From nobody Fri Apr 4 07:10:30 2025 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=1740807468; cv=none; d=zohomail.com; s=zohoarc; b=Rx9mNtBao0oo5HxNsxbLo33IYNCnCC+h1/sxstCek2tIqygBEh7ZlWv+8vE1dwihOYwNDIKyI+w9AA3AuPQ5xawBGVB8AtbSwl4FwHVjym6PVhaeIRY+S7xP/Zj2RDmoOXN+Yua65wqtFhqIeKijfM1Dee28gkvCDodRhvJUW5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740807468; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eiekoLL7gr5td0wkXCBh/rRbE+ZSV6VcR92m6VgCUw0=; b=fBjmFqSKBr+XmgrAe3QR4Ek0FUz4EirCqaWlVK6KiQ9QK3i1xcf+0wpJn9ooRE3JiVcSpQv1FvUWXT7N5OqSqpKT38pxczLDs3ARODETnml6Olv4jqdab/D+hZFkPj/pohQtA8RrCm2ywYjhB8HZWC5AROLJ5fCcYOPi6WWL4Ps= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1740807468135235.23678015610062; Fri, 28 Feb 2025 21:37:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1toFPO-00089A-OT; Sat, 01 Mar 2025 00:29:06 -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 1toFPM-00086l-SA for qemu-devel@nongnu.org; Sat, 01 Mar 2025 00:29:05 -0500 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1toFPL-0008Nb-53 for qemu-devel@nongnu.org; Sat, 01 Mar 2025 00:29:04 -0500 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5214E6Do030641 for ; Sat, 1 Mar 2025 05:29:02 GMT Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 453u0d037a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 01 Mar 2025 05:29:01 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-22334230880so39443325ad.1 for ; Fri, 28 Feb 2025 21:29:01 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fea67a5dc8sm4732955a91.23.2025.02.28.21.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 21:29:00 -0800 (PST) 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= eiekoLL7gr5td0wkXCBh/rRbE+ZSV6VcR92m6VgCUw0=; b=ARrmYGTnLvHYLr3e ejQljD+0yUfsE6E2RD9CmyOFoFyTqA4joF8kQMvt9Fg7gfQhpEW2tur6WSU5syRI x67J6AXM9ls0X21F1kt4hKxM/5/lI//cxFLUX8AbRv1Mwb7UEhSK4l2Bcy88p/Eu bJI5tm5gBd6rrrD5XomfjtMrmlMn/tmfMDulX3TC6WHCQauuQvkWEL1MI79E+fld mzpsE8A1owMe6zVvmC2wQmqqHUeXiRcKHL4U5u5YRs0Z64izMZ35XYJ6LddOZZOI Tp6lWYqTpDO96orc4EdwF3rtpeBDHu4sLZJNF71JyQ6bk0o13dtvDaXr/r9Vk05b takCPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740806941; x=1741411741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eiekoLL7gr5td0wkXCBh/rRbE+ZSV6VcR92m6VgCUw0=; b=vRH0qgUd5sDnz1NXj2NwOGnZccRkwxFxId110qYz5/BbxUwCFlwvLYg2tS1QYhY5Z/ WVZBH1agrjK4bRM6TuSx9rqgA3A0xefIfdeikOvT1i79pEwn5WQ18n4crbC00TRO7xXQ DNFfCrH1eW+LIuGqfB0BPsaJK0ePT+9hhi2I/CAwpkSO7jRRE3bHSvEbNpu3XsCA8uSM Z387nx9NHJHHG6YVMaLDGozw0lAwoIyyqtfQDiIdiEpKkB2KIuRs7cWQEfPU6VWaGRpX U2Uewv6M4j3aWH8SDeLR8OUXRZD2d/56Ab9yvup1ANK5cd2SaZuga4qjSvptNA5RZHz7 thrw== X-Gm-Message-State: AOJu0Yw1AV+8quomQk+NwN/wzDVk32moPRzB3CbjYKIsbCpELFmkrm6H JBbDyyv8Kd9ptUWaVFQ2oEibKMN+ks6dlsmYGGHM2/xnkGB63FVTG/EvMtQ7f/k36y34AycIVC5 9eqYL7ZPsctvcm1hYZ3bxRAg2AERrB4hFC6ZvCkv0j9/13yAXQtjak8UvQqi3Tg== X-Gm-Gg: ASbGnct0tO9jKcvSjO9xDQGd3BqVaHThrU14sj4od3yuaSPCpVovPDpmwyZmhIHJoL1 Yi3V6+jWWiEfDMkE1cvsGbWkPcJFqLK4ve+c8GzEOZqXm6KYypMltTem3310j2+qrc5h2+aYmdt eZIEjUi+kWNMcmytTCHTpnvZ25mJaFCp/I2TspImSHsfInS6uR/1IbdQFZ5m/qpq73n50eusId6 l211SBkJ2w9TQRlxNjxQhGM3qP7fcKPLpfWTrh4Ly1cUP3whI8EQOAe+sNkIrLdsmt0BA71326Y oMOm9pqmTe/ECFK32kdll1LwEBTv/Et1huPPmNoUJr0THd13Mymv789EIld764wi X-Received: by 2002:a17:903:230c:b0:223:7006:4db2 with SMTP id d9443c01a7336-22370064ea3mr67165225ad.31.1740806940831; Fri, 28 Feb 2025 21:29:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ+7DXIXcMC+zzf3hwna0fyMOTGjC75mvJdEnNCgzRN7ydyvCA1BpoBJtJneugJ//CM4ql/g== X-Received: by 2002:a17:903:230c:b0:223:7006:4db2 with SMTP id d9443c01a7336-22370064ea3mr67165085ad.31.1740806940498; Fri, 28 Feb 2025 21:29:00 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, richard.henderson@linaro.org, philmd@linaro.org, quic_mathbern@quicinc.com, ale@rev.ng, anjo@rev.ng, quic_mliebel@quicinc.com, ltaylorsimpson@gmail.com, alex.bennee@linaro.org, quic_mburton@quicinc.com, sidneym@quicinc.com, Brian Cain Subject: [PATCH 08/39] target/hexagon: Implement get_exe_mode() Date: Fri, 28 Feb 2025 21:28:14 -0800 Message-Id: <20250301052845.1012069-9-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250301052845.1012069-1-brian.cain@oss.qualcomm.com> References: <20250301052845.1012069-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: 7IW3aro-KkTnC6zlSiOZJqTEoA9la8DF X-Proofpoint-GUID: 7IW3aro-KkTnC6zlSiOZJqTEoA9la8DF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-01_01,2025-02-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxlogscore=671 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503010040 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=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1740807469928019000 From: Brian Cain Signed-off-by: Brian Cain Reviewed-by: Taylor Simpson --- target/hexagon/reg_fields_def.h.inc | 11 +++++++++++ target/hexagon/cpu_helper.c | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/target/hexagon/reg_fields_def.h.inc b/target/hexagon/reg_field= s_def.h.inc index 156a3514e7..50b8c26f8b 100644 --- a/target/hexagon/reg_fields_def.h.inc +++ b/target/hexagon/reg_fields_def.h.inc @@ -135,3 +135,14 @@ DEF_REG_FIELD(CCR_GRE, 27, 1) DEF_REG_FIELD(CCR_VV1, 29, 1) DEF_REG_FIELD(CCR_VV2, 30, 1) DEF_REG_FIELD(CCR_VV3, 31, 1) + +/* ISDB ST fields */ +DEF_REG_FIELD(ISDBST_WAITRUN, 24, 8) +DEF_REG_FIELD(ISDBST_ONOFF, 16, 8) +DEF_REG_FIELD(ISDBST_DEBUGMODE, 8, 8) +DEF_REG_FIELD(ISDBST_STUFFSTATUS, 5, 1) +DEF_REG_FIELD(ISDBST_CMDSTATUS, 4, 1) +DEF_REG_FIELD(ISDBST_PROCMODE, 3, 1) +DEF_REG_FIELD(ISDBST_MBXINSTATUS, 2, 1) +DEF_REG_FIELD(ISDBST_MBXOUTSTATUS, 1, 1) +DEF_REG_FIELD(ISDBST_READY, 0, 1) diff --git a/target/hexagon/cpu_helper.c b/target/hexagon/cpu_helper.c index e64568b9fc..e0dd120cd4 100644 --- a/target/hexagon/cpu_helper.c +++ b/target/hexagon/cpu_helper.c @@ -237,6 +237,30 @@ void hexagon_ssr_set_cause(CPUHexagonState *env, uint3= 2_t cause) =20 int get_exe_mode(CPUHexagonState *env) { + g_assert(bql_locked()); + + target_ulong modectl =3D arch_get_system_reg(env, HEX_SREG_MODECTL); + uint32_t thread_enabled_mask =3D GET_FIELD(MODECTL_E, modectl); + bool E_bit =3D thread_enabled_mask & (0x1 << env->threadId); + uint32_t thread_wait_mask =3D GET_FIELD(MODECTL_W, modectl); + bool W_bit =3D thread_wait_mask & (0x1 << env->threadId); + target_ulong isdbst =3D arch_get_system_reg(env, HEX_SREG_ISDBST); + uint32_t debugmode =3D GET_FIELD(ISDBST_DEBUGMODE, isdbst); + bool D_bit =3D debugmode & (0x1 << env->threadId); + + /* Figure 4-2 */ + if (!D_bit && !W_bit && !E_bit) { + return HEX_EXE_MODE_OFF; + } + if (!D_bit && !W_bit && E_bit) { + return HEX_EXE_MODE_RUN; + } + if (!D_bit && W_bit && E_bit) { + return HEX_EXE_MODE_WAIT; + } + if (D_bit && !W_bit && E_bit) { + return HEX_EXE_MODE_DEBUG; + } g_assert_not_reached(); } =20 --=20 2.34.1