From patchwork Thu Aug 11 17:16:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 596659 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp923109maz; Thu, 11 Aug 2022 10:18:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR6NCykFmNsxHPrTn8x1eO2doZwW5Ck8nebFDajlmVXQ3IBDQDs9X+vXT9qk0+JFQi9Tfm/0 X-Received: by 2002:a0c:8e06:0:b0:47b:39cf:ab8e with SMTP id v6-20020a0c8e06000000b0047b39cfab8emr40461qvb.110.1660238333103; Thu, 11 Aug 2022 10:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660238333; cv=none; d=google.com; s=arc-20160816; b=uL0oXlSsLgFWaPxzzMXx1q3/f+pOO8KQAhmYUZv44K0r+4jmd+RWLgFQSlq4hrqXuL jF0jcGd+Y0Q+HkmzprjiJQ90GISjAbpL8rCTPzYoj0TcUG5mcGiH4k3g9UTRWqwnEuQW eIE3uWnCGxD0qytvZyj8OJkVbV1WzyBg2KdNhJPygbfXmhOdL5m6FzWN7mKRrP9LKCUa b/6FpVqCDnYHsRQCwW9z0aBEQA76L17lO6DmIf7sXLsrV8ZE+f8+LClUXRvxFA27v8ie 1Tcj2oaJEu1cq7YbRAp7K476e/VMz5QLEXmDmqDqE2UZn0VPrb+IOf3MDFPDatMSA4lA buLQ== 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=bBQi63nUBjyD4P8li6gSvAkrvfkoQz4taZFgjQpefug=; b=QspCO7DzY1m1o8Qhj0/wzFgRDBCL4Quco6OUEfcLUpKUDLHlSkgpetbYMYm8NJzDQx 1nVsJ8y+TwKKYwdMSlp/Tv1G4jCva0DWEcOrdOJddh9CkX1pTQiP4NmcdVuMdu+RiJVw Dfl/xNGZEnMl6+2vetfLeV1hsXESfprovBmoCg6NVaaFiXAc+qhyKDU60Ltgen0L/Eg7 qm3V7uTPcoPRFoWvOhcgONzHaFvGnWClQLwl7TfYC9j9z5fPCLjrT4yMyk6ICUKgRpBt 9z57h8oUO8bet8SBlLhl9gPgn0EYwBmw1nEM5qmM2H9s3KG3zwJCJXBl1Fz5uqojhgZj E25A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PbYn+Imq; 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 g123-20020a37b681000000b006b5f70826dfsi1581519qkf.760.2022.08.11.10.18.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Aug 2022 10:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PbYn+Imq; 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]:40094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMBpc-0007aC-Ku for patch@linaro.org; Thu, 11 Aug 2022 13:18:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMBnF-0006jY-Q9 for qemu-devel@nongnu.org; Thu, 11 Aug 2022 13:16:25 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:44587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMBnE-0000sO-2v for qemu-devel@nongnu.org; Thu, 11 Aug 2022 13:16:25 -0400 Received: by mail-wm1-x32c.google.com with SMTP id b21-20020a05600c4e1500b003a32bc8612fso2978485wmq.3 for ; Thu, 11 Aug 2022 10:16:23 -0700 (PDT) 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; bh=bBQi63nUBjyD4P8li6gSvAkrvfkoQz4taZFgjQpefug=; b=PbYn+ImqxRrZalnxqoq/L7G3eeVOoA1PJW/yAjviXUWAX+SeJOcxBlEcleqJiCZMpN FrLIdXdmMJzuy4ZYThI8Cf2Bv/VTFdyeDK0Uak54EHTMy/FH9qzaAUZc0Sn4f4aYtIio KXyZAa4mgg+atjvuZShVXpjgTnyyQ4sSINOT53lo5uEc4HHfrfaA80potRaKMlqq5QSS j1KbJajodGlcLI4pIFPOQsRucVtFaagMSu48mmoA3e4EO+DBvsy27PH3PVWK13MbK8eQ 0vAa9g+l0huGd8R6ZD7RqYlo3AsoX9jdqnBnMg7gJNEUo4JSSFJ/tinXBkPiq+2Equhd 5RsQ== 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; bh=bBQi63nUBjyD4P8li6gSvAkrvfkoQz4taZFgjQpefug=; b=o1Kl2Ec/ff31LO01xidyPl6qcu2FXEfiAybljHyviMqSTfBxadFAGjs8BnqeelEIAu M18X63vM1oXNpXytVdrd8O3XiqGxa7WVRuCPOtZZ3M+BpcrmGZKWlXeh8Grsfw90uDDM f4SKXJa+J4PFwGxQ9d1rUlj0Tfr30CekEFXN8ww39fQGZY+e93Fcw9vQwekvGCImWJ5p lm7G01TRHM/rwrp+7QeVEdroFzm2kcJuy3ncHjUng2rt8BhcdwnmLoeho1e2GvcSUGTl 6WzKXMpIL3n+hU/PHXxy0mDUFGkBRZ76MZkZqyeaxzBp6gPc5PNO42ak+JMpCpTpFtUp BC2Q== X-Gm-Message-State: ACgBeo1nv4v8VdbrqPTQ6RKrwNWi+6Zq7viro9lG+kjoGmEIX9fQdG/e vFV2GY3Wu1aYDjiyiO3qqJPF6w== X-Received: by 2002:a1c:6a0a:0:b0:3a5:bcad:f2cc with SMTP id f10-20020a1c6a0a000000b003a5bcadf2ccmr2907305wmc.74.1660238181983; Thu, 11 Aug 2022 10:16:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id b1-20020a05600c4e0100b003a2f6367049sm6633918wmq.48.2022.08.11.10.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 10:16:21 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 01/10] target/arm: Don't corrupt high half of PMOVSR when cycle counter overflows Date: Thu, 11 Aug 2022 18:16:10 +0100 Message-Id: <20220811171619.1154755-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220811171619.1154755-1-peter.maydell@linaro.org> References: <20220811171619.1154755-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, T_SCC_BODY_TEXT_LINE=-0.01 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" When the cycle counter overflows, we are intended to set bit 31 in PMOVSR to indicate this. However a missing ULL suffix means that we end up setting all of bits 63-31. Fix the bug. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index d7bc467a2a5..87c89748954 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1186,7 +1186,7 @@ static void pmccntr_op_start(CPUARMState *env) uint64_t overflow_mask = env->cp15.c9_pmcr & PMCRLC ? \ 1ull << 63 : 1ull << 31; if (env->cp15.c15_ccnt & ~new_pmccntr & overflow_mask) { - env->cp15.c9_pmovsr |= (1 << 31); + env->cp15.c9_pmovsr |= (1ULL << 31); pmu_update_irq(env); }