From patchwork Fri Sep 1 10:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Stefan ISAILA X-Patchwork-Id: 9933879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 14F2A6021C for ; Fri, 1 Sep 2017 10:46:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31A7D28616 for ; Fri, 1 Sep 2017 10:46:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 269A828630; Fri, 1 Sep 2017 10:46:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5049728616 for ; Fri, 1 Sep 2017 10:46:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnjRE-00036c-Ge; Fri, 01 Sep 2017 10:44:36 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnjRD-00036V-63 for xen-devel@lists.xen.org; Fri, 01 Sep 2017 10:44:35 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id D9/6C-03128-21A39A95; Fri, 01 Sep 2017 10:44:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsUSfTyjVVfQamW kwfkGc4slHxezODB6HN39mymAMYo1My8pvyKBNePZhAlMBat5Kh41fmVpYOzi6mLk5GAWsJbo /dfM2MXIxcEi0MwisXTqZFYI5yezxOtFr9lAqoQE3CX6J2xih7DnM0oc3FDexcgBZLtJ3HphA BFeyigxc5kviM0mYCDx6us3RhBbREBa4trny2ALmAW6mCSOXOpiAUkIC5hJnH5+Fmwmi4CqxK yZ71hBbF6gXadePAOLSwjISdw818k8gZFvASPDKkaN4tSistQiXUMLvaSizPSMktzEzBxdQwM zvdzU4uLE9NScxKRiveT83E2MwEBhAIIdjDc3BhxilORgUhLlrfZfESnEl5SfUpmRWJwRX1Sa k1p8iFGGg0NJgneDxcpIIcGi1PTUirTMHGDIwqQlOHiURHg3g6R5iwsSc4sz0yFSpxgVpcR5m S2BEgIgiYzSPLg2WJxcYpSVEuZlBDpEiKcgtSg3swRV/hWjOAejkjBvO8h4nsy8Erjpr4AWMw Et/vd5BcjikkSElFQD48R8o8bi6Rdq12nIina9Pa0XVbM30vDs+9wOGa91DzezG7Zv9X7wx4e TxSzLKm1psJbVqo9fRF1uJe/mC+u9nt7u1LpsTkX/QfaCX+K32c/vX+7oY9opdLVtSta66U94 uib5vDH5yN/je01q84ylM05I/Khe+3YNy06FXys+uzFtnc+8N/PuFSWW4oxEQy3mouJEAHwUp 82OAgAA X-Env-Sender: aisaila@bitdefender.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1504262673!114643010!1 X-Originating-IP: [91.199.104.133] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26260 invoked from network); 1 Sep 2017 10:44:33 -0000 Received: from mx02.bbu.dsd.mx.bitdefender.com (HELO mx02.buh.bitdefender.com) (91.199.104.133) by server-9.tower-27.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 1 Sep 2017 10:44:33 -0000 Comment: DomainKeys? See http://domainkeys.sourceforge.net/ DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=ONv4QwSwCPpSYGxf5HF+vPLQWAJoQfaLhgcgjF8OD25fFLzQ/PaaYJPz1RK2W5yZa+wnXCjmycT0ZIWY5IUZE0oCD390Qq6bHyvgFfyKXPPJgdh02MkqwjXJGO7SgSKHW7IgSdQNk1tMdcXBrL3RhiIg76akosvguFvjfM1aX41pfRNdhhtNfl9iW8hkK3nXX5zY+6WOR51Rj/vo1OvKKFOCPduL1Z3vAQ/ED0q3wun5Grkh0547F/k5sG2pqwAsQIb7WnYdZ/5tV9mc7Pg9Z52+gTB7WmPh1uL++UfC/YiaRiWsl40mzhuUlcXk36wn6+kpPCU4eAcvXx0gT51kCw==; h=Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer; DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bitdefender.com; h=from:to :cc:subject:date:message-id; s=default; bh=/lvjUerxF//B9hWBEI+p4 ugLaH8=; b=x4ERJJaEjemP9/W9DtXLWaVIfR9JrmbiqBhiOO3CHdKWVk30Lohbi Ub2JQxVk/6lvirQNjWqByO3gNncIRuT6b8e+T9IQS8CNLXhUn6+SPpw4qFGx5PVs jaLsXDeH0G9F07lI1KICFQtugHQ9+f7af6f9F+QfobQORTixt/eQ6XhbGkGGA8yy mZB+NN7m8+eFrNLKJy3pb3hz7WoxjyjPkXSFe6kHpVwMRU0Qj9IC98NhkzibbX2X 9l6afmv6tjH1k7rWmbg8TdIWM681Y4Jw9pcP5VE+X4rW8wkw//KAOYFnG3jc6mfJ SgNxjDBSGKkmKZLl+bS1O+vbKqXnZSxMg== Received: (qmail 20598 invoked from network); 1 Sep 2017 13:44:31 +0300 Received: from mx01robo.bbu.dsd.mx.bitdefender.com (10.17.80.60) by mx02.buh.bitdefender.com with AES128-GCM-SHA256 encrypted SMTP; 1 Sep 2017 13:44:31 +0300 Received: (qmail 1513 invoked from network); 1 Sep 2017 13:44:32 +0300 Received: from unknown (HELO aisaila-Latitude-E5570.dsd.bitdefender.biz) (10.10.195.54) by mx01robo.bbu.dsd.mx.bitdefender.com with SMTP; 1 Sep 2017 13:44:32 +0300 From: Alexandru Isaila To: xen-devel@lists.xen.org Date: Fri, 1 Sep 2017 13:44:25 +0300 Message-Id: <1504262665-28092-1-git-send-email-aisaila@bitdefender.com> X-Mailer: git-send-email 2.7.4 Cc: sstabellini@kernel.org, wei.liu2@citrix.com, rcojocaru@bitdefender.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com, Alexandru Isaila Subject: [Xen-devel] [PATCH v1] x86/hvm: Expose MSR_SHADOW_GS_BASE X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch is adding an new param in the hvm_hw_cpu structure so it can be exposed to user space. Signed-off-by: Alexandru Isaila --- xen/arch/x86/hvm/hvm.c | 4 ++++ xen/include/public/arch-x86/hvm/save.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 6cb903d..519333c 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -834,6 +834,8 @@ static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h) ctxt.gs_base = seg.base; ctxt.gs_arbytes = seg.attr; + rdmsrl(MSR_SHADOW_GS_BASE, ctxt.shadow_gs_base); + hvm_get_segment_register(v, x86_seg_tr, &seg); ctxt.tr_sel = seg.sel; ctxt.tr_limit = seg.limit; @@ -1090,6 +1092,8 @@ static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h) seg.attr = ctxt.gs_arbytes; hvm_set_segment_register(v, x86_seg_gs, &seg); + wrmsrl(MSR_SHADOW_GS_BASE, ctxt.shadow_gs_base); + seg.sel = ctxt.tr_sel; seg.limit = ctxt.tr_limit; seg.base = ctxt.tr_base; diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h index fd7bf3f..e6e8e87 100644 --- a/xen/include/public/arch-x86/hvm/save.h +++ b/xen/include/public/arch-x86/hvm/save.h @@ -134,6 +134,8 @@ struct hvm_hw_cpu { /* msr for em64t */ uint64_t shadow_gs; + uint64_t shadow_gs_base; + /* msr content saved/restored. */ uint64_t msr_flags; /* Obsolete, ignored. */ uint64_t msr_lstar;