From patchwork Sat Sep 21 10:07:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 174188 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp478658ill; Sat, 21 Sep 2019 03:09:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQk2LAjb+RZra/MM0UiXNZjPAZd9guE3S6DTn7dpC8myeFP9bTBI4aklHMNZmSc7E0YvwK X-Received: by 2002:a5e:c749:: with SMTP id g9mr24368333iop.7.1569060590155; Sat, 21 Sep 2019 03:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569060590; cv=none; d=google.com; s=arc-20160816; b=iG5hc61e6gy1HG7ETxNFn6EEcmtnKDxG5HOP1fp2zbWNT6jA6/qyRXU/FTLcvhC+Ma VxZWgdBLtIujIfJ3ojRdLcEyFFQt5yLhk15qhsDuxtvIxSPZX3C/9nmQIHytQhruHapF MUzLUVvo5r69z805zrYA7oT8VefAYfA1CmsSDFqz31v28uq5VHScuMrev/edL5hcmcpb hwoaAGnmp31ZkdyvCsX+6grVEArIc/fmYm2+tc6Q56xG0PBMNfgkbHjgZZwVxDyWZkFL zaMF6hPhPWBtk/JN/0HFnvdZ31I2Hm2d9XzyHSgtKI4VMO+okoxAIh5aNG2xrDj8cKCt SaMw== 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=TOdFOkrOu5efTzAMfb7hJYM6wCc34o+Z+pER8vw1bc8=; b=1Hs8ikvQRAJK4iD1utdwY5Msls8ErpRLQlftVrdolywToHkr8xNsk6fwzfoZWYT9lB xc2HVcpkMrnA21oq94qF+h9lCGTR8ev9pl02L6WRL3eTWFy7N1kQeZ8jWZTZiTlcqkLI AzMFtRu7LzdQ8u6FvFsBy6rF90capqh9clUKQBUPRksgcXZcmuyMceUbOjTD7NhE0YDx 9g2pUEpW9CGYj4AlijcEAqkuGo9ofwTMm1cCwIUqN47GXU/ZY3qdppAr+Wukvra+oot7 oc0naaIDHar9+2t2kFS9RL4kzXHcZsqG0tex0FK1TvfP21etP7ty0Lavu26wvGBetRsy X8oA== 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 o16si6583619ioo.45.2019.09.21.03.09.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Sep 2019 03:09:50 -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 1iBcJ7-0003iY-M6; Sat, 21 Sep 2019 10:08:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iBcJ6-0003iT-O4 for xen-devel@lists.xenproject.org; Sat, 21 Sep 2019 10:08:00 +0000 X-Inumbo-ID: af5ccd70-dc57-11e9-b76c-bc764e2007e4 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id af5ccd70-dc57-11e9-b76c-bc764e2007e4; Sat, 21 Sep 2019 10:07:57 +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 1E3981000; Sat, 21 Sep 2019 03:07:57 -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 A1BA23F59C; Sat, 21 Sep 2019 03:07:56 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Sat, 21 Sep 2019 11:07:53 +0100 Message-Id: <20190921100753.21347-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [PATCH for-4.13] xen/arm: mm: Clear boot pagetables before bringing-up each secondary CPU 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: Julien Grall MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" At the moment, boot pagetables are only cleared once at boot. This means when booting CPU2 (and onwards) then boot pagetables will not be cleared. To keep the interface exactly the same for all secondary CPU, the boot pagetables are now cleared before bringing-up each secondary CPU. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 1129dc28c8..e14ee76ff8 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -704,8 +704,20 @@ void __init setup_pagetables(unsigned long boot_phys_offset) switch_ttbr(ttbr); - /* Clear the copy of the boot pagetables. Each secondary CPU - * rebuilds these itself (see head.S) */ + xen_pt_enforce_wnx(); + +#ifdef CONFIG_ARM_32 + per_cpu(xen_pgtable, 0) = cpu0_pgtable; + per_cpu(xen_dommap, 0) = cpu0_dommap; +#endif +} + +static void clear_boot_pagetables(void) +{ + /* + * Clear the copy of the boot pagetables. Each secondary CPU + * rebuilds these itself (see head.S) + */ clear_table(boot_pgtable); #ifdef CONFIG_ARM_64 clear_table(boot_first); @@ -713,18 +725,13 @@ void __init setup_pagetables(unsigned long boot_phys_offset) #endif clear_table(boot_second); clear_table(boot_third); - - xen_pt_enforce_wnx(); - -#ifdef CONFIG_ARM_32 - per_cpu(xen_pgtable, 0) = cpu0_pgtable; - per_cpu(xen_dommap, 0) = cpu0_dommap; -#endif } #ifdef CONFIG_ARM_64 int init_secondary_pagetables(int cpu) { + clear_boot_pagetables(); + /* Set init_ttbr for this CPU coming up. All CPus share a single setof * pagetables, but rewrite it each time for consistency with 32 bit. */ init_ttbr = (uintptr_t) xen_pgtable + phys_offset; @@ -767,6 +774,8 @@ int init_secondary_pagetables(int cpu) per_cpu(xen_pgtable, cpu) = first; per_cpu(xen_dommap, cpu) = domheap; + clear_boot_pagetables(); + /* Set init_ttbr for this CPU coming up */ init_ttbr = __pa(first); clean_dcache(init_ttbr);