[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/38] pseries: Switch VGA endian on H_SET_MODE
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PULL 18/38] pseries: Switch VGA endian on H_SET_MODE |
Date: |
Sun, 8 Mar 2015 09:44:37 +0100 |
From: David Gibson <address@hidden>
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 <address@hidden>
Signed-off-by: David Gibson <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
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(PowerPCCPU
*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 cebdeb3..7d37d83 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -982,3 +982,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 = *(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-framebuffer",
+ &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 = &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 a8e6817..168b608 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -481,6 +481,7 @@ 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);
#define TYPE_SPAPR_RTC "spapr-rtc"
--
1.8.1.4
- [Qemu-devel] [PULL 14/38] pseries: Export RTC time via QOM, (continued)
- [Qemu-devel] [PULL 14/38] pseries: Export RTC time via QOM, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 11/38] pseries: Make RTAS time of day functions respect -rtc options, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 20/38] display cpu id dump state, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 04/38] spapr: Add pseries-2.3 machine, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 08/38] pseries: Move sPAPR RTC code into its own file, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 31/38] Revert "default-configs/ppc64: add all components of i82378 SuperIO chip used by prep", Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 32/38] ppc64-softmmu: Remove unsupported FDC from config, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 28/38] openpic: switch IRQQueue queue from inline to bitmap, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 21/38] macio.c: include parent PCIDevice state in VMStateDescription, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 12/38] pseries: Make the PAPR RTC a qdev device, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 18/38] pseries: Switch VGA endian on H_SET_MODE,
Alexander Graf <=
- [Qemu-devel] [PULL 35/38] PPC: Introduce the Virtual Time Base (VTB) SPR register, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 07/38] Add more VMSTATE_*_TEST variants for integers, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 19/38] Openpic: check that cpu id is within the number of cpus, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 30/38] spapr_vio: Convert to realize(), Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 10/38] pseries: Add spapr_rtc_read() helper function, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 26/38] openpic: fix segfault on -M mac99 savevm, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 36/38] target-ppc: Add versions to server CPU descriptions, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 03/38] pseries: Limit PCI host bridge "index" value, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 34/38] PPC: Remove duplicate OPENPIC defines in default-configs, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 27/38] openpic: fix up loadvm under -M mac99, Alexander Graf, 2015/03/08