From patchwork Tue Jun 13 16:13:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105391 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp486429qgd; Tue, 13 Jun 2017 09:15:27 -0700 (PDT) X-Received: by 10.107.6.211 with SMTP id f80mr935323ioi.188.1497370527074; Tue, 13 Jun 2017 09:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497370527; cv=none; d=google.com; s=arc-20160816; b=AHeXKNcKmdjFm6Z0xjoBS+Ewnia0PwtUS3lxk0glM790PVAMCROEH2Coz9ExdJaYnL VzK1mZtRjgLxN+FppVVRaaX6/FosHqtD0J573cDLXsAFsgyYnikwmm3T+vVgIBe6Xi8C MAsxb6KSosW12zqkO6ei8apMheS5z6o93nx5WdIYWDfVPz7w2vWxBOTCjYN247YOSGO6 A19sQDeSXz5mGtGywARA3DJggPmJvRfWnNoWCgRQGHnvl25NY89decB9jMUKUed2mcSp PsUQbhLpsQu7YufjQoOCtayb07FprYnPAg/OwSBZc4ZHwAlfkBV3NGy1aUsDzbxj0fi0 8jbw== 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 :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=//RLEGdqLEh8UJfkioWf2QmgrQgK/ivWXm39AUh2YC0=; b=ccw1qytnp4OuJNZNpjkWpvAhb/xJYAA3/jjNcaOaIQ/UUgFHwPjQVQ6RR1zVgaK1T9 vp8lu1rxejnuwinM2HBVnB6LTPbzEviiDHmWhfA5FH80Lz5gNmgq5uSNrp+TdqtnycIF B+6mI60Kw9SKm7GTNW6Uv1+JP2gqVoca4bMS889dOQZ9BuadWvhwwvIyQ2/jGAaaMiya 15xwt7bxB+2jiDFcdrxkaqlas8Kv+XKK+uregckq0dURWt9MFE8if6endeqqCZQ8cmbN Gpn5cx4rq0hiP3DtErqUbAaj+STGUX8Zm9Ks5PAcn2+VjAFa3Pces1y/54dPqd7/fMiE qRxA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y195si1139554itc.0.2017.06.13.09.15.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 09:15:27 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoRn-00083i-2V; Tue, 13 Jun 2017 16:13:39 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoRl-00081e-OV for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:13:37 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 16/B3-03613-13F00495; Tue, 13 Jun 2017 16:13:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTdeA3yH S4O0jLYslHxezODB6HN39mymAMYo1My8pvyKBNePKoglMBcf5Kh4+Wc7awLiAp4uRi0NIYDOj xLTN81m7GDmBnNOMEqe+u4LYbAKaEnc+f2ICsUUEpCWufb7MCGIzC0RINC3YCxYXFnCR2LWlm wXEZhFQlbg2vw8ozsHBK2ApMXdKMUhYQkBeYlfbRbDxnAJWEpeeNzFCrLKUaN69nmkCI/cCRo ZVjBrFqUVlqUW6RoZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiB3mUAgh2Mf5Y FHGKU5GBSEuX1FLCLFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBa8/nECkkWJSanlqRlpkDDDOY tAQHj5II730WoDRvcUFibnFmOkTqFKOilDjvH16ghABIIqM0D64NFtqXGGWlhHkZgQ4R4ilIL crNLEGVf8UozsGoJMzbwgM0hSczrwRu+iugxUxAi69fsQFZXJKIkJJqYJzmHr//xNP1oVpn4u +JNGgstW5MeNLxuY3DYN/y0PYjths9aiOnOb1gmmDT/8puyYv2sye73y1v2KTM/Gbdzdii3w8 4ZctYxMMja4oCqhJW/HlhvsPhZ1TcGdY66y03OS0XblouYslxXc6iZekfU5HHey/UX/i9paqm /H/Yik0vXGXEDustP6zEUpyRaKjFXFScCAAZ9Y04aAIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1497370416!73580866!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54503 invoked from network); 13 Jun 2017 16:13:36 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-21.messagelabs.com with SMTP; 13 Jun 2017 16:13:36 -0000 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 018AB1596; Tue, 13 Jun 2017 09:13:36 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3D9643F557; Tue, 13 Jun 2017 09:13:35 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:03 +0100 Message-Id: <20170613161323.25196-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613161323.25196-1-julien.grall@arm.com> References: <20170613161323.25196-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, punit.agrawal@arm.com Subject: [Xen-devel] [PATCH 04/24] xen/arm: mm: Introduce clear_table and use it X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Add a new helper clear_table to clear a page table entry and invalidate the cache. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/mm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 082c872c72..b4ff777b55 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -529,6 +529,13 @@ void __init remove_early_mappings(void) extern void relocate_xen(uint64_t ttbr, void *src, void *dst, size_t len); +/* Clear a translation table and clean & invalidate the cache */ +static void clear_table(void *table) +{ + clear_page(table); + clean_and_invalidate_dcache_va_range(table, PAGE_SIZE); +} + /* Boot-time pagetable setup. * Changes here may need matching changes in head.S */ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) @@ -604,18 +611,13 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Clear the copy of the boot pagetables. Each secondary CPU * rebuilds these itself (see head.S) */ - memset(boot_pgtable, 0x0, PAGE_SIZE); - clean_and_invalidate_dcache(boot_pgtable); + clear_table(boot_pgtable); #ifdef CONFIG_ARM_64 - memset(boot_first, 0x0, PAGE_SIZE); - clean_and_invalidate_dcache(boot_first); - memset(boot_first_id, 0x0, PAGE_SIZE); - clean_and_invalidate_dcache(boot_first_id); + clear_table(boot_first); + clear_table(boot_first_id); #endif - memset(boot_second, 0x0, PAGE_SIZE); - clean_and_invalidate_dcache(boot_second); - memset(boot_third, 0x0, PAGE_SIZE); - clean_and_invalidate_dcache(boot_third); + clear_table(boot_second); + clear_table(boot_third); /* Break up the Xen mapping into 4k pages and protect them separately. */ for ( i = 0; i < LPAE_ENTRIES; i++ )