[PATCH v2 6/8] iommu/arm-smmu-v3: Support IOMMU_GET_HW_INFO via struct arm_smmu_hw_info

Shameerali Kolothum Thodi shameerali.kolothum.thodi at huawei.com
Wed Sep 4 00:11:19 PDT 2024



> -----Original Message-----
> From: Jason Gunthorpe <jgg at nvidia.com>
> Sent: Wednesday, September 4, 2024 12:40 AM
> To: Mostafa Saleh <smostafa at google.com>
> Cc: acpica-devel at lists.linux.dev; Guohanjun (Hanjun Guo)
> <guohanjun at huawei.com>; iommu at lists.linux.dev; Joerg Roedel
> <joro at 8bytes.org>; Kevin Tian <kevin.tian at intel.com>;
> kvm at vger.kernel.org; Len Brown <lenb at kernel.org>; linux-
> acpi at vger.kernel.org; linux-arm-kernel at lists.infradead.org; Lorenzo Pieralisi
> <lpieralisi at kernel.org>; Rafael J. Wysocki <rafael at kernel.org>; Robert
> Moore <robert.moore at intel.com>; Robin Murphy
> <robin.murphy at arm.com>; Sudeep Holla <sudeep.holla at arm.com>; Will
> Deacon <will at kernel.org>; Alex Williamson <alex.williamson at redhat.com>;
> Eric Auger <eric.auger at redhat.com>; Jean-Philippe Brucker <jean-
> philippe at linaro.org>; Moritz Fischer <mdf at kernel.org>; Michael Shavit
> <mshavit at google.com>; Nicolin Chen <nicolinc at nvidia.com>;
> patches at lists.linux.dev; Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi at huawei.com>
> Subject: Re: [PATCH v2 6/8] iommu/arm-smmu-v3: Support
> IOMMU_GET_HW_INFO via struct arm_smmu_hw_info
> 
> On Tue, Sep 03, 2024 at 08:34:17AM +0000, Mostafa Saleh wrote:
> 
> > > > For example, KVM doesn’t allow reading reading the CPU system
> > > > registers to know if SVE(or other features) is supported but hides
> > > > that by a CAP in KVM_CHECK_EXTENSION
> > >
> > > Do you know why?
> >
> > I am not really sure, but I believe it’s a useful abstraction
> 
> It seems odd to me, unpriv userspace can look in /proc/cpuinfo and see
> SEV, why would kvm hide the same information behind a
> CAP_SYS_ADMIN/whatever check?

I don’t think KVM hides SVE always. It also depends on whether the VMM has
requested sve for a specific Guest or not(Qemu has option to turn sve on/off, similarly pmu
as well).  Based on that KVM populates the Guest specific ID registers.  And Guest
/proc/cpuinfo reflects that.

And for some features if KVM is not handling the feature properly or not making any sense
to be exposed to Guest, those features are masked in ID registers.

Recently ARM64 ID registers has been made writable from userspace to allow VMM to turn
on/off features, so that VMs can be migrated between hosts that differ in feature support.

https://lore.kernel.org/all/ZR2YfAixZgbCFnb8@linux.dev/T/#m7c2493fd2d43c13a3336d19f2dc06a89803c6fdb

Thanks,
Shameer


More information about the linux-arm-kernel mailing list