From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvQHt-0006vh-8C for qemu-devel@nongnu.org; Fri, 13 Jun 2014 08:09:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvQHl-0005MH-JN for qemu-devel@nongnu.org; Fri, 13 Jun 2014 08:08:53 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:34541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvQHl-0005KT-4P for qemu-devel@nongnu.org; Fri, 13 Jun 2014 08:08:45 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Jun 2014 13:08:43 +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 223C8219004D for ; Fri, 13 Jun 2014 13:08:30 +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 s5DC8fAB35848228 for ; Fri, 13 Jun 2014 12:08:41 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 s5DC8eC1031239 for ; Fri, 13 Jun 2014 06:08:40 -0600 Date: Fri, 13 Jun 2014 14:08:35 +0200 From: Greg Kurz Message-ID: <20140613140835.515970d8@bahia.local> In-Reply-To: <539AE38C.2060906@suse.de> References: <20140613111703.22108.14322.stgit@bahia.local> <20140613112201.22108.52075.stgit@bahia.local> <539AE38C.2060906@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v8 10/20] cpu: introduce CPUClass::virtio_is_big_endian() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , "Michael S. Tsirkin" , Rusty Russell , qemu-devel@nongnu.org, Juan Quintela , aneesh.kumar@linux.vnet.ibm.com, Anthony Liguori , Amit Shah , Paolo Bonzini , Andreas =?UTF-8?B?RsOkcmJlcg==?= On Fri, 13 Jun 2014 13:42:04 +0200 Alexander Graf wrote: > > On 13.06.14 13:22, Greg Kurz wrote: > > If we want to support targets that can change endianness (modern PPC and > > ARM for the moment), we need to add a per-CPU class method to be called > > from the virtio code. The virtio_ prefix in the name is a hint for people > > to avoid misusage (aka. anywhere but from the virtio code). > > > > The default behaviour is to return the compile-time default target > > endianness. > > > > Suggested-by: Peter Maydell > > Signed-off-by: Greg Kurz > > --- > > include/qom/cpu.h | 10 ++++++++++ > > qom/cpu.c | 6 ++++++ > > 2 files changed, 16 insertions(+) > > > > diff --git a/include/qom/cpu.h b/include/qom/cpu.h > > index 4b352a2..30e8fe3 100644 > > --- a/include/qom/cpu.h > > +++ b/include/qom/cpu.h > > @@ -116,6 +116,7 @@ typedef struct CPUClass { > > CPUUnassignedAccess do_unassigned_access; > > void (*do_unaligned_access)(CPUState *cpu, vaddr addr, > > int is_write, int is_user, uintptr_t retaddr); > > + bool (*virtio_is_big_endian)(CPUState *cpu); > > int (*memory_rw_debug)(CPUState *cpu, vaddr addr, > > uint8_t *buf, int len, bool is_write); > > void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, > > @@ -548,6 +549,15 @@ void cpu_interrupt(CPUState *cpu, int mask); > > > > #endif /* USER_ONLY */ > > > > +#ifndef CONFIG_USER_ONLY > > +static inline bool cpu_virtio_is_big_endian(CPUState *cpu) > > +{ > > + CPUClass *cc = CPU_GET_CLASS(cpu); > > + > > + return cc->virtio_is_big_endian(cpu); > > +} > > +#endif > > + > > Why? Just do this from virtio code directly. > > > Alex > Well I guess it is the same mistake as in the previous patch... I put it there because it is a cpu method, but indeed it should only be exposed to virtio code. -- 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.