From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481046; cv=none; d=zohomail.com; s=zohoarc; b=W1eZyjMmRtMLbvW5XBIXYHmO/i/7xliPfl+J/DW//xMQG0aPMRc0PCJ477bUdFrF8BWv/z7s2vFPw7BcWOY6vtzapkgOcGFq2Dgy0Axz6Aq++V2gWFeRge44lgvo9bGUpgDtqg/c7Rl0JQutAs2TwSmWHl8LLzl08Ch/nxge9ME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481046; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yoMZ5Lhhpa4yw40aAugkzPNGIP1VZYIJaNLaSg584+0=; b=gBW99vHo8fEbmWEa5QyLzGauzeXsK9tS9099QlAJF4Z5h2PY8dhkzNHkS/e9uvg6VV0pO5HEgDPv+8rrJk0Id/Tke2mywgmmxCLBG7w1DdSwbcDTbGUnpxG1AbRmvWmdZPq/nKPPmuWU+O8G2bzGB10rMvqTPWbC5NuX1UKAygk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481046010250.68100131508425; Mon, 23 Jan 2023 05:37:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzu-00066B-V4; Mon, 23 Jan 2023 08:36:31 -0500 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 1pJwzU-0005vR-5Z for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 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 1pJwzP-0002Lc-3m for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:02 -0500 Received: by mail-wm1-x329.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so10606305wml.3 for ; Mon, 23 Jan 2023 05:35:58 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.35.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:35:56 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yoMZ5Lhhpa4yw40aAugkzPNGIP1VZYIJaNLaSg584+0=; b=pubc/w3r0SHPLirgKvZ9tHunQbNO5r3h/hqejuqylpI0HP8guO9+oJPDljcEMokFWr QBZaE/tDjd/PCxyZP0+k0mU/saGFHCtunk+clT35B7pn6k1UmbwnUv7XqTgwFr6cONyY SNbRsTSj9npVgd//gsS63A+HpBwC5xDjNolMoi1I/KGl/YqYDHv2E1PZ8LCtifHjujAe gbyNvmgmU7lOx2m4Pojhpqf86TrIcV4SDHR302GSLoogFOzE0N26SfAsC8awTKwPTbyy THrsCT+KS+akKkFVgBzuQZTajJ+ITDLAxT/YcWS+Vn2Y4sHsNHSNRNscr/rLUrdNow/k H7CA== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yoMZ5Lhhpa4yw40aAugkzPNGIP1VZYIJaNLaSg584+0=; b=fFEXGwyf7/6LkNchnVW0rVw5b5VmG6DF+xcCZ3jqR3ql98gWdAOK701YGHrWdOsUpm MYRx5dVmN6H9GO0dNGVg/z9MfctEgaZQkweqeM2NqlOgkjoq9trdQUXGHP7tiRJyt4fc meZdjqRHcovuqC5czfnxOhUtWBtszyI7f6N59Y6pyw7EL35qZctRukTbpxbxop3Ul4di PoXaBemQRX/lyUJ26Ulj1fxncyDwA0qPB2Z5jVqF5FeT8M26jWT27SZEh1WRmYbCBbuD DWgkLZmNcrRwp9Jlg7LBuLKFTf9WFAEmWMg3FguQKl4Ee8Hv1gCP8bgsw+q9RD2YzOJB aw9Q== X-Gm-Message-State: AFqh2kpDM6uqPVwWrHjdWUS5O1pUp6Kn/LnWBtXaIepV/GnTGFsBbsv5 N3FI2jO5UlEzdfKrv9ycqoGEupCNEWK1Nz08 X-Google-Smtp-Source: AMrXdXtzuOgDZRvCoy1QGAoOy17sgxIC0fQEopdp26qgZNu3opubZxVoC7oqy1hTG6cIJZW6j69aqw== X-Received: by 2002:a05:600c:1d05:b0:3d2:3be4:2d9a with SMTP id l5-20020a05600c1d0500b003d23be42d9amr22945882wms.20.1674480957198; Mon, 23 Jan 2023 05:35:57 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/26] target/arm: Widen cnthctl_el2 to uint64_t Date: Mon, 23 Jan 2023 13:35:28 +0000 Message-Id: <20230123133553.2171158-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481047904100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson This is a 64-bit register on AArch64, even if the high 44 bits are RES0. Because this is defined as ARM_CP_STATE_BOTH, we are asserting that the cpreg field is 64-bits. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1400 Signed-off-by: Richard Henderson Message-id: 20230115171633.3171890-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index bf2bce046d5..1feb63b4d73 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -479,7 +479,7 @@ typedef struct CPUArchState { }; uint64_t c14_cntfrq; /* Counter Frequency register */ uint64_t c14_cntkctl; /* Timer Control register */ - uint32_t cnthctl_el2; /* Counter/Timer Hyp Control register */ + uint64_t cnthctl_el2; /* Counter/Timer Hyp Control register */ uint64_t cntvoff_el2; /* Counter Virtual Offset register */ ARMGenericTimer c14_timer[NUM_GTIMERS]; uint32_t c15_cpar; /* XScale Coprocessor Access Register */ --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481089; cv=none; d=zohomail.com; s=zohoarc; b=ZUW6gBmUYnYpCRpeq9wJxmFXpAYBPTTwQUx20i6GDopY3SFiLzQujfBkFA3Wdu1i0w3cmvy1upfqUckUxe4lPe+6fZ9nICEYt+ac5AiqM6l+CfuJtlUxLBTveo+5Bj/cIRuAczyRJYfnNN+0A6UBMjwO56V4URlkjhhZZeNIs/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481089; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=baS6RwiqJNceR0oUd3JGQ4ePjOLEDMiL7ZbUGHl6dos=; b=EF2mpYClyNeadIPH5NSBEvTKfXE/lN80LqnmYR+S4oyMgDd2KZ69yGR7+i+j6gSMp95dxeCuYGTgNDtY4wq/6Br6lg3seI0CaHuKeW+RnknnLVKqZXfJzUkOtuv2lYi+fS3FBfUloIczkoCKxw0PTV5MoXrdNCruOJGg0OHYdCM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481088768138.8665454245197; Mon, 23 Jan 2023 05:38:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzu-000669-VS; Mon, 23 Jan 2023 08:36:31 -0500 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 1pJwzS-0005v4-A0 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:07 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzP-0002Lo-Q3 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:02 -0500 Received: by mail-wm1-x32b.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so10606339wml.3 for ; Mon, 23 Jan 2023 05:35:59 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.35.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:35:57 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=baS6RwiqJNceR0oUd3JGQ4ePjOLEDMiL7ZbUGHl6dos=; b=Tv+4vSouO/lxvncrcG2hxr3tqLXJE/K3HXmeVFPvtutpjqCoV1mbBfb2C7MhpVDU+7 voTLEADPeFHgVH0inQ2Id/4+XlYnfMQIKx3jlbMdYD1F8ZoXS9KCmN5AfP9N/Fwgi14M CNWEQTYhqkM176Y4iZVAAwNRY2JwF29UtGvuNs4+J1QvTz7Uq5u5WKy26oajKG6qGS8i ZzghEx1Qly3cAMOFiJS9wSu09w1jsrhjM6zFB21HrrG2BWS/+q7DrWEBWsd7f4tkSstz n4+aEK7Vq6lmoi3uK1ncvhHIjkxGydJ4GePpPuCF1f2bbN4gf1ccdKmjPuuvKfr9UC8D DrTg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=baS6RwiqJNceR0oUd3JGQ4ePjOLEDMiL7ZbUGHl6dos=; b=Oz+xqtkp3aQDskSV+wlEJycr0yHYmPgttIbRf0nNpqaw5ybTtBtejRYHToTF1XykSb OtFQxku9fap2H/c24XNrOkl+GrEqwZW2g/8U6CAoNHcH41KyFfuhTh2Btb6XSmYX7C5T EMjLOzXzXxEgnr6fuINvvpoStVkYhu6vMKUuq8wyjXlffdY0h3BdR2FMY1KgzifPCZp9 KkS8eJYDhRCtnfJ9QSm7o9j+lhLwjp8BPKv9sUPn/fNjcvgQcTM0C/aQG6oajN0igAYb nPFLAegEXXEgnlXNeSTB+eQGSMbk8vzSVwi6ddlyK8N9BujgbW9Ay7PI93kA2gSiKKX1 rhZQ== X-Gm-Message-State: AFqh2kpFRE6GL/sVwXOilYxA0u46H9VdwUVEc51cHtKWLeQHMy7z0K6U LqRuMw/+68TaCroxdsywkun/FUhx3IhTV+eW X-Google-Smtp-Source: AMrXdXsvxfR90fAQyh8EYeBuTTKQHFax0LeSA4wmmmK0GBccJ3y+PywSqKkRz1UD3FANOGG0yp2CJw== X-Received: by 2002:a05:600c:1c01:b0:3da:fc07:5e80 with SMTP id j1-20020a05600c1c0100b003dafc075e80mr26768238wms.12.1674480958099; Mon, 23 Jan 2023 05:35:58 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/26] target/arm: Unify checking for M Main Extension in MRS/MSR Date: Mon, 23 Jan 2023 13:35:29 +0000 Message-Id: <20230123133553.2171158-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481090072100003 Content-Type: text/plain; charset="utf-8" From: David Reiss BASEPRI, FAULTMASK, and their _NS equivalents only exist on devices with the Main Extension. However, the MRS instruction did not check this, and the MSR instruction handled it inconsistently (warning BASEPRI, but silently ignoring writes to BASEPRI_NS). Unify this behavior and always warn when reading or writing any of these registers if the extension is not present. Signed-off-by: David Reiss Message-id: 167330628518.10497.13100425787268927786-0@git.sr.ht Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/m_helper.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 033a4d92614..d87b9ecd123 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -2465,11 +2465,17 @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t= reg) } return env->v7m.primask[M_REG_NS]; case 0x91: /* BASEPRI_NS */ + if (!arm_feature(env, ARM_FEATURE_M_MAIN)) { + goto bad_reg; + } if (!env->v7m.secure) { return 0; } return env->v7m.basepri[M_REG_NS]; case 0x93: /* FAULTMASK_NS */ + if (!arm_feature(env, ARM_FEATURE_M_MAIN)) { + goto bad_reg; + } if (!env->v7m.secure) { return 0; } @@ -2515,8 +2521,14 @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t = reg) return env->v7m.primask[env->v7m.secure]; case 17: /* BASEPRI */ case 18: /* BASEPRI_MAX */ + if (!arm_feature(env, ARM_FEATURE_M_MAIN)) { + goto bad_reg; + } return env->v7m.basepri[env->v7m.secure]; case 19: /* FAULTMASK */ + if (!arm_feature(env, ARM_FEATURE_M_MAIN)) { + goto bad_reg; + } return env->v7m.faultmask[env->v7m.secure]; default: bad_reg: @@ -2581,13 +2593,19 @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t mas= kreg, uint32_t val) env->v7m.primask[M_REG_NS] =3D val & 1; return; case 0x91: /* BASEPRI_NS */ - if (!env->v7m.secure || !arm_feature(env, ARM_FEATURE_M_MAIN))= { + if (!arm_feature(env, ARM_FEATURE_M_MAIN)) { + goto bad_reg; + } + if (!env->v7m.secure) { return; } env->v7m.basepri[M_REG_NS] =3D val & 0xff; return; case 0x93: /* FAULTMASK_NS */ - if (!env->v7m.secure || !arm_feature(env, ARM_FEATURE_M_MAIN))= { + if (!arm_feature(env, ARM_FEATURE_M_MAIN)) { + goto bad_reg; + } + if (!env->v7m.secure) { return; } env->v7m.faultmask[M_REG_NS] =3D val & 1; --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481273; cv=none; d=zohomail.com; s=zohoarc; b=GJBVHwm8JlbA7m1haeJZ2Ssy3nLjk/eA7YLoiO8oClzWamqSWewW8GTx8HmebY/E/PPrv8t6dOl1TibcFKnvXrpAI7CLMZjjtH2SiTsLojeTgAj0lxbG9WjkXimDyGTcAQLg39CVie8r4cNducFIdxFkpTZIXzgAEUbl/4OK594= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481273; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IIgxyXSUr0bntZmMjT7iADRhtvV5tpYANa73KzeI1HU=; b=Nq+yGzMdXroU21MakMFD0NCqUTgjG4VydvbeXya3fJ9Rc+sC905sGmvvg7NvfX/6PAa+1aVvNasDIJvvy1ecz1HmRPCA+INwYL7q4dkTRNALN2QTdgDcTwt6CDnZxCX/xcEbzSOLr0Lr6l7gzbW/Jc705Vq4fw3n17n8wmmJw4g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481273453549.2636793480649; Mon, 23 Jan 2023 05:41:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx00-0006DM-Ij; Mon, 23 Jan 2023 08:36:36 -0500 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 1pJwzU-0005vj-KU for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzQ-0002Lw-DR for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:02 -0500 Received: by mail-wm1-x32d.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so10639881wmb.0 for ; Mon, 23 Jan 2023 05:35:59 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.35.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:35:58 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IIgxyXSUr0bntZmMjT7iADRhtvV5tpYANa73KzeI1HU=; b=Wipqwz5NeTk00+eJZWzcr0HtL7TnYmoeHgZKTwYw5SgAgsOs3RM+FJfbRRxcezsKye UnK98NXl8ri6RM1UGhMsfaD2oWtiD7oUvZfVfnFUFOW7rsEjgFKoj2mXwBcLjZ8fZHp3 AoxzmVbVv6e38rSPiOyHETsKzaz6NPYdQ567diI22pz+ncMhWYCwZkSUl5KDsDUi/+To zJcyt8HwHSHQM4MXNi1gmm1s/eIjCc2CTOX1AxOGbi7tmUZkw65Gl8b0aZfCU5zUYj0r bXfSskDn7/nt9AZVPQdpiUTArlO6/Nc5BaM3VXfAFCLSB4DBGQ5Zwx4is/dHpKOz59hd 9Zlg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IIgxyXSUr0bntZmMjT7iADRhtvV5tpYANa73KzeI1HU=; b=PwfdKnGPtwBbtqpqxJEDe/vJ1kiwJrMhSldyPUnFR1rz4nexcHQV6GSH5Kfn5uo0YN QYoeHEw8+h/HYV+SGPQ/+SUcIJL+B+gMmf03j75a1diYX+db1lA9DiTljuq8sLVGO11K QBMxmEY48hXl/W0duMyFWmmI2Vl/sP2max5+G0GVAFOevu/fx1ZriAHf1MBT2a9GLsI1 P2xn6qPPSScFki5uUstQdOMt2j6bXZTBbhRtPklWIDNT7S7Rq36+nRgkvZhsXw5HJ+W8 CwD3ixUG7PifIUU4420hPsr7t7luJZiLpcftNI3KWfIu1E5YFfqP8+4TdamiMULi9kuY kvnA== X-Gm-Message-State: AFqh2kqOTpaPIhtSB/uprPU9OvtGgTuldcBK36SBfPlfbq30ibI6tKOJ fj34elARlaL9ksQoPQtaPRCKSpQHTDC8dHls X-Google-Smtp-Source: AMrXdXuof8zoX3VAI7znaoA0j2GgqgDgneFAqXnYNLTRAzzD4hcoN6NlCfVPp6mz4R+yIxDt0qF45g== X-Received: by 2002:a05:600c:5409:b0:3da:f66a:e866 with SMTP id he9-20020a05600c540900b003daf66ae866mr23992383wmb.10.1674480959023; Mon, 23 Jan 2023 05:35:59 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/26] hw/i2c/bitbang_i2c: Define TYPE_GPIO_I2C in public header Date: Mon, 23 Jan 2023 13:35:30 +0000 Message-Id: <20230123133553.2171158-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481275034100005 From: Philippe Mathieu-Daud=C3=A9 Define TYPE_GPIO_I2C in the public "hw/i2c/bitbang_i2c.h" header and use it in hw/arm/musicpal.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard Message-id: 20230111085016.44551-2-philmd@linaro.org Signed-off-by: Peter Maydell --- include/hw/i2c/bitbang_i2c.h | 2 ++ hw/arm/musicpal.c | 3 ++- hw/i2c/bitbang_i2c.c | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hw/i2c/bitbang_i2c.h b/include/hw/i2c/bitbang_i2c.h index 92334e9016a..a079e6d70f9 100644 --- a/include/hw/i2c/bitbang_i2c.h +++ b/include/hw/i2c/bitbang_i2c.h @@ -3,6 +3,8 @@ =20 #include "hw/i2c/i2c.h" =20 +#define TYPE_GPIO_I2C "gpio_i2c" + typedef struct bitbang_i2c_interface bitbang_i2c_interface; =20 #define BITBANG_I2C_SDA 0 diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 73e2b7e4cef..89b66606c32 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -26,6 +26,7 @@ #include "hw/block/flash.h" #include "ui/console.h" #include "hw/i2c/i2c.h" +#include "hw/i2c/bitbang_i2c.h" #include "hw/irq.h" #include "hw/or-irq.h" #include "hw/audio/wm8750.h" @@ -1303,7 +1304,7 @@ static void musicpal_init(MachineState *machine) =20 dev =3D sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE, qdev_get_gpio_in(pic, MP_GPIO_IRQ)); - i2c_dev =3D sysbus_create_simple("gpio_i2c", -1, NULL); + i2c_dev =3D sysbus_create_simple(TYPE_GPIO_I2C, -1, NULL); i2c =3D (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c"); =20 lcd_dev =3D sysbus_create_simple(TYPE_MUSICPAL_LCD, MP_LCD_BASE, NULL); diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index e9a0612a043..ac84bf02624 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -162,7 +162,6 @@ void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus = *bus) =20 /* GPIO interface. */ =20 -#define TYPE_GPIO_I2C "gpio_i2c" OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C) =20 struct GPIOI2CState { --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481358; cv=none; d=zohomail.com; s=zohoarc; b=OUgsD18rPVJ5yJvLKnHgkyIEhg38tWfWjNGYHftIb7nYo2ETBlTA5UAa0VuZEE8pfOJAXKMFC+twvvWWrGx8iQ7Q7/JTONTMdr/nVJ7LbB88vwOzO7NYkEFeCSne9GPWMMje2Peam0lAcrMeBzrc100MK33SdF3aUaY++4Zjrbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481358; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YmXnlmeCDWnUzpUGh2Egb8JcHFR1ZUCOATZdrEkd6xo=; b=RskqKtkBjwVGfW2fEMLKYKy0EQ4NXRB9GYGBPtnwJEHo2fFHD44W2X/E0hmIi8EhSPolM7pXg0uTpzJypJc2dG7tdG8HD83yjOMpJdQ0PjSoWgfyBWwfaq/WZQfT7/ffde2sCH7INAyvT4HGvmau/bWGu5zip5YfUAMcILq5pAk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167448135830674.60259269873518; Mon, 23 Jan 2023 05:42:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzx-000688-0P; Mon, 23 Jan 2023 08:36:33 -0500 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 1pJwzU-0005vh-KH for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzR-0002M5-IT for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:02 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso8559411wmq.5 for ; Mon, 23 Jan 2023 05:36:00 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.35.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:35:59 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YmXnlmeCDWnUzpUGh2Egb8JcHFR1ZUCOATZdrEkd6xo=; b=N1Odq7GvT6ITPZ5ISHD1B+ZLP0UjFLQJ9ckuY5CEygpozbRCHF14/1QMmqkguci/7W nAN8Xq3C6QK3057noCXrzk5XXOyXy2GRrP93zFTGVpAvxCVaE5c0X8DGGO0nERLEr6h4 2gieaUydYSaUKUWn+jdXuQ8XYIsFnlTXTWIJuGyERTNDkpxJHAbOyKCesyCl0+HtmhZ4 1rBSodRJ+TTNQiHlOb1IKTX0ZwC72Lwd5+C598i6Gl7znF0dLAjeh+sIlT0f9MyYC+7r s8vxWmiKK9+g31HRLl7XjmDc/7SLui2Ed4D3eXJaY9PM0s8qW66YcgF2qLQq7hiLCmGu eEiw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YmXnlmeCDWnUzpUGh2Egb8JcHFR1ZUCOATZdrEkd6xo=; b=NbDWgxp+9UV6EyXEtBh+pu5HSeor+j9XzRtoQJBGjjQ4VYIIdkc4uzwgereReDc9To 8AB7+2jiIWfQrX585tvaDuPq8FQg47aFfUZcq5jxynclqp/iJU2SwXKljf8W9sW3CUJJ +lidhR0HtBAgJnvIPpyqlo3B8SmLGQyWAifU7hhI3FIMGmAj1Ha/OGiYivd4QOz1H1Zc +v6jvVSymjtM13rnklJAFN3+tJ1jo3jTVtS9eK4bXuXfYpy7EuP6XtnQiGa6ZJf+9cDP 291UYyAs35lSztLIIy2iu6/JFYMBZqzgaosSgeNW7eDztumv4g0PUi6vDPb71ErB+Ax+ gObQ== X-Gm-Message-State: AFqh2ko78Ikg02jDbUaMEmkRuvvi+dIyGi2c6vSGU49A2yVbsFI0rEJ7 ePkoOq/+kUrY7gwY3NpWTL0gCQM/ye5pukYu X-Google-Smtp-Source: AMrXdXtopnyimQGkch7dKzViWAUvsj9qsdlkCClzNYXJhAsHAG+2rWrRugptymuYcE11wkCvEUhdvQ== X-Received: by 2002:a05:600c:4f56:b0:3db:1f68:28f with SMTP id m22-20020a05600c4f5600b003db1f68028fmr16064621wmq.24.1674480959820; Mon, 23 Jan 2023 05:35:59 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/26] hw/i2c/bitbang_i2c: Remove unused dummy MemoryRegion Date: Mon, 23 Jan 2023 13:35:31 +0000 Message-Id: <20230123133553.2171158-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481359582100003 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard Message-id: 20230111085016.44551-3-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/i2c/bitbang_i2c.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index ac84bf02624..e41cb63daa7 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -165,9 +165,10 @@ void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus= *bus) OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C) =20 struct GPIOI2CState { + /*< private >*/ SysBusDevice parent_obj; + /*< public >*/ =20 - MemoryRegion dummy_iomem; bitbang_i2c_interface bitbang; int last_level; qemu_irq out; @@ -188,12 +189,8 @@ static void gpio_i2c_init(Object *obj) { DeviceState *dev =3D DEVICE(obj); GPIOI2CState *s =3D GPIO_I2C(obj); - SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); I2CBus *bus; =20 - memory_region_init(&s->dummy_iomem, obj, "gpio_i2c", 0); - sysbus_init_mmio(sbd, &s->dummy_iomem); - bus =3D i2c_init_bus(dev, "i2c"); bitbang_i2c_init(&s->bitbang, bus); =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481107; cv=none; d=zohomail.com; s=zohoarc; b=nKRbGzd54CQpA2snxhPMI0HFgslt5yUxaf7tP7tfw2CNxTr60CxQ0hsXDrdnfv6VtKCe+mMYhXVV4h/NYumH8ubqkosKhHIyAeIh2X7TTAHdzPWtwb9IkO4nr7ZMEnYRK5aKU2uJyBiPiwQaEhSAJO375YmbfHHcZkSmaksnnOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481107; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6g1ePUTRmriS5gLoLUmsa+TXq6zNdDNdJGL0C/i+UZw=; b=eAkVYWYAVWdCvhtQDna6LaxnWiDnMZx5wyzMlgUhs8kUmGWBBE/7ZocU7nIB1X+UIHNFHQ7A7Us0dHLa8NwodvqFKCcF0Eze8+t/II32Acf8keXFVgWLTbyVSnNewii1l5F42oPyA/JzN7JHmB9Z5oPrJusD+eRaC3XD1srlqLI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481107453918.4771425127248; Mon, 23 Jan 2023 05:38:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx01-0006F2-Og; Mon, 23 Jan 2023 08:36:37 -0500 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 1pJwzW-0005vx-0L for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzS-0002MF-VN for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:05 -0500 Received: by mail-wm1-x32a.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso10605050wmc.4 for ; Mon, 23 Jan 2023 05:36:01 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.35.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:00 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6g1ePUTRmriS5gLoLUmsa+TXq6zNdDNdJGL0C/i+UZw=; b=gapkhKbB3ip3m2EWJSaRXMuGmifZOlxOyeicz9GJew4wRgNjcwkonC7mfxJzkXFNq8 ZFE1ugLpxLbj2n9zBtqlatRhsqh5Gj/p7zkzFmk6kn97oSL2xxJ0aTUDjkwLhNKllaOd 2OASyKZk1jQfLQedxwbttCQeyzgwaz8Kb8q8haM7gnUUYCYbxLTb6Q9izmnN2EaW+ACO CBU5D1QcAcXS26MecWDSUl5VaFfK5xHf3FsE0X6z8jj2LjeU9zfC53KW478Z8oPQtCr6 VAN4530AUsyxjYSAIubbRlXvpCfjNm3JspXRgnAkLgbEh05Pr0KrDGkpFQBLQPF9X1vc O4fw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6g1ePUTRmriS5gLoLUmsa+TXq6zNdDNdJGL0C/i+UZw=; b=CiHtU4846GbbImg8CgkZNKK1Uc4peC1pYGiVQdbrHn3aDw/zJBpcx9bfQWm5OZl+A4 4eVqZFee05+FIHDJ3hU6kWUBIsp0qSn3SSyeDnjQzFa1zFWJ2n42Xd3DBc1BkYFA2EOD 8it02/NbcvEqppjMHK2nF/L90xxnVlWj7LQWepRaydXR0Xh+/wQ1td0lgwaScHpOnwOm 6VTF3Jl1RubnzjjF69tyI6zrim8xvNM/q9DK7OWnvN/DBuLgPQ+2Ww72DKal+11Ed72w afUywnr02ovFDc3asthzlSUfZ0SfAqKtNgm+Te5sXZzvmEcBjnyjMxzqcOhHj2nU37nu k/vQ== X-Gm-Message-State: AFqh2krfZQHTeyHaGiGRlTE2wOKMg48WNyTmMXnXotTu+IbXtKyd6nWf b+os830PzK7MLIMkcWqfvQ8O9D+00bNnTXCV X-Google-Smtp-Source: AMrXdXtAARE7+HlZjRCUffaBFb7K9jYXhSRQ5SX0ntGQ/Q+7MnN0oHXQiNDdyGrYwohc3k1VcnoTtQ== X-Received: by 2002:a05:600c:510d:b0:3da:f6ae:faa9 with SMTP id o13-20020a05600c510d00b003daf6aefaa9mr28700687wms.29.1674480960748; Mon, 23 Jan 2023 05:36:00 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/26] hw/i2c/bitbang_i2c: Change state calling bitbang_i2c_set_state() helper Date: Mon, 23 Jan 2023 13:35:32 +0000 Message-Id: <20230123133553.2171158-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481108166100003 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard Message-id: 20230111085016.44551-4-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/i2c/bitbang_i2c.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index e41cb63daa7..bf4b781393d 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -26,13 +26,19 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } wh= ile (0) #define DPRINTF(fmt, ...) do {} while(0) #endif =20 +static void bitbang_i2c_set_state(bitbang_i2c_interface *i2c, + bitbang_i2c_state state) +{ + i2c->state =3D state; +} + static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) { DPRINTF("STOP\n"); if (i2c->current_addr >=3D 0) i2c_end_transfer(i2c->bus); i2c->current_addr =3D -1; - i2c->state =3D STOPPED; + bitbang_i2c_set_state(i2c, STOPPED); } =20 /* Set device data pin. */ @@ -69,7 +75,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line,= int level) if (level =3D=3D 0) { DPRINTF("START\n"); /* START condition. */ - i2c->state =3D SENDING_BIT7; + bitbang_i2c_set_state(i2c, SENDING_BIT7); i2c->current_addr =3D -1; } else { /* STOP condition. */ @@ -96,7 +102,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line= , int level) case SENDING_BIT7 ... SENDING_BIT0: i2c->buffer =3D (i2c->buffer << 1) | data; /* will end up in WAITING_FOR_ACK */ - i2c->state++;=20 + bitbang_i2c_set_state(i2c, i2c->state + 1); return bitbang_i2c_ret(i2c, 1); =20 case WAITING_FOR_ACK: @@ -117,13 +123,14 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int l= ine, int level) * device we were sending to decided to NACK us). */ DPRINTF("Got NACK\n"); + bitbang_i2c_set_state(i2c, SENT_NACK); bitbang_i2c_enter_stop(i2c); return bitbang_i2c_ret(i2c, 1); } if (i2c->current_addr & 1) { - i2c->state =3D RECEIVING_BIT7; + bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } else { - i2c->state =3D SENDING_BIT7; + bitbang_i2c_set_state(i2c, SENDING_BIT7); } return bitbang_i2c_ret(i2c, 0); } @@ -134,18 +141,18 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int l= ine, int level) case RECEIVING_BIT6 ... RECEIVING_BIT0: data =3D i2c->buffer >> 7; /* will end up in SENDING_ACK */ - i2c->state++; + bitbang_i2c_set_state(i2c, i2c->state + 1); i2c->buffer <<=3D 1; return bitbang_i2c_ret(i2c, data); =20 case SENDING_ACK: - i2c->state =3D RECEIVING_BIT7; if (data !=3D 0) { DPRINTF("NACKED\n"); - i2c->state =3D SENT_NACK; + bitbang_i2c_set_state(i2c, SENT_NACK); i2c_nack(i2c->bus); } else { DPRINTF("ACKED\n"); + bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } return bitbang_i2c_ret(i2c, 1); } --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481273; cv=none; d=zohomail.com; s=zohoarc; b=CRZDRZWMlP8dukf9SBxoyhIPre0vFemr3K4WRS4WNjCSy4+zs/C7Li67TwREEdUj32KHTy08TtwcNeYB63Q7qgesElIfej7bgG48rzLYDB41ZzvJUd6ydj45OoB5PJC1RLJ/koGuHesABsa+zmmyieOfkn1VvujjXfnP7+blGsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481273; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w55BWEiCagDu8rhFOm3b8OsC2R7luqRvAnPZEXr+dRQ=; b=EGZipREAs8/3Tk2Vh9wNThip3NNxzNaJDcXXmTUf9eGgvS3fr7LsI1NGxFFpFvMeW/QptJTeX0VnHzzvGjKoNDPmiYSUQWEhdOGv6dfTqh6X5jCXc9K1EM+YMJbgtVPLCCBonos7h8YFzEv7Jb4P1h+H1RHT42KnQofalUgMbb0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481273016931.8760378682542; Mon, 23 Jan 2023 05:41:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzy-0006AB-UA; Mon, 23 Jan 2023 08:36:34 -0500 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 1pJwzX-0005wD-Bc for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 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 1pJwzT-0002MS-VO for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:06 -0500 Received: by mail-wm1-x335.google.com with SMTP id q8so9011389wmo.5 for ; Mon, 23 Jan 2023 05:36:02 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:01 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=w55BWEiCagDu8rhFOm3b8OsC2R7luqRvAnPZEXr+dRQ=; b=qRn8xLe9R6b8GOWtOqQVwxcoPKV7XoJpE7FRmfruv6HkCNhRX/ThP7Wg3UxPQ4drmA 9n56YgSYRfjOYoRs9yrxceOlEiCHdu0Om+/Ij2/lTBXsRmhWTltURDTlWgr3axfvB+x8 5+iAIIrRM9bkpbcj8FMZqeI3HL8FItC+wpU7APLZYejY0HeIS9RkbbnGRz4+iGBj6gHM bHaUJ/wVfaNaaUC6ljWnoBB//M//pU0cyB1fZc9TjbKglFmUieYp4lzCjw3QqCROC191 RNcczzHaxcUw5eHWz89PV3XWxAlDk3bxSXTsY//sGCDdHGG5wejodSDIlsS2G4U3QliC 2A9Q== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w55BWEiCagDu8rhFOm3b8OsC2R7luqRvAnPZEXr+dRQ=; b=PHfJ3i0w5M1Ul9jT6sTzD4r7MEwyRX8UMTmIwfNSkmIWkFquX5cu3QaLjBIegw6N5h +AvOiO5BPaLfpspJXvUpfmHhJ9A8Nc6xvOGP+MH/37Rpt7btVAdFeLvBXz2M5MOaTphj J1hMs/UXqUdFD4gsD8BjiqU5gT5kQySTQuqp0Dy3E0GFqfjj3lmU8YX6pN2KhanTrIZZ rgQCWUBEjutSnZ3tRLlyI3Z6eOGKoOY2ALq52vumsiaurnrAWs3Q0G9OaJ64db4/QqBj Z++9knfUhW8Tj8zLXb941sGprq48FSHK64VbLw6ygxutg6hMlyl1+Imkk2vbvMPyOpIE boDA== X-Gm-Message-State: AFqh2koGUnzAxt2hic82UuQqcvHm/1wnqv6p61dQITxLm5WCkQyQJbQG BEqptY0OGBzWyE3MC8NmKqaElK5XDeXhfmTL X-Google-Smtp-Source: AMrXdXuUUaqwxWOV3AaELSN+sM8DdrpsCSeVLeAhqyyT9QbjPXXtb+4PdO+d/8ZbgKqv7ftFgrI3Fw== X-Received: by 2002:a05:600c:354a:b0:3da:1f6a:7b36 with SMTP id i10-20020a05600c354a00b003da1f6a7b36mr24330608wmq.0.1674480961489; Mon, 23 Jan 2023 05:36:01 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/26] hw/i2c/bitbang_i2c: Trace state changes Date: Mon, 23 Jan 2023 13:35:33 +0000 Message-Id: <20230123133553.2171158-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@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 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481275055100006 From: Philippe Mathieu-Daud=C3=A9 Trace bitbang state machine changes with trace events. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Corey Minyard Message-id: 20230111085016.44551-5-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/i2c/bitbang_i2c.c | 33 ++++++++++++++++++++++++++++----- hw/i2c/trace-events | 3 +++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index bf4b781393d..efc49b7502f 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -16,6 +16,7 @@ #include "hw/sysbus.h" #include "qemu/module.h" #include "qom/object.h" +#include "trace.h" =20 //#define DEBUG_BITBANG_I2C =20 @@ -26,15 +27,41 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } wh= ile (0) #define DPRINTF(fmt, ...) do {} while(0) #endif =20 +/* bitbang_i2c_state enum to name */ +static const char * const sname[] =3D { +#define NAME(e) [e] =3D stringify(e) + NAME(STOPPED), + [SENDING_BIT7] =3D "SENDING_BIT7 (START)", + NAME(SENDING_BIT6), + NAME(SENDING_BIT5), + NAME(SENDING_BIT4), + NAME(SENDING_BIT3), + NAME(SENDING_BIT2), + NAME(SENDING_BIT1), + NAME(SENDING_BIT0), + NAME(WAITING_FOR_ACK), + [RECEIVING_BIT7] =3D "RECEIVING_BIT7 (ACK)", + NAME(RECEIVING_BIT6), + NAME(RECEIVING_BIT5), + NAME(RECEIVING_BIT4), + NAME(RECEIVING_BIT3), + NAME(RECEIVING_BIT2), + NAME(RECEIVING_BIT1), + NAME(RECEIVING_BIT0), + NAME(SENDING_ACK), + NAME(SENT_NACK) +#undef NAME +}; + static void bitbang_i2c_set_state(bitbang_i2c_interface *i2c, bitbang_i2c_state state) { + trace_bitbang_i2c_state(sname[i2c->state], sname[state]); i2c->state =3D state; } =20 static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) { - DPRINTF("STOP\n"); if (i2c->current_addr >=3D 0) i2c_end_transfer(i2c->bus); i2c->current_addr =3D -1; @@ -73,7 +100,6 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line= , int level) return bitbang_i2c_nop(i2c); } if (level =3D=3D 0) { - DPRINTF("START\n"); /* START condition. */ bitbang_i2c_set_state(i2c, SENDING_BIT7); i2c->current_addr =3D -1; @@ -122,7 +148,6 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int lin= e, int level) /* NACK (either addressing a nonexistent device, or the * device we were sending to decided to NACK us). */ - DPRINTF("Got NACK\n"); bitbang_i2c_set_state(i2c, SENT_NACK); bitbang_i2c_enter_stop(i2c); return bitbang_i2c_ret(i2c, 1); @@ -147,11 +172,9 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int li= ne, int level) =20 case SENDING_ACK: if (data !=3D 0) { - DPRINTF("NACKED\n"); bitbang_i2c_set_state(i2c, SENT_NACK); i2c_nack(i2c->bus); } else { - DPRINTF("ACKED\n"); bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } return bitbang_i2c_ret(i2c, 1); diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index 52dbd53a234..48aee4887c4 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -1,5 +1,8 @@ # See docs/devel/tracing.rst for syntax documentation. =20 +# bitbang_i2c.c +bitbang_i2c_state(const char *old_state, const char *new_state) "state %s = -> %s" + # core.c =20 i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x)" --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481149; cv=none; d=zohomail.com; s=zohoarc; b=ARgYPJuO4JCrCsUA4y5yFakqYQRRxdxDQ5SYSOuF4/hVuSv2h3tBMlrcB13cVK7BhyczLlHWQNTJAuBeb3pbFybYrc7XQ+S/OsI/4rbY0YOk2ujLk6RGZcXPfKw38uRLAyD4OQ2fFmACZwy8ZtI4yiYHMn4oqDjdlRkfCIYbq/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481149; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ajiuKuxh7mBml7IbKxk3IiOiyKWtjxLpWptuFD5vSqA=; b=GKRFSFFRxvBAGrQ96lQ6IVHIQlK4+IrWjsazLtPbLgpw9HCMcp6solK69cf0puIhjzSlfW46nkEH5N2MLlrlNjIRdjlNrD8tkUUGXXS3vE7zPmn79kh2/gQQRVcb8S7/85RgHZTzp5Fkt9nh3BzpAjDWjJn/Pzcf1tYzIzgh9oY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481149149129.18689622749116; Mon, 23 Jan 2023 05:39:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzw-00067l-47; Mon, 23 Jan 2023 08:36:32 -0500 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 1pJwzW-0005wA-U4 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzU-0002Mg-1T for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:05 -0500 Received: by mail-wm1-x331.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so10622400wma.1 for ; Mon, 23 Jan 2023 05:36:03 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:01 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ajiuKuxh7mBml7IbKxk3IiOiyKWtjxLpWptuFD5vSqA=; b=iIvtyJ0ZlaFi6umY76siNSJc+GznIVIm5Xcro+uY59F16XwmbQyecIRg4py1Tyj5ky jO+R9c1dyrqrzv2RvNXFz750m4n2ChxFBdnrpMZEFF+wrpZ7GHwHddsP8i2muqPtM6FK r2cwtTito0jEKRoykhBcU6QAem2QcVRtr28vF7xdN/bEocBjwDRcMrXAxHnjt3B2D/oy EpQ5FE9bbXUDxmClRxlxv/W4iJ7SG8meovUdbm5jtG7AqbBtmjOd9/7Y9tEyAsU4L38z Dn8p1hW5tL6g3awXQHNmQzEJAtauGLzNjwUOV6VtXmkvn/iQMkAWdXRlp3kS0D2sKjJT 0VMw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ajiuKuxh7mBml7IbKxk3IiOiyKWtjxLpWptuFD5vSqA=; b=ZReGUgk9lH9Gq0kXz2SG4IftEoggesttezdBu3boMZCrugYn1d5CzR5gmT9JECtNgh ZnEtArRIognCWPK4i9BbfC2dzkK4brpMR1oqJyJb1fjTky9q8BtAidTNZFQ3Lm0c3aqY 7cQ3VgD69BG5NcG7to3xVar4T4MaQEnEkEZhROzdnO1C6zNfiLhMAygxY6JwRdtwTvcX M3XS6ImzshP8w+Rk4OfggKl2cmEECrIL4QMktJE9RfAJ8t7kP72mT3+Uq2GGxA8qHO42 KzD7E1rg79nan4GxIUWHuXmLUEIfhueX6KO/ErU79v9MazTinSU8318mKhuxy0z8OY6z gR7g== X-Gm-Message-State: AFqh2kr42eXdwQAGMv239ldFGgQ758vVgU7ksEKPLyTbf5ff6meNDhsl gEjmRSywCz4yhmyffljfnPbQWT1tsSG7Ia+R X-Google-Smtp-Source: AMrXdXvnRE200a1hsI1zhGKqV7Jt0WvLJns2SB8YPaSSmRzqgSmSVawXCmSF6F7+bxxfg+zC0STnzw== X-Received: by 2002:a05:600c:a29f:b0:3d9:f42c:56c5 with SMTP id hu31-20020a05600ca29f00b003d9f42c56c5mr24002311wmb.4.1674480962334; Mon, 23 Jan 2023 05:36:02 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/26] hw/i2c/bitbang_i2c: Convert DPRINTF() to trace events Date: Mon, 23 Jan 2023 13:35:34 +0000 Message-Id: <20230123133553.2171158-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481150365100005 From: Philippe Mathieu-Daud=C3=A9 Convert the remaining DPRINTF debug macro uses to tracepoints. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Acked-by: Corey Minyard Message-id: 20230111085016.44551-6-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/i2c/bitbang_i2c.c | 18 ++++++------------ hw/i2c/trace-events | 4 ++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index efc49b7502f..bb189547651 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -18,14 +18,6 @@ #include "qom/object.h" #include "trace.h" =20 -//#define DEBUG_BITBANG_I2C - -#ifdef DEBUG_BITBANG_I2C -#define DPRINTF(fmt, ...) \ -do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) do {} while(0) -#endif =20 /* bitbang_i2c_state enum to name */ static const char * const sname[] =3D { @@ -71,8 +63,10 @@ static void bitbang_i2c_enter_stop(bitbang_i2c_interface= *i2c) /* Set device data pin. */ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level) { + trace_bitbang_i2c_data(i2c->last_clock, i2c->last_data, + i2c->device_out, level); i2c->device_out =3D level; - //DPRINTF("%d %d %d\n", i2c->last_clock, i2c->last_data, i2c->device_o= ut); + return level & i2c->last_data; } =20 @@ -137,11 +131,11 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int l= ine, int level) =20 if (i2c->current_addr < 0) { i2c->current_addr =3D i2c->buffer; - DPRINTF("Address 0x%02x\n", i2c->current_addr); + trace_bitbang_i2c_addr(i2c->current_addr); ret =3D i2c_start_transfer(i2c->bus, i2c->current_addr >> 1, i2c->current_addr & 1); } else { - DPRINTF("Sent 0x%02x\n", i2c->buffer); + trace_bitbang_i2c_send(i2c->buffer); ret =3D i2c_send(i2c->bus, i2c->buffer); } if (ret) { @@ -161,7 +155,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int lin= e, int level) } case RECEIVING_BIT7: i2c->buffer =3D i2c_recv(i2c->bus); - DPRINTF("RX byte 0x%02x\n", i2c->buffer); + trace_bitbang_i2c_recv(i2c->buffer); /* Fall through... */ case RECEIVING_BIT6 ... RECEIVING_BIT0: data =3D i2c->buffer >> 7; diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index 48aee4887c4..8e88aa24c1a 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -2,6 +2,10 @@ =20 # bitbang_i2c.c bitbang_i2c_state(const char *old_state, const char *new_state) "state %s = -> %s" +bitbang_i2c_addr(uint8_t addr) "Address 0x%02x" +bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x" +bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x" +bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned ne= w_out) "dat %u clk %u out %u -> %u" =20 # core.c =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481149; cv=none; d=zohomail.com; s=zohoarc; b=AWkbS9Pqt0GxJpA6ZdQI5VfXpsPieuqZ1T5O6oFLkjYNHkj/cttFC7hrZ4RJnQeCCphvtWY2TA6Xf47V8I8ihhVpJhqs3uvdMUTpc2wHiE1KsoWjCrRTgskvuPZ8Op/R++Wa/QtMmxeSmstjG1H7QaBrmTCNDOTYFEeHMHhfLxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481149; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wkC9VodrEkubPHoJig8p7hlAtgaFbvzuu8bhIKhFiNs=; b=XYairMGEA9g/ImoS4m/gEvGoFlbV9WamaFHpKSJHD1Ks3Tb7IfeiiB/X+SPctJwNUDKIgT8WgxcRusZ8BBwAnjmgko8WsLczL0VgP/bFCD9qEyWNMgYSIaVhN+hRj9x3fD7LrdTnB/+8GjcX+zFBgJ1Zotrk2lpulHQuoUldu0o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481149244904.9343449977433; Mon, 23 Jan 2023 05:39:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzw-000687-PL; Mon, 23 Jan 2023 08:36:32 -0500 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 1pJwzY-0005wb-Ih for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzV-0002Mo-Np for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:07 -0500 Received: by mail-wm1-x336.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so10640047wmb.0 for ; Mon, 23 Jan 2023 05:36:04 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:02 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wkC9VodrEkubPHoJig8p7hlAtgaFbvzuu8bhIKhFiNs=; b=rr22wxB8O///C7OBNFb9xyn2jb25U2yG/0a27ViWD598z7tnwan8mU0Zu/pzT/t8KH tMYmrfaygNTjtvX7BwkMQkKNc9r4OKLFh1LA/EI0HxaW49uSy2rhD/3h7+zU7J+f3wkq Bka7PjtmKYGtqBIfGYtlpRD994JGs0erR3/15SpYVRY+OwIczjAywJLFELyhyHLZ7BoG d2apZLnoZD06mCmLKu/I35uIeHujHTZFEH6PmQJMXOVLxfOVPtTrU5lx1AyZaGvsIqRk nOpAwvIQiuj0nC0Q0+fqzWLHmPmxdVVZPdW2wsWCY338f9F9yCDinXY+dUXP59BMjrJJ sE3Q== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wkC9VodrEkubPHoJig8p7hlAtgaFbvzuu8bhIKhFiNs=; b=bBYmGE/MNM3YiFzhUYrghRl3xCAW9eIAPa/InhMHHtrtg0qCjopv8MS2DZ4RxXw/bh zySbFM1OKv7qqt9GWVV7t2LzYsDuK6oop8TRCYL0h2MdRc+JMM9OGc1LrnJ7gyLEtWmN oSypjI2AV00qeqseQ56aEcng9gby5CF34lKFjOY0+HgrHtz/vWIP8OOaxrQn+eKLBh2k jNWbyZ3aM2p7tTXt4gLLbXYDB6/3CBsWG+JuEHUzM/J/vAS79uhBXtvOMcGBN2Tf+KtP i4BPw3KFk0Ib8i0W1RpsjLgWqlI5hChz3cWK1QFh8JQEZMQzLs2pSDvYPZDiibDuD4+Y ZrbA== X-Gm-Message-State: AFqh2kr6lMJb9NK6ZOtPbPGIni83Zy56Ww5SpsHbH6HvDaMMpX7TwG+L +0DHXhbJHyA3grrdktLaChCmF/S50zuwBoDh X-Google-Smtp-Source: AMrXdXvTRauHkApUwnpjm8DEAr/wZNXHLQYubjS61Cqy2CjwqQNX3zllU60hCmSHaYevgOpmmS293w== X-Received: by 2002:a05:600c:54d0:b0:3d9:7847:96e2 with SMTP id iw16-20020a05600c54d000b003d9784796e2mr24027260wmb.2.1674480963158; Mon, 23 Jan 2023 05:36:03 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/26] hw/i2c/versatile_i2c: Drop useless casts from void * to pointer Date: Mon, 23 Jan 2023 13:35:35 +0000 Message-Id: <20230123133553.2171158-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481150368100006 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20230110082508.24038-2-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/i2c/versatile_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index 3a04ba39691..52a650f45ee 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -45,7 +45,7 @@ REG32(CONTROL_CLR, 4) static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, unsigned size) { - VersatileI2CState *s =3D (VersatileI2CState *)opaque; + VersatileI2CState *s =3D opaque; =20 switch (offset) { case A_CONTROL_SET: @@ -60,7 +60,7 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr o= ffset, static void versatile_i2c_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { - VersatileI2CState *s =3D (VersatileI2CState *)opaque; + VersatileI2CState *s =3D opaque; =20 switch (offset) { case A_CONTROL_SET: --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481065; cv=none; d=zohomail.com; s=zohoarc; b=jyVxjtQGKlWPOsNZuxSt2i9gGow66OJLf0QfybpfxZ/wdIuv7WxgF8UJ29hTKxyfqdADzpZwkvrG2mbL9cyfxnRUwPDU88f3uvmobVIHijGkOCblp+DnW8oKPOcM9js19BMVzPv0B43b16ty4Eo7bep+2JSvKctIaBiwygI1V8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481065; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ea17f0Na5Eii5BWvhP8T/nWUNUn1BNxyDUvea71J5gg=; b=NyjhZBQpaZDcieRpib3SjKC4O8x2EK3l5O3sSmjW2xcZBvDQCE7ucRr708A+RMoU0WTj2LRdFqHeYGg/wpjaiqFK/gdeu7zhO3FvIqFBa5A9ABSCxfir4ONv4Uw9PZkMK1sHdqQ3C25rqtVBpNXjSKtJBs+P8eBTsqAJgkqns4o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481065157284.0821171643296; Mon, 23 Jan 2023 05:37:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzx-00068P-8E; Mon, 23 Jan 2023 08:36:33 -0500 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 1pJwzY-0005wc-Iv for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 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 1pJwzV-0002NO-O9 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:07 -0500 Received: by mail-wm1-x335.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso8572656wms.3 for ; Mon, 23 Jan 2023 05:36:04 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:03 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ea17f0Na5Eii5BWvhP8T/nWUNUn1BNxyDUvea71J5gg=; b=UH97Ge+kSAC8kqEZz8J7zaVm2reLtqedHpb+WaWoOaJUxQFTJydv8hrvUrTQ9+FVPd zdYtKJwv+PmavrRAxiSd/8cnBn4OuBlMCtznkj1P1tgnE1k3tqzk6p1qqkadGZqh0w4p 0jAVqfQgKZxCBcyU0M/gQFjmOtTNEIRWV3ZxvKmTkJ7gOS+FTavoGHaPO+dMpCzVszUY lbWfP+DlHlkTOWTZAfYYxN+zkELeEQl6bZHIIF61O6x4TNByicVcjKhHUsudIjhvop83 m4n1Bs41dIJhDqR5XAP15vFS8AtyNx6COV2k8Z0jUIr0Go+NMxFkNTzyUL3ERqP3v7nB h/pg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ea17f0Na5Eii5BWvhP8T/nWUNUn1BNxyDUvea71J5gg=; b=GC7iqewe6CbImkvOEjQVYMxECk+K6rWRIMOHW6KBzRg9/s21CcO06CCQuifCnNIuPM DLtTGRsNBV9+RP7RkKEQtTHxkDStJsVpxWhEyp2uuVpa7LZUOwRsefH7zt3x5xxtE3Rw jBxhilqSvKV36qQqmDgWRfa/KkwJViqVJHoVKJpG2TApYijPfraZ1cCDRZ+O2l33XCUn +DWhp59UwL6MRBU/rdKxBtRRzrph/kfyDMCg0jtWmRVeo75MWJTwAY/MEMaiJZNm1MkL COsK8scA2Zjcaw1m5dSWkCqTBPUek6uDsE28gGHtTYls3sRCkp9VbCusnIJURMIp4PyY XMYg== X-Gm-Message-State: AFqh2krzpw90XABAqNmGrbe4htux8eGqAN6jIigiMaAh3wvxcCAjk+n0 uBIKF1ZU2VhVaMIPBGj5f6m2ZGldxUNfcu9b X-Google-Smtp-Source: AMrXdXuxt8auB3STZf3mptCtVxCY704tEyjJBGZhzJxct5mkriJZ9+vGxjp8WIHAk6b02Er+m0AXTA== X-Received: by 2002:a05:600c:3d16:b0:3d0:6a57:66a5 with SMTP id bh22-20020a05600c3d1600b003d06a5766a5mr24158285wmb.0.1674480964017; Mon, 23 Jan 2023 05:36:04 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/26] hw/i2c/versatile_i2c: Replace VersatileI2CState -> ArmSbconI2CState Date: Mon, 23 Jan 2023 13:35:36 +0000 Message-Id: <20230123133553.2171158-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@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 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481065970100001 From: Philippe Mathieu-Daud=C3=A9 In order to rename TYPE_VERSATILE_I2C as TYPE_ARM_SBCON_I2C (the formal ARM naming), start renaming its state. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20230110082508.24038-3-philmd@linaro.org Signed-off-by: Peter Maydell --- include/hw/i2c/arm_sbcon_i2c.h | 3 +-- hw/i2c/versatile_i2c.c | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/hw/i2c/arm_sbcon_i2c.h b/include/hw/i2c/arm_sbcon_i2c.h index f54d1e54135..0101422d9dc 100644 --- a/include/hw/i2c/arm_sbcon_i2c.h +++ b/include/hw/i2c/arm_sbcon_i2c.h @@ -21,8 +21,7 @@ #define TYPE_ARM_SBCON_I2C TYPE_VERSATILE_I2C =20 typedef struct ArmSbconI2CState ArmSbconI2CState; -DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, ARM_SBCON_I2C, - TYPE_ARM_SBCON_I2C) +DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, ARM_SBCON_I2C, TYPE_ARM_SBCON_I= 2C) =20 struct ArmSbconI2CState { /*< private >*/ diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index 52a650f45ee..ee095762e57 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -30,7 +30,7 @@ #include "qom/object.h" =20 typedef ArmSbconI2CState VersatileI2CState; -DECLARE_INSTANCE_CHECKER(VersatileI2CState, VERSATILE_I2C, +DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, VERSATILE_I2C, TYPE_VERSATILE_I2C) =20 =20 @@ -45,7 +45,7 @@ REG32(CONTROL_CLR, 4) static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, unsigned size) { - VersatileI2CState *s =3D opaque; + ArmSbconI2CState *s =3D opaque; =20 switch (offset) { case A_CONTROL_SET: @@ -60,7 +60,7 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr o= ffset, static void versatile_i2c_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { - VersatileI2CState *s =3D opaque; + ArmSbconI2CState *s =3D opaque; =20 switch (offset) { case A_CONTROL_SET: @@ -86,7 +86,7 @@ static const MemoryRegionOps versatile_i2c_ops =3D { static void versatile_i2c_init(Object *obj) { DeviceState *dev =3D DEVICE(obj); - VersatileI2CState *s =3D VERSATILE_I2C(obj); + ArmSbconI2CState *s =3D VERSATILE_I2C(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); I2CBus *bus; =20 @@ -100,7 +100,7 @@ static void versatile_i2c_init(Object *obj) static const TypeInfo versatile_i2c_info =3D { .name =3D TYPE_VERSATILE_I2C, .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(VersatileI2CState), + .instance_size =3D sizeof(ArmSbconI2CState), .instance_init =3D versatile_i2c_init, }; =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481133; cv=none; d=zohomail.com; s=zohoarc; b=CayZg3WHBDQhGm+m/O9VM6Zh0vt7oQvFAUiM3qNtQEgb8DaWXc0j26ZLKwrnMSxPMeH5QNJDwMF48HEQqu+eICog/Qhim7clq+llzD6VZJBTeEr7FmIAcD36NgZ0DlQ129FxKN5KUX2CNU0zoLQpc+nmdY0vjcVqZIn1X3sQXa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481133; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n+Z4F18ikzEKW2fIzsVDR9UWsk1P14NLzyqF4zsWzHQ=; b=QsvIwSN1BnnFQxTwSAAl04evwp6aZwHvGHBCwX0lmuvN8+ZMOxnpgKxgCpV5zflmMqPdtYeCSeqVXQziSm4sSIaa3t7KxZ7CY6qUkzlZUVlvZtqeGheMYn6t+R5zBNsg+BEFI9ONP4VQOBisyhVf6d4iwKUfipmDeggtzz8AlmA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481133423637.7443048506656; Mon, 23 Jan 2023 05:38:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzy-00068t-0f; Mon, 23 Jan 2023 08:36:34 -0500 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 1pJwzY-0005wn-Pr for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzV-0002Lw-PS for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:08 -0500 Received: by mail-wm1-x32d.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so10640101wmb.0 for ; Mon, 23 Jan 2023 05:36:05 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:04 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=n+Z4F18ikzEKW2fIzsVDR9UWsk1P14NLzyqF4zsWzHQ=; b=NPIqZLfbly6385rX4/2lS2XUPTbfK14VYXP8U5W1AmUYcVz2LESbFRTdx+1rpFgY+H Ca8F18FXYGckAqlhBMCvlvGWDjb1TM5wxmsVxd25JG8JjYB+Ej9Zj7bUVMEEsOI67IER UX2+AlOHRSOpsVKSfWgEZnJ1hZ+KC+O9D4h5+saIUZCa2jf51wgMygoPdlVJmPseI/ji Jn0psp3rPxA+A+EfeMDyXIB7/tk1ii1LyLV9Klu+ECLG9IjIgk9H3R1Wm5tcBUit7rjW n2d1kiFpKln8ejrevM/I2PPxT0DnBYVDWilakQhHmpdYhzEx3+KmxqU6DuKNn08gPBDX hi4g== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n+Z4F18ikzEKW2fIzsVDR9UWsk1P14NLzyqF4zsWzHQ=; b=tKAAtCH2voJisjyIe6rxgQKmOq7nPIQIKWMYW/7hrh5jx0yn/SkiatFvi/s1LM14Fz KZYu1oru6D5C1HqpC1yV5eZtpXWWVe5uPSkpEPvD87RZvx4wOI2BhOipyoBJrkZ/E8lZ lBqXczlRJ/B2gPN3vrvDGRrTu4XNQWwRZJyQ6HH9eK9Geydj5cFrWHI4Z1EsKFhfCaPg HhKwLGwa+vpC4vFU9x0YajsOpmrAp3q+wMsn7MinaqG/SDAMgkYutVxbW4B1RBWwn8hh QSYUDXNgKjI91gLZ+7cGlU1FyeP0JpqUd5AOyNfNl4SB9z9aybxOtt2RwkOM/+5V/9Yj wLTg== X-Gm-Message-State: AFqh2kqDWhn03o8kS+gKMD8bw7odU4wplli0+nJLte4+/2fnCXuGjvAy JNUdzq7Wg+MW1W2WBlgXzxeUkTNws49gApVq X-Google-Smtp-Source: AMrXdXttYYZLJ2mcCenKPRlW/h/VDOjutHdljVU30dr402M8JaX4wog4ShKZ71DG6Oe4DTXUS+MvLw== X-Received: by 2002:a05:600c:1695:b0:3da:f502:83b5 with SMTP id k21-20020a05600c169500b003daf50283b5mr24278448wmn.2.1674480964856; Mon, 23 Jan 2023 05:36:04 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/26] hw/i2c/versatile_i2c: Replace TYPE_VERSATILE_I2C -> TYPE_ARM_SBCON_I2C Date: Mon, 23 Jan 2023 13:35:37 +0000 Message-Id: <20230123133553.2171158-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481134324100001 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20230110082508.24038-4-philmd@linaro.org Signed-off-by: Peter Maydell --- include/hw/i2c/arm_sbcon_i2c.h | 3 +-- hw/arm/realview.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 2 +- hw/i2c/versatile_i2c.c | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/hw/i2c/arm_sbcon_i2c.h b/include/hw/i2c/arm_sbcon_i2c.h index 0101422d9dc..da9b5e8f83b 100644 --- a/include/hw/i2c/arm_sbcon_i2c.h +++ b/include/hw/i2c/arm_sbcon_i2c.h @@ -17,8 +17,7 @@ #include "hw/i2c/bitbang_i2c.h" #include "qom/object.h" =20 -#define TYPE_VERSATILE_I2C "versatile_i2c" -#define TYPE_ARM_SBCON_I2C TYPE_VERSATILE_I2C +#define TYPE_ARM_SBCON_I2C "versatile_i2c" =20 typedef struct ArmSbconI2CState ArmSbconI2CState; DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, ARM_SBCON_I2C, TYPE_ARM_SBCON_I= 2C) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index d2dc8a89525..a5aa2f046ae 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -309,7 +309,7 @@ static void realview_init(MachineState *machine, } } =20 - dev =3D sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); + dev =3D sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL); i2c =3D (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "ds1338", 0x68); =20 diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 43172d72ea4..05b9462a5b7 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -336,7 +336,7 @@ static void versatile_init(MachineState *machine, int b= oard_id) /* Add PL031 Real Time Clock. */ sysbus_create_simple("pl031", 0x101e8000, pic[10]); =20 - dev =3D sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); + dev =3D sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL); i2c =3D (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "ds1338", 0x68); =20 diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 757236767b0..34b012b528b 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -646,7 +646,7 @@ static void vexpress_common_init(MachineState *machine) sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]); sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]); =20 - dev =3D sysbus_create_simple(TYPE_VERSATILE_I2C, map[VE_SERIALDVI], NU= LL); + dev =3D sysbus_create_simple(TYPE_ARM_SBCON_I2C, map[VE_SERIALDVI], NU= LL); i2c =3D (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "sii9022", 0x39); =20 diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index ee095762e57..b95c70608b2 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -31,7 +31,7 @@ =20 typedef ArmSbconI2CState VersatileI2CState; DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, VERSATILE_I2C, - TYPE_VERSATILE_I2C) + TYPE_ARM_SBCON_I2C) =20 =20 =20 @@ -98,7 +98,7 @@ static void versatile_i2c_init(Object *obj) } =20 static const TypeInfo versatile_i2c_info =3D { - .name =3D TYPE_VERSATILE_I2C, + .name =3D TYPE_ARM_SBCON_I2C, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(ArmSbconI2CState), .instance_init =3D versatile_i2c_init, --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481251; cv=none; d=zohomail.com; s=zohoarc; b=Hl0rkMd9A/9z7nfeFosraiZpF3hEZIbKOKVZ73wUOwoh7bfFA0YxIi1ivDHWCNwdhB/hdzGL7x5pWw1LBMM+xCOKK+/BqTgcW5NoQK93NrMawYNIPQRAURA33s7Jxga8CsoESLj/nKeO9e7lO0ik1jXo7r2ioSEiOqdd6UF0fsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481251; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1+71eOJG8GsVCLoNEVtR5oknFA2XfD2q/R1m6fbM4mk=; b=ZHFZvkRMZ2Cc7EMYG77wTRR8Y/YhsldRUH7lfUCGq4b8oCAP9HE9xyNppjV1WQdkW8mhStS0l0FFYLwSqYCQfKjeJq0/6M+ECfst7aQIv/ANOUGHej1p75j4saUKU6+wiNjJ0NxKYqtsN8k5k4Y07HA7LiJXxT4RoU5r5QW4RC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481251125240.7215313708342; Mon, 23 Jan 2023 05:40:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzy-00068v-6M; Mon, 23 Jan 2023 08:36:34 -0500 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 1pJwzZ-0005x3-Kw for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzX-0002Om-8Z for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:09 -0500 Received: by mail-wm1-x32a.google.com with SMTP id g10so9034903wmo.1 for ; Mon, 23 Jan 2023 05:36:06 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:05 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1+71eOJG8GsVCLoNEVtR5oknFA2XfD2q/R1m6fbM4mk=; b=BfeyaEPIc6ygebMNcOOg0E4x2DBgG++njx7YJFtUZw9M4Yf70xGwed8oaSNEUxq7Y0 KJDD+RAz+Z+MBbSnZFSxZRWh5xor49yyjnt3gGWRx00VksAyTMJRCWS2W/81zUAQLFio pwOavWsBs7wxs9nAfGdohAVpIV3Ads/EqqGgGqhiomyaYHmLgbfCd7SavA1ZIMY/FQEp orWE7KRbqfQBl6mRpBCHrvPqrwloZ3eJNAIb5FTx/aHolpkVl+eIp3Wqpe3MZp7TT8ZS JtAjnH4rrDaosOfyHwVrhw5Mp5k7dE6eIwtnRi9FjoalYvL3fSRh5kYaBitfxwMqHDNg Bppg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1+71eOJG8GsVCLoNEVtR5oknFA2XfD2q/R1m6fbM4mk=; b=WrDfkdJ6jXYloQGggoUYgj/+4UxSQjZQIczYDzVqxpz7voMVNmholIoo0TiIXJosk3 uRS79EnmtWPRLEaAQs/GqHrvn8OYMTAQ51rx6UaUlUZmRb1ISOZLOYbf1oQyfPCfoKVP 69/U6fCLSot4FbB5tm5BQQ/TUY4+l7qjZb0K7a5hcy4V5qWNUq/OKn3IpfKyltHCgX7I KrqIGvxtNOGCUia60IZ+3KCJHNqGbeOnuMq+Nmg9vcAhWXYzwjO0KBCCSpdJlvIVSlzK IWWKouC6ATA/3Hlwh1sR7+sbyiZ1z3qUf2KZnzAaEK+w3ZNsSuXpbof6gr6H/6f880xf g+FQ== X-Gm-Message-State: AFqh2kr2S8V8T8TxtHLlaqETa9J40Tv599OB4mznM9CILmw2WxDl5b2c 3ATaEVrWb9V1TPE3I4Gw7bf/MmM9PZqIQTbs X-Google-Smtp-Source: AMrXdXvLnIBEHTVE89A58EDfvxfQeHAeidk6WnkffHZw+xP+Od0OaDFh4+B+9hfWkBWKIRHoqStFzw== X-Received: by 2002:a05:600c:995:b0:3da:f4f5:ad0e with SMTP id w21-20020a05600c099500b003daf4f5ad0emr23642433wmp.9.1674480965646; Mon, 23 Jan 2023 05:36:05 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/26] hw/i2c/versatile_i2c: Use ARM_SBCON_I2C() macro Date: Mon, 23 Jan 2023 13:35:38 +0000 Message-Id: <20230123133553.2171158-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481252907100003 From: Philippe Mathieu-Daud=C3=A9 ARM_SBCON_I2C() macro and ArmSbconI2CState typedef are already declared via the QOM DECLARE_INSTANCE_CHECKER() macro in "hw/i2c/arm_sbcon_i2c.h". Drop the VERSATILE_I2C declarations from versatile_i2c.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20230110082508.24038-5-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/i2c/versatile_i2c.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index b95c70608b2..d19df62265a 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -29,11 +29,6 @@ #include "qemu/module.h" #include "qom/object.h" =20 -typedef ArmSbconI2CState VersatileI2CState; -DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, VERSATILE_I2C, - TYPE_ARM_SBCON_I2C) - - =20 REG32(CONTROL_GET, 0) REG32(CONTROL_SET, 0) @@ -86,7 +81,7 @@ static const MemoryRegionOps versatile_i2c_ops =3D { static void versatile_i2c_init(Object *obj) { DeviceState *dev =3D DEVICE(obj); - ArmSbconI2CState *s =3D VERSATILE_I2C(obj); + ArmSbconI2CState *s =3D ARM_SBCON_I2C(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); I2CBus *bus; =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481167; cv=none; d=zohomail.com; s=zohoarc; b=EoO+YFj6XjebFALVkYVOXBdA2GF1wmdLY88bDuImSodMT1YV3PWXUluKYpHVzRGh4aKbQc5p03lgGqePGc9TPr5pRsIEkzdQ6tJkQ3ejJ3HiT+moJ20nPtlAZ8amOGxCqWsjDPfkAnCfGYHIop3dVkSwbdkthKCQ1phX+lnehEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481167; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+Nl5qo/slZRtjVNjxVllWsAsU0f66RVRp0rLB7RBFmo=; b=KU8TJQnmM29k8rggl0E9OTGHWRNtuZ3TYuR18ZSvAHSCxbuHbhvy/+dEDK4887Any5fbUDUFcbEdjgYpkm+PafV35GhXPn5ovbZgZzlIDPftbJprNDlDcbzMJOSPNrfxZGPaK51mfVny3YZJWVFOUWyc8Qle56ACuhhPYpOUHaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481167226161.35095915330248; Mon, 23 Jan 2023 05:39:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx02-0006GW-RF; Mon, 23 Jan 2023 08:36:38 -0500 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 1pJwzb-0005xF-U7 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzX-0002M5-PM for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:09 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso8559675wmq.5 for ; Mon, 23 Jan 2023 05:36:06 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:05 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+Nl5qo/slZRtjVNjxVllWsAsU0f66RVRp0rLB7RBFmo=; b=gnzg3txinoLY8ckenAFQ+qpfw6YovOer2/DVYAGGAt3bW04TjOKr6Oby80vHQvFOqo OougmmifssCRCwHvFi/Bh5k3iR6TCfzclb3uvsWEqoPJ6fqzuHsaBcunBWFga/J9iJIu gk/cdveYIQlwHlwptmGLo6ttewNGOZusDOn78n+ZJyRq0xNNFx8Z8DtBL9m63wt51+p7 y8fSeqgh7hiKC0NvfaU8jJaIik+/W+QlH8RrTOzSzIHQuI8AHqBg4X4hePVCW3V/rK/J b6OKP7njPdYlNZnTnJXhnVYJX1peE4Imm9HsAJVUlR559OTd1hq20sx6yxPfmJg1UVVh T2+g== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Nl5qo/slZRtjVNjxVllWsAsU0f66RVRp0rLB7RBFmo=; b=8FgBaf6KWbwvKP04LwOtXBzaHEhEftAkZhNEetNWkE9HcYa3GP7yHZk7V06vm2tto0 fNuquvhrJDsJFo6o+A7DldwWMpYocDDiN/bSovzk6aDKLC5JH5ZhHm85+/Y6s4G8tiGv Ybk+7V+dAFp42BoMR4b9g10/Opyf1E6LvtlqQ6VTFhzElENtEwzx1vempkEI5XdUJKJ6 gWQZf/xtRqKZVRVCs3pNn0SaxTRXQqcctShN6DtPqLYutLuo2dY7INEopG0uEDMhlGsS XQpf59oyMHLfB817Sr/DjzyjwaiIuHvqP+cw3ihSrOhy+Fq2pkXnjk/y4ilmGtWcULkT wGQg== X-Gm-Message-State: AFqh2kruqb5iwYTfWkktaUsXePUxZTZOgGtKNHefNAObUdmxsRKTnj4t gL3BlYBLaZLib/IGrrsTcZiLaj7coqt/Ko2Y X-Google-Smtp-Source: AMrXdXsMVR9Iu2PDoS2tsFmyB5MQ8XU0ifxXOIUa6XgtB5YUZilYEtCOMb24Y74iDDm7cOUa5aQeZA== X-Received: by 2002:a05:600c:35ce:b0:3db:1caf:1020 with SMTP id r14-20020a05600c35ce00b003db1caf1020mr17289064wmq.35.1674480966591; Mon, 23 Jan 2023 05:36:06 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/26] hw/i2c/versatile_i2c: Rename versatile_i2c -> arm_sbcon_i2c Date: Mon, 23 Jan 2023 13:35:39 +0000 Message-Id: <20230123133553.2171158-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481168566100003 From: Philippe Mathieu-Daud=C3=A9 This device model started with the Versatile board, named TYPE_VERSATILE_I2C, then ended up renamed TYPE_ARM_SBCON_I2C as per the official "ARM SBCon two-wire serial bus interface" description from: https://developer.arm.com/documentation/dui0440/b/programmer-s-reference/tw= o-wire-serial-bus-interface--sbcon Use the latter name as a better description. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20230110082508.24038-6-philmd@linaro.org Signed-off-by: Peter Maydell --- MAINTAINERS | 1 + hw/i2c/{versatile_i2c.c =3D> arm_sbcon_i2c.c} | 24 ++++++++++----------- hw/arm/Kconfig | 4 ++-- hw/i2c/Kconfig | 2 +- hw/i2c/meson.build | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) rename hw/i2c/{versatile_i2c.c =3D> arm_sbcon_i2c.c} (81%) diff --git a/MAINTAINERS b/MAINTAINERS index 08ad1e5341e..c581c11a645 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -942,6 +942,7 @@ M: Peter Maydell L: qemu-arm@nongnu.org S: Maintained F: hw/*/versatile* +F: hw/i2c/arm_sbcon_i2c.c F: include/hw/i2c/arm_sbcon_i2c.h F: hw/misc/arm_sysctl.c F: docs/system/arm/versatile.rst diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/arm_sbcon_i2c.c similarity index 81% rename from hw/i2c/versatile_i2c.c rename to hw/i2c/arm_sbcon_i2c.c index d19df62265a..979ccbe0ed6 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/arm_sbcon_i2c.c @@ -37,7 +37,7 @@ REG32(CONTROL_CLR, 4) #define SCL BIT(0) #define SDA BIT(1) =20 -static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, +static uint64_t arm_sbcon_i2c_read(void *opaque, hwaddr offset, unsigned size) { ArmSbconI2CState *s =3D opaque; @@ -52,7 +52,7 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr o= ffset, } } =20 -static void versatile_i2c_write(void *opaque, hwaddr offset, +static void arm_sbcon_i2c_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { ArmSbconI2CState *s =3D opaque; @@ -72,13 +72,13 @@ static void versatile_i2c_write(void *opaque, hwaddr of= fset, s->in =3D bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & SDA)= !=3D 0); } =20 -static const MemoryRegionOps versatile_i2c_ops =3D { - .read =3D versatile_i2c_read, - .write =3D versatile_i2c_write, +static const MemoryRegionOps arm_sbcon_i2c_ops =3D { + .read =3D arm_sbcon_i2c_read, + .write =3D arm_sbcon_i2c_write, .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void versatile_i2c_init(Object *obj) +static void arm_sbcon_i2c_init(Object *obj) { DeviceState *dev =3D DEVICE(obj); ArmSbconI2CState *s =3D ARM_SBCON_I2C(obj); @@ -87,21 +87,21 @@ static void versatile_i2c_init(Object *obj) =20 bus =3D i2c_init_bus(dev, "i2c"); bitbang_i2c_init(&s->bitbang, bus); - memory_region_init_io(&s->iomem, obj, &versatile_i2c_ops, s, + memory_region_init_io(&s->iomem, obj, &arm_sbcon_i2c_ops, s, "arm_sbcon_i2c", 0x1000); sysbus_init_mmio(sbd, &s->iomem); } =20 -static const TypeInfo versatile_i2c_info =3D { +static const TypeInfo arm_sbcon_i2c_info =3D { .name =3D TYPE_ARM_SBCON_I2C, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(ArmSbconI2CState), - .instance_init =3D versatile_i2c_init, + .instance_init =3D arm_sbcon_i2c_init, }; =20 -static void versatile_i2c_register_types(void) +static void arm_sbcon_i2c_register_types(void) { - type_register_static(&versatile_i2c_info); + type_register_static(&arm_sbcon_i2c_info); } =20 -type_init(versatile_i2c_register_types) +type_init(arm_sbcon_i2c_register_types) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 19d6b9d95f5..2d157de9b8b 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -211,7 +211,7 @@ config REALVIEW select PL110 select PL181 # display select PL310 # cache controller - select VERSATILE_I2C + select ARM_SBCON_I2C select DS1338 # I2C RTC+NVRAM select USB_OHCI =20 @@ -481,7 +481,7 @@ config MPS2 select SPLIT_IRQ select UNIMP select CMSDK_APB_WATCHDOG - select VERSATILE_I2C + select ARM_SBCON_I2C =20 config FSL_IMX7 bool diff --git a/hw/i2c/Kconfig b/hw/i2c/Kconfig index f8ec461be3d..14886b35dac 100644 --- a/hw/i2c/Kconfig +++ b/hw/i2c/Kconfig @@ -14,7 +14,7 @@ config SMBUS_EEPROM bool select SMBUS =20 -config VERSATILE_I2C +config ARM_SBCON_I2C bool select BITBANG_I2C =20 diff --git a/hw/i2c/meson.build b/hw/i2c/meson.build index e4c8e14a527..3996564c25c 100644 --- a/hw/i2c/meson.build +++ b/hw/i2c/meson.build @@ -12,7 +12,7 @@ i2c_ss.add(when: 'CONFIG_ALLWINNER_I2C', if_true: files('= allwinner-i2c.c')) i2c_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('microbit_i2c.c')) i2c_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_smbus.c')) i2c_ss.add(when: 'CONFIG_SMBUS_EEPROM', if_true: files('smbus_eeprom.c')) -i2c_ss.add(when: 'CONFIG_VERSATILE_I2C', if_true: files('versatile_i2c.c')) +i2c_ss.add(when: 'CONFIG_ARM_SBCON_I2C', if_true: files('arm_sbcon_i2c.c')) i2c_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_i2c.c')) i2c_ss.add(when: 'CONFIG_PPC4XX', if_true: files('ppc4xx_i2c.c')) i2c_ss.add(when: 'CONFIG_PCA954X', if_true: files('i2c_mux_pca954x.c')) --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481037; cv=none; d=zohomail.com; s=zohoarc; b=UQohnr7VQt4oXPk4l4j6Zhx+S8h4rFcJbj7DLEZk7X212CiMU9rSzeZ6gp8xS/jsqB7a5DAjQRZJf7HzLemH7Q0QkO7h/KXwQuVvGYwKgSio0hx1rkwtxWJeybRE2ymzJk6Kxar0eFNgvnH2u5WhNvsHIGrxOrn9kZgRZ7cniUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481037; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vZk1C88uw/inCNfkrhOVPoUDXVTmPwNQrJRmUIYnoUY=; b=JVmKxx1KVSjL6j68c68zIE013PedsRQ5roLGuveLYdr7g9fgMDpCDHdYpev8XLcSUq4r5azUmCuQ6r+kKWVpiNRGj0zAPv9jmd6iA5XucZ36uFGDXyO9YR2Sz2Md7JcSfN82rSIxNdxF390LnfT4p7OBTNtPBZbsSIUP4ROz37k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481037361410.54562234954915; Mon, 23 Jan 2023 05:37:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx07-0006Ki-Ny; Mon, 23 Jan 2023 08:36:43 -0500 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 1pJwzc-0005xL-1A for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzY-0002PQ-VP for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:10 -0500 Received: by mail-wm1-x332.google.com with SMTP id e19-20020a05600c439300b003db1cac0c1fso9123819wmn.5 for ; Mon, 23 Jan 2023 05:36:08 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:06 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vZk1C88uw/inCNfkrhOVPoUDXVTmPwNQrJRmUIYnoUY=; b=DptZjk2eRGxN815sOpbFJ2EIw6ZxsFCm/5ZtSXO0npbgZwwu65Nh/duBte92Lnf3JC MD5NWCv5n7LgazigWlq9CwnM9zSRX0/yx7YXzuox7/v9502O0sK2OXVofJkQYrDdhEBj 4LJqa4FNqxql/Sy+ectaRO+sNrwyNsU2AB2XnLvi3l/3+YF5XtUGtzFjAKvyXGHXyXFa b9s8df1WkKJHwUs+ol/UPgITDQMVOEb8bf17W8kowNichdevUHcbOMYHIdDh7nRWl2rR FjeLhPgUkWsXKXJ1n4l++UgQH/ryf5+8HtSAchaFlT5XNhfJLKbh7ZBzKDhxFdRopcJz xiVw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vZk1C88uw/inCNfkrhOVPoUDXVTmPwNQrJRmUIYnoUY=; b=L2B+BhVKZ2Y/p1YY/xU3IxJUppO6R3MwKHpy5MBSN8fEzL+yoEvKjFzOYwYGMu8mH6 8ejvXkrqny5Q4/vUV0jJOKrl0MDixILJVbIG3G5seubyMSsBnhDNpe7oEXZVHNdY4wdV Y1XMl8JzlsT3S06XixKOgC284EmmqEgGrrMF3ZcB2E/ikNgIzAz/SxuyyapayZjQlvDF G4yk6DmR4nPSX3em4jLqqEYGE9HUzDLYeZ9gqvfjhgSp/CBRy4BKwhJPlm+if+M6dV8h sQNYJY332rO6zLHZbJhIwM4kcPSGfv2j3S8hTTBhT5c+t/eQPvYcBtKXtY539HTwMUa5 BEqg== X-Gm-Message-State: AFqh2kpnkWUFBxzJ2udXXlqwRK1YqU6Iyl/qgqzdrFfPnOKWTuBXLkVf S0UfJLROu7dEscFXwzZsyHow+KyyyyfdyZIA X-Google-Smtp-Source: AMrXdXtu0ODow583BF1pUpwQF88+7E73oL+gU7l+6GuR8maPGuOCbFnbpH2czWIDEkYYMMyJCYEfDA== X-Received: by 2002:a05:600c:358b:b0:3db:2e6e:7826 with SMTP id p11-20020a05600c358b00b003db2e6e7826mr12685821wmq.5.1674480967527; Mon, 23 Jan 2023 05:36:07 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/26] target/arm/sme: Reorg SME access handling in handle_msr_i() Date: Mon, 23 Jan 2023 13:35:40 +0000 Message-Id: <20230123133553.2171158-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481037823100003 From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-2-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 2ee171f249c..35cc851246f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1841,18 +1841,20 @@ static void handle_msr_i(DisasContext *s, uint32_t = insn, goto do_unallocated; } if (sme_access_check(s)) { - bool i =3D crm & 1; - bool changed =3D false; + int old =3D s->pstate_sm | (s->pstate_za << 1); + int new =3D (crm & 1) * 3; + int msk =3D (crm >> 1) & 3; =20 - if ((crm & 2) && i !=3D s->pstate_sm) { - gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); - changed =3D true; - } - if ((crm & 4) && i !=3D s->pstate_za) { - gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); - changed =3D true; - } - if (changed) { + if ((old ^ new) & msk) { + /* At least one bit changes. */ + bool i =3D crm & 1; + + if ((crm & 2) && i !=3D s->pstate_sm) { + gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); + } + if ((crm & 4) && i !=3D s->pstate_za) { + gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); + } gen_rebuild_hflags(s); } else { s->base.is_jmp =3D DISAS_NEXT; --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481053; cv=none; d=zohomail.com; s=zohoarc; b=Wi9hCJuTJu7N9WHbue7nGb5EqBtZe7BvkZdCGg+jdhBoBdOf1XFJyqXJic04WHytdUnORHKMrkC7O3XYrHeLejZuk/XLxmgaqszVP3N0TY0o4r50VxF1rtaCP2Vk0VdjL2UcDSUQX88b6gSRA5rc685O4X7r01aS75NOhw3DjDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481053; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O2uCOr2ehr+mt4R5d82Y/g2mqNmQH9GBB29ghk2KeoQ=; b=MIwLvkWVqSwEonaiSh4GhepmpI0HpkFkpLc7B0t0QvBspby5EV5UYyQPlTsG5EJtCiGRkzQWd2p8FTrGt2TLGHru2hs/gP42FCqEFQqYshALwxS3ZQfVj6SffmzaBEreNMlgxmydMhYQ0bVX8KHg1Dn0I5ClVaYpSHiwOeOziWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167448105389143.4612295144907; Mon, 23 Jan 2023 05:37:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx0A-0006VI-Pp; Mon, 23 Jan 2023 08:36:46 -0500 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 1pJwzd-0005xd-0z for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzZ-0002Pw-Po for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:12 -0500 Received: by mail-wm1-x32f.google.com with SMTP id g10so9035016wmo.1 for ; Mon, 23 Jan 2023 05:36:09 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:07 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=O2uCOr2ehr+mt4R5d82Y/g2mqNmQH9GBB29ghk2KeoQ=; b=eLT9RpJHV7GKIfVwGnBdi9V+/TM8a4LBqNL8YHkbRCS495qSDKfUzQnPeaVaxLxYez Pq5w/260K8mTcM8vVmaYm/QPwlzgeS2avE3Ii05h0m8fhXEH7ZK4zm9MO/P+EmF+altb 9qyGSnzi4wqkrEWUYbdNEYZIsqPSWoMom3WNfNlnOrDvAHfCOKtDpI/vtNBLWBCKigzm +KOrfS3w2VxQLm/I9V603a8MhWrpAT1WHZfeDKeytvJOHTNFpnUNqFkRmVc4oa/RIVZy VIBxucmyV1fGh2WpsbwD6JH+/+xEb5jswR3eAEwVSn+rhgswT7VuOng1kvswLYzDHYre t+2A== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O2uCOr2ehr+mt4R5d82Y/g2mqNmQH9GBB29ghk2KeoQ=; b=Q439i7UHDcxvvSyWIBRBKqUqVowBaVAINSmAdGW/VmPq3U9atnZHNr32H7qRakoLh1 wgSiUsh8zqGMGWxFh5w7LAwRISGFCyQrQSEbI6iV6WcDenSH3OmEBTIeTcqfMiI1tr7D IFIiBjHFr8ytANpASxsacSVf5MjqmiCs/nmIPQ3I7SbVhe6D0UruXTVe7I+eGDuGbXRy yJVlaSlX5niSXxNkpZQD3YFvZUNSvY7B7/49wdb8wZpWQmZXxyuC1QWySrZrXWQRph0C QBhYkIFYj/74iUQehZK3hSsjWsjVFQZ+1FYnKJYWKhdyLndvHMPzuBkqfgDkoKzGvVab lUsw== X-Gm-Message-State: AFqh2ko4fV8xtQFIeqbFa5pWgv6jJXYxliiZSA93nnsQE6J+by4CWBj3 dgd2u/EMwUfkDbcqeedmjnGq0DC4z+bmoLcF X-Google-Smtp-Source: AMrXdXtNb5fdoJWgWAU/Lykic6VVSBL1izAqQBAN6QEDIsqEWJDRpEsXccAynGshZtmvnsrVcQSc/Q== X-Received: by 2002:a05:600c:a690:b0:3d5:64bf:ccb8 with SMTP id ip16-20020a05600ca69000b003d564bfccb8mr23567910wmb.12.1674480968424; Mon, 23 Jan 2023 05:36:08 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/26] target/arm/sme: Rebuild hflags in set_pstate() helpers Date: Mon, 23 Jan 2023 13:35:41 +0000 Message-Id: <20230123133553.2171158-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481055936100001 From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-3-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/sme_helper.c | 2 ++ target/arm/translate-a64.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index f891306bb98..b5aefa3edaf 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -45,6 +45,7 @@ void helper_set_pstate_sm(CPUARMState *env, uint32_t i) } env->svcr ^=3D R_SVCR_SM_MASK; arm_reset_sve_state(env); + arm_rebuild_hflags(env); } =20 void helper_set_pstate_za(CPUARMState *env, uint32_t i) @@ -65,6 +66,7 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i) if (i) { memset(env->zarray, 0, sizeof(env->zarray)); } + arm_rebuild_hflags(env); } =20 void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 35cc851246f..035e63bdc51 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1855,7 +1855,6 @@ static void handle_msr_i(DisasContext *s, uint32_t in= sn, if ((crm & 4) && i !=3D s->pstate_za) { gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); } - gen_rebuild_hflags(s); } else { s->base.is_jmp =3D DISAS_NEXT; } --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481026; cv=none; d=zohomail.com; s=zohoarc; b=WQtesYqlBYQ5kRS/1mxm5FwZdYZTTPNixPzDWnWI02hNZKppnADhalUe5MZQTwyhWDvwIKiuAvnOWmPZNIsT7bsFSt7bEPVTIeGLKzjVCXMP5KXD8cep5HKuNH0aBW4D0WqBxuSzAHtQ+6rh5dOXItGLwv78Y5st+zFpCex3Xlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481026; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IeF7jJTB/G2ZdwYbP4k411cz0vGAuT9uWrSxSGjM9fc=; b=UOMrB6Vyj5etLexLdKOax8Fdi1kzAUxr+5D+EcTnWdcFMKeAagE4gczIhNLl1k5rVW7it8KTa5KbEl52GNxLxReUBJk4y462Vl6yQmapT8sZ+wxy2VD4UM93T+b6+27xTg9ya2smxdnvkiUz4Ivww97k54L128GWDvhtDB9b9Kw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481026537960.2107928627335; Mon, 23 Jan 2023 05:37:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzz-0006Aa-7H; Mon, 23 Jan 2023 08:36:35 -0500 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 1pJwze-0005xz-Tr for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzb-0002Rk-GN for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:13 -0500 Received: by mail-wm1-x336.google.com with SMTP id e19-20020a05600c439300b003db1cac0c1fso9123868wmn.5 for ; Mon, 23 Jan 2023 05:36:10 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:08 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IeF7jJTB/G2ZdwYbP4k411cz0vGAuT9uWrSxSGjM9fc=; b=zfCG6HNrHIIzntEHcbjfgW53hdjauA9FhrnSmDQJIxbor6sEzh6oOQM6Xf7YS31mvC E0UARUp5PPc0K0YIr6IAlwzHOsRA88hwCphaQrbPWIZ81SXcaf7+erCD6+Dhqlnt/DRB M734cdpPf1UmrqFeR6c/DlazLuUSwhD/NjYHmRv+PYvkYeNGsV19hW6Sn8p/wRk4vJoZ 8BYXXn0xe67KJwWHSOLTZYxyorQ4g+wXf3cm7RA0ateMBJJQN3CXBqtwR2k2lLNuo3ip hhBvTwL5s4iLCnjAllJ5hrRpjvcbubRRgojfs5N5gwiCXub0Fkf52BxFxN2o6BPWyqJ1 7fXw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IeF7jJTB/G2ZdwYbP4k411cz0vGAuT9uWrSxSGjM9fc=; b=JKvxZT8Sa6a4trmYlOvT3l9HlkJY/0nTtR0OjWGZAzdJqJxWwnPDv6z0Uoz1CtPVt0 E1044bprrH29WYWflGAszp4Nvv7BxsFvhJQ2li+LsKd5UUpeyo/Ktj9hT6phS3NX/qma xo/VnxnIqUSV/UTGOyztLQgR4PU9Q5WFAMeViHYVSC/v8vpZVoQXfKCJGDWThYoqpmuG qfUYPEYoSzT1xKaVPDtstcKHdQcpYNaorp7L6ByrVIaRBjRbK3JCrU2+xuzkmIYd85jc M8/RglCSkInq5Wf2wxgnAMusoDinvVleVpRpgGknPQBzaivrTVcV4Agqh4VnCTvb/wn8 nGYg== X-Gm-Message-State: AFqh2koUs1bqds0OlTbDUopT+bg0YxLz48votm2XDMTHtfMjSUOOQTNw hruK4FTWjl1kaVuoCCqEsxFxYl9sOrCji07g X-Google-Smtp-Source: AMrXdXvajyFKujbvjSSuoX6u1RSzarGV+EO/V8TGludsemNFYMboVDS5QsmaPCRRMm+d835v6UcqeA== X-Received: by 2002:a05:600c:5d1:b0:3d0:761b:f86 with SMTP id p17-20020a05600c05d100b003d0761b0f86mr24220974wmd.28.1674480969259; Mon, 23 Jan 2023 05:36:09 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/26] target/arm/sme: Introduce aarch64_set_svcr() Date: Mon, 23 Jan 2023 13:35:42 +0000 Message-Id: <20230123133553.2171158-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481027752100001 From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-4-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 + linux-user/aarch64/cpu_loop.c | 2 +- linux-user/aarch64/signal.c | 2 +- target/arm/helper.c | 8 ++++++++ target/arm/sme_helper.c | 4 ++-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 1feb63b4d73..ef61849eb1d 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1123,6 +1123,7 @@ int aarch64_cpu_gdb_write_register(CPUState *cpu, uin= t8_t *buf, int reg); void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq); void aarch64_sve_change_el(CPUARMState *env, int old_el, int new_el, bool el0_a64); +void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask); void arm_reset_sve_state(CPUARMState *env); =20 /* diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 9875d609a91..d53742e10bb 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -93,8 +93,8 @@ void cpu_loop(CPUARMState *env) * On syscall, PSTATE.ZA is preserved, along with the ZA matri= x. * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState. */ + aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); if (FIELD_EX64(env->svcr, SVCR, SM)) { - env->svcr =3D FIELD_DP64(env->svcr, SVCR, SM, 0); arm_rebuild_hflags(env); arm_reset_sve_state(env); } diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 6a2c6e06d28..b6e4dcb494d 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -669,11 +669,11 @@ static void target_setup_frame(int usig, struct targe= t_sigaction *ka, * Invoke the signal handler with both SM and ZA disabled. * When clearing SM, ResetSVEState, per SMSTOP. */ + aarch64_set_svcr(env, 0, R_SVCR_SM_MASK | R_SVCR_ZA_MASK); if (FIELD_EX64(env->svcr, SVCR, SM)) { arm_reset_sve_state(env); } if (env->svcr) { - env->svcr =3D 0; arm_rebuild_hflags(env); } =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index 22ea8fbe368..24c069b8acf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6725,11 +6725,19 @@ static CPAccessResult access_esm(CPUARMState *env, = const ARMCPRegInfo *ri, return CP_ACCESS_OK; } =20 +void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) +{ + uint64_t change =3D (env->svcr ^ new) & mask; + + env->svcr ^=3D change; +} + static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { helper_set_pstate_sm(env, FIELD_EX64(value, SVCR, SM)); helper_set_pstate_za(env, FIELD_EX64(value, SVCR, ZA)); + aarch64_set_svcr(env, value, -1); arm_rebuild_hflags(env); } =20 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index b5aefa3edaf..94dc084135d 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -43,7 +43,7 @@ void helper_set_pstate_sm(CPUARMState *env, uint32_t i) if (i =3D=3D FIELD_EX64(env->svcr, SVCR, SM)) { return; } - env->svcr ^=3D R_SVCR_SM_MASK; + aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); arm_reset_sve_state(env); arm_rebuild_hflags(env); } @@ -53,7 +53,7 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i) if (i =3D=3D FIELD_EX64(env->svcr, SVCR, ZA)) { return; } - env->svcr ^=3D R_SVCR_ZA_MASK; + aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); =20 /* * ResetSMEState. --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481085; cv=none; d=zohomail.com; s=zohoarc; b=MMmgD83YpFJJZmf0/SNGQXr7f5DHKl3ivLCMekdtOguhVdVhlEvMsqfCDVfJSt6ilJUmKijwSFH1QOOlVXLobCJ45/hhRyckVVjpKhSTN5rb2p0T/IaIceX5nWmHhW944b485C9pyGAXv2Vs/+Z7GEWtvwmiJTtF4CXBPNvcBUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481085; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ClfwKQfwQPNiuEhLu9/OoLk23WFzZiEhdIdZyE3JTl4=; b=NxfT3W7vxYCSc+nWRTNhFU6I3PwDBARHR3taRhMaIQgMajf83JZWnFONK9PR3bH3HT5x5lPjWch2bww7ULRpM+A6CVs+l3med/0mTWdcCZsk2XYnzcCI6HvVRyamA0gtLOkAP1/2gBFtR0QTSI4JShsEV62bEim4PWis5BWpgX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481085224492.9128247780469; Mon, 23 Jan 2023 05:38:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx04-0006JN-OM; Mon, 23 Jan 2023 08:36:40 -0500 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 1pJwze-0005xy-U0 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 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 1pJwzb-0002La-QQ for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: by mail-wm1-x335.google.com with SMTP id l8so9024032wms.3 for ; Mon, 23 Jan 2023 05:36:10 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:09 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ClfwKQfwQPNiuEhLu9/OoLk23WFzZiEhdIdZyE3JTl4=; b=zMXytAplMMlhHTKcgA8ZrPuZ/KmQC3RGPKA6YBRJ3qGnOWZ81D2qUzR6Ntn0gRpWyk cCX71eR71q7rJiZrkw1oR60XpoucJy2D4aO1Z733a+EgrGXyPgbV25e0Q1QQCc4kc5Tm QKUKwvuIdUOrITl+mNIhqongisYuAvRlD6MJ+DbTRfqogEoIK533YcPMozuujVw73p3w KDAvU+WyQuvQ68DzTNM6H2HxlcPtUuwmkog/nxYYxLmjDIoUuOE9w1RxR0bcqCWtFKyB DYYKYr0rTkmdIoiR5XybUhQ9KLfVP4V16QJ/avBABia94Hdyp/dUJH7HC/XB4OTt2Ezy kUUA== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ClfwKQfwQPNiuEhLu9/OoLk23WFzZiEhdIdZyE3JTl4=; b=6SFzJuToa6HLmG/Oze1cUUyVZYJeJ99TFgxTSXBOvCouhvHqkhZ65SFr5vR+PRWLTN 7kLNg1cvhRfNywjxdZXHTkvy8KbkmcpIdOYaafDkU08dpSTATGOqJzFS319tz9KHpAIQ 0gbWhVClqwGYhCt2oAqlak2bnEMiPJFqfnjDrJomAiZPy1O0rM8d/ZeSyDz+GbEPYu1p 5r6c30/yPFW9bIxFyiFImVN1Rn5CeTTFoMBYLF5Hq7QtumQNKcbDfPTThN7//Ppu7Zqh w+3jlTKT9MFdUsQdeJZ6jyHCqT1kRJCrjc765HspF2w6dSMKf+z0fWkpQWyyo87hnaQc Lxdg== X-Gm-Message-State: AFqh2kqmBBPs7fzClySGjEJgCx1nAfmytjoJo6p1zZ1jta8jkC7YBI0w i0/m5SlmEzYpQVPTB1xUtlpLGKPo/Qu7IkfX X-Google-Smtp-Source: AMrXdXvRfFY9nQn2ozVnGZ+974ptMiwYCQuHyTaHes0WzQQtC8kW17TcaHvET6ahS29d88zPXqZahg== X-Received: by 2002:a05:600c:1e1f:b0:3db:e13:750c with SMTP id ay31-20020a05600c1e1f00b003db0e13750cmr22355969wmb.29.1674480970076; Mon, 23 Jan 2023 05:36:10 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/26] target/arm/sme: Reset SVE state in aarch64_set_svcr() Date: Mon, 23 Jan 2023 13:35:43 +0000 Message-Id: <20230123133553.2171158-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@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 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481086094100003 From: Richard Henderson Move arm_reset_sve_state() calls to aarch64_set_svcr(). Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-5-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 - linux-user/aarch64/cpu_loop.c | 1 - linux-user/aarch64/signal.c | 8 +------- target/arm/helper.c | 13 +++++++++++++ target/arm/sme_helper.c | 10 ---------- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ef61849eb1d..f3ddc3b7793 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1124,7 +1124,6 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned= vq); void aarch64_sve_change_el(CPUARMState *env, int old_el, int new_el, bool el0_a64); void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask); -void arm_reset_sve_state(CPUARMState *env); =20 /* * SVE registers are encoded in KVM's memory in an endianness-invariant fo= rmat. diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index d53742e10bb..5e93d27d8f6 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -96,7 +96,6 @@ void cpu_loop(CPUARMState *env) aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); if (FIELD_EX64(env->svcr, SVCR, SM)) { arm_rebuild_hflags(env); - arm_reset_sve_state(env); } ret =3D do_syscall(env, env->xregs[8], diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index b6e4dcb494d..a326a6def5e 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -665,14 +665,8 @@ static void target_setup_frame(int usig, struct target= _sigaction *ka, env->btype =3D 2; } =20 - /* - * Invoke the signal handler with both SM and ZA disabled. - * When clearing SM, ResetSVEState, per SMSTOP. - */ + /* Invoke the signal handler with both SM and ZA disabled. */ aarch64_set_svcr(env, 0, R_SVCR_SM_MASK | R_SVCR_ZA_MASK); - if (FIELD_EX64(env->svcr, SVCR, SM)) { - arm_reset_sve_state(env); - } if (env->svcr) { arm_rebuild_hflags(env); } diff --git a/target/arm/helper.c b/target/arm/helper.c index 24c069b8acf..0ac867c4119 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6725,11 +6725,24 @@ static CPAccessResult access_esm(CPUARMState *env, = const ARMCPRegInfo *ri, return CP_ACCESS_OK; } =20 +/* ResetSVEState */ +static void arm_reset_sve_state(CPUARMState *env) +{ + memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); + /* Recall that FFR is stored as pregs[16]. */ + memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); + vfp_set_fpcr(env, 0x0800009f); +} + void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) { uint64_t change =3D (env->svcr ^ new) & mask; =20 env->svcr ^=3D change; + + if (change & R_SVCR_SM_MASK) { + arm_reset_sve_state(env); + } } =20 static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index 94dc084135d..f73bf4d2853 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -29,22 +29,12 @@ #include "vec_internal.h" #include "sve_ldst_internal.h" =20 -/* ResetSVEState */ -void arm_reset_sve_state(CPUARMState *env) -{ - memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); - /* Recall that FFR is stored as pregs[16]. */ - memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); - vfp_set_fpcr(env, 0x0800009f); -} - void helper_set_pstate_sm(CPUARMState *env, uint32_t i) { if (i =3D=3D FIELD_EX64(env->svcr, SVCR, SM)) { return; } aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); - arm_reset_sve_state(env); arm_rebuild_hflags(env); } =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481276; cv=none; d=zohomail.com; s=zohoarc; b=IBUMK0tTmAMRE5E9SZWr3K8oxfc/H9uiWhZyOn1wNGvjxPVMCi0wkHskxlkQKAU5FF7Si1J9V0n5LnM+z8KD97kGAQ8txPvro3o/UEuGvMZN0l4K6rBEWWMDV7wRvgWOrhqfPOHYAG07HlTqGE3cqQjH+A5ycKJk3CtXAROloQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481276; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=l/YMRK9H6MKjZ5V6/MO4JKEI70EptTGhUj/yaHlEPN7azQIpWOE72WdJoEKXqGlHaNtyq6jEdqfTuydWxduVU4PADMUxc2n4qVAXwjE+/Jb3USDT5EsviXM9HxMvpMqgL6+P8Qj5X44IP1B0RmDfco+X0NZA8edApojoP5xCZds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481276826859.795826911832; Mon, 23 Jan 2023 05:41:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx03-0006Hy-R3; Mon, 23 Jan 2023 08:36:39 -0500 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 1pJwze-0005y0-VJ for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:15 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzc-0002SC-HK for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:14 -0500 Received: by mail-wm1-x32e.google.com with SMTP id o17-20020a05600c511100b003db021ef437so8562774wms.4 for ; Mon, 23 Jan 2023 05:36:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:10 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=LCqb+Q3kWHuuK2NSBE+7jCobx112B7Mrc+nhiy3HroRLMkXGZm0VIO9Mv0Uip/btGD 3LAOA20kRwF/K37kMmdUORE+9Gv7JRQ8HHBYrUVYFGNLN3Hy3D1B9lgWZ7a6wFhOThnt maB92wyhIj+P9FD3hkHCIkSopp/NCwxnCn2Ut4ixFBVIsIw7fiAKkgxrP+F6R8LXLogV n98CODzQ6vjEC3vdeoxwX2e4Ugtgt2ASwV2QF/a5bYK7bMCUZBo/4rKjc+e/1jR4u9Pk 0jER1WW+UHmfCilQyryGbIBdmFUB3qk2zev5Iom+91Km+yxZMG+IApqHhkjfs1ZCVPXO CdsA== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=DWWkTDDT+g2o3XUlEZYEoGWdEbawlxkVeV0aWr+zceH6jmfvjjNlc4ZgLMoI1gia8c iANKKgN5r+kqekP+p9mVaIN3nFlbnwm+VvtB5+J9jtppm5Qrds2PbcRCJRbUHp1BO1w3 GaXzPq+FXqt6+GjHBcg6sucLNC16fHvA8FAQIfnAMYK9bkQQVV8FaqxLIV6tOiIGc/59 70LzzCbdKAYeQjK9/5zf9fnE1eonfDhqvGKMmVULY9Ip31j7V7u2Z8ZQDbuG7xH3my/F bcH99qMbREKCKRH+UziAYwFDU3Mh1AVELLkGcYRPECRMUUiWEwf8eGBBvxQOMg+OwhI7 WqJQ== X-Gm-Message-State: AFqh2koQdOyyAsS1YHZjEG2kcoo1dsJh9Z4xLo3Y4iMUELFqHs2ycw0W vbD4LE4Y3ctEzVRePi+N97U4GsqvEm3vBur+ X-Google-Smtp-Source: AMrXdXu0zGSAzUoSm1a+uzDsK/4tQd+kbGXSBnhR6jsW84lDtyHUneeBkS3Z9SVjgtb8CSIkhWMecA== X-Received: by 2002:a7b:cbd6:0:b0:3db:622:4962 with SMTP id n22-20020a7bcbd6000000b003db06224962mr23984290wmi.21.1674480971019; Mon, 23 Jan 2023 05:36:11 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/26] target/arm/sme: Reset ZA state in aarch64_set_svcr() Date: Mon, 23 Jan 2023 13:35:44 +0000 Message-Id: <20230123133553.2171158-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481277064100009 From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-6-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/helper.c | 12 ++++++++++++ target/arm/sme_helper.c | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 0ac867c4119..564c5d93320 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6743,6 +6743,18 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new= , uint64_t mask) if (change & R_SVCR_SM_MASK) { arm_reset_sve_state(env); } + + /* + * ResetSMEState. + * + * SetPSTATE_ZA zeros on enable and disable. We can zero this only + * on enable: while disabled, the storage is inaccessible and the + * value does not matter. We're not saving the storage in vmstate + * when disabled either. + */ + if (change & new & R_SVCR_ZA_MASK) { + memset(env->zarray, 0, sizeof(env->zarray)); + } } =20 static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index f73bf4d2853..e146c17ba19 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -44,18 +44,6 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i) return; } aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); - - /* - * ResetSMEState. - * - * SetPSTATE_ZA zeros on enable and disable. We can zero this only - * on enable: while disabled, the storage is inaccessible and the - * value does not matter. We're not saving the storage in vmstate - * when disabled either. - */ - if (i) { - memset(env->zarray, 0, sizeof(env->zarray)); - } arm_rebuild_hflags(env); } =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481005; cv=none; d=zohomail.com; s=zohoarc; b=PVfQO56j1JuO9kjCb1jrkCeDSdkjOZJyN8lVB2bGbUNskT6CGib/yprAElCczJiewVOU1S4DX5DUU+AQ4CACDbXB4bf7VKmr196WCqUSeaVv6P/8t64RdBwDe69qev1COBycRSt2kjFWSPBuobTtQVLjEIgf8ATIL5E2VXLCunw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481005; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kMExk8W8eDEbzmTmN5tKGDb7IruksybidHcjv8e9z20=; b=j7d1e49fHpsHiTBnNRXJGTbCkqDfII6Dz1fB+sysOvQFkDzIg01D/SPkUJVt5xV8gWD2wczwPjxLOg7xXGTl+5QApU8ZTbMVUtuct+QHTs0ERqL0+okHItl3nwShNLqo0uAGRmQGHNqN6QfhLzOsbxmdlQaMhwWi9AbzjBzZRzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481005689258.6238505766627; Mon, 23 Jan 2023 05:36:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzz-0006AM-4N; Mon, 23 Jan 2023 08:36:35 -0500 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 1pJwzg-0005zl-UH for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:21 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwze-0002Mo-LB for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:16 -0500 Received: by mail-wm1-x336.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so10640388wmb.0 for ; Mon, 23 Jan 2023 05:36:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:11 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kMExk8W8eDEbzmTmN5tKGDb7IruksybidHcjv8e9z20=; b=aMbpEDtpMrHRlm8Z5xI6nRy+3a8A/z0IbOWvVXKuAvu6vbJxt8ZX+Dfjyczq2L4aYt YGsDe+/BGgLqw3zNS0Hv7GnXPwjrRDgqGF0+Gqnpc9kiADuRajfJErJj9gTwMIWcas5+ PHj38PvMpEf46NSacH311Dje/2SV5S5+8r08P28dOyQ2cRw8MejKsnTxStTBA+sGCtxF lfUHrrRd0xZBZj7Vku8fKeUgb4zE/bAO4TRYwXsqw40QkSFMWWxzktiNcklJeMdnr0M3 xRWrxZcbRg1qZSGu87sLssn8WhWvQ6XoyaZb/yWnffJkxIYyPtUohg2gmX8cGkx36k/o IuAw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kMExk8W8eDEbzmTmN5tKGDb7IruksybidHcjv8e9z20=; b=CVs1aTzRH4UaaPObJMKzsG30+/BbIFcyOEZow+TJf8tOqZElOhs/kxpQ/duhVQWQEZ HSDdTVVE/4ykYDnpct5okn5d/04gMDT78n0hfSBRBHDMT3+nZqbGU1paPEy5hwLLmyYd Q57SGFTSf/tdcVT7oP+hnfuLOTZWva7hwFP67JMmffvQv3o9DGkMc7wLU00OXI7BuOgp MamuVY6rJRBLS+hVvGqG2wk4T89ZryIVsJiw1lksEk1YNY/BXwBZhZfkkGTzMwpBjwZR 7d8jmZ9McqBuwhOihZ2pU0gKkFKb3IjdfDlf7zTaHX5+j68KonvSxsice7w4an03SwD9 DCpQ== X-Gm-Message-State: AFqh2krYUZDo8M7Cepu0JoWWCnRQKMwLoHLk+799gh2uQdeQ9/fSxo/H tNJ1DBrNAq2+JhVNL5SUSnqztRn5ll7S1rKv X-Google-Smtp-Source: AMrXdXtA8k+PrTAr/fVRMPgl891Y78nVgYEoH/MoG+z4kHl2UuJ5ufSZf1l/aD2yW1oV1740/YgG4Q== X-Received: by 2002:a7b:c4d7:0:b0:3db:2fc6:e124 with SMTP id g23-20020a7bc4d7000000b003db2fc6e124mr13158204wmk.7.1674480972023; Mon, 23 Jan 2023 05:36:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/26] target/arm/sme: Rebuild hflags in aarch64_set_svcr() Date: Mon, 23 Jan 2023 13:35:45 +0000 Message-Id: <20230123133553.2171158-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481011769100001 From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-7-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- linux-user/aarch64/cpu_loop.c | 8 +------- linux-user/aarch64/signal.c | 3 --- target/arm/helper.c | 6 +++++- target/arm/sme_helper.c | 8 -------- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 5e93d27d8f6..2e2f7cf2188 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -89,14 +89,8 @@ void cpu_loop(CPUARMState *env) =20 switch (trapnr) { case EXCP_SWI: - /* - * On syscall, PSTATE.ZA is preserved, along with the ZA matri= x. - * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState. - */ + /* On syscall, PSTATE.ZA is preserved, PSTATE.SM is cleared. */ aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); - if (FIELD_EX64(env->svcr, SVCR, SM)) { - arm_rebuild_hflags(env); - } ret =3D do_syscall(env, env->xregs[8], env->xregs[0], diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index a326a6def5e..b265cfd4706 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -667,9 +667,6 @@ static void target_setup_frame(int usig, struct target_= sigaction *ka, =20 /* Invoke the signal handler with both SM and ZA disabled. */ aarch64_set_svcr(env, 0, R_SVCR_SM_MASK | R_SVCR_ZA_MASK); - if (env->svcr) { - arm_rebuild_hflags(env); - } =20 if (info) { tswap_siginfo(&frame->info, info); diff --git a/target/arm/helper.c b/target/arm/helper.c index 564c5d93320..80779678499 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6738,6 +6738,9 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new,= uint64_t mask) { uint64_t change =3D (env->svcr ^ new) & mask; =20 + if (change =3D=3D 0) { + return; + } env->svcr ^=3D change; =20 if (change & R_SVCR_SM_MASK) { @@ -6755,6 +6758,8 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new,= uint64_t mask) if (change & new & R_SVCR_ZA_MASK) { memset(env->zarray, 0, sizeof(env->zarray)); } + + arm_rebuild_hflags(env); } =20 static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -6763,7 +6768,6 @@ static void svcr_write(CPUARMState *env, const ARMCPR= egInfo *ri, helper_set_pstate_sm(env, FIELD_EX64(value, SVCR, SM)); helper_set_pstate_za(env, FIELD_EX64(value, SVCR, ZA)); aarch64_set_svcr(env, value, -1); - arm_rebuild_hflags(env); } =20 static void smcr_write(CPUARMState *env, const ARMCPRegInfo *ri, diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index e146c17ba19..3abe03e4cb3 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -31,20 +31,12 @@ =20 void helper_set_pstate_sm(CPUARMState *env, uint32_t i) { - if (i =3D=3D FIELD_EX64(env->svcr, SVCR, SM)) { - return; - } aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); - arm_rebuild_hflags(env); } =20 void helper_set_pstate_za(CPUARMState *env, uint32_t i) { - if (i =3D=3D FIELD_EX64(env->svcr, SVCR, ZA)) { - return; - } aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); - arm_rebuild_hflags(env); } =20 void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481137; cv=none; d=zohomail.com; s=zohoarc; b=Z2j3PPAopFFD4/iH33VRuXYmcuYwacwOYAOpaTQ81G3eccu8Y1A/CtfpBY/mpqGAPFrDgDCsceh766UzFJVwnFP05hzGA/lkoey5H3YVci12v3qsPx8kt07Y3p7q8rE0q1jOlQN7gRLm4TCY3ULQlhg3Wz+DjwtNNWU1mDwJl2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481137; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=73fZODUVN+eHuckJW+3x93TAtbbakSn6uC4UQHq9gd4=; b=OBpslh5TxAh2emYxIDTOwrR1znve6vaM8G+JEb5sj2dDOnogMS+K9iSkvFFgdNz8EfjXrx8yIWp71fQ+M2V/SgKd13qNe6Km2mE0/R+6s1j2oU0TcbfPdu/oEChFrl6GKAUT/g6KvEhmlp7KOWuVGM6BiBfubPDgv8mBUWNGJdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481137209593.3098010798493; Mon, 23 Jan 2023 05:38:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzv-00067Z-LO; Mon, 23 Jan 2023 08:36:31 -0500 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 1pJwzg-0005zk-U6 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:20 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwze-0002Lo-Le for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:16 -0500 Received: by mail-wm1-x32b.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so10606901wml.3 for ; Mon, 23 Jan 2023 05:36:13 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:12 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=73fZODUVN+eHuckJW+3x93TAtbbakSn6uC4UQHq9gd4=; b=Dj+KcwUsgwcaxSvxsnwooipVuNR1Xxv4sDuvLgMRWJdIw0w5U4x6BT4foNMzleQv1A RneBfDz6uzdmmwm/stL4QKThQjUDLqHtFE8FSjoYM774C1g+RCJMsGylJnjCcWtC1aM9 fcAOTTmrZ1gWgv/L9jBz1ExTybwGfHiKGpAgBEYEFWGUI0AaL+pOpsa1YVSjFirkihgZ zjYENw3kUt+Y+Wt+cxhjkLcnhxVs74nh4cefNAk2aPjpDgOkNxjW5L9ZWcBNLB16waRa Gc8TMRx2tJPc9qCazHES0j/9GIt+1Y3uk0q7esZS+Af8h3mmTwuacSaEMDM+7cpq2HZS FybQ== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=73fZODUVN+eHuckJW+3x93TAtbbakSn6uC4UQHq9gd4=; b=2LN/JkA2nIhQrsKM21xCcCRKgWTyDuihMsxFEBSONwSc5uRxN0G/hRYo2Srfv2D6xv WxHIAUx/wytafkiTKI3kwfhdKU9qINJXNA6+f1MJTnyhqpsJplF6rRJyVMUpFUISfvjN jbUramJjKUjYQkJY2AmFdtTFbk968UO1kSqgjiLEgaBFlwDwkphbh6cisRssI3vgb8xP WbmdnTl4Fn0HwE3gR22d9XdkNt5Fb+FGY/3o891hrJL+zOfccvEbVMID3g8CTBJbIGTp RIwcgXNks1J2104oD3lCE1dBEc1EbLcKlSGSrPgijEkND5YMwKgBACK2VPdZAFd/mJFd 82BQ== X-Gm-Message-State: AFqh2krYiSwJosl/JcXVMeIJXoLSQJZJUn5xHBeU/DGtnTBkM5slysvG wzJk04+bF+Zd/TUipIUmMu9V22C4EvhiLP3v X-Google-Smtp-Source: AMrXdXvYI1Ea/wO94/9fipfePjs05Vwpxm/xbtslRJb1zKVZ9QYPnCbGrT+uIzEOrCDkADn9vhZclA== X-Received: by 2002:a05:600c:34d1:b0:3db:1434:c51a with SMTP id d17-20020a05600c34d100b003db1434c51amr18371567wmq.40.1674480972912; Mon, 23 Jan 2023 05:36:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/26] target/arm/sme: Unify set_pstate() SM/ZA helpers as set_svcr() Date: Mon, 23 Jan 2023 13:35:46 +0000 Message-Id: <20230123133553.2171158-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481138284100007 From: Richard Henderson Unify the two helper_set_pstate_{sm,za} in this function. Do not call helper_* functions from svcr_write. Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230112102436.1913-8-philmd@linaro.org Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org> [PMD: Split patch in multiple tiny steps] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- target/arm/helper-sme.h | 3 +-- target/arm/helper.c | 2 -- target/arm/sme_helper.c | 9 ++------- target/arm/translate-a64.c | 10 ++-------- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index d2d544a6961..27eef49a11e 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -17,8 +17,7 @@ * License along with this library; if not, see . */ =20 -DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32) -DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32) +DEF_HELPER_FLAGS_3(set_svcr, TCG_CALL_NO_RWG, void, env, i32, i32) =20 DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32) =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index 80779678499..72b37b7cf17 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6765,8 +6765,6 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new,= uint64_t mask) static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - helper_set_pstate_sm(env, FIELD_EX64(value, SVCR, SM)); - helper_set_pstate_za(env, FIELD_EX64(value, SVCR, ZA)); aarch64_set_svcr(env, value, -1); } =20 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index 3abe03e4cb3..1e67fcac308 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -29,14 +29,9 @@ #include "vec_internal.h" #include "sve_ldst_internal.h" =20 -void helper_set_pstate_sm(CPUARMState *env, uint32_t i) +void helper_set_svcr(CPUARMState *env, uint32_t val, uint32_t mask) { - aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); -} - -void helper_set_pstate_za(CPUARMState *env, uint32_t i) -{ - aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); + aarch64_set_svcr(env, val, mask); } =20 void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 035e63bdc51..19cf371c4c8 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1847,14 +1847,8 @@ static void handle_msr_i(DisasContext *s, uint32_t i= nsn, =20 if ((old ^ new) & msk) { /* At least one bit changes. */ - bool i =3D crm & 1; - - if ((crm & 2) && i !=3D s->pstate_sm) { - gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); - } - if ((crm & 4) && i !=3D s->pstate_za) { - gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); - } + gen_helper_set_svcr(cpu_env, tcg_constant_i32(new), + tcg_constant_i32(msk)); } else { s->base.is_jmp =3D DISAS_NEXT; } --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481310; cv=none; d=zohomail.com; s=zohoarc; b=CzFuG/pBplMGtitXde7Ztp9CiEpug/z/2OY/C4UVaBxS8mVii2EDVyF16bMj6joyM1aSBKdC70sPekx1QtW5Fs1PUrhhNHbmRWydZGuafsafy4UDNzIXQjrM425YHbvP6aOggRAjtTi3ONfo0DNMF1jW/yxN8WLi3BzhFilkP68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481310; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qLC1OizCVn68FH21GRDKjbsntWejSNUy0/YImu0bDg8=; b=EKn84zeDJA8gBENQWUFuBVAcEXsWcZQYLmKwf6CIeYnspCdlC+3pfa2lwR15SC5LNSX43phDHHo3s6WHIT0zbX69oAaxN+sw+rNR8GmZYX1rCCEU+QXX99qTi6cbLW7UFC1Lo/D9QOJF6SDClXFK663HAY8CzIwO/KlCUACUxAs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481310670950.1810743590624; Mon, 23 Jan 2023 05:41:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwzx-00068o-Ue; Mon, 23 Jan 2023 08:36:33 -0500 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 1pJwzi-00060a-DP for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:21 -0500 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 1pJwzf-0002Sy-06 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:17 -0500 Received: by mail-wm1-x329.google.com with SMTP id l8so9024155wms.3 for ; Mon, 23 Jan 2023 05:36:14 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:13 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qLC1OizCVn68FH21GRDKjbsntWejSNUy0/YImu0bDg8=; b=VGZ7W03/KX1ic4nVdv2+VWdXVpUupbOqE3gqbp5b4Mdgvw/dISi9dvGpPsxPUk3hGl M71xjWlpx5KPy1kHUFLvCnRNJLesi6MYg5tWioXljWj3aBIzLZsLaUiVTmMg3gogn+mb +Wk1xx1B5UANmBBLNG2PZhudz9w0kniNYh+gMKPnQJyrDkPvVQ9v3w0b4kNx56ZDs2XN fzCwegpoTDJDjEBspGtSoRiYB+OhOvPVEDBQ0K9nI7wOg1cbG9iw968pd/y3n3Y9u32r EkIMqAyHaPUnJY4zihtJxh56rv4ydtPefYvTIFbbs0CZ3pzErGjz3VZ3PtG2qRKhVBZP m5dw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qLC1OizCVn68FH21GRDKjbsntWejSNUy0/YImu0bDg8=; b=hEo7aY+NzmcgAbqKa3JZMOKEMW4prVKLn308ZvUD4hwSfD2XSLcfGkWx8DtZYMFPz7 YHTeZ0s5TV7+H5Yua67QTFeYcMr2Pz44bhq041v2gtMhVrb+V/hwyfkGgoLyqO5Pu3tn bMGJHig+BQm0O3s9Vzk1Bj+/hh8CBY5KCmEaaUFrIBT2WgA/Ta7F3kWaGYqfN1qN8f+n RHbYWYwB0lJMFA5BCNzAZcUXK9z8u6q+FKpVfmBV/OYnM/knIcXhpM9d2fTsT7T4lP+V rEY3Ck0myEKqvRoT37T9XgS0GyDutuToXSRWqMtpkZBqvdO86Up1wBf9Zz9i8s3hcz/M e8ag== X-Gm-Message-State: AFqh2krTksgvpHTmSknIg+NvAKq9PA43zjyewGz0S/xHuyrp9v9O2Y7A Y6VKQltz9/KLS49192bvKhTu3JfZRKYo84TQ X-Google-Smtp-Source: AMrXdXs0PM2lG8Fdsm0KX8ivbL0bFSkKwnK/+M78+0WV2Sl7LQjt/KqCfcfK4UyjhRYse5+e5Dj7Lw== X-Received: by 2002:a05:600c:2255:b0:3da:f950:8168 with SMTP id a21-20020a05600c225500b003daf9508168mr22875737wmm.35.1674480973751; Mon, 23 Jan 2023 05:36:13 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/26] target/arm: Fix physical address resolution for MTE Date: Mon, 23 Jan 2023 13:35:47 +0000 Message-Id: <20230123133553.2171158-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481311359100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson Conversion to probe_access_full missed applying the page offset. Fixes: b8967ddf ("target/arm: Use probe_access_full for MTE") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1416 Signed-off-by: Richard Henderson Message-id: 20230114031213.2970349-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/mte_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index 86b37548386..98bcf59c225 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -142,7 +142,7 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, in= t ptr_mmu_idx, * Remember these values across the second lookup below, * which may invalidate this pointer via tlb resize. */ - ptr_paddr =3D full->phys_addr; + ptr_paddr =3D full->phys_addr | (ptr & ~TARGET_PAGE_MASK); attrs =3D full->attrs; full =3D NULL; =20 --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481284; cv=none; d=zohomail.com; s=zohoarc; b=OBsj2K7/WYUD55r4Ff/MADFckNFf0eH+YoO86dC/2co2mY2r+uTA+YEHwqPnxoxnagYeRcZAcA1I9wu33XybnR0UMT51zuMjqpHlzQJSkd4t9KCKY3PKDWEebCt5Dr2K3WKDTD5ng46QCUQzfoQfSov73QZWpztXGimJCNeBZe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481284; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=t4bugJ+RO2MbQct6JNW9hnGo8RWEyhaawxl4hk6fSFE=; b=GFD5VxLbuq12dQdsNPmfhVvw+boj2ofDlEB6faPENAtePFrz27wwt294RxHUh7F5565lSu0/bozDVwuDVklsN/8IYCk6Ij+gzU2a8m5su53Fjmlj/llT7Eb0cj4rfi342NGuQbJeYpMp88r6x9XhWIxaFVT+4Xgr08+5i7UKaEg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481284559934.3542502537989; Mon, 23 Jan 2023 05:41:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx00-0006Cw-72; Mon, 23 Jan 2023 08:36:36 -0500 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 1pJwzj-00060i-Rr for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:23 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzg-0002Mg-Lw for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:19 -0500 Received: by mail-wm1-x331.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so10622886wma.1 for ; Mon, 23 Jan 2023 05:36:14 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:14 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=t4bugJ+RO2MbQct6JNW9hnGo8RWEyhaawxl4hk6fSFE=; b=TxGjFB4lSqLFsidh7yoptsPDvTUNfCH+V992YeG9C/VBkayxVK1m5ml8X8pCk1LqPC 6I5JEcKNSPXu9v1HNxEN8FzaVfFF8Uzw/bf1Fd80MSHs+tQMYj020yb1x52Tm9WvZt3I N2mfYOmNmXz4DX8f29jDn7Yakl2y44aea4kuxIpEtY9SAbR9DPP+Kv2pQVWRcGPVTF20 JePZsNMS/g0S2GuRhIhty+3a9NXxhOzDsOYXboaYSm1ok6YhMtguA/XxSr8jT1zH8KMB Pnym2ECiBjmm/3x1YXYXOtTHDCLLQYAL4vm8LPkrg//PwurtVXvZ9VJUHPUBlk5CAKKR +EUg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t4bugJ+RO2MbQct6JNW9hnGo8RWEyhaawxl4hk6fSFE=; b=tBXBzfEBRBnxV0ChwflLHwIQjZJq6irYe9B7cdYDrOjSTdmknTxQPUwoXZRNtws3ce vt0cULE5HNOHoPpKuWDe/mxYN5c67wGrpc1QVWZ9IL/TMIDSB6iOGmkn66p2esGqUk0D U4I6uLmv8+z8GxPnu1uoKzMX/Cr0R0dlVaivO2Pd7tgZswJFkYZWhNSn0cukdYmwWN72 6h9R3sEhBILRZiIabmCYYUY8Z9MumMZ9o2w8/E/xAJ1OefeHegISv+dr8+8hq+n80KX1 O6fJ5ROnjKSejUvwBRBwV0AUN4AKNJZeg5ZlGYaAU7aN5tiv3r4v5tQUWoVvOXtOEDKW uuOw== X-Gm-Message-State: AFqh2krO3bNJcoqopXHUQ32Y1PfzsIW/8kzox9yV73lUEVqmm/zSYO5D iPwjD2Hw14W/mNU8Vl2wuthuwaLZdLpdrQZc X-Google-Smtp-Source: AMrXdXuc54GJagnnK1NZugNbQYYFKH9QlJ3T7WjTZTKfrHSvvnL0p6U8lxFp7kqbFLVTElfJAi8Lfg== X-Received: by 2002:a05:600c:5118:b0:3db:1e4f:7cdc with SMTP id o24-20020a05600c511800b003db1e4f7cdcmr16211655wms.15.1674480974548; Mon, 23 Jan 2023 05:36:14 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/26] target/arm: Fix in_debug path in S1_ptw_translate Date: Mon, 23 Jan 2023 13:35:48 +0000 Message-Id: <20230123133553.2171158-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481285097100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson During the conversion, the test against get_phys_addr_lpae got inverted, meaning that successful translations went to the 'failed' label. Cc: qemu-stable@nongnu.org Fixes: f3639a64f60 ("target/arm: Use softmmu tlbs for page table walking") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1417 Signed-off-by: Richard Henderson Message-id: 20230114054605.2977022-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/ptw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 4bda0590c7c..57f3615a66d 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -238,8 +238,8 @@ static bool S1_ptw_translate(CPUARMState *env, S1Transl= ate *ptw, }; GetPhysAddrResult s2 =3D { }; =20 - if (!get_phys_addr_lpae(env, &s2ptw, addr, MMU_DATA_LOAD, - false, &s2, fi)) { + if (get_phys_addr_lpae(env, &s2ptw, addr, MMU_DATA_LOAD, + false, &s2, fi)) { goto fail; } ptw->out_phys =3D s2.f.phys_addr; --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481292; cv=none; d=zohomail.com; s=zohoarc; b=jz2WkUUS3CX8/2pGBtbYAc38ATHIfAKFKXwQHPMnSmq+OBb08RS6baAAKhB6H953ey0h1lKcEzQPdXkivBA1kTj1ClJCc3Bnzg9lJgvgHB6lSzKlfUi8upRNFEk4gsHEZpvUGgufwLdgEdLhJIQMdtirhEkBL8+s1jD7jrKcVM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481292; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UKUCDtm5zNRWKAtz89l2k8txnv+LgwgNpjX50RbpUOg=; b=IKGLiOKCuF8310u4XQHtuTm3qV3OEFUbE4SqFsVLIkZXB8u0IRRX4akZ+Y5UI//uUxBLZuHzdgjewR70mblIsNfDIEt/T2ulsAfo5PS5abHzGoee+HEBDU0urXkEFbyjL9L0mwNopXOhgEqdZq52wrEOMHfwZMVbZb8GNj7utBs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481292358577.2992620816406; Mon, 23 Jan 2023 05:41:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx00-0006DT-KQ; Mon, 23 Jan 2023 08:36:36 -0500 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 1pJwzj-00060h-Nk for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:23 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzg-0002U1-MG for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:19 -0500 Received: by mail-wm1-x332.google.com with SMTP id k16so9027400wms.2 for ; Mon, 23 Jan 2023 05:36:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:14 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UKUCDtm5zNRWKAtz89l2k8txnv+LgwgNpjX50RbpUOg=; b=U5boNfvsqtBzHRVwYqUWgnrGX/YKuxqwfdJCEKt3D4v1E/5Tf8WMZCyYGhjXH0rDft Rh1eKJjGR+TN+PdmLsZWseWrrP9vbtrCOM0RJGVybzRn61Z9T2M8du2/mWNhzqiyOE8n fmIv8NgYpo2+VxtZpBhGpp0tx4F9fWKJhUqernTCjoG63ilML+PR/RmEyP27PDPgDrVx /inlDPoq1OpvL4v0KpFpm+5gRvjkIZIwPrqhoqVa4fk8WMpO5KZ+QXr5ird8ttOd9c+z E4K0eKADooTHcdkhlwiYh20TuV4v1wY6hRXmhua3bGmluvmgPX127hJld1fwFvLSofQJ hGDw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKUCDtm5zNRWKAtz89l2k8txnv+LgwgNpjX50RbpUOg=; b=K1QCHoeckaJbyCe4rapb6C+BM4PLjy7OAZ2TERM1OIDiAyOz5tD+iMpnD4S1+Gv0PV WiFxw2SCnmhGI/GyTbuhMUTOlMZLB7f8zGNOjgEIIsOX3BnNfASL/BHt0yqgalzAd8J8 U8RASFSHNfm3pKIKDyJBREuoju8AjdqUZjFUYOOGQpkCaRcNfcHJ6zNm0cSmnhQJLu+T WQiyPoo1GBgdruW7WyfmsyVxNo+IzcLkQFOwhTBLS7miusuSgqmw6wbgKgfT5eJnx8bx PLUAiOfgHwAvfx6HTMfElHqVNaUpZpUqkveNXYgrpem2t2J43+0fiDqeP6cV/ddDM9qp 82DQ== X-Gm-Message-State: AFqh2kpr8ZssB3cyTO3Yzlib0gXsw8+40ezzA0cvaJWsxA84JU+6L3BL KOpz0mycPPqOwPIrf7M2fY7GZIrYXaa+9ObT X-Google-Smtp-Source: AMrXdXsr9QMRelyFN34fFsQQzmDfIn5dlz5pmyl8AB3xDKyIVhOQUQomCrpXjxL6z3xCsbLodC2qXw== X-Received: by 2002:a05:600c:3b13:b0:3db:26b8:5023 with SMTP id m19-20020a05600c3b1300b003db26b85023mr15627804wms.10.1674480975407; Mon, 23 Jan 2023 05:36:15 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/26] target/arm: Don't set EXC_RETURN.ES if Security Extension not present Date: Mon, 23 Jan 2023 13:35:49 +0000 Message-Id: <20230123133553.2171158-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481293214100001 Content-Type: text/plain; charset="utf-8" In v7m_exception_taken(), for v8M we set the EXC_RETURN.ES bit if either the exception targets Secure or if the CPU doesn't implement the Security Extension. This is incorrect: the v8M Arm ARM specifies that the ES bit should be RES0 if the Security Extension is not implemented, and the pseudocode agrees. Remove the incorrect condition, so that we leave the ES bit 0 if the Security Extension isn't implemented. This doesn't have any guest-visible effects for our current set of emulated CPUs, because all our v8M CPUs implement the Security Extension; but it's worth fixing in case we add a v8M CPU without the extension in future. Reported-by: Igor Kotrasinski Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/m_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index d87b9ecd123..e7e746ea182 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -879,7 +879,7 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t l= r, bool dotailchain, } =20 lr &=3D ~R_V7M_EXCRET_ES_MASK; - if (targets_secure || !arm_feature(env, ARM_FEATURE_M_SECURITY)) { + if (targets_secure) { lr |=3D R_V7M_EXCRET_ES_MASK; } lr &=3D ~R_V7M_EXCRET_SPSEL_MASK; --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481172; cv=none; d=zohomail.com; s=zohoarc; b=PEtguDiliA/W88HykaG9RauGDpn6qNRX0GXLCwaIK+whtQKoxau+1inqakUcEWAvLXPfNw0MNYnwtXhzmX3ngLmE8JyjYysmfqZnBfmjqC3l1nv9plU57w660LSFtE+TYPStTuRpwNtJT8IsmW7Rk3XCuNV3U+2EO4vZQZ5muyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481172; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=brguCCskR07IlO3tUdOSX78gsX0q+RbP7/3ek3OIEVI=; b=R8+Xn2/3NVpPXMwhqyfKEpc2Qga4uOWBGTw27/tuS2EK2tN2Fzo7723rFxbhMKUP7wIPkaEsUMLFS0E78vVj2C6x73pQ/qlZ0Bvj99qSjATdt8RBTh77gIYQP56a4wocYchNLQltP96QYGwCz+BJBfbMSkeIcLSuDtGxWJMq0bo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16744811729411001.3742155282939; Mon, 23 Jan 2023 05:39:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx02-0006GG-R8; Mon, 23 Jan 2023 08:36:38 -0500 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 1pJwzk-00060j-0z for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:23 -0500 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 1pJwzi-0002Lc-6B for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:19 -0500 Received: by mail-wm1-x329.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so10607034wml.3 for ; Mon, 23 Jan 2023 05:36:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:15 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=brguCCskR07IlO3tUdOSX78gsX0q+RbP7/3ek3OIEVI=; b=oe00pt1Y7Exut/UqdK4ma9r5e400xIJ9sRy/7fHUKWoA6Y4C3tEDLnC3DZnEBdUuPK 3K5uJz7qEld9FKcGXHecKalRLakl21bCv2t3cd8IW+Gt0YwNMb5G4mjqBBulY95lPRa5 Akw9nfaUoigcfUeeQYMm0iyTd++JAnIoFBmu1T55Y6cnXPzf+5NYyQnPlFwm8h2NUPse hqc6pwD/ov1Iu01zPaULD6zhN1B4SINYjf7uZCTq2EdFW849hCDD3vgreDq3GUCMit8A h7BVLFR6ssJON0S0momCdo+W9gzYnpribaCAwSm7W6U8qRdT5JorUo2ysl6liplkHkC9 2QyA== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=brguCCskR07IlO3tUdOSX78gsX0q+RbP7/3ek3OIEVI=; b=xIlPXVlcR1/hgSWxr4w4wDC57jFAkgxJ+oRhcmXEtQ9y8sl0zPd3WmrMGY3uEYnr5p NKlQyakhnfDKNO+hxpFrM01NvsxuM8LQbfCb328eb+pLShJBLmGogHdlH0oXZTt5heFO IJLRzkOjl+ZsVyW/NLJT1eCKxyYbHoYwsE5GHLUmd5bCrF2rtA9nW4JEwPUMOoVgW1f9 RSC6XFOUttst0m8W4AoW/qgwC9ZZHpujXd18KV2titYZK4ZCFwgnXFiLlD5L8tkmhNqA UGWooj0//5SOQCnfV5/cIkTjY+bUc0C5hxsr9G5PzFD6foAbZKw6buHEwf9Ci6/VvN2E Lmww== X-Gm-Message-State: AFqh2kocTKlSiqbnUHWCWmZDJAIFdF2Bsr1ofrq9GjLKZGQvSjaV9ve4 pGm9bWlj1GyQN2HtX4cYT8njqYYyoyZfkMxo X-Google-Smtp-Source: AMrXdXvhy5ZMXxbcTbYz5ALHyo+ZLDcDjnPgcKbNkmXuDQwC+yhphRVdEXMX0iEweyaWhsR5oYLf3A== X-Received: by 2002:a05:600c:3d9b:b0:3db:1afd:ac36 with SMTP id bi27-20020a05600c3d9b00b003db1afdac36mr17776682wmb.32.1674480976228; Mon, 23 Jan 2023 05:36:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/26] target/arm: implement DBGCLAIM registers Date: Mon, 23 Jan 2023 13:35:50 +0000 Message-Id: <20230123133553.2171158-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481174601100003 Content-Type: text/plain; charset="utf-8" From: Evgeny Iakovlev The architecture does not define any functionality for the CLAIM tag bits. So we will just keep the raw bits, as per spec. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230120155929.32384-2-eiakovlev@linux.microsoft.com Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 + target/arm/debug_helper.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index f3ddc3b7793..8cf70693be4 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -495,6 +495,7 @@ typedef struct CPUArchState { uint64_t dbgbcr[16]; /* breakpoint control registers */ uint64_t dbgwvr[16]; /* watchpoint value registers */ uint64_t dbgwcr[16]; /* watchpoint control registers */ + uint64_t dbgclaim; /* DBGCLAIM bits */ uint64_t mdscr_el1; uint64_t oslsr_el1; /* OS Lock Status */ uint64_t osdlr_el1; /* OS DoubleLock status */ diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 2f6ddc0da57..f95a73329db 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -632,6 +632,24 @@ static void osdlr_write(CPUARMState *env, const ARMCPR= egInfo *ri, } } =20 +static void dbgclaimset_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + env->cp15.dbgclaim |=3D (value & 0xFF); +} + +static uint64_t dbgclaimset_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + /* CLAIM bits are RAO */ + return 0xFF; +} + +static void dbgclaimclr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + env->cp15.dbgclaim &=3D ~(value & 0xFF); +} + static const ARMCPRegInfo debug_cp_reginfo[] =3D { /* * DBGDRAR, DBGDSAR: always RAZ since we don't implement memory mapped @@ -715,6 +733,21 @@ static const ARMCPRegInfo debug_cp_reginfo[] =3D { .cp =3D 14, .opc0 =3D 2, .opc1 =3D 0, .crn =3D 0, .crm =3D 2, .opc2 = =3D 0, .access =3D PL1_RW, .accessfn =3D access_tda, .type =3D ARM_CP_NOP }, + /* + * Dummy DBGCLAIM registers. + * "The architecture does not define any functionality for the CLAIM t= ag bits.", + * so we only keep the raw bits + */ + { .name =3D "DBGCLAIMSET_EL1", .state =3D ARM_CP_STATE_BOTH, + .cp =3D 14, .opc0 =3D 2, .opc1 =3D 0, .crn =3D 7, .crm =3D 8, .opc2 = =3D 6, + .type =3D ARM_CP_ALIAS, + .access =3D PL1_RW, .accessfn =3D access_tda, + .writefn =3D dbgclaimset_write, .readfn =3D dbgclaimset_read }, + { .name =3D "DBGCLAIMCLR_EL1", .state =3D ARM_CP_STATE_BOTH, + .cp =3D 14, .opc0 =3D 2, .opc1 =3D 0, .crn =3D 7, .crm =3D 9, .opc2 = =3D 6, + .access =3D PL1_RW, .accessfn =3D access_tda, + .writefn =3D dbgclaimclr_write, .raw_writefn =3D raw_write, + .fieldoffset =3D offsetof(CPUARMState, cp15.dbgclaim) }, }; =20 static const ARMCPRegInfo debug_lpae_cp_reginfo[] =3D { --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481089; cv=none; d=zohomail.com; s=zohoarc; b=UBw7JAG2OGl872dtcEWHeM0kDOhITCX8oTizC8k69lmnJhMHF0ytdOJvENjFBpUV4UH4yW20MgrpYmVShvDrRdzO0jHkTEBYywS4/tjtxCTymB7/+X15dIAAHEng38PklintlS390gJKltFOS/AbCjFm/wBD7Rq4TVk/Co2QJJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481089; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Er8X565bqDdOiGqHEEKq8jrV5bcDZFCydYLQznUV95Q=; b=UniOMKn/9y0i0hbzOIZ4er9vupOVpuMV7V9/smyMiuIpnAvGJwfJ91shTrrRAP8o/YIx86TeIaDJmVwSMy9XjwXObQK2+caSuqnEkpSfmQ9FONa2FL005zNJVp7OrBsdkYXrWLKkRjdtdmhXAfGQS6er6xKl/wOv9doumTqEIIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481089598281.0018821541678; Mon, 23 Jan 2023 05:38:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx0V-0006li-35; Mon, 23 Jan 2023 08:37:08 -0500 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 1pJwzl-000617-67 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:24 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzi-0002Ud-Cy for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:20 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m15so9026345wms.4 for ; Mon, 23 Jan 2023 05:36:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:16 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Er8X565bqDdOiGqHEEKq8jrV5bcDZFCydYLQznUV95Q=; b=akkEyr4b9blvXEMbcQ2a3DasgX2qj8P/tP+u9F3rctAmz8JwEzLzzRMWB+Gx93y9+u O7it3T/ub+xxm8j+9sDsOft0pXFAuYuUQ+RJGrxwzRkDL0pk8hNdwLIbelGqOfd/7Xca XA6e+TCL1SdDawHrEyu6FIjjyT5MtYDU+DXCG7aIsr5c+rPvMvkW2YDWffdZsIy9bSEi C4HzWv2MIlPRMTvr+pkFjgLH/pAO888jVy5vO/yZrjo0hX6O7CB0jClQoFPPDq5Z5S1K iR6z+RTQ1kpUNwoozQIZSGCiYWVacr/49SkRqxhpVgPSI4RGLY4LFt7vqJkeJtMxv+vS B2uw== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Er8X565bqDdOiGqHEEKq8jrV5bcDZFCydYLQznUV95Q=; b=xXjDEho9La0fXGt+4A3YXBLx9T8RpkwOCsf3fONDu9HwPTc9mWL5K7wBl8E+WhoQ92 xZ/xrywBSrKvQDXSvfvPaFOlRd2mQMmq4VoEZde6vrBx0CcFYviU8oj1j15Tj8x2/TUt CUUGiGjePpeDMY1oIej42aFgv6qr4Zju6NrQ+bk3oQ9QMrgaEFMte3jrTs1oIiKNYPNl Gq6aQ8YVu/GB/7lMY8GV3eBz5VC0dTU+Nohn0MnunSu8zEe84cX3d/LP3PR2jrFTod0R swZPxmh6OV024CrO9zvvIk9KIiEaJCgSd2Qqt+VsOXKrLiy8sa5MGekEt5loLjxFMXsX ZoAA== X-Gm-Message-State: AFqh2koz6bkRcbXaXWCWf/tviwAK8KH1EDFHiPrU4wGF6mZuxsoaBp+g 4YroQdIbUyDNJ5JrxPAfsRdO8flsaOVtus1s X-Google-Smtp-Source: AMrXdXugVpHWTmRcnBSOMvGTLGp15OkuyR331i79W0mZf929Indkt6oBnD6lSvWjwyTVf/pvkdEyYg== X-Received: by 2002:a05:600c:5488:b0:3db:1ab:b91b with SMTP id iv8-20020a05600c548800b003db01abb91bmr25106678wmb.15.1674480977047; Mon, 23 Jan 2023 05:36:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/26] target/arm: provide stubs for more external debug registers Date: Mon, 23 Jan 2023 13:35:51 +0000 Message-Id: <20230123133553.2171158-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481090122100004 Content-Type: text/plain; charset="utf-8" From: Evgeny Iakovlev Qemu doesn't implement Debug Communication Channel, as well as the rest of external debug interface. However, Microsoft Hyper-V in tries to access some of those registers during an EL2 context switch. Since there is no architectural way to not advertise support for external debug, provide RAZ/WI stubs for OSDTRRX_EL1, OSDTRTX_EL1 and OSECCR_EL1 registers in the same way the rest of DCM is currently done. Do account for access traps though with access_tda. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Message-id: 20230120155929.32384-3-eiakovlev@linux.microsoft.com Signed-off-by: Peter Maydell --- target/arm/debug_helper.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index f95a73329db..cced3f168d0 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -682,6 +682,27 @@ static const ARMCPRegInfo debug_cp_reginfo[] =3D { .opc0 =3D 2, .opc1 =3D 3, .crn =3D 0, .crm =3D 1, .opc2 =3D 0, .access =3D PL0_R, .accessfn =3D access_tda, .type =3D ARM_CP_CONST, .resetvalue =3D 0 }, + /* + * OSDTRRX_EL1/OSDTRTX_EL1 are used for save and restore of DBGDTRRX_E= L0. + * It is a component of the Debug Communications Channel, which is not= implemented. + */ + { .name =3D "OSDTRRX_EL1", .state =3D ARM_CP_STATE_BOTH, .cp =3D 14, + .opc0 =3D 2, .opc1 =3D 0, .crn =3D 0, .crm =3D 0, .opc2 =3D 2, + .access =3D PL1_RW, .accessfn =3D access_tda, + .type =3D ARM_CP_CONST, .resetvalue =3D 0 }, + { .name =3D "OSDTRTX_EL1", .state =3D ARM_CP_STATE_BOTH, .cp =3D 14, + .opc0 =3D 2, .opc1 =3D 0, .crn =3D 0, .crm =3D 3, .opc2 =3D 2, + .access =3D PL1_RW, .accessfn =3D access_tda, + .type =3D ARM_CP_CONST, .resetvalue =3D 0 }, + /* + * OSECCR_EL1 provides a mechanism for an operating system + * to access the contents of EDECCR. EDECCR is not implemented though, + * as is the rest of external device mechanism. + */ + { .name =3D "OSECCR_EL1", .state =3D ARM_CP_STATE_BOTH, .cp =3D 14, + .opc0 =3D 2, .opc1 =3D 0, .crn =3D 0, .crm =3D 6, .opc2 =3D 2, + .access =3D PL1_RW, .accessfn =3D access_tda, + .type =3D ARM_CP_CONST, .resetvalue =3D 0 }, /* * DBGDSCRint[15,12,5:2] map to MDSCR_EL1[15,12,5:2]. Map all bits as * it is unlikely a guest will care. --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481057; cv=none; d=zohomail.com; s=zohoarc; b=D1FaZXywYo2sXz4eJbkw3GYx6aADogUA07Qa5Otu8xnXknxLlv7GCmQc67ow2LP8hyhJ/XuY1dZLTlKV/e3AnKWCQJI3KAvZ90udhgo7ALk6h7Er1A+Xp5vGkljBpcPC5u+LtMp6I2JGdejlxU22fqsZ/2eJM32dMAdA+i2CLRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481057; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lVUlCzuReKpCyyuTgLiiDtMEzcD1jFlaCUDrec+Vc7s=; b=I8HKkqJzCTIP2wmol1Urx4tepJZFLT4ivD3WLIIqLjqVD2Of6TVLXWZCYY/aC9CZv9pS63RHAgP+V2g21YiQxeoFcodrs1Dl1g0asxU3cTGuObG0Yzm23VAJnFmq7ZOk3bSUMwk2jGqstWPt8IX4kzuhCW91Vgv11wW1wOiHW2o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674481057739396.97415086504407; Mon, 23 Jan 2023 05:37:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx05-0006Jo-Me; Mon, 23 Jan 2023 08:36:41 -0500 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 1pJwzl-00061B-Se for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:25 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzj-0002V3-6I for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:21 -0500 Received: by mail-wm1-x32d.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so10623040wma.1 for ; Mon, 23 Jan 2023 05:36:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:17 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lVUlCzuReKpCyyuTgLiiDtMEzcD1jFlaCUDrec+Vc7s=; b=kCq36M9RpBcQ9OiJsNu7YWOPSnOPf8gFGynIC/pbdNL1vD8XLr/lJs+r6B1Th+TaFP dQaXKbRY3Vl48TrLMmPPqmIXfjcwUd5HK3zTW+p9SIWZeMuUjH+EJNhETCJQjGUaCTzl 6kR6+kUXlnoNjGu6WBmfehujQcl7TQ9xppnmgm471N6BVcu6hDyp6+Z5tVUk/AL22HaW nrvsKKpSHryqRUJ/qdQ8r6Q3cf+g++8C02BrX8h+XjU+OrphDKoa9qUzTPT7vv8QklaS 4g3gkmtPqLPdv6trPFtizm+RChny1ggcRSjGgWca1I7Qhlur9rhM5inD42f+WlRNuari 3WIg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lVUlCzuReKpCyyuTgLiiDtMEzcD1jFlaCUDrec+Vc7s=; b=ibQ4jTqUuqGIy/hKiyoniGcEkgxlY2j6H7ioJ/rnMNI2PPLZp6tNus1ajkWSH7pXKv crVEA3m9Eyvvzw07gIP4Vnb6zC8FbJyI5QOuCD+s+XFHOtbaZlSYebaWEV84ClWGvmrm wmubzRrZdUCZojYrX7ZzkFEksL5bTVakb1HavRd+s44GVG9dosnRCXL59TDDzMWq6I3I wxyrx9zkLOYpVOxNciMlwlAAdriyqfy9VgA+aN83RRclkjj8kFaYlt//xYyDWNzL8vKU 80yZbfFcRtjUY5lIgvg3z5JP5hmBs8hmdzK9rHwdOyZhelylfXjrKmHGlaI0r4PP3S0t mHkA== X-Gm-Message-State: AFqh2koCyw8w9dLE5JKeoZkl7nN/hysWM6CX3fwkNAuoRQOIuXwXKYj5 S39w0fegWBvUAMuNAOhNSs5m5VUTALSHMt/m X-Google-Smtp-Source: AMrXdXu/ppWhGeTMw4RL5oa+pglHL4GQTnJgezkdqZr+WpqlUjzQyRt2kU20ZLgtiCbAPotkS+llMg== X-Received: by 2002:a05:600c:3596:b0:3da:1357:4ca2 with SMTP id p22-20020a05600c359600b003da13574ca2mr25198195wmq.11.1674480977818; Mon, 23 Jan 2023 05:36:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/26] target/arm: Reorg do_coproc_insn Date: Mon, 23 Jan 2023 13:35:52 +0000 Message-Id: <20230123133553.2171158-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481059989100007 From: Richard Henderson Move the ri =3D=3D NULL case to the top of the function and return. This allows the else to be removed and the code unindented. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Message-id: 20230106194451.1213153-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.c | 406 ++++++++++++++++++++--------------------- 1 file changed, 203 insertions(+), 203 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 1dcaefb8e75..40f9f07ea30 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4715,220 +4715,220 @@ static void do_coproc_insn(DisasContext *s, int c= pnum, int is64, bool isread, int rt, int rt2) { const ARMCPRegInfo *ri; + bool need_exit_tb; =20 ri =3D get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); - if (ri) { - bool need_exit_tb; =20 - /* Check access permissions */ - if (!cp_access_ok(s->current_el, ri, isread)) { - unallocated_encoding(s); - return; - } - - if (s->hstr_active || ri->accessfn || - (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { - /* Emit code to perform further access permissions checks at - * runtime; this may result in an exception. - * Note that on XScale all cp0..c13 registers do an access che= ck - * call in order to handle c15_cpar. - */ - uint32_t syndrome; - - /* Note that since we are an implementation which takes an - * exception on a trapped conditional instruction only if the - * instruction passes its condition code check, we can take - * advantage of the clause in the ARM ARM that allows us to set - * the COND field in the instruction to 0xE in all cases. - * We could fish the actual condition out of the insn (ARM) - * or the condexec bits (Thumb) but it isn't necessary. - */ - switch (cpnum) { - case 14: - if (is64) { - syndrome =3D syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, = rt2, - isread, false); - } else { - syndrome =3D syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn,= crm, - rt, isread, false); - } - break; - case 15: - if (is64) { - syndrome =3D syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, = rt2, - isread, false); - } else { - syndrome =3D syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn,= crm, - rt, isread, false); - } - break; - default: - /* ARMv8 defines that only coprocessors 14 and 15 exist, - * so this can only happen if this is an ARMv7 or earlier = CPU, - * in which case the syndrome information won't actually be - * guest visible. - */ - assert(!arm_dc_feature(s, ARM_FEATURE_V8)); - syndrome =3D syn_uncategorized(); - break; - } - - gen_set_condexec(s); - gen_update_pc(s, 0); - gen_helper_access_check_cp_reg(cpu_env, - tcg_constant_ptr(ri), - tcg_constant_i32(syndrome), - tcg_constant_i32(isread)); - } else if (ri->type & ARM_CP_RAISES_EXC) { - /* - * The readfn or writefn might raise an exception; - * synchronize the CPU state in case it does. - */ - gen_set_condexec(s); - gen_update_pc(s, 0); - } - - /* Handle special cases first */ - switch (ri->type & ARM_CP_SPECIAL_MASK) { - case 0: - break; - case ARM_CP_NOP: - return; - case ARM_CP_WFI: - if (isread) { - unallocated_encoding(s); - return; - } - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp =3D DISAS_WFI; - return; - default: - g_assert_not_reached(); - } - - if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_= IO)) { - gen_io_start(); - } - - if (isread) { - /* Read */ - if (is64) { - TCGv_i64 tmp64; - TCGv_i32 tmp; - if (ri->type & ARM_CP_CONST) { - tmp64 =3D tcg_constant_i64(ri->resetvalue); - } else if (ri->readfn) { - tmp64 =3D tcg_temp_new_i64(); - gen_helper_get_cp_reg64(tmp64, cpu_env, - tcg_constant_ptr(ri)); - } else { - tmp64 =3D tcg_temp_new_i64(); - tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); - } - tmp =3D tcg_temp_new_i32(); - tcg_gen_extrl_i64_i32(tmp, tmp64); - store_reg(s, rt, tmp); - tmp =3D tcg_temp_new_i32(); - tcg_gen_extrh_i64_i32(tmp, tmp64); - tcg_temp_free_i64(tmp64); - store_reg(s, rt2, tmp); - } else { - TCGv_i32 tmp; - if (ri->type & ARM_CP_CONST) { - tmp =3D tcg_constant_i32(ri->resetvalue); - } else if (ri->readfn) { - tmp =3D tcg_temp_new_i32(); - gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(r= i)); - } else { - tmp =3D load_cpu_offset(ri->fieldoffset); - } - if (rt =3D=3D 15) { - /* Destination register of r15 for 32 bit loads sets - * the condition codes from the high 4 bits of the val= ue - */ - gen_set_nzcv(tmp); - tcg_temp_free_i32(tmp); - } else { - store_reg(s, rt, tmp); - } - } + if (!ri) { + /* + * Unknown register; this might be a guest error or a QEMU + * unimplemented feature. + */ + if (is64) { + qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " + "64 bit system register cp:%d opc1: %d crm:%d " + "(%s)\n", + isread ? "read" : "write", cpnum, opc1, crm, + s->ns ? "non-secure" : "secure"); } else { - /* Write */ - if (ri->type & ARM_CP_CONST) { - /* If not forbidden by access permissions, treat as WI */ - return; - } - - if (is64) { - TCGv_i32 tmplo, tmphi; - TCGv_i64 tmp64 =3D tcg_temp_new_i64(); - tmplo =3D load_reg(s, rt); - tmphi =3D load_reg(s, rt2); - tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); - tcg_temp_free_i32(tmplo); - tcg_temp_free_i32(tmphi); - if (ri->writefn) { - gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), - tmp64); - } else { - tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); - } - tcg_temp_free_i64(tmp64); - } else { - TCGv_i32 tmp =3D load_reg(s, rt); - if (ri->writefn) { - gen_helper_set_cp_reg(cpu_env, tcg_constant_ptr(ri), t= mp); - tcg_temp_free_i32(tmp); - } else { - store_cpu_offset(tmp, ri->fieldoffset, 4); - } - } + qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " + "system register cp:%d opc1:%d crn:%d crm:%d " + "opc2:%d (%s)\n", + isread ? "read" : "write", cpnum, opc1, crn, + crm, opc2, s->ns ? "non-secure" : "secure"); } - - /* I/O operations must end the TB here (whether read or write) */ - need_exit_tb =3D ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && - (ri->type & ARM_CP_IO)); - - if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { - /* - * A write to any coprocessor register that ends a TB - * must rebuild the hflags for the next TB. - */ - gen_rebuild_hflags(s, ri->type & ARM_CP_NEWEL); - /* - * We default to ending the TB on a coprocessor register write, - * but allow this to be suppressed by the register definition - * (usually only necessary to work around guest bugs). - */ - need_exit_tb =3D true; - } - if (need_exit_tb) { - gen_lookup_tb(s); - } - + unallocated_encoding(s); return; } =20 - /* Unknown register; this might be a guest error or a QEMU - * unimplemented feature. - */ - if (is64) { - qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " - "64 bit system register cp:%d opc1: %d crm:%d " - "(%s)\n", - isread ? "read" : "write", cpnum, opc1, crm, - s->ns ? "non-secure" : "secure"); - } else { - qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " - "system register cp:%d opc1:%d crn:%d crm:%d opc2:%d= " - "(%s)\n", - isread ? "read" : "write", cpnum, opc1, crn, crm, op= c2, - s->ns ? "non-secure" : "secure"); + /* Check access permissions */ + if (!cp_access_ok(s->current_el, ri, isread)) { + unallocated_encoding(s); + return; } =20 - unallocated_encoding(s); - return; + if (s->hstr_active || ri->accessfn || + (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { + /* + * Emit code to perform further access permissions checks at + * runtime; this may result in an exception. + * Note that on XScale all cp0..c13 registers do an access check + * call in order to handle c15_cpar. + */ + uint32_t syndrome; + + /* + * Note that since we are an implementation which takes an + * exception on a trapped conditional instruction only if the + * instruction passes its condition code check, we can take + * advantage of the clause in the ARM ARM that allows us to set + * the COND field in the instruction to 0xE in all cases. + * We could fish the actual condition out of the insn (ARM) + * or the condexec bits (Thumb) but it isn't necessary. + */ + switch (cpnum) { + case 14: + if (is64) { + syndrome =3D syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, + isread, false); + } else { + syndrome =3D syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, + rt, isread, false); + } + break; + case 15: + if (is64) { + syndrome =3D syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, + isread, false); + } else { + syndrome =3D syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, + rt, isread, false); + } + break; + default: + /* + * ARMv8 defines that only coprocessors 14 and 15 exist, + * so this can only happen if this is an ARMv7 or earlier CPU, + * in which case the syndrome information won't actually be + * guest visible. + */ + assert(!arm_dc_feature(s, ARM_FEATURE_V8)); + syndrome =3D syn_uncategorized(); + break; + } + + gen_set_condexec(s); + gen_update_pc(s, 0); + gen_helper_access_check_cp_reg(cpu_env, + tcg_constant_ptr(ri), + tcg_constant_i32(syndrome), + tcg_constant_i32(isread)); + } else if (ri->type & ARM_CP_RAISES_EXC) { + /* + * The readfn or writefn might raise an exception; + * synchronize the CPU state in case it does. + */ + gen_set_condexec(s); + gen_update_pc(s, 0); + } + + /* Handle special cases first */ + switch (ri->type & ARM_CP_SPECIAL_MASK) { + case 0: + break; + case ARM_CP_NOP: + return; + case ARM_CP_WFI: + if (isread) { + unallocated_encoding(s); + return; + } + gen_update_pc(s, curr_insn_len(s)); + s->base.is_jmp =3D DISAS_WFI; + return; + default: + g_assert_not_reached(); + } + + if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO))= { + gen_io_start(); + } + + if (isread) { + /* Read */ + if (is64) { + TCGv_i64 tmp64; + TCGv_i32 tmp; + if (ri->type & ARM_CP_CONST) { + tmp64 =3D tcg_constant_i64(ri->resetvalue); + } else if (ri->readfn) { + tmp64 =3D tcg_temp_new_i64(); + gen_helper_get_cp_reg64(tmp64, cpu_env, + tcg_constant_ptr(ri)); + } else { + tmp64 =3D tcg_temp_new_i64(); + tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); + } + tmp =3D tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(tmp, tmp64); + store_reg(s, rt, tmp); + tmp =3D tcg_temp_new_i32(); + tcg_gen_extrh_i64_i32(tmp, tmp64); + tcg_temp_free_i64(tmp64); + store_reg(s, rt2, tmp); + } else { + TCGv_i32 tmp; + if (ri->type & ARM_CP_CONST) { + tmp =3D tcg_constant_i32(ri->resetvalue); + } else if (ri->readfn) { + tmp =3D tcg_temp_new_i32(); + gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); + } else { + tmp =3D load_cpu_offset(ri->fieldoffset); + } + if (rt =3D=3D 15) { + /* Destination register of r15 for 32 bit loads sets + * the condition codes from the high 4 bits of the value + */ + gen_set_nzcv(tmp); + tcg_temp_free_i32(tmp); + } else { + store_reg(s, rt, tmp); + } + } + } else { + /* Write */ + if (ri->type & ARM_CP_CONST) { + /* If not forbidden by access permissions, treat as WI */ + return; + } + + if (is64) { + TCGv_i32 tmplo, tmphi; + TCGv_i64 tmp64 =3D tcg_temp_new_i64(); + tmplo =3D load_reg(s, rt); + tmphi =3D load_reg(s, rt2); + tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); + tcg_temp_free_i32(tmplo); + tcg_temp_free_i32(tmphi); + if (ri->writefn) { + gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), tmp= 64); + } else { + tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); + } + tcg_temp_free_i64(tmp64); + } else { + TCGv_i32 tmp =3D load_reg(s, rt); + if (ri->writefn) { + gen_helper_set_cp_reg(cpu_env, tcg_constant_ptr(ri), tmp); + tcg_temp_free_i32(tmp); + } else { + store_cpu_offset(tmp, ri->fieldoffset, 4); + } + } + } + + /* I/O operations must end the TB here (whether read or write) */ + need_exit_tb =3D ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && + (ri->type & ARM_CP_IO)); + + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { + /* + * A write to any coprocessor register that ends a TB + * must rebuild the hflags for the next TB. + */ + gen_rebuild_hflags(s, ri->type & ARM_CP_NEWEL); + /* + * We default to ending the TB on a coprocessor register write, + * but allow this to be suppressed by the register definition + * (usually only necessary to work around guest bugs). + */ + need_exit_tb =3D true; + } + if (need_exit_tb) { + gen_lookup_tb(s); + } } =20 /* Decode XScale DSP or iWMMXt insn (in the copro space, cp=3D0 or 1) */ --=20 2.34.1 From nobody Fri Nov 1 00:08:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674481097; cv=none; d=zohomail.com; s=zohoarc; b=kgDcs8e1Gvxwv147gp6w/fxKN6LAVTSbUuAuCqdsVPDJKB4U9uEM4WfxVMOmkb0hp9LsxWp+UhoXqDcWDNDexzPo08WNWiq27oBozJHmPdgLMSRcTglviV6IRldTTfxQGTa8Ka2hpEX6FARCG9s/S96v5jZS4KoNUW50F2CqafA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674481097; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pSfx3spfZRksbaPoHAooOlaakQpNRrolJmeYWC6KI2k=; b=XbWpji9zb+ZNMLeN9nex4XhUhibxLBJ2kqMS9h6wificvqdV+JVXq5XYf7KB+uvDGHRIJtPKDw0IGoYhAFEWW8IPWWBSgbFgijyuWDo+3SYMYgasLLUP/KG08JD78yJKfXhmA1snGZfttonWrBUPsBJae+wfPoJUtuse7VhoWfQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16744810978261017.7279923676408; Mon, 23 Jan 2023 05:38:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJx0g-00072a-F1; Mon, 23 Jan 2023 08:37:18 -0500 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 1pJwzm-00061L-3d for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:25 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJwzj-0002MF-K1 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 08:36:21 -0500 Received: by mail-wm1-x32a.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso10605738wmc.4 for ; Mon, 23 Jan 2023 05:36:19 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d19-20020a05600c34d300b003a6125562e1sm10817457wmq.46.2023.01.23.05.36.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 05:36:18 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pSfx3spfZRksbaPoHAooOlaakQpNRrolJmeYWC6KI2k=; b=sBoFENcuAe6sLAeXbyMmf0+Tbvt6UydaiSKgLhNpquIYNRJicov9l7flRsJ8yi5pzq XpXcJNKTWchtla7DxNyzW286ivTaf0bjLK3wgej1/iJ9UVzHLLZAchwIHwHbTnA3FAKi Ugd/dB+3U6thIkUMi9RPWm+MJQVKkXoKnBXEkbJ4NLJvb3iDabXxEmH9pgfGjBZpYybZ WK/sGeLtnXDCFd1n7NFZ3ikufn2awVIbGnNgEN3X9epNkBv3Rw7eTSR7evLOiosxzr8r XqT1lk30EeRuXXIm6nMt4moxPcQzxe/kTqdaHfiwQlJaa2pU0uwRpF46II3zQprphhun Yjmg== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pSfx3spfZRksbaPoHAooOlaakQpNRrolJmeYWC6KI2k=; b=RzPxDvTSsYaolei00EoYzkf//0UxTclNCdTmXUyGTgm+jBqwssID6ClepNq0CruSPM wlA6/VPaAlHUFYuobcxpdJszb4wbj5slVyb8KBloLO2gSmCosZrFJtMh6A8mR8vumUnB tPeGUy84JsyrD5d+x4o5WW8Outg3EaU2umzaZ7zEDlStyidKwvVeCQ4LBqoIep0LOstW mPQfp2HF0HoDhoJu1NgfQMfPHgjhFvfKZcjsKe+WfGQIjOPZ1BrfIegOy2tdeDjOhT09 FiWnGHOFLtckljN+6v1CNlHE906n8MiDXfTDrnscjchb9wulyAhoQAuWSAIbDivKHlml NGNQ== X-Gm-Message-State: AFqh2krVfQo7jO2EkJGK3xneCIEYVcnQs9ObpYsCwk82CtqJB+se0AQI i6Jdi7w0xhT85/cXpaogSA1i6EddaW32Jd7j X-Google-Smtp-Source: AMrXdXtD0YBwVfNzjmTCPvC2YqR28yQRyRrL2bLYx2csv4QLHdyGzbSqGsse66zVCnYBVWGg+KlZ6g== X-Received: by 2002:a05:600c:a690:b0:3d5:64bf:ccb8 with SMTP id ip16-20020a05600ca69000b003d564bfccb8mr23568436wmb.12.1674480978614; Mon, 23 Jan 2023 05:36:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/26] target/arm: Look up ARMCPRegInfo at runtime Date: Mon, 23 Jan 2023 13:35:53 +0000 Message-Id: <20230123133553.2171158-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org> References: <20230123133553.2171158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674481098322100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson Do not encode the pointer as a constant in the opcode stream. This pointer is specific to the cpu that first generated the translation, which runs into problems with both hot-pluggable cpus and user-only threads, as cpus are removed. It's also a potential correctness issue in the theoretical case of a slightly-heterogenous system, because if CPU 0 generates a TB and then CPU 1 executes it, CPU 1 will end up using CPU 0's hash table, which might have a wrong set of registers in it. (All our current systems are either completely homogenous, M-profile, or have CPUs sufficiently different that they wouldn't be sharing TBs anyway because the differences would show up in the TB flags, so the correctness issue is only theoretical, not practical.) Perform the lookup in either helper_access_check_cp_reg, or a new helper_lookup_cp_reg. Signed-off-by: Richard Henderson Message-id: 20230106194451.1213153-3-richard.henderson@linaro.org [PMM: added note in commit message about correctness issue] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.h | 11 +++++---- target/arm/translate.h | 7 ++++++ target/arm/op_helper.c | 27 ++++++++++++++------ target/arm/translate-a64.c | 49 ++++++++++++++++++++++--------------- target/arm/translate.c | 50 +++++++++++++++++++++++++------------- 5 files changed, 95 insertions(+), 49 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 92f36d9dbb7..018b00ea75b 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -79,11 +79,12 @@ DEF_HELPER_2(v8m_stackcheck, void, env, i32) =20 DEF_HELPER_FLAGS_2(check_bxj_trap, TCG_CALL_NO_WG, void, env, i32) =20 -DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32) -DEF_HELPER_3(set_cp_reg, void, env, ptr, i32) -DEF_HELPER_2(get_cp_reg, i32, env, ptr) -DEF_HELPER_3(set_cp_reg64, void, env, ptr, i64) -DEF_HELPER_2(get_cp_reg64, i64, env, ptr) +DEF_HELPER_4(access_check_cp_reg, cptr, env, i32, i32, i32) +DEF_HELPER_FLAGS_2(lookup_cp_reg, TCG_CALL_NO_RWG_SE, cptr, env, i32) +DEF_HELPER_3(set_cp_reg, void, env, cptr, i32) +DEF_HELPER_2(get_cp_reg, i32, env, cptr) +DEF_HELPER_3(set_cp_reg64, void, env, cptr, i64) +DEF_HELPER_2(get_cp_reg64, i64, env, cptr) =20 DEF_HELPER_2(get_r13_banked, i32, env, i32) DEF_HELPER_3(set_r13_banked, void, env, i32, i32) diff --git a/target/arm/translate.h b/target/arm/translate.h index 3cdc7dbc2fb..f17f095cbe2 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -610,6 +610,13 @@ static inline void set_disas_label(DisasContext *s, Di= sasLabel l) s->pc_save =3D l.pc_save; } =20 +static inline TCGv_ptr gen_lookup_cp_reg(uint32_t key) +{ + TCGv_ptr ret =3D tcg_temp_new_ptr(); + gen_helper_lookup_cp_reg(ret, cpu_env, tcg_constant_i32(key)); + return ret; +} + /* * Helpers for implementing sets of trans_* functions. * Defer the implementation of NAME to FUNC, with optional extra arguments. diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 70672bcd9fc..31f89db8997 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -624,14 +624,16 @@ uint32_t HELPER(mrs_banked)(CPUARMState *env, uint32_= t tgtmode, uint32_t regno) } } =20 -void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syn= drome, - uint32_t isread) +const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, + uint32_t syndrome, uint32_t isread) { ARMCPU *cpu =3D env_archcpu(env); - const ARMCPRegInfo *ri =3D rip; + const ARMCPRegInfo *ri =3D get_arm_cp_reginfo(cpu->cp_regs, key); CPAccessResult res =3D CP_ACCESS_OK; int target_el; =20 + assert(ri !=3D NULL); + if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14 && extract32(env->cp15.c15_cpar, ri->cp, 1) =3D=3D 0) { res =3D CP_ACCESS_TRAP; @@ -663,7 +665,7 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void= *rip, uint32_t syndrome, res =3D ri->accessfn(env, ri, isread); } if (likely(res =3D=3D CP_ACCESS_OK)) { - return; + return ri; } =20 fail: @@ -705,7 +707,16 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, voi= d *rip, uint32_t syndrome, raise_exception(env, EXCP_UDEF, syndrome, target_el); } =20 -void HELPER(set_cp_reg)(CPUARMState *env, void *rip, uint32_t value) +const void *HELPER(lookup_cp_reg)(CPUARMState *env, uint32_t key) +{ + ARMCPU *cpu =3D env_archcpu(env); + const ARMCPRegInfo *ri =3D get_arm_cp_reginfo(cpu->cp_regs, key); + + assert(ri !=3D NULL); + return ri; +} + +void HELPER(set_cp_reg)(CPUARMState *env, const void *rip, uint32_t value) { const ARMCPRegInfo *ri =3D rip; =20 @@ -718,7 +729,7 @@ void HELPER(set_cp_reg)(CPUARMState *env, void *rip, ui= nt32_t value) } } =20 -uint32_t HELPER(get_cp_reg)(CPUARMState *env, void *rip) +uint32_t HELPER(get_cp_reg)(CPUARMState *env, const void *rip) { const ARMCPRegInfo *ri =3D rip; uint32_t res; @@ -734,7 +745,7 @@ uint32_t HELPER(get_cp_reg)(CPUARMState *env, void *rip) return res; } =20 -void HELPER(set_cp_reg64)(CPUARMState *env, void *rip, uint64_t value) +void HELPER(set_cp_reg64)(CPUARMState *env, const void *rip, uint64_t valu= e) { const ARMCPRegInfo *ri =3D rip; =20 @@ -747,7 +758,7 @@ void HELPER(set_cp_reg64)(CPUARMState *env, void *rip, = uint64_t value) } } =20 -uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip) +uint64_t HELPER(get_cp_reg64)(CPUARMState *env, const void *rip) { const ARMCPRegInfo *ri =3D rip; uint64_t res; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 19cf371c4c8..52b1b8a1f0a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1939,13 +1939,12 @@ static void handle_sys(DisasContext *s, uint32_t in= sn, bool isread, unsigned int op0, unsigned int op1, unsigned int op= 2, unsigned int crn, unsigned int crm, unsigned int rt) { - const ARMCPRegInfo *ri; + uint32_t key =3D ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, + crn, crm, op0, op1, op2); + const ARMCPRegInfo *ri =3D get_arm_cp_reginfo(s->cp_regs, key); + TCGv_ptr tcg_ri =3D NULL; TCGv_i64 tcg_rt; =20 - ri =3D get_arm_cp_reginfo(s->cp_regs, - ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, - crn, crm, op0, op1, op2)); - if (!ri) { /* Unknown register; this might be a guest error or a QEMU * unimplemented feature. @@ -1971,8 +1970,9 @@ static void handle_sys(DisasContext *s, uint32_t insn= , bool isread, =20 syndrome =3D syn_aa64_sysregtrap(op0, op1, op2, crn, crm, rt, isre= ad); gen_a64_update_pc(s, 0); - gen_helper_access_check_cp_reg(cpu_env, - tcg_constant_ptr(ri), + tcg_ri =3D tcg_temp_new_ptr(); + gen_helper_access_check_cp_reg(tcg_ri, cpu_env, + tcg_constant_i32(key), tcg_constant_i32(syndrome), tcg_constant_i32(isread)); } else if (ri->type & ARM_CP_RAISES_EXC) { @@ -1988,7 +1988,7 @@ static void handle_sys(DisasContext *s, uint32_t insn= , bool isread, case 0: break; case ARM_CP_NOP: - return; + goto exit; case ARM_CP_NZCV: tcg_rt =3D cpu_reg(s, rt); if (isread) { @@ -1996,14 +1996,14 @@ static void handle_sys(DisasContext *s, uint32_t in= sn, bool isread, } else { gen_set_nzcv(tcg_rt); } - return; + goto exit; case ARM_CP_CURRENTEL: /* Reads as current EL value from pstate, which is * guaranteed to be constant by the tb flags. */ tcg_rt =3D cpu_reg(s, rt); tcg_gen_movi_i64(tcg_rt, s->current_el << 2); - return; + goto exit; case ARM_CP_DC_ZVA: /* Writes clear the aligned block of memory which rt points into. = */ if (s->mte_active[0]) { @@ -2020,7 +2020,7 @@ static void handle_sys(DisasContext *s, uint32_t insn= , bool isread, tcg_rt =3D clean_data_tbi(s, cpu_reg(s, rt)); } gen_helper_dc_zva(cpu_env, tcg_rt); - return; + goto exit; case ARM_CP_DC_GVA: { TCGv_i64 clean_addr, tag; @@ -2041,7 +2041,7 @@ static void handle_sys(DisasContext *s, uint32_t insn= , bool isread, tcg_temp_free_i64(tag); } } - return; + goto exit; case ARM_CP_DC_GZVA: { TCGv_i64 clean_addr, tag; @@ -2059,16 +2059,16 @@ static void handle_sys(DisasContext *s, uint32_t in= sn, bool isread, tcg_temp_free_i64(tag); } } - return; + goto exit; default: g_assert_not_reached(); } if ((ri->type & ARM_CP_FPU) && !fp_access_check_only(s)) { - return; + goto exit; } else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) { - return; + goto exit; } else if ((ri->type & ARM_CP_SME) && !sme_access_check(s)) { - return; + goto exit; } =20 if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO))= { @@ -2081,16 +2081,22 @@ static void handle_sys(DisasContext *s, uint32_t in= sn, bool isread, if (ri->type & ARM_CP_CONST) { tcg_gen_movi_i64(tcg_rt, ri->resetvalue); } else if (ri->readfn) { - gen_helper_get_cp_reg64(tcg_rt, cpu_env, tcg_constant_ptr(ri)); + if (!tcg_ri) { + tcg_ri =3D gen_lookup_cp_reg(key); + } + gen_helper_get_cp_reg64(tcg_rt, cpu_env, tcg_ri); } else { tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset); } } else { if (ri->type & ARM_CP_CONST) { /* If not forbidden by access permissions, treat as WI */ - return; + goto exit; } else if (ri->writefn) { - gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), tcg_rt); + if (!tcg_ri) { + tcg_ri =3D gen_lookup_cp_reg(key); + } + gen_helper_set_cp_reg64(cpu_env, tcg_ri, tcg_rt); } else { tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset); } @@ -2113,6 +2119,11 @@ static void handle_sys(DisasContext *s, uint32_t ins= n, bool isread, */ s->base.is_jmp =3D DISAS_UPDATE_EXIT; } + + exit: + if (tcg_ri) { + tcg_temp_free_ptr(tcg_ri); + } } =20 /* System diff --git a/target/arm/translate.c b/target/arm/translate.c index 40f9f07ea30..365e02fb0b8 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4714,12 +4714,11 @@ static void do_coproc_insn(DisasContext *s, int cpn= um, int is64, int opc1, int crn, int crm, int opc2, bool isread, int rt, int rt2) { - const ARMCPRegInfo *ri; + uint32_t key =3D ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc= 2); + const ARMCPRegInfo *ri =3D get_arm_cp_reginfo(s->cp_regs, key); + TCGv_ptr tcg_ri =3D NULL; bool need_exit_tb; =20 - ri =3D get_arm_cp_reginfo(s->cp_regs, - ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); - if (!ri) { /* * Unknown register; this might be a guest error or a QEMU @@ -4800,8 +4799,9 @@ static void do_coproc_insn(DisasContext *s, int cpnum= , int is64, =20 gen_set_condexec(s); gen_update_pc(s, 0); - gen_helper_access_check_cp_reg(cpu_env, - tcg_constant_ptr(ri), + tcg_ri =3D tcg_temp_new_ptr(); + gen_helper_access_check_cp_reg(tcg_ri, cpu_env, + tcg_constant_i32(key), tcg_constant_i32(syndrome), tcg_constant_i32(isread)); } else if (ri->type & ARM_CP_RAISES_EXC) { @@ -4818,15 +4818,15 @@ static void do_coproc_insn(DisasContext *s, int cpn= um, int is64, case 0: break; case ARM_CP_NOP: - return; + goto exit; case ARM_CP_WFI: if (isread) { unallocated_encoding(s); - return; + } else { + gen_update_pc(s, curr_insn_len(s)); + s->base.is_jmp =3D DISAS_WFI; } - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp =3D DISAS_WFI; - return; + goto exit; default: g_assert_not_reached(); } @@ -4843,9 +4843,11 @@ static void do_coproc_insn(DisasContext *s, int cpnu= m, int is64, if (ri->type & ARM_CP_CONST) { tmp64 =3D tcg_constant_i64(ri->resetvalue); } else if (ri->readfn) { + if (!tcg_ri) { + tcg_ri =3D gen_lookup_cp_reg(key); + } tmp64 =3D tcg_temp_new_i64(); - gen_helper_get_cp_reg64(tmp64, cpu_env, - tcg_constant_ptr(ri)); + gen_helper_get_cp_reg64(tmp64, cpu_env, tcg_ri); } else { tmp64 =3D tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); @@ -4862,8 +4864,11 @@ static void do_coproc_insn(DisasContext *s, int cpnu= m, int is64, if (ri->type & ARM_CP_CONST) { tmp =3D tcg_constant_i32(ri->resetvalue); } else if (ri->readfn) { + if (!tcg_ri) { + tcg_ri =3D gen_lookup_cp_reg(key); + } tmp =3D tcg_temp_new_i32(); - gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); + gen_helper_get_cp_reg(tmp, cpu_env, tcg_ri); } else { tmp =3D load_cpu_offset(ri->fieldoffset); } @@ -4881,7 +4886,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum= , int is64, /* Write */ if (ri->type & ARM_CP_CONST) { /* If not forbidden by access permissions, treat as WI */ - return; + goto exit; } =20 if (is64) { @@ -4893,7 +4898,10 @@ static void do_coproc_insn(DisasContext *s, int cpnu= m, int is64, tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { - gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), tmp= 64); + if (!tcg_ri) { + tcg_ri =3D gen_lookup_cp_reg(key); + } + gen_helper_set_cp_reg64(cpu_env, tcg_ri, tmp64); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } @@ -4901,7 +4909,10 @@ static void do_coproc_insn(DisasContext *s, int cpnu= m, int is64, } else { TCGv_i32 tmp =3D load_reg(s, rt); if (ri->writefn) { - gen_helper_set_cp_reg(cpu_env, tcg_constant_ptr(ri), tmp); + if (!tcg_ri) { + tcg_ri =3D gen_lookup_cp_reg(key); + } + gen_helper_set_cp_reg(cpu_env, tcg_ri, tmp); tcg_temp_free_i32(tmp); } else { store_cpu_offset(tmp, ri->fieldoffset, 4); @@ -4929,6 +4940,11 @@ static void do_coproc_insn(DisasContext *s, int cpnu= m, int is64, if (need_exit_tb) { gen_lookup_tb(s); } + + exit: + if (tcg_ri) { + tcg_temp_free_ptr(tcg_ri); + } } =20 /* Decode XScale DSP or iWMMXt insn (in the copro space, cp=3D0 or 1) */ --=20 2.34.1