From: Greg Kurz <gkurz@linux.vnet.ibm.com>
To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: rusty@rustcorp.com.au, agraf@suse.de
Subject: [Qemu-devel] [PATCH] target-ppc: ppc64 target's virtio can be either endian. (v3)
Date: Fri, 17 Jan 2014 14:52:12 +0100 [thread overview]
Message-ID: <20140117135211.27377.91848.stgit@bahia.local> (raw)
In-Reply-To: <20131211155716.8373.27979.stgit@bahia.local>
We base it on the OS endian, as reflected by the endianness of the
interrupt vectors (handled through the ILE bit in the LPCR register).
This patch implements virtio_get_byteswap() over LPCR.
Using first_cpu to fetch the registers from KVM may look arbitrary
and awkward, but it is okay because KVM sets/unsets the ILE bit on
all CPUs.
Changes in v3:
- dropped the explicit calls to kvm_[get|put]_one_reg as LPCR is
now properly handled by the generic SPR code.
Changes in v2:
- call cpu_synchronize_state() instead of kvm_arch_get_registers().
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
---
target-ppc/misc_helper.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/target-ppc/misc_helper.c b/target-ppc/misc_helper.c
index 616aab6..e8fc8a3 100644
--- a/target-ppc/misc_helper.c
+++ b/target-ppc/misc_helper.c
@@ -20,6 +20,8 @@
#include "helper.h"
#include "helper_regs.h"
+#include "hw/virtio/virtio.h"
+#include "sysemu/kvm.h"
/*****************************************************************************/
/* SPR accesses */
@@ -116,3 +118,13 @@ void ppc_store_msr(CPUPPCState *env, target_ulong value)
{
hreg_store_msr(env, value, 0);
}
+
+bool virtio_get_byteswap(void)
+{
+ PowerPCCPU *cp = POWERPC_CPU(first_cpu);
+ CPUPPCState *env = &cp->env;
+
+ cpu_synchronize_state(first_cpu);
+
+ return env->spr[SPR_LPCR] & LPCR_ILE;
+}
next prev parent reply other threads:[~2014-01-17 13:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 15:35 [Qemu-devel] [PATCH] target-ppc: ppc64 target's virtio can be either endian Greg Kurz
2013-12-09 15:33 ` Alexander Graf
2013-12-09 17:11 ` Greg Kurz
2013-12-09 17:18 ` Alexander Graf
2013-12-10 17:37 ` Greg Kurz
2013-12-10 17:48 ` Alexander Graf
2013-12-10 19:44 ` Greg Kurz
2013-12-10 22:25 ` Alexander Graf
2013-12-11 15:59 ` [Qemu-devel] [PATCH V2] " Greg Kurz
2013-12-11 16:11 ` Alexander Graf
2013-12-11 17:18 ` Greg Kurz
2014-01-17 13:52 ` Greg Kurz [this message]
2014-01-20 14:36 ` [Qemu-devel] [PATCH] target-ppc: ppc64 target's virtio can be either endian. (v3) Alexander Graf
2013-12-09 19:44 ` [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: ppc64 target's virtio can be either endian Benjamin Herrenschmidt
2013-12-10 1:18 ` Alexander Graf
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=20140117135211.27377.91848.stgit@bahia.local \
--to=gkurz@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rusty@rustcorp.com.au \
/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.