x86/platform changes for v4.14
Linus,
Please pull the latest x86-platform-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-platform-for-linus
# HEAD: 773b79f7a7c7839fb9d09c0e206734173a8b0a6b tracing/hyper-v: Trace hyperv_mmu_flush_tlb_others()
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.
out-of-topic modifications in x86-platform-for-linus:
-------------------------------------------------------
MAINTAINERS # 773b79f7a7c7: tracing/hyper-v: Trace hyper
# db46e14f8a3c: MAINTAINERS: Add missed file
drivers/hv/Kconfig # 2ffd9e33ce4a: x86/hyper-v: Use hypercall f
drivers/hv/channel_mgmt.c # 7415aea6072b: hyper-v: Globalize vp_index
# 057841713cff: hyper-v: Use fast hypercall
drivers/hv/connection.c # 7415aea6072b: hyper-v: Globalize vp_index
# 057841713cff: hyper-v: Use fast hypercall
# fc53662f13b8: x86/hyper-v: Make hv_do_hype
drivers/hv/hv.c # 7415aea6072b: hyper-v: Globalize vp_index
drivers/hv/hyperv_vmbus.h # 7415aea6072b: hyper-v: Globalize vp_index
drivers/hv/vmbus_drv.c # 7415aea6072b: hyper-v: Globalize vp_index
drivers/pci/host/pci-hyperv.c # 7415aea6072b: hyper-v: Globalize vp_index
include/linux/hyperv.h # 7415aea6072b: hyper-v: Globalize vp_index
# 057841713cff: hyper-v: Use fast hypercall
# fc53662f13b8: x86/hyper-v: Make hv_do_hypeThanks,
Ingo
------------------>
Andy Shevchenko (3):
x86/platform/intel-mid: Group timers callbacks together x86/platform/intel-mid: Make IRQ allocation a bit more flexible
MAINTAINERS: Add missed file for Hyper-V
Bhumika Goyal (1):
x86/platform/intel-mid: Make 'bt_sfi_data' const
Colin Ian King (1):
x86/platform/intel-mid: Make several arrays static, to make code smaller
Vitaly Kuznetsov (9):
x86/hyper-v: Include hyperv/ only when CONFIG_HYPERV is set x86/hyper-v: Make hv_do_hypercall() inline x86/hyper-v: Introduce fast hypercall implementation
hyper-v: Use fast hypercall for HVCALL_SIGNAL_EVENT x86/hyper-v: Implement rep hypercalls
hyper-v: Globalize vp_index
x86/hyper-v: Use hypercall for remote TLB flush x86/hyper-v: Support extended CPU ranges for TLB flush hypercalls tracing/hyper-v: Trace hyperv_mmu_flush_tlb_others()
MAINTAINERS | 2 + arch/x86/Kbuild | 2 +- arch/x86/hyperv/Makefile | 2 +- arch/x86/hyperv/hv_init.c | 90 +++---- arch/x86/hyperv/mmu.c | 272 +++++++++++++++++++++ arch/x86/include/asm/mshyperv.h | 147 ++++++++++- arch/x86/include/asm/trace/hyperv.h | 40 +++ arch/x86/include/uapi/asm/hyperv.h | 17 ++ arch/x86/kernel/cpu/mshyperv.c | 1 + arch/x86/pci/intel_mid_pci.c | 12 +- .../platform/intel-mid/device_libs/platform_bt.c | 2 +- .../intel-mid/device_libs/platform_mrfld_wdt.c | 6 +- arch/x86/platform/intel-mid/intel-mid.c | 2 +- arch/x86/platform/intel-mid/pwr.c | 4 +- drivers/hv/Kconfig | 1 + drivers/hv/channel_mgmt.c | 20 +- drivers/hv/connection.c | 7 +- drivers/hv/hv.c | 9 - drivers/hv/hyperv_vmbus.h | 11 - drivers/hv/vmbus_drv.c | 17 -- drivers/pci/host/pci-hyperv.c | 54 +--- include/linux/hyperv.h | 17 +- 22 files changed, 552 insertions(+), 183 deletions(-) create mode 100644 arch/x86/hyperv/mmu.c create mode 100644 arch/x86/include/asm/trace/hyperv.h
MAINTAINERS +2 -0
@@ -6258,6 +6258,7 @@ M: Stephen Hemminger <[email protected]> L: [email protected] S: Maintained 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
@@ -6270,6 +6271,7 @@ F: drivers/scsi/storvsc_drv.c F: drivers/uio/uio_hv_generic.c F: drivers/video/fbdev/hyperv_fb.c F: include/linux/hyperv.h +F: include/uapi/linux/hyperv.h F: tools/hv/ F: Documentation/ABI/stable/sysfs-bus-vmbus
arch/x86/Kbuild +1 -1
@@ -8,7 +8,7 @@ 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/
arch/x86/hyperv/Makefile +1 -1
@@ -1 +1 @@ -obj-y := hv_init.o +obj-y := hv_init.o mmu.o
arch/x86/hyperv/hv_init.c +40 -50
136 lines not on this page · raw message
arch/x86/hyperv/mmu.c new file +272 -0
272 lines not on this page · raw message
arch/x86/include/asm/mshyperv.h +146 -1
164 lines not on this page · raw message
arch/x86/include/asm/trace/hyperv.h new file +40 -0
@@ -0,0 +1,40 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM hyperv + +#if !defined(_TRACE_HYPERV_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_HYPERV_H + +#include <linux/tracepoint.h> + +#if IS_ENABLED (CONFIG_HYPERV ) + +TRACE_EVENT (hyperv_mmu_flush_tlb_others, + TP_PROTO(const struct cpumask *cpus, + const struct flush_tlb_info *info), +TP_ARGS (cpus, info), +TP_STRUCT__entry ( + __field(unsigned int, ncpus) + __field(struct mm_struct *, mm) + __field(unsigned long, addr) + __field(unsigned long, end) + ), + TP_fast_assign(__entry->ncpus = cpumask_weight(cpus); + __entry->mm = info->mm; + __entry->addr = info->start; + __entry->end = info->end; + ), +TP_printk ("ncpus %d mm %p addr %lx, end %lx" , + __entry->ncpus, __entry->mm, + __entry->addr, __entry->end) + ); + +#endif /* CONFIG_HYPERV */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH asm/trace/ +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE hyperv +#endif /* _TRACE_HYPERV_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h>
arch/x86/include/uapi/asm/hyperv.h +17 -0
@@ -149,6 +149,9 @@*/ #define HV_X64_DEPRECATING_AEOI_RECOMMENDED (1 << 9) +/* Recommend using the newer ExProcessorMasks interface */ +#define HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED (1 << 11) +/* * HV_VP_SET available */
@@ -242,7 +245,11 @@ (~((1ull <<HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT ) -1 )) /* Declare the various hypercall operations. */ +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE 0x0002 +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST 0x0003#define HVCALL_NOTIFY_LONG_SPIN_WAIT 0x0008 +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013 +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX 0x0014#define HVCALL_POST_MESSAGE 0x005c#define HVCALL_SIGNAL_EVENT 0x005d
@@ -259,6 +266,16 @@#define HV_PROCESSOR_POWER_STATE_C2 2#define HV_PROCESSOR_POWER_STATE_C3 3 +#define HV_FLUSH_ALL_PROCESSORS BIT(0) +#define HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES BIT(1) +#define HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY BIT(2) +#define HV_FLUSH_USE_EXTENDED_RANGE_FORMAT BIT(3) + +enum HV_GENERIC_SET_FORMAT { +HV_GENERIC_SET_SPARCE_4K , +HV_GENERIC_SET_ALL , +}; +/* hypercall status code */ #define HV_STATUS_SUCCESS 0#define HV_STATUS_INVALID_HYPERCALL_CODE 2
arch/x86/kernel/cpu/mshyperv.c +1 -0
@@ -249,6 +249,7 @@ static void __init ms_hyperv_init_platform(void)* Setup the hook to get control post apic initialization. */ x86_platform.apic_post_init = hyperv_init; +hyperv_setup_mmu_ops ();#endif }
arch/x86/pci/intel_mid_pci.c +10 -2
@@ -215,16 +215,23 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)struct irq_alloc_info info;int polarity;int ret; +u8 gsi;if (dev->irq_managed && dev->irq >0 )return 0 ; + ret =pci_read_config_byte (dev,PCI_INTERRUPT_LINE , &gsi); +if (ret <0 ) { +dev_warn (&dev->dev,"Failed to read interrupt line: %d\n" , ret); +return ret; + } +switch (intel_mid_identify_cpu ()) {case INTEL_MID_CPU_CHIP_TANGIER : polarity =IOAPIC_POL_HIGH ;/* Special treatment for IRQ0 */ -if (dev->irq ==0 ) { +if (gsi ==0 ) {/* * Skip HS UART common registers device since it has * IRQ0 assigned and not used by the kernel.
@@ -253,10 +260,11 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)* MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to * IOAPIC RTE entries, so we just enable RTE for the device. */ - ret =mp_map_gsi_to_irq (dev->irq,IOAPIC_MAP_ALLOC , &info); + ret =mp_map_gsi_to_irq (gsi,IOAPIC_MAP_ALLOC , &info);if (ret <0 )return ret; + dev->irq = ret; dev->irq_managed =1 ;return 0 ;
arch/x86/platform/intel-mid/device_libs/platform_bt.c +1 -1
@@ -60,7 +60,7 @@ static int __init tng_bt_sfi_setup(struct bt_sfi_data *ddata)return 0 ; } -static struct bt_sfi_data tng_bt_sfi_data__initdata = { +static const struct bt_sfi_data tng_bt_sfi_data__initdata = { .setup = tng_bt_sfi_setup, };
arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c +3 -3
@@ -30,13 +30,13 @@ static int tangier_probe(struct platform_device *pdev) {struct irq_alloc_info info;struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data; -int gsi, irq; +int gsi =TANGIER_EXT_TIMER0_MSI ; +int irq;if (!pdata)return -EINVAL ;/* IOAPIC builds identity mapping between GSI and IRQ on MID */ - gsi = pdata->irq;ioapic_set_alloc_attr (&info,cpu_to_node (0 ),1 ,0 ); irq =mp_map_gsi_to_irq (gsi,IOAPIC_MAP_ALLOC , &info);if (irq <0 ) {
@@ -44,11 +44,11 @@ static int tangier_probe(struct platform_device *pdev)return irq; } + pdata->irq = irq;return 0 ; }static struct intel_mid_wdt_pdata tangier_pdata = { - .irq =TANGIER_EXT_TIMER0_MSI , .probe = tangier_probe, };
arch/x86/platform/intel-mid/intel-mid.c +1 -1
@@ -183,6 +183,7 @@ void __init x86_intel_mid_early_setup(void) x86_init.timers.timer_init = intel_mid_time_init; x86_init.timers.setup_percpu_clockev = x86_init_noop; + x86_init.timers.wallclock_init = intel_mid_rtc_init; x86_init.irqs.pre_vector_init = x86_init_noop;
@@ -191,7 +192,6 @@ void __init x86_intel_mid_early_setup(void) x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock; x86_platform.calibrate_tsc = intel_mid_calibrate_tsc; - x86_init.timers.wallclock_init = intel_mid_rtc_init; x86_platform.get_nmi_reason = intel_mid_get_nmi_reason; x86_init.pci.init = intel_mid_pci_init;
arch/x86/platform/intel-mid/pwr.c +2 -2
@@ -444,7 +444,7 @@ static int mid_set_initial_state(struct mid_pwr *pwr, const u32 *states)static int pnw_set_initial_state (struct mid_pwr *pwr) {/* On Penwell SRAM must stay powered on */ -const u32 states[] = { +static const u32 states[] = {0xf00fffff ,/* PM_SSC(0) */ 0xffffffff ,/* PM_SSC(1) */ 0xffffffff ,/* PM_SSC(2) */
@@ -455,7 +455,7 @@ static int pnw_set_initial_state(struct mid_pwr *pwr)static int tng_set_initial_state (struct mid_pwr *pwr) { -const u32 states[] = { +static const u32 states[] = {0xffffffff ,/* PM_SSC(0) */ 0xffffffff ,/* PM_SSC(1) */ 0xffffffff ,/* PM_SSC(2) */
drivers/hv/Kconfig +1 -0
@@ -3,6 +3,7 @@ menu "Microsoft Hyper-V guest support" config HYPERV tristate "Microsoft Hyper-V client drivers" depends on X86 && ACPI && PCI && X86_LOCAL_APIC && HYPERVISOR_GUEST + select PARAVIRT help Select this option to run Linux as a Hyper-V client operating system.
drivers/hv/channel_mgmt.c +5 -15
@@ -599,7 +599,7 @@ static void init_vp_index(struct vmbus_channel *channel, u16 dev_type)*/ 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 ; }
@@ -683,7 +683,7 @@ static void init_vp_index(struct vmbus_channel *channel, u16 dev_type) } 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 )
@@ -805,21 +805,12 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)/* * 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,
@@ -1228,8 +1219,7 @@ struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary)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 )
drivers/hv/connection.c +5 -2
@@ -32,6 +32,8 @@#include <linux/hyperv.h> #include <linux/export.h> #include <asm/hyperv.h> +#include <asm/mshyperv.h> +#include "hyperv_vmbus.h"
@@ -94,7 +96,8 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,* the CPU attempting to connect may not be CPU 0. */ if (version >=VERSION_WIN8_1 ) { - msg->target_vcpu = hv_context.vp_index[smp_processor_id ()]; + msg->target_vcpu = +hv_cpu_number_to_vp_number (smp_processor_id ()); vmbus_connection.connect_cpu =smp_processor_id (); }else { msg->target_vcpu =0 ;
@@ -406,6 +409,6 @@ void vmbus_set_event(struct vmbus_channel *channel)if (!channel->is_dedicated_interrupt)vmbus_send_interrupt (child_relid); -hv_do_hypercall (HVCALL_SIGNAL_EVENT , channel->sig_event,NULL ); +hv_do_fast_hypercall8 (HVCALL_SIGNAL_EVENT , channel->sig_event); }EXPORT_SYMBOL_GPL (vmbus_set_event);
drivers/hv/hv.c +0 -9
@@ -234,7 +234,6 @@ int hv_synic_init(unsigned int cpu)union hv_synic_siefp siefp;union hv_synic_sint shared_sint;union hv_synic_scontrol sctrl; -u64 vp_index;/* Setup the Synic's message page */ hv_get_simp (simp.as_uint64);
@@ -276,14 +275,6 @@ int hv_synic_init(unsigned int cpu) hv_context.synic_initialized = true;/* -* Setup the mapping between Hyper-V's notion -* of cpuid and Linux' notion of cpuid. -* This array will be indexed using Linux cpuid. -*/ -hv_get_vp_index (vp_index); - hv_context.vp_index[cpu] = (u32 )vp_index; - -/* * Register the per-cpu clockevent source. */ if (ms_hyperv.features &HV_X64_MSR_SYNTIMER_AVAILABLE )
drivers/hv/hyperv_vmbus.h +0 -11
@@ -229,17 +229,6 @@ struct hv_context {struct hv_per_cpu_context __percpu *cpu_context;/* -* 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: -* -* vp_index[a] is the Hyper-V's processor ID corresponding to -* Linux cpuid 'a'. -*/ -u32 vp_index[NR_CPUS ]; - -/* * To manage allocations in a NUMA node. * Array indexed by numa node ID. */
drivers/hv/vmbus_drv.c +0 -17
@@ -1451,23 +1451,6 @@ void vmbus_free_mmio(resource_size_t start, resource_size_t size) }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;
drivers/pci/host/pci-hyperv.c +3 -51
84 lines not on this page · raw message
include/linux/hyperv.h +1 -16
@@ -677,18 +677,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 ,
@@ -770,8 +758,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
@@ -1186,8 +1173,6 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, 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.