Allow RedHat PCI bridges reserve more buses than necessary during init
cover Allow RedHat PCI bridges reserve more buses than necessary during init
Now PCI bridges (and PCIE root port too) get a bus range number in system init, basing on currently plugged devices. That's why when one wants to hotplug another bridge, it needs his child bus, which the parent is unable to provide.
The suggested workaround is to have vendor-specific capability in RedHat generic pcie-root-port that contains number of additional bus to reserve on BIOS PCI init.
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more buses
src/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
RFC PATCH 1/2 pci: add support for direct usage of bdf for capability lookup
Add a capability lookup function which gets bdf instead of pci_device as its first argument. It may be useful when we have bdf, but don't have the whole pci_device structure.
--- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 2 files changed, 25 insertions(+)
src/hw/pcidevice.c +24 -0
@@ -158,6 +158,30 @@ u8 pci_find_capability(struct pci_device *pci, u8 cap_id, u8 cap)return 0 ; } +u8 pci_find_capability_bdf (int bdf,u8 cap_id,u8 cap) +{ +int i; +u16 status =pci_config_readw (bdf,PCI_STATUS ); + +if (!(status &PCI_STATUS_CAP_LIST )) +return 0 ; + +if (cap ==0 ) { +/* find first */ + cap =pci_config_readb (bdf,PCI_CAPABILITY_LIST ); + }else { +/* find next */ + cap =pci_config_readb (bdf, cap +PCI_CAP_LIST_NEXT ); + } +for (i =0 ; cap && i <=0xff ; i++) { +if (pci_config_readb (bdf, cap +PCI_CAP_LIST_ID ) == cap_id) +return cap; + cap =pci_config_readb (bdf, cap +PCI_CAP_LIST_NEXT ); + } + +return 0 ; +} +// Enable PCI bus-mastering (ie, DMA) support on a pci device void pci_enable_busmaster (struct pci_device *pci)
src/hw/pcidevice.h +1 -0
@@ -70,6 +70,7 @@ int pci_init_device(const struct pci_device_id *idsstruct pci_device *pci_find_init_device (const struct pci_device_id *ids ,void *arg);u8 pci_find_capability (struct pci_device *pci,u8 cap_id,u8 cap); +u8 pci_find_capability_bdf (int bdf,u8 cap_id,u8 cap);void pci_enable_busmaster (struct pci_device *pci);u16 pci_enable_iobar (struct pci_device *pci,u32 addr);void *pci_enable_membar (struct pci_device *pci,u32 addr);
Signature · 1 line
2.7.4
Re: [Qemu-devel] [RFC PATCH 1/2] pci: add support for direct usage of bdf for capability lookup
Quoted 15 lines · Aleksandr Bezzubikov
Add a capability lookup function which gets bdf instead of
pci_deviceas its first argument. It may be useful when we have bdf, but don't have the wholepci_devicestructure.Signed-off-by Aleksandr Bezzubikov <[email protected]>--- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 2 files changed, 25 insertions(+)src/hw/pcidevice.c +0
-0
src/hw/pcidevice.c u8 pci_find_capability(struct pci_device *pci, u8 cap_id, u8 cap) · line 160
Quoted 3 lines
src/hw/pcidevice.c +0
-0@@ -158,6 +158,30 @@ u8 pci_find_capability(struct pci_device *pci, u8 cap_id, u8 cap)return 0 ; }
Hi Aleksandr,
src/hw/pcidevice.c u8 pci_find_capability(struct pci_device *pci, u8 cap_id, u8 cap) · line 162
Quoted 2 lines
src/hw/pcidevice.c +2
-0+u8 pci_find_capability_bdf (int bdf,u8 cap_id,u8 cap) +{
Please do not duplicate the code for the 'pci_find_capability'. In this case you can reuse the code by
making 'pci_find_capability' call 'pci_find_capability_bdf', or better, instead of a new function, change the signature as you proposed and make the calling code use bdf instead of the pci device, since is the only info needed.
Thanks,
Marcel
Quoted 38 lines
src/hw/pcidevice.c +22
-0+int i; +u16 status =pci_config_readw (bdf,PCI_STATUS ); + +if (!(status &PCI_STATUS_CAP_LIST )) +return 0 ; + +if (cap ==0 ) { +/* find first */ + cap =pci_config_readb (bdf,PCI_CAPABILITY_LIST ); + }else { +/* find next */ + cap =pci_config_readb (bdf, cap +PCI_CAP_LIST_NEXT ); + } +for (i =0 ; cap && i <=0xff ; i++) { +if (pci_config_readb (bdf, cap +PCI_CAP_LIST_ID ) == cap_id) +return cap; + cap =pci_config_readb (bdf, cap +PCI_CAP_LIST_NEXT ); + } + +return 0 ; +} +// Enable PCI bus-mastering (ie, DMA) support on a pci device void pci_enable_busmaster (struct pci_device *pci)src/hw/pcidevice.h +1
-0@@ -70,6 +70,7 @@ int pci_init_device(const struct pci_device_id *idsstruct pci_device *pci_find_init_device (const struct pci_device_id *ids ,void *arg);u8 pci_find_capability (struct pci_device *pci,u8 cap_id,u8 cap); +u8 pci_find_capability_bdf (int bdf,u8 cap_id,u8 cap);void pci_enable_busmaster (struct pci_device *pci);u16 pci_enable_iobar (struct pci_device *pci,u32 addr);void *pci_enable_membar (struct pci_device *pci,u32 addr);
RFC PATCH 2/2 pci: enable RedHat pci bridges to reserve more buses
In reply to Aleksandr BezzubikovIn case of RedHat PCI bridges reserve additional buses, which number is provided in a vendor-specific capability.
--- src/fw/pciinit.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
src/fw/pciinit.c +10 -2
@@ -578,9 +578,17 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus)pci_bios_init_bus_rec (secbus, pci_bus);if (subbus != *pci_bus) { +u16 vendor =pci_config_readw (bdf,PCI_VENDOR_ID ); +u8 res_bus =0 ; +if (vendor ==0x1b36 ) { +u8 cap =pci_find_capability_bdf (bdf,PCI_CAP_ID_VNDR ,0 ); +if (cap) { + res_bus =pci_config_readb (bdf, cap +16 ); + } + }dprintf (1 ,"PCI: subordinate bus = 0x%x -> 0x%x\n" , - subbus, *pci_bus); - subbus = *pci_bus; + subbus, *pci_bus + res_bus); + subbus = *pci_bus + res_bus; }else {dprintf (1 ,"PCI: subordinate bus = 0x%x\n" , subbus); }
Signature · 1 line
2.7.4
Re: [Qemu-devel] [RFC PATCH 2/2] pci: enable RedHat pci bridges to reserve more buses
Quoted 1 line · Aleksandr Bezzubikov
In case of RedHat PCI bridges reserve additional buses, which number is provided
It is "Red Hat"
Quoted 1 line
in a vendor-specific capability.
And perhaps also a #define ?
Quoted 34 lines
Signed-off-by Aleksandr Bezzubikov <[email protected]>--- src/fw/pciinit.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)src/fw/pciinit.c +10
-2@@ -578,9 +578,17 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus)pci_bios_init_bus_rec (secbus, pci_bus);if (subbus != *pci_bus) { +u16 vendor =pci_config_readw (bdf,PCI_VENDOR_ID ); +u8 res_bus =0 ; +if (vendor ==0x1b36 ) { +u8 cap =pci_find_capability_bdf (bdf,PCI_CAP_ID_VNDR ,0 ); +if (cap) { + res_bus =pci_config_readb (bdf, cap +16 ); + } + }dprintf (1 ,"PCI: subordinate bus = 0x%x -> 0x%x\n" , - subbus, *pci_bus); - subbus = *pci_bus; + subbus, *pci_bus + res_bus); + subbus = *pci_bus + res_bus; }else {dprintf (1 ,"PCI: subordinate bus = 0x%x\n" , subbus); }Signature · 1 line
2.7.4
Re: [Qemu-devel] [RFC PATCH 2/2] pci: enable RedHat pci bridges to reserve more buses
Quoted 7 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Aleksandr Bezzubikov
In case of RedHat PCI bridges reserve additional buses, which number is provided
It is "Red Hat"
Quoted 1 line
in a vendor-specific capability.
And perhaps also a #define ?
Right, please add it to src/hw/pci_ids.h.
Thanks,
Marcel
Quoted 34 lines
Quoted 34 lines
Signed-off-by Aleksandr Bezzubikov <[email protected]>--- src/fw/pciinit.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)src/fw/pciinit.c +10
-2@@ -578,9 +578,17 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus)pci_bios_init_bus_rec (secbus, pci_bus);if (subbus != *pci_bus) { +u16 vendor =pci_config_readw (bdf,PCI_VENDOR_ID ); +u8 res_bus =0 ; +if (vendor ==0x1b36 ) { +u8 cap =pci_find_capability_bdf (bdf,PCI_CAP_ID_VNDR ,0 ); +if (cap) { + res_bus =pci_config_readb (bdf, cap +16 ); + } + }dprintf (1 ,"PCI: subordinate bus = 0x%x -> 0x%x\n" , - subbus, *pci_bus); - subbus = *pci_bus; + subbus, *pci_bus + res_bus); + subbus = *pci_bus + res_bus; }else {dprintf (1 ,"PCI: subordinate bus = 0x%x\n" , subbus); }Signature · 1 line
2.7.4
Quoted 3 lines · Aleksandr Bezzubikov
Now PCI bridges (and PCIE root port too) get a bus range number in system init, basing on currently plugged devices. That's why when one wants to hotplug another bridge, it needs his child bus, which the parent is unable to provide.
Could you explain how you trigger this?
Quoted 2 lines
The suggested workaround is to have vendor-specific capability in RedHat generic pcie-root-port that contains number of additional bus to reserve on BIOS PCI init.
But wouldn't the proper fix be for the PCI bridge to have the subordinate value be extended to fit more bus ranges?
Quoted 14 lines
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more busessrc/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)Signature · 1 line
2.7.4
ср, 19 июля 2017 г. в 16:57, Konrad Rzeszutek Wilk <[email protected]>:
Quoted 8 lines · Aleksandr Bezzubikov
Quoted 1 line
Now PCI bridges (and PCIE root port too) get a bus range number in
system init,
Quoted 1 line
basing on currently plugged devices. That's why when one wants to
hotplug another bridge,
Quoted 1 line
it needs his child bus, which the parent is unable to provide.
Could you explain how you trigger this?
I'm trying to hot plug pcie-pci bridge into pcie root port, and Linux says 'cannot allocate bus number for device bla-bla'. This obviously does not allow me to use the bridge at all.
Quoted 8 lines
Quoted 3 lines
The suggested workaround is to have vendor-specific capability in RedHat
generic pcie-root-port
Quoted 1 line
that contains number of additional bus to reserve on BIOS PCI init.
But wouldn't the proper fix be for the PCI bridge to have the subordinate value be extended to fit more bus ranges?
What do you mean? This is what I'm trying to do. Do you suppose to get rid of vendor-specific cap and use original register value instead of it?
Quoted 16 lines
Quoted 15 lines
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more busessrc/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)--
2.7.4
Signature · 1 line
Alexander Bezzubikov
Quoted 20 lines · Alexander Bezzubikov
ср, 19 июля 2017 г. в 16:57, Konrad Rzeszutek Wilk <[email protected]>:
Quoted 8 lines · Aleksandr Bezzubikov
Quoted 1 line
Now PCI bridges (and PCIE root port too) get a bus range number in
system init,
Quoted 1 line
basing on currently plugged devices. That's why when one wants to
hotplug another bridge,
Quoted 1 line
it needs his child bus, which the parent is unable to provide.
Could you explain how you trigger this?
I'm trying to hot plug pcie-pci bridge into pcie root port, and Linux says 'cannot allocate bus number for device bla-bla'. This obviously does not allow me to use the bridge at all.
Quoted 4 lines
Quoted 3 lines
The suggested workaround is to have vendor-specific capability in RedHat
generic pcie-root-port
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
that contains number of additional bus to reserve on BIOS PCI init.
But wouldn't the proper fix be for the PCI bridge to have the subordinate value be extended to fit more bus ranges?
What do you mean? This is what I'm trying to do. Do you suppose to get rid of vendor-specific cap and use original register value instead of it?
I would suggest a simple fix - each bridge has a a number of bus devices it can use. You have up to 255 - so you split the number of northbridge numbers by the amount of NUMA nodes (if that is used) - so for example if you have 4 NUMA nodes, each bridge would cover 63 bus numbers.
Meaning the root bridge would cover 0->63 bus, 64->128, and so on. That gives you enough space to plug in your plugged in devices (up to 63).
And if you need sub-briges then carve out a specific range.
Quoted 19 lines
Quoted 17 lines
Quoted 16 lines
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more busessrc/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)--
2.7.4Signature · 1 line
Alexander Bezzubikov
A message that is not in the archive (sent off-list or not yet received): CAKSfGUCp=AFDjm24bMOpaSAA5FiDZXO0ZrBvuCp4wT+5EbhqDA@mail.gmail.com
cover Allow RedHat PCI bridges reserve more buses than necessary during init
2017-07-19 21:18 GMT+03:00 Konrad Rzeszutek Wilk <[email protected]>:
Quoted 40 lines · Alexander Bezzubikov
Quoted 1 line
ср, 19 июля 2017 г. в 16:57, Konrad Rzeszutek Wilk <
Quoted 4 lines
Quoted 4 lines · Aleksandr Bezzubikov
Quoted 1 line
Now PCI bridges (and PCIE root port too) get a bus range number in
system init,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
basing on currently plugged devices. That's why when one wants to
hotplug another bridge,
Quoted 1 line
it needs his child bus, which the parent is unable to provide.
Could you explain how you trigger this?
I'm trying to hot plug pcie-pci bridge into pcie root port, and Linux
says
Quoted 6 lines
'cannot allocate bus number for device bla-bla'. This obviously does not allow me to use the bridge at all.
Quoted 3 lines
Quoted 3 lines
The suggested workaround is to have vendor-specific capability in
RedHat
Quoted 4 lines
Quoted 4 lines
generic pcie-root-port
Quoted 1 line
that contains number of additional bus to reserve on BIOS PCI init.
But wouldn't the proper fix be for the PCI bridge to have the
subordinate
Quoted 4 lines
Quoted 1 line
value be extended to fit more bus ranges?
What do you mean? This is what I'm trying to do. Do you suppose to get
rid
Quoted 1 line
of vendor-specific cap and use original register value instead of it?
I would suggest a simple fix - each bridge has a a number of bus devices it can use. You have up to 255 - so you split the number of northbridge numbers by the amount of NUMA nodes (if that is used) - so for example if you have 4 NUMA nodes, each bridge would cover 63 bus numbers.
Quoted 6 lines
Meaning the root bridge would cover 0->63 bus, 64->128, and so on. That gives you enough space to plug in your plugged in devices (up to 63).
And if you need sub-briges then carve out a specific range.
The problem is that we don't know at the init moment how many subbridges we may need,
and how deep the whole device tree will be. The key moment - PCI bridge hotplugging
needs either rescan all buses on each bridge device addition, or reserve space in advance during BIOS init.
In this series the second way was chosen.
Quoted 22 lines
Quoted 21 lines
Quoted 14 lines
Quoted 14 lines
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more busessrc/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 4 lines
--
2.7.4--
Alexander Bezzubikov
Signature · 1 line
Alexander Bezzubikov
Quoted 46 lines · Alexander Bezzubikov
2017-07-19 21:18 GMT+03:00 Konrad Rzeszutek Wilk <[email protected]>:
Quoted 44 lines · Alexander Bezzubikov
Quoted 1 line
ср, 19 июля 2017 г. в 16:57, Konrad Rzeszutek Wilk <
Quoted 4 lines
Quoted 4 lines · Aleksandr Bezzubikov
Quoted 1 line
Now PCI bridges (and PCIE root port too) get a bus range number in
system init,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
basing on currently plugged devices. That's why when one wants to
hotplug another bridge,
Quoted 1 line
it needs his child bus, which the parent is unable to provide.
Could you explain how you trigger this?
I'm trying to hot plug pcie-pci bridge into pcie root port, and Linux
says
Quoted 6 lines
'cannot allocate bus number for device bla-bla'. This obviously does not allow me to use the bridge at all.
Quoted 3 lines
Quoted 3 lines
The suggested workaround is to have vendor-specific capability in
RedHat
Quoted 4 lines
Quoted 4 lines
generic pcie-root-port
Quoted 1 line
that contains number of additional bus to reserve on BIOS PCI init.
But wouldn't the proper fix be for the PCI bridge to have the
subordinate
Quoted 4 lines
Quoted 1 line
value be extended to fit more bus ranges?
What do you mean? This is what I'm trying to do. Do you suppose to get
rid
Quoted 1 line
of vendor-specific cap and use original register value instead of it?
I would suggest a simple fix - each bridge has a a number of bus devices it can use. You have up to 255 - so you split the number of northbridge numbers by the amount of NUMA nodes (if that is used) - so for example if you have 4 NUMA nodes, each bridge would cover 63 bus numbers.
Meaning the root bridge would cover 0->63 bus, 64->128, and so on. That gives you enough space to plug in your plugged in devices (up to 63).
Quoted 5 lines
Quoted 2 lines
And if you need sub-briges then carve out a specific range.
The problem is that we don't know at the init moment how many subbridges we may need,
And the explanation above does not either. It just setups at init time an range where you can plug in your new devices in. But in a more uniform way such that you can also utilize this with NUMA and _PXM topology in the future.
Quoted 4 lines
and how deep the whole device tree will be. The key moment - PCI bridge hotplugging
needs either rescan all buses on each bridge device addition, or reserve space in advance during BIOS init.
can all buses on each bridge device addition, or reserve
It is more complex than that - you may need to move devices that are below you. And Linux kernel (nor any other OS) can handle that. (They can during bootup)
Quoted 30 lines
In this series the second way was chosen.
Quoted 22 lines
Quoted 21 lines
Quoted 14 lines
Quoted 14 lines
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more busessrc/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 4 lines
--
2.7.4--
Alexander BezzubikovSignature · 1 line
Alexander Bezzubikov
Quoted 43 lines · Konrad Rzeszutek Wilk
Quoted 42 lines · Alexander Bezzubikov
2017-07-19 21:18 GMT+03:00 Konrad Rzeszutek Wilk <[email protected]>:
Quoted 40 lines · Alexander Bezzubikov
Quoted 1 line
ср, 19 июля 2017 г. в 16:57, Konrad Rzeszutek Wilk <
Quoted 4 lines
Quoted 4 lines · Aleksandr Bezzubikov
Quoted 1 line
Now PCI bridges (and PCIE root port too) get a bus range number in
system init,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
basing on currently plugged devices. That's why when one wants to
hotplug another bridge,
Quoted 1 line
it needs his child bus, which the parent is unable to provide.
Could you explain how you trigger this?
I'm trying to hot plug pcie-pci bridge into pcie root port, and Linux
says
Quoted 6 lines
'cannot allocate bus number for device bla-bla'. This obviously does not allow me to use the bridge at all.
Quoted 3 lines
Quoted 3 lines
The suggested workaround is to have vendor-specific capability in
RedHat
Quoted 4 lines
Quoted 4 lines
generic pcie-root-port
Quoted 1 line
that contains number of additional bus to reserve on BIOS PCI init.
But wouldn't the proper fix be for the PCI bridge to have the
subordinate
Quoted 4 lines
Quoted 1 line
value be extended to fit more bus ranges?
What do you mean? This is what I'm trying to do. Do you suppose to get
rid
Quoted 1 line
of vendor-specific cap and use original register value instead of it?
I would suggest a simple fix - each bridge has a a number of bus devices it can use. You have up to 255 - so you split the number of northbridge numbers by the amount of NUMA nodes (if that is used) - so for example if you have 4 NUMA nodes, each bridge would cover 63 bus numbers.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Meaning the root bridge would cover 0->63 bus, 64->128, and so on. That gives you enough space to plug in your plugged in devices (up to 63).
And if you need sub-briges then carve out a specific range.
Hi Konrad,
Quoted 3 lines
Quoted 2 lines
The problem is that we don't know at the init moment how many subbridges we may need,
Is possible the explanation was not clear clear and led to some miscommunication.
Quoted 6 lines
And the explanation above does not either. It just setups at init time an range where you can plug in your new devices in. But in a more uniform way such that you can also utilize this with NUMA and
_PXMtopology in the future.
I fully agree with you and actually QEMU has already implemented the exact idea you are describing here, its called a pxb/pxb-pci device, that can be "bounded" to a specific NUMA node and has a subrange of bus numbers dedicated to it.
However this problem is different. In a PCI Express machine you can hotplug PCIe devices only into PCIe Root Ports (or switch downstream ports, but not in current scope).
We want to be able to hotplug a PCIe-PCI bridge into a PCIe Root Port so we can then hot-plug legacy PCI devices.
Since the PCIe Root Port is a type of PCI bridge, at boot time it only gets the bus sub-range (primary bus,subordinate bus] which is computed by firmware and leaves no bus number that can be used by a hot-plugged pci-bridge. And this obviously does not depend on how we arrange NUMA/proximities.
We are also not looking for a fix for a specific guest OS, so reserving some extra bus-numbers it has minimal impact on the system. I do agree the problem may be solved differently, however we can't reach all guest OS vendors and ask them to support an alternative solution in a reasonable time frame.
Thanks,
Marcel
Quoted 41 lines
Quoted 4 lines
and how deep the whole device tree will be. The key moment - PCI bridge hotplugging
needs either rescan all buses on each bridge device addition, or reserve space in advance during BIOS init.can all buses on each bridge device addition, or reserve
It is more complex than that - you may need to move devices that are below you. And Linux kernel (nor any other OS) can handle that. (They can during bootup)
Quoted 30 lines
In this series the second way was chosen.
Quoted 22 lines
Quoted 21 lines
Quoted 14 lines
Quoted 14 lines
Aleksandr Bezzubikov (2):
pci: add support for direct usage of bdf for capability lookup
pci: enable RedHat pci bridges to reserve more busessrc/fw/pciinit.c | 12 ++++++++++-- src/hw/pcidevice.c | 24 ++++++++++++++++++++++++ src/hw/pcidevice.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 4 lines
--
2.7.4--
Alexander BezzubikovSignature · 1 line
Alexander Bezzubikov
Quoted 8 lines · Aleksandr Bezzubikov
Now PCI bridges (and PCIE root port too) get a bus range number in system init,
basing on currently plugged devices. That's why when one wants to hotplug another bridge,
it needs his child bus, which the parent is unable to provide. The suggested workaround is to have vendor-specific capability in RedHat generic pcie-root-port
that contains number of additional bus to reserve on BIOS PCI init.
Where is the qemu patch for this?
What about window sizes? IIRC there was a plan to provide allocation hints for them too ...
cheers,
Gerd
Quoted 10 lines · Gerd Hoffmann
Quoted 8 lines · Aleksandr Bezzubikov
Now PCI bridges (and PCIE root port too) get a bus range number in system init,
basing on currently plugged devices. That's why when one wants to hotplug another bridge,
it needs his child bus, which the parent is unable to provide. The suggested workaround is to have vendor-specific capability in RedHat generic pcie-root-port
that contains number of additional bus to reserve on BIOS PCI init.
Hi Gerd,
Thanks for looking into this.
Quoted 2 lines
Where is the qemu patch for this?
On the way, Aleksandr is working on it, should
be ready soon.
Quoted 2 lines
What about window sizes? IIRC there was a plan to provide allocation hints for them too ...
Yes, is in my TODO list, however not as part of Aleksandr's series which aims to provide PCIe-PCI bridge hotplug support. I should mention that for this case both Windows and Linux guests (modern OSes) trigger correctly IO/MEM resource re-balancing process and succeeds to complete the hotplug operation.
Thanks,
Marcel
Quoted 4 lines
cheers,
Gerd
Hi,
Quoted 6 lines
Quoted 3 lines
What about window sizes? IIRC there was a plan to provide allocation
hints for them too ...Yes, is in my TODO list, however not as part of Aleksandr's series which aims to provide PCIe-PCI bridge hotplug support.
I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
cheers,
Gerd
Quoted 6 lines · Gerd Hoffmann
Hi,Quoted 4 lines
Quoted 3 lines
What about window sizes? IIRC there was a plan to provide allocation
hints for them too ...
Quoted 6 lines
Quoted 2 lines
Yes, is in my TODO list, however not as part of Aleksandr's series which aims to provide PCIe-PCI bridge hotplug support.
I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
[Adding Laszlo]
Sure, the capability looking something like:
[flags: reserve-buses|reserve-IO|reserve-MEM|...] [extra-buses][IO-size][MEM-size]
if reserve-buses -> use 'extra-buses' value and so on
would be OK?
Thanks,
Marcel
Quoted 3 lines
cheers,
Gerd
Quoted 18 lines · Marcel Apfelbaum
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
Quoted 3 lines
What about window sizes? IIRC there was a plan to provide allocation
hints for them too ...Quoted 7 lines
Quoted 3 lines
Yes, is in my TODO list, however not as part of Aleksandr's series
which aims to provide PCIe-PCI bridge hotplug support.I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
[Adding Laszlo]
Quoted 6 lines
Sure, the capability looking something like:
[flags: reserve-buses|reserve-IO|reserve-MEM|...] [extra-buses][IO-size][MEM-size]
if reserve-buses -> use 'extra-buses' value and so on
Do we need the flags? We can use "value == 0 -> no hint for you". Also what about prefetchable vs. non-prefetchable memory? I guess we want a size hint for both memory windows?
cheers,
Gerd
Quoted 19 lines · Gerd Hoffmann
Quoted 18 lines · Marcel Apfelbaum
Quoted 6 lines · Gerd Hoffmann
Hi,Quoted 4 lines
Quoted 3 lines
What about window sizes? IIRC there was a plan to provide allocation
hints for them too ...Quoted 7 lines
Quoted 3 lines
Yes, is in my TODO list, however not as part of Aleksandr's series
which aims to provide PCIe-PCI bridge hotplug support.I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
[Adding Laszlo]
Quoted 8 lines
Quoted 6 lines
Sure, the capability looking something like:
[flags: reserve-buses|reserve-IO|reserve-MEM|...] [extra-buses][IO-size][MEM-size] if reserve-buses -> use 'extra-buses' value and so onDo we need the flags? We can use "value == 0 -> no hint for you".
Maybe we don't want to allocate IO at all,
So value 0 would say do not allocate.
But we can disable IO by other means.
Quoted 2 lines
Also what about prefetchable vs. non-prefetchable memory? I guess we want a size hint for both memory windows?
Good point, thanks!
Marcel
Quoted 4 lines
cheers,
Gerd
Hi,
Quoted 4 lines
Maybe we don't want to allocate IO at all,
So value 0 would say do not allocate.But we can disable IO by other means.
Indeed. As IO is optional for pcie we don't need a qemu-specific extension for that.
cheers,
Gerd
Quoted 9 lines · Marcel Apfelbaum
Quoted 2 lines · Gerd Hoffmann
I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
Sure, the capability looking something like:
[flags: reserve-buses|reserve-IO|reserve-MEM|...] [extra-buses][IO-size][MEM-size]
if reserve-buses -> use 'extra-buses' value and so on
I don't have any objection to using a PCI capability, but I do wonder if fw_cfg would be a better fit. This information is purely qemu -> firmware, right?
-Kevin
Quoted 6 lines · Kevin O'Connor
Quoted 5 lines · Marcel Apfelbaum
Quoted 2 lines · Gerd Hoffmann
I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
Sure, the capability looking something like:
Quoted 9 lines
Quoted 4 lines
[flags: reserve-buses|reserve-IO|reserve-MEM|...] [extra-buses][IO-size][MEM-size] if reserve-buses -> use 'extra-buses' value and so onI don't have any objection to using a PCI capability, but I do wonder if
fw_cfgwould be a better fit. This information is purely qemu -> firmware, right?
Hi Kevin,
Right, but theoretically speaking a guest OS driver could also get the hint on hotplug, or simply because the OS chooses to re-assign resources on its own.
A while ago we discussed the fw_cfg option, but Gerd preferred the vendor capability, and since the capability looked cleaner Aleksandr opted for it.
He will send V2 soon together with the QEMU counterpart feature.
Thanks,
Marcel
Quoted 2 lines
-Kevin
Quoted 7 lines · Kevin O'Connor
Quoted 6 lines · Marcel Apfelbaum
Quoted 2 lines · Gerd Hoffmann
I'd prefer to have a single vendor capability for all resource allocation hints provided by qemu.
Sure, the capability looking something like:
Quoted 8 lines
Quoted 4 lines
[flags: reserve-buses|reserve-IO|reserve-MEM|...] [extra-buses][IO-size][MEM-size]
if reserve-buses -> use 'extra-buses' value and so on
I don't have any objection to using a PCI capability, but I do wonder if
fw_cfgwould be a better fit. This information is purely qemu -> firmware, right?
fw_cfg quickly becomes messy if you want allow different hints per bridge.
cheers,
Gerd