From: "Michael S. Tsirkin" <mst@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Shannon Zhao <shannon.zhao@linaro.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v2 0/4] target-arm: Add some omitted dma cache coherency flags
Date: Thu, 9 Feb 2017 20:13:21 +0200 [thread overview]
Message-ID: <20170209201301-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <70829774-a0c4-79ae-2eaf-cfac19e9dd7d@redhat.com>
On Thu, Feb 09, 2017 at 02:15:36PM +0100, Laszlo Ersek wrote:
> On 02/09/17 13:53, Alexander Graf wrote:
> > ARM is amazing when it comes to cache coherency and VMs. While any sane
> > architecture allows the host to override the guest's caching attributes,
> > that's very hard to do on ARM.
> >
> > That means that the guest may directly access guest memory bypassing the
> > cache while QEMU happily writes to / reads from cache. The end result is
> > very nasty, because both sides see very different views of the world.
> >
> > That means that we need to be very cautious to tell guests that devices
> > that QEMU emulates are going to use data in the cache rather than directly
> > on memory.
> >
> > We added this to PCI a while back for DT (5d636e21 "hw/arm/virt: mark the PCIe
> > host controller as DMA coherent in the DT") and ACPI (bc64b96 "hw/arm/virt-
> > acpi-build: _CCA attribute is compulsory") but never updated virtio-mmio or
> > fw-cfg in DT or ACPI tables.
> >
> > This patch set adds the respective cache coherency flags for them in both DT and
> > ACPI.
> >
> > Fortunately, no guests except for Linux 4.9.7 and 4.9.8 are broken because of
> > this. Upstream realized quickly enough that every user of virtio-mmio out there
> > describes its cache coherency incorrectly and reverted the patch that would
> > require said dma coherency flag. But we should be safe for the future and "do
> > the right thing".
> >
> > Alexander Graf (4):
> > target-arm: Declare virtio-mmio as dma-coherent in dt
> > hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI
> > hw/arm/virt: Declare fwcfg as dma cache coherent in ACPI
> > hw/arm/virt: Declare fwcfg as dma cache coherent in dt
> >
> > hw/arm/vexpress.c | 1 +
> > hw/arm/virt-acpi-build.c | 2 ++
> > hw/arm/virt.c | 2 ++
> > 3 files changed, 5 insertions(+)
> >
>
> Famous last words:
> series
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> Should we replicate patch #3 to QEMU0002 / FWCF in
> "hw/i386/acpi-build.c" too? Or is it that we couldn't care less about
> _CCA on x86? :) (Can't really muster the energy right now to look it up
> in the ACPI spec, sorry!)
>
> Thanks
> Laszlo
ACPI spec says:
On platforms for which existing default cache-coherency behavior of the OS is not adequate, _CCA
enables the OS to adapt to the differences
So I think we don't need it on x86.
--
MST
next prev parent reply other threads:[~2017-02-09 18:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 12:53 [Qemu-devel] [PATCH v2 0/4] target-arm: Add some omitted dma cache coherency flags Alexander Graf
2017-02-09 12:53 ` [Qemu-devel] [PATCH v2 1/4] target-arm: Declare virtio-mmio as dma-coherent in dt Alexander Graf
2017-02-09 12:53 ` [Qemu-devel] [PATCH v2 2/4] hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI Alexander Graf
2017-02-10 2:49 ` Shannon Zhao
2017-02-09 12:53 ` [Qemu-devel] [PATCH v2 3/4] hw/arm/virt: Declare fwcfg " Alexander Graf
2017-02-10 2:49 ` Shannon Zhao
2017-02-09 12:53 ` [Qemu-devel] [PATCH v2 4/4] hw/arm/virt: Declare fwcfg as dma cache coherent in dt Alexander Graf
2017-02-09 13:15 ` [Qemu-devel] [PATCH v2 0/4] target-arm: Add some omitted dma cache coherency flags Laszlo Ersek
2017-02-09 18:13 ` Michael S. Tsirkin [this message]
2017-02-09 18:27 ` Alexander Graf
2017-02-09 20:28 ` Laszlo Ersek
2017-02-09 17:51 ` Ard Biesheuvel
2017-02-10 15:02 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
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=20170209201301-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=ard.biesheuvel@linaro.org \
--cc=lersek@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhao@linaro.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).