From nobody Tue Feb 10 20:48:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763781387032698.623839342584; Fri, 21 Nov 2025 19:16:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMdNU-0000AA-NU; Fri, 21 Nov 2025 21:29: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 1vMdNQ-00008y-Px; Fri, 21 Nov 2025 21:29:28 -0500 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMdMU-000732-6b; Fri, 21 Nov 2025 21:29:25 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A32D316C6F9; Fri, 21 Nov 2025 16:51:56 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id 078FD321996; Fri, 21 Nov 2025 16:52:05 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Ilya Leoshkevich , Thomas Huth , Michael Tokarev Subject: [Stable-10.1.3 33/76] target/s390x: Fix missing clock-comparator interrupts after reset Date: Fri, 21 Nov 2025 16:51:11 +0300 Message-ID: <20251121135201.1114964-33-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1763781389050018900 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich After reset, CKC value is set to 0, so if clock-comparator interrupts are enabled, one should occur very shortly thereafter. Currently the code that loads the respective control register does not set tod_timer, so this does not happen. Fix by adding a tcg_s390_tod_updated() call to LCTL and LCTLG. Cc: qemu-stable@nongnu.org Suggested-by: Thomas Huth Reviewed-by: Thomas Huth Signed-off-by: Ilya Leoshkevich Message-ID: <20251016175954.41153-3-iii@linux.ibm.com> Signed-off-by: Thomas Huth (cherry picked from commit dacfec5157fb9e2249cf393a143bd545e80a6e31) Signed-off-by: Michael Tokarev diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index f1acb1618f..24675fc818 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -1959,6 +1959,10 @@ void HELPER(lctlg)(CPUS390XState *env, uint32_t r1, = uint64_t a2, uint32_t r3) if (env->cregs[i] !=3D val && i >=3D 9 && i <=3D 11) { PERchanged =3D true; } + if (i =3D=3D 0 && !(env->cregs[i] & CR0_CKC_SC) && (val & CR0_CKC_= SC)) { + BQL_LOCK_GUARD(); + tcg_s390_tod_updated(env_cpu(env), RUN_ON_CPU_NULL); + } env->cregs[i] =3D val; HELPER_LOG("load ctl %d from 0x%" PRIx64 " =3D=3D 0x%" PRIx64 "\n", i, src, val); @@ -1989,10 +1993,15 @@ void HELPER(lctl)(CPUS390XState *env, uint32_t r1, = uint64_t a2, uint32_t r3) =20 for (i =3D r1;; i =3D (i + 1) % 16) { uint32_t val =3D cpu_ldl_data_ra(env, src, ra); + uint64_t val64 =3D deposit64(env->cregs[i], 0, 32, val); if ((uint32_t)env->cregs[i] !=3D val && i >=3D 9 && i <=3D 11) { PERchanged =3D true; } - env->cregs[i] =3D deposit64(env->cregs[i], 0, 32, val); + if (i =3D=3D 0 && !(env->cregs[i] & CR0_CKC_SC) && (val64 & CR0_CK= C_SC)) { + BQL_LOCK_GUARD(); + tcg_s390_tod_updated(env_cpu(env), RUN_ON_CPU_NULL); + } + env->cregs[i] =3D val64; HELPER_LOG("load ctl %d from 0x%" PRIx64 " =3D=3D 0x%x\n", i, src,= val); src +=3D sizeof(uint32_t); =20 --=20 2.47.3