Re: [PATCH] iommu: Distinguish between sw-msi and msi

From: Robin Murphy
Date: Tue Oct 22 2024 - 08:31:05 EST


On 22/10/2024 1:02 pm, Angus Chen wrote:
Hi robin。

-----Original Message-----
From: Robin Murphy <robin.murphy@xxxxxxx>
Sent: Monday, October 21, 2024 7:59 PM
To: Angus Chen <angus.chen@xxxxxxxxxxxxxxx>; joro@xxxxxxxxxx;
will@xxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx; iommu@xxxxxxxxxxxxxxx
Subject: Re: [PATCH] iommu: Distinguish between sw-msi and msi

On 2024-10-21 12:34 pm, Angus Chen wrote:
iommu_group_resv_type_string use the same string of IOMMU_RESV_MSI
and IOMMU_RESV_SW_MSI, Make a distinction for these.

Why? What in userspace needs to know the exact details of how the kernel
and the underlying hardware are routing MSIs?
We use smmu-v3 for a dpu design,and we set a private region to handle msi region like x86.
We set some private iommu register to control this.
If some customer want to use their os like openouler, we use sw-msi mode.
If some customer want to use our customize os ,we will set msi private.
Some customer use openouler and we private smmu-v3 module at the same time,

So I want to use reserve-type to distinguish between sw-msi and msi.

But *why*? What do you expect userspace to do with this information? It was a deliberate choice not to expose this distinction, precisely *because* it should make no difference to a VFIO user whether an MSI address range is defined by the platform or by the IOMMU driver, and if userspace did think it wants to know that then it's probably doing something wrong. IIRC, the reason for distinguishing "msi" from "reserved" at all was just as a hint to userspace that although the address range is still not usable for remapping memory, it's a good place for a VMM to put an emulated MSI doorbell in GPA/IPA space.

Also, this has been userspace ABI since 2017, and changing it has a high risk of breaking existing users who are looking for an "msi" region, so no.

Thanks,
Robin.