Message ID | 6-v4-9e99b76f3518+3a8-smmuv3_nesting_jgg@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show
Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2061.outbound.protection.outlook.com [40.107.101.61]) (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 B26F86F06A; Thu, 31 Oct 2024 00:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730334081; cv=fail; b=oe6Jw4tKPlhw1lZ9K8RHHlesXY2uAxh0NWwGV5LDtpu/G+3mg4HfNpFmKESgrtDR7pQd31ktkB/OVYe8w8mDglEd+zHp7BNVtOeHill+rfim+qX/+BnJ/zLfm2vtzYdn0WEsdROZGvH0XIX+LlKnEAqnmoPGGaP3i/7tCIYz5Kw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730334081; c=relaxed/simple; bh=8HmRIQ+ob3Cujks43WszTNKg071RPE+9RsXErrb33Ds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=pXIyjxj3kjcfrLX25Ic9tYYD2NUQkt3eYNxubO5odMZBLVQPQr8dias9ojdgTREmVKIMHgTc0FJWyNY5/nogE4ecQBAeuij9Z/MnUyn1/B8FTFkyr3bkc6b+cw67J+fQhIDPgqBIUfdBngxXtb+WkDPFIA/jvlTMtlUEVDhiB6Y= 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=ckKPjqVA; arc=fail smtp.client-ip=40.107.101.61 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ckKPjqVA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zT1PajWwCdhzPFFx/fmKaOUXf2CIM5xxQYlLjsOrJSjtmP3qEOverjffeSv6Z8hyMcCd4PXgDLJg9qds6ztvPynhTOYFKIfxW1wnciYD/y5cwp3Xn32Gp0DGLgwwWF9N7fa79vndSQDvzt3llEnCDVj78+6Jm4zJU65g+ee7Ugfxzm9Lk7WOefpmr707DlrdKXnxIl3pfeVttlayJgLAlCPcS8OlWKet7DWXbJW/RPJTeetJcXhqN66ORirKbCvHTE40L4rchlbhZy+2TwNNOPFOAuqmD4ODdO5fu9eWOzrf8UbPKVnzIUil/OjO/upZpBOevvqsAypV7A8UgQ28rA== 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=AfXCICcjx/gPooceCH2idpyPNlo530cMDJUtAU51n+g=; b=wfUIEcOc9cWUEwqW4/6+ti0srA3cBtwa9OLYEtTdlQMpRZUDCFXmLVm/NAnZ2s5XWCQYWNJMBwaDIKzQWLl2TmqWDe1Nr2VlRXJBe/XLnIDEHDJVY4hEbALh7prThuyDha9JT2zwYZmwm59dW8DqzcPQZ73qV8EegsKeF/gBjQX8U8Yfe2sP9b5hUqmgXTC35c8JmPogU8k2kgpUBcLEOvnaBTGq/PLKf7Ap6vy9xfe7G8vDMgwZ8PfAvskLjHjgYB6IlbuKkk9bEA/E9TVFf8gUIHD61zQcjSKZoeRpDD2AkcwUW5LXc4nW9e7vvRk5LHR3Jc6DvxcdBqKKr+30IA== 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=AfXCICcjx/gPooceCH2idpyPNlo530cMDJUtAU51n+g=; b=ckKPjqVA5Cec7L0OVzDaQY2t5gPe23r5X7iLul+s33hQFbU0dcgcEEyBMfXRpxktsg5svW8cLzKKnEYO8exTfyO2/wjIHVLM6K23oQ1LmHVI5ThxROoaD0dDnzM+7KR1NtfG6aKEXAC6zdAMoHiUKxK9B7EjHoWGcPn+/2dywW+0LthnUYB1whQkAAfvlAn/7FyIbfx3puXd8JzPPCFJj537WbKayjO2anF1gOL6HN3DsIOjKqy0594RN1UN8swoT6GIbUvvfBKcI/jRcdtA46itjBHKgIvqgovvaMp9/D3HTHK6E15QPAawQddv78ptkZs9iDdU+3aSoUW6EXSowg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CH3PR12MB8659.namprd12.prod.outlook.com (2603:10b6:610:17c::13) by DM4PR12MB7573.namprd12.prod.outlook.com (2603:10b6:8:10f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 00:21:01 +0000 Received: from CH3PR12MB8659.namprd12.prod.outlook.com ([fe80::6eb6:7d37:7b4b:1732]) by CH3PR12MB8659.namprd12.prod.outlook.com ([fe80::6eb6:7d37:7b4b:1732%4]) with mapi id 15.20.8093.018; Thu, 31 Oct 2024 00:21:01 +0000 From: Jason Gunthorpe <jgg@nvidia.com> To: acpica-devel@lists.linux.dev, iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>, Kevin Tian <kevin.tian@intel.com>, kvm@vger.kernel.org, Len Brown <lenb@kernel.org>, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi <lpieralisi@kernel.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Robert Moore <robert.moore@intel.com>, Robin Murphy <robin.murphy@arm.com>, Sudeep Holla <sudeep.holla@arm.com>, Will Deacon <will@kernel.org> Cc: Alex Williamson <alex.williamson@redhat.com>, Donald Dutile <ddutile@redhat.com>, Eric Auger <eric.auger@redhat.com>, Hanjun Guo <guohanjun@huawei.com>, Jean-Philippe Brucker <jean-philippe@linaro.org>, Jerry Snitselaar <jsnitsel@redhat.com>, Moritz Fischer <mdf@kernel.org>, Michael Shavit <mshavit@google.com>, Nicolin Chen <nicolinc@nvidia.com>, patches@lists.linux.dev, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>, Mostafa Saleh <smostafa@google.com> Subject: [PATCH v4 06/12] iommu/arm-smmu-v3: Implement IOMMU_HWPT_ALLOC_NEST_PARENT Date: Wed, 30 Oct 2024 21:20:50 -0300 Message-ID: <6-v4-9e99b76f3518+3a8-smmuv3_nesting_jgg@nvidia.com> In-Reply-To: <0-v4-9e99b76f3518+3a8-smmuv3_nesting_jgg@nvidia.com> References: Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MN2PR03CA0018.namprd03.prod.outlook.com (2603:10b6:208:23a::23) To CH3PR12MB8659.namprd12.prod.outlook.com (2603:10b6:610:17c::13) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: <kvm.vger.kernel.org> List-Subscribe: <mailto:kvm+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:kvm+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR12MB8659:EE_|DM4PR12MB7573:EE_ X-MS-Office365-Filtering-Correlation-Id: e917b365-bd5a-4ce3-1272-08dcf941e495 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024|921020; X-Microsoft-Antispam-Message-Info: 7wLGnVtWm5E8MJPNSBBpnUipcRnbmkO81d4obyOch6oravTyAlsZ4OlUTamt3RpxvZCgZQJqBfc/w70IchPQEg7MQTh2wtFzPxwCLJ7ISa4f1dNxQx58uSe5zkl2+BKxMXPuRUZS0xz1ZxSWB/nA5xVaskLRUj8gVI8duLeR8WZdtaII7Ze46A5RgyF41R1liFDOvx53dE8u+YRVegmml3Mam8IuiPU7Rarm/VMvzDYDjxj+T+W8cLdrQ5Z9hrwtIi+scpJTBMNrd7Cs7urzsqR+oxF9goaK5HP1ZPDriYoDfFnmSc7/5aJWk/ALnc470r5dahdBxuODvJ4qLdvvYKHqJ2ED+F3TiGZgyAg5hp7MRTrYiTu1dNhYB5W8aqU9EOTVcZFaGBCpcYrjGW/z0hBLij9S6c6bJQtxHmudU7PsIAVmfXkHSm6IUSpbcI97CV8q16Ky/gGOk5v1JvQKMZqU2tTfBLXveimnhkgy+kS8cPVXXRyweoVJR762dePrAnzQsGZqQ3v9exChkBX2jaJ3LZIhlHJqasDe9767YtVkXEVpGJGtWrGBy1bqKEkzxBHe7b4VKfDwzjgmkjSNqPYmi/dF7kAIL9t8iYTjxEcmFFT2/e+oF5h2vDJnguuhLVU7ACzMX1bTIGnHGp9CF0xZBoR0CPlhyR/ajRxhYQMtbS/qy1atcBCL0AcfwgjoQPCk+S0BHLp7cG2jfsZlSvMs2dYF8wDCsCZlQSB87WMwsxPKYjhuEbR05I78DHKqhrYgADSIu1MWiEkhfYLKOfvNEAixMDXV0KtUTDSVrcwNaHLJffBFdhhGv/63krccTf0Xn1pPjXTZdnH0lvSAPKWYmbBXo/fF1myfnlk2YRmXu3mpyrrnn/4Tu3P0XxOw17g4FYslFfA22foHUmr+DsNHpXHxGrF4fRlJqSYwUa4NoARZUmg8d2zCKhNPYURviipuS0jMX03u6bCPFhthetl+/1WjQSz+f8+rt2AxF/9IdGT8bt7OnQeSyx+lfav3FbywaludECCHWkJBrBaLC9FK/aE5Pc4W0rNYjnduqcdWCjuLT6HkZpxf77ptL9ax2EkAea/BgR/Qrc6n0PJrZNAn+gfYaWVNdyJizvPhIYQn5aA88EJ4lY2R/4EG7193Drcde9I+Kmd6zlKPfHL50unOnmPjjk38K/JccrhZ3SeGE4R4d6tj1Tmn2rBHuXfF38gikrxo6MerUAL5j+ROCTY0TSf1cFRJCuriHYi0Q8p8UHFXzdYVUz5gENXLg/G0r5jpYu2SNQq1rTuBJ1hy9vT2CXMRUpKFhe8Lff+dxmDEklmu4OCrSyJoCSulond26jw/yFR21qrnFdlmzsU7P59wsICOHIKtc7LUmwpgzNo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH3PR12MB8659.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(1800799024)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +1EZl7QyU5rPlD4u/gzBUHBxLyRmUrZc7kUMvkOnFW+QWnTlFDWIG9SfNOhrfXPHVdDpfeI/PcWHmjSv15ZQqAsjPzGFL28r6r4tJOOKDn1zmrt0F7ThrK3BRkw74f1FpVO6F0NUsxkY1gL9DOmwWPL3nJuYvS+qRRXYa+iOcLiw23TbgIGBuWfJ11V5vW6Tab4hqHFEk0NmcsaKFoKgen4LI4U83ywJI3EUEPfT5BZTbxEXNJP5wzBrXd8CQnlGX3cRXTg1iDcfUGENeU2V/PnHRm8B/oMecfXvXjenF+K/U3qIKvS69FH6UbC44P6URl/7A09UIFerdg8P+oHJs4H+aXVU1mrfyWoL4biTSklF7wmdVEl6sb4EoqVKWWWOSHMsUKQnFdLsAQQTyBG5iShZeuvJr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uLusd4I2qjlr0SnGfMoir8J4funsBmYRo6mVy0h5eaBXWJ3cUkVKDq4uoEzUoAwqGcpDWoZk6blorpF+kI= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e917b365-bd5a-4ce3-1272-08dcf941e495 X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB8659.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 00:20:58.4214 (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: UpayNvBePLtLGRhcOn2XMQkiH5cMQHoDI/pX2qImo9UUFf6X7iKcQSSIPfUNF3Q3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7573 |
Series |
Initial support for SMMUv3 nested translation
|
expand
|
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 996774d461aea2..80847fa386fcd2 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3114,7 +3114,8 @@ arm_smmu_domain_alloc_user(struct device *dev, u32 flags, const struct iommu_user_data *user_data) { struct arm_smmu_master *master = dev_iommu_priv_get(dev); - const u32 PAGING_FLAGS = IOMMU_HWPT_ALLOC_DIRTY_TRACKING; + const u32 PAGING_FLAGS = IOMMU_HWPT_ALLOC_DIRTY_TRACKING | + IOMMU_HWPT_ALLOC_NEST_PARENT; struct arm_smmu_domain *smmu_domain; int ret; @@ -3127,6 +3128,14 @@ arm_smmu_domain_alloc_user(struct device *dev, u32 flags, if (IS_ERR(smmu_domain)) return ERR_CAST(smmu_domain); + if (flags & IOMMU_HWPT_ALLOC_NEST_PARENT) { + if (!(master->smmu->features & ARM_SMMU_FEAT_NESTING)) { + ret = -EOPNOTSUPP; + goto err_free; + } + smmu_domain->stage = ARM_SMMU_DOMAIN_S2; + } + smmu_domain->domain.type = IOMMU_DOMAIN_UNMANAGED; smmu_domain->domain.ops = arm_smmu_ops.default_domain_ops; ret = arm_smmu_domain_finalise(smmu_domain, master->smmu, flags);