From mboxrd@z Thu Jan 1 00:00:00 1970 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 98511CE7CF8 for ; Tue, 1 Oct 2024 08:55:51 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:CC:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VUtBzc50RdH+EFt2YLXMObkUbfdaMdsP0sTO6Y/RVg4=; b=Q89dIlnUyVDTxBa+Zn3ite12aK hRNgg1M3lOn4I4kYRNzrbu3N/SlWOolZQXtrVG6kkvWtx+dWE59HHWC5sVa6kEwhbx/CBQejzB2dQ aQGUQbAlyxejzHhIILswoYLgurZd5AlfBvz4v5y8CdSfDv7lDyA0BrOCjAsx8hO2xiRQOhtvXhklR OG1wssp+LD7m7B6rk/PKMWRmf8Qfbo2NROGyzLbeT+s5/lTjdz/SRB8HiKS7fSvCZ2Av05Q9tzxl/ 0+v4uA5/QpB8m6iNl/fmYN6/yiR7JolJjgO2274n2OdTlCua/oZmnKqb5IifAS4x4rSz+tPH/D88n fShBpyHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svYfR-000000028yu-34C3; Tue, 01 Oct 2024 08:55:37 +0000 Received: from mail-sn1nam02on20629.outbound.protection.outlook.com ([2a01:111:f400:7ea9::629] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svYeD-000000028i5-1i45 for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2024 08:54:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bRHpNtSWogwiBr5yk0+IL62C2DhTCVgQHIwfAdMvfARASBb0fMgc9a7imxysosynfsBAnxKRkJpUZhNQ0S6V2i+DE2biU/EZ5yJ4IcJU8MhudU8uYGocJj0ZFGYaUNxfKzkZjDAFDfjQr+zg3ODwCE/MK9O/NJO1+N+g/8rC84s/5sVUS+M7qQ+E9969jdpunSPCrER1bClzC7hYJA5E0nf6Wov7ZvXLbZTZoWuT50RiCmm78XnQr0lKTv84UV6/YvT8wt4efNg8AF1l1XdNtGt8+sbSP5sIZGyRD0nZ0X/YKUlQ1i85FckHhbau3Qv/ViYyGPu2TwNcI7WcR0Ra/A== 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=VUtBzc50RdH+EFt2YLXMObkUbfdaMdsP0sTO6Y/RVg4=; b=XDB18NLFUH7XI3AiH+sfPsrT1dXdW9Nk0IQAhe0+i+QnA5AhmLIRUac5D6Sb871R0lpccT4BYQ0NpMyXrfpnNx/e1d2oJ6ukqBY7mxbfEOVLCBGP4T0+ACcfp0Y25eT+825WavNWQJrqJsoUkwzq3GibCsIcLdbR/jyXhR+qNu3FXSCjtcg0S77k5eeuWMFNrzXkFMyh9mWeai50i7+6dd0x8cNWH5Cuc80fTHqkepf4bPO1W1X1CCA0ptlEu2f04s89khi63SZuh6QsIvRvgNXuKhKQxqrKzw8jjdRGusb9wgmyRvD3StEHb7HY9fk3Wb92Nyb0tTUTSCsBA2qeCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=huawei.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=VUtBzc50RdH+EFt2YLXMObkUbfdaMdsP0sTO6Y/RVg4=; b=qtValy6aJ+QVP8bW+NjTyBwuUVKDhWLLWSdA0xI/R9r4OFpphB4ylP+ATbTel/AU319TY5Iidzol44pxA/Vmxh7ywDtkq6bqDNZgFla8kQ7KQYLdDnKsXIKStMsC71nZjyPAqKFDAklFGWM3Bm/7zF2lZL9/uMEVIYSftOH4ci1X9ouLBqHKGFyYmDVxJqx0tmCq3ZS47ON8xafE9X7Mdw5TCYTvp9PPeMdyEn6/If6BJIUg8AvbRfhE4vHOLvGfuigXRnT4TVOjBUMZOgN/cT9p7NVG1ZhWQhHgYgVbPNeeg4ETGMwyb3RvF6Xq+ocVAIRbH+wzjqtXR7VmnloAPA== Received: from SJ0PR05CA0074.namprd05.prod.outlook.com (2603:10b6:a03:332::19) by CY8PR12MB7564.namprd12.prod.outlook.com (2603:10b6:930:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Tue, 1 Oct 2024 08:54:14 +0000 Received: from SJ1PEPF000023CD.namprd02.prod.outlook.com (2603:10b6:a03:332:cafe::91) by SJ0PR05CA0074.outlook.office365.com (2603:10b6:a03:332::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.15 via Frontend Transport; Tue, 1 Oct 2024 08:54:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF000023CD.mail.protection.outlook.com (10.167.244.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.11 via Frontend Transport; Tue, 1 Oct 2024 08:54:13 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 1 Oct 2024 01:54:08 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 1 Oct 2024 01:54:08 -0700 Received: from Asurada-Nvidia (10.127.8.13) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 1 Oct 2024 01:54:07 -0700 Date: Tue, 1 Oct 2024 01:54:05 -0700 From: Nicolin Chen To: Jason Gunthorpe CC: Dan Williams , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v2 06/19] iommufd/viommu: Add IOMMU_VIOMMU_SET/UNSET_VDEV_ID ioctl Message-ID: References: <6348cc7a72ce9f2ac0e9caf9737e70177a01eb74.1724776335.git.nicolinc@nvidia.com> <20240905160353.GP1358970@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CD:EE_|CY8PR12MB7564:EE_ X-MS-Office365-Filtering-Correlation-Id: 28f30d74-aefb-4f18-1f9c-08dce1f69fa4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hv219JXzZBwJSWw1HjzOR2wWGuVXQG1hDGHZUUcrdiS9boRdK3liuWZrCe83?= =?us-ascii?Q?JrDCbq7jCpWTovSzpMwGWcl8o+Qj9RBPuyLtYUZbbBDUMrxz4q9nbD8EsAqL?= =?us-ascii?Q?za1vjD6IwhFl10WmwnFOMYjKXvdUyu66JnwMHUYRu3B5LNzEG/s63UVzkn5B?= =?us-ascii?Q?9r6xnhxhNah7O3ghANZPc+24+Osg6/Hi20ivjNlpOO53HkF384/UWTmJaJ1+?= =?us-ascii?Q?tuOYjhFNDDiPlrE4laIrjIAT+1gySOXsH0yesM49wgP31nC/VWONkm1IVYiW?= =?us-ascii?Q?cYVISvtlcpGzI3t58rI3apsyB0+OMJYQm57CyWfG9gxM2eELAMjWd6SRJYQa?= =?us-ascii?Q?lf/Zy9Ww04fztMk6ET6gQvrxAPiEDrJ4jD2JgdlAeBu2LvMB1K5DZpoN+h+5?= =?us-ascii?Q?DQ7iynZVarNkh6XqMQFDjwq9Bk+k8YeBvAhqh3WXoTdGtsNIqiOBmOkJ1UHK?= =?us-ascii?Q?6auLkrbXIjS13IEWgH4yzgyY5LyOM+rwyegu0ZeVRrnnaHpO0sPJC80SUZil?= =?us-ascii?Q?xWU0Tcj3uqIoSoak9d1Z8q60nz3unnEN6bhrAy196s16XjpMHLZA0DsUWTP5?= =?us-ascii?Q?8VFDh+PEjQCNcjqdhAI7NXVhqRJtmYqN36kgbsUCddLMZqkfUBSQIaZKk97Y?= =?us-ascii?Q?G99Uw9veLD7iEfdk8N7csS0MGhHnrUamiSASAa/8Bs7j6TgZlsICrlDk3vg9?= =?us-ascii?Q?vllc3FZAhhGqgS/NNityeicUOUOT0/syMP2cAYNxEoxqRizusCF/ZZxHOaIs?= =?us-ascii?Q?cDSyKgudqGZ2gRDMx5TlfkqxlAeS0dHarAyqxljtmShC4KeSHpf7n0fwFUZr?= =?us-ascii?Q?EwHAXhgad+jUNfG6Z9StaVpxHFP3a2in9Ez3DTbVkWGRRRWzd6addS/8ptLE?= =?us-ascii?Q?u+YGty4HUfPge+dzXuAs3M6AtBeHnrZTz5F6WhHTCikab/toPJasUdkqIWzJ?= =?us-ascii?Q?jh8oIBm2icrI0ClrS2MPbqwewf9EaXQBesqr5/WFUl1IbL2A/fjAXjOx04pk?= =?us-ascii?Q?tlCgYv0S/rOkZwwTxzUVVHhMKux66xSpAxViy9+uKFrOfzFSog6ic4M3Z6Xg?= =?us-ascii?Q?mmzViaQDAh7ovx+WwIPhN8qu+l26FvjTXDFHiuGZCkTmjOyhXPM6ZADDG3aG?= =?us-ascii?Q?afn752qybakFWmQb58Pmy804WFD6Awt3fuTqFUzOlJZhE6hbsqf/Zi1g6MC+?= =?us-ascii?Q?YCwQBHypnapkRkusydJ4GBGMNT+nnC5pmI2Zw7MhsCT6gLrd5F4cSm/DJ6wp?= =?us-ascii?Q?WQ8K3de+NrJdszwt9X0B+WjPREjMKz6cl5Flkuiglt9Mwkpwbt0k6GG98Kdt?= =?us-ascii?Q?tHsTJNChaeY/goDjfqam037ukgp7wtyGH7adMFKoZMP/p/pUgX//5J4r94R0?= =?us-ascii?Q?URmyMsVCE93JXyGofpm6JT3YMoPh+zCbm3bwDQTmzYC64/uQFuEuCSzGlv0W?= =?us-ascii?Q?JZMurQidBPenoNR5/yCQTWnsHosHW1Zv?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2024 08:54:13.5993 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28f30d74-aefb-4f18-1f9c-08dce1f69fa4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023CD.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7564 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241001_015421_462088_11AE6689 X-CRM114-Status: GOOD ( 29.28 ) 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 On Thu, Sep 05, 2024 at 10:38:23AM -0700, Nicolin Chen wrote: > On Thu, Sep 05, 2024 at 01:03:53PM -0300, Jason Gunthorpe wrote: > > On Tue, Aug 27, 2024 at 09:59:43AM -0700, Nicolin Chen wrote: > > > Introduce a pair of new ioctls to set/unset a per-viommu virtual device id > > > that should be linked to a physical device id via an idev pointer. > > > > Given some of the other discussions around CC I suspect we should > > rename these to 'create/destroy virtual device' with an eye that > > eventually they would be extended like other ops with per-CC platform > > data. > > > > ie this would be the interface to tell the CC trusted world that a > > secure device is being added to a VM with some additional flags.. > > > > Right now it only conveys the vRID parameter of the virtual device > > being created. > > > > A following question is if these objects should have their own IDs in > > the iommufd space too, and then unset is not unset but just a normal > > destroy object. If so then the thing you put in the ids xarray would > > also just be a normal object struct. I found that adding it as a new object makes things a lot of easier since a vdevice can take refcounts of both viommu and idev. So both destroy() callbacks wouldn't be bothered. While confirming if I am missing something from the review comments, I am not quite sure what is "the thing you put in the ids xarray".. I only added a vRID xarray per viommu, yet that doesn't seem to be able to merge into the normal object struct. Mind elaborating? Thanks Nicolin > > This is probably worth doing if this is going to grow more CC stuff > > later. > > Having to admit that I have been struggling to find a better name > than set_vdev_id, I also thought about something similar to that > "create/destroy virtual device', yet was not that confident since > we only have virtual device ID in its data structure. Also, the > virtual device sounds a bit confusing, given we already have idev. > > That being said, if we have a clear picture that in the long term > we would extend it to hold more information, I think it could be > a smart move. > > Perhaps virtual device can have its own "attach" to vIOMMU? Or > would you still prefer attaching via proxy hwpt_nested? > > Thanks > Nicolin