From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTCfA-00019r-1x for qemu-devel@nongnu.org; Mon, 07 Oct 2013 11:24:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTCf0-0005KH-Su for qemu-devel@nongnu.org; Mon, 07 Oct 2013 11:23:59 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:44031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTCf0-0005Jx-HN for qemu-devel@nongnu.org; Mon, 07 Oct 2013 11:23:50 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Oct 2013 16:23:49 +0100 From: Greg Kurz Date: Mon, 07 Oct 2013 17:23:44 +0200 Message-ID: <20131007152344.26996.16447.stgit@bahia.local> In-Reply-To: <20131007152327.26996.50016.stgit@bahia.local> References: <20131007152327.26996.50016.stgit@bahia.local> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 2/2] virtio: refresh registers at reset time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: qemu-ppc@nongnu.org, Rusty Russell , Paul Mackerras , qemu-devel@nongnu.org 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 --- 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 }