qemu_arm64_defconfig: PCI autoconfig fails for qemu-system-aarch64 -m 4G

Heinrich Schuchardt xypron.glpk at gmx.de
Wed Jan 1 18:57:40 CET 2020


Dear all,

I want to run qemu_arm64_defconfig with 4G.

    qemu-system-aarch64 -machine virt -m 4G -smp cores=2 \
    -bios u-boot.bin -cpu cortex-a53 -nographic -gdb tcp::1234 \
    -netdev user,id=eth0,tftp=tftp -device e1000,netdev=eth0 \
    -device virtio-rng-pci

I see an error:

No working controllers found
e1000: 52:54:00:12:34:56

Warning: e1000#0 using MAC address from ROM
BOOTP broadcast 1
pci_hose_phys_to_bus: invalid physical address
BOOTP broadcast 2
pci_hose_phys_to_bus: invalid physical address

The error does not occur for a smaller RAM size.

I added some debug output:

_dm_pci_phys_to_bus:
phys_addr 0x000000013ffecb40,
res->phys_start 0x0000000010000000,
res->bus_start 0x10000000

As qemu_arm64_defconfig does not define CONFIG_SYS_PCI_64BIT the
calculated bus address is truncated.

If CONFIG_SYS_PCI_64BIT is defined for qemu_arm64_defconfig and the
memory is less then 4 GiB an error
PCI: Failed autoconfig bar 10
occurs.

For 3GiB memory I observed the following values:

_dm_pci_phys_to_bus:
phys_addr 0x00000000fffecbc0,
res->phys_start 0x0000000010000000,
res->bus_start 0x0000000010000000

When I define type pci_addr_t as 64bit everything works correctly.

Why does the number of bits in pci_addr_t depend on CONFIG_SYS_PCI_64BIT
and not on the bitness of the system?

It is especially worrisome that CONFIG_SYS_PCI_64BIT is not documented
at all. I wonder if Kumar remembers why he introduced it in 2008.

I tried to change the definition of the following types in pci.h

typedef phys_addr_t pci_addr_t;
typedef phys_addr_t pci_size_t;

This lets qemu-x86_defconfig fail with
Error binding driver 'cpu_qemu': -12

Using

typedef unsigned long pci_addr_t;
typedef unsigned long pci_size_t;

does not produce the error but I am not sure if this is the right approach.

Best regards

Heinrich


More information about the U-Boot mailing list