Message ID | 1409171401-22616-3-git-send-email-arnab.basu@freescale.com |
---|---|
State | Changes Requested |
Delegated to: | Albert ARIBAUD |
Headers | show |
Hi Arnab, On Wed, Aug 27, 2014 at 09:29:55PM +0100, Arnab Basu wrote: > Both ARMv7 and ARMv8 need to patch the device tree but the kind > of patching done is different. This creates a function that can be > defined by each architecture to handle the differences I have no problem with the patch, but what is it that we need to do differently for ARMv7 and ARMv8? Mark. > Signed-off-by: Arnab Basu <arnab.basu@freescale.com> > Reviewed-by: Bhupesh Sharma <bhupesh.sharma@freescale.com> > Cc: Marc Zyngier <marc.zyngier@arm.com> > --- > arch/arm/cpu/armv7/virt-dt.c | 7 ++++++- > arch/arm/lib/bootm-fdt.c | 11 ++++++++--- > 2 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c > index 0b0d6a7..3fbec39 100644 > --- a/arch/arm/cpu/armv7/virt-dt.c > +++ b/arch/arm/cpu/armv7/virt-dt.c > @@ -88,7 +88,7 @@ static int fdt_psci(void *fdt) > return 0; > } > > -int armv7_update_dt(void *fdt) > +static int armv7_update_dt(void *fdt) > { > #ifndef CONFIG_ARMV7_SECURE_BASE > /* secure code lives in RAM, keep it alive */ > @@ -98,3 +98,8 @@ int armv7_update_dt(void *fdt) > > return fdt_psci(fdt); > } > + > +int cpu_update_dt(void *fdt) > +{ > + return armv7_update_dt(fdt); > +} > diff --git a/arch/arm/lib/bootm-fdt.c b/arch/arm/lib/bootm-fdt.c > index d4f1578..daabc03 100644 > --- a/arch/arm/lib/bootm-fdt.c > +++ b/arch/arm/lib/bootm-fdt.c > @@ -21,6 +21,11 @@ > > DECLARE_GLOBAL_DATA_PTR; > > +__weak int cpu_update_dt(void *fdt) > +{ > + return 0; > +} > + > int arch_fixup_fdt(void *blob) > { > bd_t *bd = gd->bd; > @@ -34,11 +39,11 @@ int arch_fixup_fdt(void *blob) > } > > ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS); > -#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT) > + > if (ret) > return ret; > > - ret = armv7_update_dt(blob); > -#endif > + ret = cpu_update_dt(blob); > + > return ret; > } > -- > 1.7.7.4 > >
Hi Mark On 08/28/2014 03:40 PM, Mark Rutland wrote: > Hi Arnab, > > On Wed, Aug 27, 2014 at 09:29:55PM +0100, Arnab Basu wrote: >> Both ARMv7 and ARMv8 need to patch the device tree but the kind >> of patching done is different. This creates a function that can be >> defined by each architecture to handle the differences > > I have no problem with the patch, but what is it that we need to do > differently for ARMv7 and ARMv8? > In ARMv7 there does not seem to be any code around to set "enable-method" to "spin-table". I guess it is assumed that DTs already come with this set. For ARMv8 we would like to assume that "enable-method" is missing from the cpu node and will be set either to "spin-table" or "psci" by the boot loader. So the difference is, for ARMv7 the "enable-method" is only modified in case of PSCI, whereas for ARMv8 it is always modified. Thanks Arnab > Mark. >
On Thu, Aug 28, 2014 at 11:51:08AM +0100, Arnab Basu wrote: > Hi Mark > > On 08/28/2014 03:40 PM, Mark Rutland wrote: > > Hi Arnab, > > > > On Wed, Aug 27, 2014 at 09:29:55PM +0100, Arnab Basu wrote: > >> Both ARMv7 and ARMv8 need to patch the device tree but the kind > >> of patching done is different. This creates a function that can be > >> defined by each architecture to handle the differences > > > > I have no problem with the patch, but what is it that we need to do > > differently for ARMv7 and ARMv8? > > > > In ARMv7 there does not seem to be any code around to set > "enable-method" to "spin-table". I guess it is assumed that DTs already > come with this set. That'll be a consequence of partial conversion frmo board file on the 32-bit side. For most platforms the SMP boot mechanism is still implicit. > For ARMv8 we would like to assume that "enable-method" is missing from > the cpu node and will be set either to "spin-table" or "psci" by the > boot loader. Sounds good to me. > So the difference is, for ARMv7 the "enable-method" is only modified in > case of PSCI, whereas for ARMv8 it is always modified. Ok. Thanks for the description. :) Mark.
diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c index 0b0d6a7..3fbec39 100644 --- a/arch/arm/cpu/armv7/virt-dt.c +++ b/arch/arm/cpu/armv7/virt-dt.c @@ -88,7 +88,7 @@ static int fdt_psci(void *fdt) return 0; } -int armv7_update_dt(void *fdt) +static int armv7_update_dt(void *fdt) { #ifndef CONFIG_ARMV7_SECURE_BASE /* secure code lives in RAM, keep it alive */ @@ -98,3 +98,8 @@ int armv7_update_dt(void *fdt) return fdt_psci(fdt); } + +int cpu_update_dt(void *fdt) +{ + return armv7_update_dt(fdt); +} diff --git a/arch/arm/lib/bootm-fdt.c b/arch/arm/lib/bootm-fdt.c index d4f1578..daabc03 100644 --- a/arch/arm/lib/bootm-fdt.c +++ b/arch/arm/lib/bootm-fdt.c @@ -21,6 +21,11 @@ DECLARE_GLOBAL_DATA_PTR; +__weak int cpu_update_dt(void *fdt) +{ + return 0; +} + int arch_fixup_fdt(void *blob) { bd_t *bd = gd->bd; @@ -34,11 +39,11 @@ int arch_fixup_fdt(void *blob) } ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS); -#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT) + if (ret) return ret; - ret = armv7_update_dt(blob); -#endif + ret = cpu_update_dt(blob); + return ret; }