]> Git Repo - linux.git/commitdiff
Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <[email protected]>
Thu, 7 Sep 2017 16:25:15 +0000 (09:25 -0700)
committerLinus Torvalds <[email protected]>
Thu, 7 Sep 2017 16:25:15 +0000 (09:25 -0700)
Pull x86 platform updates from Ingo Molnar:
 "The main changes include various Hyper-V optimizations such as faster
  hypercalls and faster/better TLB flushes - and there's also some
  Intel-MID cleanups"

* 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tracing/hyper-v: Trace hyperv_mmu_flush_tlb_others()
  x86/hyper-v: Support extended CPU ranges for TLB flush hypercalls
  x86/platform/intel-mid: Make several arrays static, to make code smaller
  MAINTAINERS: Add missed file for Hyper-V
  x86/hyper-v: Use hypercall for remote TLB flush
  hyper-v: Globalize vp_index
  x86/hyper-v: Implement rep hypercalls
  hyper-v: Use fast hypercall for HVCALL_SIGNAL_EVENT
  x86/hyper-v: Introduce fast hypercall implementation
  x86/hyper-v: Make hv_do_hypercall() inline
  x86/hyper-v: Include hyperv/ only when CONFIG_HYPERV is set
  x86/platform/intel-mid: Make 'bt_sfi_data' const
  x86/platform/intel-mid: Make IRQ allocation a bit more flexible
  x86/platform/intel-mid: Group timers callbacks together

1  2 
MAINTAINERS
arch/x86/Kbuild
arch/x86/include/asm/mshyperv.h
arch/x86/kernel/cpu/mshyperv.c
drivers/hv/channel_mgmt.c
drivers/hv/vmbus_drv.c
include/linux/hyperv.h

diff --combined MAINTAINERS
index 11dde284a426e626ac0e240696e2bfe82f6cc752,9fcffdfcb09d1a6056916576bd2b2d5a044ba6e0..fb63e53ea3c8af52bb8dc34aac67826143b987e3
@@@ -301,7 -301,6 +301,7 @@@ S: Supporte
  F:    drivers/acpi/
  F:    drivers/pnp/pnpacpi/
  F:    include/linux/acpi.h
 +F:    include/linux/fwnode.h
  F:    include/acpi/
  F:    Documentation/acpi/
  F:    Documentation/ABI/testing/sysfs-bus-acpi
