From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120887; cv=none; d=zohomail.com; s=zohoarc; b=feJYnMeqRRbAMC5WFr82LfEUvVbQnlyfTI8WA85uLsZ4j/VgMXFWq6QNfW0+7vww4SLBbUe5JWkaseDOW2peKyUWredvOeE9xm+v0RRndsVYkWQMgzbM5JC4xuDKlf1rAiKGKGexaiQPdW6Dz39NGHeakYjU9fC4UTdxV7/2Yq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120887; h=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=9dy3qf6IaLVQUOCpdCYB+Cic6TeM6A0aGthPw78OLaY=; b=Cv2NkmBBaTWu//4ZImT33LuN0B/7WO6OndWh2P2GrQiQzaZZ4jjBxH+vPXLasJoVsQNY6TYzXgcZrGnW5uLxBIdrNGY1HJ5BjSQXL7AYpE6/EQ9LK1RAIyEDwJwvpttvtcOew+QyTBq/ObL4OdfHsjqqW0QOSX7KPbpqlrPNtIc= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120887093338.8840608717436; Thu, 19 Nov 2026 12:41:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vO-0003DQ-0A; Thu, 19 Nov 2026 15:40:06 -0500 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 1xU8v6-0003Az-O4 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:51 -0500 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 1xU8v3-0007ID-9Q for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:48 -0500 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 6AJJ1St51671586 for ; Thu, 19 Nov 2026 20:39:42 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1x70bc1x-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdfud3570559; Thu, 19 Nov 2026 20:39:41 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 6AJKdfvA3570548 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 6ED8B23D1D; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=9dy3qf6IaLV QUOCpdCYB+Cic6TeM6A0aGthPw78OLaY=; b=BYXWQfXr+pMY10T1o8GxwrQELxh 4kfWCVLbPAxuuWAHlfA5OrQUwTih9fhWQ8lQpGZBd0qL67BJHzQlqo7vhMR2lJmL DWLVkfM1Gj47QpILmE79wzoJTlB7O7NEq5cghQ6RRvOOT8mKlZ8ig+gRem/hZ5Op 3SgXfuzBwBu0uVxOX26lha3i69mDY1bXTGEl+A8VD6tyAocT/J5sh4Fq4o1lFL+n SlELTJCFI1MYTGgWI5yAbAjVdSXbSnR7giDy733RK3jL4v/wzga+xH/iIhB3KWFP wWAKRpH7y4JRMOQ17MfToWJyzsIcI4fySt3orDJfLELZGNMoqM40MpSgjaw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 01/13] target/hexagon: allow writes to V85 USR coprocessor fields Date: Thu, 19 Nov 2026 12:39:29 -0800 Message-ID: <20261119203941.899748-2-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: fnRTYkQTx22JO0u24dI6ci8TWe-HhIyB X-Authority-Analysis: v=2.4 cv=RdgFmFtv c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=pwpJZb41pcAE4D4LGfYA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX6sFKykCNaVeF PWX29HtW/q0X9z/d/WraM/OjCC1McbIP+WM+dxLspNEre9QAeF+DlJ2F0SQ1DGMBddX9TN2vzmj Df5vrC43QE3tH8wwMxxcCfAWHW7BjS4= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX0d3TpVjyqjWe R/WIe4ZrL0mp78z0XxWFjg3clutGr+t8GBsWjVwjwyJy3LbXfgcUwf9A0kgHEIAmenrQM1q9obb nF1WRbZzDVMQeESI4oIDdRVzRbpCR9rRJBSmUQjmwBVIwnG+zIjVW+ujTfjQ63KnPxOm0LPMeiG g4U6mBCXqRQmjo82btNMpmBZoldFhb1iA8wzpmUc9NFvRbDl4o8tr8GOzyv5+jolBYcaBQ9rVwX ydLSnJsknwDhZgoPCnE4UhrdiGu3Zvv9jvr/zaLaI7kQTTStfkMHkECXfrhat9+SyPVM2SdqCae PhpZYniTtm5jgPe3ty6O17h3vj+q4VASYOuMkj3FATSN0yj+ha/ARtYBcOI5zzifHGXMzbbF732 YQQ5FjOEs/MHDYXD6yTXGZlN5+nt0HWjQBPHg7rQShOnhfmbNwRLzOokOFQROQ9iYDJMFZSf9ax kj0R5vsji314Sb9demQ== X-Proofpoint-GUID: fnRTYkQTx22JO0u24dI6ci8TWe-HhIyB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 phishscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120887784158500 Content-Type: text/plain; charset="utf-8" NPC and FPCOPROC are writable on V85. Remove them from the immutable mask for that revision, without changing older CPU models. Signed-off-by: Marco Liebel --- target/hexagon/genptr.c | 6 +++++ target/hexagon/reg_fields_def.h.inc | 2 ++ tests/tcg/hexagon/meson.build | 2 ++ tests/tcg/hexagon/packet_user.c | 35 +++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 tests/tcg/hexagon/packet_user.c diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 52615628e3..d226cc4ebb 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -562,6 +562,12 @@ static inline void gen_write_ctrl_reg(DisasContext *ct= x, int reg_num, /* USR.FPSAT is reserved before v79 */ reg_mask &=3D ~fGET_REG_FIELD_MASK(USR_FPSAT); } + if (reg_num =3D=3D HEX_REG_USR && + ctx->hex_def->hex_version >=3D HEX_VER_V85) { + /* V85 permits writes to NPC and FPCOPROC. */ + reg_mask &=3D ~(fGET_REG_FIELD_MASK(USR_NPC) | + fGET_REG_FIELD_MASK(USR_FPCOPROC)); + } gen_masked_reg_write(val, hex_gpr[reg_num], reg_mask); tcg_gen_mov_tl(get_result_gpr(ctx, reg_num), val); if (reg_num =3D=3D HEX_REG_QEMU_PKT_CNT) { diff --git a/target/hexagon/reg_fields_def.h.inc b/target/hexagon/reg_field= s_def.h.inc index 32dbb2da30..4c0bd4674a 100644 --- a/target/hexagon/reg_fields_def.h.inc +++ b/target/hexagon/reg_fields_def.h.inc @@ -29,10 +29,12 @@ DEF_REG_FIELD(USR_FPDBZF, 2, 1) DEF_REG_FIELD(USR_FPOVFF, 3, 1) DEF_REG_FIELD(USR_FPUNFF, 4, 1) DEF_REG_FIELD(USR_FPINPF, 5, 1) +DEF_REG_FIELD(USR_NPC, 6, 1) =20 DEF_REG_FIELD(USR_LPCFG, 8, 2) =20 DEF_REG_FIELD(USR_FPDAZ, 17, 1) +DEF_REG_FIELD(USR_FPCOPROC, 20, 2) =20 DEF_REG_FIELD(USR_FPRND, 22, 2) DEF_REG_FIELD(USR_FPSAT, 24, 1) diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index 70f6475656..cb2e7e68b2 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -96,6 +96,8 @@ tests +=3D { 'misc.c': {'cflags': [cflags, '-mv71', '-O2']}, 'multiple-writes.c': {'cflags': [cflags, '-mhvx']}, 'overflow.c': {'cflags': cflags, 'exe_name': 'hex-overflow'}, + 'packet_user.c': {'cflags': [cflags, '-O2'], + 'qemu_args': ['-cpu', 'v85']}, 'preg_alias.c': {'cflags': cflags}, 'dual_stores.c': {'cflags': cflags}, 'framekey.c': {'cflags': cflags}, diff --git a/tests/tcg/hexagon/packet_user.c b/tests/tcg/hexagon/packet_use= r.c new file mode 100644 index 0000000000..c4b88a30e5 --- /dev/null +++ b/tests/tcg/hexagon/packet_user.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: BSD-3-Clause-Clear + */ + +#include +#include + +static int err; + +#include "hex_test.h" + +static void test_usr_mask(void) +{ + unsigned old, value; + + asm volatile( + "%[old] =3D usr\n" + "r0 =3D #-1\n" + "usr =3D r0\n" + "%[value] =3D usr\n" + "usr =3D %[old]\n" + : [old] "=3D&r"(old), [value] "=3D&r"(value) + : : "r0" + ); + /* V85 USR writable bits. */ + check32(value, 0x3fffff7f); +} + +int main(void) +{ + test_usr_mask(); + puts(err ? "FAIL" : "PASS"); + return err !=3D 0; +} --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120860; cv=none; d=zohomail.com; s=zohoarc; b=BhBZpLl/9qN92nDqcO8V4sqtW3EeeKA7AaCoQQn6owzo5pa3CazEaZPwg5qPM973c+y/FlvuPqIky5G4y5P8hQvNkkUo+xSQRm682OO1K25raBiBpqwR34oBIcJgUBfLbpgJ0/h2vBahGVpAyYeguTt7HY6qSypV+0Vw2i3dxzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120860; h=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=yIS4w009B5W8zoyCuy0ARodT4hl5V0xOcDO6COikrSo=; b=QUs1RdxMmCz4f2T7MfQJ+Acl0sc/CO0rcHauKxL7qy4sUu95xmxZ4fT78hPyqNs/ElTPf13NPruKLyRNzp0eQVg8t5k+c44a0GwG1ANWdkdwp1v8FtTt+sHGVS86NhNmzhFMCraL88sOGNK9dcj3bmzBZzAdSAbD9VWrHq0cAS0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120860163215.43305071918053; Thu, 19 Nov 2026 12:41:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vV-0003M0-AM; Thu, 19 Nov 2026 15:40:14 -0500 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 1xU8vA-0003B8-0r for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:55 -0500 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 1xU8v3-0007JC-Ty for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:50 -0500 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 6AJKKaKo3366337 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27fyg913-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta05.qualcomm.com [127.0.0.1]) by NALASPPMTA05.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdfoS3577067; Thu, 19 Nov 2026 20:39:41 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA05.qualcomm.com (PPS) with ESMTPS id 6AJKdfuv3577056 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 72A0825229; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=yIS4w009B5W 8zoyCuy0ARodT4hl5V0xOcDO6COikrSo=; b=d87NfaXThQdf8oytR4UT5RLcR77 Cy8uTI1U9/rOLwqWibdn6tFm7uaq3J8A24d8N1mMjxK4gy+JKNv4dWc7EsuErDKL ue5zBuetTZWe/AsoStATZHRf304czHP7S8wz1Rt61w8ak/wzP7ZJNhpzNOLXnKAy pJCwzVTRl/igQO3d5+K1DBe8nIgIkKNSCsinA7CYwus3FQEN3IPMS+4t/2YVAV2X YtTjflHUMHSPZra90KS9LtX7vnwMQj4l+ob5yTr/lUm17VOXty9ficNRMIL4oQ72 rWsg2bIGWuL8HjGZqLA1gHzoHSCyhSr2d7GxG1CS39FPpUbb+2g7FCf5s0g== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 02/13] target/hexagon: suppress LR writes from a losing call Date: Thu, 19 Nov 2026 12:39:30 -0800 Message-ID: <20261119203941.899748-3-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX70eZK9ePN27w 1xHWtMRJmyA9e5l2L7fLiJcBN8fttvepPOScttQKdoJp3XgXXl3BA9SBWvPxY5+FSjQ3uMBvKgU I1EJvhmohgRhSZhlZjxww9kYClf9hAQ= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX0TkWNV8WWcSJ RgNAH2ZuDZ0qAV+WChbmdBDN1mS/zSrwr7WxT72xa1FxTdQnvvcRNyQsF4ZW4iR5F4RwZKPCk7a xf07sCvlgDoNJvSx11QvYiNwitMrt5EBZ4cJF+rdCSVEz4gSkuCjeHi6Qbh8RfmJPIHbmQT3G+I KEtbQm5Fc289Qi0rB1yQ23xwbcnnjC0YOo+rTCJXYNTmJpEmLwUekiQKp1UGL+XqAPxLWu+YnOD xDuXBd9aKJ7lpdm7NvG8IJ5z871THa7wOieQdMt7IB3g0OpNjLb8tdxP8lbZBEdQUkl26KPQmIF MsmSTyCQK5JcT/BWQMHx7wSR2jKu1yhNfr6Xfp2GIuZhvfN5GDfzjlh4KDwkFRoLnVs+WtFlpsn l2PUZbr3sb7YsuVsRM60+aOJ0v1XnnHuZKsjDGPFJ3lzc6M2Y1FBZf53Sw4gXfW+5Aq57w5MY+9 O3LsOwUbAER+GvOGQCg== X-Authority-Analysis: v=2.4 cv=GZKCDgXL c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=8veDVPTrlRqF5xbOnt4A:9 X-Proofpoint-ORIG-GUID: FusAjipwa2p1GKuiSllImvFZrKO1FDVu X-Proofpoint-GUID: FusAjipwa2p1GKuiSllImvFZrKO1FDVu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120861625158500 Content-Type: text/plain; charset="utf-8" A call after a taken branch must not update LR. Guard direct and indirect calls with the packet branch state, and preserve LR when a multi-branch packet uses deferred register commit. Signed-off-by: Marco Liebel --- target/hexagon/genptr.c | 14 +++++++++++--- target/hexagon/translate.c | 4 ++++ tests/tcg/hexagon/packet_user.c | 26 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index d226cc4ebb..954dea6622 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -1058,27 +1058,35 @@ static void gen_jumpr(DisasContext *ctx, TCGv new_p= c) static void gen_call(DisasContext *ctx, int pc_off) { TCGv lr =3D get_result_gpr(ctx, HEX_REG_LR); + TCGLabel *skip =3D gen_new_label(); + if (ctx->pkt.pkt_has_multi_cof) { + tcg_gen_brcondi_tl(TCG_COND_NE, ctx->branch_taken, 0, skip); + } tcg_gen_movi_tl(lr, ctx->next_PC); gen_write_new_pc_pcrel(ctx, pc_off, TCG_COND_ALWAYS, NULL); + gen_set_label(skip); } =20 static void gen_callr(DisasContext *ctx, TCGv new_pc) { TCGv lr =3D get_result_gpr(ctx, HEX_REG_LR); + TCGLabel *skip =3D gen_new_label(); =20 new_pc =3D gen_unalias_gpr_src(new_pc, lr); + if (ctx->pkt.pkt_has_multi_cof) { + tcg_gen_brcondi_tl(TCG_COND_NE, ctx->branch_taken, 0, skip); + } tcg_gen_movi_tl(lr, ctx->next_PC); gen_write_new_pc_addr(ctx, new_pc, TCG_COND_ALWAYS, NULL); + gen_set_label(skip); } =20 static void gen_cond_call(DisasContext *ctx, TCGv pred, TCGCond cond, int pc_off) { - TCGv lr =3D get_result_gpr(ctx, HEX_REG_LR); TCGLabel *skip =3D gen_new_label(); - gen_write_new_pc_pcrel(ctx, pc_off, cond, pred); tcg_gen_brcondi_tl(cond, pred, 1, skip); - tcg_gen_movi_tl(lr, ctx->next_PC); + gen_call(ctx, pc_off); gen_set_label(skip); } =20 diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index ec1d79e31f..10ed73590c 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -495,6 +495,10 @@ static void mark_implicit_reg_write(DisasContext *ctx,= int attrib, int rnum) if (GET_ATTRIB(opcode, attrib)) { bool is_predicated =3D GET_ATTRIB(opcode, A_CONDEXEC); =20 + if (rnum =3D=3D HEX_REG_LR && ctx->pkt.pkt_has_multi_cof) { + is_predicated =3D true; + } + /* LC0/LC1 is conditionally written by endloop instructions */ if ((rnum =3D=3D HEX_REG_LC0 || rnum =3D=3D HEX_REG_LC1) && (opcode =3D=3D J2_endloop0 || diff --git a/tests/tcg/hexagon/packet_user.c b/tests/tcg/hexagon/packet_use= r.c index c4b88a30e5..3ea08a99b2 100644 --- a/tests/tcg/hexagon/packet_user.c +++ b/tests/tcg/hexagon/packet_user.c @@ -27,9 +27,35 @@ static void test_usr_mask(void) check32(value, 0x3fffff7f); } =20 +static void test_call_priority(void) +{ + unsigned lr; + + asm volatile( + "r12 =3D r31\n" + "r31 =3D ##0x12345678\n" + "r0 =3D #0\n" + "p0 =3D cmp.eq(r0,r0)\n" + "{\n" + " if (p0) jump 1f\n" + " call 2f\n" + "}\n" + "2:\n" + "r31 =3D #0\n" + "1:\n" + "%[lr] =3D r31\n" + "r31 =3D r12\n" + : [lr] "=3D&r"(lr) + : : "r0", "r12", "r31", "p0" + ); + /* Losing call preserves LR. */ + check32(lr, 0x12345678); +} + int main(void) { test_usr_mask(); + test_call_priority(); puts(err ? "FAIL" : "PASS"); return err !=3D 0; } --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120853; cv=none; d=zohomail.com; s=zohoarc; b=gZn+0ztPM5pUDVN/vGu5FooT9hxco0LHqy4Ukepczg886o+4F3hDw1/dBhNwqZMaM7+gQCKeTVc6ziHsNg1K3pE8gkPkbHT7gxUG9FqYclJakoJb4TaOGTeTnsVIOSH6oAILTxX8SqxX4G7KmWC7uWXy2Q+S+hsq18szxuNPhoE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120853; h=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=xfRj2/fOUHuLvCHmcF+QIAgUyPKbkygrO3t2TzJ1EKA=; b=GQAMNZEpDL2LtmEoHiLfWLgj3JeH7YrrEdNZQH/PbL49LJfg5izhDJH/tkJ33w6tS42arJaipuvDuNs20jB0wuSZ4qI8e8LXqOdWx6W771wfIqvloKGvrC9gJZCnHunMYGwhSe0JfBar9tENYdOjqh0iqRPovD7K/u7TwMHsrbU= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120853507945.9717548517372; Thu, 19 Nov 2026 12:40:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8ve-0003Me-JY; Thu, 19 Nov 2026 15:40:22 -0500 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 1xU8v6-0003B0-QY for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:52 -0500 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 1xU8v3-0007Ia-9P for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:48 -0500 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 6AJJ1Scn095119 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1b48a-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdfEq3698910; Thu, 19 Nov 2026 20:39:41 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 6AJKdfcH3698901 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 7712825379; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=xfRj2/fOUHu LvCHmcF+QIAgUyPKbkygrO3t2TzJ1EKA=; b=FZ5ipPiK3nLC4X50c4nwdRKjwqO ab2hVZFsgbmPJJyaXyfBsgtLkC7nco6sMox3rSOFpQDULVZ07h4cQUXOa6DjKc5V ZFmp1aXGFp1BQVGuxWYrtovxTK5WhMUxHtQYkXpx+b4SuLZwYqsE/0w0BCG/clJX kzKXNR2VJW7VA+Vn/GGs+IrrFPtGR6CtYJIx3dn68MMu4R0W6ZUQ9HA+L1TUn7uM xF+P9X5Nj2cyz7uRHJF9sy4QVNFar4yPlnSn2lypcCCZArMVNN0cVH+9LxqdzamG Hnqb0t6ZgkKyXwq4+5eWC8Y7/l5U6k0Ke1+8qjc4vylqGYdN7BAI7pl72/w== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 03/13] target/hexagon: reject HMX operands outside VTCM Date: Thu, 19 Nov 2026 12:39:31 -0800 Message-ID: <20261119203941.899748-4-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Authority-Analysis: v=2.4 cv=PcBqFShd c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=AOcVaDlDQPZahzFAqEIA:9 X-Proofpoint-ORIG-GUID: AyQsfOkDkSJZZ8zL8Ob5ePlvi0nyVih5 X-Proofpoint-GUID: AyQsfOkDkSJZZ8zL8Ob5ePlvi0nyVih5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfXwuRy/WUPWqyt 6/a879ynZAcpHFEAzlWIVNVzGpRQMMBljrjc4R9iSp/B5Dj2HfBnAhNje3V9iKO5sBD/E8FZYIs w+AAnxk3iaDfBrXh03azNXX86bRe32Jfm8lcMQ9jFKKEJxl5asFZBcG2x+EUY29lmU6J3/ZfLA8 uICbfvrGG4iglsJrx9SK8qAegTagW9zUoYM+m9JscQi+7LbSkbzEHT+l0utriPnnzPK2Bt0ffmk ycutPR03sSg2zdaFG80xBVPOqhDH9pX7iEAKx2RtQ8HwFeLYJCe+Tr+MT9CmWqnXUwvaG7+8n7G VSkts17NU8heevVHEVf2ULBsqaJbv8Y/M7FVHtgVersV3fkbc18fpc1lN/gSQfbfv9N5Un3pL5S 42Kwi0geYpHxR+jIeK9FtAO5IIBEzUA6LkC1ZUttBcklrNCj+a1Zu/r/jEL1x0kyDQF3RQ8aclo VcyEaXKV22x9Flirquw== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX/F5uKDjW0BLG dpEwMnlafUT1SzI3yzNvwReINAI+X58pttjVLc5NPbKo2clstaivwnWxivbMYZBLSCJzAIIwozg C9kcmJZohXkO/EJGMnZjaO2hIN1qa4Q= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120855760158500 Content-Type: text/plain; charset="utf-8" Check activation and weight addresses against the machine VTCM range before executing packet instructions. An invalid operand raises the precise coprocessor VMEM address error and prevents packet commit. HMX arithmetic remains unimplemented. Signed-off-by: Marco Liebel --- hw/hexagon/hex-subsys.c | 4 ++++ include/hw/hexagon/hexagon.h | 2 ++ target/hexagon/cpu.c | 2 ++ target/hexagon/cpu.h | 2 ++ target/hexagon/translate.c | 26 ++++++++++++++++++++++++++ target/hexagon/translate.h | 4 ++++ 6 files changed, 40 insertions(+) diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index 52ec0cadac..d2e095bb91 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -181,6 +181,8 @@ void hex_subsys_create(HexagonCommonMachineState *hms, sizeof(m_cfg->cfgtable), m_cfg->cfgbase, &address_space_memory); =20 + hms->vtcm_base =3D (uint64_t)m_cfg->cfgtable.vtcm_base << 16; + hms->vtcm_size =3D (uint64_t)m_cfg->cfgtable.vtcm_size_kb << 10; if (m_cfg->cfgtable.vtcm_size_kb > 0) { memory_region_init_ram(&hms->vtcm, NULL, "vtcm.ram", m_cfg->cfgtable.vtcm_size_kb * 1024, @@ -204,6 +206,8 @@ void hex_subsys_add_cpu(HexagonCommonMachineState *hms,= DeviceState *cpu) Object *hmx; =20 object_property_add_child(OBJECT(hms->cluster), "cpu[*]", OBJECT(cpu)); + qdev_prop_set_uint64(cpu, "vtcm-base", hms->vtcm_base); + qdev_prop_set_uint64(cpu, "vtcm-size", hms->vtcm_size); object_property_set_link(OBJECT(cpu), "global-regs", OBJECT(hms->glob_regs), &error_fatal); object_property_set_link(OBJECT(cpu), "tlb", OBJECT(hms->tlb), diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index 2ca4a518db..a856651fba 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -187,6 +187,8 @@ struct HexagonCommonMachineState { MemoryRegion cfgtable_rom; uint32_t cfgtable_data[HEXAGON_CFGSPACE_ENTRIES]; MemoryRegion vtcm; + uint64_t vtcm_base; + uint64_t vtcm_size; DeviceState *cluster; DeviceState *l2vic; DeviceState *qtimer; diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 3575b31d19..effa95534b 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -69,6 +69,8 @@ static const Property hexagon_cpu_properties[] =3D { DEFINE_PROP_LINK("tlb", HexagonCPU, tlb, TYPE_HEXAGON_TLB, HexagonTLBState *), DEFINE_PROP_UINT32("exec-start-addr", HexagonCPU, boot_addr, 0xfffffff= f), + DEFINE_PROP_UINT64("vtcm-base", HexagonCPU, vtcm_base, 0), + DEFINE_PROP_UINT64("vtcm-size", HexagonCPU, vtcm_size, 0), DEFINE_PROP_LINK("l2vic", HexagonCPU, l2vic, TYPE_HEX_L2VIC_INTERFACE, HexL2VicInterface *), DEFINE_PROP_LINK("global-regs", HexagonCPU, globalregs, diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 5739254f1f..1eb6c7d8bf 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -248,6 +248,8 @@ struct ArchCPU { HexagonHMXContextState *hmx_ctx; HexagonTLBState *tlb; uint32_t boot_addr; + uint64_t vtcm_base; + uint64_t vtcm_size; HexagonGlobalRegState *globalregs; uint32_t htid; HexL2VicInterface *l2vic; diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 10ed73590c..3601c4e9f3 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -149,6 +149,20 @@ void gen_precise_exception(int cause, uint32_t PC) tcg_constant_i32(PC)); } =20 +#ifndef CONFIG_USER_ONLY +static void gen_hmx_check_address(DisasContext *ctx, TCGv_i32 address) +{ + TCGv_i64 offset =3D tcg_temp_new_i64(); + TCGLabel *valid =3D gen_new_label(); + + tcg_gen_extu_i32_i64(offset, address); + tcg_gen_subi_i64(offset, offset, ctx->vtcm_base); + tcg_gen_brcondi_i64(TCG_COND_LTU, offset, ctx->vtcm_size, valid); + gen_precise_exception(HEX_CAUSE_COPROC_LDST, ctx->pkt.pc); + gen_set_label(valid); +} +#endif + static void gen_exec_counters(DisasContext *ctx) { tcg_gen_addi_tl(hex_gpr[HEX_REG_QEMU_PKT_CNT], @@ -946,6 +960,16 @@ static void gen_start_packet(DisasContext *ctx) gen_precise_exception(HEX_CAUSE_NO_COPROC2_ENABLE, ctx->pkt.pc); ctx->hmx_check_emitted =3D true; } + if (ctx->pkt.pkt_has_hmx) { + for (i =3D 0; i < ctx->pkt.num_insns; i++) { + Insn *insn =3D &ctx->pkt.insn[i]; + if (GET_ATTRIB(insn->opcode, A_HMX) && + (GET_ATTRIB(insn->opcode, A_PAIR_1OF2) || + GET_ATTRIB(insn->opcode, A_PAIR_2OF2))) { + gen_hmx_check_address(ctx, hex_gpr[insn->regno[0]]); + } + } + } #endif } =20 @@ -1583,6 +1607,8 @@ static void hexagon_tr_init_disas_context(DisasContex= tBase *dcbase, ctx->hlx_coproc_enabled =3D hex_cpu->hlx !=3D NULL && hex_cpu->hlx->contexts_bitmap !=3D 0; ctx->hlx_check_emitted =3D false; + ctx->vtcm_base =3D hex_cpu->vtcm_base; + ctx->vtcm_size =3D hex_cpu->vtcm_size; #endif ctx->branch_cond =3D TCG_COND_NEVER; ctx->is_tight_loop =3D FIELD_EX32(hex_flags, TB_FLAGS, IS_TIGHT_LOOP); diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index bc3b49ab06..f1aa56e463 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -114,6 +114,10 @@ typedef struct DisasContext { DECLARE_BITMAP(lregs_updated_tmp, NUM_LREGS); bool hmx_coproc_enabled; bool hmx_check_emitted; +#ifndef CONFIG_USER_ONLY + uint64_t vtcm_base; + uint64_t vtcm_size; +#endif } DisasContext; =20 bool is_gather_store_insn(DisasContext *ctx); --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120905; cv=none; d=zohomail.com; s=zohoarc; b=kiVetB9fm7+mpjU/e81gCzMSgzHmxPszv9yHNz2H7buP86WUkrp786tYbkPQAkF2ep3lDNMqhc7o+hqfsrr7JmnQIAZxB9NtVHayItJ9bNemiuWaIv/TEaBhqWGcT/vE+Q3/J9kYcKe3cErFUk5urASoHF+MdGjIB1nzDmjEn3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120905; h=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=H7snRXnsDEQo2A4oQdNti29KXhzPkxkFULbOHBbGRDM=; b=ZXo8zAIwfm1EdnpAvjNqyz1OqqKAhcJDH9Wpa9mMdXYRgm2jbF45HBDfP/PEtx0oWs3LFl166Ysedfb1vv5di5YMf1gCHel1haz6sYdlqdvcVNYHzkeoMawKEEnxqpnj+kigriQIqJM/TwP1htmyNVthJU3F8E4Zn1cOUEKcip0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120904940529.3087604168005; Thu, 19 Nov 2026 12:41:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8w2-0003QC-M5; Thu, 19 Nov 2026 15:40:46 -0500 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 1xU8vE-0003BL-KH for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:58 -0500 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 1xU8vC-0007LP-9n for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:55 -0500 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJUXx03367478 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27b5ra7p-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:43 +0000 (GMT) Received: from pps.filterd (nalasppmta03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdfrM1670316; Thu, 19 Nov 2026 20:39:41 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 6AJKdfhR1670297 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 7B9602575D; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=H7snRXnsDEQ o2A4oQdNti29KXhzPkxkFULbOHBbGRDM=; b=cddWjgn6ZpocEJk0c7DEFNb7C+6 JvAbx8aMiyWn8cJymF48nvyqYxN7dOYANysUnisAqNT/x8zYmk/txI8+YkQvE/7O fiHE2GEewau4kzY9dxI+oIq7RgDba8D8Ottgfotq5Mukq76cBnfMGj1b1jU0EMo8 EwfsolzbAjrl1riZCU5LhgBvY/xir6WpxhNLHVDEYnCWp5rq44yF75Kcyc1wjKTp 6LbUh7v5GlJYg9dNjIhmEAAQDnFP8tipiwhYbwhLUepau/oVqRMyI92xcEJC/rC6 7uXqqF0dGlxgkN03DN5S7FM/b1RIyLATPL+W6w7ac9QROeMbRwhCTMD1Pyw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 04/13] target/hexagon: commit coprocessor results before context changes Date: Thu, 19 Nov 2026 12:39:32 -0800 Message-ID: <20261119203941.899748-5-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX011x7u1ro6BI PpzDPWzWf+mCg/iEBlIil/4w9wGbG7FgVsVZri7z5TDSK1yhoV1y85b9qfs6bPyyU5XFQrviyCr 6cUOjCM0m6w559hSzsol5GQcmTwopd4= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfXy/+DlTYgK7go iDV5pfS0ifVxCujDrzlqZCZGa/wFMvnJv/MRpd32dMRt1G6gWaqIC/MXPW224wuBrnuTcMOlmbA suuJmqf39VvPQoN7fIWkXiNcIg1yGWrtIR1M8dBJkY0D6mQrfQepP3i1M+1uOtpsIDGuoFi/Wn5 kV/Ygbsy5j1Z0jRyWXdrGeorh4I+uieDkfzE9n2OeSaUgZGIObmhDPXyCUAAGn79sxvUd42ny1D 08fEo+S2fyb4PNU/V6iwHy7+H4+LuSspN1bvL5c1T5QfsOh6PZHhXQywtxCUG6xxvz+iH4qWioZ mBqm/FGH7Tgw5AW46+B/yb4f+yb4GPHu+tgnYh6p3xedZtbf7t57+Og0Pa2RayWvwMlyKMF/kQQ WxDyW0oYamUY18B990ShqhAWS5kqi1pL+A3AzI/qkKxioQgXWfuzFmnLEoHYY2lYbYIXMuEFFNl n3qU9wR58mVVSEjaDfA== X-Proofpoint-GUID: OTf3hM9jcbiXpUTDlLW8lTNnwH70kaKn X-Proofpoint-ORIG-GUID: OTf3hM9jcbiXpUTDlLW8lTNnwH70kaKn X-Authority-Analysis: v=2.4 cv=LPTz05W9 c=1 sm=1 tr=0 ts=6aff5e8f cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=2ZaAnrbsLTiuA5g7MksA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120905904158500 Content-Type: text/plain; charset="utf-8" A CCR write can detach the HLX context. Commit packet results to the old context before applying system register writes, so clearing XE3 does not abort the emulator. Signed-off-by: Marco Liebel --- target/hexagon/translate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 3601c4e9f3..220328147f 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1482,7 +1482,6 @@ static void gen_commit_packet(DisasContext *ctx) gen_reg_writes(ctx); #ifndef CONFIG_USER_ONLY gen_greg_writes(ctx); - gen_sreg_writes(ctx); #endif gen_pred_writes(ctx); if (ctx->pkt.pkt_has_hvx) { @@ -1494,6 +1493,10 @@ static void gen_commit_packet(DisasContext *ctx) if (ctx->pkt.pkt_has_hmx) { gen_commit_hmx(ctx); } +#ifndef CONFIG_USER_ONLY + /* Context changes must follow writes to the packet's old context. */ + gen_sreg_writes(ctx); +#endif update_exec_counters(ctx); =20 if (ctx->pkt.vhist_insn !=3D NULL) { --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120853; cv=none; d=zohomail.com; s=zohoarc; b=DeYzKrENvnOJyGpqtLtsXxGcfXVCI6keYYWZzuttSrwbWuczjsFBQ65kirrQQD9CvKCZyXYOkTFb4S7LglWPA4sZ4oyJStORp3ffm0dymACgivFw+Xu2dUVcNiA94cjr3JGsBW4GbJxhHonTtmmANn1P5aT16TYly/2ZZth0gmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120853; h=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=WfEpdar0kA213KLzSJxLmMtq23Gd5/8FW4eBSEmojFc=; b=YtXR1Z43oT+guO9EKAHaSr+DVYvqczu+3gElSekSm+IZNPbOhSOg3yhlFqbZ+rH9pxn399R/4dNbtuChKvPlJGyWgXl8yPd1bhWap2btSxoxuem6bjqYkN7a6JsickMmOZEf0MBt24dy9RAsE214gqZhVIP5yCuYobFYjNrKu+4= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120853472500.97672865641175; Thu, 19 Nov 2026 12:40:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vk-0003N2-I5; Thu, 19 Nov 2026 15:40:29 -0500 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 1xU8vA-0003B9-1X for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:55 -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 1xU8v3-0007IY-Ol for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:49 -0500 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1L8Q373665 for ; Thu, 19 Nov 2026 20:39:42 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xymjyjk-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta04.qualcomm.com [127.0.0.1]) by NALASPPMTA04.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdgbH3657757; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA04.qualcomm.com (PPS) with ESMTPS id 6AJKdfar3657747 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 802B82577C; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=WfEpdar0kA2 13KLzSJxLmMtq23Gd5/8FW4eBSEmojFc=; b=Oe5g1MQ3XEIaGiMaHmKTJsbgQAW UuwaQV7kxWY3RYsKJDjv8BOzZmPiL8nAbSMryu9WGDMSPhCtyKjmuwZP9ES+STkl W8e0BnVYkguH50mEDDGYF/a5THJwL4xOAOHVykFpg/sI6XgZ6pGpDZl8PlfmjKnj vpN8ZQDX1HV2KfoVMIgT5hQSs7Y4W7KiuNU9PTy1MqW54U3ZKWbXquNFcd4XX+48 x7XzNeLlClVYcuZH93YbK/o352KdQic/x8TraBYbrLPSSn81QKKelHWe/o5S3MDD Qnd5WIy76QpcDB8B85ViI6Dzw6zQkP4s8n4ubRYwvVNSJvnSJUAJvrnG5yA== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 05/13] target/hexagon: distinguish packet-page instruction TLB misses Date: Thu, 19 Nov 2026 12:39:33 -0800 Message-ID: <20261119203941.899748-6-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfXwPuh/+7/mplK lbTaHBqG169hd+e+O2lKegP4E+VDLnQLVcAF77sWNncyIG2NFQtJQnZjwFTs7NNRwRQ/8jx7Pca pbiwFylGtpMe5r8UAmAov+Z/7AXuf8E= X-Proofpoint-GUID: PXM9o92oY7H7KjdL41vravgtvUQSe29I X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX30gVJ/XPd7Lv CnUsNvcHs+CJOF3OWKkWMPmBrc9Y8qw7Xfg3LKFQyOvFG0bOUsFpXhOLHTnAKTPwQ5sxqehw8UW +DYH0p2JqQVb9bS89D5r970u9oLUMN6gZYMT3bmAV0jKxQP8EPRR22R/VAS5mmJKEPIlCSEDLnY HawoPOywuoG24v87r5Qz+slo979DvQEwMFw933Mt/+aM9siV6nnYxOsHegWg3HCNVID/VYq8Oma CaHYtogOqtIKS0mfa8taDnhKNgrkXG5zxfHMIPmJsmFMLEyqv9ZIn9/vYTMpzt8kjrbmeKivLAA +df4PlRgUtHKyOM1Vxa4JuImMYVrhuol9SFj/muxpVLAKBKjfHVP7wjIEBmsJHFta17TuznDgVD m7MfDthtX1l9AS+WchqKgr/bj/u/NaC4E2DwbX9b45qdGveusdD/ztBtTsNUM8XDfC9wHf1mQOT sW4Ein9xO8mhszXmG2w== X-Proofpoint-ORIG-GUID: PXM9o92oY7H7KjdL41vravgtvUQSe29I X-Authority-Analysis: v=2.4 cv=WKPqzXsR c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=y542WfLQcSmRoA_04BIA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 adultscore=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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.168.131; envelope-from=mliebel@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, 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: 1795120855701158500 Content-Type: text/plain; charset="utf-8" A page-aligned fault address does not imply a straddling packet. Compare its page with the packet PC page to select cause 0x60 or 0x61. Signed-off-by: Marco Liebel --- target/hexagon/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index effa95534b..1159b0cac9 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -786,7 +786,8 @@ static void raise_tlbmiss_exception(CPUState *cs, uint3= 2_t VA, int slot, switch (access_type) { case MMU_INST_FETCH: cs->exception_index =3D HEX_EVENT_TLB_MISS_X; - if ((VA & ~TARGET_PAGE_MASK) =3D=3D 0) { + if ((VA & TARGET_PAGE_MASK) !=3D + (env->gpr[HEX_REG_PC] & TARGET_PAGE_MASK)) { env->cause_code =3D HEX_CAUSE_TLBMISSX_CAUSE_NEXTPAGE; } else { env->cause_code =3D HEX_CAUSE_TLBMISSX_CAUSE_NORMAL; --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120884; cv=none; d=zohomail.com; s=zohoarc; b=oFjswuSM8wub5QHzZJJU25OEXIyqzSJfzBQNX0awg/73hcCH+DUKtFneGaZyjQhymwdyjUIHX2CB+6VQeK3nWJsszBKb5fDSMyy886wOWYpgPjdE7qLPtU9hcqFNL+J0z5M9SGhCUUSFtp5RTvOxHNIhO54aI8vnsEE5BvGXQ8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120884; h=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=4iT11E3LHVEBfqejpW9UwuSL/16Wu6MMPFRqencprq8=; b=dJku0BDQ5sqYsPB5LRQVgqDKXpuCOwoByPWAAocNg54OqicOifEKPnKcDmBxebWxbUrmMoUo/C+LnArT0Ck5T2ANN8iyKenxSrWSCR4l4UM8H3psxM/eRAGoCRUWFpkHrL28vxQz6SjA7cyqpKssmEaMe+tiG88BHs1abtwT3mg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120884007953.7555739797302; Thu, 19 Nov 2026 12:41:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vl-0003NM-9L; Thu, 19 Nov 2026 15:40:29 -0500 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 1xU8vA-0003BB-2D for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:56 -0500 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 1xU8v3-0007JE-SQ for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:49 -0500 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 6AJJelJT3279091 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27fyg914-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdfAD1670338; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 6AJKdfXq1670301 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 84D162577E; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=4iT11E3LHVE BfqejpW9UwuSL/16Wu6MMPFRqencprq8=; b=EzFIjLICIvxqgjEEnkFzbHWN7oq Olj+ItZ1rs3aOJxHsC7BaFYZZLHY+FdM3OorVmELIuuE2/rVda6ikW+aiOimAE7N IE4qJcqv5zi2KHJUuSHsEZwxfnb4OOXKtGUKQOZGreHmarX6cghjiBoJpYR/xddN 5JYlepHSQoW4r08peBuoBBx8J/UJsCJcaYE96UjUNJBdlsIhcFvrl9eP4Bvk4N5M fvuiDRFW9CDkEib0WmlZRF7iTAuDXe6+Q09ZLlfA8xLYINg4D+2yiwp0n/431I6n AuraD8Pv968Nnb2a+CtzeeHxTxl5nk/dz7oN8dDgynREiJWEuzFpe4qC+Ig== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 06/13] target/hexagon: report the faulting memory slot Date: Thu, 19 Nov 2026 12:39:34 -0800 Message-ID: <20261119203941.899748-7-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX39QEHASYDnrC 7DHepfjf66mzFZ9ktA/y8Uyiy6JfenVyrgfVQqLdiOioamHvMc9PEBNZRtdyVXMZLmsYYaxQcns rAfUVvLuC7D2+gpNBH9c3Y2eUuxNxyg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX0AqVurm+l8JS lGf9dQifdyseKDCdyldS3XwNw2slXPnzwmLotCqSHn2GhuFtt0TqpZnE/cSo1FJ2ZM0JSr40Uq2 ipxepmZxrUtzxREPunq25jBySHaUssXhxRGfRUbLeNmXhY4gNl0ozbZPyhW8omtBsl8G+/7rWfr Pjv6Dc9FFZh952dUHjgiXBXFutlq2eAm/Mzp7Ww7qbfq7ybYPBj6cRcdkoYXaRDLcGA8AaCN16b zFf/APeO0gLgNndAlxnOZ8N78MsNRfMKkz0ChdjDDouW1/bUZV8sj+/cFURk9CqiZX/Oqay1zHQ LWuTrdkGzsER2Kx/cnpXuS3aJ0NuaFVx+9sSWYITzaJvi2ImjrizpbAKIAnR29HhPe6nxo8yDAj ogVOXEU06WyzL4ha+t1oKalQ8LR2V/RveHC8VC2/f872Q6NJ7dC/+81pV13NUtr56V7qVA7Mk8x yka3AMrdpRd1XwAJr/g== X-Authority-Analysis: v=2.4 cv=GZKCDgXL c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=uZvwfCfAbIog8kgrQSkA:9 X-Proofpoint-ORIG-GUID: jREK2SxlW0QvibsVFaO74njud8ecsXd0 X-Proofpoint-GUID: jREK2SxlW0QvibsVFaO74njud8ecsXd0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120885955158500 Content-Type: text/plain; charset="utf-8" Track the slot during memory execution and store probes. Use it for TLB and alignment faults so a slot 1 fault selects BADVA1 and BVS. Signed-off-by: Marco Liebel --- target/hexagon/cpu.c | 4 ++-- target/hexagon/cpu.h | 2 ++ target/hexagon/op_helper.c | 6 ++++++ target/hexagon/translate.c | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 1159b0cac9..11d622948e 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -836,7 +836,7 @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr addres= s, int size, uintptr_t retaddr) { CPUHexagonState *env =3D cpu_env(cs); - int slot =3D 0; + int slot =3D access_type =3D=3D MMU_INST_FETCH ? 0 : env->mem_slot; hwaddr phys; int prot =3D 0; uint64_t page_size =3D 0; @@ -918,7 +918,7 @@ void hexagon_cpu_do_unaligned_access(CPUState *cs, vadd= r addr, { CPUHexagonState *env =3D cpu_env(cs); =20 - raise_misaligned_exception(cs, addr, 0, access_type); + raise_misaligned_exception(cs, addr, env->mem_slot, access_type); do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], retaddr); } diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 1eb6c7d8bf..d6a513988c 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -165,6 +165,8 @@ typedef struct CPUArchState { #ifndef CONFIG_USER_ONLY /* Some system registers are per thread and some are global. */ uint32_t t_sreg[NUM_SREGS]; + /* Slot of the memory operation currently being executed or probed. */ + uint32_t mem_slot; =20 uint32_t greg[NUM_GREGS]; =20 diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 71b27ef07f..be5ce7d89c 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -441,6 +441,9 @@ static void probe_store(CPUHexagonState *env, int slot,= int mmu_idx, bool is_predicated, uintptr_t retaddr) { if (!is_predicated || !(env->slot_cancelled & (1 << slot))) { +#ifndef CONFIG_USER_ONLY + env->mem_slot =3D slot; +#endif uint32_t width =3D env->mem_log_stores[slot].width; target_ulong va =3D env->mem_log_stores[slot].va; probe_write(env, va, width, mmu_idx, retaddr); @@ -455,6 +458,9 @@ void HELPER(probe_noshuf_load)(CPUHexagonState *env, ta= rget_ulong va, int size, int mmu_idx) { uintptr_t retaddr =3D GETPC(); +#ifndef CONFIG_USER_ONLY + env->mem_slot =3D 0; +#endif probe_read(env, va, size, mmu_idx, retaddr); } =20 diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 220328147f..3105101aa3 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1019,6 +1019,13 @@ static void gen_insn(DisasContext *ctx) { uint16_t opcode =3D ctx->insn->opcode; =20 +#ifndef CONFIG_USER_ONLY + if (GET_ATTRIB(opcode, A_LOAD) || GET_ATTRIB(opcode, A_STORE)) { + tcg_gen_st_i32(tcg_constant_i32(ctx->insn->slot), tcg_env, + offsetof(CPUHexagonState, mem_slot)); + } +#endif + if (GET_ATTRIB(opcode, A_RELEASE) || GET_ATTRIB(opcode, A_CVI_SCATTER_RELEASE)) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); @@ -1175,6 +1182,10 @@ void process_store(DisasContext *ctx, int slot_num) } { TCGv address =3D tcg_temp_new(); +#ifndef CONFIG_USER_ONLY + tcg_gen_st_i32(tcg_constant_i32(slot_num), tcg_env, + offsetof(CPUHexagonState, mem_slot)); +#endif tcg_gen_mov_tl(address, hex_store_addr[slot_num]); =20 /* @@ -1221,6 +1232,13 @@ void process_store(DisasContext *ctx, int slot_num) if (is_predicated) { gen_set_label(label_end); } +#ifndef CONFIG_USER_ONLY + /* An early mem_noshuf store is followed by the slot 0 load. */ + if (ctx->pre_commit) { + tcg_gen_st_i32(tcg_constant_i32(ctx->insn->slot), tcg_env, + offsetof(CPUHexagonState, mem_slot)); + } +#endif } =20 static void process_store_log(DisasContext *ctx) --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120875; cv=none; d=zohomail.com; s=zohoarc; b=jl34/uTG013g4h6a9ydfBNuDFqfyV6FBnEF1TGQpbrPRiwToC3Dega7EVMU6fgIz0imtWhzIuI8rDHp30d+mBxNeCWNmvDRegiN2dwfr08AVQR1yfI8zmRMy1j1Py4jVw62toOMT0R48aAO8vnaYXCfvE+W0A7Z8/ZYJ4Vu6Uww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120875; h=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=sJbkU6RkldJb8/sxSgpi48gbpiNdinIrZynp3hs/mfI=; b=UtMiFzMhsY1VizaQS0L6zZnG+jbEdVobJbue/ZTmtlN5qeF0q5feq4VRMJXWY1w3XfXCMboha//NFZRGPR02DzpHFo52xu8EczcYVmPP9WLG5b5vVXTAx4EEHu4CqWMjGPC78wMRGT4lB1ZXHUDdxJHTM3DhIEuByr87iZWMjuQ= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120875862876.2264771062462; Thu, 19 Nov 2026 12:41:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8ve-0003Mn-MT; Thu, 19 Nov 2026 15:40:22 -0500 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 1xU8v7-0003B2-8S for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:53 -0500 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 1xU8v3-0007It-9P for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:48 -0500 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 6AJJ1KNn3655666 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j20guaqau-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdf971670339; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 6AJKdfKF1670302 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 896A425782; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=sJbkU6RkldJ b8/sxSgpi48gbpiNdinIrZynp3hs/mfI=; b=RqNbFzdf//t2HBQH1kD6EkqovtI 7knwlkzJOx0/8LeaPZDWexfV4IDaiJZBkFK5zWp4bQQie28hrm2OVYaGO68OdgIQ RNdolAQy0gVqtRZx3p2O/9cU/msNPVIUGyQUI3SAu28mHstCz+iv7Y6YnlnaNTzO 12wNZcPmVWGvEzsLBp4YwVBnZnUovW2C3OV6JTr6N5+CiXTLDXxarkzMJKlGtHOu NSAcQfxmcrkkTosnrUVn8z7Rxk0iS8Wci81jT0scLRLh/8qEK8zvmcWnlYsKzD2u v/ywMDdaIaeh8ihdiE5YjIAPxFDDqm17WLnBve0rN85+V25f97KL633G4UQ== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 07/13] target/hexagon: retain both scalar packet fault addresses Date: Thu, 19 Nov 2026 12:39:35 -0800 Message-ID: <20261119203941.899748-8-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX1PKsGmLfnFIt CHevPzB418ssoy5G8NiNKE/f04EI4c8Cgu+HIVl2trcUavs1F425D1bDRnkAUOgBV8qq+6dkiaC kl0r+RIdXQOC+Ne33c1Bi33NSBXwmx0= X-Proofpoint-ORIG-GUID: iGbXpfGr39n2DKQuaOz2XR_kdfDZylvp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfXzD4OFIZEkuXd 1FywbPrAsMW4mw551L+sXgipIUkoXTLvupuUYp1R0dojr2FactKxVWXhLbgRlLb6rnNLLNHBtwk CR3tQsfvLGLefhj3yTnI20KOO8qDrl9iFf0q9C2ny5v3xJqyLlYVXnN8/B58dypNEooDviQPtao AyoKJCel6patwvf3M6oVbUAkGMoiV74EWgxEQS6+xWFq46QZOW7aElbXtjpiT2DMVhd5I0bse4q W8zHuAka0dOXhcI0nXvkXHyi39ChUAANjhcyCRbQBOhgjpNYpogIZH9D978yMXATuCl+o1lTMDE OHdwznn6wxWNLYhX6XUztwrAMolnWMMWs7xxyDcaDijldTSTs6U72289b/ZUPyBJPXhgll60o1/ e7VqjWZ4k+KPMos5weH8WfHcQjDeqrCDxdyw8V5zTgVkQwJ8N8iH7JzkY4/3++hsZ1uu2AVpA9M 5W5aVhcXLpn8es7UBBA== X-Proofpoint-GUID: iGbXpfGr39n2DKQuaOz2XR_kdfDZylvp X-Authority-Analysis: v=2.4 cv=XutvqlF9 c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=9Yne1IhLnBY4bJs1OgIA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120877786158500 Content-Type: text/plain; charset="utf-8" Generate address-only code from scalar memory semantics. Record both active slots before memory execution, without loads, stores, or pointer updates. Use the recorded addresses and validity bits on a data fault. Signed-off-by: Marco Liebel --- target/hexagon/cpu.c | 16 ++++++++++++ target/hexagon/cpu.h | 2 ++ target/hexagon/gen_tcg_func_table.py | 6 +++++ target/hexagon/gen_tcg_funcs.py | 38 ++++++++++++++++++++++++++++ target/hexagon/genptr.c | 17 +++++++++++++ target/hexagon/genptr.h | 4 +++ target/hexagon/hex_common.py | 22 ++++++++++++++++ target/hexagon/translate.c | 16 ++++++++++++ target/hexagon/translate.h | 1 + 9 files changed, 122 insertions(+) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 11d622948e..34f80d6671 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -759,6 +759,22 @@ static void set_badva_regs(CPUHexagonState *env, uint3= 2_t VA, int slot, { env->t_sreg[HEX_SREG_BADVA] =3D VA; =20 + if (access_type !=3D MMU_INST_FETCH && env->mem_access_valid) { + uint32_t valid =3D env->mem_access_valid | (1U << slot); + for (int i =3D 0; i < 2; i++) { + if (valid & (1U << i)) { + env->t_sreg[HEX_SREG_BADVA0 + i] =3D + i =3D=3D slot ? VA : env->mem_access_va[i]; + } else { + env->t_sreg[HEX_SREG_BADVA0 + i] =3D INVALID_BADVA; + } + } + SET_SSR_FIELD(env, SSR_V0, valid & 1); + SET_SSR_FIELD(env, SSR_V1, (valid >> 1) & 1); + SET_SSR_FIELD(env, SSR_BVS, slot); + return; + } + if (access_type =3D=3D MMU_INST_FETCH || slot =3D=3D 0) { env->t_sreg[HEX_SREG_BADVA0] =3D VA; env->t_sreg[HEX_SREG_BADVA1] =3D INVALID_BADVA; diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index d6a513988c..915da339a0 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -167,6 +167,8 @@ typedef struct CPUArchState { uint32_t t_sreg[NUM_SREGS]; /* Slot of the memory operation currently being executed or probed. */ uint32_t mem_slot; + uint32_t mem_access_valid; + uint32_t mem_access_va[2]; =20 uint32_t greg[NUM_GREGS]; =20 diff --git a/target/hexagon/gen_tcg_func_table.py b/target/hexagon/gen_tcg_= func_table.py index ba56ede568..3ec136d6f1 100755 --- a/target/hexagon/gen_tcg_func_table.py +++ b/target/hexagon/gen_tcg_func_table.py @@ -22,6 +22,12 @@ def main(): f.write(f" [{tag}] =3D generate_{tag},\n") =20 f.write("};\n\n") + f.write("#ifndef CONFIG_USER_ONLY\n") + f.write("const SemanticInsn opcode_address[XX_LAST_OPCODE] =3D {\n= ") + for tag in hex_common.tags: + if not hex_common.tag_ignore(tag) and hex_common.packet_memory= _info(tag): + f.write(f" [{tag}] =3D address_{tag},\n") + f.write("};\n#endif\n\n") f.write("#endif /* HEXAGON_FUNC_TABLE_H */\n") =20 =20 diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index eb2e5f3a7e..f67056049e 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -154,11 +154,49 @@ def gen_tcg_func(f, tag, regs, imms): f.write("}\n\n") =20 =20 +def gen_memory_address(f, tag, regs, imms): + info =3D hex_common.packet_memory_info(tag) + if info is None: + return + ea, pred, width =3D info + for reg in ("SP", "FP", "GP", "LR"): + ea =3D ea.replace(f"fREAD_{reg}()", f"hex_gpr[HEX_REG_{reg}]") + f.write("#ifndef CONFIG_USER_ONLY\n") + f.write(f"static void address_{tag}(DisasContext *ctx)\n{{\n") + f.write(" Insn *insn G_GNUC_UNUSED =3D ctx->insn;\n") + f.write(" TCGv EA =3D tcg_temp_new();\n") + for i, (regtype, regid) in enumerate(regs): + name =3D f"{regtype}{regid}V" + if regtype =3D=3D "R" and re.search(rf"\b{name}\b", ea): + f.write(f" TCGv {name} =3D hex_gpr[insn->regno[{i}]];\n") + for immlett, bits, shift in imms: + name =3D hex_common.imm_name(immlett) + if re.search(rf"\b{name}\b", ea): + i =3D 1 if immlett.isupper() else 0 + f.write(f" int {name} =3D insn->immed[{i}];\n") + if pred: + name =3D pred.group(3) + i =3D next(i for i, (t, r) in enumerate(regs) + if f"{t}{r}" =3D=3D name[:-1]) + source =3D "ctx->new_pred_value" if pred.group(1) =3D=3D "NEW" els= e "hex_pred" + f.write(" TCGv LSB =3D tcg_temp_new();\n") + f.write(" TCGLabel *skip =3D gen_new_label();\n") + f.write(f" tcg_gen_andi_tl(LSB, {source}[insn->regno[{i}]], 1);= \n") + cond =3D "NE" if pred.group(2) else "EQ" + f.write(f" tcg_gen_brcondi_tl(TCG_COND_{cond}, LSB, 0, skip);\n= ") + f.write(f" {ea};\n") + f.write(" gen_log_mem_address(ctx, EA);\n") + if pred: + f.write(" gen_set_label(skip);\n") + f.write("}\n#endif\n\n") + + def gen_def_tcg_func(f, tag, tagregs, tagimms): regs =3D tagregs[tag] imms =3D tagimms[tag] =20 gen_tcg_func(f, tag, regs, imms) + gen_memory_address(f, tag, regs, imms) =20 =20 def main(): diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 954dea6622..e270a41b8d 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -1722,6 +1722,23 @@ static void vec_to_qvec(size_t size, TCGv_ptr dstbas= e, intptr_t dstoff, } } =20 +#ifndef CONFIG_USER_ONLY +void gen_log_mem_address(DisasContext *ctx, TCGv va) +{ + unsigned slot =3D ctx->insn->slot; + TCGv valid =3D tcg_temp_new(); + + tcg_debug_assert(slot < 2); + tcg_gen_st_i32(va, tcg_env, + offsetof(CPUHexagonState, mem_access_va[slot])); + tcg_gen_ld_i32(valid, tcg_env, + offsetof(CPUHexagonState, mem_access_valid)); + tcg_gen_ori_i32(valid, valid, 1U << slot); + tcg_gen_st_i32(valid, tcg_env, + offsetof(CPUHexagonState, mem_access_valid)); +} +#endif + void probe_noshuf_load(TCGv va, int s, int mi) { TCGv size =3D tcg_constant_tl(s); diff --git a/target/hexagon/genptr.h b/target/hexagon/genptr.h index 270375251f..99dff75973 100644 --- a/target/hexagon/genptr.h +++ b/target/hexagon/genptr.h @@ -23,6 +23,10 @@ #include "translate.h" =20 extern const SemanticInsn opcode_genptr[]; +#ifndef CONFIG_USER_ONLY +extern const SemanticInsn opcode_address[]; +void gen_log_mem_address(DisasContext *ctx, TCGv va); +#endif =20 void gen_store32(TCGv vaddr, TCGv src, uint32_t width, uint32_t slot); void gen_store1(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot); diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index f85f063f52..6d335e9423 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -299,6 +299,28 @@ def need_pkt_has_multi_cof(tag): return False =20 =20 +def packet_memory_info(tag): + """Return a side-effect-free scalar address expression, if available."= "" + attrs =3D attribdict[tag] + if not ("A_LOAD" in attrs or "A_STORE" in attrs): + return None + if any(a in attrs for a in ("A_CVI", "A_HVX", "A_HLX", "A_HMX")): + return None + sem =3D semdict[tag] + ea =3D re.search(r"fEA_(?:RI|RRs|IRs|IMM|REG|BREVR)\([^;]+\)", sem) + if not ea: + return None + # A locked store is conditional on the reservation, not a predicate. + if "fSTORE_LOCKED" in sem: + return None + width =3D next((n for n in (1, 2, 4, 8) + if f"A_MEMSIZE_{n}B" in attrs), None) + if width is None: + return None + pred =3D re.search(r"fLSB(OLD|NEW)(NOT)?\((P\w+)\)", sem) + return ea.group(0), pred, width + + def need_pkt_need_commit(tag): return 'A_IMPLICIT_WRITES_USR' in attribdict[tag] =20 diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 3105101aa3..163b22bc75 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -814,6 +814,7 @@ static void gen_start_packet(DisasContext *ctx) * gen phase, so clear it again. */ bitmap_zero(ctx->pregs_written, NUM_PREGS); + ctx->mem_addresses_generated =3D false; #ifndef CONFIG_USER_ONLY for (i =3D 0; i < HEX_SREG_GLB_START; i++) { ctx->t_sreg_new_value[i] =3D NULL; @@ -1021,6 +1022,21 @@ static void gen_insn(DisasContext *ctx) =20 #ifndef CONFIG_USER_ONLY if (GET_ATTRIB(opcode, A_LOAD) || GET_ATTRIB(opcode, A_STORE)) { + if (!ctx->mem_addresses_generated) { + Insn *saved =3D ctx->insn; + + tcg_gen_st_i32(tcg_constant_i32(0), tcg_env, + offsetof(CPUHexagonState, mem_access_valid)); + for (int i =3D 0; i < ctx->pkt.num_insns; i++) { + Insn *in =3D &ctx->pkt.insn[i]; + if (opcode_address[in->opcode]) { + ctx->insn =3D in; + opcode_address[in->opcode](ctx); + } + } + ctx->insn =3D saved; + ctx->mem_addresses_generated =3D true; + } tcg_gen_st_i32(tcg_constant_i32(ctx->insn->slot), tcg_env, offsetof(CPUHexagonState, mem_slot)); } diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index f1aa56e463..55d95fd3ab 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -88,6 +88,7 @@ typedef struct DisasContext { DECLARE_BITMAP(insn_qregs_read, NUM_QREGS); bool pre_commit; bool need_commit; + bool mem_addresses_generated; TCGCond branch_cond; target_ulong branch_dest; bool is_tight_loop; --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120856; cv=none; d=zohomail.com; s=zohoarc; b=bKvuMEEK8tx4UkmwljVQNA3frtCC917seaJev/ErlvXaN6lBANpGzNQBuA780sn66RAF8PoMVKJb44/Web2P7F0ww6AK/JH7opSqmJbwWrlBTuwRJvDRwlXnJvM6IDNM3i+tcwGAs3omr6ZG7Eqh1twYlBjX2uoN1X71oaZJCrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120856; h=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=tKl/qEFEO+y+kWGHTZjrwg54bY2zAfu7YfpJia+KXyw=; b=eZiMcOgq+T41dIvnfsfSFF9g00Uk4cPnveWSnZqIUQmi0pxH/N/2hYR6FETKRRfVOMvMVPA2UCQluKLOISBOv5Zqh/FXZyk8FnXRd6AgTG0lQ+mQ8Pbgn1EVAYGVJ3DolvVRTIJ+WelrXzdnqkG+1rR+78p+BOW1XryuPQsFWbQ= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120856871778.3838734649446; Thu, 19 Nov 2026 12:40:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vV-0003Lw-A1; Thu, 19 Nov 2026 15:40:14 -0500 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 1xU8v5-0003Ap-2l for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:48 -0500 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 1xU8v3-0007IP-73 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:46 -0500 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 6AJJTvXl1112077 for ; Thu, 19 Nov 2026 20:39:42 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27au0awn-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdgNZ1670342; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 6AJKdfvU1670303 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 8E9EE25785; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=tKl/qEFEO+y +kWGHTZjrwg54bY2zAfu7YfpJia+KXyw=; b=S+WeUZyIrRQT+N0BQppDDBpZsOa mOTQt4La0NDuPtnifWu3PGSRlHCTgD6WI9ytagCyh78ekOBBYF1ATeivdn0fUj3T fFoE+GfepVTHz02WWg59TTa7loVM8Ntlfdcs+CS2ut58CTb5K3/p9NiajskPvqPr em6NXyCRhGIiO4dxbAjkCRf8saB66b4q9wq5wallhPyhWRMKtMuX4joztp3yEuI8 yKIzrvfbK1RlpKPf3kmhMU5svdjs0O6OTs5vJwFjafo//3GxM4cHM6ciMJSle3N5 QCs7KHnMx4p/b5SQcq+ZXDnvmKZwquCrDZEOQpNdmod/NJZmVdtUTtIL2Eg== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 08/13] target/hexagon: preserve inactive BADVA registers Date: Thu, 19 Nov 2026 12:39:36 -0800 Message-ID: <20261119203941.899748-9-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX48tzbS6DEYcf F978m5ZpsorjvQOL6isirJiVZRousaBBZavXQZ0lkzIgEgeXCjS4uhjKqPNWsTSpfVfMoH7jDIQ OalRwg0jbTIkkyZdoGudQ++FQ27qkusmUpcP5taZC1chju15RDJcY0sc4VznhpoNRc6LGuwhi7e KyOhD0iDwafg/t1vjwr6a561ptH6w5hL/qDchJTrTpF7xr5k9zqd5x2jQ9U3Wd3IUmsY30NvlC+ VfFYt9P81wRwy0B63f0wK599+m4SWrklpEu3w8u19aj0lx9LcDPP07uYInAmIYju1mIn/cInL2c ZYwTO5ghH3/v75OOAYABFbL0wqxHDGXsFmwOblEsypiGd/4zfJpPB8+tx4SBqvFsnMiNqS4J3Xk tMCIBabkW0rXTWIS6svX4UdvmNT8uyn2Ck3plUFXRLYUAFqociQOrHoKg7v30leriiKON033DwA IB5vEAM+hlxPXJaS1oA== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX3A0IiMse7bDr GhPW4vmwqUrLtgT9TlStq33ysD0H9vTos4J5nXVz20sIds0sbKjezj1uH8vObt8fg9J/Y2TCPDX X2OgX+arMJPopVHMgKeJ3DZxjuZDjVo= X-Proofpoint-ORIG-GUID: zPyyJ1VSP3rlGk6q-zpZzll0ZjUJtp-h X-Proofpoint-GUID: zPyyJ1VSP3rlGk6q-zpZzll0ZjUJtp-h X-Authority-Analysis: v=2.4 cv=KuHYSmWN c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=Stv3M7lcxomkFMvdv2cA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120857633158500 Content-Type: text/plain; charset="utf-8" Clear the validity bit without overwriting the inactive slot address. Fault handlers can retain BADVA values across exceptions. Signed-off-by: Marco Liebel --- target/hexagon/cpu.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 34f80d6671..5ebe67d024 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -752,8 +752,6 @@ static bool hexagon_cpu_translate_for_debug(CPUState *c= s, vaddr addr, } =20 =20 -#define INVALID_BADVA 0xbadabada - static void set_badva_regs(CPUHexagonState *env, uint32_t VA, int slot, MMUAccessType access_type) { @@ -765,8 +763,6 @@ static void set_badva_regs(CPUHexagonState *env, uint32= _t VA, int slot, if (valid & (1U << i)) { env->t_sreg[HEX_SREG_BADVA0 + i] =3D i =3D=3D slot ? VA : env->mem_access_va[i]; - } else { - env->t_sreg[HEX_SREG_BADVA0 + i] =3D INVALID_BADVA; } } SET_SSR_FIELD(env, SSR_V0, valid & 1); @@ -777,12 +773,10 @@ static void set_badva_regs(CPUHexagonState *env, uint= 32_t VA, int slot, =20 if (access_type =3D=3D MMU_INST_FETCH || slot =3D=3D 0) { env->t_sreg[HEX_SREG_BADVA0] =3D VA; - env->t_sreg[HEX_SREG_BADVA1] =3D INVALID_BADVA; SET_SSR_FIELD(env, SSR_V0, 1); SET_SSR_FIELD(env, SSR_V1, 0); SET_SSR_FIELD(env, SSR_BVS, 0); } else if (slot =3D=3D 1) { - env->t_sreg[HEX_SREG_BADVA0] =3D INVALID_BADVA; env->t_sreg[HEX_SREG_BADVA1] =3D VA; SET_SSR_FIELD(env, SSR_V0, 0); SET_SSR_FIELD(env, SSR_V1, 1); --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120900; cv=none; d=zohomail.com; s=zohoarc; b=GiiQQHTUPjDyYT7z7G79IBsQK/1x+tPfphaaN45G/QX0iXu4Xj/Lho/ZnO425f2ah7uHaN/hR/R6qozv1uohkKz3IkaaN9P5o650NEegVPO3teA8e1eLTvGiOb7IfbuJlQriHB2Efzpw9l75OonXueb79rnVnzdAF5ZcettMeiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120900; h=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=obaYNB5+EMm2OLpXASkG5Fo78WwbSU4KyHhou3DNGqo=; b=VElhUPvvqKxFp/Os0a9HIbRi+RM+OLh+o88dwiFkGQVxOE9+F2/FblcU6kkxxgw288ysn+0n4OB/IC1IgjL3e16XrHNCI3QpWcXViV4cE0GfZEbh6dQu+k6Yw/Pe6wxVcgmJu6SEStrZbxqSNLsXXt309o9cB7Rcp3TDTmTrbFI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120900270586.161524668291; Thu, 19 Nov 2026 12:41:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vl-0003NZ-AZ; Thu, 19 Nov 2026 15:40:29 -0500 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 1xU8v5-0003Aq-3r for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:51 -0500 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 1xU8v3-0007Io-73 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:46 -0500 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 6AJJ1S6b095162 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1b48d-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdgWt3698925; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 6AJKdfEE3698908 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 930CD2578D; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=obaYNB5+EMm 2OLpXASkG5Fo78WwbSU4KyHhou3DNGqo=; b=FReA09GCKy2BYya8yOq0N1sqbMw aeDN4Q6XcenOTbndSa8e0jQwe7ugeigYp9jWo/dTsRZb/rEdFK9M3QndvLDdE06E bCQ2Noun51EWj5XTWElqyT+ZH9bXdKz1bWid3d9bikPPVAQpC3FkNXlQar/I63M0 JKk4s5EZY8KVxiFmQMNmSb2mfcMKl/sxvJhj+ATFHeZ/P8Zk3fbwyHDmWhisIv5m 4xOUCsiO9/uT8y6q1pQkZnxSbL+IwZQDSmnxdHMbelmRN5S2i1gcMk++4tFESvo7 yphl4gWM94nfU7KxPClMA33osPhuQXONak66vMG7XNBDab08Cy93XQoAneA== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 09/13] target/hexagon: probe scalar packet memory in slot priority order Date: Thu, 19 Nov 2026 12:39:37 -0800 Message-ID: <20261119203941.899748-10-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Authority-Analysis: v=2.4 cv=PcBqFShd c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=dMN3z6l-B7iZEtH36-MA:9 X-Proofpoint-ORIG-GUID: FsXaQXyrM0_CfSBCIENgBcbKzYtrFNGl X-Proofpoint-GUID: FsXaQXyrM0_CfSBCIENgBcbKzYtrFNGl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX/FyW03U4sTm2 HhAQHNUZSfkXiqr2a0+vwVZq3EBMm8Kxe5m5C+EinSdVz9z+lOs5WbhLum+cI2r/JuqOSskb8Q+ 9CQZsknrapyn5UgRO9HWirAbHhsBDcWHr7ZPK1Q+lumc5HzxFEgmVTQmjELqc/Q9pxX8fWsGvel jrp1SJ5UD04Xoq4F7dWLWLBV/VOI81qR1V1CLSqBSK+9fdbg61VUV5AQ9VMjzGH2dD839Tzu6Yx 9L9o63Tx32LCvPgimMLRmb3sVjF89d9oYDveEhYyvj/2Sy4b814hsLNKQ5LZKJK3lqC7azzQBvu daK69Ozn0Xv2ThauP/btHkYS0pCzyrbLju7gIMcpTyej2gHQyQhlSVLj7ktkPStY8tVwPmf70eW 2n8yc6jC0VvwBlIx+exXNz5sOevv8Oer/rR5J6Wpvjq8ewsf7NgIpHtvDb7XOnrHvYVMIvo+VL1 wtupoVyzjOCnl6LusBw== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX1Vbe466D8rY7 Yb1f8hcCbC+yOrrDXUCOs0dpxN5JNbZQnUg1cemBpiUutEXnPE1fi1h6Y71feWSmV3GYGQLa51S lq9xX3mlaaJAs60PKcDCldHbII99/+g= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120901860158500 Content-Type: text/plain; charset="utf-8" Probe slot 1 before slot 0 without committing either access. A slot 1 store miss must win over a slot 0 load miss in a mem_noshuf packet. Signed-off-by: Marco Liebel --- target/hexagon/op_helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index be5ce7d89c..f22353302b 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -459,6 +459,12 @@ void HELPER(probe_noshuf_load)(CPUHexagonState *env, t= arget_ulong va, { uintptr_t retaddr =3D GETPC(); #ifndef CONFIG_USER_ONLY + /* The slot 1 store fault must precede the slot 0 load fault. */ + if (env->mem_access_valid & (1U << 1)) { + env->mem_slot =3D 1; + probe_write(env, env->mem_access_va[1], + env->mem_log_stores[1].width, mmu_idx, retaddr); + } env->mem_slot =3D 0; #endif probe_read(env, va, size, mmu_idx, retaddr); @@ -555,6 +561,10 @@ static void check_noshuf(CPUHexagonState *env, bool pk= t_has_scalar_store_s1, { if (slot =3D=3D 0 && pkt_has_scalar_store_s1 && ((env->slot_cancelled & (1 << 1)) =3D=3D 0)) { +#ifndef CONFIG_USER_ONLY + probe_store(env, 1, MMU_USER_IDX, false, ra); + env->mem_slot =3D 0; +#endif probe_read(env, vaddr, size, MMU_USER_IDX, ra); commit_store(env, 1, ra); } --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120905; cv=none; d=zohomail.com; s=zohoarc; b=QYsqJ+wfmSiE4ipI3uADNMCnBeDncREUglX0ouR4EvQtz5tY/kQDQ2/4JtiSLSm+3mQXRAkzwQQ0yTF8hqnArX65umfZ6dRRwelMvvlvz1s5sVhFlj7jIJTyhVYF60eMDuiy5ab/8T8PFuHSUh3k1kcgZ1udG3aOL2HmsHzRVHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120905; h=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=XeA+MHJPwbGCI5x48+len4cjrkLeW9r3ihdyS0XYQs0=; b=D4Qgu6jrqTnbxws2k+POlYEa7llIp8VMBin6hBL0INhXvP2pJ1hEMty9PgTLvvbiiJVdrM0WY88Bn7tE9xKYRMIVIIZvzJ7l9xHo0Dz1iFyPX9GMNas9Xm+Mk0RkRJlqlPdkDE/u4W8hwaZE4vnhCRyVaewrt5J0+U+3S1E4tzE= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120905160916.462314757216; Thu, 19 Nov 2026 12:41:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8w2-0003QF-UG; Thu, 19 Nov 2026 15:40:46 -0500 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 1xU8v7-0003B1-8W for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:53 -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 1xU8v3-0007IW-9O for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:48 -0500 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1Q0E3595248 for ; Thu, 19 Nov 2026 20:39:42 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j255wh6a0-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdgvd3570598; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 6AJKdfO13570567 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 996342578E; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=XeA+MHJPwbG CI5x48+len4cjrkLeW9r3ihdyS0XYQs0=; b=gyXrEZdR/0toCanpEDkPfdIA1KP MhlYrDWrEf16Xkcu8AKhSmsMfTTVRkxcYkbtL3/D+Fa89ZSWFmXXEJU9VTufa6PX u2nnr1srOwl2LIJiuq9/HrpQkwBk5VX2ofrZz7LI+RwgxU6q20nNaYfg+Tq/nQ4f 30M1y/isSeE5hpZkrL9v1iRtYoaT4S2kTyY9Iw0p2MFqJtgLgSsfffJbTrCGm+xa 03+JRPLnHyDP7eoOCjPesEM7fPHxtnJt20qCgqmxApcEZk8vhgZ5IrHfDz6PFf6Q aPkmvLrD5LuhjNAIPtweEZV2ADCBOR130uNaZGWtLuhB7Fi2qFstdZJ9l2g== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 10/13] target/hexagon: prioritize packet alignment in the fault path Date: Thu, 19 Nov 2026 12:39:38 -0800 Message-ID: <20261119203941.899748-11-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX3cRpGG8beb0Q lGiYq5YsJ9zorw0y09GfT+dI4O9eUERODOMemjAvCcADpqO2anZ/qY8N0hjGDv/mJZadQsSf0lW 0B/GNZSQgJ3RoAF19gBVlLaBK/GDnTA= X-Proofpoint-GUID: hxSaMUVfiGFfuQkIZ7BFJ-_H69Pcrtbv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX9WlLNT/3QEH3 r4wYV/3UIgt517mo7i8qkVpNvK9xlB+/k+pGUVoufqD/Zma0emfLSitkFTqJYulUCgJxaSikMkT Hb8WwomRX1Hx0gyBeSKK6iAoNG6pdxc5qD/GfCNkzxTUKNbDkkZyPyBcXmrPkPmK0k7CWuUsCO7 clpK1swH2fF5S+c/HyJ6YB/WNsSWv1BWcsibhmOexdn9HX1XNpwS+Jt+FKWYVesxhhKJwA4wh7D LM+1F74+Uu/T14PXzxWsn0Tc0TRGMG5AXV+iFCNj6f0Jx7hwLBFynCNksj6p4nChTcUkKn18f/S fsIv6HWPLxMPgvpmxS0UJbs4uECa5V+7CUvXHOxZ4PQWkKpjSlJZ8mfgwqb2dlYAZHaEkRiFBAh oeyExrLTjSUiCnHjTCuu2OO0NoCdI+7IpHBT9XpC8j3VBYZCzVFCWRT//XMYEJZbHOY0ka349NG +g/fKsyiIUjsTZC2khg== X-Authority-Analysis: v=2.4 cv=da0VTnXe c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=aDDlNDSNT8dN0QXSkRAA:9 X-Proofpoint-ORIG-GUID: hxSaMUVfiGFfuQkIZ7BFJ-_H69Pcrtbv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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.168.131; envelope-from=mliebel@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, 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: 1795120906047158500 Content-Type: text/plain; charset="utf-8" Use MO_ALIGN for normal scalar memory accesses. On a memory fault, check the recorded active addresses for alignment before reporting a translation fault. Give slot 1 priority when both accesses are unaligned. Keep constant access widths and types in insn_start unwind metadata so the precedence checks add no runtime metadata stores or packet-wide TCG alignment checks. Retain per-access checks in commit probes to prevent partial stores. Signed-off-by: Marco Liebel --- target/hexagon/cpu.c | 47 +++++++++++++++++++++++++++++++++ target/hexagon/cpu.h | 6 +++++ target/hexagon/gen_tcg_funcs.py | 2 +- target/hexagon/genptr.c | 10 ++++++- target/hexagon/genptr.h | 2 +- target/hexagon/internal.h | 5 ++++ target/hexagon/op_helper.c | 2 ++ target/hexagon/translate.c | 1 + target/hexagon/translate.h | 1 + 9 files changed, 73 insertions(+), 3 deletions(-) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 5ebe67d024..1eb0fc588c 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -30,6 +30,7 @@ #include "tcg/tcg.h" #include "exec/gdbstub.h" #include "accel/tcg/cpu-ops.h" +#include "accel/tcg/cpu-loop.h" #include "cpu_helper.h" #include "hex_mmu.h" =20 @@ -835,6 +836,45 @@ static void raise_misaligned_exception(CPUState *cs, u= int32_t VA, int slot, env->cause_code =3D excp; } =20 +static void check_packet_alignment(CPUHexagonState *env, uintptr_t retaddr) +{ + CPUState *cs =3D env_cpu(env); + uint64_t data[INSN_START_WORDS]; + + if (!env->mem_access_valid || !retaddr || + !cpu_unwind_state_data(cs, retaddr, data)) { + return; + } + + /* Alignment wins over translation faults; slot 1 wins over slot 0. */ + for (int slot =3D 1; slot >=3D 0; slot--) { + unsigned info =3D data[1] >> (slot * HEX_SCALAR_MEM_ACCESS_BITS); + unsigned width =3D info & HEX_SCALAR_MEM_SIZE_MASK; + uint32_t va =3D env->mem_access_va[slot]; + + if ((env->mem_access_valid & (1U << slot)) && width && + (va & (width - 1))) { + raise_misaligned_exception(cs, va, slot, + info & HEX_SCALAR_MEM_STORE ? + MMU_DATA_STORE : MMU_DATA_LOAD); + do_raise_exception(env, cs->exception_index, data[0], retaddr); + } + } +} + +void hexagon_check_alignment(CPUHexagonState *env, uint32_t va, + unsigned size, int slot, + MMUAccessType access_type, uintptr_t retaddr) +{ + if (va & (size - 1)) { + CPUState *cs =3D env_cpu(env); + check_packet_alignment(env, retaddr); + raise_misaligned_exception(cs, va, slot, access_type); + do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], + retaddr); + } +} + static const char *access_type_names[] =3D { "MMU_DATA_LOAD ", "MMU_DATA_S= TORE", "MMU_INST_FETCH" }; =20 @@ -870,6 +910,9 @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr addres= s, int size, if (probe) { return false; } + if (access_type !=3D MMU_INST_FETCH) { + check_packet_alignment(env, retaddr); + } raise_perm_exception(cs, address, slot, access_type, excp); do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], retaddr); @@ -877,6 +920,9 @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr addres= s, int size, if (probe) { return false; } + if (access_type !=3D MMU_INST_FETCH) { + check_packet_alignment(env, retaddr); + } raise_tlbmiss_exception(cs, address, slot, access_type); do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], ret= addr); } @@ -928,6 +974,7 @@ void hexagon_cpu_do_unaligned_access(CPUState *cs, vadd= r addr, { CPUHexagonState *env =3D cpu_env(cs); =20 + check_packet_alignment(env, retaddr); raise_misaligned_exception(cs, addr, env->mem_slot, access_type); do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], retaddr); diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 915da339a0..f177a56148 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -231,6 +231,12 @@ typedef struct CPUArchState { HmxState *hmx_state; } CPUHexagonState; =20 +#ifndef CONFIG_USER_ONLY +void hexagon_check_alignment(CPUHexagonState *env, uint32_t va, + unsigned size, int slot, + MMUAccessType access_type, uintptr_t retaddr); +#endif + typedef struct HexagonCPUClass { CPUClass parent_class; =20 diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index f67056049e..4f89be8449 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -185,7 +185,7 @@ def gen_memory_address(f, tag, regs, imms): cond =3D "NE" if pred.group(2) else "EQ" f.write(f" tcg_gen_brcondi_tl(TCG_COND_{cond}, LSB, 0, skip);\n= ") f.write(f" {ea};\n") - f.write(" gen_log_mem_address(ctx, EA);\n") + f.write(f" gen_log_mem_address(ctx, EA, {width});\n") if pred: f.write(" gen_set_label(skip);\n") f.write("}\n#endif\n\n") diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index e270a41b8d..339f43b7ae 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -24,6 +24,7 @@ #include "tcg/tcg-op-gvec.h" #include "exec/helper-gen.h" #include "insn.h" +#include "attribs.h" #include "opcodes.h" #include "sys_macros.h" #include "translate.h" @@ -1723,12 +1724,18 @@ static void vec_to_qvec(size_t size, TCGv_ptr dstba= se, intptr_t dstoff, } =20 #ifndef CONFIG_USER_ONLY -void gen_log_mem_address(DisasContext *ctx, TCGv va) +void gen_log_mem_address(DisasContext *ctx, TCGv va, unsigned width) { unsigned slot =3D ctx->insn->slot; + unsigned info =3D width; TCGv valid =3D tcg_temp_new(); =20 tcg_debug_assert(slot < 2); + if (GET_ATTRIB(ctx->insn->opcode, A_STORE)) { + info |=3D HEX_SCALAR_MEM_STORE; + } + ctx->scalar_mem_info |=3D info << (slot * HEX_SCALAR_MEM_ACCESS_BITS); + tcg_set_insn_start_param(ctx->base.insn_start, 1, ctx->scalar_mem_info= ); tcg_gen_st_i32(va, tcg_env, offsetof(CPUHexagonState, mem_access_va[slot])); tcg_gen_ld_i32(valid, tcg_env, @@ -1737,6 +1744,7 @@ void gen_log_mem_address(DisasContext *ctx, TCGv va) tcg_gen_st_i32(valid, tcg_env, offsetof(CPUHexagonState, mem_access_valid)); } + #endif =20 void probe_noshuf_load(TCGv va, int s, int mi) diff --git a/target/hexagon/genptr.h b/target/hexagon/genptr.h index 99dff75973..c104ef65c2 100644 --- a/target/hexagon/genptr.h +++ b/target/hexagon/genptr.h @@ -25,7 +25,7 @@ extern const SemanticInsn opcode_genptr[]; #ifndef CONFIG_USER_ONLY extern const SemanticInsn opcode_address[]; -void gen_log_mem_address(DisasContext *ctx, TCGv va); +void gen_log_mem_address(DisasContext *ctx, TCGv va, unsigned width); #endif =20 void gen_store32(TCGv vaddr, TCGv src, uint32_t width, uint32_t slot); diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h index 6def331a83..d00c288ad2 100644 --- a/target/hexagon/internal.h +++ b/target/hexagon/internal.h @@ -20,6 +20,11 @@ =20 #include "target/hexagon/cpu.h" =20 +/* Per-slot scalar access fields in the second insn_start unwind word. */ +#define HEX_SCALAR_MEM_ACCESS_BITS 5 +#define HEX_SCALAR_MEM_SIZE_MASK 0xf +#define HEX_SCALAR_MEM_STORE (1U << 4) + int hexagon_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int hexagon_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int hexagon_hvx_gdb_read_register(CPUState *env, GByteArray *mem_buf, int = n); diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index f22353302b..354b9a2c91 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -466,6 +466,7 @@ void HELPER(probe_noshuf_load)(CPUHexagonState *env, ta= rget_ulong va, env->mem_log_stores[1].width, mmu_idx, retaddr); } env->mem_slot =3D 0; + hexagon_check_alignment(env, va, size, 0, MMU_DATA_LOAD, retaddr); #endif probe_read(env, va, size, mmu_idx, retaddr); } @@ -564,6 +565,7 @@ static void check_noshuf(CPUHexagonState *env, bool pkt= _has_scalar_store_s1, #ifndef CONFIG_USER_ONLY probe_store(env, 1, MMU_USER_IDX, false, ra); env->mem_slot =3D 0; + hexagon_check_alignment(env, vaddr, size, 0, MMU_DATA_LOAD, ra); #endif probe_read(env, vaddr, size, MMU_USER_IDX, ra); commit_store(env, 1, ra); diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 163b22bc75..83b1ecd898 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -816,6 +816,7 @@ static void gen_start_packet(DisasContext *ctx) bitmap_zero(ctx->pregs_written, NUM_PREGS); ctx->mem_addresses_generated =3D false; #ifndef CONFIG_USER_ONLY + ctx->scalar_mem_info =3D 0; for (i =3D 0; i < HEX_SREG_GLB_START; i++) { ctx->t_sreg_new_value[i] =3D NULL; } diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 55d95fd3ab..1b6c326052 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -46,6 +46,7 @@ typedef struct DisasContext { bool implicit_usr_write; #ifndef CONFIG_USER_ONLY uint32_t cpu_mode; + uint32_t scalar_mem_info; bool ss_active; int greg_log[GREG_WRITES_MAX]; int greg_log_idx; --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120885; cv=none; d=zohomail.com; s=zohoarc; b=CpTWntV1IMwZ8jI9w7opQWerQzwvznpBXNok/jD0XZhAs6BCXum4pPz92iBW/JBxvIQW/3mrVW3gqV4lFZRjai52kblMtWwv/kepHABznpDYH+f4z7xVBhFJq2LU5G94oPv+FmtPHduF8s+GYcLv5ze0HRlOA/RuSPBarlD6vkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120885; h=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=zfYts+PyqAkeKACTqYHsIQD4pmvNjphWhN7roV4gbIU=; b=YszxZr+u76au6DSOXKo+eNvTKWnwoyW9gbKY8M3v4tDzlIipGl96Jt2/2DV1Ma7P0bn/rb6EnZpkYu3RAwYN5VWoQaqFFX6a47B0u2d+tThUtNxJ1bj52nS3UHF+C9xBWr4fgWd4d6apJGvoU8MnnTQnztZTBIvjgnmKC0lsxDg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120885895686.9214897531554; Thu, 19 Nov 2026 12:41:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vv-0003OO-1T; Thu, 19 Nov 2026 15:40:40 -0500 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 1xU8v6-0003Ay-NC for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:51 -0500 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 1xU8v3-0007L6-9T for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:48 -0500 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJUXTx3367487 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27b5ra7n-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdgev3570599; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 6AJKdftb3570568 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 9C1D42578F; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=zfYts+PyqAk eKACTqYHsIQD4pmvNjphWhN7roV4gbIU=; b=pnOwZd7GwIaYJ0CcABTzTZcL8TB I59oDMuZO0h8riC8cVB7e2M7b86prtp1rqFiZ+Gc6lWgryASJ78Oa+SONzapaFie CYw0wdIISOJzJ6T5+5ZQHlV7Zx5ebC2L/wySWq148hMi5KJck+0BtNTvENrPm5on s0Fztuv7o2at71taPsRcfUFFKbjDgqeqQDWvxopm72Jj1XBhkIDwB8LY2KdFFV64 lQPZU24RBq8eGc1bfeY7/8KOTE185VoZ2skwOqXd+gYFiMFU5Rp+RDdGAdHgfHoz B1eC8YA11Ztt49CTJh65+Dj38JE4H/s4lCgI1ZY7OvFA6N69IVWbFPTzb1A== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 11/13] target/hexagon: validate both stores before packet commit Date: Thu, 19 Nov 2026 12:39:39 -0800 Message-ID: <20261119203941.899748-12-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX/8nKJy99z2yS ACEHNiqx8bYlhAdQbD/shi0F2yChGEBQ8q5zcD/vC0n2Sika8igTqt95hkaUesWbnxFoyOa+nJr IZwu6nI7CZP2O3DsVnmxu+sSzUPk1Fk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX5YOwZ/v1pn6l cMmxvH99x7z9S6BqmwRFkobh5jvc1JGDpVWwhJWRy3UWI+g0YC7om8OaZ+gWoVVzO+nhnuIEeyf SorPZlFVuQoWl0m5dg1BEeJeT7suzTxuNG9sNEFnPrai/5D8yuvOOq7e+lVJfboAnwYJKjMdmt4 gKqCu69/fsyHHUwn3Wm0MSyvyZq1b9PoIHrUDlxml024YKHmK1HkmSzUmJh9m+mBPYLVh8VZip6 xCm92If7/QRHtrpXblv3hJS71v23jxvVPZOQHtA0xueCuYTFkOAnnL9ECVckscs2pb+tVOsBKum ra6fNtttiMsULXr/6yi29MQ5aY6wiAa2Pn+0+2N3TqTuRLlsdkIP2ZwydAiaaIE/S5uf36P0J0C ZZ/sJCuOZGwGa617MvNI792claPo3NVu32a0zi3KaGxrDE/LkYESj78ZbKQH7ta68V7IkD7lrnn 7pXYZJIr3L8ZKZ9UPrw== X-Proofpoint-GUID: QukEkwWNqiGoNFUbgcnpehF0bJH-uGVx X-Proofpoint-ORIG-GUID: QukEkwWNqiGoNFUbgcnpehF0bJH-uGVx X-Authority-Analysis: v=2.4 cv=LPTz05W9 c=1 sm=1 tr=0 ts=6aff5e8f cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=vAFW47GOeLQmlYVeWGsA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120887799158500 Content-Type: text/plain; charset="utf-8" Check alignment in store probes and validate both logged stores before committing either one. This also covers stores without generated address preflight code. Signed-off-by: Marco Liebel --- target/hexagon/helper.h | 2 +- target/hexagon/op_helper.c | 16 +++++++++++----- target/hexagon/translate.c | 15 ++++++++------- target/hexagon/translate.h | 5 +++-- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index 292ca8eb7c..0303ea9bba 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -143,7 +143,7 @@ DEF_HELPER_2(vwhist128m, void, env, s32) DEF_HELPER_2(vwhist128qm, void, env, s32) =20 DEF_HELPER_4(probe_noshuf_load, void, env, i32, int, int) -DEF_HELPER_2(probe_pkt_scalar_store_s0, void, env, int) +DEF_HELPER_2(probe_pkt_scalar_stores, void, env, int) DEF_HELPER_2(probe_hvx_stores, void, env, int) DEF_HELPER_2(probe_pkt_scalar_hvx_stores, void, env, int) =20 diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 354b9a2c91..31e1140270 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -446,6 +446,9 @@ static void probe_store(CPUHexagonState *env, int slot,= int mmu_idx, #endif uint32_t width =3D env->mem_log_stores[slot].width; target_ulong va =3D env->mem_log_stores[slot].va; +#ifndef CONFIG_USER_ONLY + hexagon_check_alignment(env, va, width, slot, MMU_DATA_STORE, reta= ddr); +#endif probe_write(env, va, width, mmu_idx, retaddr); } } @@ -472,13 +475,16 @@ void HELPER(probe_noshuf_load)(CPUHexagonState *env, = target_ulong va, } =20 /* Called during packet commit when there are two scalar stores */ -void HELPER(probe_pkt_scalar_store_s0)(CPUHexagonState *env, int args) +void HELPER(probe_pkt_scalar_stores)(CPUHexagonState *env, int args) { - int mmu_idx =3D FIELD_EX32(args, PROBE_PKT_SCALAR_STORE_S0, MMU_IDX); - bool is_predicated =3D - FIELD_EX32(args, PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED); + int mmu_idx =3D FIELD_EX32(args, PROBE_PKT_SCALAR_STORES, MMU_IDX); + bool pred[2] =3D { + FIELD_EX32(args, PROBE_PKT_SCALAR_STORES, S0_IS_PREDICATED), + FIELD_EX32(args, PROBE_PKT_SCALAR_STORES, S1_IS_PREDICATED), + }; uintptr_t ra =3D GETPC(); - probe_store(env, 0, mmu_idx, is_predicated, ra); + probe_store(env, 1, mmu_idx, pred[1], ra); + probe_store(env, 0, mmu_idx, pred[0], ra); } =20 static void probe_hvx_stores(CPUHexagonState *env, int mmu_idx, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 83b1ecd898..e10f9e21c5 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1486,19 +1486,20 @@ static void gen_commit_packet(DisasContext *ctx) tcg_constant_tl(mask)); } } else if (has_store_s0 && has_store_s1) { - /* - * process_store_log will execute the slot 1 store first, - * so we only have to probe the store in slot 0 - */ + /* Validate both stores, including alignment, before commit. */ int args =3D 0; args =3D - FIELD_DP32(args, PROBE_PKT_SCALAR_STORE_S0, MMU_IDX, ctx->mem_= idx); + FIELD_DP32(args, PROBE_PKT_SCALAR_STORES, MMU_IDX, ctx->mem_id= x); if (slot_is_predicated(&ctx->pkt, 0)) { args =3D - FIELD_DP32(args, PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED,= 1); + FIELD_DP32(args, PROBE_PKT_SCALAR_STORES, S0_IS_PREDICATED= , 1); + } + if (slot_is_predicated(&ctx->pkt, 1)) { + args =3D FIELD_DP32(args, PROBE_PKT_SCALAR_STORES, + S1_IS_PREDICATED, 1); } TCGv args_tcgv =3D tcg_constant_tl(args); - gen_helper_probe_pkt_scalar_store_s0(tcg_env, args_tcgv); + gen_helper_probe_pkt_scalar_stores(tcg_env, args_tcgv); } =20 if (ctx->hex_def->hex_version >=3D HEX_VER_V83) { diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 1b6c326052..34d8ff5e6a 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -442,8 +442,9 @@ void hex_gen_exception_end_tb(DisasContext *ctx, int ca= use); =20 void process_store(DisasContext *ctx, int slot_num); =20 -FIELD(PROBE_PKT_SCALAR_STORE_S0, MMU_IDX, 0, 2) -FIELD(PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED, 2, 1) +FIELD(PROBE_PKT_SCALAR_STORES, MMU_IDX, 0, 2) +FIELD(PROBE_PKT_SCALAR_STORES, S0_IS_PREDICATED, 2, 1) +FIELD(PROBE_PKT_SCALAR_STORES, S1_IS_PREDICATED, 3, 1) =20 FIELD(PROBE_PKT_SCALAR_HVX_STORES, HAS_ST0, 0, 1) FIELD(PROBE_PKT_SCALAR_HVX_STORES, HAS_ST1, 1, 1) --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120916; cv=none; d=zohomail.com; s=zohoarc; b=loon5qEwCMBLFptUOqzyGz0O+fW3g0KH9oY7uVByzrmUOlSP3FxduKrcD9PEpVAvsYK15nuE3Qxq58q8YfcnAjSR3E+Vkzd3bMkUUqS01kAhtqiuV0U1vD2SR0vH4iVs1gaHJYcrPz4c7ViYZYpN+KmEQVcyUsGSXgK7N7DPJVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120916; h=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=6xMOreOGbXvJQEbGksluhUCb/roNQ3o09XBrj1PWOhc=; b=WjWK8Zv1H4Uy4opGlfFOLR492n7nZzTaCs1Prc9C4h0LS0rTogByA/24CaKd2skjEIKJ0cpLbCs/SffiEP63R4926YvO94NJdpKSDNZZtAM+uANc5QAwYld11WznNpSso9ACdiB0NO+e40hC0wDjhcwMM8ybTl8xkprPnbNTvJg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120916957456.98735925811843; Thu, 19 Nov 2026 12:41:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vX-0003MF-3c; Thu, 19 Nov 2026 15:40:15 -0500 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 1xU8vA-0003B6-0h for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:55 -0500 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 1xU8v3-0007K0-SS for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:50 -0500 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 6AJJ1Wpb1671647 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1x70bc21-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdfAE1670338 for ; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 6AJKdf9A1670309 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id A097A25790; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=6xMOreOGbXv JQEbGksluhUCb/roNQ3o09XBrj1PWOhc=; b=ac8j1abnqe4QD3hHbuNhT6Rmve0 IKjo0+uP62ijxS8bjKII4P4YLIOorsof6yw2d6IdrX2MkNmRMh9+I60L/0C2YGI0 uQAcUlWFTJ2Kldygi/WMZatio94ffV10TSCR9gtybrgprRD8G3iT2wbQBvDuSWAo zO1G15cDLc9EuJ2GO8fNAj7gRa3T5UsMZ+s7LH67yVXXkLv2DmQum+SGIKgVZCfi T0eFJv0qsfjGroqFexQa1gS4ppTJOLiCscIqhYPHkuPUsbjR25Y8/siFClHFRT3A KK218PlUuewejOfIEE8l+gwHdhl2J0hXfXWegw3S9to/59Xz7UU6fsVb4pg== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 12/13] target/hexagon: probe VMEMU upper transactions before lower ones Date: Thu, 19 Nov 2026 12:39:40 -0800 Message-ID: <20261119203941.899748-13-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: 6csKvny-yqLE75qPtB_qgG_igh9uisAC X-Authority-Analysis: v=2.4 cv=RdgFmFtv c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=SFsQfBXkJAIU8DLS2pcA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX0hnWRUURUHf3 eoVGF3tu7eQURfPvyNOt0KGauzmVerTn5vNIbJG9+WnapbMVkKJng+xVksTmd1YWDrFKVHoPOtC Y70rtCj4vktfuQGLd5fsB6g46Y8587o= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfXzDr681WjnmOs HfEHBW6JNrr57V+sQCWN7lseoTLJU+9FC0ABlB3wkPoVlWLhWGqP5LXo1EzRJHKKV5RzC0oJAe/ l3OiCASfERO4LIpckoFQvP7y+ORDkiOL1DNdC1pugLq9/yvkHuxUdO+nBztCNk9xyqx/T6xJ1Sn EEH2bQ+Cms6TDhJ5lGwyAIdsIIdcJ65QFAWFqsbK6qwBZquxX3ux1OKdAta35yFY6hXRfzaUPNG nKCBmkQNap9YAXbD4D2FQueIsZhqle0ouWkqMN4/Uq3IC6eK6V0FbZIxhGGwEiU+9M6adB8W5wS tWv2B1K41cyRBg1bmlX///NtRaqb+5z1oJ+2AJ0ioanZqx9AJdO/aQuyJJSm62bCdBQbUtenwgf E2BHnJNv4C3TD1O2KqVDBcWGIEZyKS2WbPV/02/U7gkQF6fxTVW0eVHS4Im5hTFqlpCvAM1k12K C/3CAFiaDJCu8jgH2qQ== X-Proofpoint-GUID: 6csKvny-yqLE75qPtB_qgG_igh9uisAC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 phishscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120918057158500 Content-Type: text/plain; charset="utf-8" Record both unaligned VMEMU addresses and probe the upper transaction first. Report the architectural address, not the page boundary found by a split TLB access. Preserve both validity bits on load and store faults. Signed-off-by: Marco Liebel --- target/hexagon/cpu.c | 4 +++- target/hexagon/genptr.c | 10 ++++++++++ target/hexagon/helper.h | 3 +++ target/hexagon/op_helper.c | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 1eb0fc588c..9146b27708 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -763,9 +763,11 @@ static void set_badva_regs(CPUHexagonState *env, uint3= 2_t VA, int slot, for (int i =3D 0; i < 2; i++) { if (valid & (1U << i)) { env->t_sreg[HEX_SREG_BADVA0 + i] =3D - i =3D=3D slot ? VA : env->mem_access_va[i]; + (env->mem_access_valid & (1U << i)) ? + env->mem_access_va[i] : VA; } } + env->t_sreg[HEX_SREG_BADVA] =3D env->t_sreg[HEX_SREG_BADVA0 + slot= ]; SET_SSR_FIELD(env, SSR_V0, valid & 1); SET_SSR_FIELD(env, SSR_V1, (valid >> 1) & 1); SET_SSR_FIELD(env, SSR_BVS, slot); diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 339f43b7ae..077319a7b6 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -1635,6 +1635,11 @@ static void gen_vreg_load(DisasContext *ctx, TCGv_pt= r dstbase, intptr_t dstoff, TCGv src, bool aligned) { TCGv_i64 tmp =3D tcg_temp_new_i64(); +#ifndef CONFIG_USER_ONLY + gen_helper_probe_hvx_mem(tcg_env, src, tcg_constant_i32(ctx->insn->slo= t), + tcg_constant_i32(aligned), tcg_constant_i32(0= ), + tcg_constant_i32(ctx->mem_idx)); +#endif if (aligned) { tcg_gen_andi_tl(src, src, ~((int32_t)VECTOR_SIZE_BYTE - 1)); } @@ -1657,6 +1662,11 @@ static void gen_vreg_store(DisasContext *ctx, TCGv E= A, TCGv_ptr srcbase, return; } =20 +#ifndef CONFIG_USER_ONLY + gen_helper_probe_hvx_mem(tcg_env, EA, tcg_constant_i32(slot), + tcg_constant_i32(aligned), tcg_constant_i32(1= ), + tcg_constant_i32(ctx->mem_idx)); +#endif tcg_gen_movi_tl(hex_vstore_pending[slot], 1); if (aligned) { tcg_gen_andi_tl(hex_vstore_addr[slot], EA, diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index 0303ea9bba..1c4de477fe 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -22,6 +22,9 @@ DEF_HELPER_FLAGS_3(raise_exception, TCG_CALL_NO_RETURN, n= oreturn, 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) +#ifndef CONFIG_USER_ONLY +DEF_HELPER_6(probe_hvx_mem, void, env, i32, i32, i32, i32, i32) +#endif DEF_HELPER_FLAGS_4(fcircadd, TCG_CALL_NO_RWG_SE, s32, s32, s32, s32, s32) DEF_HELPER_FLAGS_1(fbrev, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_4(sfrecipa, i64, env, f32, f32, i32) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 31e1140270..3492c99c08 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -54,6 +54,41 @@ #include "hexswi.h" #endif =20 +#ifndef CONFIG_USER_ONLY +static void log_mem_address(CPUHexagonState *env, uint32_t va, uint32_t sl= ot) +{ + assert(slot < 2); + env->mem_access_valid |=3D 1U << slot; + env->mem_access_va[slot] =3D va; +} + +void HELPER(probe_hvx_mem)(CPUHexagonState *env, uint32_t va, uint32_t slo= t, + uint32_t aligned, uint32_t store, uint32_t mmu_= idx) +{ + uintptr_t ra =3D GETPC(); + uint32_t base =3D va & ~(VECTOR_SIZE_BYTE - 1); + + if (aligned) { + log_mem_address(env, base, slot); + } else { + /* VMEMU uses both slots; BADVA records the unaligned addresses. */ + log_mem_address(env, va, 0); + log_mem_address(env, va + VECTOR_SIZE_BYTE, 1); + } + int first =3D aligned ? slot : 1; + int last =3D aligned ? slot : 0; + for (int s =3D first; s >=3D last; s--) { + uint32_t address =3D base + (aligned ? 0 : s * VECTOR_SIZE_BYTE); + env->mem_slot =3D s; + if (store) { + probe_write(env, address, VECTOR_SIZE_BYTE, mmu_idx, ra); + } else { + probe_read(env, address, VECTOR_SIZE_BYTE, mmu_idx, ra); + } + } +} +#endif + #ifdef CONFIG_USER_ONLY /* * User mode has no qtimer device backing TIMERLO/TIMERHI, so derive the @@ -493,6 +528,9 @@ static void probe_hvx_stores(CPUHexagonState *env, int = mmu_idx, /* Normal (possibly masked) vector store */ for (int i =3D 0; i < VSTORES_MAX; i++) { if (env->vstore_pending[i]) { +#ifndef CONFIG_USER_ONLY + env->mem_slot =3D i; +#endif target_ulong va =3D env->vstore[i].va; int size =3D env->vstore[i].size; for (int j =3D 0; j < size; j++) { --=20 2.43.0 From nobody Mon Nov 23 04:28:04 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=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1795120913; cv=none; d=zohomail.com; s=zohoarc; b=GHg5p25jcbDmeuw0RpoJ9BsFOcH+ttHXm/4qgBdW5UicSHnHZR+EMXLmLfsllo3JlFZXRe9pHnVyuV0F2efn0AwiOvgxj2Jh9FYteABqcfafKutr++eLcPSxV9wmRRM1LTpw8/tapCBKYP7XCy4WqxPJ2722kr4tx0i66dXx2BE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795120913; h=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=kLGFjAZekQMrnOWQURYvjxdaFgHeFlhem0RNmV+idrk=; b=LgP6oZ8qt5LihyGQjBn+rlsMaOTpRrf4gNzwwFyEpjVMFh9jipeN2DLQogKo2Y/x3nTcJv9j37+jGYsqcs/D1/MyzY4uy14rkQm9EcpPPeapdlzessQaTcI7nFLvjoqyU5nlgOGznvymgF8gBnlvz2Nnb2+ATOajx2lLqCzv3kU= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795120913074854.8429621125279; Thu, 19 Nov 2026 12:41:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8vO-0003ES-1K; Thu, 19 Nov 2026 15:40:06 -0500 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 1xU8vA-0003B7-0d for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:55 -0500 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 1xU8v3-0007Jp-U4 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:39:50 -0500 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 6AJKFpoi3354957 for ; Thu, 19 Nov 2026 20:39:43 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27fyg916-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 20:39:42 +0000 (GMT) Received: from pps.filterd (nalasppmta02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJKdgdO3698928; Thu, 19 Nov 2026 20:39:42 GMT Received: from hu-devc-lv-u24-a.qualcomm.com (hu-mliebel-lv.qualcomm.com [10.81.81.31]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 6AJKdfZK3698909 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 20:39:41 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id A4DD625791; Thu, 19 Nov 2026 12:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=kLGFjAZekQM rnOWQURYvjxdaFgHeFlhem0RNmV+idrk=; b=PscMuQ9a9wYep13Bk9ZhanbKEle jOhr1TxnPXueLEdrl7F0QNBw+6mtd7ixQ0qZZxuo8GYIl1KDqutyhPZa3w0qZaFd nD0OCN7ld25VEnv/GtjkmSF/6NNwk3PEfBlzV4Tyo3+3gObteKrFesuPmPW6cvM1 UNI6xumzELTR19tVQWjrzDw4CN7BM9136NUXWt8bq0xLuODcAuXQ3xVa4w628F7p AooltMEuyr6QQawW0Bktn1qJ4ZVvvkbxsbRK2E5Yw7vGGHgJaqNz2XRp6gcbcqfE geRPuJiJOQQTOokQP1EJqu1bAwYRtkw+u49E3tOrvByl0jqvKQ4ZRe13+bw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v2 13/13] tests/functional/hexagon: add packet regression tests Date: Thu, 19 Nov 2026 12:39:41 -0800 Message-ID: <20261119203941.899748-14-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> References: <20261119203941.899748-1-marco.liebel@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Reinject: loops=2 maxloops=12 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX9RECaoyTHn0g lPVVQNfcKNHzBDv1d9lvKqMvP1oOQH9lTN6ie7gtDT6UrNHdqGeN7QLKWzswxNk6pp9gIyIcudx 7M6rDm/LXxifE84Zoz2o9RziUxo9AfM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MiBTYWx0ZWRfX3ry0GO8jpGi6 VmOx2uxjAKNe9qKD80Ldjz0uwjuIv/Or0C1Z8yg743PovoxJBl8QKzLLb3IB+5Dp37K3I9yOqIm HYxdy1mC2QIgF53VkxE6J2x02OtGGa76vloHiZsOotoxcAqsfEncxX8A7pWmUUNqAS7A8PxAXxS h/7G/tadjNZHuxu9J7hzmJWkeVS9dmQe1RPFqvYZMJSYAhPF6r83qWkV3MV32ZqHv/3eGouuKrB G3XwM00U0Iizw4Rqt89WKOVeOJuVriCsmJ6fc9z3cilROwlNMMwmAuxwPSZOutqLr2yQeVnYGuY W0g+9qR8l+uG1l+gMu0HwZRoY9ViiiB1b3U03rAEGs1/T22X0j6X4hqmGykhgLVb/8PA+jURi42 TsAWgxGpW4zQVQlH8sqoJmVsT7XQhXhXfdDYURIu0BPcvQi0qfFyVUxYnoUfs0PDI6Z9mVN9GJS 4gIJl8PML4bHf3mB/dg== X-Authority-Analysis: v=2.4 cv=GZKCDgXL c=1 sm=1 tr=0 ts=6aff5e8e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=5vFef2XoAAAA:20 a=EUspDBNiAAAA:8 a=Z9VDHF9Blclki5krBAIA:9 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-ORIG-GUID: lwIfdOUZQfhm2jxbQmoMp02jPmJtKplF X-Proofpoint-GUID: lwIfdOUZQfhm2jxbQmoMp02jPmJtKplF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190082 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=mliebel@qualcomm.com; helo=mx0b-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, 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: 1795120914012158500 Content-Type: text/plain; charset="utf-8" Run the standalone packet binary from qemu-hexagon-testing v0.3.5 and check all 11 system case results and the final summary. Use the existing standalone archive layout with a checksum-verified release archive. Stop QEMU after the runtime prints the results. Signed-off-by: Marco Liebel --- tests/functional/hexagon/meson.build | 2 + tests/functional/hexagon/test_packets.py | 47 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/functional/hexagon/test_packets.py diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexago= n/meson.build index 3dd40ed046..a653a4fa76 100644 --- a/tests/functional/hexagon/meson.build +++ b/tests/functional/hexagon/meson.build @@ -6,6 +6,7 @@ tests_hexagon_system_thorough =3D [ 'systests', 'hlx', 'minivm', + 'packets', ] =20 test_hexagon_timeouts =3D { @@ -13,4 +14,5 @@ test_hexagon_timeouts =3D { 'qcom_dsp_firmware': 240, 'systests': 180, 'hlx': 180, + 'packets': 180, } diff --git a/tests/functional/hexagon/test_packets.py b/tests/functional/he= xagon/test_packets.py new file mode 100644 index 0000000000..00ea7bf49b --- /dev/null +++ b/tests/functional/hexagon/test_packets.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from pathlib import Path + +from qemu_test import Asset, QemuSystemTest, wait_for_console_pattern + + +class PacketTests(QemuSystemTest): + timeout =3D 180 + + ASSET_TARBALL =3D Asset( + "https://github.com/qualcomm/qemu-hexagon-testing/releases/" + "download/v0.3.5/systests_standalone.tar.gz", + "640b0aa60af7d3e561c25c33079c31dd6a7077fed757f9d29c0ad9ee9f2eca19", + ) + + def test_packets(self): + self.archive_extract(self.ASSET_TARBALL) + kernel =3D Path(self.scratch_file( + "systests_standalone_package", + "StandaloneSysTests_6.7.0.0_v68", "bin", "packet_tests")) + self.assertTrue(kernel.is_file(), str(kernel)) + self.set_machine("V85NA_1") + self.set_vm_arg("-display", "none") + self.set_vm_arg("-kernel", str(kernel)) + self.vm.set_console(semihosting=3DTrue) + self.vm.launch() + names =3D ( + "hmx_address", "hlx_disable", "fetch_cause", "fetch_pc", "faul= t_slot", + "fault_validity", "inactive_badva", "store_priority", + "alignment_priority", "store_rollback", "vmemu_fault", + ) + try: + for name in names: + wait_for_console_pattern(self, "PASS " + name, "FAIL") + wait_for_console_pattern(self, "PASS packet_tests: 11 cases", + "FAIL") + finally: + self.vm.kill() + + +if __name__ =3D=3D "__main__": + QemuSystemTest.main() --=20 2.43.0