[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 10/20] cpu: introduce CPUClass::virtio_is_big
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [PATCH v8 10/20] cpu: introduce CPUClass::virtio_is_big_endian() |
Date: |
Fri, 13 Jun 2014 14:08:35 +0200 |
On Fri, 13 Jun 2014 13:42:04 +0200
Alexander Graf <address@hidden> 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 <address@hidden>
> > Signed-off-by: Greg Kurz <address@hidden>
> > ---
> > 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 address@hidden
address@hidden
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)562 165 496
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
- [Qemu-devel] [PATCH v8 04/20] virtio-blk: implement per-device migration calls, (continued)
- [Qemu-devel] [PATCH v8 04/20] virtio-blk: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 05/20] virtio-serial: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 06/20] virtio-balloon: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 07/20] virtio-rng: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 08/20] virtio: add subsections to the migration stream, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 09/20] exec: introduce target_words_bigendian() helper, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 10/20] cpu: introduce CPUClass::virtio_is_big_endian(), Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 11/20] virtio: add endian-ambivalent support to VirtIODevice, Greg Kurz, 2014/06/13
[Qemu-devel] [PATCH v8 12/20] virtio: memory accessors for endian-ambivalent targets, Greg Kurz, 2014/06/13
[Qemu-devel] [PATCH v8 13/20] virtio: allow byte swapping for vring, Greg Kurz, 2014/06/13
[Qemu-devel] [PATCH v8 14/20] virtio-net: use virtio wrappers to access headers, Greg Kurz, 2014/06/13