Skip to contentSkip to conversation

hw/arm/virt: Add linux,pci-domain property

PATCH In review Jan Kiszka 3 participants 6 messages Apr 23, 2018 – Apr 27, 2018

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 hw/arm/virt: Add linux,pci-domain property

From: Jan Kiszka <[email protected]>

This allows to pin the host controller in the Linux PCI domain space. Linux requires that property to be available consistently or not at all, in which case the domain number becomes unstable on additions/removals. Adding it here won't make a difference in practice for most setups as we only expose one controller.

However, enabling Jailhouse on top may introduce another controller, and that one would like to have stable address as well. So the property is needed for the first controller as well.

---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/virt.c +1 -0
index 94dcb125d3..943371b75e 100644
@@ -1023,6 +1023,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
     qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
     qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
Signature · 1 line
2.13.6
#1 lore raw

Re: [Qemu-devel] [PATCH] hw/arm/virt: Add linux, pci-domain property

Quoted 11 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This allows to pin the host controller in the Linux PCI domain space. Linux requires that property to be available consistently or not at all, in which case the domain number becomes unstable on additions/removals. Adding it here won't make a difference in practice for most setups as we only expose one controller.

However, enabling Jailhouse on top may introduce another controller, and that one would like to have stable address as well. So the property is needed for the first controller as well.

Am I right in thinking that for ACPI the PCI domain number is communicated via the _SEG method? If so, looks like we already set that, and we set it to 0, which matches what we're doing here in the DT, so that's good.

Quoted 10 lines
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/virt.c +0 -0
index 94dcb125d3..943371b75e 100644

hw/arm/virt.c static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)

Quoted 8 lines
hw/arm/virt.c +1 -1
@@ -1023,6 +1023,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
     qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
     qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
--

Drew -- is minor changes to the DTC something we can do without having to condition it on machine version? I forget...

thanks
-- PMM

author
#2 lore raw

Re: [Qemu-devel] [PATCH] hw/arm/virt: Add linux, pci-domain property

Quoted 9 lines · Peter Maydell
Quoted 8 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This allows to pin the host controller in the Linux PCI domain space. Linux requires that property to be available consistently or not at all, in which case the domain number becomes unstable on additions/removals. Adding it here won't make a difference in practice for most setups as we only expose one controller.

Quoted 8 lines
Quoted 3 lines

However, enabling Jailhouse on top may introduce another controller, and that one would like to have stable address as well. So the property is needed for the first controller as well.

Am I right in thinking that for ACPI the PCI domain number is communicated via the _SEG method? If so, looks like we already set that, and we set it to 0, which matches what we're doing here in the DT, so that's good.

Looking at the related arm64 kernel code (not the spec), it seems __SEG is involved, yet.

Jan

Quoted 26 lines
Quoted 11 lines
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/virt.c +0 -0
index 94dcb125d3..943371b75e 100644

hw/arm/virt.c static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)

Quoted 8 lines
hw/arm/virt.c +1 -1
@@ -1023,6 +1023,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
     qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
     qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
--

Drew -- is minor changes to the DTC something we can do without having to condition it on machine version? I forget...

thanks
-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH] hw/arm/virt: Add linux, pci-domain property

In reply to Peter Maydell
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This allows to pin the host controller in the Linux PCI domain space. Linux requires that property to be available consistently or not at all, in which case the domain number becomes unstable on additions/removals. Adding it here won't make a difference in practice for most setups as we only expose one controller.

Quoted 8 lines
Quoted 3 lines

However, enabling Jailhouse on top may introduce another controller, and that one would like to have stable address as well. So the property is needed for the first controller as well.

Am I right in thinking that for ACPI the PCI domain number is communicated via the _SEG method? If so, looks like we already set that, and we set it to 0, which matches what we're doing here in the DT, so that's good.

_SEG and linux,pci-domain are similar in definition, but don't appear to be equivalent, as the same _SEG number is permitted across multiple host bridges, but linux,pci-domain must be unique for each host bridge. I think the (_SEG, _BBN) pair may form the equivalent. We also set _BBN to zero, so I think we're fine anyway.

