From: David Gibson <david@gibson.dropbear.id.au>
To: 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, David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 1/2] vga: Expose framebuffer byteorder as a QOM property
Date: Tue, 10 Feb 2015 15:36:15 +1100 [thread overview]
Message-ID: <1423542976-8825-2-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1423542976-8825-1-git-send-email-david@gibson.dropbear.id.au>
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(+)
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;
}
--
2.1.0
next prev parent reply other threads:[~2015-02-10 4:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 4:36 [Qemu-devel] [PATCH 0/2] ppc: Automatically set vga framebuffer endianness based on guest David Gibson
2015-02-10 4:36 ` David Gibson [this message]
2015-02-10 9:19 ` [Qemu-devel] [PATCH 1/2] vga: Expose framebuffer byteorder as a QOM property Gerd Hoffmann
2015-02-10 10:58 ` David Gibson
2015-02-10 4:36 ` [Qemu-devel] [PATCH 2/2] pseries: Switch VGA endian on H_SET_MODE David Gibson
2015-02-17 17:03 ` Michael Roth
2015-02-20 14:11 ` [Qemu-devel] [PATCH 0/2] ppc: Automatically set vga framebuffer endianness based on guest Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423542976-8825-2-git-send-email-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=kraxel@redhat.com \
--cc=mdroth@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).