From patchwork Fri Jan 31 17:49:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11360339 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 CC049159A for ; Fri, 31 Jan 2020 17:51:11 +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 A6E6D206F0 for ; Fri, 31 Jan 2020 17:51:11 +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="hwvD5kmf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6E6D206F0 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 1ixaQw-0006pM-0H; Fri, 31 Jan 2020 17:50:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixaQu-0006oO-Je for xen-devel@lists.xenproject.org; Fri, 31 Jan 2020 17:50:20 +0000 X-Inumbo-ID: 114f5676-4452-11ea-b211-bc764e2007e4 Received: from mail-wr1-x443.google.com (unknown [2a00:1450:4864:20::443]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 114f5676-4452-11ea-b211-bc764e2007e4; Fri, 31 Jan 2020 17:49:46 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id a6so9614658wrx.12 for ; Fri, 31 Jan 2020 09:49:46 -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=OuvS4yHEnv92OOnV7XktlEYfMKEuteYkS0t0AqPy5go=; b=hwvD5kmfTcaY4SDDf56iLEhTGp+0/f2bFu2wV6wAesdwO/JabEtA5MaYN/5ZtPVntv suaAwo8kO4VM3IPzL6maUg66nkFBijUP8K2viaEK7Aa9T7EFLxIA4Nr0buBNnRyO3G0d Yiubzdy4gjCSHGkiRwXl0DA8+XFl4sEUnLs+6KBk2J4QlO2/VN2D5i6Ee4bjJDNPIPOx zWcpu0JyclCOR//OS9Wq++NKr0qgJPNrku/DwUX87+sJE9yoLMm9ErblRUyd1M9kIy9h naHYR/D8QN2TciW8ttnVdawKwsS7cIq0aAjDbby6EcTF0+AFSlPGXMrGbSY5/FioNA/x zsJQ== 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=OuvS4yHEnv92OOnV7XktlEYfMKEuteYkS0t0AqPy5go=; b=TjnYImh8rT5uf6UJZnvZNU+NPVpJGgzOoQVaQH4d8IZ9OFf2r33pZinTxeaPx68kyO XrCzE4lVYTjMk473TX3ikKC2IqrXhe7udt7NEWuN2o3A51bvzSbBCtQXRnKFjyxnfzrb Qza9Ex3rkNBelkPnJy01OttIOOW2EcLi4UmIuW4Vjn1Vws5Qpfvh/imS5bI4+PXi/iZO jz+VE4s6b1stM0QVDjM2i926Raf0kPlWFYjaV7y4f8+/GMIaWHnycTBWFYNSQcVOfM6F 5mspOsMCT63KphVM8h88Ic5Ubqlgyj0k5GDCTObNGufwNw2io2Yxh5WwapboqI8NdgEl CxMg== X-Gm-Message-State: APjAAAVLNHIp/dkVmnkNmJDoPtD2FCd9bZDNafttVvYHI4/boiwVnW68 y6i0yI2UanhAsqsmhW4kO+Zaq1954pw= X-Google-Smtp-Source: APXvYqyHmpYL9shBrZJ2wnN9iAiM+ykSuxvP+dAaDUSr5n/QJiZkRjMKXJ06LxWT3bKCiy+PtJnsrw== X-Received: by 2002:adf:81c2:: with SMTP id 60mr13002491wra.8.1580492985145; Fri, 31 Jan 2020 09:49:45 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id 133sm4364352wmd.5.2020.01.31.09.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 09:49:44 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 31 Jan 2020 17:49:28 +0000 Message-Id: <20200131174930.31045-10-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200131174930.31045-1-liuwe@microsoft.com> References: <20200131174930.31045-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v6 09/11] 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 | 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 8d44b35aa6..6dac3bfceb 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__ */