[PATCH v3 1/3] PCI: sandbox: Use a parallel structure for emulation
Simon Glass
sjg at chromium.org
Tue Jan 13 21:03:08 CET 2026
Hi Sean,
On Mon, 12 Jan 2026 at 18:21, Sean Anderson <sean.anderson at linux.dev> wrote:
>
> Currently, sandbox associates PCI emulators with PCI devices on a
> per-device level. To create this association, the PCI bus needs an ofnode
> for each device to include the appropriate phandle, or sandbox,dev-info can
> be used to automatically create PCI devices. In the latter case, the
> emulator is bound to the PCI device itself! This prevents testing any
> U-Boot PCI driver, and also precludes bridges without device tree nodes (as
> non-zero busses cannot be specified with sandbox,dev-info).
>
> Instead of extending sandbox,dev-info, switch to a more-natural approach
> where PCI emulators form a parallel tree exactly matching the PCI hierarchy
> to emulate. To do the lookup, we walk up the PCI tree until we get to the
> root port, look up the emulator, and retrace our steps down the emulator
> tree.
>
> As it's no longer necessary to have device tree nodes just to link to the
> appropriate emulator, remove the superfluous ones. 01:10.0 and 02:1f.0 are
> left in because they are required by dm_test_pci_drvdata and
> dm_test_pci_mixed, respectively.
>
> Signed-off-by: Sean Anderson <sean.anderson at linux.dev>
> ---
>
> Changes in v3:
> - New
>
> arch/sandbox/dts/sandbox.dtsi | 16 +++--
> arch/sandbox/dts/test.dts | 85 +++++++++++++++++-------
> doc/develop/driver-model/pci-info.rst | 59 +++++------------
> drivers/misc/p2sb_emul.c | 7 +-
> drivers/misc/swap_case.c | 7 +-
> drivers/pci/pci-emul-uclass.c | 82 +++++++++++++++++------
> drivers/pci/pci_sandbox.c | 94 +++++----------------------
> include/pci.h | 5 +-
> 8 files changed, 179 insertions(+), 176 deletions(-)
Thank you for taking this on.
Reviewed-by: Simon Glass <simon.glass at canonical.com>
More information about the U-Boot
mailing list