Quoted 6 lines
Quoted 6 lines
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 16 lines

hw/arm/virt.c static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)

Quoted 13 lines
hw/arm/virt.c +1 -1
index 94dcb125d3..943371b75e 100644
@@ -1023,6 +1023,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
     qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
     qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
--

Drew -- is minor changes to the DTC something we can do without having to condition it on machine version? I forget...

Yes, and even less minor changes than this one can be made to ACPI and DT generation, per the "if a firwmare update could change it, then don't worry about it" policy.

(I've CC'ed Igor in case he wants to chime in to correct anything I've
said.)

Thanks,
drew

#4 lore raw

Re: [Qemu-devel] [PATCH] hw/arm/virt: Add linux, pci-domain property

Quoted 48 lines · Andrew Jones
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This allows to pin the host controller in the Linux PCI domain space. Linux requires that property to be available consistently or not at all, in which case the domain number becomes unstable on additions/removals. Adding it here won't make a difference in practice for most setups as we only expose one controller.

Quoted 8 lines
Quoted 3 lines

However, enabling Jailhouse on top may introduce another controller, and that one would like to have stable address as well. So the property is needed for the first controller as well.

Am I right in thinking that for ACPI the PCI domain number is communicated via the _SEG method? If so, looks like we already set that, and we set it to 0, which matches what we're doing here in the DT, so that's good.

_SEG and linux,pci-domain are similar in definition, but don't appear to be equivalent, as the same _SEG number is permitted across multiple host bridges, but linux,pci-domain must be unique for each host bridge. I think the (_SEG, _BBN) pair may form the equivalent. We also set _BBN to zero, so I think we're fine anyway.

Quoted 6 lines
Quoted 6 lines
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 16 lines

hw/arm/virt.c static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)

Quoted 13 lines
hw/arm/virt.c +1 -1
index 94dcb125d3..943371b75e 100644
@@ -1023,6 +1023,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
     qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
     qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
--

Drew -- is minor changes to the DTC something we can do without having to condition it on machine version? I forget...

Quoted 6 lines

Yes, and even less minor changes than this one can be made to ACPI and DT generation, per the "if a firwmare update could change it, then don't worry about it" policy.

(I've CC'ed Igor in case he wants to chime in to correct anything I've
said.)

Eh, now I've CC'ed him...

#5 lore raw

Re: [Qemu-devel] [PATCH] hw/arm/virt: Add linux, pci-domain property

In reply to Andrew Jones
Quoted 48 lines · Andrew Jones
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This allows to pin the host controller in the Linux PCI domain space. Linux requires that property to be available consistently or not at all, in which case the domain number becomes unstable on additions/removals. Adding it here won't make a difference in practice for most setups as we only expose one controller.

Quoted 8 lines
Quoted 3 lines

However, enabling Jailhouse on top may introduce another controller, and that one would like to have stable address as well. So the property is needed for the first controller as well.

Am I right in thinking that for ACPI the PCI domain number is communicated via the _SEG method? If so, looks like we already set that, and we set it to 0, which matches what we're doing here in the DT, so that's good.

_SEG and linux,pci-domain are similar in definition, but don't appear to be equivalent, as the same _SEG number is permitted across multiple host bridges, but linux,pci-domain must be unique for each host bridge. I think the (_SEG, _BBN) pair may form the equivalent. We also set _BBN to zero, so I think we're fine anyway.

Quoted 6 lines
Quoted 6 lines
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 16 lines

hw/arm/virt.c static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)

Quoted 13 lines
hw/arm/virt.c +1 -1
index 94dcb125d3..943371b75e 100644
@@ -1023,6 +1023,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
     qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
     qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
     qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
--

Drew -- is minor changes to the DTC something we can do without having to condition it on machine version? I forget...

Quoted 3 lines

Yes, and even less minor changes than this one can be made to ACPI and DT generation, per the "if a firwmare update could change it, then don't worry about it" policy.

Cool; applied to target-arm.next, then.

-- PMM