From patchwork Mon Jan 23 13:35:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645554 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186451pvb; Mon, 23 Jan 2023 05:37:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXvniqb4nAb9SOItZr9TWgyxk+5JFJIQK5i6NHgseeGrjK6iMGgFvsYets2E8PKY3zClEQfj X-Received: by 2002:ac8:4601:0:b0:3b6:304c:9a6d with SMTP id p1-20020ac84601000000b003b6304c9a6dmr34801989qtn.62.1674481045449; Mon, 23 Jan 2023 05:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481045; cv=none; d=google.com; s=arc-20160816; b=YfAhzQQIkSqUAMwblIAWVE7vdG7Oyu2NfvzxyKQKi4xsCbMzSiG+T508ECKqvcd74k 3hrqmwmNqvE2a09HPcpAGUFloX0kILBoAazwL0bkwi9vN7T/h7Sc7uQ+1P1LK4KcIrHO 5Enkv3nZrBuNgGkrQQBIvaLKcqEACIwp+KX+NV7/FnTifjxc0bs9/nVpEmdbzB5ORDKu SnhP/Sic6dZkP/pdlOeU2wmcKKXvioaV7IV6bmVLTwK3hXaNKW6PPxnyYBYjfw1cR+b7 6mfwqbXfP27VU1eDzyJHcJ0xnZA99gLKFCoIbnCMx1lg8F8q+ahBE7d64nxg3VoXWgcz X34w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yoMZ5Lhhpa4yw40aAugkzPNGIP1VZYIJaNLaSg584+0=; b=GHN+A1Zggon7ETqxW7cNdQRCH6kjoA0YvRUdAI5GAow+EUoKnqWNwB9WU2LBJD8K45 XWIdYs9U+VoTa4Sb3iCV7J8IeV4WdtVgB9Jpb7dAVeLrbgjMYqm4jozl39fKrVSqx3D+ m8sM+ZT65O39LSDl/VJziJ55Qay21Yg4ilKgX15cBuWTg90HJ2Wle/xu28kqk78Z7enx 0CTM5m16gjUqb6uk83AJ6kfeORxnSRWK4hPctZVh+g0vbmkk9ck9UMLkpzAQGH2VIBRJ L3IE3QI8DyAGHa19hF0bZxxR9O+w6K8u6+ilivYRkaSL1vRF83x4NukJjURDdKb+bYJs LwLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pubc/w3r"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id de11-20020a05620a370b00b0070256c10513si6137166qkb.15.2023.01.23.05.37.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:37:25 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pubc/w3r"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 */ From patchwork Mon Jan 23 13:35:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645559 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186800pvb; Mon, 23 Jan 2023 05:38:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgNLNellnKr8j+vl2glFPODkCon3QJAD70f5LA0VSQt1hUGZKoc2FTTgHIAMkwb+j2eMJ/ X-Received: by 2002:a0c:f483:0:b0:537:4bc7:a617 with SMTP id i3-20020a0cf483000000b005374bc7a617mr17202764qvm.50.1674481088240; Mon, 23 Jan 2023 05:38:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481088; cv=none; d=google.com; s=arc-20160816; b=jR8dWqGPZmtSV4Hvq8ZmtFtEaed1kRl4MkmhciW6DqPNme7siCmK2s34QlWv5Xz7Pu V4H31vYbiSpDim+ro7sX6D3bptTEqcP8KSCLFVIogBIlMiRCH2+9wuyhieq3oBePBDQG ofx7Srn9WvBRRVOB5KtlfaxifYz0IO2J+YL8qkDwOYSRsVN4RQrC86Zw24SJPghmA8hs nrk4ZCSt+vC6v1aBjVePZn3SzejL1DsfJ9GwTpKZNFte8a/QU+d1JfxGJdK6xIxqI1oo IrZ7KSRu8XQp+18rRMgJr8HW83repNFjDdgK9w4EPJ4l7vgk7MbeZBje3bcXErEae7Cr gSVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=baS6RwiqJNceR0oUd3JGQ4ePjOLEDMiL7ZbUGHl6dos=; b=lHige7W/DaRZwx5YDMtb1y/PVlWwUqd8JU57proiIVgiEGLccN6imxTunKF/y9rcaC yiCtBDn9ZHmalhVKe335Yc46AXYpY2Rvy8+y9MYGszBafVyOjAj/TJEKdVcYdIR4dR7+ LmNcMHn7WNORa2afm6t/twLKninNPgw1ZG9gYt0J3fVYfhYe99hifqw0sCfkTQxIWr4L PpLP4L7oVQgPYGZW9pW5c/SbvZ7YeZDGa8155qgAnn3PjAXDpOUglofaem+MjomPUJN5 dodIKGY2uWvgY7oGUZyLUPxlcY6TBlf0SEqTOPKWq0C8zE+0xCnj58gtQO6Gp8C3HMo6 Rr7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tv+4vSou; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u8-20020ad45aa8000000b005347cdcbb88si20757534qvg.349.2023.01.23.05.38.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:38:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tv+4vSou; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 maskreg, uint32_t val) env->v7m.primask[M_REG_NS] = 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] = 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] = val & 1; From patchwork Mon Jan 23 13:35:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645575 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2236936pvb; Mon, 23 Jan 2023 07:12:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXutZOOJd1vHevKTw6sOuhApNj8yIRLUqpWyMnfm11Udk554s5Ryg3mBqFpIFnmIARSWXsOu X-Received: by 2002:ac8:5a95:0:b0:3b6:2f0d:1924 with SMTP id c21-20020ac85a95000000b003b62f0d1924mr47721229qtc.32.1674486775612; Mon, 23 Jan 2023 07:12:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486775; cv=none; d=google.com; s=arc-20160816; b=L26s7g3ocPrGBg6hrEMcN3aAAsetSv0Q0Kn2HSQvG3H5AXvK4P6B3KOpbWBF8BOEse 33T+VOU30JYYaeEwsJoHtG6twWdW6GPeQnhZZF5PfKC3v52PdgQTI1jPaMs932IT58Qq hrYJfjIrexwAJYyha0LphxY0d+6qhMZ6IXuUQRuI0/rGyQ0eIz57ZqtyVAA87QezoACC 9e8BUKPU/BGk88X1joQ/ph4oCtdLWtx6h84GpJkNF7I+8S+BPo/ybnYa73DSgrw0trSC vi0SQJBNduBEg7YfDgKGODvoZs+iVWhNbqfbbX4jE2SQ/x3dIT1UuQQfNVK4+0MHVZPa VfmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=IIgxyXSUr0bntZmMjT7iADRhtvV5tpYANa73KzeI1HU=; b=s/YGQRb1c1Sp0oSNkbnGe//N+jqhnxnngJeKLKjwhY41YouaDTPgoOhNP9huGWBarl pJwKZCXkPax9VU9t932EqSctmO9G7DhjIXLu+/42HgVAa9qbyWS1tVCgIuahy8YLiWRO Faufzit3rh4b2DlrGupanDgOn3bXTpuE8tfdbWj12NWzOLk2ngKgHIi/EMao6XjR244h Hp+hRfn9vOQEVFx/tQRitMdmbw4LmpdWPehHnAaAsrIJB+jGcUrZhghGkJsUIyL86DS6 KsLtpQflhRqRzT7TWouLLQVjGcgqAN8LfmcLCVDXo+E7EFprVZlcjoUrYfqrRhanwaje GX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wipqwz5N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t2-20020ac85302000000b003a7e09739f3si27815612qtn.765.2023.01.23.07.12.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 07:12:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wipqwz5N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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 @@ #include "hw/i2c/i2c.h" +#define TYPE_GPIO_I2C "gpio_i2c" + typedef struct bitbang_i2c_interface bitbang_i2c_interface; #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) dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE, qdev_get_gpio_in(pic, MP_GPIO_IRQ)); - i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL); + i2c_dev = sysbus_create_simple(TYPE_GPIO_I2C, -1, NULL); i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c"); lcd_dev = 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) /* GPIO interface. */ -#define TYPE_GPIO_I2C "gpio_i2c" OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C) struct GPIOI2CState { From patchwork Mon Jan 23 13:35:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645571 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2224305pvb; Mon, 23 Jan 2023 06:50:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXt16Ruv3Du3c/cTvf3FoYbTWyiWLcbE+2YkExDjz4FMz+48S0l8MfXAQEl3z0f29EGuXmXH X-Received: by 2002:ac8:47d1:0:b0:3b6:3995:2ec2 with SMTP id d17-20020ac847d1000000b003b639952ec2mr39217615qtr.19.1674485437131; Mon, 23 Jan 2023 06:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674485437; cv=none; d=google.com; s=arc-20160816; b=YJGocrwEBGJOnDmXSpyCYPjxkYL+euBE6FNEn4hCh/4MFPhmYo3hoMX81X55OqvLP5 O1H25TzmYQSOKYDpIHxkZa+kaRuxKoBIVaGPrHogPZNuwQT7R9HdmAVQFwblxgOmITFs UemRLXC2xPWkwLgWbKZ6KsYqoq8XcCPs7zqFDrCpSkQG+c6ozfR05O4zBedt6jIyi6tj 3z/0s/9DJCxhYWTuhxR8Uh/+lbDAmPMmmO2sR+Pqib9CsP9m2JSHtSnWOfy4+1U0XzqJ 8BaEsZk8z5FqkezKuW/qmVoR9e8YBSFzRRBxOZbq/XEvsRfVxs4hGRRcDin+/ArXwmI+ onnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YmXnlmeCDWnUzpUGh2Egb8JcHFR1ZUCOATZdrEkd6xo=; b=pUtFD+6PfoopMieXMmZmh+dy2+q+KHwsGByWA50VOKHzCwmuNt6xIYT7J8p5nG6lyt POzgT4xEDQMA80Fi8Na3ZWsvupQGYuHA3uSc+izCZLcWWsRJHvJ4mRZProjlRsW1StZz l+1me3FmhHJie54kLFECZG+26tuPhwhifcA6Cj1b4zbxnmGkHNyOB6VgkSfkW4F8jO8a VpB39kN6uYvjWPlyexzHlFArxatSwUxAXVqDebHis9stOa9Z0mWC/BrVyyl4OsV4mzK4 8IXI67F7ispZO4CtXuJQZ3u1lri9OHMCOetfYOOSRXRGQ/8ciFlHKauBcmKxau/5fw4M IUiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1Odq7Gv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o10-20020ac8554a000000b003b645fac147si11286301qtr.103.2023.01.23.06.50.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:50:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1Odq7Gv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé 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) struct GPIOI2CState { + /*< private >*/ SysBusDevice parent_obj; + /*< public >*/ - 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 = DEVICE(obj); GPIOI2CState *s = GPIO_I2C(obj); - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); I2CBus *bus; - memory_region_init(&s->dummy_iomem, obj, "gpio_i2c", 0); - sysbus_init_mmio(sbd, &s->dummy_iomem); - bus = i2c_init_bus(dev, "i2c"); bitbang_i2c_init(&s->bitbang, bus); From patchwork Mon Jan 23 13:35:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645573 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2235149pvb; Mon, 23 Jan 2023 07:09:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXt8bIMR7ZtXNvFHThiNjOiMpaoN8Q7A09m+rAxt6B+qNpA7Tzx4Jyc3sm4dw61JCnD0oBE2 X-Received: by 2002:a0c:ec05:0:b0:4c6:ed83:9f7b with SMTP id y5-20020a0cec05000000b004c6ed839f7bmr39956641qvo.30.1674486595892; Mon, 23 Jan 2023 07:09:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486595; cv=none; d=google.com; s=arc-20160816; b=Zc0GO1kZC6G/HhPfdIlBixD8QR4u41cMJ4JBcEk9VvyfOKMG8Uoi4+1pJwKzfvGqkH zumjoPjVX8Uv4iEQWBWtXmb41cc4ND6RbWg1bo/FHqy4qoKP7Y5BwxuxGBZydcI6Dq1F leqgQyze1IXWle6HiPlpYkEuX8pHANU3PrQIUIQJpxr4b40G1Y434ozY+4u5dxYXCNNX mwzWkAkxMLhRwszOcAQdgQIpgQDLpKdbBjOOhSYViUEDhWD04uNEAo5A70WWy0pEldnA xj522et7vCV03IcmxGimgtnqp6Qh70Js5Da+TXpt1pcinEEFfLkrmo8dQkDwQgdcb/ag 1xtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=6g1ePUTRmriS5gLoLUmsa+TXq6zNdDNdJGL0C/i+UZw=; b=sbhkaqutNexmjFu/3eISHinegL1BP+YkLew49mauuXZOHURoeuNEfUpYhVfScr4/2K saMhKfHgmUiRBfz1+klqQ4pNiDcYrBfGfwavC9SyETT1m9sKeQVTJTK+sKSqr+8TIENU Gw1pZ+Ewg4riQ65eVxNYZ8g2MdEBbbmHutzj1g7tDvmYnr7KS/q5riUEttd4YNIjQVyh ygoSimHH3oAN/K84aVubuGAxbTZ3BNCRu/Ge3cn5ZPpTfY7g6pqgYtPdVPpU/DIt9kTJ my+345ZHZrvbgwWwLmxmmXZpsL8s6B/B33StxxmPHe4a2cmnXGxPndjOG75a5j/F3iI4 qj3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gapkhKbB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m7-20020a0562141bc700b005318cae5b45si3330126qvc.544.2023.01.23.07.09.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 07:09:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gapkhKbB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé 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__); } while (0) #define DPRINTF(fmt, ...) do {} while(0) #endif +static void bitbang_i2c_set_state(bitbang_i2c_interface *i2c, + bitbang_i2c_state state) +{ + i2c->state = state; +} + static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) { DPRINTF("STOP\n"); if (i2c->current_addr >= 0) i2c_end_transfer(i2c->bus); i2c->current_addr = -1; - i2c->state = STOPPED; + bitbang_i2c_set_state(i2c, STOPPED); } /* Set device data pin. */ @@ -69,7 +75,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level) if (level == 0) { DPRINTF("START\n"); /* START condition. */ - i2c->state = SENDING_BIT7; + bitbang_i2c_set_state(i2c, SENDING_BIT7); i2c->current_addr = -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 = (i2c->buffer << 1) | data; /* will end up in WAITING_FOR_ACK */ - i2c->state++; + bitbang_i2c_set_state(i2c, i2c->state + 1); return bitbang_i2c_ret(i2c, 1); case WAITING_FOR_ACK: @@ -117,13 +123,14 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, 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 = RECEIVING_BIT7; + bitbang_i2c_set_state(i2c, RECEIVING_BIT7); } else { - i2c->state = 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 line, int level) case RECEIVING_BIT6 ... RECEIVING_BIT0: data = i2c->buffer >> 7; /* will end up in SENDING_ACK */ - i2c->state++; + bitbang_i2c_set_state(i2c, i2c->state + 1); i2c->buffer <<= 1; return bitbang_i2c_ret(i2c, data); case SENDING_ACK: - i2c->state = RECEIVING_BIT7; if (data != 0) { DPRINTF("NACKED\n"); - i2c->state = 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); } From patchwork Mon Jan 23 13:35:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645568 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2216799pvb; Mon, 23 Jan 2023 06:33:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXszOEIDxthSWnkE/NVd9gwc/F6SiokQE0kFj8M9d23zSOnT+UIalmuz7F6s0EBoj22+lPJG X-Received: by 2002:a05:6102:dc6:b0:3d3:dc3f:2a2b with SMTP id e6-20020a0561020dc600b003d3dc3f2a2bmr17861341vst.28.1674484436216; Mon, 23 Jan 2023 06:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674484436; cv=none; d=google.com; s=arc-20160816; b=cr+FWIKYePMe3mnPe+l3mBEA9QSjwcpo4coK4iG+OPLBapcK9cwhWThaxaTxjAfSJl NpwVU7po1iVNNK/cJZFX9qmoBZ/1UB9Mggz3V/2CFDooNjWRjZ6o1SlIPKl/POFL6Or9 pB10JTpedULwt1XndRxEiFIGNpASUYP5yJjTFx2aIw5xR5xy2EVMmXlTXUQfbt966ZWO PQ1KNsiDMQqRUYy4uSRcILMyEXt2W1u64FX53Xw4nnHP0L8jgzzzFr8VP3S8L/6ZkPzc GjEL/qivvBUJeRuwD3O14SwxcgdnJz/rmGUYltYQsCYPwdP1Y7jxBHaEd/M+flZXOCw0 4aPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=w55BWEiCagDu8rhFOm3b8OsC2R7luqRvAnPZEXr+dRQ=; b=kj6INh6RdSwJrhOuyP3Vrowu+qeTgQCObJl8fjJeebHHfooKbbiBo2QcweSkgxlfP2 aZZsWLKlrxqIgz7IyzYuXAPGX+YiyCX0vMMqIs2pvo5LerLScOwsDkixBi7mFhH+HyxI wk5LK2AjYUn6bJE7Hk1kwIHfFfSgmABIU6E0Zj3KKAtiVzrHX7cwxZdlwiWVWsxiQcnA jPh0fRYO5JecSWfsz+jkVHmIGOQff6qz5LbewGcyf95pTEkWprvVL5cPcHfR1Ppw5W65 BA6Uuk9YlPhOYkhmQCmi7G4joGL52zFXeqYFToSizsXmL5Vto9ANTzW61YeJqaoAYbox wasw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qRn8xLe9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w5-20020a67b105000000b003d0a4114a48si81126vsl.198.2023.01.23.06.33.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:33:56 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qRn8xLe9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Trace bitbang state machine changes with trace events. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé 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" //#define DEBUG_BITBANG_I2C @@ -26,15 +27,41 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0) #define DPRINTF(fmt, ...) do {} while(0) #endif +/* bitbang_i2c_state enum to name */ +static const char * const sname[] = { +#define NAME(e) [e] = stringify(e) + NAME(STOPPED), + [SENDING_BIT7] = "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] = "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 = state; } static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) { - DPRINTF("STOP\n"); if (i2c->current_addr >= 0) i2c_end_transfer(i2c->bus); i2c->current_addr = -1; @@ -73,7 +100,6 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level) return bitbang_i2c_nop(i2c); } if (level == 0) { - DPRINTF("START\n"); /* START condition. */ bitbang_i2c_set_state(i2c, SENDING_BIT7); i2c->current_addr = -1; @@ -122,7 +148,6 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, 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 line, int level) case SENDING_ACK: if (data != 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. +# bitbang_i2c.c +bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s" + # core.c i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x)" From patchwork Mon Jan 23 13:35:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645563 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2203173pvb; Mon, 23 Jan 2023 06:09:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuKp0CuYbJrdyhTXjf7pcCD3WaQMRT7jDp5eYXqCKOD5/MW+M2DZIsmBp1Z30ot/ifFL/r3 X-Received: by 2002:ac8:5a95:0:b0:3b6:2f0d:1924 with SMTP id c21-20020ac85a95000000b003b62f0d1924mr47360265qtc.32.1674482948639; Mon, 23 Jan 2023 06:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674482948; cv=none; d=google.com; s=arc-20160816; b=M0ISOAXsNfYGHqY+LUnbAPIapr+gytZGsYBswIT0cSJx87Ws+2Z4u+9Gn+lkAe/Sv7 8AKZeIjCozCoQxpMlqP3r5g4pb4eV+cMjEkg3sz+kKXi0RvDcWqhEmwDSpX1QZAkVtpi PUkh241B341zTuCjQ2Scy99GgD3KnrSs1RXt/D1Oo0JdVAkGwXkWVZi0CAHBIviNNqYw ElkVEjduFk4m9V990JEOyhSHETCGaBewlNtTwjA/rr5yn3ypUF5CisJBiKB4+++1lxOA 0W1xiilv4J70bc5lO0ONbitYHpfRuzay7INPeXYB32GGx5a8kPzHFqr7eZYCy4Ur2F6S zKnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ajiuKuxh7mBml7IbKxk3IiOiyKWtjxLpWptuFD5vSqA=; b=xgvF2TFfEmPo/246UInUuxdvS+wAYeigQRnFP+hghOgb+QnTZxmEWaS/aaVyRByevp QdTzLIbFdNCbGuZFf3qdpAqbw+iQ8Arnc2reXN2p9FEUzPreIm1+KTRmnd+EhT1fVnTf 77qv/7ROJmPzNOdn9VD7o4W2mywY81BreGM1aLeJxhs/Ojm0yLUiOlgcf93ST2lO9cwT Ibr330oSSiDv1qyxcvamKtTlnT1EL47i2cH/7PVt+znCG2Vm52TRl7Uz3y0VQffruZFn PMxckoIBu51+7N0pwEo84U2QTQictJv3mWTX6mAZDPkfIaNUsr48pIH2WeU5WZdGaZLW 1JNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iIvtyJ0Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fd15-20020a05622a4d0f00b003ae0db1185asi28332630qtb.686.2023.01.23.06.09.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:09:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iIvtyJ0Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Convert the remaining DPRINTF debug macro uses to tracepoints. Signed-off-by: Philippe Mathieu-Daudé 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" -//#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 /* bitbang_i2c_state enum to name */ static const char * const sname[] = { @@ -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 = level; - //DPRINTF("%d %d %d\n", i2c->last_clock, i2c->last_data, i2c->device_out); + return level & i2c->last_data; } @@ -137,11 +131,11 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level) if (i2c->current_addr < 0) { i2c->current_addr = i2c->buffer; - DPRINTF("Address 0x%02x\n", i2c->current_addr); + trace_bitbang_i2c_addr(i2c->current_addr); ret = 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 = i2c_send(i2c->bus, i2c->buffer); } if (ret) { @@ -161,7 +155,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level) } case RECEIVING_BIT7: i2c->buffer = 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 = 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 @@ # 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 new_out) "dat %u clk %u out %u -> %u" # core.c From patchwork Mon Jan 23 13:35:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645562 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2202997pvb; Mon, 23 Jan 2023 06:08:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXsGbJ+fIxsEA96fmg8U3tf2LmflmRc94dQhzSgboH8QpPOjbhnQACcUQNT63iJTy8+OUdcY X-Received: by 2002:a5b:883:0:b0:7d1:d26b:7eaa with SMTP id e3-20020a5b0883000000b007d1d26b7eaamr17943769ybq.39.1674482928741; Mon, 23 Jan 2023 06:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674482928; cv=none; d=google.com; s=arc-20160816; b=wUQJdgS/ukhsVtBI1BD8fL46zxUCso5VV8GvOnS/P5qNedi2Lemg5+QebI97VCDQrl KCbDiTw+KA9z92hfu4zsZZZZQy6I4vdg2aNX100EKp8BaNmGelqdp4Y9rkPNOl0Mtceq PGS/f9zGg4GvSDi52z6yYwY03uSPbWI2+9JXCUyUflFdvpe0uEpaQLJNcxyAAboV/Uy+ s/eTEsweWLgMBIVLy8vGU/kVBhYUR3I1RIKqwBI1I+ETcTzZvGtlAwYRinYHkgQ6mR4p txSc9ZM6PvF49yt5QnJO8n+SaAYNmCXEoJBNu+Tl2LP2Eyaava4x/q95A/LvcwVXWaB4 Rekg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wkC9VodrEkubPHoJig8p7hlAtgaFbvzuu8bhIKhFiNs=; b=vK9E0LqjaNVGj4wDSfk3ShQ0Qpne4t+ZBbrUdIssXqC5YJg/FHkIXSe6Gt5Ofew3rc 7Xh9tAqE4kLqEo/Mcx0mxv+L+azBfgWj31Z49tSjoNLfArCeUDAVPRIcpG9I1Flv3RPz P3RZHAW55eCSsSzb/pMSOIP9DfChCxD/PKdzQ/nOgptVgN8++ORdl9ckPK375EHA5CmJ BeL1tboYfdJDupgtw8D+cJaRe94NSiyORDxHkxyKqFuNFphNKU2Keh+2t21fQyTppZ3C eiQ/ykxVX/K4Oge7kj2N3uvDSS1kAgWYzVcbM8EtM9sNq038mMhMkaEuNqReXptno6v7 WCjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rr22wxB8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b12-20020a05620a04ec00b0070683c2251fsi12419362qkh.85.2023.01.23.06.08.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:08:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rr22wxB8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé 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 = (VersatileI2CState *)opaque; + VersatileI2CState *s = opaque; switch (offset) { case A_CONTROL_SET: @@ -60,7 +60,7 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, static void versatile_i2c_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { - VersatileI2CState *s = (VersatileI2CState *)opaque; + VersatileI2CState *s = opaque; switch (offset) { case A_CONTROL_SET: From patchwork Mon Jan 23 13:35:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645557 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186628pvb; Mon, 23 Jan 2023 05:37:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXtWX0Ea6BzIJbeJigh8nC7U+6dEyl9NokBfcSdnqO6qxh35UBjXoSJdiZk/SA32WTOmwNF+ X-Received: by 2002:a67:d014:0:b0:3d0:f1de:6606 with SMTP id r20-20020a67d014000000b003d0f1de6606mr11599392vsi.21.1674481064668; Mon, 23 Jan 2023 05:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481064; cv=none; d=google.com; s=arc-20160816; b=QREZgngdvJQ+aTB0z6ub2VQb4tnrxcXVVG5jeLtPi2rdtsYcOpPU6Ji8BWzBf2yNBA LdPMFNFPND4GwPL261Jn8U/HVO6CUL7fmBBPmt3EnPZSCZl/bp/zl64h4nSIRpGEAYZz LKzctRB9Kbcsh37IfqfGpOf6XTVQ6l+pAV0Cy0z6OhahaUinuBOu+sFtnXncqWTw582G VePva3ZDXgfPqPgEEGf+bPndjc4AhEvz/C0EqoWsFpBe24quJIDmH9cfx4iX9kWNzzmz XsaOpqS3gjG4rEs65q/HFua7WPKo83fIR0IkfHfMlYGOux8DeFJfSrak7lmj3LhqU9Hu cEJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ea17f0Na5Eii5BWvhP8T/nWUNUn1BNxyDUvea71J5gg=; b=rXVIcWCE2cAF5Gku9R02XHZdK9E7RMgc0JyBsdm6AkZC2MI6oFYd9bt4zJMEOVpLot KrCIhLlR8xL7IKq/p1DvdToUOV/LkVrqliIKCZOa6R627QXlQz9egzGkaM+pgafQbh+j 7Q14NycNgF8bxs4WJF+bwq4FawU/V8h5okb1/Vaoh6e3U9JFKl5J3RM7GDfsBYMriZxT P769QWQadn866PkBf7uHY8HtLiRid/cU9e+GgvRYNkuPgYoZ47/8GOlE2lj2U8a7RBU3 Zy+LPZPiNTEADdkUugKV7BYoxcm+KZhKRAcH00OFfXoOdMwIyZAF0SjWuOdk9fMjLqEe Iz5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UH97Ge+k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bq34-20020a05620a46a200b006f5f43caac6si12530688qkb.176.2023.01.23.05.37.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:37:44 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UH97Ge+k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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 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_I2C) 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" typedef ArmSbconI2CState VersatileI2CState; -DECLARE_INSTANCE_CHECKER(VersatileI2CState, VERSATILE_I2C, +DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, VERSATILE_I2C, TYPE_VERSATILE_I2C) @@ -45,7 +45,7 @@ REG32(CONTROL_CLR, 4) static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, unsigned size) { - VersatileI2CState *s = opaque; + ArmSbconI2CState *s = opaque; switch (offset) { case A_CONTROL_SET: @@ -60,7 +60,7 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, static void versatile_i2c_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { - VersatileI2CState *s = opaque; + ArmSbconI2CState *s = opaque; switch (offset) { case A_CONTROL_SET: @@ -86,7 +86,7 @@ static const MemoryRegionOps versatile_i2c_ops = { static void versatile_i2c_init(Object *obj) { DeviceState *dev = DEVICE(obj); - VersatileI2CState *s = VERSATILE_I2C(obj); + ArmSbconI2CState *s = VERSATILE_I2C(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); I2CBus *bus; @@ -100,7 +100,7 @@ static void versatile_i2c_init(Object *obj) static const TypeInfo versatile_i2c_info = { .name = TYPE_VERSATILE_I2C, .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(VersatileI2CState), + .instance_size = sizeof(ArmSbconI2CState), .instance_init = versatile_i2c_init, }; From patchwork Mon Jan 23 13:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645567 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2216659pvb; Mon, 23 Jan 2023 06:33:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmCas4V/ZGuV/27+pgxUvKV8lt8EHRxEbINWd3IS/P0Bzd08LWhsbp6Np8PcqzR7eApjwY X-Received: by 2002:a05:6102:304f:b0:3d3:e24b:fdb6 with SMTP id w15-20020a056102304f00b003d3e24bfdb6mr19275155vsa.0.1674484419919; Mon, 23 Jan 2023 06:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674484419; cv=none; d=google.com; s=arc-20160816; b=QqEojUyhfe50cp+1fnRGEyEIzmUnmsIPDR7IAju/M7N69jS7IOnTU+kyRr4MmpmK1X WCqzMMo17Zwey6x7/wgAnRR6xJ/CheC8kivlwj/fU90gNL7dn83PY+CQaI7Yn/eisKlf j7OV2sE41VcgYVhZWUAC1cEV0IqLvq7YzcAzPLbfWBQon8HOuGsx3HKxO73sPxzOhWYo e5g7COfDU1orXelA8fi3jb70mQQy7Jmgo/wbQ6IejQwxMDb1b8F05tPDttTNFeo1WmPW oGoqd6ScgSr1RRgOULL8DwTS59jGSqpfl+wmCsuioBrn7M5I1TV+Ml36B/mB7C5uUUtg E+Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=n+Z4F18ikzEKW2fIzsVDR9UWsk1P14NLzyqF4zsWzHQ=; b=wKL78dp8BNjoES/hA/dbmlRsabASDoSDsA8sxQ14IWXRLAlYIVB+BYsnvjjFLLh9GZ zpxt9vTxGEtAFJzFNaH1yHuwTJhbo2DEuUau0R6VClLkXrFs3OKgcXLFzR51eJldyUFj xAXdvsnnIsHanDxYDgS0vHUFb835w3NqkVmTrI5CZlGSwYn2gOUT32ZObeDv1md35FMB MJ7FXPDilqeQUxEKJ3cb35Bt1xXX/EC0xt+hTrO0BcjpTMUnpyj2Fieof1g9rV0u+2mO JV4FcuT2qdYtbb8602VeSm69lR1GDdKDlqgdcbtlvnQMFwSjY0TI9kOkV1s++5vcwnNc H76Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NPIqZLfb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v190-20020a6761c7000000b003d0fd34d1aasi8258778vsb.586.2023.01.23.06.33.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:33:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NPIqZLfb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé 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" -#define TYPE_VERSATILE_I2C "versatile_i2c" -#define TYPE_ARM_SBCON_I2C TYPE_VERSATILE_I2C +#define TYPE_ARM_SBCON_I2C "versatile_i2c" typedef struct ArmSbconI2CState ArmSbconI2CState; DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, ARM_SBCON_I2C, TYPE_ARM_SBCON_I2C) 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, } } - dev = sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); + dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL); i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "ds1338", 0x68); 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 board_id) /* Add PL031 Real Time Clock. */ sysbus_create_simple("pl031", 0x101e8000, pic[10]); - dev = sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); + dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL); i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "ds1338", 0x68); 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]); - dev = sysbus_create_simple(TYPE_VERSATILE_I2C, map[VE_SERIALDVI], NULL); + dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, map[VE_SERIALDVI], NULL); i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "sii9022", 0x39); 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 @@ typedef ArmSbconI2CState VersatileI2CState; DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, VERSATILE_I2C, - TYPE_VERSATILE_I2C) + TYPE_ARM_SBCON_I2C) @@ -98,7 +98,7 @@ static void versatile_i2c_init(Object *obj) } static const TypeInfo versatile_i2c_info = { - .name = TYPE_VERSATILE_I2C, + .name = TYPE_ARM_SBCON_I2C, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(ArmSbconI2CState), .instance_init = versatile_i2c_init, From patchwork Mon Jan 23 13:35:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645569 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2220808pvb; Mon, 23 Jan 2023 06:42:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXt2EhngUbWblfblDIiKRdyzBYvytDrxSwZNSW8otEluIWAZBsnt3pxjZRh0amnLQ+Mmx6in X-Received: by 2002:ac8:4914:0:b0:3b6:3acb:7f70 with SMTP id e20-20020ac84914000000b003b63acb7f70mr36748991qtq.61.1674484963684; Mon, 23 Jan 2023 06:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674484963; cv=none; d=google.com; s=arc-20160816; b=p3qASHFTymLG8Ei2nM8LTA8imyIFnepLVKpsU3bFr/4ma/ltmr6a0NKXW/rjaUYShN K5CnwNA+FS9ccv8NprO3khNqOq05fXFVpNsju4eRmgLL3MSpccrKUdXlguNZjz2L+o78 5rXuwA7SsfHjU/Htt1wJXrokkVte13C3kpwHNpdFVP0cf7Vtar1gmpvmKDtCQCbGdUZF FLxio6HWQm9Fr2EO5r08VFZq6LuBhAyUiFy6FtBH7W/OXaVIsA4s8cJOIlQnAZpbndMV 4jWw/XWC4fTMfiW7CxTh9dckzkkaA01QqaTbljz8w2kn2hshKUujw+QgtS6B2nrWxF25 Rwyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1+71eOJG8GsVCLoNEVtR5oknFA2XfD2q/R1m6fbM4mk=; b=kBFq/PPy/1Jr1kmvI+pUDgRtXJpbLWMGJCIJ+QocaKjOFzPRwf8nWfvJi7tE8rD55J OP6QcrY4xeeqdW87G3H9ep1dkaXHUoUkgjYB96IUCSYxgBHttZROqVmreU2is4KjQVXM hTtlVtlEK10PaymNWGGW256elLT4ZmzNsP/vR9CZd1B616kCSvlzmxha75hbx5sja8r1 9vcJ3MIO4iB37+zlfPR665trwna0YTT4y8/iG1UuWDhNtygdNXV1GGbu0NfdIL1T/n9W ncut5GXmSoblTSWbXkcDe6RFDSY4mI6RpmA+ZvjnsOt8mqHEhQBuc91EqV1yR81wHAvN Q3Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BfeyaEPI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b13-20020ac844cd000000b003b63ed20e10si12199305qto.52.2023.01.23.06.42.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:42:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BfeyaEPI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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" -typedef ArmSbconI2CState VersatileI2CState; -DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, VERSATILE_I2C, - TYPE_ARM_SBCON_I2C) - - REG32(CONTROL_GET, 0) REG32(CONTROL_SET, 0) @@ -86,7 +81,7 @@ static const MemoryRegionOps versatile_i2c_ops = { static void versatile_i2c_init(Object *obj) { DeviceState *dev = DEVICE(obj); - ArmSbconI2CState *s = VERSATILE_I2C(obj); + ArmSbconI2CState *s = ARM_SBCON_I2C(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); I2CBus *bus; From patchwork Mon Jan 23 13:35:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645566 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2213706pvb; Mon, 23 Jan 2023 06:28:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1u20oYQVZWjnBGxp+pJEb0gLDbD1cpgJMrOhNNWljwWUTPoSty++KjK0GDQ4CBRzbC7Ws X-Received: by 2002:a0c:eb43:0:b0:534:9def:9a39 with SMTP id c3-20020a0ceb43000000b005349def9a39mr36873142qvq.36.1674484093099; Mon, 23 Jan 2023 06:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674484093; cv=none; d=google.com; s=arc-20160816; b=SNbbumOkTIQENYEfMv/c1RsvRT1IDsgSdGVoO0Vk2Mbzrl6/U7ktqGR3qqwJSBSXZn hNHcAwm8JUJlBDesXlqgtcnninKLO4O8HknHQlkvRD3X8goYKUGwA2tJMnfNhbM4ebc/ r/Tin+J4LLK0dZxO0pFUt7Yh6OUQFADQ5Bt+l2lC0s2P9QJLfGKSDO+hOKtBnqlyFoDf EE3OfMs24qHD+9Ez+Bx/iWUyvBBxgN/3anS/UmQdKElMHxENdmHIBrHvIf8jUcJuIGLs EFW0i1TdgVRkjl0LLfrci7k30QT5JPZWpzVNz37jEbyl4QvXtQGFbXld6i9PrI/TLa1z hKEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+Nl5qo/slZRtjVNjxVllWsAsU0f66RVRp0rLB7RBFmo=; b=l9j9CYRsoomK/tPRNj7SoHNxex/OV3UsCiGDPj4m9+z94Z8faqqBaATQW972GNzT21 kRtlhi60wUllFNP1tCf9ozKHBnGdjOO6TwYq+hOT5J/vnj6wJLb67yZs7X92kkIgsImH fFFLintc78eIURL099p4S3s9jvlLJIyIhySvQKicDxTbbzFIkKsqvXVYHlDN/D2oOGeC YLJecIlgYcBnH6W4jloUKKRvAUrxtlgxpQ1PUfTbSZcpDd3UL4OJM2XbuZzDbsPaVw3+ M6zfeurrTiAmZI59+/f4Kjxm4tO5rHIHXitwcdHBpBx2VZD3VNP8jmqoSUp5sASAdE2f aT/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gnzg3txi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m12-20020ad45dcc000000b00531a8fb2736si13368161qvh.321.2023.01.23.06.28.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:28:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gnzg3txi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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/two-wire-serial-bus-interface--sbcon Use the latter name as a better description. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20230110082508.24038-6-philmd@linaro.org Signed-off-by: Peter Maydell --- MAINTAINERS | 1 + hw/i2c/{versatile_i2c.c => 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 => 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) -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 = opaque; @@ -52,7 +52,7 @@ static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, } } -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 = opaque; @@ -72,13 +72,13 @@ static void versatile_i2c_write(void *opaque, hwaddr offset, s->in = bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & SDA) != 0); } -static const MemoryRegionOps versatile_i2c_ops = { - .read = versatile_i2c_read, - .write = versatile_i2c_write, +static const MemoryRegionOps arm_sbcon_i2c_ops = { + .read = arm_sbcon_i2c_read, + .write = arm_sbcon_i2c_write, .endianness = DEVICE_NATIVE_ENDIAN, }; -static void versatile_i2c_init(Object *obj) +static void arm_sbcon_i2c_init(Object *obj) { DeviceState *dev = DEVICE(obj); ArmSbconI2CState *s = ARM_SBCON_I2C(obj); @@ -87,21 +87,21 @@ static void versatile_i2c_init(Object *obj) bus = 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); } -static const TypeInfo versatile_i2c_info = { +static const TypeInfo arm_sbcon_i2c_info = { .name = TYPE_ARM_SBCON_I2C, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(ArmSbconI2CState), - .instance_init = versatile_i2c_init, + .instance_init = arm_sbcon_i2c_init, }; -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); } -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 @@ -481,7 +481,7 @@ config MPS2 select SPLIT_IRQ select UNIMP select CMSDK_APB_WATCHDOG - select VERSATILE_I2C + select ARM_SBCON_I2C 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 -config VERSATILE_I2C +config ARM_SBCON_I2C bool select BITBANG_I2C 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')) From patchwork Mon Jan 23 13:35:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645553 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186384pvb; Mon, 23 Jan 2023 05:37:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXIUXgS8EJmhg1aHUHNwHdFnhRoLWQNNTyGsUB29iIMSoNXNVddyhg/8TqdOMADK9kFM3W X-Received: by 2002:a05:6214:32f:b0:532:299d:99c9 with SMTP id j15-20020a056214032f00b00532299d99c9mr32730453qvu.1.1674481035066; Mon, 23 Jan 2023 05:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481035; cv=none; d=google.com; s=arc-20160816; b=qgqal2J872ZytK94l/euKhPdDzuTznak2IrdqSV3+eGq1xs11F9seh/8+vF5krjikP Mujf0y4VqmOzYXyk+XcWiVXIGvkZLOQKt6SdO5jkamvy4f89DVnvnqO/YipB95TNUgAc sxMy6xx3vMNjfImU4yeX6cYSnKPFsp7S+ZRbzujvmxsZq5fnK0ZR63Ece3SqhJJpdGvn szOFyD1rpOuTsBhGkegtiR0ZqV2wlPd4z8IIV25tVnleWH4oLoJSxdo9uELfdi4YeRH2 ceI4Gbyo8JNHOsTAtX6twG/4th2X+aiMgOQZz+zOXi/Ge26ObQPTAhYP2DOA36oCcA/H F10A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vZk1C88uw/inCNfkrhOVPoUDXVTmPwNQrJRmUIYnoUY=; b=G/zkSzSi/fC+t8OnWECMh0LV6GVJ5VAqsYzwoIAMmP/BJ5VG2P8w/5QAW1G+bia9FL U0LpBFTwKBNJ/1qFenZX5uLV+grz3aA0yitIxOfcsdFtC4BvVXE0NgfxjZeMLxLZifWQ 8l7ngRgxGdbvx5oSZlYGBIkJ37XazB62ItGrVdhI/TWNDUzeIjEKBpa1F3Lk3MaiNoI5 hcjQgd8pMmwK3xsGDlZe8IUxCOKYf0/VLNHgdmNYR6DgR9CN+7t1jWCUcRdi5XDKAwmH ijtUVW6aGoWKQpKTdA0rmk23Y6o1nLdNf+PBbKhHlCLJ7f3bIV9cXk7ppFn1gS+mDqXg KcRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DptZjk2e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id og12-20020a056214428c00b00531c58053cfsi2081355qvb.253.2023.01.23.05.37.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:37:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DptZjk2e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé 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é 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 = crm & 1; - bool changed = false; + int old = s->pstate_sm | (s->pstate_za << 1); + int new = (crm & 1) * 3; + int msk = (crm >> 1) & 3; - if ((crm & 2) && i != s->pstate_sm) { - gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); - changed = true; - } - if ((crm & 4) && i != s->pstate_za) { - gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); - changed = true; - } - if (changed) { + if ((old ^ new) & msk) { + /* At least one bit changes. */ + bool i = crm & 1; + + if ((crm & 2) && i != s->pstate_sm) { + gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); + } + if ((crm & 4) && i != s->pstate_za) { + gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); + } gen_rebuild_hflags(s); } else { s->base.is_jmp = DISAS_NEXT; From patchwork Mon Jan 23 13:35:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645555 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186527pvb; Mon, 23 Jan 2023 05:37:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFHwjqN1FBI2CJNEdyf2Fi0a5U0aft2iREgGueog0R3LeYxxJnroq3wHMaZSrdIbWw5c92 X-Received: by 2002:a05:6102:150b:b0:3d3:c608:d5f9 with SMTP id f11-20020a056102150b00b003d3c608d5f9mr17435849vsv.23.1674481053394; Mon, 23 Jan 2023 05:37:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481053; cv=none; d=google.com; s=arc-20160816; b=U37eyWCLDo0qGbBsXVAmkJrAeV+BjecOwuHXizs9/po/OMfQCbJtBgR6bfM84gTyVl AT1O6Q+K1Ofs4Z2EC6Q7dyVnfupABsS+Rqj3MdBY924rSNwUoqlG718gnb0C1A45CdSa COrbbssrBav8m+eEbpe6tdYh6cjurWWJb04rLk7OnnJVFQHjmXPIH4RzukDyxOMzdHpe C5WYFLEhs4rQvlgklGHE0mcCKYxM0m1ckKYTOLcMjZeDLgZP9x9LRW1laC77NFLdynbb ELCQG7rYdTd0NajfpHx1nocUpOM36iBmqKZroY4ekyzbbnehd03+QQIIx6iydR9BQCNB I6Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=O2uCOr2ehr+mt4R5d82Y/g2mqNmQH9GBB29ghk2KeoQ=; b=0xy2XdMuXCmKhEVrNA0HHa/JHiT9+ggZxtzawWPZnN25AmCNs3uf6jZJepUdbd70Ar mYkdO/h1lCJKoX4JI1lM7u4KsHDcz9s14i8DETxopT7r9p4g9BabRG6jMJm3TV9kbHLu YJKxm6RQATcvZzkPczxTzjPAD2nqZtNQ/VRc1hLW7nX3TL6OPlDcCODwxV9xVKtIyN/R azhWHWEnGshyy4hFIDjgcorJg/fZ4hHLbVhX2wOaoxlNR/BDTa9A1dVylDdogLJCPSNl XJnTivZd/kkwVfdxpQqcfUDHIy/HJQTGmamfgmPDrWXpSnsKdh8/8OOwPn3k7uKz6Dwx g2hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eLT9RpJH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bn42-20020a05620a2aea00b00706a08d2316si11802717qkb.558.2023.01.23.05.37.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:37:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eLT9RpJH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé 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é 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 ^= R_SVCR_SM_MASK; arm_reset_sve_state(env); + arm_rebuild_hflags(env); } 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); } 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 insn, if ((crm & 4) && i != s->pstate_za) { gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); } - gen_rebuild_hflags(s); } else { s->base.is_jmp = DISAS_NEXT; } From patchwork Mon Jan 23 13:35:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645552 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186319pvb; Mon, 23 Jan 2023 05:37:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXsfvjb6n/m++iLNw45zjMrM9Q4JJAubXxdYMog72lm1sVI2NCxcdFIns2v9qv/qc1hMF3/l X-Received: by 2002:a05:6214:3389:b0:531:7d95:bb7 with SMTP id mv9-20020a056214338900b005317d950bb7mr33903761qvb.8.1674481025889; Mon, 23 Jan 2023 05:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481025; cv=none; d=google.com; s=arc-20160816; b=SoTA4/FRzHranSiHEgVzrlyXPi6VxJ3uQCVTImmJoVyDlKb4w0RCzlmyZaIbQ/GeKq 3jzCa2G1gu4Jdk3EMC7V9/yZWHuUiJ+NaPetSO1I5QPSrZJTO8jQRLEOfMrDlzZT8qFL yO6E8uioUwmK/yi6WwI8gL1ZoJJcF9r3KP4gxHLEBMsTK+s4YI9AQQR9gsgUkkZqgXYB qNJForIrjJt6KsXuOxN02RF62XOtKy20EznKZHQbq/Sxa7dNEyUHa2+rXtfhfB0QGyG9 3JTwVp34Y1gb16Bij0Y5VLuji9gw53ilL1IIk09R4jWAW6RrJ1SJbtrJNhZZKCYkzOus xGMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=IeF7jJTB/G2ZdwYbP4k411cz0vGAuT9uWrSxSGjM9fc=; b=DOKWb9TkVveu805kxgZTu3ishWjXqV/v2/DAUBBieCq5XNdXE+1lKWltW6hUWgkm8O 94vXEA/vkWNUb1Dd2kYcwH/gQLRSF7qEBAoZzdy+yBCe6aXWxU32D7q6fKlopGKgK2qj uIyDy1s3rYopBaVG1Y33GHwZS5pMyr+DwVswu/L1KmYg/p59Lusv8yCf+dthiWFzM8um beJ9hHA5r3TB1wDdQyi0AeXC/AZFgMTaz+KleeLctY7bcs2DwUe7UBjNaC/9M6hrO+ko gOHSuylp09WGmuLR1ku7UKyyXTITChg9PonBwhCrd+zfP/WHLs9y5ZRkMnOUX3JcOUev GVLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zfCG6HNr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o10-20020a0562140e4a00b004c6d97073f1si9012719qvc.229.2023.01.23.05.37.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:37:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zfCG6HNr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé 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é 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, uint8_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); /* 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 matrix. * 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 = 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 target_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 = 0; arm_rebuild_hflags(env); } 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; } +void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) +{ + uint64_t change = (env->svcr ^ new) & mask; + + env->svcr ^= 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); } 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 == FIELD_EX64(env->svcr, SVCR, SM)) { return; } - env->svcr ^= 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 == FIELD_EX64(env->svcr, SVCR, ZA)) { return; } - env->svcr ^= R_SVCR_ZA_MASK; + aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); /* * ResetSMEState. From patchwork Mon Jan 23 13:35:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645558 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186776pvb; Mon, 23 Jan 2023 05:38:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXsywQAP5VQJf5s1qV7e54OoyEzqFtf0CK6f4iOjblKMIC6q9fwI2cwHZHeIaYdcRbMvp2hR X-Received: by 2002:a05:6102:304f:b0:3d3:e24b:fdb6 with SMTP id w15-20020a056102304f00b003d3e24bfdb6mr19087286vsa.0.1674481084756; Mon, 23 Jan 2023 05:38:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481084; cv=none; d=google.com; s=arc-20160816; b=lzekTsyr9EOPoX6/PzHsssH1mbejYoblHYnRyDbCtwN1CQoOu6YtDxdFPahtxuIKYd hT1yC4VNlS04mUH4cPtRt7kKaLsEpQKghEApyMhtn/x/JN0GpG6FKUVC3d8WduhJBRfK tTdh1H3ZMXQUwMJVlh/NhjzRdr39Pg/VhXphkMMCGHWQxSsd7Q6PRIlNGE4oLvdNq1Dm lEOSGgKilc4vNQkh2bhTUmS2nGF0s0JEfPjS1R9duUkvEayATWLaORfOikkWW1Altsas HG5XBZ/BCYH+lLZjSbFE8aZYSebbv7vZz8Oyg8A8/CeDKfVZVRAhqx+oXVdUq/gYUWhs XCiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ClfwKQfwQPNiuEhLu9/OoLk23WFzZiEhdIdZyE3JTl4=; b=dqlS5iYqUdG7NT5etlX3MTwB2zgGiaMHgYL4pgHHPytjqmgOPc7C+su+vBjKcDconH 5VNsynwWjsZBZ6d7qXP5L4bc+z7mgxQLCqx3r1f9WU8w5bbBb5iFJLL5VspHvTlos7tF rhZGL4AzxrgrXTt0Qf7gcRQ+IMvI9qLDrrxBcLv+b7obbn9C2nwO7zmbzCIeES0+gBkN MwFH4VfqJh4hLO/Mkhejx1XN3eyvnx41u+E1nrDecuZyv14kP8iFTv29F/lvCc5HG/Dl DNaHq70ZUoPjNnXcI8G3W7nYLK4r8F+OF8yu/t6xD1hc7Djuc0rkB08SYJm5rZ3NJ+ZL JDuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zMXytApl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s15-20020a05620a254f00b006fcb2fbc4f4si31144234qko.4.2023.01.23.05.38.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:38:04 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zMXytApl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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é 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); /* * SVE registers are encoded in KVM's memory in an endianness-invariant format. 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 = 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 = 2; } - /* - * 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; } +/* 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 = (env->svcr ^ new) & mask; env->svcr ^= change; + + if (change & R_SVCR_SM_MASK) { + arm_reset_sve_state(env); + } } 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" -/* 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 == 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); } From patchwork Mon Jan 23 13:35:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645572 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2228006pvb; Mon, 23 Jan 2023 06:59:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXsz1KQopz3y8cOj56HPn8zKMCL3dR4xsND7wy0lHuYSaSCkLoQl/i8zR5xJaQ2e5ydoJ2ok X-Received: by 2002:ac8:5053:0:b0:3b6:3577:2fe7 with SMTP id h19-20020ac85053000000b003b635772fe7mr32031884qtm.49.1674485959332; Mon, 23 Jan 2023 06:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674485959; cv=none; d=google.com; s=arc-20160816; b=QZ2mhdj5r1PXVih2YeueIni5lvTH/ArOeFi5EsiNMW5NGzX1sAg308sS/7RFd7+B23 G896px9Bq0NHTM8s7qbQ6E+lLcJaXRcDpNYZdJGNITR5ZM4UpT/YQdgdA4zkPXz6aJR/ prkaKbFkOrjynC15cQh3UpC0lGfHFC2X0crjw0WeUO79O5g6adoAjHLVNG+mP7XoQrNT SfDFfUxWrunx1rU/KCqWwDqsRo7ADarrI+lRCk2SQV/odB7zKtflbCtdnNbUPMM2OGlE lZbwMQxku+/3qGEBERO5bOaOc8jCYarZ/ojnwe50T9Rx9dKkXGfmi+t0njLK1Sr/j1ys g7FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZXJTKTj4JLVkfDaqWL6JD9NCI4CqzwMFAUaoEHUCTnY=; b=MJM5qfU71VyxAnT6wJWAtdF3valhoyAGVpiBWgORICn0ZfDEySO37fxRwq35YrmfNe vhGvUECuy564X73WJWV/21dpogJ3wojBkim6JNkwQ7mXnl4JK3HGSLfFuPI77x3gzA4+ TZdzQ4a0uuS9RXHFSCTlKAUQjZqDpNZLRDRxw5vZYHvVMlWeYmajj0e5Dm+aLOOeobgr 2oevvwzmDEBKXdJ1qlIzJWZ87rh+FuFERP6w+wOXsTTNOlEO+fP8pX7xhDvIjBjjfwoN lYJuBxreQpqs/XZni2MQgHlIcdUEq3senIEOFs35E6+dtvCtGUNpj3pqBW3wQye/8Sta WiYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LCqb+Q3k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r16-20020ae9d610000000b00705dad47076si24796286qkk.144.2023.01.23.06.59.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:59:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LCqb+Q3k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé 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é 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)); + } } 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); } From patchwork Mon Jan 23 13:35:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645551 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186148pvb; Mon, 23 Jan 2023 05:36:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXvU/Cyynx6pG3jSVGcH7W+OqHsa9H/d8R9NEHDKeAHpJRSTKrDLCVblBK3EdkRebCws7nVP X-Received: by 2002:a05:6214:5cb:b0:532:1db4:405c with SMTP id t11-20020a05621405cb00b005321db4405cmr34364745qvz.34.1674481004934; Mon, 23 Jan 2023 05:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481004; cv=none; d=google.com; s=arc-20160816; b=EArWAHhm3C0hUiEi9oG5kCy1q/d74VO1SoN+nCZcDM2Nu6kVv3O+EJiIVT3tkBCxXl lgDA730Q0SnaLiIoKsCy9hwOoCyg5Y1fQ80rgnmyqnyifYzfsYT6m74dAC2VrWt+bIY8 bCvOkbafvTguXn4AxwVsQR90Lw0ZL+RHV0jSeXM3zqyUJIW7iwxDlNPqRBNFPCkDdonQ Qg8OHwizyxq+yUiaOZxKp0sdN5W5esr61FeTURVbgVFEB+FWFeaz8G+zVJKBavCZCEPU pGoKD7r0rkRfof2jMQV4VSaO7ONZxO3JwlQUH4g4uEtHDaLf6nednYrerl1ShQ20yRPi r41g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kMExk8W8eDEbzmTmN5tKGDb7IruksybidHcjv8e9z20=; b=dYTlOqoDdwGEOTTcgRkEyPo1JRRlavuWz8e/LqNvsm9FaYgrNB6HkJxTxyTkrKHnoX tsJrQhpj1UfkZmyOFbHKXC4WDbdEeM0CH0+KruE8CkzIP5oFQHlixD3WxKejhbpu6t2n ofCtkKxDWDhI0e79Ww8ZUEqd8C/0SRABgdXj9+WGGgosT4PVKTjYi+UW6kM2v93+jlR+ R2LpgMWJTeCpUV0llDnATVfDP/KZijJ6ZhOe6iIJLfIWrfM5F/jgsfuOfRLnsc6wK4im G6KgE0zLocH47f3CeEbfjNwvDXNMcQ+xBo2lE3B3aPlgBsZ2EEyFjNwrofdvqnWszmkb mNQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMbpEDtp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jv12-20020a05621429ec00b0053216c5b0dasi16659502qvb.92.2023.01.23.05.36.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:36:44 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMbpEDtp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé 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é 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) switch (trapnr) { case EXCP_SWI: - /* - * On syscall, PSTATE.ZA is preserved, along with the ZA matrix. - * 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 = 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, /* 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); - } 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 = (env->svcr ^ new) & mask; + if (change == 0) { + return; + } env->svcr ^= change; 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); } static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -6763,7 +6768,6 @@ static void svcr_write(CPUARMState *env, const ARMCPRegInfo *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); } 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 @@ void helper_set_pstate_sm(CPUARMState *env, uint32_t i) { - if (i == FIELD_EX64(env->svcr, SVCR, SM)) { - return; - } aarch64_set_svcr(env, 0, R_SVCR_SM_MASK); - arm_rebuild_hflags(env); } void helper_set_pstate_za(CPUARMState *env, uint32_t i) { - if (i == FIELD_EX64(env->svcr, SVCR, ZA)) { - return; - } aarch64_set_svcr(env, 0, R_SVCR_ZA_MASK); - arm_rebuild_hflags(env); } void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) From patchwork Mon Jan 23 13:35:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645561 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2198434pvb; Mon, 23 Jan 2023 06:02:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFI/ojtj+zurROiz+Fga3QUYv/ubqYYvn7dd7pzZ222EjnenRIvxfZkkWev1ijeROvuno+ X-Received: by 2002:a0c:f146:0:b0:535:5bae:6bf6 with SMTP id y6-20020a0cf146000000b005355bae6bf6mr25506144qvl.41.1674482562632; Mon, 23 Jan 2023 06:02:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674482562; cv=none; d=google.com; s=arc-20160816; b=TYvuEbfgHVBcGrx5klbLnbW0RVPdMSe34v2hcYXKzs7RU3GSjr1ZwDmCOb7DH5Jhga Z2KN0N3bFVWUJrMukx7UnIQSTct7djyghXsOd6lnIHFSIMvTAwe/sSLZb/gWSEHCqTFV hxbU8qh9ECSQqLgXxFRXsTXhkPW0NgBhSQXWT5ygG0D9lT9K3mL6C1lTE85g6SyvEWTa QFP1ybaOVc//xZLVmYLFUuzeZJtCr2Hmv9BgVYY+Hjs0BdJjonjSJMTZDFqDOOWgUqE/ oDZXen9Iqs5xH2WaY13IByxeY55jFPcOSy0Hyn3UsBnbL4JdHjZr3+XyS8Hu07bZtCqA kboA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=73fZODUVN+eHuckJW+3x93TAtbbakSn6uC4UQHq9gd4=; b=KfBoAKldWfesfIqCnXzAZtlqXf3b9WMOemtiPL+Yp3sO1Jh+k6x0ilR35pXIVnxn0E fi2Be2ab7Doyq1CEkBDMCL8BHbOodQ8XjdJwlvrnt4WTg31q6R/Mj06k0Ka7RAXwBOSM QEUDPPTL7jr6Jb94QV82uBWNAyu0kHJ6L8sxVfs0MrprPt4S/vKdffSkUMlqnbfxGyoe nEano79bT6aD4+nTNFAPqt5jibN5Xn0QDpwFntfs6GanBv3N0rGqzoGWZhLGjY7OVjjg rM6THoyQz8q+UdjZcwYbCSGWKwjTbSoA/O/uGIKzcHzTBJmVyA0KyDBYPF5v7815595F IthA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dj+KcwUs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k12-20020ad45bec000000b005318cf5172asi10196289qvc.520.2023.01.23.06.02.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:02:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dj+KcwUs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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é 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 . */ -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) DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32) 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); } 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" -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); } 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 insn, if ((old ^ new) & msk) { /* At least one bit changes. */ - bool i = crm & 1; - - if ((crm & 2) && i != s->pstate_sm) { - gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); - } - if ((crm & 4) && i != 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 = DISAS_NEXT; } From patchwork Mon Jan 23 13:35:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645570 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2221180pvb; Mon, 23 Jan 2023 06:43:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXtjmQCh1WfsctqhFFlH3C1jL2P2fTCgf8RZKZ5RUMuFnqreFvAAuEgJPMtUGkz0UQWFRpb6 X-Received: by 2002:ac8:6cb:0:b0:3a9:8cc6:d4b2 with SMTP id j11-20020ac806cb000000b003a98cc6d4b2mr60559901qth.5.1674485008566; Mon, 23 Jan 2023 06:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674485008; cv=none; d=google.com; s=arc-20160816; b=1IN613WWoJWoPKcXzm4hG2GzLWjaINosE3fxl2SbFL3OASl8EV3WW2dMogxn4ZJiVS i/3EdGLW5uVOSdQ1Kd5qOEY2kNWjudNbOXr5DQyS+GECalHwD/VzW2qs5cuiAqhrui6e rWZUvYIDpurlAUvgAG3AZ3sHegYJZjsNF1M4JjjN1aaSWBzYDU6i6y6WVrUJ2zACA8O6 SBRw7QfIkMdv/Ckl9VtW6VDTMA3B5sxNehH2p1w3gexQtwCd/kWXGz4DscQNvxzH6xmz jZGb+8U/E6MbGVsX95cay9mL6uOr0R8Pr4uVkGluJfnedV24PRCNHBRZZkUBxey7DlgH hAqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qLC1OizCVn68FH21GRDKjbsntWejSNUy0/YImu0bDg8=; b=rrtuXWP8R+MIenfGHTatiFtiZgGrNRPITXfPZbRDuup39Kz/FRISbKzkKBUtgsJajO Q7t5nZ5+8szYdKdLHAviFwhJg3z94XFN2IvYpSwZXEtxzdhzBA/cgeIahKcPpLoW0IaR Mz47gh6SDO1hWsRrh9Ms2Ox/rE3ScsJ+QajexaqnmXFfztYFEV1eWbooiF792Rv3bba4 1WYzIp+dYggdhitKoLXv5LcR7yaMCP/Kq01y1yjBRqQiU2zZlwyIAnkvSh2P1YMHSPOg 8t+7VNS+ChCj7X69laZxYXYG5FPa3hGA8SJpIOClR+2FstbZvLVFB1iWd+9EdmKW5Rdn rJmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VGZ7W03/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q18-20020ac84512000000b003b68fe36d95si8512346qtn.656.2023.01.23.06.43.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:43:28 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VGZ7W03/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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, int ptr_mmu_idx, * Remember these values across the second lookup below, * which may invalidate this pointer via tlb resize. */ - ptr_paddr = full->phys_addr; + ptr_paddr = full->phys_addr | (ptr & ~TARGET_PAGE_MASK); attrs = full->attrs; full = NULL; From patchwork Mon Jan 23 13:35:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645574 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2236489pvb; Mon, 23 Jan 2023 07:12:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXugfoDlncxuLwMuC5AqviKuznQeA6FERACg8yzwPuuilycgG2VKEZ4FABapKLFL/2SdwBCL X-Received: by 2002:ad4:5d6b:0:b0:536:85cf:a265 with SMTP id fn11-20020ad45d6b000000b0053685cfa265mr21352818qvb.14.1674486728418; Mon, 23 Jan 2023 07:12:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486728; cv=none; d=google.com; s=arc-20160816; b=lQW8cnojlb53NHwU8zCtLBoSqFx1PiZH4PeU4FxJ/vXDE29SBMvGnDdAfAbzBfb8I1 8Xk4qUv9kGWtSYllZ4ra0Sca4fqBRvzOfnXkKd5jO+ufEd8L8Vn6Wq5lMULWNyyc3uZV qrAfvp9zosMg2PWvU2rT58k2WndoBaTj+fSFKxE593MBHAh2RK/UebL7SrxJyvF+lrUT ENh9zdC4nKIcJG8/rQeEpMRh6+tKfGgz7q32gov4Ju58/UNcTD9V+PpjQlUuRNxny/7r WnXj/VJSG+6YRaHucSs8XhtpE9X1LrsLrxE58LHJVFxIIIHmS2MYLOFgl7quR+BkHnUW dRkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=t4bugJ+RO2MbQct6JNW9hnGo8RWEyhaawxl4hk6fSFE=; b=NXOBmsJt7Hj2yexM3bZSCsXdmoi8KajIpd3m9Akmzo7Zj9ITw28XPhWeeNhR61DdGC aKUZzgCDjsazWzgpx3CS1UQoI5BiICwIRJr0RHK1YrVzH+PX1r5DMDY4l0yfb/u4tUfx vMCku30L95VII75QrtEgE5sa45tzXh9yLqs+OqUWxeksyprrLnxqd2dwalTDWTtDs2VV 4ja8kpyNVkAa5WOZ3PQ0CVfmbj0H/+FnlgyIeYz4QaepAB2OTfUNWKUIiQHZh7neGRUw 4r5RxwFzR5/HS+cajKlyHGr6epqu8VEdxExjSFG494DOj9P1h8aHwwlMBW/ZXz+NP8W0 ks+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TxGjFB4l; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ke30-20020a056214301e00b005353ec9a265si10580809qvb.44.2023.01.23.07.12.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 07:12:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TxGjFB4l; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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, S1Translate *ptw, }; GetPhysAddrResult s2 = { }; - 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 = s2.f.phys_addr; From patchwork Mon Jan 23 13:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645576 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2237173pvb; Mon, 23 Jan 2023 07:13:21 -0800 (PST) X-Google-Smtp-Source: AK7set9Cg84SL8Fq3jDmixYn69cnrDRt1DKXGj1Wvg5Ym42ZopUCuSjTX0LQ68ZGwCQjFQ0h3Cbw X-Received: by 2002:a0c:fe92:0:b0:537:628a:b38f with SMTP id d18-20020a0cfe92000000b00537628ab38fmr962802qvs.31.1674486801688; Mon, 23 Jan 2023 07:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486801; cv=none; d=google.com; s=arc-20160816; b=Ca+LKKX99BIFivSBQWIxNZ5rihz6qHosx0u4gXI4Hzxbfzk4WLgBfaxx+CCXIscaKY irMVSgPXPEzC+Qzuud4w9+uFVRpFpNlo99Eta3sv//bAvOfFk/DHVda5N0vSIa8uumtp m4D8nrELC38V4jt4dn7k6wUGruCQchpYTmlVtYxAlrTl/A73lxbQmx3eg4H21aJF9DHn kxatYyHwt5oVGopAkcdjGqi9TJqNyBe4ZuHPkRooT2uqhp4g9gUeHwYv6DM76zTb/BJ/ ZbRn9h5k9Jg7Ly1GAPiNvisn4OU1RUXESSNE4Z7NVmXxr02yWxrkCUdCnwk9lYHmyxBf Agvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UKUCDtm5zNRWKAtz89l2k8txnv+LgwgNpjX50RbpUOg=; b=hYjcyjLO2hN5mtPDEv7el0vRS17BbR6h316goRoO97RuazJ7f0Y9zhpaa80Uw1WFTg InuYgxeonbKBI11sImGFEWGyxmIbxCYjQGrFTlxEJa3T98ckDEw6BD1QFq1vjGQO8ueJ RuVULzU7dNQ8pwGFPvEqXxvhBiPdJkLSzBmajrWO/AHB6o+mYaXq30NXIY6NyHlAqeak f/D/F2HlMAjH2SuQXs5XNkECMZKlJR3TX5Z15gQSLwe/QSJAjSX7PysNnuJZUQFdSRbh EfvUWtPiCjTfc8+fahXarNnwsm39iUlf0J1nnuevUPlW351oP69Q9eNovi3YXPoif8Li XkRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U5boNfvs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gh3-20020a05621429c300b0053555a1b5f7si8031884qvb.581.2023.01.23.07.13.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 07:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U5boNfvs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 lr, bool dotailchain, } lr &= ~R_V7M_EXCRET_ES_MASK; - if (targets_secure || !arm_feature(env, ARM_FEATURE_M_SECURITY)) { + if (targets_secure) { lr |= R_V7M_EXCRET_ES_MASK; } lr &= ~R_V7M_EXCRET_SPSEL_MASK; From patchwork Mon Jan 23 13:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645565 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2213581pvb; Mon, 23 Jan 2023 06:28:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXtGM/pdF47F/g+dLMFtGrizeasmOIE4PfVeH0n1KvKPb/64yvcbfEcI+bCH6GX9XsaH4mkf X-Received: by 2002:a05:6214:350f:b0:531:94d7:a41f with SMTP id nk15-20020a056214350f00b0053194d7a41fmr38668405qvb.43.1674484080384; Mon, 23 Jan 2023 06:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674484080; cv=none; d=google.com; s=arc-20160816; b=PhA6oK+alUF7sjyYK94Mo0oEMGZBMjkleWkqBakkQsAT++04BFfxn8KOsBStxlzLsf Lixkz2Xv4+MpAGWC1KUVXobkOc2kEANCbwAMOCqfCxRWLariCO9NbhzvD0H7fhDyf/p2 q8pXwt3qat5mBAqgvZZk/56bdkdxMm9ByxbaDsXntnnMiF7nrmKH10BJDeRg6LydGirl DW58f57jAyslv9aWJWzKQqvKiMsfOkDezCs+nkeZ3roeTxZRZYfCU1qWBNBxdMKiEnVB qLgcbqTVdUeLT4SSoNjVuFOoyhNiIshvrsKDVTtMyaMeuCWBdvqnpdjznKiKNyv9m+0Q D8SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=brguCCskR07IlO3tUdOSX78gsX0q+RbP7/3ek3OIEVI=; b=Am4ad1SP+Ig0oJnYe7BQj+3vpw0TFY1liPVRpdcEk8cX1TpZ7A1a712h6HPtTMwe7j uDoVGDcT+cwTFCBuczrhWyuoytAb1HJ/wZuM7w6jN8zrVUcik/K+FeJFxIBzD7oRcfQE HnghlpBKcqgdsoqqbZymyZM/pVwFAw0FIKfFhjNN0ENsOqA8asxlbkSUH4557KwQ9I3B IiBYEXaD7otxjWl42bSTHU8Mn2exab6iXmgv43hrkxOnlI6EsuIJohycQk1vPBGPlQ+g N1HwqREwOdGe/KZUNEBBnmUM3ZodJ7gDNFolUqe4sMC5rDV5+idIEdDxNtVguBDbFX2d 77jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oe00pt1Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n8-20020a0cfbc8000000b005374df629acsi4880212qvp.102.2023.01.23.06.28.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:28:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oe00pt1Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 ARMCPRegInfo *ri, } } +static void dbgclaimset_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + env->cp15.dbgclaim |= (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 &= ~(value & 0xFF); +} + static const ARMCPRegInfo debug_cp_reginfo[] = { /* * DBGDRAR, DBGDSAR: always RAZ since we don't implement memory mapped @@ -715,6 +733,21 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, .access = PL1_RW, .accessfn = access_tda, .type = ARM_CP_NOP }, + /* + * Dummy DBGCLAIM registers. + * "The architecture does not define any functionality for the CLAIM tag bits.", + * so we only keep the raw bits + */ + { .name = "DBGCLAIMSET_EL1", .state = ARM_CP_STATE_BOTH, + .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 6, + .type = ARM_CP_ALIAS, + .access = PL1_RW, .accessfn = access_tda, + .writefn = dbgclaimset_write, .readfn = dbgclaimset_read }, + { .name = "DBGCLAIMCLR_EL1", .state = ARM_CP_STATE_BOTH, + .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 6, + .access = PL1_RW, .accessfn = access_tda, + .writefn = dbgclaimclr_write, .raw_writefn = raw_write, + .fieldoffset = offsetof(CPUARMState, cp15.dbgclaim) }, }; static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { From patchwork Mon Jan 23 13:35:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645564 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2211259pvb; Mon, 23 Jan 2023 06:23:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvsYILYWpCyivwhq1sI6GC2DnXBsPrcw1BU0dzC4UBAUGOUAPcMPTKJ1xfAQjTkk6298AGV X-Received: by 2002:a05:6102:36d4:b0:3cc:4469:1106 with SMTP id z20-20020a05610236d400b003cc44691106mr12309179vss.21.1674483807129; Mon, 23 Jan 2023 06:23:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674483807; cv=none; d=google.com; s=arc-20160816; b=mhO/mOe4xTodxycuuVRM+uuPWhAwGG08Q6JUoxf4ladW0hl+jlNqVmRJG6ClAB3B/4 MFb0ZhLEusYaaXH6qfJ9bd0WTavEfR4a38JvYT6KMkw8fCy4zo+bbi7nfCcMAHzBCN8b QQ6737GfaLwW05Caj1KcAwMsvEMMI+AZXm/G0cRBRLlHs9d82hxOLa4IM+9qFMs4DgLQ pg4W1f18jswQ720b4GOmn0bS4fzF6qMlb7aI3eCK0kjE17f3428wr6mtGeqGOatnyuNj GlVraO77yVnBOJOCJ+KT6CRroMk/SqZz113vnzD+1lXhxVWyu7wXb7spNSRrJguqSjvJ qidg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Er8X565bqDdOiGqHEEKq8jrV5bcDZFCydYLQznUV95Q=; b=Qxeo3U9fCKCEPH7+/lda22rNlo1W6+a6hg3PdJGphwpJ2RqAdjVr52lYSS1ABiMveV dLPlvUZwPrRAR01wjdDEG50HqwsGTueSfMp8RRjEIjpzdZkARQ05q2xvlITHnfxDN6Da nwinjm0lCTt67PTkeXqLNCwUUhj7zg0p8tNX/Smeui+30aqwfwQDSj03+xhlLMc8wY6f VJjIMD3AARS1ydv94KDsbArx4mxKl+t6NzHv/tIFoIpmkL5f9giT/IO9GglIzAp7cAYd p4c+Zm2bHIxAC2WRoQSqIlhxQDmwyBFCDlc2iwuqhIi6JH79rpW5gq/3C4B8nzBsvSGq FYkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=akkEyr4b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g17-20020a05620a40d100b00706a9dbb91bsi11724789qko.519.2023.01.23.06.23.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 06:23:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=akkEyr4b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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[] = { .opc0 = 2, .opc1 = 3, .crn = 0, .crm = 1, .opc2 = 0, .access = PL0_R, .accessfn = access_tda, .type = ARM_CP_CONST, .resetvalue = 0 }, + /* + * OSDTRRX_EL1/OSDTRTX_EL1 are used for save and restore of DBGDTRRX_EL0. + * It is a component of the Debug Communications Channel, which is not implemented. + */ + { .name = "OSDTRRX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, + .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 2, + .access = PL1_RW, .accessfn = access_tda, + .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "OSDTRTX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, + .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, + .access = PL1_RW, .accessfn = access_tda, + .type = ARM_CP_CONST, .resetvalue = 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 = "OSECCR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, + .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, + .access = PL1_RW, .accessfn = access_tda, + .type = ARM_CP_CONST, .resetvalue = 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. From patchwork Mon Jan 23 13:35:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645556 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186551pvb; Mon, 23 Jan 2023 05:37:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXsXlNeSDYuYO7eDtC68W99yNOY6ozOMDKwgkfS3a9+Hgvpz9ojYDTiqZwSWLpBCKbEBS9iT X-Received: by 2002:a67:6cc2:0:b0:3d3:d98c:1070 with SMTP id h185-20020a676cc2000000b003d3d98c1070mr12731000vsc.9.1674481056905; Mon, 23 Jan 2023 05:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481056; cv=none; d=google.com; s=arc-20160816; b=G8bQ0GsggOs3pNnXyCPwbNz0yk1XHu5yPxgwpy+mVz+nQevjl/4xBk/4APQdNt+ska +kYxMMpulrDOYA0UhSZqwdcQL3YFwapPu/29x+lA+jhcAPcYoXt2O9PH6M3shh6kLS+L yaOfwKQ8nRuElCDNNLfcZNmmxW4Ej6QtGCErF16EBqBpoWH2DmpeZDg5sAmAZuiT00gl dK9uZtcBrSs+KObyqFMN+3Q1jQUP3Q3J4VdwOxxFBTrV6gxzYiEXhUww6CawfQ/zj3w8 iKG16qm0mTY3FJQIxcXL9RklA3ALbb6WcSNmdOVMBI8EIkSP6AL0uV/0p9Mzi7/qM6Pm QfAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lVUlCzuReKpCyyuTgLiiDtMEzcD1jFlaCUDrec+Vc7s=; b=NgoJ5lcnZtMPB035xQQwZVhdxnFy25MmReq1KWu6aGph+UqHJmhVHEKw7yGXET6qG6 qnwwlBbo3QOLdf8MUd1s8+AsZtV95ooFV0oBBZJfIdms63lauAw6GcEFu5cNqKhPLfJq aBRtu1uC16ewDXUkv/fttz3ukpcMmUoigzJ4Yzc8yal43myNvB72/uBj6NN/4jMg/5id 3W171gt1HvvjauoAF1Dox8OEulVgZka2aUNta0k7cPxt6UaAmnJ3CMq2Z6hbGGjE2PLr 9TL1h/AjsBSK2z8MNspyJP9OwIZ3s+ExGHYOG+XGj1AyKLGZWdqCd7Br1/YY63IPN9+q MHQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCq36M9R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n17-20020a05620a223100b007066cde642esi11522530qkh.361.2023.01.23.05.37.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:37:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCq36M9R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Move the ri == 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ée 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 cpnum, int is64, bool isread, int rt, int rt2) { const ARMCPRegInfo *ri; + bool need_exit_tb; ri = get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); - if (ri) { - bool need_exit_tb; - /* 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 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 = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, - isread, false); - } else { - syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, - rt, isread, false); - } - break; - case 15: - if (is64) { - syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, - isread, false); - } else { - syndrome = 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 = 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 = 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 = tcg_constant_i64(ri->resetvalue); - } else if (ri->readfn) { - tmp64 = tcg_temp_new_i64(); - gen_helper_get_cp_reg64(tmp64, cpu_env, - tcg_constant_ptr(ri)); - } else { - tmp64 = tcg_temp_new_i64(); - tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); - } - tmp = tcg_temp_new_i32(); - tcg_gen_extrl_i64_i32(tmp, tmp64); - store_reg(s, rt, tmp); - tmp = 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 = tcg_constant_i32(ri->resetvalue); - } else if (ri->readfn) { - tmp = tcg_temp_new_i32(); - gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); - } else { - tmp = load_cpu_offset(ri->fieldoffset); - } - if (rt == 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); - } - } + 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 = tcg_temp_new_i64(); - tmplo = load_reg(s, rt); - tmphi = 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 = 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); - } - } + 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 = ((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 = true; - } - if (need_exit_tb) { - gen_lookup_tb(s); - } - + unallocated_encoding(s); return; } - /* 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, opc2, - s->ns ? "non-secure" : "secure"); + /* Check access permissions */ + if (!cp_access_ok(s->current_el, ri, isread)) { + unallocated_encoding(s); + return; } - 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 = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, + isread, false); + } else { + syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, + rt, isread, false); + } + break; + case 15: + if (is64) { + syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, + isread, false); + } else { + syndrome = 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 = 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 = 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 = tcg_constant_i64(ri->resetvalue); + } else if (ri->readfn) { + tmp64 = tcg_temp_new_i64(); + gen_helper_get_cp_reg64(tmp64, cpu_env, + tcg_constant_ptr(ri)); + } else { + tmp64 = tcg_temp_new_i64(); + tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); + } + tmp = tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(tmp, tmp64); + store_reg(s, rt, tmp); + tmp = 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 = tcg_constant_i32(ri->resetvalue); + } else if (ri->readfn) { + tmp = tcg_temp_new_i32(); + gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); + } else { + tmp = load_cpu_offset(ri->fieldoffset); + } + if (rt == 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 = tcg_temp_new_i64(); + tmplo = load_reg(s, rt); + tmphi = 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 = 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 = ((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 = true; + } + if (need_exit_tb) { + gen_lookup_tb(s); + } } /* Decode XScale DSP or iWMMXt insn (in the copro space, cp=0 or 1) */ From patchwork Mon Jan 23 13:35:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 645560 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2186869pvb; Mon, 23 Jan 2023 05:38:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXt2n6VyQQv1NYJxo/pZ56qKN9DcQUQCgn6X0Ep4EefB3aOApVKiNkMs4G5IGNsxE+Mg1PjW X-Received: by 2002:ac8:4616:0:b0:3b6:31e3:1a59 with SMTP id p22-20020ac84616000000b003b631e31a59mr41330629qtn.40.1674481097406; Mon, 23 Jan 2023 05:38:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674481097; cv=none; d=google.com; s=arc-20160816; b=X4UqhAQkPu2gS0vzCIQ/Jc3YGiczsZFzbyDK8RkO5AwHZ8hXLUEYKYJlrjx5+G+meI N+Zafq60vmXztOGXaEFBTLZcnIWVrJGwhX8dtRpVqd6uUlMYVVIuNOLmY1/WU/HzfEhf x/utbo8uI7PLhsiE7LiL3g+oag+EN67enO4WIIzW9DDTepLIdaHgMtgcpCABWcx9oST1 WNs9B5pDKuadLWzMhpfcLsZx4ZA1wGKAwj+VuboKgwz3h5hddF/cVzvaxWdWx9WBdXiE DQ4ZAY1cy/SPutMu1vBS28DwlztXVdVTPrWtsSK5oCPp6NmEAv5d/uVM2Lezewt0jzY3 f1FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=pSfx3spfZRksbaPoHAooOlaakQpNRrolJmeYWC6KI2k=; b=OUGrYo3IfwKQqrxmrlyvieX14l+64jqryyfv6zZYOGjhfDl76q6yQJj+Xujd+dK1AF fNGHYB6FG13rdNEcUSjV7YcbhFjTjuTZlHh9sQuiF5yij/O5Q3pR2GkQJexp3+xEGHl4 lepBRsj3lfJigJ22AoA7mQo/GCQ7MjN+cum9WCtpBG8DIR2oF3RIE0n6k0FGOdNxOZ2J z2R92BfzTcVcTSLtXsbR6PcjZBkzUwo0HyCy83izNaM3dN8MfCdFASUP36bXkZ3CfRez TpfaNzbj8Eh9lwzI87JAZfkNcP0XQC8Bxg3jAVQIdsrp2ah24DL6+AMS4r6rzorK42oi dujw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sBoFENcu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 12-20020ac8564c000000b003b6850ce381si10421433qtt.739.2023.01.23.05.38.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 05:38:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sBoFENcu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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) DEF_HELPER_FLAGS_2(check_bxj_trap, TCG_CALL_NO_WG, void, env, i32) -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) 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, DisasLabel l) s->pc_save = l.pc_save; } +static inline TCGv_ptr gen_lookup_cp_reg(uint32_t key) +{ + TCGv_ptr ret = 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) } } -void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, - uint32_t isread) +const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, + uint32_t syndrome, uint32_t isread) { ARMCPU *cpu = env_archcpu(env); - const ARMCPRegInfo *ri = rip; + const ARMCPRegInfo *ri = get_arm_cp_reginfo(cpu->cp_regs, key); CPAccessResult res = CP_ACCESS_OK; int target_el; + assert(ri != NULL); + if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14 && extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) { res = CP_ACCESS_TRAP; @@ -663,7 +665,7 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, res = ri->accessfn(env, ri, isread); } if (likely(res == CP_ACCESS_OK)) { - return; + return ri; } fail: @@ -705,7 +707,16 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, raise_exception(env, EXCP_UDEF, syndrome, target_el); } -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 = env_archcpu(env); + const ARMCPRegInfo *ri = get_arm_cp_reginfo(cpu->cp_regs, key); + + assert(ri != NULL); + return ri; +} + +void HELPER(set_cp_reg)(CPUARMState *env, const void *rip, uint32_t value) { const ARMCPRegInfo *ri = rip; @@ -718,7 +729,7 @@ void HELPER(set_cp_reg)(CPUARMState *env, void *rip, uint32_t value) } } -uint32_t HELPER(get_cp_reg)(CPUARMState *env, void *rip) +uint32_t HELPER(get_cp_reg)(CPUARMState *env, const void *rip) { const ARMCPRegInfo *ri = rip; uint32_t res; @@ -734,7 +745,7 @@ uint32_t HELPER(get_cp_reg)(CPUARMState *env, void *rip) return res; } -void HELPER(set_cp_reg64)(CPUARMState *env, void *rip, uint64_t value) +void HELPER(set_cp_reg64)(CPUARMState *env, const void *rip, uint64_t value) { const ARMCPRegInfo *ri = rip; @@ -747,7 +758,7 @@ void HELPER(set_cp_reg64)(CPUARMState *env, void *rip, uint64_t value) } } -uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip) +uint64_t HELPER(get_cp_reg64)(CPUARMState *env, const void *rip) { const ARMCPRegInfo *ri = 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 insn, bool isread, unsigned int op0, unsigned int op1, unsigned int op2, unsigned int crn, unsigned int crm, unsigned int rt) { - const ARMCPRegInfo *ri; + uint32_t key = ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, + crn, crm, op0, op1, op2); + const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key); + TCGv_ptr tcg_ri = NULL; TCGv_i64 tcg_rt; - ri = 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, syndrome = syn_aa64_sysregtrap(op0, op1, op2, crn, crm, rt, isread); gen_a64_update_pc(s, 0); - gen_helper_access_check_cp_reg(cpu_env, - tcg_constant_ptr(ri), + tcg_ri = 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 = cpu_reg(s, rt); if (isread) { @@ -1996,14 +1996,14 @@ static void handle_sys(DisasContext *s, uint32_t insn, 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 = 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 = 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 insn, 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; } 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 insn, 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 = 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 = 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 insn, bool isread, */ s->base.is_jmp = DISAS_UPDATE_EXIT; } + + exit: + if (tcg_ri) { + tcg_temp_free_ptr(tcg_ri); + } } /* 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 cpnum, int is64, int opc1, int crn, int crm, int opc2, bool isread, int rt, int rt2) { - const ARMCPRegInfo *ri; + uint32_t key = ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2); + const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key); + TCGv_ptr tcg_ri = NULL; bool need_exit_tb; - ri = 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, gen_set_condexec(s); gen_update_pc(s, 0); - gen_helper_access_check_cp_reg(cpu_env, - tcg_constant_ptr(ri), + tcg_ri = 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 cpnum, 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 = DISAS_WFI; } - gen_update_pc(s, curr_insn_len(s)); - s->base.is_jmp = DISAS_WFI; - return; + goto exit; default: g_assert_not_reached(); } @@ -4843,9 +4843,11 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, if (ri->type & ARM_CP_CONST) { tmp64 = tcg_constant_i64(ri->resetvalue); } else if (ri->readfn) { + if (!tcg_ri) { + tcg_ri = gen_lookup_cp_reg(key); + } tmp64 = 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 = 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 cpnum, int is64, if (ri->type & ARM_CP_CONST) { tmp = tcg_constant_i32(ri->resetvalue); } else if (ri->readfn) { + if (!tcg_ri) { + tcg_ri = gen_lookup_cp_reg(key); + } tmp = 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 = 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; } if (is64) { @@ -4893,7 +4898,10 @@ static void do_coproc_insn(DisasContext *s, int cpnum, 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), tmp64); + if (!tcg_ri) { + tcg_ri = 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 cpnum, int is64, } else { TCGv_i32 tmp = load_reg(s, rt); if (ri->writefn) { - gen_helper_set_cp_reg(cpu_env, tcg_constant_ptr(ri), tmp); + if (!tcg_ri) { + tcg_ri = 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 cpnum, int is64, if (need_exit_tb) { gen_lookup_tb(s); } + + exit: + if (tcg_ri) { + tcg_temp_free_ptr(tcg_ri); + } } /* Decode XScale DSP or iWMMXt insn (in the copro space, cp=0 or 1) */