From patchwork Wed Feb 23 22:31:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 545228 X-Google-Smtp-Source: ABdhPJwji7Uz3dSw8r3cH/0dwbzPcfA//Msh2z6h1Y6WDdKvV5PvA7uqAJXdGEdsc9s7S7q9TM+5 X-Received: by 2002:a05:6214:5010:b0:42c:f952:6608 with SMTP id jo16-20020a056214501000b0042cf9526608mr1349122qvb.77.1645656363153; Wed, 23 Feb 2022 14:46:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645656363; cv=none; d=google.com; s=arc-20160816; b=IElPXGUxVUcQAt9hpoLDevEKtMbwKGadNW2rI+SDMfs+n+3RMv3hDC+8U9nlCA7SYB qufzt0MkDqeGhuNPIli5A1Lz4mCvYcbk35KsByoWuTJgEdLffKkQSSpV9AvQ7R6CbTup RqtZPakKSOC8evk062buycTyUTZbTmELG9npVSXGVUXzcI3oF26F+PYWeTxdp/8B/K9H NaP9OhEo2bTRgLfsevlLfjuiPtpkxjkmP4Xldi4UdbtYXKk3QktVt3FTcEP0hTCNFE73 uHElloW6nUuI4E6FO3sNsfhxi58d3YNxO61rs/+33hyfs4zkasW/Je7axe/Vmb83B7OE BsMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=LEHpSJT8J9ebqqTQjfyKLCxLV+2FFN9FnOSHNM/yVQA=; b=v+9S1nFtPNUS3qMSfrA9zd0EtABRcQidYf0l2d4vCnsuHbsrhe+XFP8tXPPI7k20EO iA39KxFlD6ClAkjtwwVs6BHj1kOO6w8m4iOZVTV7q0ZeeS46qmIZR0OzTcXRfWowtLdy H6IbOuUeQ/0DgeKa96KzxKAiMjcyOfMDGKlGOA0/ZOfdlJFi7hrR2uBtJ00JZvSXz4mi hRERP3GoifWXZvnZx8mAf7I0xy8XgiZfzg/sFVIoT/2PEFMtxT6WxhNnkjxxaXo1oNhK 4GJkWka78N24P03TAll9/nwSquDC73U1nYfmKE0pETc+FpEqOadq65ZmMNDkNIczFABr yppw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kiY62Skr; 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=fail (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 r7si635304qtw.558.2022.02.23.14.46.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Feb 2022 14:46:03 -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=fail header.i=@linaro.org header.s=google header.b=kiY62Skr; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN0OY-0004jN-OV for patch@linaro.org; Wed, 23 Feb 2022 17:46:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN0B0-00075l-AC for qemu-devel@nongnu.org; Wed, 23 Feb 2022 17:32:02 -0500 Received: from [2607:f8b0:4864:20::1035] (port=56269 helo=mail-pj1-x1035.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN0Ax-0001GC-Rf for qemu-devel@nongnu.org; Wed, 23 Feb 2022 17:32:01 -0500 Received: by mail-pj1-x1035.google.com with SMTP id gb21so294528pjb.5 for ; Wed, 23 Feb 2022 14:31:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LEHpSJT8J9ebqqTQjfyKLCxLV+2FFN9FnOSHNM/yVQA=; b=kiY62SkrmyQWbDayOPFjfJYfbitMiww3SYSsE9+fJJtcUdtQ2/ZtABx+iTOLRtu7BA SNyzfun3bSubk7/e14xLtbHHMot6XIiqB2ue+Hz0B7HbpVZHuzPCZO8OUyAgeU5o2owh RJM8vZxXR20PubDIG6MEadGNoiJrqhXinj577l6Wf03p85OnOMuXgXRjC5CNkuwECs9P t2PJGLWPfAf8gb4Rjmcshkn5syu5wcESsuB29jV/PpV2TeddfBoqX80ntGVEgn+Qpkok XAAWiL/voPtjociSk4lUotdgyOZddcs4g1aWdKITGWQgwdXnlzq8T4D6+s/CafVjDyPS uypg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LEHpSJT8J9ebqqTQjfyKLCxLV+2FFN9FnOSHNM/yVQA=; b=hn9l+aFRLtC2mSiV1HF5JYut/Oa/GfDaJoziP2WgDbpDHdQc3PPS1BuJK3fFqR+Yz1 sIOQLBtLoeA4aLZwofQcdQCCvGbnfv/DrwLpdTlJZy+gxvWdvwtwdHrdWvjiQqUNON8C qq8Mi9CufqAev9H9q6NwBkhpLwIjoC6O2wpWLoc2+BcPjmNyUXCjqlFnIRkVQjWiHv9A uUGZ/sFKyQQUqaI/nT8hxbBZFlVoRo87r/gFgJ/RJLtMlrUfaerGsE2I+kTPwkY44Fxh hFcAJ3eBley/9CBsQYDJxLaU/f8f7T8klmAHvhTgoarX6B8RnDcy+1vrfAxIgy4732dw KN+g== X-Gm-Message-State: AOAM532rArhAy50vUsndZl4isv9YHrv7JaXrr/M5ZZKfs6d77NnCytBr YcZp4gBdZdAXjv3gWsJcVpW8CoJlenyJ9A== X-Received: by 2002:a17:902:b94b:b0:14e:f1a8:9b99 with SMTP id h11-20020a170902b94b00b0014ef1a89b99mr1909464pls.28.1645655518546; Wed, 23 Feb 2022 14:31:58 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id f8sm533815pfv.100.2022.02.23.14.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 14:31:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/17] target/arm: Extend arm_fi_to_lfsc to level -1 Date: Wed, 23 Feb 2022 12:31:31 -1000 Message-Id: <20220223223137.114264-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223223137.114264-1-richard.henderson@linaro.org> References: <20220223223137.114264-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1035 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" With FEAT_LPA2, rather than introducing translation level 4, we introduce level -1, below the current level 0. Extend arm_fi_to_lfsc to handle these faults. Assert that this new translation level does not leak into fault types for which it is not defined, which allows some masking of fi->level to be removed. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 3d3d41ba2b..00af41d792 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -462,28 +462,51 @@ static inline uint32_t arm_fi_to_lfsc(ARMMMUFaultInfo *fi) case ARMFault_None: return 0; case ARMFault_AddressSize: - fsc = fi->level & 3; + assert(fi->level >= -1 && fi->level <= 3); + if (fi->level < 0) { + fsc = 0b101001; + } else { + fsc = fi->level; + } break; case ARMFault_AccessFlag: - fsc = (fi->level & 3) | (0x2 << 2); + assert(fi->level >= 0 && fi->level <= 3); + fsc = 0b001000 | fi->level; break; case ARMFault_Permission: - fsc = (fi->level & 3) | (0x3 << 2); + assert(fi->level >= 0 && fi->level <= 3); + fsc = 0b001100 | fi->level; break; case ARMFault_Translation: - fsc = (fi->level & 3) | (0x1 << 2); + assert(fi->level >= -1 && fi->level <= 3); + if (fi->level < 0) { + fsc = 0b101011; + } else { + fsc = 0b000100 | fi->level; + } break; case ARMFault_SyncExternal: fsc = 0x10 | (fi->ea << 12); break; case ARMFault_SyncExternalOnWalk: - fsc = (fi->level & 3) | (0x5 << 2) | (fi->ea << 12); + assert(fi->level >= -1 && fi->level <= 3); + if (fi->level < 0) { + fsc = 0b010011; + } else { + fsc = 0b010100 | fi->level; + } + fsc |= fi->ea << 12; break; case ARMFault_SyncParity: fsc = 0x18; break; case ARMFault_SyncParityOnWalk: - fsc = (fi->level & 3) | (0x7 << 2); + assert(fi->level >= -1 && fi->level <= 3); + if (fi->level < 0) { + fsc = 0b011011; + } else { + fsc = 0b011100 | fi->level; + } break; case ARMFault_AsyncParity: fsc = 0x19;