From patchwork Wed Feb 12 16:09:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11378699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 317BF17F0 for ; Wed, 12 Feb 2020 16:10:53 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E31E2082F for ; Wed, 12 Feb 2020 16:10:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lJxs3jYt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E31E2082F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1uZy-0003O9-L9; Wed, 12 Feb 2020 16:09:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1uZx-0003Ns-Dt for xen-devel@lists.xenproject.org; Wed, 12 Feb 2020 16:09:33 +0000 X-Inumbo-ID: 09684986-4db2-11ea-aa99-bc764e2007e4 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 09684986-4db2-11ea-aa99-bc764e2007e4; Wed, 12 Feb 2020 16:09:25 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id b17so3177847wmb.0 for ; Wed, 12 Feb 2020 08:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=56pHjvmS/8iVc5aFusq4dajXLO6o88TEhecDdThBVrE=; b=lJxs3jYtOldvRlBSU5bkybowGs5xu7k+fL5wkQE3M4hCjIYWkFTZpTUwCjgdOu5qJF oLsqVqY8tnm9TWyS0WTYZxb//x3lw777kt5WoLU5+1c1ICknhDNfti88cDbQc9O/JfU5 ypnz844dCaKX9LLboaMNdNyiDEBRNn+lD8mmFd/EZrxzjJbTCVNGvDwTtfJ++D6JtYJS QpyAa6qq+D9quitcgoORA1ytFzP8sXXbixNuoFGujC4/fg179bxMY8ySLN6b1FFTliB+ vuhcFPykvI+v3MTVppMGfCXbywWBJDoCb/hZZD+lkdxNKFOQNN+xtvhRUheA0uhr3TK/ wPPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=56pHjvmS/8iVc5aFusq4dajXLO6o88TEhecDdThBVrE=; b=sz5woLeqeM/k5pVgbYJB62DuXkPTOAMCsAUg42KXAz+B/BXMtQIArk/X8smzaJUJPO 6Lx+vl7faQLyhd4dML0AZzKOu9iRjn2oaNyZ4w5bSKHMJqNMqA7LRxnKmlIEaTz9d1dQ FpgWnouDrkzYlNaazmgKNQaV7CmfCnxJomwzyGhoOMJN+onQvsv03bVKVPCbU4bFvqn7 XVGy9+JLz9Xe1+IkzcBKJPSjzOrP78TEZFqTl7vG5+b9MloHiLdu+FrbeNBO7aDEhhx3 tent5/0dK53SqikviWY6rmPZ7K5oMwHUQxUqKWtxcx0Am2EX2UYk9wPNUqorBQYXtE0D KA4A== X-Gm-Message-State: APjAAAUwrSSwwHNY0kCEphIfXeXmzlOSDYS3JfY4S/UTrhnd1Gfatv2F 3TFLKFoYwAZzjaO7FWJT9Wt73CaR X-Google-Smtp-Source: APXvYqzcejQMmCuKD0cuxnlcxBaIVnCk5rf6VX+2D1gNhB97xzHFfaOsqzhIdmjs1hVrQIWArZUNnA== X-Received: by 2002:a7b:cc6a:: with SMTP id n10mr13532046wmj.170.1581523763975; Wed, 12 Feb 2020 08:09:23 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id o4sm1142500wrx.25.2020.02.12.08.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 08:09:23 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 12 Feb 2020 16:09:16 +0000 Message-Id: <20200212160918.18470-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200212160918.18470-1-liuwe@microsoft.com> References: <20200212160918.18470-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] x86/hypervisor: pass flags to hypervisor_flush_tlb X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hyper-V's L0 assisted flush has fine-grained control over what gets flushed. We need all the flags available to make the best decisions possible. No functional change because Xen's implementation doesn't care about what is passed to it. Signed-off-by: Wei Liu --- xen/arch/x86/guest/hypervisor.c | 4 ++-- xen/arch/x86/guest/xen/xen.c | 2 +- xen/arch/x86/smp.c | 2 +- xen/include/asm-x86/guest/hypervisor.h | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c index 47e938e287..2724fd9bad 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -75,10 +75,10 @@ void __init hypervisor_e820_fixup(struct e820map *e820) } int hypervisor_flush_tlb(const cpumask_t *mask, const void *va, - unsigned int order) + unsigned int flags) { if ( ops.flush_tlb ) - return alternative_call(ops.flush_tlb, mask, va, order); + return alternative_call(ops.flush_tlb, mask, va, flags); return -ENOSYS; } diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c index 5d3427a713..0eb1115c4d 100644 --- a/xen/arch/x86/guest/xen/xen.c +++ b/xen/arch/x86/guest/xen/xen.c @@ -324,7 +324,7 @@ static void __init e820_fixup(struct e820map *e820) pv_shim_fixup_e820(e820); } -static int flush_tlb(const cpumask_t *mask, const void *va, unsigned int order) +static int flush_tlb(const cpumask_t *mask, const void *va, unsigned int flags) { return xen_hypercall_hvm_op(HVMOP_flush_tlbs, NULL); } diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index 9bc925616a..2df21e396a 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -260,7 +260,7 @@ void flush_area_mask(const cpumask_t *mask, const void *va, unsigned int flags) if ( cpu_has_hypervisor && !(flags & ~(FLUSH_TLB | FLUSH_TLB_GLOBAL | FLUSH_VA_VALID | FLUSH_ORDER_MASK)) && - !hypervisor_flush_tlb(mask, va, flags & FLUSH_ORDER_MASK) ) + !hypervisor_flush_tlb(mask, va, flags) ) { if ( tlb_clk_enabled ) tlb_clk_enabled = false; diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h index 432e57c2a0..48d54735d2 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -35,7 +35,7 @@ struct hypervisor_ops { /* Fix up e820 map */ void (*e820_fixup)(struct e820map *e820); /* L0 assisted TLB flush */ - int (*flush_tlb)(const cpumask_t *mask, const void *va, unsigned int order); + int (*flush_tlb)(const cpumask_t *mask, const void *va, unsigned int flags); }; #ifdef CONFIG_GUEST @@ -48,11 +48,11 @@ void hypervisor_e820_fixup(struct e820map *e820); /* * L0 assisted TLB flush. * mask: cpumask of the dirty vCPUs that should be flushed. - * va: linear address to flush, or NULL for global flushes. - * order: order of the linear address pointed by va. + * va: linear address to flush, or NULL for entire address space. + * flags: flags for flushing, including the order of va. */ int hypervisor_flush_tlb(const cpumask_t *mask, const void *va, - unsigned int order); + unsigned int flags); #else @@ -65,7 +65,7 @@ static inline int hypervisor_ap_setup(void) { return 0; } static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); } static inline void hypervisor_e820_fixup(struct e820map *e820) {} static inline int hypervisor_flush_tlb(const cpumask_t *mask, const void *va, - unsigned int order) + unsigned int flags) { return -ENOSYS; }