From patchwork Tue Feb 4 15:37:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11364889 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 30BD2139A for ; Tue, 4 Feb 2020 15:38:50 +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 0DDD820674 for ; Tue, 4 Feb 2020 15:38:50 +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="RZ3zEa41" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DDD820674 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 1iz0Gy-0001if-TC; Tue, 04 Feb 2020 15:37:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iz0Gx-0001he-Aw for xen-devel@lists.xenproject.org; Tue, 04 Feb 2020 15:37:55 +0000 X-Inumbo-ID: 3ae0e224-4764-11ea-b211-bc764e2007e4 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3ae0e224-4764-11ea-b211-bc764e2007e4; Tue, 04 Feb 2020 15:37:20 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id w15so23670428wru.4 for ; Tue, 04 Feb 2020 07:37:20 -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=W+fIUGL54VDjFvlN5NvdUJjiDGrz9F9XnuiMBBpSm/k=; b=RZ3zEa41XOa7IKXYLw5JVHKyBQZfnhdWOu8y/1x9l1Ho0Uxw0AjkTIJqlvDyVcAUXX efkmhKzI3+nSyn6rHv4oRFQgzbKLrO2ATvi4TPHdCpLKakXq6+0dXV2JW7ZCpIA+91/3 9Z/aAUlCUeJqC2C+OCBDSO4CdxwH4wb/b5wYlURFOKOQsw3sO3hj/mx55CPLPIqGaXlr Q3ZFCBdj8PTDu1Ih0MC8+Y2NHEz8KBGc1nt/Ddl23IPkJDBtSVyGwVG6dsEQurCGc46h VjRUBQLri0UF+FumrRzA6PF/5AMqkDhjq3+QmlPTUwYZzpdo2AyP/9SjksKLE7OfDers dUiA== 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=W+fIUGL54VDjFvlN5NvdUJjiDGrz9F9XnuiMBBpSm/k=; b=J8lZTq7KJ/E/04F8Xs+Mv8cxzdjR93YqbDnfJOnluV7k8r0yxVUAcREkJeQkjI9Ppl iH0E+xgdj12tvWj1PwDH8rZ/rm3FuBDFqjF7umxyvHeLTMGOgeoKztmBG5TTPSksBKgX nG+NYcHmb8eo/joe0KPB0cR9Ldi7yF7m9H0XPTxDzo/uCu5bucQSnfyX1fNd+quyzFMT jj/R2+BS6PUJw4F0a2GldUbnneywczneJegQePwjW8OHwkiZyw+GoYJOcsNaoyh4zXWO 4ltokDlDijMJSYHQKa0HCLDLtbAPmBWuAuPDP3UTotVGzBs3bsEchR2RC2yG6StMdEZY J50A== X-Gm-Message-State: APjAAAWFnq1A+feVtuhJkB80zriWH/GKKdbwDvFUzoj1WoVEsykHS4ef 6zlZ1LSlna3J6OLRZRKsDEorb+x2wXM= X-Google-Smtp-Source: APXvYqzuj6E+k6UwyKZ7Qo/sUUTOB+Zv00lWZCDCoZsPpt527rOtRj1rcPFhRCGqy7RIrfRxiYONvA== X-Received: by 2002:adf:e8c9:: with SMTP id k9mr23014221wrn.168.1580830639405; Tue, 04 Feb 2020 07:37:19 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id p26sm4067143wmc.24.2020.02.04.07.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 07:37:18 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Tue, 4 Feb 2020 15:37:03 +0000 Message-Id: <20200204153704.15934-10-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200204153704.15934-1-liuwe@microsoft.com> References: <20200204153704.15934-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v7 09/10] x86/hyperv: retrieve vp_index from Hyper-V 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 , Paul Durrant , 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" This will be useful when invoking hypercall that targets specific vcpu(s). Signed-off-by: Wei Liu Reviewed-by: Paul Durrant Acked-by: Jan Beulich --- v5: 1. Add Jan's Ack. v4: 1. Use private.h 2. Add Paul's review tag v2: 1. Fold into setup_pcpu_arg function --- xen/arch/x86/guest/hyperv/hyperv.c | 6 ++++++ xen/arch/x86/guest/hyperv/private.h | 1 + 2 files changed, 7 insertions(+) diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv/hyperv.c index 6b58065c78..e31c4b30b8 100644 --- a/xen/arch/x86/guest/hyperv/hyperv.c +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -31,6 +31,7 @@ struct ms_hyperv_info __read_mostly ms_hyperv; DEFINE_PER_CPU_READ_MOSTLY(void *, hv_input_page); +DEFINE_PER_CPU_READ_MOSTLY(unsigned int, hv_vp_index); static uint64_t generate_guest_id(void) { @@ -135,6 +136,8 @@ static void __init setup_hypercall_page(void) static int setup_hypercall_pcpu_arg(void) { + uint64_t vp_index_msr; + if ( this_cpu(hv_input_page) ) return 0; @@ -146,6 +149,9 @@ static int setup_hypercall_pcpu_arg(void) return -ENOMEM; } + rdmsrl(HV_X64_MSR_VP_INDEX, vp_index_msr); + this_cpu(hv_vp_index) = vp_index_msr; + return 0; } diff --git a/xen/arch/x86/guest/hyperv/private.h b/xen/arch/x86/guest/hyperv/private.h index 093985a94b..d1765d4f23 100644 --- a/xen/arch/x86/guest/hyperv/private.h +++ b/xen/arch/x86/guest/hyperv/private.h @@ -25,5 +25,6 @@ #include DECLARE_PER_CPU(void *, hv_input_page); +DECLARE_PER_CPU(unsigned int, hv_vp_index); #endif /* __XEN_HYPERV_PRIVIATE_H__ */