From 718b0facc8fecb068d7c757ac929ed3e3e4635b1 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Tue, 16 Sep 2014 07:21:54 +0000 Subject: [PATCH] [powerpc/powerpc64,ppc64el] Backport more KVM patches from 3.17. Enable KVM_BOOK3S_64_HV, KVM_BOOK3S_64_PR and KVM_XICS, but keep KVM_BOOK3S_64 disabled for now as it would trigger an ABI change (Partially addresses: #761656). usb/gadget: Enable USB_NET2280 as module svn path=/dists/sid/linux/; revision=21849 --- debian/changelog | 8 +- .../config/kernelarch-powerpc/config-arch-64 | 8 + ...ore-code-under-CONFIG_HAVE_KVM_IRQFD.patch | 231 ++++++++++++++++++ ...ove-vcore-definition-to-end-of-kvm_a.patch | 42 ++++ debian/patches/series | 2 + 5 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 debian/patches/features/powerpc/KVM-Move-more-code-under-CONFIG_HAVE_KVM_IRQFD.patch create mode 100644 debian/patches/features/powerpc/KVM-PPC-Book3S-Move-vcore-definition-to-end-of-kvm_a.patch diff --git a/debian/changelog b/debian/changelog index 3975e97ab..08ff76be9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,12 @@ linux (3.16.2-4) UNRELEASED; urgency=medium [ Ian Campbell ] * [armhf] Enable support for Exynos5 systems. (Closes: #759291) + [ Aurelien Jarno ] + * [powerpc/powerpc64,ppc64el] Backport more KVM patches from 3.17. Enable + KVM_BOOK3S_64_HV, KVM_BOOK3S_64_PR and KVM_XICS, but keep KVM_BOOK3S_64 + disabled for now as it would trigger an ABI change (Partially addresses: + #761656). + -- Ben Hutchings Sat, 13 Sep 2014 22:28:05 +0100 linux (3.16.2-3) unstable; urgency=medium @@ -39,7 +45,7 @@ linux (3.16.2-3) unstable; urgency=medium * media/pci/cx23885: Enable MEDIA_ALTERA_CI as module * sound/usb: Enable SND_USB_HIFACE, SND_BCD2000 as modules * usb/misc: Enable USB_EHSET_TEST_FIXTURE as module - * usb/gadget: Enable USB_NET2280 as module + usb/gadget: Enable USB_NET2280 as module * leds: Enable LEDS_TRIGGER_CPU as built-in and LEDS_TRIGGER_ONESHOT, LEDS_TRIGGER_GPIO, LEDS_TRIGGER_TRANSIENT, LEDS_TRIGGER_CAMERA as modules * uio: Enable UIO_MF624 as module diff --git a/debian/config/kernelarch-powerpc/config-arch-64 b/debian/config/kernelarch-powerpc/config-arch-64 index d7ae6ec81..14875d9b7 100644 --- a/debian/config/kernelarch-powerpc/config-arch-64 +++ b/debian/config/kernelarch-powerpc/config-arch-64 @@ -12,6 +12,14 @@ CONFIG_SCHED_SMT=y CONFIG_CMDLINE="console=hvsi0 console=hvc0 console=ttyS0,9600 console=tty0" CONFIG_KERNEL_START=0xc000000000000000 +## +## file: arch/powerpc/kvm/Kconfig +## +# CONFIG_KVM_BOOK3S_64 is not set +CONFIG_KVM_BOOK3S_64_HV=m +CONFIG_KVM_BOOK3S_64_PR=m +CONFIG_KVM_XICS=y + ## ## file: arch/powerpc/platforms/Kconfig ## diff --git a/debian/patches/features/powerpc/KVM-Move-more-code-under-CONFIG_HAVE_KVM_IRQFD.patch b/debian/patches/features/powerpc/KVM-Move-more-code-under-CONFIG_HAVE_KVM_IRQFD.patch new file mode 100644 index 000000000..1af161726 --- /dev/null +++ b/debian/patches/features/powerpc/KVM-Move-more-code-under-CONFIG_HAVE_KVM_IRQFD.patch @@ -0,0 +1,231 @@ +From: Paolo Bonzini +Date: Wed, 6 Aug 2014 14:24:45 +0200 +Subject: KVM: Move more code under CONFIG_HAVE_KVM_IRQFD +Origin: https://git.kernel.org/linus/c77dcacb397519b6ade8f08201a4a90a7f4f751e + +Commits e4d57e1ee1ab (KVM: Move irq notifier implementation into +eventfd.c, 2014-06-30) included the irq notifier code unconditionally +in eventfd.c, while it was under CONFIG_HAVE_KVM_IRQCHIP before. + +Similarly, commit 297e21053a52 (KVM: Give IRQFD its own separate enabling +Kconfig option, 2014-06-30) moved code from CONFIG_HAVE_IRQ_ROUTING +to CONFIG_HAVE_KVM_IRQFD but forgot to move the pieces that used to be +under CONFIG_HAVE_KVM_IRQCHIP. + +Together, this broke compilation without CONFIG_KVM_XICS. Fix by adding +or changing the #ifdefs so that they point at CONFIG_HAVE_KVM_IRQFD. + +Signed-off-by: Paolo Bonzini +--- + include/linux/kvm_host.h | 2 + + include/trace/events/kvm.h | 8 +-- + virt/kvm/eventfd.c | 122 ++++++++++++++++++++++----------------------- + virt/kvm/kvm_main.c | 2 + + 4 files changed, 69 insertions(+), 65 deletions(-) + +diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h +index 8593d2e..a4c33b3 100644 +--- a/include/linux/kvm_host.h ++++ b/include/linux/kvm_host.h +@@ -388,6 +388,8 @@ struct kvm { + */ + struct kvm_irq_routing_table __rcu *irq_routing; + struct hlist_head mask_notifier_list; ++#endif ++#ifdef CONFIG_HAVE_KVM_IRQFD + struct hlist_head irq_ack_notifier_list; + #endif + +diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h +index 131a0bd..908925a 100644 +--- a/include/trace/events/kvm.h ++++ b/include/trace/events/kvm.h +@@ -37,7 +37,7 @@ TRACE_EVENT(kvm_userspace_exit, + __entry->errno < 0 ? -__entry->errno : __entry->reason) + ); + +-#if defined(CONFIG_HAVE_KVM_IRQCHIP) ++#if defined(CONFIG_HAVE_KVM_IRQFD) + TRACE_EVENT(kvm_set_irq, + TP_PROTO(unsigned int gsi, int level, int irq_source_id), + TP_ARGS(gsi, level, irq_source_id), +@@ -57,7 +57,7 @@ TRACE_EVENT(kvm_set_irq, + TP_printk("gsi %u level %d source %d", + __entry->gsi, __entry->level, __entry->irq_source_id) + ); +-#endif ++#endif /* defined(CONFIG_HAVE_KVM_IRQFD) */ + + #if defined(__KVM_HAVE_IOAPIC) + #define kvm_deliver_mode \ +@@ -124,7 +124,7 @@ TRACE_EVENT(kvm_msi_set_irq, + + #endif /* defined(__KVM_HAVE_IOAPIC) */ + +-#if defined(CONFIG_HAVE_KVM_IRQCHIP) ++#if defined(CONFIG_HAVE_KVM_IRQFD) + + TRACE_EVENT(kvm_ack_irq, + TP_PROTO(unsigned int irqchip, unsigned int pin), +@@ -149,7 +149,7 @@ TRACE_EVENT(kvm_ack_irq, + #endif + ); + +-#endif /* defined(CONFIG_HAVE_KVM_IRQCHIP) */ ++#endif /* defined(CONFIG_HAVE_KVM_IRQFD) */ + + + +diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c +index f5f6154..3c5981c 100644 +--- a/virt/kvm/eventfd.c ++++ b/virt/kvm/eventfd.c +@@ -445,6 +445,67 @@ out: + kfree(irqfd); + return ret; + } ++ ++bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) ++{ ++ struct kvm_irq_ack_notifier *kian; ++ int gsi, idx; ++ ++ idx = srcu_read_lock(&kvm->irq_srcu); ++ gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); ++ if (gsi != -1) ++ hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, ++ link) ++ if (kian->gsi == gsi) { ++ srcu_read_unlock(&kvm->irq_srcu, idx); ++ return true; ++ } ++ ++ srcu_read_unlock(&kvm->irq_srcu, idx); ++ ++ return false; ++} ++EXPORT_SYMBOL_GPL(kvm_irq_has_notifier); ++ ++void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) ++{ ++ struct kvm_irq_ack_notifier *kian; ++ int gsi, idx; ++ ++ trace_kvm_ack_irq(irqchip, pin); ++ ++ idx = srcu_read_lock(&kvm->irq_srcu); ++ gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); ++ if (gsi != -1) ++ hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, ++ link) ++ if (kian->gsi == gsi) ++ kian->irq_acked(kian); ++ srcu_read_unlock(&kvm->irq_srcu, idx); ++} ++ ++void kvm_register_irq_ack_notifier(struct kvm *kvm, ++ struct kvm_irq_ack_notifier *kian) ++{ ++ mutex_lock(&kvm->irq_lock); ++ hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list); ++ mutex_unlock(&kvm->irq_lock); ++#ifdef __KVM_HAVE_IOAPIC ++ kvm_vcpu_request_scan_ioapic(kvm); ++#endif ++} ++ ++void kvm_unregister_irq_ack_notifier(struct kvm *kvm, ++ struct kvm_irq_ack_notifier *kian) ++{ ++ mutex_lock(&kvm->irq_lock); ++ hlist_del_init_rcu(&kian->link); ++ mutex_unlock(&kvm->irq_lock); ++ synchronize_srcu(&kvm->irq_srcu); ++#ifdef __KVM_HAVE_IOAPIC ++ kvm_vcpu_request_scan_ioapic(kvm); ++#endif ++} + #endif + + void +@@ -867,64 +928,3 @@ kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) + + return kvm_assign_ioeventfd(kvm, args); + } +- +-bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) +-{ +- struct kvm_irq_ack_notifier *kian; +- int gsi, idx; +- +- idx = srcu_read_lock(&kvm->irq_srcu); +- gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); +- if (gsi != -1) +- hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, +- link) +- if (kian->gsi == gsi) { +- srcu_read_unlock(&kvm->irq_srcu, idx); +- return true; +- } +- +- srcu_read_unlock(&kvm->irq_srcu, idx); +- +- return false; +-} +-EXPORT_SYMBOL_GPL(kvm_irq_has_notifier); +- +-void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) +-{ +- struct kvm_irq_ack_notifier *kian; +- int gsi, idx; +- +- trace_kvm_ack_irq(irqchip, pin); +- +- idx = srcu_read_lock(&kvm->irq_srcu); +- gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); +- if (gsi != -1) +- hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, +- link) +- if (kian->gsi == gsi) +- kian->irq_acked(kian); +- srcu_read_unlock(&kvm->irq_srcu, idx); +-} +- +-void kvm_register_irq_ack_notifier(struct kvm *kvm, +- struct kvm_irq_ack_notifier *kian) +-{ +- mutex_lock(&kvm->irq_lock); +- hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list); +- mutex_unlock(&kvm->irq_lock); +-#ifdef __KVM_HAVE_IOAPIC +- kvm_vcpu_request_scan_ioapic(kvm); +-#endif +-} +- +-void kvm_unregister_irq_ack_notifier(struct kvm *kvm, +- struct kvm_irq_ack_notifier *kian) +-{ +- mutex_lock(&kvm->irq_lock); +- hlist_del_init_rcu(&kian->link); +- mutex_unlock(&kvm->irq_lock); +- synchronize_srcu(&kvm->irq_srcu); +-#ifdef __KVM_HAVE_IOAPIC +- kvm_vcpu_request_scan_ioapic(kvm); +-#endif +-} +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c +index a69a623..33712fb 100644 +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -465,6 +465,8 @@ static struct kvm *kvm_create_vm(unsigned long type) + + #ifdef CONFIG_HAVE_KVM_IRQCHIP + INIT_HLIST_HEAD(&kvm->mask_notifier_list); ++#endif ++#ifdef CONFIG_HAVE_KVM_IRQFD + INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list); + #endif + +-- +2.0.0 + diff --git a/debian/patches/features/powerpc/KVM-PPC-Book3S-Move-vcore-definition-to-end-of-kvm_a.patch b/debian/patches/features/powerpc/KVM-PPC-Book3S-Move-vcore-definition-to-end-of-kvm_a.patch new file mode 100644 index 000000000..997b99f83 --- /dev/null +++ b/debian/patches/features/powerpc/KVM-PPC-Book3S-Move-vcore-definition-to-end-of-kvm_a.patch @@ -0,0 +1,42 @@ +From: Alexander Graf +Date: Fri, 4 Jul 2014 12:52:51 +0200 +Subject: KVM: PPC: Book3S: Move vcore definition to end of kvm_arch struct +Origin: https://git.kernel.org/linus/1287cb3fa85cd4a0d18402f6a23e1d4c6a9d7b8b + +When building KVM with a lot of vcores (NR_CPUS is big), we can potentially +get out of the ld immediate range for dereferences inside that struct. + +Move the array to the end of our kvm_arch struct. This fixes compilation +issues with NR_CPUS=2048 for me. + +Signed-off-by: Alexander Graf +--- + arch/powerpc/include/asm/kvm_host.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h +index faf2f0e..855ba4d 100644 +--- a/arch/powerpc/include/asm/kvm_host.h ++++ b/arch/powerpc/include/asm/kvm_host.h +@@ -255,7 +255,6 @@ struct kvm_arch { + atomic_t hpte_mod_interest; + spinlock_t slot_phys_lock; + cpumask_t need_tlb_flush; +- struct kvmppc_vcore *vcores[KVM_MAX_VCORES]; + int hpt_cma_alloc; + #endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ + #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE +@@ -273,6 +272,10 @@ struct kvm_arch { + struct kvmppc_xics *xics; + #endif + struct kvmppc_ops *kvm_ops; ++#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE ++ /* This array can grow quite large, keep it at the end */ ++ struct kvmppc_vcore *vcores[KVM_MAX_VCORES]; ++#endif + }; + + /* +-- +2.0.0 + diff --git a/debian/patches/series b/debian/patches/series index 35d021419..a3db25bc6 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -84,6 +84,7 @@ features/powerpc/KVM-PPC-Book3S-HV-Access-host-lppaca-and-shadow-slb-.patch features/powerpc/KVM-PPC-Book3S-HV-Access-XICS-in-BE.patch features/powerpc/KVM-PPC-Book3S-HV-Fix-ABIv2-on-LE.patch features/powerpc/KVM-PPC-Book3S-HV-Enable-for-little-endian-hosts.patch +features/powerpc/KVM-PPC-Book3S-Move-vcore-definition-to-end-of-kvm_a.patch features/powerpc/KVM-Rename-and-add-argument-to-check_extension.patch features/powerpc/KVM-Allow-KVM_CHECK_EXTENSION-on-the-vm-fd.patch features/powerpc/KVM-Don-t-keep-reference-to-irq-routing-table-in-irq.patch @@ -92,6 +93,7 @@ features/powerpc/KVM-Move-all-accesses-to-kvm-irq_routing-into-irqchi.patch features/powerpc/KVM-Move-irq-notifier-implementation-into-eventfd.c.patch features/powerpc/KVM-Give-IRQFD-its-own-separate-enabling-Kconfig-opt.patch features/powerpc/KVM-PPC-Enable-IRQFD-support-for-the-XICS-interrupt-.patch +features/powerpc/KVM-Move-more-code-under-CONFIG_HAVE_KVM_IRQFD.patch features/powerpc/deb-pkg-add-support-for-powerpc-little-endian.patch features/x86/x86-memtest-WARN-if-bad-RAM-found.patch features/x86/x86-make-x32-syscall-support-conditional.patch