PCI bridge fixes and cleanup
v2 cover PCI bridge fixes and cleanup
Hello Michael,
This mini-series cleans up Gerd's commit message and adds the generalization on top. Both look safe for 1.6 to me; doing it in two steps not only allows to record Gerd's authorship but allows to cherry-pick his patch for 1.5 while mine is 1.6+.
Regards,
Andreas
Gerd's v1 -> v2:
* Reworked commit message: Added qemu-stable, clarified scope and change.
* Appended patch
Andreas Färber (1):
pci-bridge: Move common class initializations to base type
Gerd Hoffmann (1):
i82801b11: Fix i82801b11 PCI host bridge config space
hw/pci-bridge/dec.c | 4 ---- hw/pci-bridge/i82801b11.c | 1 - hw/pci-bridge/ioh3420.c | 1 - hw/pci-bridge/pci_bridge_dev.c | 1 - hw/pci-bridge/xio3130_downstream.c | 1 - hw/pci-bridge/xio3130_upstream.c | 1 - hw/pci-host/apb.c | 4 ---- hw/pci/pci_bridge.c | 12 ++++++++++++ 8 files changed, 12 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.1.4
PATCH v2 1/2 i82801b11: Fix i82801b11 PCI host bridge config space
From: Gerd Hoffmann <[email protected]>
pci_bridge_write_config() was not being used.
--- hw/pci-bridge/i82801b11.c | 1 + 1 file changed, 1 insertion(+)
hw/pci-bridge/i82801b11.c +1 -0
@@ -90,6 +90,7 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data) k->device_id =PCI_DEVICE_ID_INTEL_82801BA_11 ; k->revision =ICH9_D2P_A2_REVISION ; k->init = i82801b11_bridge_initfn; + k->config_write = pci_bridge_write_config;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); }
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH for-1.6 v2 1/2] i82801b11: Fix i82801b11 PCI host bridge config space
Quoted 7 lines · Andreas Färber
From: Gerd Hoffmann <[email protected]>
pci_bridge_write_config()was not being used.Signed-off-by Gerd Hoffmann <[email protected]>Signed-off-by Andreas Färber <[email protected]>
Quoted 18 lines
--- hw/pci-bridge/i82801b11.c | 1 + 1 file changed, 1 insertion(+)hw/pci-bridge/i82801b11.c +1
-0@@ -90,6 +90,7 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data) k->device_id =PCI_DEVICE_ID_INTEL_82801BA_11 ; k->revision =ICH9_D2P_A2_REVISION ; k->init = i82801b11_bridge_initfn; + k->config_write = pci_bridge_write_config;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); }Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH for-1.6 v2 1/2] i82801b11: Fix i82801b11 PCI host bridge config space
In reply to Andreas FärberQuoted 7 lines · Andreas Färber
From: Gerd Hoffmann <[email protected]>
pci_bridge_write_config()was not being used.Signed-off-by Gerd Hoffmann <[email protected]>Signed-off-by Andreas Färber <[email protected]>
Ping? I see it's not yet in master, can we *please* get this in? It is save to take just this one-liner and defer 2/2 to 1.7.
cheers,
Gerd
Re: [Qemu-devel] [PATCH for-1.6 v2 1/2] i82801b11: Fix i82801b11 PCI host bridge config space
Am 12.08.2013 10:51, schrieb Gerd Hoffmann:
Quoted 11 lines · Andreas Färber
Quoted 7 lines
From: Gerd Hoffmann <[email protected]>
pci_bridge_write_config()was not being used.Signed-off-by Gerd Hoffmann <[email protected]>Signed-off-by Andreas Färber <[email protected]>Ping? I see it's not yet in master, can we *please* get this in? It is save to take just this one-liner and defer 2/2 to 1.7.
Michael, please decide as PCI maintainer and send a pull. Thanks!
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
PATCH v2 2/2 pci-bridge: Move common class initializations to base type
In reply to Andreas FärberSet PCIDeviceClass::is_bridge as well as PCIDeviceClass::config_write(), PCIDeviceClass::exit() and DeviceClass::reset() defaults directly for TYPE_PCI_BRIDGE (complements f055e96bd4311d287c0e03faec02a1bdbc351925).
This avoids another pci_bridge_config_write() missing somewhere, unless explicitly overridden.
--- hw/pci-bridge/dec.c | 4 ---- hw/pci-bridge/i82801b11.c | 2 -- hw/pci-bridge/ioh3420.c | 1 - hw/pci-bridge/pci_bridge_dev.c | 1 - hw/pci-bridge/xio3130_downstream.c | 1 - hw/pci-bridge/xio3130_upstream.c | 1 - hw/pci-host/apb.c | 4 ---- hw/pci/pci_bridge.c | 12 ++++++++++++ 8 files changed, 12 insertions(+), 14 deletions(-)
hw/pci-bridge/dec.c +0 -4
@@ -62,13 +62,9 @@ static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->init = dec_pci_bridge_initfn; - k->exit = pci_bridge_exitfn; k->vendor_id =PCI_VENDOR_ID_DEC ; k->device_id =PCI_DEVICE_ID_DEC_21154 ; - k->config_write = pci_bridge_write_config; - k->is_bridge =1 ; dc->desc ="DEC 21154 PCI-PCI bridge" ; - dc->reset = pci_bridge_reset; dc->vmsd = &vmstate_pci_device; }
hw/pci-bridge/i82801b11.c +0 -2
@@ -85,12 +85,10 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->is_bridge =1 ; k->vendor_id =PCI_VENDOR_ID_INTEL ; k->device_id =PCI_DEVICE_ID_INTEL_82801BA_11 ; k->revision =ICH9_D2P_A2_REVISION ; k->init = i82801b11_bridge_initfn; - k->config_write = pci_bridge_write_config;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); }
hw/pci-bridge/ioh3420.c +0 -1
@@ -200,7 +200,6 @@ static void ioh3420_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->is_express =1 ; - k->is_bridge =1 ; k->config_write = ioh3420_write_config; k->init = ioh3420_initfn; k->exit = ioh3420_exitfn;
hw/pci-bridge/pci_bridge_dev.c +0 -1
@@ -142,7 +142,6 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data) k->vendor_id =PCI_VENDOR_ID_REDHAT ; k->device_id =PCI_DEVICE_ID_REDHAT_BRIDGE ; k->class_id =PCI_CLASS_BRIDGE_PCI ; - k->is_bridge =1 , dc->desc ="Standard PCI Bridge" ; dc->reset = qdev_pci_bridge_dev_reset; dc->props = pci_bridge_dev_properties;
hw/pci-bridge/xio3130_downstream.c +0 -1
@@ -167,7 +167,6 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->is_express =1 ; - k->is_bridge =1 ; k->config_write = xio3130_downstream_write_config; k->init = xio3130_downstream_initfn; k->exit = xio3130_downstream_exitfn;
hw/pci-bridge/xio3130_upstream.c +0 -1
@@ -146,7 +146,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->is_express =1 ; - k->is_bridge =1 ; k->config_write = xio3130_upstream_write_config; k->init = xio3130_upstream_initfn; k->exit = xio3130_upstream_exitfn;
hw/pci-host/apb.c +0 -4
@@ -553,14 +553,10 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->init = apb_pci_bridge_initfn; - k->exit = pci_bridge_exitfn; k->vendor_id =PCI_VENDOR_ID_SUN ; k->device_id =PCI_DEVICE_ID_SUN_SIMBA ; k->revision =0x11 ; - k->config_write = pci_bridge_write_config; - k->is_bridge =1 ;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); - dc->reset = pci_bridge_reset; dc->vmsd = &vmstate_pci_device; }
hw/pci/pci_bridge.c +12 -0
@@ -405,11 +405,23 @@ void pci_bridge_map_irq(PCIBridge *br, const char* bus_name, br->bus_name = bus_name; } +static void pci_bridge_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); +PCIDeviceClass *pdc =PCI_DEVICE_CLASS (oc); + + pdc->is_bridge =1 ; + pdc->exit = pci_bridge_exitfn; + pdc->config_write = pci_bridge_write_config; + dc->reset = pci_bridge_reset; +} +static const TypeInfo pci_bridge_type_info = { .name =TYPE_PCI_BRIDGE , .parent =TYPE_PCI_DEVICE , .instance_size =sizeof (PCIBridge), .abstract = true, + .class_init = pci_bridge_class_init, };static void pci_bridge_register_types (void )
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH for-1.6 v2 2/2] pci-bridge: Move common class initializations to base type
Quoted 9 lines · Andreas Färber
Set
PCIDeviceClass::is_bridgeas well asPCIDeviceClass::config_write(),PCIDeviceClass::exit()andDeviceClass::reset()defaults directly forTYPE_PCI_BRIDGE(complementsf055e96bd4311d287c0e03faec02a1bdbc351925).This avoids another
pci_bridge_config_write()missing somewhere, unless explicitly overridden.Reported-by Gerd Hoffmann <[email protected]>Signed-off-by Andreas Färber <[email protected]>
Why for 1.6?
Paolo
Quoted 142 lines
--- hw/pci-bridge/dec.c | 4 ---- hw/pci-bridge/i82801b11.c | 2 -- hw/pci-bridge/ioh3420.c | 1 - hw/pci-bridge/pci_bridge_dev.c | 1 - hw/pci-bridge/xio3130_downstream.c | 1 - hw/pci-bridge/xio3130_upstream.c | 1 - hw/pci-host/apb.c | 4 ---- hw/pci/pci_bridge.c | 12 ++++++++++++ 8 files changed, 12 insertions(+), 14 deletions(-)hw/pci-bridge/dec.c +0
-4@@ -62,13 +62,9 @@ static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->init = dec_pci_bridge_initfn; - k->exit = pci_bridge_exitfn; k->vendor_id =PCI_VENDOR_ID_DEC ; k->device_id =PCI_DEVICE_ID_DEC_21154 ; - k->config_write = pci_bridge_write_config; - k->is_bridge =1 ; dc->desc ="DEC 21154 PCI-PCI bridge" ; - dc->reset = pci_bridge_reset; dc->vmsd = &vmstate_pci_device; }hw/pci-bridge/i82801b11.c +0
-2@@ -85,12 +85,10 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->is_bridge =1 ; k->vendor_id =PCI_VENDOR_ID_INTEL ; k->device_id =PCI_DEVICE_ID_INTEL_82801BA_11 ; k->revision =ICH9_D2P_A2_REVISION ; k->init = i82801b11_bridge_initfn; - k->config_write = pci_bridge_write_config;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); }hw/pci-bridge/ioh3420.c +0
-1@@ -200,7 +200,6 @@ static void ioh3420_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->is_express =1 ; - k->is_bridge =1 ; k->config_write = ioh3420_write_config; k->init = ioh3420_initfn; k->exit = ioh3420_exitfn;hw/pci-bridge/pci_bridge_dev.c +0
-1@@ -142,7 +142,6 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data) k->vendor_id =PCI_VENDOR_ID_REDHAT ; k->device_id =PCI_DEVICE_ID_REDHAT_BRIDGE ; k->class_id =PCI_CLASS_BRIDGE_PCI ; - k->is_bridge =1 , dc->desc ="Standard PCI Bridge" ; dc->reset = qdev_pci_bridge_dev_reset; dc->props = pci_bridge_dev_properties;hw/pci-bridge/xio3130_downstream.c +0
-1@@ -167,7 +167,6 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->is_express =1 ; - k->is_bridge =1 ; k->config_write = xio3130_downstream_write_config; k->init = xio3130_downstream_initfn; k->exit = xio3130_downstream_exitfn;hw/pci-bridge/xio3130_upstream.c +0
-1@@ -146,7 +146,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->is_express =1 ; - k->is_bridge =1 ; k->config_write = xio3130_upstream_write_config; k->init = xio3130_upstream_initfn; k->exit = xio3130_upstream_exitfn;hw/pci-host/apb.c +0
-4@@ -553,14 +553,10 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); k->init = apb_pci_bridge_initfn; - k->exit = pci_bridge_exitfn; k->vendor_id =PCI_VENDOR_ID_SUN ; k->device_id =PCI_DEVICE_ID_SUN_SIMBA ; k->revision =0x11 ; - k->config_write = pci_bridge_write_config; - k->is_bridge =1 ;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); - dc->reset = pci_bridge_reset; dc->vmsd = &vmstate_pci_device; }hw/pci/pci_bridge.c +12
-0@@ -405,11 +405,23 @@ void pci_bridge_map_irq(PCIBridge *br, const char* bus_name, br->bus_name = bus_name; } +static void pci_bridge_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); +PCIDeviceClass *pdc =PCI_DEVICE_CLASS (oc); + + pdc->is_bridge =1 ; + pdc->exit = pci_bridge_exitfn; + pdc->config_write = pci_bridge_write_config; + dc->reset = pci_bridge_reset; +} +static const TypeInfo pci_bridge_type_info = { .name =TYPE_PCI_BRIDGE , .parent =TYPE_PCI_DEVICE , .instance_size =sizeof (PCIBridge), .abstract = true, + .class_init = pci_bridge_class_init, };static void pci_bridge_register_types (void )
Re: [Qemu-devel] [PATCH for-1.6 v2 2/2] pci-bridge: Move common class initializations to base type
Am 05.08.2013 16:41, schrieb Paolo Bonzini:
Quoted 5 lines · Andreas Färber
Quoted 4 lines
Set
PCIDeviceClass::is_bridgeas well asPCIDeviceClass::config_write(),PCIDeviceClass::exit()andDeviceClass::reset()defaults directly forTYPE_PCI_BRIDGE(complementsf055e96bd4311d287c0e03faec02a1bdbc351925).
Quoted 7 lines
Quoted 5 lines
This avoids another
pci_bridge_config_write()missing somewhere, unless explicitly overridden.Reported-by Gerd Hoffmann <[email protected]>Signed-off-by Andreas Färber <[email protected]>Why for 1.6?
This is The Real Fix. We could squash it as one patch, but then we can't backport it.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg