[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw: ppc: sam460ex: Disable Ethernet devicetree nodes
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] hw: ppc: sam460ex: Disable Ethernet devicetree nodes |
Date: |
Mon, 16 Aug 2021 12:11:25 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 8/16/21 7:41 AM, David Gibson wrote:
> On Sun, Aug 15, 2021 at 07:59:15PM -0700, Guenter Roeck wrote:
>> IBM EMAC Ethernet controllers are not emulated by qemu. If they are
>> enabled in devicetree files, they are instantiated in Linux but
>> obviously won't work. Disable associated devicetree nodes to prevent
>> unpredictable behavior.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
> I'll wait for Zoltan's opinion on this, but this sort of thing is why
> I was always pretty dubious about qemu *loading* a dtb file, rather
> than generating a dt internally.
Hmm interesting point.
>> ---
>> hw/ppc/sam460ex.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
>> index 0737234d66..feb356e625 100644
>> --- a/hw/ppc/sam460ex.c
>> +++ b/hw/ppc/sam460ex.c
>> @@ -194,6 +194,14 @@ static int sam460ex_load_device_tree(hwaddr addr,
>> _FDT(fdt_nop_node(fdt, offset));
>> }
>>
>> + /* Ethernet interfaces are not emulated */
>> + offset = fdt_node_offset_by_compatible(fdt, -1, "ibm,emac-460ex");
>> + while (offset >= 0) {
>> + _FDT(fdt_setprop_string(fdt, offset, "status", "disabled"));
>> + offset = fdt_node_offset_by_compatible(fdt, offset,
>> "ibm,emac-460ex");
>> + }
Oh, I didn't know about appending 'status=disabled'.
FWIW I'm carrying this patch to boot Linux on the raspi4
(but I prefer your way):
-- >8 --
Author: Philippe Mathieu-Daudé <f4bug@amsat.org>
Date: Sun Oct 18 22:39:19 2020 +0200
hw/arm/raspi: Remove unsupported raspi4 peripherals from device tree
Kludge when using Linux kernels to reach userland.
No device in DT -> no hardware initialization.
Linux 5.9 uses the RPI_FIRMWARE_GET_CLOCKS so we now need to
implement that feature too. Look like a cat and mouse game...
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 6a793766840..93eb6591ee8 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -25,6 +25,7 @@
#include "hw/arm/boot.h"
#include "sysemu/sysemu.h"
#include "qom/object.h"
+#include <libfdt.h>
#define SMPBOOT_ADDR 0x300 /* this should leave enough space for
ATAGS */
#define MVBAR_ADDR 0x400 /* secure vectors */
@@ -200,6 +201,29 @@ static void reset_secondary(ARMCPU *cpu, const
struct arm_boot_info *info)
cpu_set_pc(cs, info->smp_loader_start);
}
+static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)
+{
+ int offset;
+
+ offset = fdt_node_offset_by_compatible(fdt, -1, "brcm,genet-v5");
+ if (offset >= 0) {
+ /* FIXME we shouldn't nop the parent */
+ offset = fdt_parent_offset(fdt, offset);
+ if (offset >= 0) {
+ if (!fdt_nop_node(fdt, offset)) {
+ warn_report("dtc: bcm2838-genet removed!");
+ }
+ }
+ }
+
+ offset = fdt_node_offset_by_compatible(fdt, -1,
"brcm,avs-tmon-bcm2838");
+ if (offset >= 0) {
+ if (!fdt_nop_node(fdt, offset)) {
+ warn_report("dtc: bcm2838-tmon removed!");
+ }
+ }
+}
+
static void setup_boot(MachineState *machine, RaspiProcessorId
processor_id,
size_t ram_size)
{
@@ -234,6 +258,9 @@ static void setup_boot(MachineState *machine,
RaspiProcessorId processor_id,
}
s->binfo.secondary_cpu_reset_hook = reset_secondary;
}
+ if (processor_id >= PROCESSOR_ID_BCM2838) {
+ s->binfo.modify_dtb = raspi4_modify_dtb;
+ }
/* If the user specified a "firmware" image (e.g. UEFI), we bypass
* the normal Linux boot process
---