From patchwork Sat Sep 21 10:08:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 174189 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp479201ill; Sat, 21 Sep 2019 03:10:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhvZLBCZxmO7n3SZNaGN0dUdKuOChH4x/RqdXCrDOgSaSBnTBVA2B+2khd/UnDj3XVGbzT X-Received: by 2002:a02:3785:: with SMTP id r127mr24814688jar.40.1569060624071; Sat, 21 Sep 2019 03:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569060624; cv=none; d=google.com; s=arc-20160816; b=p07VQiu+dtcceueVcYTiVaF8z5Qj02EaMRytRzutX10z6giNpQRZAVJVDQXat81+d1 QUc8kv29zWzp3RQWiCZTpBp26vehc8xwms/ggf3WB5tTwO9aazAqr//QMf/I1uT/yKXV yV06pilYF0bM2SC4e5ud9D51SPW95QlB8Tvhj+DLcSf/o+sG5CxC95pRFLDIhmuhYjHN ze6toV912FkooFGJ96ZJ4xlCr0RfV25VPLuZ0Yo3KVM1Z3zdsMgExb9MREXh6MYrBmNJ CdJmZ/5/ohTnSC11kv78+e97bBIQWH2OiD89K6d/jSbRG5zy0K0L2qtL40u78rJ+aDjk vXpg== 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=L4I7LyLpJLGOz89PA8qU6nTfj1ojJowU4HGkhFsBUN8tkvR4nbVM65PCHGwL9faus5 6pFo62Pef8G0686omrNpg7Uul1hgfrfZ3WTr8LbgVBsgB+C6wu2dIUxWqD6QKSE8Q4jA zs2LNKxrw/VoT2V7q+AZXJLuffM7hnocwUf2KbH2UjPeBiSIGEP03Sbsp5zi75c1XEWA jrHCGHjwklk/cA6YCxfmmQwQPRzz6aHvsoyN42Xs6QDZtW+C8l5dQYMn5KcFQKhcRxZ6 ZW3vN5LT84uMh5kimse0KFWZQvJvi+aJxsaRJ9p7bn8o10FO4rPR59w3x4agC6de3XCc C1Ww== 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 b9si7608189ioc.125.2019.09.21.03.10.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Sep 2019 03:10:24 -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 1iBcJw-0003rl-1A; Sat, 21 Sep 2019 10:08:52 +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 1iBcJu-0003re-5G for xen-devel@lists.xenproject.org; Sat, 21 Sep 2019 10:08:50 +0000 X-Inumbo-ID: cd9802e6-dc57-11e9-95b8-12813bfff9fa Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id cd9802e6-dc57-11e9-95b8-12813bfff9fa; Sat, 21 Sep 2019 10:08:48 +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 DFDDE1000; Sat, 21 Sep 2019 03:08:47 -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 39FC13F59C; Sat, 21 Sep 2019 03:08:47 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Sat, 21 Sep 2019 11:08:36 +0100 Message-Id: <20190921100836.21396-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [RESEND][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 , Stefano Stabellini , Volodymyr Babchuk 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 Reviewed-by: Volodymyr Babchuk Reviewed-by: Stefano Stabellini --- 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);