From nobody Thu Oct 22 19:25:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1791997190; cv=none; d=zohomail.com; s=zohoarc; b=Mxy952mJlB8z67pqMo19J21todCXwFdEd/tB7/oBfdlOxctFgV8YI+/3ZA5EEbm+OegGYvlxCXyGVlD0rlTcExSU1uXw2D6rg+DCQOwsEQS1wFDkBfji9K4Xo7LQe5evyvuasVSH48brYqIAsu2qzYRd5kv/RixJU7ugLd4sHp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791997190; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hDM2hDJKEOOT27YQJ81jFT8aBqIAoi8FtdpFrMtrjZg=; b=R1JJKMOb1Sab7rzdrLxT27cKGGNCiKG0r8RnkpcH/Q93BrFsznl0v7gGFLRmUC97nMPJiSg1JKWEHSY5GQZkFW6IOfvJ5pb7kbCKB7CCFwBxcCBO1HlkpLQfesSpAyxAyljvfj8k7Q/Lb3XYW0Nq1kOv3NrTcnoZLmcIR/uf+iA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179199719010935.70149250832753; Wed, 14 Oct 2026 09:59:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xH2Jj-0000zr-LZ; Wed, 14 Oct 2026 12:59:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Ja-0000yi-6T for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:54 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2JS-0001Yz-CH for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:50 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69EEbHo7301254 for ; Wed, 14 Oct 2026 16:58:43 GMT Received: from mail-dl1-f69.google.com (mail-dl1-f69.google.com [74.125.82.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ha4622nba-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 14 Oct 2026 16:58:43 +0000 (GMT) Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-1383723dfddso2197957c88.0 for ; Wed, 14 Oct 2026 09:58:43 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-17dc865cbffsm11137939c88.6.2026.10.14.09.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 09:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= hDM2hDJKEOOT27YQJ81jFT8aBqIAoi8FtdpFrMtrjZg=; b=ZAu4egt62NRdJHTN +WlduIuf8ihm/TItBic1IENTb+ri8ou1KFTW+Xc1QjoXy/JZsw3F2WQKJZ7s3BnX yiSq1jN14tkp+LlProeXjm9CmYMopgcdkNOCqqsfBOLHpj1i5MRbrZZaV8RBSuz3 qJ4SEbtkU7Zg00yEragBDwjQFSIFyrwnapHtkZOOesUb0HryWorCaypTwhnsVVpQ q5FLkLQW27sA5ARfmsYnvytXa8SyZ7oioxAWo7v9O4mpr2HJn1PLdUOZ0XuZoyVv HlxlUgYisWTVcwQ9txkS2689rtts0agxgaVJXejOcff34SJ8NbnmGvlixUX5uYhG 87XDvw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791997122; x=1792601922; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hDM2hDJKEOOT27YQJ81jFT8aBqIAoi8FtdpFrMtrjZg=; b=SEJVmwQw18Yl1zoajDOYM2Vy7zPJDeQv0rKw/lRlXCNPo+NTNVaRGExrKuzBKoASBa 35gpC6OaICtAUBWAFdcJrVQE7ZJqrgp9KhSsqKf/3IpYMQ1PuLMpRfXgkqTb2rAsnw5/ NAvyvZD/H58mV4NeuT7Q3Ob0pS3g6o+m1iPU6I3b8E+m9mprYEZOmeDPPJdRyPcWtwcV 6zBtt3dPiI8DfukNTqeRZMt0O7UMgxGwzR+trkGKSdt1ubTH+xlKmXpMgCyMJt2d8JU0 G59zB/ZzeZuG0iBszbcqMKlTJKA7U+WUSvZlLxRYzHNY7R1ghE7XuyAui2dRv/5+SNnP Lg4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791997122; x=1792601922; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hDM2hDJKEOOT27YQJ81jFT8aBqIAoi8FtdpFrMtrjZg=; b=KbebFJ0GsJO6hzU1UA5Y2lNaWFdgk4vA1+mHl5vUee0KGUIZHeZGsdNgPY996FpjkW ky8SQbz7bRjHQ5MIlQlsc/3huInyPoiDmEf90EnjSjihuWk2lxJS81vVMSFYsUdZY7/G iXxxeKobS/kfAQdGJmZ5+yrUnbs58S4ieoduEsASterHQ0NJhvckPPAxQCmaNk/BpnuB Viml3xzYAOXiYV+i/ZoohLAquiqW6513Ko2HxH99Kcjet0W36RuXgSFu68wlEcThHcxL u8AxoQWLMMxliWxDxoWLEznNzkezyKCAQeS3apoHREtDv2KQYLBNBvE2Wt2ht7G34qa8 r8Lg== X-Gm-Message-State: AFq9FYJE793yNbiB0mDaJbQmpo3tiDN2UnDnD2bhG3T2X3G0+xmQJaO8 hss3Cx9EtJLALihw1lWuMs8xak3JGUjb72WMwsC8sK9uG69qh3trBTDuCaRHosl7/Et5zVd/Nr1 ZNXQEWqugyO0W5saZGnfiznQh0r4FMc7vYsZZnMENiTKDu4zMdve7s2HOPwfmvX4nZA== X-Gm-Gg: AYBFou2syw/rkpdMpJz4G6xqFuoV0mcTCt8Xq5r1P6v89I98LwwmfWJ0V7Em3uZAV9O ovXeHEr7iuKBSGJKNkNGKTUN2TIGfUR9erqauLiYXpnJ0zCklC9ke+mUlqaDs6LyyO0YAZsO5jL 8LHcptHf9BdbV6y4MmY9HxQ/Tpk9ZNwFc0JbdTg/ndjiAin34iMeml2ECp7tVzZ1AfHLw885lq7 xe5oGYQu6lNLElVZZWHlfg7W9a1MBGsY/KNi/8GqtyuGx82VuSYJ9bcEQ8BgXZiZUZx/lrSb5ua AXE8uPvAdmR1xu1HcNore8z2i7tY782pX/m/L2jgmMGqibyW4kB2Pcg8F7NYz9nwidBF9zF57nt WcrgUC1PHgQ8FGW/B6yAwdR7iiUM5muhNeNVRNZyFXdrYY/Q= X-Received: by 2002:a05:7022:4399:b0:175:525c:90b4 with SMTP id a92af1059eb24-175525c91b3mr18811669c88.20.1791997122006; Wed, 14 Oct 2026 09:58:42 -0700 (PDT) X-Received: by 2002:a05:7022:4399:b0:175:525c:90b4 with SMTP id a92af1059eb24-175525c91b3mr18811620c88.20.1791997121415; Wed, 14 Oct 2026 09:58:41 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Brian Cain , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/5] target/hexagon: check privilege mode for system instructions Date: Wed, 14 Oct 2026 09:58:33 -0700 Message-Id: <20261014165837.2916482-2-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> References: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: FyN9RNdjPqSHxr-INXPrd_f3gc5HmWj6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX5gnDy6ZtvARt E9DbqD7JP6n2NH5GNq+/Ec+QWiSia6qoGhPxPrZHXXtmjaBCXbGGeP0DyKqj6CAbQfU9HmDHg4w mxPEnK0T+XUevBPSKoCMemT01GudX91Kxk5qcBhlQ95Kq8BRD3dmSXeFBntQALL8fROb0LHtVIH qM2eIL2E4QayXY7yO4D4enfTZldfnPoT3pviArXHiGjL2R/FwXfxgjShAUN4dm+EPd6up4vuA2K wClvXVxxiXPJhkzHAfvhep4JNXiSrFvEZQRrLor+fOemwc9TLDuFn5JNHFfhjsaH1NR5yzcXdsD g4dioe3CzZrbd0b/zggZECaqoF/S+C/MkkMESkNo0LeG1atY+C62qjwXHlMUbaK5BRlU9hlY5qZ EEuxMYm55htqc1MMO2akJYNaYnmdnLZKhSe/fa7CfT1RCVLzy/9zcglEkBmWUgGLRcql7mGv8aZ 70q4iK7R3aFK4x+etyQ== X-Authority-Analysis: v=2.4 cv=ErZHPicA c=1 sm=1 tr=0 ts=6acfb4c3 cx=c_pps a=kVLUcbK0zfr7ocalXnG1qA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=BTrIe76cHL4Dmed7cV0A:9 a=QEXdDO2ut3YA:10 a=vr4QvYf-bLy2KjpDp97w:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX5VVCUZt3xfWj rAVFCAGmYXXJFdWjV8yCXspODfvEg3yqPMiDpqUWZ8LkENhdFaZ0MAZRfXaFlLID9AAk/awGSJi gIzIC2fK0jUGRZYEHtuVlq4GpY81lu0= X-Proofpoint-GUID: FyN9RNdjPqSHxr-INXPrd_f3gc5HmWj6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-13_01,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610140067 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1791997190824158500 Fixes: 9831d3cab168 ("target/hexagon: Add privilege check, use tag_ignore()= ") Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- target/hexagon/cpu.h | 1 + target/hexagon/translate.h | 1 + target/hexagon/cpu.c | 2 ++ target/hexagon/translate.c | 15 +++++++++++++++ target/hexagon/gen_tcg_funcs.py | 16 ++++++++++------ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 65fd2b29830..649e33de020 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -228,6 +228,7 @@ FIELD(TB_FLAGS, IS_TIGHT_LOOP, 0, 1) FIELD(TB_FLAGS, MMU_INDEX, 1, 3) FIELD(TB_FLAGS, PCYCLE_ENABLED, 4, 1) FIELD(TB_FLAGS, HVX_COPROC_ENABLED, 5, 1) +FIELD(TB_FLAGS, CPU_MODE, 6, 2) =20 G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, uint32_t exception, diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 2d1ed5208b7..15918f2c52c 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -45,6 +45,7 @@ typedef struct DisasContext { DECLARE_BITMAP(gpr_uncond, TOTAL_PER_THREAD_REGS); bool implicit_usr_write; #ifndef CONFIG_USER_ONLY + uint32_t cpu_mode; int greg_log[GREG_WRITES_MAX]; int greg_log_idx; DECLARE_BITMAP(gregs_written, NUM_GREGS); diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 6550e7fa800..f58e4596039 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -353,6 +353,8 @@ static TCGTBCPUState hexagon_get_tb_cpu_state(CPUState = *cs) hex_flags =3D FIELD_DP32(hex_flags, TB_FLAGS, HVX_COPROC_ENABLED, cpu->hvx_ctx[0] && GET_SSR_FIELD(SSR_XE, env->t_sreg[HEX_SREG_SSR]= )); + hex_flags =3D FIELD_DP32(hex_flags, TB_FLAGS, CPU_MODE, + get_cpu_mode(env)); #else hex_flags =3D FIELD_DP32(hex_flags, TB_FLAGS, MMU_INDEX, MMU_USER_IDX); #endif diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index cd1abdf1461..72dd1fdbbb2 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1306,6 +1306,20 @@ static void decode_and_translate_packet(CPUHexagonSt= ate *env, DisasContext *ctx) HEX_CAUSE_REG_WRITE_CONFLICT); return; } +#ifndef CONFIG_USER_ONLY + if (check_for_attrib(&ctx->pkt, A_PRIV) && + ctx->cpu_mode !=3D HEX_CPU_MODE_MONITOR) { + hex_gen_exception_end_tb(ctx, HEX_CAUSE_PRIV_USER_NO_SINSN); + ctx->base.pc_next +=3D ctx->pkt.encod_pkt_size_in_bytes; + return; + } + if (check_for_attrib(&ctx->pkt, A_GUEST) && + ctx->cpu_mode =3D=3D HEX_CPU_MODE_USER) { + hex_gen_exception_end_tb(ctx, HEX_CAUSE_PRIV_USER_NO_GINSN); + ctx->base.pc_next +=3D ctx->pkt.encod_pkt_size_in_bytes; + return; + } +#endif gen_start_packet(ctx); for (i =3D 0; i < ctx->pkt.num_insns; i++) { ctx->insn =3D &ctx->pkt.insn[i]; @@ -1340,6 +1354,7 @@ static void hexagon_tr_init_disas_context(DisasContex= tBase *dcbase, ctx->hvx_coproc_enabled =3D FIELD_EX32(hex_flags, TB_FLAGS, HVX_COPROC_ENABLED); ctx->hvx_check_emitted =3D false; + ctx->cpu_mode =3D FIELD_EX32(hex_flags, TB_FLAGS, CPU_MODE); #endif } =20 diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index b09ce7c285f..61effa38cfa 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -58,16 +58,20 @@ def gen_tcg_func(f, tag, regs, imms): =20 f.write(" Insn *insn G_GNUC_UNUSED =3D ctx->insn;\n") =20 - if "A_PRIV" in hex_common.attribdict[tag]: + if ( + "A_PRIV" in hex_common.attribdict[tag] + or "A_GUEST" in hex_common.attribdict[tag] + ): f.write(dedent("""\ #ifdef CONFIG_USER_ONLY - hex_gen_exception_end_tb(ctx, HEX_CAUSE_PRIV_USER_NO_SINSN); -#else """)) - if "A_GUEST" in hex_common.attribdict[tag]: + if "A_PRIV" in hex_common.attribdict[tag]: + f.write(" hex_gen_exception_end_tb(ctx, " + "HEX_CAUSE_PRIV_USER_NO_SINSN);\n") + else: + f.write(" hex_gen_exception_end_tb(ctx, " + "HEX_CAUSE_PRIV_USER_NO_GINSN);\n") f.write(dedent("""\ -#ifdef CONFIG_USER_ONLY - hex_gen_exception_end_tb(ctx, HEX_CAUSE_PRIV_USER_NO_GINSN); #else """)) if hex_common.need_ea(tag): --=20 2.34.1 From nobody Thu Oct 22 19:25:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1791997171; cv=none; d=zohomail.com; s=zohoarc; b=mP2qKlyLHyWz+lhRqwIyKYL7CQfsVhleDTeMIjzLBpn74ii2T3HjpLQAi0ul3PdZRZ8ue/1tVeyd3z4tLzhaSgox/zpEpEzdaB+nF2XnB+4LJhINhQMZhQ4KkCNrxDFvCAxGdwxaPxHa1FzloCM+fhWsz4BqBcwhSReKLeLRgcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791997171; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OwEId9u4WijsIxmndtgjMiGSx7S1PZeqfFdYfIdbG+E=; b=fyj7H1IFRLUb9YCj9MiTy5ahiP8A46O35WgFmLFkaK6KVHj7yQJspiyqGwye20m/txHqONCKSPAMc6aV34Wdexu8ufjoueVvGQjx+PdBy3/3Zkn2m3KEMCkZ7QPYTlJcO5ezTQtx80pNWXNX1JY6v2dofXzbRGrmcTq74tlZR9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1791997171987382.95791089418253; Wed, 14 Oct 2026 09:59:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xH2Jf-0000zi-OH; Wed, 14 Oct 2026 12:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Ja-0000yk-7h for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:54 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2JV-0001ZF-E0 for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:52 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69EEbHv1467701 for ; Wed, 14 Oct 2026 16:58:45 GMT Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h9yphkmgy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 14 Oct 2026 16:58:45 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-35c5aef2a74so5027610eec.0 for ; Wed, 14 Oct 2026 09:58:45 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-17dc865cbffsm11137939c88.6.2026.10.14.09.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 09:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= OwEId9u4WijsIxmndtgjMiGSx7S1PZeqfFdYfIdbG+E=; b=USO30MTWIWO1ZlcQ n+hIamrmeLYmmw+0s5348Hfv06YfDUOoR98uKNvdzQs1yT/Z3GR7aI2zXgzZUfaJ m+dbTZoPkQAW+yxWJ2sQJeEOTqic1+FYtMo4vl2OixhE5bAVmsBLLaPr9PnYrRQv nvoj/xs5QBtdi8ZMN2tN3tCZsJSH0pYUkEKXgneFkBA+C5fR3b8H7p7sP787CFq3 1uYvQ8EhzNm0YTDGclsv+3zwZbwQEAvikQ9NGQinaRhxiaTH39GHE8ZWh6GYAQTb o+XNdyo9mpCDKnNC6RwiDEMqeoHTImg8jUPxEf2UY4DuHICBy7Ntreo+/AwUDXNl 6nAUMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791997125; x=1792601925; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=OwEId9u4WijsIxmndtgjMiGSx7S1PZeqfFdYfIdbG+E=; b=PYj4VGQ2GJ+sRn9RYncLbxUvktX+MEFAvBYKvak/6IHbB7frqZ4MZ3hw0z0Ppsv1qe PPysOMHeS3ZrapyCN18mSf6AOg+TZufbGvj1gRgEu8Jd3BcHzKEDAz0GgKHRa0I4UjoF OQvxLq/AqHPR1so97DWJ+PTCaRVw/HghfF5NWOsY8zbs+mePaZfUB6CVuEXIa223a8Ty aXeeT94CXtBQ7TOQj0m6aDtJsklmyB7yY8RNysTRbmrQ0jaTnF4LnJ6aEs45DqPYSUYq 662r9rACzQZXiy5UV9hPFlOFc6UFc6quZVDTLqdFnxpzs6jMyh5kpyWhOlpStQ9JT4GO cBYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791997125; x=1792601925; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OwEId9u4WijsIxmndtgjMiGSx7S1PZeqfFdYfIdbG+E=; b=YQ6TmtnRKDQ2rdQkJ3SjESrQI3jpK7EAbeFGZiFsXzJfF9hMK5nXPBc5Oq/ELP1hIw WZVv6TfgQQw8RbE76jh/pPgPLlNuWCbyyJM1aFqajVzCWvtJSjxLTmtwRyKsnHacMSld Idytvk14aLJr48USH+tw07qPP7QlIUOPalv625ypWWYL9o2nhyfU7h4DyeOOl+s2+L2v hHrpiE3nJeN/EyCKPTgbAHJoRn+fJw/kY6F++fKPwFb4ODTLyjwRTCmwAxYCpU+UCzD4 NBDJvjifhYcjMyW81pmgsVH9Q22dq6OjzjjmW4cf8BJA1FN0EuwUAg4KHsIUhz1gPcGq 2l1w== X-Gm-Message-State: AFq9FYJG/QMPbaZ83zesquMYFFEPHAYvZ5pk9KJjwf0D4JrFHDbUqB/W aPqyI+962+CxWGtv+jNvTf8ciWsm/FxbuU+NCeLDGFvFvyQYaNhKkXu0gQsK/4FBPe10OonjEtJ XM7DQGpUcyBJeM3pe5EudsFDA0NQ3iE2F98s05Qxsdgh9okWodozEYWvF2NDYsyGFZA== X-Gm-Gg: AYBFou1KysWz+CvvVSSddgVxPeAeMocRj6BNpJVKgkl2YX2TbS0YQSKUPVMfrUeB1eB Jur1VLgpj5xtLCZ1PhX3HDCUIf52JPRMKUmDQkAxEM7z9NN9LHk1SnD0bIMgzpr1Q0A6RKdHYO4 5Ia/ksd9bgmAuyGGLVQktyGh9GbbbYC8BDP5JNFMK+jpSc2BiKfCLOE36wTwIQtzlXD3a7RmbiW egu8x3mbQR+OB/5jngRTza39Q/JSMZOo4bRsBVAQ8HoQjiOwLtbq67ajcvjgl+7uyBLN/dJLTK8 Qi5rkqGthF04CIqp0ItLKV4dVnL6alUlaANqCY08Qkt25wXswwpyou7MRIT0/JBIF5rbJGdts5V clRd//R6Q84JfWwzr1ydT5RlZHKGBk4+28VLp9a8RITOnYWA= X-Received: by 2002:a05:701b:42c2:10b0:143:2984:6517 with SMTP id a92af1059eb24-16a60fd3678mr26274581c88.38.1791997124399; Wed, 14 Oct 2026 09:58:44 -0700 (PDT) X-Received: by 2002:a05:701b:42c2:10b0:143:2984:6517 with SMTP id a92af1059eb24-16a60fd3678mr26274536c88.38.1791997123728; Wed, 14 Oct 2026 09:58:43 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Brian Cain , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/5] target/hexagon: wake K0 and TLB lock waiters Date: Wed, 14 Oct 2026 09:58:34 -0700 Message-Id: <20261014165837.2916482-3-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> References: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 9uypFZuhdYCBDeFq3yJkwQm0s0IopJ_7 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX6bsNdmaLVt88 KMiGQlswlpE9Gk1SxkFpcInSI7ApUC+WG/arjFp3V6BWNRg2sCKsuaarQVdoDY3Br9bLt3qhXFP saO1nL2xfk5rvkyCRFLHmHOBbtK7qQE= X-Proofpoint-ORIG-GUID: 9uypFZuhdYCBDeFq3yJkwQm0s0IopJ_7 X-Authority-Analysis: v=2.4 cv=Uv72pOwB c=1 sm=1 tr=0 ts=6acfb4c5 cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=B3wVGE7vzLrs5E8uOrsA:9 a=f_BrlBvIKBnCG3jP:21 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfXzGpVq0Xg8TR4 AWSNmOZYXAhpINJpevk2ntUX/TxEz14J1gguzXrfF6AXRtoPjcgB0TJj/yfVcMrIMTefI1M65os 7ItbmLPpSb9OPZu8cd4qD1h66aVp8Jskc+EiENw7u2msT8USI8JAixRLTfIPwZc64ABzqOJOl7N //mR0IZSp2Bfp+RnbT0tvNCk0I+lDkopt8eKE6iNH+C04j8kPnyLg5FggtOQbkrJYRXFIZWCsyC 6OqXpaUl5zvOrkt+IiEoV9RnIKD0qOPGJOgeUeSPXxcaGDZPwIEkmWz+RWO7u4lI0+QtGuZTs+u QM6hyQEHkSh5f3NmoKRsn0C8uZUclwWj2mnsA6fN9RA/F+A9gpL/sP3zJuWO2pNJEqEqXp9g7DA CwB/EunOV+HBzWdxYwRQ8gFHWl22TRs5HQzP4Tfv/Ho4JVlcO71E5TeVI9BTnPy9mMJjCvJZ2Jd GjVaYtFySBgW/JSvD/A== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-13_01,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610140067 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1791997174575158500 Wake the selected K0 or TLB lock waiter when ownership passes. Update its interrupt state and kick the vCPU. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- target/hexagon/cpu_helper.c | 2 ++ target/hexagon/hex_interrupts.c | 8 ++++++-- target/hexagon/hex_mmu.c | 3 +++ target/hexagon/op_helper.c | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/target/hexagon/cpu_helper.c b/target/hexagon/cpu_helper.c index c2fc27f1c02..4e4a81c162d 100644 --- a/target/hexagon/cpu_helper.c +++ b/target/hexagon/cpu_helper.c @@ -452,6 +452,7 @@ static uint32_t set_enable_mask(CPUHexagonState *env) thread_enabled_mask =3D GET_FIELD(MODECTL_E, modectl); thread_enabled_mask |=3D 0x1 << env->threadId; SET_SYSTEM_FIELD(env, HEX_SREG_MODECTL, MODECTL_E, thread_enabled_mask= ); + hex_interrupt_update(env); return thread_enabled_mask; } =20 @@ -472,6 +473,7 @@ static uint32_t clear_enable_mask(CPUHexagonState *env) thread_enabled_mask =3D GET_FIELD(MODECTL_E, modectl); thread_enabled_mask &=3D ~(0x1 << env->threadId); SET_SYSTEM_FIELD(env, HEX_SREG_MODECTL, MODECTL_E, thread_enabled_mask= ); + hex_interrupt_update(env); return thread_enabled_mask; } static void do_start_thread(CPUState *cs, run_on_cpu_data tbd) diff --git a/target/hexagon/hex_interrupts.c b/target/hexagon/hex_interrupt= s.c index ab66d548a1e..03e1f28da9b 100644 --- a/target/hexagon/hex_interrupts.c +++ b/target/hexagon/hex_interrupts.c @@ -240,8 +240,10 @@ static bool hex_is_qualified_for_int(CPUHexagonState *= env, int int_num) bool ssr_ie =3D get_ssr_ie(env); bool ssr_ex =3D get_ssr_ex(env); bool imask =3D get_imask_bit(env, int_num); + bool lock_pending =3D env->k0_lock_state !=3D HEX_LOCK_UNLOCKED || + env->tlb_lock_state !=3D HEX_LOCK_UNLOCKED; =20 - return syscfg_gie && !iad && ssr_ie && !ssr_ex && !imask; + return syscfg_gie && !iad && ssr_ie && !ssr_ex && !imask && !lock_pend= ing; } =20 static void clear_pending_locks(CPUHexagonState *env) @@ -257,7 +259,9 @@ static void clear_pending_locks(CPUHexagonState *env) =20 static bool should_not_exec(CPUHexagonState *env) { - return (get_exe_mode(env) =3D=3D HEX_EXE_MODE_WAIT); + return get_exe_mode(env) =3D=3D HEX_EXE_MODE_WAIT || + env->k0_lock_state =3D=3D HEX_LOCK_WAITING || + env->tlb_lock_state =3D=3D HEX_LOCK_WAITING; } =20 static void restore_state(CPUHexagonState *env, bool int_accepted) diff --git a/target/hexagon/hex_mmu.c b/target/hexagon/hex_mmu.c index 0ca52ed666d..637873b2668 100644 --- a/target/hexagon/hex_mmu.c +++ b/target/hexagon/hex_mmu.c @@ -19,6 +19,7 @@ #include "sys_macros.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/hexagon/hexagon_globalreg.h" +#include "hex_interrupts.h" =20 static inline void hex_log_tlbw(uint32_t index, uint64_t entry) { @@ -271,6 +272,8 @@ void hex_tlb_unlock(CPUHexagonState *env) unlock_thread->tlb_lock_state =3D HEX_LOCK_QUEUED; SET_SYSCFG_FIELD(unlock_thread, SYSCFG_TLBLOCK, 1); cpu_interrupt(cs, CPU_INTERRUPT_TLB_UNLOCK); + hex_interrupt_update(unlock_thread); + qemu_cpu_kick(cs); } =20 if (qemu_loglevel_mask(CPU_LOG_MMU)) { diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index accadd7927a..5bdb4a6e882 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1397,6 +1397,8 @@ static void hex_k0_unlock(CPUHexagonState *env) unlock_thread->k0_lock_state =3D HEX_LOCK_QUEUED; SET_SYSCFG_FIELD(unlock_thread, SYSCFG_K0LOCK, 1); cpu_interrupt(cs, CPU_INTERRUPT_K0_UNLOCK); + hex_interrupt_update(unlock_thread); + qemu_cpu_kick(cs); } =20 } --=20 2.34.1 From nobody Thu Oct 22 19:25:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1791997171; cv=none; d=zohomail.com; s=zohoarc; b=H6FSoROUTF1NBDanFDtO4R7xOz2p9l/2NoLlB9bCqM5zVyaXe4PGU9vYEWgzwy5aBCrA2KwtYfLtUakleYadOWbsPoJ2/E3VBhw+68kRWw4xHXVrYTg/n2XMZVoxEDHkUuRIDONUjbQA72+MraCEQweHg+jiILhFN0hQGkGfVk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791997171; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=U/M/6P4gwX9yNMbs+L6jBr/DCKCOnbulmkGdz93C2Fg=; b=Bxg5Yn9J8I/6a5B9p0eg2PvGllGuwn2uQn7OolgsOHwBD+bf/X3bGw2SNFZHY0+/1kaxsCjGQI9m1Aikq2GMFRY1gbhsHklpP+U6+T/H4kKeO183r2h9/Ey5e18L7WPLUzzrzAQpWf6pMmzffB342I7KJuL7zdTY/G3Uws1WejE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179199717187742.31918952335218; Wed, 14 Oct 2026 09:59:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xH2Jf-0000zl-OF; Wed, 14 Oct 2026 12:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Ja-0000yj-7I for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:54 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2JV-0001Zi-NA for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:52 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69EEbFvX301195 for ; Wed, 14 Oct 2026 16:58:48 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ha4622nbm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 14 Oct 2026 16:58:48 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-30c0d568830so8922154eec.1 for ; Wed, 14 Oct 2026 09:58:48 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-17dc865cbffsm11137939c88.6.2026.10.14.09.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 09:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= U/M/6P4gwX9yNMbs+L6jBr/DCKCOnbulmkGdz93C2Fg=; b=hJ+zMkrCJL4Innrk Vhqym0qRVIfLpx3oDOLkrSQZxt19qx/oBGwdox3ri4s5tkcFzsfawJzxM68P9cmP YmNnxekHbp/2dwiW/OSw5c4iu5rLSjb3vwl/YiuKihlnX0Z65EV7pM4V+EjDMe7C VltHNnkMoHRh4Ccjq4FdXgaqAov3HA8iWhdt1WZ8Hqo8nOR6el/FTJQeUcRDzyGl wk/tEZ2qt2ybuBFq90bXqQTSdgLC9UnEWuebg4xJSpJWh1xsrDv1d6DBp9/hXWGY 07b91RhDR1VHpCAR+kPqEbiKzCFHGI9SzGGD+Ksj2fwUwSUX0K9/AFbjIAmUlA1O DvxCUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791997128; x=1792601928; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=U/M/6P4gwX9yNMbs+L6jBr/DCKCOnbulmkGdz93C2Fg=; b=ZJS7y078aZTdb0JKnzVekjTVq9K37R5metoByFnorVWkkNl04u1t8PkFKj/63FnSXX wkdD+U4xwAJYxtdgrXKaZVbtGKh9C/reI72ih0XHS3nWQJJ/yM5c/DbTUzOgjESKGcy9 eRYVuJyHpzmOjS3VmxrczYONj4pDDzzlcaFEWHXAnd60sdUVsmwLAffGlFcBBHIKTphk 5fse+HcoEbGMYCMz/HlORHnkYLp6jNOU3u3N+ZW2afa98luIGEsjS+N6j9XfD+krwKP7 ZR30Wv48gGRwLy24JrIJFo1ryB3i/Dc44vo4dcRJDoC+W1bUWXWNiLmmNlTkuIFxRfY7 RF2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791997128; x=1792601928; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=U/M/6P4gwX9yNMbs+L6jBr/DCKCOnbulmkGdz93C2Fg=; b=C5pO5XIRhwjMHP765df5Lvd3SXhGIdI/5zXwuGiKwEs1DL3bM7LvqX/RW374b+TVWX VY8iy+6hB7P5aGixEQ7UQlKR2w6XaidLX6L/mW+M80A8rGGEs6CsPubB6hGmIEKi9Etn MO4iL8e3Xy1pdrbO98NQ+5kaaOiMQG/qXIB9dPEt1Iy8XOeqMldwP/V+sL0tvmSu2ZQ0 vbWFyDCnYxKajtvBGZWaok+O7hEeZAqxHSNfp0MLHhiZq0jy4AvwmRmCJQrhuHlJOJFb t8cfcNYPu+KK2eAI5TXC4QkxtEfOSlldqrYtsPMMT6mufP/Ko/rA5PbVzM45xYp6Eff7 Oyqw== X-Gm-Message-State: AFq9FYJEgmjTRn1ioKVHWbznfpNkejm0E04nvQSO42v1KZ1wD4Ak8ZnF VHLGNCOvTu5aAhaQeZfg9jdW086fBMw3N8Zr+P6gYbWPUeaSoHbZ3XgEEmD58DKeWm21iBZ+X89 fsPdKmiv/M9FpUrWy0+fJr1EBhECNkU+M52NOw2UiZXZAPOrpvFetbUmHLhCVKGEGPw== X-Gm-Gg: AYBFou3KBhTKvOnLOeKZbW6Mwg6tcX7bEm1JEPeRQJV9fMtkRkQca4rRNxeIKe/3KYn WEJQYKxA/0OLJyKZPut+/+MGnxrhmT2jGYKl8fcLwtIwfnv3F1+hQNXREJDQOySTlTllu/CWHIL RBUTB2QNR+DIWOYXFaBrnsz1ERA2MXuUxP5XcbuHN8OPnZIHP09F8KuV9+3X9BP0CY/x+g+vhfb FIs6Ds7hUi2hl+sFp3JCjNXjUh36atG/qwMyv3EAbi44Y9kpM5cVGm0znjMnJceVW6Qwnf/8WWH ZFEKypIvxGXbF89RLOj2tcERLHJpEyzLPUvdQ2TEOi+W+Lz/mC2pUvF7pc3YJJc81g90CDo5Yq/ k97fFdPjLYUuMTSkocj/UAIVTrpuWP7SS0va9IAK5hvWatNU= X-Received: by 2002:a05:701b:2916:b0:14a:d8fe:3390 with SMTP id a92af1059eb24-16a5dc01448mr22013957c88.32.1791997127404; Wed, 14 Oct 2026 09:58:47 -0700 (PDT) X-Received: by 2002:a05:701b:2916:b0:14a:d8fe:3390 with SMTP id a92af1059eb24-16a5dc01448mr22013933c88.32.1791997126778; Wed, 14 Oct 2026 09:58:46 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Brian Cain , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 3/5] target/hexagon: halt on tlblock when the TLB lock is contended Date: Wed, 14 Oct 2026 09:58:35 -0700 Message-Id: <20261014165837.2916482-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> References: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: m-L_L44aN90mQe9zfx6siqbzxCKYaHW6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfXwcatgdWVghh8 +4Q0U6QF0S4EhCXbb2nX1QQqZ/UIElAVZ6sbfI/TekE99PYSut3LAQOTO3DKbb1rFPaUuL0P9jN aylOHi+1aLEWZfKE0l8sF9Ni6Nkc6dMPvtO3aObs1I6HX9F+XAyU+cgJme/bgMhfTjUhhm/q9Pw TxsH/DnV6iAKxj/IJ05WATQusJ8t771GP1XK+/iWYDv49Ww6/gRIgNO+kdChXkaCuhaPhW59ulc HfYh5UCHoAqdtBFC17KHwb5zFBzRaDd7AmstbuP2iUDsWmhs1CKO5FB2jzrwCrSsSO639XDuTYu Eq5VK4DUBC5ljU0lfcbc8SMS18vPR9pcVmidfZ5sjongHViSFmTOti03l8/gudjVE+10eWBUXHV 3ECAhQlY1uNY8Fg5GVhH3taiy5V8hwr6wDVNETIBqPgcDnCyo8uHW0eUVK+HBFBsVDwufprSXNZ JSX2Lq8AJ4Br5YBakeA== X-Authority-Analysis: v=2.4 cv=ErZHPicA c=1 sm=1 tr=0 ts=6acfb4c8 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=n7pvLpctYYjJJk5sxiwA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX739+4D7ZzE9k ZhQRiH49IbmgfPiuM3/ChcFCWUukl3mu4RXNeXeN906/MOwM7rYhTbfg/cu2AiXXH62Hu8E+GUL KxRNVhwV48R5mwODKbFpAtLB/1EOyiU= X-Proofpoint-GUID: m-L_L44aN90mQe9zfx6siqbzxCKYaHW6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-13_01,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610140067 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1791997174536158500 Set PC to the tlblock instruction and leave the CPU loop when the lock is contended. This retries tlblock after ownership is passed and prevents execution without the lock. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- target/hexagon/hex_mmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/hexagon/hex_mmu.c b/target/hexagon/hex_mmu.c index 637873b2668..79a19797a05 100644 --- a/target/hexagon/hex_mmu.c +++ b/target/hexagon/hex_mmu.c @@ -12,6 +12,7 @@ #include "system/cpus.h" #include "internal.h" #include "exec/cpu-interrupt.h" +#include "accel/tcg/cpu-loop.h" #include "cpu_helper.h" #include "exec/cputlb.h" #include "hex_mmu.h" @@ -180,6 +181,7 @@ void hex_tlb_lock(CPUHexagonState *env, uint32_t PC) ", thread may hang\n", PC); CPUState *cs =3D env_cpu(env); cpu_interrupt(cs, CPU_INTERRUPT_HALT); + cpu_loop_exit(cs); return; } env->tlb_lock_state =3D HEX_LOCK_WAITING; @@ -191,6 +193,7 @@ void hex_tlb_lock(CPUHexagonState *env, uint32_t PC) env->gpr[HEX_REG_PC] =3D PC; CPUState *cs =3D env_cpu(env); cpu_interrupt(cs, CPU_INTERRUPT_HALT); + cpu_loop_exit(cs); } else { env->tlb_lock_count++; env->tlb_lock_state =3D HEX_LOCK_OWNER; --=20 2.34.1 From nobody Thu Oct 22 19:25:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1791997192; cv=none; d=zohomail.com; s=zohoarc; b=KuuwFkU4f0uUz8CB6Wo3A2PLcKWdJ68FuQhTjEVpGebk8ihzWitO5oxjp4L7BpAEIkEwNsHmux6nMRjNgjkPXmhMNoXW8aYPXrYIWBrdcw2ZTfedxaaJYRVd52crhPWD1KdLkLYL4LE+Pq6gvWWwon4uL4/Ot6jww4So5AJxGWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791997192; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f8sHOzLY27EX2ge3nt6iGcIVVcBSICm/Xh/n5vtFUWY=; b=jm7/uSUubZ5obAKr41SsISZNXkpVvqrFexKjLVTN3mL0v7p1AQvhoJMjUJgim8NR+MD7zwk40XZg5xgrvTCFYHTV3XUWKmJ8K+E9+13NZRTsT0gF50WuSw75sGola4kcLTj5vbWoSNoX9A/6gt4JIpmiPFbVZ0fQkWFCKi6biy4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1791997192248655.0431407562492; Wed, 14 Oct 2026 09:59:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xH2Jn-00010b-8c; Wed, 14 Oct 2026 12:59:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Je-0000zA-5A for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:58 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Ja-0001Zx-4t for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:56 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69EEbx253644305 for ; Wed, 14 Oct 2026 16:58:50 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ha470akx3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 14 Oct 2026 16:58:49 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-3515266f6eeso2139347eec.0 for ; Wed, 14 Oct 2026 09:58:49 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-17dc865cbffsm11137939c88.6.2026.10.14.09.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 09:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= f8sHOzLY27EX2ge3nt6iGcIVVcBSICm/Xh/n5vtFUWY=; b=SGTkLzjTJlMbM6ER eY4sDSy0InfNM9OoOOPzDRtqFg8rtYBNGkbqeIPfcr/88skpCoS06Q2MU0KlFfUj j9/9AIRmwKCd6ayRdEiwV6r/dE27pQvJ1YfCYv/M1oouGTQTm7DeGvy06+wnHyNW tiIspgU3XIn8x1solsewWIeibTqvjVInwVCAmnBr5wPM6J/+wk0RhYCdoh3/RxqO 6NWI3ythMhec4MgSKmue9sm7FQFRb2+sVa8UoMBq9++rt+fTAcV6tGZ8v8tTPo8x 7oWhiCejznG7BCBTganUK1jEUXNnraz3l9ZA8fSNoaAkxQisbMloUjpDvuEiFF5q UCP2mw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791997129; x=1792601929; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=f8sHOzLY27EX2ge3nt6iGcIVVcBSICm/Xh/n5vtFUWY=; b=HTKnaM+McnJZyR+3pJvkj2cLdjB5Ud6xGg2/MBKGVRwZlfmtn/prdBQtxNkMp/wci7 P6NKhZNP/guq876apoAy3ow8hg+PfQ+ZbsvuRWQMIGl+nl8Ld8TvZMca7ZEADlx/IX5p ILp7AHRV9YBEedk3cEDpAhDRdMoDsfr18QCAhZXsUiycqKeHGADOceLnV4MfvlZ14Vzr bqRGnjY6JPsBU8nX1a2sta2BaxVFOE++4Af/yEv7l2rW4ehk7/gmZnT1JvEfv7jZfNGt ZkJBFx2cMDUps6wRwQ6lQ+/Wqv14yF7vD8RZ8acyQWEyHTTXZDcUEciiJ3oZox99ZFh6 jY1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791997129; x=1792601929; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=f8sHOzLY27EX2ge3nt6iGcIVVcBSICm/Xh/n5vtFUWY=; b=u3hqFapRwP2mS5937v7q+5YA5fhj/plYw7jjEIhDIV4yDGdrGmqqIp7GR2LhbSnNi0 5JmtQXpPtZDiF1Z8GMdDUEx9dOAey3IiBKVh6ayySYrGCPe69gwAkUdN87E2Wb2Lh7m2 Da6O3hhU3B20IpIdE8hpmSyv/ntnAnGOxaPzy4fj70LVsmRuPWGKT/oz2H3zDIbvvvmk FTVrmV4BciDFU2tNopM973F5d2+hMLaBH1PU3GvEsaBlr3g3mw8Gt2/0PRZfUMqTkVBp 0TPReX7u9Yk8TaNpjunYoAMPFV3JlUD3+jEcOIwjGAP9ImfzD0q2+i4OfgZt1unZ66kD fxtA== X-Gm-Message-State: AFq9FYIES6PT4ne2/XXKWVzkpSf1o2XHPBu5heovB1pywTy/57LZEHYI 6j94njwZpiwOYyueCfqWW/yJSVM7SLVcamqSuynEXh+9Dvw5TVH6JDxTYn416asiYt5sjUs7+eA qZ6AbCAOFv5s6B1kBgujwlNQNUk6hLvSjvc02KAcaCTUJX0C6qjMxAceQkHUolWqSSg== X-Gm-Gg: AYBFou02y3BDZPsuvFTZJ+Ttkqq/pY1U/lZ7d4xv1e6uDD8UvzXyMpTG1d3w8+kKptM +/KZ9jgfFHheF5IzQj6heo9Rfx6Pdija5ZeS+gxO4TSH2EiDe9EpakYVuYrvyTlC7lCU9s80kt3 Zi8iGul8izhdSScuk+7l9x7fuA4iTScTHQhL3Qfzg+k+rcCCP0/R6IuXDzP+aKJN8UU/Yf9RLIw RAXwI93JVcRlkQ0hd7Qu02zbY3X6tUTxRPm+IosUxDNvDXuGRemg9+hJr0rHiIQiqgaG+6umbeD 9wuScdBT7sBrRLYgUeNEhoCt5HAdSpBCEajSG6mImNnD6gGyx4/+2Fvpcb7g8VbCvYHvuX/K+JE qRghcRun5ls00VWto/bMMAfnnLlDg3qVdZ6xClFZ/VjOmJUA= X-Received: by 2002:a05:7022:927:b0:150:c9c5:1ce4 with SMTP id a92af1059eb24-16a56ab133dmr27859881c88.6.1791997128675; Wed, 14 Oct 2026 09:58:48 -0700 (PDT) X-Received: by 2002:a05:7022:927:b0:150:c9c5:1ce4 with SMTP id a92af1059eb24-16a56ab133dmr27859834c88.6.1791997128078; Wed, 14 Oct 2026 09:58:48 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Brian Cain , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 4/5] target/hexagon: set a started thread's enable bit when start retires Date: Wed, 14 Oct 2026 09:58:36 -0700 Message-Id: <20261014165837.2916482-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> References: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX++3SqHru6J9l /cHy30cDJFA9pHaxLtiT9IzPeygkqrCwlCZqopf7S/vrNqq0HPM3lAay2jU9/QLAuAgPshTE+2z nzblI921yi3vIr8aYAbpCCFGhb0sw0859PAgeftDK18nXue54AqAoqufVMHQbmbTZU6OmoJExkY lKx/D0O8zE/ejFrcqciuI48twNt0SqyZaMgPL/R3xGcc5KTq4C/E5e4zGI0g6E600sqNwQaJWPm 4tiQCZePRQ5L2ROp9jOyvISKCHzdo6hUJMWbZcGA3bjHj3Da/xe7fOclX3YRgrbmSI3i4747XvJ VGIWCdGBxr13nTmN3NSbU2CiD6pRAQNNyfXWsICx7iawIVxkVlW202krXBmi5Wo4OYj8PdNXu1g bX2ohsWIbMmoLWjv+hlCvjg0ZPDavnevUgwE3C3kHUlt9rqcs0ownfeQ+LrLk+yiUY3L/zP3S4y 1J0GQfTFnjRKFlIVQkg== X-Proofpoint-GUID: cMqdJKXfd1p15evqlLpi8nQ9DaAGjfZn X-Authority-Analysis: v=2.4 cv=P6avFSAu c=1 sm=1 tr=0 ts=6acfb4c9 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=u35ek3RR3RME6NZFTgcA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-ORIG-GUID: cMqdJKXfd1p15evqlLpi8nQ9DaAGjfZn X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX1S/pi60dlNlG ASpmA23BSEi587AnxEo5bBqW7U6wfg3PCR/bsSSrR0Qzaj0v/zDdh1ePK94vwee0cq5gO8qtJKo 9OLy1yx69ZFgkwdRyLMg+EsDd7Q5Hwk= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-13_01,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 suspectscore=0 clxscore=1015 impostorscore=0 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610140067 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1791997192786158500 Set MODECTL.E when start retires rather than when the target thread runs. T= his makes the thread state visible to software immediately after start. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- target/hexagon/cpu_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/hexagon/cpu_helper.c b/target/hexagon/cpu_helper.c index 4e4a81c162d..689f79ca934 100644 --- a/target/hexagon/cpu_helper.c +++ b/target/hexagon/cpu_helper.c @@ -496,6 +496,9 @@ static void do_start_thread(CPUState *cs, run_on_cpu_da= ta tbd) void hexagon_start_threads(CPUHexagonState *current_env, uint32_t mask) { CPUState *cs; + + BQL_LOCK_GUARD(); + CPU_FOREACH(cs) { CPUHexagonState *env =3D cpu_env(cs); if (!(mask & (0x1 << env->threadId))) { @@ -503,6 +506,7 @@ void hexagon_start_threads(CPUHexagonState *current_env= , uint32_t mask) } =20 if (current_env->threadId !=3D env->threadId) { + set_enable_mask(env); async_safe_run_on_cpu(cs, do_start_thread, RUN_ON_CPU_NULL); } } --=20 2.34.1 From nobody Thu Oct 22 19:25:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1791997175; cv=none; d=zohomail.com; s=zohoarc; b=OSzedNYBU8P9ocPobjg5dFK4awEsfIlwAWnR3IhL34tytCgCNeuSmVGOwhJtf1VUoBdT9fGTTTBsT95Dl2w7LgjOiSZjv6MhWQBmIya5j8FNEejapEcXcLgr2W/rIYTQMRvtUYHEN585X2NcEWsXiMv1XKgnJnhcPLYPkR44tKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791997175; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+wdQOWWjrb2A+1zKjaniSXLm1/gTrVOZcbWWQj2p5Vs=; b=fXXXTR6LX8ZEH8ypZE2Y2x0mXq4BAdojV+ok1GeSfW1dqcAX2sP+bzZsJw2vnjlCvBhphaa6v63zajUt8AMHh04RyNAENz2XzhB9Rag5V7veRxe0UwNtHJ4ZYToQHiwnWShirb7t7tW2yQzaf8DVIb4hwDM7iiasro7m9S7zwRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1791997175570883.5483924827251; Wed, 14 Oct 2026 09:59:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xH2Jo-00010v-KB; Wed, 14 Oct 2026 12:59:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Je-0000z9-3U for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:58 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xH2Ja-0001aD-0H for qemu-devel@nongnu.org; Wed, 14 Oct 2026 12:58:56 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69EEb30d1013141 for ; Wed, 14 Oct 2026 16:58:51 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ha80csj5b-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 14 Oct 2026 16:58:51 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-35c3c370b17so4101130eec.0 for ; Wed, 14 Oct 2026 09:58:51 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-17dc865cbffsm11137939c88.6.2026.10.14.09.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 09:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +wdQOWWjrb2A+1zKjaniSXLm1/gTrVOZcbWWQj2p5Vs=; b=jUpYKfVRFVov3gPJ k6vDzus4yPfXL4rfKhUp5FCz2blJyxGSaMF1unle8f7TUZjnDu+WhAsCxliZaFXu /pB6bD7ru9ELg4jdI3odDejfws/j5X950jRv1Wbi7BXCAAH4n3KAjIuLeZD26EEl cx8125oSyhITeqqcZR6T5VQJgDXRvGzUc3HgJ/fWWqf1K1CmVFevgRE9qHg3RXJ9 +xu8JtkGK8wD1Lzdm53bXbMk2oPd4b3+kf0YzJ6rSYRBu8C0slk69xmWbW06pCcS bjpgxBL/6UIp7lI8z6ClkzorfbNNu3VCz0Af07gO39t2GKfQKYsVVZfmuhAwN7PL spfmtA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791997130; x=1792601930; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=+wdQOWWjrb2A+1zKjaniSXLm1/gTrVOZcbWWQj2p5Vs=; b=ZDKGGHSBHqHBHIYzeBBLflDWnsN0sxDVize4Y53lX8MA4osXH380yGhE1DvJIU7sIe ZJUhSsI15xIzoHlmek7or8pZp5EUAKg7xYMoADKmlo/irxQPj3tPXFdIodVV/xzIf5Q/ uV1Nubf+myG1TE0s2YOsAiRggg/pbJMU6XFuzlf+AjjrbJabl0mk/l8/a9rhTEbQ0MXV WOuALGx7b2+zyDOEIvuW1+qRlU/sPryZXYGxhW+acpkAtbL0wb7nCjhPDJ3izfVHrkrr F4O2cHv28q8H0gqzdsZjRnRGLO+w1H5xBMHM8ZaZX7ZOOmZSK7I60MWnOPECbos0a/a1 iwrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791997130; x=1792601930; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+wdQOWWjrb2A+1zKjaniSXLm1/gTrVOZcbWWQj2p5Vs=; b=Lc9ml7fJmrRv6UNjgzdX6sMdq3bE4wEcXId+a8tHlRiMrk2zaqPyb2UuutuNLUT0mV 9ll1O8PNDN+3X7fEN0fV7kTmoi4mUm8KwL77+cmPCfqykt9bcoX1HY69s0t3c6lKVwjB 9zqiW4qGF1Omehz4KwxY9XC6gpb9u8gpuuw/Uwff7fRJmDwAIhEbyR5djkObg+upJ4hx TYgrv7HfC6mNQnT31mttu+nQvQ/HwUwqpAj96eD6YuyMe+CTDOKXC3GZKJCxwujwulru AkSTyJRkJSmmVMMnGYwIQrm+fS2W1Spex5SdjMN3MwWq0kZsZNkXtsH/F6qlaOkDpVTt rnFg== X-Gm-Message-State: AFq9FYJ+9xywnJBW0wxjFcZ7Z2zjCXa/+xQs6IEd5FymYQzuqcW0lsep 744vR0P90+1xWMGje1fvJ+z0Ix/PttHA1gXhwHkqIlhtZ8cyWF1p3iyyUQMWTtAOE1SK4/9YdSg QJMajHuVdD+zFwKthAkbNliyMGWcr2y9LWEqNuQoqpacFq1MDn7KCeknPYwtxBlg+Qw== X-Gm-Gg: AYBFou34Zsoqc8SpNKD0eCjrQCfEv9VxZi6RUtfwgn8YRj4zivg2lrfD0br2dSuFJNo PMJkz96aZfIdz9bbC2DFPk7XzNZd+hwENBlvHKW3bOQl/igxk19JDgKMOQbC0LPyYXE4rSW3F6T 4gQQ+YJ/iDduPag+toN10dgkzXeA1QBBnOTLrwavTTPdpS+iz+kDSVIY5guP/gT9z0A9k03KifF cFynzlb1M2EgELmJHSnLuoE0DD6u8SiEfQUL6bMjchagEju3Mr0Cq+FzbxyByuPoV22PX+Q3wgK vQCihY2C9BgStNb6aN/4OGYwLySNARuSzqG9NlYzVL/mB1oD7a8Ah36L/dFiHUsetWbxIs4OlWi nu+P6LoDjQTyIvUwn70AZvCfRdduTOvCQyMTdtTmT6WMlf/M= X-Received: by 2002:a05:701b:2806:b0:169:3706:d61b with SMTP id a92af1059eb24-16a5dbfddfdmr21967857c88.16.1791997130290; Wed, 14 Oct 2026 09:58:50 -0700 (PDT) X-Received: by 2002:a05:701b:2806:b0:169:3706:d61b with SMTP id a92af1059eb24-16a5dbfddfdmr21967826c88.16.1791997129592; Wed, 14 Oct 2026 09:58:49 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Brian Cain , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 5/5] tests/functional/hexagon: add MiniVM, lock tests Date: Wed, 14 Oct 2026 09:58:37 -0700 Message-Id: <20261014165837.2916482-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> References: <20261014165837.2916482-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX58RajXe0MsgY mk9VpvCvJN2QDd0x+133Zi4PP6wnwxhRnw5qXwms6Ep3DADCaSqmCXg/+tRJjRlTXNytPsX3VjD 3gzG6DIyJarONFTHxtShCyAOb0LgU7A= X-Proofpoint-GUID: eEGR1fkXec8AWq2GsH-waXE9EN9JMgPf X-Proofpoint-ORIG-GUID: eEGR1fkXec8AWq2GsH-waXE9EN9JMgPf X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE0MDA2NyBTYWx0ZWRfX8G0GwIe/dzl6 vOjT4PEsVyn8yHUnTcai5LvFYtJvjqROwj1XtlqHlw8YaRabmykBKaz51V2j/OX8htKMI5Xz+nn Cpq6FgRu65vOJs4gCb3lWUtC7+4o9CYi8pPjq2PYu+JWGSkExz8ACM94N9juJaUnwm6XPqYWOey Uc8DiEDd+YyQNFohn9tttA2l/vOOeU9meJIO4KnDp0zYo8gOx42CqJkIWYDQBX2BpTmLnL6btPu PMm6s0DymPPxC+Oj4rzL/lMWOos4QTZ7kHuTc/4DOrvLgCH2z01gLsHvGCTLt9LGi5IzhCLAAYF f9aoGJ82KyNRJ+rmhWLfdhFkNcduUHLGI3+V+pbRGQPUD08rd0Wiz70m1ijBGWJyamUgNoXNkaK g+tgDBTC7EQQgwLfddGWr2pjhi25dEilxbYh5maCmXJevfDfmy2MaSvooKLQaXM3AG+0Keq65FI 2M3OMpLko4H2tS4Meew== X-Authority-Analysis: v=2.4 cv=JegpPkKV c=1 sm=1 tr=0 ts=6acfb4cb cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=5vFef2XoAAAA:20 a=EUspDBNiAAAA:8 a=N306dsr3tXGB1petHgEA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-13_01,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610140067 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1791997176488158501 Add the lock_verify test case to verify the k0/tlblock behavior, add the minivm tests to cover start() and more. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/functional/hexagon/meson.build | 1 + tests/functional/hexagon/test_minivm.py | 48 +++++++++++++++++++++++ tests/functional/hexagon/test_systests.py | 3 ++ 3 files changed, 52 insertions(+) create mode 100755 tests/functional/hexagon/test_minivm.py diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexago= n/meson.build index 44053e64676..e182bc98a06 100644 --- a/tests/functional/hexagon/meson.build +++ b/tests/functional/hexagon/meson.build @@ -3,6 +3,7 @@ tests_hexagon_system_thorough =3D [ 'arch_tests', 'systests', + 'minivm', ] =20 test_hexagon_timeouts =3D { diff --git a/tests/functional/hexagon/test_minivm.py b/tests/functional/hex= agon/test_minivm.py new file mode 100755 index 00000000000..115f3cf3710 --- /dev/null +++ b/tests/functional/hexagon/test_minivm.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +# +# Copyright(c) 2024-2025 Qualcomm Innovation Center, Inc. All Rights Reser= ved. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import QemuSystemTest, Asset + +class MiniVMTest(QemuSystemTest): + ''' + minivm is a Hexagon hypervisor that implements the Hexagon VM + specification. These test cases boot minivm and then load test cases + to the address specified by MiniVMTest.GUEST_ENTRY and + execute a minvm-guest program to exercise minivm virtualization + features. + ''' + timeout =3D 180 + GUEST_ENTRY =3D 0xc0000000 + ASSET_TARBALL =3D Asset( + 'https://github.com/qualcomm/qemu-hexagon-testing/releases/' + 'download/v0.2.21/hexagon_minivm.tar.gz', + '5980740c5fa505f55cacd1646088831202df4ccbf9e2ddc34b690673574169ba') + + def run_minivm_test(self, test_case): + self.set_machine('sim') + self.archive_extract(self.ASSET_TARBALL) + rootfs_path =3D self.scratch_file('hexagon-unknown-linux-musl-root= fs') + kernel_path =3D f'{rootfs_path}/boot/minivm' + + vm =3D self.get_vm(name=3Dtest_case) + vm.add_args('-kernel', kernel_path, '-device', + f'loader,addr=3D{hex(self.GUEST_ENTRY)},' + f'file=3D{rootfs_path}/boot/{test_case}') + vm.launch() + vm.wait() + self.assertEqual(vm.exitcode(), 0) + + def test_mmu(self): + self.run_minivm_test('test_mmu') + + def test_interrupts(self): + self.run_minivm_test('test_interrupts') + + def test_processors(self): + self.run_minivm_test('test_processors') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/h= exagon/test_systests.py index 20c58f84f67..0489db0af91 100755 --- a/tests/functional/hexagon/test_systests.py +++ b/tests/functional/hexagon/test_systests.py @@ -108,5 +108,8 @@ def test_hvx_multi(self): def test_standalone_vec(self): self.run_exit_zero("standalone_vec") =20 + def test_lock_verify(self): + self.run_exit_zero("lock_verify") + if __name__ =3D=3D "__main__": QemuSystemTest.main() --=20 2.34.1