Skip to contentSkip to conversation

hw/riscv/virt: re-add machine-specific compatible string to /soc/ node

PATCH In review Lukas Auer 4 participants 14 messages Feb 10, 2019 – Mar 19, 2019 RISC-V

lore
Share & tools
lore

Lukas Auer

author
#0 lore raw

PATCH 1/1 hw/riscv/virt: re-add machine-specific compatible string to /soc/ node

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

Fixes 53f54508dae6("hw/riscv/virtio: Set the soc device tree node as a

simple-bus")

---

 hw/riscv/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/riscv/virt.c +2 -1
index 3e8b19c668..c53bb905ff 100644
@@ -157,6 +157,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
     char *nodename;
     uint32_t plic_phandle, phandle = 1;
     int i;
+    const char soc_compat[] = "riscv-virtio-soc\0simple-bus";
 
     fdt = s->fdt = create_device_tree(&s->fdt_size);
     if (!fdt) {
@@ -171,7 +172,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
 
     qemu_fdt_add_subnode(fdt, "/soc");
     qemu_fdt_setprop(fdt, "/soc", "ranges", NULL, 0);
-    qemu_fdt_setprop_string(fdt, "/soc", "compatible", "simple-bus");
+    qemu_fdt_setprop(fdt, "/soc", "compatible", soc_compat, sizeof(soc_compat));
     qemu_fdt_setprop_cell(fdt, "/soc", "#size-cells", 0x2);
     qemu_fdt_setprop_cell(fdt, "/soc", "#address-cells", 0x2);
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

Fixes 53f54508dae6("hw/riscv/virtio: Set the soc device tree node as a

simple-bus")

This looks fine to me.

Alistair

Quoted 30 lines

---

 hw/riscv/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/riscv/virt.c +2 -2
index 3e8b19c668..c53bb905ff 100644
@@ -157,6 +157,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
     char *nodename;
     uint32_t plic_phandle, phandle = 1;
     int i;
+    const char soc_compat[] = "riscv-virtio-soc\0simple-bus";
 
     fdt = s->fdt = create_device_tree(&s->fdt_size);
     if (!fdt) {
@@ -171,7 +172,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
 
     qemu_fdt_add_subnode(fdt, "/soc");
     qemu_fdt_setprop(fdt, "/soc", "ranges", NULL, 0);
-    qemu_fdt_setprop_string(fdt, "/soc", "compatible", "simple-bus");
+    qemu_fdt_setprop(fdt, "/soc", "compatible", soc_compat, sizeof(soc_compat));
     qemu_fdt_setprop_cell(fdt, "/soc", "#size-cells", 0x2);
     qemu_fdt_setprop_cell(fdt, "/soc", "#address-cells", 0x2);
 
--

2.20.1

#2 lore raw
In reply to Lukas Auer

Hi Lukas,

Quoted 8 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

I see no problem with U-Boot working with current compatible string "simple-bus". In fact I had planned to remove the compatible string "riscv-virtio-soc" in U-Boot but did not get time to work on it.

Quoted 8 lines
Fixes 53f54508dae6("hw/riscv/virtio: Set the soc device tree node as a

simple-bus")

---

 hw/riscv/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Regards,
Bin

#3 lore raw

Hi Bin,

Quoted 9 lines · Bin Meng

Hi Lukas,

Quoted 5 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

Quoted 8 lines
Quoted 3 lines

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

I see no problem with U-Boot working with current compatible string "simple-bus". In fact I had planned to remove the compatible string "riscv-virtio-soc" in U-Boot but did not get time to work on it.

It is only required if U-Boot is running in machine-mode. For relocation it needs to use the CLINT driver to send appropriate IPIs to the other harts. To be able to probe the driver, the device and its parent device tree node (soc) must therefore be available in the pre- relocation device model.
This patch was the easiest way I could think of for achieving this. It could be that there is a better way of solving this.

Thanks,
Lukas

Quoted 12 lines
Quoted 9 lines
Fixes 53f54508dae6("hw/riscv/virtio: Set the soc device tree node

as a
simple-bus")

---

 hw/riscv/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Regards,
Bin

#4 lore raw

Hi Lukas,

Quoted 22 lines · Lukas

Hi Bin,

Quoted 9 lines · Bin Meng

Hi Lukas,

Quoted 5 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

Quoted 8 lines
Quoted 3 lines

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

I see no problem with U-Boot working with current compatible string "simple-bus". In fact I had planned to remove the compatible string "riscv-virtio-soc" in U-Boot but did not get time to work on it.

Quoted 8 lines

It is only required if U-Boot is running in machine-mode. For relocation it needs to use the CLINT driver to send appropriate IPIs to the other harts. To be able to probe the driver, the device and its parent device tree node (soc) must therefore be available in the pre- relocation device model.
This patch was the easiest way I could think of for achieving this. It could be that there is a better way of solving this.

I tested your SMP U-Boot series in both M-mode and S-mode, using a 4 core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is "simple-bus".

Regards,
Bin

#5 lore raw

Hi Bin,

Quoted 42 lines · Bin Meng

Hi Lukas,

Quoted 26 lines · Lukas

Hi Bin,

Quoted 16 lines · Bin Meng

Hi Lukas,

Quoted 11 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the soc
device tree node to allow U-Boot and Linux to bind machine- specific
drivers to it. The current compatible string "simple-bus" is retained.

This is required by U-Boot to bind devices early, as part of the
pre-relocation driver model.

Quoted 6 lines

I see no problem with U-Boot working with current compatible string
"simple-bus". In fact I had planned to remove the compatible string
"riscv-virtio-soc" in U-Boot but did not get time to work on it.

Quoted 11 lines

It is only required if U-Boot is running in machine-mode. For relocation it needs to use the CLINT driver to send appropriate IPIs to
the other harts. To be able to probe the driver, the device and its parent device tree node (soc) must therefore be available in the pre-
relocation device model.
This patch was the easiest way I could think of for achieving this. It
could be that there is a better way of solving this.

Quoted 4 lines

I tested your SMP U-Boot series in both M-mode and S-mode, using a 4 core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is "simple-bus".

That is actually my fault, it should not work.
What is happening is that U-Boot fails to relocate the secondary harts, because the CLINT driver cannot get the memory address of the CLINT device. This error is currently silently ignored.
The secondary harts are still waiting to receive IPIs, so booting Linux works fine, because U-Boot can now send IPIs. This will however break if U-Boot overwrites the code the secondary harts are running, which could happen when loading an image.

I will update my SMP U-Boot series to print a warning if sending an IPI fails.

Thanks,
Lukas

#6 lore raw

Hi Lukas,

Quoted 51 lines · Lukas

Hi Bin,

Quoted 42 lines · Bin Meng

Hi Lukas,

Quoted 26 lines · Lukas

Hi Bin,

Quoted 16 lines · Bin Meng

Hi Lukas,

Quoted 11 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the soc
device tree node to allow U-Boot and Linux to bind machine- specific
drivers to it. The current compatible string "simple-bus" is retained.

This is required by U-Boot to bind devices early, as part of the
pre-relocation driver model.

Quoted 6 lines

I see no problem with U-Boot working with current compatible string
"simple-bus". In fact I had planned to remove the compatible string
"riscv-virtio-soc" in U-Boot but did not get time to work on it.

Quoted 11 lines

It is only required if U-Boot is running in machine-mode. For relocation it needs to use the CLINT driver to send appropriate IPIs to
the other harts. To be able to probe the driver, the device and its parent device tree node (soc) must therefore be available in the pre-
relocation device model.
This patch was the easiest way I could think of for achieving this. It
could be that there is a better way of solving this.

Quoted 4 lines

I tested your SMP U-Boot series in both M-mode and S-mode, using a 4 core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is "simple-bus".

Quoted 4 lines

That is actually my fault, it should not work.
What is happening is that U-Boot fails to relocate the secondary harts, because the CLINT driver cannot get the memory address of the CLINT device. This error is currently silently ignored.

I still don't understand. Why does the CLINT driver fail to get the memory address? U-Boot has been supporting "simpile-bus" for a long time. It was because QEMU 3.0.0 generated the /soc node with "riscv-virtio-soc" compatible string, U-Boot was taught to treat such compatible string as a "simple-bus" too (that was the U-Boot commit 27dc2c130e29)

Quoted 8 lines

The secondary harts are still waiting to receive IPIs, so booting Linux works fine, because U-Boot can now send IPIs. This will however break if U-Boot overwrites the code the secondary harts are running, which could happen when loading an image.

I will update my SMP U-Boot series to print a warning if sending an IPI fails.

Regards,
Bin

#7 lore raw

Hi Bin,

Quoted 68 lines · Bin Meng

Hi Lukas,

Quoted 58 lines · Lukas

Hi Bin,

Quoted 49 lines · Bin Meng

Hi Lukas,

Quoted 30 lines · Lukas

Hi Bin,

Quoted 19 lines · Bin Meng

Hi Lukas,

Quoted 9 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the
soc
device tree node to allow U-Boot and Linux to bind machine- specific
drivers to it. The current compatible string "simple-bus" is
retained.

Quoted 5 lines

This is required by U-Boot to bind devices early, as part of
the
pre-relocation driver model.

Quoted 7 lines

I see no problem with U-Boot working with current compatible string
"simple-bus". In fact I had planned to remove the compatible string
"riscv-virtio-soc" in U-Boot but did not get time to work on it.

Quoted 14 lines

It is only required if U-Boot is running in machine-mode. For relocation it needs to use the CLINT driver to send appropriate IPIs to
the other harts. To be able to probe the driver, the device and its
parent device tree node (soc) must therefore be available in the
pre-
relocation device model.
This patch was the easiest way I could think of for achieving this.
It
could be that there is a better way of solving this.

Quoted 5 lines

I tested your SMP U-Boot series in both M-mode and S-mode, using a 4
core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is "simple-bus".

Quoted 5 lines

That is actually my fault, it should not work.
What is happening is that U-Boot fails to relocate the secondary harts,
because the CLINT driver cannot get the memory address of the CLINT device. This error is currently silently ignored.

Quoted 6 lines

I still don't understand. Why does the CLINT driver fail to get the memory address? U-Boot has been supporting "simpile-bus" for a long time. It was because QEMU 3.0.0 generated the /soc node with "riscv-virtio-soc" compatible string, U-Boot was taught to treat such compatible string as a "simple-bus" too (that was the U-Boot commit 27dc2c130e29)

That's correct. The problem with the default simple-bus U-Boot driver is that it does not have the DM_FLAG_PRE_RELOC flag set. The /soc and /soc/clint nodes are therefore not available before relocation, meaning that IPIs cannot be sent to relocate the secondary harts.

Thanks,
Lukas

Quoted 16 lines
Quoted 9 lines

The secondary harts are still waiting to receive IPIs, so booting Linux
works fine, because U-Boot can now send IPIs. This will however break
if U-Boot overwrites the code the secondary harts are running, which
could happen when loading an image.

Quoted 4 lines

I will update my SMP U-Boot series to print a warning if sending an IPI
fails.

Regards,
Bin

#8 lore raw

Hi Lukas,

Quoted 79 lines · Lukas

Hi Bin,

Quoted 68 lines · Bin Meng

Hi Lukas,

Quoted 58 lines · Lukas

Hi Bin,

Quoted 49 lines · Bin Meng

Hi Lukas,

Quoted 30 lines · Lukas

Hi Bin,

Quoted 19 lines · Bin Meng

Hi Lukas,

Quoted 9 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio-soc" to the
soc
device tree node to allow U-Boot and Linux to bind machine- specific
drivers to it. The current compatible string "simple-bus" is
retained.

Quoted 5 lines

This is required by U-Boot to bind devices early, as part of
the
pre-relocation driver model.

Quoted 7 lines

I see no problem with U-Boot working with current compatible string
"simple-bus". In fact I had planned to remove the compatible string
"riscv-virtio-soc" in U-Boot but did not get time to work on it.

Quoted 14 lines

It is only required if U-Boot is running in machine-mode. For relocation it needs to use the CLINT driver to send appropriate IPIs to
the other harts. To be able to probe the driver, the device and its
parent device tree node (soc) must therefore be available in the
pre-
relocation device model.
This patch was the easiest way I could think of for achieving this.
It
could be that there is a better way of solving this.

Quoted 5 lines

I tested your SMP U-Boot series in both M-mode and S-mode, using a 4
core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is "simple-bus".

Quoted 5 lines

That is actually my fault, it should not work.
What is happening is that U-Boot fails to relocate the secondary harts,
because the CLINT driver cannot get the memory address of the CLINT device. This error is currently silently ignored.

Quoted 6 lines

I still don't understand. Why does the CLINT driver fail to get the memory address? U-Boot has been supporting "simpile-bus" for a long time. It was because QEMU 3.0.0 generated the /soc node with "riscv-virtio-soc" compatible string, U-Boot was taught to treat such compatible string as a "simple-bus" too (that was the U-Boot commit 27dc2c130e29)

Quoted 5 lines

That's correct. The problem with the default simple-bus U-Boot driver is that it does not have the DM_FLAG_PRE_RELOC flag set. The /soc and /soc/clint nodes are therefore not available before relocation, meaning that IPIs cannot be sent to relocate the secondary harts.

Thanks for the clarifications. Now I see the problem. But I think we should fix U-Boot "simple-bus" driver instead. As seen on FU540 or likely other hardware, QEMU generates the "simple-bus" compatible string for the /soc node, as well as the DT provided by the hardware.

Regards,
Bin

#9 lore raw

Hi Bin,

Quoted 111 lines · Bin Meng

Hi Lukas,

Quoted 98 lines · Lukas

Hi Bin,

Quoted 84 lines · Bin Meng

Hi Lukas,

Quoted 72 lines · Lukas

Hi Bin,

Quoted 61 lines · Bin Meng

Hi Lukas,

Quoted 47 lines · Lukas

Hi Bin,

Quoted 23 lines · Bin Meng

Hi Lukas,

Quoted 12 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio- soc" to
the
soc
device tree node to allow U-Boot and Linux to bind machine-
specific
drivers to it. The current compatible string "simple- bus"
is
retained.

Quoted 6 lines

This is required by U-Boot to bind devices early, as part
of
the
pre-relocation driver model.

Quoted 10 lines

I see no problem with U-Boot working with current compatible
string
"simple-bus". In fact I had planned to remove the compatible
string
"riscv-virtio-soc" in U-Boot but did not get time to work on
it.

It is only required if U-Boot is running in machine-mode. For
relocation it needs to use the CLINT driver to send appropriate
IPIs to
the other harts. To be able to probe the driver, the device and
its
parent device tree node (soc) must therefore be available in

Quoted 9 lines

the
pre-
relocation device model.
This patch was the easiest way I could think of for achieving
this.
It
could be that there is a better way of solving this.

Quoted 7 lines

I tested your SMP U-Boot series in both M-mode and S-mode, using
a 4
core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is
"simple-bus".

Quoted 7 lines

That is actually my fault, it should not work.
What is happening is that U-Boot fails to relocate the secondary
harts,
because the CLINT driver cannot get the memory address of the CLINT
device. This error is currently silently ignored.

Quoted 10 lines

I still don't understand. Why does the CLINT driver fail to get the
memory address? U-Boot has been supporting "simpile-bus" for a long
time. It was because QEMU 3.0.0 generated the /soc node with "riscv-virtio-soc" compatible string, U-Boot was taught to treat such
compatible string as a "simple-bus" too (that was the U-Boot commit
27dc2c130e29)

Quoted 8 lines

That's correct. The problem with the default simple-bus U-Boot driver
is that it does not have the DM_FLAG_PRE_RELOC flag set. The /soc and
/soc/clint nodes are therefore not available before relocation, meaning
that IPIs cannot be sent to relocate the secondary harts.

Quoted 5 lines

Thanks for the clarifications. Now I see the problem. But I think we should fix U-Boot "simple-bus" driver instead. As seen on FU540 or likely other hardware, QEMU generates the "simple-bus" compatible string for the /soc node, as well as the DT provided by the hardware.

That makes sense, I can send a patch to set the DM_FLAG_PRE_RELOC flag in the simple-bus U-Boot driver. I think it's best to send it separately from the SMP patch series, since it could affect other boards and it's a bit late in the release cycle. What do you think?

This patch can be dropped then.

Thanks,
Lukas

#10 lore raw

Hi Lukas,

Quoted 121 lines · Lukas

Hi Bin,

Quoted 111 lines · Bin Meng

Hi Lukas,

Quoted 98 lines · Lukas

Hi Bin,

Quoted 84 lines · Bin Meng

Hi Lukas,

Quoted 72 lines · Lukas

Hi Bin,

Quoted 61 lines · Bin Meng

Hi Lukas,

Quoted 47 lines · Lukas

Hi Bin,

Quoted 23 lines · Bin Meng

Hi Lukas,

Quoted 12 lines · Lukas Auer

Re-add the previous compatible string "riscv-virtio- soc" to
the
soc
device tree node to allow U-Boot and Linux to bind machine-
specific
drivers to it. The current compatible string "simple- bus"
is
retained.

Quoted 6 lines

This is required by U-Boot to bind devices early, as part
of
the
pre-relocation driver model.

Quoted 10 lines

I see no problem with U-Boot working with current compatible
string
"simple-bus". In fact I had planned to remove the compatible
string
"riscv-virtio-soc" in U-Boot but did not get time to work on
it.

It is only required if U-Boot is running in machine-mode. For
relocation it needs to use the CLINT driver to send appropriate
IPIs to
the other harts. To be able to probe the driver, the device and
its
parent device tree node (soc) must therefore be available in

Quoted 9 lines

the
pre-
relocation device model.
This patch was the easiest way I could think of for achieving
this.
It
could be that there is a better way of solving this.

Quoted 7 lines

I tested your SMP U-Boot series in both M-mode and S-mode, using
a 4
core 'virt' target. Works fine. I am using QEMU 3.1.0 so it is
"simple-bus".

Quoted 7 lines

That is actually my fault, it should not work.
What is happening is that U-Boot fails to relocate the secondary
harts,
because the CLINT driver cannot get the memory address of the CLINT
device. This error is currently silently ignored.

Quoted 10 lines

I still don't understand. Why does the CLINT driver fail to get the
memory address? U-Boot has been supporting "simpile-bus" for a long
time. It was because QEMU 3.0.0 generated the /soc node with "riscv-virtio-soc" compatible string, U-Boot was taught to treat such
compatible string as a "simple-bus" too (that was the U-Boot commit
27dc2c130e29)

Quoted 8 lines

That's correct. The problem with the default simple-bus U-Boot driver
is that it does not have the DM_FLAG_PRE_RELOC flag set. The /soc and
/soc/clint nodes are therefore not available before relocation, meaning
that IPIs cannot be sent to relocate the secondary harts.

Quoted 5 lines

Thanks for the clarifications. Now I see the problem. But I think we should fix U-Boot "simple-bus" driver instead. As seen on FU540 or likely other hardware, QEMU generates the "simple-bus" compatible string for the /soc node, as well as the DT provided by the hardware.

Quoted 5 lines

That makes sense, I can send a patch to set the DM_FLAG_PRE_RELOC flag in the simple-bus U-Boot driver. I think it's best to send it separately from the SMP patch series, since it could affect other boards and it's a bit late in the release cycle. What do you think?

Yes, agreed that the "simple-bus" driver changes should be next U-Boot release. We should try to get the U-Boot SMP series in the v2019.04 release.

Quoted 2 lines

This patch can be dropped then.

Regards,
Bin

#11 lore raw

Hi Bin,

Quoted 148 lines · Bin Meng

Hi Lukas,

Quoted 137 lines · Lukas

Hi Bin,

Quoted 125 lines · Bin Meng

Hi Lukas,

Quoted 111 lines · Lukas

Hi Bin,

Quoted 94 lines · Bin Meng

Hi Lukas,

Quoted 81 lines · Lukas

Hi Bin,

Quoted 68 lines · Bin Meng

Hi Lukas,

Quoted 54 lines · Lukas

Hi Bin,

Quoted 26 lines · Bin Meng

Hi Lukas,

Quoted 14 lines · Lukas Auer

Re-add the previous compatible string "riscv- virtio-
soc" to
the
soc
device tree node to allow U-Boot and Linux to bind machine-
specific
drivers to it. The current compatible string "simple-
bus"
is
retained.

Quoted 7 lines

This is required by U-Boot to bind devices early,
as
part
of
the
pre-relocation driver model.

Quoted 11 lines

I see no problem with U-Boot working with current compatible
string
"simple-bus". In fact I had planned to remove the compatible
string
"riscv-virtio-soc" in U-Boot but did not get time to work
on
it.

It is only required if U-Boot is running in machine- mode.
For
relocation it needs to use the CLINT driver to send appropriate
IPIs to
the other harts. To be able to probe the driver, the device
and
its
parent device tree node (soc) must therefore be available
in

Quoted 9 lines

the
pre-
relocation device model.
This patch was the easiest way I could think of for achieving
this.
It
could be that there is a better way of solving this.

Quoted 9 lines

I tested your SMP U-Boot series in both M-mode and S- mode,
using
a 4
core 'virt' target. Works fine. I am using QEMU 3.1.0 so it
is
"simple-bus".

Quoted 8 lines

That is actually my fault, it should not work. What is happening is that U-Boot fails to relocate the secondary
harts,
because the CLINT driver cannot get the memory address of the
CLINT
device. This error is currently silently ignored.

Quoted 13 lines

I still don't understand. Why does the CLINT driver fail to get
the
memory address? U-Boot has been supporting "simpile-bus" for a
long
time. It was because QEMU 3.0.0 generated the /soc node with "riscv-virtio-soc" compatible string, U-Boot was taught to treat
such
compatible string as a "simple-bus" too (that was the U-Boot commit
27dc2c130e29)

Quoted 9 lines

That's correct. The problem with the default simple-bus U-Boot driver
is that it does not have the DM_FLAG_PRE_RELOC flag set. The /soc
and
/soc/clint nodes are therefore not available before relocation, meaning
that IPIs cannot be sent to relocate the secondary harts.

Quoted 8 lines

Thanks for the clarifications. Now I see the problem. But I think we
should fix U-Boot "simple-bus" driver instead. As seen on FU540 or
likely other hardware, QEMU generates the "simple-bus" compatible string for the /soc node, as well as the DT provided by the hardware.

Quoted 6 lines

That makes sense, I can send a patch to set the DM_FLAG_PRE_RELOC flag
in the simple-bus U-Boot driver. I think it's best to send it separately from the SMP patch series, since it could affect other boards and it's a bit late in the release cycle. What do you think?

Quoted 5 lines

Yes, agreed that the "simple-bus" driver changes should be next U- Boot
release. We should try to get the U-Boot SMP series in the v2019.04 release.

Yes definitely, I have just sent version 3 of the series. I hope it is ready to go into mainline now.

Thanks,
Lukas

#12 lore raw
In reply to Lukas Auer
Quoted 10 lines · On Sun, 10 Feb 2019 12:17:26 PST (-0800), [email protected] wrote:

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

Fixes 53f54508dae6("hw/riscv/virtio: Set the soc device tree node as a

simple-bus")

I still had this at the top of my patch queue, but from looking at the thread it appears the resolution here is to drop this in favor of generic support. LMK if I missed something.

Quoted 25 lines

---

 hw/riscv/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/riscv/virt.c +2 -1
index 3e8b19c668..c53bb905ff 100644
@@ -157,6 +157,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
     char *nodename;
     uint32_t plic_phandle, phandle = 1;
     int i;
+    const char soc_compat[] = "riscv-virtio-soc\0simple-bus";
 
     fdt = s->fdt = create_device_tree(&s->fdt_size);
     if (!fdt) {
@@ -171,7 +172,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
 
     qemu_fdt_add_subnode(fdt, "/soc");
     qemu_fdt_setprop(fdt, "/soc", "ranges", NULL, 0);
-    qemu_fdt_setprop_string(fdt, "/soc", "compatible", "simple-bus");
+    qemu_fdt_setprop(fdt, "/soc", "compatible", soc_compat, sizeof(soc_compat));
     qemu_fdt_setprop_cell(fdt, "/soc", "#size-cells", 0x2);
     qemu_fdt_setprop_cell(fdt, "/soc", "#address-cells", 0x2);
#13 lore raw
Quoted 15 lines · Palmer Dabbelt
Quoted 5 lines · On Sun, 10 Feb 2019 12:17:26 PST (-0800), [email protected] wrote:

Re-add the previous compatible string "riscv-virtio-soc" to the soc device tree node to allow U-Boot and Linux to bind machine-specific drivers to it. The current compatible string "simple-bus" is retained.

Quoted 7 lines

This is required by U-Boot to bind devices early, as part of the pre-relocation driver model.

Fixes 53f54508dae6("hw/riscv/virtio: Set the soc device tree node

as a
simple-bus")

Quoted 5 lines

I still had this at the top of my patch queue, but from looking at the thread
it appears the resolution here is to drop this in favor of generic support.
LMK if I missed something.

Yes, you are right. We are going to fix this from the U-Boot side, so this patch can be dropped.

Thanks,
Lukas

Quoted 30 lines
Quoted 30 lines

---

 hw/riscv/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/riscv/virt.c +1 -0
index 3e8b19c668..c53bb905ff 100644
@@ -157,6 +157,7 @@ static void *create_fdt(RISCVVirtState *s,
 const struct MemmapEntry *memmap,
     char *nodename;
     uint32_t plic_phandle, phandle = 1;
     int i;
+    const char soc_compat[] = "riscv-virtio-soc\0simple-bus";
 
     fdt = s->fdt = create_device_tree(&s->fdt_size);
     if (!fdt) {
hw/riscv/virt.c +1 -1
@@ -171,7 +172,7 @@ static void *create_fdt(RISCVVirtState *s,
 const struct MemmapEntry *memmap,
 
     qemu_fdt_add_subnode(fdt, "/soc");
     qemu_fdt_setprop(fdt, "/soc", "ranges", NULL, 0);
-    qemu_fdt_setprop_string(fdt, "/soc", "compatible", "simple-
 bus");
+    qemu_fdt_setprop(fdt, "/soc", "compatible", soc_compat,
 sizeof(soc_compat));
     qemu_fdt_setprop_cell(fdt, "/soc", "#size-cells", 0x2);
     qemu_fdt_setprop_cell(fdt, "/soc", "#address-cells", 0x2);