Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.52 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796110475; b=W8chWjTMfia5PmfeI1NtgUj9+5AtmUMbxhzidk++dPyCpkxVyYwDZz6yiCNslKjQhkcN evMnmCAEHWDugdGAtNve9XpZEc8tmRxBAK49hN/GxGuMUVqf8dD7PjKtrbqo8AjJaEBsd ihoW4J/1ZRjrdCNOeur43jN3zq6L1Actg90crrWH2lDMhZPCenoUv/WwPdN9G4MlO+NBo fRgz3Qft+e7vGit37Rl/F1Nh3mMx59A5JtlHxS2ebEUZnsbqPYXWNIa+HLYrN3YpKd+x8 Cg+QYE7PiIS7CrZkpD4nSs0SOq9JvLijbis7qrfH3y66AQw6Wjz4yct3nDG1dBkBANg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796110475; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding:Content-Type: X-NV-OnPremToCloud:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=x9fFVRupES/Izc4VMWvZ47qph1bV/Q8Ig7NR+2T9drI=; b=YGaR0lOy7KWFPRqjnSn9I6FWkqwdKpOFmW+p4dzBnpV/CohyGO6blfjkgPwxqujrj3Z2 I9/T5IG5lMNuiFpakag+B1IZ9cB7o8Vby/NxmQMXCxQ4o4GuB6ULLDoBqZW7dS82CkV5r 73L2XR6oigmmW5E63i2InOuKT+Ev3zzFFS6Nq0OImRtRgAtaH+LafRo9UxhEkkQBOGD3w i7U1aBfnZ1xQ91vQQLDvYP/bTbd3e/+nXp5yXW6azNfYporrqF2snAoQ0kJxvYfrjYAvT pM8AJ98E4bFk5e8N76bmbVNhNQa8QPupRMV4Q12WMhyehnCRdqF6ZqMWfKFFw+71yyA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=kcJ55m90; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.52 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010052.outbound.protection.outlook.com [40.93.198.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A522A606A33D; Tue, 1 Dec 2026 07:34:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A522A606A33D 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, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=kcJ55m90 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F6Nwb58zNo7VAIPhvuKtEjP3+ClbQUm2CjlLpsIhJuaf/px+e4bLpFCbmfTbnNv951zJIoke1a7QQ4GMqnJo4Bmo3gpxfVJfHYjftqjzXBBffC4zH2nsWeaKcqf74YM4UY5qrV+dI528VQqNNGaUxcY4o33MGTQT4EoN5ePfqTiyHQt8rTn5eFcFUbeOGmvIMU5nHgvQotBmrFOZMiQ0DYPjERWLfK6ZZbYv1Qp3wyZ2026Iyab1xMj+n8TBCymztaL6WdalfUtjRX+2sRCaPHlWyyIVXnct8ITvLhErrXuy2MxH6Fgc6suTPuFTBwX+0WznMHelD9zljcxQfWKQ5Q== 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=x9fFVRupES/Izc4VMWvZ47qph1bV/Q8Ig7NR+2T9drI=; b=WI2vDaGk9fJqMhB9DNhjm0xU/4rBNmWn00iFUoDfigA7FwF5UODq6aYjuspZh/TmXRGeh8uMt3PZKhfnW9JDtumSpsAshenc0PQ2JbTl0+cqUPD9wh9GSpwudwS2WDxvu4FQmzWQVesVxWjev5Hp4Ky0/gC0W8F71aafCQbuaxDOfTqH9S3dw78AddqVHimxCcQrLXn64L6ELn53UXi4BuWdGQDT+iF52IcyTBt+tg3rmOB5eY93PFWNGsFdPpXJK8n69DVFq9oU5dNgC7MrYhlXID5C+a3VCgRdWO8jTBAVG0p/oLXujG+RPHkoyuepiCg4B6WqBDahYK9nYlJrqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=lists.linux.dev 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=x9fFVRupES/Izc4VMWvZ47qph1bV/Q8Ig7NR+2T9drI=; b=kcJ55m90xBIiZZmhD6Igv9U6SJY92XDypR151pntKK/ehvralIjSImPhPZrzazBaR7QH8wwthmr6MBSs7tzRJgbSikcMuUWReCwzAn7i+0OxlsI9qHfvSt3A+Y9BdBJkqBcGmjujFfyChdqpnQjR8TJUiiSR5fSkkxrNhgA9n0FxOArYpQIk17aw7r1DeUgbzOkhxZDvzHpEt9yLBkqnE2frUEPqyW4jGv72KY5Q7gZKvXE19w0oPSupMChzYaneFgTTR+IdEVKHF60af5pGR8CMD8DDlIhFu4JAz97cexhSA4KRxZCgNn2hwM6jBtvzu3mpkSNt7wxklaW2nEP1vA== Received: from SJ0PR03CA0363.namprd03.prod.outlook.com (2603:10b6:a03:3a1::8) by PH8PR12MB6748.namprd12.prod.outlook.com (2603:10b6:510:1c4::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Tue, 1 Dec 2026 07:34:26 +0000 Received: from SJ1PEPF000023CF.namprd02.prod.outlook.com (2603:10b6:a03:3a1:cafe::31) by SJ0PR03CA0363.outlook.office365.com (2603:10b6:a03:3a1::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Tue, 1 Dec 2026 07:34:26 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 SJ1PEPF000023CF.mail.protection.outlook.com (10.167.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 07:34:26 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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.2562.57; Mon, 30 Nov 2026 23:34:10 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 23:34:10 -0800 Received: from Asurada-Nvidia.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 23:34:08 -0800 From: Nicolin Chen To: Jason Gunthorpe , , Will Deacon , Robin Murphy , Catalin Marinas , Greg Kroah-Hartman , , Danilo Krummrich , Johan Hovold , Marek Szyprowski , CC: Mark Rutland , Pranjal Shrivastava , Mostafa Saleh , , , , Sonang Patel , "Ankit Agrawal" , Subject: [PATCH v4 0/6] iommu/arm-smmu-v3: Support guest-level Realm VSMMU (Part-1) Date: Mon, 30 Nov 2026 23:33:52 -0800 Message-ID: X-Mailer: git-send-email 2.43.0 X-Mailing-List: driver-core@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CF:EE_|PH8PR12MB6748:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f14c337-0292-4f08-a3db-08df4f7d86e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|36860700016|1800799024|23010399003|11063799006|5023799004|261009223027099003|18002099003|6133799003|3023799007|13003099007|921020|20052099010|260925022911599003|260925021311599003|260925021911599003|261026140227099003|10067099003|56012099006|261102123227099003|261021123027099003|261026121527099003|261028144727099003|261021121427099003|261022105027099003|261022075727099003|261021135927099003; X-Microsoft-Antispam-Message-Info: H3hB6rniJVMUCjxFSSr/WPBwMV4WXgjIwrPR78aHwP6flUFxLCuEMb4ao6eZhM+sMKMo+V5uALV7fDGPb+9eBRTyyazXRHt8XqAeGJuPZMQycE2Kqwz80PCAQsVjtUTP59jJFxymDRO8PS0W654olP42w9cL/dpLpAVqFdillQA1pAJXt6U/UZHnANfRWtQNN8ILKMYLM0GZWlRURB2hRKoQHmRpWeSn+cXB6+q5TnDF5Hi3/fMK1Z2yDMeVe5mMqmFoQzZfuYsSYNDYlthCjbe+UKkk7T2ml8NdRAp9DKEewBL24JD9sIpuHwrXUaND40iUJcHsdYRebIkeGUdMwTse2v4i642KR1dPw9TFT15ADbihSZiPkIYtAdM9v/Cqs8pgqI7wT4u8aw+FF0rtesx8UJqcDt6qdLUvWAmVfHCXJ/A6wQ3JLK9OISmS8eE04RF9CiOsutr8ocQtuN7kAxkM9V78WJad2ys3H/JNS/ApovCmqsI6tHv2y3SLu7SpxUnJ2Je45U697BPYiWQWMr7WhBuFH1R5EVehE8gKA83sGxVZHE3rVKzjssEAHqPLyFJrXguCo0TfjVEFO9zNwkC2ilNDGpaTzbwoLvOI9w7qN/KhofdD/Qtu15kxzkPy8MGQhUESOjsihHOccVg14qSoILNsnOYQFMaT87dnXGDFcczItEbp2XQJK3EkeMEeaAlnG+L+30llYWFC/t7xfqY3xxmFwK2h+jdIpJStt42rGzV1NVKdD5MiaS0uhbMj 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)(82310400026)(7416014)(376014)(36860700016)(1800799024)(23010399003)(11063799006)(5023799004)(261009223027099003)(18002099003)(6133799003)(3023799007)(13003099007)(921020)(20052099010)(260925022911599003)(260925021311599003)(260925021911599003)(261026140227099003)(10067099003)(56012099006)(261102123227099003)(261021123027099003)(261026121527099003)(261028144727099003)(261021121427099003)(261022105027099003)(261022075727099003)(261021135927099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zFTR/hSVBNaja334pPkdF9Gst4fZrbFzIRjurQMlXnpXfTa5crTwshmlBoJSzZAH7y1t09fZ4EK8DZws+Xj2JumJtcAwRdoUWDjA1M8aQnMl4aCLJ7u59jPhlRT0v0wBTJjoxYXLPhQVL/8LvvCWwlSMwZuHIHQuJJfCYxbDk7UIDz1bH5G1XX2zzrmhqbf9meYiCGfBkSGUXZBpjIA6fS4S23mWC1jyr06BT5xQN3aUoFP09+AV3vkKe4fV4vojmTO9wAyf9Li9x04bjYLG6GaKiY3gqn3ErK5nM9XhJ7ntG1q8DXNz+0v2PmLJUJ7FNGn/oTPOE40blV0f6dE85dGouhHe7zFUEod2oT0aSuW6gWt5VHOgWM5q5I8fHwSEQCeT4QrrPDjvmiPGXQZw8FhGR9/2zYIEBjQwulWiqkcfla3QZdFl/+KMWKn1a3bM X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 07:34:26.2369 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f14c337-0292-4f08-a3db-08df4f7d86e6 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: SJ1PEPF000023CF.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6748 This series prepares Realm guest IOMMU and DMA subsystems for devices that are present but not yet inside the Realm trust boundary. Inside a confidential guest, we expect that all the iommus are going to be T=1 aware; there seems to be no interest in supporting IOMMUs that handle T=0 only. This means they only work on devices that have been put into the run state and issue T=1 transactions. Today an iommu driver assumes it translates for every device behind it: it probes the device, takes a translating default domain, and puts the DMA API on its page tables. That assumption is wrong for T=0 devices, whose DMA the hypervisor translates instead, so the mappings made by the guest are never consulted and the device silently stops working. To solve this problem, let the core treat each confidential vIOMMU as being bypassed by every device associated with it. Part 2 will add the per-device T=1 state, along with the transition. While T=0, the device remains outside the Realm trust boundary. Its DMA is translated by the host or hypervisor: [device: T=0] ===> [hypervisor] ===> [memory] | +-- (guest association) --> [confidential IOMMU: blocking DMA] Legend: ===> DMA path; --> guest topology and control After reaching T=1, the device is inside the Realm trust boundary. Its DMA may use the guest VSMMU after RMM binds the device to its virtual stream: [device] ===> [VSMMU: S1] ===> [RMM/PSMMU: S2 + DPT] ===> [memory] As part 1 of Realm VSMMU support, implement enough core infrastructure to manage a confidential vIOMMU: - Detect and mark it as cc_private in the core iommu structures - Support devices in T=0 mode by keeping the DMA API in direct mode. The iommu is up and running, but parks such a device in its blocking domain and translates for nothing. The hypervisor owns the whole T=0 path, ATS included - Keep it parked: refuse a translating domain by every route in, whether through the default domain, sysfs, group attach or replace, or PASID Then implement SMMUv3 support: - Let a CPU-integrated IOMMU declare that its DMA can reach private memory, so coherent allocations and streaming mappings avoid the SWIOTLB shared pool - Identify a T=1 VSMMU using trusted RSI because firmware does not distinguish it from a normal T=0 SMMU - Validate the firmware MMIO range against RSI before activating the VSMMU and allocating its queues and tables from private memory The series is on github: https://github.com/nicolinc/iommufd/commits/smmuv3_realm_guest_p1-v4 Changelog v4: * Add Reviewed-by from Jason and Acked-by from Marek * Check cc_private directly in iommu_dma_prepare_msi() * Move the is_realm_world() checks into the probe helpers * Explain why a realm guest cannot use the Tegra241 CMDQV yet * Reword the DEV_FLAG_DMA_CC_PRIVATE commit message per Jason * Rename iommu_using_t0_stream() to iommu_cc_viommu_bypassed() * Rename "confidential" to "cc_private" and make it a bitfield * Keep require_direct, and skip its checks for a bypassed vIOMMU instead * Drop "Introduce TDISP T=0 state", as the hypervisor owns ATS. This also drops the PCI reset hooks and the tdisp_t1 flag v3: https://lore.kernel.org/all/cover.1794343501.git.nicolinc@nvidia.com/ * Add Acked-by from Marek * Disable and enable ATS for T=0 devices across a PCI reset * Rename dma_require_decrypted() to dma_require_unencrypted() * Explain the minimum STU used to enable ATS while TDISP is T=0 v2: https://lore.kernel.org/all/cover.1793676742.git.nicolinc@nvidia.com/ * Rebase on v7.4-rc1 * Drop Assisted-by tags * Drop Aneesh's firmware patch that was merged * Skip Tegra CMDQV implementation in the realm world * Use arm_smccc_1_2_smc() to zero inputs as RMM spec demands * Add missing iommu_using_t0_stream() check in iommu_dma_prepare_msi() v1: https://lore.kernel.org/all/cover.1789010941.git.nicolinc@nvidia.com/ Future work =========== Part 2 will add the T=1 transition after validation through: - TSM, whose guest-side interface remains under discussion - RMM, using the Arm-specific RSI VDEV command For a multi-device IOMMU group, the first device accepted into T=1 claims the group. Part 2 will reject T=1 for every other member. The current RSI binding validation returns one VSID, so part 2 must reject a firmware specification containing multiple SIDs upon the T=1 transition. Nicolin Chen (6): firmware: arm_rmm: Add VSMMU commands and fields dma-mapping: Let a device declare that it reaches private memory dma-mapping: Keep DMA memory private for capable devices iommu: Let a driver mark an IOMMU as confidential iommu: Use the blocking domain for a bypassed confidential vIOMMU iommu/arm-smmu-v3: Probe a guest-level Realm VSMMU via RSI commands drivers/iommu/iommu-priv.h | 11 +++ include/linux/arm-rsi-cmds.h | 29 ++++++++ include/linux/arm-smccc-rsi.h | 20 ++++++ include/linux/device.h | 4 ++ include/linux/dma-direct.h | 7 +- include/linux/dma-mapping.h | 4 ++ include/linux/iommu.h | 10 +++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 78 +++++++++++++++++++- drivers/iommu/iommu.c | 80 +++++++++++++++++++-- kernel/dma/direct.c | 21 +++--- kernel/dma/mapping.c | 23 +++++- kernel/dma/swiotlb.c | 2 +- 12 files changed, 269 insertions(+), 20 deletions(-) base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 -- 2.43.0