@@@ -311,14 -310,6 +311,14 @@@ F:       drivers/pci/*/*acpi
  F:    drivers/pci/*/*/*acpi*
  F:    tools/power/acpi/
  
 +ACPI APEI
 +M:    "Rafael J. Wysocki" <[email protected]>
 +M:    Len Brown <[email protected]>
 +L:    [email protected]
 +R:    Tony Luck <[email protected]>
 +R:    Borislav Petkov <[email protected]>
 +F:    drivers/acpi/apei/
 +
  ACPI COMPONENT ARCHITECTURE (ACPICA)
  M:    Robert Moore <[email protected]>
  M:    Lv Zheng <[email protected]>
@@@ -1162,7 -1153,6 +1162,7 @@@ L:      [email protected]
  F:    arch/arm/mach-artpec
  F:    arch/arm/boot/dts/artpec6*
  F:    drivers/clk/axis
 +F:    drivers/crypto/axis
  F:    drivers/pinctrl/pinctrl-artpec*
  F:    Documentation/devicetree/bindings/pinctrl/axis,artpec6-pinctrl.txt
  
@@@ -1292,15 -1282,10 +1292,15 @@@ S:   Maintaine
  
  ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE
  M:    Hans Ulli Kroll <[email protected]>
 +M:    Linus Walleij <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  T:    git git://github.com/ulli-kroll/linux.git
  S:    Maintained
 +F:    Documentation/devicetree/bindings/arm/gemini.txt
 +F:    Documentation/devicetree/bindings/pinctrl/cortina,gemini-pinctrl.txt
 +F:    Documentation/devicetree/bindings/rtc/faraday,ftrtc010.txt
  F:    arch/arm/mach-gemini/
 +F:    drivers/pinctrl/pinctrl-gemini.c
  F:    drivers/rtc/rtc-ftrtc010.c
  
  ARM/CSR SIRFPRIMA2 MACHINE SUPPORT
@@@ -1585,7 -1570,7 +1585,7 @@@ M:      Chunfeng Yun <chunfeng.yun@mediatek.
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
 -F:    drivers/phy/phy-mt65xx-usb3.c
 +F:    drivers/phy/mediatek/phy-mtk-tphy.c
  
  ARM/MICREL KS8695 ARCHITECTURE
  M:    Greg Ungerer <[email protected]>
@@@ -2008,7 -1993,6 +2008,7 @@@ F:      arch/arm64/boot/dts/socionext
  F:    drivers/bus/uniphier-system-bus.c
  F:    drivers/clk/uniphier/
  F:    drivers/i2c/busses/i2c-uniphier*
 +F:    drivers/irqchip/irq-uniphier-aidet.c
  F:    drivers/pinctrl/uniphier/
  F:    drivers/reset/reset-uniphier.c
  F:    drivers/tty/serial/8250/8250_uniphier.c
@@@ -2493,7 -2477,7 +2493,7 @@@ Q:      https://patchwork.open-mesh.org/proj
  S:    Maintained
  F:    Documentation/ABI/testing/sysfs-class-net-batman-adv
  F:    Documentation/ABI/testing/sysfs-class-net-mesh
 -F:    Documentation/networking/batman-adv.txt
 +F:    Documentation/networking/batman-adv.rst
  F:    include/uapi/linux/batman_adv.h
  F:    net/batman-adv/
  
@@@ -4375,12 -4359,6 +4375,12 @@@ S:    Maintaine
  F:    drivers/gpu/drm/qxl/
  F:    include/uapi/drm/qxl_drm.h
  
 +DRM DRIVER FOR PERVASIVE DISPLAYS REPAPER PANELS
 +M:    Noralf Trønnes <[email protected]>
 +S:    Maintained
 +F:    drivers/gpu/drm/tinydrm/repaper.c
 +F:    Documentation/devicetree/bindings/display/repaper.txt
 +
  DRM DRIVER FOR RAGE 128 VIDEO CARDS
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/r128/
@@@ -4396,12 -4374,6 +4396,12 @@@ S:    Orphan / Obsolet
  F:    drivers/gpu/drm/sis/
  F:    include/uapi/drm/sis_drm.h
  
 +DRM DRIVER FOR SITRONIX ST7586 PANELS
 +M:    David Lechner <[email protected]>
 +S:    Maintained
 +F:    drivers/gpu/drm/tinydrm/st7586.c
 +F:    Documentation/devicetree/bindings/display/st7586.txt
 +
  DRM DRIVER FOR TDFX VIDEO CARDS
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/tdfx/
@@@ -4650,14 -4622,6 +4650,14 @@@ F:    drivers/gpu/drm/panel
  F:    include/drm/drm_panel.h
  F:    Documentation/devicetree/bindings/display/panel/
  
 +DRM TINYDRM DRIVERS
 +M:    Noralf Trønnes <[email protected]>
 +W:    https://github.com/notro/tinydrm/wiki/Development
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +S:    Maintained
 +F:    drivers/gpu/drm/tinydrm/
 +F:    include/drm/tinydrm/
 +
  DSBR100 USB FM RADIO DRIVER
  M:    Alexey Klimov <[email protected]>
  L:    [email protected]
@@@ -5137,7 -5101,6 +5137,7 @@@ F:      include/linux/of_net.
  F:    include/linux/phy.h
  F:    include/linux/phy_fixed.h
  F:    include/linux/platform_data/mdio-gpio.h
 +F:    include/linux/platform_data/mdio-bcm-unimac.h
  F:    include/trace/events/mdio.h
  F:    include/uapi/linux/mdio.h
  F:    include/uapi/linux/mii.h
@@@ -5378,11 -5341,10 +5378,11 @@@ K:   fmc_d.*registe
  
  FPGA MANAGER FRAMEWORK
  M:    Alan Tull <[email protected]>
 -R:    Moritz Fischer <m[email protected]>
 +R:    Moritz Fischer <m[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/atull/linux-fpga.git
 +Q:    http://patchwork.kernel.org/project/linux-fpga/list/
  F:    Documentation/fpga/
  F:    Documentation/devicetree/bindings/fpga/
  F:    drivers/fpga/
@@@ -6185,14 -6147,6 +6185,14 @@@ S:    Maintaine
  F:    drivers/net/ethernet/hisilicon/
  F:    Documentation/devicetree/bindings/net/hisilicon*.txt
  
 +HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3)
 +M:    Yisen Zhuang <[email protected]>
 +M:    Salil Mehta <[email protected]>
 +L:    [email protected]
 +W:    http://www.hisilicon.com
 +S:    Maintained
 +F:    drivers/net/ethernet/hisilicon/hns3/
 +
  HISILICON ROCE DRIVER
  M:    Lijun Ou <[email protected]>
  M:    Wei Hu(Xavier) <[email protected]>
  S:    Maintained
  F:    drivers/input/touchscreen/htcpen.c
  
 +HUAWEI ETHERNET DRIVER
 +M:    Aviad Krawczyk <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    Documentation/networking/hinic.txt
 +F:    drivers/net/ethernet/huawei/hinic/
 +
  HUGETLB FILESYSTEM
  M:    Nadia Yvette Chambers <[email protected]>
  S:    Maintained
@@@ -6310,8 -6257,8 +6310,9 @@@ M:      Haiyang Zhang <[email protected]
  M:    Stephen Hemminger <[email protected]>
  L:    [email protected]
  S:    Maintained
 +F:    Documentation/networking/netvsc.txt
  F:    arch/x86/include/asm/mshyperv.h
+ F:    arch/x86/include/asm/trace/hyperv.h
  F:    arch/x86/include/uapi/asm/hyperv.h
  F:    arch/x86/kernel/cpu/mshyperv.c
  F:    arch/x86/hyperv
@@@ -6323,8 -6270,8 +6324,9 @@@ F:      drivers/net/hyperv
  F:    drivers/scsi/storvsc_drv.c
  F:    drivers/uio/uio_hv_generic.c
  F:    drivers/video/fbdev/hyperv_fb.c
 +F:    net/vmw_vsock/hyperv_transport.c
  F:    include/linux/hyperv.h
+ F:    include/uapi/linux/hyperv.h
  F:    tools/hv/
  F:    Documentation/ABI/stable/sysfs-bus-vmbus
  
@@@ -6799,9 -6746,8 +6801,9 @@@ S:      Supporte
  F:    drivers/scsi/isci/
  
  INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
 -M:    Daniel Vetter <[email protected]>
  M:    Jani Nikula <[email protected]>
 +M:    Joonas Lahtinen <[email protected]>
 +M:    Rodrigo Vivi <[email protected]>
  L:    [email protected]
  W:    https://01.org/linuxgraphics/
  B:    https://01.org/linuxgraphics/documentation/how-report-bugs
@@@ -7139,7 -7085,9 +7141,7 @@@ W:      http://irda.sourceforge.net
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git
  F:    Documentation/networking/irda.txt
 -F:    drivers/net/irda/
 -F:    include/net/irda/
 -F:    net/irda/
 +F:    drivers/staging/irda/
  
  IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
  M:    Marc Zyngier <[email protected]>
@@@ -7693,6 -7641,17 +7695,6 @@@ T:     git git://linuxtv.org/mkrufky/tuners
  S:    Maintained
  F:    drivers/media/dvb-frontends/lgdt3305.*
  
 -LGUEST
 -M:    Rusty Russell <[email protected]>
 -L:    [email protected]
 -W:    http://lguest.ozlabs.org/
 -S:    Odd Fixes
 -F:    arch/x86/include/asm/lguest*.h
 -F:    arch/x86/lguest/
 -F:    drivers/lguest/
 -F:    include/linux/lguest*.h
 -F:    tools/lguest/
 -
  LIBATA PATA ARASAN COMPACT FLASH CONTROLLER
  M:    Viresh Kumar <[email protected]>
  L:    [email protected]
@@@ -8466,9 -8425,7 +8468,9 @@@ F:      include/uapi/linux/uvcvideo.
  
  MEDIATEK ETHERNET DRIVER
  M:    Felix Fietkau <[email protected]>
 -M:    John Crispin <[email protected]>
 +M:    John Crispin <[email protected]>
 +M:    Sean Wang <[email protected]>
 +M:    Nelson Chang <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/net/ethernet/mediatek/
@@@ -8509,14 -8466,6 +8511,14 @@@ M:    Sean Wang <[email protected]
  S:    Maintained
  F:    drivers/char/hw_random/mtk-rng.c
  
 +MEDIATEK USB3 DRD IP DRIVER
 +M:    Chunfeng Yun <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +L:    [email protected] (moderated for non-subscribers)
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +F:    drivers/usb/mtu3/
 +
  MEGACHIPS STDPXXXX-GE-B850V3-FW LVDS/DP++ BRIDGES
  M:    Peter Senna Tschudin <[email protected]>
  M:    Martin Donnelly <[email protected]>
@@@ -8681,7 -8630,7 +8683,7 @@@ M:      Mathieu Desnoyers <mathieu.desnoyers
  M:    "Paul E. McKenney" <[email protected]>
  L:    [email protected]
  S:    Supported
 -F:    kernel/membarrier.c
 +F:    kernel/sched/membarrier.c
  F:    include/uapi/linux/membarrier.h
  
  MEMORY MANAGEMENT
@@@ -8771,12 -8720,6 +8773,12 @@@ F:    drivers/dma/at_hdmac.
  F:    drivers/dma/at_hdmac_regs.h
  F:    include/linux/platform_data/dma-atmel.h
  
 +MICROCHIP / ATMEL ECC DRIVER
 +M:    Tudor Ambarus <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/crypto/atmel-ecc.*
 +
  MICROCHIP / ATMEL ISC DRIVER
  M:    Songjun Wu <[email protected]>
  L:    [email protected]
@@@ -9524,7 -9467,6 +9526,7 @@@ M:      Srinivas Kandagatla <srinivas.kandag
  S:    Maintained
  F:    drivers/nvmem/
  F:    Documentation/devicetree/bindings/nvmem/
 +F:    Documentation/ABI/stable/sysfs-bus-nvmem
  F:    include/linux/nvmem-consumer.h
  F:    include/linux/nvmem-provider.h
  
@@@ -11170,7 -11112,7 +11172,7 @@@ M:   Fenghua Yu <[email protected]
  L:    [email protected]
  S:    Supported
  F:    arch/x86/kernel/cpu/intel_rdt*
 -F:    arch/x86/include/asm/intel_rdt*
 +F:    arch/x86/include/asm/intel_rdt_sched.h
  F:    Documentation/x86/intel_rdt*
  
  READ-COPY UPDATE (RCU)
@@@ -13052,11 -12994,6 +13054,11 @@@ M: Yehezkel Bernat <yehezkel.bernat@int
  S:    Maintained
  F:    drivers/thunderbolt/
  
 +THUNDERX GPIO DRIVER
 +M:    David Daney <[email protected]>
 +S:    Maintained
 +F:    drivers/gpio/gpio-thunderx.c
 +
  TI AM437X VPFE DRIVER
  M:    "Lad, Prabhakar" <[email protected]>
  L:    [email protected]
diff --combined arch/x86/Kbuild
index f65a804b86f0535927f4c3fca23eb920755a6409,3e6f640730051ce5e88bc2450d77223736a4e8f5..0038a2d10a7a575f1aa24aa6485fd277503d1753
@@@ -8,8 -8,11 +8,8 @@@ obj-$(CONFIG_KVM) += kvm
  obj-$(CONFIG_XEN) += xen/
  
  # Hyper-V paravirtualization support
- obj-$(CONFIG_HYPERVISOR_GUEST) += hyperv/
+ obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/
  
 -# lguest paravirtualization support
 -obj-$(CONFIG_LGUEST_GUEST) += lguest/
 -
  obj-y += realmode/
  obj-y += kernel/
  obj-y += mm/
index 58b9291b46d87184fdba3b6069e84ca700f43624,0d4b01c5e43848cea251b3fc341c756ba49e54f0..63cc96f064dc4987813352eb8ceba869d3738856
@@@ -3,6 -3,8 +3,8 @@@
  
  #include <linux/types.h>
  #include <linux/atomic.h>
+ #include <linux/nmi.h>
+ #include <asm/io.h>
  #include <asm/hyperv.h>
  
  /*
@@@ -28,8 -30,6 +30,8 @@@ struct ms_hyperv_info 
        u32 features;
        u32 misc_features;
        u32 hints;
 +      u32 max_vp_index;
 +      u32 max_lp_index;
  };
  
  extern struct ms_hyperv_info ms_hyperv;
@@@ -170,12 -170,155 +172,155 @@@ void hv_remove_crash_handler(void)
  
  #if IS_ENABLED(CONFIG_HYPERV)
  extern struct clocksource *hyperv_cs;
+ extern void *hv_hypercall_pg;
+ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
+ {
+       u64 input_address = input ? virt_to_phys(input) : 0;
+       u64 output_address = output ? virt_to_phys(output) : 0;
+       u64 hv_status;
+       register void *__sp asm(_ASM_SP);
+ #ifdef CONFIG_X86_64
+       if (!hv_hypercall_pg)
+               return U64_MAX;
+       __asm__ __volatile__("mov %4, %%r8\n"
+                            "call *%5"
+                            : "=a" (hv_status), "+r" (__sp),
+                              "+c" (control), "+d" (input_address)
+                            :  "r" (output_address), "m" (hv_hypercall_pg)
+                            : "cc", "memory", "r8", "r9", "r10", "r11");
+ #else
+       u32 input_address_hi = upper_32_bits(input_address);
+       u32 input_address_lo = lower_32_bits(input_address);
+       u32 output_address_hi = upper_32_bits(output_address);
+       u32 output_address_lo = lower_32_bits(output_address);
+       if (!hv_hypercall_pg)
+               return U64_MAX;
+       __asm__ __volatile__("call *%7"
+                            : "=A" (hv_status),
+                              "+c" (input_address_lo), "+r" (__sp)
+                            : "A" (control),
+                              "b" (input_address_hi),
+                              "D"(output_address_hi), "S"(output_address_lo),
+                              "m" (hv_hypercall_pg)
+                            : "cc", "memory");
+ #endif /* !x86_64 */
+       return hv_status;
+ }
+ #define HV_HYPERCALL_RESULT_MASK      GENMASK_ULL(15, 0)
+ #define HV_HYPERCALL_FAST_BIT         BIT(16)
+ #define HV_HYPERCALL_VARHEAD_OFFSET   17
+ #define HV_HYPERCALL_REP_COMP_OFFSET  32
+ #define HV_HYPERCALL_REP_COMP_MASK    GENMASK_ULL(43, 32)
+ #define HV_HYPERCALL_REP_START_OFFSET 48
+ #define HV_HYPERCALL_REP_START_MASK   GENMASK_ULL(59, 48)
+ /* Fast hypercall with 8 bytes of input and no output */
+ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
+ {
+       u64 hv_status, control = (u64)code | HV_HYPERCALL_FAST_BIT;
+       register void *__sp asm(_ASM_SP);
+ #ifdef CONFIG_X86_64
+       {
+               __asm__ __volatile__("call *%4"
+                                    : "=a" (hv_status), "+r" (__sp),
+                                      "+c" (control), "+d" (input1)
+                                    : "m" (hv_hypercall_pg)
+                                    : "cc", "r8", "r9", "r10", "r11");
+       }
+ #else
+       {
+               u32 input1_hi = upper_32_bits(input1);
+               u32 input1_lo = lower_32_bits(input1);
+               __asm__ __volatile__ ("call *%5"
+                                     : "=A"(hv_status),
+                                       "+c"(input1_lo),
+                                       "+r"(__sp)
+                                     : "A" (control),
+                                       "b" (input1_hi),
+                                       "m" (hv_hypercall_pg)
+                                     : "cc", "edi", "esi");
+       }
+ #endif
+               return hv_status;
+ }
+ /*
+  * Rep hypercalls. Callers of this functions are supposed to ensure that
+  * rep_count and varhead_size comply with Hyper-V hypercall definition.
+  */
+ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
+                                     void *input, void *output)
+ {
+       u64 control = code;
+       u64 status;
+       u16 rep_comp;
+       control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET;
+       control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET;
+       do {
+               status = hv_do_hypercall(control, input, output);
+               if ((status & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS)
+                       return status;
+               /* Bits 32-43 of status have 'Reps completed' data. */
+               rep_comp = (status & HV_HYPERCALL_REP_COMP_MASK) >>
+                       HV_HYPERCALL_REP_COMP_OFFSET;
+               control &= ~HV_HYPERCALL_REP_START_MASK;
+               control |= (u64)rep_comp << HV_HYPERCALL_REP_START_OFFSET;
+               touch_nmi_watchdog();
+       } while (rep_comp < rep_count);
+       return status;
+ }
+ /*
+  * Hypervisor's notion of virtual processor ID is different from
+  * Linux' notion of CPU ID. This information can only be retrieved
+  * in the context of the calling CPU. Setup a map for easy access
+  * to this information.
+  */
+ extern u32 *hv_vp_index;
+ /**
+  * hv_cpu_number_to_vp_number() - Map CPU to VP.
+  * @cpu_number: CPU number in Linux terms
+  *
+  * This function returns the mapping between the Linux processor
+  * number and the hypervisor's virtual processor number, useful
+  * in making hypercalls and such that talk about specific
+  * processors.
+  *
+  * Return: Virtual processor number in Hyper-V terms
+  */
+ static inline int hv_cpu_number_to_vp_number(int cpu_number)
+ {
+       return hv_vp_index[cpu_number];
+ }
  
  void hyperv_init(void);
+ void hyperv_setup_mmu_ops(void);
+ void hyper_alloc_mmu(void);
  void hyperv_report_panic(struct pt_regs *regs);
  bool hv_is_hypercall_page_setup(void);
  void hyperv_cleanup(void);
- #endif
+ #else /* CONFIG_HYPERV */
+ static inline void hyperv_init(void) {}
+ static inline bool hv_is_hypercall_page_setup(void) { return false; }
+ static inline void hyperv_cleanup(void) {}
+ static inline void hyperv_setup_mmu_ops(void) {}
+ #endif /* CONFIG_HYPERV */
  #ifdef CONFIG_HYPERV_TSCPAGE
  struct ms_hyperv_tsc_page *hv_get_tsc_page(void);
  static inline u64 hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg)
