NXP P50XX/e5500: SMP doesn't work anymore with the latest Git kernel
Christian Zigotzky
chzigotzky at xenosoft.de
Wed Oct 31 02:05:19 AEDT 2018
On 30 October 2018 at 08:27AM, Christian Zigotzky wrote:
> On 30 October 2018 at 02:59AM, Benjamin Herrenschmidt wrote:
>> On Tue, 2018-10-30 at 02:42 +0100, Christian Zigotzky wrote:
>>> OF patch for the latest Git kernel: http://www.xenosoft.de/of_v2.patch
>> This just seems to revert a whole bunch of stuff, not really the right
>> way to go. Why is of_get_next_cpu_node() not finding your CPUs ? There
>> must be something wrong with the device-tree...
> Maybe we need a new dtb for QEMU ppce500 and P50XX machines. I don't
> know. For us it is good to have this patch because we can test
> further. (other updates)
> With this patch, SMP works again on virtual QEMU ppce500 and P50XX
> machines. If you have another code, then I will test it with QEMU and
> my P5020 board.
>
> Thanks,
> Christian
We use the 'cyrus_p5020.dts' file for creating the dtb file for our
P5020 board. You can find it in the official kernel source code.
(arch/powerpc/boot/dts/cyrus_p5020.dts)
For the virtual ppce500 machine I don't need to add a dtb file to the
QEMU command. But maybe there is a solution:
On 30 October 2018 at 3:18PM, Michael Ellerman wrote:
> Hi Rob,
>
> Sorry I missed this when you posted it.
>
> Rob Herring <robh at kernel.org> writes:
>> Iterating thru cpu nodes is a common pattern. Create a common iterator
>> which can find child nodes either by node name or device_type == cpu.
>> Using the former will allow for eventually dropping device_type
>> properties which are deprecated for FDT.
> Device trees we see on powerpc generally don't (never?) use "cpu" as the
> node name for CPU nodes. And many of those device trees come from
> firmware, so we can't update them.
>
> So dropping support for device_type is a non-starter from our POV.
>
> cheers
>
>
>>
>>> ----------------------------- of_v2.patch -----------------------------
>>>
>>> diff -rupN a/drivers/of/base.c b/drivers/of/base.c
>>> --- a/drivers/of/base.c 2018-10-30 02:19:30.827089495 +0100
>>> +++ b/drivers/of/base.c 2018-10-30 02:18:51.666856715 +0100
>>> @@ -395,7 +395,7 @@ struct device_node *of_get_cpu_node(int
>>> {
>>> struct device_node *cpun;
>>>
>>> - for_each_of_cpu_node(cpun) {
>>> + for_each_node_by_type(cpun, "cpu") {
>>> if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread))
>>> return cpun;
>>> }
>>> @@ -750,45 +750,6 @@ struct device_node *of_get_next_availabl
>>> EXPORT_SYMBOL(of_get_next_available_child);
>>>
>>> /**
>>> - * of_get_next_cpu_node - Iterate on cpu nodes
>>> - * @prev: previous child of the /cpus node, or NULL to get first
>>> - *
>>> - * Returns a cpu node pointer with refcount incremented, use
>>> of_node_put()
>>> - * on it when done. Returns NULL when prev is the last child.
>>> Decrements
>>> - * the refcount of prev.
>>> - */
>>> -struct device_node *of_get_next_cpu_node(struct device_node *prev)
>>> -{
>>> - struct device_node *next = NULL;
>>> - unsigned long flags;
>>> - struct device_node *node;
>>> -
>>> - if (!prev)
>>> - node = of_find_node_by_path("/cpus");
>>> -
>>> - raw_spin_lock_irqsave(&devtree_lock, flags);
>>> - if (prev)
>>> - next = prev->sibling;
>>> - else if (node) {
>>> - next = node->child;
>>> - of_node_put(node);
>>> - }
>>> - for (; next; next = next->sibling) {
>>> - if (!(of_node_name_eq(next, "cpu") ||
>>> - (next->type && !of_node_cmp(next->type, "cpu"))))
>>> - continue;
>>> - if (!__of_device_is_available(next))
>>> - continue;
>>> - if (of_node_get(next))
>>> - break;
>>> - }
>>> - of_node_put(prev);
>>> - raw_spin_unlock_irqrestore(&devtree_lock, flags);
>>> - return next;
>>> -}
>>> -EXPORT_SYMBOL(of_get_next_cpu_node);
>>> -
>>> -/**
>>> * of_get_compatible_child - Find compatible child node
>>> * @parent: parent node
>>> * @compatible: compatible string
>>> diff -rupN a/include/linux/of.h b/include/linux/of.h
>>> --- a/include/linux/of.h 2018-10-30 02:19:32.047096634 +0100
>>> +++ b/include/linux/of.h 2018-10-30 02:18:51.666856715 +0100
>>> @@ -347,7 +347,6 @@ extern const void *of_get_property(const
>>> const char *name,
>>> int *lenp);
>>> extern struct device_node *of_get_cpu_node(int cpu, unsigned int
>>> *thread);
>>> -extern struct device_node *of_get_next_cpu_node(struct device_node
>>> *prev);
>>>
>>> #define for_each_property_of_node(dn, pp) \
>>> for (pp = dn->properties; pp != NULL; pp = pp->next)
>>> @@ -757,11 +756,6 @@ static inline struct device_node *of_get
>>> return NULL;
>>> }
>>>
>>> -static inline struct device_node *of_get_next_cpu_node(struct
>>> device_node *prev)
>>> -{
>>> - return NULL;
>>> -}
>>> -
>>> static inline int of_n_addr_cells(struct device_node *np)
>>> {
>>> return 0;
>>> @@ -1239,10 +1233,6 @@ static inline int of_property_read_s32(c
>>> for (child = of_get_next_available_child(parent, NULL); child !=
>>> NULL; \
>>> child = of_get_next_available_child(parent, child))
>>>
>>> -#define for_each_of_cpu_node(cpu) \
>>> - for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \
>>> - cpu = of_get_next_cpu_node(cpu))
>>> -
>>> #define for_each_node_with_property(dn, prop_name) \
>>> for (dn = of_find_node_with_property(NULL, prop_name); dn; \
>>> dn = of_find_node_with_property(dn, prop_name))
>>
>
>
More information about the Linuxppc-dev
mailing list