From: Peter Xu <peterx@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: eperezma@redhat.com, qemu-stable@nongnu.org,
qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [PATCH] pci: advertise a page aligned ATS
Date: Wed, 9 Sep 2020 11:43:29 -0400 [thread overview]
Message-ID: <20200909154329.GB247092@xz-x1> (raw)
In-Reply-To: <20200909081731.24688-1-jasowang@redhat.com>
On Wed, Sep 09, 2020 at 04:17:31PM +0800, Jason Wang wrote:
> After Linux kernel commit 61363c1474b1 ("iommu/vt-d: Enable ATS only
> if the device uses page aligned address."), ATS will be only enabled
> if device advertises a page aligned request.
>
> Unfortunately, vhost-net is the only user and we don't advertise the
> aligned request capability in the past since both vhost IOTLB and
> address_space_get_iotlb_entry() can support non page aligned request.
>
> Though it's not clear that if the above kernel commit makes
> sense. Let's advertise a page aligned ATS here to make vhost device
> IOTLB work with Intel IOMMU again.
IIUC the kernel commit should be needed because the VT-d Page Request
Descriptor used the rest bits of the address for other use (bits 11-0), so
logically an unaligned address can be mis-recognized with special meanings.
I'd guess some other archs (with its own IOMMU) might support unaligned
addresses and has different layout of page request descriptor, but not vt-d.
>
> Note that in the future we may extend pcie_ats_init() to accept
> parameters like queue depth and page alignment.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Maybe it would be good too that vhost provides real 4k-aligned addresses (in
vhost_iotlb_miss)? My understanding is that PCI_ATS_CAP_PAGE_ALIGNED will be
more compatible than without the bit set. E.g., so far vt-d emulation always
cut the address with 4k no matter what iova was passed in. However not sure
whether this will stop working with some new vIOMMUs joining.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2020-09-09 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 8:17 [PATCH] pci: advertise a page aligned ATS Jason Wang
2020-09-09 15:43 ` Peter Xu [this message]
2020-09-10 1:53 ` Jason Wang
2020-09-10 16:23 ` Peter Xu
2020-10-15 7:47 ` Jason Wang
2020-10-15 13:10 ` Michael S. Tsirkin
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=20200909154329.GB247092@xz-x1 \
--to=peterx@redhat.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.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;
as well as URLs for NNTP newsgroup(s).