Re: [PATCH V9 5/5] of: unittest: Add pci_dt_testdrv pci driver

From: Rob Herring
Date: Mon Jun 26 2023 - 12:51:45 EST


On Thu, Jun 22, 2023 at 4:27 AM Herve Codina <herve.codina@xxxxxxxxxxx> wrote:
>
> Hi all,
>
> On Wed, 21 Jun 2023 10:34:09 -0700
> Lizhi Hou <lizhi.hou@xxxxxxx> wrote:
>
> > pci_dt_testdrv is bound to QEMU PCI Test Device. It reads
> > overlay_pci_node fdt fragment and apply it to Test Device. Then it
> > calls of_platform_default_populate() to populate the platform
> > devices.
> >
> > Signed-off-by: Lizhi Hou <lizhi.hou@xxxxxxx>
> > ---
> > drivers/of/unittest-data/Makefile | 3 +-
> > .../of/unittest-data/overlay_pci_node.dtso | 22 ++
> > drivers/of/unittest.c | 188 ++++++++++++++++++
> > drivers/pci/quirks.c | 1 +
> > 4 files changed, 213 insertions(+), 1 deletion(-)
> > create mode 100644 drivers/of/unittest-data/overlay_pci_node.dtso
>
> Did the test under QEMU with the instructions that Lizhi provided at
> https://github.com/houlz0507/xoclv2/blob/pci-dt-0329/pci-dt-patch-0329/README

Instructions need to be in the tree, not living somewhere else. Don't
need the full QEMU setup, but just stating 'add "-device pci-testdev"'
somewhere. Probably in the test failure messages would be the most
helpful location.

>
> The unittest results were:
> --- 8< ---
> [ 1.107378] ### dt-test ### pass of_unittest_lifecycle():3273
> [ 1.110068] ### dt-test ### pass of_unittest_pci_node():3909
> [ 1.110401] ### dt-test ### pass unittest_pci_probe():3840
> [ 1.110618] ### dt-test ### pass of_unittest_pci_node():3914
> [ 1.110759] ### dt-test ### pass of_unittest_pci_node_verify():3870
> [ 1.110894] ### dt-test ### pass of_unittest_pci_node_verify():3877
> [ 1.110985] ### dt-test ### pass of_unittest_pci_node_verify():3884
> [ 1.111088] ### dt-test ### pass of_unittest_pci_node():3926
> [ 1.111171] ### dt-test ### pass of_unittest_pci_node():3927
> [ 1.112056] ### dt-test ### pass of_unittest_pci_node_verify():3870
> [ 1.112201] ### dt-test ### pass of_unittest_pci_node_verify():3890
> [ 1.112326] ### dt-test ### pass of_unittest_pci_node_verify():3892
> [ 1.112489] ### dt-test ### pass of_unittest_check_tree_linkage():271
> --- 8< ---
>
> Based on the test provided, no failure detected.
>
> Tested-by: Herve Codina <herve.codina@xxxxxxxxxxx>
>
> Further more, I dumped the dt (PCI related nodes) available on the target.
> If someone needs to look at it:

Thanks!

> --- 8< ---
> # cat /tmp/dt.dts
> /dts-v1/;
>
> / {
> #address-cells = <0x02>;
> #size-cells = <0x02>;
> interrupt-parent = <0x8002>;
> compatible = "linux,dummy-virt";
> name = [00];
> [...]
> pcie@10000000 {
> #address-cells = <0x03>;
> dma-coherent;
> bus-range = <0x00 0xff>;
> interrupt-map = <0x00 0x00 0x00 0x01 0x8002 0x00 0x00 0x00 0x03 0x04 0x00 0x00 0x00 0x02 0x8002 0x00 0x00 0x00 0x04 0x04 0x00 0x00 0x00 0x03 0x8002 0x00 0x00 0x00 0x05 0x04 0x00 0x00 0x00 0x04 0x8002 0x00 0x00 0x00 0x06 0x04 0x800 0x00 0x00 0x01 0x8002 0x00 0x00 0x00 0x04 0x04 0x800 0x00 0x00 0x02 0x8002 0x00 0x00 0x00 0x05 0x04 0x800 0x00 0x00 0x03 0x8002 0x00 0x00 0x00 0x06 0x04 0x800 0x00 0x00 0x04 0x8002 0x00 0x00 0x00 0x03 0x04 0x1000 0x00 0x00 0x01 0x8002 0x00 0x00 0x00 0x05 0x04 0x1000 0x00 0x00 0x02 0x8002 0x00 0x00 0x00 0x06 0x04 0x1000 0x00 0x00 0x03 0x8002 0x00 0x00 0x00 0x03 0x04 0x1000 0x00 0x00 0x04 0x8002 0x00 0x00 0x00 0x04 0x04 0x1800 0x00 0x00 0x01 0x8002 0x00 0x00 0x00 0x06 0x04 0x1800 0x00 0x00 0x02 0x8002 0x00 0x00 0x00 0x03 0x04 0x1800 0x00 0x00 0x03 0x8002 0x00 0x00 0x00 0x04 0x04 0x1800 0x00 0x00 0x04 0x8002 0x00 0x00 0x00 0x05 0x04>;
> #size-cells = <0x02>;
> device_type = "pci";
> interrupt-map-mask = <0x1800 0x00 0x00 0x07>;
> compatible = "pci-host-ecam-generic";
> ranges = <0x1000000 0x00 0x00 0x00 0x3eff0000 0x00 0x10000 0x2000000 0x00 0x10000000 0x00 0x10000000 0x00 0x2eff0000 0x3000000 0x80 0x00 0x80 0x00 0x80 0x00>;
> #interrupt-cells = <0x01>;
> reg = <0x40 0x10000000 0x00 0x10000000>;
> linux,pci-domain = <0x00>;
> msi-parent = <0x8003>;
> name = "pcie";
>
> pci@3,0 {
> #address-cells = <0x03>;
> #size-cells = <0x02>;
> device_type = "pci";
> compatible = "pci1b36,c\0pciclass,060400\0pciclass,0604";
> ranges = <0x81001800 0x00 0x1000 0x81001800 0x00 0x1000 0x00 0x2000 0x82001800 0x00 0x10000000 0x82001800 0x00 0x10000000 0x00 0x200000 0xc3001800 0x80 0x00 0xc3001800 0x80 0x00 0x00 0x200000>;
> reg = <0x1800 0xffff6d76 0xc2b23600 0xffff6d76 0x3fbf63a0>;

Something looks wrong with the values here. I found this running it thru dtc.

<stdout>: Warning (pci_device_reg): /pcie@10000000/pci@3,0:reg: PCI
reg config space address cells 2 and 3 must be 0

Rob