From nobody Wed Apr 8 02:53:14 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=1773202331; cv=none; d=zohomail.com; s=zohoarc; b=K2KbVbPvzMChzIaGdmLxjSS8zV7/TE4mRFSkkmlo92ex8vAtELtzttQt2JIKGsNWXPj70LshIjYoUPPKL+YeyTnPipMEd+KS2wnWWZ2Zuw9BIphDKZZk7IZFw+a/HV+8Gg1KQKEGngy/12jMAi/vRSoV3/LJQaon5E3/SZZZ4oI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773202331; 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=ff4FH4KD/KqDDp9J54RDLlHX3Ej/XN2N2unxc6XHPMI=; b=PM8h+i0twmjiXqzVebJt42fOMl7xmxpBWVuhTSQaazeT5q9/6LtcwkcyMPQJSQAFCNq+3wtsSGqBCfxvKwoKcxUiRwPYHv+iO/73AUOENIlVwumzn2wckDd5iAWovX4QwIbnakP/e4ENnCAmm99VIKVeUFpbLzJ0iEzIa3+arJg= 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 1773202331694401.23130668699696; Tue, 10 Mar 2026 21:12:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Asa-0000z5-76; Wed, 11 Mar 2026 00:09:04 -0400 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 1w0AsW-0000xE-Hp for qemu-devel@nongnu.org; Wed, 11 Mar 2026 00:09:00 -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 1w0AsS-000075-G8 for qemu-devel@nongnu.org; Wed, 11 Mar 2026 00:08:57 -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 62B3PlB12179858 for ; Wed, 11 Mar 2026 04:08:45 GMT Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ctqvsstgd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 11 Mar 2026 04:08:45 +0000 (GMT) Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-415e1e9aa5dso63639971fac.0 for ; Tue, 10 Mar 2026 21:08: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 586e51a60fabf-4177e5ea30asm998656fac.10.2026.03.10.21.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 21:08:43 -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= ff4FH4KD/KqDDp9J54RDLlHX3Ej/XN2N2unxc6XHPMI=; b=p0a6G6XA3d4tqzLV YTRjWtS3R3f8u2sLzM95fK3Z8TbFlI4WJeShxHKYFbbNyzEIXNeImp5CIo0rcA4B H8QYf9yRvYkLpVlThvyd/ZLImUCsys0KCXWSzvw2CMo1iRWD8poQoD8DiDw2jTgD jARrqaNLmmBQnmo9rGdh5O3CNy/tCHVePMcf0C5vkHyhS0+QbtSdPi4DVfEqnkhj PEIBwrmJj/WQpvB4jUfCHmb2mCXO4TOopYgBJP5FWYLoM+VefDkxLCUsXll1xF1Y pkODRJ9k10coVHSj33Bp0PQ56sE1jNW97IDl+4QsQB8JGjYNELUAxel3APA6Jq6W RAmWIA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773202124; x=1773806924; 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=ff4FH4KD/KqDDp9J54RDLlHX3Ej/XN2N2unxc6XHPMI=; b=ZxEFdkBkzc56NwwZJ9UgQ/jdEWGtluOg3nvgzc9GrFYrC7B4MrOomCdIm0HxAmuBV2 PZhe3esRRO7ix2zadZu/4h9HnVLbYhJycPffKpBaDyZQ6pchq9Qs5gFY8wqe1ze7prxg b1ghKSSftSGsOhrnoRCssusowFO8q0VbH0Hnaktt2kgFot3f5WxcZwh2mxbDb5oMr4ah fnmwdS1wmlgGdVWy/wkaNwY9BMAd8inzzlee0locAXN3ql/ycGNWOrwVDSA9i6PZKu9Z S0HuTAuD57s0REzA3waKbNuwRSO65/0daXQfDGvkMcngSlv3CQ8M7GxXq5FyEfJ45eJQ ZLXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773202124; x=1773806924; 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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g== X-Received: by 2002:a05:6871:5d05:b0:40e:dadc:4a01 with SMTP id 586e51a60fabf-4177c969755mr916488fac.46.1773202124537; Tue, 10 Mar 2026 21:08:44 -0700 (PDT) X-Received: by 2002:a05:6871:5d05:b0:40e:dadc:4a01 with SMTP id 586e51a60fabf-4177c969755mr916468fac.46.1773202124077; Tue, 10 Mar 2026 21:08:44 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, philmd@linaro.org, ltaylorsimpson@gmail.com, matheus.bernardino@oss.qualcomm.com, marco.liebel@oss.qualcomm.com, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com, ale@rev.ng, anjo@rev.ng, Brian Cain Subject: [PATCH v3 28/32] target/hexagon: Add PC to raise_exception, use fTRAP() helper Date: Tue, 10 Mar 2026 21:07:54 -0700 Message-Id: <20260311040758.1068731-29-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260311040758.1068731-1-brian.cain@oss.qualcomm.com> References: <20260311040758.1068731-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: AW1haW4tMjYwMzExMDAzMiBTYWx0ZWRfXygdR5CR269sR dvT7K7rMdMYNQa8LZh1DYPZvVDeQrbkUapYv85FAqIRKeAXy0uc0SEuu+Sk2hGi1eEvCaFOCuBC eC3FpmGRUtUEiTmYfxNx4REih3Iw8i9HQSRjJBnYqlheBpZEA7zlyAszYy8C3qGcsN64Uu0O58G MMJus8GTaYba+C5/vahT+vSpqRwJl4LxFjnpIPp9lYmxmdRms2brTHfoPb8lV8yoCxrNV3BTmNN ZvJSOHtazeVPlMQrg7zA/zNgY7Gfr8imLL4bBrDJu5IVBS0gJn27QAHC5yIEHVn6E+ZRop+dlnR NcS7NvGMVhw0dmitvfXOSdk5rRk1WynqU/phDLO7o62JMfvMZNoGfD/eVDP9g5hvDDJwPQwYXkk i1tudpTiqUltNYurmL5REIuub3E+WlAZP2kl2DCOy5eaQE1kPAH10Oi8tJKvAelJLZ2C82JmYPR AUjjatMNzLJTZBp9A5A== X-Proofpoint-ORIG-GUID: 7qmXktXxaTmG7c0jB8ZgiUVYTsL1Pmim X-Authority-Analysis: v=2.4 cv=Lo2fC3dc c=1 sm=1 tr=0 ts=69b0eacd cx=c_pps a=nSjmGuzVYOmhOUYzIAhsAg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=4FQt9sIIQT5CW9ciUtIA:9 a=QEXdDO2ut3YA:10 a=1zu1i0D7hVQfj8NKfPKu:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 7qmXktXxaTmG7c0jB8ZgiUVYTsL1Pmim X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-10_05,2026-03-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 impostorscore=0 bulkscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603110032 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.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: 1773202331800158500 From: Brian Cain Add PC to raise_exception helper Replace the fGEN_TCG_J2_trap0 macro override with the fTRAP()-generated system helper instead. Signed-off-by: Brian Cain Reviewed-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 7 ------- target/hexagon/helper.h | 2 +- target/hexagon/op_helper.c | 10 ++++------ target/hexagon/translate.c | 20 +++++++++++++++----- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index bd04386d860..507d529c4b2 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -1369,13 +1369,6 @@ #define fGEN_TCG_S2_storew_rl_st_vi(SHORTCODE) SHORTCODE #define fGEN_TCG_S4_stored_rl_st_vi(SHORTCODE) SHORTCODE =20 -#define fGEN_TCG_J2_trap0(SHORTCODE) \ - do { \ - uiV =3D uiV; \ - tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->pkt->pc); \ - TCGv excp =3D tcg_constant_tl(HEX_EVENT_TRAP0); \ - gen_helper_raise_exception(tcg_env, excp); \ - } while (0) #endif =20 #define fGEN_TCG_A2_nop(SHORTCODE) do { } while (0) diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index 17e74b12f3c..a89758b5df5 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -18,7 +18,7 @@ #include "internal.h" #include "helper_protos_generated.h.inc" =20 -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32) +DEF_HELPER_FLAGS_3(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32= , i32) DEF_HELPER_2(commit_store, void, env, int) DEF_HELPER_3(gather_store, void, env, i32, int) DEF_HELPER_1(commit_hvx_stores, void, env) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 89712bf8e09..3720f2679da 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -65,15 +65,13 @@ G_NORETURN void hexagon_raise_exception_err(CPUHexagonS= tate *env, uint32_t exception, uintptr_t pc) { - CPUState *cs =3D env_cpu(env); - qemu_log_mask(CPU_LOG_INT, "%s: %d\n", __func__, exception); - cs->exception_index =3D exception; - cpu_loop_exit_restore(cs, pc); + do_raise_exception(env, exception, pc, 0); } =20 -G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t exc= p) +G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t exc= p, + uint32_t PC) { - hexagon_raise_exception_err(env, excp, 0); + hexagon_raise_exception_err(env, excp, PC); } =20 void log_store32(CPUHexagonState *env, target_ulong addr, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index ddf328e0a62..e4a0993c88a 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -124,12 +124,19 @@ intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regn= um, return offset; } =20 -static void gen_exception_raw(int excp) +static void gen_exception(int excp, uint32_t PC) { - gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp)); + gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp), + tcg_constant_i32(PC)); } =20 #ifndef CONFIG_USER_ONLY +static inline void gen_precise_exception(int excp, uint32_t PC) +{ + tcg_gen_movi_i32(hex_cause_code, excp); + gen_exception(HEX_EVENT_PRECISE, PC); +} + static inline void gen_pcycle_counters(DisasContext *ctx) { if (ctx->pcycle_enabled) { @@ -213,8 +220,11 @@ static void gen_end_tb(DisasContext *ctx) void hex_gen_exception_end_tb(DisasContext *ctx, int excp) { gen_exec_counters(ctx); - tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->next_PC); - gen_exception_raw(excp); +#ifdef CONFIG_USER_ONLY + gen_exception(excp, ctx->pkt->pc); +#else + gen_precise_exception(excp, ctx->pkt->pc); +#endif ctx->base.is_jmp =3D DISAS_NORETURN; } =20 @@ -228,7 +238,7 @@ static void gen_exception_decode_fail(DisasContext *ctx= , int nwords, int excp) =20 gen_exec_counters(ctx); tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], fail_pc); - gen_exception_raw(excp); + gen_exception(excp, fail_pc); ctx->base.is_jmp =3D DISAS_NORETURN; ctx->base.pc_next =3D fail_pc; } --=20 2.34.1