From patchwork Sun Mar 8 08:44:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 447720 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DDB65140083 for ; Sun, 8 Mar 2015 20:05:19 +1100 (AEDT) Received: from localhost ([::1]:38051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUX9C-0007F0-2z for incoming@patchwork.ozlabs.org; Sun, 08 Mar 2015 05:05:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUWpk-0004hX-2B for qemu-devel@nongnu.org; Sun, 08 Mar 2015 04:45:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUWpc-0004ky-1x for qemu-devel@nongnu.org; Sun, 08 Mar 2015 04:45:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33753 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUWpb-0004ba-N7; Sun, 08 Mar 2015 04:45:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 62C9FADC3; Sun, 8 Mar 2015 08:45:00 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Sun, 8 Mar 2015 09:44:36 +0100 Message-Id: <1425804297-53727-18-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1425804297-53727-1-git-send-email-agraf@suse.de> References: <1425804297-53727-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, David Gibson Subject: [Qemu-devel] [PULL 17/38] vga: Expose framebuffer byteorder as a QOM property 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 From: David Gibson The VGA device model now supports having the framebuffer in either endian, and can be switched between these by the guest via a register in the qext region. However, in some cases (e.g. LE OS on the pseries machine) we have existing guest that don't know about the endian switch register, but other parts of the qemu code have better information to set a default endianness than the VGA code does of itself. In order to allow them to set a correct default endianness in these cases, without breaking abstraction walls, this patch exposes the VGA framebuffer endianness via a writable QOM property. Signed-off-by: David Gibson Reviewed-by: Gerd Hoffmann Signed-off-by: Alexander Graf --- hw/display/vga-pci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index 53739e4..8bd6ff7 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -181,6 +181,20 @@ static void pci_vga_qext_write(void *ptr, hwaddr addr, } } +static bool vga_get_big_endian_fb(Object *obj, Error **errp) +{ + PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, PCI_DEVICE(obj)); + + return d->vga.big_endian_fb; +} + +static void vga_set_big_endian_fb(Object *obj, bool value, Error **errp) +{ + PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, PCI_DEVICE(obj)); + + d->vga.big_endian_fb = value; +} + static const MemoryRegionOps pci_vga_qext_ops = { .read = pci_vga_qext_read, .write = pci_vga_qext_write, @@ -233,6 +247,10 @@ static int pci_std_vga_initfn(PCIDevice *dev) vga_init_vbe(s, OBJECT(dev), pci_address_space(dev)); } + /* Expose framebuffer byteorder via QOM */ + object_property_add_bool(OBJECT(dev), "big-endian-framebuffer", + vga_get_big_endian_fb, vga_set_big_endian_fb, NULL); + return 0; } @@ -268,6 +286,10 @@ static int pci_secondary_vga_initfn(PCIDevice *dev) pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram); pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio); + /* Expose framebuffer byteorder via QOM */ + object_property_add_bool(OBJECT(dev), "big-endian-framebuffer", + vga_get_big_endian_fb, vga_set_big_endian_fb, NULL); + return 0; }