Message ID | 1423542976-8825-2-git-send-email-david@gibson.dropbear.id.au |
---|---|
State | New |
Headers | show |
On Di, 2015-02-10 at 15:36 +1100, David Gibson wrote: > 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 <david@gibson.dropbear.id.au> > > prop fixup squash leftover? Otherwise: Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> (assuming this little series gets in via ppc tree). cheers, Gerd
On Tue, Feb 10, 2015 at 10:19:58AM +0100, Gerd Hoffmann wrote: > On Di, 2015-02-10 at 15:36 +1100, David Gibson wrote: > > 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 <david@gibson.dropbear.id.au> > > > > prop fixup > > squash leftover? Oops, yes. > Otherwise: > > Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> > > (assuming this little series gets in via ppc tree). > > cheers, > Gerd > >
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; }
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 <david@gibson.dropbear.id.au> prop fixup --- hw/display/vga-pci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)