index fbafd24174afe5c3dfccb5ff024b78f7974213d4,daefd67a66c7959faf08e5a676712acc1cca73ec..3b3f713e15e5fea418ebc8eae3bc7a948570dd73
@@@ -59,8 -59,13 +59,8 @@@ void hyperv_vector_handler(struct pt_re
  void hv_setup_vmbus_irq(void (*handler)(void))
  {
        vmbus_handler = handler;
 -      /*
 -       * Setup the IDT for hypervisor callback. Prevent reallocation
 -       * at module reload.
 -       */
 -      if (!test_bit(HYPERVISOR_CALLBACK_VECTOR, used_vectors))
 -              alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
 -                              hyperv_callback_vector);
 +      /* Setup the IDT for hypervisor callback */
 +      alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
  }
  
  void hv_remove_vmbus_irq(void)
@@@ -179,15 -184,9 +179,15 @@@ static void __init ms_hyperv_init_platf
        ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES);
        ms_hyperv.hints    = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO);
  
 -      pr_info("HyperV: features 0x%x, hints 0x%x\n",
 +      pr_info("Hyper-V: features 0x%x, hints 0x%x\n",
                ms_hyperv.features, ms_hyperv.hints);
  
 +      ms_hyperv.max_vp_index = cpuid_eax(HVCPUID_IMPLEMENTATION_LIMITS);
 +      ms_hyperv.max_lp_index = cpuid_ebx(HVCPUID_IMPLEMENTATION_LIMITS);
 +
 +      pr_debug("Hyper-V: max %u virtual processors, %u logical processors\n",
 +               ms_hyperv.max_vp_index, ms_hyperv.max_lp_index);
 +
        /*
         * Extract host information.
         */
                rdmsrl(HV_X64_MSR_APIC_FREQUENCY, hv_lapic_frequency);
                hv_lapic_frequency = div_u64(hv_lapic_frequency, HZ);
                lapic_timer_frequency = hv_lapic_frequency;
 -              pr_info("HyperV: LAPIC Timer Frequency: %#x\n",
 +              pr_info("Hyper-V: LAPIC Timer Frequency: %#x\n",
                        lapic_timer_frequency);
        }
  
         * Setup the hook to get control post apic initialization.
         */
        x86_platform.apic_post_init = hyperv_init;
+       hyperv_setup_mmu_ops();
  #endif
  }
  
  const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
 -      .name                   = "Microsoft HyperV",
 +      .name                   = "Microsoft Hyper-V",
        .detect                 = ms_hyperv_platform,
        .init_platform          = ms_hyperv_init_platform,
  };
