From patchwork Mon Jun 3 16:03:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 165666 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4660602ili; Mon, 3 Jun 2019 09:05:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpUcY2KhmjFOVCCo+RCrVgtRs00GVzPlnjrDxxgJ1OGIjN5bIc/xIL4kupUbbOAX8JM6Su X-Received: by 2002:a6b:7312:: with SMTP id e18mr15097836ioh.156.1559577933760; Mon, 03 Jun 2019 09:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577933; cv=none; d=google.com; s=arc-20160816; b=fgDWQNzSgS6/CTLUns/BOqQuAKLOG+YM4XyO507oAp26f2/wTXWWnOwq3+CBhkVW79 rC4GCFJ/c+N9vt4GOvnlpDwmD+6GKk0PwJqVOCfjNTH0o7mZ8zYap69VZUO0eQKszjBx GnjTTC/2WxZG3Ls1+z15xg6Q8lLgQY7sPPkL+IYPlXLh/fIl3UWASYrU3HnNNsQv4Xxp zRMojYUx7hMPqGXAl1oeuTgs093/ieej1JuEWq5dbLR1U7bkl7VhaRuSysvePnRjJdxe AKDAVzFCmUuQyjU/mcRrK5RV8qR5Dlg0YlXfLQKJElbpltq6lt06Gt6Lp+OOkONQg7NT pEDA== 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=9I6SG1Dz3HCvviVDoowGPpTpX8L5XhdKvTHABn47KpA=; b=uoNWslhFFDSnwQd7qy+tHF6nwH/gLGpSrw14fTVTe3Lcxiv7268ubipMR7c7rt0Xzy cPaZz7VAZ2Rdwqc0j3++tUFYJE22zUJ4oqsqrBSSBv+Ppk2QkjPYFm3A8PCc84vxqiVW 3/uGCehPYN5toKJgEmp/TI29VpInIw3BzwSHUfTFOTBumhhiNw2QCcwfFa899L+GWwOX dSuOVP4YTKCsejNoTbJdpUxW4P1mtw/RszNzS3RQy4s4mV8wXPgBmX7DpOW67tWc5HWt WHuaQ++RAOWNw7p4DgOEl1I1A293D0lq/YfU0YczHkMl3/Uq7ENSc95jnYQIaM+8kT0W YIvA== 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 81si9169164itm.63.2019.06.03.09.05.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 09:05:33 -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 1hXpRT-0001xO-91; Mon, 03 Jun 2019 16:04:11 +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.89) (envelope-from ) id 1hXpRS-0001wq-D7 for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 16:04:10 +0000 X-Inumbo-ID: 3886b10a-8619-11e9-892c-875838fe41ea Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 3886b10a-8619-11e9-892c-875838fe41ea; Mon, 03 Jun 2019 16:04:09 +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 0929515AB; Mon, 3 Jun 2019 09:04:09 -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 A268F3F246; Mon, 3 Jun 2019 09:04:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 3 Jun 2019 17:03:41 +0100 Message-Id: <20190603160350.29806-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190603160350.29806-1-julien.grall@arm.com> References: <20190603160350.29806-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 05/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 , George Dunlap , 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 v3: - Add George's reviewed-by 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 7075e084b4..71e24dbb2d 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1572,7 +1572,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 c72e329506..0d954e1bd8 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 */