Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+54 -14
+1
arch/x86/include/asm/idtentry.h
··· 613 613 614 614 #ifdef CONFIG_XEN_PV 615 615 DECLARE_IDTENTRY_XENCB(X86_TRAP_OTHER, exc_xen_hypervisor_callback); 616 + DECLARE_IDTENTRY_RAW(X86_TRAP_OTHER, exc_xen_unknown_trap); 616 617 #endif 617 618 618 619 /* Device interrupts common/spurious */
+14 -1
arch/x86/xen/enlighten_pv.c
··· 583 583 exc_debug(regs); 584 584 } 585 585 586 + DEFINE_IDTENTRY_RAW(exc_xen_unknown_trap) 587 + { 588 + /* This should never happen and there is no way to handle it. */ 589 + pr_err("Unknown trap in Xen PV mode."); 590 + BUG(); 591 + } 592 + 586 593 struct trap_array_entry { 587 594 void (*orig)(void); 588 595 void (*xen)(void); ··· 638 631 { 639 632 unsigned int nr; 640 633 bool ist_okay = false; 634 + bool found = false; 641 635 642 636 /* 643 637 * Replace trap handler addresses by Xen specific ones. ··· 653 645 if (*addr == entry->orig) { 654 646 *addr = entry->xen; 655 647 ist_okay = entry->ist_okay; 648 + found = true; 656 649 break; 657 650 } 658 651 } ··· 664 655 nr = (*addr - (void *)early_idt_handler_array[0]) / 665 656 EARLY_IDT_HANDLER_SIZE; 666 657 *addr = (void *)xen_early_idt_handler_array[nr]; 658 + found = true; 667 659 } 668 660 669 - if (WARN_ON(ist != 0 && !ist_okay)) 661 + if (!found) 662 + *addr = (void *)xen_asm_exc_xen_unknown_trap; 663 + 664 + if (WARN_ON(found && ist != 0 && !ist_okay)) 670 665 return false; 671 666 672 667 return true;
+1
arch/x86/xen/xen-asm.S
··· 178 178 #ifdef CONFIG_IA32_EMULATION 179 179 xen_pv_trap entry_INT80_compat 180 180 #endif 181 + xen_pv_trap asm_exc_xen_unknown_trap 181 182 xen_pv_trap asm_exc_xen_hypervisor_callback 182 183 183 184 __INIT
+7 -13
drivers/block/xen-blkfront.c
··· 945 945 if (info->feature_discard) { 946 946 blk_queue_flag_set(QUEUE_FLAG_DISCARD, rq); 947 947 blk_queue_max_discard_sectors(rq, get_capacity(gd)); 948 - rq->limits.discard_granularity = info->discard_granularity; 948 + rq->limits.discard_granularity = info->discard_granularity ?: 949 + info->physical_sector_size; 949 950 rq->limits.discard_alignment = info->discard_alignment; 950 951 if (info->feature_secdiscard) 951 952 blk_queue_flag_set(QUEUE_FLAG_SECERASE, rq); ··· 2180 2179 2181 2180 static void blkfront_setup_discard(struct blkfront_info *info) 2182 2181 { 2183 - int err; 2184 - unsigned int discard_granularity; 2185 - unsigned int discard_alignment; 2186 - 2187 2182 info->feature_discard = 1; 2188 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2189 - "discard-granularity", "%u", &discard_granularity, 2190 - "discard-alignment", "%u", &discard_alignment, 2191 - NULL); 2192 - if (!err) { 2193 - info->discard_granularity = discard_granularity; 2194 - info->discard_alignment = discard_alignment; 2195 - } 2183 + info->discard_granularity = xenbus_read_unsigned(info->xbdev->otherend, 2184 + "discard-granularity", 2185 + 0); 2186 + info->discard_alignment = xenbus_read_unsigned(info->xbdev->otherend, 2187 + "discard-alignment", 0); 2196 2188 info->feature_secdiscard = 2197 2189 !!xenbus_read_unsigned(info->xbdev->otherend, "discard-secure", 2198 2190 0);
+31
drivers/xen/xenbus/xenbus_probe.c
··· 714 714 #endif 715 715 } 716 716 717 + static int xenbus_probe_thread(void *unused) 718 + { 719 + DEFINE_WAIT(w); 720 + 721 + /* 722 + * We actually just want to wait for *any* trigger of xb_waitq, 723 + * and run xenbus_probe() the moment it occurs. 724 + */ 725 + prepare_to_wait(&xb_waitq, &w, TASK_INTERRUPTIBLE); 726 + schedule(); 727 + finish_wait(&xb_waitq, &w); 728 + 729 + DPRINTK("probing"); 730 + xenbus_probe(); 731 + return 0; 732 + } 733 + 717 734 static int __init xenbus_probe_initcall(void) 718 735 { 719 736 /* ··· 742 725 !xs_hvm_defer_init_for_callback())) 743 726 xenbus_probe(); 744 727 728 + /* 729 + * For XS_LOCAL, spawn a thread which will wait for xenstored 730 + * or a xenstore-stubdom to be started, then probe. It will be 731 + * triggered when communication starts happening, by waiting 732 + * on xb_waitq. 733 + */ 734 + if (xen_store_domain_type == XS_LOCAL) { 735 + struct task_struct *probe_task; 736 + 737 + probe_task = kthread_run(xenbus_probe_thread, NULL, 738 + "xenbus_probe"); 739 + if (IS_ERR(probe_task)) 740 + return PTR_ERR(probe_task); 741 + } 745 742 return 0; 746 743 } 747 744 device_initcall(xenbus_probe_initcall);