From patchwork Mon Oct 7 15:23:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 281131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6FD622C00A7 for ; Tue, 8 Oct 2013 02:24:36 +1100 (EST) Received: from localhost ([::1]:60272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTCff-0001SF-Pi for incoming@patchwork.ozlabs.org; Mon, 07 Oct 2013 11:24:31 -0400 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 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 Oct 2013 16:23:48 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id A7FD92190061; Mon, 7 Oct 2013 16:23:47 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r97FNZCE65405136; Mon, 7 Oct 2013 15:23:35 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r97FNl3l029336; Mon, 7 Oct 2013 09:23:47 -0600 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r97FNl6s029333; Mon, 7 Oct 2013 09:23:47 -0600 Received: from bahia.local (sig-9-145-146-94.de.ibm.com [9.145.146.94]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 897B6210FF4; Mon, 7 Oct 2013 17:23:46 +0200 (CEST) To: Alexander Graf 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> User-Agent: StGit/0.16 MIME-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13100715-1948-0000-0000-00000682ECB4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.110 Cc: qemu-ppc@nongnu.org, Rusty Russell , Paul Mackerras , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/2] virtio: refresh registers at reset time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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 }