Skip to content

Commit 358cd9a

Browse files
jgross1Christoph Hellwig
authored andcommitted
xen/pci: add flag for PCI passthrough being possible
When running as a Xen PV guests passed through PCI devices only have a chance to work if the Xen supplied memory map has some PCI space reserved. Add a flag xen_pv_pci_possible which will be set in early boot in case the memory map has at least one area with the type E820_TYPE_RESERVED. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 5d0c230 commit 358cd9a

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

arch/x86/xen/setup.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
4444
/* Number of pages released from the initial allocation. */
4545
unsigned long xen_released_pages;
4646

47+
/* Memory map would allow PCI passthrough. */
48+
bool xen_pv_pci_possible;
49+
4750
/* E820 map used during setting up memory. */
4851
static struct e820_table xen_e820_table __initdata;
4952

@@ -814,6 +817,9 @@ char * __init xen_memory_setup(void)
814817
chunk_size = size;
815818
type = xen_e820_table.entries[i].type;
816819

820+
if (type == E820_TYPE_RESERVED)
821+
xen_pv_pci_possible = true;
822+
817823
if (type == E820_TYPE_RAM) {
818824
if (addr < mem_end) {
819825
chunk_size = min(size, mem_end - addr);

include/xen/xen.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ extern bool xen_pvh;
2929

3030
extern uint32_t xen_start_flags;
3131

32+
#ifdef CONFIG_XEN_PV
33+
extern bool xen_pv_pci_possible;
34+
#else
35+
#define xen_pv_pci_possible 0
36+
#endif
37+
3238
#include <xen/interface/hvm/start_info.h>
3339
extern struct hvm_start_info pvh_start_info;
3440
void xen_prepare_pvh(void);

0 commit comments

Comments
 (0)