From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwpfI-0007wI-EG for qemu-devel@nongnu.org; Tue, 17 Jun 2014 05:26:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwpfA-0008Vm-VJ for qemu-devel@nongnu.org; Tue, 17 Jun 2014 05:26:52 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55125 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwpfA-0008Ug-Of for qemu-devel@nongnu.org; Tue, 17 Jun 2014 05:26:44 -0400 Message-ID: <53A009D3.1050800@suse.de> Date: Tue, 17 Jun 2014 11:26:43 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1402974463.7661.102.camel@pasglop> <539FC6B9.6060003@redhat.com> <1402981184.7661.107.camel@pasglop> <539FD3F1.2010304@redhat.com> <53A007D3.2090604@ozlabs.ru> In-Reply-To: <53A007D3.2090604@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed 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 , Paolo Bonzini , Benjamin Herrenschmidt Cc: Peter Maydell , Greg Kurz , "qemu-devel@nongnu.org" , Gerd Hoffmann On 17.06.14 11:18, 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. > > Ideas? The register approach is nicer. Let's wait for Gerd to see what he thinks. Alex