From nobody Fri Apr 26 20:39:34 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1557837147; cv=none; d=zoho.com; s=zohoarc; b=Dqw1hqZcK4vmpInsk5dRQu8XsnrmFgFjnvpBxL4l668YWTZJ4AGmVxFHZc69hbTiZ163IGLZw7Iy6RvpI8NPG/zNX56APDSCvYcScqdqIS/Ya09Ds1s4aIZGnQstyvp3xoZ9OztJToRQrCYtmyy/cINSf+n/3qszrmusVHy/gHU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557837147; 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:ARC-Authentication-Results; bh=636CpUsBf7lH75u4OaPdW//ylanrxAd2Ry/1iH7WNaQ=; b=Mheb9Iwca6WuYQMr2cb6H58d/aaZHrQJbGwmg9GRu56z9gG2pccq4V+qPadQw+dRYHLNQ773yQL1o213aqqbxT8UqfPdPu4eVZ+OmdSoRnrVAnmEBI8IwjrHQ2XNpSITh4Wn05UFMERBR5lox2bWVgIu5ymXLZDnbRszllArQ8g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 1557837147537511.68663898558293; Tue, 14 May 2019 05:32:27 -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 1hQWau-0005O8-91; Tue, 14 May 2019 12:31:44 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hQWat-0005NT-26 for xen-devel@lists.xenproject.org; Tue, 14 May 2019 12:31:43 +0000 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 3a201512-7644-11e9-8980-bc764e045a96; Tue, 14 May 2019 12:31:41 +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 80C1315AB; Tue, 14 May 2019 05:31:41 -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 4CF8D3F71E; Tue, 14 May 2019 05:31:40 -0700 (PDT) X-Inumbo-ID: 3a201512-7644-11e9-8980-bc764e045a96 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 14 May 2019 13:31:20 +0100 Message-Id: <20190514123125.29086-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190514123125.29086-1-julien.grall@arm.com> References: <20190514123125.29086-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH MM-PART3 v2 07/12] xen/arm: mm: Rework xen_pt_update_entry to avoid use xenmap_operation 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , Stefano Stabellini , Andrii Anisov 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" With the newly introduced flags, it is now possible to know how the page will be updated through the flags. All the use of xenmap_operation are now replaced with the flags. At the same time, validity check are now removed as they are gathered in xen_pt_check_entry(). Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov Reviewed-by: Stefano Stabellini --- Changes in v2: - Fix typo in the commit message - Add Andrii's reviewed-by --- xen/arch/arm/mm.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 45a6f9287f..86e1faeeb5 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1067,34 +1067,33 @@ static int xen_pt_update_entry(enum xenmap_operatio= n op, unsigned long addr, if ( !xen_pt_check_entry(*entry, mfn, flags) ) return -EINVAL; =20 - switch ( op ) { - case INSERT: - case RESERVE: - if ( op =3D=3D RESERVE ) - break; + /* If we are only populating page-table, then we are done. */ + if ( flags & _PAGE_POPULATE ) + return 0; + + /* We are removing the page */ + if ( !(flags & _PAGE_PRESENT) ) + memset(&pte, 0x00, sizeof(pte)); + else + { + /* We are inserting a mapping =3D> Create new pte. */ + if ( !mfn_eq(mfn, INVALID_MFN) ) + { pte =3D mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); - pte.pt.ro =3D PAGE_RO_MASK(flags); - pte.pt.xn =3D PAGE_XN_MASK(flags); - BUG_ON(!pte.pt.ro && !pte.pt.xn); + + /* Third level entries set pte.pt.table =3D 1 */ pte.pt.table =3D 1; - write_pte(entry, pte); - break; - case MODIFY: - case REMOVE: - if ( op =3D=3D REMOVE ) - pte.bits =3D 0; - else - { - pte =3D *entry; - pte.pt.ro =3D PAGE_RO_MASK(flags); - pte.pt.xn =3D PAGE_XN_MASK(flags); - } - write_pte(entry, pte); - break; - default: - BUG(); + } + else /* We are updating the permission =3D> Copy the current pte. = */ + pte =3D *entry; + + /* Set permission */ + pte.pt.ro =3D PAGE_RO_MASK(flags); + pte.pt.xn =3D PAGE_XN_MASK(flags); } =20 + write_pte(entry, pte); + return 0; } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel