From patchwork Tue May 7 15:14:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 163540 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp3883178oca; Tue, 7 May 2019 08:16:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTBF7xQrfn3vkXoEl1y7N9NwXM6jbqDHeYyegxxzQUOpaAKl7T/Dh5mFTgErSyOenk5Pon X-Received: by 2002:a02:3342:: with SMTP id k2mr21789621jak.15.1557242211621; Tue, 07 May 2019 08:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557242211; cv=none; d=google.com; s=arc-20160816; b=O5Lk3khDjjBzMk4i96WA/OiOv2LFw/Xh8RGTGhnGBQYuqze70dsJhTBtKGHTChqFzv Ud79ujg3cWjd4wc//q3TISALcl6B69j1LPtvr7mhZANqEbQmWk2qEu790llVWhRGB4As N+WWYh2Q5TkttS/gvk6P8iUYUN9wBHIMEYSxRXJfvH1HKmlmTVWdpLKGDQH9grajCzwq WhztL1NbwFups+jaeEMINKQTBFeLyyhkHOamQuPt1rcCD/VuWvRcEfYEq+OMQ28VfoLU sV+eZbjts4HmhglcEuslzOYIN0OUCwL8+q2sddzH0nryXhcqbli6V6e9R9SJh+zbIkS3 1pYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=2dyr9eAQpdHVeXG+OlaeiKcumRIFOcnZQiA32I1R9XM=; b=Qo55JYYwP8hFVnFSTyddUmHiBHQXeOchdnAyuIY+PR3ANZCDlD3l7iYw2VQcu2bPKU Y4lbQx8QrSDnqUp9HOQR1famwMc5ki1lNQ2R6n1w6NYFa98Q3halSFptcAHzukmIl3rM 54XXrWxN4sxoI8dj/VahyocHGwtrg0AutaF6F/R/K3/XUwPdDTBUzjoIqOfh6CMemePB 0AGYe/7YxaKiVVFIbxwOUo4EwxnTLCYSHNU2Y3s8okygktj4uGb35Kg71ZoE9dVkUkBi vLkLptu5eccBgS8BqYzTaITaO7aAL7ZWgN1Pr0YAOFMnSbRxAufck8PULxqWXTJaVIfV S4KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@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.google.com with ESMTPS id y199si7297451itc.65.2019.05.07.08.16.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 May 2019 08:16:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1hO1oT-0007OC-5Z; Tue, 07 May 2019 15:15:25 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hO1oS-0007NN-IZ for xen-devel@lists.xenproject.org; Tue, 07 May 2019 15:15:24 +0000 X-Inumbo-ID: ef840d39-70da-11e9-843c-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id ef840d39-70da-11e9-843c-bc764e045a96; Tue, 07 May 2019 15:15:23 +0000 (UTC) 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 63E2F15AD; Tue, 7 May 2019 08:15:23 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C5923F5AF; Tue, 7 May 2019 08:15:21 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 7 May 2019 16:14:51 +0100 Message-Id: <20190507151458.29350-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190507151458.29350-1-julien.grall@arm.com> References: <20190507151458.29350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 07/14] xen: Convert is_xen_fixed_mfn to use typesafe MFN 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: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Shane Wang , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper , Gang Wei , =?utf-8?q?Roger_Pau_Monn=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" No functional changes. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich Acked-by: Stefano Stabellini Reviewed-by: George Dunlap --- Changes in v2: - Add Jan's reviewed-by - Add Stefano's acked-by --- xen/arch/x86/tboot.c | 2 +- xen/common/page_alloc.c | 2 +- xen/include/asm-arm/mm.h | 4 ++-- xen/include/asm-x86/mm.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c index f3fdee4d39..30d159cc62 100644 --- a/xen/arch/x86/tboot.c +++ b/xen/arch/x86/tboot.c @@ -280,7 +280,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE], if ( !mfn_valid(_mfn(mfn)) ) continue; - if ( is_xen_fixed_mfn(mfn) ) + if ( is_xen_fixed_mfn(_mfn(mfn)) ) continue; /* skip Xen */ if ( (mfn >= PFN_DOWN(g_tboot_shared->tboot_base - 3 * PAGE_SIZE)) && (mfn < PFN_UP(g_tboot_shared->tboot_base diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index f445f7daec..b4067ae202 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1584,7 +1584,7 @@ int offline_page(mfn_t mfn, int broken, uint32_t *status) *status = 0; pg = mfn_to_page(mfn); - if ( is_xen_fixed_mfn(mfn_x(mfn)) ) + if ( is_xen_fixed_mfn(mfn) ) { *status = PG_OFFLINE_XENPAGE | PG_OFFLINE_FAILED | (DOMID_XEN << PG_OFFLINE_OWNER_SHIFT); diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 7b6aaf5e3f..b56018aace 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -151,8 +151,8 @@ extern vaddr_t xenheap_virt_start; #endif #define is_xen_fixed_mfn(mfn) \ - ((pfn_to_paddr(mfn) >= virt_to_maddr(&_start)) && \ - (pfn_to_paddr(mfn) <= virt_to_maddr(&_end))) + ((mfn_to_maddr(mfn) >= virt_to_maddr(&_start)) && \ + (mfn_to_maddr(mfn) <= virt_to_maddr(&_end))) #define page_get_owner(_p) (_p)->v.inuse.domain #define page_set_owner(_p,_d) ((_p)->v.inuse.domain = (_d)) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index 6faa563167..f124f57964 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -280,8 +280,8 @@ struct page_info #define is_xen_heap_mfn(mfn) \ (__mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(_mfn(mfn)))) #define is_xen_fixed_mfn(mfn) \ - ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) && \ - (((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end))) + (((mfn_to_maddr(mfn)) >= __pa(&_stext)) && \ + ((mfn_to_maddr(mfn)) <= __pa(&__2M_rwdata_end))) #define PRtype_info "016lx"/* should only be used for printk's */