From patchwork Mon Aug 22 15:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599193 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1881347mae; Mon, 22 Aug 2022 11:41:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR6l2iP8JtG7PkUHUHSzFlYHA4xxR8d44oZpphbakYZYWBU9E0KnjGFKD3BC6S+Yi3/rixhC X-Received: by 2002:ac8:5b56:0:b0:343:390a:9908 with SMTP id n22-20020ac85b56000000b00343390a9908mr16390603qtw.41.1661193683341; Mon, 22 Aug 2022 11:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661193683; cv=none; d=google.com; s=arc-20160816; b=cb/elvv0tOcl01I4M7GOc+cMk1wqOVhf47YwPSp8HWSDA4ElMwy8LE6ISyotjtQqaZ zvVaLAeDha03LKO17aaJgDQJvBBNduyqGo/W30hisbPtcArxD7+kaHhQcJBdceoOeRr4 9rchhHNp3tHB8GeTJuoHGAxFyntxw+vyqPnw/33t+AgKhXTr5MdFxbwyFK72F/wH445b GujaQ3ETrn0DsMCCMsy6I2EBsf7kXQ4fPR5blnAA7M8JeYU5M9xdbKaZHBdgU/5bTTuS beFZQYV7LtCwIzhqyj8IlPSkbaGBV6J58Gt7NPA3Yvxv7p7TPmIukKn0hdiMUx2v/UyS FA7g== 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=dgGRXfqBRyRwvYaWW/xMoQ57AfJT2+cy/LziIxT5Jyk=; b=Inpa/b6iqzUlUKukcUmkv1PmzPmPlBDr6k1hICr5WxDrvjrbR86YhkAICBMQ6lE3M4 HH46XZTHYi6jR4M3AeNvtIwX17awyUHx73fUw9hgIyu4pPkQ66T6tsgWsTLH3ImQRyY6 +SxQACoyOvIxGHjorTrOR9EgGM3h5+F3fNudxmvYBlG5OWCxWLQbGkoolISKMIP+JbdE nXkkktuapq0d2lbYeiBM/eSmQSI9Q1VsaY8HugVRHEnwDPPgaOEckzqRz5Zz80sjFBWr VvW7BeWa5yXCOh7xsE4G/ZYOpb2JI1055A4kmOYeXJvpBoqbHiJ1/mJVYlga0zYTNTiW DtVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rEKsOcEb; 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 j7-20020a05620a288700b006bb20678c36si5266145qkp.220.2022.08.22.11.41.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 11:41:23 -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=rEKsOcEb; 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]:38602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQCMU-0005zL-U4 for patch@linaro.org; Mon, 22 Aug 2022 14:41:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9PC-0004uj-Bl for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:31:58 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:41973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9P0-0001gs-5R for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:31:58 -0400 Received: by mail-pj1-x1036.google.com with SMTP id t2-20020a17090a4e4200b001f21572f3a4so11705681pjl.0 for ; Mon, 22 Aug 2022 08:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=dgGRXfqBRyRwvYaWW/xMoQ57AfJT2+cy/LziIxT5Jyk=; b=rEKsOcEbdGRtMJ/BQTJu4uv9iKaJuJxmXD7CJZBG2trWvgMc38DNYnE5p7KWyhyJ4J HfcKVlUkIpvUaHAv4L/gnntO6tN0WrUaBUl8Eu87QdT1USNHo5P8WZ5HjV96RMJNLXbJ UORpSX1giweIfqByBpJKRC3XpDwrIxvHDFfHes8GQrSxppXs0My4tu++93gZnE+n79LY F15F41/5HOzDFKhSOVGzN+pWpuYfjl+8FZume5L1HxIpOk6OAas16LfBV+SHwxxUqDS+ XGo6lm8Copc5leuRYtIpsvff9uKmkRUb7IHA3iQ5+aiNHislx9QuKXLdhKbGgYcqQFpZ EX4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=dgGRXfqBRyRwvYaWW/xMoQ57AfJT2+cy/LziIxT5Jyk=; b=WBptkAoJqqgmcoBrf+F7iFe0gxpEWtR7gRGZZp974WZaKM0Jm0tn7NNErH76jICf3b oh4C5/b0SWljs1h6d2Uo9TcXtUu9RKa2TEbOMESPt2vpOlBYi6VuOMQuTajMWdvJ0J0v yh/3iYO+FjxAyzr2tq/rttBcvVk4TFBQtN0afYfcnlcqfQEtkuCrUPMVvi441IXCIbME reyC2fww4oT/ozzTtWy4ECWAZLNClIyY71yS/vmw20SNOdtm6btHl2U8kkFG8yUvMqP4 4wd1FIev51s6jgbHWZHZZwqeZ+vejAH3ZZIAdo/bKJ3jMb06Xwo9+ENO2mRRvJXJm3oO hYIQ== X-Gm-Message-State: ACgBeo0UCC+diCVx0COTf2fOF5F7sdMjRj5dYO4auoutKclhh62rC00k NR+oqWN5hxpRJFKjbMwvd+H2zJuosHjZWg== X-Received: by 2002:a17:902:c411:b0:170:91ff:884b with SMTP id k17-20020a170902c41100b0017091ff884bmr20767560plk.58.1661182294248; Mon, 22 Aug 2022 08:31:34 -0700 (PDT) Received: from stoup.. ([71.212.157.236]) by smtp.gmail.com with ESMTPSA id i6-20020a17090a3d8600b001f262f6f717sm10353835pjc.3.2022.08.22.08.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 08:31:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 59/66] target/arm: Move be test for regime into S1TranslateResult Date: Mon, 22 Aug 2022 08:27:34 -0700 Message-Id: <20220822152741.1617527-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822152741.1617527-1-richard.henderson@linaro.org> References: <20220822152741.1617527-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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=unavailable 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" Hoist this test out of arm_ld[lq]_ptw into S1_ptw_translate. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 7c44e7eadd..e898db8765 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -192,6 +192,7 @@ static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx, typedef struct { bool is_secure; + bool be; void *hphys; hwaddr gphys; } S1TranslateResult; @@ -261,6 +262,7 @@ static bool S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, : env->cp15.vtcr_el2 & VTCR_NSW)); res->gphys = full->phys_addr; + res->be = regime_translation_big_endian(env, mmu_idx); return true; } @@ -272,7 +274,6 @@ static uint32_t arm_ldl_ptw(CPUARMState *env, hwaddr addr, bool is_secure, CPUState *cs = env_cpu(env); S1TranslateResult s1; uint32_t data; - bool be; if (!S1_ptw_translate(env, mmu_idx, ptw_idx, addr, is_secure, &s1, fi)) { /* Failure. */ @@ -280,10 +281,9 @@ static uint32_t arm_ldl_ptw(CPUARMState *env, hwaddr addr, bool is_secure, return 0; } - be = regime_translation_big_endian(env, mmu_idx); if (likely(s1.hphys)) { /* Page tables are in RAM, and we have the host address. */ - if (be) { + if (s1.be) { data = ldl_be_p(s1.hphys); } else { data = ldl_le_p(s1.hphys); @@ -294,7 +294,7 @@ static uint32_t arm_ldl_ptw(CPUARMState *env, hwaddr addr, bool is_secure, AddressSpace *as = arm_addressspace(cs, attrs); MemTxResult result = MEMTX_OK; - if (be) { + if (s1.be) { data = address_space_ldl_be(as, s1.gphys, attrs, &result); } else { data = address_space_ldl_le(as, s1.gphys, attrs, &result); @@ -315,7 +315,6 @@ static uint64_t arm_ldq_ptw(CPUARMState *env, hwaddr addr, bool is_secure, CPUState *cs = env_cpu(env); S1TranslateResult s1; uint64_t data; - bool be; if (!S1_ptw_translate(env, mmu_idx, ptw_idx, addr, is_secure, &s1, fi)) { /* Failure. */ @@ -323,10 +322,9 @@ static uint64_t arm_ldq_ptw(CPUARMState *env, hwaddr addr, bool is_secure, return 0; } - be = regime_translation_big_endian(env, mmu_idx); if (likely(s1.hphys)) { /* Page tables are in RAM, and we have the host address. */ - if (be) { + if (s1.be) { data = ldq_be_p(s1.hphys); } else { data = ldq_le_p(s1.hphys); @@ -337,7 +335,7 @@ static uint64_t arm_ldq_ptw(CPUARMState *env, hwaddr addr, bool is_secure, AddressSpace *as = arm_addressspace(cs, attrs); MemTxResult result = MEMTX_OK; - if (be) { + if (s1.be) { data = address_space_ldq_be(as, s1.gphys, attrs, &result); } else { data = address_space_ldq_le(as, s1.gphys, attrs, &result);