All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Tushar Dave <tdave@nvidia.com>
Cc: Vasant Hegde <vasant.hegde@amd.com>,
	Baolu Lu <baolu.lu@linux.intel.com>,
	joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
	kevin.tian@intel.com, yi.l.liu@intel.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH rc] iommu: Skip PASID validation for devices without PASID capability
Date: Fri, 25 Apr 2025 09:00:35 -0300	[thread overview]
Message-ID: <20250425120035.GA1804142@nvidia.com> (raw)
In-Reply-To: <77be6671-e4e8-4b17-bf72-74bde325671a@nvidia.com>

On Thu, Apr 24, 2025 at 05:49:20PM -0700, Tushar Dave wrote:

> In the above topology, we setup ACS flags on DSP 0008:02:03.0 and
> 0008:02:00.0 to achieve desired p2p configuration for GPU and DMA-PF.
> Apparently, this creates multi-device group with GPU being only device with
> PASID support in that group. In this case, set_dev_pasid() ops invoked for
> each device within the group with pasid=1 and doesn't fail.

Hurm, it doesn't fail, but it corrupts memory in the driver :\

int arm_smmu_set_pasid(struct arm_smmu_master *master,
		       struct arm_smmu_domain *smmu_domain, ioasid_t pasid,
		       struct arm_smmu_cd *cd, struct iommu_domain *old)
{
	struct iommu_domain *sid_domain = iommu_get_domain_for_dev(master->dev);
	struct arm_smmu_attach_state state = {
		.master = master,
		.ssid = pasid,
		.old_domain = old,
	};
	struct arm_smmu_cd *cdptr;
	int ret;

	/* The core code validates pasid */
                ^^^^^^^^^^

Which is not true after this patch.

The core code may not call the driver's set_pasid() function with a PASID
larger than that specific device's device->dev->iommu->max_pasids

Jason

  reply	other threads:[~2025-04-25 12:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24  2:06 [PATCH rc] iommu: Skip PASID validation for devices without PASID capability Tushar Dave
2025-04-24  3:27 ` Baolu Lu
2025-04-24  4:33   ` Tian, Kevin
2025-04-24  6:38   ` Vasant Hegde
2025-04-24 12:31     ` Jason Gunthorpe
2025-04-24 15:49       ` Vasant Hegde
2025-04-25  0:49       ` Tushar Dave
2025-04-25 12:00         ` Jason Gunthorpe [this message]
2025-04-28  1:47           ` Tushar Dave

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=20250425120035.GA1804142@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=tdave@nvidia.com \
    --cc=vasant.hegde@amd.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.