From: Alex Williamson <alex.williamson@redhat.com>
To: Ajay Garg <ajaygargnsit@gmail.com>
Cc: iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: How are iommu-mappings set up in guest-OS for dma_alloc_coherent
Date: Mon, 22 Sep 2025 08:32:21 -0600 [thread overview]
Message-ID: <20250922083221.5c6a68c0.alex.williamson@redhat.com> (raw)
In-Reply-To: <CAHP4M8WOkDvEf6DYe6w+V9PVHkqcu2-8YrKa7jwLBYRAqLVS+g@mail.gmail.com>
On Sat, 20 Sep 2025 20:27:54 +0530
Ajay Garg <ajaygargnsit@gmail.com> wrote:
> Thanks Alex for the clarification; really grateful.
>
> When I had last tried attaching PCI-device to a VM (spawned via VFIO), the
> PCI-device vanished from host-device :)
>
> So, as of today, if the PCIe device is PASID-capable, can it be :
>
> a)
> Shared/visible both across a host-os and guest-os?
>
> b)
> Shared/visible across more than one guest-os?
VFIO doesn't make PCI devices disappear from the host. Maybe you're
referring to unbinding the host function driver, which might make your
NIC/HBA/GPU device disappear from the host as the PCI device is bound
to vfio-pci instead.
There are ways to multiplex devices between host and guest, SR-IOV is
currently the most common way to do this. Here you'd have a physical
function (PF) with a host function driver, which can create multiple
virtual functions (VFs), each of which have a unique requester ID and
therefore a unique set of page tables allowing them to operate in
independent IOVA spaces for VMs. You can imagine here that your PF
remains bound to the host function driver and continues to provide host
services, while the VFs can be assigned to VMs.
PASID is another way to do this and is often described in an SIOV
(Scalable IOV) framework, where we rely more on software to expose an
assignable entity which makes use of the combination of the physical
requester ID along with PASID to create a unique IOVA space through two
levels of IOMMU page tables.
In either case, having an SR-IOV or PASID capability on the device
doesn't automatically enable device multiplexing, there's software
required to enable these features, more so in the direction of SIOV
support as the scalability trade-off is to push more of the basic
device emulation into software. Thanks,
Alex
next prev parent reply other threads:[~2025-09-22 14:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 17:54 How are iommu-mappings set up in guest-OS for dma_alloc_coherent Ajay Garg
2025-09-19 16:41 ` Alex Williamson
2025-09-20 3:04 ` Ajay Garg
2025-09-20 14:34 ` Alex Williamson
[not found] ` <CAHP4M8WOkDvEf6DYe6w+V9PVHkqcu2-8YrKa7jwLBYRAqLVS+g@mail.gmail.com>
2025-09-22 14:32 ` Alex Williamson [this message]
2025-09-22 16:21 ` Ajay Garg
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=20250922083221.5c6a68c0.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=ajaygargnsit@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.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