Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	Jean-Philippe Brucker <jpb@kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Thierry Reding <thierry.reding@kernel.org>,
	Krishna Reddy <vdumpa@nvidia.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	<linux-arm-kernel@lists.infradead.org>, <iommu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH RFC v6 3/5] iommu/arm-smmu-v3: Support shared SIDs in insert/remove_master
Date: Mon, 12 Oct 2026 13:48:43 -0700	[thread overview]
Message-ID: <as1Hq8FD3S67MpoE@nvidia.com> (raw)
In-Reply-To: <20261011-smmu-shared-sid-v6-3-cb76b89dc612@nxp.com>

On Sun, Oct 11, 2026 at 07:31:27PM +0800, Peng Fan (OSS) wrote:
>  static void arm_smmu_remove_master(struct arm_smmu_master *master)
>  {
> +	int i;
>  	struct arm_smmu_device *smmu = master->smmu;
>  
>  	if (!smmu || !master->streams)
>  		return;
>  
>  	mutex_lock(&smmu->streams_mutex);
> -	arm_smmu_free_master_streams(master);
> +	for (i = 0; i < master->num_streams; i++) {
> +		struct arm_smmu_stream *stream = master->streams[i];
> +
> +		if (!list_empty(&stream->shared_masters)) {
> +			struct arm_smmu_master *next;
> +
> +			list_del_init(&master->shared_masters_elm);
> +			next = list_first_entry(&stream->shared_masters,
> +						struct arm_smmu_master,
> +						shared_masters_elm);
> +			if (stream->master == master)
> +				stream->master = next;
> +			if (list_is_singular(&stream->shared_masters))
> +				list_del_init(&next->shared_masters_elm);
> +			continue;
> +		}
> +		rb_erase(&stream->node, &smmu->streams);
> +		kfree(stream);
> +	}

Rather than removing arm_smmu_free_master_streams(), just fold all
of these into arm_smmu_free_master_streams(). The rollback path in
arm_smmu_insert_master() can still use the same helper:

arm_smmu_insert_master:
	[...]
	if (ret) {
		arm_smmu_free_master_streams(master);
		mutex_unlock(&smmu->streams_mutex);
		kfree(master->streams);
		[...]

arm_smmu_remove_master:
	[...]
	mutex_lock(&smmu->streams_mutex);
	arm_smmu_free_master_streams(master);
	mutex_unlock(&smmu->streams_mutex);
	[...]

> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> index 56ed6ad1dd523..95da4ad354829 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> @@ -1020,6 +1020,8 @@ struct arm_smmu_stream {
>  	u32				id;
>  	struct arm_smmu_master		*master;
>  	struct rb_node			node;
> +	bool				ste_installed;

ste_installed is unused; better move to the patch that uses it.

With these addressed,

Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>


  reply	other threads:[~2026-10-12 20:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 11:31 [PATCH RFC v6 0/5] iommu/arm-smmu-v3: Support shared Stream IDs Peng Fan (OSS)
2026-10-11 11:31 ` [PATCH RFC v6 1/5] iommu/arm-smmu-v3: Allocate streams individually Peng Fan (OSS)
2026-10-11 11:31 ` [PATCH RFC v6 2/5] iommu/arm-smmu-v3: Delay stream allocation to inside the mutex Peng Fan (OSS)
2026-10-12 20:36   ` Nicolin Chen
2026-10-11 11:31 ` [PATCH RFC v6 3/5] iommu/arm-smmu-v3: Support shared SIDs in insert/remove_master Peng Fan (OSS)
2026-10-12 20:48   ` Nicolin Chen [this message]
2026-10-11 11:31 ` [PATCH RFC v6 4/5] iommu/arm-smmu-v3: Group aliasing devices into the same IOMMU group Peng Fan (OSS)
2026-10-12 12:24   ` Peng Fan
2026-10-12 13:05     ` Robin Murphy
2026-10-11 11:31 ` [PATCH RFC v6 5/5] iommu/arm-smmu-v3: Wire up shared-SID STE ordering and feature gating Peng Fan (OSS)
2026-10-12 13:23   ` Peng Fan
2026-10-12 23:54     ` Nicolin Chen

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=as1Hq8FD3S67MpoE@nvidia.com \
    --to=nicolinc@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jpb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=robin.murphy@arm.com \
    --cc=thierry.reding@kernel.org \
    --cc=vdumpa@nvidia.com \
    --cc=will@kernel.org \
    /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