mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alistair Francis <Alistair.Francis@wdc.com>
To: "mst@redhat.com" <mst@redhat.com>,
	"alistair23@gmail.com" <alistair23@gmail.com>
Cc: "jasowangio@gmail.com" <jasowangio@gmail.com>,
	"virtualization@lists.linux.dev" <virtualization@lists.linux.dev>,
	"xuanzhuo@linux.alibaba.com" <xuanzhuo@linux.alibaba.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"eperezma@redhat.com" <eperezma@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mkp@kernel.org" <mkp@kernel.org>,
	"James.Bottomley@hansenpartnership.com"
	<James.Bottomley@hansenpartnership.com>
Subject: Re: [PATCH 1/2] virtio_pci: Add a quirk to force DMA Map API for certain legacy devices
Date: Fri, 4 Sep 2026 03:21:42 +0000	[thread overview]
Message-ID: <22cb4c64c9d7a2c5590bd0ea74a399169539d206.camel@wdc.com> (raw)
In-Reply-To: <20260901043810-mutt-send-email-mst@kernel.org>

On Tue, 2026-09-01 at 04:43 -0400, Michael S. Tsirkin wrote:
> On Tue, Sep 01, 2026 at 11:46:49AM +1000, alistair23@gmail.com wrote:
> > From: Alistair Francis <alistair.francis@wdc.com>
> > 
> > Legacy virtio devices only have 32 feature bits and therefore can't
> > set the VIRTIO_F_ACCESS_PLATFORM (bit 33) feature. This means the
> > vring_use_map_api() function will return false.
> > 
> > Currently Linux endpoint devices use the legacy virtio interface as
> > they aren't able to advertise the Common configuration capability.
> > As most PCI endpoint capable PCIe controllers do not allow
> > modifying the
> > capability list, and thus are unable to advertise the Common
> > configuration
> > capability. This means the device's inbound TLPs fault on the host
> > SMMU because the vring descriptors carry raw physical addresses.
> > 
> > This quirk forces a subset of legacy virtio devices to use the
> > DMA Map API (vring_use_map_api() will return true), which fixes
> > this
> > issue.
> > 
> > This doesn't affect existing devices as we are checking for an
> > otherwise invalid vendor ID.
> > 
> > Ideally we would update the endpoint devices (like scsi-pci-epf)
> > to not use the legacy virtio interface, but lots of endpoint
> > hardware (like the one in the RK3588) doesn't allow us to add
> > custom capabilities.
> > 
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> 
> I don't much like hacks around DMA API, it is very fragile already.
> 
> So, here's an idea:
> 
> put all the capabilities simply at a fixed offset in a memory BAR.

So just pick some hard coded address? Then update the host to check
that address if there is no Common configuration capability found in
the actual config space?

Seems doable

> 
> it's a small spec extension, but saves a lot of trouble IMHO.

How do we update the VirtIO spec to include that?

> 
> And in fact, people already complained that legacy pci config space
> should be avoided.

Yeah, I did get that impression. The name "legacy" does give that away
:)

> 
> What do you say?

Works for me. How would I update the spec to include that?

Alistair

  reply	other threads:[~2026-09-04  3:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  1:46 [PATCH 0/2] scsi: Initial commit of VirtIO PCIe Endpoint Driver alistair23
2026-09-01  1:46 ` [PATCH 1/2] virtio_pci: Add a quirk to force DMA Map API for certain legacy devices alistair23
2026-09-01  8:43   ` Michael S. Tsirkin
2026-09-04  3:21     ` Alistair Francis [this message]
2026-10-02  2:35     ` Alistair Francis
2026-09-01  1:46 ` [PATCH 2/2] scsi: Initial commit of VirtIO PCIe Endpoint Driver alistair23
2026-09-01  9:03   ` Niklas Cassel
2026-09-01 11:04   ` Michael S. Tsirkin
2026-09-01  8:35 ` [PATCH 0/2] " Niklas Cassel
2026-09-03 11:51   ` Manivannan Sadhasivam
2026-09-04  0:12     ` Damien Le Moal
2026-09-04  3:19       ` Alistair Francis
2026-09-04  4:41         ` Damien Le Moal
2026-09-04  5:26           ` Alistair Francis
2026-09-05 15:46       ` Manivannan Sadhasivam
2026-09-01  9:20 ` Damien Le Moal

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=22cb4c64c9d7a2c5590bd0ea74a399169539d206.camel@wdc.com \
    --to=alistair.francis@wdc.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=alistair23@gmail.com \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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 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®