From patchwork Mon Dec 16 11:08:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 181688 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp4174201och; Mon, 16 Dec 2019 03:26:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzOGgBGwO4Qe8Kbyu2L51c4TbKg7tU8wweb4dpEh0TsFQLjQtYuxOzoMPnF/NHhk5b0/pH2 X-Received: by 2002:aed:3c5b:: with SMTP id u27mr24261233qte.287.1576495584359; Mon, 16 Dec 2019 03:26:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576495584; cv=none; d=google.com; s=arc-20160816; b=m/i3HUjj6K6T1Z0BCG7lBP0ooERZFPms0QAdipGFGEaKMZ0O3Pyn9Skl6U1sahSsEA wc9h2c1o1OwYmW50fm8nIQdQLKXzOE7aAMGZswHjSRmjzFcvBUjHSThoRBwh7hMDEDcH t+kSTzc3q9d2yoZ/4l6FzkIs3mOfvPiv4titwLvv/sjYfr6TENdplubAlTlRhcIILiGM ywXzmpq1hHOVBQNcjf1a/nAbvH0wnWz9dewWoQscoV9VZptAEDZa4E158TdiAUs6lq6p 3ykuejmYQvoG23r5s8IzWxvhG9OuPt2Scvb1ud8Vii9QQcxHDnIsfO1b3z/YIDfLlK7f fvfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ACmqU9kc4pH2AFemnhFozmUJPmfCe2y1E2GEg4ME7dE=; b=KTMlF5d6kQb4xVS0lq+RKEEmNYxeS1p1K1vmVqCGKBcTM0cDfygxNk7qLQ6UiFRsPk AG+Y42J+Uogb5HvNAG14yfXJq5R88SmDrDOGZ5wi6QKL+GjFp1Lwu7c+XeRjKqAL9P1H 2PXlf4d/AdNwYKW+uIEYkuWLPk7b82TWizNHNp74fK5c/HyMF0DMjobq68EQa0gyYy1g arwf1N8YT1BttYb0I0P+zIX4+iYHjl7WuwfDA1B3XsjNMQ1TvSv3+fhNZ3nQGGXO8aBW sGcf3uT1VxUhlcLErmWS+/66IjYL8lmORExw0UEGvP3RJCaDRp59LOywJN53Iwmkb22q Xo/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qtv41et/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w1si9728855qvh.182.2019.12.16.03.26.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Dec 2019 03:26:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qtv41et/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igoW7-0004Ha-EA for patch@linaro.org; Mon, 16 Dec 2019 06:26:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51172) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igoFs-00083y-UU for qemu-devel@nongnu.org; Mon, 16 Dec 2019 06:09:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igoFr-000083-Ip for qemu-devel@nongnu.org; Mon, 16 Dec 2019 06:09:36 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43135) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igoFr-00006T-CA for qemu-devel@nongnu.org; Mon, 16 Dec 2019 06:09:35 -0500 Received: by mail-wr1-x441.google.com with SMTP id d16so6712516wre.10 for ; Mon, 16 Dec 2019 03:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ACmqU9kc4pH2AFemnhFozmUJPmfCe2y1E2GEg4ME7dE=; b=Qtv41et/cAnVAjr9sEMIwdJhL+pjKHlCpFIjd9AFEhnEGk2EGzeW9XHbpWNYBF0LBY uqdSCXdbsvLbL7QkrD3Zi24rB/cBwqBXbAwOo2Y214VmM7umK4UOWlALq7Fzixr/IQKG KqvG+hJwJOLFCXQek/jEgQAJECT6JbVJpklD9/D4IFKHUn0ocKq+noxv51U6Im2YxLm/ ua7qCqLqQRgGEwAtZTihcH8iSf3YZnEmvMXDwtL4pD2NjoBDDB3JAAVo8NVGMeOgiiMN 8p1GYjLpCAfHIejfMmsUtBVWQcxFFRLmZYw+ztiNFLoYIupAoQvHL/iV7kUQk8CCpPBK DfRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ACmqU9kc4pH2AFemnhFozmUJPmfCe2y1E2GEg4ME7dE=; b=W8cCMyqssVZmm35+26J7wXj8HVyfo2kT8uHqr4V5i81WDSN9HTi8MFeW2CnUuBBRuR q2J/TXOKJUuDAPuIeAJLtgFRam982XfjCSINJI5KqtgFzL7aZKXJCTvpbWc3lQ7EB90M XAeIbFuxVPfueOLsRt9Q3ul9Xis2ZLjp4Qb9vATWQ2dZHOLm4u7SCfN28lvsKmCLCL0/ j+fch9ksNAr9K5LbDlbgJcfc1xxrLT1B2OuZZbY1fl5XxhmqGIrG1D9g9lMBcib+xckf EXsVzHKtpYd3KogM1cVT1yOL9hEv17b/QGRJDnwuq71RHJpek/TeyozEEXVT83EF4yLJ D4DA== X-Gm-Message-State: APjAAAVxjhA2jRFF998rPFflRaDS/G5uhllMD4xwTAhqI74MiLO0zVWg scqVFEoBfsG8LXQS7hyjOWDLf2VREFt8/g== X-Received: by 2002:adf:f1d0:: with SMTP id z16mr28468734wro.209.1576494574226; Mon, 16 Dec 2019 03:09:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id x10sm20976131wrp.58.2019.12.16.03.09.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2019 03:09:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/34] arm/arm-powerctl: set NSACR.{CP11, CP10} bits in arm_set_cpu_on() Date: Mon, 16 Dec 2019 11:08:55 +0000 Message-Id: <20191216110904.30815-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191216110904.30815-1-peter.maydell@linaro.org> References: <20191216110904.30815-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Niek Linnenbank This change ensures that the FPU can be accessed in Non-Secure mode when the CPU core is reset using the arm_set_cpu_on() function call. The NSACR.{CP11,CP10} bits define the exception level required to access the FPU in Non-Secure mode. Without these bits set, the CPU will give an undefined exception trap on the first FPU access for the secondary cores under Linux. This is necessary because in this power-control codepath QEMU is effectively emulating a bit of EL3 firmware, and has to set the CPU up as the EL3 firmware would. Fixes: fc1120a7f5 Cc: qemu-stable@nongnu.org Signed-off-by: Niek Linnenbank [PMM: added clarifying para to commit message] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/arm-powerctl.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index f77a950db67..b064513d44a 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -104,6 +104,9 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state, /* Processor is not in secure mode */ target_cpu->env.cp15.scr_el3 |= SCR_NS; + /* Set NSACR.{CP11,CP10} so NS can access the FPU */ + target_cpu->env.cp15.nsacr |= 3 << 10; + /* * If QEMU is providing the equivalent of EL3 firmware, then we need * to make sure a CPU targeting EL2 comes out of reset with a