From patchwork Wed Jan 29 20:20:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11356795 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 41788159A for ; Wed, 29 Jan 2020 20:22:25 +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 1E68020716 for ; Wed, 29 Jan 2020 20:22:25 +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="f0PScuK5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E68020716 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 1iwtqA-0006wV-Gl; Wed, 29 Jan 2020 20:21: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 1iwtqA-0006w6-0Z for xen-devel@lists.xenproject.org; Wed, 29 Jan 2020 20:21:34 +0000 X-Inumbo-ID: d6ac66fe-42d4-11ea-8396-bc764e2007e4 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d6ac66fe-42d4-11ea-8396-bc764e2007e4; Wed, 29 Jan 2020 20:20:49 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id k11so1024681wrd.9 for ; Wed, 29 Jan 2020 12:20:49 -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=9g3iTQhv4DyHzwGgjHdIef6GauOsAtk67e0Cyiz0EQw=; b=f0PScuK5w4yGOs6U+IObwEnYCSaWM9BSUS5EJ/TVYFueKkgOcLlZTnUhZqozYejssr i3EQ/NX0qI2zc27HvqhQXJ4XgzU6uEFGF+gLBbveCMSMmoJoA5rZ80ksZsMujPM2MCtR A9WQkmSfpS+FfljjBMPfY3krGc+yd8jtPAVVGEefmCtGjaNO07kZoAl5JABb1BbIj80d /C8Ee9iZ1eyDEZKS2WyfxMMJa9XPbUmTFVqKjapQ4/tih4VPorHZdffcJtVe8KF5GNhY oLiJoALiBJI7xWN3fYtkObxBzRDIT88dbVBoTCpRa9nxiLg0aLb5Vq+PoTAerJUVC7RK FkRw== 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=9g3iTQhv4DyHzwGgjHdIef6GauOsAtk67e0Cyiz0EQw=; b=cPwAMgYFJac0AGnKrs50aGyw1royZSezbS6b+MCewi2lTAqU1cdCVkXK2EPFq7nmrl Bkbyqzmb5GmCE1laI8Qx/qlzdr91PJJb9uh2ejlUVI1/rPi8hO0SxRgLFRfrUKfyJYLK KIcNwnc+/IKQ6qwX9d0R1zDU3sJjzdcyA/48Kx5RFQ/7ZTt4QnwTB2nOwQGnQZelK2HE ytKS5xObcrZ/PsUV8hCo4HC3g2P2Cef2kXstWxvKMhAu2zYgN+paSyJ7Up9OS6vBWqhN JAgDcgUkzOEEAFjR2yRsyFe2F4QY0DmHqJ/H2Nb7e7uMY3vgJQPVqSt5YfL7cARJDqf2 0CBQ== X-Gm-Message-State: APjAAAWZ/36xy48U3hVSJIpo3EBEPouf5bLM5J4y0bfF2XrtzJ1cYE4a 1zRhTijEaMPJGM2NMsgYN9E5Kxi68wc= X-Google-Smtp-Source: APXvYqwp6kymbHNPC8nm/01CpwpfI7w1ecgBosM7fI+t2uwImDdGy8S/3Qs1fx9uYKW9TY2NiY/FGw== X-Received: by 2002:a5d:6406:: with SMTP id z6mr618262wru.294.1580329248522; Wed, 29 Jan 2020 12:20:48 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id a22sm3564115wmd.20.2020.01.29.12.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 12:20:48 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 29 Jan 2020 20:20:33 +0000 Message-Id: <20200129202034.15052-12-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200129202034.15052-1-liuwe@microsoft.com> References: <20200129202034.15052-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 11/12] 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 , =?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 | 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 f0facccbad..af0d6ed692 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_page); +DEFINE_PER_CPU_READ_MOSTLY(unsigned int, hv_vp_index); static uint64_t generate_guest_id(void) { @@ -133,6 +134,7 @@ static void __init setup_hypercall_page(void) static int setup_hypercall_pcpu_arg(void) { void *mapping; + uint64_t vp_index_msr; if ( this_cpu(hv_pcpu_input_page) ) return 0; @@ -147,6 +149,9 @@ static int setup_hypercall_pcpu_arg(void) this_cpu(hv_pcpu_input_page) = mapping; + 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 a339274985..c1c2431eff 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_page); +DECLARE_PER_CPU(unsigned int, hv_vp_index); #endif /* __XEN_HYPERV_PRIVIATE_H__ */