mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Kevin Tian <kevin.tian@intel.com>,
	Eric Badger <ebadger@purestorage.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/5] iommu: Add static iommu_ops->release_domain
Date: Thu, 11 Apr 2024 10:41:54 -0300	[thread overview]
Message-ID: <20240411134154.GK223006@ziepe.ca> (raw)
In-Reply-To: <0dda6ce6-1b82-4168-93b7-a0e847ce9b08@arm.com>

On Wed, Apr 10, 2024 at 05:37:06PM +0100, Robin Murphy wrote:
> > We should probably be sensitive to the
> > dev->iommu->require_direct flag - generally drivers should prefer the
> > blocked for the release domain, but in case the FW ias asking for
> > require_direct we need to switch to identity.
> 
> At this point do we even need release_domain?

Ultimately ideally not, but I feel better going through the exercise
driver-by-driver before we just make the core code do it
automatically. Maybe I'm being overly pessimistic about the drivers..

Have all the drivers setting identity/blocked domain set release
domain before we switch to this unconditional method.

Anyhow, I just noticed it went into -rc1 already, so may as well keep
going.

> static void iommu_set_release_domain(struct device *dev)
> {
> 	const struct iommu_ops *ops = dev_iommu_ops(dev);
> 	struct iommu_domain *rd;
> 
> 	/*
> 	 * Static domains are expected not to track any device state,
> 	 * and thus be tolerant of devices disappearing once "attached"
> 	 */
> 	if (ops->blocked_domain && !(dev->iommu->require_direct ||
> other_arch_or_platform_reason))
> 		rd = ops->blocked_domain;
> 	else if (ops->identity_domain)
> 		rd = ops->identity_domain;
> 	else /* Hope release_device does the right thing! */
> 		return;
> 
> 	if (!dev->iommu->attach_deferred && rd != dev->iommu_group->domain)
> 		__iommu_attach_device(rd, dev);
> }

Yeah, this is a good end goal.

Jason

  reply	other threads:[~2024-04-11 13:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  1:33 [PATCH v3 0/5] iommu: Fix domain check on release Lu Baolu
2024-03-05  1:33 ` [PATCH v3 1/5] iommu: Add static iommu_ops->release_domain Lu Baolu
2024-04-10 15:26   ` Jason Gunthorpe
2024-04-10 16:37     ` Robin Murphy
2024-04-11 13:41       ` Jason Gunthorpe [this message]
2024-03-05  1:33 ` [PATCH v3 2/5] iommu/vt-d: Fix NULL domain on device release Lu Baolu
2024-03-05  1:48   ` Tian, Kevin
2024-03-05  1:33 ` [PATCH v3 3/5] iommu/vt-d: Setup scalable mode context entry in probe path Lu Baolu
2024-03-05  1:50   ` Tian, Kevin
2024-03-05  1:33 ` [PATCH v3 4/5] iommu/vt-d: Remove scalable mode context entry setup from attach_dev Lu Baolu
2024-03-05  1:33 ` [PATCH v3 5/5] iommu/vt-d: Remove scalabe mode in domain_context_clear_one() Lu Baolu
2024-03-05  7:54 ` [PATCH v3 0/5] iommu: Fix domain check on release Joerg Roedel
2024-03-05 12:01   ` Baolu Lu

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=20240411134154.GK223006@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=baolu.lu@linux.intel.com \
    --cc=ebadger@purestorage.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.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

all inboxes | Powered by JetHome®