From patchwork Fri Jun 14 17:51:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 166866 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2351188ilk; Fri, 14 Jun 2019 10:53:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyq/2ltxeEKgdDymJ7Pb6GOG12p285EUahPu0oXV3gMMHClZPUSEpNzFV1ksvp9sF4EcQBT X-Received: by 2002:a02:710f:: with SMTP id n15mr2358547jac.119.1560534809305; Fri, 14 Jun 2019 10:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534809; cv=none; d=google.com; s=arc-20160816; b=Lb7JH0lzN2GFSETCRrRBC/GWkwe0gPVIftnAKDyQCARzcERq9B6VPGMcCNrpXLhCJ9 rwZmdLnVRSP+hFGZ39WSIfZx4KahNczMoV2HswlWgOzm5WOlfutsMvhVm83IxXAAJ/df yuKOp4i3NVHpbzwxdeHmrmJETrA72GjdIZf4/j+qSn/JE2sVm6J+o2fwcqzKrFNOqydI 4REUAnBZUA2aVp2UTmV7cYPatHMkHcsv+sjQ9LjGTBSgG9fpn9UvK1ujx4jY9xQueCCd aJBm1RqyXtfIBLgdEW5CjGyK32GcWo//k6W0XKZCs0yg6GLJeG35krSc3/kWgjh3fgLF SX+g== 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=HYLcYkqpiKKexJCCsOS2Z3CzG0m9BDEYryGleFEV7YA=; b=YpXC5b2kQX+e9obgYmHwv7R8aAeU/5fIL7JlCh7shkGIBv3ErADnal5CVv2+dQaP8J x07McfqIfUOZEbJnsRkn/SGHOg375PWuTiznk28eo+RM+bbhkjkbQbWTDVEvejTXNEvR FzJhkRA4F5LySXNcbaessvpvOhIFXjE8L7fTeDJ2havp6bOSX04BJSd6tN36dV7I24lf SrL8YAn4ImL77e9fuluI46vEujDWFzFFfaCm2DQUKugFgVeWAB2eYrD5TeMrkRkmQWrl acelJHmn4eGfFY34WgCKHotIV8csqKnx1pMcSnEFT5Q4/8JVXsOAXgNMvk7vp2ZlTFat Cw9A== 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 m4si3680972iok.21.2019.06.14.10.53.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Jun 2019 10:53:29 -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 1hbqMq-0001ow-Ac; Fri, 14 Jun 2019 17:52:00 +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 1hbqMo-0001nJ-EK for xen-devel@lists.xenproject.org; Fri, 14 Jun 2019 17:51:58 +0000 X-Inumbo-ID: 18b281da-8ecd-11e9-806d-bbdfc0d74393 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 18b281da-8ecd-11e9-806d-bbdfc0d74393; Fri, 14 Jun 2019 17:51:54 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59628346; Fri, 14 Jun 2019 10:51:54 -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 713AF3F718; Fri, 14 Jun 2019 10:51:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Fri, 14 Jun 2019 18:51:37 +0100 Message-Id: <20190614175144.20046-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190614175144.20046-1-julien.grall@arm.com> References: <20190614175144.20046-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH MM-PART3 v3 2/9] xen/arm: mm: Introduce _PAGE_PRESENT and _PAGE_POPULATE 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 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" At the moment, the flags are not enough to describe what kind of update will done on the VA range. They need to be used in conjunction with the enum xenmap_operation. It would be more convenient to have all the information for the update in a single place. Two new flags are added to remove the relience on xenmap_operation: - _PAGE_PRESENT: Indicate whether we are adding/removing the mapping - _PAGE_POPULATE: Indicate whether we only populate page-tables Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov Reviewed-by: Stefano Stabellini --- Changes in v3: - Clarify the description of the new flags Changes in v2: - Add Andrii's reviewed-by --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/page.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 23e9565ddc..b13d9adf40 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1056,7 +1056,7 @@ int map_pages_to_xen(unsigned long virt, int populate_pt_range(unsigned long virt, unsigned long nr_mfns) { - return xen_pt_update(RESERVE, virt, INVALID_MFN, nr_mfns, 0); + return xen_pt_update(RESERVE, virt, INVALID_MFN, nr_mfns, _PAGE_POPULATE); } int destroy_xen_mappings(unsigned long v, unsigned long e) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 2bcdb0f1a5..37e1d9aadb 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -76,6 +76,8 @@ * * [0:2] Memory Attribute Index * [3:4] Permission flags + * [5] Page present + * [6] Only populate page tables */ #define PAGE_AI_MASK(x) ((x) & 0x7U) @@ -86,12 +88,15 @@ #define PAGE_XN_MASK(x) (((x) >> _PAGE_XN_BIT) & 0x1U) #define PAGE_RO_MASK(x) (((x) >> _PAGE_RO_BIT) & 0x1U) +#define _PAGE_PRESENT (1U << 5) +#define _PAGE_POPULATE (1U << 6) + /* * _PAGE_DEVICE and _PAGE_NORMAL are convenience defines. They are not * meant to be used outside of this header. */ -#define _PAGE_DEVICE _PAGE_XN -#define _PAGE_NORMAL MT_NORMAL +#define _PAGE_DEVICE (_PAGE_XN|_PAGE_PRESENT) +#define _PAGE_NORMAL (MT_NORMAL|_PAGE_PRESENT) #define PAGE_HYPERVISOR_RO (_PAGE_NORMAL|_PAGE_RO|_PAGE_XN) #define PAGE_HYPERVISOR_RX (_PAGE_NORMAL|_PAGE_RO)