From patchwork Wed Apr 24 16:59:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162792 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp895679jan; Wed, 24 Apr 2019 10:01:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCz+BWV0gKUCGSWtgkNfXpK+49zMjm8K1BbcyYZPxNRSr+Z6O3YRByXYjBKYn6GW6FnRdQ X-Received: by 2002:a81:a60b:: with SMTP id d11mr28784844ywh.251.1556125313592; Wed, 24 Apr 2019 10:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556125313; cv=none; d=google.com; s=arc-20160816; b=n/RNXrs0eWKdlaGeuqJwRjzJRy3ZUcRJGmgO9HM25rKPZtAw6vrfVuT3foO84aewud 2jAl6ttRW54DZQKc5hgMjSIdeulVj2SAc4YB60vAtIK8IWYmD6XD6ALpMlwoNH0UoGY1 vtBTTO8MgJ85SFz6Ms62j7eLNaexA+35x9+V1Gj/cKB+tsiPRVNlmO3POBMn8jlfChwS N2FlW+QhljhTHgeBnlZfySBvFG2deS1ROTm4LYxFD+v8bk2VNpiqT98XDI6I55iGKGL/ T88t5pwo9Hn8j3ull/1t/87I4LkR48U1RNqjPwBJPXjXgmd1qhqIFuKzYy0v4s5gREO0 +v2A== 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=LpnIUsiNfWwPWKoaae1YH4QsdYC0swy4OnB3z1iHi1M=; b=t/ytNe0bvQ7xjtNkBB7HyIBHTqISWO6bmLECrzSAU0BwWXpYEOzXJTpJVX+p8cPxT1 kcl7qyUtFI6nIvGfBF1litGsQl6XZEQvxJofevJSOO5TD9dJv0tZVdHxsjoppQPE4mUr 5L0S8s4bwhn8PDfo7hKPGfL1q70hRgg7dAQY+ta1YEeqddtzIrEdVhbvsKyzvPuicsog fgkZ/2gKuuU1tdkE+AGfMOrJhWXikCI/LvuA5iiyo2UNgSe4hMigzkN4apLOIkfDrr+p gJP8GiosgW/E17rBJYRWq5o2WHVdImR7Dvjr9UR010yd+iaTW3ltXCnYHNqNzs3vQYVz 1hiQ== 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 o4si13515233ybp.283.2019.04.24.10.01.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 10:01:53 -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 1hJLFk-0007nS-Ux; Wed, 24 Apr 2019 17:00:12 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hJLFj-0007nC-8v for xen-devel@lists.xenproject.org; Wed, 24 Apr 2019 17:00:11 +0000 X-Inumbo-ID: 6b529442-66b2-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 6b529442-66b2-11e9-92d7-bc764e045a96; Wed, 24 Apr 2019 17:00:10 +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 F363AEBD; Wed, 24 Apr 2019 10:00:09 -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 D87713F557; Wed, 24 Apr 2019 10:00:08 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 24 Apr 2019 17:59:47 +0100 Message-Id: <20190424165955.23718-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190424165955.23718-1-julien.grall@arm.com> References: <20190424165955.23718-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 04/12] 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 , sstabellini@kernel.org, Andrii_Anisov@epam.com 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 --- 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 6b1d41cfba..b61217abd0 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1075,7 +1075,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..caf2fac1ff 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] Present bit + * [6] Populate page table */ #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)