On Tue, 17 Jun 2014 19:18:11 +1000 Alexey Kardashevskiy <a...@ozlabs.ru> wrote:
> On 06/17/2014 03:36 PM, Paolo Bonzini wrote: > > Il 17/06/2014 06:59, Benjamin Herrenschmidt ha scritto: > >> Thanks. I've tried the other approach of adding new functions which > >> means no overhead (hopefully) for the non-swap case and less invasive > >> changes to vga_template.c. > >> > >> Patch below. What do you think ? This or the previous approach ? Then we > >> can discuss how we actually trigger the endian change and where we store > >> the state :-) > > > > This is definitely more readable. Anyway Gerd is the VGA guy. :) > > I am that lucky person who got to do endianness-on-fly-switching > QOM'fication :) > > We have 2 ways of doing this: > > 1. implement a VGA register in QEMU and use it from the guest; > there is a try to discuss it in "[Qemu-devel] Endian control register"; > requires guest changes; > > 2. on SPAPR we have H_SET_MODE hypercall which guest uses when it switches > endianness and current hack is to change the flag directly in VGA device > from this hypercall handler. Instead of that hack, we could have added a > device callback: > > void DeviceClass::endianness_notify(DeviceState *dev, > enum device_endian endianness); > > or even an Interface (with the same method alone). And in H_SET_MODE we > could walk through all devices in the system and poke ones which implement > a callback or an interface. virtio could benefit from this as well. > There has been a discussion already about virtio endianness: relying on a guest system wide setting such as LPCR_ILE has been strongly rejected at the time... The consensus for virtio is "device endianness is the endianness of the CPU that does the reset" (hence MSR_LE for PPC). I don't know the details for VGA, but virtio would not benefit from such callback. > Ideas? > > -- Gregory Kurz kurzg...@fr.ibm.com gk...@linux.vnet.ibm.com Software Engineer @ IBM/Meiosys http://www.ibm.com Tel +33 (0)562 165 496 "Anarchy is about taking complete responsibility for yourself." Alan Moore.