Skip to content

Commit 5739844

Browse files
committed
Merge tag 'for-linus-5.15b-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: "Some minor cleanups and fixes of some theoretical bugs, as well as a fix of a bug introduced in 5.15-rc1" * tag 'for-linus-5.15b-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/x86: fix PV trap handling on secondary processors xen/balloon: fix balloon kthread freezing swiotlb-xen: this is PV-only on x86 xen/pci-swiotlb: reduce visibility of symbols PCI: only build xen-pcifront in PV-enabled environments swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests Xen/gntdev: don't ignore kernel unmapping error xen/x86: drop redundant zeroing from cpu_initialize_context()
2 parents 90316e6 + 0594c58 commit 5739844

File tree

11 files changed

+28
-36
lines changed

11 files changed

+28
-36
lines changed

arch/x86/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2610,7 +2610,6 @@ config PCI_OLPC
26102610
config PCI_XEN
26112611
def_bool y
26122612
depends on PCI && XEN
2613-
select SWIOTLB_XEN
26142613

26152614
config MMCONF_FAM10H
26162615
def_bool y

arch/x86/include/asm/xen/swiotlb-xen.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
#define _ASM_X86_SWIOTLB_XEN_H
44

55
#ifdef CONFIG_SWIOTLB_XEN
6-
extern int xen_swiotlb;
76
extern int __init pci_xen_swiotlb_detect(void);
8-
extern void __init pci_xen_swiotlb_init(void);
97
extern int pci_xen_swiotlb_init_late(void);
108
#else
11-
#define xen_swiotlb (0)
12-
static inline int __init pci_xen_swiotlb_detect(void) { return 0; }
13-
static inline void __init pci_xen_swiotlb_init(void) { }
9+
#define pci_xen_swiotlb_detect NULL
1410
static inline int pci_xen_swiotlb_init_late(void) { return -ENXIO; }
1511
#endif
1612

arch/x86/xen/enlighten_pv.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,8 @@ static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g)
755755
preempt_enable();
756756
}
757757

758-
static void xen_convert_trap_info(const struct desc_ptr *desc,
759-
struct trap_info *traps)
758+
static unsigned xen_convert_trap_info(const struct desc_ptr *desc,
759+
struct trap_info *traps, bool full)
760760
{
761761
unsigned in, out, count;
762762

@@ -766,17 +766,18 @@ static void xen_convert_trap_info(const struct desc_ptr *desc,
766766
for (in = out = 0; in < count; in++) {
767767
gate_desc *entry = (gate_desc *)(desc->address) + in;
768768

769-
if (cvt_gate_to_trap(in, entry, &traps[out]))
769+
if (cvt_gate_to_trap(in, entry, &traps[out]) || full)
770770
out++;
771771
}
772-
traps[out].address = 0;
772+
773+
return out;
773774
}
774775

775776
void xen_copy_trap_info(struct trap_info *traps)
776777
{
777778
const struct desc_ptr *desc = this_cpu_ptr(&idt_desc);
778779

779-
xen_convert_trap_info(desc, traps);
780+
xen_convert_trap_info(desc, traps, true);
780781
}
781782

782783
/* Load a new IDT into Xen. In principle this can be per-CPU, so we
@@ -786,14 +787,16 @@ static void xen_load_idt(const struct desc_ptr *desc)
786787
{
787788
static DEFINE_SPINLOCK(lock);
788789
static struct trap_info traps[257];
790+
unsigned out;
789791

790792
trace_xen_cpu_load_idt(desc);
791793

792794
spin_lock(&lock);
793795

794796
memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc));
795797

796-
xen_convert_trap_info(desc, traps);
798+
out = xen_convert_trap_info(desc, traps, false);
799+
memset(&traps[out], 0, sizeof(traps[0]));
797800

798801
xen_mc_flush();
799802
if (HYPERVISOR_set_trap_table(traps))

arch/x86/xen/pci-swiotlb-xen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#endif
1919
#include <linux/export.h>
2020

21-
int xen_swiotlb __read_mostly;
21+
static int xen_swiotlb __read_mostly;
2222

2323
/*
2424
* pci_xen_swiotlb_detect - set xen_swiotlb to 1 if necessary
@@ -56,7 +56,7 @@ int __init pci_xen_swiotlb_detect(void)
5656
return xen_swiotlb;
5757
}
5858

59-
void __init pci_xen_swiotlb_init(void)
59+
static void __init pci_xen_swiotlb_init(void)
6060
{
6161
if (xen_swiotlb) {
6262
xen_swiotlb_init_early();

arch/x86/xen/smp_pv.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
290290

291291
gdt = get_cpu_gdt_rw(cpu);
292292

293-
memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
294-
295293
/*
296294
* Bring up the CPU in cpu_bringup_and_idle() with the stack
297295
* pointing just below where pt_regs would be if it were a normal
@@ -308,8 +306,6 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
308306

309307
xen_copy_trap_info(ctxt->trap_ctxt);
310308

311-
ctxt->ldt_ents = 0;
312-
313309
BUG_ON((unsigned long)gdt & ~PAGE_MASK);
314310

315311
gdt_mfn = arbitrary_virt_to_mfn(gdt);

drivers/pci/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ config PCI_PF_STUB
110110

111111
config XEN_PCIDEV_FRONTEND
112112
tristate "Xen PCI Frontend"
113-
depends on X86 && XEN
113+
depends on XEN_PV
114114
select PCI_XEN
115115
select XEN_XENBUS_FRONTEND
116116
default y

drivers/xen/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ config XEN_GRANT_DMA_ALLOC
177177

178178
config SWIOTLB_XEN
179179
def_bool y
180+
depends on XEN_PV || ARM || ARM64
180181
select DMA_OPS
181182
select SWIOTLB
182183

drivers/xen/balloon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ static int balloon_thread(void *unused)
522522
timeout = 3600 * HZ;
523523
credit = current_credit();
524524

525-
wait_event_interruptible_timeout(balloon_thread_wq,
526-
balloon_thread_cond(state, credit), timeout);
525+
wait_event_freezable_timeout(balloon_thread_wq,
526+
balloon_thread_cond(state, credit), timeout);
527527

528528
if (kthread_should_stop())
529529
return 0;

drivers/xen/gntdev.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ static int __unmap_grant_pages(struct gntdev_grant_map *map, int offset,
381381
map->unmap_ops[offset+i].handle,
382382
map->unmap_ops[offset+i].status);
383383
map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
384+
if (use_ptemod) {
385+
if (map->kunmap_ops[offset+i].status)
386+
err = -EINVAL;
387+
pr_debug("kunmap handle=%u st=%d\n",
388+
map->kunmap_ops[offset+i].handle,
389+
map->kunmap_ops[offset+i].status);
390+
map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
391+
}
384392
}
385393
return err;
386394
}

drivers/xen/swiotlb-xen.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ void __init xen_swiotlb_init_early(void)
230230
/*
231231
* Get IO TLB memory from any location.
232232
*/
233-
start = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE);
233+
start = memblock_alloc(PAGE_ALIGN(bytes),
234+
IO_TLB_SEGSIZE << IO_TLB_SHIFT);
234235
if (!start)
235-
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
236-
__func__, PAGE_ALIGN(bytes), PAGE_SIZE);
236+
panic("%s: Failed to allocate %lu bytes\n",
237+
__func__, PAGE_ALIGN(bytes));
237238

238239
/*
239240
* And replace that memory with pages under 4GB.

0 commit comments

Comments
 (0)