Commit e5ff2cb9 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-5.11-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

 - A fix for a regression introduced in 5.11 resulting in Xen dom0
   having problems to correctly initialize Xenstore.

 - A fix for avoiding WARN splats when booting as Xen dom0 with
   CONFIG_AMD_MEM_ENCRYPT enabled due to a missing trap handler for the
   #VC exception (even if the handler should never be called).

 - A fix for the Xen bklfront driver adapting to the correct but
   unexpected behavior of new qemu.

* tag 'for-linus-5.11-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  x86/xen: avoid warning in Xen pv guest with CONFIG_AMD_MEM_ENCRYPT enabled
  xen: Fix XenStore initialisation for XS_LOCAL
  xen-blkfront: allow discard-* nodes to be optional
parents 228345bf 2e924936
...@@ -613,6 +613,7 @@ DECLARE_IDTENTRY_VC(X86_TRAP_VC, exc_vmm_communication); ...@@ -613,6 +613,7 @@ DECLARE_IDTENTRY_VC(X86_TRAP_VC, exc_vmm_communication);
#ifdef CONFIG_XEN_PV #ifdef CONFIG_XEN_PV
DECLARE_IDTENTRY_XENCB(X86_TRAP_OTHER, exc_xen_hypervisor_callback); DECLARE_IDTENTRY_XENCB(X86_TRAP_OTHER, exc_xen_hypervisor_callback);
DECLARE_IDTENTRY_RAW(X86_TRAP_OTHER, exc_xen_unknown_trap);
#endif #endif
/* Device interrupts common/spurious */ /* Device interrupts common/spurious */
......
...@@ -583,6 +583,13 @@ DEFINE_IDTENTRY_RAW(xenpv_exc_debug) ...@@ -583,6 +583,13 @@ DEFINE_IDTENTRY_RAW(xenpv_exc_debug)
exc_debug(regs); exc_debug(regs);
} }
DEFINE_IDTENTRY_RAW(exc_xen_unknown_trap)
{
/* This should never happen and there is no way to handle it. */
pr_err("Unknown trap in Xen PV mode.");
BUG();
}
struct trap_array_entry { struct trap_array_entry {
void (*orig)(void); void (*orig)(void);
void (*xen)(void); void (*xen)(void);
...@@ -631,6 +638,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist) ...@@ -631,6 +638,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
{ {
unsigned int nr; unsigned int nr;
bool ist_okay = false; bool ist_okay = false;
bool found = false;
/* /*
* Replace trap handler addresses by Xen specific ones. * Replace trap handler addresses by Xen specific ones.
...@@ -645,6 +653,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist) ...@@ -645,6 +653,7 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
if (*addr == entry->orig) { if (*addr == entry->orig) {
*addr = entry->xen; *addr = entry->xen;
ist_okay = entry->ist_okay; ist_okay = entry->ist_okay;
found = true;
break; break;
} }
} }
...@@ -655,9 +664,13 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist) ...@@ -655,9 +664,13 @@ static bool __ref get_trap_addr(void **addr, unsigned int ist)
nr = (*addr - (void *)early_idt_handler_array[0]) / nr = (*addr - (void *)early_idt_handler_array[0]) /
EARLY_IDT_HANDLER_SIZE; EARLY_IDT_HANDLER_SIZE;
*addr = (void *)xen_early_idt_handler_array[nr]; *addr = (void *)xen_early_idt_handler_array[nr];
found = true;
} }
if (WARN_ON(ist != 0 && !ist_okay)) if (!found)
*addr = (void *)xen_asm_exc_xen_unknown_trap;
if (WARN_ON(found && ist != 0 && !ist_okay))
return false; return false;
return true; return true;
......
...@@ -178,6 +178,7 @@ xen_pv_trap asm_exc_simd_coprocessor_error ...@@ -178,6 +178,7 @@ xen_pv_trap asm_exc_simd_coprocessor_error
#ifdef CONFIG_IA32_EMULATION #ifdef CONFIG_IA32_EMULATION
xen_pv_trap entry_INT80_compat xen_pv_trap entry_INT80_compat
#endif #endif
xen_pv_trap asm_exc_xen_unknown_trap
xen_pv_trap asm_exc_xen_hypervisor_callback xen_pv_trap asm_exc_xen_hypervisor_callback
__INIT __INIT
......
...@@ -945,7 +945,8 @@ static void blkif_set_queue_limits(struct blkfront_info *info) ...@@ -945,7 +945,8 @@ static void blkif_set_queue_limits(struct blkfront_info *info)
if (info->feature_discard) { if (info->feature_discard) {
blk_queue_flag_set(QUEUE_FLAG_DISCARD, rq); blk_queue_flag_set(QUEUE_FLAG_DISCARD, rq);
blk_queue_max_discard_sectors(rq, get_capacity(gd)); blk_queue_max_discard_sectors(rq, get_capacity(gd));
rq->limits.discard_granularity = info->discard_granularity; rq->limits.discard_granularity = info->discard_granularity ?:
info->physical_sector_size;
rq->limits.discard_alignment = info->discard_alignment; rq->limits.discard_alignment = info->discard_alignment;
if (info->feature_secdiscard) if (info->feature_secdiscard)
blk_queue_flag_set(QUEUE_FLAG_SECERASE, rq); blk_queue_flag_set(QUEUE_FLAG_SECERASE, rq);
...@@ -2179,19 +2180,12 @@ static void blkfront_closing(struct blkfront_info *info) ...@@ -2179,19 +2180,12 @@ static void blkfront_closing(struct blkfront_info *info)
static void blkfront_setup_discard(struct blkfront_info *info) static void blkfront_setup_discard(struct blkfront_info *info)
{ {
int err;
unsigned int discard_granularity;
unsigned int discard_alignment;
info->feature_discard = 1; info->feature_discard = 1;
err = xenbus_gather(XBT_NIL, info->xbdev->otherend, info->discard_granularity = xenbus_read_unsigned(info->xbdev->otherend,
"discard-granularity", "%u", &discard_granularity, "discard-granularity",
"discard-alignment", "%u", &discard_alignment, 0);
NULL); info->discard_alignment = xenbus_read_unsigned(info->xbdev->otherend,
if (!err) { "discard-alignment", 0);
info->discard_granularity = discard_granularity;
info->discard_alignment = discard_alignment;
}
info->feature_secdiscard = info->feature_secdiscard =
!!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure", !!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure",
0); 0);
......
...@@ -714,6 +714,23 @@ static bool xs_hvm_defer_init_for_callback(void) ...@@ -714,6 +714,23 @@ static bool xs_hvm_defer_init_for_callback(void)
#endif #endif
} }
static int xenbus_probe_thread(void *unused)
{
DEFINE_WAIT(w);
/*
* We actually just want to wait for *any* trigger of xb_waitq,
* and run xenbus_probe() the moment it occurs.
*/
prepare_to_wait(&xb_waitq, &w, TASK_INTERRUPTIBLE);
schedule();
finish_wait(&xb_waitq, &w);
DPRINTK("probing");
xenbus_probe();
return 0;
}
static int __init xenbus_probe_initcall(void) static int __init xenbus_probe_initcall(void)
{ {
/* /*
...@@ -725,6 +742,20 @@ static int __init xenbus_probe_initcall(void) ...@@ -725,6 +742,20 @@ static int __init xenbus_probe_initcall(void)
!xs_hvm_defer_init_for_callback())) !xs_hvm_defer_init_for_callback()))
xenbus_probe(); xenbus_probe();
/*
* For XS_LOCAL, spawn a thread which will wait for xenstored
* or a xenstore-stubdom to be started, then probe. It will be
* triggered when communication starts happening, by waiting
* on xb_waitq.
*/
if (xen_store_domain_type == XS_LOCAL) {
struct task_struct *probe_task;
probe_task = kthread_run(xenbus_probe_thread, NULL,
"xenbus_probe");
if (IS_ERR(probe_task))
return PTR_ERR(probe_task);
}
return 0; return 0;
} }
device_initcall(xenbus_probe_initcall); device_initcall(xenbus_probe_initcall);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment