Skip to content

Commit ec56103

Browse files
committed
Merge tag 'for-linus-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen update from Juergen Gross: "Only two small patches this time: - a small cleanup for swiotlb-xen - a fix for PCI initialization for some platforms" * tag 'for-linus-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/pci: reserve MCFG areas earlier swiotlb-xen: Convert to use macro
2 parents cbafe18 + a4098bc commit ec56103

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

drivers/xen/pci.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "../pci/pci.h"
1818
#ifdef CONFIG_PCI_MMCONFIG
1919
#include <asm/pci_x86.h>
20+
21+
static int xen_mcfg_late(void);
2022
#endif
2123

2224
static bool __read_mostly pci_seg_supported = true;
@@ -28,7 +30,18 @@ static int xen_add_device(struct device *dev)
2830
#ifdef CONFIG_PCI_IOV
2931
struct pci_dev *physfn = pci_dev->physfn;
3032
#endif
31-
33+
#ifdef CONFIG_PCI_MMCONFIG
34+
static bool pci_mcfg_reserved = false;
35+
/*
36+
* Reserve MCFG areas in Xen on first invocation due to this being
37+
* potentially called from inside of acpi_init immediately after
38+
* MCFG table has been finally parsed.
39+
*/
40+
if (!pci_mcfg_reserved) {
41+
xen_mcfg_late();
42+
pci_mcfg_reserved = true;
43+
}
44+
#endif
3245
if (pci_seg_supported) {
3346
struct {
3447
struct physdev_pci_device_add add;
@@ -201,7 +214,7 @@ static int __init register_xen_pci_notifier(void)
201214
arch_initcall(register_xen_pci_notifier);
202215

203216
#ifdef CONFIG_PCI_MMCONFIG
204-
static int __init xen_mcfg_late(void)
217+
static int xen_mcfg_late(void)
205218
{
206219
struct pci_mmcfg_region *cfg;
207220
int rc;
@@ -240,8 +253,4 @@ static int __init xen_mcfg_late(void)
240253
}
241254
return 0;
242255
}
243-
/*
244-
* Needs to be done after acpi_init which are subsys_initcall.
245-
*/
246-
subsys_initcall_sync(xen_mcfg_late);
247256
#endif

drivers/xen/swiotlb-xen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <asm/xen/page-coherent.h>
4040

4141
#include <trace/events/swiotlb.h>
42+
#define MAX_DMA_BITS 32
4243
/*
4344
* Used to do a quick range check in swiotlb_tbl_unmap_single and
4445
* swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this
@@ -115,8 +116,6 @@ static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
115116
return 0;
116117
}
117118

118-
static int max_dma_bits = 32;
119-
120119
static int
121120
xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
122121
{
@@ -136,7 +135,7 @@ xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
136135
p + (i << IO_TLB_SHIFT),
137136
get_order(slabs << IO_TLB_SHIFT),
138137
dma_bits, &dma_handle);
139-
} while (rc && dma_bits++ < max_dma_bits);
138+
} while (rc && dma_bits++ < MAX_DMA_BITS);
140139
if (rc)
141140
return rc;
142141

0 commit comments

Comments
 (0)