Linux Documentation
 help / color / mirror / Atom feed
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,
	jgg@ziepe.ca, james.morse@arm.com, ben.horgan@arm.com,
	xiaqinxin@huawei.com, will@kernel.org, robin.murphy@arm.com,
	pjw@kernel.org, aou@eecs.berkeley.edu, alex@ghiti.fr,
	Dave.Martin@arm.com, babu.moger@amd.com, kevin.tian@intel.com,
	corbet@lwn.net, skhan@linuxfoundation.org, shuah@kernel.org,
	randy.dunlap@infradead.org, 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 v2 2/4] iommu/riscv: Register independently tagged devices with resctrl
Date: Sun, 22 Nov 2026 23:48:40 -0800	[thread overview]
Message-ID: <awPv2KwSZdE_Biuj@thelio> (raw)
In-Reply-To: <20261116071338.35991-8-zhangzhanpeng.jasper@bytedance.com>

On Mon, Nov 16, 2026 at 03:13:41PM +0800, Zhanpeng Zhang wrote:
> Register independently tagged devices after default-domain setup and
> retain their IDs in driver-private state across domain changes. Program
> all firmware IDs under the context-update lock and report command
> completion failures to resctrl.
>
> The DC.ta field size does not describe the implemented QoS ID widths.
> Probe the low bits of the global write-any, read-legal fields with DDTP
> OFF and all queues disabled and idle. Preserve and verify restoration of
> the original register. If the widths cannot be obtained safely, do not
> register devices with resctrl. Reject IDs outside the probed range before
> changing any device context.
>
> Track exclusive device-context ownership without changing IOMMU core.
> Discovering an alias resets and unregisters any previous QoS owner before
> marking the context shared. Shared contexts are excluded from independent
> QoS assignment until IOMMU reprobe, without failing ordinary DMA probing.
> Serialize registration, alias discovery and release so an old owner
> cannot become independently assignable again after its context is shared.
>
> Signed-off-by: Zhanpeng Zhang <zhangzhanpeng.jasper@bytedance.com>
[..]
> diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
> index fbdca69c436e..dd2ebb25312d 100644
> --- a/drivers/iommu/riscv/iommu.c
> +++ b/drivers/iommu/riscv/iommu.c
[..]
> +static void riscv_iommu_probe_qosid_limits(struct riscv_iommu_device *iommu)
[..]
> +	iommu->qos_rcid_max = rcid;
> +	iommu->qos_mcid_max = mcid;
> +	iommu->qos_ids_valid = true;

The iommu spec requires rcid and mcid to be at least as wide as on any
hart, and resctrl only hands out IDs that the harts already use in
srmcfg. Maybe the limit probe could be dropped?

[..]
> diff --git a/drivers/iommu/riscv/iommu.h b/drivers/iommu/riscv/iommu.h
> index 5676001548cc..72bb536190d1 100644
> --- a/drivers/iommu/riscv/iommu.h
> +++ b/drivers/iommu/riscv/iommu.h
> @@ -15,6 +15,9 @@
>  #include <linux/spinlock.h>
>  #include <linux/types.h>
>  #include <linux/iopoll.h>
> +#include <linux/mutex.h>
> +#include <linux/spinlock.h>
> +#include <linux/xarray.h>

spinlock.h is already included above.

Thanks,
Drew

  reply	other threads:[~2026-11-23  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  7:13 [RFC PATCH v2 0/4] resctrl: Assign registered devices to resource groups Zhanpeng Zhang
2026-11-16  7:13 ` [RFC PATCH v2 1/4] resctrl: Add registered device assignment Zhanpeng Zhang
2026-11-16  7:13 ` [RFC PATCH v2 2/4] iommu/riscv: Register independently tagged devices with resctrl Zhanpeng Zhang
2026-11-23  7:48   ` Drew Fustini [this message]
2026-11-16  7:13 ` [RFC PATCH v2 3/4] iommu/riscv: Expose global QoS IDs in sysfs Zhanpeng Zhang
2026-11-16  7:13 ` [RFC PATCH v2 4/4] selftests/resctrl: Exercise device assignment and IOMMU global IDs Zhanpeng Zhang
2026-11-23  7:03 ` [RFC PATCH v2 0/4] resctrl: Assign registered devices to resource groups Drew Fustini

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=awPv2KwSZdE_Biuj@thelio \
    --to=fustini@kernel.org \
    --cc=Dave.Martin@arm.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.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=randy.dunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tomasz.jeznach@linux.dev \
    --cc=tony.luck@intel.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=xiaqinxin@huawei.com \
    --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