Message ID | 20180313153458.26822-8-peter.maydell@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | raspi3: various fixes for Linux booting | expand |
> From: Peter Maydell <peter.maydell@linaro.org> > Sent: Tuesday, 13 March 2018 08:35 > > The BCM2837 sets the Aff1 field of the MPIDR affinity values for the > CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it > is required for Linux to boot. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > hw/arm/bcm2836.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c > index 07d2705f96..7140257c98 100644 > --- a/hw/arm/bcm2836.c > +++ b/hw/arm/bcm2836.c > @@ -25,14 +25,17 @@ > > struct BCM283XInfo { > const char *name; > + int clusterid; > }; > > static const BCM283XInfo bcm283x_socs[] = { > { > .name = TYPE_BCM2836, > + .clusterid = 0xf, > }, > { > .name = TYPE_BCM2837, > + .clusterid = 0x0, > }, > }; > > @@ -58,6 +61,8 @@ static void bcm2836_init(Object *obj) > static void bcm2836_realize(DeviceState *dev, Error **errp) > { > BCM283XState *s = BCM283X(dev); > + BCM283XClass *bc = BCM283X_GET_CLASS(dev); > + const BCM283XInfo *info = bc->info; > Object *obj; > Error *err = NULL; > int n; > @@ -119,7 +124,7 @@ static void bcm2836_realize(DeviceState *dev, Error > **errp) > /* Mirror bcm2836, which has clusterid set to 0xf The first line of this comment should probably move or just be deleted. It's not relevant here. > * TODO: this should be converted to a property of ARM_CPU > */ > - s->cpus[n].mp_affinity = 0xF00 | n; > + s->cpus[n].mp_affinity = (info->clusterid << 8) | n; > > /* set periphbase/CBAR value for CPU-local registers */ > object_property_set_int(OBJECT(&s->cpus[n]), Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
On 13 March 2018 at 16:48, Andrew Baumann <Andrew.Baumann@microsoft.com> wrote: >> From: Peter Maydell <peter.maydell@linaro.org> >> Sent: Tuesday, 13 March 2018 08:35 >> >> The BCM2837 sets the Aff1 field of the MPIDR affinity values for the >> CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it >> is required for Linux to boot. >> >> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >> @@ -119,7 +124,7 @@ static void bcm2836_realize(DeviceState *dev, Error >> **errp) >> /* Mirror bcm2836, which has clusterid set to 0xf > > The first line of this comment should probably move or just be deleted. It's not relevant here. Yeah, simplest just to delete it. thanks -- PMM
On 03/13/2018 04:34 PM, Peter Maydell wrote: > The BCM2837 sets the Aff1 field of the MPIDR affinity values for the > CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it > is required for Linux to boot. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> I don't have the datasheet for this SoC, but checked Linux dts ("ARM CPUs bindings -> cpus and cpu node bindings definition" from doc/Documentation/devicetree/bindings/arm/cpus.txt, then arch/arm/boot/dts/bcm283[67].dtsi). This might be useful to add in the commit description. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > hw/arm/bcm2836.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c > index 07d2705f96..7140257c98 100644 > --- a/hw/arm/bcm2836.c > +++ b/hw/arm/bcm2836.c > @@ -25,14 +25,17 @@ > > struct BCM283XInfo { > const char *name; > + int clusterid; > }; > > static const BCM283XInfo bcm283x_socs[] = { > { > .name = TYPE_BCM2836, > + .clusterid = 0xf, > }, > { > .name = TYPE_BCM2837, > + .clusterid = 0x0, > }, > }; > > @@ -58,6 +61,8 @@ static void bcm2836_init(Object *obj) > static void bcm2836_realize(DeviceState *dev, Error **errp) > { > BCM283XState *s = BCM283X(dev); > + BCM283XClass *bc = BCM283X_GET_CLASS(dev); > + const BCM283XInfo *info = bc->info; > Object *obj; > Error *err = NULL; > int n; > @@ -119,7 +124,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) > /* Mirror bcm2836, which has clusterid set to 0xf > * TODO: this should be converted to a property of ARM_CPU > */ > - s->cpus[n].mp_affinity = 0xF00 | n; > + s->cpus[n].mp_affinity = (info->clusterid << 8) | n; > > /* set periphbase/CBAR value for CPU-local registers */ > object_property_set_int(OBJECT(&s->cpus[n]), >
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 07d2705f96..7140257c98 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -25,14 +25,17 @@ struct BCM283XInfo { const char *name; + int clusterid; }; static const BCM283XInfo bcm283x_socs[] = { { .name = TYPE_BCM2836, + .clusterid = 0xf, }, { .name = TYPE_BCM2837, + .clusterid = 0x0, }, }; @@ -58,6 +61,8 @@ static void bcm2836_init(Object *obj) static void bcm2836_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); + BCM283XClass *bc = BCM283X_GET_CLASS(dev); + const BCM283XInfo *info = bc->info; Object *obj; Error *err = NULL; int n; @@ -119,7 +124,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) /* Mirror bcm2836, which has clusterid set to 0xf * TODO: this should be converted to a property of ARM_CPU */ - s->cpus[n].mp_affinity = 0xF00 | n; + s->cpus[n].mp_affinity = (info->clusterid << 8) | n; /* set periphbase/CBAR value for CPU-local registers */ object_property_set_int(OBJECT(&s->cpus[n]),
The BCM2837 sets the Aff1 field of the MPIDR affinity values for the CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it is required for Linux to boot. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- hw/arm/bcm2836.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.16.2