From nobody Fri Apr 26 15:11:05 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=1557837151; cv=none; d=zoho.com; s=zohoarc; b=UKQF5uIvVbxGXGuHoBJ7Nm3YU/IERz6ZQEOug0+lhtyIFqj10y21O2ttqwf8oKVmh6xRSqrOXEwFxsZah4H/fvx6mShfpW0kEn1lvibBJjuS26nQRIMIDx0cEqEcynDFo1NBXVGZ4KTC4ymvjcCl3KCTo7uOgCbxUE7uY9h7lzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557837151; 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=q/5fO5w8i5zfDMpa1uLC2hOGVREryTjNX266uOdlSzI=; b=OKzCUe1YxxdlHcTD94H/S+llPiorIKGE2i5gvS+nDygz5CLKV9xFSwC/HUQbatKTeuH8cf8EqGKCOMo8s3AGDF6OIIrXMWpSejb7FpApUedd0a9g3wlodm/zeOrrh18prWEhyJwuBxdjQRK9K2XCxZ0p+p3nBelgG4/I8MsNpZY= 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 1557837151004152.62759946482674; Tue, 14 May 2019 05:32:31 -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 1hQWb0-0005Vt-3w; Tue, 14 May 2019 12:31:50 +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 1hQWay-0005U8-LN for xen-devel@lists.xenproject.org; Tue, 14 May 2019 12:31:48 +0000 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 3dba290c-7644-11e9-8b9c-93296919fc85; Tue, 14 May 2019 12:31:47 +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 5E11C341; Tue, 14 May 2019 05:31:47 -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 2ACDC3F71E; Tue, 14 May 2019 05:31:46 -0700 (PDT) X-Inumbo-ID: 3dba290c-7644-11e9-8b9c-93296919fc85 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 14 May 2019 13:31:24 +0100 Message-Id: <20190514123125.29086-12-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 11/12] xen/arm: mm: Don't open-code Xen PT update in {set, clear}_fixmap() 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" {set, clear}_fixmap() are currently open-coding update to the Xen page-tables. This can be avoided by using the generic helpers map_pages_to_xen() and destroy_xen_mappings(). Both function are not meant to fail for fixmap, hence the BUG_ON() checking the return. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- Changes in v2: - Add Andrii's reviewed-by --- xen/arch/arm/mm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 9a40754f44..23ca61e8f0 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -348,19 +348,19 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsi= gned attr) /* Map a 4k page in a fixmap entry */ void set_fixmap(unsigned map, mfn_t mfn, unsigned int flags) { - lpae_t pte =3D mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); - pte.pt.table =3D 1; /* 4k mappings always have this bit set */ - pte.pt.xn =3D 1; - write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte); - flush_xen_tlb_range_va(FIXMAP_ADDR(map), PAGE_SIZE); + int res; + + res =3D map_pages_to_xen(FIXMAP_ADDR(map), mfn, 1, flags); + BUG_ON(res !=3D 0); } =20 /* Remove a mapping from a fixmap entry */ void clear_fixmap(unsigned map) { - lpae_t pte =3D {0}; - write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte); - flush_xen_tlb_range_va(FIXMAP_ADDR(map), PAGE_SIZE); + int res; + + res =3D destroy_xen_mappings(FIXMAP_ADDR(map), FIXMAP_ADDR(map) + PAGE= _SIZE); + BUG_ON(res !=3D 0); } =20 /* Create Xen's mappings of memory. --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel