From: Alex Williamson <alex@shazbot.org>
To: "Cédric Le Goater" <clg@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Eric Auger <eric.auger@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
alex@shazbot.org
Subject: Re: [PATCH v2] vfio/listener: Replace misalignment whitelist with DMA capability check
Date: Wed, 8 Jul 2026 09:06:50 -0600 [thread overview]
Message-ID: <20260708090650.2247755c@shazbot.org> (raw)
In-Reply-To: <20260708133604.1606448-1-clg@redhat.com>
On Wed, 8 Jul 2026 15:36:04 +0200
Cédric Le Goater <clg@redhat.com> wrote:
> The vfio_known_safe_misalignment() whitelist (currently TPM CRB only)
> requires a new entry every time a device exposes a non-page-aligned
> region, which does not scale.
Arguable as we have exactly one class of device so far that's validated
as safe.
> Replace it with a DMA capability check: a region that is not
> page-aligned or is smaller than a host page can never be a valid DMA
> target, so a page-offset mismatch is harmless and only traced. Only
> warn for page-aligned, page-sized regions where the mismatch could
> indicate a real mapping problem.
But it's the composition into the address space and how that address
space is defined to the guest that matters. Imagine a minimum counter
example to the test presented here, a page-size range of RAM in the VM
is composed by a device as two contiguous sub-page MemoryRegions. We
only see the individual MRs here, they're each sub-page, the shape
suggests they're not DMA targets, but together they map contiguously
into the VM address space. KVM can trap and emulate them as normal
RAM. QEMU emulated devices can DMA to them as RAM. VFIO cannot map
them through the IOMMU.
That is what this test is meant to validate. The judgment that the
control register range for a TPM device presented as a RAM MR is not a
meaningful DMA target for a vfio device is the thing that cannot be
determined based only on the shape of the MR.
> This removes the TPM CRB dependency from the VFIO listener and
> eliminates the need for per-device whitelisting entirely.
And removes the diagnostic it provided. Thanks,
Alex
next prev parent reply other threads:[~2026-07-08 15:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 13:36 [PATCH v2] vfio/listener: Replace misalignment whitelist with DMA capability check Cédric Le Goater
2026-07-08 15:06 ` Alex Williamson [this message]
2026-07-08 15:20 ` Cédric Le Goater
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=20260708090650.2247755c@shazbot.org \
--to=alex@shazbot.org \
--cc=clg@redhat.com \
--cc=eric.auger@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.