Re: [PATCH v3 29/29] iommu/arm-smmu-v3-kvm: Add IOMMU ops
From: Mostafa Saleh <smostafa@google.com>
Date: 2025-08-12 12:37:14
Also in:
kvmarm, linux-iommu, lkml
On Tue, Aug 12, 2025 at 09:10:56AM -0300, Jason Gunthorpe wrote:
On Tue, Aug 12, 2025 at 10:29:38AM +0000, Mostafa Saleh wrote:quoted
On Mon, Aug 11, 2025 at 03:55:23PM -0300, Jason Gunthorpe wrote:quoted
On Wed, Aug 06, 2025 at 02:10:35PM +0000, Mostafa Saleh wrote:quoted
I am not sure I understand, the SMMU driver will register its IOMMU ops to probe the devicesYou couldn't do this. But why do you need the iommu subsystem to help you do probing for the pKVM driver? Today SMMU starts all devices in ABORT mode except for some it scans manually from the fw tables. They switch to identity when the iommu subsystem attaches devices, you can continue to do that by having the paravirt driver tell pkvm when it attaches. What is wrong with this approach?My confusion is that in this proposal we have 2 drivers: - arm-smmu-v3-kvm: Register arm_smmu_ops? binds to the SMMUsNo, I don't mean two iommu subsystem drivers. You have only the pkvm-iommu driver. Whatever you bind to the arm-smmu does not register with the iommu subsystem.
I see.
quoted
I am almost done with v4, which relies on a single driver, I don’t think it’s that complicated, it adds a few impl_ops + some few re-works. I think that is much simpler than having 3 drivers. Also better for the current SMMUv3 driver maintainability to have the KVM driver as mode, where all the KVM logic is implemented in a new file which relies on few ops, similar to “tegra241-cmdqv.c”I don't understand how you can do this, it is fundamentally not an iommu subsystem driver if pkvm is in control of the HW. And I still strongly do not want to see a para virt iommu driver hidden inside the smmu driver. It should be its own thing. The tegra ops were for customizing the iommu subsystem behavior of the arm iommu driver, not to turn it into a wrapper for a different paravirt driver!!
I see, but most of the code in KVM mode is exactly the same as in the current driver, as the driver is not HW agnostic (unlike virtio-iommu). In fact it does almost everything, and just delegates attach_identity/blocked to the hypervisor. IMO, having a full fledged KVM IOMMU driver + faux devices + moving all shared SMMUv3 code, just for this driver to implement a handful lines of code, is an over-kill, especially since most of this logic won’t be needed in the future. In addition, with no standard iommu-binding, this driver has to be enlightened somehow about how to deal with device operations. As mentioned before, when nesting is added, many of the hooks will be removed anyway as KVM would rely on trap and emulate instead of HVCs. Otherwise, we can skip this series and I can post nesting directly (which would be a relatively bigger one), that probably would rely on the same concept of the driver bootstrapping the hypervisor driver. I am generally open to any path to move this forward, as Robin and Will originally suggested the KVM mode in the upstream driver approach, what do you think? Thank, Mostafa
Jason