From nobody Mon Nov 23 04:28:10 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=1795125610; cv=none; d=zohomail.com; s=zohoarc; b=D/7ZNFqL0vcZsjaEQHQ6RQWz5wxIGbH7PojYgIWGESfhDH9Xa1EsxG2QUVfSZo2e0PbunVSLQc8QT1ogGnicL+5X/CfMhVEHfBlCxt620GaoN/a+D7NJJ4v0EFWA/YLNTUR2ogfFzZvDCIO4zsuiHqEluoZYVD89u1jj/AA3EFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125610; 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=p1RVaOWbtfQbYQjs/GfhBdK5/KroMVgCk9blW8QDqzY=; b=VBprAFZK7Sd7jc6sTvMAE/1tMrD5uP42BFFMoNzinHR6YEDbMmShpshzR+doYipRV+sZhnSH97tvP13/orwT3dhsm7/dYyQuaCDTOKvWPG1hYkpsOq1KqZIA1d/p4a7zBo/DC/wOgXo7IjUl6C72wxKUm84VblYyjq12XSNdivs= 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 1795125610672181.78423409055983; Thu, 19 Nov 2026 14:00:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9n-0003Bl-LP; Thu, 19 Nov 2026 16:59:03 -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 1xUA9l-0003A2-Ju for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 1xUA9h-0006Zc-46 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -0500 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1Ow13814584 for ; Thu, 19 Nov 2026 21:58:54 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xc6uj1b-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLwr8o1783825 for ; Thu, 19 Nov 2026 21:58:54 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 6AJLwrlu1783803 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:53 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 398CA23D1B; Thu, 19 Nov 2026 13:58:53 -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=p1RVaOWbtfQ bYQjs/GfhBdK5/KroMVgCk9blW8QDqzY=; b=ZlW0C1xvtpBBowB168pj9g0kG1w AR+RNgDZjpflsAkI21twMx2pTfzSxh1U8vQlJcztNwNcpaohZj4rvBMgr1WaVv9C dgSm3S0Yn+xnGARBp/vy/RVoorG3mCgm6aOZD7biX4/wIZxygIwZ8su3s3oFAekT 63PeY3qgYD3Ei7CnNl/HX0d0rNRuZ6jmpflZyvsvLjOCHpnMFuqsheH4IDSt6fnm yAZUdAbnpzAGJV2rze+ig//ir0+fgPBIi1Ztust4s/z27rdolw+oWpd6nlyZk9UW h87XcT5lx+cJT5xg2/ijzEj9GV9xvAbnfIdtN6eAN3fRSKufysaa22tNJ1g== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 01/15] target/hexagon: read the old predicate value through C4 Date: Thu, 19 Nov 2026 13:58:39 -0800 Message-ID: <20261119215853.987158-2-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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=ef+o7LEH c=1 sm=1 tr=0 ts=6aff711e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=YG9VzMu1pjctpm2pRaQA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX/fqVQjRj+xus MtURuY1nmMRUkFgqgEaZX+usMHQfFgxkpWkI5pw6TYW7/9h22h3oVdAe3vpHAIlAm71KhmHaSVC pOf+JXXLJ2zTaiHcEd5CXiHwgh1055uJGzOo49SzDd8SS4B13fOUBCbIxcHY6OdkYEVUu4DLIDs GdC8kNKNwYX1TwGUMHqE8lhchfudD50vfcXqEHZ0sYRn/W3EyM43+CSKU9KmWiW8kwRbMtQH9g3 3MsuDEc8G+mkIxvAIOy675XmLtrb6Vm9Zn+yqJUaEAlJYdn39OiIO7l1DXLFdkNHzRiXfQcprEo DTmTHTq7L4VI0BlEbBLIo8pyU/jP7nxjg599l+g1lmQnuD6757QvptZCpVobaszDS72BK+/v2eJ ApGsoeSgA9azxBvC+ScAiS/HzStVikg9sgVnF88/fqeIb9fQ+/qVeWueYNgf8Areb0r7lChofvS EkrW/UhI7nNRKNiJ9Pg== X-Proofpoint-ORIG-GUID: XDumqyoFA633GRC03okVSSyfVXnix_tM X-Proofpoint-GUID: XDumqyoFA633GRC03okVSSyfVXnix_tM X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX8raQCRorkFbR 5qGVw7McJiqjE9JzmWptDgkwas31SoO4TzrgCq1CO3aDUfXSK0EvzBs5VcF+6A7C7wD7pbbHjr2 ho9Y1AWbXTqiysfJwibD8pMAzBr0J4U= 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 phishscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190088 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: 1795125612384158500 Content-Type: text/plain; charset="utf-8" Track C4 reads as reads of all four predicates. This prevents the packet short circuit from exposing a predicate result to an old-value control register read. Reviewed-by: Pierrick Bouvier Reviewed-by: Brian Cain Signed-off-by: Marco Liebel --- target/hexagon/translate.h | 6 +++++- tests/tcg/hexagon/meson.build | 1 + tests/tcg/hexagon/packet_user.c | 38 +++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/hexagon/packet_user.c diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index bc3b49ab06..c988c85f33 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -248,7 +248,11 @@ static inline void ctx_log_reg_write_pair(DisasContext= *ctx, int rnum, =20 static inline void ctx_log_reg_read(DisasContext *ctx, int rnum) { - if (test_bit(rnum, ctx->regs_written)) { + if (rnum =3D=3D HEX_REG_P3_0_ALIASED) { + for (int i =3D 0; i < NUM_PREGS; i++) { + ctx_log_pred_read(ctx, i); + } + } else if (test_bit(rnum, ctx->regs_written)) { ctx->read_after_write =3D true; } } diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index 70f6475656..b3635be3fc 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -96,6 +96,7 @@ 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']}, '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..acc77202ef --- /dev/null +++ b/tests/tcg/hexagon/packet_user.c @@ -0,0 +1,38 @@ +/* + * 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_predicate_read(void) +{ + unsigned old, new; + + asm volatile( + "r0 =3D #0x12\n" + "p3:0 =3D r0\n" + "{\n" + " p0 =3D cmp.eq(r0,r0)\n" + " %[old] =3D p3:0\n" + "}\n" + "%[new] =3D p3:0\n" + : [old] "=3Dr"(old), [new] "=3Dr"(new) + : : "r0", "p0", "p1", "p2", "p3" + ); + /* Packet reads old C4, then commits P0. */ + check32(old, 0x12); + check32(new, 0xff); +} + +int main(void) +{ + test_predicate_read(); + puts(err ? "FAIL" : "PASS"); + return err !=3D 0; +} --=20 2.43.0 From nobody Mon Nov 23 04:28:10 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=1795125615; cv=none; d=zohomail.com; s=zohoarc; b=Nsefy4eQQMzIaaRa5/g5QvjaQqb1c2bJa9qP+mmIGvEOYMjzfJHSLWBdbzw4KESH8zwYJ3AlGU1qb+aIRntcoKjagYy7xUHNw21hDhhipfhW76VZ6Hn+XgheofgkkMMhBTqxz/XFE+fRxVrkVDE82pc+ESBiWXbDgviWiRurrMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125615; 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=1ox2ZlUIMoPRycCE62DtwsyfoWgZo3Ly5koTPLonMq0=; b=MVBz/KUEWv0pymrVfGFK6zHHsa/eijooTejcD7k7iAJAIyHfk1Ej+yXF6GnxWVWYyzyBcjcSBEzyOzEb0HUnSwY10KhFQc+wIxJAVlQYJx1BBN/TmUa7IIQQI0R2zizTkuT/OqqIEBazZbwCeP28MhMeAGt23mouVaA9F1fmBJM= 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 1795125615490498.81350793372883; Thu, 19 Nov 2026 14:00:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9l-00039r-H5; Thu, 19 Nov 2026 16:59:01 -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 1xUA9k-000390-3p for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:00 -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 1xUA9g-0006Zd-SR for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:59 -0500 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1kkm3148691 for ; Thu, 19 Nov 2026 21:58:54 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1yx6b18e-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLwrVR1783827; Thu, 19 Nov 2026 21:58:53 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 6AJLwrxj1783801 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:53 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 3D76A25229; Thu, 19 Nov 2026 13:58:53 -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=1ox2ZlUIMoP RycCE62DtwsyfoWgZo3Ly5koTPLonMq0=; b=QUTj/580BzkhvzIHPhV6aHIjnaz OOEoYR8p7uedTVjKwf6JlSNYxCt6LuMNilD5q62t/qrEdnmDuvMfBEORZQbo9iE+ 5ZHv/iYJkqCeiBg/fuF1HM+AwDfZkdBDoIImHfpgnWz0wY7q0YhHG85o/Xdbsu22 Fthfpu3IMO0fHoe7tSST7HMVgl36XbZHh8HiYa0NUHn0Xgaw9awKiJqecRFf6xFo IEWTOdnNT4gZsypj5sQvzQelspu4AbxRFCalK8RoRpXdrcm6FcbHVP516l1mBfrK 6o/EFt+s1T/i1UBogv7iCKcbmu4XyfasKcbcM9xtQ51Hs0vpQpbR+V2h9dQ== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 02/15] target/hexagon: allow writes to V85 USR coprocessor fields Date: Thu, 19 Nov 2026 13:58:40 -0800 Message-ID: <20261119215853.987158-3-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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-GUID: I4dYGrH-pE2mG9pJ59ZfkzaZPttO6Z72 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX+ryNfRssD3ao 9+DR3m24jAhSEogV9lKXvGXM74hje71sAnOub6OQElPGT8Yjk0yw4kV9A41kyYcy4Gpv53r7zxV hx9Y0kB2hYhz1XrI1UgJAXCDnD3q5XA= X-Proofpoint-ORIG-GUID: I4dYGrH-pE2mG9pJ59ZfkzaZPttO6Z72 X-Authority-Analysis: v=2.4 cv=FPmOVOos c=1 sm=1 tr=0 ts=6aff711e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=qS8oT8J1kFDks1gOr5kA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXybxYoakWKXzp DjlB7+Ug66UOmTA0oRt6riIQU8UJctMAnAlE0i2WU4QDjw4oVNfdb805ONRJU8C2PSP2LfUMUw5 apL1v1xtEs9rL3fHDzg9/80frJd6sR1UJHdTh37/UcABFSnildU/eyjyt+9Vye9K6LOhG0Cdrqa NzWiOSrcaMS/5riVm/bZxG/6fi3rGxZGmop7YPnz8SVTjwbiBBV5+HFG8nEvZnEdL2yIMeiU3V1 qGRsq6c4CTUwGk6BTv2csWDQd4pkWBDaacRs7zQUPFJKdTe/nGg/VIDOf5C9BJh2Cduvkwq/EPQ S9e9xaq3mQlVHG3NG4mavy2ieoWs+/aXiqXL60C9pr0E3FCLUp++1sn4RTOc1DJ6qCNDfE2casn gi7a/NpvqoqoivV4nIVCMsSvjzP+m64YMEFVEiFWajifbANIeS84k8jVDqbJtEv7m0Pl4etTMkp zL2tMtndPlhGbuC6XiA== 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 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 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-2611190088 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: 1795125616336158500 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. Reviewed-by: Pierrick Bouvier Reviewed-by: Brian Cain Signed-off-by: Marco Liebel --- target/hexagon/genptr.c | 6 ++++++ target/hexagon/reg_fields_def.h.inc | 2 ++ tests/tcg/hexagon/meson.build | 3 ++- tests/tcg/hexagon/packet_user.c | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) 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 b3635be3fc..cb2e7e68b2 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -96,7 +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']}, + '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 index acc77202ef..1343a0287a 100644 --- a/tests/tcg/hexagon/packet_user.c +++ b/tests/tcg/hexagon/packet_user.c @@ -30,9 +30,27 @@ static void test_predicate_read(void) check32(new, 0xff); } =20 +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_predicate_read(); + test_usr_mask(); puts(err ? "FAIL" : "PASS"); return err !=3D 0; } --=20 2.43.0 From nobody Mon Nov 23 04:28:10 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=1795125612; cv=none; d=zohomail.com; s=zohoarc; b=a5MzEaUAvaH10Zu9h1gGAbhBvyPA032JRXSpWz2rt/fMpfBNOkVfoXp+djj723gpm+8AJa0zvA2uELigWXAzM4Eov7zmDdRDdSkUb85BDhkVy78Jk1BUW5qw9Y4/oPRdnItlg8/8Jib+dE/ILwnEGbhAT+J21rb2qwsEfDWtguI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125612; 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=CL3ZNiB9dQUJQPHN6Kej7TfgEMRuSV1vdZyCqiGofIE=; b=c6v3bqVqlJx09hnDyF9BUEH0xB5hvy6zpvxbyFjyqpF+tG/MnO4BwzhyO/tZNxlsQhDKugkh9glTNZt6oUryUFTp28LmomKtyBAmKEH4hTX4cnn5iXIE/h541l/ZRbWrrymaJyf3WklAZpAwxZpInXSAVMuwwBs4+z7tkysPFxs= 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 1795125612242900.2993580882983; Thu, 19 Nov 2026 14:00:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9p-0003D0-OT; Thu, 19 Nov 2026 16:59:05 -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 1xUA9l-0003A1-JA for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 1xUA9h-0006Zf-7x for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 6AJJUY1b3367508 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27b5rnbe-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLwrvv1783830; Thu, 19 Nov 2026 21:58:53 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 6AJLwr1v1783802 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:53 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 4225825379; Thu, 19 Nov 2026 13:58:53 -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=CL3ZNiB9dQU JQPHN6Kej7TfgEMRuSV1vdZyCqiGofIE=; b=LNUSaMd+ASSldz8DaS/JHQ2aD/7 zO6T5KjBzLpw0XHZ0Vt+NMUltd+ku5AOdkcyPLtgyENVWNVrTMuD5WO7fFEvopkW HnVH6nUKQLzrbsX4cERZY5K4tywqRqiWllb9/7NAGV79+Lpk37NeGcsxSTjiMHZ4 C+44Po9BynAf9LLoLH+ST7yAQ0VS1pxcwz0cYdVedWI1yJs26jOghJgGNHvC//S3 RTFsF53DJeQpDSmcRsoRoseUKelNTV2VkKdjOSCRbyd+GV3jpT9FcTIRE8evM8+5 pSHyC3kmy/SpUU7iluENQ/V1BMEfI7BbP7Vl5wxGQ3vHfg68s9WKSYqjYbg== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 03/15] target/hexagon: suppress LR writes from a losing call Date: Thu, 19 Nov 2026 13:58:41 -0800 Message-ID: <20261119215853.987158-4-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX5SOhgtmRPZ/j UKB4J8of6VerXnvQ/kFs3BlvYh3mWvY4ujC+i1SKeVM2xaPY9ZXqGqjHJfR46LoKicPQ2Zj1dh7 YMWWVdyo+BwSO7aTux4AdQFCw0lINjk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXzUskv7ZPWMjW NXyd8gTC6NrC2O3kmHHsjsodK2yVlk1EXMK7GoOBlD9eyvzyrd4xaE+WstxCP8FWVvIvUKQ75Bg XkjJOj9FoRWfXMbYV1bnh60LxnWUQ120pbyK80cX8APvD7SYKDY9V2ribMZrust6VZlmNt15kJm msT9ckxDZhTLdbJUeEz4VxmrKgRYgwnN5w2x+BPc29dVnM0xauqJW0dPriZaqkm49h00jvo7MJC l0xwgwSAjM3dXwvdfsv1f7l9VyKVH05yNQoK3IVqMiVmW9rv8E728OCt5JJTolZJCJNVld8MaTN 5KEaoj2rwMzcJMHglPPzvNeYLFqDYu9lJitEhef6+NAAafUyH/k7A84JdzWw6IBt17iLlZ693xk 13mkkWxexElXrCLBzvr44gqGu7Rzps4XaiE299DpEGbxishj8VwmUOPdoaR/fFzVqoym7HMtcsp HKED72p76XnTmrnsFpA== X-Proofpoint-GUID: aIz21IneoR_iKerfaW-Esjlv3iyZZb61 X-Proofpoint-ORIG-GUID: aIz21IneoR_iKerfaW-Esjlv3iyZZb61 X-Authority-Analysis: v=2.4 cv=LPTz05W9 c=1 sm=1 tr=0 ts=6aff711e 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=-Ps3b4u8n0j1yV-_ekcA: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-2611190088 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: 1795125614346158500 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. Reviewed-by: Brian Cain 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 1343a0287a..4b23a02a79 100644 --- a/tests/tcg/hexagon/packet_user.c +++ b/tests/tcg/hexagon/packet_user.c @@ -47,10 +47,36 @@ 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_predicate_read(); 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:10 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=1795125728; cv=none; d=zohomail.com; s=zohoarc; b=mnPY9/9SWHhzMCGORfRNE0djVDUR26x6mBOLvFvgo0pFJ64fuu082PmFdSAvOLErz2vqDH83MeFEbjRIml0aMXDLxjKN0oNPq+L1Ah1X9R1bJkGF3n5XGvwLEqjlVTEqrRe/uzIlf/hege4gxykvc7Q5pBmG9OdX6b8UVEk+kFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125728; 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=KPV1ZXv9EGJwTz9glzUKwTI5SWkFIm+3uFyt4FC4+aU=; b=aKPzpe0Xnta8ARqbvxtpVb/NeCN4DLi9dYKqKXqQYJma/ZXQKDQldrx9+hpKkdx3MqogGebShwMN7oDjyBIg3cl/ulQBQFSTqk6ib0bJ9b/v8TILgHSyk2JkouynB1gaV+4S+rmEaDn4XqdwRhYCRFDAtP1ZdVfCr72V6foyLQQ= 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 1795125728780450.1979257801328; Thu, 19 Nov 2026 14:02:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9s-0003EA-Ag; Thu, 19 Nov 2026 16:59:08 -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 1xUA9k-00039B-7v for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:00 -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 1xUA9g-0006Ze-R6 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:59 -0500 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1Sd71936307 for ; Thu, 19 Nov 2026 21:58:54 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j22ugt9j3-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLwrVn3770693; Thu, 19 Nov 2026 21:58:53 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 6AJLwrw93770687 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:53 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 46B122575D; Thu, 19 Nov 2026 13:58:53 -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=KPV1ZXv9EGJ wTz9glzUKwTI5SWkFIm+3uFyt4FC4+aU=; b=UaioQr2xcJAIM2eT4tnZc+frNs6 yUxu4kJJuXAGhj2xYBmgRIwi20yObdoZcqGY+hnAmLBSHA6pX5iPdVYz5954fddv Alm1YPaLHW3TJSr4N3W0B4VhU1ZYiS5sLzXKnCSvot7c7pxUtiMuh8KAsUfrPOiV FYhzBHW28OABkLHmZ3o/76fXuQxT6NV4bFiC5oWvK7fnuyae7l6hKaECKCAFbIPN FHXO/aWGMeMpyZGUktf1Lk7E1FWmgN4k8AbrQIVIAvstZhIfkHMkXDmJnI4lewJ8 XsYcN3UFTAOa7jRtaMrMG0ODv2INHoxxXRS8egbVCh3q1ZW8fxswRg5CYbg== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 04/15] target/hexagon: reject HMX operands outside VTCM Date: Thu, 19 Nov 2026 13:58:42 -0800 Message-ID: <20261119215853.987158-5-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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-GUID: nNKPqxKc0Apt6y2L187SgQU5EwnaSEcv X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXznPUjLnfiSxD BDVX4zcvIq1ZjC2b2HHXzgGdds68ZvRN05/DMUQddiOLeh9RfJszilbvIUmI/Jq5CwUWGQgquym 2pDXSn/WnaSg/jSko8iaD2FFGsk2aaM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXzyJUAovGi76I CzXQDNFtkesbf7U0kQVy01J0lzW+8aWqvS44i9PTBLHbEwDEddy3pdwLeXMwbeZ0VVdgFHvIyx8 7OZ5tC9rkQQAAsxoKw6v3fZgpqcFF6q2r3w6WjziNW566wLR6QX9zO7D714VYvm62K0nXwpaJ2c 9RxwDyY9gJziSNPxK+46X/LqD+mc+vlnSa/dYqhSfwe1856ZZwq4lT6cJ8cd3jWOyB2nmXp2JVq ptt7YmLzRQFkOIGqEsq6t7eb9BsZnf+OHSKiSN6dzU4nARtSRSduWwLG3WqTWMRyGCfVRnQgIwD loPDQqZ7qMofwRza2Ay7/3xVuG8j3TRYZ2RYEZp9BQ5kN1ud7zu9hueI21GrLbatpdDSwlwYG6T 9Y80U1lA0CyMr+ouepZGi1JxCQHpLX8+xb6jecuxgXcb/1cslOiYtHo8EGMWjrPePrvjzDrucKl qCXaHy8VSykkMleDevA== X-Authority-Analysis: v=2.4 cv=YeEodARf c=1 sm=1 tr=0 ts=6aff711e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=AOcVaDlDQPZahzFAqEIA:9 X-Proofpoint-ORIG-GUID: nNKPqxKc0Apt6y2L187SgQU5EwnaSEcv 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 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190088 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: 1795125729596158500 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 c988c85f33..aaafcb0954 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:10 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=1795125722; cv=none; d=zohomail.com; s=zohoarc; b=GRTom4TwflPkI2XPJnOUMWFGKF/OVgtEw3sQMr4X6nEz3gWC0qmSMNzmbAUYcD9aZETFyD/+6cGLa9CzTQvx+wJaeofEjOzOGW48bDQ9ikIjPIsuWSkP6BTwJ4WurZ/AtdwSvYck1kcsqSeHzqJah5xxe2RaOc5skQcpgLnogIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125722; 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=XdS6IUwy5hjyxzXWpJVR89i6bqQBuQHFOPwe/SLcuNY=; b=FPcxARV/xHm/XPVsVuph+YN/R6aDsxbHIhHATJg9J8elyOWOP13Utq9eUHxSOKnC3ywZM62DJw3irbQtkeaLVbKvcJzXUxDFpDsaHdA0gwQdAV07eZjjyT9+2qPmo9MDvfzVqwKH6O2DxC0OZzps+w6hbW9LNdzwEVyQnfbK6is= 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 1795125722637164.92142312973488; Thu, 19 Nov 2026 14:02:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9m-0003AV-7i; Thu, 19 Nov 2026 16:59:02 -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 1xUA9l-00039o-50 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 1xUA9g-0006Zz-TD for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:00 -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 6AJJ1SnV095109 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1bf71-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLrv773805686 for ; Thu, 19 Nov 2026 21:58:54 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 6AJLwsGh3812750 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 4B4662577C; Thu, 19 Nov 2026 13:58:53 -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=XdS6IUwy5hj yxzXWpJVR89i6bqQBuQHFOPwe/SLcuNY=; b=SZ2QLRgl9sHZ+XN4YNCHEVgD+0D 3rKf5wR0KHSP7gNwarwwyMaW0Rjf/lPmW2FFGKNMEzEgzCXiqkzDxrwiSc6QwLfu iNrXDx/SnCA3rj/qKVLcofZ015rqs0el94PWnj9HGuduW/JFXCu1JAfEuCKw5IXY 8wsBu70XMQG/dVjXhTHCAcnMiXjiDquEfKKovfS3xx5IP98+br8We7Fv5EjytLPq DqIGCq1/3uLL1L8qSoOMUjXB2w/bsc+rDiJm/eRG8x5RQuQy7qQhUX4hTfbT9yOB 1BMy9VTQIh9lRjQgtO4PXmEMBNSy66ER/aMvbnxLbhMgTrB3ObT3eAbTtaQ== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 05/15] target/hexagon: commit coprocessor results before context changes Date: Thu, 19 Nov 2026 13:58:43 -0800 Message-ID: <20261119215853.987158-6-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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=6aff711f 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=2ZaAnrbsLTiuA5g7MksA:9 X-Proofpoint-ORIG-GUID: DodZNidkbRCegq_7juUoMSwFC_pycukx X-Proofpoint-GUID: DodZNidkbRCegq_7juUoMSwFC_pycukx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXxdcDNkMPkAWw qlubrV5KUarPWpAvDEBsVVKwr+vG3+bJqlI+IsqsGXyuMqgWgGFiJu4Wi1SpjARNDiMnN6Gud33 m3DVLzxqa+2ENTatw+S59TgZ8m8V8/f3bFXqr7FzO1OxdsIRZu4azBCyD89YcICn+lXepcQqkv4 NNY0crHMdE1ic355fg3VlbxRdM0mBJlIb5gizx1Krto0z3hpwD3LMRXU8FfHy8nwegR75oYzzr/ vmHAPUqDKJo41Nxdb5LcKxRvR0lGCp7pQP58dKDTLO8Ovkn1FxA45sncK4DvK4cCI7E9zbEk6ro Pce8Z6x5qgpop3GAMxUKrHVjgOkq225WQLuWQcH9JRty4PQvhRfqdaVrKaIlFp5+jda+G7kadft /yMs53Sswh654NGZjYZqkXuWwZtLqjd88PLSI46ePCHw/ROEbtquW9FwdTEeosCBML1dgOq3DA1 N4dCceneGjVUemsZU1Q== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX8PdJ8HF+cirU yDdpqNxHINR9Rms3i1nC9B/NVQOPWPlF9W6+93DdrjdQ+sdFgU2Uh+ga+KJo4/+hJXPuizS5RVH z9NogoeY3qVZPXNaxCVm1ef96seV1xY= 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-2611190088 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: 1795125723461158500 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. Reviewed-by: Pierrick Bouvier 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:10 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=1795125590; cv=none; d=zohomail.com; s=zohoarc; b=lKXPyXen0GiLfxPnzM+xysJY/7LwRPnKKM4N3yQGc/2/9+Yg05zPcKUio9wqZEK/YeHSi1bxah+h8xJt/l3AhRHrh2k0og6x1yzG7YEC8B4t6bjAnCtyqO9ChMhP1wCuYfTL/yuiwOKJ4iNJ4gxkeAdiIFntlJklNwyhuwjy6Ug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125590; 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=d0kVke999rur6drkLHFxztqnMjHAuMDK5K6ETJehnR0=; b=NVTpH03vz2SVGUJxMAnj0N73nuz5sP8cf0jGLqO8TJrp2wiQaTykqcyZB4ISK38zcHJuR1mY48pJQJGJWe69H6xSHxtlAafGxCm2ZEYsDwnjqHRy8IwMr8KlzSyk76JUCSeEognaaXuNWGG/Qxpah8J6Kb6HP/Yl/mlV6pMy8eM= 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 1795125590070926.5779709845356; Thu, 19 Nov 2026 13:59:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9p-0003Cw-FL; Thu, 19 Nov 2026 16:59:05 -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 1xUA9m-0003Aa-76 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:02 -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 1xUA9h-0006aU-C0 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 6AJJ1Tkc095198 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1bf6w-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLws8b3770711; Thu, 19 Nov 2026 21:58:54 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 6AJLwsEG3770698 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 504F62577E; Thu, 19 Nov 2026 13:58:53 -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=d0kVke999ru r6drkLHFxztqnMjHAuMDK5K6ETJehnR0=; b=Dl9O1SfFbUXUrUQr6wxUGeAW1EF ecaTpN5ODs/nWuv6cLrRcJQdfQ2OTVoHzZbID5COeQzotcrrq1exDe5Tt6zx2b92 E63/wkuZx1wqgtuAs+VUhHSjvAuD3USsuJJ4uuO6rEy4oS8qY3Cl7p/jh5hInXfD DG2GrFC1ru5batM2ISvMxNuYB19ZekCXLdZnWfoA5pc3o2qrhQW+Z62IZVQAqodM SdTEq0SviQ8xcWlpmQdzSGd1KuNSxuJ8kgRFy4wZfCX2/jpcv9lWrcDgxCYvqFiv HaTRjRP3N1k3yb5e0tmOI6vbrUQCH/VctAGgjneSOFhJ43D6euPqWfaoY2w== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 06/15] target/hexagon: distinguish packet-page instruction TLB misses Date: Thu, 19 Nov 2026 13:58:44 -0800 Message-ID: <20261119215853.987158-7-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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=6aff711f 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=fbzj6gRIl7KxkdMa5FcA:9 X-Proofpoint-ORIG-GUID: TesJ6rOp2f-QlxststvUjsBvsfI_XUFJ X-Proofpoint-GUID: TesJ6rOp2f-QlxststvUjsBvsfI_XUFJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXwFrOfYW2Pv4f 7/MrwuCKTELcvhdfzVZse3WZs2ApzId5BPdC0T0xzClgsoVmpmTJbHAWlJPwy41nidgFGuaz9OF 9j3MUcExBe5UF1tjfGGlRvEDQedC7BWQ1o3qvKHar02urCkD4EXQpFccKlu2FE5FkFJJPLqhdY5 Q3KJXFQWUk/ozRmjnn8VoMT+7OXgPaP1+/UY9FySbymBfl4RwG4KKi9Nm9o1TvLgteH784hM9Pa ScJ4lmcXj2UFm4GBNZpuCu184UaeuGve3Cn6wOMgUuQV/etcArAJ104HNEeXrEGE8EKhwvp2JhW 1Q+1B26ADMW1qCs4jc9uzhMWAwupboCZydY/DqC1Yojm/0e0WLaJjn9VUQz+k0FBk/QAwojC71E LJkqro7+AHW5G6aivgEmpTEElmX591jLO+BPvFwx3k3FK4xOmIKGLEPXXPhXicys87HUj7QySZF WpsESxBGsJF59iDYcdg== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX9OVb9dtEBmSJ sgHyWZ7bKqtIesO8c7hn7vVZYYu3py3K+OWCVfLpxnJLaKaIkkyMdYyucJIiocUEH90lbB3K4UK 9kDtgRl+ol4K0CiCl6vvRswRAI9XeUs= 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-2611190088 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: 1795125592144158501 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. Reviewed-by: Pierrick Bouvier Reviewed-by: Brian Cain 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:10 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=1795125589; cv=none; d=zohomail.com; s=zohoarc; b=ZBjydIkY1hq7LvqZz8sM12paHa2SX3EQudIlJhRv0ng7f0Ohq78Sl55700i+ZJta+sgHeLiFatU7w1lY2qfYCozPueohZLYh6pW/1LkUayCx9FfJ4IRTXfWAo9CXg+xSlTPdQHlOaBhZzxp6LBV4LqokFZ0bt0auHEYLMhFiA38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125589; 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=5dva35PM0dnhdrmFSBWAu6N7kmor4hMyiOzEwZtKI80=; b=OR/zd7BR4BoQWDhQks7lc+0NQWJbzMKntwhX6t410B3p84U9Wk6b1PunIDSsUm2D2RMRtiSmnSZLZskGEh43J/MhHo6euJMRRc9YdXDujuNwvfQEKuIFs6dqtm3wFId9EU+HrnmBE/VZCV9s7wGyH+yjcgkQV6e4c8QY06TcB2A= 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 1795125589522537.4423600256729; Thu, 19 Nov 2026 13:59:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9s-0003ES-KU; Thu, 19 Nov 2026 16:59:08 -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 1xUA9l-00039p-7T for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 1xUA9g-0006Zw-SS for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:00 -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 6AJJ1Rea1671581 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1x70bpuh-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLwsma3770712; Thu, 19 Nov 2026 21:58:54 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 6AJLwsJn3770699 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 563BE250C6; Thu, 19 Nov 2026 13:58:53 -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=5dva35PM0dn hdrmFSBWAu6N7kmor4hMyiOzEwZtKI80=; b=Jc5+WIBxXLuQMRk47h3G0mzlkzX vJHVQmlOlUlU+/9+yXEa6gNtg6Qfu3D7c4sBEdsumKwe9qhcDaoebtYiSuzRzofu GIU+JfFVtcOfRLPjE0aNrxn3q5nZ2iCZ/cQw6Lirk2/LIrPaelVO/k91Pz2NiRYK fMi9m3KaxlNtUIeDkRLkM93BuUFD5xQd6mGejmzxu9OhWdaRgsRTuhHAEuJFrAK7 o3XcdSJD/u0gH5IHGpPBY97lTJjzgvndnNqALw7wG3/6IIdkzRXb9Ebj2rOMM8uq cHlTSE/gjqbYpnjaUxxNIaYYbdEB/APJD350PGRtCOekA8AyS4IdSAicYAw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 07/15] target/hexagon: bound packet lookahead to the current page Date: Thu, 19 Nov 2026 13:58:45 -0800 Message-ID: <20261119215853.987158-8-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: 8CJ6db55jh6Yzh0kww-kTJKWxbw4csff X-Authority-Analysis: v=2.4 cv=RdgFmFtv c=1 sm=1 tr=0 ts=6aff711f 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=2ZaAnrbsLTiuA5g7MksA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX1kd8vlSdDf4P wcfMtMVCrBWWLKYKfrvT5FlIOMGBo1+YNrxPVSvocCE3dPg+ARQaGBXJSab8rDla/+HpfpS0u6O 7tZ4fMMuTCLWz1ceojDNl6kWuTbeZRU= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX6LuN87E1ty4V JsEtHSQj03JUWw2fS8NbRQ7D6/ddgosvioFsMSVHGlZE8Kdh2+hdqk/A9tIqSiBmMuXrs/n96uT vvvt3tOaD1nBw048lkI3acjiZETYZBQnC207ZUnCTrYgyXZAbWRN9C0NZAb8tTyIh6ZGR6EAVRR DfCILljDBHrT+H17rhI2QPM9fDSljcwOpmqwjQz8HJY/g7TlrTMRsMorUnLoQu1l/l+a+EO0X9J 2OnNADxekiR/eTYgoA3oiONA0YqVzIdZoi76wm+BktMTFHj/E8HVMdi7xpHd+WenBL2lMtwmT85 DZXNZh5Ypp0Ziz2555CC3ejkszQTORsj7+wdfPC6rS4tI0yJ2wraRCypifK6KePEHs/ritBKGpq 2pB8z7sKiu76nHkgXkeQ4pOfv+V8jlSlvP0vv3vaHNWSdqclde8lmg/XbmoHJ6nKDJnfxN31tmN lkftqVvCzHTx0e8CD3g== X-Proofpoint-GUID: 8CJ6db55jh6Yzh0kww-kTJKWxbw4csff 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-2611190088 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: 1795125590179158500 Content-Type: text/plain; charset="utf-8" Do not fetch an unmapped page while deciding where to end a TB. This lets complete packets retire before a straddling packet faults, and preserves the correct packet restart address. Reviewed-by: Pierrick Bouvier Signed-off-by: Marco Liebel Reviewed-by: Brian Cain --- target/hexagon/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 220328147f..73676f6346 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1653,6 +1653,11 @@ static bool pkt_crosses_page(CPUHexagonState *env, D= isasContext *ctx) int nwords; =20 for (nwords =3D 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) { + /* Look ahead only on this page; a fault must not discard this TB.= */ + if (ctx->base.pc_next + nwords * sizeof(uint32_t) - page_start >= =3D + TARGET_PAGE_SIZE) { + return true; + } uint32_t word =3D translator_ldl_end(env, &ctx->base, ctx->base.pc_next + nwords * sizeof(uint32_t), --=20 2.43.0 From nobody Mon Nov 23 04:28:10 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=1795125640; cv=none; d=zohomail.com; s=zohoarc; b=iO2sHyLPGh0NMVbf1Ie+6x7oGcftpuzVMEazpzvaGA2haIiEOJuAtbwnWsxeiLxpCr6I1gymjkBBLCZnOR5cyGwgXaDaG6mDo/sH8giq2IS18Xwfq+NfboPHiH10DBRsWJZIuDWWGZ0CXFwpNg366IqUJI7LoD4HM8B4wunuj1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125640; 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=2wxLsk8LyswoL/FOKGmQWGaYChPMzCUkeHVru0yxP4Q=; b=lF+9lMsovI0DCF/nb/1sULUO+VQdfGju2r8p61LPJCsx9fHrMWv5hREK7BXBO/vDyXAU+TQTZxjsZXdRoRzBwUMjZe862PMJU7obgKEjGRDWmp1vydqFWSh46EvUUINyMuMEh+dBauxWgKgdN4mtjA60iT9rU+oAQKtcPkNr1O8= 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 1795125640767275.1580917884404; Thu, 19 Nov 2026 14:00:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9q-0003DK-6A; Thu, 19 Nov 2026 16:59: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 1xUA9m-0003BE-NE for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:02 -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 1xUA9h-0006aV-CS for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:02 -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 6AJJ1T7C095221 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1bf6y-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLwsH23812792; Thu, 19 Nov 2026 21:58:54 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 6AJLwsMR3812748 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 5AA8F25785; Thu, 19 Nov 2026 13:58:53 -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=2wxLsk8Lysw oL/FOKGmQWGaYChPMzCUkeHVru0yxP4Q=; b=UXvE2l0DH9pCJBnuQ7e3rCVtzXM 78s7AJQCogXrqgKQ9o9GAPKmyd8taYkvQ3rFaJxV32r+X5kJG8z6tJETSFeBrR2Y EM//FLwC0mD6PLZcnsRYBcN3KryRzfGv/ouHB9jzq9+12Hnh+3YE5zGi4ymjsdeB fVKWcLWrKX5jPR3PD87LKjiusvqOza8Ht8YqhFDCVtiA+5bOlqCkwX/PMJeJwZc4 Dmf+L5gpP62joXoJtl1407K/xzf1XzPLz6/V4DVq28sVyqzqbMMnvkG6m1IO5fVM mbqWdCMMiiFHaLrt1D7YBShvnNyhC4p5z0EXTt1eSV71pna7ZLFfumsWvFw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 08/15] target/hexagon: report the faulting memory slot Date: Thu, 19 Nov 2026 13:58:46 -0800 Message-ID: <20261119215853.987158-9-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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=6aff711f 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=uZvwfCfAbIog8kgrQSkA:9 X-Proofpoint-ORIG-GUID: NfjhXz3v11sXU8MMWoBalrNVJlIv5zfh X-Proofpoint-GUID: NfjhXz3v11sXU8MMWoBalrNVJlIv5zfh X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX8dYf69rPrSwS F/RJe8KeLO3glw3mMyOiUprmZ6mkFGQ2T0Bdqg7gai7X9nuyHLEWYP8DnSguIpZfTO7GyU+9evN gbzqkBn/oghSpp2OKk/YIjBH9xtlfwo3J6QOf+htPtY2OSM2Duiyt5sUS0xQLtZRYmZrfJS1bDB HIjnrsg7FWCfwuRNw9TcK3iLEsfm8jvNany+KKSaOAFI4b2VSmR43KnRtWyBc2ccVyfUTh64E0j /o/luSNo4+Q2H8BVs7s+hKsUJRZVzr7HmBQZ0nWi/sPOpRcJPotISLc/iZIkUQGFIxOD3Y3fdeL xwJGAf8BXF2DR7h3rQCtihj9acmQB/I8mkWDJQa7dRLzExwUTqTtLdBm+HZ5DvuMY3qGfBcKQpB mK2KX5Q+NnRWMlh/Kv8xRIkS7IU0gC8F0TOdRSQIvF3KMXpkGKsbIg51d+tg0nZoijQP2IZSVcd q1+JPa8JA5sQcnvrw3Q== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX9XFyMTAnSYl7 Q1qaD1p5AzBuJknWblBPYNmw0ZnvjhDQ6Pevqv2vRn4JYYC79a0aG2lu0OKKH2Ru+PNzjn8KEdi 1QeitFc4uIGhPOfMTQuXAxoaiT0r4yk= 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-2611190088 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: 1795125642630158500 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 73676f6346..68d6a64fe6 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:10 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=1795125722; cv=none; d=zohomail.com; s=zohoarc; b=CDgAaT04QvUNR1TEer90ULHdewXywKRN+rkNX/X2NZRApai3ZlySGWBH0LcDAnl8oQeQSTzJDqxcLXuNKFI8jS9UjmTr9xvZoDmwiwo9dfwpp0CAcSULGjSGHngzBTQ9TgmqjpMEcbfUY7VDbu9xdlIrubJG5m5pph1vvzxl3RA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125722; 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=Tw320WyG9HAHgBL9Puhhfdy/eph5t+YAV50d16pJ/2o=; b=SKQ+jN6mo/3ft1cue4LQsvpe51O43k8uG73bWuxLCQi3qXECiJhfXEEfCM91uLHjVVMS1t9dxGdcDj1i7RTR+VAkWovoz9AMSWGAbTt/vNcpHXw1D6tIPm+Izb8i/R9rmEhim5Vg9l2hZme0L8KcwN3NYSsQqJqO3eidYBUuKAg= 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 1795125722545876.2448910928862; Thu, 19 Nov 2026 14:02:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9s-0003EE-CP; Thu, 19 Nov 2026 16:59:08 -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 1xUA9j-00038Y-7Y for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:59 -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 1xUA9g-0006Zu-R1 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:58 -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 6AJJUXsj3367484 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27b5rnbg-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLws7D3812789; Thu, 19 Nov 2026 21:58:54 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 6AJLwsnk3812749 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 603F02578D; Thu, 19 Nov 2026 13:58:53 -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=Tw320WyG9HA HgBL9Puhhfdy/eph5t+YAV50d16pJ/2o=; b=UbPmvlMDs9CbSaRqlPPmSd5pzjZ AWTodZWYzD3dRZqKDOO9IB25HgUDV3moLuRpWw4Gq9cf97DniTgSue6SlP+aedm9 4JQIFfeBi1JM56yPn8gjOuV0gD1vJAf+buno6wSOexkKVPvpA58di3HfElegn4c6 n2eYXTZS9M9hIoAypTCoUD2Lu37PI9k7TbqYy8e6Gvtynh4Nn+6gW7VY6GM6c93T IPneJKHx+o725cMIjAPOQcB3fPsCBYkUM3++7Ej1n9FgtKBichW15O2cuaqfrTA0 TpLGrrnrrGfk663vMxkJZ5N4NW+k1OrA4DArDHzZFW4IITH0yQ7arHc+kBw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 09/15] target/hexagon: retain both scalar packet fault addresses Date: Thu, 19 Nov 2026 13:58:47 -0800 Message-ID: <20261119215853.987158-10-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXxf2fGbc1M820 6dYGmJso1xgGMFqI1YHWlJiWwP/BwV4i9C1oKEki+qi2rgtKg7Cw679DugCxC5keAqwLMXni4G1 XAyo3oqR8ibS3Kys77b/0Eb42IIC09U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX0VdK+Hhyae/X HN5NclcSw0gGHAL5asHupDtuCFkzb19YfncC7ytsnQBQYjPpOuI6GWEBU0uvw6Qet7vD5NBIa3D jQdgNAhaVF1sb7Z5fVNVtjrbgOVn9Crrp9nUrBFjFYi7s6OMXnapbRVEIrSeqUUquG/xbMp8GKh e3mUng4FiOHge8wurFEWUw9aJO36gTebCoIkJY6p+R3tZp+jRRncsYkrzs1BQRqGYJWbrt42pmD QbO4xyNnH8Patmy3f5QVXg5/pS3vO7A4op9yGmuiWbdNRjXHsfo0OqF269VVTis6P5mvx4pxpwb WYuWEH+4hrP30zEbcUybOoYxtBVmGRVJF3Z7nJc5lXtzhmmcr9pVDbkZC/KOH7U2NYkBnMmM6+K 589SEJFi+FFhwJasy/ZJ/6I/R2uIawpFbZPK61xL4pfs5hil/bS4xo+/zc98VP0VQEmPD3BKCZi SqoOL8sCNDY3WM8frRw== X-Proofpoint-GUID: KmuygY9QRpzg1xDI7RvEibvpDNGZGK52 X-Proofpoint-ORIG-GUID: KmuygY9QRpzg1xDI7RvEibvpDNGZGK52 X-Authority-Analysis: v=2.4 cv=LPTz05W9 c=1 sm=1 tr=0 ts=6aff711f 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=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 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-2611190088 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: 1795125723596158500 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 68d6a64fe6..41151250b7 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 aaafcb0954..ac498b78fd 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:10 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=1795125576; cv=none; d=zohomail.com; s=zohoarc; b=EQRtLW4f9b5ofa1bhcZpC9es0keIHQsz1HKcPw6oO+DAsh15Lk9lJTVEiSGsEAOEWwxW7oFU7QmQWu98va8dB06JEuUJ1jobn3tS+o5C7kdeWW1Sp5VQ2jxJ73WVFA1m7DJtJ5aHOIUfZHDtcVynaHjtrfjDqq6QFDWV7/yt8aQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125576; 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=V9GahG9mlrjgAlDlSLiQw4PxCH6t5UqCiJbTv17m5JSpQXqf+QFAsRcWtRFxPEAB5CaUY1nh3OzKxoy3j6XMARMqWuAgwt9odwpnvoLOCQO90tADEnm7Sjss0A/HxpH/dqxc2WvG6TNKU/4DJen+ZRdvjwfyT7D5zpkh02kO+lk= 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 1795125576340816.4157739130106; Thu, 19 Nov 2026 13:59:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9n-0003C7-R7; Thu, 19 Nov 2026 16:59:04 -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 1xUA9j-00038t-Uu for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:59 -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 1xUA9g-0006Zh-R6 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:59 -0500 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1UIe1936335 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j22ugt9j6-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLws0i3684705; Thu, 19 Nov 2026 21:58:54 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 6AJLwsXS3684676 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 658172578E; Thu, 19 Nov 2026 13:58:53 -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=TmOzmpkRx2h3mn5YywKMnGEMw2z XhMor6FEhvwYdKZ63XcKjygozCrEUp3lEqzeYVoinSAhA/Ojd/g8ZJ0WIwg7KNn5 ndjNQo89CZl4kdiM2EZfNLewDEH3uooXPxnHOt8jCv4oxBYyGRY/11T6JD7ef04U cjNAOy3QthJwTa41hD+3BqAztd3kcJM1/p84m6zK0rObQ665odhxFfOlczpeA8Xa ifexLfwzsW/oHGta6OLs+bt6yLIfTd2SgW1j7BHLqZxObhcE8J7vmgijVpPtrHAA zaXaNEX5GWzKU2z3gF+kYX3UHwlQZEt4QDfV85A9HuYAXbvqod+WN0dKF0w== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 10/15] target/hexagon: preserve inactive BADVA registers Date: Thu, 19 Nov 2026 13:58:48 -0800 Message-ID: <20261119215853.987158-11-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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-GUID: 8O6OhMQ8mvPLxDueXyYWdBr97gvNKqsC X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX76scZeFY0kkb dVMGXsynxo1FW0VimFqt547zfqQIFCEkHxe/YQ5kqZys/y9vluvXHh8s2aqVwcU/zYDppgr2HRD tmIpLBg1cI8NYprep+Djxrk9qh4mUhM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX2Pk3q1idRkCG A8HdyrN3HGVNXxVtTHZNo8oQyvjMPyUStVYDqzBj3Om+ecT9C01gUMnVfRSpKbHUpq70nWKFoCa BczrVHJclbNDNSWCuRc4c319PuBBu3ssxVyThibkDP+xYybYUA6Cjs/G4kW54KeS+xVXRg4ZcBG 6y97A3xw7iurHpcgbfXoN1dOif4o6HnZQ8Jjn4eCWBZKVx/gbcaUqayWpuEw+R5GowR0jpk0v9d gmsqCvb4Fh2e65Pp0g09OyLmpzSriT0IT17kOw9Ju9yJ8U74uUOHWPyo8C3rIR41eKHfVso5HCI 9FUUWIrpDkuPRKp3FsUGiljC1TCvjdSUQxquLyMLAQ/6UnDSvYCCFdzht6c7lfk0tnwNeBiMO0b u+2FB3mUfvNb3zX9dmAoV4MaUsLb6LlUvHEyCUIfDMD/Wj4YtMHTb4NyTnCE5dYeeLlqQTiXG7L DeBw8RyBphP/f8SAtdQ== X-Authority-Analysis: v=2.4 cv=YeEodARf c=1 sm=1 tr=0 ts=6aff711e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=Stv3M7lcxomkFMvdv2cA:9 X-Proofpoint-ORIG-GUID: 8O6OhMQ8mvPLxDueXyYWdBr97gvNKqsC 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 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190088 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: 1795125578202158500 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 Reviewed-by: Brian Cain --- 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:10 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=1795125677; cv=none; d=zohomail.com; s=zohoarc; b=Dd3ZyjwCp9fxSHuF2SygAEKlMP/wbZYJ5PMvTsyt3XrETUQKnJTHqSKos2I90he68LS1iOmQf55n4LQRwuwIyMIQ6arvFnlcGOTMs0dyl7wG2qYUb4tAYszKQewqpzc+AZb9mCOq6gni7tiSQS+yeaylD+cSzKdrRHvNWWJq6qg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125677; 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=lmY4EsT16bADCp0FKALeC91bNzFk6r6tFLjBbCYzSii0LYTc1ypmHuKY4eBrxfLK3n/hWkBu+dshHDis9MrTu2+cxy4xVUrQFHjZtPMI3rshqSu7MHpI9KSE89CTOvh8efVoikIjGbNMQtdwcLJIQfDJcKwAIbDozR+J56Uh9CM= 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 1795125677019836.4253686593795; Thu, 19 Nov 2026 14:01:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9o-0003CB-3L; Thu, 19 Nov 2026 16:59:04 -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 1xUA9l-0003A9-NY for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 1xUA9h-0006Zg-82 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:01 -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 6AJJ1DId3594959 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j255whhgv-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLwsNF3684702; Thu, 19 Nov 2026 21:58:54 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 6AJLwsDM3684675 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 6A0062578F; Thu, 19 Nov 2026 13:58:53 -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=PaAm8cPvDOB9PReNKfpbqJQlbJY y0UvdWikLci5/67VoBJ4atwijLhWBNrcAb/a22jwjgvVCmyw35QhTpLOVEFzX2Vp jH1XzNg7uPt1u9gEiSNTCuGKJvV9hhwpTTsVK73VqV306+wCxGYfAzipSzByVsB2 KKKRmh0BWYKX9L+ayd+a6tqRoMMvwaFvbxJ3OlU7Nv3HjcRtIBt0L8/4f1c49K85 WfBeHblx7RmwMmNgoTBlt86U8voy5DKBEEa+bmfRwbjksgAcQu4JZH458dQO82VM 3Mx9f5ct+8+HC1ief+xay7cHXfnjxiP1fS59EadhkvEo3tirlVARELocwbg== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 11/15] target/hexagon: probe scalar packet memory in slot priority order Date: Thu, 19 Nov 2026 13:58:49 -0800 Message-ID: <20261119215853.987158-12-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX60NwcQdZKpw0 ciL1phsVFv31buVb7gwd+GUPZKWDEw1wGZUYyHE35u7me2b2wlKkQV2Z7aXgeiAKoQebm7w8eMd BZScEfgevuJb2bKxCTB4gcYGOFGsG3Q= X-Proofpoint-GUID: YfN2aTDZvwMf8Dg00C94kQh2YPuWcvjq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX2W2xFWZcdzYL 9Tym+oBDIXOpGskkPPcr/NRHDJ7dVIDLG1ikETGK6aeJ7rsPkqQqECS1169lLxSI/Aavr8pGaeq MUK98qfPKSIp5rrt5630c9QH7ST7h40OsZESbGiOm+LD9uWRkZwiwR03eBrcsga/ZEMk/IVE5a1 sRWrAJ3cB5OfPj9Lp4Cf8vRpkC+tWBk9nAlv9Ez8OsxuFoDZ0gCK0VicmQMZMHC2V6etWvoRQFK ygaLptBi/b6AMBJVbxICljOLOefoFJEr/gr7PLvJxLWca12dfD8xWa9BL2osZ7AMJvzOD8gK1uO H4gVLccXEkh9sB4IQGzDbaIcJqTrHWYtbvRHcoJEWzKc1oxsFuMgvhzR68mVXsQLQmsFMQdle3T tz81aI1Y+mR9PRFa52urCIz1zef9dTGMPQV5vXEhZHj9AbhG4r2u52KKvdKwsmAPlBydlQp2J7C FwEDm70BNQTMHKdKYew== X-Authority-Analysis: v=2.4 cv=da0VTnXe c=1 sm=1 tr=0 ts=6aff711e 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=dMN3z6l-B7iZEtH36-MA:9 X-Proofpoint-ORIG-GUID: YfN2aTDZvwMf8Dg00C94kQh2YPuWcvjq 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-2611190088 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: 1795125678986158500 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:10 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=1795125660; cv=none; d=zohomail.com; s=zohoarc; b=AEFrA/RaL+1mMHTaxk2BW92G+3Ei5JNTEk52hJuk/WeTmbvRZgcGfqwmeF7WS4vIGmiIwg8p75rN/eoE5WsrNwqepfYFwC4Mnb+UqPyoImNkeRX58eGME5mroBx/OM03kWeDSz8WvEcKCMj9fgfCkV5/ge1F4l9h8JS2cd/Yoig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125660; 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=669WWcxPlsIFsr6tsUw1SYhGitu5KLgx9EGcnDUZYjI=; b=NLcGuUYZmNXqxX4WqO2EZy56dbsFNTL/hvIaGrn3UQDQuJHOwBoMnOLuSvq6yxw+l6sNsoV/UBUlCS36nY3L96kT1EsdTW9XOcN4b8ez5KIXdO8a8HF8YH9P7HNfOm8iW2PIggxzFClsilYGzpm9naBDpoc+c9aaj51tYnciCCU= 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 1795125660349113.87700667494175; Thu, 19 Nov 2026 14:01:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9s-0003Ed-Nv; Thu, 19 Nov 2026 16:59:08 -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 1xUA9n-0003Bk-CC for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:03 -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 1xUA9h-0006Zn-FB for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:03 -0500 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1ld43148713 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1yx6b18j-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLws0m3684706; Thu, 19 Nov 2026 21:58:54 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 6AJLws3s3684674 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 6F0D525790; Thu, 19 Nov 2026 13:58:53 -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=669WWcxPlsI Fsr6tsUw1SYhGitu5KLgx9EGcnDUZYjI=; b=V+tvjWw36Arhmff32MiBANQdMny 1Nk4KhTvz7KT9Rc3kOYjVZebWGfeNkgogvs+rf8sAJoSBQBvUgWPEea1my/XC/BW 08gMQNXfsVrNBnCoNOWzTJmdQ1GjP6CJKsNp13uglGLI257AyhkEW328XGKtU7Ro mmvPJ4So5KbLBr+CHIM1YmXmyG5RGE/aBKfy3C39gsiiK6He92TBtqRyIrZnx6Yf OCegoY1Pbf239aK1L71MFJgWYxjM4MBDXaN93alor8DAwvS39ERhffSy4KPX+E/f xZVq62Ok7lx7ow+v0l5GRteL3lbOw6U9YZc/ngXtNc/AWZbxBvWjB2+cMpA== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 12/15] target/hexagon: prioritize packet alignment in the fault path Date: Thu, 19 Nov 2026 13:58:50 -0800 Message-ID: <20261119215853.987158-13-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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-GUID: KP-eXwaEuLQLqz_woI61D9_ez4vdPpzm X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXzvU6fBbe3C2z f9UPHlVekmkwl05L3qlm1neiDnbez1sFxg2JkyK3pB2HoiVxgB8WSeoONDBqD9kQt13+ALvSabx H5EwUW9aImh2zXG95d0qyczTw0kx19M= X-Proofpoint-ORIG-GUID: KP-eXwaEuLQLqz_woI61D9_ez4vdPpzm X-Authority-Analysis: v=2.4 cv=FPmOVOos c=1 sm=1 tr=0 ts=6aff711e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=aDDlNDSNT8dN0QXSkRAA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXwmbBlPA029kh p+Gnr3AvtgQxUeKsMvdwcSgmKfBMcBt66M8aLAUaH/965MHlYVLVpKe1kPaWkNaNcA9FiD/nZjk dAmbImWZTuCYZ1p0fuhVpsG0nA9p6XDkQT6HRpJMqZ3pcN7Vcd7qzJ4u9mvKc+gQGGIeULKBDbT HCBAbsNaRWm8nfEx5S9oxyA361qd2O0g5dDAubiR5HT3QljndYQtAGkdV7iWN8ag2r+bX/ZekHg 5ICTw8p6aNZKWvqKFbLYzxCEY7tTOhb+vG0ueszKTOYSdv2CwajfS4hayry5XLKTcqTqctgBNve F2tnE0haL9XNvG7S5EltBJ3NSpViEAOP2nBPVNhfH4bwFi7tr8SVmOrw5eWy/tzJSym+d9N9R8h RyvAI/Z9ARWyw5mdylrF29s+c4E8TFCavfDyxfRTfWYRWJkE3kIBfr2YcjvJCNgCDgY5a4sCjWl 4a+9+ZicpRGEkxiKpOA== 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 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 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-2611190088 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: 1795125660925158500 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 41151250b7..db87b05afb 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 ac498b78fd..0c729d719b 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:10 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=1795125615; cv=none; d=zohomail.com; s=zohoarc; b=kUD558wU4PW3kd90udERyWl/u41d9SeQYK/dnpguZ1layxNNn2R3bJmeLGIgN7Cn0VoUKNwzymiB24w/SfYNzA/XV8BnNvhJ9xowDJOHDOY/7fIfyotonkBg2QUmToifxOCg0FW2BWRp6o34dxMmjUlX+P2K85EId/XroJdUalc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125615; 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=bG7d3ZBtDv9jbzBRfRhD+gruLYTMDT+3Si6LkLTLYnI=; b=aYTD6iFDz3DTT5hsA2ylB4lgfCkJ93mMlvof6xBTAoORRVrb3ABqlRi5T29aRxAkuKwfbAfl0TZZ8IzH8Ym4X4MyzE99L0yLwZ7l/mHsVTzp2fp/ypPTE52LJmDqu5u+KPzBl4DHCJiXpeKtP1FW203FMARCbHzH3bJ+SAWwHGw= 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 179512561548333.02022270690645; Thu, 19 Nov 2026 14:00:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9l-00039k-6m; Thu, 19 Nov 2026 16:59:01 -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 1xUA9k-00038w-0U for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:00 -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 1xUA9g-0006Zs-Qt for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:59 -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 6AJJ1FcH373337 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xymkajj-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLrv763805686 for ; Thu, 19 Nov 2026 21:58:54 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 6AJLwssg3812747 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 7395B25791; Thu, 19 Nov 2026 13:58:53 -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=bG7d3ZBtDv9 jbzBRfRhD+gruLYTMDT+3Si6LkLTLYnI=; b=UbXO5PadzfvLwhfsNhr0RFPS1Oq TVeV/Q5pZI5dgAT/8P++njQ2Iz9wvo93Gmob38IrCwn/5G+/AulovfPKSmgT5a+3 tSO64pmu+Tuk++naDDGz1N/4akVL4Sv2HCBSPRhsGGekT9UumFa3qu51kWGfB3Nt JvX60R/2cVEJFsJj0/vb6oYgGWf7Mg5iGLpcgJVeGSKuBpuC3BjiiL3MGU6C6aGB TX+/zrK/WmzTMa4H5L4GnGvhXQzpRIBIryzhxVam4wP+lkNel8LA0NR9ArlVA35n SetkVVH2ZeKff9NauNF0IDNlrgxhHwcIFR5y6IWPPmnGUghdWeg+bYwzAGw== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 13/15] target/hexagon: validate both stores before packet commit Date: Thu, 19 Nov 2026 13:58:51 -0800 Message-ID: <20261119215853.987158-14-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXw+JIT2V9Fgfj xBO6iYXhcjBM+rz5ID7bZnp9Z7yLKlbHkv+MuXniOjSJ/YqE8E3TWXjIMKNq4VkIVDFuKDFMpKH nXNWHxsWe1jSJaZbes6HMr19ngMVBq4= X-Proofpoint-GUID: -LC_iNi4UK9tBVd_NTcASZDdx3F4jEOn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX/VSOZ2nDNACe Ij1txbkwpnzWSHcFjEZr1qkuC/kmFVyJEEMttB1v9Qr3/4pEjzdqvu/wFmnaJev+VpuAm0u6L25 0lS2t/dlOevcX5yd0pJir2PLZFDvJB2MXdZv5oiw2oYZ/zC6I2nJAvQeGijlEGq226PGJ/BrV0M IQACIGAHLiuXDqyreZnUcA4ydkHCHCInTOYpvL08cfgmy+lXMlPlDYdQL9wxSiWS4oI1sBiJoHl ryV1ZGSRQ2Z5VOvIz8YhCs7OZlelFsEhT0uk/3GxScpV2pLS5bj4CtizQHC2vhmEW0icKGw2oaI acq4GPyvN4Qes9bMU7P/rnJCCCESky73rRYoA6RP9Wy7r0jqQv8iOrm9zdqEIaC6dnVXVdca6vd uy7XMS2zIKLrIlAJdrO/FLfIEp5mtbOItnRiqRQgYpXEpADsyjYnb5rbdyCxZivmza22A0kDuj5 phBPW+ByuM5zIu318IQ== X-Proofpoint-ORIG-GUID: -LC_iNi4UK9tBVd_NTcASZDdx3F4jEOn X-Authority-Analysis: v=2.4 cv=WKPqzXsR c=1 sm=1 tr=0 ts=6aff711f 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=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 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-2611190088 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: 1795125616328158500 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 db87b05afb..63ecd38d50 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 0c729d719b..b259cd7d80 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -446,8 +446,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:10 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=1795125590; cv=none; d=zohomail.com; s=zohoarc; b=Abh54kEsYdY9XPwfHjUqVXk5AJsk1kZKOF9rQv5IkbsOD92EwWGdZSkmmnzRDnwu8UD5QT3NEZ7BNKagAvS603oErYrFJIN3M4o/1F9GDzTZ+oFAz8S7CAJt2m1aJAf3FdNGrx4vnxpwCI12MJxE0wX4v2d9t7Dwui/YWFxidjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125590; 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=YfnvSoEZOm3qR7LzUbHwicmAnMZKc5BAFfliC95g3UhNsno/xzsHBcoRiHe+0z8mPy5vYnFuPKe313xKuHpVtSYCaJsM7pRQ5/9Q0ZutaIzHLhF4TeifxgSaJoXi9orzY57zEvl5fW2m6u8NQqRyA/LE+gez+6S+gQXP0ibF8oA= 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 1795125590089956.478524701478; Thu, 19 Nov 2026 13:59:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9p-0003Cv-AL; Thu, 19 Nov 2026 16:59:05 -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 1xUA9n-0003BV-1G for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:03 -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 1xUA9h-0006aR-Hz for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:59:02 -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 6AJJ1DH03594976 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j255whhgw-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:54 +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 6AJLwssF3812790; Thu, 19 Nov 2026 21:58:54 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 6AJLws0q3812751 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 782832579B; Thu, 19 Nov 2026 13:58:53 -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=m6MveZwnlrXZ9oSuGPIJJyytH7z Kp4Q5hpNQB3kCKUNcxZS+kclPWBIz6WJQWm+CkTp1wjPKmnQQB7proWJ5W8cZ0kQ 3jf570q5gYEsJdQ0gkpkG+iLAUsvr3YAJk8u9g4o90FXrflg2kUScX8FhZgo0X4T GfC8cPb4PZecpy5uSaswuI6rMKb/16d9/Zy38C71IgMseucIZUY04tO9qgzUrqSM 7naSirBgg/NyshSfdugx9iKwIePl6AzZVNhjraJU5RC3tryJvZjuDA9keajf+LVT dyfPa0sofBMdI5ReIsY8iiZckIe5Q9XvdJ7V5vSwkHGnVzVjtQqeZ4RTAJg== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 14/15] target/hexagon: probe VMEMU upper transactions before lower ones Date: Thu, 19 Nov 2026 13:58:52 -0800 Message-ID: <20261119215853.987158-15-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXzimfDQ8DV48F Am5SKCw8qnutCwmbLnYY7P5Glalv/eg7R7CiW+WtdorsXU4hs1UL0jE8nloapLJdd3LCAoc9eHR t4VwT0LY2qZtbs+5uL3qn9mjbHGPZA8= X-Proofpoint-GUID: Fpv4UzedWhLaytqCxmTGEnOQoY3k69fp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXzzPyBU6IGS0Q bESibZ+2pr6UT0U4bp04CeyWDaaaTH/BS8PS+drzLc9R5auw5ofdPJ49o8HLfEchtr74Xo3vmCr Mv5yo0lD88poTUwEKCr57PcumzCTh4pDI30ynowY98yDLJl2vBBWtkmlIWsZ5Pmj06feGhSXKCe ikfTFnxgds7kbxMKHILOzNc2p1dgN04Sqhw/WiQuRg+mGKboQKmeYOTMyEoy6b6lvYcYcnSa7AB JjhFEUpmvpxMtUzEULihg/KOgn1QyQHriGKgnFbi7ENAMvnMsCbpJdZs/v3SEhhmH5YIZlE42hn T5i+0TzfNOr01ixAi7qFPR1XqtS7RgKAWj7r98t/hLzwMf+7d4qwi10lLmVAz7cmSnWcA/g19Kj Yj+4xxGPoaF+rHkbxe9aWBFh0JAc1x9R8jQdhFzeK+PA57GHqoNEx1jd2UsjI8wz+uA2Yj4s3Ov OalO218ltftOgWMAGvQ== X-Authority-Analysis: v=2.4 cv=da0VTnXe c=1 sm=1 tr=0 ts=6aff711f 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=SFsQfBXkJAIU8DLS2pcA:9 X-Proofpoint-ORIG-GUID: Fpv4UzedWhLaytqCxmTGEnOQoY3k69fp 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-2611190088 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: 1795125592191158500 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:10 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=1795125577; cv=none; d=zohomail.com; s=zohoarc; b=UvCLlPU5rll/KwvZlWSaXyuJcPQROLH29VjW2Z1GDF+Sj/EKWtBASGS0grf2fLdHeSRp8ioUqkgimHCTMoNNiWKbUgNBbprnlrrNnHaWOg0ByHjnCwRiaTPlK4XGJP7U/tWFbZday1//bfKt1yxYTpZM7ufbQuowmDK4bvDwoEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795125577; 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=WMzaNZOWZlXjmia6OYY9q0d2YNf3ztv6ln/E2KDig0hhdCKQH30BBLHWbzmNbJ2nMXSz2iRzOpHkYGzqDm0iqq6L+ckwHQE+ulbyDW2KOfJj162et63keZkVifvyzJH5FlP1+CIa9mEohl0ES2SfPDxkAXwv5SNglpX8RWzPghE= 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 1795125577462824.4797383992792; Thu, 19 Nov 2026 13:59:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUA9k-00038v-8c; Thu, 19 Nov 2026 16:59:00 -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 1xUA9i-00038O-H9 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58: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 1xUA9g-0006a3-Qr for qemu-devel@nongnu.org; Thu, 19 Nov 2026 16:58:58 -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 6AJJUX6A3367475 for ; Thu, 19 Nov 2026 21:58:55 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27b5rnbh-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 19 Nov 2026 21:58:55 +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 6AJLwsaJ3812819; Thu, 19 Nov 2026 21:58:54 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 6AJLwsTU3812803 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 21:58:54 +0000 (GMT) Received: by hu-devc-lv-u24-a.qualcomm.com (Postfix, from userid 4282937) id 7CCDD257A4; Thu, 19 Nov 2026 13:58:53 -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=pZgqUkXtJepWeofvgKBXjCi+TgL 5PS/lDszjDdoUHItsh7y40BevxxzzOLIogg7i1rsQD/NXli/wqPz1iVvcu3Nmv+e yoW7Kp7Y18iNOoyGP7DvlNxUm9fEOWWer0RokuyhehprVkT/3yF48fdA2gQ0mKva cOMvsfYsdV95n9xudVQDJgb9q4AyCctnKk1/7sVKSWC0iMB7Kn+No/JP5dpzoA7T oz4M7RnWXlQTJ6AB/1d1UM3nbpp6nZEVWyPMEHQGf3fSwmZkHPJ2bwwIlSM5uss2 zhkB7NRa45o1quZNvh9r/bIUNBLGLgKOZVp9iI1bfLedjtW5nMRRlPzQRcQ== From: Marco Liebel To: qemu-devel@nongnu.org Cc: Brian Cain , Pierrick Bouvier , Marco Liebel Subject: [PATCH v3 15/15] tests/functional/hexagon: add packet regression tests Date: Thu, 19 Nov 2026 13:58:53 -0800 Message-ID: <20261119215853.987158-16-marco.liebel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261119215853.987158-1-marco.liebel@oss.qualcomm.com> References: <20261119215853.987158-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: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfX5kHCm/uNbZdE emIpUa6j5mLta2ikMsDNTlNyYjdIFjp5r8wv5sFqZ53le3ITrFSGI8PJKXXAwECqTH0BuyPL6Jm vtJuLtXQW5jFAMHJuSzSuUoB3s+0lKA= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4OCBTYWx0ZWRfXz+fLwjNHACM2 PYb/knFQNbqBmED3M40alcIa21N795GLsy/fDrDZDepG8hjdaei//0ss+KdHOQnZhAMg0WM4qDy VkVuIFOa1NKk2Kr1FiGBEPD8MdTJab2HO/3sKlE0DmxKILIEDnRCTLzZe/p+7bQ9CLaZzByO7BQ ykk9ttQA3Fy9oNs2gXpI3PG/+a9aATk8wUVgS6Jn6f+4ZQx1VATZcs/lVKr1A9iwq63WXFn/5Y9 9fjHiTBXt4BDTZY9DFeb+u+FdQOV5MVdKjuXoXy7uNEhfHG5VCUX/ChgmpG7AoRiKFtFpM322/p cl6q6XoyCoX4AHAxPpTfcyhm7ue+9X/SSNyZPmwZ7bPA3qV/qXWg32TmrHoe2/0gj7eTO1/zFjo Tr9X+ugzwCEOYidSoZmDLhyFYewK8WrfaOeS89+MMqua4dIkfV689TGERil/C9jH75nL8QwLb9r XhJgczEfExsH+K2xQHg== X-Proofpoint-GUID: 7ijGMSbH75KTOOugNIzjzez06vK3pLdn X-Proofpoint-ORIG-GUID: 7ijGMSbH75KTOOugNIzjzez06vK3pLdn X-Authority-Analysis: v=2.4 cv=LPTz05W9 c=1 sm=1 tr=0 ts=6aff711f 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=5vFef2XoAAAA:20 a=EUspDBNiAAAA:8 a=Z9VDHF9Blclki5krBAIA:9 a=bA3UWDv6hWIuX7UZL3qL:22 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-2611190088 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: 1795125578229158500 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 Reviewed-by: Brian Cain --- 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