Re: [kvm-unit-tests PATCH v4 12/17] powerpc/ppc64: adapt arm's setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 17, 2016 at 01:45:40PM +0100, Andrew Jones wrote:
> On Wed, Feb 17, 2016 at 01:11:58PM +1100, David Gibson wrote:
> > On Mon, Feb 15, 2016 at 02:49:21PM +0100, Andrew Jones wrote:
> > > Copy arm's setup code (also DT based) over to powerpc, adapting
> > > it a bit. Also bring over arm's setup selftest, giving powerpc
> > > its first test.
> > > 
> > > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
> > > Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>
> > > Tested-by: Laurent Vivier <lvivier@xxxxxxxxxx>
> > > ---
> > >  lib/powerpc/asm/setup.h |  36 +++++++++++++++
> > >  lib/powerpc/setup.c     | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
> > >  lib/ppc64/asm/setup.h   |   1 +
> > >  powerpc/Makefile.common |   1 +
> > >  powerpc/cstart64.S      |  16 +++++++
> > >  powerpc/selftest.c      |  63 +++++++++++++++++++++++--
> > >  6 files changed, 233 insertions(+), 3 deletions(-)
> > >  create mode 100644 lib/powerpc/asm/setup.h
> > >  create mode 100644 lib/powerpc/setup.c
> > >  create mode 100644 lib/ppc64/asm/setup.h
> > > 
> > > diff --git a/lib/powerpc/asm/setup.h b/lib/powerpc/asm/setup.h
> > > new file mode 100644
> > > index 0000000000000..0b9f04b4b7289
> > > --- /dev/null
> > > +++ b/lib/powerpc/asm/setup.h
> > > @@ -0,0 +1,36 @@
> > > +#ifndef _ASMPOWERPC_SETUP_H_
> > > +#define _ASMPOWERPC_SETUP_H_
> > > +/*
> > > + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@xxxxxxxxxx>
> > > + *
> > > + * This work is licensed under the terms of the GNU LGPL, version 2.
> > > + */
> > > +#include <libcflat.h>
> > > +#include <alloc.h>	/* phys_addr_t */
> > > +
> > > +#define NR_CPUS			8	/* arbitrarily set for now */
> > > +extern u32 cpus[NR_CPUS];
> > > +extern int nr_cpus;
> > > +
> > > +#define NR_MEM_REGIONS		8
> > > +#define MR_F_PRIMARY		(1U << 0)
> > > +struct mem_region {
> > > +	phys_addr_t start;
> > > +	phys_addr_t end;
> > > +	unsigned int flags;
> > > +};
> > > +extern struct mem_region mem_regions[NR_MEM_REGIONS];
> > > +extern phys_addr_t __physical_start, __physical_end;
> > > +
> > > +#define PHYSICAL_START		(__physical_start)
> > > +#define PHYSICAL_END		(__physical_end)
> > > +
> > > +#ifdef __powerpc64__
> > > +#define L1_CACHE_SHIFT		7
> > > +#else
> > > +#define L1_CACHE_SHIFT		5
> > > +#endif
> > 
> > These aren't necessarily true for all systems, although it's probably
> > right for all BE, BookS systems supporting KVM at present.  It would
> > be better to get the cache alignment from the device tree if possible.
> 
> Ah, I hadn't considered being able to do that. I presume I can expect
> i-cache-line-size to always == d-cache-line-size, right?

In theory, no.  In practice, I don't think I've ever seen a machine
with them different, at least not anything even vaguely recent.

> > Also, is this correct for LE, which I imagine you'll want to support
> > soon (I don't recall if __powerpc64__ is defined for both BE and LE
> > systems).
> 
> This use of __powerpc64__ will go away with the above change, but I
> have another one in rtas.c. I don't know if it's valid for LE, but
> I'd prefer to ignore LE for now, and then create a new series that
> modifies everything necessary for enabling both BE and LE compiles.

Ok.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux