From patchwork Tue Jul 12 13:59:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 71842 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp492903qga; Tue, 12 Jul 2016 07:03:40 -0700 (PDT) X-Received: by 10.36.41.16 with SMTP id p16mr3252567itp.60.1468332213457; Tue, 12 Jul 2016 07:03:33 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id d139si1989520itd.48.2016.07.12.07.03.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 07:03:33 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMyE5-00076g-CV; Tue, 12 Jul 2016 13:59:53 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMyE4-000765-8r for xen-devel@lists.xen.org; Tue, 12 Jul 2016 13:59:52 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id B6/66-11548-7D7F4875; Tue, 12 Jul 2016 13:59:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTff695Z wg2fr+S2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozFE76wFxzgrdi1M6KB8SlXFyMXh5DAJkaJ c/uWsHYxcgI5pxklri+pAbHZBDQl7nz+xARiiwhIS1z7fJkRpIFZ4BijxOe5p9hBEsIC4RLzD nxgBrFZBFQlHt5fBBbnFXCRuDH5OZgtISAncfLYZLAFnAKuEl+nn2SEWOYicWHZV9YJjNwLGB lWMaoXpxaVpRbpGuklFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgR6lwEIdjAu++t 0iFGSg0lJlLeZuSVciC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvuW9AOcGi1PTUirTMHGCYwaQl OHiURHhfg6R5iwsSc4sz0yFSpxgVpcR5J4AkBEASGaV5cG2w0L7EKCslzMsIdIgQT0FqUW5mC ar8K0ZxDkYlYd5fIFN4MvNK4Ka/AlrMBLS41qEZZHFJIkJKqoEx1P7ApxUvC86c/CNZekSgbc 6vSO6Jlx5xmbR3Nt5+eWDul9ULb+ipPv+3eFvbnEorQell1Y6XD665/kX0f/yjshtHPifG8e/ 3bO5sOX4i3ffJh06/REN+Gxmhsm+3C9OezLW10XdgisrXSDnP+Wrh1GfSN/tfVew1/uGxaIPp 5W97HvsoW0/tVmIpzkg01GIuKk4EAPJOogJoAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1468331990!23426262!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25314 invoked from network); 12 Jul 2016 13:59:51 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-9.tower-21.messagelabs.com with SMTP; 12 Jul 2016 13:59:51 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45FA643E; Tue, 12 Jul 2016 07:00:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 536E43F213; Tue, 12 Jul 2016 06:59:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Jul 2016 14:59:23 +0100 Message-Id: <1468331975-27331-3-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468331975-27331-1-git-send-email-julien.grall@arm.com> References: <1468331975-27331-1-git-send-email-julien.grall@arm.com> Cc: Andrew Cooper , Julien Grall , sstabellini@kernel.org, Suravee Suthikulpanit , Jan Beulich Subject: [Xen-devel] [PATCH v7 02/14] xen/passthrough: x86: Use INVALID_GFN rather than INVALID_MFN 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" A variable containing a guest frame should be compared to INVALID_GFN and not INVALID_MFN. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich Reviewed-by: Andrew Cooper --- Cc: Suravee Suthikulpanit Changes in v6: - Fix typo in the commit message - Add Andrew's and Jan' reviewed-by Changes in v5: - Patch added --- xen/drivers/passthrough/amd/iommu_map.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index 1b914ba..c758459 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -555,7 +555,7 @@ static int update_paging_mode(struct domain *d, unsigned long gfn) unsigned long old_root_mfn; struct domain_iommu *hd = dom_iommu(d); - if ( gfn == INVALID_MFN ) + if ( gfn == INVALID_GFN ) return -EADDRNOTAVAIL; ASSERT(!(gfn >> DEFAULT_DOMAIN_ADDRESS_WIDTH)); diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index a18a608..cd435d7 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -61,7 +61,7 @@ int arch_iommu_populate_page_table(struct domain *d) unsigned long mfn = page_to_mfn(page); unsigned long gfn = mfn_to_gmfn(d, mfn); - if ( gfn != INVALID_MFN ) + if ( gfn != INVALID_GFN ) { ASSERT(!(gfn >> DEFAULT_DOMAIN_ADDRESS_WIDTH)); BUG_ON(SHARED_M2P(gfn));