index 968af173c4c192f32beba063797f716cccb517f6,dc590195a74e5aff1ff173c6f70d0399103818ae..060df71c2e8b72f42020168fb574ff42f6827729
@@@ -451,12 -451,6 +451,12 @@@ static void vmbus_process_offer(struct 
        /* Make sure this is a new offer */
        mutex_lock(&vmbus_connection.channel_mutex);
  
 +      /*
 +       * Now that we have acquired the channel_mutex,
 +       * we can release the potentially racing rescind thread.
 +       */
 +      atomic_dec(&vmbus_connection.offer_in_progress);
 +
        list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
                if (!uuid_le_cmp(channel->offermsg.offer.if_type,
                        newchannel->offermsg.offer.if_type) &&
                        channel->num_sc++;
                        spin_unlock_irqrestore(&channel->lock, flags);
                } else {
 -                      atomic_dec(&vmbus_connection.offer_in_progress);
                        goto err_free_chan;
                }
        }
        if (!fnew) {
                if (channel->sc_creation_callback != NULL)
                        channel->sc_creation_callback(newchannel);
 -              atomic_dec(&vmbus_connection.offer_in_progress);
                return;
        }
  
                goto err_deq_chan;
        }
  
 -      atomic_dec(&vmbus_connection.offer_in_progress);
 +      newchannel->probe_done = true;
        return;
  
  err_deq_chan:
