From patchwork Wed Jan 22 20:23:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11346355 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 2A3A792A for ; Wed, 22 Jan 2020 20:25:06 +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 0688424655 for ; Wed, 22 Jan 2020 20:25:06 +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="AqG8fBZP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0688424655 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 1iuMXy-0006Ny-Us; Wed, 22 Jan 2020 20:24:18 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuMXy-0006NU-0H for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 20:24:18 +0000 X-Inumbo-ID: 1b43a186-3d55-11ea-8e9a-bc764e2007e4 Received: from mail-wr1-x441.google.com (unknown [2a00:1450:4864:20::441]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1b43a186-3d55-11ea-8e9a-bc764e2007e4; Wed, 22 Jan 2020 20:23:53 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id g17so528341wro.2 for ; Wed, 22 Jan 2020 12:23:53 -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=BC91hdyPWV2hM/+wf0AJs+FRr6HNGJISWFhaN0f9Tb0=; b=AqG8fBZPBYp8jfoKXSZCsN7epFOY5v1w1Sa8ukbc/KRcnw+8Y0iCtlLfPHukMrxsR8 7Tg+g0RTIVCdvr1DyjVAKduyBqGHQC/jGvGM4zLd6trMoUFWGyzu0TDreHCPUz0926c8 MFElRQPtJE4IC9Tn0upJPkm+BOlAoosqpFTiGqexfiUfjYPh6Qv2r85iaE7CKKbieI2T l9mfdBt4a7pKHXYtO5RCV75aTGVxxHaoOaBA4hRMKpDLuTC0qWN2IVDLo5qX0lVe1d2q uGGXwerQKD44cz4+HMOQtnY8lXiUCeB/c3cO76abhRm+UozcFuEZ8WmHIZwtF0OEcs9J LFIw== 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=BC91hdyPWV2hM/+wf0AJs+FRr6HNGJISWFhaN0f9Tb0=; b=PQ/zurYpf/Y4nXPhvwxwFD+8Lmf393zZ4cZVfLJtgm3n2KDlvUeM+1wjwbpS6hBTOp RfxUvxcEsLwLkvsdvMc7hXoiS4gsqwJKQCN9yGNGI7z1DqA7NA6YqV+15LLkiy2jWoo8 Lw85nJqKVNKTBD0ePX4ELqxTlneM4Mn5M2CHiR0YEgvjmGKDarE9xSMECxD/dlTDnyUT YH/7zX+MbiwcsAUNj5aIpqWXaxXvfG2AsJlnIjHcEsugsVpHhOC+H5bL+ZjnPmEGNWY9 UxwiursGS6ljiqzXDOOCHIosV9yJ3w9eU8Bks6VsIc2UxAlvidRKhiFwo9ooXL4p8tfA HZDg== X-Gm-Message-State: APjAAAViPLb5oqT/Yo9Fudp2IIdprv4uZBfDsSfthZwE45Wn7OtgK8qA CSy5eLPY7kTk1/Fqn6O4c4+R8dU/j1fJ6w== X-Google-Smtp-Source: APXvYqwk6HQpf+44L7I2MA22dHt5tir2BvnV1QjBKthOuxwqexeCAGNnBdYOsvYCBn4ao7WqLwa2ag== X-Received: by 2002:a5d:46c1:: with SMTP id g1mr12965981wrs.200.1579724632194; Wed, 22 Jan 2020 12:23:52 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id r6sm60267992wrq.92.2020.01.22.12.23.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 12:23:51 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 22 Jan 2020 20:23:42 +0000 Message-Id: <20200122202343.5703-7-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200122202343.5703-1-liuwe@microsoft.com> References: <20200122202343.5703-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 6/7] 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 , Michael Kelley , =?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 --- 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 | 5 +++++ xen/arch/x86/guest/hyperv/private.h | 1 + 2 files changed, 6 insertions(+) diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv/hyperv.c index c5195af948..085e646dc6 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_pcpu_input_arg); +DEFINE_PER_CPU_READ_MOSTLY(unsigned int, hv_vp_index); static uint64_t generate_guest_id(void) { @@ -125,6 +126,7 @@ static void __init setup_hypercall_page(void) static void setup_hypercall_pcpu_arg(void) { void *mapping; + uint64_t vp_index_msr; if ( this_cpu(hv_pcpu_input_arg) ) return; @@ -135,6 +137,9 @@ static void setup_hypercall_pcpu_arg(void) smp_processor_id()); this_cpu(hv_pcpu_input_arg) = mapping; + + rdmsrl(HV_X64_MSR_VP_INDEX, vp_index_msr); + this_cpu(hv_vp_index) = vp_index_msr; } static void __init setup(void) diff --git a/xen/arch/x86/guest/hyperv/private.h b/xen/arch/x86/guest/hyperv/private.h index b6902b5639..da70990401 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_pcpu_input_arg); +DECLARE_PER_CPU(unsigned int, hv_vp_index); #endif /* __XEN_HYPERV_PRIVIATE_H__ */