From patchwork Wed Jul 19 15:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 704318 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp2191818wrt; Wed, 19 Jul 2023 08:57:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlHuZGT3BY24MLicisw1TwTl0lGheKeCK+DOl+gk7CkRCXnEEBTBueG8Q39XTovGeOUafGpF X-Received: by 2002:ac8:5949:0:b0:403:aa49:606e with SMTP id 9-20020ac85949000000b00403aa49606emr24450014qtz.30.1689782269961; Wed, 19 Jul 2023 08:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689782269; cv=none; d=google.com; s=arc-20160816; b=uNZazVKNqXxNuQhGDJgB8rdm2nmtO4eSlGVuRivsy7Ly2TdT9xidhUrPL+tfm/5Etm 8pkMxi2wwCyMxAVlKj7e28xYQ8xJlLpNozqFn9OW6SahfUPGzaoHS3pHPJYWqXjqpOQE YTRgXqmybe4LRT1gYvIK7eoT3mKYTjiDwgUZazpxHSf2xq/XCorMFlBhkW/mQjGHyP7Z GKRIcQ4z4O6W7hqIYGQke3ZH9AwH9w1vzpUU+mhuQzFcEga8QuGhIOAtCiGxT7MHpgiT zvHxKwRqAhrHqJIJ/QaHKXuTOBsSQDDc3VUDOcAtNxwljJyH6hMCV9FAMZIEgMKNJ4gA CJgw== 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:cc:to :from:dkim-signature; bh=WNPqefvQgMivoBtumxDAYGfl0jiPjDA6sqhpbGZ4NhE=; fh=zMLmPP9ozJY0jj0bAXqZquWHP0BgmjJZ9lKiHhJNaWU=; b=laTQ8G94fxoA3yFuc9flhzMvbQB41Z6sPb9TtzrVY+6wGXcB5UkXgZ8prDQBNbUIsA xTKhtfpxeSnqqrN9tdHUqx0rNnsWOFX/tTiKcF8NcEkSWe0amG5xwtakckFH3mUbiObO rw5D9MsBk09o+urylsjAvw51ty0Gh/6rGjx10/Y1aciEEhCUAFfScFTueOVW2ycgjDfW mWjilgAdV7aSlehhDZY+ftY73EcMSWWR1j00zHGTvrgwygkRjCW/BBwcLciWPWDQEuY7 /nLzs1XokvYuvXnrnbQKTsFpXoLyiKbGIcLFK7nsHHLMW6FtIWT2xXB8Q2bPLW+ik9fE gKRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b/0hKs0Q"; 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 d20-20020a05622a101400b003f1fba7038csi2959925qte.429.2023.07.19.08.57.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jul 2023 08:57:49 -0700 (PDT) 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="b/0hKs0Q"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qM9Xv-00038G-2Q; Wed, 19 Jul 2023 11:56:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM9Xq-00036d-V4 for qemu-devel@nongnu.org; Wed, 19 Jul 2023 11:56:55 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM9Xl-0007IS-8A for qemu-devel@nongnu.org; Wed, 19 Jul 2023 11:56:54 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbdfda88f4so64928055e9.1 for ; Wed, 19 Jul 2023 08:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689782205; x=1690387005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WNPqefvQgMivoBtumxDAYGfl0jiPjDA6sqhpbGZ4NhE=; b=b/0hKs0QxDQccRusYNa5gcfxhSGWwRIFg3RS7TS0wQgh2xg/t4sOawHxqaNGQdze5u Y1ZS1No5vF3tbx5w5qdPbQ74gugYWY0XVGl8bOALogHaofJA5C4+8eYamZKn8poVx48A IFpqCc11TaMrB3JdRllZ+M1ZheG03HCZllNjiLBzGroGFcDX57QYxtQqo7vR9JqEShDO uxltFYAXNfBGZM9zMEk2d3pDUSzHsVcx1WS1S2yahaK1zn9UTrNwVxbvK8RwoZafVRTU whrKLmX53YODwWc9yc0AMp2S5DJn/J8FZjp/SIRBhKd3LwRlyDfUVyEbwiO+JZf/94rn Irdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689782205; x=1690387005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WNPqefvQgMivoBtumxDAYGfl0jiPjDA6sqhpbGZ4NhE=; b=NfRWYN8rqCIBpWbMMDFZ4FFNekeEY6vgoHAL04FfTxlF66//c4Sr3q/bPFVPzsxK+P 7vQIA7PT9yEmm+Ydup/FAR0EYiRGoqMFt4dSyDhMTnWlOepvinVGvOKJhUd9b0leYVhp ltV7gJlcQWVHUI4z5FVnBqrzGTZ5DAeJkuP23g7jG2X4jx9daEZWIi7Ssy1A2y9POJRt +LWUu99OQHO9w/jzvxeBA6UeY7gYwHonOO5zkuUNVgWXcdeU36GhFKvY5W4eX2amezTb 8uEgMO7EENrkIryBtKSaaQoWye4CWc0CT6xY4JIdZhpPd5PmCgIo/rl3onbtUKgOJhMa mn6A== X-Gm-Message-State: ABy/qLazkGmp/fwmrLQiRNVoIAuNNR5pGneeFEM/uwF+UBn8aFToM+Q4 cyHq3VOFycU79e77AYnYWbRO5w== X-Received: by 2002:a05:600c:20d1:b0:3fc:80a:993e with SMTP id y17-20020a05600c20d100b003fc080a993emr4651088wmm.17.1689782205641; Wed, 19 Jul 2023 08:56:45 -0700 (PDT) Received: from localhost.localdomain ([2.219.138.198]) by smtp.gmail.com with ESMTPSA id l14-20020a1c790e000000b003fc3b03caa4sm2351006wme.0.2023.07.19.08.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 08:56:45 -0700 (PDT) From: Jean-Philippe Brucker To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, Jean-Philippe Brucker Subject: [PATCH 1/5] target/arm/ptw: Load stage-2 tables from realm physical space Date: Wed, 19 Jul 2023 16:30:15 +0100 Message-ID: <20230719153018.1456180-3-jean-philippe@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719153018.1456180-2-jean-philippe@linaro.org> References: <20230719153018.1456180-2-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org In realm state, stage-2 translation tables are fetched from the realm physical address space (R_PGRQD). Signed-off-by: Jean-Philippe Brucker --- target/arm/ptw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index d1de934702..6318e13b98 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -164,7 +164,11 @@ static ARMMMUIdx ptw_idx_for_stage_2(CPUARMState *env, ARMMMUIdx stage2idx) * an NS stage 1+2 lookup while the NS bit is 0.) */ if (!arm_is_secure_below_el3(env) || !arm_el_is_aa64(env, 3)) { - return ARMMMUIdx_Phys_NS; + if (arm_security_space_below_el3(env) == ARMSS_Realm) { + return ARMMMUIdx_Phys_Realm; + } else { + return ARMMMUIdx_Phys_NS; + } } if (stage2idx == ARMMMUIdx_Stage2_S) { s2walk_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);