From nobody Tue Feb 10 17:30:45 2026 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; 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=1584893748; cv=none; d=zohomail.com; s=zohoarc; b=FUutzmk4s95UHxIVYyiwgyjy7K3MovEZvj5sG1MWmS1S2Rb8EFircyfvEziHelYXhacoRbTBocwzEgCcpNEaebbOA56EpGS0JUOewAw9z/flruwr5q1wqvbzPY5j/SmVp97slcePWT4K276IWMKkBEG8mT+Ob7SoNG9/vX+Zark= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584893748; 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=k5m3I8FESwWQ/d/DA9ukcNe3e7KAZ0ArP1Zq5+M/4cU=; b=RuKAbdWaPoo8OAgkGTt1eBLwjSRcyJHep0AuQUZbkDt16WvFzmrNYIwjp+Odhfxw92EXIijTwNdwwoswHSIffgTCxrXkEYSJ63E8n8TGLrdXx82VrmOEz6engmezUjVdnEG6cNzZTV5KKoyqwx12o8F7uE2UbqR1lMPpucOSvjE= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1584893748172769.2224396478485; Sun, 22 Mar 2020 09:15:48 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jG3F6-0004V2-Fk; Sun, 22 Mar 2020 16:14:28 +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 1jG3F5-0004UB-82 for xen-devel@lists.xenproject.org; Sun, 22 Mar 2020 16:14:27 +0000 Received: from mail-ed1-f65.google.com (unknown [209.85.208.65]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 332b1cad-6c58-11ea-8134-12813bfff9fa; Sun, 22 Mar 2020 16:14:26 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id z3so13446365edq.11 for ; Sun, 22 Mar 2020 09:14:26 -0700 (PDT) Received: from ufe34d9ed68d054.ant.amazon.com (54-240-197-235.amazon.com. [54.240.197.235]) by smtp.gmail.com with ESMTPSA id v13sm106693edj.62.2020.03.22.09.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Mar 2020 09:14:25 -0700 (PDT) X-Inumbo-ID: 332b1cad-6c58-11ea-8134-12813bfff9fa X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QU5H42/aI1bJSwJ4GskPiooVWk39PG871znlVQQSh0c=; b=PZxb9wn6BhRKZnPaUCHgRXACr+Rya7vdCizihBQOc+J2XbUhdShgN3AcDwKRQD48Ze C/Ma4UBWtGYMPXxnB/ePDUvn8Qt2GqGgQSLCEHUQ+N7zZjUiePaQbDqOOXsGC9ml4wTo EgETpdeD/IwlX32M05FQt6rGZZ4Azsxafc19PxDzGLp+Qx8NbixNi4NxUTUd+Fiak4rT CHh/CWvMHikAP8vYiiPPx1R8B44l28PC3+csqXqh/Tt1AAQS23UAx0qK+CboCbiHqeSb UVPGa7KVFAhJppI944F87rsFliOuHYaYFdE4izhK/o9slg7n4n4skv9xEt/J6LidjIxl g1Lg== X-Gm-Message-State: ANhLgQ3CXfOvQBAqQqOBda8FvoyVLEs8rwjTy3IrUgvg7hSqvsLUsMBT 5hs14jXXpaX19RU0h4//fbieZW/+XSfwoA== X-Google-Smtp-Source: ADFU+vvnV1cmI//55J09x/ur/fQwaz5bz5rmowQkTLWcZD37tm9EqIKP+5hb6m2VzPeiUeTKURA38w== X-Received: by 2002:a05:6402:4cd:: with SMTP id n13mr17844074edw.240.1584893665706; Sun, 22 Mar 2020 09:14:25 -0700 (PDT) From: julien@xen.org To: xen-devel@lists.xenproject.org Date: Sun, 22 Mar 2020 16:14:03 +0000 Message-Id: <20200322161418.31606-3-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200322161418.31606-1-julien@xen.org> References: <20200322161418.31606-1-julien@xen.org> Subject: [Xen-devel] [PATCH 02/17] xen/x86_64: Convert do_page_walk() 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: julien@xen.org, Wei Liu , Andrew Cooper , Julien Grall , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Julien Grall No functional changes intended. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich --- xen/arch/x86/x86_64/mm.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index b7ce833ffc..3516423bb0 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -46,7 +46,7 @@ l2_pgentry_t *compat_idle_pg_table_l2; =20 void *do_page_walk(struct vcpu *v, unsigned long addr) { - unsigned long mfn =3D pagetable_get_pfn(v->arch.guest_table); + mfn_t mfn =3D pagetable_get_mfn(v->arch.guest_table); l4_pgentry_t l4e, *l4t; l3_pgentry_t l3e, *l3t; l2_pgentry_t l2e, *l2t; @@ -55,7 +55,7 @@ void *do_page_walk(struct vcpu *v, unsigned long addr) if ( !is_pv_vcpu(v) || !is_canonical_address(addr) ) return NULL; =20 - l4t =3D map_domain_page(_mfn(mfn)); + l4t =3D map_domain_page(mfn); l4e =3D l4t[l4_table_offset(addr)]; unmap_domain_page(l4t); if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) ) @@ -64,36 +64,36 @@ void *do_page_walk(struct vcpu *v, unsigned long addr) l3t =3D map_l3t_from_l4e(l4e); l3e =3D l3t[l3_table_offset(addr)]; unmap_domain_page(l3t); - mfn =3D l3e_get_pfn(l3e); - if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || !mfn_valid(_mfn(mfn)) ) + mfn =3D l3e_get_mfn(l3e); + if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || !mfn_valid(mfn) ) return NULL; if ( (l3e_get_flags(l3e) & _PAGE_PSE) ) { - mfn +=3D PFN_DOWN(addr & ((1UL << L3_PAGETABLE_SHIFT) - 1)); + mfn =3D mfn_add(mfn, PFN_DOWN(addr & ((1UL << L3_PAGETABLE_SHIFT) = - 1))); goto ret; } =20 - l2t =3D map_domain_page(_mfn(mfn)); + l2t =3D map_domain_page(mfn); l2e =3D l2t[l2_table_offset(addr)]; unmap_domain_page(l2t); - mfn =3D l2e_get_pfn(l2e); - if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || !mfn_valid(_mfn(mfn)) ) + mfn =3D l2e_get_mfn(l2e); + if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || !mfn_valid(mfn) ) return NULL; if ( (l2e_get_flags(l2e) & _PAGE_PSE) ) { - mfn +=3D PFN_DOWN(addr & ((1UL << L2_PAGETABLE_SHIFT) - 1)); + mfn =3D mfn_add(mfn, PFN_DOWN(addr & ((1UL << L2_PAGETABLE_SHIFT) = - 1))); goto ret; } =20 - l1t =3D map_domain_page(_mfn(mfn)); + l1t =3D map_domain_page(mfn); l1e =3D l1t[l1_table_offset(addr)]; unmap_domain_page(l1t); - mfn =3D l1e_get_pfn(l1e); - if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) || !mfn_valid(_mfn(mfn)) ) + mfn =3D l1e_get_mfn(l1e); + if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) || !mfn_valid(mfn) ) return NULL; =20 ret: - return map_domain_page(_mfn(mfn)) + (addr & ~PAGE_MASK); + return map_domain_page(mfn) + (addr & ~PAGE_MASK); } =20 /* --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel