From: Greg Kurz <gkurz@linux.vnet.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org, Rusty Russell <rusty@rustcorp.com.au>,
Paul Mackerras <paulus@samba.org>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] virtio: refresh registers at reset time
Date: Mon, 07 Oct 2013 17:23:44 +0200 [thread overview]
Message-ID: <20131007152344.26996.16447.stgit@bahia.local> (raw)
In-Reply-To: <20131007152327.26996.50016.stgit@bahia.local>
We need to support the guest endianness as soon as a virtio device shows
up. Alex suggested this can achieved by calling cpu_synchronize_state().
To have it working on PowerPC, we need to add LPCR in the sync register
functions.
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
hw/virtio/virtio.c | 5 +++++
target-ppc/kvm.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index bc728d8..4a294e1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -19,6 +19,7 @@
#include "qemu/atomic.h"
#include "hw/virtio/virtio-bus.h"
#include "hw/virtio/virtio-access.h"
+#include "sysemu/kvm.h"
/*
* The alignment to use between consumer and producer parts of vring.
@@ -566,6 +567,10 @@ void virtio_reset(void *opaque)
vdev->vq[i].signalled_used_valid = false;
vdev->vq[i].notification = true;
}
+
+ if (current_cpu) {
+ cpu_synchronize_state(current_cpu);
+ }
}
uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index b77ce5e..69ebe2a 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -869,6 +869,8 @@ int kvm_arch_put_registers(CPUState *cs, int level)
DPRINTF("Warning: Unable to set VPA information to KVM\n");
}
}
+
+ kvm_put_one_spr(cs, KVM_REG_PPC_LPCR, SPR_LPCR);
#endif /* TARGET_PPC64 */
}
@@ -1091,6 +1093,8 @@ int kvm_arch_get_registers(CPUState *cs)
DPRINTF("Warning: Unable to get VPA information from KVM\n");
}
}
+
+ kvm_get_one_spr(cs, KVM_REG_PPC_LPCR, SPR_LPCR);
#endif
}
next prev parent reply other threads:[~2013-10-07 15:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130925223118.GA2844@iris.ozlabs.ibm.com>
[not found] ` <20130927135930.10288.86526.stgit@nimbus>
[not found] ` <20130927164535.6dbeface@bahia.local>
[not found] ` <20131003162952.4cbf482c@bahia.local>
2013-10-04 11:43 ` [Qemu-devel] [RFC] QEMU/KVM PowerPC: virtio and guest endianness Alexander Graf
2013-10-04 13:43 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
[not found] ` <20131004115302.GA26884@iris.ozlabs.ibm.com>
[not found] ` <46DFE136-500E-4192-BB38-06333A6A0901@suse.de>
2013-10-04 14:08 ` Greg Kurz
2013-10-04 14:19 ` 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 ` Greg Kurz [this message]
2013-10-15 1:49 ` [Qemu-devel] [PATCH 2/2] virtio: refresh registers at reset time Rusty Russell
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=20131007152344.26996.16447.stgit@bahia.local \
--to=gkurz@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=paulus@samba.org \
--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 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).