----- Original Message -----
> From: "Thomas Huth" <th...@redhat.com>
> To: "Laurent Vivier" <lviv...@redhat.com>, qemu-devel@nongnu.org
> Cc: "David Gibson" <da...@gibson.dropbear.id.au>, qemu-...@nongnu.org, "Dr . 
> David Alan Gilbert"
> <dgilb...@redhat.com>, "Miroslav Rezanina" <mreza...@redhat.com>
> Sent: Monday, September 11, 2017 4:36:01 PM
> Subject: Re: [PATCH] hmp: fix "dump-quest-memory" segfault (ppc)
> 
> On 11.09.2017 13:00, Laurent Vivier wrote:
> > Commit fd5d23babf (hmp: fix "dump-quest-memory" segfault)
> > fixes the problem for i386, do the same for ppc.
> > 
> > Running QEMU with
> >     qemu-system-ppc64 -M none -nographic -m 256
> > and executing
> >     dump-guest-memory /dev/null 0 8192
> > results in segfault
> > 
> > Fix by checking if we have CPU.
> > 
> > Signed-off-by: Laurent Vivier <lviv...@redhat.com>
> > ---
> >  target/ppc/arch_dump.c | 17 +++++++++++------
> >  1 file changed, 11 insertions(+), 6 deletions(-)
> > 
> > diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
> > index 8e9397aa58..dcb7b19950 100644
> > --- a/target/ppc/arch_dump.c
> > +++ b/target/ppc/arch_dump.c
> > @@ -224,17 +224,22 @@ typedef struct NoteFuncDescStruct NoteFuncDesc;
> >  int cpu_get_dump_info(ArchDumpInfo *info,
> >                        const struct GuestPhysBlockList *guest_phys_blocks)
> >  {
> > -    PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
> > -    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
> > -
> >      info->d_machine = PPC_ELF_MACHINE;
> >      info->d_class = ELFCLASS;
> >  
> > -    if ((*pcc->interrupts_big_endian)(cpu)) {
> > -        info->d_endian = ELFDATA2MSB;
> > +    if (first_cpu) {
> > +        PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
> > +        PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
> > +
> > +        if ((*pcc->interrupts_big_endian)(cpu)) {
> > +            info->d_endian = ELFDATA2MSB;
> > +        } else {
> > +            info->d_endian = ELFDATA2LSB;
> > +        }
> >      } else {
> > -        info->d_endian = ELFDATA2LSB;
> > +        info->d_endian = ELFDATA2MSB;
> >      }
> > +
> >      /* 64KB is the max page size for pseries kernel */
> >      if (strncmp(object_get_typename(qdev_get_machine()),
> >                  "pseries-", 8) == 0) {
> > 
> 
> Reviewed-by: Thomas Huth <th...@redhat.com>
> 

We need similar fix for aarch64 too.

Mirek
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team


Reply via email to