From patchwork Thu Jan 5 16:43:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639318 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp341639pvb; Thu, 5 Jan 2023 09:29:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXvsS0hPkRHwgdfMHz/IimbDAafwPBgLXYJQhOeQ62B+Q7BUfI4DgmSpKtLStXc7CROUzasu X-Received: by 2002:a05:622a:250d:b0:3ab:5f5f:b7c4 with SMTP id cm13-20020a05622a250d00b003ab5f5fb7c4mr78701128qtb.24.1672939797251; Thu, 05 Jan 2023 09:29:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939797; cv=none; d=google.com; s=arc-20160816; b=Ku1XPTC998mF8VWuKRe6w0ILf7fV1HBRFr9ZK++xVc634zWNE2uZFro1hTp3xY3Utn 3anBhGTV1Fxf65QfDfB3nDxd6HAGn1EaWbWG83p5X7Zriu/xGtpFtOPVpkASgGHgC5LE K6bZ1+Ls2PvXDb3XJeIAF88/HwPZOjQJQGK2tts8k8V/+7sY7FhSdx93hfxokhbSxCOV fhxZ2dLNqwQVRVqcJNtYY8XZ7Y0FxIGdpQEV/VD/xzG7R17OBbGRnTsoR1thIccrOG9p 3U6+c6DRKQ9zdx+vhUBdvnkslaO2Ax8hOgizOw2nGQXHucLQC1gkSuUAQ5dO8GTnLjXH u1lQ== 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=F/5EJBYFSRrAmo1vD4tU1WXQrdeBd0ZRx/qGyNKF6P8=; b=XY4nuwx1ddfV9KNP1tl68mKcfCp2cROkPVpF7tizC56v8rnGvjDwC2JvaL1reI2zFL YZDEhuTX+TejIIKHjyE810ff+KSrfAZ55Y7BffCiaNlytGxds5ebFF4To5/OJp04ln6U FGCINvsgdxmxHzc9DoFtTQIi4U/KHLYz0GVuhAn5n81Awd0TxN2O8Qd1S5mtT1vCeDcj v+IYCXJArC0KxBHN7WogCGv68kDWDhT1iQsA/mjkug/0wgvKQIW+dpsi4c6URiRZ6cPl IOhMzERTrr84M8e/pqh3PylKrVYbAV6QZjWfZvZJ4nTarfbMd1+qbldXj1EEAOZx2eF3 dezg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qDZMeaYi; 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 e3-20020ac845c3000000b003a5f9a090easi20096067qto.182.2023.01.05.09.29.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:29:57 -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=qDZMeaYi; 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 1pDTLt-0000KD-Kr; Thu, 05 Jan 2023 11:44:25 -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 1pDTLr-0000Bh-Md for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:23 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLp-0007Lb-Jk for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:23 -0500 Received: by mail-wm1-x334.google.com with SMTP id fm16-20020a05600c0c1000b003d96fb976efso1734007wmb.3 for ; Thu, 05 Jan 2023 08:44:21 -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=F/5EJBYFSRrAmo1vD4tU1WXQrdeBd0ZRx/qGyNKF6P8=; b=qDZMeaYiYNDzYr3EONnabtzevfAdpv6S+k4rBuXC41YwVlTnkJTANjXikb3M3L+wOI WFaUyZ6hxX06bnzEYmld2oRyAmOOx53bqoKg9WL1GVAELNACUr4AGcp0Qau8ox6Z6o4A Cn/xSZ0l8PxgSoFuWXufjW+p24VoJ0rQNsd4X4dknoou8vBSck7l8sDpcjpC08G2ojpR MW7z+TmSK6sqP3e3/aCyuc188Y73X1Wd/MqcOxy0nlLJQC717QVTlrvUi+2pnE96FGhS pLAokyY+lgWjEUyPcn4VcGsJhx15pY97JmTSN3amPEbGRh1BEaMXRFRdZBY/iJ8KeHSK oocw== 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=F/5EJBYFSRrAmo1vD4tU1WXQrdeBd0ZRx/qGyNKF6P8=; b=2CQxQ7keji9jyV1PTFHy5oCUEptIlwQqRgZaooE+FjOj2BFMMGt70aiLxp71F+/5Rb EERV1XA/IJDIPFYPQM2i1x8nJ9JnvIC78cJXlFsf9xLD0j7vw7dyyPPQyJ2lq1prek+f syWtRE64ZH1hbJGtSGh/ULKlCedqlXXDZDvjloeie3NCrUGfTTVJtyKtlDwBOEwz3X8T lg4U2asn6jFaCuZzeuiLytST04oa/mlym37ibUnHh+rG9ZUGN77XeXCyhgYA1UZdw3rr 4YzC4X55o0xDWD90Rsa+YSGu2UOmJq/tmwrQHYwdK5jwc92XXXYo4tKGR+0UcBbPS1SU iR5Q== X-Gm-Message-State: AFqh2krvTAG+z4Jk+eI9P/LkD5YtUic8bUVxScpJH9TEzs+SPviTlJ+f 4buPQM3XqUHD+CyQ9/OJVoRNBUmFwDviWipp X-Received: by 2002:a05:600c:1e24:b0:3d3:5075:7526 with SMTP id ay36-20020a05600c1e2400b003d350757526mr38135203wmb.31.1672937060194; Thu, 05 Jan 2023 08:44:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/34] target/arm:Set lg_page_size to 0 if either S1 or S2 asks for it Date: Thu, 5 Jan 2023 16:43:44 +0000 Message-Id: <20230105164417.3994639-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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 get_phys_addr_twostage() we set the lg_page_size of the result to the maximum of the stage 1 and stage 2 page sizes. This works for the case where we do want to create a TLB entry, because we know the common TLB code only creates entries of the TARGET_PAGE_SIZE and asking for a size larger than that only means that invalidations invalidate the whole larger area. However, if lg_page_size is smaller than TARGET_PAGE_SIZE this effectively means "don't create a TLB entry"; in this case if either S1 or S2 said "this covers less than a page and can't go in a TLB" then the final result also should be marked that way. Set the resulting page size to 0 if either stage asked for a less-than-a-page entry, and expand the comment to explain what's going on. This has no effect for VMSA because currently the VMSA lookup always returns results that cover at least TARGET_PAGE_SIZE; however when we add v8R support it will reuse this code path, and for v8R the S1 and S2 results can be smaller than TARGET_PAGE_SIZE. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20221212142708.610090-1-peter.maydell@linaro.org --- target/arm/ptw.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index f812734bfb2..2e7826dc29b 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2655,10 +2655,20 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, } /* - * Use the maximum of the S1 & S2 page size, so that invalidation - * of pages > TARGET_PAGE_SIZE works correctly. + * If either S1 or S2 returned a result smaller than TARGET_PAGE_SIZE, + * this means "don't put this in the TLB"; in this case, return a + * result with lg_page_size == 0 to achieve that. Otherwise, + * use the maximum of the S1 & S2 page size, so that invalidation + * of pages > TARGET_PAGE_SIZE works correctly. (This works even though + * we know the combined result permissions etc only cover the minimum + * of the S1 and S2 page size, because we know that the common TLB code + * never actually creates TLB entries bigger than TARGET_PAGE_SIZE, + * and passing a larger page size value only affects invalidations.) */ - if (result->f.lg_page_size < s1_lgpgsz) { + if (result->f.lg_page_size < TARGET_PAGE_BITS || + s1_lgpgsz < TARGET_PAGE_BITS) { + result->f.lg_page_size = 0; + } else if (result->f.lg_page_size < s1_lgpgsz) { result->f.lg_page_size = s1_lgpgsz; } From patchwork Thu Jan 5 16:43: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: 639271 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp321257pvb; Thu, 5 Jan 2023 08:45:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXsagOzRpTknMlLrdmqiBo1D+7ANVeOJBZwaPi/x5n8qZ2wyD/4ZB/I+1PLGlx+c1/VgTkLu X-Received: by 2002:a25:d751:0:b0:74f:871e:2b19 with SMTP id o78-20020a25d751000000b0074f871e2b19mr63482342ybg.30.1672937148625; Thu, 05 Jan 2023 08:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937148; cv=none; d=google.com; s=arc-20160816; b=uXjNVZAHs22SgYH0N07IBP91/S35FsmWXxyoXr3hBVbKRVcBv0Rzeszg9RbR2jVojp 75TVSMb1FIyNhHYjSjjtr9MpITd811nfBL1J33YzqYfjHd4FVo1RkS5i9sexvHr77mP+ XGMADL/CrrLDvF2uhc+8NoeWiR17hozTAe1gZ1M5SIqTGlEeDMNHf2ki/YNoaa3mB88U JdC3kaiHjGmVOaWugKJTh0AE4walE7lzQV79yuAQaP+x5NTTxyagaHK0/ns9k+3b2Muo 1tZprWAmqbk9ToLPNB5y1YQVJS6v0mCzjLLQTX0h8ixpNbBDQ50Krp4wuMUuqC0mFpdf Sz1Q== 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=Yuo7qK1mL55V9kttGcjYaiTtFdumRPFENl39UXW9mMo=; b=PS4UnzSpiUpc25+ABBeYkaMvjYngP7GBCmIoEkuuUK7IdkZmewirjsNvFiaKZHLEs2 9too8oav/7JC6CWThPoZ2F+qnoAHrP5Pf/2SBayiTLMlNZQAK76Z1Acw3Vm5550xU1lC bKEvHmntUxA1uPfDgZIYVRVAhUe4wK2MR7IOBcBbfrtPodChCHeGjPo7r+u8rS91RniG EnaFk5m/hWu6CrGBcvHITTs8XIMQSU14BxwYpnxKFU51058qYqnZPzmUs50UG/auTSbk x6JYqnozFJiOh0ZRAxBhUSjpCMaOd6tFqumeIH6m84LKVZf8yxFkNC5iJ/mpd5euzdVI xhyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CURm2aHY; 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 t29-20020a37ea1d000000b006f988e553b3si18845194qkj.249.2023.01.05.08.45.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:45: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=CURm2aHY; 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 1pDTLu-0000LZ-5R; Thu, 05 Jan 2023 11:44:26 -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 1pDTLr-0000Bj-NU for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:23 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLp-00072G-Kc for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:23 -0500 Received: by mail-wm1-x32c.google.com with SMTP id ja17so28449479wmb.3 for ; Thu, 05 Jan 2023 08:44:21 -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=Yuo7qK1mL55V9kttGcjYaiTtFdumRPFENl39UXW9mMo=; b=CURm2aHYSLjNVaFu4jFPVh5GEmDEb99ahposk6Q2BYXcJ4uhzq4km8rjdJ2UWhqZde PvoqVRWcYp2vC+xfjc7PCqxlBCop6jA4GXII9UuneMGi6+Nvhj1aMCobAbDZu8vJPoR4 a9PTjEs1Zj8Bny5b8KQjo9QLd1g6y6JvV455u5XBIRThhWK/B+xYu1SrkSBmOtc708za F77v01D3DYvQyCq+ZJ8NNqgoYFMMf/cFqbkSe25E7KshFVCCQA+tKXS7bZZ/Z7mWc1S3 DTdiQ0DzQJun/T8QD3xfi7copPVSYe4jWFnl4BuGPsTKcFfV6FnzamLBFR3haP3gxPDj mP0w== 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=Yuo7qK1mL55V9kttGcjYaiTtFdumRPFENl39UXW9mMo=; b=ixXsX24aGZ6EEAvpjnjzIQk31tCzNI0EKNxNZGNmzpvNCmG9n0yfq/QwQCMP2XNcp1 CZE03nPKDpuMJ3dU26Qm6PcB1YM2ooiHGA69BAn2m8Zsy6Fu7MyZbaN9s90AyuyLrAhL i+tYGyIFuBtsADuIkROE40BL9PMGNaW8QJwU6NsarslorZXD3szNz1bKk9O+PnRNATTp tQc2pByQB4/Bq/cEazLQn3K4eK+1wixLOcWWPY02bxlgvaz6nOVQNARx2bukODXqhWjO rcTeGmAuK2U4uTboYqBRltPSXrYhJ5Kw7iCSyVHkR9DGCF+N4RmSNNPjAe11Y3p31bN3 +DBA== X-Gm-Message-State: AFqh2kpO1SIFaF+KKEq2maZzL6qbVdiHPdosYChdyQHqa1SA+Pc9wNrx bFisS2x1O9T46UdJyWvpY3trHx/1jXj4q+GS X-Received: by 2002:a05:600c:4854:b0:3d3:5a4a:90ff with SMTP id j20-20020a05600c485400b003d35a4a90ffmr39115253wmo.23.1672937060960; Thu, 05 Jan 2023 08:44:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:20 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/34] target/arm: Don't add all MIDR aliases for cores that implement PMSA Date: Thu, 5 Jan 2023 16:43:45 +0000 Message-Id: <20230105164417.3994639-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Tobias Röhmel Cores with PMSA have the MPUIR register which has the same encoding as the MIDR alias with opc2=4. So we only add that alias if we are not realizing a core that implements PMSA. Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20221206102504.165775-2-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/helper.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index bac2ea62c44..090daf93c71 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8153,10 +8153,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr, .fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid), .readfn = midr_read }, - /* crn = 0 op1 = 0 crm = 0 op2 = 4,7 : AArch32 aliases of MIDR */ - { .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST, - .cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 4, - .access = PL1_R, .resetvalue = cpu->midr }, + /* crn = 0 op1 = 0 crm = 0 op2 = 7 : AArch32 aliases of MIDR */ { .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST, .cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 7, .access = PL1_R, .resetvalue = cpu->midr }, @@ -8166,6 +8163,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) .accessfn = access_aa64_tid1, .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, }; + ARMCPRegInfo id_v8_midr_alias_cp_reginfo = { + .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST, + .cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 4, + .access = PL1_R, .resetvalue = cpu->midr + }; ARMCPRegInfo id_cp_reginfo[] = { /* These are common to v8 and pre-v8 */ { .name = "CTR", @@ -8231,6 +8233,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) } if (arm_feature(env, ARM_FEATURE_V8)) { define_arm_cp_regs(cpu, id_v8_midr_cp_reginfo); + if (!arm_feature(env, ARM_FEATURE_PMSA)) { + define_one_arm_cp_reg(cpu, &id_v8_midr_alias_cp_reginfo); + } } else { define_arm_cp_regs(cpu, id_pre_v8_midr_cp_reginfo); } From patchwork Thu Jan 5 16:43: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: 639280 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324434pvb; Thu, 5 Jan 2023 08:54:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXuXqwwY8zAXN5xpihtqtlNhkGVv2SXBgmVmwRf2OuVbvcg5vDvTnvdONsWWcndt5fGPjE62 X-Received: by 2002:a05:622a:4d47:b0:3ab:5dc7:6be7 with SMTP id fe7-20020a05622a4d4700b003ab5dc76be7mr80896217qtb.27.1672937642704; Thu, 05 Jan 2023 08:54:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937642; cv=none; d=google.com; s=arc-20160816; b=EBknoO9KCmdvVyxUlBI9IdSQP4jN3xTErNpcfND6HpC0rm2zLicjjLU+ysKstX5uoZ Qld736kPE0vilNQsbFzQ8ISGKH8CeJp9gDDkDBus5QpqjOzkFM5f4ZcQ7ZhrvNOKNP4G 4LCxEscBfa+sXv6KaG4S0WV8xyzjFBII0CwoAavK1eFv5MKhicOj8rONNi0BWo/Lziwy HW4/bEzfOhNppqGN8+3pfcPQMe7SEkaWicWolU7bggswzEUPhXbnr+pyr1umTxr0wtVy pyGDalVpHvzF3bHpncO/Hy7KaJO6yctzZf+7KU0ORTW1HR7cuScfwcmrpBnowX8SWdBB awLQ== 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=ucC6r0jcHK+UNQ8eQHcmxpwSVgcMH/k1pFOZLGUGlEY=; b=glNMFrN5E2Jr0XzWrP9hTSzqkhrAw8716l6te9DDuiHApKe/ZyFMNGuXdTbkG0/UDf 8MrUQF3sPUQ8o/qhWLxU0mtUCvOmHZrd5NEEe5xI+9BOZ+dcgqkUXCzN1YkHPEOJkho7 aVjfx4Lfd+wWuNlw4bBxt7u44kLv7WweduaE9RYRO633VXhT8lFEs7zVCUzPR3/apIqn YXIOeGY9PIh1LgI+BjWvfe0QTq3xsaf6VaGCWNHgHjHhT1qhwbjgRIEGNskvGnWF6nhS yLAiBLRIZGTU6wCDii2oezPrML3tmJs44ral0F8Nf5PwfIivh2Fu+vIsNF+a6VeoN7yf 1zuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E8DRv8Nu; 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 r184-20020ae9ddc1000000b006e07228ed51si17729534qkf.99.2023.01.05.08.54.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:54:02 -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=E8DRv8Nu; 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 1pDTLv-0000Qa-EH; Thu, 05 Jan 2023 11:44:27 -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 1pDTLt-0000Jl-6v for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:25 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLr-0007Lt-Di for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:24 -0500 Received: by mail-wm1-x334.google.com with SMTP id g10so14660734wmo.1 for ; Thu, 05 Jan 2023 08:44:22 -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=ucC6r0jcHK+UNQ8eQHcmxpwSVgcMH/k1pFOZLGUGlEY=; b=E8DRv8Nu4ixugWfK7FytBuxghTiwZxfIA8v2FkhXE8xQW7boVkVkF+ANXVyqrfEvS5 ubCGchzYN2aFeHm2tR8DMack6HoC4RTfYINzGn5FJbUIlsOgXpes59SFRZv8zLMu7r7M U/qGrPyF2LhtYeQpK0x8yey/snnryI4Zs+TGyyxvlV6OgaD3PHyO74AorODaxr+cwdZO 9pldvRk+3pujN/t0Bdaz0Uqx54ussUqGnGUAbaVhSJdWFcSd6oND7W6W6TX8AAUbXTra dqmmZd6URkVBFjRQW7ut8d64eXaLcogbiDEWfqeC1K7NM0O7rPzqfO7B8sSNHXNZN0jA GsFQ== 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=ucC6r0jcHK+UNQ8eQHcmxpwSVgcMH/k1pFOZLGUGlEY=; b=k6IFLW31DlujVtfe5jGPfK14UTSYonEHLMIix3qn1i95baCleqeskSwxvc9MXGqo+v Ai3iGlez4gmZT3OTwRXg/R1kYBQsyCr3kyJLtoLl+EYC/bklUvfEGJFY0GJOuKmQOOAF +mV/SVKmJZBR87Cv7VPPV1qk1hKtN9EQB0DnClDIm106MPFEjUO24v8uyQJ0C0s1V5sm IjMx8JB9Akn733dhF3FM/978fleK9vrqJ71tDNKGh4dX0R0NwULbtNZoWD33CqsMm7Ao fjg2h/n3+6+jVhZ8gIOmx6FFgpG3zndJlnfnf2DAZqkTue1mfjjLXnbwtd2whpmjE+SX FMtA== X-Gm-Message-State: AFqh2kp+qdvxEA8NMNqYA1yPlOgzfgLjUL1JaSvxVyl5rob8VMlvPrEm SvJElAPs49Z5cm8LVBrLcq9TG5bIU9Gt55vi X-Received: by 2002:a7b:ca4f:0:b0:3d3:56ce:5673 with SMTP id m15-20020a7bca4f000000b003d356ce5673mr39142433wml.6.1672937061813; Thu, 05 Jan 2023 08:44:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/34] target/arm: Make RVBAR available for all ARMv8 CPUs Date: Thu, 5 Jan 2023 16:43:46 +0000 Message-Id: <20230105164417.3994639-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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: Tobias Röhmel RVBAR shadows RVBAR_ELx where x is the highest exception level if the highest EL is not EL3. This patch also allows ARMv8 CPUs to change the reset address with the rvbar property. Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Message-id: 20221206102504.165775-3-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/cpu.c | 6 +++++- target/arm/helper.c | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2fa022f62ba..c107cbd7574 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -309,6 +309,10 @@ static void arm_cpu_reset_hold(Object *obj) env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, CPACR, CP11, 3); #endif + if (arm_feature(env, ARM_FEATURE_V8)) { + env->cp15.rvbar = cpu->rvbar_prop; + env->regs[15] = cpu->rvbar_prop; + } } #if defined(CONFIG_USER_ONLY) @@ -1345,7 +1349,7 @@ void arm_cpu_post_init(Object *obj) qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_hivecs_property); } - if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { + if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { object_property_add_uint64_ptr(obj, "rvbar", &cpu->rvbar_prop, OBJ_PROP_FLAG_READWRITE); diff --git a/target/arm/helper.c b/target/arm/helper.c index 090daf93c71..d8066fe97d3 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7896,7 +7896,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (!arm_feature(env, ARM_FEATURE_EL3) && !arm_feature(env, ARM_FEATURE_EL2)) { ARMCPRegInfo rvbar = { - .name = "RVBAR_EL1", .state = ARM_CP_STATE_AA64, + .name = "RVBAR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1, .access = PL1_R, .fieldoffset = offsetof(CPUARMState, cp15.rvbar), @@ -7987,13 +7987,20 @@ void register_cp_regs_for_features(ARMCPU *cpu) } /* RVBAR_EL2 is only implemented if EL2 is the highest EL */ if (!arm_feature(env, ARM_FEATURE_EL3)) { - ARMCPRegInfo rvbar = { - .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1, - .access = PL2_R, - .fieldoffset = offsetof(CPUARMState, cp15.rvbar), + ARMCPRegInfo rvbar[] = { + { + .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1, + .access = PL2_R, + .fieldoffset = offsetof(CPUARMState, cp15.rvbar), + }, + { .name = "RVBAR", .type = ARM_CP_ALIAS, + .cp = 15, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1, + .access = PL2_R, + .fieldoffset = offsetof(CPUARMState, cp15.rvbar), + }, }; - define_one_arm_cp_reg(cpu, &rvbar); + define_arm_cp_regs(cpu, rvbar); } } From patchwork Thu Jan 5 16:43:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639270 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp321123pvb; Thu, 5 Jan 2023 08:45:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvP1WqoDoR7NYAVxAQOk/+7wj8YJE2t5D54wjNclscJEnMYWj5L1zbRQCA/IChYewVFTRV0 X-Received: by 2002:a05:6214:5713:b0:4e8:178d:7ec7 with SMTP id lt19-20020a056214571300b004e8178d7ec7mr17064757qvb.26.1672937133403; Thu, 05 Jan 2023 08:45:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937133; cv=none; d=google.com; s=arc-20160816; b=f7H40aP9+Ix6b5A8RIc+dkhGRQ5tVlRIdvznPcv+/5EoR0O+iQRZqCDFwoTZ+XnHnA dN/7R9SrlU0s+e2xbcLfMDb6jwue7JsQjCi3Fej/hcq7kP4OuZYHfF9ITawckeKc4OSZ a3Iv8ELJm99FA0D6/PfJ/gT+dWv6MVsSTSaoSAGSeT1A8ZHAlgR/UxMWNLWvTSAl/Ntj U4PNnPKctk6yLlzeZ+xsdMLzNBI9FLS5wHfYXJaS9LnQd4+YWycM15q5RWFRGgrz3HFk wvTI89ulep+HwDYR1IevqFrUejCepS+2maC+faa8xM7M22ILNq8VVczZzAofvPFSOGUR Icdg== 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=SBtE1WaPGjXlOvM4v7lfDebcyZ7mACd7pg2snYYPi6M=; b=VrZ2kIS5BevVQ0RwQjPAZeMgCbumNrDZSdCI1VWgO/4Bf7ASWaLKVAFqos9EpzqAXO /SEI8JYHoUgaxZTud2rukB0tO1IpnOcOmuGjJHcGSXVhsQ1ZynNo04pPxBhM+xK6LLdC tiMFouy7FivzS/PGNT8/RXa8og4rx8yZNV5SecqiOD9+jB9DjN+eRzAzWLcJYy8yIlc/ 9Q+eiuMXRuBDBm5/Wru/tGSlnUvpHCuYKnf3vaFvSurNv3VC2gORjr+3suHWlKS/CfBE /reOCOJsKfRSz/Zg1BTRHy28hBTZqICmwTN/JCeqohNkDEq7qsk+K+M4L3aRVzAC5DWg 3r+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ihjQueGM; 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 o20-20020a05620a2a1400b006ed1e68ccb4si22101011qkp.627.2023.01.05.08.45.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:45: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=ihjQueGM; 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 1pDTLx-0000S5-32; Thu, 05 Jan 2023 11:44:29 -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 1pDTLt-0000Ke-QB for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:25 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLr-0007M4-VT for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:25 -0500 Received: by mail-wm1-x333.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so1773915wms.4 for ; Thu, 05 Jan 2023 08:44:23 -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=SBtE1WaPGjXlOvM4v7lfDebcyZ7mACd7pg2snYYPi6M=; b=ihjQueGM9bP+CPvnaesnHe1pT6sp2QspjYleUq+tvbjnNECfiS4cGKTObPe6p9YVhU c0SuWf9NpD157Dj0PVrutwqFK8ZZuEmb6Hc9uEctTLWMUmgUtmwnagPtP/KIZin66GHO IzsKgDLCUQv2SSX26vulTvteNiEocTq4HHrlacpRL9o1tM6Zrf8cSD6uQuDzBP0oFDZq qook4FiSSzMMpfQboEOEcmXv30sQQCup0A92xTaxMGttAngfmxvkva6Q1bwM3eqh4aIN B85gr5j4sXMEx36P4/TEF+J+hPyu9pbH8jKCKWQoXH2vvuXru9O2yYB/Z7ViSaaU7Ums M3cQ== 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=SBtE1WaPGjXlOvM4v7lfDebcyZ7mACd7pg2snYYPi6M=; b=ck6G1aPM92hLM2gbc4hVrnglQxc59WS7GLdhQKN2aVWMmInPoI+miWYfK0ZY2rVqZK 2hLzA9AU4jfBS7+OlBNd6qmIMTUO53JPFgVbF72ClHdVM1/2nGZpKEtiXffulRe+3Wk6 +9wE5V846zNQGzM4rQ9q3snDF4kTReVemBefIt8CKZcDuSuCN3JkBewubYxVqZ3Pzj4N d0/k5KraVc0sa4Uu43zcTWccb4StKUzOyCE/5p19gTADtopwlyrcs6IOHdRUYJ2df0DL etD5c9K6KgyVKCguEhUFuG5aGMJT8igGE48t23SGpxzbUOCiQWWMe+7THWzGefqdl5EF OGAQ== X-Gm-Message-State: AFqh2krdayY5EO0yQLsqukGBY/cf5RBL3v8tBtCG05Njk9p7y4kODlzd LT6sT2IESgRBteaQW+Y94Q++OzHRqSvByi3w X-Received: by 2002:a05:600c:43ca:b0:3d0:73f5:b2c0 with SMTP id f10-20020a05600c43ca00b003d073f5b2c0mr38841841wmn.20.1672937062671; Thu, 05 Jan 2023 08:44:22 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/34] target/arm: Make stage_2_format for cache attributes optional Date: Thu, 5 Jan 2023 16:43:47 +0000 Message-Id: <20230105164417.3994639-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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: Tobias Röhmel The v8R PMSAv8 has a two-stage MPU translation process, but, unlike VMSAv8, the stage 2 attributes are in the same format as the stage 1 attributes (8-bit MAIR format). Rather than converting the MAIR format to the format used for VMSA stage 2 (bits [5:2] of a VMSA stage 2 descriptor) and then converting back to do the attribute combination, allow combined_attrs_nofwb() to accept s2 attributes that are already in the MAIR format. We move the assert() to combined_attrs_fwb(), because that function really does require a VMSA stage 2 attribute format. (We will never get there for v8R, because PMSAv8 does not implement FEAT_S2FWB.) Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Message-id: 20221206102504.165775-4-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/ptw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 2e7826dc29b..1c7c9cb5e37 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2361,7 +2361,11 @@ static uint8_t combined_attrs_nofwb(uint64_t hcr, { uint8_t s1lo, s2lo, s1hi, s2hi, s2_mair_attrs, ret_attrs; - s2_mair_attrs = convert_stage2_attrs(hcr, s2.attrs); + if (s2.is_s2_format) { + s2_mair_attrs = convert_stage2_attrs(hcr, s2.attrs); + } else { + s2_mair_attrs = s2.attrs; + } s1lo = extract32(s1.attrs, 0, 4); s2lo = extract32(s2_mair_attrs, 0, 4); @@ -2418,6 +2422,8 @@ static uint8_t force_cacheattr_nibble_wb(uint8_t attr) */ static uint8_t combined_attrs_fwb(ARMCacheAttrs s1, ARMCacheAttrs s2) { + assert(s2.is_s2_format && !s1.is_s2_format); + switch (s2.attrs) { case 7: /* Use stage 1 attributes */ @@ -2467,7 +2473,7 @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr, ARMCacheAttrs ret; bool tagged = false; - assert(s2.is_s2_format && !s1.is_s2_format); + assert(!s1.is_s2_format); ret.is_s2_format = false; if (s1.attrs == 0xf0) { From patchwork Thu Jan 5 16:43:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639303 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp333086pvb; Thu, 5 Jan 2023 09:10:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvYgcaHnbE38jjUw0utdEseD4N7mmVweaLSqEgMiLCYjrzOn1/YcFtT2esKIz89/RGd+s1v X-Received: by 2002:ac8:53cd:0:b0:3a8:2d6:521e with SMTP id c13-20020ac853cd000000b003a802d6521emr82741995qtq.37.1672938633231; Thu, 05 Jan 2023 09:10:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938633; cv=none; d=google.com; s=arc-20160816; b=uL9Ow7VVKZhWvV5zsE8L8qlGIgMcY09QcFDCD61FYKMctMphnhtopNELvf9ba651oO 1oaSMSuZTXsNxhe/k08traxmnhDtJ3OLgOSOICS2c9VRvpcPqYAzIh35jIcG+E71h09J 3Zbw3dOY7CUeQE709tClpm2Q5gmE+sitMfYAzWJIikSrT3C1zUmniSIpTtE3+9UItOIb DaZqGAbw+Buw8B5haDWHjLsEd2MvatdUZme02/rogbltWu2SD7V8kcD/8LMQPsnk660K Ae9OVs+TAzLtBJFsQv3pQCqR/+cxj6ayPzJ+GHVHlprWpsEMsIASfqV5b29cY8Mdsoti AQZw== 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=V04Q2CJZVVTmActVLx4PP0ERtalL12YnqZ2E3ccFR8A=; b=kYmn/c6FfERoZc2l+IPbq/wCCeahis8bpGj8jKF04AB1KJ3vBhjG3YyVfeY4FkzuK5 xSc2RIWwLBFyT6Kkv5z05z+3KrK9LG1lQATyz4c//mgW7bmta8BH0xd6FpzHtNexWpNg KQHp1TYBGpT0Y6gRscC+Kf9SqSJRzruUQSTtvPkZxS/5ugndu8kRTJ/DyS43ZPZY0Ioh KQXMCvu+XDhcixlcC6ExRzsNZOpWI6LnjcG99grruifHHrrpRUf5FszFW428xJL6GeyN om0e0h8U+6z+yEduPFjgmIjM29tk4BLCW9bfd+ey/lWAZqp6WTB5Of8e6VzkvNskKOJs WjiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T8mjqMBc; 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 h18-20020ac87152000000b0039cb986f233si19009507qtp.255.2023.01.05.09.10.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:10: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=T8mjqMBc; 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 1pDTLy-0000SN-AI; Thu, 05 Jan 2023 11:44:30 -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 1pDTLu-0000O9-OY for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:26 -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 1pDTLs-0007MR-VS for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:26 -0500 Received: by mail-wm1-x32b.google.com with SMTP id ay2-20020a05600c1e0200b003d22e3e796dso1803494wmb.0 for ; Thu, 05 Jan 2023 08:44:24 -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=V04Q2CJZVVTmActVLx4PP0ERtalL12YnqZ2E3ccFR8A=; b=T8mjqMBc9Ht3YjC0UpJ8/V4IBgXv8kOLjG3I6S7ydweegYUBloGCSV3Um/YyUlxeb8 feWmBvRJxf8M0EHR8mypWPxzQlxpn+zY3iqG8K6Yn7FIzFaFTL2Gh5oyjQAHxF8/Phle uvy7WWZ7hRy1MqOJBIKp11LUOSNMK1a5LX9HbQYU5Mko6wX3TGTTTq5S9Z564hide39H 2SAzMv6kICm+kQHhF/DvDzRvLV9HTrKQ193zTYH5brCA0ThKrXI9pQ4MelwZuho1CXLk S275ySYSOznboEohF6hOomvPZqgXEPNbzAFKW56GekmBcH3SwW8/79zlMUUSmVehaIXy CpzA== 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=V04Q2CJZVVTmActVLx4PP0ERtalL12YnqZ2E3ccFR8A=; b=5Ou3SghOxykaAMBjNzFA1AO6t6+ZUp5ORR6xO1NSqrwtbnU/RWz2EuaJUk+acAIwVo BPuB2h/+6q4DuTse3dkYNxQBwREHGFs7VmKITVE0apGiAJlSCo3DjK8JhHhk6VgYxvtb 9LaFsBQ+UCaombVs6IyAdEB7B+bCZI0BUq6wPkOz+j13tjihPhrlOWkvgPIwC6VqcOm5 rj44fnd3hbhSVJ5ocKFDTeWXuAJyW4UQmJVYuLw/9KNZ4M8PJTkc63Jw0b6HvL/ZuX3A UvLQ7z0pPRHIqM/S7XL64mmg3jEy8u+OkQUs7SlWSf6jCKFrthh+LLxba8iMUKUZMnqW 8Cbw== X-Gm-Message-State: AFqh2kppZHYYZs6h1KjJ6oSY/hH7G1+T7MibeeLT2VrDCLGtK5e4HPkc byj3oM9PSNUfr3KQIMFk2gb/hFWiJNfF8KYs X-Received: by 2002:a05:600c:4b1d:b0:3d3:3deb:d916 with SMTP id i29-20020a05600c4b1d00b003d33debd916mr37333688wmp.4.1672937063602; Thu, 05 Jan 2023 08:44:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/34] target/arm: Enable TTBCR_EAE for ARMv8-R AArch32 Date: Thu, 5 Jan 2023 16:43:48 +0000 Message-Id: <20230105164417.3994639-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Tobias Röhmel ARMv8-R AArch32 CPUs behave as if TTBCR.EAE is always 1 even tough they don't have the TTBCR register. See ARM Architecture Reference Manual Supplement - ARMv8, for the ARMv8-R AArch32 architecture profile Version:A.c section C1.2. Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Message-id: 20221206102504.165775-5-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/internals.h | 4 ++++ target/arm/debug_helper.c | 3 +++ target/arm/tlb_helper.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/target/arm/internals.h b/target/arm/internals.h index 161e42d50f4..d9555309df0 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -257,6 +257,10 @@ unsigned int arm_pamax(ARMCPU *cpu); static inline bool extended_addresses_enabled(CPUARMState *env) { uint64_t tcr = env->cp15.tcr_el[arm_is_secure(env) ? 3 : 1]; + if (arm_feature(env, ARM_FEATURE_PMSA) && + arm_feature(env, ARM_FEATURE_V8)) { + return true; + } return arm_el_is_aa64(env, 1) || (arm_feature(env, ARM_FEATURE_LPAE) && (tcr & TTBCR_EAE)); } diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index c21739242c5..2f6ddc0da57 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -437,6 +437,9 @@ static uint32_t arm_debug_exception_fsr(CPUARMState *env) if (target_el == 2 || arm_el_is_aa64(env, target_el)) { using_lpae = true; + } else if (arm_feature(env, ARM_FEATURE_PMSA) && + arm_feature(env, ARM_FEATURE_V8)) { + using_lpae = true; } else { if (arm_feature(env, ARM_FEATURE_LPAE) && (env->cp15.tcr_el[target_el] & TTBCR_EAE)) { diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c index 0f4f4fc8094..60abcbebe64 100644 --- a/target/arm/tlb_helper.c +++ b/target/arm/tlb_helper.c @@ -19,6 +19,10 @@ bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx) if (el == 2 || arm_el_is_aa64(env, el)) { return true; } + if (arm_feature(env, ARM_FEATURE_PMSA) && + arm_feature(env, ARM_FEATURE_V8)) { + return true; + } if (arm_feature(env, ARM_FEATURE_LPAE) && (regime_tcr(env, mmu_idx) & TTBCR_EAE)) { return true; From patchwork Thu Jan 5 16:43:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639314 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp340906pvb; Thu, 5 Jan 2023 09:28:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXsK9VbjWSTibI7pL16HM/VkMv9rk4mdg6/BJIQHOk85h+Mo1cgx3bFNYNY6scJJTw4OTGmx X-Received: by 2002:ac8:6b82:0:b0:39c:efc8:b2a8 with SMTP id z2-20020ac86b82000000b0039cefc8b2a8mr82242485qts.27.1672939694244; Thu, 05 Jan 2023 09:28:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939694; cv=none; d=google.com; s=arc-20160816; b=Iot0Ed3tOe4YFKaeURv/wEg+X/AH2RWu/nHg+gZ8AQESu2NThL54fKbneBN0oMUTpJ Baozr0NOzSHx2Fey1ApZJPMGl/ATVsm5bn0R6V407UVasLwDPw+Z3jiNONMVBETETvSU ZSmSgW4R1Q03PufuPdmNEy1Ben4BmssUKQnzw9DeamLwm4PU27iraG9qQZFqmfZZiisq LsXLakR4FD3lXhv/fdTZzgLWpk/HW9/eLZCaoEtJ95MdnZ9hv5NtowDCRevYBvMUF9BO wR4Chuwk4R6dn0M/EzaohIRs+JSK0VNw498SJyGms3XuCYbAaZnKgcIbVOZQBU8MKq77 GHnw== 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=/+yy8hrXR7W8CC89aup3gLLcA2qa4yC8gAslmEHdnXE=; b=Q3KyzLnyExHIyAR3ownx0ntpmhKUoCgWvBWxarpvULu7RlgCerjKj4l5aT03hFfXgv 2uEZqBeVFWlSl9JetXxJA+v1TpiUtdRseZduQDkJWHWGWkIVmZslqWmBQ5ITk/PJEJ1g bwZzDyo1LEm5xwjAinSxhgfi8Ue3izo0u1G3UZEOdPvUijQAfCyTkskC0NGdM4aqRKUS a4NKEaFgRxYTMoEFjf/QU6+FrXQSXv4bB0TaplychM8d4bcMCPtXz5Ri7xDV808usMym QIqzRYtsYVSbsZqQt2w7tPf9FaexnnFfC8xfBiZ3pTDbxeDQhJRKffWJGBmWUztamB1w /aUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k7pJT1ES; 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 cf16-20020a05622a401000b00397a47f88e4si20099787qtb.783.2023.01.05.09.28.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:28:14 -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=k7pJT1ES; 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 1pDTM1-0000Z3-FM; Thu, 05 Jan 2023 11:44: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 1pDTLw-0000S8-E4 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:28 -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 1pDTLt-0007Mj-QC for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:28 -0500 Received: by mail-wm1-x335.google.com with SMTP id g10so14660828wmo.1 for ; Thu, 05 Jan 2023 08:44:25 -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=/+yy8hrXR7W8CC89aup3gLLcA2qa4yC8gAslmEHdnXE=; b=k7pJT1ESY39CpKZyRqhHGTks/E2MNfgoE2q53HlzQ21hS2+KR+KL8hZgVPV+cqgSsh HprP8PAYEWZpCSYgtG0KWvQf1iCN/e1YU0mEiIYglErUuI340J3+hMkxn1QMti2oEfkF SswD6VsZV1AsL86ce6R/GNgshMhafi1ONQ+nUsbc/VXQQaue5BdUArZuYiRUT0JQUipD 3Sa/2nPhUaVE+4KQxDHPlgfdmCuYxvRJLmv6h1SCJhCWnqT7nXbXcY98Cl0Uq7Gf28eR bYNs3YKBIoNkPzz2+1bOA+YGbUnH3u7zLqEDeiafNnNo++9ZaP06T35XJdi0QhE9Vgv4 RRNw== 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=/+yy8hrXR7W8CC89aup3gLLcA2qa4yC8gAslmEHdnXE=; b=ekKOlQHBDFqPtlkFdl/lULb8zB6s4kz21PN4y7nfI6EOgLVu3YRjv8wP731XPAHWev qwqhcbzYYLYkK+gByaYnWLNpkHHtkgBt7Km0BgWcg62xv96qEgog0HEUEYp7MKz31z0l bkE1buuyE/lhM/6b3XcK/le2veipTgI1n6MipwZ17NTGjw12UusczBmitpBNSyMIVxuc PaRm3vbxOj3K1uHN3XZIB/cDr42cT5merQv50EZX1AA+SK2ExeJl0Fl7UINu0t1hVsqg tc3hCVtRHcIcHTHL33fmqxBdpSnO9eIv6x4lXs7HFgVtsMO9DdX/VzGORjB56BSkGClM 69xw== X-Gm-Message-State: AFqh2krJxAZ5ZvfGoSpXqxZWJcgwezGSElZCQM9ZJByABOC4PTOGhxYw xSKKgUAK8N2K8n+3nRdSWzlJ7xSq9bo+FxEP X-Received: by 2002:a05:600c:3844:b0:3d2:191d:2420 with SMTP id s4-20020a05600c384400b003d2191d2420mr37826502wmr.7.1672937064423; Thu, 05 Jan 2023 08:44:24 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:23 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/34] target/arm: Add PMSAv8r registers Date: Thu, 5 Jan 2023 16:43:49 +0000 Message-Id: <20230105164417.3994639-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Tobias Röhmel Signed-off-by: Tobias Röhmel Message-id: 20221206102504.165775-6-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/cpu.h | 6 + target/arm/cpu.c | 28 +++- target/arm/helper.c | 302 +++++++++++++++++++++++++++++++++++++++++++ target/arm/machine.c | 28 ++++ 4 files changed, 360 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2b4bd20f9d0..bf2bce046d5 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -309,6 +309,7 @@ typedef struct CPUArchState { }; uint64_t sctlr_el[4]; }; + uint64_t vsctlr; /* Virtualization System control register. */ uint64_t cpacr_el1; /* Architectural feature access control register */ uint64_t cptr_el[4]; /* ARMv8 feature trap registers */ uint32_t c1_xscaleauxcr; /* XScale auxiliary control register. */ @@ -745,8 +746,11 @@ typedef struct CPUArchState { */ uint32_t *rbar[M_REG_NUM_BANKS]; uint32_t *rlar[M_REG_NUM_BANKS]; + uint32_t *hprbar; + uint32_t *hprlar; uint32_t mair0[M_REG_NUM_BANKS]; uint32_t mair1[M_REG_NUM_BANKS]; + uint32_t hprselr; } pmsav8; /* v8M SAU */ @@ -906,6 +910,8 @@ struct ArchCPU { bool has_mpu; /* PMSAv7 MPU number of supported regions */ uint32_t pmsav7_dregion; + /* PMSAv8 MPU number of supported hyp regions */ + uint32_t pmsav8r_hdregion; /* v8M SAU number of supported regions */ uint32_t sau_sregion; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index c107cbd7574..f99f749b295 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -491,6 +491,14 @@ static void arm_cpu_reset_hold(Object *obj) sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion); } } + + if (cpu->pmsav8r_hdregion > 0) { + memset(env->pmsav8.hprbar, 0, + sizeof(*env->pmsav8.hprbar) * cpu->pmsav8r_hdregion); + memset(env->pmsav8.hprlar, 0, + sizeof(*env->pmsav8.hprlar) * cpu->pmsav8r_hdregion); + } + env->pmsav7.rnr[M_REG_NS] = 0; env->pmsav7.rnr[M_REG_S] = 0; env->pmsav8.mair0[M_REG_NS] = 0; @@ -2002,11 +2010,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) /* MPU can be configured out of a PMSA CPU either by setting has-mpu * to false or by setting pmsav7-dregion to 0. */ - if (!cpu->has_mpu) { - cpu->pmsav7_dregion = 0; - } - if (cpu->pmsav7_dregion == 0) { + if (!cpu->has_mpu || cpu->pmsav7_dregion == 0) { cpu->has_mpu = false; + cpu->pmsav7_dregion = 0; + cpu->pmsav8r_hdregion = 0; } if (arm_feature(env, ARM_FEATURE_PMSA) && @@ -2033,6 +2040,19 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) env->pmsav7.dracr = g_new0(uint32_t, nr); } } + + if (cpu->pmsav8r_hdregion > 0xff) { + error_setg(errp, "PMSAv8 MPU EL2 #regions invalid %" PRIu32, + cpu->pmsav8r_hdregion); + return; + } + + if (cpu->pmsav8r_hdregion) { + env->pmsav8.hprbar = g_new0(uint32_t, + cpu->pmsav8r_hdregion); + env->pmsav8.hprlar = g_new0(uint32_t, + cpu->pmsav8r_hdregion); + } } if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { diff --git a/target/arm/helper.c b/target/arm/helper.c index d8066fe97d3..b13f6ff328c 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3682,6 +3682,222 @@ static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri, raw_write(env, ri, value); } +static void prbar_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + + tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ + env->pmsav8.rbar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]] = value; +} + +static uint64_t prbar_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return env->pmsav8.rbar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]]; +} + +static void prlar_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + + tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ + env->pmsav8.rlar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]] = value; +} + +static uint64_t prlar_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return env->pmsav8.rlar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]]; +} + +static void prselr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + + /* + * Ignore writes that would select not implemented region. + * This is architecturally UNPREDICTABLE. + */ + if (value >= cpu->pmsav7_dregion) { + return; + } + + env->pmsav7.rnr[M_REG_NS] = value; +} + +static void hprbar_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + + tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ + env->pmsav8.hprbar[env->pmsav8.hprselr] = value; +} + +static uint64_t hprbar_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return env->pmsav8.hprbar[env->pmsav8.hprselr]; +} + +static void hprlar_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + + tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ + env->pmsav8.hprlar[env->pmsav8.hprselr] = value; +} + +static uint64_t hprlar_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return env->pmsav8.hprlar[env->pmsav8.hprselr]; +} + +static void hprenr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + uint32_t n; + uint32_t bit; + ARMCPU *cpu = env_archcpu(env); + + /* Ignore writes to unimplemented regions */ + int rmax = MIN(cpu->pmsav8r_hdregion, 32); + value &= MAKE_64BIT_MASK(0, rmax); + + tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ + + /* Register alias is only valid for first 32 indexes */ + for (n = 0; n < rmax; ++n) { + bit = extract32(value, n, 1); + env->pmsav8.hprlar[n] = deposit32( + env->pmsav8.hprlar[n], 0, 1, bit); + } +} + +static uint64_t hprenr_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + uint32_t n; + uint32_t result = 0x0; + ARMCPU *cpu = env_archcpu(env); + + /* Register alias is only valid for first 32 indexes */ + for (n = 0; n < MIN(cpu->pmsav8r_hdregion, 32); ++n) { + if (env->pmsav8.hprlar[n] & 0x1) { + result |= (0x1 << n); + } + } + return result; +} + +static void hprselr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + + /* + * Ignore writes that would select not implemented region. + * This is architecturally UNPREDICTABLE. + */ + if (value >= cpu->pmsav8r_hdregion) { + return; + } + + env->pmsav8.hprselr = value; +} + +static void pmsav8r_regn_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + ARMCPU *cpu = env_archcpu(env); + uint8_t index = (extract32(ri->opc0, 0, 1) << 4) | + (extract32(ri->crm, 0, 3) << 1) | extract32(ri->opc2, 2, 1); + + tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ + + if (ri->opc1 & 4) { + if (index >= cpu->pmsav8r_hdregion) { + return; + } + if (ri->opc2 & 0x1) { + env->pmsav8.hprlar[index] = value; + } else { + env->pmsav8.hprbar[index] = value; + } + } else { + if (index >= cpu->pmsav7_dregion) { + return; + } + if (ri->opc2 & 0x1) { + env->pmsav8.rlar[M_REG_NS][index] = value; + } else { + env->pmsav8.rbar[M_REG_NS][index] = value; + } + } +} + +static uint64_t pmsav8r_regn_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + ARMCPU *cpu = env_archcpu(env); + uint8_t index = (extract32(ri->opc0, 0, 1) << 4) | + (extract32(ri->crm, 0, 3) << 1) | extract32(ri->opc2, 2, 1); + + if (ri->opc1 & 4) { + if (index >= cpu->pmsav8r_hdregion) { + return 0x0; + } + if (ri->opc2 & 0x1) { + return env->pmsav8.hprlar[index]; + } else { + return env->pmsav8.hprbar[index]; + } + } else { + if (index >= cpu->pmsav7_dregion) { + return 0x0; + } + if (ri->opc2 & 0x1) { + return env->pmsav8.rlar[M_REG_NS][index]; + } else { + return env->pmsav8.rbar[M_REG_NS][index]; + } + } +} + +static const ARMCPRegInfo pmsav8r_cp_reginfo[] = { + { .name = "PRBAR", + .cp = 15, .opc1 = 0, .crn = 6, .crm = 3, .opc2 = 0, + .access = PL1_RW, .type = ARM_CP_NO_RAW, + .accessfn = access_tvm_trvm, + .readfn = prbar_read, .writefn = prbar_write }, + { .name = "PRLAR", + .cp = 15, .opc1 = 0, .crn = 6, .crm = 3, .opc2 = 1, + .access = PL1_RW, .type = ARM_CP_NO_RAW, + .accessfn = access_tvm_trvm, + .readfn = prlar_read, .writefn = prlar_write }, + { .name = "PRSELR", .resetvalue = 0, + .cp = 15, .opc1 = 0, .crn = 6, .crm = 2, .opc2 = 1, + .access = PL1_RW, .accessfn = access_tvm_trvm, + .writefn = prselr_write, + .fieldoffset = offsetof(CPUARMState, pmsav7.rnr[M_REG_NS]) }, + { .name = "HPRBAR", .resetvalue = 0, + .cp = 15, .opc1 = 4, .crn = 6, .crm = 3, .opc2 = 0, + .access = PL2_RW, .type = ARM_CP_NO_RAW, + .readfn = hprbar_read, .writefn = hprbar_write }, + { .name = "HPRLAR", + .cp = 15, .opc1 = 4, .crn = 6, .crm = 3, .opc2 = 1, + .access = PL2_RW, .type = ARM_CP_NO_RAW, + .readfn = hprlar_read, .writefn = hprlar_write }, + { .name = "HPRSELR", .resetvalue = 0, + .cp = 15, .opc1 = 4, .crn = 6, .crm = 2, .opc2 = 1, + .access = PL2_RW, + .writefn = hprselr_write, + .fieldoffset = offsetof(CPUARMState, pmsav8.hprselr) }, + { .name = "HPRENR", + .cp = 15, .opc1 = 4, .crn = 6, .crm = 1, .opc2 = 1, + .access = PL2_RW, .type = ARM_CP_NO_RAW, + .readfn = hprenr_read, .writefn = hprenr_write }, +}; + static const ARMCPRegInfo pmsav7_cp_reginfo[] = { /* Reset for all these registers is handled in arm_cpu_reset(), * because the PMSAv7 is also used by M-profile CPUs, which do @@ -8207,6 +8423,13 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = cpu->pmsav7_dregion << 8 }; + /* HMPUIR is specific to PMSA V8 */ + ARMCPRegInfo id_hmpuir_reginfo = { + .name = "HMPUIR", + .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 4, + .access = PL2_R, .type = ARM_CP_CONST, + .resetvalue = cpu->pmsav8r_hdregion + }; static const ARMCPRegInfo crn0_wi_reginfo = { .name = "CRN0_WI", .cp = 15, .crn = 0, .crm = CP_ANY, .opc1 = CP_ANY, .opc2 = CP_ANY, .access = PL1_W, @@ -8249,6 +8472,74 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_arm_cp_regs(cpu, id_cp_reginfo); if (!arm_feature(env, ARM_FEATURE_PMSA)) { define_one_arm_cp_reg(cpu, &id_tlbtr_reginfo); + } else if (arm_feature(env, ARM_FEATURE_PMSA) && + arm_feature(env, ARM_FEATURE_V8)) { + uint32_t i = 0; + char *tmp_string; + + define_one_arm_cp_reg(cpu, &id_mpuir_reginfo); + define_one_arm_cp_reg(cpu, &id_hmpuir_reginfo); + define_arm_cp_regs(cpu, pmsav8r_cp_reginfo); + + /* Register alias is only valid for first 32 indexes */ + for (i = 0; i < MIN(cpu->pmsav7_dregion, 32); ++i) { + uint8_t crm = 0b1000 | extract32(i, 1, 3); + uint8_t opc1 = extract32(i, 4, 1); + uint8_t opc2 = extract32(i, 0, 1) << 2; + + tmp_string = g_strdup_printf("PRBAR%u", i); + ARMCPRegInfo tmp_prbarn_reginfo = { + .name = tmp_string, .type = ARM_CP_ALIAS | ARM_CP_NO_RAW, + .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2, + .access = PL1_RW, .resetvalue = 0, + .accessfn = access_tvm_trvm, + .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read + }; + define_one_arm_cp_reg(cpu, &tmp_prbarn_reginfo); + g_free(tmp_string); + + opc2 = extract32(i, 0, 1) << 2 | 0x1; + tmp_string = g_strdup_printf("PRLAR%u", i); + ARMCPRegInfo tmp_prlarn_reginfo = { + .name = tmp_string, .type = ARM_CP_ALIAS | ARM_CP_NO_RAW, + .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2, + .access = PL1_RW, .resetvalue = 0, + .accessfn = access_tvm_trvm, + .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read + }; + define_one_arm_cp_reg(cpu, &tmp_prlarn_reginfo); + g_free(tmp_string); + } + + /* Register alias is only valid for first 32 indexes */ + for (i = 0; i < MIN(cpu->pmsav8r_hdregion, 32); ++i) { + uint8_t crm = 0b1000 | extract32(i, 1, 3); + uint8_t opc1 = 0b100 | extract32(i, 4, 1); + uint8_t opc2 = extract32(i, 0, 1) << 2; + + tmp_string = g_strdup_printf("HPRBAR%u", i); + ARMCPRegInfo tmp_hprbarn_reginfo = { + .name = tmp_string, + .type = ARM_CP_NO_RAW, + .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2, + .access = PL2_RW, .resetvalue = 0, + .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read + }; + define_one_arm_cp_reg(cpu, &tmp_hprbarn_reginfo); + g_free(tmp_string); + + opc2 = extract32(i, 0, 1) << 2 | 0x1; + tmp_string = g_strdup_printf("HPRLAR%u", i); + ARMCPRegInfo tmp_hprlarn_reginfo = { + .name = tmp_string, + .type = ARM_CP_NO_RAW, + .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2, + .access = PL2_RW, .resetvalue = 0, + .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read + }; + define_one_arm_cp_reg(cpu, &tmp_hprlarn_reginfo); + g_free(tmp_string); + } } else if (arm_feature(env, ARM_FEATURE_V7)) { define_one_arm_cp_reg(cpu, &id_mpuir_reginfo); } @@ -8370,6 +8661,17 @@ void register_cp_regs_for_features(ARMCPU *cpu) sctlr.type |= ARM_CP_SUPPRESS_TB_END; } define_one_arm_cp_reg(cpu, &sctlr); + + if (arm_feature(env, ARM_FEATURE_PMSA) && + arm_feature(env, ARM_FEATURE_V8)) { + ARMCPRegInfo vsctlr = { + .name = "VSCTLR", .state = ARM_CP_STATE_AA32, + .cp = 15, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0, + .access = PL2_RW, .resetvalue = 0x0, + .fieldoffset = offsetoflow32(CPUARMState, cp15.vsctlr), + }; + define_one_arm_cp_reg(cpu, &vsctlr); + } } if (cpu_isar_feature(aa64_lor, cpu)) { diff --git a/target/arm/machine.c b/target/arm/machine.c index 54c5c62433d..5f261526525 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -487,6 +487,30 @@ static bool pmsav8_needed(void *opaque) arm_feature(env, ARM_FEATURE_V8); } +static bool pmsav8r_needed(void *opaque) +{ + ARMCPU *cpu = opaque; + CPUARMState *env = &cpu->env; + + return arm_feature(env, ARM_FEATURE_PMSA) && + arm_feature(env, ARM_FEATURE_V8) && + !arm_feature(env, ARM_FEATURE_M); +} + +static const VMStateDescription vmstate_pmsav8r = { + .name = "cpu/pmsav8/pmsav8r", + .version_id = 1, + .minimum_version_id = 1, + .needed = pmsav8r_needed, + .fields = (VMStateField[]) { + VMSTATE_VARRAY_UINT32(env.pmsav8.hprbar, ARMCPU, + pmsav8r_hdregion, 0, vmstate_info_uint32, uint32_t), + VMSTATE_VARRAY_UINT32(env.pmsav8.hprlar, ARMCPU, + pmsav8r_hdregion, 0, vmstate_info_uint32, uint32_t), + VMSTATE_END_OF_LIST() + }, +}; + static const VMStateDescription vmstate_pmsav8 = { .name = "cpu/pmsav8", .version_id = 1, @@ -500,6 +524,10 @@ static const VMStateDescription vmstate_pmsav8 = { VMSTATE_UINT32(env.pmsav8.mair0[M_REG_NS], ARMCPU), VMSTATE_UINT32(env.pmsav8.mair1[M_REG_NS], ARMCPU), VMSTATE_END_OF_LIST() + }, + .subsections = (const VMStateDescription * []) { + &vmstate_pmsav8r, + NULL } }; From patchwork Thu Jan 5 16:43:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639294 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp329292pvb; Thu, 5 Jan 2023 09:04:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXswLYlahONes6kvBivCPK7wWx0KC3yttaEs96waS247ULIB+k6tNm8/bGiq4UaFHLXnW3Ie X-Received: by 2002:a05:7500:3110:b0:f0:2a85:d291 with SMTP id bg16-20020a057500311000b000f02a85d291mr261935gab.45.1672938248791; Thu, 05 Jan 2023 09:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938248; cv=none; d=google.com; s=arc-20160816; b=LYf1kbYyvM/GGbqwU+DBCqp4Z21WedYenlnRMdwD9gfhru2mLk6wJu6OAcuS73iHWa pREQagZ1EtuXhTma3/0cjxWRtOlaIR+ZQO8AnMlVY/6bYa2KS1bitecSpRrE/5JkQDja wNHccGyjwrNXNUJL/unGjDGoa6aK6fP4zOKRyYClw8y8iBq8QaXBGtP5TKCWOdNEytUx xXvhs2QcaOcxAmmuKGUFFRDgukeseKcl0BpCJQn9GWGvtqo4x68yV2mnrT9E2NvWCbYL wkWbSuPdkvFM94uJr0J2PWg8Wv/hskb3IEIKkTy8/4Osu2w7Spk3b1iTT+FrkoNx1+Ba AFlg== 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=2hpQCTC8nGWhTVif5Vc0Cni0nOiQ1N1H86BSl5lGHtY=; b=laX4+5WkUjARxz62wajYHDxgjdLpuOcYvfN56lRCY4p7FvMQOeHs+zYRKl0n0fpS3I N+5V3rDe5rr2OkAFn8EPiFXluaBvSg4nPiPLr2OR3L9tY4DM6gtDl/dvrPMjd736T3qi ZXkwoNW7v5zwsXLtxGr2HwcamvA8RdJvgAmKfURIGe9meuGelQQ1wPtzIv4lincxubuR MApdA8H7n8fIXNiLJRtBWzDyjasvpL/TifJekBQhPgrdVoWLD9tWXjzymD5j88+f3m+X ZemtVddD9je7Q2mpATeqcw7m+jPJahA0ls7W4E7uZSEo80my2WjacyiruqQahk8LreDL RauQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vm33gnUL; 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 o4-20020a05620a228400b006fc5ded6d1esi18077309qkh.325.2023.01.05.09.04.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:04: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=Vm33gnUL; 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 1pDTLz-0000WB-QI; Thu, 05 Jan 2023 11:44: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 1pDTLy-0000Sr-GW for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:30 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLu-0007My-G5 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:28 -0500 Received: by mail-wm1-x330.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso2535013wmb.1 for ; Thu, 05 Jan 2023 08:44:26 -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=2hpQCTC8nGWhTVif5Vc0Cni0nOiQ1N1H86BSl5lGHtY=; b=Vm33gnULgSEbiU7G7P3KP/PiqYRBgKnQpK4MGLC9BNviCe2V2H/olJUXsfnGUZK4tH 9jL5MX7rzZcxlnZG+0tOcODXdIZc5SpZb4211ewev17Tsl+clWPiMgvigRvEZfFdj/g3 54YfFkJLRlgfwTyhbc7OoUkdGBYh81/eNVbwBRViLKojQkxNmFLwLFt8s1lCapZZSGvx FbgjpaKqJFrdXC8X4MrHFp4I5ZTWrRjKibXfoz0ZHkMBhx087+J7eJXo7QAmfEOv0XS6 p5gP4zQS9DN+TSdo7NsUwjzyRfKLumHHEqSQ++wpz7DTjyRTB+HG2nMfe9eqos2PYG/S KqjQ== 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=2hpQCTC8nGWhTVif5Vc0Cni0nOiQ1N1H86BSl5lGHtY=; b=YEKwgtQ90H/iTqxq/HkNPDhBwQE9cqVEIKOocFfDjkKGMIsz3aWCpfR9BTXd9out4Q l2iucxXQ6vY0zeQTHWgUZCLsTycdfhNPp6ep4pMFkHxcW14NYdNR58VDdbm5990esdYX w7+f1G54O4okRVAJIxUql3D6jsOi+HMFHViM1O+jRWzZuyyGJjHj2+xyeEgt2wy4c94l OaYJIWpOMiVxemNIoTuOnRUsees0Gsa9cBIWmB13TB+xUO1QS0FvRiJ1q2mMmrV5Bxc7 O2rV5a/us2ueRXS7s5z0JKy76ZckWVYANoGEtaLeH5w2wAC1JCfs9CF2SgEgOZ8bVyRw nGFA== X-Gm-Message-State: AFqh2krIyl40s9PK0GrtXLwJwbMO9pvGXyCTKSS8LYfZIdK7N5QX/mzy EvTGMjXFs1e1TyTVJrELBUVntYrnPppkIqxu X-Received: by 2002:a05:600c:c06:b0:3d9:7065:5b9c with SMTP id fm6-20020a05600c0c0600b003d970655b9cmr31602205wmb.6.1672937065188; Thu, 05 Jan 2023 08:44:25 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:24 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/34] target/arm: Add PMSAv8r functionality Date: Thu, 5 Jan 2023 16:43:50 +0000 Message-Id: <20230105164417.3994639-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: Tobias Röhmel Add PMSAv8r translation. Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Message-id: 20221206102504.165775-7-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/ptw.c | 126 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 104 insertions(+), 22 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 1c7c9cb5e37..4bda0590c7c 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1758,9 +1758,13 @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, if (arm_feature(env, ARM_FEATURE_M)) { return env->v7m.mpu_ctrl[is_secure] & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; - } else { - return regime_sctlr(env, mmu_idx) & SCTLR_BR; } + + if (mmu_idx == ARMMMUIdx_Stage2) { + return false; + } + + return regime_sctlr(env, mmu_idx) & SCTLR_BR; } static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, @@ -1952,6 +1956,26 @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, return !(result->f.prot & (1 << access_type)); } +static uint32_t *regime_rbar(CPUARMState *env, ARMMMUIdx mmu_idx, + uint32_t secure) +{ + if (regime_el(env, mmu_idx) == 2) { + return env->pmsav8.hprbar; + } else { + return env->pmsav8.rbar[secure]; + } +} + +static uint32_t *regime_rlar(CPUARMState *env, ARMMMUIdx mmu_idx, + uint32_t secure) +{ + if (regime_el(env, mmu_idx) == 2) { + return env->pmsav8.hprlar; + } else { + return env->pmsav8.rlar[secure]; + } +} + bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, MMUAccessType access_type, ARMMMUIdx mmu_idx, bool secure, GetPhysAddrResult *result, @@ -1974,6 +1998,13 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, bool hit = false; uint32_t addr_page_base = address & TARGET_PAGE_MASK; uint32_t addr_page_limit = addr_page_base + (TARGET_PAGE_SIZE - 1); + int region_counter; + + if (regime_el(env, mmu_idx) == 2) { + region_counter = cpu->pmsav8r_hdregion; + } else { + region_counter = cpu->pmsav7_dregion; + } result->f.lg_page_size = TARGET_PAGE_BITS; result->f.phys_addr = address; @@ -1982,6 +2013,10 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, *mregion = -1; } + if (mmu_idx == ARMMMUIdx_Stage2) { + fi->stage2 = true; + } + /* * Unlike the ARM ARM pseudocode, we don't need to check whether this * was an exception vector read from the vector table (which is always @@ -1998,17 +2033,26 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, hit = true; } - for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) { + uint32_t bitmask; + if (arm_feature(env, ARM_FEATURE_M)) { + bitmask = 0x1f; + } else { + bitmask = 0x3f; + fi->level = 0; + } + + for (n = region_counter - 1; n >= 0; n--) { /* region search */ /* - * Note that the base address is bits [31:5] from the register - * with bits [4:0] all zeroes, but the limit address is bits - * [31:5] from the register with bits [4:0] all ones. + * Note that the base address is bits [31:x] from the register + * with bits [x-1:0] all zeroes, but the limit address is bits + * [31:x] from the register with bits [x:0] all ones. Where x is + * 5 for Cortex-M and 6 for Cortex-R */ - uint32_t base = env->pmsav8.rbar[secure][n] & ~0x1f; - uint32_t limit = env->pmsav8.rlar[secure][n] | 0x1f; + uint32_t base = regime_rbar(env, mmu_idx, secure)[n] & ~bitmask; + uint32_t limit = regime_rlar(env, mmu_idx, secure)[n] | bitmask; - if (!(env->pmsav8.rlar[secure][n] & 0x1)) { + if (!(regime_rlar(env, mmu_idx, secure)[n] & 0x1)) { /* Region disabled */ continue; } @@ -2042,7 +2086,9 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, * PMSAv7 where highest-numbered-region wins) */ fi->type = ARMFault_Permission; - fi->level = 1; + if (arm_feature(env, ARM_FEATURE_M)) { + fi->level = 1; + } return true; } @@ -2052,8 +2098,11 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, } if (!hit) { - /* background fault */ - fi->type = ARMFault_Background; + if (arm_feature(env, ARM_FEATURE_M)) { + fi->type = ARMFault_Background; + } else { + fi->type = ARMFault_Permission; + } return true; } @@ -2061,12 +2110,14 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, /* hit using the background region */ get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->f.prot); } else { - uint32_t ap = extract32(env->pmsav8.rbar[secure][matchregion], 1, 2); - uint32_t xn = extract32(env->pmsav8.rbar[secure][matchregion], 0, 1); + uint32_t matched_rbar = regime_rbar(env, mmu_idx, secure)[matchregion]; + uint32_t matched_rlar = regime_rlar(env, mmu_idx, secure)[matchregion]; + uint32_t ap = extract32(matched_rbar, 1, 2); + uint32_t xn = extract32(matched_rbar, 0, 1); bool pxn = false; if (arm_feature(env, ARM_FEATURE_V8_1M)) { - pxn = extract32(env->pmsav8.rlar[secure][matchregion], 4, 1); + pxn = extract32(matched_rlar, 4, 1); } if (m_is_system_region(env, address)) { @@ -2074,21 +2125,46 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, xn = 1; } - result->f.prot = simple_ap_to_rw_prot(env, mmu_idx, ap); + if (regime_el(env, mmu_idx) == 2) { + result->f.prot = simple_ap_to_rw_prot_is_user(ap, + mmu_idx != ARMMMUIdx_E2); + } else { + result->f.prot = simple_ap_to_rw_prot(env, mmu_idx, ap); + } + + if (!arm_feature(env, ARM_FEATURE_M)) { + uint8_t attrindx = extract32(matched_rlar, 1, 3); + uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; + uint8_t sh = extract32(matched_rlar, 3, 2); + + if (regime_sctlr(env, mmu_idx) & SCTLR_WXN && + result->f.prot & PAGE_WRITE && mmu_idx != ARMMMUIdx_Stage2) { + xn = 0x1; + } + + if ((regime_el(env, mmu_idx) == 1) && + regime_sctlr(env, mmu_idx) & SCTLR_UWXN && ap == 0x1) { + pxn = 0x1; + } + + result->cacheattrs.is_s2_format = false; + result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); + result->cacheattrs.shareability = sh; + } + if (result->f.prot && !xn && !(pxn && !is_user)) { result->f.prot |= PAGE_EXEC; } - /* - * We don't need to look the attribute up in the MAIR0/MAIR1 - * registers because that only tells us about cacheability. - */ + if (mregion) { *mregion = matchregion; } } fi->type = ARMFault_Permission; - fi->level = 1; + if (arm_feature(env, ARM_FEATURE_M)) { + fi->level = 1; + } return !(result->f.prot & (1 << access_type)); } @@ -2649,7 +2725,13 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); - ret = get_phys_addr_lpae(env, ptw, ipa, access_type, is_el0, result, fi); + if (arm_feature(env, ARM_FEATURE_PMSA)) { + ret = get_phys_addr_pmsav8(env, ipa, access_type, + ptw->in_mmu_idx, is_secure, result, fi); + } else { + ret = get_phys_addr_lpae(env, ptw, ipa, access_type, + is_el0, result, fi); + } fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ From patchwork Thu Jan 5 16:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639307 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp335847pvb; Thu, 5 Jan 2023 09:16:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXtGAwesrXu0tzC1O1XMwawEiuiq215/pL/a8tCkZw1/WWR/ou13NKAhlOtDbFrPSSVac3QG X-Received: by 2002:a0c:e189:0:b0:4c7:5c88:dcbc with SMTP id p9-20020a0ce189000000b004c75c88dcbcmr69867379qvl.48.1672938979723; Thu, 05 Jan 2023 09:16:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938979; cv=none; d=google.com; s=arc-20160816; b=g9BMpQFyT+7Q8bxV84ExyhwjjfEJFjJhD6VJwFZCTyApimHeB/WZUnNbJrqqGZvAeF p54Sl4YXeL+660ZOqcjoumLJXmXTxHv3t+wN6xWp01/y8PstA+PpfY8WqJTdDw+YKhCj FDl368tljZ63oxz1m9/cmNYs+wIkKDHI4h2k+UUyujeBvMr88WhMiRIwbrTYsAAbA0Gz UfD9Ksn6lKW3MwyaqU66wfpRnQfytmKFT4ofb+T5PG4IHd0fjgJHwZ5Xm4pEiWhbyRrb 8tpgHxNAKOmg2VV5x+tT3mQRGWP1DndaFjguf0FR0XBqeI7aG+JdXCOOTMhqCRocUI3H HCSw== 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=ng4n7caOd1N7rKPRAQimra3XDjGA4Dk/t3YXksN0GKU=; b=qLiDrYvxkImj6stEKmolvMR/AqXTMJS6aY9iMR3RPbtId3MLkX4uMPBm5sd4MrcYhu OeosZf7uaKoZMSk2D0UIi0T+Ppk0zHKmrG3B2eH4704DL15PJuQmrg2Gl3lPUJF/3Z0x n1gmI2Z9ZQW6GjmPJupksCu5D5Dm8xYOuL1EcMvVnFxEc94Wpl5FMzxZq4GFsopdfeoq D3zykSWFN82io5ExyWWMa9j/+0QnhvaTSl4gDoickqN5ZWJdHadh/dykhMFx9Al5QYpr iQA25qvH4JUDQ8hQOOTAmVfIVJyiPljqBA9f1s0ae3dGIyGj50qGRfQH/kLJJVmNnI3m 08dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ps3q43Xh; 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 hr8-20020a05621423c800b004ad0f5cf00esi19852712qvb.117.2023.01.05.09.16.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:16: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=ps3q43Xh; 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 1pDTM0-0000Wr-5u; Thu, 05 Jan 2023 11:44: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 1pDTLy-0000Sv-IC for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:30 -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 1pDTLv-0007NS-9t for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:29 -0500 Received: by mail-wm1-x32a.google.com with SMTP id ay40so28486885wmb.2 for ; Thu, 05 Jan 2023 08:44:26 -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=ng4n7caOd1N7rKPRAQimra3XDjGA4Dk/t3YXksN0GKU=; b=ps3q43XhTsM6WIcrZTzz4bXFINYGUjaivSP07xcM/UCSeGOy57Ns1bcausVy40IJId W0yiiD0wwtBM8wwdTC/uGHlcT0xEqODzBea7bXFSRyhhY3BQda9v/Jz+43hYIra7ADxp AAVPgMwrnzj02oE0e5q4SSq9I+z3OPXkT8DCntjzK+y+yJ5Yj5ikpgBg7kO9jJa4TvSD BM73vsbSLZv6J95Jfr1p+ZuLc75JdlhdHX/YuRgWCr3LxMMuKEhyiqMFRR35sZFTLTXb VBYRnPuo7ZJ7Fr583Mv4hK8Q3QPr4cu9aRhGRFlMqX+33Cvi8/kRcnLkBM6KbLICtfho 5lcw== 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=ng4n7caOd1N7rKPRAQimra3XDjGA4Dk/t3YXksN0GKU=; b=mMx/M3cohBRt1jkbepj1nfyuujax4jdr5nyKM/9g88WFCygRhzKQu7icFmjQCK9y40 Pg1+PPrXIumRbat42lkznRhIpfpOUkuHWEXWuA/+gZltKOmhkeoLMieoZa7y2LmF38ET bocAI0dH7Nj0BlBEePckqZ1kksYUVW9vSeh9F4KHwqzrCCSsv3PlWdiKqaU+xKs7d+Bw om2IP7b7Vw7eYBYVBnqGxVOV6hRotp9mXWo6bgeoPyQySQ8sHSDc8vxWknjOLgVycMdd LsqqjTJHLKAZHhJ6bLcMkxMK7d+Uni2Cz2Vcl5nBHFlwXFQ3ogEeEpaCVv1U4xoDD33A kImA== X-Gm-Message-State: AFqh2krvLC13dvOQLTxRefRxh2cJZyNq9ye5jo9EaQyZ6z71tQjDDqaT AKrXujgr6c8cI4fwV7ndPIVGOBv8sknE/pBK X-Received: by 2002:a05:600c:4191:b0:3d7:9ae7:e4f2 with SMTP id p17-20020a05600c419100b003d79ae7e4f2mr38940905wmh.35.1672937066045; Thu, 05 Jan 2023 08:44:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/34] target/arm: Add ARM Cortex-R52 CPU Date: Thu, 5 Jan 2023 16:43:51 +0000 Message-Id: <20230105164417.3994639-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Tobias Röhmel All constants are taken from the ARM Cortex-R52 Processor TRM Revision: r1p3 Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Message-id: 20221206102504.165775-8-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 568cbcfc524..ccde5080eb7 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -854,6 +854,47 @@ static void cortex_r5_initfn(Object *obj) define_arm_cp_regs(cpu, cortexr5_cp_reginfo); } +static void cortex_r52_initfn(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + + set_feature(&cpu->env, ARM_FEATURE_V8); + set_feature(&cpu->env, ARM_FEATURE_EL2); + set_feature(&cpu->env, ARM_FEATURE_PMSA); + set_feature(&cpu->env, ARM_FEATURE_NEON); + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); + cpu->midr = 0x411fd133; /* r1p3 */ + cpu->revidr = 0x00000000; + cpu->reset_fpsid = 0x41034023; + cpu->isar.mvfr0 = 0x10110222; + cpu->isar.mvfr1 = 0x12111111; + cpu->isar.mvfr2 = 0x00000043; + cpu->ctr = 0x8144c004; + cpu->reset_sctlr = 0x30c50838; + cpu->isar.id_pfr0 = 0x00000131; + cpu->isar.id_pfr1 = 0x10111001; + cpu->isar.id_dfr0 = 0x03010006; + cpu->id_afr0 = 0x00000000; + cpu->isar.id_mmfr0 = 0x00211040; + cpu->isar.id_mmfr1 = 0x40000000; + cpu->isar.id_mmfr2 = 0x01200000; + cpu->isar.id_mmfr3 = 0xf0102211; + cpu->isar.id_mmfr4 = 0x00000010; + cpu->isar.id_isar0 = 0x02101110; + cpu->isar.id_isar1 = 0x13112111; + cpu->isar.id_isar2 = 0x21232142; + cpu->isar.id_isar3 = 0x01112131; + cpu->isar.id_isar4 = 0x00010142; + cpu->isar.id_isar5 = 0x00010001; + cpu->isar.dbgdidr = 0x77168000; + cpu->clidr = (1 << 27) | (1 << 24) | 0x3; + cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */ + cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */ + + cpu->pmsav7_dregion = 16; + cpu->pmsav8r_hdregion = 16; +} + static void cortex_r5f_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); @@ -1163,6 +1204,7 @@ static const ARMCPUInfo arm_tcg_cpus[] = { .class_init = arm_v7m_class_init }, { .name = "cortex-r5", .initfn = cortex_r5_initfn }, { .name = "cortex-r5f", .initfn = cortex_r5f_initfn }, + { .name = "cortex-r52", .initfn = cortex_r52_initfn }, { .name = "ti925t", .initfn = ti925t_initfn }, { .name = "sa1100", .initfn = sa1100_initfn }, { .name = "sa1110", .initfn = sa1110_initfn }, From patchwork Thu Jan 5 16:43: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: 639319 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp342004pvb; Thu, 5 Jan 2023 09:30:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXsbzYoi6pUEV86ubIJeyr9fMGH2DGeipCfiE6XBxjvhCNuo4psnjvz2TLWEdKDDJswTLmg0 X-Received: by 2002:ac8:534c:0:b0:3a9:8183:6a04 with SMTP id d12-20020ac8534c000000b003a981836a04mr83060216qto.54.1672939838463; Thu, 05 Jan 2023 09:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939838; cv=none; d=google.com; s=arc-20160816; b=hvSSdj1mJLPIkfFBbnQ3DN2kl+peZyJMXqtFiEBFcC5Sq8RAcRIYv5KXUptpnArauC ehfUx7JpMQGLzQyvikc/CrAmBMgwEjIM+D66G8eus4iFIDWDa8OEGdqzkPRnXBdaja9z H5F/Q+GSqAHMOBrz+Ud/ytMj/8BrtsvbIbiKRZ3NuFXXQUG4BaELIbdvtfuGxpEw+Efp ZQlSJzB7Egrtwy/bm9mtKLg8gF0xtLMztpXFtNAwd4f3fSc/gjruOZEi2txSwMBBc+As lNM+mtqj9uFjmyWoEfCRutYY7sDd+IgpMICnI0Hgn/tkUWBtFExvAAbseJmRCZqCZltx e1/w== 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=0ayPkdxL46XexnzpSXNyqqZUrm3nHdGW7BqfJTrIiyQ=; b=JaLhrEL97RrczgUWSYdzP8S8bXoXnz/h4MXlq3x0+1zNFgr4LxMNYDEgk+LpA+mjI/ dWeoMco/OHpOnZbO6G9NXNA9DU7QziyiGI852hAaugiJufQ6MPGF5KJjKD9k1YzAiAY0 P6CWOGNW4cVwHHDXhgbpcH9Cy9EhF/kTq4lD+9NQUSwVIHGgUifQEbK5MWctt7ELjOwM RW37whDRReB0ROD2mdJX4kNIlFJFkuLAYMYGE6Ch9G2k4pB4FA1D8Ocztu1whwaLKl2S wfmHR0dtRQ5S5AE10xXLbL4pRxEo89QOiBiHlRnQB5w6RqhHJa0e4yHzS8qaGAEvdagT UlsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z7NRP06D; 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 ew6-20020a05622a514600b003a584259797si20740194qtb.315.2023.01.05.09.30.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:30:38 -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=z7NRP06D; 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 1pDTM1-0000aH-P9; Thu, 05 Jan 2023 11:44: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 1pDTLz-0000Wc-WA for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:32 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLy-0007Nm-8o for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:31 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso1776475wms.5 for ; Thu, 05 Jan 2023 08:44:27 -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=0ayPkdxL46XexnzpSXNyqqZUrm3nHdGW7BqfJTrIiyQ=; b=z7NRP06DQkj+cy/2LKOW04y6z2BTqgon7pm4YonyqyR8qjV9Pv6fg3cgtTRCPysfSe hbHojJxu+TXBON9CYQCYAvCfN0V7X/F6EXMfFsSrVBu9YDqZOTLzPI2fxqGn3sIAp8bC Y8ez7CHYnpRdvxykgdXkAAyhDVPndYXTWISWIk5gPdQLlQJnpozCTNPqih2deY9VN1nr wsfCAjqM4wZX3RsG9Prnfnnhpk/NhhQsojSub47qTF7fKT4oZB4M1CAZOdEcKFJzuOQY LhzTRDiE5a3TryyksOLWJSW5beRahy0Tr5LoEOQ7JFzD9tzbrQYMxQP2D5vXlR08s0hy WwRA== 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=0ayPkdxL46XexnzpSXNyqqZUrm3nHdGW7BqfJTrIiyQ=; b=IVo9hbUtBv8jF8CgFtTqt7NGT+ZfeWg84L2LzI6NMRVQZ0rqRofMGhuwoDhqJa5nE3 vyisCCefo3Khe3TsWdXAu00RvaETrrWiLOr1NHZWpWwqW+DBKOW42q4kJlahPAyRxvQq y+ZnIXsSfSwKAfE2haKoDc4aj4KTa45hXkhjERTzTou06TWgUvvdq7o1dMDiicMLwn1I amUiJv3KhLXwWdthyjTqHMay8t1CHwVJSKjQA0FwgFAsMW/rm0U0WkFqUGHqJ+oyN5LU 9Rw6rpiTa8pEvn97yvpSahv4DcgJ7B0yl8ABhzs3Oseg9ysyv1z5IvQB1T/wEfFMf2zH GLCg== X-Gm-Message-State: AFqh2kqUULFb2/FOUdbAYnUz6OPvXQY+xy/B77kukrHpxvWH+aT7/u0l p75Wh0QHmpj0cP4ipPAQN1ivoNalqwa6EvZX X-Received: by 2002:a05:600c:a51:b0:3cf:6f4d:c259 with SMTP id c17-20020a05600c0a5100b003cf6f4dc259mr35900013wmq.39.1672937066800; Thu, 05 Jan 2023 08:44:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/34] target/arm: fix handling of HLT semihosting in system mode Date: Thu, 5 Jan 2023 16:43:52 +0000 Message-Id: <20230105164417.3994639-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Alex Bennée The check semihosting_enabled() wants to know if the guest is currently in user mode. Unlike the other cases the test was inverted causing us to block semihosting calls in non-EL0 modes. Cc: qemu-stable@nongnu.org Fixes: 19b26317e9 (target/arm: Honour -semihosting-config userspace=on) Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 74a903072fe..1dcaefb8e75 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1184,7 +1184,7 @@ static inline void gen_hlt(DisasContext *s, int imm) * semihosting, to provide some semblance of security * (and for consistency with our 32-bit semihosting). */ - if (semihosting_enabled(s->current_el != 0) && + if (semihosting_enabled(s->current_el == 0) && (imm == (s->thumb ? 0x3c : 0xf000))) { gen_exception_internal_insn(s, EXCP_SEMIHOST); return; From patchwork Thu Jan 5 16:43: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: 639273 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp321674pvb; Thu, 5 Jan 2023 08:46:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6FJICkJhD8uKCusxzzO5iT0hnWXKLTtw85+z8w0mwz6H+vhxk4SH0ttYToJlRlGxg8JLR X-Received: by 2002:a1f:5e0a:0:b0:3d5:d313:37c8 with SMTP id s10-20020a1f5e0a000000b003d5d31337c8mr6695598vkb.7.1672937202855; Thu, 05 Jan 2023 08:46:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937202; cv=none; d=google.com; s=arc-20160816; b=qtEw2smp5gc1kyyuedILQx602ojnSr8Kqi47p9HoyfHr23f8I4CajwByCvMp1fRIti T2jO7KhsSnA6nsYbAeur4zdynPI10NElPXz4pFo6aHQtC7HxjZeRnVdev7sW92Zg7TmK W2JM4ZMDI5mM4YNdX9awccLBnUC5c/CVb8z65hkwLfoLTTYFzk9vnUpjrwka/vquK36B 4SB+0Kx7tamK7xyLVqeDtRry+PHsPCGacouDRAOwjFA/U62BgjVXezJ/cq9yjgtFZm19 v6QnjQGyaYZajjpaR+lds1rZPhf086If0QBR1hljdcOLOuEscHvAV5DiPg9VsDn2TjVJ b1XQ== 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=5SjlNN0Q6eegKF4lgc+ItSkFv4TSnZq46y/byWdrbtE=; b=l7KVR50Ns91UNh1l2nwCFGyDKrqYx2sxqrUo/sO0deVmTUgyIVNLvQMNhy585/mMGT LT9pFafN5KErFSTLJHrIVUykAdPcRlP/SMHL/fTC7RD/nIZwNo6y+0NPOcaCti/Ml1Kt 5+JaklQp5liG4aVvcpYjoSGUQ95rSei8mzrAEqFU4OAgURw4UwzLrQe89VbeemGZHaVr xQPsqTmKEJyZKv0ghuXlmiQwvPC5sYsFqn6wz6cBHg5N5qU2chsNvuO+xp5Z4KIr8U5p FfIfDjVJZsd3P2cMocFcUPy6gStOOlL63PT5H+JhNqhPRfM5HBcwubRjxlf+F9Pilaxn Vuqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tQr6otgF; 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 x1-20020ac85381000000b003a7eb78866asi19599723qtp.88.2023.01.05.08.46.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:46: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=tQr6otgF; 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 1pDTMJ-0000oi-OK; Thu, 05 Jan 2023 11:44:52 -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 1pDTM1-0000Yu-8l for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -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 1pDTLy-0007Nx-8k for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:32 -0500 Received: by mail-wm1-x32e.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso1776511wms.5 for ; Thu, 05 Jan 2023 08:44:28 -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=5SjlNN0Q6eegKF4lgc+ItSkFv4TSnZq46y/byWdrbtE=; b=tQr6otgFj0AWru8PBTY4y30StmfEOHh96EWjLbCDssCaBlDpgRZYu/JCj3QO/BSL/u m14DlXT/5cJU6f8mq+inVy+u+RJPzOitktj9v3xv0JDVw/CZLYqpH8JAz2wlBxMYJmAn 1t0TvSojs8Nyxqi2xMRWhljFip/fOE42KhhRWBtCsUAS8BKYMUzrEj4Wh2sQKRb3o2tN Ixm8AgfaBXzqlXRol/MnHM7eWDkRyOPaWv+V8SZPYp5nCuYOQaaT5KHHOAgqITH5N8WR ehNaGObHYkZ2ETPNXzLSUhpbu+jOZrwRUwiV2aQ+2kjvZVtUDtkCgVL9kIibSy0oWIY/ KUrg== 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=5SjlNN0Q6eegKF4lgc+ItSkFv4TSnZq46y/byWdrbtE=; b=6wwQgSNe9tvrdidPdVb9zxVkQuw+WV4g3p3cmmU2KSvjLrqqENYQmWeEVRyLyUsgGW tGF0p58sgjvAKBtugAdFSvK3WVDFXMZnGcARWN3ijSHvyXAdxvF4XlIct+9iy8l9al+R /dblCRPNILpQ/jl3S1RoieHWV3rmQ/3fCgNlH9AfL6EAZGDNZplHrZzAQg3cj5uOUbE1 VHjUeaGdqKbmc2k10acXqBbPZOGbctMp06ykhzpF3ZYXX9+ZPq5s51IIQSd3ijhJUrYo oduf4BiwSpqMML7qcCNVzRUZuQumqraXQ+YtYlyAgkJgrfXOJUzNXgOAFpnadUmJX8/L W/fw== X-Gm-Message-State: AFqh2koQ0WcgNgCx4a7hubUtLKKlHH8c5PYjO6GldUP95a58rt8L2vpd VW25ECc6JZxIuY0lUmklJsSLiGK+gRJBkXYA X-Received: by 2002:a05:600c:3493:b0:3d2:370b:97f4 with SMTP id a19-20020a05600c349300b003d2370b97f4mr41176082wmq.16.1672937067542; Thu, 05 Jan 2023 08:44:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/34] hw/timer/imx_epit: improve comments Date: Thu, 5 Jan 2023 16:43:53 +0000 Message-Id: <20230105164417.3994639-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Axel Heider Fix typos, add background information Signed-off-by: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/imx_epit.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index ec0fa440d72..2841fbaa1c8 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -96,13 +96,14 @@ static void imx_epit_set_freq(IMXEPITState *s) } } +/* + * This is called both on hardware (device) reset and software reset. + */ static void imx_epit_reset(DeviceState *dev) { IMXEPITState *s = IMX_EPIT(dev); - /* - * Soft reset doesn't touch some bits; hard reset clears them - */ + /* Soft reset doesn't touch some bits; hard reset clears them */ s->cr &= (CR_EN|CR_ENMOD|CR_STOPEN|CR_DOZEN|CR_WAITEN|CR_DBGEN); s->sr = 0; s->lr = EPIT_TIMER_MAX; @@ -214,6 +215,7 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, ptimer_transaction_begin(s->timer_cmp); ptimer_transaction_begin(s->timer_reload); + /* Update the frequency. Has been done already in case of a reset. */ if (!(s->cr & CR_SWR)) { imx_epit_set_freq(s); } @@ -254,7 +256,7 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, break; case 1: /* SR - ACK*/ - /* writing 1 to OCIF clear the OCIF bit */ + /* writing 1 to OCIF clears the OCIF bit */ if (value & 0x01) { s->sr = 0; imx_epit_update_int(s); @@ -352,8 +354,18 @@ static void imx_epit_realize(DeviceState *dev, Error **errp) 0x00001000); sysbus_init_mmio(sbd, &s->iomem); + /* + * The reload timer keeps running when the peripheral is enabled. It is a + * kind of wall clock that does not generate any interrupts. The callback + * needs to be provided, but it does nothing as the ptimer already supports + * all necessary reloading functionality. + */ s->timer_reload = ptimer_init(imx_epit_reload, s, PTIMER_POLICY_LEGACY); + /* + * The compare timer is running only when the peripheral configuration is + * in a state that will generate compare interrupts. + */ s->timer_cmp = ptimer_init(imx_epit_cmp, s, PTIMER_POLICY_LEGACY); } From patchwork Thu Jan 5 16:43:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639313 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp340110pvb; Thu, 5 Jan 2023 09:26:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwJ21toYRfgw4/ehKQ7LZkBvbJwE2Q5h68grBV9xwx9jW61CK+wW/0U+sx0lSq+M3AiJ3h X-Received: by 2002:a05:622a:4810:b0:3a5:4e34:fafe with SMTP id fb16-20020a05622a481000b003a54e34fafemr82691204qtb.68.1672939563335; Thu, 05 Jan 2023 09:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939563; cv=none; d=google.com; s=arc-20160816; b=H9ATRrV/F1/8DIv9Gk6mPSrTs4zEpYujEWgxbFC62I6QLOtRcRQNY1MGUb60yITajh ASbHqckCqtZvFCXEYsmfK9Qopb82q1PUuPrvXn2WPCI9TYHu3gzvc5VhFjkx75t6nt9N E7r5nGtmZlqwbDNIwleWvl6U62x5vNs59mqJOv+eCbmYZGsTdACEmoLAOki3lfIqtpAp CnDbmbA0xlyFs5PJpfHYGFe/D19xfTOXrnaR8d/SXmAAzXx3N/iuUuPFWrcjv2slBEJi I9IBrkjosIhpDuguVofjjoLjnd8LryB+rZUDfG6oiKeIjwP2sgIW3fYGUoMzAZ5BL2kQ 7gdw== 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=4lYj5lfrX23EEPpJVAljAbbuQWpQ9S1qrdtCZ8SVOo0=; b=MJMgbV7dUQUf9hWj5+8oarKo0N8ZTz+yb2+Lqm0ki/ATv/4zEmqM9yLtlbqu1BJnIE McUgbRc4p1fK5RIzobCN2mS0Iy51ynr3GWtH8B9plQ/1ioQ1SQ+c1Mxo7KvAnpKNhTlw e12wV/BoY4kQzdS8oS2jZRfDu8OZ9fVTW6ki4Um/FksBDuwIWvRpNE4eBkCnBiLj2kpg uGYW8eXGfUmMAmddq5Pc2QY18UtG9lmrsj2ftHpUzgNnRkwbAB47My9+RMXkNd/Vob15 3ustm9ZO99PfWU3yC1bO4OfqQMBh9YTj6AMKL9vSKNMjNaZ3XNqEm0qD9hkmSWUmH6R8 NVjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=naDdzj0P; 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 ew7-20020a05622a514700b00343a6e631c4si20479722qtb.764.2023.01.05.09.26.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:26:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=naDdzj0P; 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 1pDTMO-0000uA-8X; Thu, 05 Jan 2023 11:44:56 -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 1pDTM1-0000Yw-A0 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLy-0007M4-9M for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -0500 Received: by mail-wm1-x333.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so1774091wms.4 for ; Thu, 05 Jan 2023 08:44:28 -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=4lYj5lfrX23EEPpJVAljAbbuQWpQ9S1qrdtCZ8SVOo0=; b=naDdzj0PBXlEs8HQw9FMQFoKAI5aUqssiWIBKtRjf6B1faIsU7Tasp15JKEfQiMKZ1 Q9ptHA9WjYYKsPOGyUUKw0Mo9RVbQNYSKmwjudxcYOnZPO5KkC6GRVeRU9NXbi40DFyd P00khDvPCjPRlFKF3WOgLuebcd0MkMPOaXec8hQTBVwnT0piaHz1AN+1gk2+qvzCEO26 nXYVxiw0yP0dBiCDeSgf5oH1ByzbCiuubuV//NwxykSdHUAjMWWeZe4f4ebIQtBZqgk1 DT+5bN1xfcnCxuZ4Xyc2Bb6AcTuDEYbUuqMGoQauUVcgrl1KTHMHxW4Rh9P/3V1RHvRh QtBw== 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=4lYj5lfrX23EEPpJVAljAbbuQWpQ9S1qrdtCZ8SVOo0=; b=3/6/h0IJIMTflepoNRTP76NRcB31khx/jUNBVwk3HYS6eUfTd5QNxDGtNjxfUP5G9M CQO8jVLqTcnUQBnFfQ0hm49K9Zo0R48TUqKw9UrAV+q+1tiLwk/0lR2NigjljAsCnSfa Fpnef0MfxyfrqS7R+K95nIMOE/+gi6R6VnZq4g0V8UIFwbcxthNPHCkh5emBubI5loeQ Cfza+zs1iaZG+vzqnPVBksZiPkUNL+szkJb6xfilCEYY5Q3cruatKKNhN/huD63S+96U dNO7Eqygt6awd8jJT3wfdfUSHuPpo7hrb5lNZgMhmLgLW9Aur0Jrxqjxuqj5qz94nynB 0vEQ== X-Gm-Message-State: AFqh2kqkEIal/MjQ0pK3pfMl5pBsq7EapU2TVtF/iojQOVNkxWP/K5CZ oXYKBGZaxK8210Mj2HwfXx7zkwG2HYD1mWAw X-Received: by 2002:a05:600c:3d1b:b0:3d0:6a57:66a5 with SMTP id bh27-20020a05600c3d1b00b003d06a5766a5mr36113770wmb.0.1672937068350; Thu, 05 Jan 2023 08:44:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/34] hw/timer/imx_epit: cleanup CR defines Date: Thu, 5 Jan 2023 16:43:54 +0000 Message-Id: <20230105164417.3994639-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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: Axel Heider remove unused defines, add needed defines Signed-off-by: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/timer/imx_epit.h | 4 ++-- hw/timer/imx_epit.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h index 2acc41e9822..e2cb96229be 100644 --- a/include/hw/timer/imx_epit.h +++ b/include/hw/timer/imx_epit.h @@ -43,7 +43,7 @@ #define CR_OCIEN (1 << 2) #define CR_RLD (1 << 3) #define CR_PRESCALE_SHIFT (4) -#define CR_PRESCALE_MASK (0xfff) +#define CR_PRESCALE_BITS (12) #define CR_SWR (1 << 16) #define CR_IOVW (1 << 17) #define CR_DBGEN (1 << 18) @@ -51,7 +51,7 @@ #define CR_DOZEN (1 << 20) #define CR_STOPEN (1 << 21) #define CR_CLKSRC_SHIFT (24) -#define CR_CLKSRC_MASK (0x3 << CR_CLKSRC_SHIFT) +#define CR_CLKSRC_BITS (2) #define EPIT_TIMER_MAX 0XFFFFFFFFUL diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 2841fbaa1c8..661e9158e3b 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -82,8 +82,8 @@ static void imx_epit_set_freq(IMXEPITState *s) uint32_t clksrc; uint32_t prescaler; - clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, 2); - prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, 12); + clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, CR_CLKSRC_BITS); + prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS); s->freq = imx_ccm_get_clock_frequency(s->ccm, imx_epit_clocks[clksrc]) / prescaler; From patchwork Thu Jan 5 16:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639283 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324936pvb; Thu, 5 Jan 2023 08:55:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXu4k1xWcSHpHPn4LgWdL4oHs2m2F8P2m12y7EpEU+8FtLDjGyud8ZrgbCcKrXQvjCMbKWlt X-Received: by 2002:a05:622a:20a:b0:3a8:2bf6:85ea with SMTP id b10-20020a05622a020a00b003a82bf685eamr90181236qtx.49.1672937733820; Thu, 05 Jan 2023 08:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937733; cv=none; d=google.com; s=arc-20160816; b=O4Fn+aXVpeEZsbUeAd2GBhm/RjuaW4wxwKDI8MRJnVRUx7gDeV8v7N9H5YJDQSjS1k lUguR7Zsoz3gLw++lIBfvBZeDzssiX6el1mXrcf5q1CxSyu6/OvAlC57+Av+N6eopgdE rw9FpoCzjv1tKpOtAj67c72pz2CnIZcWWsDYtcn0VwoJSiSD/gI4RttFrg44BuQmIxB0 NMvGCLLTwnhlo665bVj4c2xkrfmbf4VJ+I9NYqCzhxG+V+nUrOiEtFCfBzsN41G2CsxG 45W6vWoY38qiwsHdGYCWy2b9gBBiT/QIlUbBBhw54JMX7ShvSXTB8C2z45NwLK42sFMQ AZtg== 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=TK1ZAIb2SC1DPcdzdUgcMa2CLBumxiEB57+So4PesS8=; b=056/Sf8FpTvlANvBRJTc0nkpyRlH2XV8V/T95uT7GMjI31qy0pBwRvAxM1SuHl+PQH dxjYe386lIyPGt7qxsHJIJFowE82MrRWdqzd6gsAtWgylVe5KXiye/vRZ7ZsRdqs4n3m 7/1eWFoDi+R8h+vm/ewZDU1m4msTp/khlqrU50Hj1qOX53Or5XvgjJbrlDVX7hiltIFo Oj25Cx9KTwjVUokNr20ZXwzMh8c6BZPQGGYvvxGTslQPnu5pQsccW4/1vd2Df2tnr2/y AFqynXX0LASSE5fNJPbGSFr0MYwlDj+tZmZvEaIdM5o9r7X3k+rbBQjWfETVOFT5kjrm sCAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YOxUM/+e"; 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 fc20-20020a05622a489400b003a991b9b888si20606777qtb.265.2023.01.05.08.55.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:55: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="YOxUM/+e"; 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 1pDTM2-0000bU-ML; Thu, 05 Jan 2023 11:44: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 1pDTLz-0000WT-TF for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:31 -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 1pDTLy-0007MR-93 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:31 -0500 Received: by mail-wm1-x32b.google.com with SMTP id ay2-20020a05600c1e0200b003d22e3e796dso1803665wmb.0 for ; Thu, 05 Jan 2023 08:44:29 -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=TK1ZAIb2SC1DPcdzdUgcMa2CLBumxiEB57+So4PesS8=; b=YOxUM/+etWUtZiir+YsugNs3bCaR7ypo2CRlnM5Aw5GTGsYq3rPRUju4H7S7F3Ma+C V1vLnCxTtGA0irMa7Gy+Kot/9tW2IDXOc6JQBuVXhSlSeU8OsRbNZi7PLnaisWJc9AGr 6c8tcGci1Bo55K0lA0cEWKvC9NczPRF22EU6CLmv9+Wb9Dn0fQAwBbN/b4nCM+azbjCm Ka07TikmsyTcADkXEha8RRlJEldTuE3BXfREKieo8RXIyBMd0pUcoHiy3OVZiUzgiKDT DXvEpbGP0i7B0LLuFRVEROYaLxR85QN5oMCjQQhu+0yodC6FJ6HNqdj0Ob9LiMSKx7GU 8vIA== 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=TK1ZAIb2SC1DPcdzdUgcMa2CLBumxiEB57+So4PesS8=; b=Iobl2y6Fd5VD960bhU2RwAe88uDyCclhJ2vLUGC1w3oGrtbQjzmX5aEg+6OJNOKNnE kyqUcz2bJLPfO/jxpEuDPMbRxtt99dsKxpAEeLAEZI6IoiwY+CE+sCHcLPDfWlJEKXo/ mCA1QefXXUz+PzVO/RNl/JZpZ99IlVuXtITxTKO/vFQC5c0CwXzv9Ja3ZdaLVkYJWO8g EHvqlIIODaPA9gxuttd5gUCym+pbK9ubIYqYKJ2VR8dIbmnNS3zYPT4R0vMzTnfHAGJs pDlCUDL3GJCndAPhds7L7Ku6ZzQxEhSLtyrunjhnhSbZyYD9y1rYaSXIvnsPF9c+Nj2W cL4g== X-Gm-Message-State: AFqh2kqc2poD085VzWiDU5qT2nJtz+DkZJt+VX6ksJmvVTb4RxFaAuRi vzsheb3p7yAO3tF+RMAjdD6K7kQ/fMW/5cLc X-Received: by 2002:a05:600c:1d0e:b0:3cf:7c8b:a7c7 with SMTP id l14-20020a05600c1d0e00b003cf7c8ba7c7mr36564738wms.39.1672937069176; Thu, 05 Jan 2023 08:44:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/34] hw/timer/imx_epit: define SR_OCIF Date: Thu, 5 Jan 2023 16:43:55 +0000 Message-Id: <20230105164417.3994639-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/timer/imx_epit.h | 2 ++ hw/timer/imx_epit.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h index e2cb96229be..783eaf0c3a6 100644 --- a/include/hw/timer/imx_epit.h +++ b/include/hw/timer/imx_epit.h @@ -53,6 +53,8 @@ #define CR_CLKSRC_SHIFT (24) #define CR_CLKSRC_BITS (2) +#define SR_OCIF (1 << 0) + #define EPIT_TIMER_MAX 0XFFFFFFFFUL #define TYPE_IMX_EPIT "imx.epit" diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 661e9158e3b..f148868b8cb 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -66,7 +66,7 @@ static const IMXClk imx_epit_clocks[] = { */ static void imx_epit_update_int(IMXEPITState *s) { - if (s->sr && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) { + if ((s->sr & SR_OCIF) && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) { qemu_irq_raise(s->irq); } else { qemu_irq_lower(s->irq); @@ -256,9 +256,9 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, break; case 1: /* SR - ACK*/ - /* writing 1 to OCIF clears the OCIF bit */ - if (value & 0x01) { - s->sr = 0; + /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */ + if (value & SR_OCIF) { + s->sr = 0; /* SR.OCIF is the only bit in this register anyway */ imx_epit_update_int(s); } break; @@ -309,8 +309,8 @@ static void imx_epit_cmp(void *opaque) IMXEPITState *s = IMX_EPIT(opaque); DPRINTF("sr was %d\n", s->sr); - - s->sr = 1; + /* Set interrupt status bit SR.OCIF and update the interrupt state */ + s->sr |= SR_OCIF; imx_epit_update_int(s); } From patchwork Thu Jan 5 16:43:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639291 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp326480pvb; Thu, 5 Jan 2023 08:59:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtW3G72CVsuo6nxza5ZBHHqz2SdxJo9M4XNbDytEC5zI/4Zk07nD6FUAqYlK+9DxD7HE1qA X-Received: by 2002:ac8:7615:0:b0:3a6:9622:ea85 with SMTP id t21-20020ac87615000000b003a69622ea85mr76590416qtq.54.1672937984833; Thu, 05 Jan 2023 08:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937984; cv=none; d=google.com; s=arc-20160816; b=ACemQS9P6n+10LE2fkTsml82cQdNQAcOykd+4loNjXB5DtLURi3VY0OpU3OYOH3f1u oaE7kzwjlGLzI+7YuCfnXWtInL/iBk3n7HPW+ROLTO6UPC2ThS8LhFhcVW24nlD4jIp1 9b/gYjwIjlyBzaMCsPKscFFX8R75nAPq4ZWOdQkGNMfj8loW2bel4IiULNavC5RzZUA9 PdBTjajheJCjmse26J4AHksMMdnbzHM3M3Eq8dvRYv5xeCm+qCCZLSYvKhaCvLM0cSHW q02zmaCxrc5mqzcXrsYia7SuJ6SG537P9vYEeiiPV8VcjCg/gocqabodFWoMkScp4d9f aMug== 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=2FLbsaEjrO+mfvP9azEL7lq/R52dHqN0L8IGeRLVJ0o=; b=ZaASUPt+GJWArx+fl8O5bVhKdPIogvlX4skrdkpIWpoyqLJExM5W9Zgz4YEOdX/YCp kT2HuEuq1gAzyiIo8LUQ7x4zpfx6EiZyDYJXyoOK3p30morFP1tZe+ZUfrBfeR8WEXl9 U9zLvGrQhb6WiWH243TGdhyOVmmW7A6p+ZYU1X0wuv7FfJ/mG4AqqnO9HNL/YXKFRnkI 2v8ieMFYbvFr3xy1jWUQEZX1T+T0vi8uBaWuZk5klhgpP6xlyPbr6ZoJbNNwHoWYF14f zHpP/E1hyjgf19WgL5lY5ldrXlPaTJYzRveHANr4tzgKAYk6zT1nL2mdb6smMuXgdI8d BSlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jP+hA+y0; 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 y14-20020ac8708e000000b003a693df8aacsi19005169qto.472.2023.01.05.08.59.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:59: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=jP+hA+y0; 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 1pDTMP-0000wb-5Y; Thu, 05 Jan 2023 11:44:57 -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 1pDTM1-0000Yv-9o for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLz-0007Of-5m for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -0500 Received: by mail-wm1-x330.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso1776588wms.5 for ; Thu, 05 Jan 2023 08:44:30 -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=2FLbsaEjrO+mfvP9azEL7lq/R52dHqN0L8IGeRLVJ0o=; b=jP+hA+y0EWKOILuYbI6CaDIEVAXZl4N/unlllakrSk5WmOGEl+nAOKOVBoeP4Tlreo LJAUHEhZ2kRsX1ppg+bkuk84CWwuYUAAJt5a95WjN1Nk39zJxSfwp7yF202lpqSDAG9O udImk0oHOG9MofnR1n3ZVcsozqGhTjWD8M6suJSwxImSmqpdZFCUJdaFYKvrGdNRS6GY Ltgr8O9ejjVPjxaZShs2MxnGyPWCfWxquR5BfiId7ujG63R4VnQpRU+bqQ1LjiRz29gI PNJd07DKupiDb5CcJX5cifs0UBV43qcl7fags6mX/xf3loQdPrFGnGunDH8sQOcbai4J NWvw== 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=2FLbsaEjrO+mfvP9azEL7lq/R52dHqN0L8IGeRLVJ0o=; b=vsfU94aKuwu2FFRJOm3pXsUZcBSw3s2QfgZDk3R6DbQpvgZDpkutBNy+VIgqJYzPVk Zcsisio/39hJIEy0X48iYosGnBtBuP0cNYVo2Z8klWPvn7iLADgeK/2hUNjhH7l0UuH+ BlDbvwmbwtoZttGUF2/wzm4qK/W51fqKg57/z+glXN4Qe773Kn4inonBjGUymTGQbF35 5ERKRtLXnA1VClSWUeM1BVX4on91wwSZTxVjAIyOg54O/ocZ+eQS1VBZ5CUjGby+Crt3 +22FvAcbb2EeHYqvkzOFBWd3i8K0ITH+Lkt9KDgcRFIY4g5zpXdjwE3hiQBMbrcDXYKv cG2A== X-Gm-Message-State: AFqh2kpgU01ZyBjGl+hhCKghAxAlp9J+McjaVDILkgHfM2G2+Q1vtonM 0irfsLdVUZwUZEXcuco27FB3BpXesH6sVCMs X-Received: by 2002:a05:600c:5022:b0:3c6:e61e:ae8c with SMTP id n34-20020a05600c502200b003c6e61eae8cmr45127208wmr.28.1672937069943; Thu, 05 Jan 2023 08:44:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/34] hw/timer/imx_epit: update interrupt state on CR write access Date: Thu, 5 Jan 2023 16:43:56 +0000 Message-Id: <20230105164417.3994639-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: Axel Heider The interrupt state can change due to: - reset clears both SR.OCIF and CR.OCIE - write to CR.EN or CR.OCIE Signed-off-by: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/imx_epit.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index f148868b8cb..7af3a8b10e8 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -206,12 +206,20 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, if (s->cr & CR_SWR) { /* handle the reset */ imx_epit_reset(DEVICE(s)); - /* - * TODO: could we 'break' here? following operations appear - * to duplicate the work imx_epit_reset() already did. - */ } + /* + * The interrupt state can change due to: + * - reset clears both SR.OCIF and CR.OCIE + * - write to CR.EN or CR.OCIE + */ + imx_epit_update_int(s); + + /* + * TODO: could we 'break' here for reset? following operations appear + * to duplicate the work imx_epit_reset() already did. + */ + ptimer_transaction_begin(s->timer_cmp); ptimer_transaction_begin(s->timer_reload); From patchwork Thu Jan 5 16:43:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639321 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp344938pvb; Thu, 5 Jan 2023 09:36:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXuxlS3f34odm1gWe+ydnHAF98YNObBMguJIXCthHtVXisqlbt1qbnMAKf/lNvZ8BLMe41hv X-Received: by 2002:ac8:1382:0:b0:3a8:1793:76d6 with SMTP id h2-20020ac81382000000b003a8179376d6mr71135598qtj.68.1672940193247; Thu, 05 Jan 2023 09:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672940193; cv=none; d=google.com; s=arc-20160816; b=KkSUP6CmtfJCYpQnFvIwUr1T79Id6hcMFZIrJ1C8W1FsiDn0yyC7IFdBwcZmucEcGY 5SHusBnBmCQRgi5v18CkLCbhS7h0v1iccUbcz7dFTl/EDycR7LNDJIgu9rnTrZj495Y+ MSGWfME2AEvXA4I2W44/x2qgOrDonZwwaPa6KE2fF7WFqbMBtB8ZT8OMsDG/RwTIt4Q4 FfqU7iDQjhqxmRXcHjZsqtWGd9+atnGEPBrtsU2m1XXidt8Zx4UiFasPnrKzmXp9yUe+ agUi/255Jti8j8co+9aRIv6UqGVpQrNMI1viZscZa40a4hzUhoz5ELOBLFfp5Q0+Qova 2ddw== 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=P2vsUh1KZZjl1KJb8eEAjrnadXinJSPoXxKJHFfBzmE=; b=Ru/vH0fcgd5in3H8fqxb9ksPkStOy+tEo7JXFqEeqIdR2t9xEfsPWQKBCiMM8LHPFT G/TisqeBnZhZZzGp7WY27Ns7bzttu6sPQ8Dr7pYBD5om9yx+J0ekuQ52iwWY/O9ABrCQ Or/pSZK5KonG0Og5UUMNxK7KnfUQyAvBiZ/UjiK8vhUObfVWDjfUxSgWsYfRDWdxOAd/ oAoVSUW3/YAdMqpprx2CDh99oS06CPgoXQuugk8eNvEk7BOSkR7gywArkg282MaBdxUy 9tblyFiAcqAtZkWj5aUTSSzNzMxft4hkYuE7DHlSnheeOwQatvwwW9V2swByWU4O8kHw XzUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U3kcW9JR; 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 r25-20020ac85219000000b003a7e5493305si19605622qtn.356.2023.01.05.09.36.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:36: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=U3kcW9JR; 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 1pDTMO-0000uC-8Z; Thu, 05 Jan 2023 11:44:56 -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 1pDTM1-0000a0-K3 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -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 1pDTM0-0007Ov-0u for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:33 -0500 Received: by mail-wm1-x32d.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so1759183wms.0 for ; Thu, 05 Jan 2023 08:44:31 -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=P2vsUh1KZZjl1KJb8eEAjrnadXinJSPoXxKJHFfBzmE=; b=U3kcW9JRoPNBIJ+pD9iACicumyH+81stmcE1sYz6Um0fAJXfwYpCAkAIB7E443GdjL m12TtsG3IWQkFad/4UiWgYFMOa+dC/dG/06X5DRHnVPCdTixrhsXYKruk5CA0RIf7Pr3 1aScrl1bVyY+1UPzDbJfaRAztI4+eq5FtVBy5T5VYRMfz8BdjgnuNP+2SwBiUaE0kiNN fKF5/4NTCmTwFEYL5a9FI/DyCwU+9iqEL1KCNZEBwe3Ld/l6EuWWlRoT3q69UUYEezaw jGIqdtYDOi2HPSNmFIiSJ12aFlyiKxLLdOa6xVf4bienRfVh+Mvy3hhIXNh0zhtbRpoA cv4A== 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=P2vsUh1KZZjl1KJb8eEAjrnadXinJSPoXxKJHFfBzmE=; b=SP/5EJPtzGh3QlNX/HmNngC+8mKg47YXtlwYGBhlhbLMr5o6KdcjijNFTV0hJUpQw+ C49rRIrQxsZcFB7DKNBneL7ICHOfAvZFYQorQin3oFyo55P2qkE4XdG4yg3JyElno94f jolF/73mjVFte2vxXPGIdc79hT3eI2nKHBNLaLldkfXszD3RHvZHjNNQEJgpgtzSw5ra +9v0afbXLkQuvkNIvShMye+OIqlMrih/IBGFmkFky8DxyrhQo6K3ogEeYaAsOstjlQaf 0UbgptSQBD8L79vAVhH2VpsxzqhgkPAFKpQNwb47kNnZiGxAxK3BB25+LCl0hucW+skj pa6Q== X-Gm-Message-State: AFqh2krmDpfxiU18PKu/qKwvPGudMHXXFDDQDeAFrdUoXmmkHiPHCaao 0CwWN0PJy2YR3PsMEaxyvtXtGTi0n4CfWldt X-Received: by 2002:a05:600c:1e1d:b0:3cf:b07a:cd2f with SMTP id ay29-20020a05600c1e1d00b003cfb07acd2fmr35644674wmb.37.1672937070719; Thu, 05 Jan 2023 08:44:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/34] hw/timer/imx_epit: hard reset initializes CR with 0 Date: Thu, 5 Jan 2023 16:43:57 +0000 Message-Id: <20230105164417.3994639-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Axel Heider Signed-off-by: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/imx_epit.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 7af3a8b10e8..39f47222d05 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -99,12 +99,14 @@ static void imx_epit_set_freq(IMXEPITState *s) /* * This is called both on hardware (device) reset and software reset. */ -static void imx_epit_reset(DeviceState *dev) +static void imx_epit_reset(IMXEPITState *s, bool is_hard_reset) { - IMXEPITState *s = IMX_EPIT(dev); - /* Soft reset doesn't touch some bits; hard reset clears them */ - s->cr &= (CR_EN|CR_ENMOD|CR_STOPEN|CR_DOZEN|CR_WAITEN|CR_DBGEN); + if (is_hard_reset) { + s->cr = 0; + } else { + s->cr &= (CR_EN|CR_ENMOD|CR_STOPEN|CR_DOZEN|CR_WAITEN|CR_DBGEN); + } s->sr = 0; s->lr = EPIT_TIMER_MAX; s->cmp = 0; @@ -205,7 +207,7 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, s->cr = value & 0x03ffffff; if (s->cr & CR_SWR) { /* handle the reset */ - imx_epit_reset(DEVICE(s)); + imx_epit_reset(s, false); } /* @@ -377,12 +379,18 @@ static void imx_epit_realize(DeviceState *dev, Error **errp) s->timer_cmp = ptimer_init(imx_epit_cmp, s, PTIMER_POLICY_LEGACY); } +static void imx_epit_dev_reset(DeviceState *dev) +{ + IMXEPITState *s = IMX_EPIT(dev); + imx_epit_reset(s, true); +} + static void imx_epit_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = imx_epit_realize; - dc->reset = imx_epit_reset; + dc->reset = imx_epit_dev_reset; dc->vmsd = &vmstate_imx_timer_epit; dc->desc = "i.MX periodic timer"; } From patchwork Thu Jan 5 16:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639276 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp323018pvb; Thu, 5 Jan 2023 08:50:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXtOS9ez39oA9j7neCamZX9b4Mxf+U8Z9ocEyJPSK8zR/wUjpnudbARvTMc3MKXkhMKlRCXO X-Received: by 2002:a0c:ec8d:0:b0:4c7:6db8:b0d3 with SMTP id u13-20020a0cec8d000000b004c76db8b0d3mr77038485qvo.37.1672937414778; Thu, 05 Jan 2023 08:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937414; cv=none; d=google.com; s=arc-20160816; b=k7O6gp5k17asFjjToWqbvc5fM5hVNX5bE/fdvebif2ORmaCkuPEo47blLuNtRFgL2W rj9AqSt9TplBW0mvH+HVE3MVq5xayDtrdmtKXSTAZJv3qvCizXqB16hNnuF6bc23f2tr vQhj4ixOma5Pcs/a/K37lzSJHoJuDUc5vrv8aXIm7lmyWyGVNXpSWqeCraDeLktUVPqf YI0MuK4ntZyDSuDPzOjlnFmWtocrisq4DWgNjHWKAf2S+cxQHsg4Yfl4Om5BAY66CcWZ gJsbGb88KaP+4nRqyg/LZx+LbxJUKD1O9iXH9Hib/znOds1rFhzGoyqu+uVVlJnSx+9M S+Yg== 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=8xqm51ez6F8zTWVDgAKbMhiEiLQ8CI6XG2qRGoTrIzY=; b=PNpEElnOnxfnv5lGC3qmGIUk7dPOacqFBnPx3P0aeUYJCxvGXO5egL0ryKaorOIUI9 mjugiuYEEXyamK3FuAtijGI+FLKv7APaoDYjLoAeI/cZFlbpvH0gYbrCDkIioRcp3srj CiqNZY4Hab3FVFQJZHA0rxhcoZ9U3z6ugmKCvssyFhOKonYnP7j34ogZBd5bjsZzARig EdjrQRtt2UvoVWPT/PdUoUjjwc423wiis6UqGGmd/84QEOsizKgqn1V8kWBCvtQU3OyJ eblj6DgewUegHyN6qLXW8IfmT9ncSKsUkQR2sVIk3R/FpDPf+MZWJVUMys0rO16OALDJ lDtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j7Mu7Tqo; 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 kl10-20020a056214518a00b00531e639020fsi3066653qvb.473.2023.01.05.08.50.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:50:14 -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=j7Mu7Tqo; 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 1pDTMd-0001JX-HJ; Thu, 05 Jan 2023 11:45:11 -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 1pDTM2-0000bu-R7 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:36 -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 1pDTM0-0007PM-TI for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:34 -0500 Received: by mail-wm1-x32b.google.com with SMTP id g25-20020a7bc4d9000000b003d97c8d4941so1731199wmk.4 for ; Thu, 05 Jan 2023 08:44:32 -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=8xqm51ez6F8zTWVDgAKbMhiEiLQ8CI6XG2qRGoTrIzY=; b=j7Mu7TqoMZf1Y2rF8XQ2qf/CO0xUezfljd2jk/1Z4jtW4HiGRzf9+BJry361mc3sdP 5JJn8yz24wSPLEhmtSJs+Gdp9nvGWWgmIrrBv6OAuSTzgtP0Ijw1vjd8FwPOV4tVf8M5 QDDu61nS2+J4hfqepkcbkW1eXZMizVjrOLJFvV9jQv5jkpo9OdsAYlJSgwOB4Z1KR+Zt YIj+eKDwKcOxwjLGFsww8KnucdEQs8GZzNXJJWF9m63e2AH/jIN8rUerBrYs9wAiWhZk TBfh8kQXs/ZBIGhQRo+2LwBDbn1JwBviV0Uttjv1KTmei6ASfwmcfejWpfWrCW9DesqF SZRQ== 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=8xqm51ez6F8zTWVDgAKbMhiEiLQ8CI6XG2qRGoTrIzY=; b=HfGvN3KjrSGl0dIQxnzG+ZDtVa7w1BJQpeYQIglV7xj8P4qhhXfXVy2M+wPgDY6cJx UOoRm/ww7bvlTS90kKIuAE9gHM12buIOF4agWVb83TAFJVM2rSw3hovyadkQ0A2MX6tw ZKN1a/Yf46lR9bJdSnEN2K+LN1SfQXyGfkuLYMPbMY+tjCQmNp7nHUGI0st2f4a6Gdn/ siDTH+Bk4xK7GO0UUBEV8gOrz39RY1CieOjJCgN07Z7Zf05eEsgupXq4L604n4qtFvqP c7i43X8mTugYF0oc+QIHylmTf96EeuREm6nUU4FRcqob3vS47RRCCl+HvmeHDz0mQWGz qjIw== X-Gm-Message-State: AFqh2kouKsbZHLEBnt9nyaiTgBo6QP1ZPYGOCep0u81FcAjxugNvnIQ+ pS2/64N2vfdD6ZPhFA/apdyY+ZY5ps+QSUCt X-Received: by 2002:a05:600c:5399:b0:3d9:c6f5:c63d with SMTP id hg25-20020a05600c539900b003d9c6f5c63dmr5659371wmb.28.1672937071474; Thu, 05 Jan 2023 08:44:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/34] hw/timer/imx_epit: factor out register write handlers Date: Thu, 5 Jan 2023 16:43:58 +0000 Message-Id: <20230105164417.3994639-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Axel Heider Signed-off-by: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/imx_epit.c | 215 ++++++++++++++++++++++++-------------------- 1 file changed, 117 insertions(+), 98 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 39f47222d05..e04427542ff 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -191,129 +191,148 @@ static void imx_epit_reload_compare_timer(IMXEPITState *s) } } +static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) +{ + uint32_t oldcr = s->cr; + + s->cr = value & 0x03ffffff; + + if (s->cr & CR_SWR) { + /* handle the reset */ + imx_epit_reset(s, false); + } + + /* + * The interrupt state can change due to: + * - reset clears both SR.OCIF and CR.OCIE + * - write to CR.EN or CR.OCIE + */ + imx_epit_update_int(s); + + /* + * TODO: could we 'break' here for reset? following operations appear + * to duplicate the work imx_epit_reset() already did. + */ + + ptimer_transaction_begin(s->timer_cmp); + ptimer_transaction_begin(s->timer_reload); + + /* Update the frequency. Has been done already in case of a reset. */ + if (!(s->cr & CR_SWR)) { + imx_epit_set_freq(s); + } + + if (s->freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) { + if (s->cr & CR_ENMOD) { + if (s->cr & CR_RLD) { + ptimer_set_limit(s->timer_reload, s->lr, 1); + ptimer_set_limit(s->timer_cmp, s->lr, 1); + } else { + ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1); + ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1); + } + } + + imx_epit_reload_compare_timer(s); + ptimer_run(s->timer_reload, 0); + if (s->cr & CR_OCIEN) { + ptimer_run(s->timer_cmp, 0); + } else { + ptimer_stop(s->timer_cmp); + } + } else if (!(s->cr & CR_EN)) { + /* stop both timers */ + ptimer_stop(s->timer_reload); + ptimer_stop(s->timer_cmp); + } else if (s->cr & CR_OCIEN) { + if (!(oldcr & CR_OCIEN)) { + imx_epit_reload_compare_timer(s); + ptimer_run(s->timer_cmp, 0); + } + } else { + ptimer_stop(s->timer_cmp); + } + + ptimer_transaction_commit(s->timer_cmp); + ptimer_transaction_commit(s->timer_reload); +} + +static void imx_epit_write_sr(IMXEPITState *s, uint32_t value) +{ + /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */ + if (value & SR_OCIF) { + s->sr = 0; /* SR.OCIF is the only bit in this register anyway */ + imx_epit_update_int(s); + } +} + +static void imx_epit_write_lr(IMXEPITState *s, uint32_t value) +{ + s->lr = value; + + ptimer_transaction_begin(s->timer_cmp); + ptimer_transaction_begin(s->timer_reload); + if (s->cr & CR_RLD) { + /* Also set the limit if the LRD bit is set */ + /* If IOVW bit is set then set the timer value */ + ptimer_set_limit(s->timer_reload, s->lr, s->cr & CR_IOVW); + ptimer_set_limit(s->timer_cmp, s->lr, 0); + } else if (s->cr & CR_IOVW) { + /* If IOVW bit is set then set the timer value */ + ptimer_set_count(s->timer_reload, s->lr); + } + /* + * Commit the change to s->timer_reload, so it can propagate. Otherwise + * the timer interrupt may not fire properly. The commit must happen + * before calling imx_epit_reload_compare_timer(), which reads + * s->timer_reload internally again. + */ + ptimer_transaction_commit(s->timer_reload); + imx_epit_reload_compare_timer(s); + ptimer_transaction_commit(s->timer_cmp); +} + +static void imx_epit_write_cmp(IMXEPITState *s, uint32_t value) +{ + s->cmp = value; + + ptimer_transaction_begin(s->timer_cmp); + imx_epit_reload_compare_timer(s); + ptimer_transaction_commit(s->timer_cmp); +} + static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { IMXEPITState *s = IMX_EPIT(opaque); - uint64_t oldcr; DPRINTF("(%s, value = 0x%08x)\n", imx_epit_reg_name(offset >> 2), (uint32_t)value); switch (offset >> 2) { case 0: /* CR */ - - oldcr = s->cr; - s->cr = value & 0x03ffffff; - if (s->cr & CR_SWR) { - /* handle the reset */ - imx_epit_reset(s, false); - } - - /* - * The interrupt state can change due to: - * - reset clears both SR.OCIF and CR.OCIE - * - write to CR.EN or CR.OCIE - */ - imx_epit_update_int(s); - - /* - * TODO: could we 'break' here for reset? following operations appear - * to duplicate the work imx_epit_reset() already did. - */ - - ptimer_transaction_begin(s->timer_cmp); - ptimer_transaction_begin(s->timer_reload); - - /* Update the frequency. Has been done already in case of a reset. */ - if (!(s->cr & CR_SWR)) { - imx_epit_set_freq(s); - } - - if (s->freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) { - if (s->cr & CR_ENMOD) { - if (s->cr & CR_RLD) { - ptimer_set_limit(s->timer_reload, s->lr, 1); - ptimer_set_limit(s->timer_cmp, s->lr, 1); - } else { - ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1); - ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1); - } - } - - imx_epit_reload_compare_timer(s); - ptimer_run(s->timer_reload, 0); - if (s->cr & CR_OCIEN) { - ptimer_run(s->timer_cmp, 0); - } else { - ptimer_stop(s->timer_cmp); - } - } else if (!(s->cr & CR_EN)) { - /* stop both timers */ - ptimer_stop(s->timer_reload); - ptimer_stop(s->timer_cmp); - } else if (s->cr & CR_OCIEN) { - if (!(oldcr & CR_OCIEN)) { - imx_epit_reload_compare_timer(s); - ptimer_run(s->timer_cmp, 0); - } - } else { - ptimer_stop(s->timer_cmp); - } - - ptimer_transaction_commit(s->timer_cmp); - ptimer_transaction_commit(s->timer_reload); + imx_epit_write_cr(s, (uint32_t)value); break; - case 1: /* SR - ACK*/ - /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */ - if (value & SR_OCIF) { - s->sr = 0; /* SR.OCIF is the only bit in this register anyway */ - imx_epit_update_int(s); - } + case 1: /* SR */ + imx_epit_write_sr(s, (uint32_t)value); break; - case 2: /* LR - set ticks */ - s->lr = value; - - ptimer_transaction_begin(s->timer_cmp); - ptimer_transaction_begin(s->timer_reload); - if (s->cr & CR_RLD) { - /* Also set the limit if the LRD bit is set */ - /* If IOVW bit is set then set the timer value */ - ptimer_set_limit(s->timer_reload, s->lr, s->cr & CR_IOVW); - ptimer_set_limit(s->timer_cmp, s->lr, 0); - } else if (s->cr & CR_IOVW) { - /* If IOVW bit is set then set the timer value */ - ptimer_set_count(s->timer_reload, s->lr); - } - /* - * Commit the change to s->timer_reload, so it can propagate. Otherwise - * the timer interrupt may not fire properly. The commit must happen - * before calling imx_epit_reload_compare_timer(), which reads - * s->timer_reload internally again. - */ - ptimer_transaction_commit(s->timer_reload); - imx_epit_reload_compare_timer(s); - ptimer_transaction_commit(s->timer_cmp); + case 2: /* LR */ + imx_epit_write_lr(s, (uint32_t)value); break; case 3: /* CMP */ - s->cmp = value; - - ptimer_transaction_begin(s->timer_cmp); - imx_epit_reload_compare_timer(s); - ptimer_transaction_commit(s->timer_cmp); - + imx_epit_write_cmp(s, (uint32_t)value); break; default: qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" HWADDR_PRIx "\n", TYPE_IMX_EPIT, __func__, offset); - break; } } + static void imx_epit_cmp(void *opaque) { IMXEPITState *s = IMX_EPIT(opaque); From patchwork Thu Jan 5 16:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639292 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp326564pvb; Thu, 5 Jan 2023 08:59:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtxJBFe48AkT4k1VVAHinmfI2QK9MImrdVXUAdqnVcBwUbG7s06WfvArSg2nK46zKVJ2cac X-Received: by 2002:a0c:c3c9:0:b0:531:8cdb:10a1 with SMTP id p9-20020a0cc3c9000000b005318cdb10a1mr48478421qvi.16.1672937996356; Thu, 05 Jan 2023 08:59:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937996; cv=none; d=google.com; s=arc-20160816; b=YABTKVM02xIUMzAXtHfpT1ziiCYhYN9avoQTB86CogFBAyqErZOFiZkHxnje0xNC87 yjOFxIQdnC8IQK2fJqkWXbY9/CXolJHK/cQOsodatMEkN+lyWxUs03xDjVoxrMWU1XaE gCa1EfwKWzymLpu5zsyF4rQATRys/I7wyKfLeMMS2zJEhOpvF7bsCZE+x5qvwXFyunZy rK2uHjdQf+QcsNuFh94NfEAzHT8idmAbQ6WVVivkdkAKPh2ZC8MViGBBHeHfTHuEUz02 VFXGZC6wYPwVHO4FtG/3DjNDwNBeSVRUJd0mApk9zhkeS5P3X3pRFw4w2+uU+7LjmUwz xLVw== 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=ew4ZuCC9yg58vS2TrdlpWSuLYwEQS/rH4g7G61S6lm4=; b=iz4m+h2Sodw5/SvBUhE8hyPdRnwYT7vWALL63KKsr2Ku64cxjt34KfaDlUuoWA9asy NeN3527PlgXiAFrXKYm6rRISlHlr9mltYjdLAAzEoiFTnBgen3/bvyWFFvRYKvgioabV NZtUcNuIx3n7XO08zvJkli0Sfb6Lv231OwH75hCIkWeWN7DV0VHm8PfSCa2QTPR3LByY vZMPNZ/XojLRqNKJDIV9G70ZSfqELW9kRci1aXqj7MOXXja3VD3mf5v1+Lt4nW9A3rU7 ENqCqo55i/eYVxdp0aEYqnxFbBbnx/Ot2eu5N4tu7G5Mxkl4ghVC2IK7URbgOojifK4F FrMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRVGz2tl; 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 q14-20020a05621419ee00b005309b6be01csi19781780qvc.489.2023.01.05.08.59.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:59: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=cRVGz2tl; 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 1pDTML-0000qn-Du; Thu, 05 Jan 2023 11:44:53 -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 1pDTM3-0000bw-Ck for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:36 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTM1-0007Pb-Kk for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:35 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m3so19555663wmq.0 for ; Thu, 05 Jan 2023 08:44:33 -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=ew4ZuCC9yg58vS2TrdlpWSuLYwEQS/rH4g7G61S6lm4=; b=cRVGz2tlUd6kSkrs0sSHiv7DF2yujPfDZvZo+ICl0qxrd6bpJacTaeW6oai9+OxR8r r7GRqo8zbZJ4M3waK8elRZoFIxraEeqFn383Wnrlm69/4pqHMZBR0lUXPryDPCo1Zx4B TSk2QFCo5lM7DQPr4Mwj+Rw4XeXyfRa4SU852/vKI/IUsucCndhIer0+jr8nDl6y4Qn/ sNxUxIH/Dc/N5ZRLqnMLUjNFzS8YBXd/zhqjMWklBvQMFXToWqGcaIUFW8UykZvPrrmZ uOwK8i1WzY8cIXaReOt5QV8O75EI2N5kPysvfBlGz1ALikFtvcvUkO7tao5LqKS5M/cH 6LQQ== 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=ew4ZuCC9yg58vS2TrdlpWSuLYwEQS/rH4g7G61S6lm4=; b=6KdIpAFLdVUWWnxjJUeW5xZvjB275UJy7OaDuG71wfXwec+864YkP7BonSYH8bJXFO e9BAzX2KcU5Va5hHcdlzfK5PpzVZmObJmJwuYweiGuc8HZZ4/Eai2aABT/4tMmtO9rPx gFiwIk3UtleGN7uhCqx4gxRIkE5DvDflEQgDsCzCwwKVKNdj64O3YJhh6gEQHqutFYbL BM4TK6qziHlBLB0G+JxWsqHm7Q0P50SVImIoy0CYEKkgxGnv3cITDvQeVlFWRZzI63jj 44dLzyAOejjAArErU/71tGgprBMgmmCsPBGuy1yNQlrSWXBoVapue/0wzQIqp7O7bPh+ vocA== X-Gm-Message-State: AFqh2kpbW9EETFlZEQR1kaaUy91NEd8V2INgmJHTe2jjyKODb1QZcUCi TMjt3en8NhCvSUbn1kYQ5I49u54AjUdZNk/J X-Received: by 2002:a05:600c:1d0e:b0:3cf:7c8b:a7c7 with SMTP id l14-20020a05600c1d0e00b003cf7c8ba7c7mr36564875wms.39.1672937072403; Thu, 05 Jan 2023 08:44:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/34] hw/timer/imx_epit: remove explicit fields cnt and freq Date: Thu, 5 Jan 2023 16:43:59 +0000 Message-Id: <20230105164417.3994639-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Axel Heider The CNT register is a read-only register. There is no need to store it's value, it can be calculated on demand. The calculated frequency is needed temporarily only. Note that this is a migration compatibility break for all boards types that use the EPIT peripheral. Signed-off-by: Axel Heider Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/timer/imx_epit.h | 2 - hw/timer/imx_epit.c | 73 ++++++++++++++----------------------- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h index 783eaf0c3a6..79aff0cec20 100644 --- a/include/hw/timer/imx_epit.h +++ b/include/hw/timer/imx_epit.h @@ -74,9 +74,7 @@ struct IMXEPITState { uint32_t sr; uint32_t lr; uint32_t cmp; - uint32_t cnt; - uint32_t freq; qemu_irq irq; }; diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index e04427542ff..cf134961650 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -73,27 +73,14 @@ static void imx_epit_update_int(IMXEPITState *s) } } -/* - * Must be called from within a ptimer_transaction_begin/commit block - * for both s->timer_cmp and s->timer_reload. - */ -static void imx_epit_set_freq(IMXEPITState *s) +static uint32_t imx_epit_get_freq(IMXEPITState *s) { - uint32_t clksrc; - uint32_t prescaler; - - clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, CR_CLKSRC_BITS); - prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS); - - s->freq = imx_ccm_get_clock_frequency(s->ccm, - imx_epit_clocks[clksrc]) / prescaler; - - DPRINTF("Setting ptimer frequency to %u\n", s->freq); - - if (s->freq) { - ptimer_set_freq(s->timer_reload, s->freq); - ptimer_set_freq(s->timer_cmp, s->freq); - } + uint32_t clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, CR_CLKSRC_BITS); + uint32_t prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS); + uint32_t f_in = imx_ccm_get_clock_frequency(s->ccm, imx_epit_clocks[clksrc]); + uint32_t freq = f_in / prescaler; + DPRINTF("ptimer frequency is %u\n", freq); + return freq; } /* @@ -110,32 +97,23 @@ static void imx_epit_reset(IMXEPITState *s, bool is_hard_reset) s->sr = 0; s->lr = EPIT_TIMER_MAX; s->cmp = 0; - s->cnt = 0; ptimer_transaction_begin(s->timer_cmp); ptimer_transaction_begin(s->timer_reload); - /* stop both timers */ + + /* + * The reset switches off the input clock, so even if the CR.EN is still + * set, the timers are no longer running. + */ + assert(imx_epit_get_freq(s) == 0); ptimer_stop(s->timer_cmp); ptimer_stop(s->timer_reload); - /* compute new frequency */ - imx_epit_set_freq(s); /* init both timers to EPIT_TIMER_MAX */ ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1); ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1); - if (s->freq && (s->cr & CR_EN)) { - /* if the timer is still enabled, restart it */ - ptimer_run(s->timer_reload, 0); - } ptimer_transaction_commit(s->timer_cmp); ptimer_transaction_commit(s->timer_reload); } -static uint32_t imx_epit_update_count(IMXEPITState *s) -{ - s->cnt = ptimer_get_count(s->timer_reload); - - return s->cnt; -} - static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size) { IMXEPITState *s = IMX_EPIT(opaque); @@ -159,8 +137,7 @@ static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size) break; case 4: /* CNT */ - imx_epit_update_count(s); - reg_value = s->cnt; + reg_value = ptimer_get_count(s->timer_reload); break; default: @@ -179,7 +156,7 @@ static void imx_epit_reload_compare_timer(IMXEPITState *s) { if ((s->cr & (CR_EN | CR_OCIEN)) == (CR_EN | CR_OCIEN)) { /* if the compare feature is on and timers are running */ - uint32_t tmp = imx_epit_update_count(s); + uint32_t tmp = ptimer_get_count(s->timer_reload); uint64_t next; if (tmp > s->cmp) { /* It'll fire in this round of the timer */ @@ -193,6 +170,7 @@ static void imx_epit_reload_compare_timer(IMXEPITState *s) static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) { + uint32_t freq = 0; uint32_t oldcr = s->cr; s->cr = value & 0x03ffffff; @@ -217,12 +195,19 @@ static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) ptimer_transaction_begin(s->timer_cmp); ptimer_transaction_begin(s->timer_reload); - /* Update the frequency. Has been done already in case of a reset. */ + /* + * Update the frequency. In case of a reset the input clock was + * switched off, so this can be skipped. + */ if (!(s->cr & CR_SWR)) { - imx_epit_set_freq(s); + freq = imx_epit_get_freq(s); + if (freq) { + ptimer_set_freq(s->timer_reload, freq); + ptimer_set_freq(s->timer_cmp, freq); + } } - if (s->freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) { + if (freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) { if (s->cr & CR_ENMOD) { if (s->cr & CR_RLD) { ptimer_set_limit(s->timer_reload, s->lr, 1); @@ -356,15 +341,13 @@ static const MemoryRegionOps imx_epit_ops = { static const VMStateDescription vmstate_imx_timer_epit = { .name = TYPE_IMX_EPIT, - .version_id = 2, - .minimum_version_id = 2, + .version_id = 3, + .minimum_version_id = 3, .fields = (VMStateField[]) { VMSTATE_UINT32(cr, IMXEPITState), VMSTATE_UINT32(sr, IMXEPITState), VMSTATE_UINT32(lr, IMXEPITState), VMSTATE_UINT32(cmp, IMXEPITState), - VMSTATE_UINT32(cnt, IMXEPITState), - VMSTATE_UINT32(freq, IMXEPITState), VMSTATE_PTIMER(timer_reload, IMXEPITState), VMSTATE_PTIMER(timer_cmp, IMXEPITState), VMSTATE_END_OF_LIST() From patchwork Thu Jan 5 16:44:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639289 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp326105pvb; Thu, 5 Jan 2023 08:58:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXufaVRSU2cF2u95VkiX36HaRel1m7YuJTYgrI56oZc9bBsItIQ+4rxZ+zdegzrmtXu0LoF5 X-Received: by 2002:ac8:4789:0:b0:3a8:3028:ce4a with SMTP id k9-20020ac84789000000b003a83028ce4amr70216890qtq.53.1672937931681; Thu, 05 Jan 2023 08:58:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937931; cv=none; d=google.com; s=arc-20160816; b=zaFpryHusAn6EJ7b2CD0KpBhKf6wRNKNBfXKrlQkugU7oggawsl2wi+H2ZhHDOhBnl Hf9gic3yo+6EKaFit+Q6+ceoMGICzYfoDssDIp0l1NhTxu+mBoS0HPzsGQquinYQw4xq oCPaP2Jm3LUW05t5v7rvnZ4YP5WaheAzQtkF25OVjqYfNnNea7zQ4LOvAK1uUUM7U6lg kKpMbgd9YN5I4nONLbdqQr27PdyW7pNhh1ftvCS/oecxa+U+KsabFoA1oGh0WohnG+Vz Wk0QyC4lQZj7b6VO89M+5JAi18JKUtGbp3PejJSsHj7lrYZM/3J41lbN5sorF9rx6hJ+ 41nQ== 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=v5vPLrOJerSouBci4jbMD3472GqmuD+aNRfNrDgOb8Y=; b=TtoHdMLgg8Z5HYGmpS/D1VpTPqgMqPbHrIsJYFwgG5onSxNKAN43Xp6jtjtXQ4g8c/ 6dJK9KfQzCasdaEKxtl3WbhPH06T2HcdRN3yejKCSc4M9LUW+isqQ/p9Foqfg1s0eaBx h4RQlgsW8EQcEycKH/GtC7kQ6rcQoCD3BfCeLGe3gCPF8N/1AFT5KFSg5+Y8NgUL00yr 07kqondIcr35L4gp6i6vuWDNcYDWitBJRFo1NWvwQ8vR4zpkM4g5z15GmxDReW1Ep479 ZHzvFHImA8l8TBpA+tkWRBum1F9LtstDqPaM8tuNeBgFUbF0acjYGV+rXlTFcHHMbBpW f8ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y3Sh5nuy; 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 fy21-20020a05622a5a1500b0035a6b8181cbsi21037278qtb.688.2023.01.05.08.58.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:58:51 -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=y3Sh5nuy; 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 1pDTML-0000qm-F3; Thu, 05 Jan 2023 11:44:53 -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 1pDTM4-0000c3-H7 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:36 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTM2-0007Q6-Go for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:36 -0500 Received: by mail-wm1-x32c.google.com with SMTP id o15so28448996wmr.4 for ; Thu, 05 Jan 2023 08:44:34 -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=v5vPLrOJerSouBci4jbMD3472GqmuD+aNRfNrDgOb8Y=; b=y3Sh5nuyHPjFBGOU7+t84fL56vXA61w2dFp8rLYnQVA82R2JGKbMzVlIW4oZlU+Ew3 j5f2L4Q7mnjZH61YA5OC67Fdu5ULBsvkS5TYhhyfgY9HcrEOVOP+d6PGxB+zue4EBAeP iKj4S+pvAyRWLGLgglGtwbt00IOaRLs++Dt/xtnfh7Uskv0HAVMJEC4FHAQHKHHorE// wojRxMsAVheRozIrpI3FFPYiN3kT0A8lmk2cQShZCJ1xqTp6oUlHM9mv6S6DiGyAt0VJ S7G80++Q4Pi+YogyHFMkknDhE9AbayBXBoIwV59MvL8iiZ0vpLLBK5huyEXzfpT6ZtHt BnyQ== 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=v5vPLrOJerSouBci4jbMD3472GqmuD+aNRfNrDgOb8Y=; b=oZYPwT34qyXWBfUHzDqoFAkZJhzumrme/kR7THIX7xlGjP0nUSkafq6KjQhlBXyr+7 mqdF/GxRZ28hIHVlOEpC6xRlIXMNu/C4EJZwR8CA/xFI5u2JVnHzS7Vkftl3pZLSm8pB EElh4xVU0tPcYsg5I6X7vmYciI69X9kmYBzSAKUi6tUN9mr5UPE1N3BAiC8CbKbuPJDU y+54yRnsV3sNvIW1qX1nfmeIVNTxwzkHNNEej+bH0/1SiurUgsL7g5OyRi2DMLbQoF2O OFU0aZ3yX35t1+ZYkehxA7zDfadM21v8TQlJDTz2vvHSlm9oRMep5mG0hZxUJXgswh+N 0ZSQ== X-Gm-Message-State: AFqh2kqR2u4fpnRBmQoJ31JRMewAuFQZ/ISc+2paFZzdJ4GwNh7/ANKI kfpM13B0+mVlOYQ8gfgdDfsrJVmsqWLUH2kZ X-Received: by 2002:a1c:790a:0:b0:3d6:b691:b814 with SMTP id l10-20020a1c790a000000b003d6b691b814mr36437655wme.1.1672937073171; Thu, 05 Jan 2023 08:44:33 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/34] hw/timer/imx_epit: fix compare timer handling Date: Thu, 5 Jan 2023 16:44:00 +0000 Message-Id: <20230105164417.3994639-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Axel Heider - fix #1263 for CR writes - rework compare time handling - The compare timer has to run even if CR.OCIEN is not set, as SR.OCIF must be updated. - The compare timer fires exactly once when the compare value is less than the current value, but the reload values is less than the compare value. - The compare timer will never fire if the reload value is less than the compare value. Disable it in this case. Signed-off-by: Axel Heider [PMM: fixed minor style nits] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/imx_epit.c | 192 ++++++++++++++++++++++++++------------------ 1 file changed, 116 insertions(+), 76 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index cf134961650..3a869782bcd 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -6,6 +6,7 @@ * Originally written by Hans Jiang * Updated by Peter Chubb * Updated by Jean-Christophe Dubois + * Updated by Axel Heider * * This code is licensed under GPL version 2 or later. See * the COPYING file in the top-level directory. @@ -151,33 +152,126 @@ static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size) return reg_value; } -/* Must be called from ptimer_transaction_begin/commit block for s->timer_cmp */ -static void imx_epit_reload_compare_timer(IMXEPITState *s) +/* + * Must be called from a ptimer_transaction_begin/commit block for + * s->timer_cmp, but outside of a transaction block of s->timer_reload, + * so the proper counter value is read. + */ +static void imx_epit_update_compare_timer(IMXEPITState *s) { - if ((s->cr & (CR_EN | CR_OCIEN)) == (CR_EN | CR_OCIEN)) { - /* if the compare feature is on and timers are running */ - uint32_t tmp = ptimer_get_count(s->timer_reload); - uint64_t next; - if (tmp > s->cmp) { - /* It'll fire in this round of the timer */ - next = tmp - s->cmp; - } else { /* catch it next time around */ - next = tmp - s->cmp + ((s->cr & CR_RLD) ? EPIT_TIMER_MAX : s->lr); + uint64_t counter = 0; + bool is_oneshot = false; + /* + * The compare timer only has to run if the timer peripheral is active + * and there is an input clock, Otherwise it can be switched off. + */ + bool is_active = (s->cr & CR_EN) && imx_epit_get_freq(s); + if (is_active) { + /* + * Calculate next timeout for compare timer. Reading the reload + * counter returns proper results only if pending transactions + * on it are committed here. Otherwise stale values are be read. + */ + counter = ptimer_get_count(s->timer_reload); + uint64_t limit = ptimer_get_limit(s->timer_cmp); + /* + * The compare timer is a periodic timer if the limit is at least + * the compare value. Otherwise it may fire at most once in the + * current round. + */ + bool is_oneshot = (limit >= s->cmp); + if (counter >= s->cmp) { + /* The compare timer fires in the current round. */ + counter -= s->cmp; + } else if (!is_oneshot) { + /* + * The compare timer fires after a reload, as it is below the + * compare value already in this round. Note that the counter + * value calculated below can be above the 32-bit limit, which + * is legal here because the compare timer is an internal + * helper ptimer only. + */ + counter += limit - s->cmp; + } else { + /* + * The compare timer won't fire in this round, and the limit is + * set to a value below the compare value. This practically means + * it will never fire, so it can be switched off. + */ + is_active = false; } - ptimer_set_count(s->timer_cmp, next); } + + /* + * Set the compare timer and let it run, or stop it. This is agnostic + * of CR.OCIEN bit, as this bit affects interrupt generation only. The + * compare timer needs to run even if no interrupts are to be generated, + * because the SR.OCIF bit must be updated also. + * Note that the timer might already be stopped or be running with + * counter values. However, finding out when an update is needed and + * when not is not trivial. It's much easier applying the setting again, + * as this does not harm either and the overhead is negligible. + */ + if (is_active) { + ptimer_set_count(s->timer_cmp, counter); + ptimer_run(s->timer_cmp, is_oneshot ? 1 : 0); + } else { + ptimer_stop(s->timer_cmp); + } + } static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) { - uint32_t freq = 0; uint32_t oldcr = s->cr; s->cr = value & 0x03ffffff; if (s->cr & CR_SWR) { - /* handle the reset */ + /* + * Reset clears CR.SWR again. It does not touch CR.EN, but the timers + * are still stopped because the input clock is disabled. + */ imx_epit_reset(s, false); + } else { + uint32_t freq; + uint32_t toggled_cr_bits = oldcr ^ s->cr; + /* re-initialize the limits if CR.RLD has changed */ + bool set_limit = toggled_cr_bits & CR_RLD; + /* set the counter if the timer got just enabled and CR.ENMOD is set */ + bool is_switched_on = (toggled_cr_bits & s->cr) & CR_EN; + bool set_counter = is_switched_on && (s->cr & CR_ENMOD); + + ptimer_transaction_begin(s->timer_cmp); + ptimer_transaction_begin(s->timer_reload); + freq = imx_epit_get_freq(s); + if (freq) { + ptimer_set_freq(s->timer_reload, freq); + ptimer_set_freq(s->timer_cmp, freq); + } + + if (set_limit || set_counter) { + uint64_t limit = (s->cr & CR_RLD) ? s->lr : EPIT_TIMER_MAX; + ptimer_set_limit(s->timer_reload, limit, set_counter ? 1 : 0); + if (set_limit) { + ptimer_set_limit(s->timer_cmp, limit, 0); + } + } + /* + * If there is an input clock and the peripheral is enabled, then + * ensure the wall clock timer is ticking. Otherwise stop the timers. + * The compare timer will be updated later. + */ + if (freq && (s->cr & CR_EN)) { + ptimer_run(s->timer_reload, 0); + } else { + ptimer_stop(s->timer_reload); + } + /* Commit changes to reload timer, so they can propagate. */ + ptimer_transaction_commit(s->timer_reload); + /* Update compare timer based on the committed reload timer value. */ + imx_epit_update_compare_timer(s); + ptimer_transaction_commit(s->timer_cmp); } /* @@ -186,60 +280,6 @@ static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) * - write to CR.EN or CR.OCIE */ imx_epit_update_int(s); - - /* - * TODO: could we 'break' here for reset? following operations appear - * to duplicate the work imx_epit_reset() already did. - */ - - ptimer_transaction_begin(s->timer_cmp); - ptimer_transaction_begin(s->timer_reload); - - /* - * Update the frequency. In case of a reset the input clock was - * switched off, so this can be skipped. - */ - if (!(s->cr & CR_SWR)) { - freq = imx_epit_get_freq(s); - if (freq) { - ptimer_set_freq(s->timer_reload, freq); - ptimer_set_freq(s->timer_cmp, freq); - } - } - - if (freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) { - if (s->cr & CR_ENMOD) { - if (s->cr & CR_RLD) { - ptimer_set_limit(s->timer_reload, s->lr, 1); - ptimer_set_limit(s->timer_cmp, s->lr, 1); - } else { - ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1); - ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1); - } - } - - imx_epit_reload_compare_timer(s); - ptimer_run(s->timer_reload, 0); - if (s->cr & CR_OCIEN) { - ptimer_run(s->timer_cmp, 0); - } else { - ptimer_stop(s->timer_cmp); - } - } else if (!(s->cr & CR_EN)) { - /* stop both timers */ - ptimer_stop(s->timer_reload); - ptimer_stop(s->timer_cmp); - } else if (s->cr & CR_OCIEN) { - if (!(oldcr & CR_OCIEN)) { - imx_epit_reload_compare_timer(s); - ptimer_run(s->timer_cmp, 0); - } - } else { - ptimer_stop(s->timer_cmp); - } - - ptimer_transaction_commit(s->timer_cmp); - ptimer_transaction_commit(s->timer_reload); } static void imx_epit_write_sr(IMXEPITState *s, uint32_t value) @@ -266,14 +306,10 @@ static void imx_epit_write_lr(IMXEPITState *s, uint32_t value) /* If IOVW bit is set then set the timer value */ ptimer_set_count(s->timer_reload, s->lr); } - /* - * Commit the change to s->timer_reload, so it can propagate. Otherwise - * the timer interrupt may not fire properly. The commit must happen - * before calling imx_epit_reload_compare_timer(), which reads - * s->timer_reload internally again. - */ + /* Commit the changes to s->timer_reload, so they can propagate. */ ptimer_transaction_commit(s->timer_reload); - imx_epit_reload_compare_timer(s); + /* Update the compare timer based on the committed reload timer value. */ + imx_epit_update_compare_timer(s); ptimer_transaction_commit(s->timer_cmp); } @@ -281,8 +317,9 @@ static void imx_epit_write_cmp(IMXEPITState *s, uint32_t value) { s->cmp = value; + /* Update the compare timer based on the committed reload timer value. */ ptimer_transaction_begin(s->timer_cmp); - imx_epit_reload_compare_timer(s); + imx_epit_update_compare_timer(s); ptimer_transaction_commit(s->timer_cmp); } @@ -322,6 +359,9 @@ static void imx_epit_cmp(void *opaque) { IMXEPITState *s = IMX_EPIT(opaque); + /* The cmp ptimer can't be running when the peripheral is disabled */ + assert(s->cr & CR_EN); + DPRINTF("sr was %d\n", s->sr); /* Set interrupt status bit SR.OCIF and update the interrupt state */ s->sr |= SR_OCIF; From patchwork Thu Jan 5 16:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639287 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp325553pvb; Thu, 5 Jan 2023 08:57:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXuIA9Xzm1FGTGtjuV3zZRFXjAPPxjftrLtnmAw3Ycgu+8IPRidnCZvpbjLA7AAzHpdgog2a X-Received: by 2002:a05:622a:5814:b0:3a5:af69:408a with SMTP id fg20-20020a05622a581400b003a5af69408amr90564638qtb.67.1672937838373; Thu, 05 Jan 2023 08:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937838; cv=none; d=google.com; s=arc-20160816; b=dNbC4zkwyJMYaxTzPjIE7kQNKNNfHwB60XVtf5LccFAct0NvBiAf6fb9KX6mI2OLCs +qeHuek4V+LsYmcAYOALCortQj9SvmQ7KHnDskoj2ZRBh8VgwNRCyPYNoQo7F0//WzK7 IMVTsHg1KJaIYdeO6qcMd9OqzeRqxiAzkFhi9P77zn8Z4XECBr37uo5an+JOYGHbRYEG dSVLQFJnKbp0NmiRcqBsN8Olroi8vIA29ELNnTooYYFHwWhuC6oOjI+7WJZgpyqkGlzh irqSRgz30EHcZnsKvXn2z5eaXaLf274BWRR6NmcdYc94z0DdLaPB2lOQrRejrEczadTY J+7w== 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=Iv7iewiQXPKui2BoDF1siilf+8tNwWAMXxG4GDV6wp8=; b=LeBzFHEQQ6G+fCNBqZD0uAy518BXppet4dam7ipTR9uUqZSFj2rdUkGsxUuPKZ6v8Y k7WVro/gMzPOcEDzogvfLuvJy1qsSjfT3cMvx2VhJc0ZMJ8M2q7ZQkzwu+uN79bnqDHz +euvCqFm7WGHtTmb2lBL/1sIvkzc4FMQbFqmkWEUrxn5z6qFac27BxbWvW90UujSVE3I kntNgpZQSFIhSy4faGyC32WYQlQ51WhMoGGpQFXrY+LXPnW3Yx7n/bc+o6I7mHIB10xb xL2EDAaRUEmAEK1dCl/a2MV7cOGT0vhZtk92hRPfqn7uwixY8UJl0sYfD1mZ8GUz3oHo OD/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QW0Dl1qa; 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 bx6-20020a05622a090600b0035d696d54basi21092521qtb.151.2023.01.05.08.57.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:57:18 -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=QW0Dl1qa; 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 1pDTNp-00021R-NJ; Thu, 05 Jan 2023 11:46:27 -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 1pDTM7-0000gw-SV for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:41 -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 1pDTM3-0007NS-8U for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:39 -0500 Received: by mail-wm1-x32a.google.com with SMTP id ay40so28487158wmb.2 for ; Thu, 05 Jan 2023 08:44:34 -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=Iv7iewiQXPKui2BoDF1siilf+8tNwWAMXxG4GDV6wp8=; b=QW0Dl1qaIcWWTV1DNuQwIzIPgh+2Pv/t49ugeZ0U0RdUP5a6+w5YuVyRs5G84axT0B 8tQULhK0PbctX4S6vZI5LwzQHTB373A/EIAZbXE1LdPS2MmUe6JoFYKvVfZRf2yidskW SHZQtC/FLXTs58jPFhUudfvpFAmzHVuI44iB1dQD0nFjGVxFM7TRf78lmDlcHQYtvXOm 3bste1UAAdxfLoSe6roZXBdNntTmDp17LEVbR96kipYOT8rsiYQ+90u8c63dt3UzAlQh ElpVGz7E/xX4kmAouyxnDoXadXMmzqe2hKEVs4bhRiKSENb4dmVP99Z2OiKRMN/PARAg f/qA== 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=Iv7iewiQXPKui2BoDF1siilf+8tNwWAMXxG4GDV6wp8=; b=V/2E4GPL20zn85rI1XD7SqBUuN67CJACBmmlqX1kRWXggvbTEO6ql5fHCAl0aOZxSV R0MBV1x6nDmAy2QPt5zNZ/lQ7SZo0FdTjOlKZ/sJ6TXskb4GiTiE7dLrQabmMuKIsJvL C1cLOR1GN7ptRFQ6CYqTsPUoxNIaT0doljZgo0qMrzPDGmpt1VQox0XGJdF9by+6FUNx 2x5An8jeKxmO+29087U5X8gMJkTekrbPGudvrrw0CiVq6ZNBJT7SgDZWk187UStjqBvv 927gOZON4TPKJhUzJ1EbBjPZA6F1fZ5Cg7zZW7JoCmFcC6TdM+OahA3dmbt0K7OUdmEW plAg== X-Gm-Message-State: AFqh2krjK+JreeUjz38Ybl6I7UB56n4BFspGw7hgdwKLXy++ioEbMH6k 2GlLyFQ5twxbnfEgxqtvxSC0GHoTN7xY5ZVg X-Received: by 2002:a05:600c:4e04:b0:3d2:381f:2db5 with SMTP id b4-20020a05600c4e0400b003d2381f2db5mr36005695wmq.22.1672937074063; Thu, 05 Jan 2023 08:44:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/34] target/arm: Fix checkpatch comment style warnings in helper.c Date: Thu, 5 Jan 2023 16:44:01 +0000 Message-Id: <20230105164417.3994639-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Fabiano Rosas Fix these: WARNING: Block comments use a leading /* on a separate line WARNING: Block comments use * on subsequent lines WARNING: Block comments use a trailing */ on a separate line Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana Reviewed-by: Cornelia Huck Message-id: 20221213190537.511-2-farosas@suse.de Signed-off-by: Peter Maydell --- target/arm/helper.c | 323 +++++++++++++++++++++++++++++--------------- 1 file changed, 215 insertions(+), 108 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index b13f6ff328c..a5f96ab77dd 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -83,7 +83,8 @@ uint64_t read_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri) static void write_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t v) { - /* Raw write of a coprocessor register (as needed for migration, etc). + /* + * Raw write of a coprocessor register (as needed for migration, etc). * Note that constant registers are treated as write-ignored; the * caller should check for success by whether a readback gives the * value written. @@ -101,7 +102,8 @@ static void write_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri, static bool raw_accessors_invalid(const ARMCPRegInfo *ri) { - /* Return true if the regdef would cause an assertion if you called + /* + * Return true if the regdef would cause an assertion if you called * read_raw_cp_reg() or write_raw_cp_reg() on it (ie if it is a * program bug for it not to have the NO_RAW flag). * NB that returning false here doesn't necessarily mean that calling @@ -184,7 +186,8 @@ bool write_list_to_cpustate(ARMCPU *cpu) if (ri->type & ARM_CP_NO_RAW) { continue; } - /* Write value and confirm it reads back as written + /* + * Write value and confirm it reads back as written * (to catch read-only registers and partially read-only * registers where the incoming migration value doesn't match) */ @@ -237,7 +240,8 @@ static gint cpreg_key_compare(gconstpointer a, gconstpointer b) void init_cpreg_list(ARMCPU *cpu) { - /* Initialise the cpreg_tuples[] array based on the cp_regs hash. + /* + * Initialise the cpreg_tuples[] array based on the cp_regs hash. * Note that we require cpreg_tuples[] to be sorted by key ID. */ GList *keys; @@ -279,7 +283,8 @@ static CPAccessResult access_el3_aa32ns(CPUARMState *env, return CP_ACCESS_OK; } -/* Some secure-only AArch32 registers trap to EL3 if used from +/* + * Some secure-only AArch32 registers trap to EL3 if used from * Secure EL1 (but are just ordinary UNDEF in other non-EL3 contexts). * Note that an access from Secure EL1 can only happen if EL3 is AArch64. * We assume that the .access field is set to PL1_RW. @@ -301,7 +306,8 @@ static CPAccessResult access_trap_aa32s_el1(CPUARMState *env, return CP_ACCESS_TRAP_UNCATEGORIZED; } -/* Check for traps to performance monitor registers, which are controlled +/* + * Check for traps to performance monitor registers, which are controlled * by MDCR_EL2.TPM for EL2 and MDCR_EL3.TPM for EL3. */ static CPAccessResult access_tpm(CPUARMState *env, const ARMCPRegInfo *ri, @@ -399,7 +405,8 @@ static void fcse_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) ARMCPU *cpu = env_archcpu(env); if (raw_read(env, ri) != value) { - /* Unlike real hardware the qemu TLB uses virtual addresses, + /* + * Unlike real hardware the qemu TLB uses virtual addresses, * not modified virtual addresses, so this causes a TLB flush. */ tlb_flush(CPU(cpu)); @@ -414,7 +421,8 @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri, if (raw_read(env, ri) != value && !arm_feature(env, ARM_FEATURE_PMSA) && !extended_addresses_enabled(env)) { - /* For VMSA (when not using the LPAE long descriptor page table + /* + * For VMSA (when not using the LPAE long descriptor page table * format) this register includes the ASID, so do a TLB flush. * For PMSA it is purely a process ID and no action is needed. */ @@ -606,7 +614,8 @@ static void tlbiipas2is_hyp_write(CPUARMState *env, const ARMCPRegInfo *ri, } static const ARMCPRegInfo cp_reginfo[] = { - /* Define the secure and non-secure FCSE identifier CP registers + /* + * Define the secure and non-secure FCSE identifier CP registers * separately because there is no secure bank in V8 (no _EL3). This allows * the secure register to be properly reset and migrated. There is also no * v8 EL1 version of the register so the non-secure instance stands alone. @@ -621,7 +630,8 @@ static const ARMCPRegInfo cp_reginfo[] = { .access = PL1_RW, .secure = ARM_CP_SECSTATE_S, .fieldoffset = offsetof(CPUARMState, cp15.fcseidr_s), .resetvalue = 0, .writefn = fcse_write, .raw_writefn = raw_write, }, - /* Define the secure and non-secure context identifier CP registers + /* + * Define the secure and non-secure context identifier CP registers * separately because there is no secure bank in V8 (no _EL3). This allows * the secure register to be properly reset and migrated. In the * non-secure case, the 32-bit register will have reset and migration @@ -642,7 +652,8 @@ static const ARMCPRegInfo cp_reginfo[] = { }; static const ARMCPRegInfo not_v8_cp_reginfo[] = { - /* NB: Some of these registers exist in v8 but with more precise + /* + * NB: Some of these registers exist in v8 but with more precise * definitions that don't use CP_ANY wildcards (mostly in v8_cp_reginfo[]). */ /* MMU Domain access control / MPU write buffer control */ @@ -652,7 +663,8 @@ static const ARMCPRegInfo not_v8_cp_reginfo[] = { .writefn = dacr_write, .raw_writefn = raw_write, .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.dacr_s), offsetoflow32(CPUARMState, cp15.dacr_ns) } }, - /* ARMv7 allocates a range of implementation defined TLB LOCKDOWN regs. + /* + * ARMv7 allocates a range of implementation defined TLB LOCKDOWN regs. * For v6 and v5, these mappings are overly broad. */ { .name = "TLB_LOCKDOWN", .cp = 15, .crn = 10, .crm = 0, @@ -670,7 +682,8 @@ static const ARMCPRegInfo not_v8_cp_reginfo[] = { }; static const ARMCPRegInfo not_v6_cp_reginfo[] = { - /* Not all pre-v6 cores implemented this WFI, so this is slightly + /* + * Not all pre-v6 cores implemented this WFI, so this is slightly * over-broad. */ { .name = "WFI_v5", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = 2, @@ -678,12 +691,14 @@ static const ARMCPRegInfo not_v6_cp_reginfo[] = { }; static const ARMCPRegInfo not_v7_cp_reginfo[] = { - /* Standard v6 WFI (also used in some pre-v6 cores); not in v7 (which + /* + * Standard v6 WFI (also used in some pre-v6 cores); not in v7 (which * is UNPREDICTABLE; we choose to NOP as most implementations do). */ { .name = "WFI_v6", .cp = 15, .crn = 7, .crm = 0, .opc1 = 0, .opc2 = 4, .access = PL1_W, .type = ARM_CP_WFI }, - /* L1 cache lockdown. Not architectural in v6 and earlier but in practice + /* + * L1 cache lockdown. Not architectural in v6 and earlier but in practice * implemented in 926, 946, 1026, 1136, 1176 and 11MPCore. StrongARM and * OMAPCP will override this space. */ @@ -697,14 +712,16 @@ static const ARMCPRegInfo not_v7_cp_reginfo[] = { { .name = "DUMMY", .cp = 15, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = CP_ANY, .access = PL1_R, .type = ARM_CP_CONST | ARM_CP_NO_RAW, .resetvalue = 0 }, - /* We don't implement pre-v7 debug but most CPUs had at least a DBGDIDR; + /* + * We don't implement pre-v7 debug but most CPUs had at least a DBGDIDR; * implementing it as RAZ means the "debug architecture version" bits * will read as a reserved value, which should cause Linux to not try * to use the debug hardware. */ { .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL0_R, .type = ARM_CP_CONST, .resetvalue = 0 }, - /* MMU TLB control. Note that the wildcarding means we cover not just + /* + * MMU TLB control. Note that the wildcarding means we cover not just * the unified TLB ops but also the dside/iside/inner-shareable variants. */ { .name = "TLBIALL", .cp = 15, .crn = 8, .crm = CP_ANY, @@ -732,7 +749,8 @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, /* In ARMv8 most bits of CPACR_EL1 are RES0. */ if (!arm_feature(env, ARM_FEATURE_V8)) { - /* ARMv7 defines bits for unimplemented coprocessors as RAZ/WI. + /* + * ARMv7 defines bits for unimplemented coprocessors as RAZ/WI. * ASEDIS [31] and D32DIS [30] are both UNK/SBZP without VFP. * TRCDIS [28] is RAZ/WI since we do not implement a trace macrocell. */ @@ -748,7 +766,8 @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, value |= R_CPACR_ASEDIS_MASK; } - /* VFPv3 and upwards with NEON implement 32 double precision + /* + * VFPv3 and upwards with NEON implement 32 double precision * registers (D0-D31). */ if (!cpu_isar_feature(aa32_simd_r32, env_archcpu(env))) { @@ -790,7 +809,8 @@ static uint64_t cpacr_read(CPUARMState *env, const ARMCPRegInfo *ri) static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri) { - /* Call cpacr_write() so that we reset with the correct RAO bits set + /* + * Call cpacr_write() so that we reset with the correct RAO bits set * for our CPU features. */ cpacr_write(env, ri, 0); @@ -831,7 +851,8 @@ static const ARMCPRegInfo v6_cp_reginfo[] = { { .name = "MVA_prefetch", .cp = 15, .crn = 7, .crm = 13, .opc1 = 0, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NOP }, - /* We need to break the TB after ISB to execute self-modifying code + /* + * We need to break the TB after ISB to execute self-modifying code * correctly and also to take any pending interrupts immediately. * So use arm_cp_write_ignore() function instead of ARM_CP_NOP flag. */ @@ -846,7 +867,8 @@ static const ARMCPRegInfo v6_cp_reginfo[] = { .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ifar_s), offsetof(CPUARMState, cp15.ifar_ns) }, .resetvalue = 0, }, - /* Watchpoint Fault Address Register : should actually only be present + /* + * Watchpoint Fault Address Register : should actually only be present * for 1136, 1176, 11MPCore. */ { .name = "WFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1, @@ -1051,7 +1073,8 @@ static bool event_supported(uint16_t number) static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { - /* Performance monitor registers user accessibility is controlled + /* + * Performance monitor registers user accessibility is controlled * by PMUSERENR. MDCR_EL2.TPM and MDCR_EL3.TPM allow configurable * trapping to EL2 or EL3 for other accesses. */ @@ -1139,7 +1162,8 @@ static CPAccessResult pmreg_access_ccntr(CPUARMState *env, (MDCR_HPME | MDCR_HPMD | MDCR_HPMN | MDCR_HCCD | MDCR_HLP) #define MDCR_EL3_PMU_ENABLE_BITS (MDCR_SPME | MDCR_SCCD) -/* Returns true if the counter (pass 31 for PMCCNTR) should count events using +/* + * Returns true if the counter (pass 31 for PMCCNTR) should count events using * the current EL, security state, and register configuration. */ static bool pmu_counter_enabled(CPUARMState *env, uint8_t counter) @@ -1503,7 +1527,8 @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri) static void pmselr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* The value of PMSELR.SEL affects the behavior of PMXEVTYPER and + /* + * The value of PMSELR.SEL affects the behavior of PMXEVTYPER and * PMXEVCNTR. We allow [0..31] to be written to PMSELR here; in the * meanwhile, we check PMSELR.SEL when PMXEVTYPER and PMXEVCNTR are * accessed. @@ -1614,7 +1639,8 @@ static void pmevtyper_write(CPUARMState *env, const ARMCPRegInfo *ri, env->cp15.c14_pmevtyper[counter] = value & PMXEVTYPER_MASK; pmevcntr_op_finish(env, counter); } - /* Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when + /* + * Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when * PMSELR value is equal to or greater than the number of implemented * counters, but not equal to 0x1f. We opt to behave as a RAZ/WI. */ @@ -1715,8 +1741,10 @@ static uint64_t pmevcntr_read(CPUARMState *env, const ARMCPRegInfo *ri, } return ret; } else { - /* We opt to behave as a RAZ/WI when attempts to access PM[X]EVCNTR - * are CONSTRAINED UNPREDICTABLE. */ + /* + * We opt to behave as a RAZ/WI when attempts to access PM[X]EVCNTR + * are CONSTRAINED UNPREDICTABLE. + */ return 0; } } @@ -1791,7 +1819,8 @@ static void pmintenclr_write(CPUARMState *env, const ARMCPRegInfo *ri, static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* Note that even though the AArch64 view of this register has bits + /* + * Note that even though the AArch64 view of this register has bits * [10:0] all RES0 we can only mask the bottom 5, to comply with the * architectural requirements for bits which are RES0 only in some * contexts. (ARMv8 would permit us to do no masking at all, but ARMv7 @@ -1854,7 +1883,8 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) if (!arm_feature(env, ARM_FEATURE_EL2)) { valid_mask &= ~SCR_HCE; - /* On ARMv7, SMD (or SCD as it is called in v7) is only + /* + * On ARMv7, SMD (or SCD as it is called in v7) is only * supported if EL2 exists. The bit is UNK/SBZP when * EL2 is unavailable. In QEMU ARMv7, we force it to always zero * when EL2 is unavailable. @@ -1911,7 +1941,8 @@ static uint64_t ccsidr_read(CPUARMState *env, const ARMCPRegInfo *ri) { ARMCPU *cpu = env_archcpu(env); - /* Acquire the CSSELR index from the bank corresponding to the CCSIDR + /* + * Acquire the CSSELR index from the bank corresponding to the CCSIDR * bank */ uint32_t index = A32_BANKED_REG_GET(env, csselr, @@ -1986,7 +2017,8 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { /* the old v6 WFI, UNPREDICTABLE in v7 but we choose to NOP */ { .name = "NOP", .cp = 15, .crn = 7, .crm = 0, .opc1 = 0, .opc2 = 4, .access = PL1_W, .type = ARM_CP_NOP }, - /* Performance monitors are implementation defined in v7, + /* + * Performance monitors are implementation defined in v7, * but with an ARM recommended set of registers, which we * follow. * @@ -2140,7 +2172,8 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .writefn = csselr_write, .resetvalue = 0, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s), offsetof(CPUARMState, cp15.csselr_ns) } }, - /* Auxiliary ID register: this actually has an IMPDEF value but for now + /* + * Auxiliary ID register: this actually has an IMPDEF value but for now * just RAZ for all cores: */ { .name = "AIDR", .state = ARM_CP_STATE_BOTH, @@ -2148,7 +2181,8 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid1, .resetvalue = 0 }, - /* Auxiliary fault status registers: these also are IMPDEF, and we + /* + * Auxiliary fault status registers: these also are IMPDEF, and we * choose to RAZ/WI for all cores. */ { .name = "AFSR0_EL1", .state = ARM_CP_STATE_BOTH, @@ -2159,7 +2193,8 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 1, .access = PL1_RW, .accessfn = access_tvm_trvm, .type = ARM_CP_CONST, .resetvalue = 0 }, - /* MAIR can just read-as-written because we don't implement caches + /* + * MAIR can just read-as-written because we don't implement caches * and so don't need to care about memory attributes. */ { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64, @@ -2171,10 +2206,12 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .opc0 = 3, .opc1 = 6, .crn = 10, .crm = 2, .opc2 = 0, .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[3]), .resetvalue = 0 }, - /* For non-long-descriptor page tables these are PRRR and NMRR; + /* + * For non-long-descriptor page tables these are PRRR and NMRR; * regardless they still act as reads-as-written for QEMU. */ - /* MAIR0/1 are defined separately from their 64-bit counterpart which + /* + * MAIR0/1 are defined separately from their 64-bit counterpart which * allows them to assign the correct fieldoffset based on the endianness * handled in the field definitions. */ @@ -2337,7 +2374,8 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { static CPAccessResult gt_cntfrq_access(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { - /* CNTFRQ: not visible from PL0 if both PL0PCTEN and PL0VCTEN are zero. + /* + * CNTFRQ: not visible from PL0 if both PL0PCTEN and PL0VCTEN are zero. * Writable only at the highest implemented exception level. */ int el = arm_current_el(env); @@ -2496,7 +2534,8 @@ static CPAccessResult gt_stimer_access(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { - /* The AArch64 register view of the secure physical timer is + /* + * The AArch64 register view of the secure physical timer is * always accessible from EL3, and configurably accessible from * Secure EL1. */ @@ -2531,7 +2570,8 @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx) ARMGenericTimer *gt = &cpu->env.cp15.c14_timer[timeridx]; if (gt->ctl & 1) { - /* Timer enabled: calculate and set current ISTATUS, irq, and + /* + * Timer enabled: calculate and set current ISTATUS, irq, and * reset timer to when ISTATUS next has to change */ uint64_t offset = timeridx == GTIMER_VIRT ? @@ -2554,7 +2594,8 @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx) /* Next transition is when we hit cval */ nexttick = gt->cval + offset; } - /* Note that the desired next expiry time might be beyond the + /* + * Note that the desired next expiry time might be beyond the * signed-64-bit range of a QEMUTimer -- in this case we just * set the timer for as far in the future as possible. When the * timer expires we will reset the timer for any remaining period. @@ -2671,7 +2712,8 @@ static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri, /* Enable toggled */ gt_recalc_timer(cpu, timeridx); } else if ((oldval ^ value) & 2) { - /* IMASK toggled: don't need to recalculate, + /* + * IMASK toggled: don't need to recalculate, * just set the interrupt line based on ISTATUS */ int irqstate = (oldval & 4) && !(value & 2); @@ -2982,7 +3024,8 @@ static void arm_gt_cntfrq_reset(CPUARMState *env, const ARMCPRegInfo *opaque) } static const ARMCPRegInfo generic_timer_cp_reginfo[] = { - /* Note that CNTFRQ is purely reads-as-written for the benefit + /* + * Note that CNTFRQ is purely reads-as-written for the benefit * of software; writing it doesn't actually change the timer frequency. * Our reset value matches the fixed frequency we implement the timer at. */ @@ -3145,7 +3188,8 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { .readfn = gt_virt_redir_cval_read, .raw_readfn = raw_read, .writefn = gt_virt_redir_cval_write, .raw_writefn = raw_write, }, - /* Secure timer -- this is actually restricted to only EL3 + /* + * Secure timer -- this is actually restricted to only EL3 * and configurably Secure-EL1 via the accessfn. */ { .name = "CNTPS_TVAL_EL1", .state = ARM_CP_STATE_AA64, @@ -3184,7 +3228,8 @@ static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri, #else -/* In user-mode most of the generic timer registers are inaccessible +/* + * In user-mode most of the generic timer registers are inaccessible * however modern kernels (4.12+) allow access to cntvct_el0 */ @@ -3192,7 +3237,8 @@ static uint64_t gt_virt_cnt_read(CPUARMState *env, const ARMCPRegInfo *ri) { ARMCPU *cpu = env_archcpu(env); - /* Currently we have no support for QEMUTimer in linux-user so we + /* + * Currently we have no support for QEMUTimer in linux-user so we * can't call gt_get_countervalue(env), instead we directly * call the lower level functions. */ @@ -3233,7 +3279,8 @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { if (ri->opc2 & 4) { - /* The ATS12NSO* operations must trap to EL3 or EL2 if executed in + /* + * The ATS12NSO* operations must trap to EL3 or EL2 if executed in * Secure EL1 (which can only happen if EL3 is AArch64). * They are simply UNDEF if executed from NS EL1. * They function normally from EL2 or EL3. @@ -3394,7 +3441,8 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, } } } else { - /* fsr is a DFSR/IFSR value for the short descriptor + /* + * fsr is a DFSR/IFSR value for the short descriptor * translation table format (with WnR always clear). * Convert it to a 32-bit PAR. */ @@ -3899,7 +3947,8 @@ static const ARMCPRegInfo pmsav8r_cp_reginfo[] = { }; static const ARMCPRegInfo pmsav7_cp_reginfo[] = { - /* Reset for all these registers is handled in arm_cpu_reset(), + /* + * Reset for all these registers is handled in arm_cpu_reset(), * because the PMSAv7 is also used by M-profile CPUs, which do * not register cpregs but still need the state to be reset. */ @@ -4000,7 +4049,8 @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri, } if (arm_feature(env, ARM_FEATURE_LPAE)) { - /* With LPAE the TTBCR could result in a change of ASID + /* + * With LPAE the TTBCR could result in a change of ASID * via the TTBCR.A1 bit, so do a TLB flush. */ tlb_flush(CPU(cpu)); @@ -4117,7 +4167,8 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { offsetoflow32(CPUARMState, cp15.tcr_el[1])} }, }; -/* Note that unlike TTBCR, writing to TTBCR2 does not require flushing +/* + * Note that unlike TTBCR, writing to TTBCR2 does not require flushing * qemu tlbs nor adjusting cached masks. */ static const ARMCPRegInfo ttbcr2_reginfo = { @@ -4155,7 +4206,8 @@ static void omap_wfi_write(CPUARMState *env, const ARMCPRegInfo *ri, static void omap_cachemaint_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* On OMAP there are registers indicating the max/min index of dcache lines + /* + * On OMAP there are registers indicating the max/min index of dcache lines * containing a dirty line; cache flush operations have to reset these. */ env->cp15.c15_i_max = 0x000; @@ -4187,7 +4239,8 @@ static const ARMCPRegInfo omap_cp_reginfo[] = { .crm = 8, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .type = ARM_CP_NO_RAW, .readfn = arm_cp_read_zero, .writefn = omap_wfi_write, }, - /* TODO: Peripheral port remap register: + /* + * TODO: Peripheral port remap register: * On OMAP2 mcr p15, 0, rn, c15, c2, 4 sets up the interrupt controller * base address at $rn & ~0xfff and map size of 0x200 << ($rn & 0xfff), * when MMU is off. @@ -4216,7 +4269,8 @@ static const ARMCPRegInfo xscale_cp_reginfo[] = { .cp = 15, .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.c1_xscaleauxcr), .resetvalue = 0, }, - /* XScale specific cache-lockdown: since we have no cache we NOP these + /* + * XScale specific cache-lockdown: since we have no cache we NOP these * and hope the guest does not really rely on cache behaviour. */ { .name = "XSCALE_LOCK_ICACHE_LINE", @@ -4234,7 +4288,8 @@ static const ARMCPRegInfo xscale_cp_reginfo[] = { }; static const ARMCPRegInfo dummy_c15_cp_reginfo[] = { - /* RAZ/WI the whole crn=15 space, when we don't have a more specific + /* + * RAZ/WI the whole crn=15 space, when we don't have a more specific * implementation of this implementation-defined space. * Ideally this should eventually disappear in favour of actually * implementing the correct behaviour for all cores. @@ -4274,7 +4329,8 @@ static const ARMCPRegInfo cache_block_ops_cp_reginfo[] = { }; static const ARMCPRegInfo cache_test_clean_cp_reginfo[] = { - /* The cache test-and-clean instructions always return (1 << 30) + /* + * The cache test-and-clean instructions always return (1 << 30) * to indicate that there are no dirty cache lines. */ { .name = "TC_DCACHE", .cp = 15, .crn = 7, .crm = 10, .opc1 = 0, .opc2 = 3, @@ -4310,7 +4366,8 @@ static uint64_t mpidr_read_val(CPUARMState *env) if (arm_feature(env, ARM_FEATURE_V7MP)) { mpidr |= (1U << 31); - /* Cores which are uniprocessor (non-coherent) + /* + * Cores which are uniprocessor (non-coherent) * but still implement the MP extensions set * bit 30. (For instance, Cortex-R5). */ @@ -4522,7 +4579,8 @@ static CPAccessResult access_tocu(CPUARMState *env, const ARMCPRegInfo *ri, return do_cacheop_pou_access(env, HCR_TOCU | HCR_TPU); } -/* See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions +/* + * See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions * Page D4-1736 (DDI0487A.b) */ @@ -4655,7 +4713,8 @@ static void tlbi_aa64_alle3is_write(CPUARMState *env, const ARMCPRegInfo *ri, static void tlbi_aa64_vae2_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* Invalidate by VA, EL2 + /* + * Invalidate by VA, EL2 * Currently handles both VAE2 and VALE2, since we don't support * flush-last-level-only. */ @@ -4669,7 +4728,8 @@ static void tlbi_aa64_vae2_write(CPUARMState *env, const ARMCPRegInfo *ri, static void tlbi_aa64_vae3_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* Invalidate by VA, EL3 + /* + * Invalidate by VA, EL3 * Currently handles both VAE3 and VALE3, since we don't support * flush-last-level-only. */ @@ -4694,7 +4754,8 @@ static void tlbi_aa64_vae1is_write(CPUARMState *env, const ARMCPRegInfo *ri, static void tlbi_aa64_vae1_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* Invalidate by VA, EL1&0 (AArch64 version). + /* + * Invalidate by VA, EL1&0 (AArch64 version). * Currently handles all of VAE1, VAAE1, VAALE1 and VALE1, * since we don't support flush-for-specific-ASID-only or * flush-last-level-only. @@ -5015,7 +5076,8 @@ static CPAccessResult sp_el0_access(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { if (!(env->pstate & PSTATE_SP)) { - /* Access to SP_EL0 is undefined if it's being used as + /* + * Access to SP_EL0 is undefined if it's being used as * the stack pointer. */ return CP_ACCESS_TRAP_UNCATEGORIZED; @@ -5055,7 +5117,8 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, } if (raw_read(env, ri) == value) { - /* Skip the TLB flush if nothing actually changed; Linux likes + /* + * Skip the TLB flush if nothing actually changed; Linux likes * to do a lot of pointless SCTLR writes. */ return; @@ -5123,7 +5186,8 @@ static void mdcr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri, } static const ARMCPRegInfo v8_cp_reginfo[] = { - /* Minimal set of EL0-visible registers. This will need to be expanded + /* + * Minimal set of EL0-visible registers. This will need to be expanded * significantly for system emulation of AArch64 CPUs. */ { .name = "NZCV", .state = ARM_CP_STATE_AA64, @@ -5406,7 +5470,8 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 0, .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, banked_spsr[BANK_SVC]) }, - /* We rely on the access checks not allowing the guest to write to the + /* + * We rely on the access checks not allowing the guest to write to the * state field when SPSel indicates that it's being used as the stack * pointer. */ @@ -5484,7 +5549,8 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) if (arm_feature(env, ARM_FEATURE_EL3)) { valid_mask &= ~HCR_HCD; } else if (cpu->psci_conduit != QEMU_PSCI_CONDUIT_SMC) { - /* Architecturally HCR.TSC is RES0 if EL3 is not implemented. + /* + * Architecturally HCR.TSC is RES0 if EL3 is not implemented. * However, if we're using the SMC PSCI conduit then QEMU is * effectively acting like EL3 firmware and so the guest at * EL2 should retain the ability to prevent EL1 from being @@ -5914,7 +5980,8 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2is_write }, #ifndef CONFIG_USER_ONLY - /* Unlike the other EL2-related AT operations, these must + /* + * Unlike the other EL2-related AT operations, these must * UNDEF from EL3 if EL2 is not implemented, which is why we * define them here rather than with the rest of the AT ops. */ @@ -5928,7 +5995,8 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .access = PL2_W, .accessfn = at_s1e2_access, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = ats_write64 }, - /* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE + /* + * The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE * if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3 * with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose * to behave as if SCR.NS was 1. @@ -5941,7 +6009,8 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC }, { .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0, - /* ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the + /* + * ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the * reset values as IMPDEF. We choose to reset to 3 to comply with * both ARMv7 and ARMv8. */ @@ -6024,7 +6093,8 @@ static const ARMCPRegInfo el2_sec_cp_reginfo[] = { static CPAccessResult nsacr_access(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { - /* The NSACR is RW at EL3, and RO for NS EL1 and NS EL2. + /* + * The NSACR is RW at EL3, and RO for NS EL1 and NS EL2. * At Secure EL1 it traps to EL3 or EL2. */ if (arm_current_el(env) == 3) { @@ -6828,7 +6898,8 @@ static void define_pmu_regs(ARMCPU *cpu) } } -/* We don't know until after realize whether there's a GICv3 +/* + * We don't know until after realize whether there's a GICv3 * attached, and that is what registers the gicv3 sysregs. * So we have to fill in the GIC fields in ID_PFR/ID_PFR1_EL1/ID_AA64PFR0_EL1 * at runtime. @@ -6857,7 +6928,8 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) } #endif -/* Shared logic between LORID and the rest of the LOR* registers. +/* + * Shared logic between LORID and the rest of the LOR* registers. * Secure state exclusion has already been dealt with. */ static CPAccessResult access_lor_ns(CPUARMState *env, @@ -7684,7 +7756,8 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_arm_cp_regs(cpu, cp_reginfo); if (!arm_feature(env, ARM_FEATURE_V8)) { - /* Must go early as it is full of wildcards that may be + /* + * Must go early as it is full of wildcards that may be * overridden by later definitions. */ define_arm_cp_regs(cpu, not_v8_cp_reginfo); @@ -7698,7 +7771,8 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, .resetvalue = cpu->isar.id_pfr0 }, - /* ID_PFR1 is not a plain ARM_CP_CONST because we don't know + /* + * ID_PFR1 is not a plain ARM_CP_CONST because we don't know * the value of the GIC field until after we define these regs. */ { .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH, @@ -8239,7 +8313,8 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_arm_cp_regs(cpu, el3_regs); } - /* The behaviour of NSACR is sufficiently various that we don't + /* + * The behaviour of NSACR is sufficiently various that we don't * try to describe it in a single reginfo: * if EL3 is 64 bit, then trap to EL3 from S EL1, * reads as constant 0xc00 from NS EL1 and NS EL2 @@ -8331,13 +8406,15 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (cpu_isar_feature(aa32_jazelle, cpu)) { define_arm_cp_regs(cpu, jazelle_regs); } - /* Slightly awkwardly, the OMAP and StrongARM cores need all of + /* + * Slightly awkwardly, the OMAP and StrongARM cores need all of * cp15 crn=0 to be writes-ignored, whereas for other cores they should * be read-only (ie write causes UNDEF exception). */ { ARMCPRegInfo id_pre_v8_midr_cp_reginfo[] = { - /* Pre-v8 MIDR space. + /* + * Pre-v8 MIDR space. * Note that the MIDR isn't a simple constant register because * of the TI925 behaviour where writes to another register can * cause the MIDR value to change. @@ -8446,7 +8523,8 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (arm_feature(env, ARM_FEATURE_OMAPCP) || arm_feature(env, ARM_FEATURE_STRONGARM)) { size_t i; - /* Register the blanket "writes ignored" value first to cover the + /* + * Register the blanket "writes ignored" value first to cover the * whole space. Then update the specific ID registers to allow write * access, so that they ignore writes rather than causing them to * UNDEF. @@ -8654,7 +8732,8 @@ void register_cp_regs_for_features(ARMCPU *cpu) .raw_writefn = raw_write, }; if (arm_feature(env, ARM_FEATURE_XSCALE)) { - /* Normally we would always end the TB on an SCTLR write, but Linux + /* + * Normally we would always end the TB on an SCTLR write, but Linux * arch/arm/mach-pxa/sleep.S expects two instructions following * an MMU enable to execute from cache. Imitate this behaviour. */ @@ -9060,7 +9139,8 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, const ARMCPRegInfo *r, void *opaque) { - /* Define implementations of coprocessor registers. + /* + * Define implementations of coprocessor registers. * We store these in a hashtable because typically * there are less than 150 registers in a space which * is 16*16*16*8*8 = 262144 in size. @@ -9127,7 +9207,8 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, default: g_assert_not_reached(); } - /* The AArch64 pseudocode CheckSystemAccess() specifies that op1 + /* + * The AArch64 pseudocode CheckSystemAccess() specifies that op1 * encodes a minimum access level for the register. We roll this * runtime check into our general permission check code, so check * here that the reginfo's specified permissions are strict enough @@ -9169,7 +9250,8 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, assert((r->access & ~mask) == 0); } - /* Check that the register definition has enough info to handle + /* + * Check that the register definition has enough info to handle * reads and writes if they are permitted. */ if (!(r->type & (ARM_CP_SPECIAL_MASK | ARM_CP_CONST))) { @@ -9194,7 +9276,8 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, continue; } if (state == ARM_CP_STATE_AA32) { - /* Under AArch32 CP registers can be common + /* + * Under AArch32 CP registers can be common * (same for secure and non-secure world) or banked. */ char *name; @@ -9220,8 +9303,10 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, g_assert_not_reached(); } } else { - /* AArch64 registers get mapped to non-secure instance - * of AArch32 */ + /* + * AArch64 registers get mapped to non-secure instance + * of AArch32 + */ add_cpreg_to_hashtable(cpu, r, opaque, state, ARM_CP_SECSTATE_NS, crm, opc1, opc2, r->name); @@ -9307,7 +9392,8 @@ void arm_cp_reset_ignore(CPUARMState *env, const ARMCPRegInfo *opaque) static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type) { - /* Return true if it is not valid for us to switch to + /* + * Return true if it is not valid for us to switch to * this CPU mode (ie all the UNPREDICTABLE cases in * the ARM ARM CPSRWriteByInstr pseudocode). */ @@ -9328,10 +9414,12 @@ static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type) case ARM_CPU_MODE_UND: case ARM_CPU_MODE_IRQ: case ARM_CPU_MODE_FIQ: - /* Note that we don't implement the IMPDEF NSACR.RFR which in v7 + /* + * Note that we don't implement the IMPDEF NSACR.RFR which in v7 * allows FIQ mode to be Secure-only. (In v8 this doesn't exist.) */ - /* If HCR.TGE is set then changes from Monitor to NS PL1 via MSR + /* + * If HCR.TGE is set then changes from Monitor to NS PL1 via MSR * and CPS are treated as illegal mode changes. */ if (write_type == CPSRWriteByInstr && @@ -9389,7 +9477,8 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, env->GE = (val >> 16) & 0xf; } - /* In a V7 implementation that includes the security extensions but does + /* + * In a V7 implementation that includes the security extensions but does * not include Virtualization Extensions the SCR.FW and SCR.AW bits control * whether non-secure software is allowed to change the CPSR_F and CPSR_A * bits respectively. @@ -9405,7 +9494,8 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, changed_daif = (env->daif ^ val) & mask; if (changed_daif & CPSR_A) { - /* Check to see if we are allowed to change the masking of async + /* + * Check to see if we are allowed to change the masking of async * abort exceptions from a non-secure state. */ if (!(env->cp15.scr_el3 & SCR_AW)) { @@ -9417,7 +9507,8 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, } if (changed_daif & CPSR_F) { - /* Check to see if we are allowed to change the masking of FIQ + /* + * Check to see if we are allowed to change the masking of FIQ * exceptions from a non-secure state. */ if (!(env->cp15.scr_el3 & SCR_FW)) { @@ -9427,7 +9518,8 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, mask &= ~CPSR_F; } - /* Check whether non-maskable FIQ (NMFI) support is enabled. + /* + * Check whether non-maskable FIQ (NMFI) support is enabled. * If this bit is set software is not allowed to mask * FIQs, but is allowed to set CPSR_F to 0. */ @@ -9447,7 +9539,8 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, if (write_type != CPSRWriteRaw && ((env->uncached_cpsr ^ val) & mask & CPSR_M)) { if ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_USR) { - /* Note that we can only get here in USR mode if this is a + /* + * Note that we can only get here in USR mode if this is a * gdb stub write; for this case we follow the architectural * behaviour for guest writes in USR mode of ignoring an attempt * to switch mode. (Those are caught by translate.c for writes @@ -9455,7 +9548,8 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, */ mask &= ~CPSR_M; } else if (bad_mode_switch(env, val & CPSR_M, write_type)) { - /* Attempt to switch to an invalid mode: this is UNPREDICTABLE in + /* + * Attempt to switch to an invalid mode: this is UNPREDICTABLE in * v7, and has defined behaviour in v8: * + leave CPSR.M untouched * + allow changes to the other CPSR fields @@ -9598,7 +9692,8 @@ static void switch_mode(CPUARMState *env, int mode) env->regs[14] = env->banked_r14[r14_bank_number(mode)]; } -/* Physical Interrupt Target EL Lookup Table +/* + * Physical Interrupt Target EL Lookup Table * * [ From ARM ARM section G1.13.4 (Table G1-15) ] * @@ -9672,7 +9767,8 @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, if (arm_feature(env, ARM_FEATURE_EL3)) { rw = ((env->cp15.scr_el3 & SCR_RW) == SCR_RW); } else { - /* Either EL2 is the highest EL (and so the EL2 register width + /* + * Either EL2 is the highest EL (and so the EL2 register width * is given by is64); or there is no EL2 or EL3, in which case * the value of 'rw' does not affect the table lookup anyway. */ @@ -9947,7 +10043,8 @@ void aarch64_sync_64_to_32(CPUARMState *env) env->banked_r13[bank_number(ARM_CPU_MODE_UND)] = env->xregs[23]; } - /* Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ + /* + * Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ * mode, then we can copy to r8-r14. Otherwise, we copy to the * FIQ bank for r8-r14. */ @@ -10293,7 +10390,8 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) /* High vectors. When enabled, base address cannot be remapped. */ addr += 0xffff0000; } else { - /* ARM v7 architectures provide a vector base address register to remap + /* + * ARM v7 architectures provide a vector base address register to remap * the interrupt vector table. * This register is only followed in non-monitor mode, and is banked. * Note: only bits 31:5 are valid. @@ -10427,7 +10525,8 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) aarch64_sve_change_el(env, cur_el, new_el, is_a64(env)); if (cur_el < new_el) { - /* Entry vector offset depends on whether the implemented EL + /* + * Entry vector offset depends on whether the implemented EL * immediately lower than the target level is using AArch32 or AArch64 */ bool is_aa64; @@ -10628,7 +10727,8 @@ static void handle_semihosting(CPUState *cs) } #endif -/* Handle a CPU exception for A and R profile CPUs. +/* + * Handle a CPU exception for A and R profile CPUs. * Do any appropriate logging, handle PSCI calls, and then hand off * to the AArch64-entry or AArch32-entry function depending on the * target exception level's register width. @@ -10673,7 +10773,8 @@ void arm_cpu_do_interrupt(CPUState *cs) } #endif - /* Hooks may change global state so BQL should be held, also the + /* + * Hooks may change global state so BQL should be held, also the * BQL needs to be held for any modification of * cs->interrupt_request. */ @@ -10954,9 +11055,11 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, }; } -/* Note that signed overflow is undefined in C. The following routines are - careful to use unsigned types where modulo arithmetic is required. - Failure to do so _will_ break on newer gcc. */ +/* + * Note that signed overflow is undefined in C. The following routines are + * careful to use unsigned types where modulo arithmetic is required. + * Failure to do so _will_ break on newer gcc. + */ /* Signed saturating arithmetic. */ @@ -11198,7 +11301,8 @@ uint32_t HELPER(sel_flags)(uint32_t flags, uint32_t a, uint32_t b) return (a & mask) | (b & ~mask); } -/* CRC helpers. +/* + * CRC helpers. * The upper bytes of val (above the number specified by 'bytes') must have * been zeroed out by the caller. */ @@ -11222,7 +11326,8 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes) return crc32c(acc, buf, bytes) ^ 0xffffffff; } -/* Return the exception level to which FP-disabled exceptions should +/* + * Return the exception level to which FP-disabled exceptions should * be taken, or 0 if FP is enabled. */ int fp_exception_el(CPUARMState *env, int cur_el) @@ -11230,7 +11335,8 @@ int fp_exception_el(CPUARMState *env, int cur_el) #ifndef CONFIG_USER_ONLY uint64_t hcr_el2; - /* CPACR and the CPTR registers don't exist before v6, so FP is + /* + * CPACR and the CPTR registers don't exist before v6, so FP is * always accessible */ if (!arm_feature(env, ARM_FEATURE_V6)) { @@ -11255,7 +11361,8 @@ int fp_exception_el(CPUARMState *env, int cur_el) hcr_el2 = arm_hcr_el2_eff(env); - /* The CPACR controls traps to EL1, or PL1 if we're 32 bit: + /* + * The CPACR controls traps to EL1, or PL1 if we're 32 bit: * 0, 2 : trap EL0 and EL1/PL1 accesses * 1 : trap only EL0 accesses * 3 : trap no accesses From patchwork Thu Jan 5 16:44:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639278 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324172pvb; Thu, 5 Jan 2023 08:53:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXtaVjBlH5D9EL4TqbFSubCrS25m1cq0i8EdbB1NLwzTXZI8V/24+vdFjQdOJZ7lAgK2lwzo X-Received: by 2002:a05:6214:438a:b0:4c7:5635:3360 with SMTP id oh10-20020a056214438a00b004c756353360mr78663599qvb.2.1672937599872; Thu, 05 Jan 2023 08:53:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937599; cv=none; d=google.com; s=arc-20160816; b=fKnc4iKFB5RqhSKJ7zIWdY+TI8BLRbS/vwn/f2rjssVFhAqi98uZ0UjIgRhdJNFTz5 juuV3LqtOhBbHDV3OfMdA8gcxPjprSvfXsnSJ+OCdD9e4KuwRhk4UNtjgDL3Ft30KNnj mgmiPZFOtfOmi3RgmBT7jmH0N1peERUa3smYFKXapIpkmcBSXkdh+VDlrIsyueQ2adfe fP2qou/6ImGeOXc+DZO9st/NMILAyY0Gn+jdYHJcaW5TPkY93CjgrasbljyuLcc1KsnF G9AwQ3MQx95gatYrYIawJV+hwzt2YDjlgo9QPZ1uJg8G2i1M1AcCdgqPGfP0C1EugfVe qS3A== 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=byMM6iVgc74/+OKbtKS09cRKP886+lRaecSbts9EjCY=; b=aZOCa7I6S/1RlKk94aAW1L160hVTg57z51uuXzc5Wmv6YTFhbvI/8y4HVzoMz4fZGf mgXGtt8U/8Q6kEHFGv9sh9iO9ZHLe/ybPPSXVZx1DTPNYr5J7OL7RC2eFLxv89gkoOA6 aIGOTVoOtLWth1tmUSXcYeXZY72C9kT35ROXala0nb5YdWMQYvO46uHObAuxtqfA00pZ GN9m6JR4BiCCi243NtSg3e6/4/q1c1jG09xy5rmLl2pPT8rhAwMsO4QmBySTAfEFZWAY FYMkRlJ+CdFPTR+OKFM2sybf0V9xoFpa79w3Am2u5DFkqUBBz6R6XJWvODqF0gYT82dm JvTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hTaih6ok; 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 a13-20020ad45c4d000000b005320dba84d9si941720qva.361.2023.01.05.08.53.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:53: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=hTaih6ok; 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 1pDTMa-0001C9-4a; Thu, 05 Jan 2023 11:45: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 1pDTM6-0000do-0I for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:41 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTM4-0007Qa-7C for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:37 -0500 Received: by mail-wm1-x333.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so1747897wmb.2 for ; Thu, 05 Jan 2023 08:44:35 -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=byMM6iVgc74/+OKbtKS09cRKP886+lRaecSbts9EjCY=; b=hTaih6okMw0Bki+BQB5k5bxdR6I7tyyUju5LVmrht0TSeRqslP9FadCv8hbh+3GO0u 2JFDCwH7G1Z5Odi+CRVhrjeemYqFODm2Bi4HGW/9P7TnUGdv1hC6mPmJQAfpEAP+tjZW OVIgBk0MbxrJD48IjFYJyQaak4o5eaNfQXenjqci8Sws3GL67NUzW4t8BrMLFRDSj0tR 0JqQc81+e0QNckRUBAYa6xd+kycuj5v1gjlMH4sBcTsZkhJ4PTkNjZlZZeKGXSJ3e/Z2 6NbaVuB7yummZ4WQ72yuKOFOSJBxdYTnKHtVbFSKjePCybzsbCHWFsOEgnCk2Z08Wqxw ob3A== 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=byMM6iVgc74/+OKbtKS09cRKP886+lRaecSbts9EjCY=; b=GNRyn/Cq8oKhMK69Hgi8uAJGJQeM6bUIkiRKWBkofdXT32x7nPu/DbzSnfibnv5VU9 DOM2VAfrPhgEvbb9XebTjXZvMP77164h8snBI9ZbQM1A+OrA5HRZk/BSWrMeN2UKXJue XTVy1VJLOvmaNGk9pmp9iCQQ4Nm3EDrsQiUmXBoUqnyrlnf8UiLwPtP+Y9Oo8oGxHYJ+ i7d8diVW+nc8YTUMANJguTEaT3Ps6KzLHLMPFudYEErLRKRLA5OBAQ6Cl3BfysFblQQo c45TC45mkGlukqXuRe9+0+eBuQnrZScUKvqQJsNU/dfZdvF8B5pdzRuAW+H7tkLsU9D2 kcQA== X-Gm-Message-State: AFqh2kpFArZzVr1oEY00QqMfJBVx1pQ++j3PPDjuHE1rG04XsXh5KMZn +sxaeQ+ITtUR2VEcx0cYylc7AJhJ33EPQkKW X-Received: by 2002:a7b:c7c8:0:b0:3d7:889:7496 with SMTP id z8-20020a7bc7c8000000b003d708897496mr36660973wmk.17.1672937075028; Thu, 05 Jan 2023 08:44:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/34] target/arm: Fix checkpatch space errors in helper.c Date: Thu, 5 Jan 2023 16:44:02 +0000 Message-Id: <20230105164417.3994639-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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: Fabiano Rosas Fix the following: ERROR: spaces required around that '|' (ctx:VxV) ERROR: space required before the open parenthesis '(' ERROR: spaces required around that '+' (ctx:VxB) ERROR: space prohibited between function name and open parenthesis '(' (the last two still have some occurrences in macros which I left behind because it might impact readability) Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana Reviewed-by: Cornelia Huck Message-id: 20221213190537.511-3-farosas@suse.de Signed-off-by: Peter Maydell --- target/arm/helper.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index a5f96ab77dd..8f1cc2d7cfb 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -205,7 +205,7 @@ static void add_cpreg_to_list(gpointer key, gpointer opaque) uint32_t regidx = (uintptr_t)key; const ARMCPRegInfo *ri = get_arm_cp_reginfo(cpu->cp_regs, regidx); - if (!(ri->type & (ARM_CP_NO_RAW|ARM_CP_ALIAS))) { + if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) { cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_id(regidx); /* The value array need not be initialized at this point */ cpu->cpreg_array_len++; @@ -219,7 +219,7 @@ static void count_cpreg(gpointer key, gpointer opaque) ri = g_hash_table_lookup(cpu->cp_regs, key); - if (!(ri->type & (ARM_CP_NO_RAW|ARM_CP_ALIAS))) { + if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) { cpu->cpreg_array_len++; } } @@ -2350,11 +2350,11 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { .resetfn = arm_cp_reset_ignore }, { .name = "TPIDRRO_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 3, .crn = 13, .crm = 0, - .access = PL0_R|PL1_W, + .access = PL0_R | PL1_W, .fieldoffset = offsetof(CPUARMState, cp15.tpidrro_el[0]), .resetvalue = 0}, { .name = "TPIDRURO", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 3, - .access = PL0_R|PL1_W, + .access = PL0_R | PL1_W, .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidruro_s), offsetoflow32(CPUARMState, cp15.tpidruro_ns) }, .resetfn = arm_cp_reset_ignore }, @@ -4315,17 +4315,17 @@ static const ARMCPRegInfo cache_block_ops_cp_reginfo[] = { .resetvalue = 0 }, /* The cache ops themselves: these all NOP for QEMU */ { .name = "IICR", .cp = 15, .crm = 5, .opc1 = 0, - .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, + .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_64BIT }, { .name = "IDCR", .cp = 15, .crm = 6, .opc1 = 0, - .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, + .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_64BIT }, { .name = "CDCR", .cp = 15, .crm = 12, .opc1 = 0, - .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, + .access = PL0_W, .type = ARM_CP_NOP | ARM_CP_64BIT }, { .name = "PIR", .cp = 15, .crm = 12, .opc1 = 1, - .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, + .access = PL0_W, .type = ARM_CP_NOP | ARM_CP_64BIT }, { .name = "PDR", .cp = 15, .crm = 12, .opc1 = 2, - .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, + .access = PL0_W, .type = ARM_CP_NOP | ARM_CP_64BIT }, { .name = "CIDCR", .cp = 15, .crm = 14, .opc1 = 0, - .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, + .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_64BIT }, }; static const ARMCPRegInfo cache_test_clean_cp_reginfo[] = { @@ -8695,7 +8695,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) ARMCPRegInfo cbar = { .name = "CBAR", .cp = 15, .crn = 15, .crm = 0, .opc1 = 4, .opc2 = 0, - .access = PL1_R|PL3_W, .resetvalue = cpu->reset_cbar, + .access = PL1_R | PL3_W, .resetvalue = cpu->reset_cbar, .fieldoffset = offsetof(CPUARMState, cp15.c15_config_base_address) }; @@ -9673,11 +9673,11 @@ static void switch_mode(CPUARMState *env, int mode) return; if (old_mode == ARM_CPU_MODE_FIQ) { - memcpy (env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t)); - memcpy (env->regs + 8, env->usr_regs, 5 * sizeof(uint32_t)); + memcpy(env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t)); + memcpy(env->regs + 8, env->usr_regs, 5 * sizeof(uint32_t)); } else if (mode == ARM_CPU_MODE_FIQ) { - memcpy (env->usr_regs, env->regs + 8, 5 * sizeof(uint32_t)); - memcpy (env->regs + 8, env->fiq_regs, 5 * sizeof(uint32_t)); + memcpy(env->usr_regs, env->regs + 8, 5 * sizeof(uint32_t)); + memcpy(env->regs + 8, env->fiq_regs, 5 * sizeof(uint32_t)); } i = bank_number(old_mode); @@ -11181,7 +11181,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) RESULT(sum, n, 16); \ if (sum >= 0) \ ge |= 3 << (n * 2); \ - } while(0) + } while (0) #define SARITH8(a, b, n, op) do { \ int32_t sum; \ @@ -11189,7 +11189,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) RESULT(sum, n, 8); \ if (sum >= 0) \ ge |= 1 << n; \ - } while(0) + } while (0) #define ADD16(a, b, n) SARITH16(a, b, n, +) @@ -11208,7 +11208,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) RESULT(sum, n, 16); \ if ((sum >> 16) == 1) \ ge |= 3 << (n * 2); \ - } while(0) + } while (0) #define ADD8(a, b, n) do { \ uint32_t sum; \ @@ -11216,7 +11216,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) RESULT(sum, n, 8); \ if ((sum >> 8) == 1) \ ge |= 1 << n; \ - } while(0) + } while (0) #define SUB16(a, b, n) do { \ uint32_t sum; \ @@ -11224,7 +11224,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) RESULT(sum, n, 16); \ if ((sum >> 16) == 0) \ ge |= 3 << (n * 2); \ - } while(0) + } while (0) #define SUB8(a, b, n) do { \ uint32_t sum; \ @@ -11232,7 +11232,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) RESULT(sum, n, 8); \ if ((sum >> 8) == 0) \ ge |= 1 << n; \ - } while(0) + } while (0) #define PFX u #define ARITH_GE From patchwork Thu Jan 5 16:44:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639293 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp328299pvb; Thu, 5 Jan 2023 09:02:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXv7suTMcWjDIZGIQuKR43Fbj+IycPUdK/7jnncdBhIRdte2YMCWYbrkl1DDwTdFNPbxHzuv X-Received: by 2002:a05:600c:3b26:b0:3d7:fa4a:681b with SMTP id m38-20020a05600c3b2600b003d7fa4a681bmr39338207wms.0.1672938157526; Thu, 05 Jan 2023 09:02:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938157; cv=none; d=google.com; s=arc-20160816; b=aszhf1seG+0ZsE7rDqZkVqSJ9y4oL5N2JgeH5lz0Bi49hDXQVKdOkXVuDjXB5yvXG6 1SO7T8XHZmx0fTgS2HmVJ4m/b45IDGn+p6HIH1DJS/4aSZbyMTqlrTwyoCK0JXBGnymj mQlByi7vHcgOFzjLYiVpPyev1bsPW2HHVclS/wKqPRFSbwzNcunQlxmyTyMraSdivscy QMWAbTYtZSFwErINdHx6J2V5I1mZ4muTTAuT3ERlevm/oG97sgLLHn7Ye0XzZTDgzd5Y CXXY0tA02yzBCNuzk3telX1QH/TtXpGohTvUj7GrGFy+xJ7PyPktodRXFP0IzZ3CAXRc WKTA== 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=aTsMmCJLl94F3lARaNShxP5uscfsUduynI0oR3AN0iE=; b=AQHnLe/ZsMxS9POy1WOmRSc9hkUhB0b6Rl3d6QufJnKHijajtiiuaz0LMLjP25fKrP kfAjNVuwqNuAi1SEXX3tKgYgGpcoL1yqYkFjCAONbSLIDGK/pUn1efMDt/wXe+PARWYI JP6BBhqEXDGeugmke7lsbtkElaYAMY8QHH7K00O8gyeUd1KjmS2hkA8qFIkvu0+Ta35D /FDKKWs/7VuZwkgbOuIWU6mJMAZdBHkicALR0gaecfIhEju8G0JgM7WTJB+g4RjMHon3 2ox0Nu84Y3X3jCRcK0bker23JHtwKOdaJBq+RlfYP0nLCMfX+gH4BfRJS407wcxjjSAa 3+dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tqxdM7VT; 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 a10-20020a05600c224a00b003b4fa689602si1535465wmm.21.2023.01.05.09.02.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:02: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=tqxdM7VT; 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 1pDTMP-0000y8-Jo; Thu, 05 Jan 2023 11:44:57 -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 1pDTM6-0000ds-U6 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:41 -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 1pDTM5-0007Qs-9B for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:38 -0500 Received: by mail-wm1-x335.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so1747935wmb.2 for ; Thu, 05 Jan 2023 08:44:36 -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=aTsMmCJLl94F3lARaNShxP5uscfsUduynI0oR3AN0iE=; b=tqxdM7VT1/X+UCcqkT4f3GcDHMSUhVRvu6OnYzI6pa2ZUKOy+HVEPdj4JR8OcrM2IL vHEYwzH2K8GNItFP9l5DbSFf9xg9cg8MgWKKrjNco4RCbfXSEMW7ozGEzoplVQQmCMOU GqR2rlrWe8nfDCTKNcaW3Rddjxzm2gaLrNahnGCDoicHkKjzUOUHdlTmxCpM/lL3KJFX rVwLO8Mc4gZ1kvNtZSe5u0z/JTcDJkkfi18OHxtPM43F7R9ZnOTe6W50L+jSFCiGeZf3 3UtNsohuFE/33HpfIHuLI0kzRg3osxOWlwu8l3XIT3EKzLNR9t/Aq7EXOOCAjICKCKFp fqlA== 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=aTsMmCJLl94F3lARaNShxP5uscfsUduynI0oR3AN0iE=; b=3SN1oxZ9htKUjn86kwX3+KusFj67AiSMQ4wtmaeGJ0mCdZwSnDfAHa/Fqvd74UIuCa fNwgDgVMCxmF28OlWN3vR3m81FYY3QT1ZDX3UN0o38Q+LbLEW9Z3Q/WJ320AbmNCqmUF PLVIbL0bV62J6e4u7DxrCYXaZnhsdzgc819/P0hOWNqYGO0R4Rt9EU4xuuJMo5KsDON4 jh72Tpf3TxoI6Y3A17Q1Qtri8xS0tmHaEWMuhDgjt048w5bghMflX84/HZ4om1YMx2hx s/SexdlTqZyd7F5OJ3eY+eDUaLuBPbfrdXAvgzjXQ374RB2Ydo693J/rgQzk2cw3NQPz joLg== X-Gm-Message-State: AFqh2kpHCiGbViyihxBoM2+4P9sN4tPBqXaMpdLxASVUPA8XRSIRUJnz 2Zn1LAO7zn46H0vPyj73gOuwvLeQRXe0AqSW X-Received: by 2002:a05:600c:3506:b0:3cf:803b:d7cc with SMTP id h6-20020a05600c350600b003cf803bd7ccmr39920959wmq.33.1672937075999; Thu, 05 Jan 2023 08:44:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:35 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/34] target/arm: Fix checkpatch brace errors in helper.c Date: Thu, 5 Jan 2023 16:44:03 +0000 Message-Id: <20230105164417.3994639-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Fabiano Rosas Fix this: ERROR: braces {} are necessary for all arms of this statement Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana Reviewed-by: Cornelia Huck Message-id: 20221213190537.511-4-farosas@suse.de Signed-off-by: Peter Maydell --- target/arm/helper.c | 67 ++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 8f1cc2d7cfb..5d8971aa51e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9461,10 +9461,12 @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, env->CF = (val >> 29) & 1; env->VF = (val << 3) & 0x80000000; } - if (mask & CPSR_Q) + if (mask & CPSR_Q) { env->QF = ((val & CPSR_Q) != 0); - if (mask & CPSR_T) + } + if (mask & CPSR_T) { env->thumb = ((val & CPSR_T) != 0); + } if (mask & CPSR_IT_0_1) { env->condexec_bits &= ~3; env->condexec_bits |= (val >> 25) & 3; @@ -9669,8 +9671,9 @@ static void switch_mode(CPUARMState *env, int mode) int i; old_mode = env->uncached_cpsr & CPSR_M; - if (mode == old_mode) + if (mode == old_mode) { return; + } if (old_mode == ARM_CPU_MODE_FIQ) { memcpy(env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t)); @@ -10276,10 +10279,11 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) new_mode = ARM_CPU_MODE_UND; addr = 0x04; mask = CPSR_I; - if (env->thumb) + if (env->thumb) { offset = 2; - else + } else { offset = 4; + } break; case EXCP_SWI: new_mode = ARM_CPU_MODE_SVC; @@ -11070,10 +11074,11 @@ static inline uint16_t add16_sat(uint16_t a, uint16_t b) res = a + b; if (((res ^ a) & 0x8000) && !((a ^ b) & 0x8000)) { - if (a & 0x8000) + if (a & 0x8000) { res = 0x8000; - else + } else { res = 0x7fff; + } } return res; } @@ -11085,10 +11090,11 @@ static inline uint8_t add8_sat(uint8_t a, uint8_t b) res = a + b; if (((res ^ a) & 0x80) && !((a ^ b) & 0x80)) { - if (a & 0x80) + if (a & 0x80) { res = 0x80; - else + } else { res = 0x7f; + } } return res; } @@ -11100,10 +11106,11 @@ static inline uint16_t sub16_sat(uint16_t a, uint16_t b) res = a - b; if (((res ^ a) & 0x8000) && ((a ^ b) & 0x8000)) { - if (a & 0x8000) + if (a & 0x8000) { res = 0x8000; - else + } else { res = 0x7fff; + } } return res; } @@ -11115,10 +11122,11 @@ static inline uint8_t sub8_sat(uint8_t a, uint8_t b) res = a - b; if (((res ^ a) & 0x80) && ((a ^ b) & 0x80)) { - if (a & 0x80) + if (a & 0x80) { res = 0x80; - else + } else { res = 0x7f; + } } return res; } @@ -11136,34 +11144,38 @@ static inline uint16_t add16_usat(uint16_t a, uint16_t b) { uint16_t res; res = a + b; - if (res < a) + if (res < a) { res = 0xffff; + } return res; } static inline uint16_t sub16_usat(uint16_t a, uint16_t b) { - if (a > b) + if (a > b) { return a - b; - else + } else { return 0; + } } static inline uint8_t add8_usat(uint8_t a, uint8_t b) { uint8_t res; res = a + b; - if (res < a) + if (res < a) { res = 0xff; + } return res; } static inline uint8_t sub8_usat(uint8_t a, uint8_t b) { - if (a > b) + if (a > b) { return a - b; - else + } else { return 0; + } } #define ADD16(a, b, n) RESULT(add16_usat(a, b), n, 16); @@ -11267,10 +11279,11 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) static inline uint8_t do_usad(uint8_t a, uint8_t b) { - if (a > b) + if (a > b) { return a - b; - else + } else { return b - a; + } } /* Unsigned sum of absolute byte differences. */ @@ -11290,14 +11303,18 @@ uint32_t HELPER(sel_flags)(uint32_t flags, uint32_t a, uint32_t b) uint32_t mask; mask = 0; - if (flags & 1) + if (flags & 1) { mask |= 0xff; - if (flags & 2) + } + if (flags & 2) { mask |= 0xff00; - if (flags & 4) + } + if (flags & 4) { mask |= 0xff0000; - if (flags & 8) + } + if (flags & 8) { mask |= 0xff000000; + } return (a & mask) | (b & ~mask); } From patchwork Thu Jan 5 16:44:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639312 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp339746pvb; Thu, 5 Jan 2023 09:25:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXvohN6Z8WmZfx7CP6HXkmW+iJSfrYEHZ5RSp6BL/iflZ5EYbxg9a4nB0vWdWkbNkbj4+PM1 X-Received: by 2002:a05:6214:418e:b0:515:5e33:5059 with SMTP id ld14-20020a056214418e00b005155e335059mr73942341qvb.26.1672939512505; Thu, 05 Jan 2023 09:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939512; cv=none; d=google.com; s=arc-20160816; b=D65GkOsAX/9gErpvrLggQChIGihEHPskGrf4pFouBPHeDUTbtZQvkYzcALPl8igLKz rtBcDdWgsJKm3SCZ3rcQELBVjsFKlHOFoSc6pYBo8IuvQS0SrJ/fNFBle+4PueJSVxb8 uHMCW2vhqdA8d5DgFUWKIeOqWa7FZGObF+yig8ONrT+KVxmHisPgjPLRMB6jHwDZWEAv JdowoYIzrpoJMqJtNiGIq0ddGyhmLVXC0MJXcmbSZRc+mxQDd0pTL2EU5sAzpKRSoqlo pJssZMqFowxywXXx7a3tr2cwr0lmE9ac5y4M7bqu1b5rXh67qsC8gKGbB4qBlaqQV5FF CJQA== 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=sztR4J95IadKOvZP/cP3UWW/HHhoPYqwE6deb2jD44g=; b=UYbWK1QD7T51sCIp4l0fiJKBLivgw4XEYAfKmU+IVb1e7ZGnpgB3z6Qzv/errdV9Lw N1JrTMxD20UID+nhWs0oOYaMbkESWXyvPVec7m1Jo4mytm13G5VH/P5oQ45XEy8DEG2l 3eYh7R/X940oJv7rfldmC14CJ72ziB/j28fDMq+rWic/hOvxJZzSU/FCR1aL2XGi5rrM Shyv6NI0V0OEriIQNotXWTI7P/8RwWy/cnqG7nlnoZSOt1K1zeRIAVsW40a6S7SFfgnZ QBrYupw3RW6G0pQ4GebBgb4H2DW3kE62e+MKJzJuaZsB+E1WgKC1tyR4l6WspoP33O75 g5Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V89avodA; 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 gf10-20020a056214250a00b0053216803d28si580793qvb.344.2023.01.05.09.25.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:25:12 -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=V89avodA; 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 1pDTMe-0001LU-SV; Thu, 05 Jan 2023 11:45:12 -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 1pDTM7-0000dt-6R for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:41 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTM5-0007Q6-LZ for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:38 -0500 Received: by mail-wm1-x32c.google.com with SMTP id o15so28449113wmr.4 for ; Thu, 05 Jan 2023 08:44:37 -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=sztR4J95IadKOvZP/cP3UWW/HHhoPYqwE6deb2jD44g=; b=V89avodALBG+HAp3Jpemx9sCEevME0VO5vRDIdF5wpl3NCPuqkcn+SvkJbWQZaeG9H /4w0zEhING3rfOpSUXyDf+HHLuQ4YSnikoVuH0aLdho3jOunObcdQtxBuv2W0PxkdkaO m5zONhos8GLcEoDoCpM7M0NPK9kWI7aIyFPMgdCfU39rnw5HxCrYyxRWaMOcZNVXzaib fdc3K0rp55sV/nE+kLtWVpF3yV/aJCfwHMLeuVjidGA3GnPvBUc7WKrHJg7mSArXOs6+ cth5SBqVPF3qtigChUholTcSmzmR/7aKN2FCqwKuEv34uTIl+ovzpO1kL9KEnR9jCJ/X GuMQ== 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=sztR4J95IadKOvZP/cP3UWW/HHhoPYqwE6deb2jD44g=; b=diz1UatoCE5Ci8YZldSmninqL+bgvqdmOmHsqBbmjUo1IK/ljhJHixx1jm+6x0zuRP phbAaiXGa2EvEv8wOFovFWYAEx7NhRJ89hFli1gRLPlflnEjZ5Xg9Ck2US/kveUO7uEM I7xOTMirsUuy/5NPNZiEqX81gfmVf4YjwOHz+sSdRdM+07TwLR8S0hmIPayQrI3SDSVT knUPV7uu+gQDkOMdNM/xGadjbelGprfqTopAFQdh5N1F4A6hyFaKdW8qfb9/XjAkxvXQ 0YbTB/Vg4G7dVwf+3ne1d7ZqHUqSLIiuGihtQDUICDLgX9/LCdxOID1P22SXq4xsOUxp K3Vg== X-Gm-Message-State: AFqh2kreq7Nl7z0WBsaJ6ItJZHjyuUEMCk4KuWMwrO5FcNqlx05q5ymu ndNDji07+Xu9mvxbZe70HFx9l9QVPA3YkdzJ X-Received: by 2002:a05:600c:1914:b0:3d2:2fa9:cffa with SMTP id j20-20020a05600c191400b003d22fa9cffamr36549096wmq.25.1672937076839; Thu, 05 Jan 2023 08:44:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/34] target/arm: Remove unused includes from m_helper.c Date: Thu, 5 Jan 2023 16:44:04 +0000 Message-Id: <20230105164417.3994639-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Fabiano Rosas Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana Reviewed-by: Cornelia Huck Message-id: 20221213190537.511-5-farosas@suse.de Signed-off-by: Peter Maydell --- target/arm/m_helper.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 355cd4d60a7..033a4d92614 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -7,30 +7,14 @@ */ #include "qemu/osdep.h" -#include "qemu/units.h" -#include "target/arm/idau.h" -#include "trace.h" #include "cpu.h" #include "internals.h" -#include "exec/gdbstub.h" #include "exec/helper-proto.h" -#include "qemu/host-utils.h" #include "qemu/main-loop.h" #include "qemu/bitops.h" -#include "qemu/crc32c.h" -#include "qemu/qemu-print.h" #include "qemu/log.h" #include "exec/exec-all.h" -#include /* For crc32 */ -#include "semihosting/semihost.h" -#include "sysemu/cpus.h" -#include "sysemu/kvm.h" -#include "qemu/range.h" -#include "qapi/qapi-commands-machine-target.h" -#include "qapi/error.h" -#include "qemu/guest-random.h" #ifdef CONFIG_TCG -#include "arm_ldst.h" #include "exec/cpu_ldst.h" #include "semihosting/common-semi.h" #endif From patchwork Thu Jan 5 16:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639317 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp341297pvb; Thu, 5 Jan 2023 09:29:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXvoEMh6V9JbaPwVyMw3snFpSSkXRD7b8DF96xY9P4YllErqvtpd5yH4bP8+oqC8MsKiyfiK X-Received: by 2002:a05:622a:1a08:b0:3ab:6e0c:166b with SMTP id f8-20020a05622a1a0800b003ab6e0c166bmr86325563qtb.47.1672939747983; Thu, 05 Jan 2023 09:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939747; cv=none; d=google.com; s=arc-20160816; b=pz43vMFodudKcAdYiUbiojNvLaZrSo2q49KiaAUcH+5Mkkth38T/AI0s5OTxZ5rNGr xmdqqeLpwkzUOq6+sTP5Yl3KW0IUmZN9YUj0cz/kpaNX8o1HH7goEtav58fE3B4eTaA0 7shBgxbdpvLdSlRyvIeSioFJTGSmoqpHSqKTDU9rtDr4FSdjIJXIqJnm8SC+2T82QF5j hPRcohj7ZEfIa3cIaaInp2sRB09hjL706CuO8oNeU1SDPnEKP+479zoLv3G9lE0+AHN8 HKDKCNbQrJPSle0xI5TM7kPdQnpsZK4s8JAiEpL5jrBRWFpFpmpyzbDFwN3t0jlyD1DP FQIw== 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=XPcxKKzTJ6CHZqkcMut7l6klmMKuAhMpUuRA99yE0PE=; b=rqnk5yP9+6vo3NOYJXic+dJA/jyg4hGCK6J2+4qUPHdac46B+ExmjxzhfYB/pd0KO/ wzJewk8ksOhLrxlPF86jVO6TsE6yF4fayCja2JVaRGtBHXcXLUI1g/qOuYN3lf2B0Gcv EyeM84NJ0X5ADutKijKNDkuS/3NK2uGywANlH5rxLmC8DlgWwAOK3DbW2C6Eq+fXqcNt co1sczFv7AdFGr3j46dj4Whof5fLZpDdJFe5pDBrSKUEAaqjvokxTY7AfMXrEX5TSMOn FSLBDmYiL5Lbu+2DiGxh2dtnBMY0l8KP1+BfbqRHT8r74f1scGQMLHIj/vWzCIDEHLb6 VQHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QsVOLQ3j; 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 x25-20020a05620a14b900b006f765f6a78asi18590574qkj.275.2023.01.05.09.29.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:29:07 -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=QsVOLQ3j; 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 1pDTMf-0001N8-Us; Thu, 05 Jan 2023 11:45:14 -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 1pDTM8-0000gy-60 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:41 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTM6-0007Nm-Dx for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:39 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso1776850wms.5 for ; Thu, 05 Jan 2023 08:44:38 -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=XPcxKKzTJ6CHZqkcMut7l6klmMKuAhMpUuRA99yE0PE=; b=QsVOLQ3jAvt9Pl3+gohNKc7T/bgDaJ5gOreLDIqwXsCiI7k2OSoBmmS3Q4SVr8ECvr 1inzxLdmFaAIghzio3ebO1TbFa9T1ORtksTQyXj4ru6D9dCNAgUZyd1xCyLnN5eQP6zJ TjFFfi78jkYguTRn+CQ/i0VQBN0k3KyKilNW3tabqrH/mtjZcUQgcYJbebBz9gKieG+6 beIg6P7Fp3OyBLP8ImsayGr+v7AEXvnJEhHe6p5Acd0DnhlZ2aX9sUJFWe26z149ov2M B2VEXuZ2I6iPrBlD05re99FvX6iyjzRH4RQM+QOjZ55NcGZfEUt1YkD7EBW5XvNcrgou II5A== 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=XPcxKKzTJ6CHZqkcMut7l6klmMKuAhMpUuRA99yE0PE=; b=H95xgUFVEgoiIHioVmyhUTZXSEPc9Tz3bQoa2Qf2eHgdP7XZY8CHgipbISUJaCwBHI SKvSNjloYzaplJkp7XHFlkeCIfsFxOg/SJFHyey+ysv8z4MB7xfffr8heuLr9PG3iJ0K ea9oDOgxEdsVY/WxQMDhZ/kJkEKtPCcE9dArWQHEjCs0oOp+tv5FPfeWUsuQx+NLxC1f 3bdgcXh5NWr2udEcfIYAvCg5oWi5ZhiWk4Fr3eqlbaPCk2WT+G1tbIca5q9czwVIUtdI RY0VWiRGK/T6FUhaVIYtHx7c9OzM2BQPcMDzq4a6d051G6unzZqKsCkKnIXlpvVM0KCa jdEA== X-Gm-Message-State: AFqh2ko3BpfWtlfqTB4j7G/wq84L+w0FwQEFWpgrUXMi5ukX3SZraqoV J5goAjg+iGdGVTNqz/NRTOv9mPHwEjYan2DC X-Received: by 2002:a05:600c:4e08:b0:3d2:139e:f64f with SMTP id b8-20020a05600c4e0800b003d2139ef64fmr39089601wmq.40.1672937077838; Thu, 05 Jan 2023 08:44:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/34] target/arm: Remove unused includes from helper.c Date: Thu, 5 Jan 2023 16:44:05 +0000 Message-Id: <20230105164417.3994639-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Fabiano Rosas Signed-off-by: Fabiano Rosas Reviewed-by: Claudio Fontana Reviewed-by: Cornelia Huck Message-id: 20221213190537.511-6-farosas@suse.de Signed-off-by: Peter Maydell --- target/arm/helper.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 5d8971aa51e..d3e8e606475 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7,13 +7,11 @@ */ #include "qemu/osdep.h" -#include "qemu/units.h" #include "qemu/log.h" #include "trace.h" #include "cpu.h" #include "internals.h" #include "exec/helper-proto.h" -#include "qemu/host-utils.h" #include "qemu/main-loop.h" #include "qemu/timer.h" #include "qemu/bitops.h" @@ -22,17 +20,12 @@ #include "exec/exec-all.h" #include /* For crc32 */ #include "hw/irq.h" -#include "semihosting/semihost.h" -#include "sysemu/cpus.h" #include "sysemu/cpu-timers.h" #include "sysemu/kvm.h" -#include "qemu/range.h" #include "qapi/qapi-commands-machine-target.h" #include "qapi/error.h" #include "qemu/guest-random.h" #ifdef CONFIG_TCG -#include "arm_ldst.h" -#include "exec/cpu_ldst.h" #include "semihosting/common-semi.h" #endif #include "cpregs.h" From patchwork Thu Jan 5 16:44:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639300 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp331646pvb; Thu, 5 Jan 2023 09:07:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXc2hNGtyj14bocaRvEuXtJt/tSwOTnoJkFN8PfQqp00eSaRCBbSLssBkQ8SBT7eyUsxH3 X-Received: by 2002:a05:6214:37c6:b0:532:1283:dbf4 with SMTP id nj6-20020a05621437c600b005321283dbf4mr3195373qvb.16.1672938466257; Thu, 05 Jan 2023 09:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938466; cv=none; d=google.com; s=arc-20160816; b=t7W4d8h0a+9NolvJWIoDPy01TuZScdwP94RoOCIeu0qHKW+PUUubei61JHWlVaCSDL RgBeZmahA+Z0RiV/SGyjC0XxekpnwtTa+OTE6f8ZUK4lNreKBSg/5zQ1Y15fSDnOCBR9 kSpM+4PCyohrMkXMWH9cCmJQY1XzF0BCSFibwXY8A55/bhoUk+moHvQ7Mon7wVT+/m02 CKrtA+mvvOC93OMef8srtYCGRkP8uBsha0LW74T/rYcEtB0PScvQymtW4xnD2YUH1otd BAGVdOKrES0tGIWcmWqH1c2T0ZwVRxN8AqoNc/j6s56bvZRk7Oq+f/jlyKaKzIrJ1edW lQag== 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=5phcJn3+aOzp5t3SfXhX01zMS188rkd4iS8jVPL2LkE=; b=lDYozq4HOZm4ZtYSGzjqhW6K3GftViXlKL87eeJyEqJKMq7OWXpETC10+x3Ej19wUv jXayky/UW8+L1rHicSrYZeg5m/8bqrECKBJU3YvM9dGTaayZ9HJVvwAIgRb4ooJ7uUkk PgMwuL0I+m7Vf6qC8NHKw+k3oPocYrU31ciKFI8U1iIrtSMhLrFUhX8HzYf9PNfFgENL 6qSFAwTT73EZQbg1cg2qpi4NAGk8oZS9Cy6IGc5baucTOcWwx8qC/zzp9RPByHiJOhNM Fb50UCNS3qULdrLbDPUBHhQYTZWANT7Be9o7AtAayAG1KFb5YkVkKszvvN1TCk0KRh5B q2ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cme+eRrf; 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 jk10-20020ad45d4a000000b00524daecd76fsi19863607qvb.374.2023.01.05.09.07.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:07:46 -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=cme+eRrf; 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 1pDTMP-0000wV-4A; Thu, 05 Jan 2023 11:44:57 -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 1pDTMC-0000kk-S1 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:47 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTM7-00072G-Bx for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:40 -0500 Received: by mail-wm1-x32c.google.com with SMTP id ja17so28450082wmb.3 for ; Thu, 05 Jan 2023 08:44:38 -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=5phcJn3+aOzp5t3SfXhX01zMS188rkd4iS8jVPL2LkE=; b=cme+eRrfbRSg4csUk3Lp05wb4dzOo1sKBE0qYX+J4WSopS3IXVUP7+pvOnBAq7hJQC h1rx/wZMoO9xdCsAuRujK5T9sGvpcGPRPfe1P1ImLpeXxN2mtUO8hFJL+if7HXGBgtfj 1VrqzYrB5Lga9Pz2YJu5fEUoc1Cv9/jXeL5XaZVFf+ufPBe8uoilk6feZmPQ24xEcWMt 2/D7QdfiAbqA9JFJy/OpjBCvTzc7xF9XbaYsptU1wUDyqKxQ+s/3r4bpajIc7jg/8CaI uG+cWPW6iOsLiP+HOLEOty6f8EWp1IpP7nBt84vdpf/5hmw3Z42RJFuOXy0Tev3nO8Lz pF9Q== 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=5phcJn3+aOzp5t3SfXhX01zMS188rkd4iS8jVPL2LkE=; b=UsfsSKYsx/ZD/YQXtVGhvabYBoFmidNdGTdbKhSuKym/IraqOZg8bQHc3ED8S+IpFo OY/Kt3nh48ixlFXN7GCWfQwjyCHE//0KpKs+Ec+KTohuRQPRm7lRJE6aEnYUDZ8xRnk0 CRzOl752o314yPvrd35XffYFW6td+tpW7F8RltzxLA8kO1liPF1ITSja4qM8/84QWyA8 tKO8qsOTrKO0qByBVuIx+adGyxmzWzCxBAj1bJWsRb8TkPpsTgNg0Hv2QGV+fTMkr9s7 dq2T+bPBbw4gS5ja7XtGbTySh1ZgiR2/UgqzF1gzelicmn09fB1TqPu+AzSR6Td1LgMU vG9A== X-Gm-Message-State: AFqh2kr2m70jq5F0Lfi7cicdFxGb+Zd25hH/30KRqpZLcPdlwGbAEPOR eCEfBRXONNERP9PgH/u3kHu4uQtulAt/0yRf X-Received: by 2002:a05:600c:18a1:b0:3d2:3ec4:7eed with SMTP id x33-20020a05600c18a100b003d23ec47eedmr40233937wmp.10.1672937078665; Thu, 05 Jan 2023 08:44:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/34] target/arm: cleanup cpu includes Date: Thu, 5 Jan 2023 16:44:06 +0000 Message-Id: <20230105164417.3994639-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Claudio Fontana Remove some unused headers. Signed-off-by: Claudio Fontana Acked-by: Richard Henderson Reviewed-by: Claudio Fontana Reviewed-by: Cornelia Huck Signed-off-by: Fabiano Rosas Message-id: 20221213190537.511-7-farosas@suse.de [added back some includes that are still needed at this point] Signed-off-by: Fabiano Rosas Signed-off-by: Peter Maydell --- target/arm/cpu.c | 1 - target/arm/cpu64.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index f99f749b295..5f63316dbf2 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -26,7 +26,6 @@ #include "target/arm/idau.h" #include "qemu/module.h" #include "qapi/error.h" -#include "qapi/visitor.h" #include "cpu.h" #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 2cf2ca4ce5a..0e021960fb5 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -21,13 +21,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "cpu.h" -#ifdef CONFIG_TCG -#include "hw/core/tcg-cpu-ops.h" -#endif /* CONFIG_TCG */ #include "qemu/module.h" -#if !defined(CONFIG_USER_ONLY) -#include "hw/loader.h" -#endif #include "sysemu/kvm.h" #include "sysemu/hvf.h" #include "kvm_arm.h" From patchwork Thu Jan 5 16:44:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639281 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324590pvb; Thu, 5 Jan 2023 08:54:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXvMVfKcevj1k7ScmHkwvxg7PFu2b7ZOMn3e6TVa638d6GAWLxLwzoXCSM8K3EakrWa3xiMu X-Received: by 2002:ac8:5393:0:b0:3a9:7e3e:adff with SMTP id x19-20020ac85393000000b003a97e3eadffmr71180516qtp.41.1672937668728; Thu, 05 Jan 2023 08:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937668; cv=none; d=google.com; s=arc-20160816; b=a7L0QBD4Qto8Q67EUzZEXsIVuCk1Q7VHZjZYuVIboCKJ++bPfE/zb1QvxxOPYFA926 Kr0ttn2JWYAlwm0aIiMz7wpwCorKoRiEHF3gS3f6NEzPBUVbPTSClk/HLvJ7Vv1qbgjQ dCmmT6QhDK1NQrJw0UTuHGM8s1nFhbcXxMDkgQI5ws0yFF9q8VexSa3rFTKaT9rPrH0p I0Yvf+HtHOZF7h81Q86eo/TzW7y6wNUK2k7xLsxWrhELxE59YDt2DFLOyAzV27+LqjDB WLb02505nPXXl3G60pSv0JJBZXCF5uikm40/hYomquNFfJxuRuJ9RlE1W1KlgdAHTr2o CjfA== 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=wEthfbGdCK5i2mFV7wWA7GB9Fv4cHI0iBUrT8VSFqks=; b=eWwBQPICbvzmLbRYJLF3CtWYuGqoGUzWWNfQcu+94TC6bq3LAccEWQG/1UsP1rRn3j bpEBiZJkhJYj5AayOpk1SGaJzYd5pTidglJPkMufDVmzkBQILe0cTIDT6qQDuFxBud0W 7qFUVYxORf0jJM2ZJ+djgf7Rc3g/0GCe2KreuK0LljSJEwyxIf/9aMW0tsLcyuwN7XQQ FdwDg9W2aVSHJZ8Xr9V7SF/JKAMYAs6YqLU4ZKMi+xHv5Mc0LHx0kvDAT3drFTacIK9A gKht8YECISfmG/xF+bc/NUhGabNydZTcTfqF2rUvdVKzAbAwabWWoFY+p4j7SSXHvzzy 87TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P5SxrGVP; 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 j19-20020ac84413000000b003a4f2a60b4fsi18941602qtn.681.2023.01.05.08.54.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:54: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=P5SxrGVP; 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 1pDTMh-0001Re-Bi; Thu, 05 Jan 2023 11:45:15 -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 1pDTMC-0000kl-TS for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:47 -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 1pDTM8-0007Nx-By for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:42 -0500 Received: by mail-wm1-x32e.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso1776908wms.5 for ; Thu, 05 Jan 2023 08:44:39 -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=wEthfbGdCK5i2mFV7wWA7GB9Fv4cHI0iBUrT8VSFqks=; b=P5SxrGVPYakve0Z64GTVRAvRKHsNZntW+zp326XIOsACeeyVYhifz8loRDHRJ3psog BxN1vUoDDqoRI0AsejtpGIwn/hVXYXJfvfqSXLGf1ExXeozCc2bWvdIfGZz00kLnOF0i /O3KStwRb8nslegMDUZ7YorFUNkwxJr4omJVSquTYzGOo3qLYIrrDZcIfmDAmq5xXNXm GKcFJ96MxhMT6r2382al4cBxo3U6txwXzbuolxdC4KQZh1UjAQt4DT+5EhWZBjKfCYAF LlJdsrSIjcLQczHfxjnWzwM6SlkOEiScJ5QRWWv3bTReSEhfIw4y0+lpHRRNCnK3tfyY yaWA== 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=wEthfbGdCK5i2mFV7wWA7GB9Fv4cHI0iBUrT8VSFqks=; b=GKpLHy0zq1sdsJ1DjsKJrTc82OqAWpoIpFVOaEpvjxC7NwlKvK+nYZ/lNWVHRxPj/6 EWHidG0Cp2a2ocgGPRaziLOvhYmMzvfZ9cSOQ7e4N675QM3BOcAKgviIN/ZtTzJya5zC Q0URrp158JrrWWBdaoBEUeHlRT1oZXV6uXaoVo49b7BIDU+7kgWncrngQsw/KhkKFLw3 JcU+bSaMEc96ICH5IUcn48TqfWifYJ2zMacxXRlTbgaQO2KtcfvJiY2Q2EE3c2IiPuNN MenIBaPUA2kqcKNxHWsPP2qJlwATo4kz3B06mTdhLU7kA9eZ8QRRmwmtgpX3H8yq5hQm ukdQ== X-Gm-Message-State: AFqh2kp6MG08KCwu3rdYcXq+qU5m4AuEZ1+i35d+7bgNQ+4nfF4ZLC8D A7oUL85NxJksl20+QKHRNktkq1SxWLagVN0v X-Received: by 2002:a05:600c:1d89:b0:3d3:58cb:f6a6 with SMTP id p9-20020a05600c1d8900b003d358cbf6a6mr36664684wms.41.1672937079413; Thu, 05 Jan 2023 08:44:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/34] hw/input/tsc2xxx: Constify set_transform()'s MouseTransformInfo arg Date: Thu, 5 Jan 2023 16:44:07 +0000 Message-Id: <20230105164417.3994639-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Philippe Mathieu-Daudé The pointed MouseTransformInfo structure is accessed read-only. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20221220142520.24094-2-philmd@linaro.org Signed-off-by: Peter Maydell --- include/hw/input/tsc2xxx.h | 4 ++-- hw/input/tsc2005.c | 2 +- hw/input/tsc210x.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/hw/input/tsc2xxx.h b/include/hw/input/tsc2xxx.h index 5b76ebc1776..00eca17674e 100644 --- a/include/hw/input/tsc2xxx.h +++ b/include/hw/input/tsc2xxx.h @@ -30,12 +30,12 @@ uWireSlave *tsc2102_init(qemu_irq pint); uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav); I2SCodec *tsc210x_codec(uWireSlave *chip); uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len); -void tsc210x_set_transform(uWireSlave *chip, MouseTransformInfo *info); +void tsc210x_set_transform(uWireSlave *chip, const MouseTransformInfo *info); void tsc210x_key_event(uWireSlave *chip, int key, int down); /* tsc2005.c */ void *tsc2005_init(qemu_irq pintdav); uint32_t tsc2005_txrx(void *opaque, uint32_t value, int len); -void tsc2005_set_transform(void *opaque, MouseTransformInfo *info); +void tsc2005_set_transform(void *opaque, const MouseTransformInfo *info); #endif diff --git a/hw/input/tsc2005.c b/hw/input/tsc2005.c index 14698ce1097..555b6771738 100644 --- a/hw/input/tsc2005.c +++ b/hw/input/tsc2005.c @@ -523,7 +523,7 @@ void *tsc2005_init(qemu_irq pintdav) * from the touchscreen. Assuming 12-bit precision was used during * tslib calibration. */ -void tsc2005_set_transform(void *opaque, MouseTransformInfo *info) +void tsc2005_set_transform(void *opaque, const MouseTransformInfo *info) { TSC2005State *s = (TSC2005State *) opaque; diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index df7313db5d7..fdd5ff87d94 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -1176,8 +1176,7 @@ I2SCodec *tsc210x_codec(uWireSlave *chip) * from the touchscreen. Assuming 12-bit precision was used during * tslib calibration. */ -void tsc210x_set_transform(uWireSlave *chip, - MouseTransformInfo *info) +void tsc210x_set_transform(uWireSlave *chip, const MouseTransformInfo *info) { TSC210xState *s = (TSC210xState *) chip->opaque; #if 0 From patchwork Thu Jan 5 16:44:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639284 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp325116pvb; Thu, 5 Jan 2023 08:56:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXuq7pkrQZSzStm195BXQAlBG8IZxWdrrK1C4FoBv8/iN6ozDIyyiMpEyuOVtjAJxwIVV3/2 X-Received: by 2002:a05:6214:247:b0:51e:268a:e78b with SMTP id k7-20020a056214024700b0051e268ae78bmr68986864qvt.33.1672937764884; Thu, 05 Jan 2023 08:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937764; cv=none; d=google.com; s=arc-20160816; b=s7hyhveRylsVrKNK492YtvFcWYBANg+XTPr/HVjl7rp0TMe6GRycgABHhwodU0RScl 61G003n5agDC1DYOX1OKlNIu614OibwEqhDRxbA8YbOtDLS1i0ug25fvl7vv1jYigbPa CTZeptj3rmLUd20clIvX8ffZsiZjb7P62g7mISsZSMXgoB46tu7V2BboUPnrljq8MIuq R4SC/mMrE24XH+VlOHNDyCpkFPvAbOZYmeAxSmPkgXQ50UjGTU13snV3bAiZ8JB+9653 LItgkol0bgNURkNLsoZoNlI+vv0n99jpSN7HyPI4PCIic7QEYzy2JyUKzzCGKHwqvwP3 o0tw== 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=2P8f8Xydl4tMqTJeKBieZcm7XuJfXk+zzcjb3vTLYAA=; b=WKGPcffFKurhQaIqft3xWMxxXeWkcd66Plsyo3O86flfx6Zhmx6hY+io/M/TEx8uYC vzckmWliiWlThcUDBF4U6Y+oMkGphe79WvkQtBK+HSKOV8TN3s7Y5arXJUA+c3grbwmL 4J979Al+cuhL5fZqoHz2Gr16by1k1uFMtO4YyXE6pLkN3fTRLogtQFHeQjv0zyGi0MOt A4siZLHXsXMXJKFUIw6dkCsZOeQvfThCeuwNB8WFEeuej0GJX2AFnJj7bETmazpx2HMW tCSqYqtbFLzm9xF0gX94thAn+4sagiHqPzg/xl+5EVZnGK/5uyEVwWl1VAOENjkNTWHc PW3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WF7p91kg; 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 jx8-20020a0562142b0800b004c751151a10si19705919qvb.532.2023.01.05.08.56.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:56: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=WF7p91kg; 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 1pDTMU-00017U-N1; Thu, 05 Jan 2023 11:45:03 -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 1pDTMF-0000lJ-FX for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:49 -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 1pDTM9-0007Ov-6n for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:45 -0500 Received: by mail-wm1-x32d.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so1759513wms.0 for ; Thu, 05 Jan 2023 08:44:40 -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=2P8f8Xydl4tMqTJeKBieZcm7XuJfXk+zzcjb3vTLYAA=; b=WF7p91kgVmszzdRqUJPNybNM342/MLauVvN5Fp9f7OTN2alPX7UQKQTtMpg1wnHxQU nuBj8DpScU5gZuoHPEZXxobzgq0/e4pANBTbohwjzL7XpUR4BirersBMB9S/VpiUdQcp /AS9iKyb8S7M6JVyniPHqTpHjHpIgYyNmjD59NMCvJnYrcrXTkheLb0SlDgCQXbGtCCm dpmAiCVoEDvGl11n+6QPgBRjWDGkh+OchecK2RWtncXUlPS3Le2vQ1ckTyHYL/oSIf55 A4iFHYqXL7CfmZztB/sIkPZsFVcTdVYVnQBqkZ7xCLC5rNWB52oslpnENdCPDx0CtktN z/zg== 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=2P8f8Xydl4tMqTJeKBieZcm7XuJfXk+zzcjb3vTLYAA=; b=ng+VkTyi4eP31/YL9Q2TRHVwJLFALxNRwRBqe/bfj1f5t7dGwp8oVInDNiR+vMqGEg gtZC3Q2MsKR/lTqaNn+23li0sze+0LgmW1nZ3rh4QZEw8J29oTmfOFjz1RFx4Lvjbu3J MuVS/Ck2yY+iETBH9Kt0wDxM3CcsmLlMwfxthhLVzzdYxkRthIgoiKsHfMCXiHRHAbZC t+5J5uoAvI01trANuqbK75WP52jIEu1VnHPNtc7hx4WCfUOKDX+DFpIBYPtmsqaJK9j5 OWIJihbTngg+FnejZwChhzP54mklGDf2niBPmPGYLKx9hCesPalbNzCKnUDPFnLbMp6T agrg== X-Gm-Message-State: AFqh2kpCZjsh6E2XVqW0w6RsSu/xR5RW9TTMBO4ZuKaC3yQGTfSoSl2L yroZ8JiGbG71jVE+Fu72U2ddwKrf17+Efpvf X-Received: by 2002:a05:600c:3485:b0:3d0:761b:f86 with SMTP id a5-20020a05600c348500b003d0761b0f86mr36267396wmq.28.1672937080158; Thu, 05 Jan 2023 08:44:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/34] hw/arm/nseries: Constify various read-only arrays Date: Thu, 5 Jan 2023 16:44:08 +0000 Message-Id: <20230105164417.3994639-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: 20221220142520.24094-3-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/nseries.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index b151113c275..2ff29f52e2d 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -230,13 +230,13 @@ static void n8x0_i2c_setup(struct n800_s *s) } /* Touchscreen and keypad controller */ -static MouseTransformInfo n800_pointercal = { +static const MouseTransformInfo n800_pointercal = { .x = 800, .y = 480, .a = { 14560, -68, -3455208, -39, -9621, 35152972, 65536 }, }; -static MouseTransformInfo n810_pointercal = { +static const MouseTransformInfo n810_pointercal = { .x = 800, .y = 480, .a = { 15041, 148, -4731056, 171, -10238, 35933380, 65536 }, @@ -334,7 +334,7 @@ static void n810_key_event(void *opaque, int keycode) #define M 0 -static int n810_keys[0x80] = { +static const int n810_keys[0x80] = { [0x01] = 16, /* Q */ [0x02] = 37, /* K */ [0x03] = 24, /* O */ @@ -810,7 +810,7 @@ static void n8x0_usb_setup(struct n800_s *s) /* Setup done before the main bootloader starts by some early setup code * - used when we want to run the main bootloader in emulation. This * isn't documented. */ -static uint32_t n800_pinout[104] = { +static const uint32_t n800_pinout[104] = { 0x080f00d8, 0x00d40808, 0x03080808, 0x080800d0, 0x00dc0808, 0x0b0f0f00, 0x080800b4, 0x00c00808, 0x08080808, 0x180800c4, 0x00b80000, 0x08080808, @@ -1060,7 +1060,7 @@ static void n8x0_boot_init(void *opaque) #define OMAP_TAG_CBUS 0x4e03 #define OMAP_TAG_EM_ASIC_BB5 0x4e04 -static struct omap_gpiosw_info_s { +static const struct omap_gpiosw_info_s { const char *name; int line; int type; @@ -1102,7 +1102,7 @@ static struct omap_gpiosw_info_s { { NULL } }; -static struct omap_partition_info_s { +static const struct omap_partition_info_s { uint32_t offset; uint32_t size; int mask; @@ -1125,15 +1125,15 @@ static struct omap_partition_info_s { { 0, 0, 0, NULL } }; -static uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR }; +static const uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR }; static int n8x0_atag_setup(void *p, int model) { uint8_t *b; uint16_t *w; uint32_t *l; - struct omap_gpiosw_info_s *gpiosw; - struct omap_partition_info_s *partition; + const struct omap_gpiosw_info_s *gpiosw; + const struct omap_partition_info_s *partition; const char *tag; w = p; From patchwork Thu Jan 5 16:44:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639316 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp341136pvb; Thu, 5 Jan 2023 09:28:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXuNkdsp/yJ0OuALvf2lwFFrscWc+4am2r2W78aHXZn6zoS3tNcbeR5EkQC6PHBDirzzrJ8p X-Received: by 2002:ac8:51c8:0:b0:3a8:1d3c:47e9 with SMTP id d8-20020ac851c8000000b003a81d3c47e9mr68467360qtn.48.1672939725825; Thu, 05 Jan 2023 09:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939725; cv=none; d=google.com; s=arc-20160816; b=QBfVJ52sONcIabS/vFPq4ngzmgETE58hFaOuPR5puW4GlYWj3noMIVr6TGx2U6W9WS AnUd+XAYnq+LhWzTukUeCyRisR2o6x6S4fUbXbBITwnEXivcDx/dTgDQnCM198nLMo/5 0t2S4yX1S5CGXiStO+Hc05tuDpeOB3/o5Ej2yGTlZazPGcRRaze35a10bZ5vVeCxG9V9 kprzeee+fvjF+zbTo3lPn0crg2RfsKCW7fuan5Fo4nZsz6Gil7MGWyk3hta27gippkIt 9vdtcdk9mx5prgTAXlBO6SiIPYMpFMlTHSqNs6GVm8PQaGCSqfg59aYGHXtVC+E7OFR0 GHGA== 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=sMnAfCWZCLNwdcWgdCth6k3nhxTM77vAKQFc00HifCI=; b=PdXImG59O3PCi9puTkZdgn0BTV4Sd1tNaZmtfLMEhlQKGaMBLH1tJvBdTM0kOC6ImX q3kmctTKBh9o7bul4LizFdGfZhRRdirlffbej05gbf+vBJytzuqfbm2smzBNyUktaC0u 9Deo7vTwL7kMeH0Ex+iEKNMiP9IqH98ORao6WJ69BoJRIwtkfLFEZEcsNHSgyMJkIErO ZrORjApl+QhWSq6fU06+ozuANpRbDydKvpt5UCMtXBZuXIZE4iyr3Bl0/BkF3sAP1hIo 6PA1VirOzDnnj2AhrY0D0ztC4UlQOI3ahCE030hqkSGz+zgwtJZ919lHtjnAj3lBNftV IFjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w7VsZh2Y; 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 fg13-20020a05622a580d00b003a7e6b0073csi20574990qtb.60.2023.01.05.09.28.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:28:45 -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=w7VsZh2Y; 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 1pDTN2-0001gZ-GA; Thu, 05 Jan 2023 11:45: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 1pDTMG-0000lm-Vh for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:50 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTMA-0007Lt-Cw for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:45 -0500 Received: by mail-wm1-x334.google.com with SMTP id g10so14661381wmo.1 for ; Thu, 05 Jan 2023 08:44:41 -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=sMnAfCWZCLNwdcWgdCth6k3nhxTM77vAKQFc00HifCI=; b=w7VsZh2YUNU4Wq1EFuQTzpyVpJPsB61JAmd++c74Z31nGpzj114JqAdtbtA86UoQd8 RkwfzZHS/U2VnD+tJgfOjXOcxBRG04i3QH7pZ9iWzGCX8e7Ha+Ky3Y6wVIcVCX5I74Lu ox5HDg9tjJZqPYoRqtWhTitl9VmpWbaC+xJ4J2kgVJ39FC1gLAnH79UiEhXDA00I50uy JiU8fxk1Uzf48mmu9j8TepfGnvKK3gckvFETGRcqDj1ebjC9gwKFQ8SncaqdD7K8nQuD 3bWCf8JyCXWbmzrR6RvxaXvrIEs6wmsCGC6hZ2mY6dfM5E9Ib7Ssc/dZ3KCh7t6RXb8K CMTg== 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=sMnAfCWZCLNwdcWgdCth6k3nhxTM77vAKQFc00HifCI=; b=0s3HM4J2YB3IEbr9A9JJLVGF9FJvTouataV6CNW7RHJDAjdRtkkhzaXJSNPiJAIkpL ikA+UpAwaLvtZ1hli9NYmmj7tqXOY3SWHqZmvryTsjF7D87s02Toho8Ehy2KtXThpSaT X1fyy1oi1fqw7/IRN+cdcgnYPBsSqbfZimVjec4HMeYAs9txYXqDTNiWxI57ea+7fR0w 2nz7eM+EW6/oSHRJGeEVIBdO2xlCzFfRLDpjHNc97eDFtqemdexcNa0wGgDwzinOSJTn f56RT3WYSnZUjr14S7iktYBeYLwH+forjh+2A9l4GMWvUrQjNFZtxdFQs99Nyyjotdp9 qSLA== X-Gm-Message-State: AFqh2kr+oUgG+XgigPye7PHA4r7r/lpsKkOdfdKYWHf32iEzEaaOPKGh qWGEBNugm5RODI08o+6H5zgK72ygkwx6LsvH X-Received: by 2002:a05:600c:c8a:b0:3d9:7062:e0b7 with SMTP id fj10-20020a05600c0c8a00b003d97062e0b7mr31050441wmb.33.1672937080962; Thu, 05 Jan 2023 08:44:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/34] hw/arm/nseries: Silent -Wmissing-field-initializers warning Date: Thu, 5 Jan 2023 16:44:09 +0000 Message-Id: <20230105164417.3994639-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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é Silent when compiling with -Wextra: ../hw/arm/nseries.c:1081:12: warning: missing field 'line' initializer [-Wmissing-field-initializers] { NULL } ^ Signed-off-by: Philippe Mathieu-Daudé Message-id: 20221220142520.24094-4-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/nseries.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 2ff29f52e2d..c9df063a082 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -1078,7 +1078,7 @@ static const struct omap_gpiosw_info_s { "headphone", N8X0_HEADPHONE_GPIO, OMAP_GPIOSW_TYPE_CONNECTION | OMAP_GPIOSW_INVERTED, }, - { NULL } + { /* end of list */ } }, n810_gpiosw_info[] = { { "gps_reset", N810_GPS_RESET_GPIO, @@ -1099,7 +1099,7 @@ static const struct omap_gpiosw_info_s { "slide", N810_SLIDE_GPIO, OMAP_GPIOSW_TYPE_COVER | OMAP_GPIOSW_INVERTED, }, - { NULL } + { /* end of list */ } }; static const struct omap_partition_info_s { @@ -1113,16 +1113,14 @@ static const struct omap_partition_info_s { { 0x00080000, 0x00200000, 0x0, "kernel" }, { 0x00280000, 0x00200000, 0x3, "initfs" }, { 0x00480000, 0x0fb80000, 0x3, "rootfs" }, - - { 0, 0, 0, NULL } + { /* end of list */ } }, n810_part_info[] = { { 0x00000000, 0x00020000, 0x3, "bootloader" }, { 0x00020000, 0x00060000, 0x0, "config" }, { 0x00080000, 0x00220000, 0x0, "kernel" }, { 0x002a0000, 0x00400000, 0x0, "initfs" }, { 0x006a0000, 0x0f960000, 0x0, "rootfs" }, - - { 0, 0, 0, NULL } + { /* end of list */ } }; static const uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR }; From patchwork Thu Jan 5 16:44:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639320 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp344137pvb; Thu, 5 Jan 2023 09:34:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoIJkE5iU0/kmokyMelKTRpepS/yd4HL6BpRAtQONSUfuYE5ozSE/rw7YZn6y2651q0ILW X-Received: by 2002:ac8:7778:0:b0:3ab:af31:ee3e with SMTP id h24-20020ac87778000000b003abaf31ee3emr24455802qtu.60.1672940088446; Thu, 05 Jan 2023 09:34:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672940088; cv=none; d=google.com; s=arc-20160816; b=ge7ksFXQ/Jemtm//p8K2XeSMT7SzlTY/DaYpHawj9Y6FS90itZKcAWDG0rJC6ufpJW yWzxs3NGo+qpbb/az14Qe23r3egpFI1zZPUlpcrzzyLikvWRgTs0Rwddarit+DRpLdQq R874rFMfP4tkZ8Ok5aoTVn8RK8cIU5Yrjf7dDYmjwQ5rvRb1KxNtaFu8JjW5xlKmn4Yt biDcv1U2Q00MxeWEBnokCn/wel4/oAEnEdoNgmVt0eFLjg/FjKdE8R8UuwWDsPMO4dQh 4/zkyDo+RpGNv8zclZDvHw44LhcFDzPUmff3YFEuUsRSiu1oT4OgtoQJ95pdGcFteFuK qK5w== 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=TUUrqVHsbshf4grGNc3KmU3/yCcgNu5T7lT/XacC1ek=; b=q1ikrMGJ/8iOtqaXrwYeQL0wzagpUHxG+ydBNlkgR9179xnJ7L9K5u1MQ8pUI4LsOR P0CodU2ujjPRYIaBmLSSkXiwqok++FWwxJln1pXDki7zKzCZqyDu3i+OLmqTQJo2cTEi X11bIW0gjMhRg/Z7wZYRvcALeKuCLsMc0Nxvkx7AzXh6XI0n8f/K9xnBkjUF4EuUJr5e 6uGk0DBlbUOPnkK5e1jLPX+eJhNNQn9vEumOIhV54iCA4muzbIpA2rnb2QUFw2b4gFTP pJ1Qq3+SWZvvEG/yKN2zKV+xOgbg9VKFMMxIu3xiURlQiNJwY4nh53VgZHbkpaExtKS5 iRRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AUSt5NdR; 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 x16-20020ac84a10000000b003a81551fa60si19333797qtq.181.2023.01.05.09.34.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:34: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=AUSt5NdR; 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 1pDTNI-0001m0-GH; Thu, 05 Jan 2023 11:45:54 -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 1pDTMI-0000mA-0N for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:50 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTMC-0007Lb-Kw for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:49 -0500 Received: by mail-wm1-x334.google.com with SMTP id fm16-20020a05600c0c1000b003d96fb976efso1734788wmb.3 for ; Thu, 05 Jan 2023 08:44:42 -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=TUUrqVHsbshf4grGNc3KmU3/yCcgNu5T7lT/XacC1ek=; b=AUSt5NdRIfWyeM+k6mlIP8S6Diq2f+6rbMTkhATVjpzIR+CW5motElZtGZziyFJVJv W39V5a6vitu9aamVWZ6dEaiB6JL9Le/WlD9x+aVR5wxF6bWDYT68X+BxK3+WlqP0UOnQ aVR/7AjnlrjRLgFMQuSNdvpf3cuyJsrcaRY1mdkbD4/yLtFqEYRDhOJpyq1WH1HB8vX7 VAp5HIYt66qe+Np7tMEmmCMRqPUeyxB5I+6M9jD3Qz7mHXkN5Kdsp/x6DloKx7ZZUXGs v3LvNLuVloBNpM/hVafIhg6ClI5CCNLd6mGjK69BiiffZof02O1BHDujVjQrfoXuPguH Isaw== 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=TUUrqVHsbshf4grGNc3KmU3/yCcgNu5T7lT/XacC1ek=; b=L2A4PeYvk9BF2rXSXUnaj1BJIcvH5btvHsvOSlk+XmyF3fs0AGq3IMxbzag48u4mx5 /v+8dgntUyzl4yr+Zo7u6ZFtVJmDXZD8B3B1Z9543+VS87OStR1gtEd8GUtJ3R+Vm4rO Juuw8dWCOfmBqoTdN11thhnKocGARG/lbtXbYjRv9j97l1M8iP+0Ifdg+jRofb+OJP9O LLvMsJkH33SeB4wXFCI3bg+PyDe1B/iKWZKDeYDQY0HunWKGKJeCLkHOYtRw8uL0znCu urX5K5CqzmcP9QWVSl6we+oEa7zolilUsJwIJYPNJ5JpiUAxKieGZy3pLSSp37OxnAOJ 6G4Q== X-Gm-Message-State: AFqh2krWYg2jLdiPkobdxQFIStpUptuvS3nekVtMe5TawPB3tVT5G8Ab SAu2Aq++xR8GDyVnaxexrQr5r4Xke0wl6oiS X-Received: by 2002:a05:600c:358f:b0:3d1:cdf7:debf with SMTP id p15-20020a05600c358f00b003d1cdf7debfmr38009170wmq.26.1672937081747; Thu, 05 Jan 2023 08:44:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/34] target/arm: align exposed ID registers with Linux Date: Thu, 5 Jan 2023 16:44:10 +0000 Message-Id: <20230105164417.3994639-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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: Zhuojia Shen In CPUID registers exposed to userspace, some registers were missing and some fields were not exposed. This patch aligns exposed ID registers and their fields with what the upstream kernel currently exposes. Specifically, the following new ID registers/fields are exposed to userspace: ID_AA64PFR1_EL1.BT: bits 3-0 ID_AA64PFR1_EL1.MTE: bits 11-8 ID_AA64PFR1_EL1.SME: bits 27-24 ID_AA64ZFR0_EL1.SVEver: bits 3-0 ID_AA64ZFR0_EL1.AES: bits 7-4 ID_AA64ZFR0_EL1.BitPerm: bits 19-16 ID_AA64ZFR0_EL1.BF16: bits 23-20 ID_AA64ZFR0_EL1.SHA3: bits 35-32 ID_AA64ZFR0_EL1.SM4: bits 43-40 ID_AA64ZFR0_EL1.I8MM: bits 47-44 ID_AA64ZFR0_EL1.F32MM: bits 55-52 ID_AA64ZFR0_EL1.F64MM: bits 59-56 ID_AA64SMFR0_EL1.F32F32: bit 32 ID_AA64SMFR0_EL1.B16F32: bit 34 ID_AA64SMFR0_EL1.F16F32: bit 35 ID_AA64SMFR0_EL1.I8I32: bits 39-36 ID_AA64SMFR0_EL1.F64F64: bit 48 ID_AA64SMFR0_EL1.I16I64: bits 55-52 ID_AA64SMFR0_EL1.FA64: bit 63 ID_AA64MMFR0_EL1.ECV: bits 63-60 ID_AA64MMFR1_EL1.AFP: bits 47-44 ID_AA64MMFR2_EL1.AT: bits 35-32 ID_AA64ISAR0_EL1.RNDR: bits 63-60 ID_AA64ISAR1_EL1.FRINTTS: bits 35-32 ID_AA64ISAR1_EL1.BF16: bits 47-44 ID_AA64ISAR1_EL1.DGH: bits 51-48 ID_AA64ISAR1_EL1.I8MM: bits 55-52 ID_AA64ISAR2_EL1.WFxT: bits 3-0 ID_AA64ISAR2_EL1.RPRES: bits 7-4 ID_AA64ISAR2_EL1.GPA3: bits 11-8 ID_AA64ISAR2_EL1.APA3: bits 15-12 The code is also refactored to use symbolic names for ID register fields for better readability and maintainability. The test case in tests/tcg/aarch64/sysregs.c is also updated to match the intended behavior. Signed-off-by: Zhuojia Shen Message-id: DS7PR12MB6309FB585E10772928F14271ACE79@DS7PR12MB6309.namprd12.prod.outlook.com Reviewed-by: Peter Maydell [PMM: use Sn_n_Cn_Cn_n syntax to work with older assemblers that don't recognize id_aa64isar2_el1 and id_aa64mmfr2_el1] Signed-off-by: Peter Maydell --- target/arm/helper.c | 96 +++++++++++++++++++++++++------ tests/tcg/aarch64/sysregs.c | 24 ++++++-- tests/tcg/aarch64/Makefile.target | 7 ++- 3 files changed, 103 insertions(+), 24 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index d3e8e606475..cee38043540 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8147,31 +8147,89 @@ void register_cp_regs_for_features(ARMCPU *cpu) #ifdef CONFIG_USER_ONLY static const ARMCPRegUserSpaceInfo v8_user_idregs[] = { { .name = "ID_AA64PFR0_EL1", - .exported_bits = 0x000f000f00ff0000, - .fixed_bits = 0x0000000000000011 }, + .exported_bits = R_ID_AA64PFR0_FP_MASK | + R_ID_AA64PFR0_ADVSIMD_MASK | + R_ID_AA64PFR0_SVE_MASK | + R_ID_AA64PFR0_DIT_MASK, + .fixed_bits = (0x1u << R_ID_AA64PFR0_EL0_SHIFT) | + (0x1u << R_ID_AA64PFR0_EL1_SHIFT) }, { .name = "ID_AA64PFR1_EL1", - .exported_bits = 0x00000000000000f0 }, + .exported_bits = R_ID_AA64PFR1_BT_MASK | + R_ID_AA64PFR1_SSBS_MASK | + R_ID_AA64PFR1_MTE_MASK | + R_ID_AA64PFR1_SME_MASK }, { .name = "ID_AA64PFR*_EL1_RESERVED", - .is_glob = true }, - { .name = "ID_AA64ZFR0_EL1" }, + .is_glob = true }, + { .name = "ID_AA64ZFR0_EL1", + .exported_bits = R_ID_AA64ZFR0_SVEVER_MASK | + R_ID_AA64ZFR0_AES_MASK | + R_ID_AA64ZFR0_BITPERM_MASK | + R_ID_AA64ZFR0_BFLOAT16_MASK | + R_ID_AA64ZFR0_SHA3_MASK | + R_ID_AA64ZFR0_SM4_MASK | + R_ID_AA64ZFR0_I8MM_MASK | + R_ID_AA64ZFR0_F32MM_MASK | + R_ID_AA64ZFR0_F64MM_MASK }, + { .name = "ID_AA64SMFR0_EL1", + .exported_bits = R_ID_AA64SMFR0_F32F32_MASK | + R_ID_AA64SMFR0_B16F32_MASK | + R_ID_AA64SMFR0_F16F32_MASK | + R_ID_AA64SMFR0_I8I32_MASK | + R_ID_AA64SMFR0_F64F64_MASK | + R_ID_AA64SMFR0_I16I64_MASK | + R_ID_AA64SMFR0_FA64_MASK }, { .name = "ID_AA64MMFR0_EL1", - .fixed_bits = 0x00000000ff000000 }, - { .name = "ID_AA64MMFR1_EL1" }, + .exported_bits = R_ID_AA64MMFR0_ECV_MASK, + .fixed_bits = (0xfu << R_ID_AA64MMFR0_TGRAN64_SHIFT) | + (0xfu << R_ID_AA64MMFR0_TGRAN4_SHIFT) }, + { .name = "ID_AA64MMFR1_EL1", + .exported_bits = R_ID_AA64MMFR1_AFP_MASK }, + { .name = "ID_AA64MMFR2_EL1", + .exported_bits = R_ID_AA64MMFR2_AT_MASK }, { .name = "ID_AA64MMFR*_EL1_RESERVED", - .is_glob = true }, + .is_glob = true }, { .name = "ID_AA64DFR0_EL1", - .fixed_bits = 0x0000000000000006 }, - { .name = "ID_AA64DFR1_EL1" }, + .fixed_bits = (0x6u << R_ID_AA64DFR0_DEBUGVER_SHIFT) }, + { .name = "ID_AA64DFR1_EL1" }, { .name = "ID_AA64DFR*_EL1_RESERVED", - .is_glob = true }, + .is_glob = true }, { .name = "ID_AA64AFR*", - .is_glob = true }, + .is_glob = true }, { .name = "ID_AA64ISAR0_EL1", - .exported_bits = 0x00fffffff0fffff0 }, + .exported_bits = R_ID_AA64ISAR0_AES_MASK | + R_ID_AA64ISAR0_SHA1_MASK | + R_ID_AA64ISAR0_SHA2_MASK | + R_ID_AA64ISAR0_CRC32_MASK | + R_ID_AA64ISAR0_ATOMIC_MASK | + R_ID_AA64ISAR0_RDM_MASK | + R_ID_AA64ISAR0_SHA3_MASK | + R_ID_AA64ISAR0_SM3_MASK | + R_ID_AA64ISAR0_SM4_MASK | + R_ID_AA64ISAR0_DP_MASK | + R_ID_AA64ISAR0_FHM_MASK | + R_ID_AA64ISAR0_TS_MASK | + R_ID_AA64ISAR0_RNDR_MASK }, { .name = "ID_AA64ISAR1_EL1", - .exported_bits = 0x000000f0ffffffff }, + .exported_bits = R_ID_AA64ISAR1_DPB_MASK | + R_ID_AA64ISAR1_APA_MASK | + R_ID_AA64ISAR1_API_MASK | + R_ID_AA64ISAR1_JSCVT_MASK | + R_ID_AA64ISAR1_FCMA_MASK | + R_ID_AA64ISAR1_LRCPC_MASK | + R_ID_AA64ISAR1_GPA_MASK | + R_ID_AA64ISAR1_GPI_MASK | + R_ID_AA64ISAR1_FRINTTS_MASK | + R_ID_AA64ISAR1_SB_MASK | + R_ID_AA64ISAR1_BF16_MASK | + R_ID_AA64ISAR1_DGH_MASK | + R_ID_AA64ISAR1_I8MM_MASK }, + { .name = "ID_AA64ISAR2_EL1", + .exported_bits = R_ID_AA64ISAR2_WFXT_MASK | + R_ID_AA64ISAR2_RPRES_MASK | + R_ID_AA64ISAR2_GPA3_MASK | + R_ID_AA64ISAR2_APA3_MASK }, { .name = "ID_AA64ISAR*_EL1_RESERVED", - .is_glob = true }, + .is_glob = true }, }; modify_arm_cp_regs(v8_idregs, v8_user_idregs); #endif @@ -8508,8 +8566,12 @@ void register_cp_regs_for_features(ARMCPU *cpu) #ifdef CONFIG_USER_ONLY static const ARMCPRegUserSpaceInfo id_v8_user_midr_cp_reginfo[] = { { .name = "MIDR_EL1", - .exported_bits = 0x00000000ffffffff }, - { .name = "REVIDR_EL1" }, + .exported_bits = R_MIDR_EL1_REVISION_MASK | + R_MIDR_EL1_PARTNUM_MASK | + R_MIDR_EL1_ARCHITECTURE_MASK | + R_MIDR_EL1_VARIANT_MASK | + R_MIDR_EL1_IMPLEMENTER_MASK }, + { .name = "REVIDR_EL1" }, }; modify_arm_cp_regs(id_v8_midr_cp_reginfo, id_v8_user_midr_cp_reginfo); #endif diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c index 40cf8d2877e..46b931f781d 100644 --- a/tests/tcg/aarch64/sysregs.c +++ b/tests/tcg/aarch64/sysregs.c @@ -22,6 +22,13 @@ #define HWCAP_CPUID (1 << 11) #endif +/* + * Older assemblers don't recognize newer system register names, + * but we can still access them by the Sn_n_Cn_Cn_n syntax. + */ +#define SYS_ID_AA64ISAR2_EL1 S3_0_C0_C6_2 +#define SYS_ID_AA64MMFR2_EL1 S3_0_C0_C7_2 + int failed_bit_count; /* Read and print system register `id' value */ @@ -112,18 +119,23 @@ int main(void) * minimum valid fields - for the purposes of this check allowed * to have non-zero values. */ - get_cpu_reg_check_mask(id_aa64isar0_el1, _m(00ff,ffff,f0ff,fff0)); - get_cpu_reg_check_mask(id_aa64isar1_el1, _m(0000,00f0,ffff,ffff)); + get_cpu_reg_check_mask(id_aa64isar0_el1, _m(f0ff,ffff,f0ff,fff0)); + get_cpu_reg_check_mask(id_aa64isar1_el1, _m(00ff,f0ff,ffff,ffff)); + get_cpu_reg_check_mask(SYS_ID_AA64ISAR2_EL1, _m(0000,0000,0000,ffff)); /* TGran4 & TGran64 as pegged to -1 */ - get_cpu_reg_check_mask(id_aa64mmfr0_el1, _m(0000,0000,ff00,0000)); - get_cpu_reg_check_zero(id_aa64mmfr1_el1); + get_cpu_reg_check_mask(id_aa64mmfr0_el1, _m(f000,0000,ff00,0000)); + get_cpu_reg_check_mask(id_aa64mmfr1_el1, _m(0000,f000,0000,0000)); + get_cpu_reg_check_mask(SYS_ID_AA64MMFR2_EL1, _m(0000,000f,0000,0000)); /* EL1/EL0 reported as AA64 only */ get_cpu_reg_check_mask(id_aa64pfr0_el1, _m(000f,000f,00ff,0011)); - get_cpu_reg_check_mask(id_aa64pfr1_el1, _m(0000,0000,0000,00f0)); + get_cpu_reg_check_mask(id_aa64pfr1_el1, _m(0000,0000,0f00,0fff)); /* all hidden, DebugVer fixed to 0x6 (ARMv8 debug architecture) */ get_cpu_reg_check_mask(id_aa64dfr0_el1, _m(0000,0000,0000,0006)); get_cpu_reg_check_zero(id_aa64dfr1_el1); - get_cpu_reg_check_zero(id_aa64zfr0_el1); + get_cpu_reg_check_mask(id_aa64zfr0_el1, _m(0ff0,ff0f,00ff,00ff)); +#ifdef HAS_ARMV9_SME + get_cpu_reg_check_mask(id_aa64smfr0_el1, _m(80f1,00fd,0000,0000)); +#endif get_cpu_reg_check_zero(id_aa64afr0_el1); get_cpu_reg_check_zero(id_aa64afr1_el1); diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index fc8d90ed692..db122ab4ff3 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -23,7 +23,8 @@ config-cc.mak: Makefile $(call cc-option,-march=armv8.1-a+sve2, CROSS_CC_HAS_SVE2); \ $(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3); \ $(call cc-option,-mbranch-protection=standard, CROSS_CC_HAS_ARMV8_BTI); \ - $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE)) 3> config-cc.mak + $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE); \ + $(call cc-option,-march=armv9-a+sme, CROSS_CC_HAS_ARMV9_SME)) 3> config-cc.mak -include config-cc.mak # Pauth Tests @@ -53,7 +54,11 @@ endif ifneq ($(CROSS_CC_HAS_SVE),) # System Registers Tests AARCH64_TESTS += sysregs +ifneq ($(CROSS_CC_HAS_ARMV9_SME),) +sysregs: CFLAGS+=-march=armv9-a+sme -DHAS_ARMV9_SME +else sysregs: CFLAGS+=-march=armv8.1-a+sve +endif # SVE ioctl test AARCH64_TESTS += sve-ioctls From patchwork Thu Jan 5 16:44:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639305 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp333999pvb; Thu, 5 Jan 2023 09:12:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXs23KHwU8P1uCXi31FdtYUvsvDcWcets7nh2tlN8oG14yuoSwA/hIuMw5bQY/ksydtvx1ig X-Received: by 2002:a81:783:0:b0:3ce:b4c3:1a29 with SMTP id 125-20020a810783000000b003ceb4c31a29mr46659940ywh.26.1672938741151; Thu, 05 Jan 2023 09:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938741; cv=none; d=google.com; s=arc-20160816; b=ZV+0JVp0jZQOiI2nUu5WyHlY90VeoYdtT6K3RUY1Sma5XM81SsTq2mts4ayxYzoh75 FktvAtrmyAO0BM/8/Og9QGC4Eg7n4zr2aOD3GakLioXp4ZTnRGwVKP8xsWwrhxt892uG STa5HtWDvFmdBwMbq4Je+qDdvAQRx72HNewJdtEWLuYKlZwXp3e7ct7jc1BmZT+5T1KT cXn09dfXZALVjpiH1bWRbPBWJi3ZwppOcnwT3MxIoknXTZ5DNRo8dxVFyFPru/tbqERZ KLLyywbRxGUS+AVpC2JtdHONFM5OWfhhFI9celXpvA+AdwNnCrg5N4jC/zGRhXa8l0/X /Yig== 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=3npsTUveFtQ4HNUpCii6m95dErHPlNzn4rRyXMWJ2LY=; b=L26kE5ISP2B17eczTCxtfLad3PEzx0WMPc4jYkmu+U1tXwS6jX1rkDBM2pENf5g8qx I4dYpC08tqWW2OdKiKMB12wyGfsZJ5/3BOwWAyCzdmfoVbPyB9uw1V1oULiCHwHND/Qq TnIoCUmBxmiiAbLeU37W2OeVwoRV60YOK1eARRqE6O6QTdqFsVy5cdK3/rnAyAhA20q1 6P3Sq2v3qzXw8Hj5PUqBqi21kDXwD+i4HUxjXJdzKtYeKEGR2GAx+Oxtnq7pk3a6ps/R Zdn8XuXBugJIveIWRew7p7C+E3fvBlAQuzBVYUQS0AGYBcmtPE62Cyq0z90sy4uRlx5h RNWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FtUPtj6S; 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 dm17-20020a05620a1d5100b006fa5f940d69si19056195qkb.531.2023.01.05.09.12.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:12: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=FtUPtj6S; 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 1pDTNs-00027f-Fz; Thu, 05 Jan 2023 11:46:28 -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 1pDTMI-0000m8-01 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:50 -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 1pDTMC-00071v-Lu for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:47 -0500 Received: by mail-wm1-x32d.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso1787108wmq.1 for ; Thu, 05 Jan 2023 08:44:42 -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=3npsTUveFtQ4HNUpCii6m95dErHPlNzn4rRyXMWJ2LY=; b=FtUPtj6STbtw9GjlSpF61MkZUBHAuggA25z6TacVSdPaz12QqRGvzMjGbgFCuFpBBL L2Wdt4EyO9Wu9Im/dRDLRiByXSvEF3rFNPv3gPfORsAuWYbCUQEznC/ub7vNlIhavaxW KsAc3W7+7oC03UsUWVa7hRzUn6EYzCD4nDY0WaZlDnmLETvmnbj46JI1x8QJT2hvBRAu 5v2LD86fpCRdaCLgIuJWwXKDxjirFAGMM3o07GbqlqBAtojzxMn8Idx/lke5jhVnbaf8 /YeNTNO3FtumTM+b3W5pkQv/i386zaWV6G0qV1JF3C1HfgOqVUfutJJMD6N0fGYJWTDk 86Og== 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=3npsTUveFtQ4HNUpCii6m95dErHPlNzn4rRyXMWJ2LY=; b=8C6YdvUzpvzL28gKEWCa2viCHbkO6TFtGsFMPiujBnHcBnwX7LnooNg7jN9RiZolEy B7a9UII7S6jtFeXyrC2JKSWUguj+fWsXZys7zY5bRuBrzZ78qzJ/AYTL9qBgjXDsPOUv uFvmml4TEXFYgUtoFemkE9yF9cGeWjgP2HI2ml6RN6GuzPzk2Y24VysHbru0Z2dXpqLv LW5uu8K153bIps60d3fvVHet2nyysMBsOWwwqwZw+J2PmgBw+8IwQzCxfhRVCuTj6mwV gJMhKe85aiKucXDPvu3fgUfvz+9tLS5TLqyVsOELy562Phmd9q3xavmlIiIXS3yPEaG6 J7kQ== X-Gm-Message-State: AFqh2kq17xXZMLn4QyLl5H/9AZ2bbo4em1DCumQZ87HSJMURFwqq4dOX aVVfcb1ug732nJWRZo3l7tIvEOE6eHeCjQff X-Received: by 2002:a05:600c:3d1b:b0:3d0:6a57:66a5 with SMTP id bh27-20020a05600c3d1b00b003d06a5766a5mr36114367wmb.0.1672937082502; Thu, 05 Jan 2023 08:44:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/34] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Date: Thu, 5 Jan 2023 16:44:11 +0000 Message-Id: <20230105164417.3994639-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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é This function is not used anywhere outside this file, so we can make the function "static void". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Eric Auger Message-id: 20221216214924.4711-2-philmd@linaro.org Signed-off-by: Peter Maydell --- include/hw/arm/smmu-common.h | 3 --- hw/arm/smmu-common.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h index 21e62342e92..c5683af07d6 100644 --- a/include/hw/arm/smmu-common.h +++ b/include/hw/arm/smmu-common.h @@ -173,7 +173,4 @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova, /* Unmap the range of all the notifiers registered to any IOMMU mr */ void smmu_inv_notifiers_all(SMMUState *s); -/* Unmap the range of all the notifiers registered to @mr */ -void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr); - #endif /* HW_ARM_SMMU_COMMON_H */ diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 220838525d4..9f196625a2b 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -483,7 +483,7 @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n) } /* Unmap all notifiers attached to @mr */ -inline void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr) +static void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr) { IOMMUNotifier *n; From patchwork Thu Jan 5 16:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639301 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp331739pvb; Thu, 5 Jan 2023 09:07:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUnjteXQpRwyAnYP2MpWJIul9Z9P7gpUi1MMlAw35zYEtO0g+MuxiozpuSyYWCjFNga1bz X-Received: by 2002:a25:8883:0:b0:7af:35b6:19d3 with SMTP id d3-20020a258883000000b007af35b619d3mr6256064ybl.45.1672938476497; Thu, 05 Jan 2023 09:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938476; cv=none; d=google.com; s=arc-20160816; b=IK3g+XcennMtrvzoCwWpqfI/SjFg2dM7L4cGQeCgpe/tA4R4VxGmPU4/uuhtoEs5gS o9PKYN1yyrFGUedneMqhU4N7XqFPFZmcPzMWPkjIT4iv0XwWhrWCe7+F8ucfoIGpH83b 78y2d2/QDj7kGKqviAbi56ob4K7toilFiBT9j1PNL3NcddtoSu6MtOzbnlRgRW4MbHc5 YIbFBZDDyzvG3nlZ6iLAmmmbnDM6HlMdXSii3bscrl/aJkpupR9WgF+HF07TuAJcvczq HjHYQCRGWmG3pXCx0IlakUiISEtyCZJRfoSdzbF6ZyYE5Golm2veDwr3WcICxbeXbLl9 Hhrw== 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=NIfbKJ/3ZkCvJIhNz8wE2t2u1al6fnbpkmOv2zew4vY=; b=f+1P0FJX5fWdE1jbzluMseedFNHtZODtso417N8wPlzjhjX1pnHnjcSeBlonlBzWOv TthBeYqh3IdJlOV0yM3/pu1VFQ+/Cxvkw2MccNT7hAV4LVcOTBwZlBgvL18CPcfBlrm/ ONU2cZSHJFg/TajuDo5E4Ys7fyjEJJsyb1N9QjqB/0+SfrzePrUzrNmOMhBjFkmVKVXn +D6ZX12dzB9aJ31X6iRWfkRALXdocsE3FH43aK+mcY2P3jwnZ9WpKIrpqH6S/MEIM0XV AN8zDOFvBo8h8T6II7s3vKOvPGiV/N+9eHBMaKFkuUExqmODAERnlHd/u2/gaWDmJ4P+ LLKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MAzC5WOQ; 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 h6-20020a05620a400600b006ee9af422b6si23754594qko.226.2023.01.05.09.07.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:07: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=MAzC5WOQ; 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 1pDTMf-0001Lj-6W; Thu, 05 Jan 2023 11:45:13 -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 1pDTMI-0000m7-0B for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:50 -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 1pDTMC-0007Ss-Lq for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:48 -0500 Received: by mail-wm1-x32a.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso1787135wmq.1 for ; Thu, 05 Jan 2023 08:44:44 -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=NIfbKJ/3ZkCvJIhNz8wE2t2u1al6fnbpkmOv2zew4vY=; b=MAzC5WOQTyz31T9GyWYxgHhDqod4dRuoANpsKo05PnaKOpRtBQ0OynQFAD2vgFRvAv ewi2SLseQKhc4xziNLaWTPNfw08VOLf5wBUJwxbm2EKYtBESIznPeqE7YuLdCEA4fARs JylCfUxGodTkbJvxjdT4KykXfdEHfmr1TIVFix/V0IN6AiO6+lFSIDBnddwCehX/lFvw 0xAGOIFkYKW5SxL7JRzfNzUQDXGK7cW7d8cknK9cPkFZYrjV6ev8H+hTCqZ7sfwU5OAm T0J3YPpkG1WFGcUhMQDEoEjGZMO6faPUw43rUd/dNmDGpQD0o4igDn+VOsTqM/4DZrK0 yxyw== 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=NIfbKJ/3ZkCvJIhNz8wE2t2u1al6fnbpkmOv2zew4vY=; b=rANS9RJwe0Nhz1XVgQ+ENZ0ItIWtYPhaoCJp9ZOxdwrB8dol9Qn2pwj+Z/lNefi7zj S9x4OVsa2MoAcwlw8IaVbykAOTU7Lp7dzsVaI8+ZfDDZVs5daPLCfYHUIAKrOIy6v/Gd +qknPmBh2etd6aJ9gFRthR0pAQnDfflt3RUdrQ2VUHw8m4Be86c6BV/XyNk8ohsvnKiQ V60Uj6qe3/YaiTbyrK6JHEOhmA8Iky2ozNVHtKHsdfpbtJUNTZ7+5DfAn1PmZselQybe Qq+drBDLDfeykpIUWBfKEE34Lwo4HtZUJBQHwfU0w3UOQowpaCu0bNXZIzsOICUcXub4 CRhQ== X-Gm-Message-State: AFqh2kpjSyKxa3oaFZwrtKa5w0CMFfIBwa8D6uvba0dD3EezrowOB2ka 4anqamWA5iT7rrfXJABqoULSuzCeDmBd599c X-Received: by 2002:a05:600c:1f18:b0:3cf:5583:8b3f with SMTP id bd24-20020a05600c1f1800b003cf55838b3fmr35524312wmb.20.1672937083374; Thu, 05 Jan 2023 08:44:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/34] hw/arm/smmu-common: Avoid using inlined functions with external linkage Date: Thu, 5 Jan 2023 16:44:12 +0000 Message-Id: <20230105164417.3994639-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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é When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)") and building with -Wall we get: hw/arm/smmu-common.c:173:33: warning: static function 'smmu_hash_remove_by_asid_iova' is used in an inline function with external linkage [-Wstatic-in-inline] hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova, ^ static None of our code base require / use inlined functions with external linkage. Some places use internal inlining in the hot path. These two functions are certainly not in any hot path and don't justify any inlining, so these are likely oversights rather than intentional. Reported-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Eric Auger Message-id: 20221216214924.4711-3-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/smmu-common.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 9f196625a2b..54186f31cb5 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -116,7 +116,7 @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new) g_hash_table_insert(bs->iotlb, key, new); } -inline void smmu_iotlb_inv_all(SMMUState *s) +void smmu_iotlb_inv_all(SMMUState *s) { trace_smmu_iotlb_inv_all(); g_hash_table_remove_all(s->iotlb); @@ -146,9 +146,8 @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value, ((entry->iova & ~info->mask) == info->iova); } -inline void -smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova, - uint8_t tg, uint64_t num_pages, uint8_t ttl) +void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova, + uint8_t tg, uint64_t num_pages, uint8_t ttl) { /* if tg is not set we use 4KB range invalidation */ uint8_t granule = tg ? tg * 2 + 10 : 12; @@ -174,7 +173,7 @@ smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova, &info); } -inline void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid) +void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid) { trace_smmu_iotlb_inv_asid(asid); g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid); @@ -374,8 +373,8 @@ error: * * return 0 on success */ -inline int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm, - SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info) +int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm, + SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info) { if (!cfg->aa64) { /* From patchwork Thu Jan 5 16:44:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639296 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp330652pvb; Thu, 5 Jan 2023 09:06:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtG8j+GRDntl0IcLV3bXb414OpuEkgLgVP2M1vpYiAEWGyuegtSnheM25NRCp5hTBniiXUQ X-Received: by 2002:a05:622a:4c88:b0:3a8:649:8d0a with SMTP id ez8-20020a05622a4c8800b003a806498d0amr78320918qtb.30.1672938370436; Thu, 05 Jan 2023 09:06:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938370; cv=none; d=google.com; s=arc-20160816; b=zw7NBh0debctHIRibFnZIJfY8Mi6KXxPttOp/cvYAa40+1qd8E4MjdLFlzdBrOA892 0vJiuG2f37D/VlpFZBjao/stdGq2TxkaFPBKRiQQGFEznrcKj9I9P7t47q1if32Chlrh 6zNAcJ7T7+MJcbci+LGz9t4iS6mtjFjj9UVykPawdOCn7hqhq9FQQBlfrpJn0PFS+dW3 rT5+CjxAtspEV4PCsc+IVhCjPRrHm4taU11k+4J1mb6dq4OBW90JL9UfiEby9uSfi+Iz x7JzleJcFgKcmnU5sRl0EtnhybQcoi+LzayJKn6S51F4auW6v+R5RHenJYD0OvSoTRFv Cx2w== 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=WdsQkzgPH1wTahyKLQ7ZmQKEPjf3NSnJoH3HoNNy3yI=; b=LITo7Y4jvgBFM3CS7VwGlSKKhcJn+8IknDi1BIg1oHK+HPXMpsysYFapDZSdALiDas +KaxRaqLx01wVy46NbpXl6AdHFiCzHAnthK1OvGAkW5G4GTI0EW4masYyEVShgw5SF++ 1uBXe9zzXl4HIVc2GtLKucjl32Z0sAimOTa321OraS2ML3hDZemlocFR2cDyUj3A8Jbu L5qSN/q/pK3gJFWWsi2vNF/cWaMLL6jdgX9E6xzrhjiUgM1B4Y0ZR6nUxaGpaWv6SrP2 SIe9sVcWYM8AzozSXW2sZOUt7XRGj310Cns830w32KGwjyAtE1Cp6+UozJspYoteK93T V0fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6wgz+5P; 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 br10-20020a05622a1e0a00b003a69eb226casi19790139qtb.54.2023.01.05.09.06.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:06:10 -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=X6wgz+5P; 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 1pDTNP-0001wf-E4; Thu, 05 Jan 2023 11:46:01 -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 1pDTMI-0000m9-0B for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:50 -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 1pDTMD-0007T2-Tq for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:49 -0500 Received: by mail-wm1-x32b.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso1787162wmq.1 for ; Thu, 05 Jan 2023 08:44:44 -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=WdsQkzgPH1wTahyKLQ7ZmQKEPjf3NSnJoH3HoNNy3yI=; b=X6wgz+5PwOZZOdDqD0dokqIsnOAe+JlN75+szGkbO2yzXSBlMujbXS/reBh6/Kt3Hb DyeclxgD3oxKcPcU71NtsBiQQPBdjYLUvyaY9gsZm97OAj1vNVIeUEjV/lXTA5ngxvQ1 umtwlrGDvOo9QxbCJqujTOIEvhBydGooiu6tGFop9qeP5dcDVRdbEVaRBY2mzFkF688P osFjG+SXUqLFd6nX7eKdI+j7+/7FEXnWrTXVLArVXhO9+3nwZ+L+PruAf+ubLdlgXXsq hmssuBDrhYqEAB+US33/FwC3sP0x5T0dBzBKMFFiIGqnz9/7MI17CCE0T8pZjKREpiiN TcBQ== 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=WdsQkzgPH1wTahyKLQ7ZmQKEPjf3NSnJoH3HoNNy3yI=; b=vjn+INA6TLNc1hYZstwhCCbvwc9dzBl19sG8BwQXRBGm4pHEPCmrmcgKdIrNPyEQT3 yydWP6glLqM3c3NFI1ALPHskxDTO9C5SHBcVhQV0ftm8ZhjwbYafQ5o3roLfUAS5kt4e UOE+BUepF8sKe68ejzeWOMk2ZxiTSQRTUuZojtiaH/geyVgE8cqSm/VT5jhJ7DX5kkOM qCDBkavi+ceqPjcqWvG2oORvwk/ygWXxcDlZyiFffJ/TC05JkqP4RCV9OmVWEM8iNKfF VR06RWbM8QAKA3+RajBou+v+GC4E5OHWyhE9VTrbpBtaQN7M1cGTVLuNEPJpDIiycxzJ Fa8Q== X-Gm-Message-State: AFqh2kotW0gqm3q7aCKzoiHCnJ6iFu75mXbkZt/EUhrNEgnZguRb4EzM 45q3l7BHjI3thFQ4kz4P5BF+0TYHR6XfsuKN X-Received: by 2002:a7b:cd0d:0:b0:3d3:5c7d:a5f5 with SMTP id f13-20020a7bcd0d000000b003d35c7da5f5mr36658213wmj.16.1672937084211; Thu, 05 Jan 2023 08:44:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/34] i.MX7D: Connect GPT timers to IRQ Date: Thu, 5 Jan 2023 16:44:13 +0000 Message-Id: <20230105164417.3994639-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Jean-Christophe Dubois So far the GPT timers were unable to raise IRQs to the processor. Signed-off-by: Jean-Christophe Dubois Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/fsl-imx7.h | 5 +++++ hw/arm/fsl-imx7.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h index 1c5fa6fd676..50f19d8db04 100644 --- a/include/hw/arm/fsl-imx7.h +++ b/include/hw/arm/fsl-imx7.h @@ -235,6 +235,11 @@ enum FslIMX7IRQs { FSL_IMX7_USB2_IRQ = 42, FSL_IMX7_USB3_IRQ = 40, + FSL_IMX7_GPT1_IRQ = 55, + FSL_IMX7_GPT2_IRQ = 54, + FSL_IMX7_GPT3_IRQ = 53, + FSL_IMX7_GPT4_IRQ = 52, + FSL_IMX7_WDOG1_IRQ = 78, FSL_IMX7_WDOG2_IRQ = 79, FSL_IMX7_WDOG3_IRQ = 10, diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index cc6fdb9373f..146bb559bbc 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -219,9 +219,19 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) FSL_IMX7_GPT4_ADDR, }; + static const int FSL_IMX7_GPTn_IRQ[FSL_IMX7_NUM_GPTS] = { + FSL_IMX7_GPT1_IRQ, + FSL_IMX7_GPT2_IRQ, + FSL_IMX7_GPT3_IRQ, + FSL_IMX7_GPT4_IRQ, + }; + s->gpt[i].ccm = IMX_CCM(&s->ccm); sysbus_realize(SYS_BUS_DEVICE(&s->gpt[i]), &error_abort); sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, FSL_IMX7_GPTn_ADDR[i]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0, + qdev_get_gpio_in(DEVICE(&s->a7mpcore), + FSL_IMX7_GPTn_IRQ[i])); } for (i = 0; i < FSL_IMX7_NUM_GPIOS; i++) { From patchwork Thu Jan 5 16:44:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639299 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp331224pvb; Thu, 5 Jan 2023 09:07:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXuXpHqMvsq6hjeJHNLVRc/KhcE/tjAiIBB6VoA+DX2bxl3kKboyk2grxkDQ+wn+Le8HSDaN X-Received: by 2002:ac8:4f49:0:b0:3a8:991:bfa5 with SMTP id i9-20020ac84f49000000b003a80991bfa5mr76233832qtw.44.1672938423635; Thu, 05 Jan 2023 09:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938423; cv=none; d=google.com; s=arc-20160816; b=aa2/uFJtdkiylcw4sn23tB1rClESALPeumsoMD0pCYDoF50Lt70j6TS/C1YKMbTNx4 H5d5snmH3wr42u560rjNIRkz5y8UVreOOvKZ+A+p9gJgPp18EAGE2/pZ62rKyyD/Q0Zb oTWmGpWlNv6SOmpu5qhowYIfjt2VpzpdI27n/LK2kDy/XW9clwo5kblEIaAjforSubbD 0b5ZfqC6oynpLO1eMbmHUD2l/ZFFGGv4gm2FCiUkrKNSI2Qp+vEvRtSnrnyQfxZwSrbq buz6ABZE0nYyC4etozTuCz64p96McQ5kZ6Ruje1ZQDtNA3lwM+DYKn7llwmOpYo49zrU wfyA== 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=0uX5qcSlWxkIv6XFcZG4vEVBT2aV30N7UKGbpRe6IA0=; b=D8AZrS9rhW65BPvkVtPzjtfe/s6lx8lHNoUsYc02rNy4aFdvuLeYTyzq0ixE38kdaf 10PuoeaFZN2dFlhsIDa/n140teFX7AVlN5hZsK+7yA1SRv0QESAm6M6U1g9Cvxkfe8pm m8I1LAyz65zttIAgOSkBkY+xe4T+ShXMeIUgC09aj5/2p+fz9yw5vcDWxY2ExOjIS5pi 6jOXXx+hWg3WdRSjD9ArNj9GzKPqm6d8jFhtt+tozK8npXV3+9dSlXjCmL+OI0xVjcrP 3kdysjTGW/N/97hxadFLA71wlEGvrZXp8CHoatMyFF8g8uROwYxerW0w2vJYICwFzTLi /Ohg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o+90ALjo; 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 h6-20020ac87446000000b003a7e92f779dsi19060485qtr.98.2023.01.05.09.07.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:07:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o+90ALjo; 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 1pDTMf-0001M0-Ci; Thu, 05 Jan 2023 11:45:13 -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 1pDTMJ-0000oG-Dg for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:51 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTMF-0007Pb-1r for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:51 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m3so19556073wmq.0 for ; Thu, 05 Jan 2023 08:44:45 -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=0uX5qcSlWxkIv6XFcZG4vEVBT2aV30N7UKGbpRe6IA0=; b=o+90ALjoozOnofJKn5PdDOdOKiJRyPHwHIvFdCUomRnMG8Jg/3KyxxBOqWdooRQiwp 3+0fjKYSNcVJdw4dvJnmGuHatud6KE0nlqAZb18wyvKyx7uHG504M4qjmiVIAeqWnWnH YPZlhF+RYsNHSOQi9/dcTOnhW77uzWWi7TtjdmUBSwIniCvt+8kAvpiPX40p5hmzU5e5 9Q+VLKwNM4RdyTFDxzz4k2mapbCZw93n2dA89MqRxo8gxQMlo1wNjwA69bhhmPaX/+l0 aEcEJw8b1RLcu8elRX+rXwlwBcZJ4gb4I4VmOrFtdbZFjMC4JigFn+BnMTd16VBqXtEE YvNA== 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=0uX5qcSlWxkIv6XFcZG4vEVBT2aV30N7UKGbpRe6IA0=; b=FD2A6Sfm5mIqJ43iAIzhTKEzr0r9hv32GL3nTPfhoOQO/jopjoDQ3wvK2JC7XFUgdt NsZE+GefTHxCcHu78hZA5NrguWYl7Te4cJiJcs9XWXoj3E/P9yjfSMtV8iZTA+g+SCYb wSZepFPY2fhemVkiACPqbLMcuw1q61x6OS6Ad3EaxBYg2pYbdYltx+Bk9NzZmo1XHRG5 S47B+RP686txZvTz1D/H9Z3aZ/7ikDIFn4CJhNzNq9Q5NaNmZKO0bcqxOOKe1k54g0qc rkmYz/7EgG10cvbKNW9bzCbAzNdD8DG3bwh9McMIwc/K71PdB3s5W3hNvslbk29CgIrr Am/Q== X-Gm-Message-State: AFqh2krb8FXt1CxO65SG1TqVlzYCSFjd96XJZz5nCX+2VsGMCQs+Z824 mUW/sxxLHBbdCPVYhDawuwnTDe1VQR6JdGis X-Received: by 2002:a05:600c:1f11:b0:3d0:57ea:319c with SMTP id bd17-20020a05600c1f1100b003d057ea319cmr36874405wmb.13.1672937084993; Thu, 05 Jan 2023 08:44:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/34] i.MX7D: Compute clock frequency for the fixed frequency clocks. Date: Thu, 5 Jan 2023 16:44:14 +0000 Message-Id: <20230105164417.3994639-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: Jean-Christophe Dubois CCM derived clocks will have to be added later. Signed-off-by: Jean-Christophe Dubois Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/misc/imx7_ccm.c | 49 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/hw/misc/imx7_ccm.c b/hw/misc/imx7_ccm.c index 075159e497b..f135ec7b7e4 100644 --- a/hw/misc/imx7_ccm.c +++ b/hw/misc/imx7_ccm.c @@ -16,6 +16,10 @@ #include "hw/misc/imx7_ccm.h" #include "migration/vmstate.h" +#include "trace.h" + +#define CKIH_FREQ 24000000 /* 24MHz crystal input */ + static void imx7_analog_reset(DeviceState *dev) { IMX7AnalogState *s = IMX7_ANALOG(dev); @@ -219,16 +223,43 @@ static const VMStateDescription vmstate_imx7_ccm = { static uint32_t imx7_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock) { /* - * This function is "consumed" by GPT emulation code, however on - * i.MX7 each GPT block can have their own clock root. This means - * that this functions needs somehow to know requester's identity - * and the way to pass it: be it via additional IMXClk constants - * or by adding another argument to this method needs to be - * figured out + * This function is "consumed" by GPT emulation code. Some clocks + * have fixed frequencies and we can provide requested frequency + * easily. However for CCM provided clocks (like IPG) each GPT + * timer can have its own clock root. + * This means we need additionnal information when calling this + * function to know the requester's identity. */ - qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Not implemented\n", - TYPE_IMX7_CCM, __func__); - return 0; + uint32_t freq = 0; + + switch (clock) { + case CLK_NONE: + break; + case CLK_32k: + freq = CKIL_FREQ; + break; + case CLK_HIGH: + freq = CKIH_FREQ; + break; + case CLK_IPG: + case CLK_IPG_HIGH: + /* + * For now we don't have a way to figure out the device this + * function is called for. Until then the IPG derived clocks + * are left unimplemented. + */ + qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Clock %d Not implemented\n", + TYPE_IMX7_CCM, __func__, clock); + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: unsupported clock %d\n", + TYPE_IMX7_CCM, __func__, clock); + break; + } + + trace_ccm_clock_freq(clock, freq); + + return freq; } static void imx7_ccm_class_init(ObjectClass *klass, void *data) From patchwork Thu Jan 5 16:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639309 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp336506pvb; Thu, 5 Jan 2023 09:17:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXuLxoD4diKmvUTT4ref/43g6ki3qnZaqre061KPKRY7Wm7LeHgpVQju/a9RBfSJRZcnFQmJ X-Received: by 2002:a05:622a:488a:b0:3a5:c553:fa4c with SMTP id fc10-20020a05622a488a00b003a5c553fa4cmr83093369qtb.65.1672939063355; Thu, 05 Jan 2023 09:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939063; cv=none; d=google.com; s=arc-20160816; b=aZPjJ8Un4jN8EHluytr19idvwkk26rW8T81yyVdB69xger6pB5IvjFIqERUunDQ45b +LVY0uTooU5wKUeKDDwwhZ5ZiNEFuibbVhtaDbp1oIyAkns2DVPcBkLLZYW6eoCby0VQ D3qXtyzzNv57USArAhCR4cuUy8NoXfMo33iSR8D1OFyr5XwBPzm+qBjONtyXsfEgvPGQ iIAHPgQjmjwuYAzHWJQAeTJkpYlpefHu7UHfmdFAUj06acFK/jFjYLx4zEpkP9pJIGRC B/oaQUMX6VuvhDmZiVcvbGUbxPNR86SuSJvI03wUrASjKEQdaKZoWHMpE8eNKSSvE+h0 8cEw== 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=HjXI1ybyBjJZ/wjqPnfmihak0F0npX5WBOx0bgmkSU8=; b=o6Cdti+4QZBnl8VMcQ5IVIFsfRjP1XTST4FyIGPtzdPlJa+JsiQDncTp+zjd0+xn3t +g3GBonoqcz9Fck3fTanvhwdZVGfKubYl0K1QwoATt+qTcSEe7808SV0E/T4Jl46d/xP GpPzVwb3txzAVJ7duLMD+CwqZsAM5eMW25ZuahWfsH9JKI6fdr7DC9V1NkHK5XSqvU9B gZPONtuu/9xlDzM3iNwEh4fUCMol01M3fVDoGaTgqkRk0HJ5oga2dLZEwDY7q6xuvtyW 2+c7/uUEO+jlkTjFS3H8Uwg9cjbwbP61vMyOPOY0kKoQmrFSmpV8Z1XUvyQATR9KJTU9 zKKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="leXeI1/9"; 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 r3-20020ac84243000000b003a5009386f1si19425478qtm.752.2023.01.05.09.17.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:17: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="leXeI1/9"; 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 1pDTMg-0001Nu-CR; Thu, 05 Jan 2023 11:45:14 -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 1pDTMJ-0000oH-Hm for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:51 -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 1pDTMF-0007Tj-4g for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:51 -0500 Received: by mail-wm1-x332.google.com with SMTP id k26-20020a05600c1c9a00b003d972646a7dso1727997wms.5 for ; Thu, 05 Jan 2023 08:44:46 -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=HjXI1ybyBjJZ/wjqPnfmihak0F0npX5WBOx0bgmkSU8=; b=leXeI1/9WEM1c5T5kiTNJp/db6voMAceui3q7C2GThMl7Cg/v2h+PKzRs2tYBKouGD Q7pHDFOw2ioI4+1xwdbAKiQMZPWZ/0C8jkkVMmoMZKlnBfX5sD5cHlcQ0qJGpTtsefKu C1Rwdh92sJBmmF08xc2YBnxclzSZVsoYMngMO7uxiTPmyNmF0LUWj4/AMivKNsfFZqFe VrQxWY9cBFeDmeqn5aewwyP5xCJ2GAOKEN/X3iaZNMy+6MeUQ/WfnD9oF9/Z/l7XLjG7 9apo8bYgfSmY00WmvEnpfbpHnX8FQxMIVu2XzmErgnCkpQOtmbVITse6vexl8Ssqyzl4 79+Q== 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=HjXI1ybyBjJZ/wjqPnfmihak0F0npX5WBOx0bgmkSU8=; b=u/PV7hnx2sOn6mS85SB4jaRS0T5BMPT8ankg+5GZV6biQK49uLZffEWBzooR/lZJLT /Coqa4Q2LOI4xcFKp7qVRF1vIDPtGDrKVvJ9NXAuPSOIVtI5j0GXt2ze5lMxhmsIUrCI 8e+0vubM87Jkn0rkyDaJ1xZ7rK7k6Kk64hliQ5WbyCIf6XSDRrIauLtRimlN6oblpyPD azqC4Yei7JPCeRLLQM+HaiiDrFVle9lhomCZTG6q6Kxz/M3BLt/Ljg3vu7J2B4iol1VQ fpVUipjDICatXz9eO/Q8EffBhk/QUs6ndFZqlH3/U5u49dSs103r/jL4FOe/cIDpODgB oSBA== X-Gm-Message-State: AFqh2kotapWTNa+xx8U/12iV5qzj6QXs0Bxi6Vn/ViMhv+F6m66LN2bQ T+BswKS+2k7HgiFgs6gcdzZd8fxG4Ta8WeVz X-Received: by 2002:a05:600c:3482:b0:3d3:4f56:62e1 with SMTP id a2-20020a05600c348200b003d34f5662e1mr35638336wmq.27.1672937085846; Thu, 05 Jan 2023 08:44:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/34] i.MX6UL: Add a specific GPT timer instance for the i.MX6UL Date: Thu, 5 Jan 2023 16:44:15 +0000 Message-Id: <20230105164417.3994639-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Jean-Christophe Dubois The i.MX6UL doesn't support CLK_HIGH ou CLK_HIGH_DIV clock source. Signed-off-by: Jean-Christophe Dubois Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/timer/imx_gpt.h | 1 + hw/arm/fsl-imx6ul.c | 2 +- hw/misc/imx6ul_ccm.c | 6 ------ hw/timer/imx_gpt.c | 25 +++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/hw/timer/imx_gpt.h b/include/hw/timer/imx_gpt.h index ff5c8a351a0..5a1230da35e 100644 --- a/include/hw/timer/imx_gpt.h +++ b/include/hw/timer/imx_gpt.h @@ -78,6 +78,7 @@ #define TYPE_IMX25_GPT "imx25.gpt" #define TYPE_IMX31_GPT "imx31.gpt" #define TYPE_IMX6_GPT "imx6.gpt" +#define TYPE_IMX6UL_GPT "imx6ul.gpt" #define TYPE_IMX7_GPT "imx7.gpt" #define TYPE_IMX_GPT TYPE_IMX25_GPT diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index f1897123294..d88d6cc1c5f 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -81,7 +81,7 @@ static void fsl_imx6ul_init(Object *obj) */ for (i = 0; i < FSL_IMX6UL_NUM_GPTS; i++) { snprintf(name, NAME_SIZE, "gpt%d", i); - object_initialize_child(obj, name, &s->gpt[i], TYPE_IMX7_GPT); + object_initialize_child(obj, name, &s->gpt[i], TYPE_IMX6UL_GPT); } /* diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c index a65d0314556..e01bb68ac72 100644 --- a/hw/misc/imx6ul_ccm.c +++ b/hw/misc/imx6ul_ccm.c @@ -522,12 +522,6 @@ static uint32_t imx6ul_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock) case CLK_32k: freq = CKIL_FREQ; break; - case CLK_HIGH: - freq = CKIH_FREQ; - break; - case CLK_HIGH_DIV: - freq = CKIH_FREQ / 8; - break; default: qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: unsupported clock %d\n", TYPE_IMX6UL_CCM, __func__, clock); diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c index 80b83026399..7222b1b3874 100644 --- a/hw/timer/imx_gpt.c +++ b/hw/timer/imx_gpt.c @@ -115,6 +115,17 @@ static const IMXClk imx6_gpt_clocks[] = { CLK_HIGH, /* 111 reference clock */ }; +static const IMXClk imx6ul_gpt_clocks[] = { + CLK_NONE, /* 000 No clock source */ + CLK_IPG, /* 001 ipg_clk, 532MHz*/ + CLK_IPG_HIGH, /* 010 ipg_clk_highfreq */ + CLK_EXT, /* 011 External clock */ + CLK_32k, /* 100 ipg_clk_32k */ + CLK_NONE, /* 101 not defined */ + CLK_NONE, /* 110 not defined */ + CLK_NONE, /* 111 not defined */ +}; + static const IMXClk imx7_gpt_clocks[] = { CLK_NONE, /* 000 No clock source */ CLK_IPG, /* 001 ipg_clk, 532MHz*/ @@ -539,6 +550,13 @@ static void imx6_gpt_init(Object *obj) s->clocks = imx6_gpt_clocks; } +static void imx6ul_gpt_init(Object *obj) +{ + IMXGPTState *s = IMX_GPT(obj); + + s->clocks = imx6ul_gpt_clocks; +} + static void imx7_gpt_init(Object *obj) { IMXGPTState *s = IMX_GPT(obj); @@ -566,6 +584,12 @@ static const TypeInfo imx6_gpt_info = { .instance_init = imx6_gpt_init, }; +static const TypeInfo imx6ul_gpt_info = { + .name = TYPE_IMX6UL_GPT, + .parent = TYPE_IMX25_GPT, + .instance_init = imx6ul_gpt_init, +}; + static const TypeInfo imx7_gpt_info = { .name = TYPE_IMX7_GPT, .parent = TYPE_IMX25_GPT, @@ -577,6 +601,7 @@ static void imx_gpt_register_types(void) type_register_static(&imx25_gpt_info); type_register_static(&imx31_gpt_info); type_register_static(&imx6_gpt_info); + type_register_static(&imx6ul_gpt_info); type_register_static(&imx7_gpt_info); } From patchwork Thu Jan 5 16:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639298 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp330934pvb; Thu, 5 Jan 2023 09:06:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNhtkHYvJk4RQzZil3tH56M8/PfjTJoXdHP5H46DbPfMEhPgbPGeVQa9uGkrCo5Md/N7y4 X-Received: by 2002:ac8:7616:0:b0:3ab:5f5f:a0d7 with SMTP id t22-20020ac87616000000b003ab5f5fa0d7mr81257598qtq.2.1672938395985; Thu, 05 Jan 2023 09:06:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938395; cv=none; d=google.com; s=arc-20160816; b=Mwbe4rY4shBUl4X6FJGymgTADEGzq01afauTCVFc9aKPb9I+/0x6Nvu598ZeFb57Ns e4jC8VUEKQ+E2cTrABIm8qoIgyRzevRR0bKOP6I8Vk6dLO6lpRYWuCKzQOrpxxt08Xbc 0h0MKQZ9ZcLjmKMvcO5qm3m4T2L663n5Nv8q9/A2KzYbW48W3wGxut2ta6vrmMLh7WEz 7sCONosFv+6TUXo70PcMBw9EcGLM/uVf45VRgCsoQSExHbvSeX7LFuwRTwCTBfioIUyK B8Z7Lfw9KISFFEswis/tsP5vq0v1LeHoIsx/Ddn+4MsHOykS9Pfp9bQ+OCdutxz7CROx ybwA== 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=U/noDqf89C9CE4dX2bLJg9toJeQoQFfDbIKZFjOUmRk=; b=VHxTTIkZAEMmolOkvtbUjRMKqdovztQJqKYUMteWSzhilMy3E126lEF1fu7/WR+aSB IhZEydMfyx96QAc13aQe31vTtXFl02Kd/LJWBKK9QzuX1dXjrlrvTUe4nbo0oE7Htb+g gkCrjZveweePLAxYN13lQXolMcwmWyDUpjBuDCS0DnH0fprGBFI8y03MOJ5gKFXreEsH /HjS3pSZ6ShoC+2iQQZQ4xc7zgZDj4Du8gNntRB5BMnyNTYtWt+x/eszH8O23E6xbFTM tVVwBJ5haZ3exoTvnkTrK0MTURPE55AhbB1FgP3Um7U+7iODJ5i+YUnxPghVCZexHiId YtLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQspyqTg; 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 fv10-20020a05622a4a0a00b003a637bdace3si20109824qtb.727.2023.01.05.09.06.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:06:35 -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=cQspyqTg; 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 1pDTMb-0001Cs-1m; Thu, 05 Jan 2023 11:45:09 -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 1pDTMJ-0000ql-Us for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:52 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTMH-0007Tr-O4 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:51 -0500 Received: by mail-wm1-x330.google.com with SMTP id b24-20020a05600c4a9800b003d21efdd61dso1781172wmp.3 for ; Thu, 05 Jan 2023 08:44:47 -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=U/noDqf89C9CE4dX2bLJg9toJeQoQFfDbIKZFjOUmRk=; b=cQspyqTg9+5Gy5xoOBRy4F4PPYqREgACYNyCW6DV8vDkYc8y9m6FiAFqaVN4JdMZs4 TE9SybAWg3T5x/i8/8p78YY1zZoEVeqsmfYLL7WqDhxR+23hUfPQQ4Bc2bFTcITOWpx9 pBBkELAx2Je9LxAcmuXej86BaTXY/gHY6EA0DjoPDCxLg3hbDmLuLwX4uMsgTNuvN4oO ZDYHedyvC4FCSGHKJfEOg759qQ7umAvITCwtyriq5/TqRhGFN5XRlfYJxFpDp/BncLUo 7hMgDqAB9e91QcKPFgKWRbwgY3gmuvWLg/xrUdQONTP2TmqKY83oJ7qjfx9xu04MHMpG ucFQ== 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=U/noDqf89C9CE4dX2bLJg9toJeQoQFfDbIKZFjOUmRk=; b=bWinC4S03egB7dvSL5J65pzDdcRuRdLjvXdFLesTDSeBDrw2DGoAkWnpaQgBd1da09 5Bbfz3zV5vvE0clhtoem6Dxx3bYA3O7g+nx/id/IK8n4FttFdREWG1t3l/G6JusDiDJB gAlXAYpkEUX2XPfrQRkbHrOgKYeLK2OHOIM+woncMiM7OV20VS4Cup35SIBCPGfWHIfU HukR4mg+byH1SqZvg6hV6SHZA7c1yWADhL1Qx9Heyc82GTd+C+e2K/Yuj/2uflthPCWe 4LwRO2wlhdYd9R7pfB5ivenXWtS6J/vJFI2ualt/fGIRXTadEFVbIWg4v2dF/1U6viM2 wZxA== X-Gm-Message-State: AFqh2kqKse+XCMvtol0IPsIfmfdD9PhzMOAL6p94mI7nP0g3gSX6lBDL xYA1Wi9TwXgGO6TZWi67wWylM8x9p5wG+zLk X-Received: by 2002:a05:600c:2247:b0:3d3:4b1a:6ff9 with SMTP id a7-20020a05600c224700b003d34b1a6ff9mr37348699wmm.26.1672937086730; Thu, 05 Jan 2023 08:44:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/34] i.MX7D: Connect IRQs to GPIO devices. Date: Thu, 5 Jan 2023 16:44:16 +0000 Message-Id: <20230105164417.3994639-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: Jean-Christophe Dubois IRQs were not associated to the various GPIO devices inside i.MX7D. This patch brings the i.MX7D on par with i.MX6. Signed-off-by: Jean-Christophe Dubois Message-id: 20221226101418.415170-1-jcd@tribudubois.net Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/fsl-imx7.h | 15 +++++++++++++++ hw/arm/fsl-imx7.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h index 50f19d8db04..4e5e0718648 100644 --- a/include/hw/arm/fsl-imx7.h +++ b/include/hw/arm/fsl-imx7.h @@ -240,6 +240,21 @@ enum FslIMX7IRQs { FSL_IMX7_GPT3_IRQ = 53, FSL_IMX7_GPT4_IRQ = 52, + FSL_IMX7_GPIO1_LOW_IRQ = 64, + FSL_IMX7_GPIO1_HIGH_IRQ = 65, + FSL_IMX7_GPIO2_LOW_IRQ = 66, + FSL_IMX7_GPIO2_HIGH_IRQ = 67, + FSL_IMX7_GPIO3_LOW_IRQ = 68, + FSL_IMX7_GPIO3_HIGH_IRQ = 69, + FSL_IMX7_GPIO4_LOW_IRQ = 70, + FSL_IMX7_GPIO4_HIGH_IRQ = 71, + FSL_IMX7_GPIO5_LOW_IRQ = 72, + FSL_IMX7_GPIO5_HIGH_IRQ = 73, + FSL_IMX7_GPIO6_LOW_IRQ = 74, + FSL_IMX7_GPIO6_HIGH_IRQ = 75, + FSL_IMX7_GPIO7_LOW_IRQ = 76, + FSL_IMX7_GPIO7_HIGH_IRQ = 77, + FSL_IMX7_WDOG1_IRQ = 78, FSL_IMX7_WDOG2_IRQ = 79, FSL_IMX7_WDOG3_IRQ = 10, diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index 146bb559bbc..afc74807990 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -245,8 +245,37 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) FSL_IMX7_GPIO7_ADDR, }; + static const int FSL_IMX7_GPIOn_LOW_IRQ[FSL_IMX7_NUM_GPIOS] = { + FSL_IMX7_GPIO1_LOW_IRQ, + FSL_IMX7_GPIO2_LOW_IRQ, + FSL_IMX7_GPIO3_LOW_IRQ, + FSL_IMX7_GPIO4_LOW_IRQ, + FSL_IMX7_GPIO5_LOW_IRQ, + FSL_IMX7_GPIO6_LOW_IRQ, + FSL_IMX7_GPIO7_LOW_IRQ, + }; + + static const int FSL_IMX7_GPIOn_HIGH_IRQ[FSL_IMX7_NUM_GPIOS] = { + FSL_IMX7_GPIO1_HIGH_IRQ, + FSL_IMX7_GPIO2_HIGH_IRQ, + FSL_IMX7_GPIO3_HIGH_IRQ, + FSL_IMX7_GPIO4_HIGH_IRQ, + FSL_IMX7_GPIO5_HIGH_IRQ, + FSL_IMX7_GPIO6_HIGH_IRQ, + FSL_IMX7_GPIO7_HIGH_IRQ, + }; + sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), &error_abort); - sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, FSL_IMX7_GPIOn_ADDR[i]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, + FSL_IMX7_GPIOn_ADDR[i]); + + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, + qdev_get_gpio_in(DEVICE(&s->a7mpcore), + FSL_IMX7_GPIOn_LOW_IRQ[i])); + + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1, + qdev_get_gpio_in(DEVICE(&s->a7mpcore), + FSL_IMX7_GPIOn_HIGH_IRQ[i])); } /* From patchwork Thu Jan 5 16:44:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639282 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324915pvb; Thu, 5 Jan 2023 08:55:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQ3LJnHt+cEX9c9ZUY5Ni5p/tJMVO2jeKiBuLkbmLU7fphy30ba59f1B3NHZf9YiOsS0Ta X-Received: by 2002:a05:6102:94b:b0:3bf:2045:e526 with SMTP id a11-20020a056102094b00b003bf2045e526mr24616185vsi.1.1672937731012; Thu, 05 Jan 2023 08:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937730; cv=none; d=google.com; s=arc-20160816; b=Ilx5khTfmjbInmfG14+tT1pi+5AgO7hF/Za1tDfDdwHvBIZn/iFP6PKA6XmNhNQgNs dWvPEyGuBD++U6RfIT8p8vrT1lPOMyJP7Ji7FhkDaz39xmsDm2cvHb8TGT+W8iy4t5lA TXeWD5mfR5PPDt/L6pzLApkxggjW9v14msSoI5QyvDax1oQ9hO78BO1tpM62QqYEzg1L 2NS0zUzj8ckh0qBDJg5SEvigSH5lQmKgDUboBFV2y6S30HEUCmToXdRd60I7fSQ49EfD +Zi2wtzjq6QNUSBudzyalbHEFiAWNezotRn2MyodcT4rUHmgQura3fPvntkLE7pOxbIF ATfQ== 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=33dG/KwajZrq9i+KPj0Q5eXpSM4wjc/WwsMuu9dKq4E=; b=P7WZmIWOIGslO7dqVm2cxPRPvCUjaauWAlPU9fm7sFEHKxjWkCDsUnhx6bJhivQERS CpwG0JPxXjk3bMYUz14aWVNBx/RlklfqF2gcxFYieqm5L4LCQWTyvi78CIsYPu1sY/ch hdHuWoT/ygCzR7nPF4eWljC+7EvuSXAtOyUHFA+e/oInkSSu8PQQDhs0E51RX4H7cjb/ fGrGib46wviywxqFOW+IQqgs+xvWhbUmMQMPtdcmAj0AzDPEZjT6b70cwgaVbvi1c1JY 2AXP/yD35m8V0d0SK86WjYtbIDHFRMVQ0PqRRcMPTirm9plZAkh/gF6DI3J00Zmpw4zN 47xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VKNL61Cw; 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 w24-20020a05620a095800b006fbdb69389asi18387397qkw.121.2023.01.05.08.55.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:55:30 -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=VKNL61Cw; 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 1pDTMh-0001Rs-Vu; Thu, 05 Jan 2023 11:45:16 -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 1pDTMJ-0000pA-Ol for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:52 -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 1pDTMH-0007Mj-OG for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:51 -0500 Received: by mail-wm1-x335.google.com with SMTP id g10so14661594wmo.1 for ; Thu, 05 Jan 2023 08:44:47 -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=33dG/KwajZrq9i+KPj0Q5eXpSM4wjc/WwsMuu9dKq4E=; b=VKNL61CwUWs3h9VqU/Dbd+x5sXmEWRnn7PJwWPHV4Z+Osgkau1oJBvTE5g7g0ZHIuO oXMCrmRImNZfmBh4Z5+ESDUKldnMmRg7MRgzUavAYoGovksBQlnuhE0jcBcmtO/kDrzP xdGw2+Jyd/xrt9yW3noSI4j+yvIJVL3Co4DvaoKVOxcgvVvXHT7togHQymyYVZE3LyPC 5crSx+1Vj7xvZLHH92Mrycg6liUPRS7BcEK9Q7Ezow0BsXSxi0/OPK0jX/QQEDhmzZcf 6QCtAQmAA8qbC74O6mXWn/2P9OsFSh6XuBZZL8Kc2/Po+wwvgHZTk7P/v2iRns5THcaY NSWw== 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=33dG/KwajZrq9i+KPj0Q5eXpSM4wjc/WwsMuu9dKq4E=; b=f0JWadfNPN+1rET+9HXMOxV60ZGFFDzF7oRzfyKghNfPFUrOplLf0D0+T1h2uT4EEF mrpWe+6pzZRjrn5MCV/jLdd3DWAbsm4nWDR/xtoQvkZWzUpU/Ih1BidXm31quZTMhMqP OuWrFO0obJ0B9/YDegyC479xBO8EgBx/vi2uynaLNg5Q21uOXPeBUuuxH2P8Pt5DpYOx lWf/+5NFfsgugrZ1tK9V1KdSn53wfsuJ0y27DLBwroFIQPkOgWNXDVXCtECBHJ9dVumq yCs/neqWkwcWx+HvKjqMRAiq89DN+0oPf29NHJb6bFXTlAHptJRTpXxw+wOrUaR74dUy YztA== X-Gm-Message-State: AFqh2kqxz2zqIMtJRzcCkCpAd7jenQ+TKMS1w11flve0B4hjLE/9AU2H C3gRO5EWtOr52eATnofeWxgRDFnbO9P4M01T X-Received: by 2002:a05:600c:3d0e:b0:3d3:4aa6:4fd0 with SMTP id bh14-20020a05600c3d0e00b003d34aa64fd0mr36932398wmb.6.1672937087484; Thu, 05 Jan 2023 08:44:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/34] hw/net: Fix read of uninitialized memory in imx_fec. Date: Thu, 5 Jan 2023 16:44:17 +0000 Message-Id: <20230105164417.3994639-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-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: Stephen Longfield Size is used at lines 1088/1188 for the loop, which reads the last 4 bytes from the crc_ptr so it does need to get increased, however it shouldn't be increased before the buffer is passed to CRC computation, or the crc32 function will access uninitialized memory. This was pointed out to me by clg@kaod.org during the code review of a similar patch to hw/net/ftgmac100.c Change-Id: Ib0464303b191af1e28abeb2f5105eb25aadb5e9b Signed-off-by: Stephen Longfield Reviewed-by: Patrick Venture Message-id: 20221221183202.3788132-1-slongfield@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/net/imx_fec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index 8c11b237de7..c862d965930 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -1068,9 +1068,9 @@ static ssize_t imx_fec_receive(NetClientState *nc, const uint8_t *buf, return 0; } - /* 4 bytes for the CRC. */ - size += 4; crc = cpu_to_be32(crc32(~0, buf, size)); + /* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */ + size += 4; crc_ptr = (uint8_t *) &crc; /* Huge frames are truncated. */ @@ -1164,9 +1164,9 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, return 0; } - /* 4 bytes for the CRC. */ - size += 4; crc = cpu_to_be32(crc32(~0, buf, size)); + /* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */ + size += 4; crc_ptr = (uint8_t *) &crc; if (shift16) {