Re: [PATCH v3 29/29] iommu/arm-smmu-v3-kvm: Add IOMMU ops
From: Jason Gunthorpe <jgg@ziepe.ca>
Date: 2025-08-12 13:48:10
Also in:
kvmarm, linux-iommu, lkml
On Tue, Aug 12, 2025 at 12:37:08PM +0000, Mostafa Saleh wrote:
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.
How is that possible? the kvm driver for smmuv3 should be very different than the iommu subsystem driver. That seemed to be what this series was showing.. Even the memory allocations and page table code were all modified? This delta seems to only get bigger as you move on toward having full emulation in the hypervisor. So, I'm confused what is being shared here and why are we trying so hard to force two different things to share some unclear amount of code?
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 think you end up with the same design I am suggesting here, it is nonsense to have one smmu driver when it is actually split into two instances where one is running inside the protected world and one is the normal iommu subsystem driver. That's not just bootstrapping, that is two full instances running in parallel that are really very different things.
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?
Well, I'd like to see you succeed here too, but it these series are very big and seem a pretty invasive. I'm very keen we are still able to support the smmuv3 driver in all the non-pkvm configurations without hassle, and I don't want to become blocked on inscrutible pkvm problems because we have decided to share a few lines of code.. Are you sure there isn't some inbetween you can do that allows getting to the full emulation of smmuv3 without so much churn to existing code? This is why I prefer adding new stuff that you then just erase vs mangling the existing drivers potentially forever.. Jason