From patchwork Mon Aug 7 14:14:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 711113 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1564520rwb; Mon, 7 Aug 2023 07:16:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD+a9TbK1WYymKL46WWHsBfXCVvjh235H0FjeBvmoyO0Z+VfRnIwoXVt65a3njeBDqgG0v X-Received: by 2002:a1f:eb83:0:b0:486:4220:a46f with SMTP id j125-20020a1feb83000000b004864220a46fmr3805541vkh.2.1691417769951; Mon, 07 Aug 2023 07:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691417769; cv=none; d=google.com; s=arc-20160816; b=qMLKCzJi0RN9FeiYIv5Gx3d+10Nn4w8QifKgqNncoXfTZP1NnerrnOIaUQUdTCNuV0 9I2jRooKu/jL1ZKXHbmfYbCkaoFp5CDWu/XW2LKWdfSmndVrIHJudXOmOWhTbMby/Jq6 zi/XLf/4Bxgxk/Kp2FtKLymZSNvaeGptJNNLhSuM8zIVBJjf98/oLwa+BnxjYOrqVXvj viJmjL0sy9ObYSAOUrktNOOYUwIvyWVs85sR38k1AKtREQ/gbCm/tmzkpCPJXp65Zu1l k4sg0zmMwtCdltnEHuAxT9IaZSs7bRVxlPquTbwHjGgtI+NOMmLXn9DLf1aoKHnlEdmj LhHg== 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:message-id:date:subject:to:from:dkim-signature; bh=f9tizgWmwswfKOu+cgNjVcEdMF1Xn+daiPSP9q+Z8ZE=; fh=jvpdohKmRoZMO537s6xMKXXtj7EZws1LOMQI/oP4vXs=; b=n6olwYVL5gX7SXNXnhnpXUA6ib/FF1Id+8tqVsW/e5Vx4KkqCQkFC59rRVVawvR7F7 LT0AQJU4Sjavst4lsHyEZgnD3AiPrHI21jKF67dwbevHRKTx8hf42o9ZWG7WM3JEoEJg +8Ld/GdkEClR7XQlkNDnVdisvFjCW8y+9Vu8Ys4egFz3CPiaqwTRAQicBlS1imNUhlWf unEeNZ3Ul6a/hQQzIErxBWAD2HpBSVV/3im/5SdGLr5AwhvrEcCLCn7+ZrI2ZdHEo5av DCL02nQ6rQOQ6MKm455tnOK9/Q5Kmc3+J7mn5Q2fMpQlSf8AgtZ2IEj6+EVzGYsgDGrk pgIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p9rcZRTB; 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 w9-20020a1f9409000000b00456d7570bdesi733256vkd.80.2023.08.07.07.16.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 07:16:09 -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=p9rcZRTB; 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 1qT114-00008O-Dg; Mon, 07 Aug 2023 10:15:26 -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 1qT10z-00006x-No for qemu-devel@nongnu.org; Mon, 07 Aug 2023 10:15:21 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qT10w-0005Qo-Te for qemu-devel@nongnu.org; Mon, 07 Aug 2023 10:15:21 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fe32016bc8so38565715e9.1 for ; Mon, 07 Aug 2023 07:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691417716; x=1692022516; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=f9tizgWmwswfKOu+cgNjVcEdMF1Xn+daiPSP9q+Z8ZE=; b=p9rcZRTBeieaHL+BJsJLO7dahJwcjjghxx6q18PYSKE9AWGmhdet5aTsarn5db5Gn5 ItAGExS8FZqz6ufTxCl29CwoOcYJbKwHg3gilZtU5KgvPRAV9sfrgfQOgCh6Ha7FwsGO +O9F62W5/yWGPrsHEJvVMNWDJbOBqs1nbUL6mzJa87SwQafbywCNEUruyxwb+u8b5+dn I8Qln5QzWRvUNnw1jm0G1P46F3ICtn5voZYjoX7klD1uTbof7HZyT4f2CHSKfuIXTvy6 ARbCFBvB5LFM6MJKsU9IXp/Tkq1V65qr4Tp9RnvN/vrbm08bxRbRYO8I26GPtoG1ZGhy Jxig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691417716; x=1692022516; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f9tizgWmwswfKOu+cgNjVcEdMF1Xn+daiPSP9q+Z8ZE=; b=ZawZvG42BRVIRbNtggRyqQOQfV0953ZAOoLOUNJLAzoF2FyV+TGW4A8l5rk10JOuWv mBOhbSVrY5AIPBpegKiJz+v2VQiv7mbJJSfuJPtCaZhBgTjjoDQJ1oLcd3E+UVk33M0f oi+kHQSEo3g2F6VaIQr97MeybXA+zdGZEGV05GHX94Z0PXI6Vm1qVow0y7JqQ/8a/YYY W2a/NQWRU36r7X2QDqJkBe1qbrZmxt/lBh2NcxcmfJFeXmR4mMRN600nG6bwAmL4pGAe dO0r/oL4DKMV7tb4wxH7Dlb7TV3UxmnUNPSiFhblNCm43xFI1KycQbRgZVRA7+28Mvvf Y4Xw== X-Gm-Message-State: AOJu0YznzUiNkYt+1pineS6v2vSTPWiM7W5RkCv9t0IetoWAgf/CocsH MFPCpSABs7blFDkXNseAxgU1wyocX5lwMiSvD0Q= X-Received: by 2002:a05:600c:2193:b0:3fb:f926:4937 with SMTP id e19-20020a05600c219300b003fbf9264937mr5737546wme.31.1691417716489; Mon, 07 Aug 2023 07:15:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id h20-20020a05600c261400b003fe2ebf479fsm10835617wma.36.2023.08.07.07.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 07:15:15 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 00/15] target/arm/ptw: Cleanups and a few bugfixes Date: Mon, 7 Aug 2023 15:14:59 +0100 Message-Id: <20230807141514.19075-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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 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-bounces+patch=linaro.org@nongnu.org While I was fixing a ptw bug recently, I noticed that we had a somewhat confusing mix of ptw->in_space and ptw->in_secure, where in theory the two are supposed to be in sync and you can figure out the in_secure state from the in_space. This patch series' principal aim is to clean that up by removing the in_secure and out_secure fields in the S1Translate struct. The first three patches are fixes for (minor) bugs I noticed while I was trying to do this refactoring because they're in or around places that were using in_secure. The next four are basically plumbing: passing ARMSecurityState arguments instead of boolean is_secure arguments. The next four patches then can get rid of uses of the in_secure and out_secure fields and drop them entirely. Finally, the last four patches are minor bug fixes for various corner cases that I noticed while I was testing this. Changes v1->v2: * in patch 6, avoid calling arm_hcr_el2_eff_secstate() with ARMSS_Root, rather than making it return 0 * new patch 7 ("Pass an ARMSecuritySpace to arm_is_el2_enabled_secstate()") Only patches 6 and 7 still need review. thanks -- PMM Peter Maydell (15): target/arm/ptw: Don't set fi->s1ptw for UnsuppAtomicUpdate fault target/arm/ptw: Don't report GPC faults on stage 1 ptw as stage2 faults target/arm/ptw: Set s1ns bit in fault info more consistently target/arm/ptw: Pass ptw into get_phys_addr_pmsa*() and get_phys_addr_disabled() target/arm/ptw: Pass ARMSecurityState to regime_translation_disabled() target/arm/ptw: Pass an ARMSecuritySpace to arm_hcr_el2_eff_secstate() target/arm: Pass an ARMSecuritySpace to arm_is_el2_enabled_secstate() target/arm/ptw: Only fold in NSTable bit effects in Secure state target/arm/ptw: Remove last uses of ptw->in_secure target/arm/ptw: Remove S1Translate::in_secure target/arm/ptw: Drop S1Translate::out_secure target/arm/ptw: Set attributes correctly for MMU disabled data accesses target/arm/ptw: Check for block descriptors at invalid levels target/arm/ptw: Report stage 2 fault level for stage 2 faults on stage 1 ptw target/arm: Adjust PAR_EL1.SH for Device and Normal-NC memory types target/arm/cpu.h | 15 ++-- target/arm/helper.c | 23 +++++- target/arm/ptw.c | 192 +++++++++++++++++++++++++++----------------- 3 files changed, 146 insertions(+), 84 deletions(-)