From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwqCe-0003xy-L1 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 06:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwqCW-0003FW-9b for qemu-devel@nongnu.org; Tue, 17 Jun 2014 06:01:20 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:46086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwqCW-0003FM-0b for qemu-devel@nongnu.org; Tue, 17 Jun 2014 06:01:12 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jun 2014 11:01:10 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id A13F9219006E for ; Tue, 17 Jun 2014 11:00:56 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5HA17QM24314036 for ; Tue, 17 Jun 2014 10:01:07 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s5HA17HN016689 for ; Tue, 17 Jun 2014 04:01:07 -0600 Date: Tue, 17 Jun 2014 12:00:44 +0200 From: Greg Kurz Message-ID: <20140617120044.3ae839fa@bahia.local> In-Reply-To: <53A007D3.2090604@ozlabs.ru> References: <1402974463.7661.102.camel@pasglop> <539FC6B9.6060003@redhat.com> <1402981184.7661.107.camel@pasglop> <539FD3F1.2010304@redhat.com> <53A007D3.2090604@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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: Alexey Kardashevskiy Cc: Peter Maydell , "qemu-devel@nongnu.org" , Alexander Graf , Gerd Hoffmann , Paolo Bonzini On Tue, 17 Jun 2014 19:18:11 +1000 Alexey Kardashevskiy 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 kurzgreg@fr.ibm.com gkurz@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.