From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwpX7-0003OM-V1 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 05:18:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwpX0-0005SS-8h for qemu-devel@nongnu.org; Tue, 17 Jun 2014 05:18:25 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:60955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwpX0-0005SG-3V for qemu-devel@nongnu.org; Tue, 17 Jun 2014 05:18:18 -0400 Received: by mail-pd0-f178.google.com with SMTP id r10so5437625pdi.9 for ; Tue, 17 Jun 2014 02:18:16 -0700 (PDT) Message-ID: <53A007D3.2090604@ozlabs.ru> Date: Tue, 17 Jun 2014 19:18:11 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1402974463.7661.102.camel@pasglop> <539FC6B9.6060003@redhat.com> <1402981184.7661.107.camel@pasglop> <539FD3F1.2010304@redhat.com> In-Reply-To: <539FD3F1.2010304@redhat.com> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] qemu VGA endian swap low level drawing changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Benjamin Herrenschmidt Cc: Peter Maydell , Alexander Graf , Greg Kurz , "qemu-devel@nongnu.org" , Gerd Hoffmann 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. Ideas? -- Alexey