[RFC PATCH 5/7] iommu/riscv: Expose global QoS IDs in sysfs
Drew Fustini
fustini at kernel.org
Tue Aug 11 14:21:56 PDT 2026
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 <zhangzhanpeng.jasper at bytedance.com>
> ---
> .../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
More information about the linux-riscv
mailing list