From patchwork Mon Jul 22 21:39:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169459 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8013558ilk; Mon, 22 Jul 2019 14:42:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/Vjby1X4+8RRJK/Zw57KJbKTcJpIRaKNSbpnbLhIKYzzNXcgPoTIFdvmdtEQ+F+DIPfWw X-Received: by 2002:a5d:9e48:: with SMTP id i8mr66096294ioi.51.1563831694869; Mon, 22 Jul 2019 14:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831694; cv=none; d=google.com; s=arc-20160816; b=je23yvsiKi63bPfpSUnnlE9rVW1kaIztzL2qYiANSzl9OKWs/fqDGkfW6dEHgHm3xd rH80qsi6Ff7k8q0MZcOD6G4DDHYKUfx/Wvu7UuC32vpXulgC8r1irtiX8xgubO+5UsEX Gjowz7RrH08Cq6xmIlRQr29Mi3xTiTc4vv3s2/QO+V/UdOkXt6L4ViHOXYp18CfHxoYb D8DzQ8nd0UM6pz1Ri83cpr10H7hE5DLYIIWJIAynaOiAu7RkQ6CRpC8suSE1WjHGYuf4 XZ7SSamjsi0wE11ZFK5AMiSYJic2pohsF+cf52X38jvUYYQX0JKZQSExwJVbmAi/L+3O DzSA== 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=Kzgd7xiUPhBTRWeugLwR+XXEPeEp1zdQoHhtO+DS2Q4=; b=AI5uOHOIYH6hYqYbgILak7xS3XvmeKJ8I+IU6AVcGzBX5bU7/AT4979veLC7Fo+Tnr YB83F3D+hHBoUBtpWAL7R+MpJSVTQx/Wgz6pn1HwujI+awhJ6gh9r2cg5vs/jtbgW00G IpDIidCRdVrwzO9PC1GunSao8oFsi97rzEhJXeFpMZ6DFihfd8jSepLRiIkfHUVCnjmH TtR3lUEb7j9vga8aKSNyfkQJVylj4FMEiLfV3Pi+pdkx8FOI3NVQEfaoIzHruDNqWayx pdR79J7/S9ftSrDInzcdyf44Y1bXec5pbFP2I5mKglv3YZJ/eDgkPno7DqZ3kWLW9OKR 9K7Q== 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 z11si61660626ioj.48.2019.07.22.14.41.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:34 -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 1hpg2d-0002bI-Eb; Mon, 22 Jul 2019 21:40:19 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2b-0002Xx-Lu for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:17 +0000 X-Inumbo-ID: 4b71e531-acc9-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 4b71e531-acc9-11e9-8980-bc764e045a96; Mon, 22 Jul 2019 21:40:16 +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 7DA151509; Mon, 22 Jul 2019 14:40:16 -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 CB7A33F71F; Mon, 22 Jul 2019 14:40:15 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:35 +0100 Message-Id: <20190722213958.5761-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190722213958.5761-1-julien.grall@arm.com> References: <20190722213958.5761-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v2 12/35] xen/arm64: head: Move assembly switch to the runtime PT in secondary CPUs path 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" The assembly switch to the runtime PT is only necessary for the secondary CPUs. So move the code in the secondary CPUs path. While this is definitely not compliant with the Arm Arm as we are switching between two differents set of page-tables without turning off the MMU. Turning off the MMU is impossible here as the ID map may clash with other mappings in the runtime page-tables. This will require more rework to avoid the problem. So for now add a TODO in the code. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2 - Add Stefano's acked-by --- xen/arch/arm/arm64/head.S | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 63563ef5e3..4ce4895a0d 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -344,6 +344,23 @@ GLOBAL(init_secondary) br x0 secondary_switched: bl setup_fixmap + + /* + * Non-boot CPUs need to move on to the proper pagetables, which were + * setup in init_secondary_pagetables. + * + * XXX: This is not compliant with the Arm Arm. + */ + ldr x4, =init_ttbr /* VA of TTBR0_EL2 stashed by CPU 0 */ + ldr x4, [x4] /* Actual value */ + dsb sy + msr TTBR0_EL2, x4 + dsb sy + isb + tlbi alle2 + dsb sy /* Ensure completion of TLB flush */ + isb + b launch ENDPROC(init_secondary) @@ -650,23 +667,6 @@ ENDPROC(setup_fixmap) launch: PRINT("- Ready -\r\n") - /* The boot CPU should go straight into C now */ - cbz x22, 1f - - /* Non-boot CPUs need to move on to the proper pagetables, which were - * setup in init_secondary_pagetables. */ - - ldr x4, =init_ttbr /* VA of TTBR0_EL2 stashed by CPU 0 */ - ldr x4, [x4] /* Actual value */ - dsb sy - msr TTBR0_EL2, x4 - dsb sy - isb - tlbi alle2 - dsb sy /* Ensure completion of TLB flush */ - isb - -1: ldr x0, =init_data add x0, x0, #INITINFO_stack /* Find the boot-time stack */ ldr x0, [x0]