aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-10-25 16:26:02 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-11-08 15:12:52 -0500
commit8deb3eb1461e4cb136c88d03ec5a6729ccf2f933 (patch)
tree268e9ca7115273256bcffae24c360951dc315daa
parentaf09d1a73aed4e83ee095f2dabdc09386e31f2ea (diff)
xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved for MCFG areas.
The PCI MMCONFIG area is usually reserved via the E820 so the Xen hypervisor is aware of these regions. But they can also be enumerated in the ACPI DSDT which means the hypervisor won't know of them until the initial domain informs it of via PHYSDEVOP_pci_mmcfg_reserved. This is what this patch does for all of the MCFG regions that the initial domain is aware of (E820 enumerated and ACPI). Reported-by: Santosh Jodh <Santosh.Jodh@citrix.com> CC: Jan Beulich <JBeulich@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> CC: David Vrabel <david.vrabel@citrix.com> CC: Mukesh Rathor <mukesh.rathor@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [v1: Redid it a bit] [v2: Dropped the P2M 1-1 setting] [v3: Check for Xen in-case we are running under baremetal] [v4: Wrap with CONFIG_PCI_MMCONFIG]
-rw-r--r--drivers/xen/pci.c47
-rw-r--r--include/xen/interface/physdev.h11
2 files changed, 58 insertions, 0 deletions
diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
index 18fff88254eb..d15f6e80479f 100644
--- a/drivers/xen/pci.c
+++ b/drivers/xen/pci.c
@@ -26,6 +26,7 @@
26#include <asm/xen/hypervisor.h> 26#include <asm/xen/hypervisor.h>
27#include <asm/xen/hypercall.h> 27#include <asm/xen/hypercall.h>
28#include "../pci/pci.h" 28#include "../pci/pci.h"
29#include <asm/pci_x86.h>
29 30
30static bool __read_mostly pci_seg_supported = true; 31static bool __read_mostly pci_seg_supported = true;
31 32
@@ -192,3 +193,49 @@ static int __init register_xen_pci_notifier(void)
192} 193}
193 194
194arch_initcall(register_xen_pci_notifier); 195arch_initcall(register_xen_pci_notifier);
196
197#ifdef CONFIG_PCI_MMCONFIG
198static int __init xen_mcfg_late(void)
199{
200 struct pci_mmcfg_region *cfg;
201 int rc;
202
203 if (!xen_initial_domain())
204 return 0;
205
206 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
207 return 0;
208
209 if (list_empty(&pci_mmcfg_list))
210 return 0;
211
212 /* Check whether they are in the right area. */
213 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
214 struct physdev_pci_mmcfg_reserved r;
215
216 r.address = cfg->address;
217 r.segment = cfg->segment;
218 r.start_bus = cfg->start_bus;
219 r.end_bus = cfg->end_bus;
220 r.flags = XEN_PCI_MMCFG_RESERVED;
221
222 rc = HYPERVISOR_physdev_op(PHYSDEVOP_pci_mmcfg_reserved, &r);
223 switch (rc) {
224 case 0:
225 case -ENOSYS:
226 continue;
227
228 default:
229 pr_warn("Failed to report MMCONFIG reservation"
230 " state for %s to hypervisor"
231 " (%d)\n",
232 cfg->name, rc);
233 }
234 }
235 return 0;
236}
237/*
238 * Needs to be done after acpi_init which are subsys_initcall.
239 */
240subsys_initcall_sync(xen_mcfg_late);
241#endif
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index 7000bb1f6e96..42721d13a106 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -231,6 +231,17 @@ struct physdev_get_free_pirq {
231#define XEN_PCI_DEV_VIRTFN 0x2 231#define XEN_PCI_DEV_VIRTFN 0x2
232#define XEN_PCI_DEV_PXM 0x4 232#define XEN_PCI_DEV_PXM 0x4
233 233
234#define XEN_PCI_MMCFG_RESERVED 0x1
235
236#define PHYSDEVOP_pci_mmcfg_reserved 24
237struct physdev_pci_mmcfg_reserved {
238 uint64_t address;
239 uint16_t segment;
240 uint8_t start_bus;
241 uint8_t end_bus;
242 uint32_t flags;
243};
244
234#define PHYSDEVOP_pci_device_add 25 245#define PHYSDEVOP_pci_device_add 25
235struct physdev_pci_device_add { 246struct physdev_pci_device_add {
236 /* IN */ 247 /* IN */