From: Paul Mackerras <paulus@samba.org>
To: kvm-ppc@vger.kernel.org
Subject: Re: [RFC] QEMU/KVM PowerPC: virtio and guest endianness
Date: Fri, 04 Oct 2013 11:53:02 +0000 [thread overview]
Message-ID: <20131004115302.GA26884@iris.ozlabs.ibm.com> (raw)
In-Reply-To: <20131003162952.4cbf482c@bahia.local>
On Thu, Oct 03, 2013 at 04:29:52PM +0200, Greg Kurz wrote:
> Hi,
>
> There have been some work on the topic lately but no agreement has
> been reached yet. I want to consolidate the facts in a single thread of
> mail and re-start the discussion. Please find below a recap of what we
> have as of today:
>
> From a virtio POV, guest endianness is reflected by the endianness of
> the interrupt vectors (ILE bit in the LPCR register). The guest kernel
> relies on the H_SET_MODE_RESOURCE_LE hcall to set this bit, early in the
> boot process.
>
> Rusty sent a patchset on qemu-devel@ to provide the necessary bits to
> perform byteswap in the QEMU:
>
> http://patchwork.ozlabs.org/patch/266451/
> http://patchwork.ozlabs.org/patch/266452/
> http://patchwork.ozlabs.org/patch/266450/
> (plus other enablement patches for virtio drivers, not essential for
> the discussion).
>
> In non-KVM mode, QEMU implements the H_SET_MODE_RESOURCE_LE and updates
> its internal value for LPCR when the guest requests it. Rusty's patchset
> works out-of-the-box in this mode: I could successfully setup and use a
> 9p share over virtio transport (broader virtio testing still to be done
> though).
>
> When using KVM, the story is different : QEMU is not on this
> endianness change flow anymore, providing KVM has the following
> patch from Anton:
>
> http://patchwork.ozlabs.org/patch/277079/
>
> There are *at least* two approaches to bring back endianness knowledge
> to QEMU: polling (1) and propagation (2).
>
> (1) QEMU must retrieve LPCR from the kernel using the following API:
>
> http://patchwork.ozlabs.org/patch/273029/
>
> (2) KVM can resume execution to the host and thus propagating
> H_SET_MODE_RESOURCE_LE to QEMU. Laurent came up with a patch on
> linuxppc-dev@ to do this:
>
> http://patchwork.ozlabs.org/patch/278590/
>
> I would say (1) is a standard and sane way of addressing the issue:
> since the LPCR register value is held by KVM, it makes sense to
> introduce an API to get/set it. Then, it is up to QEMU to use this API.
>
> We can dumbly do the polling in all the places where byteswapping
> matters: it is clearly sub-optimized, especially since the LPCR_ILE bit
> doesn't change so often. Rusty suggested we can retrieve it at virtio
> device reset time and cache it, since an endianness change after the
> devices have started to be used is non-sensical.
>
> I have searched for an appropriate place to add the polling and I must
> admit I did not find any... I am no QEMU expert but I suspect we would
> need some kind of arch specific hook to be called from the virtio code
> to do this... :-\ I hope I am wrong, please correct me if so.
>
> On the other hand, (2) looks a bit hacky: KVM usually returns to the
> host when it cannot fully handle the h_call. Propagating may look like
> a useless path to follow from a KVM POV. From a QEMU POV, things are
> different: propagation will trig the fallback code in QEMU, already
> working in non-KVM mode. Nothing more to be done.
I don't mind particularly whether H_SET_MODE for the endianness
setting gets handled in the kernel or in QEMU, but I don't think it
should be handled in both. If you want QEMU to know about the
endianness setting immediately, make the kernel version do nothing and
get QEMU to handle it -- which if KVM is enabled will mean iterating
over all vcpus and getting them all to send the new LPCR setting to
the kernel via the SET_ONE_REG ioctl.
However, I want the setting of breakpoint registers (CIABR and DAWR/X)
via H_SET_MODE to happen in the kernel, preferably in real mode, since
that can happen on context switch and thus needs to be quick.
Regards,
Paul.
next prev parent reply other threads:[~2013-10-04 11:53 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-23 2:04 [PATCH 00/39] Second round of 64bit PowerPC little endian patches Anton Blanchard
2013-09-23 2:04 ` [PATCH 01/39] powerpc: Fix endian issues in VMX copy loops Anton Blanchard
2013-09-23 2:04 ` [PATCH 02/39] powerpc: Book 3S MMU little endian support Anton Blanchard
2013-09-23 2:04 ` [PATCH 03/39] powerpc: Fix offset of FPRs in VSX registers in little endian builds Anton Blanchard
2013-09-23 2:04 ` [PATCH 04/39] powerpc: PTRACE_PEEKUSR/PTRACE_POKEUSER of FPR " Anton Blanchard
2013-09-23 2:04 ` [PATCH 05/39] powerpc: Little endian builds double word swap VSX state during context save/restore Anton Blanchard
2013-09-23 2:04 ` [PATCH 06/39] powerpc: Support endian agnostic MMIO Anton Blanchard
2013-09-23 2:04 ` [PATCH 07/39] powerpc: Add little endian support for word-at-a-time functions Anton Blanchard
2013-09-23 2:04 ` [PATCH 08/39] powerpc: Set MSR_LE bit on little endian builds Anton Blanchard
2013-09-23 2:04 ` [PATCH 09/39] powerpc: Reset MSR_LE on signal entry Anton Blanchard
2013-09-23 2:04 ` [PATCH 10/39] powerpc: Include the appropriate endianness header Anton Blanchard
2013-09-23 2:04 ` [PATCH 11/39] powerpc: endian safe trampoline Anton Blanchard
2013-12-28 7:24 ` Olof Johansson
2013-12-28 7:58 ` Benjamin Herrenschmidt
2013-09-23 2:04 ` [PATCH 12/39] powerpc: Remove open coded byte swap macro in alignment handler Anton Blanchard
2013-09-23 2:04 ` [PATCH 13/39] powerpc: Remove hard coded FP offsets " Anton Blanchard
2013-09-23 2:04 ` [PATCH 14/39] powerpc: Alignment handler shouldn't access VSX registers with TS_FPR Anton Blanchard
2013-09-23 2:04 ` [PATCH 15/39] powerpc: Add little endian support to alignment handler Anton Blanchard
2013-09-23 2:04 ` [PATCH 16/39] powerpc: Handle VSX alignment faults in little endian mode Anton Blanchard
2013-09-23 2:04 ` [PATCH 17/39] powerpc: Use generic checksum code in little endian Anton Blanchard
2013-09-23 2:04 ` [PATCH 18/39] powerpc: Use generic memcpy " Anton Blanchard
2013-09-23 2:04 ` [PATCH 19/39] powerpc: uname should return ppc64le/ppcle on little endian builds Anton Blanchard
2013-09-23 2:04 ` [PATCH 20/39] powerpc: Little endian fixes for platforms/powernv/opal.c Anton Blanchard
2013-09-23 2:04 ` [PATCH 21/39] powerpc: Little endian fix for arch/powerpc/platforms/powernv/pci.c Anton Blanchard
2013-09-23 2:04 ` [PATCH 22/39] powerpc: Little endian fix for arch/powerpc/platforms/powernv/pci-p5ioc2.c Anton Blanchard
2013-09-23 2:04 ` [PATCH 23/39] powerpc: Little endian sparse clean up for arch/powerpc/platforms/powernv/pci-ioda.c Anton Blanchard
2013-09-23 2:04 ` [PATCH 24/39] powerpc/powernv: Fix endian issues in OPAL RTC driver Anton Blanchard
2013-09-23 2:04 ` [PATCH 25/39] powerpc/powernv: Fix endian issues in OPAL ICS backend Anton Blanchard
2013-09-23 2:05 ` [PATCH 26/39] powerpc/powernv: Make OPAL NVRAM device tree accesses endian safe Anton Blanchard
2013-09-23 2:05 ` [PATCH 27/39] powerpc/powernv: Fix endian issues in powernv PCI code Anton Blanchard
2013-09-23 2:05 ` [PATCH 28/39] powerpc/powernv: Fix endian issues in OPAL console and udbg backend Anton Blanchard
2013-09-23 2:05 ` [PATCH 29/39] powerpc/powernv: Fix OPAL entry and exit in little endian mode Anton Blanchard
2013-09-23 2:05 ` [PATCH 30/39] powerpc/powernv: Don't register exception handlers " Anton Blanchard
2013-09-23 2:05 ` [PATCH 31/39] powerpc/powernv: More little endian issues in OPAL RTC driver Anton Blanchard
2013-09-23 2:05 ` [PATCH 32/39] powerpc/powernv: Fix some PCI sparse errors and one LE bug Anton Blanchard
2013-09-23 2:05 ` [PATCH 33/39] powerpc/hvsi: Fix endian issues in HVSI driver Anton Blanchard
2013-09-23 2:05 ` [PATCH 34/39] tty/hvc_opal: powerpc: Make OPAL HVC device tree accesses endian safe Anton Blanchard
2013-09-23 2:05 ` [PATCH 35/39] KVM: PPC: Disable KVM on little endian builds Anton Blanchard
2013-09-23 2:05 ` [PATCH 36/39] powerpc/kvm/book3s_hv: Add little endian guest support Anton Blanchard
2013-09-25 12:10 ` [PATCH] powerpc/kvmbook3s_hv: propagate H_SET_MODE to the host Laurent Dufour
2013-09-25 12:27 ` Greg Kurz
2013-09-25 22:31 ` Paul Mackerras
2013-09-27 8:14 ` Laurent Dufour
2013-09-27 13:59 ` [PATCH V2] powerpc/kvm/book3s_hv: propagate H_SET_MODE_RESOURCE_LE " Laurent Dufour
2013-09-27 14:45 ` Greg Kurz
2013-10-03 14:29 ` [RFC] QEMU/KVM PowerPC: virtio and guest endianness Greg Kurz
2013-10-04 11:43 ` Alexander Graf
2013-10-04 11:43 ` [Qemu-devel] " Alexander Graf
2013-10-04 13:43 ` [Qemu-ppc] " Greg Kurz
2013-10-04 13:43 ` [Qemu-devel] " Greg Kurz
2013-10-04 11:53 ` Paul Mackerras [this message]
2013-10-04 11:54 ` Alexander Graf
2013-10-04 14:08 ` Greg Kurz
2013-10-04 14:08 ` [Qemu-devel] " Greg Kurz
2013-10-04 14:19 ` Alexander Graf
2013-10-04 14:19 ` [Qemu-devel] " Alexander Graf
2013-10-07 15:23 ` [Qemu-devel] [PATCH 0/2] virtio: guest endianness support Greg Kurz
2013-10-07 15:23 ` [Qemu-devel] [PATCH 1/2] linux-headers: POWER8 partial update Greg Kurz
2013-10-07 15:23 ` [Qemu-devel] [PATCH 2/2] virtio: refresh registers at reset time Greg Kurz
2013-10-15 1:49 ` Rusty Russell
2013-09-30 18:40 ` [PATCH 36/39] powerpc/kvm/book3s_hv: Add little endian guest support Alexander Graf
2013-09-23 2:05 ` [PATCH 37/39] powerpc: Add ability to build little endian kernels Anton Blanchard
2013-09-23 2:05 ` [PATCH 38/39] powerpc: Don't set HAVE_EFFICIENT_UNALIGNED_ACCESS on little endian builds Anton Blanchard
2013-09-23 2:05 ` [PATCH 39/39] powerpc: Work around little endian gcc bug Anton Blanchard
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=20131004115302.GA26884@iris.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=kvm-ppc@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 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.