Hi Pantelis,
coming back to this topic:
Meanwhile I got a virtual PCI device recognized by Linux when running
over Jailhouse. However, my hack above doesn't get me to proper
interrupt mapping yet. This is what I was trying with upstream dtc:
/dts-v1/;
/ {
compatible = "lemaker,bananapi", "allwinner,sun7i-a20";
fragment@0 {
target-path = "/soc@01c00000";
__overlay__ {
#address-cells = <2>;
#size-cells = <2>;
vpci@2000000 {
compatible = "pci-host-ecam-generic";
device_type = "pci";
bus-range = <0 0>;
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 7>;
interrupt-map = <0 0 0 1 &gic 0 0 0 123 4>,
<0 0 0 2 &gic 0 0 0 124 4>,
<0 0 0 3 &gic 0 0 0 125 4>,
<0 0 0 4 &gic 0 0 0 126 4>;
reg = <0 0x2000000 0 0x100000>;
ranges =
<0x02000000 0x00 0x10000000 0x00 0x10000000 0x00 0x30000000>;
};
};
};
gic: fragment@1 {
target-path = "/soc@01c00000/interrupt-controller@01c81000";
__overlay__ {
};
};
};
And this is what Linux detects on that PCI bus:
00:0f.0 RAM memory: Red Hat, Inc Inter-VM shared memory
Subsystem: Red Hat, Inc Inter-VM shared memory
Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Interrupt: pin A routed to IRQ 17
Region 0: Memory at 10000000 (64-bit, non-prefetchable) [size=256]
Region 4: Memory at 10000100 (64-bit, non-prefetchable) [size=32]
Kernel modules: ivshmem_net
However, registering a handler on IRQ 17 fails (-EINVAL).
With your dtc [2] (dtc -@ -I dts -O dtb -o vpci-bpi.dtb vpci-bpi.dts)
and this fragment, I'm still not able to load the blob:
/dts-v1/;
/plugin/;
/ {
compatible = "lemaker,bananapi", "allwinner,sun7i-a20";
fragment@0 {
target-path = "/soc@01c00000";
__overlay__ {
#address-cells = <2>;
#size-cells = <2>;
vpci@2000000 {
compatible = "pci-host-ecam-generic";
device_type = "pci";
bus-range = <0 0>;
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 7>;
interrupt-map = <0 0 0 1 &gic 0 0 0 123 4>,
<0 0 0 2 &gic 0 0 0 124 4>,
<0 0 0 3 &gic 0 0 0 125 4>,
<0 0 0 4 &gic 0 0 0 126 4>;
reg = <0 0x2000000 0 0x100000>;
ranges =
<0x02000000 0x00 0x10000000 0x00 0x10000000 0x00 0x30000000>;
};
};
};
};
Any suggestions? Any patches I'm missing in upstream to make that work?
Jan
[1]
https://github.com/pantoniou/linux-beagle-track-mainline/commit/160e68ec89eca33e8ed0abb13d52c07c54d7fc10
[2]
https://github.com/pantoniou/dtc/tree/dgibson-overlay-panto