From nobody Sun May 5 20:18:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1638295944; cv=none; d=zohomail.com; s=zohoarc; b=CfWKyhKFHCkQmedSFAEeW1g014WohhUUr2PyTFaGkqXxx0qaRe7KSJhn8GbVsvXEOEJvDS4wZDrI+cSAjY2Fr6rYAKq7dkcDdoOtO62XyRUV7IhHDVPyzGmG3etcegGfuOK9MwIXcLqHF9nGykQB9SZz4nw7vyY2FqxVrFd5Rbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638295944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nWWElgmgTnsEjQ8sljMUnoZmMctkGlwCpFTUQ2gkxac=; b=TjdimuEC05MqjSiZ03xDhsNTyNTewGQHCuX0e1JoaTguYXejHdYXeICE6ZkjDfHMYpXQiEsRg1z/9nPBdginK3vmJXo90W2D1ZhGeMNAxZ9xHQT/P2nwJWzTYrVsHE4NhMAXaOIxlYtjz7Ws1abKL3NK46VkrfjoEzrRRZja9Q4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638295944243176.94178658659723; Tue, 30 Nov 2021 10:12:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.235413.408412 (Exim 4.92) (envelope-from ) id 1ms7bf-0000eF-Qd; Tue, 30 Nov 2021 18:11:55 +0000 Received: by outflank-mailman (output) from mailman id 235413.408412; Tue, 30 Nov 2021 18:11:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ms7bf-0000e8-Lk; Tue, 30 Nov 2021 18:11:55 +0000 Received: by outflank-mailman (input) for mailman id 235413; Tue, 30 Nov 2021 18:11:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ms7bd-0000OK-TY for xen-devel@lists.xenproject.org; Tue, 30 Nov 2021 18:11:54 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fc56d8ec-5208-11ec-976b-d102b41d0961; Tue, 30 Nov 2021 19:11:51 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fc56d8ec-5208-11ec-976b-d102b41d0961 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1638295911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kyOL94ZVKxqY//r4+vWiit5CAiZx1BlcznsYktkan5E=; b=Q3o2cMj+NQX8mfqX8dA6zKesIdjmumw2KtAmTngfVe34vu2kONkZLAo6 EDgtpIvUdwVTKmgj8xYGETKmG0MLhjbj3GpU8YMQt+a9dZ6Ghq7YcsSLY JS0DGMZpeu+Xnzg3fptbco1ZdBbxejs/mo2WbTLJ08hCCjbXElogLDlpx 8=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 6biRmge/6yoMWTzcNrwpVlgbk+Ua8XexRMsw41ZSXnpp0VGWRK+thtg+ZL5/75CM2ypvoqoK73 fvdz4Yl3HIz3eWub81nB9vqBql9JOAOfE4+8SAO8+pt777ohR4ZMC9LWRLWRKEJg8iPjm5HgWf aRqIaMOJNOSb6aCMe/JYRftvyjmdM4J0Vn3Dtajzcd9AQJnZetpYmixEN5jvO/6vfUu/B8c4mR O/Bg0bVBBJlnMbI9JKemB49PuGCB9PiSbNFyRev0XXjyvCzRI2fgXRGS0AgIFVF04/YgsrfB7I +NDLWorqVYgkWxIaK8oW8gF8 X-SBRS: 5.1 X-MesageID: 60966838 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:ulWjpapgMMa31i3ehPeDEMp4vEFeBmKPYhIvgKrLsJaIsI4StFCzt garIBnTa/6NYTSme90lbovj8EIHsZSDxtUyHlFvrS1nEyJE+ZuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlZT4vE2xbuKU5NTsY0idfic5Dnd+4f5fs7Rh2Ncx2IPhW1nlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnZuhcBY0GKDIodkmcShpLiNvA61N8YaSdBBTseTLp6HHW37lwvEoB0AqJ4wIvO1wBAmi9 9RBdmpLNErawbvrnvTrEYGAhex6RCXvFKoZtmtt0nfyCvE+TIqYa67L+cVZzHE7gcUm8fP2O ZJIN2Q/N0SojxtnJUU4T5ETu86R2FKufTF8owm4n4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Gz0gd7mEtfZZH8CzPt5MDdYtpBBUAmP zuIifeQnL9b3EfDLyI+GHWlMTCxXnjSVMSmFGM/Gmk= IronPort-HdrOrdr: A9a23:FcoDGqFKgurN2jBgpLqE0MeALOsnbusQ8zAXP0AYc3Jom6uj5r mTdZUgpHnJYVkqOE3I9ertBEDEewK4yXcX2/h3AV7BZniEhILAFugLhuGO/9SjIVybygc079 YZT0EUMrzN5DZB4voSmDPIceod/A== X-IronPort-AV: E=Sophos;i="5.87,276,1631592000"; d="scan'208";a="60966838" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Tamas K Lengyel , Alexandru Isaila , "Petre Pircalabu" Subject: [PATCH 1/2] x86/hvm: Simplify hvm_enable_msr_interception() Date: Tue, 30 Nov 2021 18:11:38 +0000 Message-ID: <20211130181139.14398-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20211130181139.14398-1-andrew.cooper3@citrix.com> References: <20211130181139.14398-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1638295945844100003 The sole caller doesn't check the return value, and both vendors implement = the hook. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Tamas K Lengyel CC: Alexandru Isaila CC: Petre Pircalabu --- xen/include/asm-x86/hvm/hvm.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index bd2cbb0e7baf..2767427aa938 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -631,15 +631,9 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(s= truct vcpu *v) return hvm_funcs.nhvm_intr_blocked(v); } =20 -static inline bool_t hvm_enable_msr_interception(struct domain *d, uint32_= t msr) +static inline void hvm_enable_msr_interception(struct domain *d, uint32_t = msr) { - if ( hvm_funcs.enable_msr_interception ) - { - hvm_funcs.enable_msr_interception(d, msr); - return 1; - } - - return 0; + hvm_funcs.enable_msr_interception(d, msr); } =20 static inline bool_t hvm_is_singlestep_supported(void) --=20 2.11.0 From nobody Sun May 5 20:18:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1638295944; cv=none; d=zohomail.com; s=zohoarc; b=oH9gN5Y9qfTCcugOoDucTMQpP2P+IpTgSDJImET+DvVD93wddGV/1ksMRtCmebZwOLsUKKI5o+Puo3ersmtjJVtrjj30xN+V+xDCfn72JOdpfK3Kjd0GYXkI7g1f2RyVb2aVBYe2jRn/Ugsh4Me9EwIglGMk3lZmuhhH0K0tvhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638295944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RJT8f31BIoLUuYQpIxeajE1F5ZWZKQuJWDUekfheBo0=; b=CS2AzrQv4O5u16cjfUE4ZyJiKKHd1V8a6avcnsdT2//zi3GU8McvajHpXC5Lmj4okUW36YZ9RmvQsArPRCChoYi0BQy2bwcrO/GPbBNeSIW6LKIplc2xKZhtxgiNYXeOhRf+0Wbje5gu9qFzcQDRKT10fOgxappxhmn89mrDxT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638295944589589.3573155511689; Tue, 30 Nov 2021 10:12:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.235414.408423 (Exim 4.92) (envelope-from ) id 1ms7bi-0000uQ-0k; Tue, 30 Nov 2021 18:11:58 +0000 Received: by outflank-mailman (output) from mailman id 235414.408423; Tue, 30 Nov 2021 18:11:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ms7bh-0000uJ-U5; Tue, 30 Nov 2021 18:11:57 +0000 Received: by outflank-mailman (input) for mailman id 235414; Tue, 30 Nov 2021 18:11:57 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ms7bh-0000OK-6E for xen-devel@lists.xenproject.org; Tue, 30 Nov 2021 18:11:57 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ff3faf13-5208-11ec-976b-d102b41d0961; Tue, 30 Nov 2021 19:11:55 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ff3faf13-5208-11ec-976b-d102b41d0961 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1638295915; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XSzkVLoGE9z937AIRFhmIWxFCeWPF7/Hqp4uUfMmskQ=; b=Uth1TR1792qsQcxt0DULPVkXoQ0GvA/tjpYJlEK4TEE/m4Ef5poB9+mQ 8Tv1hT7lvefjp8mewvwKOQ5SLonCbkjq4SX/DHW7Foteu/jcp6B4kTrFl gQE4eineESwCzi9YtgtcBRKSqREy4C4RHfN+M97dgsgu5bxjNbndtXPjf w=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: wZpKAQqbWF7oRjqV1maBNiVr4WVflNC+u1tN6jwIuwRnUQ72+Te4jYiLta1rgAXb0qllJKiArL /UE9Bfx7opTQYMDApysuJlXoIMhhw5QVsh+5O18NVUBvLWgAwXpwOTUCnGRhWScIbf8R4AN5Nd u19pQUGL3t8FQS5RP7NzVN1LTf3A0u5ptTgufcRXa7Jfy9ipxxzb+H9xolhQNpO58xp6zKvibg 0ktkvE/65G0qDzgpemh3KYetZgsTK+K6PoEZVCqVraW/97GGSmj76vFkPSYchq2bBPqSnjWFaA AwmLF28uJaCth0CPb7sK1P9A X-SBRS: 5.1 X-MesageID: 58452968 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:rOYuU6jVVDtgqVGCqX32Tg8zX1619xcKZh0ujC45NGQN5FlHY01je htvXGmOa/mOYGOjedp/OYWzo0wD6sSEnIBlTAtv/itgFHgb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0F0/NtTo5w7Rg29cz2YDja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5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VBQKCDejWEDDH4/6CrZ ON0yfDgMaJYwAYW4tQkS7sylPAw/driobNe3z9IJnSTYgT5EK5kL1mHwdJL6v9HyIhGtFbkQ UmI4NRbZ+mEYZu3DF4LKQM5Re2fzvVIyCLK5PE4LUimti96+L2LDRdbMxWW0XEPKbJ0NMUuw Ps7ud5Q4Au600J4PtGDhyFS1mKNMn1fDPl36sBEWNfm2lgx11VPQZ3AESunspiAZuJFPlQuP jLJ1rHJgK5Rxxaafnc+fZQXMTGxWXjaVMh28WI/ IronPort-HdrOrdr: A9a23:s3KGeqimVsY37ci/q3dkGrmpBXBQXuIji2hC6mlwRA09TySZ// rBoB19726MtN9xYgBHpTnuAsm9qB/nmaKdpLNhWItKPzOW31dATrsSjrcKqgeIc0aVm9K1l5 0QF5SWYOeAdWSS5vya3ODXKbkdKaG8gcKVuds= X-IronPort-AV: E=Sophos;i="5.87,276,1631592000"; d="scan'208";a="58452968" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Tamas K Lengyel , Alexandru Isaila , "Petre Pircalabu" Subject: [PATCH 2/2] x86/hvm: Rework nested hap functions to reduce parameters Date: Tue, 30 Nov 2021 18:11:39 +0000 Message-ID: <20211130181139.14398-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20211130181139.14398-1-andrew.cooper3@citrix.com> References: <20211130181139.14398-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1638296846732100001 Most functions in this call chain have 8 parameters, meaning that the final two booleans are spilled to the stack for for calls. First, delete nestedhap_walk_L1_p2m and introduce nhvm_hap_walk_L1_p2m() as= a thin wrapper around hvm_funcs just like all the other nhvm_*() hooks. This involves including xen/mm.h as the forward declaration of struct npfec is no longer enough. Next, replace the triple of booleans with struct npfec, which contains the same information in the bottom 3 bits. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Tamas K Lengyel CC: Alexandru Isaila CC: Petre Pircalabu I don't much like this, but I think it's the least bad option in the short term. npfec is horribly mis-named/mis-used (at best, it should be consider= ed npf_info, and probably inherits from the same API/ABI mistakes our regular pagewalk functions have) and is going to have to be untangled to make nested virt a maintainable option. --- xen/arch/x86/hvm/hvm.c | 5 +---- xen/arch/x86/hvm/svm/nestedsvm.c | 11 +++++---- xen/arch/x86/hvm/vmx/vvmx.c | 10 ++++----- xen/arch/x86/mm/hap/nested_hap.c | 40 +++++++++--------------------= ---- xen/arch/x86/mm/p2m.c | 12 +++++----- xen/include/asm-x86/hvm/hvm.h | 13 ++++++++--- xen/include/asm-x86/hvm/nestedhvm.h | 6 +---- xen/include/asm-x86/hvm/svm/nestedsvm.h | 6 ++--- xen/include/asm-x86/hvm/vmx/vvmx.h | 8 +++---- 9 files changed, 46 insertions(+), 65 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 31e9474db093..07a11d372e9f 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1769,10 +1769,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned = long gla, * the same as for shadow paging. */ =20 - rv =3D nestedhvm_hap_nested_page_fault(curr, &gpa, - npfec.read_access, - npfec.write_access, - npfec.insn_fetch); + rv =3D nestedhvm_hap_nested_page_fault(curr, &gpa, npfec); switch (rv) { case NESTEDHVM_PAGEFAULT_DONE: case NESTEDHVM_PAGEFAULT_RETRY: diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nested= svm.c index 6d9063004077..abc178d8d482 100644 --- a/xen/arch/x86/hvm/svm/nestedsvm.c +++ b/xen/arch/x86/hvm/svm/nestedsvm.c @@ -1216,10 +1216,9 @@ nsvm_vmcb_hap_enabled(struct vcpu *v) * walk is successful, the translated value is returned in * L1_gpa. The result value tells what to do next. */ -int -nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, - unsigned int *page_order, uint8_t *p2m_acc, - bool_t access_r, bool_t access_w, bool_t access_x) +int nsvm_hap_walk_L1_p2m( + struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_or= der, + uint8_t *p2m_acc, struct npfec npfec) { uint32_t pfec; unsigned long nested_cr3, gfn; @@ -1227,9 +1226,9 @@ nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, = paddr_t *L1_gpa, nested_cr3 =3D nhvm_vcpu_p2m_base(v); =20 pfec =3D PFEC_user_mode | PFEC_page_present; - if ( access_w ) + if ( npfec.write_access ) pfec |=3D PFEC_write_access; - if ( access_x ) + if ( npfec.insn_fetch ) pfec |=3D PFEC_insn_fetch; =20 /* Walk the guest-supplied NPT table, just as if it were a pagetable */ diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index e9f94daf6493..7419ee9dd0bc 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -2346,16 +2346,16 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *= msr_content) * walk is successful, the translated value is returned in * L1_gpa. The result value tells what to do next. */ -int -nvmx_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, - unsigned int *page_order, uint8_t *p2m_acc, - bool_t access_r, bool_t access_w, bool_t access_x) +int nvmx_hap_walk_L1_p2m( + struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_or= der, + uint8_t *p2m_acc, struct npfec npfec) { int rc; unsigned long gfn; uint64_t exit_qual; uint32_t exit_reason =3D EXIT_REASON_EPT_VIOLATION; - uint32_t rwx_rights =3D (access_x << 2) | (access_w << 1) | access_r; + uint32_t rwx_rights =3D + (npfec.insn_fetch << 2) | (npfec.write_access << 1) | npfec.read_a= ccess; struct nestedvmx *nvmx =3D &vcpu_2_nvmx(v); =20 vmx_vmcs_enter(v); diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_= hap.c index 50fa2dd9f405..d8a7b3b40167 100644 --- a/xen/arch/x86/mm/hap/nested_hap.c +++ b/xen/arch/x86/mm/hap/nested_hap.c @@ -113,31 +113,13 @@ nestedhap_fix_p2m(struct vcpu *v, struct p2m_domain *= p2m, } } =20 -/* This function uses L2_gpa to walk the P2M page table in L1. If the - * walk is successful, the translated value is returned in - * L1_gpa. The result value tells what to do next. - */ -int -nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, - unsigned int *page_order, uint8_t *p2m_acc, - bool_t access_r, bool_t access_w, bool_t access_x) -{ - ASSERT(hvm_funcs.nhvm_hap_walk_L1_p2m); - - return hvm_funcs.nhvm_hap_walk_L1_p2m(v, L2_gpa, L1_gpa, page_order, - p2m_acc, access_r, access_w, access_x); -} - - /* This function uses L1_gpa to walk the P2M table in L0 hypervisor. If the * walk is successful, the translated value is returned in L0_gpa. The ret= urn=20 * value tells the upper level what to do. */ -static int -nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_= gpa, - p2m_type_t *p2mt, p2m_access_t *p2ma, - unsigned int *page_order, - bool_t access_r, bool_t access_w, bool_t access_x) +static int nestedhap_walk_L0_p2m( + struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa, p2m_type_t *p= 2mt, + p2m_access_t *p2ma, unsigned int *page_order, struct npfec npfec) { mfn_t mfn; int rc; @@ -154,7 +136,7 @@ nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L= 1_gpa, paddr_t *L0_gpa, goto out; =20 rc =3D NESTEDHVM_PAGEFAULT_L0_ERROR; - if ( access_w && p2m_is_readonly(*p2mt) ) + if ( npfec.write_access && p2m_is_readonly(*p2mt) ) goto out; =20 if ( p2m_is_paging(*p2mt) || p2m_is_shared(*p2mt) || !p2m_is_ram(*p2mt= ) ) @@ -176,9 +158,8 @@ nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L= 1_gpa, paddr_t *L0_gpa, * * Returns: */ -int -nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa, - bool_t access_r, bool_t access_w, bool_t access_x) +int nestedhvm_hap_nested_page_fault( + struct vcpu *v, paddr_t *L2_gpa, struct npfec npfec) { int rv; paddr_t L1_gpa, L0_gpa; @@ -192,8 +173,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t= *L2_gpa, p2m =3D p2m_get_hostp2m(d); /* L0 p2m */ =20 /* walk the L1 P2M table */ - rv =3D nestedhap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2m= a_21, - access_r, access_w, access_x); + rv =3D nhvm_hap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2ma= _21, + npfec); =20 /* let caller to handle these two cases */ switch (rv) { @@ -209,9 +190,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t= *L2_gpa, } =20 /* =3D=3D> we have to walk L0 P2M */ - rv =3D nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa, - &p2mt_10, &p2ma_10, &page_order_10, - access_r, access_w, access_x); + rv =3D nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa, &p2mt_10, &p2ma_10, + &page_order_10, npfec); =20 /* let upper level caller to handle these two cases */ switch (rv) { diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index def1695cf00b..68e38cba14f7 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1930,6 +1930,11 @@ unsigned long paging_gva_to_gfn(struct vcpu *v, const struct paging_mode *mode; uint8_t l1_p2ma; unsigned int l1_page_order; + struct npfec npfec =3D { + .read_access =3D 1, + .write_access =3D *pfec & PFEC_write_access, + .insn_fetch =3D *pfec & PFEC_insn_fetch, + }; int rv; =20 /* translate l2 guest va into l2 guest gfn */ @@ -1940,11 +1945,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v, if ( l2_gfn =3D=3D gfn_x(INVALID_GFN) ) return gfn_x(INVALID_GFN); =20 - rv =3D nestedhap_walk_L1_p2m(v, pfn_to_paddr(l2_gfn), &l1_gpa, - &l1_page_order, &l1_p2ma, - 1, - !!(*pfec & PFEC_write_access), - !!(*pfec & PFEC_insn_fetch)); + rv =3D nhvm_hap_walk_L1_p2m( + v, pfn_to_paddr(l2_gfn), &l1_gpa, &l1_page_order, &l1_p2ma, np= fec); =20 if ( rv !=3D NESTEDHVM_PAGEFAULT_DONE ) return gfn_x(INVALID_GFN); diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 2767427aa938..7e571e1515c6 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -25,6 +25,7 @@ #include #include #include +#include =20 #ifdef CONFIG_HVM_FEP /* Permit use of the Forced Emulation Prefix in HVM guests */ @@ -203,8 +204,7 @@ struct hvm_function_table { /*Walk nested p2m */ int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order, - uint8_t *p2m_acc, bool_t access_r, - bool_t access_w, bool_t access_x); + uint8_t *p2m_acc, struct npfec npfec); =20 void (*enable_msr_interception)(struct domain *d, uint32_t msr); bool_t (*is_singlestep_supported)(void); @@ -350,7 +350,6 @@ int hvm_debug_op(struct vcpu *v, int32_t op); void hvm_toggle_singlestep(struct vcpu *v); void hvm_fast_singlestep(struct vcpu *v, uint16_t p2midx); =20 -struct npfec; int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla, struct npfec npfec); =20 @@ -631,6 +630,14 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(s= truct vcpu *v) return hvm_funcs.nhvm_intr_blocked(v); } =20 +static inline int nhvm_hap_walk_L1_p2m( + struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_or= der, + uint8_t *p2m_acc, struct npfec npfec) +{ + return hvm_funcs.nhvm_hap_walk_L1_p2m( + v, L2_gpa, L1_gpa, page_order, p2m_acc, npfec); +} + static inline void hvm_enable_msr_interception(struct domain *d, uint32_t = msr) { hvm_funcs.enable_msr_interception(d, msr); diff --git a/xen/include/asm-x86/hvm/nestedhvm.h b/xen/include/asm-x86/hvm/= nestedhvm.h index d26392578621..7184928c2bb1 100644 --- a/xen/include/asm-x86/hvm/nestedhvm.h +++ b/xen/include/asm-x86/hvm/nestedhvm.h @@ -58,11 +58,7 @@ bool_t nestedhvm_vcpu_in_guestmode(struct vcpu *v); #define NESTEDHVM_PAGEFAULT_RETRY 5 #define NESTEDHVM_PAGEFAULT_DIRECT_MMIO 6 int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa, - bool_t access_r, bool_t access_w, bool_t access_x); - -int nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, - unsigned int *page_order, uint8_t *p2m_acc, - bool_t access_r, bool_t access_w, bool_t access_= x); + struct npfec npfec); =20 /* IO permission map */ unsigned long *nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed= ); diff --git a/xen/include/asm-x86/hvm/svm/nestedsvm.h b/xen/include/asm-x86/= hvm/svm/nestedsvm.h index 087369845761..c3ef2354140c 100644 --- a/xen/include/asm-x86/hvm/svm/nestedsvm.h +++ b/xen/include/asm-x86/hvm/svm/nestedsvm.h @@ -122,9 +122,9 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v); void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v); void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v); bool_t nestedsvm_gif_isset(struct vcpu *v); -int nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, - unsigned int *page_order, uint8_t *p2m_acc, - bool_t access_r, bool_t access_w, bool_t access_x= ); +int nsvm_hap_walk_L1_p2m( + struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_or= der, + uint8_t *p2m_acc, struct npfec npfec); =20 #define NSVM_INTR_NOTHANDLED 3 #define NSVM_INTR_NOTINTERCEPTED 2 diff --git a/xen/include/asm-x86/hvm/vmx/vvmx.h b/xen/include/asm-x86/hvm/v= mx/vvmx.h index d5f68f30b129..e4ca3bc6ee2b 100644 --- a/xen/include/asm-x86/hvm/vmx/vvmx.h +++ b/xen/include/asm-x86/hvm/vmx/vvmx.h @@ -100,10 +100,10 @@ bool_t nvmx_ept_enabled(struct vcpu *v); #define EPT_TRANSLATE_MISCONFIG 2 #define EPT_TRANSLATE_RETRY 3 =20 -int -nvmx_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, - unsigned int *page_order, uint8_t *p2m_acc, - bool_t access_r, bool_t access_w, bool_t access_x); +int nvmx_hap_walk_L1_p2m( + struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_or= der, + uint8_t *p2m_acc, struct npfec npfec); + /* * Virtual VMCS layout * --=20 2.11.0