From: Drew Fustini <fustini@kernel.org>
To: Zhanpeng Zhang <zhangzhanpeng.jasper@bytedance.com>
Cc: joro@8bytes.org, palmer@dabbelt.com, tony.luck@intel.com,
reinette.chatre@intel.com, tomasz.jeznach@linux.dev,
will@kernel.org, robin.murphy@arm.com, pjw@kernel.org,
aou@eecs.berkeley.edu, alex@ghiti.fr, Dave.Martin@arm.com,
james.morse@arm.com, babu.moger@amd.com, corbet@lwn.net,
shuah@kernel.org, jgg@ziepe.ca, kevin.tian@intel.com,
cuiyunhui@bytedance.com, yuanzhu@bytedance.com,
iommu@lists.linux.dev, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org, x86@kernel.org
Subject: Re: [RFC PATCH 0/7] riscv: iommu: Add QoS ID support for resctrl device assignment
Date: Sun, 23 Aug 2026 12:02:56 -0700 [thread overview]
Message-ID: <aotD4FrUcw+7zK/e@x1> (raw)
In-Reply-To: <20260714130657.46963-1-zhangzhanpeng.jasper@bytedance.com>
On Tue, Jul 14, 2026 at 09:06:50PM +0800, Zhanpeng Zhang wrote:
> This RFC extends RISC-V CBQRI/resctrl support to external requesters
> behind a RISC-V IOMMU.
>
> The RISC-V IOMMU QoS ID extension associates a resource-control ID
> (RCID) and monitoring ID (MCID) with IOMMU-related memory requests [2].
> For a translated device request, the IOMMU obtains the IDs from the
> device context translation attributes (DC.ta) and supplies them to the
> I/O bridge after a successful translation. The bridge and downstream
> CBQRI-controlled resources can then apply their existing allocation and
> monitoring policy to the request.
>
> The series is based directly on Drew Fustini's v4 RISC-V Ssqosid and
> CBQRI resctrl series [1]. That dependency provides CPU-side QoS ID
> plumbing and CBQRI-backed resctrl support. This series extends the same
> resctrl identity to device requests translated by a RISC-V IOMMU.
>
> The RISC-V names map to the existing resctrl identifiers as follows:
>
> resctrl CLOSID -> RISC-V RCID
> resctrl RMID -> RISC-V MCID
>
> Userspace first creates a resctrl resource group. The new "devices"
> file then assigns an external requester to that group:
>
> userspace
> |
> | mkdir /sys/fs/resctrl/<group>
> |
> | echo "iommu_group:<id>" > /sys/fs/resctrl/<group>/devices
> v
> generic resctrl devices file
> |
> | (closid, rmid)
> v
> RISC-V CBQRI IOMMU binding backend
> |
> | (rcid, mcid)
> v
> RISC-V IOMMU DC.ta.{RCID,MCID}
>
> The "devices" file is an assignment and membership interface only. It
> does not describe a new resctrl resource, schema, or monitoring domain;
> resource policy remains in the existing schemata and info files.
>
> Common IOMMU helpers:
>
> The userspace ABI names an IOMMU group by the numeric ID already used by
> /sys/kernel/iommu_groups. Patch 1 adds iommu_group_get_by_id() as a
> narrow, reference-counted lookup for that existing identifier.
>
> Updating a group also needs stronger iteration semantics than separate
> iommu_group_for_each_dev() calls can provide. All devices must be
> validated before any device context is changed, and group membership
> must not change between validation and update. Patch 2 therefore adds
> iommu_group_update_devices():
>
> lock group->mutex
> for each device: check() /* may fail, no state changed */
> for each device: update() /* non-failing callback */
> unlock group->mutex
>
> The helper contains no resctrl or QoS policy. It only provides an
> all-or-none validation boundary for a group-wide update while keeping
> IOMMU group internals private. The RISC-V IOMMU QoS code is its first
> caller.
>
> RISC-V IOMMU programming:
>
> For translated device requests, the per-device-context QoS IDs are
> programmed in DC.ta. Active contexts are invalidated after an update so
> cached translations do not retain stale IDs. BARE mode cannot safely
> represent per-IOMMU-group assignment because only the per-IOMMU
> iommu_qosid global default is available, so group assignment rejects
> BARE mode.
>
> The RISC-V IOMMU also has a per-IOMMU iommu_qosid register. The series
> exposes it as:
>
> /sys/class/iommu/<iommu>/qosid
>
> This sysfs attribute programs the global RCID and MCID used for
> IOMMU-originated DDT, CQ, FQ, PQ, and MSI accesses. In BARE mode,
> device-originated requests also use these IDs. It is not a resctrl group
> assignment interface.
>
> Open questions for this RFC:
>
> * whether a common resctrl "devices" file is the right ABI for
> associating external requesters with a resource group;
> * whether iommu_group_get_by_id() is an acceptable narrow common
> helper for resolving the numeric IOMMU group ID passed through that
> ABI; and
> * whether iommu_group_update_devices() provides the right common
> contract for checked group-wide updates.
>
> [1] Drew Fustini's CBQRI v4 series:
> https://lore.kernel.org/linux-riscv/20260706-dfustini-atl-sc-cbqri-dt-v4-0-e75c20201d64@kernel.org/
FYI - the 3 Ssqosid patches from my v6 series have been merged into
mainline:
3ec6f50a91bd ("dt-bindings: riscv: Add Ssqosid extension description")
5a17eb5f1c4c ("riscv: Detect the Ssqosid extension")
326ba66db949 ("riscv: Add support for srmcfg CSR from Ssqosid extension")
I'll send a rebased series once v7.3-rc1 is tagged.
Thanks,
Drew
prev parent reply other threads:[~2026-08-23 19:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 13:06 Zhanpeng Zhang
2026-07-14 13:06 ` [RFC PATCH 1/7] iommu: Add group lookup by ID Zhanpeng Zhang
2026-07-14 14:03 ` Jason Gunthorpe
2026-07-15 2:54 ` Zhanpeng Zhang
2026-07-15 2:55 ` Zhanpeng Zhang
2026-07-14 13:06 ` [RFC PATCH 2/7] iommu: Add checked group device update helper Zhanpeng Zhang
2026-07-14 13:06 ` [RFC PATCH 3/7] resctrl: Add a devices file for external requester assignment Zhanpeng Zhang
2026-08-12 2:19 ` Drew Fustini
2026-08-12 2:58 ` Zhanpeng Zhang
2026-07-14 13:06 ` [RFC PATCH 4/7] iommu/riscv: Program QoS IDs for assigned groups Zhanpeng Zhang
2026-08-08 17:07 ` Drew Fustini
2026-08-12 2:33 ` Zhanpeng Zhang
2026-08-13 17:34 ` Drew Fustini
2026-07-14 13:06 ` [RFC PATCH 5/7] iommu/riscv: Expose global QoS IDs in sysfs Zhanpeng Zhang
2026-08-08 17:09 ` Drew Fustini
2026-08-12 2:38 ` Zhanpeng Zhang
2026-08-11 21:21 ` Drew Fustini
2026-08-12 2:42 ` Zhanpeng Zhang
2026-07-14 13:06 ` [RFC PATCH 6/7] riscv_cbqri: Assign IOMMU groups to resource groups Zhanpeng Zhang
2026-08-13 17:43 ` Drew Fustini
2026-07-14 13:06 ` [RFC PATCH 7/7] selftests/iommu: Add RISC-V IOMMU QoS smoke test Zhanpeng Zhang
2026-08-06 5:23 ` [RFC PATCH 0/7] riscv: iommu: Add QoS ID support for resctrl device assignment Drew Fustini
2026-08-06 8:42 ` Ben Horgan
2026-08-09 4:13 ` [External] " Zhanpeng Zhang
2026-08-23 19:02 ` Drew Fustini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aotD4FrUcw+7zK/e@x1 \
--to=fustini@kernel.org \
--cc=Dave.Martin@arm.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=babu.moger@amd.com \
--cc=corbet@lwn.net \
--cc=cuiyunhui@bytedance.com \
--cc=iommu@lists.linux.dev \
--cc=james.morse@arm.com \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=reinette.chatre@intel.com \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=tomasz.jeznach@linux.dev \
--cc=tony.luck@intel.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=yuanzhu@bytedance.com \
--cc=zhangzhanpeng.jasper@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®