Re: [RFC PATCH 5/7] iommu/riscv: Expose global QoS IDs in sysfs

Zhanpeng Zhang <[email protected]>
Newsgroups org.kernel.vger.linux-doc,dev.linux.lists.iommu,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <CACnXVncPrZms8PMJYbK58PEqR_mFzNxG=6CsziQCi8QCyr4eHg@mail.gmail.com>
Hi Drew,

On 8/12/26 5:21 AM, Drew Fustini wrote:
> On Tue, Jul 14, 2026 at 09:06:55PM +0800, Zhanpeng Zhang wrote:
>> The RISC-V IOMMU QoS extension provides iommu_qosid as a per-IOMMU
>> global default tag. It is used for IOMMU-originated DDT, CQ, FQ, PQ, and
>> MSI accesses, and for device-originated requests when DDTP is in BARE
>> mode.
>>
>> Initialize iommu_qosid to RCID 0 and MCID 0 when the hardware advertises
>> QOSID support. Preserve reserved and WPRI bits with read-modify-write,
>> and use register readback to reject values which the WARL fields do not
>> retain.
>>
>> Add a qosid attribute to the RISC-V IOMMU class device. Reading returns
>> the current RCID and MCID values. Writing the documented
>> 'rcid=<rcid> mcid=<mcid>' form updates both fields while preserving the
>> other register bits.
>>
>> Keep this interface separate from resctrl group QoS. The sysfs attribute
>> controls the IOMMU-wide default, while resctrl device assignment programs
>> per-device DC.ta in translated modes.
>>
>> Signed-off-by: Zhanpeng Zhang <[email protected]>
>> ---
>>   .../ABI/testing/sysfs-class-iommu-riscv-iommu |  27 +++
>>   MAINTAINERS                                   |  10 ++
>>   drivers/iommu/riscv/iommu.c                   | 159 +++++++++++++++++-
>>   drivers/iommu/riscv/iommu.h                   |   9 +-
>>   4 files changed, 202 insertions(+), 3 deletions(-)
>>   create mode 100644 Documentation/ABI/testing/sysfs-class-iommu-riscv-iommu
> [..]
>> diff --git a/drivers/iommu/riscv/iommu.h b/drivers/iommu/riscv/iommu.h
>> index 2c57625637bf..13ea67b7e42d 100644
>> --- a/drivers/iommu/riscv/iommu.h
>> +++ b/drivers/iommu/riscv/iommu.h
>> @@ -12,8 +12,12 @@
>>   #define _RISCV_IOMMU_H_
>>
>>   #include <linux/iommu.h>
>> -#include <linux/types.h>
>>   #include <linux/iopoll.h>
>> +#include <linux/mutex.h>
>> +#include <linux/types.h>
>> +#ifdef CONFIG_RISCV_IOMMU_32BIT
>> +#include <linux/spinlock.h>
>> +#endif
>
> RISCV_IOMMU_32BIT does not seem to exist upstream and these lines
> to just be deleted later in patch 6.
>
>
> Drew

Oops. These lines are leftovers from downstream code. I'll fix that.

Thanks,
Zhanpeng
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.