From nobody Sun Jul 26 13:29:05 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=1781156231; cv=none; d=zohomail.com; s=zohoarc; b=n5ZFTE6ird/j5yPOAib4q9XHKDlgLfvc3nQtDYx6MMa/uNxetNGsF9mW/jupTPGQaDjZq9tANQ+ns/2WLk5wYgi8R32WqjLArQLo7DWmfWvDcNfPHMSvje2QLgsX73Jdrbai+K9P3jpp1FmbEP7HtK+aTVWguEKBtM1Hw5W+3qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781156231; 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=C0N6L0VsODWcTmkNpYAs+/Ptwq9hq8dQoO0cvDCq6Us=; b=DydmENFOGoab0hkjtcLirC85TJO1UWz2SinUU21THLj75o/OWBzSy74QGYQpBU1XF/CNLnUU+S+P2Tweb02C+N81mnb93UlIEGsoZCGAZSFRa600qvHPxLI/qML7mYh2C7H95OFXYrpB7xDRepRyheyx6TyNnQacQ8CJWzmn78A= 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 1781156231303328.70827801988605; Wed, 10 Jun 2026 22:37:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wXY39-0002BU-Mq; Thu, 11 Jun 2026 01:33:55 -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 1wXY2u-0001h5-Tk for qemu-devel@nongnu.org; Thu, 11 Jun 2026 01:33:44 -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 1wXY2t-0002rP-AV for qemu-devel@nongnu.org; Thu, 11 Jun 2026 01:33:40 -0400 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65B5GClK3843632 for ; Thu, 11 Jun 2026 05:33:38 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eqe701rub-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Jun 2026 05:33:38 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-307625ee07fso11483417eec.1 for ; Wed, 10 Jun 2026 22:33:38 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30806ee207asm720800eec.29.2026.06.10.22.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 22:33:35 -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= C0N6L0VsODWcTmkNpYAs+/Ptwq9hq8dQoO0cvDCq6Us=; b=Reid4H6/3yfXctfN TnYwH0IiK8wilKegntkA9ltKAcnN1oztsrzBDwMTmBKG4kUwW9kCifpuKjXS/T2H tdTIB9qHwI/rTzozcolZpMTneWMFKLDRG9gMMCB3ciTOkd/rR5hGIJ92aM8K3RMg sUoQFn5aekg15jkGkqKDjAjYPTExiEZy439gdioGM/zMODS3Bm2bwDNJ+SFodYyN Nq0elDTNZJ+B6+BHhyCkMp6dl3hmjr4A9HHAMC/5orwSB346Z4Q6R1T0MuIoY4Ss L6e9vJSOioxVrGRJM2uaWKH9hIpIazsacO375rbjYAwWintLkvSVMFCqBNjpcaTt 6JQgJg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781156017; x=1781760817; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C0N6L0VsODWcTmkNpYAs+/Ptwq9hq8dQoO0cvDCq6Us=; b=j6aj2k3pKlFBB77sT9KH+aSmR6Rgepp/35Ubwqyed0vXM6Rw0v9b7+KhRlcJU+outW ps8SWNR40popzfwYtf/qJ3ZOlwpHLX8FffFxq3mEVZRbWXCFKe4DzcO3VsLTaKC7xHgm U6iAFSqqMVya5lrbCOS33s/y37QpphcFCs90lJ08QW/9QSh18NNxe8vZEt4qVhO+evsM yB42USPM5uMnz2bVPGKDuejMcpxbmlB7qdoA0c7eJWPn4i+vXxbLxJZMAHKC0sX/08iF ND0CSC/23D27rmPLuD6HfXNTLa7pbnp10SWDeyE75C0ra+c9MJrDiUL6Z5sTSDLTm+0V F3tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781156017; x=1781760817; h=content-transfer-encoding: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;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: by 2002:a05:7300:7490:b0:304:e72a:d4d9 with SMTP id 5a478bee46e88-308049eb621mr1178528eec.19.1781156017229; Wed, 10 Jun 2026 22:33:37 -0700 (PDT) X-Received: by 2002:a05:7300:7490:b0:304:e72a:d4d9 with SMTP id 5a478bee46e88-308049eb621mr1178509eec.19.1781156016690; Wed, 10 Jun 2026 22:33:36 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, matheus.bernardino@oss.qualcomm.com, pierrick.bouvier@oss.qualcomm.com, ltaylorsimpson@gmail.com, philmd@mailo.org, philmd@oss.qualcomm.com, Matheus Tavares Bernardino Subject: [PATCH v6] target/hexagon: Add guest reg reading functionality Date: Wed, 10 Jun 2026 22:32:49 -0700 Message-Id: <20260611053249.3918491-29-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260611053249.3918491-1-brian.cain@oss.qualcomm.com> References: <20260611053249.3918491-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: E_f2KD963XHNxfEuIhVy2FlV6MUhyu_T X-Authority-Analysis: v=2.4 cv=B9eJFutM c=1 sm=1 tr=0 ts=6a2a48b2 cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=COk6AnOGAAAA:8 a=pGLkceISAAAA:8 a=IJQQmebJWjVxhimlKuwA:9 a=QEXdDO2ut3YA:10 a=scEy_gLbYbu1JhEsrz4S:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjExMDA1MiBTYWx0ZWRfX4LSUFNltYG3B Qf9exoipw8SVRE2cOwV4RblJCmBe+Ma8XxR217sYpLQSqCECwNF6zLiTCVFX57r6H82uXNugNj3 RKSZ3K1B4eAxSZ0Ot3U1H+2Ziw5XSqPrQceq+xVV6drhFWZ6GyyXHVuj4OyJyEmVjQ2wP8Kqugg BvKhSVeWBVO9Y26FrFvdtzw1OQ+JgjtTFR363CVeug2PkEJggDXYGKngtVKUSyK52tvxK/flDWW OrNltgo8j7wSXp0XECYhjWNMsa86rBINOD3IhZdS9HE9cXA95BS21pA7697khOWDGobD5fE1Sqb wXk8+yoHh8VB2pjrImAICdgIxPSaKj3Qwk649CviXQtDR67bAJ51AzuImPF7fQsx6abVcVWMlhr L2uZr4HeEpkBIB/h9V8m9txBrsONNozB87SLO0eiCSNCQEK9YFNTv9O+Dus485+fG8cHgaT8doR SosKiqnWGjm5Qvm5sWw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNjExMDA1MiBTYWx0ZWRfX1nRsEdeQ3xcm /+kBL7xLnJcA9YSF2k88u7wFXi17mY2KVUgKapn8OUsYELdUzm/eJpJYCirdSmjJLCI0/JZitu/ V5prnq9jo3G+yPCg3iazhnJMQT+2Z4I= X-Proofpoint-ORIG-GUID: E_f2KD963XHNxfEuIhVy2FlV6MUhyu_T X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-11_01,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606110052 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: 1781156232650158500 From: Matheus Tavares Bernardino Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Taylor Simpson --- target/hexagon/cpu.h | 1 + target/hexagon/cpu.c | 19 +++++++++++++++++++ target/hexagon/op_helper.c | 16 ++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 6a95a6bc5b1..4a12dc04727 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -220,6 +220,7 @@ G_NORETURN void hexagon_raise_exception_err(CPUHexagonS= tate *env, * not stopped. */ bool hexagon_thread_is_enabled(CPUHexagonState *thread_env); +uint32_t hexagon_greg_read(CPUHexagonState *env, uint32_t reg); void hexagon_cpu_soft_reset(CPUHexagonState *env); #endif =20 diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 11a1a52216c..4fe09021a5d 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -769,6 +769,25 @@ static void hexagon_cpu_class_init(ObjectClass *c, con= st void *data) #endif } =20 +#ifndef CONFIG_USER_ONLY +uint32_t hexagon_greg_read(CPUHexagonState *env, uint32_t reg) +{ + if (reg <=3D HEX_GREG_G3) { + return env->greg[reg]; + } + switch (reg) { + case HEX_GREG_GPCYCLELO: + return hexagon_get_sys_pcycle_count_low(env); + case HEX_GREG_GPCYCLEHI: + return hexagon_get_sys_pcycle_count_high(env); + default: + qemu_log_mask(LOG_UNIMP, "reading greg %" PRId32 + " not yet supported.\n", reg); + return 0; + } +} +#endif + static void hexagon_cpu_class_base_init(ObjectClass *c, const void *data) { HexagonCPUClass *mcc =3D HEXAGON_CPU_CLASS(c); diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 43220a121f6..7d78a626507 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1877,13 +1877,25 @@ uint64_t HELPER(sreg_read_pair)(CPUHexagonState *en= v, uint32_t reg) } =20 uint32_t HELPER(greg_read)(CPUHexagonState *env, uint32_t reg) + { - g_assert_not_reached(); + return hexagon_greg_read(env, reg); } =20 uint64_t HELPER(greg_read_pair)(CPUHexagonState *env, uint32_t reg) + { - g_assert_not_reached(); + if (reg =3D=3D HEX_GREG_G0 || reg =3D=3D HEX_GREG_G2) { + return (uint64_t)(env->greg[reg]) | + (((uint64_t)(env->greg[reg + 1])) << 32); + } + switch (reg) { + case HEX_GREG_GPCYCLELO: + return hexagon_get_sys_pcycle_count(env); + default: + return (uint64_t)hexagon_greg_read(env, reg) | + ((uint64_t)(hexagon_greg_read(env, reg + 1)) << 32); + } } =20 /* --=20 2.34.1