* [Qemu-devel] [PATCH v2] [Bug 1187529] Update bridge mappings for migration/restore
@ 2013-07-09 15:40 dkoch
2013-07-10 9:39 ` Michael S. Tsirkin
2013-07-15 8:36 ` Michael S. Tsirkin
0 siblings, 2 replies; 3+ messages in thread
From: dkoch @ 2013-07-09 15:40 UTC (permalink / raw)
To: qemu-devel; +Cc: Don Koch, mst
From: Don Koch <dkoch@verizon.com>
Fix for LP#1187529: Devices on PCI bridge stop working when
live-migrated. Update bridge mappings for all PCI bridge
devices in get_pci_config_device().
Signed-off-by: Don Koch <dkoch@verizon.com>
---
Still using old cast method for PCIBridge since there currently is
no macro for it; this way it will be easier to find and change when
the macro is implemented.
| 5 +++++
| 2 +-
| 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
--git a/hw/pci/pci.c b/hw/pci/pci.c
index dcc85ef..68aebf9 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -378,6 +378,8 @@ int pci_bus_num(PCIBus *s)
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
{
PCIDevice *s = container_of(pv, PCIDevice, config);
+ PCIBridge *b = container_of(s, PCIBridge, dev);
+ PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(s);
uint8_t *config;
int i;
@@ -395,6 +397,9 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
memcpy(s->config, config, size);
pci_update_mappings(s);
+ if (pc->is_bridge) {
+ pci_bridge_update_mappings(b);
+ }
memory_region_set_enabled(&s->bus_master_enable_region,
pci_get_word(s->config + PCI_COMMAND)
--git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index ecdeab0..02a396b 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -224,7 +224,7 @@ static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
g_free(w);
}
-static void pci_bridge_update_mappings(PCIBridge *br)
+void pci_bridge_update_mappings(PCIBridge *br)
{
PCIBridgeWindows *w = br->windows;
--git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index 1868f7a..1d8f997 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -37,6 +37,7 @@ PCIBus *pci_bridge_get_sec_bus(PCIBridge *br);
pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type);
pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type);
+void pci_bridge_update_mappings(PCIBridge *br);
void pci_bridge_write_config(PCIDevice *d,
uint32_t address, uint32_t val, int len);
void pci_bridge_disable_base_limit(PCIDevice *dev);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] [Bug 1187529] Update bridge mappings for migration/restore
2013-07-09 15:40 [Qemu-devel] [PATCH v2] [Bug 1187529] Update bridge mappings for migration/restore dkoch
@ 2013-07-10 9:39 ` Michael S. Tsirkin
2013-07-15 8:36 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2013-07-10 9:39 UTC (permalink / raw)
To: dkoch; +Cc: qemu-devel
On Tue, Jul 09, 2013 at 11:40:02AM -0400, dkoch@verizon.com wrote:
> From: Don Koch <dkoch@verizon.com>
>
> Fix for LP#1187529: Devices on PCI bridge stop working when
> live-migrated. Update bridge mappings for all PCI bridge
> devices in get_pci_config_device().
>
> Signed-off-by: Don Koch <dkoch@verizon.com>
Applied, thanks.
I tweaked this by moving
> + PCIBridge *b = container_of(s, PCIBridge, dev);
to within if.
> ---
> Still using old cast method for PCIBridge since there currently is
> no macro for it; this way it will be easier to find and change when
> the macro is implemented.
>
> hw/pci/pci.c | 5 +++++
> hw/pci/pci_bridge.c | 2 +-
> include/hw/pci/pci_bridge.h | 1 +
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index dcc85ef..68aebf9 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -378,6 +378,8 @@ int pci_bus_num(PCIBus *s)
> static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
> {
> PCIDevice *s = container_of(pv, PCIDevice, config);
> + PCIBridge *b = container_of(s, PCIBridge, dev);
> + PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(s);
> uint8_t *config;
> int i;
>
> @@ -395,6 +397,9 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
> memcpy(s->config, config, size);
>
> pci_update_mappings(s);
> + if (pc->is_bridge) {
> + pci_bridge_update_mappings(b);
> + }
>
> memory_region_set_enabled(&s->bus_master_enable_region,
> pci_get_word(s->config + PCI_COMMAND)
> diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
> index ecdeab0..02a396b 100644
> --- a/hw/pci/pci_bridge.c
> +++ b/hw/pci/pci_bridge.c
> @@ -224,7 +224,7 @@ static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
> g_free(w);
> }
>
> -static void pci_bridge_update_mappings(PCIBridge *br)
> +void pci_bridge_update_mappings(PCIBridge *br)
> {
> PCIBridgeWindows *w = br->windows;
>
> diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
> index 1868f7a..1d8f997 100644
> --- a/include/hw/pci/pci_bridge.h
> +++ b/include/hw/pci/pci_bridge.h
> @@ -37,6 +37,7 @@ PCIBus *pci_bridge_get_sec_bus(PCIBridge *br);
> pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type);
> pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type);
>
> +void pci_bridge_update_mappings(PCIBridge *br);
> void pci_bridge_write_config(PCIDevice *d,
> uint32_t address, uint32_t val, int len);
> void pci_bridge_disable_base_limit(PCIDevice *dev);
> --
> 1.7.11.7
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] [Bug 1187529] Update bridge mappings for migration/restore
2013-07-09 15:40 [Qemu-devel] [PATCH v2] [Bug 1187529] Update bridge mappings for migration/restore dkoch
2013-07-10 9:39 ` Michael S. Tsirkin
@ 2013-07-15 8:36 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2013-07-15 8:36 UTC (permalink / raw)
To: dkoch; +Cc: qemu-devel
On Tue, Jul 09, 2013 at 11:40:02AM -0400, dkoch@verizon.com wrote:
> From: Don Koch <dkoch@verizon.com>
>
> Fix for LP#1187529: Devices on PCI bridge stop working when
> live-migrated. Update bridge mappings for all PCI bridge
> devices in get_pci_config_device().
>
> Signed-off-by: Don Koch <dkoch@verizon.com>
Applied, thanks.
> ---
> Still using old cast method for PCIBridge since there currently is
> no macro for it; this way it will be easier to find and change when
> the macro is implemented.
>
> hw/pci/pci.c | 5 +++++
> hw/pci/pci_bridge.c | 2 +-
> include/hw/pci/pci_bridge.h | 1 +
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index dcc85ef..68aebf9 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -378,6 +378,8 @@ int pci_bus_num(PCIBus *s)
> static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
> {
> PCIDevice *s = container_of(pv, PCIDevice, config);
> + PCIBridge *b = container_of(s, PCIBridge, dev);
> + PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(s);
> uint8_t *config;
> int i;
>
> @@ -395,6 +397,9 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
> memcpy(s->config, config, size);
>
> pci_update_mappings(s);
> + if (pc->is_bridge) {
> + pci_bridge_update_mappings(b);
> + }
>
> memory_region_set_enabled(&s->bus_master_enable_region,
> pci_get_word(s->config + PCI_COMMAND)
> diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
> index ecdeab0..02a396b 100644
> --- a/hw/pci/pci_bridge.c
> +++ b/hw/pci/pci_bridge.c
> @@ -224,7 +224,7 @@ static void pci_bridge_region_cleanup(PCIBridge *br, PCIBridgeWindows *w)
> g_free(w);
> }
>
> -static void pci_bridge_update_mappings(PCIBridge *br)
> +void pci_bridge_update_mappings(PCIBridge *br)
> {
> PCIBridgeWindows *w = br->windows;
>
> diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
> index 1868f7a..1d8f997 100644
> --- a/include/hw/pci/pci_bridge.h
> +++ b/include/hw/pci/pci_bridge.h
> @@ -37,6 +37,7 @@ PCIBus *pci_bridge_get_sec_bus(PCIBridge *br);
> pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type);
> pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type);
>
> +void pci_bridge_update_mappings(PCIBridge *br);
> void pci_bridge_write_config(PCIDevice *d,
> uint32_t address, uint32_t val, int len);
> void pci_bridge_disable_base_limit(PCIDevice *dev);
> --
> 1.7.11.7
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-15 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09 15:40 [Qemu-devel] [PATCH v2] [Bug 1187529] Update bridge mappings for migration/restore dkoch
2013-07-10 9:39 ` Michael S. Tsirkin
2013-07-15 8:36 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).