From patchwork Wed Apr 24 16:59:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162786 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp895637jan; Wed, 24 Apr 2019 10:01:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+tl6OreWxgzQ1KNbZmLN9dvm+mFS9BN8zfWSgPWrJxChmRCMQ/Q0alwUJcvHDgVC4jRxb X-Received: by 2002:a0d:c3c2:: with SMTP id f185mr486493ywd.317.1556125311705; Wed, 24 Apr 2019 10:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556125311; cv=none; d=google.com; s=arc-20160816; b=qMjt2OYkuSomvm2XBJBLONrklHRKigSm5+HloH9/fEb0i/ye1EvIoqsFtKG/4qSpg0 eFQ/RH2kl2GmHGgxfQy4RlbjdUhvBNRUPcU1LSPHn/5FIC1eyyDwG/I0XcEtllly3edq msNO8gSzXZwh3YYGhztbU6K9OhtiOpBkWSOZPdHU6v3qw7I8IWffBixCr9Dp9pcTF21K c8HSKtjd9DcQnV5F5k4Oo45J/GiJ+uhoPg8+5r3f0ISs4AOtD0OBoZre4Ma0yUSfVGUr jrm19oqqtxYppfagmIXE11Ds3aibu8EHIkOmll5LoBwOP12GEMD8EvoZ8pufbLX6CGuA vYRQ== 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:message-id:date:to:from; bh=4g774i2kqq7bD6QkBcrbFvovcdCRHx48pDphS5rW4Xg=; b=LAfpYM9b8O6xepgTFkjZDoITnh/3M6rNOdmB+1drhPtzK3pHNs1IRkdzgsVcmaB7QQ 44dIhTGFrlNa/NolpiPXLVhEPVbkh3pEyv4++6uNjJyZf1Iwt7mlhsXbWgK1U2yoxJtt TE9poq8C5MYyoz5g1fzVVuz+sHYe7Bth122OWIbmmR6dLGyyQ3cx6XN2nTMepNVQycQG GPsqAdnOfkcgBop6CJNHLrKqAuj1tH0KoWOfE282KI+oU/UyVnsltRPe3ypsccc0tjES zyxXZj/2OFdTK/TaF00tjv4Bp3EK8shVDfDivRyPZrmwQUVtY11tikIMPnf+XUrePQAD f6vA== 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 62si6733075ybv.420.2019.04.24.10.01.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 10:01: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 1hJLFf-0007mk-Rd; Wed, 24 Apr 2019 17:00:07 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hJLFe-0007hF-Jq for xen-devel@lists.xenproject.org; Wed, 24 Apr 2019 17:00:06 +0000 X-Inumbo-ID: 67f92802-66b2-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 67f92802-66b2-11e9-92d7-bc764e045a96; Wed, 24 Apr 2019 17:00:04 +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 7332D374; Wed, 24 Apr 2019 10:00:04 -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 579883F557; Wed, 24 Apr 2019 10:00:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 24 Apr 2019 17:59:43 +0100 Message-Id: <20190424165955.23718-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [PATCH 00/12] xen/arm: Provide a generic function to update Xen PT 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 , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hi all, This is the third part of the boot/memory rework for Xen on Arm. At the moment, the update to Xen PT is scattered all around mm.c. This makes difficult to rework Xen memory layout or even ensuring we are following the Arm Arm properly (and we are not so far!). This part contains code to provide a generic function to update Xen PT. While I could have started from scratch, I decided to base the new function on create_xen_entries() (now renamed xen_pt_update()). This makes slightly easier to follow the changes. In this series, the new generic function will only support 3rd-level update and cannot be used in early boot (i.e because xenheap is initialized). This will be extended in follow-up patch to allow more use within mm.c. There are probably some optimization possible around the TLBs flush. I haven't looked at it so far. The last two patches of this series is to show how existing callers can be converted. There are more conversion to come in follow-up series. Cheers, Julien Grall (12): xen/arm: lpae: Add a macro to generate offsets from an address xen/arm: mm: Rename create_xen_entries() to xen_pt_update() xen/arm: mm: Move out of xen_pt_update() the logic to update an entry xen/arm: mm: Introduce _PAGE_PRESENT and _PAGE_POPULATE xen/arm: mm: Only increment mfn when valid in xen_pt_update xen/arm: mm: Sanity check any update of Xen page tables xen/arm: mm: Rework xen_pt_update_entry to avoid use xenmap_operation xen/arm: mm: Remove enum xenmap_operation xen/arm: mm: Use {, un}map_domain_page() to map/unmap Xen page-tables xen/arm: mm: Rework Xen page-tables walk during update xen/arm: mm: Don't open-code Xen PT update in {set, clear}_fixmap() xen/arm: mm: Remove set_pte_flags_on_range() xen/arch/arm/mm.c | 421 ++++++++++++++++++++++++++++++--------------- xen/arch/arm/p2m.c | 23 +-- xen/include/asm-arm/lpae.h | 9 + xen/include/asm-arm/page.h | 9 +- 4 files changed, 305 insertions(+), 157 deletions(-)