From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: akihiko.odaki@daynix.com, will@kernel.org, joro@8bytes.org,
virtualization@lists.linux-foundation.org, eric.auger@redhat.com,
iommu@lists.linux.dev, robin.murphy@arm.com
Subject: Re: [PATCH] iommu/virtio: Detach domain on endpoint release
Date: Thu, 18 May 2023 17:49:37 +0100 [thread overview]
Message-ID: <20230518164937.GA2934820@myrica> (raw)
In-Reply-To: <ZGYvMDbkBN+2UgzG@nvidia.com>
On Thu, May 18, 2023 at 10:59:12AM -0300, Jason Gunthorpe wrote:
> On Thu, May 18, 2023 at 02:56:38PM +0100, Jean-Philippe Brucker wrote:
> > > Can you wrapper this into a BLOCKED domain like we are moving drivers
> > > toward, and then attach the blocked domain instead of introducing this
> > > special case?
> >
> > Yes, I think the way the virtio-iommu driver should implement BLOCKED
> > domains is initially clearing the global-bypass bit, and then issuing
> > DETACH requests when the core asks to attach a BLOCKED domain. This has
> > the same effect as issuing an ATTACH request with an empty domain, but
> > requires fewer resources in the VMM.
>
> Does that exclude identity though?
No, identity attaches a domain with the ATTACH_F_BYPASS flag (or an
identity-mapped domain if the feature is missing), it doesn't rely on
global-bypass.
>
> It seems like the protocol should not have an implicit operation like
> this, the desired translation mode should always be made
> explicit.
I probably misunderstood your plan for BLOCKED. This particular patch is
about removing devices from the machine, for example PCIe hot-unplug. So I
thought you were suggesting the core will at some point attach a BLOCKED
domain to a device being removed, in order to block translation while the
device is being removed and while a new one is being plugged in with the
same RID. For that case I think DETACH, rather than ATTACH an empty
domain, makes more sense. Otherwise with the same reasoning we'd need to
attach all 4 billion endpoint IDs to an empty domain at boot which isn't
feasible. In addition I don't think we'll want to force the VMMs to keep
endpoint ID state internally after destroying devices, though that does
need to be specified one way or another.
If BLOCKED is only for transient states, for example while a struct device
is not bound to a driver, then attaching an empty domain works and is
simpler to implement. Probably the best is to implement BLOCKED this way
and still call DETACH in the release_device() op.
In any case, it shouldn't make a difference to the core. I'll see which
one is better for the VMMs.
Thanks,
Jean
> Having a boot time default makes sense, but there is little
> reason for an OS to go back to the boot time default...
>
> Jason
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-05-18 16:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 15:07 [PATCH] iommu/virtio: Detach domain on endpoint release Jean-Philippe Brucker
2023-05-10 8:11 ` Jean-Philippe Brucker
[not found] ` <ZGT+44a6RYZ999kz@nvidia.com>
2023-05-18 13:56 ` Jean-Philippe Brucker
[not found] ` <ZGYvMDbkBN+2UgzG@nvidia.com>
2023-05-18 16:49 ` Jean-Philippe Brucker [this message]
2023-05-10 15:37 ` Eric Auger
2023-05-10 16:20 ` Jean-Philippe Brucker
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=20230518164937.GA2934820@myrica \
--to=jean-philippe@linaro.org \
--cc=akihiko.odaki@daynix.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=robin.murphy@arm.com \
--cc=virtualization@lists.linux-foundation.org \
--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