Received: by 10.213.65.68 with SMTP id h4csp2534538imn; Mon, 2 Apr 2018 09:15:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/R/gy2YzMCEV5eeyD0HBsonZWKuGs3rIGCJzfVIjn578fmfo0ZqXbvmOLSn2O2cGj7A++P X-Received: by 10.99.115.69 with SMTP id d5mr6704919pgn.289.1522685730462; Mon, 02 Apr 2018 09:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522685730; cv=none; d=google.com; s=arc-20160816; b=xzs7DCZJSj34wz1jZr1dZpdgf7x64Vff6o7jRHg81n691cFX+ME58k/V+o1obw9MZi 92XQOj3nf06iAJMo5l46YPDAbEd6aER9+FPS15PfR3yY1llmgOZFCOmLFHMWBfPIQv+H 923cBp99wgctPpgQkwTflVv2uGCmuQy6NeLBea2vMvgyZjnj1Ov7TEPdZM/K5BAqIBAk IQ5qWr7fQSE+SFYBpcDTFZz1TQL/3ZoUOr3AqOHdaVMGvJUU/YWigoCbfU6zkNKW3L4x s29wOsQwx12LYEZ9lhuf5rqbLWns/lQ6QXVRSNtAmesoMpB51raIjhLm83YXuGAi0gj9 nMeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=p66VasJBPDN97oH5Atosx8qT8inLk3DPbWUs8ZwN2j8=; b=Fx5LoW6kB00Ba/fiLxFQQsi0UJT/z6FTHcVfYVUnC7Nl15EywgLy52MiET1RKuEIf2 Q7G+MU07VpvJoEmMWo0kcguX83gvJXk0WBusfhRxm0TvpPJbj/AK9tzOnN2y1jCh1chX jOQK6wOP2ERCarY12Rsib0fLwqMFPa/beLbOaqW1Y/sHbK4mEAWLB5ogm+N0Vt8haq2L 6GHy+ECtSQyZv+Qq4+Uj9X65p8rvCuSA+32TrxWYSdJLjTOcczoU9iisjOSQkWeFu/8y nRff8Dz6XJfA2hnfQ0cMqiHuz9HmmR1TSlbtcRqwK2fERjrBoYuIxeVk6/3//Ncwcqao /tNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19-v6si603998plq.156.2018.04.02.09.15.16; Mon, 02 Apr 2018 09:15:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753093AbeDBQMT (ORCPT + 99 others); Mon, 2 Apr 2018 12:12:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46726 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752105AbeDBQLD (ORCPT ); Mon, 2 Apr 2018 12:11:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BF2D4023141; Mon, 2 Apr 2018 16:11:03 +0000 (UTC) Received: from vitty.brq.redhat.com (ovpn-204-121.brq.redhat.com [10.40.204.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CADBD7E1C; Mon, 2 Apr 2018 16:11:00 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: x86@kernel.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] x86/hyper-v: move struct hv_flush_pcpu{,ex} definitions to common header Date: Mon, 2 Apr 2018 18:10:55 +0200 Message-Id: <20180402161059.8488-2-vkuznets@redhat.com> In-Reply-To: <20180402161059.8488-1-vkuznets@redhat.com> References: <20180402161059.8488-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 02 Apr 2018 16:11:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 02 Apr 2018 16:11:03 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hyper-V TLB flush hypercalls definitions will be required for KVM so move them hyperv-tlfs.h. Structures also need to be renamed as '_pcpu' suffix is invalid for a general-purpose definition. Signed-off-by: Vitaly Kuznetsov --- arch/x86/hyperv/mmu.c | 40 ++++++++++---------------------------- arch/x86/include/asm/hyperv-tlfs.h | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c index 56c9ebac946f..002fc565f8f2 100644 --- a/arch/x86/hyperv/mmu.c +++ b/arch/x86/hyperv/mmu.c @@ -13,32 +13,12 @@ #define CREATE_TRACE_POINTS #include -/* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */ -struct hv_flush_pcpu { - u64 address_space; - u64 flags; - u64 processor_mask; - u64 gva_list[]; -}; - -/* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */ -struct hv_flush_pcpu_ex { - u64 address_space; - u64 flags; - struct { - u64 format; - u64 valid_bank_mask; - u64 bank_contents[]; - } hv_vp_set; - u64 gva_list[]; -}; - /* Each gva in gva_list encodes up to 4096 pages to flush */ #define HV_TLB_FLUSH_UNIT (4096 * PAGE_SIZE) -static struct hv_flush_pcpu __percpu **pcpu_flush; +static struct hv_tlb_flush __percpu **pcpu_flush; -static struct hv_flush_pcpu_ex __percpu **pcpu_flush_ex; +static struct hv_tlb_flush_ex __percpu **pcpu_flush_ex; /* * Fills in gva_list starting from offset. Returns the number of items added. @@ -71,7 +51,7 @@ static inline int fill_gva_list(u64 gva_list[], int offset, } /* Return the number of banks in the resulting vp_set */ -static inline int cpumask_to_vp_set(struct hv_flush_pcpu_ex *flush, +static inline int cpumask_to_vp_set(struct hv_tlb_flush_ex *flush, const struct cpumask *cpus) { int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1; @@ -81,7 +61,7 @@ static inline int cpumask_to_vp_set(struct hv_flush_pcpu_ex *flush, return 0; /* - * Clear all banks up to the maximum possible bank as hv_flush_pcpu_ex + * Clear all banks up to the maximum possible bank as hv_tlb_flush_ex * structs are not cleared between calls, we risk flushing unneeded * vCPUs otherwise. */ @@ -109,8 +89,8 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus, const struct flush_tlb_info *info) { int cpu, vcpu, gva_n, max_gvas; - struct hv_flush_pcpu **flush_pcpu; - struct hv_flush_pcpu *flush; + struct hv_tlb_flush **flush_pcpu; + struct hv_tlb_flush *flush; u64 status = U64_MAX; unsigned long flags; @@ -196,8 +176,8 @@ static void hyperv_flush_tlb_others_ex(const struct cpumask *cpus, const struct flush_tlb_info *info) { int nr_bank = 0, max_gvas, gva_n; - struct hv_flush_pcpu_ex **flush_pcpu; - struct hv_flush_pcpu_ex *flush; + struct hv_tlb_flush_ex **flush_pcpu; + struct hv_tlb_flush_ex *flush; u64 status = U64_MAX; unsigned long flags; @@ -303,7 +283,7 @@ void hyper_alloc_mmu(void) return; if (!(ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED)) - pcpu_flush = alloc_percpu(struct hv_flush_pcpu *); + pcpu_flush = alloc_percpu(struct hv_tlb_flush *); else - pcpu_flush_ex = alloc_percpu(struct hv_flush_pcpu_ex *); + pcpu_flush_ex = alloc_percpu(struct hv_tlb_flush_ex *); } diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 1c602ad4bda8..ccb1dffe0d84 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -703,4 +703,24 @@ struct hv_enlightened_vmcs { #define HV_STIMER_AUTOENABLE (1ULL << 3) #define HV_STIMER_SINT(config) (__u8)(((config) >> 16) & 0x0F) +/* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */ +struct hv_tlb_flush { + u64 address_space; + u64 flags; + u64 processor_mask; + u64 gva_list[]; +}; + +/* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */ +struct hv_tlb_flush_ex { + u64 address_space; + u64 flags; + struct { + u64 format; + u64 valid_bank_mask; + u64 bank_contents[]; + } hv_vp_set; + u64 gva_list[]; +}; + #endif -- 2.14.3