Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp526779lqb; Fri, 24 May 2024 06:04:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWF2AKTZukntAaRwIeD8nmBsgphOLzt8oO/qUz/Wux+u7Jo0ZguPEJKeRWCdPZhGGT9LFKz9BZRIGS/hdVKx+PcihzJafiWiBTcHqgkSQ== X-Google-Smtp-Source: AGHT+IGCuxbq4I/Y9pVYRuY3rr43EkpQX9duDItNi8N8LpYcM8ZF9HjdWRsN406nTd3lqvXUKYsJ X-Received: by 2002:a17:902:d482:b0:1f2:ff28:c751 with SMTP id d9443c01a7336-1f4497df4demr23287635ad.47.1716555846700; Fri, 24 May 2024 06:04:06 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c9bb4f4si13647675ad.480.2024.05.24.06.04.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 06:04:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=gJhkDoJp; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-188706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188706-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A6B54B21903 for ; Fri, 24 May 2024 13:03:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D225586AC4; Fri, 24 May 2024 13:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="gJhkDoJp" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F08F685639; Fri, 24 May 2024 13:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.73 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716555821; cv=fail; b=YKgDyRejX+RXDsM0FM88rll+FRVpqbIi8anHUtWLov8ky5V1Ey1T++rxfopxUd8hEcKWpyTdu2X0saeSTKG457M433mreiHPQqjjuSP/NHygO21idhYsir5VvUEKJjC0eWO4V1Dou0ydgAOYp1A7kFeXj4hsfot6wqicDbEuVqM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716555821; c=relaxed/simple; bh=j08HojIfWV1S22CJ/e09qTPNGHaYJuhWnvM3M7cMggY=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=s7KxY9HQ0KM1HW9BZWrWCxujmeehh7/PM2FhpVY+zIDTziE4tfu9A8ZhqHlGvXjjWUudZhA/ADy90PLXd7ABAAT2HdwHczhfOMfdS+HKGKRenxgugLpqiMq96IxN89G1J1wb253XKsKrSSrWIvJ6e/83PFXofVCqjVjqnJ2ScY0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=gJhkDoJp; arc=fail smtp.client-ip=40.107.92.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H9UhKo6lk9xfPmEFwuN7hi3IrxpkguE9bkZR+BtQs+XB8K7+9OZQTo9Nw6eoNq5UpOE/3G0P78/WBzMXKxFAb9qEKlYtgAzGSim0Xkmp3YQr3Deom4jvdjWmR/5/zIsiIeAbFmd5hB/gLV4s2tEi4IcStjVX/I4fWtrVZh3o0GI83LTvYqpba7tsi6dbUrXXmmFl2TUHhyPVJeNksf/fHnBUbQ/UIYXsbUYRheTfDJfXQ4jnBB7YwNbPNizpVFkUs9O451owshaqf+PEaqOfANjPHXdU9WCm+w6xJ8ReHK0GqDLeQn/61ZmR70xWFytRam39qzDZWNZcuW8SKtxhcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=w7ODNHpiloVQMVboE5b0UlwFX7pEya+TAa9P8NHXK9k=; b=SVvx+oaWEfLyZQEywScE0aNqnm2O6tLyH2DzEunJsb5WsuDToDHkx3u0yTHmC/Lp+jpKj+nhaIj+WYthxD6yKG5DuLXl3joW4RW1694XJqCkQTBrxyrxl9N3+LdrAoqQT7QE7WPTtdcjfKHZl1DzMMfXAYnOSZHWtzrAOedK//p9ngqapPdwJ5GoqHS0N4/NMn+zHGAT5wCJq1UEnPcCGQpLIr63f8egtHea5snsc0T5SqHzwIzEoBAqqiNSiefVrvF+ueMvvWHWratTK9sAZWYzk5h4caat+V8Mn6pKsaG/9Z8La1oiep68FWU7sStrgm7Z9TzD/7LDIZ2aM6yZZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=w7ODNHpiloVQMVboE5b0UlwFX7pEya+TAa9P8NHXK9k=; b=gJhkDoJpALGIhCDSMqIO4k/AWWilVdjfkm/4CEHtAgb0KCwixHIe9ai/U6PFcM85+4jlLQOIsgImgZi8+OAg5wZAgaUTIn+EbSvLGQfZBL2yHRfjOdqnSK+Ljb9hx2DCdI0AHxPWYAhWOTMKUEXluzZcYVyAqH8XhfhYKyYjph7fqMyJgDPQJoxPfSCmGKmMLWL6G/ECPLyhaChsH7oSEzbt3mJWuaPEeM88g3dJ2obfzozcAgA6gmYOejTPVEa6271+NWOTJnlAio8/0QcIdnaNCbCw3p/vxbewvq1hKV5mUbTMr9clw6b9rSTLaXSbYFN4D1pU4iL+fgMyd7DMLA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by PH7PR12MB9126.namprd12.prod.outlook.com (2603:10b6:510:2f0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Fri, 24 May 2024 13:03:36 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e%4]) with mapi id 15.20.7611.016; Fri, 24 May 2024 13:03:36 +0000 Date: Fri, 24 May 2024 10:03:34 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Nicolin Chen , "will@kernel.org" , "robin.murphy@arm.com" , "suravee.suthikulpanit@amd.com" , "joro@8bytes.org" , "linux-kernel@vger.kernel.org" , "iommu@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , "linux-tegra@vger.kernel.org" , "Liu, Yi L" , "eric.auger@redhat.com" , "vasant.hegde@amd.com" , "jon.grimm@amd.com" , "santosh.shukla@amd.com" , "Dhaval.Giani@amd.com" , "shameerali.kolothum.thodi@huawei.com" Subject: Re: [PATCH RFCv1 04/14] iommufd: Add struct iommufd_viommu and iommufd_viommu_ops Message-ID: <20240524130334.GQ20229@nvidia.com> References: <8610498e3fc00000e78bb9cef6fac9f6a54978a4.1712978212.git.nicolinc@nvidia.com> <20240522133905.GX20229@nvidia.com> <20240523125856.GL20229@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: YT3PR01CA0014.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::16) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|PH7PR12MB9126:EE_ X-MS-Office365-Filtering-Correlation-Id: 02c56586-634c-4fa0-e98f-08dc7bf1ec51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|376005|366007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Wjx28QuHkQez1niGwSX7kxVCynP5GvubKD+wTngnctk7bwwJBLaWCqcQlwWk?= =?us-ascii?Q?7eyb9Cz+Jx/ScIs+E768FAGG2Djdy1zF9JIQeyLnHqD9cJ5+iMYWp4zhx9TX?= =?us-ascii?Q?sM6F/pGokeygKVhUA1aJPFZdk/IQyvsnQnMYB1N+RCoGfYLvccV1WKH/QwD0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oQlh3r1WQXjRzKmsyZ1B9f9uz6jhm3WpKXjRp6G8s?= =?us-ascii?Q?5b6SyrGgj3Fe7E2yYzFG/YoCZG79uEQ6p9Qu988DkNe0g7O8npcRZ6k4y7MZ?= =?us-ascii?Q?AI6VCLLIWEQ6x1kB25zBBobNVnT9F/TipJRoIjY7hHOaxfutIpNI+PIvI3cf?= =?us-ascii?Q?SfGtATH1VA1iujAmwYxG8wZnfAUOhBtVeZc5lSQBqdnyy0SDFIwwzlhU2hLb?= =?us-ascii?Q?QjqhLOmCXraBMCHCHwAYYMp+EXoIbr5qoLAaRQ43jQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(7416005)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1oWZn3ZNGyyrlPnm+ayWvU/dpJN731zdbnxqq7iZ17jdEbfz3kfUAiN7Tt5n?= =?us-ascii?Q?ae7LhuOR0ih/KnZvjnO6Z3q9GbcDdLeUCezU7VH/5HBE0lwsR/L+ax6xBv40?= =?us-ascii?Q?a5D5N9v38HAW+gCoBKAH8o5x1erolNDmbg/t9X5XkPpKOtTUWwzf82PMqung?= =?us-ascii?Q?nSk8eltKRIN6VGmtQ3ApQBYKjlpslV/4MJdSLbR6uxWdOxYCqHjZ2xpZnk52?= =?us-ascii?Q?OGIMGA1WprVWvovWiv4vDxP87+8LoY46/7SdrSDDXQ8wOGLvUGbWTkQaTByC?= =?us-ascii?Q?B44VVkXCnReGi0TaxRtREu81TB7kunC6GwcMATPv8fqMrpfjmRAhib1DBk7K?= =?us-ascii?Q?SPltnJnz7KzZVwjH68j5wz1CLDpK8R88ARPAYoKtBv252VFwsS6/WyFboxp1?= =?us-ascii?Q?J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LhSBl0HEsg?= =?us-ascii?Q?Hv8OugHm2gTPW7jLQjyA+bsHZofzNVnKWQm+TM22hAYXI4GyDu0cDPNXhR86?= =?us-ascii?Q?jrEjraWUIvFPWmrPBe8dZrrL1/yJIDApQkqZSbm3nUg5tBMAux9OQ8SJ0mJu?= =?us-ascii?Q?ede7qgs/pcLpVnwLHs3WmxviIuLtQua/Yn5HKw7jneYmnQv10dUqmmko+wSj?= =?us-ascii?Q?YWb2OHu+1jnIfZy6Rvxi3rxYoh/9Rsa6E8mJ8BECAVZzvcAyRcCE3J2vkqCs?= =?us-ascii?Q?YcbWM9IdEPdceugQYME+IYIW8SL+hGgHK+0HNhJO?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02c56586-634c-4fa0-e98f-08dc7bf1ec51 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 13:03:36.3652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vxYmvKOz9Zg0P+IrXOtna+UdVJRHFQYfJM9mlhUwLDn+/HZo8TSk2WksS1vVYd4E X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9126 On Fri, May 24, 2024 at 02:16:34AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Thursday, May 23, 2024 8:59 PM > > On Thu, May 23, 2024 at 01:43:45AM +0000, Tian, Kevin wrote: > > > > From: Jason Gunthorpe > > > > Sent: Wednesday, May 22, 2024 9:39 PM > > > > > > > > The driver will then know it should program three different VMIDs for > > > > the same S2 page table, which matches the ARM expectation for > > > > VMID. That is to say we'd pass in the viommu as the pt_id for the > > > > iommu_hwpt_alloc. The viommu would imply both the S2 page table and > > > > any meta information like VMID the driver needs. > > > > > > Can you elaborate the aspect about "three different VMIDs"? > > > > In SMMUv3 the cache is tagged by (VMID,ASID) where ASID is completely > > controlled by the guest. > > > > Every time the guest observes a SMMUv3 instance it is allowed to > > creates its own private ASID number space for that instance. The guest > > could re-use ASID #1 on two instances. > > > > So every SMMUv3 instance plugged into the guest needs to have its own > > unique VMID so that the overlapping ASID's are disambiguate. The above > > would create a VM where: > > > > deva -> vSMMUv3 #1 > > devb -> vSMMUv3 #2 > > devc -> No IOMMU > > This assumes that each vSMMUv3 instance has only one ASID space > i.e. the guest cannot create multiple VMID's itself? Right, the vSMMUv3 in the guest has no support VMID at all. > > I assume the vPPRLog will steal all the PRI before it reaches the > > kernel, so once this is turned on Lu's path won't see anything. > > Okay, then we expect this vqueue object only for HW acceleration > while software-based fault logging is still routed via Baolu's work. Yeah, I think it mirrors the invalidation that way, we have a SW invalidation path and a HW path. The PRI is standards based so it is easier to make a generic API for it. Jason