From nobody Fri Mar 29 11:07:31 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=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1596199196; cv=none; d=zohomail.com; s=zohoarc; b=PuTxs3VNqu3NUDKPP8uyfOzvRShTMXFoTu6zeruXJkuXSeriEzxvaPdlWfeIi3YMvGvPvcJk4b092OPVRn1cJA1TwsDlpBfLAH/kaVosg/+9zVbgO/Wae/ZqjGCAItNgbp+0Klv4OPAodgAQFv5KBmlP36VkSJ/LrXGj6idTFHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596199196; 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=33WYKKwbqm7tyWR7ZQeAbyiugZFV+VQYG8o2+fd9T2E=; b=Ei70gWPPwwPATqeQl2prMIiLer9qMLUitdSm53G9XZADXRqq8QeZCR5r5tnXgVI5aAFlhUwmg5Dx3W13ACrf5+EJz8LKidfdXxgSshP0p1Huxeiz/dM65489PyNYTuDO9MhRbF+1674is4ytZpbdCeIjBe6kZIkA61GErdH1/P8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1596199196059563.2981741561488; Fri, 31 Jul 2020 05:39:56 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k1UK2-0007US-9P; Fri, 31 Jul 2020 12:39:38 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k1UK1-0007SZ-2z for xen-devel@lists.xenproject.org; Fri, 31 Jul 2020 12:39:37 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e20d8a00-d32a-11ea-abab-12813bfff9fa; Fri, 31 Jul 2020 12:39:32 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k1UJv-0001AE-Ey; Fri, 31 Jul 2020 12:39:31 +0000 Received: from host86-143-223-30.range86-143.btcentralplus.com ([86.143.223.30] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k1UJv-0007EP-7I; Fri, 31 Jul 2020 12:39:31 +0000 X-Inumbo-ID: e20d8a00-d32a-11ea-abab-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=33WYKKwbqm7tyWR7ZQeAbyiugZFV+VQYG8o2+fd9T2E=; b=AT7z8AETk7fkVZqKS7UO+hsCJU fzOgU5vqC5I6LkYpnZZnMSBHqHXb1wseDoos04sKdndp/JBUMB/D02qz9ZCZIsjMBJBaBog5LvWzE dnkSGk/CJrGcfCUyrrtd3iUoaHhbTfS9G3C5eL3zKBx7Ni37p05obmM0coNgCHuJGNS8=; From: Paul Durrant To: xen-devel@lists.xenproject.org Subject: [PATCH v2 2/2] x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt() Date: Fri, 31 Jul 2020 13:39:26 +0100 Message-Id: <20200731123926.28970-3-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200731123926.28970-1-paul@xen.org> References: <20200731123926.28970-1-paul@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Paul Durrant , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Paul Durrant Re-factor the code to take advantage of the fact that the APIC access page = is a 'special' page. Suggested-by: Jan Beulich Signed-off-by: Paul Durrant --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monn=C3=A9" --- xen/arch/x86/hvm/mtrr.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c index 3ad813ed15..0992f05e8f 100644 --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -814,29 +814,22 @@ int epte_get_entry_emt(struct domain *d, unsigned lon= g gfn, mfn_t mfn, return -1; } =20 - if ( direct_mmio ) - { - if ( (mfn_x(mfn) ^ mfn_x(d->arch.hvm.vmx.apic_access_mfn)) >> orde= r ) - return MTRR_TYPE_UNCACHABLE; - if ( order ) - return -1; - *ipat =3D 1; - return MTRR_TYPE_WRBACK; - } - if ( !mfn_valid(mfn) ) { *ipat =3D 1; return MTRR_TYPE_UNCACHABLE; } =20 - if ( (!is_iommu_enabled(d) && !cache_flush_permitted(d)) || + if ( (!direct_mmio && !is_iommu_enabled(d) && !cache_flush_permitted(d= )) || is_special_page(mfn_to_page(mfn)) ) { *ipat =3D 1; return MTRR_TYPE_WRBACK; } =20 + if ( direct_mmio ) + return MTRR_TYPE_UNCACHABLE; + gmtrr_mtype =3D hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order); if ( gmtrr_mtype >=3D 0 ) { --=20 2.20.1