@@@ -603,7 -599,7 +603,7 @@@ static void init_vp_index(struct vmbus_
                 */
                channel->numa_node = 0;
                channel->target_cpu = 0;
-               channel->target_vp = hv_context.vp_index[0];
+               channel->target_vp = hv_cpu_number_to_vp_number(0);
                return;
        }
  
        }
  
        channel->target_cpu = cur_cpu;
-       channel->target_vp = hv_context.vp_index[cur_cpu];
+       channel->target_vp = hv_cpu_number_to_vp_number(cur_cpu);
  }
  
  static void vmbus_wait_for_unload(void)
@@@ -809,21 -805,12 +809,12 @@@ static void vmbus_onoffer(struct vmbus_
        /*
         * Setup state for signalling the host.
         */
-       newchannel->sig_event = (struct hv_input_signal_event *)
-                               (ALIGN((unsigned long)
-                               &newchannel->sig_buf,
-                               HV_HYPERCALL_PARAM_ALIGN));
-       newchannel->sig_event->connectionid.asu32 = 0;
-       newchannel->sig_event->connectionid.u.id = VMBUS_EVENT_CONNECTION_ID;
-       newchannel->sig_event->flag_number = 0;
-       newchannel->sig_event->rsvdz = 0;
+       newchannel->sig_event = VMBUS_EVENT_CONNECTION_ID;
  
        if (vmbus_proto_version != VERSION_WS2008) {
                newchannel->is_dedicated_interrupt =
                                (offer->is_dedicated_interrupt != 0);
-               newchannel->sig_event->connectionid.u.id =
-                               offer->connection_id;
+               newchannel->sig_event = offer->connection_id;
        }
  
        memcpy(&newchannel->offermsg, offer,
@@@ -886,27 -873,8 +877,27 @@@ static void vmbus_onoffer_rescind(struc
        channel->rescind = true;
        spin_unlock_irqrestore(&channel->lock, flags);
  
 +      /*
 +       * Now that we have posted the rescind state, perform
 +       * rescind related cleanup.
 +       */
        vmbus_rescind_cleanup(channel);
  
 +      /*
 +       * Now wait for offer handling to complete.
 +       */
 +      while (READ_ONCE(channel->probe_done) == false) {
 +              /*
 +               * We wait here until any channel offer is currently
 +               * being processed.
 +               */
 +              msleep(1);
 +      }
 +
 +      /*
 +       * At this point, the rescind handling can proceed safely.
 +       */
 +
        if (channel->device_obj) {
                if (channel->chn_rescind_callback) {
                        channel->chn_rescind_callback(channel);
@@@ -1251,8 -1219,7 +1242,7 @@@ struct vmbus_channel *vmbus_get_outgoin
                return outgoing_channel;
        }
  
-       cur_cpu = hv_context.vp_index[get_cpu()];
-       put_cpu();
+       cur_cpu = hv_cpu_number_to_vp_number(smp_processor_id());
        list_for_each_safe(cur, tmp, &primary->sc_list) {
                cur_channel = list_entry(cur, struct vmbus_channel, sc_list);
                if (cur_channel->state != CHANNEL_OPENED_STATE)
diff --combined drivers/hv/vmbus_drv.c
index 43160a2eafe0e33c319c1e42468bc790867b80d6,c7e7d6db2d21b2b38d179dc834b8b42c593595ec..a9d49f6f6501ccb1965217abb429d13571f26f12
@@@ -940,9 -940,6 +940,9 @@@ static void vmbus_chan_sched(struct hv_
                        if (channel->offermsg.child_relid != relid)
                                continue;
  
 +                      if (channel->rescind)
 +                              continue;
 +
                        switch (channel->callback_mode) {
                        case HV_CALL_ISR:
                                vmbus_channel_isr(channel);
@@@ -1454,23 -1451,6 +1454,6 @@@ void vmbus_free_mmio(resource_size_t st
  }
  EXPORT_SYMBOL_GPL(vmbus_free_mmio);
  
- /**
-  * vmbus_cpu_number_to_vp_number() - Map CPU to VP.
-  * @cpu_number: CPU number in Linux terms
-  *
-  * This function returns the mapping between the Linux processor
-  * number and the hypervisor's virtual processor number, useful
-  * in making hypercalls and such that talk about specific
-  * processors.
-  *
-  * Return: Virtual processor number in Hyper-V terms
-  */
- int vmbus_cpu_number_to_vp_number(int cpu_number)
- {
-       return hv_context.vp_index[cpu_number];
- }
- EXPORT_SYMBOL_GPL(vmbus_cpu_number_to_vp_number);
  static int vmbus_acpi_add(struct acpi_device *device)
  {
        acpi_status result;
diff --combined include/linux/hyperv.h
index e4bbf7dc99322586d75b57a5a066f658d7bbbe7d,e2a4fa57f1102461c65f68e037796b13cb362753..c458d7b7ad197688469772fb0c842180c668864c
@@@ -124,7 -124,10 +124,7 @@@ struct hv_ring_buffer_info 
        spinlock_t ring_lock;
  
        u32 ring_datasize;              /* < ring_size */
 -      u32 ring_data_startoffset;
 -      u32 priv_write_index;
        u32 priv_read_index;
 -      u32 cached_read_index;
  };
  
  /*
@@@ -177,6 -180,19 +177,6 @@@ static inline u32 hv_get_bytes_to_write
        return write;
  }
  
 -static inline u32 hv_get_cached_bytes_to_write(
 -      const struct hv_ring_buffer_info *rbi)
 -{
 -      u32 read_loc, write_loc, dsize, write;
 -
 -      dsize = rbi->ring_datasize;
 -      read_loc = rbi->cached_read_index;
 -      write_loc = rbi->ring_buffer->write_index;
 -
 -      write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
 -              read_loc - write_loc;
 -      return write;
 -}
  /*
   * VMBUS version is 32 bit entity broken up into
   * two 16 bit quantities: major_number. minor_number.
@@@ -661,18 -677,6 +661,6 @@@ union hv_connection_id 
        } u;
  };
  
- /* Definition of the hv_signal_event hypercall input structure. */
- struct hv_input_signal_event {
-       union hv_connection_id connectionid;
-       u16 flag_number;
-       u16 rsvdz;
- };
- struct hv_input_signal_event_buffer {
-       u64 align8;
-       struct hv_input_signal_event event;
- };
  enum hv_numa_policy {
        HV_BALANCED = 0,
        HV_LOCALIZED,
@@@ -754,8 -758,7 +742,7 @@@ struct vmbus_channel 
        } callback_mode;
  
        bool is_dedicated_interrupt;
-       struct hv_input_signal_event_buffer sig_buf;
-       struct hv_input_signal_event *sig_event;
+       u64 sig_event;
  
        /*
         * Starting with win8, this field will be used to specify
         */
        enum hv_numa_policy affinity_policy;
  
 +      bool probe_done;
 +
  };
  
  static inline bool is_hvsock_channel(const struct vmbus_channel *c)
@@@ -1016,6 -1017,13 +1003,6 @@@ extern int vmbus_sendpacket(struct vmbu
                                  enum vmbus_packet_type type,
                                  u32 flags);
  
 -extern int vmbus_sendpacket_ctl(struct vmbus_channel *channel,
 -                                void *buffer,
 -                                u32 bufferLen,
 -                                u64 requestid,
 -                                enum vmbus_packet_type type,
 -                                u32 flags);
 -
  extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
                                            struct hv_page_buffer pagebuffers[],
                                            u32 pagecount,
                                            u32 bufferlen,
                                            u64 requestid);
  
 -extern int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel,
 -                                         struct hv_page_buffer pagebuffers[],
 -                                         u32 pagecount,
 -                                         void *buffer,
 -                                         u32 bufferlen,
 -                                         u64 requestid,
 -                                         u32 flags);
 -
 -extern int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
 -                                      struct hv_multipage_buffer *mpb,
 -                                      void *buffer,
 -                                      u32 bufferlen,
 -                                      u64 requestid);
 -
  extern int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel,
                                     struct vmbus_packet_mpb_array *mpb,
                                     u32 desc_size,
@@@ -1151,8 -1173,6 +1138,6 @@@ int vmbus_allocate_mmio(struct resourc
                        resource_size_t size, resource_size_t align,
                        bool fb_overlap_ok);
  void vmbus_free_mmio(resource_size_t start, resource_size_t size);
- int vmbus_cpu_number_to_vp_number(int cpu_number);
- u64 hv_do_hypercall(u64 control, void *input, void *output);
  
  /*
   * GUID definitions of various offer types - services offered to the guest.
@@@ -1438,6 -1458,55 +1423,6 @@@ hv_get_ring_buffer(const struct hv_ring
        return ring_info->ring_buffer->buffer;
  }
  
 -/*
 - * To optimize the flow management on the send-side,
 - * when the sender is blocked because of lack of
 - * sufficient space in the ring buffer, potential the
 - * consumer of the ring buffer can signal the producer.
 - * This is controlled by the following parameters:
 - *
 - * 1. pending_send_sz: This is the size in bytes that the
 - *    producer is trying to send.
 - * 2. The feature bit feat_pending_send_sz set to indicate if
 - *    the consumer of the ring will signal when the ring
 - *    state transitions from being full to a state where
 - *    there is room for the producer to send the pending packet.
 - */
 -
 -static inline  void hv_signal_on_read(struct vmbus_channel *channel)
 -{
 -      u32 cur_write_sz, cached_write_sz;
 -      u32 pending_sz;
 -      struct hv_ring_buffer_info *rbi = &channel->inbound;
 -
 -      /*
 -       * Issue a full memory barrier before making the signaling decision.
 -       * Here is the reason for having this barrier:
 -       * If the reading of the pend_sz (in this function)
 -       * were to be reordered and read before we commit the new read
 -       * index (in the calling function)  we could
 -       * have a problem. If the host were to set the pending_sz after we
 -       * have sampled pending_sz and go to sleep before we commit the
 -       * read index, we could miss sending the interrupt. Issue a full
 -       * memory barrier to address this.
 -       */
 -      virt_mb();
 -
 -      pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
 -      /* If the other end is not blocked on write don't bother. */
 -      if (pending_sz == 0)
 -              return;
 -
 -      cur_write_sz = hv_get_bytes_to_write(rbi);
 -
 -      if (cur_write_sz < pending_sz)
 -              return;
 -
 -      cached_write_sz = hv_get_cached_bytes_to_write(rbi);
 -      if (cached_write_sz < pending_sz)
 -              vmbus_setevent(channel);
 -}
 -
  /*
   * Mask off host interrupt callback notifications
   */
This page took 0.159778 seconds and 4 git commands to generate.