From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNlZL-0006gd-Qn for qemu-devel@nongnu.org; Tue, 17 Feb 2015 12:04:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNlZG-00077n-RV for qemu-devel@nongnu.org; Tue, 17 Feb 2015 12:04:19 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:39439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNlZG-00077Y-Kn for qemu-devel@nongnu.org; Tue, 17 Feb 2015 12:04:14 -0500 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Feb 2015 10:04:11 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1423542976-8825-3-git-send-email-david@gibson.dropbear.id.au> References: <1423542976-8825-1-git-send-email-david@gibson.dropbear.id.au> <1423542976-8825-3-git-send-email-david@gibson.dropbear.id.au> Message-ID: <20150217170321.17930.63434@loki> Date: Tue, 17 Feb 2015 11:03:21 -0600 Subject: Re: [Qemu-devel] [PATCH 2/2] pseries: Switch VGA endian on H_SET_MODE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , agraf@suse.de, kraxel@redhat.com, benh@kernel.crashing.org Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, mdroth@us.ibm.com Quoting David Gibson (2015-02-09 22:36:16) > When the guest switches the interrupt endian mode, which essentially > means a global machine endian switch, we want to change the VGA > framebuffer endian mode as well in order to be backward compatible > with existing guests who don't know about the new endian control > register. > = > Signed-off-by: Benjamin Herrenschmidt > Signed-off-by: David Gibson I think maybe Gerd's review applied to the whole series, but: Reviewed-by: Michael Roth > --- > hw/ppc/spapr_hcall.c | 2 ++ > hw/ppc/spapr_pci.c | 28 ++++++++++++++++++++++++++++ > include/hw/ppc/spapr.h | 1 + > 3 files changed, 31 insertions(+) > = > diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c > index 8651447..4f76f1c 100644 > --- a/hw/ppc/spapr_hcall.c > +++ b/hw/ppc/spapr_hcall.c > @@ -731,12 +731,14 @@ static target_ulong h_set_mode_resource_le(PowerPCC= PU *cpu, > CPU_FOREACH(cs) { > set_spr(cs, SPR_LPCR, 0, LPCR_ILE); > } > + spapr_pci_switch_vga(true); > return H_SUCCESS; > = > case H_SET_MODE_ENDIAN_LITTLE: > CPU_FOREACH(cs) { > set_spr(cs, SPR_LPCR, LPCR_ILE, LPCR_ILE); > } > + spapr_pci_switch_vga(false); > return H_SUCCESS; > } > = > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 21b95b3..acf9e82 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -966,3 +966,31 @@ static void spapr_pci_register_types(void) > } > = > type_init(spapr_pci_register_types) > + > +static int spapr_switch_one_vga(DeviceState *dev, void *opaque) > +{ > + bool be =3D *(bool *)opaque; > + > + if (object_dynamic_cast(OBJECT(dev), "VGA") > + || object_dynamic_cast(OBJECT(dev), "secondary-vga")) { > + object_property_set_bool(OBJECT(dev), be, "big-endian-framebuffe= r", > + &error_abort); > + } > + return 0; > +} > + > +void spapr_pci_switch_vga(bool big_endian) > +{ > + sPAPRPHBState *sphb; > + > + /* > + * For backward compatibility with existing guests, we switch > + * the endianness of the VGA controller when changing the guest > + * interrupt mode > + */ > + QLIST_FOREACH(sphb, &spapr->phbs, list) { > + BusState *bus =3D &PCI_HOST_BRIDGE(sphb)->bus->qbus; > + qbus_walk_children(bus, spapr_switch_one_vga, NULL, NULL, NULL, > + &big_endian); > + } > +} > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 716bff4..6aadc94 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -480,5 +480,6 @@ int spapr_dma_dt(void *fdt, int node_off, const char = *propname, > uint32_t liobn, uint64_t window, uint32_t size); > int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname, > sPAPRTCETable *tcet); > +void spapr_pci_switch_vga(bool big_endian); > = > #endif /* !defined (__HW_SPAPR_H__) */ > -- = > 2.1.0