Thread (50 messages) 50 messages, 4 authors, 6d ago

Re: [PATCH v8 10/25] iommu/arm-smmu-v3-kvm: Add SMMUv3 driver

From: Nicolin Chen <hidden>
Date: 2026-09-22 22:39:40
Also in: kvmarm, linux-iommu, lkml

On Tue, Sep 22, 2026 at 01:12:43PM +0000, Mostafa Saleh wrote:
From: Jean-Philippe Brucker <redacted>

Add the skeleton for an Arm SMMUv3 driver at EL2.

The driver rely on an array of SMMUv3s on the system, where at
s/rely/relies
quoted hunk ↗ jump to hunk
+++ b/drivers/iommu/arm/Kconfig
@@ -141,3 +141,15 @@ config QCOM_IOMMU
 	select ARM_DMA_USE_IOMMU
 	help
 	  Support for IOMMU on certain Qualcomm SoCs.
+
+config ARM_SMMU_V3_PKVM
+	bool "ARM SMMUv3 support for protected Virtual Machines"
+	depends on KVM && ARM_SMMU_V3=y
Should it depend on OF?
+	help
+	  Enable a SMMUv3 driver in the KVM hypervisor, to protect VMs against
s/a SMMUv3/an SMMUv3
quoted hunk ↗ jump to hunk
+++ b/drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3-hyp.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __KVM_ARM_SMMU_V3_HYP_H
+#define __KVM_ARM_SMMU_V3_HYP_H
+
+#include <asm/kvm_asm.h>
+
+/*
+ * Parameters from the trusted host:
+ * @mmio_addr		base address of the SMMU registers
+ * @mmio_size		size of the registers resource
Are these still in the host's physical address space or guest's?

If it's still "host" (though trusted), what's different from the
ioaddr in the main driver?
+size_t __ro_after_init kvm_hyp_arm_smmu_v3_count;
+struct hyp_arm_smmu_v3_device *kvm_hyp_arm_smmu_v3_smmus;
Should kvm_hyp_arm_smmu_v3_smmus be __ro_after_init as well?
+
+#define for_each_smmu(smmu) \
+	for ((smmu) = kvm_hyp_arm_smmu_v3_smmus; \
+	     (smmu) != &kvm_hyp_arm_smmu_v3_smmus[kvm_hyp_arm_smmu_v3_count]; \
+	     (smmu)++)
"smmu" sounds too generic. Maybe for_each_pkvm_smmu?
+/* Called while is the host is still trusted. */
+static int smmu_init(void)
s/while is/while
+/* Shared with the kernel driver in EL1 */
+struct pkvm_iommu_ops smmu_ops = {
+	.init				= smmu_init,
+	.host_stage2_idmap		= smmu_host_stage2_idmap,
Can we add a "pvkm_arm_smmu_" prefix for the ops and functions here?

Nicolin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help