aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/platform-pci.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-05-14 07:45:07 -0400
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-07-22 19:46:21 -0400
commit016b6f5fe8398b0291cece60b749d7c930a2e09c (patch)
tree430e9aad74f223dc5d144b60f4b78a0c3fb9cdfd /drivers/xen/platform-pci.c
parent183d03cc4ff39e0f0d952c09aa96d0abfd6e0c3c (diff)
xen: Add suspend/resume support for PV on HVM guests.
Suspend/resume requires few different things on HVM: the suspend hypercall is different; we don't need to save/restore memory related settings; except the shared info page and the callback mechanism. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/platform-pci.c')
-rw-r--r--drivers/xen/platform-pci.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
index a0ee5d06f715..bdb44f2473e8 100644
--- a/drivers/xen/platform-pci.c
+++ b/drivers/xen/platform-pci.c
@@ -31,6 +31,7 @@
31#include <xen/xenbus.h> 31#include <xen/xenbus.h>
32#include <xen/events.h> 32#include <xen/events.h>
33#include <xen/hvm.h> 33#include <xen/hvm.h>
34#include <xen/xen-ops.h>
34 35
35#define DRV_NAME "xen-platform-pci" 36#define DRV_NAME "xen-platform-pci"
36 37
@@ -41,6 +42,7 @@ MODULE_LICENSE("GPL");
41static unsigned long platform_mmio; 42static unsigned long platform_mmio;
42static unsigned long platform_mmio_alloc; 43static unsigned long platform_mmio_alloc;
43static unsigned long platform_mmiolen; 44static unsigned long platform_mmiolen;
45static uint64_t callback_via;
44 46
45unsigned long alloc_xen_mmio(unsigned long len) 47unsigned long alloc_xen_mmio(unsigned long len)
46{ 48{
@@ -85,13 +87,25 @@ static int xen_allocate_irq(struct pci_dev *pdev)
85 "xen-platform-pci", pdev); 87 "xen-platform-pci", pdev);
86} 88}
87 89
90static int platform_pci_resume(struct pci_dev *pdev)
91{
92 int err;
93 if (xen_have_vector_callback)
94 return 0;
95 err = xen_set_callback_via(callback_via);
96 if (err) {
97 dev_err(&pdev->dev, "platform_pci_resume failure!\n");
98 return err;
99 }
100 return 0;
101}
102
88static int __devinit platform_pci_init(struct pci_dev *pdev, 103static int __devinit platform_pci_init(struct pci_dev *pdev,
89 const struct pci_device_id *ent) 104 const struct pci_device_id *ent)
90{ 105{
91 int i, ret; 106 int i, ret;
92 long ioaddr, iolen; 107 long ioaddr, iolen;
93 long mmio_addr, mmio_len; 108 long mmio_addr, mmio_len;
94 uint64_t callback_via;
95 unsigned int max_nr_gframes; 109 unsigned int max_nr_gframes;
96 110
97 i = pci_enable_device(pdev); 111 i = pci_enable_device(pdev);
@@ -148,6 +162,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
148 if (ret) 162 if (ret)
149 goto out; 163 goto out;
150 xenbus_probe(NULL); 164 xenbus_probe(NULL);
165 ret = xen_setup_shutdown_event();
166 if (ret)
167 goto out;
151 return 0; 168 return 0;
152 169
153out: 170out:
@@ -171,6 +188,9 @@ static struct pci_driver platform_driver = {
171 .name = DRV_NAME, 188 .name = DRV_NAME,
172 .probe = platform_pci_init, 189 .probe = platform_pci_init,
173 .id_table = platform_pci_tbl, 190 .id_table = platform_pci_tbl,
191#ifdef CONFIG_PM
192 .resume_early = platform_pci_resume,
193#endif
174}; 194};
175 195
176static int __init platform_pci_module_init(void) 196static int __init platform_pci_module_init(void)