From patchwork Wed Aug 7 20:10:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 13756704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BF91C3DA7F for ; Wed, 7 Aug 2024 20:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0HFa6QLMqlPOiy/eJ/OPp7DO2RpkYF0EwEmAbfXRoto=; b=cE7NMYRdatQMSEw2uiGmm8L05b itozND/ZiMswZ7JMACbXogkg2Zfwz20/2SLPK0HJnbpzhMqGI1rReDsaa3uwb+xRg+yN6ch/ekNxG Cye9v7hh7ZcHmd8vkunMPz9omYQ87NyM/Svs/AQi96JUGF511HLkht9RC3iL4ReeslAx+wACsnZ8+ 6/NHacM19Ho1Mhd2L/5wkSJoukojjn9c+GPjBpfuMbAXi5zkcHS4cgCKVAn49o1D8PixRcagh6sQQ pCDrTbrbl3KZ7QxZoUjbsVICK4lwyb8v/2b55LcLfhffmb6Y/riQjVpGJOUmCLGhZiY0o7P0qI3qC /sxXDS5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbn2g-00000006A4Z-32zO; Wed, 07 Aug 2024 20:13:54 +0000 Received: from mail-bn7nam10on2061f.outbound.protection.outlook.com ([2a01:111:f403:2009::61f] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbn0O-00000006988-1AFo for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2024 20:11:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r4PiXV3MW+qiOSSpxwRbQ4AVlEBsQ9ftqXaa6OSSRI9szzWucf6dixKF0gkjm/xTj8Nrn0y7k0IdvIZiP7KZSzqHTkEQutzeB4f9lePIHlVU+8aqRQZ+bXn2bMJ59VmEb1LzRetM4X1K1YWKDjafUc/DUQQODQrS3wHdyCr5K3jbZ0/ZBbDQ6NPJGeTrPyh0wwjr0hjtZ0vq9cTEQR7YNUWnxFrndsGRFnPy2sOMqlGCjup2Cu6ePRjEhBS0JowTltrdlRizDztpFfSKaKnndzxoBsGsG16P+LDSbSjtvuAmA4MRVDpR3TagyEf7SZpTXFmTi9PluutwajzFYfk2Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0HFa6QLMqlPOiy/eJ/OPp7DO2RpkYF0EwEmAbfXRoto=; b=zARq1rzitZ/gXUaQhbuFCyprKj3P/2+FBZ5pXtvHNwaREjjQzMy29WCnK3jLdUki/IPQB/4+h9hA9K+DvXw7yrF4pPFob/pF9wspFNpKW8X4zxWH4hFpIhPeKbt+47heY9a/Gh1zXP1Jp+Ltp4H7A96kMQzFB9OzEW6Onvpfa759g5Gm8WlHO7wInDnxv3lavnuhcQV1BNDhXRASg212RP/LaodIth66bco6AD8Cj1LNIAVhaaaZWNSqmEhipwOQ3vhmVUQ1QjWrXvhm0DtnLTzQA6/DUAu7wwB/FI6uPPJ3pcMKpTonSE9bacdLGT3FLxBE6mBxp/x3txpj+c9R/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0HFa6QLMqlPOiy/eJ/OPp7DO2RpkYF0EwEmAbfXRoto=; b=ajeUVhfJnZrsnrOHtZ6zySlqNU6uJD9/iXaQaZw0pEhVsY2l/vYy9h0OB1g+gWAGh0l4jFaZKIwSMJ+XLwnmW5CoA0c7sOMOV+mkJZRJuDDc0jcwfwDp4+F62qTXeGb0BRUkM1V/dwi8bTnJKaCMuemUH6hpTPreoBdI6AXy6lke3p2RJjQqp+Bm0g/3xBVeotaS02eImmUpglbaHSW2wZLQkreLMUQYaV3c/qTz3Qp9Vbp+p8gpW1rKVtNyFOZtaop+fx5V4KBqOVh6VnTYr2g2+2fR1oL9v+0Ue5ImOV6b5HFjZu67atxkX23kUejdLPwCnRaWbYBT/Rksq6sMlw== Received: from BN0PR03CA0004.namprd03.prod.outlook.com (2603:10b6:408:e6::9) by DM4PR12MB6256.namprd12.prod.outlook.com (2603:10b6:8:a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.26; Wed, 7 Aug 2024 20:11:24 +0000 Received: from BN2PEPF000055DF.namprd21.prod.outlook.com (2603:10b6:408:e6:cafe::f5) by BN0PR03CA0004.outlook.office365.com (2603:10b6:408:e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.29 via Frontend Transport; Wed, 7 Aug 2024 20:11:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN2PEPF000055DF.mail.protection.outlook.com (10.167.245.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.2 via Frontend Transport; Wed, 7 Aug 2024 20:11:24 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 7 Aug 2024 13:11:07 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 7 Aug 2024 13:11:06 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 7 Aug 2024 13:11:05 -0700 From: Nicolin Chen To: , , CC: , , , , , , , , , Subject: [PATCH v1 01/16] iommufd/viommu: Add IOMMUFD_OBJ_VIOMMU and IOMMU_VIOMMU_ALLOC ioctl Date: Wed, 7 Aug 2024 13:10:42 -0700 Message-ID: <536c5e908af3847649d1f4b7050af17d77d8b524.1723061378.git.nicolinc@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DF:EE_|DM4PR12MB6256:EE_ X-MS-Office365-Filtering-Correlation-Id: ed7b691c-367f-494a-b116-08dcb71d1cd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: 36VOfOefxPjmIgCZzs2BLv2V3sB78ae5ZFtT4agoecC1sDsOtIrg6vjAX3DCAmxt2hfwlibGcT4KlZuEY4Ud72BZVsjwK1fMXOBkEmkwCGPeQJR0nDHCK0ntgiHNkvThoHQIFIg5H+itkOr0Z0LWA2D5CANHORKYCpGRdOsN7x2Tz4WOSu2RVNjURHbBIS5X7gcaai4sgXktIih9cY+10UmQN0TD44rh7IN9jIeyv9bvDSgJ+ZLYMzrVSUQodQ4sXaqDCBXbD7RWLzdRT/Zqz6G5MQo4MVF/KtugNtiMQuAku+t18OzzEUZQ5oB1nyu0khmpaYH+jsgnsSdALgk3KJGamjMl0X1h+48ftkUwobeWuvVQukqV/PUZBoENbPjBirur62l1UDTOMPFvQjrlCBPSzhan+k82wONrggjOLO5hMOZR6q17ncFev2bNprtiajNPod7JllvIDP5x15eTfaFrL95dXUjSvwKgPpyM6ymZWzn0aU8XCFjzFVNpozIrcPp/AS1booM8JP6JQa/mWvNiSsvDA39zWTnFcf8a9D+9rdF2zPyM1Qs7AhZ8KlVygDzH2sKpshpuLU86HEz8lbjMRelSzTQLLUR3qDUOOv08KZD9B7rq6+fezajbothHNaQg8N900y3Vd1eIFGCPpEePRjkOJU93ry2t/bIUQUsj6E0rDfWoap86qzs1QDD4Isn7rj6nysWbeNIb2Kvt9lkKzpZWkasBHt22RFLJcd1nIEFLLchxdeFB8MBhL9hD2z7dOY4cCmYqzIwyjzXaGdlQEtTonb8bvxONTiD9REGGZvdpAvOqfsTn+5+nYIgPu5ABeDUSeKfYsbeQIIDTMj4ZXFPIC5q0/uSzSY40RCgnt5VyS0oLylDCbg67Q5/KaRDLwsFqbjqL4Um/KTZou5LlOIVOnetZGEPirPeOImVNMsvYot1F7eLNqkOCmXAsdRqmUibK9Z4nCVUqdVmzLJtbCNPUcTHgby2LT4RZf4PFwh6EvCsOzyFpbRZQuBARVU369kREpbHW9Pr6EVZr6p/xu8zfOFk2d5exhNXGVOW1gf1BQYvp+CN64S6wsChzc+DHo5uhj2fkvEoikiIKCSnOBq7y5m7mifN3swM2vIc8vd0SVQhy7a3xtiqGoFhikGZaETfvZv+rYkSfJXi0G2/jkqybFixMsq2E2Vr55WthgajXb0+2UQ2ATlGeg6Kgem/wZQ9Q3C1iqvHGBszMwlJ9skmx67zvg2cX2xCf1J41bsfE+Ta/WhqeLKvuVhoskTJcjae52P8/ut6Y/xItOFO12qVpycGFbsNDG7/wy8w9y7YQW7o3r0RoF5sL4r9IgSTpRo+KAopMaOvgR9sbEroluGmQPyKuM1Xm/ebiGYLl1eN+CwD6f+Ktzs1EsgSOUxJnzZQKdHrEovkhPIrXZmwIckpVXnsQHk6NJ021rfIARM+IpKASpC4iq9Cye/dH X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2024 20:11:24.3195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed7b691c-367f-494a-b116-08dcb71d1cd4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000055DF.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6256 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240807_131132_423830_7FFD63F6 X-CRM114-Status: GOOD ( 22.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a new IOMMUFD_OBJ_VIOMMU with an iommufd_viommu structure to represent a vIOMMU instance in the user space, backed by a physical IOMMU for its HW accelerated virtualization feature, such as nested translation support for a multi-viommu-instance VM, NVIDIA CMDQ-Virtualization extension for ARM SMMUv3, and AMD Hardware Accelerated Virtualized IOMMU (vIOMMU). Also, add a new ioctl for user space to do a viommu allocation. It must be based on a nested parent HWPT, so take its refcount. As an initial version, support a viommu of IOMMU_VIOMMU_TYPE_DEFAULT type. IOMMUFD core can use this viommu to store a virtual device ID lookup table in a following patch. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/Makefile | 3 +- drivers/iommu/iommufd/iommufd_private.h | 13 +++++ drivers/iommu/iommufd/main.c | 6 ++ drivers/iommu/iommufd/viommu.c | 75 +++++++++++++++++++++++++ include/uapi/linux/iommufd.h | 30 ++++++++++ 5 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 drivers/iommu/iommufd/viommu.c diff --git a/drivers/iommu/iommufd/Makefile b/drivers/iommu/iommufd/Makefile index cf4605962bea..df490e836b30 100644 --- a/drivers/iommu/iommufd/Makefile +++ b/drivers/iommu/iommufd/Makefile @@ -7,7 +7,8 @@ iommufd-y := \ ioas.o \ main.o \ pages.o \ - vfio_compat.o + vfio_compat.o \ + viommu.o iommufd-$(CONFIG_IOMMUFD_TEST) += selftest.o diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h index 5d3768d77099..0e3755408911 100644 --- a/drivers/iommu/iommufd/iommufd_private.h +++ b/drivers/iommu/iommufd/iommufd_private.h @@ -131,6 +131,7 @@ enum iommufd_object_type { IOMMUFD_OBJ_IOAS, IOMMUFD_OBJ_ACCESS, IOMMUFD_OBJ_FAULT, + IOMMUFD_OBJ_VIOMMU, #ifdef CONFIG_IOMMUFD_TEST IOMMUFD_OBJ_SELFTEST, #endif @@ -526,6 +527,18 @@ static inline int iommufd_hwpt_replace_device(struct iommufd_device *idev, return iommu_group_replace_domain(idev->igroup->group, hwpt->domain); } +struct iommufd_viommu { + struct iommufd_object obj; + struct iommufd_ctx *ictx; + struct iommu_device *iommu_dev; + struct iommufd_hwpt_paging *hwpt; + + unsigned int type; +}; + +int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd); +void iommufd_viommu_destroy(struct iommufd_object *obj); + #ifdef CONFIG_IOMMUFD_TEST int iommufd_test(struct iommufd_ucmd *ucmd); void iommufd_selftest_destroy(struct iommufd_object *obj); diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c index b5f5d27ee963..288ee51b6829 100644 --- a/drivers/iommu/iommufd/main.c +++ b/drivers/iommu/iommufd/main.c @@ -333,6 +333,7 @@ union ucmd_buffer { struct iommu_ioas_unmap unmap; struct iommu_option option; struct iommu_vfio_ioas vfio_ioas; + struct iommu_viommu_alloc viommu; #ifdef CONFIG_IOMMUFD_TEST struct iommu_test_cmd test; #endif @@ -384,6 +385,8 @@ static const struct iommufd_ioctl_op iommufd_ioctl_ops[] = { val64), IOCTL_OP(IOMMU_VFIO_IOAS, iommufd_vfio_ioas, struct iommu_vfio_ioas, __reserved), + IOCTL_OP(IOMMU_VIOMMU_ALLOC, iommufd_viommu_alloc_ioctl, + struct iommu_viommu_alloc, out_viommu_id), #ifdef CONFIG_IOMMUFD_TEST IOCTL_OP(IOMMU_TEST_CMD, iommufd_test, struct iommu_test_cmd, last), #endif @@ -519,6 +522,9 @@ static const struct iommufd_object_ops iommufd_object_ops[] = { [IOMMUFD_OBJ_FAULT] = { .destroy = iommufd_fault_destroy, }, + [IOMMUFD_OBJ_VIOMMU] = { + .destroy = iommufd_viommu_destroy, + }, #ifdef CONFIG_IOMMUFD_TEST [IOMMUFD_OBJ_SELFTEST] = { .destroy = iommufd_selftest_destroy, diff --git a/drivers/iommu/iommufd/viommu.c b/drivers/iommu/iommufd/viommu.c new file mode 100644 index 000000000000..35ad6a77c9c1 --- /dev/null +++ b/drivers/iommu/iommufd/viommu.c @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES + */ + +#include + +#include "iommufd_private.h" + +void iommufd_viommu_destroy(struct iommufd_object *obj) +{ + struct iommufd_viommu *viommu = + container_of(obj, struct iommufd_viommu, obj); + + refcount_dec(&viommu->hwpt->common.obj.users); +} + +int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd) +{ + struct iommu_viommu_alloc *cmd = ucmd->cmd; + struct iommufd_hwpt_paging *hwpt_paging; + struct iommufd_viommu *viommu; + struct iommufd_device *idev; + int rc; + + if (cmd->flags) + return -EOPNOTSUPP; + + idev = iommufd_get_device(ucmd, cmd->dev_id); + if (IS_ERR(idev)) + return PTR_ERR(idev); + + hwpt_paging = iommufd_get_hwpt_paging(ucmd, cmd->hwpt_id); + if (IS_ERR(hwpt_paging)) { + rc = PTR_ERR(hwpt_paging); + goto out_put_idev; + } + + if (!hwpt_paging->nest_parent) { + rc = -EINVAL; + goto out_put_hwpt; + } + + if (cmd->type != IOMMU_VIOMMU_TYPE_DEFAULT) { + rc = -EOPNOTSUPP; + goto out_put_hwpt; + } + + viommu = iommufd_object_alloc(ucmd->ictx, viommu, IOMMUFD_OBJ_VIOMMU); + if (IS_ERR(viommu)) { + rc = PTR_ERR(viommu); + goto out_put_hwpt; + } + + viommu->type = cmd->type; + viommu->ictx = ucmd->ictx; + viommu->hwpt = hwpt_paging; + viommu->iommu_dev = idev->dev->iommu->iommu_dev; + + refcount_inc(&viommu->hwpt->common.obj.users); + + cmd->out_viommu_id = viommu->obj.id; + rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd)); + if (rc) + goto out_abort; + iommufd_object_finalize(ucmd->ictx, &viommu->obj); + goto out_put_hwpt; + +out_abort: + iommufd_object_abort_and_destroy(ucmd->ictx, &viommu->obj); +out_put_hwpt: + iommufd_put_object(ucmd->ictx, &hwpt_paging->common.obj); +out_put_idev: + iommufd_put_object(ucmd->ictx, &idev->obj); + return rc; +} diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h index d42e0471156f..ed6cdc2e0be1 100644 --- a/include/uapi/linux/iommufd.h +++ b/include/uapi/linux/iommufd.h @@ -51,6 +51,7 @@ enum { IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP = 0x8c, IOMMUFD_CMD_HWPT_INVALIDATE = 0x8d, IOMMUFD_CMD_FAULT_QUEUE_ALLOC = 0x8e, + IOMMUFD_CMD_VIOMMU_ALLOC = 0x8f, }; /** @@ -876,4 +877,33 @@ struct iommu_fault_alloc { __u32 out_fault_fd; }; #define IOMMU_FAULT_QUEUE_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_FAULT_QUEUE_ALLOC) + +/** + * enum iommu_viommu_type - Virtual IOMMU Type + * @IOMMU_VIOMMU_TYPE_DEFAULT: Core-managed VIOMMU type + */ +enum iommu_viommu_type { + IOMMU_VIOMMU_TYPE_DEFAULT, +}; + +/** + * struct iommu_viommu_alloc - ioctl(IOMMU_VIOMMU_ALLOC) + * @size: sizeof(struct iommu_viommu_alloc) + * @flags: Must be 0 + * @type: Type of the virtual IOMMU. Must be defined in enum iommu_viommu_type + * @dev_id: The device to allocate this virtual IOMMU for + * @hwpt_id: ID of a nesting parent HWPT to associate to + * @out_viommu_id: Output virtual IOMMU ID for the allocated object + * + * Allocate a virtual IOMMU object that holds a (shared) nesting parent HWPT + */ +struct iommu_viommu_alloc { + __u32 size; + __u32 flags; + __u32 type; + __u32 dev_id; + __u32 hwpt_id; + __u32 out_viommu_id; +}; +#define IOMMU_VIOMMU_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_VIOMMU_ALLOC) #endif