From nobody Mon Nov 23 04:26:29 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=1795198914; cv=none; d=zohomail.com; s=zohoarc; b=i2lpIOZ76Wl7J/WI9qowgPyj9Q4NS6HXP2L+Y6FpihGgbXsRbcBCrvcSUNcwuZGdYvBrL5a6+f8UhBH6gqqjuK0+6qHlmGz5zGgzLJq+emnBA//Bci+tOyHxlz1ingrYoH2CQA7Sfx45PZmA0OdmtQ7VAE2pMFGdvB93pLnZplk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198914; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZWzaegTczRZLVWvdsi8d/1D+lGgmlfY9Ir5jqzLeBFA=; b=hmU62XoQCeuHY00l8LxLxl3tEKHekWBYk5DLetQVXLIbdkeKTaB/iniIxAaqEcOfzqDsABcnoYVzKX5Gab2xvMG9pVrgR3Kz5WBM4MrSXlOOwNnNyHCL5BiE/HQEotVbKABP+InCN2pxcrVTSyMd9bqzMZC/7XF+vyJK2Z/QEO8= 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 1795198914870525.7765528909964; Fri, 20 Nov 2026 10:21:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTE1-0005yX-P9; Fri, 20 Nov 2026 13:20:41 -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 1xUTE0-0005yO-N8 for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:40 -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 1xUTDy-0000GG-K2 for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:40 -0500 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AKGFsvm3830196 for ; Fri, 20 Nov 2026 18:20:35 GMT Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2sjwgmca-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:35 +0000 (GMT) Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-85c1135c289so974450a34.3 for ; Fri, 20 Nov 2026 10:20:35 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ZWzaegTczRZLVWvdsi8d/1D+lGgmlfY9Ir5jqzLeBFA=; b=gB/haaOEwE6Wb+VW cb/gDLnZkzyuAsNAeTuPlEps5Talh8CIwpeJSY2DyesHhEdTuH+JkkEoExqNVX55 8GG8GfPXagTjt5SF878vSzxjCW7vPk4x5cvxm0LJdmum69ug1CqIPuKkOkuYNCEo KpnuBPSoK3JK/6ExRGyPe06OGaqMfwzE3Qcn4Ukzpjj+AW7bOUavcdPdMHrSk5Dm MqehCk4b27fgxO7jMSfB9815kUESeWmE+e6XPM67wvowY3LkGW2EjMGKkKz36DBo A7be7BUixw+v9fzuqOBvzVBxcmJiAqmamcjroT76knvEbwXgtf5T8jFM+Ku5e/1+ jkb8Rw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198835; x=1795803635; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ZWzaegTczRZLVWvdsi8d/1D+lGgmlfY9Ir5jqzLeBFA=; b=JyFG+EWavYwrWyWhPXRr6chE8WruKKjYclBxd4n0iFiDUn1cPHJugywD30x/o6PMDd 5/t2nSIE/npLGzYsyRSw1nnGjU4gMgnkU48Wsg68CAjoyqiNZNo5J5wz9SG2Jy7CPuq7 bVSL483zXPi2mxtA9DbVGcaDjGB9xgymGhyrJfNwWWqSkH5Ee36YgyDs7vl1DT95jplf +vQ8IqTait6KcRAM50WX832lb73egQMMy7LfvmTlrgDxOKn1ynvmfEItV39q4QBNsfJg vOL2tBmg+mLwbAEmbBU8m7YpuBgexdnChBaf+96VB+PT1VeXgxctCd88Xjjvgf2M2Y6L AdDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198835; x=1795803635; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZWzaegTczRZLVWvdsi8d/1D+lGgmlfY9Ir5jqzLeBFA=; b=vHDXAx5F17+7EQ1/gPGt+waTvk422vDRhtKzZtiIQ9RieoO4+UFsppJBx+5i4gXZOP QepVPLjsBl86QmOdILJRtZ0jcfpJuAqYbeGAm30TEj0XjDKdBp3k6KzJhkzPaP+GfBE0 Vsp+hpphShhHqicCKeppNMTlhaZY7MC2/dBsTfa0uwTfuGpYFeQpEt0GmfGVWcXt3PLo l+hBmRRUIkA22aQdQNeT4XuNofW1t4DSMdl6Ogb7AzwTAn8Ypgj7b199GJoaZxf/0Foq K7NCu7TKwtkEzqMtRo0QqkTqhZ5hQwkmpVsE87YS5Io3PFLASzG5fhPyHEQ6gJRttFHC 1BnA== X-Gm-Message-State: APuU4Z+kSsRikXzVbV+uGqTvMYZtErgvXJWDO9o2evnlTilIr4EuSUsl j57UUsTtkHaWxu/qYctk8xR3QFEWWqB2s7uvj9cCbpy7w51PXJK35BwRIb8dvDCOFAi1eOHIhSt zSFINouOLxDRMl03o8+H+qbWLprtjnv0zOE9ZEyImd6cGqGQsn4E0q1bTBfiqQhiKUA== X-Gm-Gg: AYBFou1RFvlykviqFBWZSoJuy1rtW0EIZOOzWC0BwTvlGDEvnuaadHh5iEW2VhmWWrr zv7kS4n3+9j8A/zZshO+6zu6OJ/A2qqmcu9Ss5+65RcItl2nhcMDOk+NhZxjzBKV4uZrpYM/ZXJ LzByEocJ90jaHqB++w1yk0WzNbdFa2TvH8A1qwsy45FxHrdmBWfv2dBsv3zpCpDmo0WjB7hd1/r Wi8GfdjmZGU3JTK/kZYIcNdnDy7JEsqTHAWyQV9XTQtoU962z09rP/eALPuR01sH9rLH2h5dXUJ ObwDOzsZMdsHZrKoemqibhdexaEevRIQ5alrhQbllLzIVZEWIJpREinNzR7k6Jfb3GMehf8RGNO Fd38vcsnLJ/+2LEmxFo1LFqJz+rbTK7ZNDtaHrAaWWpiKovz5YNNVbHj5SeIIvVs+GCTyTQVcER +lImKex1yImEUuC/qGnu5meA== X-Received: by 2002:a05:6830:348e:b0:81e:abb6:749f with SMTP id 46e09a7af769-86315490d2emr4639309a34.8.1795198834981; Fri, 20 Nov 2026 10:20:34 -0800 (PST) X-Received: by 2002:a05:6830:348e:b0:81e:abb6:749f with SMTP id 46e09a7af769-86315490d2emr4639277a34.8.1795198834504; Fri, 20 Nov 2026 10:20:34 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini , Marco Liebel Subject: [PATCH-for-11.2 v2 01/12] target/hexagon: read the old predicate value through C4 Date: Fri, 20 Nov 2026 10:20:20 -0800 Message-Id: <20261120182031.560481-2-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 4JF8b35KvVPHSsAWd_FrfC2PX_gMnKLW X-Proofpoint-GUID: 4JF8b35KvVPHSsAWd_FrfC2PX_gMnKLW X-Authority-Analysis: v=2.4 cv=dZ4VTnXe c=1 sm=1 tr=0 ts=6b008f73 cx=c_pps a=z9lCQkyTxNhZyzAvolXo/A==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=9fZTsBWXyneHJwdpUA4A:9 a=QEXdDO2ut3YA:10 a=EyFUmsFV_t8cxB2kMr4A:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX9yrapSX5pV0t dcKVRIdSWGlum17n+uhmGG31/hsyFC8M6l8fHuVK/9g/nVf9X4v2wCEBBQEoT33B70a9+B7o3K1 LKDSViiFlxS20Akm6cvYdMGuumV80FM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX8TeOP4/RcIn8 93t7zemZ4bzZaED1dQCTvE7wcm0BlNrTl1AiSzY53/L2yX1enfIJfv5ZCII+vUX8itTPhUI7nx8 uRTDBhTc8qA2IDP4lDgon78FuHpzbv2HyN4W7mZCNpNdlSYctTZY26/sd53bC0vvG6vne3kBGJk koHDhkMPZQBIhyZ5V8xCo4hBOPCnDyx7uc40KcI8ILO6CWTKrDRPzw/3PETkEgeH5fGgMZm2k0O c1Z5FWQmZLisY8zhaDJAxrN40EQWg2v37btdqUCz0GGZTZwylx/HfzeNquicLWmE+Saj3Ly0URZ 8m+wuyGxa0NrdBIjTtY2Exe1oUUwA1ShP8XcY1Nsqn9sahd0bvbY5JHcIZOtTXot1PcLnJkltVG A2p2PLs/e8F5+4wxwhfIpi1rE1p7xwLT33wiqfAZkXZwvm/vo/uaJkrOpwYAY7GTOrcMuVRr6I2 288y9hCFBxYBo7VNaSA== 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 phishscore=0 spamscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198915941158500 From: Marco Liebel 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. Signed-off-by: Marco Liebel Reviewed-by: Brian Cain Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- target/hexagon/translate.h | 6 +++++- tests/tcg/hexagon/packet_user.c | 38 +++++++++++++++++++++++++++++++++ tests/tcg/hexagon/meson.build | 1 + 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 bc3b49ab06d..c988c85f33b 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/packet_user.c b/tests/tcg/hexagon/packet_use= r.c new file mode 100644 index 00000000000..acc77202ef3 --- /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; +} diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index 70f6475656c..b3635be3fcb 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}, --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198908; cv=none; d=zohomail.com; s=zohoarc; b=Nq6gA7/YrfeJbS2qUwnOkyBH9xCEcinDKhgv6sHMLIS9Q5uyW6NCuRYAnJGbeBk3WPgwybkrLZAG8L49yJ99BHOxJdd53FqOTA+f9qOdJAd9ABZg27z5bpFDm5FkneQnJkD7inhxfCu2MDK4F4aQnNmHwYKRAhnTh4CMZLlXfeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198908; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=byb0vmH/3wGll+KpRvSprNYwDL9NDUjqZEYPf+zZmLU=; b=fvHt4NBM8ntd6gZ8V9SEWaCbgO4rrKQ3dKfgnNh8crH90M47x28bIgMelrGLrGEg5jeBXnRtcviI56ZvQYBImhFmGl9MXuKytiNb1cY0pfp28HQ+NvcBIrbEYACgPOEgT8xR2I+wz1ZAVppubvqIaOu+c4u2O1/EBSGhK8YdqPs= 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 1795198907952752.8115207540396; Fri, 20 Nov 2026 10:21:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTE3-0005yy-Kn; Fri, 20 Nov 2026 13:20:43 -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 1xUTE0-0005yH-Fd for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:40 -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 1xUTDy-0000Pw-RV for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:40 -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 6AKEfRIB304434 for ; Fri, 20 Nov 2026 18:20:37 GMT Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2gu82ybx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:37 +0000 (GMT) Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-862b2e1885cso1429613a34.3 for ; Fri, 20 Nov 2026 10:20:37 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= byb0vmH/3wGll+KpRvSprNYwDL9NDUjqZEYPf+zZmLU=; b=Rw9fQkeA6eYD26lE xCZnKI+L+FrZq8F/rmsvkKnGop3GU+AA9GGqosBBIme392Id1pEjNxFDO8+jpsVb IDitH+B3DUpzuQfq9cm8cPCg7TfqeJbAsc9QNVQ2WMHJ1SXNg8Xg/If21xoYM6Ge +s+Lmaa9t7EHTyi6Gg0bHUjBe83hXWVwWQ7wcq75RYumsRcWNY1LK/hm6L9RVvy9 +YxQG1cVrQm/uqlnnOZfqPA2/UtTGvE01stY2r7ocRB2GacqTv5OT21ylNQbI5gw ecCw7sJxbug8elwNbGBAi9JpL1EhEqUVO/rKGDdh9IBqiDO+NE72mA+De4asCHoc lQ2pHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198836; x=1795803636; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=byb0vmH/3wGll+KpRvSprNYwDL9NDUjqZEYPf+zZmLU=; b=iB1dMGWiQY1dMNDDPU6zUZ8LdIpXNzW8FVlP5Mjh79kl40bXPVmpn5ok3TpZNkwJ2C /m/5qv3/iURPkb1Oxb22B0x1FePJd/ZbLxEFKgJXonsAPnyy9x/5uRIGe/9FV/nXmboi Pujb1Ja8WhJS9qQp28SkclZffTiG+e8XmMMrOWJctd5QssaaYdQ6gfvqmASspxgohm5m 1Y1KL4pHMyhjgMM4sLa9ThIjXNgdqgWbO4I3Nd9jV+Jh2z6en/njPTkINS1aSUPGauk9 kgIFzHJWt0LBe0U0LpQwXe1O/zJnkshrWsKBv07rQR/msnfZNHBgJemdGlS/TjzO9wBE pWgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198836; x=1795803636; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=byb0vmH/3wGll+KpRvSprNYwDL9NDUjqZEYPf+zZmLU=; b=UqMnrU3R+rJ9E4JHUnby809h5Y0dmat/w8A2fg+sZmd3C4KgLihqEEfOWB3BzBCLDO vCht/JXT83GgmLoAt5jdlFqu+tPZMU57IIaQrZe8R9etijMbKKB2b3I72JWlLnOzq27w G5+8pQHI435ZHSdDT5W/coBGlMFnASRLkPugBU/L6H/rY2EidaBrXJtGYAmLKqIfbH50 NsY7/tk2ibxa4clNa132vEYcSh3Fpqfmn/wvs3sPTAHxEDR/6BxhMasaEcjhBKO35xoD eNYQApDvPovYcNL4Qx3mYuCC8S/5aG4RsDuLgvKObjYHYW59cC4R9VjMF5SUXfr4vnHZ NUNw== X-Gm-Message-State: APuU4Z/gNAwf6eQl2ubjXfvauQ41IfVByIztB1TJm5pGaNtvQwhDU2NV wFKb5tCCpu3rbL/R2VHTjgLTvL3J8e8xzQVIKqLAVnnNv0TJqZ91ty/tUeqi/b2veowxee3/1zP Ha9je9ogc+k8nlzDekh4O87CIQoWUGiczFz4anwVW5qLU0pogu6iuFbwd//gZew4erw== X-Gm-Gg: AYBFou306VxKeDSMJRibklGsHzFaLgsB1CV+lutz0rXKMrT76OARiN+y3BmpYEzJHGT 0bsvNyFZSsGolhraq98axJfHJqRATEdV9KTJdAkg1lr++mxJXJEgmtlnKpCpBIeZ7mNlXiGwVB6 2jTY8rVRfEUN5QPSE531oa26qYI3D68AiXqwsjbQT0iDp11Zj3ZcdnD5Ea3wXGmkuRsWtifSy7d j4J0uFi0C3zX9rsz9Llpdq13q4RQWjLiehxl7wIkUKXgN9PrQJOPHIC0Law8RARgJAX30rHtLFP 6g8d+ygh6gPRMGNAOS01KC5UDo6rBOhwBsG9wnI6oQEwO5QgldrHE9OWajK0KSiTR2TJTZV/+r+ xsILRtuy1g6kHHhj2QbzvBWthRSD38Xj62XU5JUZ8K75mjh8Bu5WFrluaCArY2d36WNfwwsRj/g 9VlXTCAyDrWChQfnCJmc621Q== X-Received: by 2002:a05:6830:3150:b0:862:a097:ab4c with SMTP id 46e09a7af769-86315932389mr5923355a34.22.1795198836472; Fri, 20 Nov 2026 10:20:36 -0800 (PST) X-Received: by 2002:a05:6830:3150:b0:862:a097:ab4c with SMTP id 46e09a7af769-86315932389mr5923311a34.22.1795198835948; Fri, 20 Nov 2026 10:20:35 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini , Marco Liebel Subject: [PATCH-for-11.2 v2 02/12] target/hexagon: bound packet lookahead to the current page Date: Fri, 20 Nov 2026 10:20:21 -0800 Message-Id: <20261120182031.560481-3-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX3hbtruVUhz3v RVGt/TkfpS/c3LUgWVFAYG/APIACtPZj5tB8O/C7bUJKJ+cIiWMMsIXbNwKpGU++8aVTkvhxcJR /bE4lWJn9ew4QWMCvx2+dheArDUGuoP8JTouZwAb+X3kwSQKqPW++mXYgoldB4Xc2bwrFgbuR8z 02+QhK+g04Jc8XHEQ7+dDwkKmqGvlO7W8Uzj7wJI41hi2D+SsKMp8vxp1OCSY/YtXfuOz33EpO4 SZX0gvDG7VSxl0ARG2hJanSeJI3okGUEiht2ZLG6PTiTfnadrxfGtmA9Tg7wlcEc1TMDKQLNPtC myQx/Z1SJwt5hrc/TzrguwplsBL/8GMe8I7I4WIxO/sLOoKn2riUhCY2Ailhw+jrYlNOWnDOBih bqJkU1AqZbNZkaqBY8p6+4j3VdLaCTtQj3igmvBeBrKF430u0oKczGTvyndrkELazreLqJeaDnJ ggo6H536AA4HWrrELRg== X-Authority-Analysis: v=2.4 cv=bLeDs/+Z c=1 sm=1 tr=0 ts=6b008f75 cx=c_pps a=7uPEO8VhqeOX8vTJ3z8K6Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=LOdbtK4x63e5lU4mKCMA:9 a=QEXdDO2ut3YA:10 a=EXS-LbY8YePsIyqnH6vw:22 X-Proofpoint-ORIG-GUID: WYzxsgiSoRIKsbKaDCQlqgTzSXNIN2Wa X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX4XklPwMTxW6a Z1r9TtscsrdSZAp1EJn5H3j5FIDVRZhjy4/ymzW+dyqcYgWjq2HznR9hvqhunoItjESjkeLKpzs BXMgT8Q4KPaL3gHiUgZy2IzlWSMoztI= X-Proofpoint-GUID: WYzxsgiSoRIKsbKaDCQlqgTzSXNIN2Wa 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 clxscore=1015 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200072 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=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198909948158501 From: Marco Liebel 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. Signed-off-by: Marco Liebel Reviewed-by: Pierrick Bouvier Signed-off-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 ec1d79e31f6..41a0f2b0852 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1620,6 +1620,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.34.1 From nobody Mon Nov 23 04:26:29 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=1795198882; cv=none; d=zohomail.com; s=zohoarc; b=n3qdJwpsy+SbHUazgmzG8iELPTVfty/2nd2Y5PJEW6c/RlGp3KZNLN5UJ0PhNSTuQ+OohtpOZzt6aTWIEkWg/7g8jwm0JeL1znhN306T2BXFYNTpUewXjvkX5wc8cDJklqgulJETW1XHlCwo1ZITo538E5tRvEGczRWOLIDbvxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198882; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MkvDrOWSlGvBHbNR9evveCnWRkHoN3V/Q+Y5xcXdxuc=; b=LqkHuANTG3xG1ZThFZZWAbYFx4pcHTZICO4K6EsQYpV7uevylo4hqtrfJfQsqo5pXKWYaIakXG+YYA3X/yijmkGg+4vkc7snNpwjVTrhxdr+K/PJk90FhWhTm1ISc2W4sNsFSIMnFCo3kSk5NzuEJAZgfi1DBCT2aH9vLsMVjvA= 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 1795198882183784.0617694573235; Fri, 20 Nov 2026 10:21:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTE3-0005z1-NT; Fri, 20 Nov 2026 13:20:43 -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 1xUTE2-0005yp-B4 for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:42 -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 1xUTE0-0000cC-Ug for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:42 -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 6AKI9VlN3120549 for ; Fri, 20 Nov 2026 18:20:39 GMT Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2u8681ke-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:39 +0000 (GMT) Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-86285932977so1366961a34.0 for ; Fri, 20 Nov 2026 10:20:39 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= MkvDrOWSlGvBHbNR9evveCnWRkHoN3V/Q+Y5xcXdxuc=; b=WJJ6D/ksH3BPUKXm cFpo+kwXdc/ZLtn/gTlE9sf+3opiMUqV7FKX0RGmQ9dPOy9KFCKPh/NnmXAYQOTB 1uHc5Gy++hoRC10jhDPGzCvlRustHfu21q3s9JNY5xNEU7W+UxeWFj8GEHRA/Fao YNiNhwD4JAL+hMAkeRRAaKzWqq0CqzA1OA+okqtWwM8GbEVpWcjdJKlccKWhfStq 1BTQwZZGezktYcdITRRRl630nGm0lKwGvSRl/4C785roSNGp/4Y8W6BTjalnWJMU 7fwJdSNdgzwTkY+Iojq50bONbpKEKN7l9SAP6pT9YtHJGWwTI/GcwARFFIAebnLd FmOClw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198839; x=1795803639; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=MkvDrOWSlGvBHbNR9evveCnWRkHoN3V/Q+Y5xcXdxuc=; b=jksDIxGHhw/e7GtWsPh8vsAQM4seaPy14Ifd6VD0nK7fvq/gmOe5V/bS4rVWJv3IVf NArWrIkRs4ojoCeHHCKWF6y+gHqUI5y/7kyrwZLIvsUGMoocNcnCMgCjTAeQtQWTuO4a vzlMobrbK6NeINb+/giggE7P1acFRiNNBdQMxgEy2Bip4RTd3m0G6WM49nRSTlQn3vQ2 K1M3fUpe5GZp16b4eRg222oW7CLYbZs95DikTmcFEn6RbA9VjWxvErTUXq0bKOzqAXq1 3IXOslq3msKFProbMjqvecHDK1fEaGgq6hMA454vgUZP9GN/lkEo9/wVhIoJ0Ovs4kWP IMkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198839; x=1795803639; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MkvDrOWSlGvBHbNR9evveCnWRkHoN3V/Q+Y5xcXdxuc=; b=w8FNstOEZuDLzDnFb6qXKRAa041en/mWnH+8HkHeL5KQVKCc7qdbobyv5IxmLoDpiu KhZWA7/znIKquXFXXnRvdfuGxABTHV2WyUXLlfkcD2mzZ5dNYVS1T09mk1T8UVBXn4lJ /RTPjVT8diIfE9VLlGVyHGICd48VmOqxk7TbkrIFmXK/isp23OB5FeTLLl7iolhhCIB8 P/CqHWgXyweRzSiEVdkVpptm3Rd7fxPAppcNvdJFHjnKcGlnPOztIXvP9bjEInZ5O0oO 7tp8IIxaqi3UiWLkn4NxsZrfWOG6PT065ZGHgT2BXKGgrNE0Z6q8EofUk4LHVirsd8oz KnZw== X-Gm-Message-State: APuU4Z8bsQtU88nUX3kRBNNDxAzHH0z1Zt3H7BubGbRMAI2qxpJ/FIcU 25qK+5FmYPihCxQZWMO0UvIe7o+59NRQZB4GxMIDwd3l+OsHCBIAft0kL7/MMGCmITEJIR+4glM TrVbN3uUJswvw28lHDv0xJLd7J49rd/KvgZcKgAkdhDujTzlH2Qs2Vp6jVqKJsuPrEA== X-Gm-Gg: AYBFou0PgtgZroU9/bhrt5yC0d/JnXAqIps7w+zmxfT02Bqj9dly6imCB6h2PA/byrg 4i9KG7BqJGg//65fSGgLufz6OaPNc2FnA5if1Kb2PbzUYJUAmqnEYnrAAKi8SSNhBs508u3PuT3 sKya+GaaAtJlLl0SbxENsrCike0+m9SDGplXuWMlh/oJO7IBV2nZ8I+6DhfpH6kqXPhrG585LOo lUsFdEfc8pbTj9m50NzuW4U0FCa36Rraf4pGS1SCiq0hwD9gHaBIIBSYs4P1xet7SGugkzx5HUG RfH+BmefJy0+LurpGe87SQs6x4b2mHlK3Cc2YnIVWaY4GE7IfZcN32JPWis7AX2mfM+XyUydAW0 f6DBU11haKGVS07zyzVrVFByArtL6fHT5wHgHe4mhm/C78yLnHyMlJpcHpwgHsDlWGJnCwZvnHu EIF0OG9EN6VEtWTjcb2bcL3g== X-Received: by 2002:a05:6830:7182:b0:862:8364:7962 with SMTP id 46e09a7af769-8631595eeebmr4909179a34.23.1795198838876; Fri, 20 Nov 2026 10:20:38 -0800 (PST) X-Received: by 2002:a05:6830:7182:b0:862:8364:7962 with SMTP id 46e09a7af769-8631595eeebmr4909146a34.23.1795198838405; Fri, 20 Nov 2026 10:20:38 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 03/12] target/hexagon: fix get_exe_mode assertion in hexagon_stop_thread Date: Fri, 20 Nov 2026 10:20:22 -0800 Message-Id: <20261120182031.560481-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=X+zHu2Te c=1 sm=1 tr=0 ts=6b008f77 cx=c_pps a=z9lCQkyTxNhZyzAvolXo/A==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=DyE358pAE-X188sEe20A:9 a=QEXdDO2ut3YA:10 a=EyFUmsFV_t8cxB2kMr4A:22 X-Proofpoint-ORIG-GUID: lGFl6cZRkJgqiOGFT1sKgIuadj7Txk6r X-Proofpoint-GUID: lGFl6cZRkJgqiOGFT1sKgIuadj7Txk6r X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX9KEYcydrxLNU sNiMhL/opBp7eUbYgwG+yk4o/Hv7qGqxMTzDMUuGC0w12DAGbKtdLwD2k1n8+9CE7gu61oxxW1o s4h9UyzWCCfxXsnzKF6q34ys8tWljNk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX3UqUXDI6kCtG alSDEjss4f3LArZlpEQzz3ptBhRmqbcxrjEL4t6r4129790qNQqR3o4Ge1CiPh3CiJdhQINiYw4 TueQz9/T0Kf9Ak8dIvJ02ZNYgBAaZfhUS4J/2NFPurTwJuKLSawyVGCgun96xei9AE7Oc39JZx2 TNWYRiwZCWSajh8u72rDq3ivtul0IUtJGpPE5O7ohMEsP4wspjLT0mOFmFHW88ADnGyokJqHHFO KvyW5q4JiYlnclAAxcworK+CZVuLvEx/8Z1jCabVzX2uf7+s2CEUCwfo5Sut+BNssxWSU/uC6jA apgJq8TkJvAAiBcaiakhXqVWrF1DZtG8bIp+Dm2ZZiOlzS0pddsLDhW1NQ75HwLXqOL1C/IuZ5n u6xzAyZaHGCLO6kCZEfcDwpEsPg8N9+6ynD30vzvoIttfWh9u/Ya/i/bSWKhGTmhft0smt5AU0D UtR6j8U+bwcOxYooU7Q== 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198883821158500 When a thread in WAIT mode (W=3D1, E=3D1) executes a STOP instruction, hexagon_stop_thread must clear the wait-mode bit before clearing the enable bit. Without this, clear_enable_mask creates a transient (W=3D1, E=3D0) state in MODECTL that triggers g_assert_not_reached() in get_exe_mode() when another thread iterates all CPUs via hex_interrupt_update. Signed-off-by: Brian Cain --- target/hexagon/cpu_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/hexagon/cpu_helper.c b/target/hexagon/cpu_helper.c index f53d377ab14..680dcf56803 100644 --- a/target/hexagon/cpu_helper.c +++ b/target/hexagon/cpu_helper.c @@ -441,6 +441,7 @@ void hexagon_stop_thread(CPUHexagonState *env) =20 BQL_LOCK_GUARD(); =20 + clear_wait_mode(env); thread_enabled_mask =3D clear_enable_mask(env); cs =3D env_cpu(env); cpu_interrupt(cs, CPU_INTERRUPT_HALT); --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198941; cv=none; d=zohomail.com; s=zohoarc; b=PYRIA27f65YCKkBRgvGy0cz7/SJNDNrCknTNiply0+wnTBRZ84DCjlEL+SckWHhkjymOpTPZacSIiNjVS+O2lqUrNzk4YRRGFgqGu9Lrd3IniWlub9xuI9yTahPsqDjJx5ugkBb/BqTzabxom26/a8KwXt2HOD3gHrug5SlUhoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198941; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=juZrxqHUpIm/ImEGWCh1BIS8AF0/lU1ZIhsBhD0LY/U=; b=n+1+CzWoHFgK3/iQwoh45vG1l+wzbue74oux8RKtdueycTjl1oSpzG9LOL3eWOwi+nQYog0Hs/8KtT1/TcANGG7760BdMl10X/9t8muiD5PgddQTUPFcZrbbASyePR/fkY3H7Q9908RnAeut70xXmpOw8vDsEkwddMEoLs1UJnI= 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 17951989414525.299865415317981; Fri, 20 Nov 2026 10:22:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTE6-000601-Sp; Fri, 20 Nov 2026 13:20:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xUTE3-0005yz-FP for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:43 -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 1xUTE1-0000hV-Qe for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:43 -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 6AKHPhd52043779 for ; Fri, 20 Nov 2026 18:20:41 GMT Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2tkn89xc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:40 +0000 (GMT) Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-8255327a28fso1352052a34.0 for ; Fri, 20 Nov 2026 10:20:40 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= juZrxqHUpIm/ImEGWCh1BIS8AF0/lU1ZIhsBhD0LY/U=; b=cXvOLKLrMtBJhaHq slYbKF1damntFQx/JHPU/moGI+zzWGnMdFXjb7DakvRuF8TcfCNFcuHgt7sazyxB +hIP/Nb54G9uAA8QHEhcuKLdAgo4BVmhixvDGA/Zygp4oGkbE74IdzpMBtTIZXe0 vclp8wHQYiLCBiwxRYJIZ76tT4VehZObdMw1oeV9g2PuyPs6hMVYm7G4ahzI9QAC qRG7DvZudZOfRZkjEBXkFjtb5IHykx7P9kdLforomYS9eOmV6TsD9zMfaq1irFrK Sy+9R8L9DZmvK9u34Q2PzdKpbBMxx3+EMUmISownmUO4opEIXQqo5RwK7ulkA27f VWZVlA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198840; x=1795803640; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=juZrxqHUpIm/ImEGWCh1BIS8AF0/lU1ZIhsBhD0LY/U=; b=LozZIP1xQd8h+YdQKeL/bjdag+Zh42hR4wOYH43IeFETkFrsQYbMQcZpQKmGIIBGC2 SeLXeFonuR/CVbIn8nc+a14CHHx/OTowvbWKYpue3Z55NZlzN7VgYbyuedWCrGxL8R8s OSEEcEBP7cf0xy9+AniE/OqFNfdYMl0ohhBXTzva8xwVNbT8kyLb1q1RsmCPG4Bay5Gp py9ua4RE1eV23asb2ddkYnwGsYiIhWFKjzDaonOVLqCJzhYWD5RqQQDee1hcqxZQSFIw cysV47GMs+bws5vpnUs8ibKg9b66lCWK6dNx0DmNxsPXF5VvvpviAl3EZAo6BU19ROWB M5Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198840; x=1795803640; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=juZrxqHUpIm/ImEGWCh1BIS8AF0/lU1ZIhsBhD0LY/U=; b=h1YlbRkRLUor6qnD1QRLapVKk+NVfdS0S3yB6Bo67vmccVFbXEDVJG7kw1IJPyAAWa je0fhbKDs2iAVD0CydLGy1xvQ/wS6gxjJ9+qzINoNVmYVXnSM6pFZaHfDv7DQoIyp802 Gj+kxYh1vTfvJgH4ONB75WAyJbG5+b8Z7Eh6JbUpgxsaJm8u9C/EHOulEpFNfywn+mAP keHhZ+DHzbGwGoo39cpgruNc1mmJo0qfRPauGpaym6fWhqf3OEE6I3aTU9IQRWUmJ7E+ EI9QBoBZfOl/+XMnh7yB/pVBRsxnbCkANEwpYTuJ2ADMQ0+j+qkpRMwD9nX62Wap8LFj fPIQ== X-Gm-Message-State: APuU4Z8IUPtey3FlutRuaXYOu3wYlcDy8XXOzMPYrD6gFzLCD6VZtu7V Th1qbdcva+oPm4UCoa5dyRRWQEHZYsBvdnPfQrrIstGsNwaZo2LWkSKxwr9sMCeaL/y0PGHf8N0 Cgn1/87Yp0WIj708470Omg8kyE+s32dt5/ClODgZclnlEdXBN5jwQHCaC/Xq7CWjQ/A== X-Gm-Gg: AYBFou2SGIEvNLWg+1NxM1mxYlJJ9geF4oHyXlttpHYrj6BTPabRLYSByEvqA3fZhN1 Z9JhuT6znq/6V1SAk5P2Bpj6Mu/h16P6HKWVo1dCFml+YDVppLJIZn5m+1TX08/phbzefDQdNLq U3mD/SKRXLlmy7VEHSBInTkfjFp5UWhvRmJ0tt03xE3r1dI2jyFrSOt+f/knwnWwX8YuPD3E5Sw nwgDUcUy3vhMH6iJ/rYEfy0cf/i1kmdqx+2hBo/j957dYWAa98hqJgvhNRiqNTqIzzigKSaLfKO B/TnGSuVgbMDxs8Q634X8uRxkbaJTRQteAAANwFzTA07Q+4Yeqx2HlnMUgfehKVSMd+qSxphKWE ZDlV7CpCidFqTQOrP7l/QtKXbtcQws3WUuYoWI12v8lo+I8t4V734LSNNXAVoGv2DpBX1AicjbC uFvOFVL/OoIOpkU1VMwLuSIA== X-Received: by 2002:a05:6830:3143:b0:862:c34b:482c with SMTP id 46e09a7af769-863159d88dbmr6119097a34.23.1795198840192; Fri, 20 Nov 2026 10:20:40 -0800 (PST) X-Received: by 2002:a05:6830:3143:b0:862:c34b:482c with SMTP id 46e09a7af769-863159d88dbmr6119056a34.23.1795198839680; Fri, 20 Nov 2026 10:20:39 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 04/12] target/hexagon: deliver floating point exceptions after the packet Date: Fri, 20 Nov 2026 10:20:23 -0800 Message-Id: <20261120182031.560481-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: f6JICkrM1SloJ8Bwn7ApP8FwFqAhwdPL X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX9gA2pNLbIOz0 vW3Zbf0pilUqxmXPSdYoYhBJ00qF3v/fDTkE60TU3w7Z4dOS2Js/jMUc/h9DRKecrwrPqFOJuo+ hpvQeUimcZtT4zsPtE6lUut1n/bjLjY+lzN5yelCJrKelyH14+hE9TX2p8DHdazspQJf/3z8riJ wtu7YJCMfOKP8Cc95wPnD+rnX26wap7avfsoj7f7t8E/wCuNgI39UhJ7Z3hBDanCKBNoBkSOrvF TMVXkAj27C/uwCXzzVjFIZupeqaMFX1fBrD3OlaWT7ihQzlY1e61ZcyI4qACQV+43O1LExgiOKV NX5EOxujMIOWphh/P/AC6isaK7nwvfvFUuTLoN9h+0NfYDnr+VjsE1JfYrC2bjOcs+uaH6XrGif i7XMQrw6kq5K2K5e/5q2l087fsie3+bJCBQlhcwV99+I6tUswRaQXqo0mzDZt0POlnJlNIBlfjJ 24+wYSDkhBzLSQlkseQ== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX1Y7zjJmNiqCl xy3QphjQBbeqlZdUqsy0UUQG5uMzZEJ2B+ZG6WXzRO+aEz2YXT1T9UI+REWXThtGHmMln0MaWMP H5jrv3hnlCYIXabIhEU/SMPMedi9WwM= X-Authority-Analysis: v=2.4 cv=ZfKIpcVA c=1 sm=1 tr=0 ts=6b008f78 cx=c_pps a=z9lCQkyTxNhZyzAvolXo/A==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=WGR0rWkjfx4cIdXbClMA:9 a=QEXdDO2ut3YA:10 a=EyFUmsFV_t8cxB2kMr4A:22 X-Proofpoint-ORIG-GUID: f6JICkrM1SloJ8Bwn7ApP8FwFqAhwdPL 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200072 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198942415158500 An unmasked floating point exception used to take the exception in the middle of the packet, with whatever PC was last written. The architecture takes it after the packet commits, like trap0, so pend it the way the TLB pends an imprecise exception and raise it at the end of the packet. Report ELR as the last word of the packet so that a handler resumes at the next packet by advancing ELR by one word. This enables the float_excp systest. Signed-off-by: Brian Cain --- target/hexagon/arch.c | 9 +++++---- target/hexagon/hexswi.c | 1 + target/hexagon/translate.c | 10 ++++++++-- tests/functional/hexagon/test_systests.py | 5 +++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/target/hexagon/arch.c b/target/hexagon/arch.c index 5ee87b320b6..ddbcba9cdd0 100644 --- a/target/hexagon/arch.c +++ b/target/hexagon/arch.c @@ -214,13 +214,14 @@ void arch_fpop_start(CPUHexagonState *env) */ #define RAISE_FP_EXCEPTION do {} while (0) #else +/* + * Floating point exceptions are taken after the packet that caused them + * commits, so pend this one for check_imprecise_exception(). + */ #define RAISE_FP_EXCEPTION \ do { \ - CPUState *cs =3D env_cpu(env); \ - cs->exception_index =3D HEX_EVENT_FPTRAP; \ + env->imprecise_exception =3D HEX_EVENT_FPTRAP; \ env->cause_code =3D HEX_CAUSE_FPTRAP_CAUSE_BADFLOAT; \ - do_raise_exception(env, cs->exception_index, \ - env->gpr[HEX_REG_PC], 0); \ } while (0) #endif =20 diff --git a/target/hexagon/hexswi.c b/target/hexagon/hexswi.c index acc68aa6c23..96d4a783ed4 100644 --- a/target/hexagon/hexswi.c +++ b/target/hexagon/hexswi.c @@ -972,6 +972,7 @@ void hexagon_cpu_do_interrupt(CPUState *cs) break; =20 case HEX_EVENT_FPTRAP: + env->imprecise_exception =3D 0; if (event_to_guest(env, CCR_GEE)) { guest_event_entry(env, env->cause_code, env->gpr[HEX_REG_PC], HEX_GEVB_HW_FPTRAP, false); diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 41a0f2b0852..eef392b1e9c 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1345,11 +1345,17 @@ static void update_exec_counters(DisasContext *ctx) #ifndef CONFIG_USER_ONLY /* * A tlbp instruction may detect multiple TLB matches and set a pending - * imprecise exception. Raise it after the packet that ran the tlbp. + * imprecise exception, and a floating point instruction may set a pending + * floating point exception. Raise them after the packet that caused them. + * + * A floating point exception establishes the exception point after the + * packet, like trap0. ELR is the last word of the packet, so a handler + * resumes at the next packet by advancing ELR by one word. */ static void check_imprecise_exception(DisasContext *ctx) { - TCGv PC =3D tcg_constant_tl(ctx->pkt.pc); + TCGv PC =3D tcg_constant_tl(check_for_attrib(&ctx->pkt, A_FPOP) ? + ctx->next_PC - 4 : ctx->pkt.pc); TCGLabel *label =3D gen_new_label(); =20 tcg_gen_brcondi_tl(TCG_COND_EQ, hex_imprecise_exception, 0, label); diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/h= exagon/test_systests.py index 76e2480c1d3..606567230b9 100755 --- a/tests/functional/hexagon/test_systests.py +++ b/tests/functional/hexagon/test_systests.py @@ -82,6 +82,11 @@ def test_ftrunc(self): self.assertEqual(os.path.getsize(ftrunc_path), 1, "_testfile_ftrunc should be 1 byte after ftrunc") =20 + def test_float_excp(self): + """Unmasked floating point exceptions are taken after the packet + that caused them commits.""" + self.run_exit_zero("float_excp") + def test_access(self): """access checks R_OK|W_OK on _testfile_access.""" testfile =3D self.scratch_file("_testfile_access") --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198954; cv=none; d=zohomail.com; s=zohoarc; b=G81HDqq2g9SYJorhihgsSmKAnS2uxl16D/wZcWV12MyZ6H5owRpADMPToiNUmlWfc1RfHQT14gy29jyFvesW8uMcFwEy5GiSJ2F54Nw0vr7y6mBlZ6lVsq2OpLYlQt29ivTIw7rwXNQrxE9/vNiXDuMeeGJ1joEaOz4DNST4uJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198954; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZKkjp8ZF9dSvEd5w4xKjfynBBPgKoKDszWTxlq1VmKQ=; b=To4Nc4DRkC7yV7fAnkEc/09VzvO8n0fw21+botBFey4tYC54mljNAnUiQrCN5gXUAqtwA5pP5uG4oN+7FJyqQvVgajxLGQiQtl1J/X0ggxMVlZmGo7KWNg8McAhSH2XsKG1zU8xAOsM/0fjldINW5pDWa/e2mSNNsQAaxOQeklo= 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 1795198954168661.8439092653379; Fri, 20 Nov 2026 10:22:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTE7-00060d-G5; Fri, 20 Nov 2026 13:20:47 -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 1xUTE6-0005zo-0I for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:46 -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 1xUTE4-0000ku-8t for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:45 -0500 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AKI1cGE1507166 for ; Fri, 20 Nov 2026 18:20:42 GMT Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2u4fr4gb-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:42 +0000 (GMT) Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-862ad1e3959so859881a34.2 for ; Fri, 20 Nov 2026 10:20:42 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ZKkjp8ZF9dSvEd5w4xKjfynBBPgKoKDszWTxlq1VmKQ=; b=Xh/r7x7TPzyDUN1Q Uzfj6ypKKMvG6QLDEO4fgl1P6tL8jjGY9lXES/+MnFDHF/O51i6KU5Oz1TssyzMO aaNFLhT0SZbb+HZmJuFOk8SoX51aw+lfuwZarXKvuP6yaNdeCGRvEbf1xhVerJZ6 C4DHpNUD/acODTSjy82FJ/akvxnktW0FAKqul1jcQNnm3EZZnULLmDSZWKFBCTUj HDGxBZEfM17KHfjXJud7d0TgDCamOeDRqVgIuGDZePMBxxc9u5HbF6P1F56NXWQC sWsBmF7sS8/mR3zXJ7xNt8EPQm7GOt0ajiwhX608fe9orsRvPhbpZDz7mCjZ/tvA 1u7HlQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198842; x=1795803642; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ZKkjp8ZF9dSvEd5w4xKjfynBBPgKoKDszWTxlq1VmKQ=; b=WVzbXoVDUj0c/ZPVUuDDhLQpDTv1Vx0UuMCcW4nNALMPnHbB4sAfPDtj6FBCC1tb1V jYzBR1e2gpvA3E/VycXEqxg/IPv+Yj37LY+FWetDnlCkGuw/OgQeGpvruM9WmPlBRrTF 3TqIlb8D3WHPlC9w8VFxOH4CVlNtVknODKWyfhj6xeGMWIDjblLonvWT2tj5jY4jtUcn k7fOxtnQMzgwg6Jv8Svs9+kBc6GMytSfDbBkrhHG8sdBjRxP0Do7XDjdx4+u5hXu/f4c rgFUuMkly7UWommS0MveNdEuhZp+daCGkfMAbC/CaqjpF4T6HvXqxWc5ontKnAu3bta6 dKfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198842; x=1795803642; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZKkjp8ZF9dSvEd5w4xKjfynBBPgKoKDszWTxlq1VmKQ=; b=hBWQzLHcPtssimkIcGPSdgX5yHHEMUJtwiQ8kpI5TMyj11pjw1m3DO0dbxnw6hxlLJ LTuHq5PRAL4B3gLAJGTR+CmCHc0qqMg+AOiYfoFN9lo8TO0qhDpUYM5EE/MkOHjmkUCT UFSggTs4kVDuHAs1W0fKaGtu/3Uept2eL2XjZiD48U9ctdYJUsm8njNk45DF9M1ISqVF lUA2cnKBYl325UJYubZ5vHlWof/5bIDULrLRgbaUIdP/1xApUugYOE9HoOZuJzLQDJzP jzsmuADfBWZnLzK6egtAkWPTN+Gc/maWB0zpVJhjoEhV6WrUP4OLjbGovAnxagD4QnLg OtCg== X-Gm-Message-State: APuU4Z9YNR2txQRWfZ0QrdJ91nJXHax1AYBu1kY8ZSHlFeGCGjTfHKoI 6RLw/193b4L9YgfuaFBy2VrZxqlym40XBRFMO/0CEUdYmjLHQpS8aQJSHgIFPaVJnx5UONhN9o6 T3UpDVFcI7ZThHvYwhPeHZrYRyNxt1QO3kVp/kdTqaspq8jS/kVYxhpNQ3V9810VxZQ== X-Gm-Gg: AYBFou3sMo9JaKktbOnX2hZVKjP+oBGMm8fAT3JcEWDt0VitO1JCne1FfumoR5Vgdd+ MXbZqldeokYCKWSYyupNHLsSUte7WoxSXNhwAzSrHLkZ1SqVW4QfPpHHsg+J/cCIjGVmTFlPyf/ JexOkfQQLUdgvyNM0bjpGJETW1d1fd5/xs9vKyi0jv82WHxlVXCMeubfiRKHLZKq1oRScpHIi0/ tZ0iolBcxm8uNDyWeDTdhk1jUZ4cCIM3dFFYrMGrHEA1WK1yVl4AwLsejqQETrVoxjxD6CHErhb qo3DqlCHPNlIiFYJpxUyeGezzSaoEbOvDXZIN741gRnV+I/NfSlbl/KuYtGI1UzSz9DXb2q92gn LkuwIRdx6jDN7ZaQ+gucIwqY5P81DQqI/ThTkexh0n1irwwSvTVPEPRBYmC33S87LSCp4eQXBG+ AQoYYuCiptO4q6Wv5KSmOr5A== X-Received: by 2002:a05:6830:6413:b0:862:abc2:9c52 with SMTP id 46e09a7af769-8631562e308mr4840750a34.14.1795198841585; Fri, 20 Nov 2026 10:20:41 -0800 (PST) X-Received: by 2002:a05:6830:6413:b0:862:abc2:9c52 with SMTP id 46e09a7af769-8631562e308mr4840723a34.14.1795198841137; Fri, 20 Nov 2026 10:20:41 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 05/12] target/hexagon: report the faulting packet for stack limit exceptions Date: Fri, 20 Nov 2026 10:20:24 -0800 Message-Id: <20261120182031.560481-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=VJBIDNPX c=1 sm=1 tr=0 ts=6b008f7a cx=c_pps a=OI0sxtj7PyCX9F1bxD/puw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=ctcHP5N1X2NQA3O8W1oA:9 a=QEXdDO2ut3YA:10 a=Z1Yy7GAxqfX1iEi80vsk:22 X-Proofpoint-GUID: 1aWzOAQF_gWagmY1Ui25BTXMEhGRXd1T X-Proofpoint-ORIG-GUID: 1aWzOAQF_gWagmY1Ui25BTXMEhGRXd1T X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfXzg9s/LAh2Mv5 ito/AqQgx1lLvXhM0Z7rwN8ZQ6ouMmlCnbDE17TQysHSCsuzXq7opBZta1Fcnh5wZio+V90Nt0w 2IUjOFbYOoigbubX4pqP99ZsYGD5xnM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfXyNaM+tuAXkxV U2SajJ648OojmBo4UX0jkOBq3bkYMqhZHCxkS1Z19NGpUx+9TJmo3TXAwk3KNZ71OtAlaLClmrd 0eJJIJkvpqVs/N7HNG4DSThurX5Gd63IUMzsQLLcodt0vVkkShwe9orECnDH76ONAYyQbA5Uj3c 0NcaCCK4zi7PsBR0jm2288IzeyWbrQ/Wldtqrse2aOGkNZ0B4x90HKRLwPxeqRrauu1ihOTjIuF 7nKlEG8se2ca59kGJFhZVmlAEhc3OtRJxwngByoqLrGbE0/p2UwG15Ih3qyYZGFHICFkFTSjOYU XB+g3B5gJg7oeW5/3g0Lj/vw0p0WOQnF+CtmSwf/sz1ATvg1wK6vvFny97n7jzRQL4SDXpo84Kx eEynq95hkbrt0h2Darpy5T4XFpSp5FOQHhvCIBHfKmu55THMimyOpVq+TWOdXHkVSpn1qCCwwdA +gZdI9S1TfmU9r+mycg== 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 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=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198954368158500 The stack limit check raised the exception from a helper without updating the PC register, which is not kept current while a packet runs. The exception's ELR was whatever PC was last written, so a handler that skipped the faulting allocframe resumed at an earlier packet and took the same exception forever. Pass the packet's PC to the helper. This enables the framelimit systest. Signed-off-by: Brian Cain --- target/hexagon/helper.h | 2 +- target/hexagon/genptr.c | 3 ++- target/hexagon/op_helper.c | 4 +++- tests/functional/hexagon/test_systests.py | 5 +++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index 292ca8eb7c5..e658f8068f4 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -158,7 +158,7 @@ DEF_HELPER_5(insn_cache_op, void, env, i32, int, int, i= 32) #endif =20 #if !defined(CONFIG_USER_ONLY) -DEF_HELPER_3(raise_stack_overflow, void, env, i32, i32) +DEF_HELPER_4(raise_stack_overflow, void, env, i32, i32, i32) DEF_HELPER_2(swi, void, env, i32) DEF_HELPER_2(cswi, void, env, i32) DEF_HELPER_2(ciad, void, env, i32) diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 52615628e3f..90b71ebc016 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -1156,7 +1156,8 @@ void gen_framecheck(DisasContext *ctx, TCGv_i32 addr,= TCGv_i32 ea) TCGLabel *ok =3D gen_new_label(); tcg_gen_brcond_i32(TCG_COND_GEU, addr, hex_gpr[HEX_REG_FRAMELIMIT], ok= ); gen_helper_raise_stack_overflow(tcg_env, - tcg_constant_i32(ctx->insn->slot), ea); + tcg_constant_i32(ctx->insn->slot), ea, + tcg_constant_i32(ctx->pkt.pc)); gen_set_label(ok); #endif } diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 71b27ef07f1..cdb731160eb 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1660,7 +1660,7 @@ void HELPER(vwhist128qm)(CPUHexagonState *env, int32_= t uiV) =20 #ifndef CONFIG_USER_ONLY void HELPER(raise_stack_overflow)(CPUHexagonState *env, uint32_t slot, - uint32_t badva) + uint32_t badva, uint32_t pc) { /* * Per section 7.3.1 of the V67 Programmer's Reference, @@ -1677,6 +1677,8 @@ void HELPER(raise_stack_overflow)(CPUHexagonState *en= v, uint32_t slot, cs =3D env_cpu(env); cs->exception_index =3D HEX_EVENT_PRECISE; env->cause_code =3D HEX_CAUSE_STACK_LIMIT; + /* The PC register is not kept current, ELR is the faulting packet */ + env->gpr[HEX_REG_PC] =3D pc; =20 if (slot =3D=3D 0) { env->t_sreg[HEX_SREG_BADVA0] =3D badva; diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/h= exagon/test_systests.py index 606567230b9..f997563baca 100755 --- a/tests/functional/hexagon/test_systests.py +++ b/tests/functional/hexagon/test_systests.py @@ -87,6 +87,11 @@ def test_float_excp(self): that caused them commits.""" self.run_exit_zero("float_excp") =20 + def test_framelimit(self): + """allocframe past FRAMELIMIT in user mode raises the stack limit + exception at the allocframe packet.""" + self.run_exit_zero("framelimit") + def test_access(self): """access checks R_OK|W_OK on _testfile_access.""" testfile =3D self.scratch_file("_testfile_access") --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198882; cv=none; d=zohomail.com; s=zohoarc; b=HyYn4AwOSbg1dXfT4n4aQViPKpf05UK9VdPWqprBe1sUEMmfPjFBfOxsFc4kAsa01Ba5fEEQqCMBeDcswVQ6XncIHuiev3j/xJC87C7DJDsf5LOIbgeXzk553Mni9l4KMELQLNh58baovhBt8NhxFeG6jCtJll+IYs60IyX9w5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198882; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CkzLKKzs4HYMXgSYKhhd2yYEm+mi2LzoFf4VTUGF40Q=; b=DTY6NjgKTwkco8G8HEvE/zxTytndSZpBH0z5RqpejKtFz+H2YUQR9yvW/JzLrosYPQzIOG68heq/WTPM0Ff2Qe0VDZR60UO6bDJodfyqoEj5VTGDikSQ176oJTPhq1wCsO471/6BvQjlrxy+2k1WbnByHzB9pxvwN54HUEDSbnc= 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 1795198881956771.5956944206454; Fri, 20 Nov 2026 10:21:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTE9-00061L-Sj; Fri, 20 Nov 2026 13:20:49 -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 1xUTE7-00060e-Lx for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:47 -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 1xUTE5-0000oy-Ep for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:47 -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 6AKEg2rP1528734 for ; Fri, 20 Nov 2026 18:20:44 GMT Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2ggqu3ek-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:43 +0000 (GMT) Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-86285932977so1367041a34.0 for ; Fri, 20 Nov 2026 10:20:43 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= CkzLKKzs4HYMXgSYKhhd2yYEm+mi2LzoFf4VTUGF40Q=; b=aqpzm9TzLnn7qC6D ma+RQQEmkgws2E6pkDC1tkW/XCi0DWoIshQ/MFfseKG7X2CJ18zoD2Gksmk8fQfQ hZXFT4YzKqZe8+TPn2fMQQabSsfnnl6iOci6ugA8f9zKhmY6GpBXl5KTDEsBZ5uQ aO01W8J0AQN6crZ6TIammzM9CyIw7qp7IjDN2LHktWxDO6wEe/3ylOBukUMjpk4f hWzAF9YlqkcC+g8n5cyU4wlgwcXHRfu37BJkg99VZwndH3yTIHM2K2J5nqRAZSF5 ggNVJ0KBXYIJ7sYDsYA2EtSNrYKbi7Ipa02fmUyxmRsJFyp+CpkVJwI6ERVptZtA p1fygA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198843; x=1795803643; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=CkzLKKzs4HYMXgSYKhhd2yYEm+mi2LzoFf4VTUGF40Q=; b=R4Wbje/JbSmg0NZR9H3XBMDa7OY8/B5Qy96QB1ZA0vwGRi3VpYWdZvXfYfFrfnCl14 bcizgasrJb6HcvKDlts7Y2vfTCT5T+FD2HWqM3598Bbmh7NoZIZkw10OpB0hKjFHtuw7 wcYrhxzIcZeXH4y05bOWTqUKPk/ZCelrKD4rTWa52tiY8h/uPvLNGKd1kNTsVAahtvjQ vGcnPsu0pplFD+SwwblX2Q/FadgOM6UAuOz6uS64B/wmnoFppeXxkkQ6LhEtS31Xm5V5 XFBNmVwJtin9pDbdDJYNbnQSDiMjy41uT+cn1T7qsiuQKhULp0yVTnAB3B2IigHywWPx N9EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198843; x=1795803643; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CkzLKKzs4HYMXgSYKhhd2yYEm+mi2LzoFf4VTUGF40Q=; b=UE/Es5qtO9v8nZ5gBSEPg9b/hXd1ZxhAf/Js6XA/3CUYylE6y2QLDVYrXbKxjr7Vaj DWZtHsoju+NsKPIsP8kWJCiqpSM6zXJuHAxheNbzfWzFiziN5BuzRSfD2ieeQGKXcaHd k7SVfuj5jSOGMTjroK/3AAstStaL6BJvomy2O7iuqvzy751pzVmHT1gtFpErxtyFh9VQ yLhbO758FKI/3iy8LoEqSmXvPqhkn1yGfvQb5WpkEn14A/gWtkIPaMBhBuTRtxth43t4 CIvlkXfWtEVNjPezpA4zXi8Z8gLltikng63RFnlDsPetrOILJayI0d4PSt5UwQ7L7/zj z3Bw== X-Gm-Message-State: APuU4Z9TrkIhTbAXmIXuT/PIC2WHL1438o5wbPv1qSp+Pw6AfzGR3Xxe wbq5+/1DzXR7olFI8s5lqEnakNYwBg4cXCFKDWe6DT5fWYw0bPOfxX5ucIBvraTzAuEzlXaAeB9 NkWltS4xGFfHHwYeCLVogdyou2Z1PcOyRNicAEB7ynFOWyuH82zizIhksFiWNg30LsA== X-Gm-Gg: AYBFou2S3g1G1baBBlagRvmu/fnUwbhcx/1A/Kd/daJaQRpviCcFu5MSDZyK7fYUX1/ j+u9umaw+PRgzCexm/pT2GMhXS2eDERtTXbhzS8/tpfeK8ugO5cD4uf8vAqsHeSWjBfTRdLUgu1 D9P90sM2G2fuw7fkYWGBHG0jBYloODm3m4BqXcVSwYutloeezhIwgy0iShq8Lca6dRp5MJ2TmEF x5lhc3Iyjo8k/zufUfKHH4fpIcB/CCw0hHT+cn6JWQVlWychxlg4QpwUzEfSvsFdnlvzytoNo7E eJO//q4pbcd5xfctw6EZKJ0tJh8E/R3FD53zRzC0cCV3APskeOV/zhmGVeS9riHLu+6Gsu8wGUv fW6tucFJ0anutOVkLo6uFNiKwf/m7KjOFlvxAOngXvG/jDJfWvh5lRrcIwih03WDTudSaoNtlBm tSQDozXUCtqeZspx5EjLY2wQ== X-Received: by 2002:a05:6830:4123:b0:826:b77:adef with SMTP id 46e09a7af769-86315625055mr5114440a34.14.1795198842897; Fri, 20 Nov 2026 10:20:42 -0800 (PST) X-Received: by 2002:a05:6830:4123:b0:826:b77:adef with SMTP id 46e09a7af769-86315625055mr5114404a34.14.1795198842446; Fri, 20 Nov 2026 10:20:42 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 06/12] target/hexagon: take exceptions for cache operations Date: Fri, 20 Nov 2026 10:20:25 -0800 Message-Id: <20261120182031.560481-7-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX1oP1+3EMlNOb Jmos15wGmueEE+8rVR9UegJYzG2bqLUXOkMp2SvyXdCky6JHAme2ehIX8u3atrBMAsRkLWcnysm dHmjSLh9zIzVGPyirVmxoM3Q2nIo7vhOPa2zSv3Ooc7fW71nDRuZLqgu6rrJClxkEfT3C+6GkB1 pxAys1wUA3rxf4NrS2TCOA3Ozv86MqgaaN+YbR5RWm5wiXQENzQvSF/tNmLTj58aVs0SIOtDk7p 5auINMCOWoJWh2bquVkwiKSvb7pD6MVsB9jqq7f4F3zKBz7rdaGYn+vD/RlCFUfqCIi5wR/+J8I kWXK6P5sH19Zv38CAT/ycEYASUzt4PX9SC9m2V1/UHJmNEvkRNYGOh6Cm8JirqniEDEQXK/x9JO quLXg0XAAw0nVTJxL0Pt/hwkseOE3z3gP+qvCkeoRoukEq4BB2/sirA57dccx4P+hE/ynCP2KES YhUG+G6t8bNlHP03lUA== X-Proofpoint-GUID: UeR8nEynHPwZoMOV_Fpc4WMh6Xxq9SQk X-Proofpoint-ORIG-GUID: UeR8nEynHPwZoMOV_Fpc4WMh6Xxq9SQk X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfXwmP7TsBGVIdn 0qubFjnNTl0g9iVOc+RY5t1P4agHQoc6ZOGDxjEpV11zsHIl3ZnIFUl6n2WYw5I7WhPGjjc9P84 4aVdkbmXIcNWusF06MdUPgvDUlG1EFA= X-Authority-Analysis: v=2.4 cv=CNy/zhrD c=1 sm=1 tr=0 ts=6b008f7b cx=c_pps a=+3WqYijBVYhDct2f5Fivkw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=7Y3dZtSKsafMCO3hotIA:9 a=QEXdDO2ut3YA:10 a=eYe2g0i6gJ5uXG_o6N4q: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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 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=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198883887158500 The dcinva, dccleaninva, dccleana and icinva instructions did nothing in system mode, but the hardware translates their address. A data cache operation takes a TLB miss exception if the address is unmapped, and a privilege exception if the mapping can be neither read nor written. An instruction cache operation only takes the TLB miss exception. Probe the address through the normal TLB fill path, which also reports the packet that faulted. This enables the mmu_cacheops systest. Link: https://lore.kernel.org/qemu-devel/20261117183629.2002840-7-marco.lie= bel@oss.qualcomm.com/ Signed-off-by: Brian Cain --- target/hexagon/gen_tcg.h | 18 +++++++--- target/hexagon/helper.h | 2 ++ target/hexagon/op_helper.c | 42 +++++++++++++++++++++++ tests/functional/hexagon/test_systests.py | 4 +++ 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index e82f89aee42..40f35eb8199 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -512,23 +512,33 @@ #define fGEN_TCG_Y2_dczeroa(SHORTCODE) SHORTCODE #define fGEN_TCG_Y2_dczeroa_nt(SHORTCODE) SHORTCODE =20 -/* In linux-user mode, these are not modelled, suppress compiler warning */ +#ifdef CONFIG_USER_ONLY +/* In linux-user mode, the data cache is not modelled */ #define fGEN_TCG_Y2_dcinva(SHORTCODE) \ do { RsV =3D RsV; } while (0) #define fGEN_TCG_Y2_dccleaninva(SHORTCODE) \ do { RsV =3D RsV; } while (0) #define fGEN_TCG_Y2_dccleana(SHORTCODE) \ do { RsV =3D RsV; } while (0) - -#ifdef CONFIG_USER_ONLY #define fGEN_TCG_Y2_icinva(SHORTCODE) \ gen_helper_insn_cache_op(tcg_env, RsV, \ tcg_constant_tl(insn->slot), \ tcg_constant_tl(ctx->mem_idx), \ tcg_constant_tl(ctx->pkt.pc)) #else +/* + * In system mode the caches are not modelled either, but the operations + * translate their address so they can take TLB miss and privilege excepti= ons. + */ +#define fGEN_TCG_Y2_dcinva(SHORTCODE) \ + gen_helper_data_cache_op(tcg_env, RsV, tcg_constant_tl(ctx->mem_idx)) +#define fGEN_TCG_Y2_dccleaninva(SHORTCODE) \ + gen_helper_data_cache_op(tcg_env, RsV, tcg_constant_tl(ctx->mem_idx)) +#define fGEN_TCG_Y2_dccleana(SHORTCODE) \ + gen_helper_data_cache_op(tcg_env, RsV, tcg_constant_tl(ctx->mem_idx)) #define fGEN_TCG_Y2_icinva(SHORTCODE) \ - do { RsV =3D RsV; } while (0) + gen_helper_insn_cache_op_check(tcg_env, RsV, \ + tcg_constant_tl(ctx->mem_idx)) #endif =20 #define fGEN_TCG_V2_CHECK_AND_WRITE_VSP(VSP) \ diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index e658f8068f4..e7e7ab2c02e 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -159,6 +159,8 @@ DEF_HELPER_5(insn_cache_op, void, env, i32, int, int, i= 32) =20 #if !defined(CONFIG_USER_ONLY) DEF_HELPER_4(raise_stack_overflow, void, env, i32, i32, i32) +DEF_HELPER_3(data_cache_op, void, env, i32, i32) +DEF_HELPER_3(insn_cache_op_check, void, env, i32, i32) DEF_HELPER_2(swi, void, env, i32) DEF_HELPER_2(cswi, void, env, i32) DEF_HELPER_2(ciad, void, env, i32) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index cdb731160eb..bdd5defc9ec 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -25,6 +25,7 @@ #include "exec/helper-proto.h" #include "exec/mmap-lock.h" #include "exec/target_page.h" +#include "exec/tlb-flags.h" #include "exec/translation-block.h" #include "fpu/softfloat.h" #include "exec/cpu-interrupt.h" @@ -1659,6 +1660,47 @@ void HELPER(vwhist128qm)(CPUHexagonState *env, int32= _t uiV) } =20 #ifndef CONFIG_USER_ONLY +/* + * The data cache operations translate their address. They take a TLB miss + * exception if the address is not mapped, and a privilege exception if the + * mapping allows neither reads nor writes. + */ +void HELPER(data_cache_op)(CPUHexagonState *env, target_ulong RsV, + uint32_t mmu_idx) +{ + uintptr_t ra =3D GETPC(); + void *host; + + if ((probe_access_flags(env, RsV, 1, MMU_DATA_LOAD, mmu_idx, true, + &host, ra) & TLB_INVALID_MASK) && + (probe_access_flags(env, RsV, 1, MMU_DATA_STORE, mmu_idx, true, + &host, ra) & TLB_INVALID_MASK)) { + /* Not accessible at all, take the exception for a read */ + probe_read(env, RsV, 1, mmu_idx, ra); + } +} + +/* + * The instruction cache operations only take a TLB miss exception, whether + * or not the mapping can be executed. + */ +void HELPER(insn_cache_op_check)(CPUHexagonState *env, target_ulong RsV, + uint32_t mmu_idx) +{ + hwaddr phys; + int prot; + uint64_t size; + int32_t excp; + + if (!hexagon_cpu_mmu_enabled(env)) { + return; + } + if (!hex_tlb_find_match(env, RsV, MMU_INST_FETCH, &phys, &prot, &size, + &excp, mmu_idx)) { + probe_access(env, RsV, 1, MMU_INST_FETCH, mmu_idx, GETPC()); + } +} + void HELPER(raise_stack_overflow)(CPUHexagonState *env, uint32_t slot, uint32_t badva, uint32_t pc) { diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/h= exagon/test_systests.py index f997563baca..5dc05256aae 100755 --- a/tests/functional/hexagon/test_systests.py +++ b/tests/functional/hexagon/test_systests.py @@ -92,6 +92,10 @@ def test_framelimit(self): exception at the allocframe packet.""" self.run_exit_zero("framelimit") =20 + def test_mmu_cacheops(self): + """Cache operations raise TLB miss and privilege exceptions.""" + self.run_exit_zero("mmu_cacheops") + def test_access(self): """access checks R_OK|W_OK on _testfile_access.""" testfile =3D self.scratch_file("_testfile_access") --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198902; cv=none; d=zohomail.com; s=zohoarc; b=fO355H09c5oqOp0dNp6/ckEJbdPXNxaUkc0+nzos6zLtmnTDpQPaTglZ2c2yOA2ns6bQ+7AfXfDxy6sQOnFHOjsMBLmfJ3SHoxN12kQX7hIptz46oMSI1BX2nJAGkE5KOT230OGSRNSH2WOtQfyvYyqm1REYgbkWEiDaY/cU5gc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198902; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=E03kImDsatFVsrjOWu+28rzbswdOKqZw85wwqwk5HY0=; b=HqhPZSfiFg67s1sbhWRy/2JkBRiVqD7/RcIg0P/I389g+DwJ4QhXB2yaQSDJ3bDMXsOJIgTN4T4TROc5A5HCqNdFJRvYqfBMFIkMX/BLfs9mlxU3qMRxJDj99IHvpuSDpr22JNLyxhT1d1toBz+7tsw9zZW83w2ssN1mPUvYHAg= 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 1795198901867432.0939710676106; Fri, 20 Nov 2026 10:21:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTEE-00062C-AF; Fri, 20 Nov 2026 13:20:54 -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 1xUTE8-00060m-6S for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:48 -0500 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xUTE6-0000p3-Do for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:47 -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 6AKHPkKU2043957 for ; Fri, 20 Nov 2026 18:20:45 GMT Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2tkn89xu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:45 +0000 (GMT) Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-86287b38a31so1439428a34.3 for ; Fri, 20 Nov 2026 10:20:45 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= E03kImDsatFVsrjOWu+28rzbswdOKqZw85wwqwk5HY0=; b=KrsA75b8rFbv8mBm A2tohnJM1YjxsLpjfItXYPyqwvS3rpNalY388iCpA7ElbI8m+aMacy1PmhHKd4UJ 5xHAWsBEyhcRGBZqXzhrRg0VXGVcvlC1+PSQRrkUIxhcL8MPfiBLJXhnxBjYacWf CiIP0k0R3UiQfCfDoXuzRJjl78+mHde34qalRveJc1SrRm+y0wRh9oucSiLhD4sx WwbFYguTICXQlycN6TZ3fI6tpCt36z+ajNfcvn0BFLZekNMn21uhTr211Bc6b7XZ aywypgIJ6wUlBJ+cuNrB529vjDgl1Ytjd6YvGYoMPJmFrm5Ev4ag0GcsNSXsialj 7PivAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198845; x=1795803645; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=E03kImDsatFVsrjOWu+28rzbswdOKqZw85wwqwk5HY0=; b=chM7Y/lgAmwnSVqS4+YRXUYimimq9hR45taM7QRquCK/8cJozVUvjaeF/ELL47iPLN SihZZZdp7r3u/9TZKRkECmwETzBSM9xpfNmy9g1Q/30FpCEp+fb+tA2djDpQxhBM9Cvs AZzCLgNLClq5AOeiDl8YHo65UdISQB7FmOGknKH59VBS5QzxxvzyLgKCYtICsbZeSB3k jQFgqgu/z4LbtJjYoje1AiULwVkZHLYPtFzw9RUEp8n8iwkWCYnNVknlrwaUtljP8jHq FUk6P+534cHB6ysGYcbV0vY/eS7mJrs7LFXvwN87eZaCYxZGtS6WGiSTgh5hIs+3h8SV tuPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198845; x=1795803645; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=E03kImDsatFVsrjOWu+28rzbswdOKqZw85wwqwk5HY0=; b=CDNWyfHIJU0Ddjkh7Df7SrIfk4g5ohymI5+kyBlCmh7Y2fXA/ANku8TvAtPrhMl1L0 Q05hDmupONpGEutKrUt9m53h9dXtsXDjvHr8jQJWnRL42GEJUbzi2l5ix7tG/LXOJYKx y/5RPnmZoN/Lmyi/5IZu8JyFSouNQyHWc5QaIIrJxFAVI6PZZeUwM34MUhfgFnbbCgod 4yad1PmCb8bSUAvSUzYA1fvStxfMRVbSJuVcgpLeRGjHPoQTGeV0joeKiyle6YKr2wdV sbD2V6r8/+F/DVI1Hld8+TL/3wyyGlo/ghj2zABSNSMpOfMhBNEUUr1OWlWSkKxlqV4O WejA== X-Gm-Message-State: APuU4Z/ph65RSylmztb7wGLjJZDaMPsqvpou1Atv90k70zQ60dY8u0SH gOWBMZ/2ugDwqGMHmC4QOqJMUpVpUYTr0TmbwKOeaPdGDpqzFQd91smJrTUX8vQlL/hG5X4skne uLOuPAFnRVNUiBKxdreyMXC1X+j+IC51Y1mPab/EYT2oiizPCTctv9FLEyCjJey7ruQ== X-Gm-Gg: AYBFou2M7Mt4hLpj66kyWWxpNz9IWF66Xy8TuNORNZhwS8OBItzei3ZqxQt9GMM4WJH mc3UZzGFOPm3n6tMiIQ+qVG32euC8LSIUZMSfZ6/MT0N8mI0NQEPCKWibqwUiLp+c1BrmVvhJxm EGw0+cdFzmgCUGxmZXmrn23EpsJFtW2D9oyYEnp7u8QjNDLPLsXUINo9wJFBCKAdKFtHVd+JFI3 0neKejf3HjH1i7Go/KRUpAhzf14LCb2DM43AygBU9XNDLNn6GXE+9/WmeX0uv2sIQNdwAWcmbvb 9HcA8WnAKmuC4J7bVmUSlJahPhhbEDYfcrkTyVya7iXfoaQCgTNwXXQjkbFLCRhevs52BJP80+b ex9kuy4352sVU8+kRgHrTYeYMxU54HxjyVVrg08rylb1cNTcIVLkJsxzEpV5UWlngw4ArWM/VOo ZvI2hqjpNdXNXuaTZSUriEIg== X-Received: by 2002:a05:6830:4103:b0:862:7ba1:9b35 with SMTP id 46e09a7af769-8631597709bmr5214098a34.11.1795198844559; Fri, 20 Nov 2026 10:20:44 -0800 (PST) X-Received: by 2002:a05:6830:4103:b0:862:7ba1:9b35 with SMTP id 46e09a7af769-8631597709bmr5214061a34.11.1795198844075; Fri, 20 Nov 2026 10:20:44 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 07/12] target/hexagon: raise decode failures at the faulting packet Date: Fri, 20 Nov 2026 10:20:26 -0800 Message-Id: <20261120182031.560481-8-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: RJfcJtZ4blFmInEPqnkXRW1wWXrRkkCS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX5H8/aC9yvu6B aUSwqRmRuXCXLKA9F5n9d7oN7r4baEri4cVkVrTigxiXxuCOfBAAX/Mmi4cOHyx+QzARrfv6WEl Zp1EgUkHeEH2NK7MNJ1tjaxF9KJ7WhPm2xRgIdjjBlw8IOhVDwBiXPvqBKyxlg0ycIl9f56hN0M elHkZrPEF2A67JAdYBX8bViahX6rOBIks1PgZ5ahkon2IYCYS6hUPxvVePh2ujd/yEmR2+uiUsa G4kAiyQ1KMy5K/gQz9M+Vy1ECMbpsrC9vSHMncnjNlPxat1ZcYbNDjJipLuOvbV5SYTqX8OTMij sHa9UFeAKzRSUzvaIAdnXmPIrFKeNxvpSbj8fmfB0l9w2GC31BnOCUFvEAfB4h1dGgw0x0Gi2zh T6d13N4UcC79eBS9KFyPcaOCzxIIlhT7MFfxVQQ1w8lYiNGNgHrNBA8CRf5dV/YczA8X9x4GZ7Q GTJcqJ1MvnpBMqDjxuQ== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX7YjhN27Z8idE lf/r2B/8VOtRobM3oizp0Mv4ROp5PxztDWP+xvKBoMN338woQnnNO6F7L7LRO/n8XbUTxTpfMzF PE6o0wga2DzBAZCA6HHtO2fpuFQFXDU= X-Authority-Analysis: v=2.4 cv=ZfKIpcVA c=1 sm=1 tr=0 ts=6b008f7d cx=c_pps a=7uPEO8VhqeOX8vTJ3z8K6Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=BJZ_eTHKON5vc81CckUA:9 a=QEXdDO2ut3YA:10 a=EXS-LbY8YePsIyqnH6vw:22 X-Proofpoint-ORIG-GUID: RJfcJtZ4blFmInEPqnkXRW1wWXrRkkCS 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198903901158500 A guest handler for an invalid packet or opcode skips the packet by advancing ELR past it. gen_exception_decode_fail() raised the exception at the address after the packet words, so the handler stepped over the packet that followed as well. In system mode report the address of the faulting packet. linux-user keeps reporting the address after the words, which is where the invalid encoding tests resume. This enables the llsc_on_excp systest. Signed-off-by: Brian Cain --- target/hexagon/translate.c | 13 +++++++++++-- tests/functional/hexagon/test_systests.py | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index eef392b1e9c..126d7b29a9d 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -271,13 +271,22 @@ void hex_gen_exception_end_tb(DisasContext *ctx, int = cause) */ static void gen_exception_decode_fail(DisasContext *ctx, int nwords, int c= ause) { - target_ulong fail_pc =3D ctx->base.pc_next + nwords * sizeof(uint32_t); + target_ulong next_pc =3D ctx->base.pc_next + nwords * sizeof(uint32_t); +#ifdef CONFIG_USER_ONLY + target_ulong fail_pc =3D next_pc; +#else + /* + * A guest handler skips the packet by advancing ELR, so it must be the + * address of the faulting packet and not the one after it. + */ + target_ulong fail_pc =3D ctx->base.pc_next; +#endif =20 gen_exec_counters(ctx); tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], fail_pc); gen_precise_exception(cause, fail_pc); ctx->base.is_jmp =3D DISAS_NORETURN; - ctx->base.pc_next =3D fail_pc; + ctx->base.pc_next =3D next_pc; } =20 static int read_packet_words(CPUHexagonState *env, DisasContext *ctx, diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/h= exagon/test_systests.py index 5dc05256aae..ac2071795fb 100755 --- a/tests/functional/hexagon/test_systests.py +++ b/tests/functional/hexagon/test_systests.py @@ -96,6 +96,11 @@ def test_mmu_cacheops(self): """Cache operations raise TLB miss and privilege exceptions.""" self.run_exit_zero("mmu_cacheops") =20 + def test_llsc_on_excp(self): + """An exception between a load-locked and the store-conditional + clears the reservation.""" + self.run_exit_zero("llsc_on_excp") + def test_access(self): """access checks R_OK|W_OK on _testfile_access.""" testfile =3D self.scratch_file("_testfile_access") --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198871; cv=none; d=zohomail.com; s=zohoarc; b=k8W9cNgQ5tZla1xkKmmKNtREHVjC6J3fFI0lCd8uhg2U/y7r2gtJjhOw1cM9aTQnxM+GVG5BTvWG8eYs4oFEEAMbwgibXFJ+K4iQJYrB3cWWSgzQOEy+PqNsj4xF8IkQ/V8TfEvHRJ9kFnhimBY5Eia2Yub+B96nNs3RvaEV6Xc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198871; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UapivG8f51tWo3vDh6NSXxhp+g0QcNz6RdJgswsVvNg=; b=iWcCN6Z31CcQensNNRe0iZRuATGZCgACAA3DCp9I6ufMIG84Bv8vcyWGbxX/PHUqmMvibZJbzUggltPbTNTwaWCpd3llgHHPGjvgOfcBYBY2U925BRDyBa6vb2p3LwxJ4I/SMtMbn7YoJXGGtzBRGLOdaLow7w1rkkP+OzsfGHA= 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 1795198870980506.0958771384736; Fri, 20 Nov 2026 10:21:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTEB-00061k-Nm; Fri, 20 Nov 2026 13:20:51 -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 1xUTE9-00061E-JA for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:49 -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 1xUTE7-0000pJ-TJ for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:49 -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 6AKEffuY1527754 for ; Fri, 20 Nov 2026 18:20:46 GMT Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2ggqu3et-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:46 +0000 (GMT) Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-8632a144987so6776a34.2 for ; Fri, 20 Nov 2026 10:20:46 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= UapivG8f51tWo3vDh6NSXxhp+g0QcNz6RdJgswsVvNg=; b=GK78o1DE15E73g2G 8pTnCKEoLDReEk8CdAXD97cYVbzENyJXeCowpcq+DtQPhX/gfI7kF3SnugZP5W23 JwFxwtFJDu9EP5pj6YzUaicKEhrH8PwbJHwBmphsssfprNQzrntY1bORwd21gv20 mieHDH7jRoqL3mCuz+hqK02R3xxLfg/H2AI7SY8xGLetvdro/2JNLk+gusVRbKDm G+T6l3PK5xF49YZ2oEZ/CEt/XMnwVdrHopbMix+zbsavEeHqFfnDRQnUwpPb5F3q 02510uoFUIy62I1iKU2C4+9Vqzhrdl+AJUK9/wo/5rrSYNb6srIAbuLR3L/72eqN y1WMJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198846; x=1795803646; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=UapivG8f51tWo3vDh6NSXxhp+g0QcNz6RdJgswsVvNg=; b=DDc40iC0qXOau6k3sSgM9S9jCeOJkpoy3o4/u7FtYRdg5qisy6GEGLpt/nakweZ/U7 UGOhQ8Q6ssvaZFt05QRn1ljYSYGIqOcxH4xnr/fLTew0qGf/MBR6LfdkJK2wTwz0v+za p0p8tgBAA/MCXKx3MqImEGCnDSpzHADdfp3DtZ7hN0szTbnJougU7Bixq5C2S6m9drqZ rcWiqrQ+xLzYWvQ9GuztvxlVkPDMSRQfHEzxQxPQV8f5AmcymPPYD1Dsmob2YldB4dku O3qI898qdIhMdNt7NTu1zGVxxIA5bk+7ewWUAAcGCw1n/zLJ4AZGxqp/oJF7pcSur5dh yU/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198846; x=1795803646; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=UapivG8f51tWo3vDh6NSXxhp+g0QcNz6RdJgswsVvNg=; b=A6ygBLtgbBqGeTiBanwfHe5yXHgom5AUZHENHlCL/KkgS+pjEm/2muhhABh/Pcyrf5 0IvGtzBGZjg2+3YAQujzosmVJEUhru/GV0165fk5sCTlyFGa5bVSgO4JHXNcq30ypZyl 6V7IhJiRJ/dIC5EJSLHBsw3PbIuNCI7x+nFldVXUP1alPgq1QVDBlew27r79Dg0Pkz2D VGN+xeEhwJihuPfiIf5Sr4WOvpdP3RDIcd5f8FG6VedGCRIQKLgXnUXVlUHwwlt080L5 uxITxq3jSFZhbJHf2i/PlJ/Jc+nVREe4ybH83j+g+C4AododI7p0yv668u1C00l/ImuZ Eo+A== X-Gm-Message-State: APuU4Z/CrzlSIwHawF8VChHilYZnUJ+zsxdMw9HgEUZp6cqdz6W28510 jdXmMrjXq6Zaz3pRGKTKkdLzSlWKRSE2LPKeJ661p42CfQCJJf6/0UbyzXV7UURuhUYzVJohOoi CB5yzZIVeFoDsJli31ZsmHH8AarW90nCTsX/Xpfg1hnWxyvF1/hPQ7MV0wtAWjw83Gw== X-Gm-Gg: AYBFou2FWMJRikSXBRYDqGSidS/t7AWLepG5SwUX1VA/XxNDOaJMcz/ZqyFKsFG4B+k VAQ4ZsFH6xrX9ikvbI824MvPI9R3q0DZjKjPIt38V7O5E7EHD3zDfre8DhmthM0IexBgSnXcbmP NFQ0LPTmsLwiY1sBNtCB8OMhW8gZ83D1zxGrMpb4qfCU4JLDRU6P6Q7fqKm1X76Pt5Fc9zp0RdB HxY+osMgo1kclSb46C/FkczvwPWs1wA5hj3dhmk6ilauSHkkrvE6ltvbV5k5WCUtOjgFIWSK6z6 Xi7sJEPE+JS6kyvXI/K9NBGd5E/rjq8Vc+tkJPJQHsdVMBKbIW2kqpquHJv8Exk2fOJU9OO+UTk XLsCkC3E/LeRQryqUN4VVHe2NrVhjzxBiHjo/6aSmDGMctJwkvVippU/vw0VpGNiXC6/S2sJ5Rx 53OwMaEJrwHVul0e0LS8TjhQ== X-Received: by 2002:a05:6830:4487:b0:861:5cbb:8603 with SMTP id 46e09a7af769-863158d55b4mr4609087a34.20.1795198845719; Fri, 20 Nov 2026 10:20:45 -0800 (PST) X-Received: by 2002:a05:6830:4487:b0:861:5cbb:8603 with SMTP id 46e09a7af769-863158d55b4mr4609056a34.20.1795198845263; Fri, 20 Nov 2026 10:20:45 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 08/12] hw/hexagon: update the glob-reg vmstate ver Date: Fri, 20 Nov 2026 10:20:27 -0800 Message-Id: <20261120182031.560481-9-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX4A9kmQKn38a8 MchQxzrqwowpsV1TkgtDQN3pgDPUk19nwv0i+JJ2SfKPRsGfCDARzs5Vf26JEhcLLs3f0FBCGmr Oqu9/b6dQB3bqv6dr8E+gbKLsvz6KostE03cbc1z5Xqhs3cw0WXO2InhbQTyYpQcugJWAGnMKfu 5w1KSnlEa3NUHTVbkEadxnMSA882Byg5IHHJOrVz9h9dIBWlx/lyjappZLlbtOKZmbxTgSIVetj KuVabUM+QUL18ZwGecE327IaOaTtMv1dZOavhh0f6Qmxpzo7ufBS+ZVk1234StMJAROFDfYV8X7 nKs6ZCRVNy/SelqR13lIuU5lpC7iD8fDL0s0oPfdJ9LSq1IjDfiEmabt0cI2YAQEyxF6B+bntKD T36+xxtphBYl28OdYM4AuzK7goP68q8Fzb94P1OpBH6JCc+kXdwo/oekcLG+jUKGHoUlt6gJlYZ dW/ntUP83NBe4yO0D4Q== X-Proofpoint-GUID: u_h513K77qJwWoGm2ntRs7q5iDNKiPSG X-Proofpoint-ORIG-GUID: u_h513K77qJwWoGm2ntRs7q5iDNKiPSG X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX9p2cyl71ly1G Trg9aZbKq+uc8wuvi/WKyhlJ7FXRqQMIDI4iDjfhXvMXa3F21iYQRYYidfd9owpMkKezKowmcFF brpu5clLyuJ0sWDhrzzOIIRGcmZ9zwY= X-Authority-Analysis: v=2.4 cv=CNy/zhrD c=1 sm=1 tr=0 ts=6b008f7e cx=c_pps a=+3WqYijBVYhDct2f5Fivkw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=yPMIFQ6QiX0x8KKfrJsA:9 a=QEXdDO2ut3YA:10 a=eYe2g0i6gJ5uXG_o6N4q: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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 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=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198871675158500 Since 11.1 the layout of the migrated global register state has changed. Several regs were added when the v81 interrupt/commit/cycle count update. Raise the version, and the minimum version that is accepted. Signed-off-by: Brian Cain --- hw/hexagon/hexagon_globalreg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/hexagon/hexagon_globalreg.c b/hw/hexagon/hexagon_globalreg.c index 8b50fec770a..dd373dec9fe 100644 --- a/hw/hexagon/hexagon_globalreg.c +++ b/hw/hexagon/hexagon_globalreg.c @@ -450,8 +450,8 @@ static int hexagon_globalreg_post_load(void *opaque, =20 static const VMStateDescription vmstate_hexagon_globalreg =3D { .name =3D "hexagon_globalreg", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .pre_save =3D hexagon_globalreg_pre_save, .post_load =3D hexagon_globalreg_post_load, .fields =3D (const VMStateField[]){ --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198944; cv=none; d=zohomail.com; s=zohoarc; b=GXMWpyj/Vb12wNxyNnwXhS9pmQyc2HE+yjRiYEcYul4VgivKJ+4px5XT+hgUEzkibe/r5Bdh88eqqHNN0dbEdKZdnrfUfu/f2zfDLH7xe9leKnzlYMtoSjP8efiu6ZG5GiypazPl8Vet5DpSJsbmZwidoMPB7EUMf1YUHu7fH0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198944; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=11Rphb8qE3rHqUAt7hIotE4lD7WAUxVmGs7+Bi1bCvw=; b=OLcdtWy/zW9ZZ68acKV+fYwkakpHRlpgBrpUVnsHeSCaZQQHH7nOO5VnN0u5dK92avp1gHun7t1LbHsrPprzHl9fp39F6sTE21WC+WevUVOF3d7LAWwDRbd/dx7ZxW+lmKLrIUMKF6lkaDGmZV+EUwKGlTYI5rk9K2pMrxrcRiU= 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 1795198944628658.3618228613782; Fri, 20 Nov 2026 10:22:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTEG-00066A-JC; Fri, 20 Nov 2026 13:20:56 -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 1xUTED-000621-H8 for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:53 -0500 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xUTEA-0000pn-F7 for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:53 -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 6AKEfNbq304265 for ; Fri, 20 Nov 2026 18:20:49 GMT Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2gu82ydm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:48 +0000 (GMT) Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-85c1135c289so974644a34.3 for ; Fri, 20 Nov 2026 10:20:48 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 11Rphb8qE3rHqUAt7hIotE4lD7WAUxVmGs7+Bi1bCvw=; b=EN4hyX2P8/bCuj6a RM32fgi6xgowlJUqC24GXtfRPV0OsvpuABOsVWskm1qiNFUfx85k3xydC69qlo4W MTx8UiDdjUPD69OSw8JF9b9j1LWzmQBKMQXpWcZLY0xsTVd1/EKHDp3q4L8D0PE2 ATGzREvrB3wQlqkSziaNRU5wgPgAFQ5zujLicT+CnNP3wPJ3nFJdqdYbZMXCJpjR 5gY28JNwlcVRU2y5faXkQJOROJ750lWF7nt4zunxjlWUAzFWq5jsbKqIMepNeXYS ot4s+XbpsSu2jSJJF1l+oe9ma19OL41FQXK6laat85B9EFXEz4IcsTlwHVzJA4nF jSkt5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198848; x=1795803648; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=11Rphb8qE3rHqUAt7hIotE4lD7WAUxVmGs7+Bi1bCvw=; b=VlYG+X/lr3cAg9hC0bN04QExBeMc/7nfvyh82g5vyfO4UwDEeu2u9HTMXF3zwLoPe3 Y/rQV4gYKh+TOYSqm2CWUaiDX3NAIWYPgSVxMdvalSMvERqv2IHzyA9YU2rKqVZQf4Lk Jb9p4EtAfuQEkje1ImEN7d9psIYV2/ARw8li/XqTXUZwnFgANuu+4AVcAK+SlTBaQwv7 6H8MzBelopiQ+1DW6AJpIQ8W6hrq1hYhcx5FZfzaex9zW8wvaGkMOla00HJLahggzAQi J8FqVFNXjQHAAiQcCxW+l9EEcBXAUWzw/m3fxlJUbcOlRlrxeOW7XZX5UjBFgK3vDzf1 +/BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198848; x=1795803648; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=11Rphb8qE3rHqUAt7hIotE4lD7WAUxVmGs7+Bi1bCvw=; b=Nk1ykQyDf/NhpsxFXn5f4CbtmbLqNHvs4cTeQesTwOzgFi/a+RKwub9k5fE4dtP7Q6 K7Hqq/WDMX45uqDCilbfHDFjzisPUn7W4hWGu/eB5bkVeqPFT4LkCrsyO1s3f1nYIHG1 VEpM8Yz2vACjGIC6+UNEsn2KCz2BwGEOWFzQXw5/WfyQF25HGJMEqRbpoiWRxlhZYRZb U3EPe0apu8Am9avUElZYbegdv8AhUGxnWMYXN9Dy39zDv1HR9q/KpokgE738B4/GjROp mL2/YBzM9RmzQcmcVMmO3EwrRoiWqdj5xcntFnuAcOiIvSs4H88beGV2LioxoLJjRW5N RiYw== X-Gm-Message-State: APuU4Z/lLczncf6aLFEm5Tw6Rh4xHtXPea9sc0eqBIjSj0imXQekJw7w tsUlMyIJuAtITkAvbr9SAcZdJcxo29Sho/ByOC1wZveyMIN+oGRXJDchOGN2IgcFh+FNhAlijCV a3HMhd1JZNyxTd2E/oGcYGdF5ukW/Rsfxb0T2M4rz6CxAai3PXBqnIN7a5Dn2cVakDw== X-Gm-Gg: AYBFou1U+/AOPQehd5S3Ra4ftAp63i+daU9O0EtS5DSSHxRNfitiaglus0Tw0he8DAk Km12f8Ym2s2bVdY6tQzC602q5vk2VMxRLXfqiPzfivJfSAFFqg+P27BVPaZ4zBT2FQvZPFmNpvP V5SQd2Fq9CwYVd6rCWZA1uynShrH7DM0aOZ1bU9fFKvYToP354Ne6n1Jp5EhfF/+JZGRNstp5/+ zQzwUoAG06l+XR/lmhZ7jFFog4seiS76Ye37sTtRc+mVAK+7jxxgKfg8N2OKH4Z4EvWYm7pjJZi BTEG0k4rSf45lTRseVlwVfOuJ90z019pJOYribxnArwDQTAuY49tVRjiJhym0+1ixv4eWj8dqL6 dUXPHNArb3Azyzs3rSORwXI2x66ODfHP4dyA+nQqxN/sNp3BRyXyPzg0yq3etLyBqUc8G+KORu8 pwTnNZPdw= X-Received: by 2002:a05:6830:82f6:b0:862:a2ec:dda8 with SMTP id 46e09a7af769-8631590938dmr4976073a34.26.1795198847550; Fri, 20 Nov 2026 10:20:47 -0800 (PST) X-Received: by 2002:a05:6830:82f6:b0:862:a2ec:dda8 with SMTP id 46e09a7af769-8631590938dmr4976024a34.26.1795198846861; Fri, 20 Nov 2026 10:20:46 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 09/12] tests/functional/hexagon: run the rest of the tests Date: Fri, 20 Nov 2026 10:20:28 -0800 Message-Id: <20261120182031.560481-10-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX69MtsxPLlPtN zx8InLhwa5kZ5oQMppDWj/tHE1vdQb8Xrxv4rhxz6b812Vg52EKS6g5UxpkrPajW005kuzuO3ZT X5oE6EOaEeC1Ey5l+RxA0IaWxZN3OiyVwsEGXsvNLtYfTkjn1CKCq45qX3x0NVh8eurc6Gdxdz0 2zE5QW/KaqiyFK+YT2zt0eizH8k+8U7fUEyZGHkd+oyFN0MVG86En7x+hOTtPB4yLpQwj79ssF6 7bWI17WLGI2Hffhb/6mJsoegF0IJ5aM4+qro951LqvPXVZOS2aw5Ov2iU2GTPic9CG1qExvNjwA eI0OlUCH92hdzX/2FYWC8CiBWjkXf3I+Dk9TMNY5QKt6QzTxax9mbqRbOHQJqoCJVmIuQqM6gWS 5clPJanlwvwNdFwRG8tVsd9c+tNHWHI4u0zDhr4Gc3HjPGWkscnhxNxgoa3dJjVWoFdWs49yiQE GXhb3e4YqHXLJ4x+quw== X-Authority-Analysis: v=2.4 cv=bLeDs/+Z c=1 sm=1 tr=0 ts=6b008f80 cx=c_pps a=7uPEO8VhqeOX8vTJ3z8K6Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=qC_FGOx9AAAA:8 a=5vFef2XoAAAA:20 a=EUspDBNiAAAA:8 a=yf9HDTBqmzeyJE9Vh_gA:9 a=QEXdDO2ut3YA:10 a=EXS-LbY8YePsIyqnH6vw:22 a=fsdK_YakeE02zTmptMdW:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-ORIG-GUID: PfSy5xw4OvXFDfqwzlEaLQ1neeyFqYAq X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfXxkgQ8tveLeUs UAnnYbyojIgqcqZO7OOTftcDvBMh3t/jh5AToiQ7DWsoqdZ6nvSOGcvXNtDz2UnCVy8bMpRsVQM J4kJHJ0+TulM4SMZ9X1gcAA7OUKTYCg= X-Proofpoint-GUID: PfSy5xw4OvXFDfqwzlEaLQ1neeyFqYAq 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 clxscore=1015 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200072 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=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198946316158500 The arch and systest tarballs carry more binaries than were being run. Run the missing test cases, and add a Linux boot test for the QCS6490 CDSP machine. With this many tests in the one file, a busy host sometimes stalled the whole file until the test timeout. The guest starts to print to the console as soon as it is launched, and does so with the BQL held. If the test has not started to read the console by the time the socket is full, the guest blocks holding the BQL. QMP is answered by the main loop, which needs the BQL, so the test cannot get a reply to a QMP command until it reads the console, and it cannot read the console while it waits for the reply. Start the guest paused, and read the console while it is resumed. Signed-off-by: Brian Cain --- tests/functional/hexagon/meson.build | 2 + tests/functional/hexagon/test_arch_tests.py | 114 +++++++++- tests/functional/hexagon/test_linux.py | 62 +++++ tests/functional/hexagon/test_systests.py | 240 +++++++++++++++++++- 4 files changed, 412 insertions(+), 6 deletions(-) create mode 100755 tests/functional/hexagon/test_linux.py diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexago= n/meson.build index 3dd40ed0463..565a056a951 100644 --- a/tests/functional/hexagon/meson.build +++ b/tests/functional/hexagon/meson.build @@ -5,6 +5,7 @@ tests_hexagon_system_thorough =3D [ 'qcom_dsp_firmware', 'systests', 'hlx', + 'linux', 'minivm', ] =20 @@ -13,4 +14,5 @@ test_hexagon_timeouts =3D { 'qcom_dsp_firmware': 240, 'systests': 180, 'hlx': 180, + 'linux': 240, } diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional= /hexagon/test_arch_tests.py index a437e4d4aac..08ebdc72477 100755 --- a/tests/functional/hexagon/test_arch_tests.py +++ b/tests/functional/hexagon/test_arch_tests.py @@ -4,6 +4,9 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 +import threading +import unittest + from qemu_test import QemuSystemTest, Asset from qemu_test.cmd import wait_for_console_pattern =20 @@ -32,6 +35,23 @@ class ArchTestsUart(QemuSystemTest): "64053b31e8e3acf7c97e7e82209b6bda", ) =20 + def launch_and_wait_for_pass(self) -> None: + """ + Run the guest until it prints PASS on the console. + + Start the guest paused and read the console while resuming it, so + that a guest blocked on a full console socket cannot deadlock QMP. + """ + self.vm.add_args("-S") + self.vm.launch() + resume =3D threading.Thread(target=3Dself.vm.cmd, args=3D("cont",), + daemon=3DTrue) + resume.start() + try: + wait_for_console_pattern(self, "PASS") + finally: + resume.join(timeout=3D30) + def run_uart_test(self, test_name: str, machine: str =3D "virt") -> None: """ @@ -44,8 +64,7 @@ def run_uart_test(self, test_name: str, self.vm.set_console() self.set_vm_arg("-display", "none") self.set_vm_arg("-kernel", target_bin) - self.vm.launch() - wait_for_console_pattern(self, "PASS") + self.launch_and_wait_for_pass() =20 def run_semihosting_test(self, test_name: str, machine: str =3D "V81QA_1") -> None: @@ -56,8 +75,7 @@ def run_semihosting_test(self, test_name: str, self.vm.set_console(semihosting=3DTrue) self.set_vm_arg("-display", "none") self.set_vm_arg("-kernel", target_bin) - self.vm.launch() - wait_for_console_pattern(self, "PASS") + self.launch_and_wait_for_pass() =20 def test_exceptions(self) -> None: """Tests exception delivery for trap instructions, privilege @@ -101,6 +119,65 @@ def test_sys_regs_v81(self) -> None: """Tests V81-specific system register masks.""" self.run_semihosting_test("test_sys_regs") =20 + def test_cache_v81(self) -> None: + """Tests cache operations on the V81 machine.""" + self.run_semihosting_test("test_cache") + + def test_exceptions_v81(self) -> None: + """Tests exception delivery on the V81 machine.""" + self.run_semihosting_test("test_exceptions") + + def test_guest_mode_v81(self) -> None: + """Tests guest mode on the V81 machine.""" + self.run_semihosting_test("test_guest_mode") + + def test_hvx_context_v81(self) -> None: + """Tests the HVX coprocessor context on the V81 machine.""" + self.run_semihosting_test("test_hvx_context") + + def test_int_steering_v81(self) -> None: + """Tests interrupt steering on the V81 machine.""" + self.run_semihosting_test("test_int_steering") + + def test_interrupts_v81(self) -> None: + """Tests interrupt delivery on the V81 machine.""" + self.run_semihosting_test("test_interrupts") + + @unittest.skip("test_isr_stress in v0.3.1 gives another hardware " + "thread a fixed polling budget, so it fails when the " + "host delays that vCPU thread") + def test_isr_stress_v81(self) -> None: + """Tests interrupt service routine stress on the V81 machine.""" + self.run_semihosting_test("test_isr_stress") + + def test_l2vic_v81(self) -> None: + """Tests the L2VIC on the V81 machine.""" + self.run_semihosting_test("test_l2vic") + + def test_pagecross_tlbmissx_v81(self) -> None: + """Tests page-crossing instruction TLB misses on the V81 machine."= "" + self.run_semihosting_test("test_pagecross_tlbmissx") + + def test_pmu_v81(self) -> None: + """Tests the performance counters on the V81 machine.""" + self.run_semihosting_test("test_pmu") + + def test_threads_v81(self) -> None: + """Tests hardware thread management on the V81 machine.""" + self.run_semihosting_test("test_threads") + + def test_timer_v81(self) -> None: + """Tests the system timer on the V81 machine.""" + self.run_semihosting_test("test_timer") + + def test_tlb_mmu_v81(self) -> None: + """Tests TLB/MMU operations on the V81 machine.""" + self.run_semihosting_test("test_tlb_mmu") + + def test_user_mode_v81(self) -> None: + """Tests user mode transitions on the V81 machine.""" + self.run_semihosting_test("test_user_mode") + def test_threads(self) -> None: """Tests hardware thread management: start/stop, MODECTL state, per-thread HTID, shared memory, wait/resume, STID priority, and @@ -115,6 +192,35 @@ def test_tlb_mmu(self) -> None: """ self.run_uart_test("test_tlb_mmu") =20 + @unittest.skip("test_isr_stress in v0.3.1 gives another hardware " + "thread a fixed polling budget, so it fails when the " + "host delays that vCPU thread") + def test_isr_stress(self) -> None: + """Tests interrupt service routine stress: bursts of interrupts, + simultaneous software interrupts, rapid refire, nesting, and + interrupts while threads start, spin, and wait. + """ + self.run_uart_test("test_isr_stress") + + def test_pagecross_tlbmissx(self) -> None: + """Tests instruction TLB misses for packets that cross a page + boundary: the next page missing, both pages missing, and the + default handler. + """ + self.run_uart_test("test_pagecross_tlbmissx") + + def test_pmu(self) -> None: + """Tests the performance counters: PCYCLE incrementing, its high + and low halves, enabling and disabling it, and UPCYCLE. + """ + self.run_uart_test("test_pmu") + + def test_timer(self) -> None: + """Tests the system timer: QTimer reads, monotonicity, version, and + using PCYCLE as a timer. + """ + self.run_uart_test("test_timer") + def test_user_mode(self) -> None: """Tests user mode / privilege transitions: supervisor mode, SSR UM/IE/XE/CE/PE bits, and the trap0 user-mode exit handler. diff --git a/tests/functional/hexagon/test_linux.py b/tests/functional/hexa= gon/test_linux.py new file mode 100755 index 00000000000..68b08eeff71 --- /dev/null +++ b/tests/functional/hexagon/test_linux.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# +# Boot Linux on the QCS6490 CDSP machine, using H2 as the Hexagon VM host +# +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import QemuSystemTest, Asset +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern + + +class HexagonLinuxQcs6490Cdsp(QemuSystemTest): + """ + Boot a Hexagon Linux kernel with an initramfs. The H2 "loadlinux" + firmware runs the kernel as a guest of the Hexagon VM interface and + hands it the device tree that QEMU generated. + """ + + timeout =3D 240 + + ASSET_KERNEL =3D Asset( + 'https://artifacts.codelinaro.org/artifactory/' + 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/vmlinux', + '1908e9c684df4eb44d700c4096e1b2f73af6652a874e377cd8c6af0f5760d66a') + ASSET_INITRD =3D Asset( + 'https://artifacts.codelinaro.org/artifactory/' + 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/initrd', + '2b958945b38db54145051f76b886f42dd5dee70db399f6222ccc54808d6bdd6b') + + # The H2 hypervisor and its loadlinux, built for this machine's DDR + # carve-out; it hands the device tree in r1:r0 on to the kernel. + ASSET_H2 =3D Asset( + 'https://github.com/qualcomm/qemu-hexagon-testing/releases/' + 'download/v0.2.17b-h2/loadlinux_qcs6490-cdsp', + 'ad667005c7ae286de5a79f79613341f6e928da74cea31ced14772d5a94cb1716') + + def test_linux_boot(self): + self.set_machine('qcs6490-cdsp') + + self.vm.set_console() + self.vm.add_args( + '-bios', self.ASSET_H2.fetch(), + '-kernel', self.ASSET_KERNEL.fetch(), + '-initrd', self.ASSET_INITRD.fetch(), + '-append', 'console=3DttyAMA0 mem=3D240M lpj=3D89124080 rdinit= =3D/init', + ) + self.vm.launch() + + # The initramfs has no login: init prints this and starts a root s= hell + wait_for_console_pattern(self, 'Please press Enter to activate thi= s ' + 'console.', failure_message=3D'Kernel pan= ic') + exec_command_and_wait_for_pattern(self, '', '# ') + + # All six hardware threads are Linux CPUs + exec_command_and_wait_for_pattern(self, 'nproc', '6') + exec_command_and_wait_for_pattern(self, 'uname -m', 'hexagon') + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/h= exagon/test_systests.py index ac2071795fb..bd444a1f831 100755 --- a/tests/functional/hexagon/test_systests.py +++ b/tests/functional/hexagon/test_systests.py @@ -36,14 +36,15 @@ def binary(self, name): self.assertTrue(os.path.exists(path)) return path =20 - def run_exit_zero(self, binary_name, *extra_args, machine=3D"sim"): + def run_exit_zero(self, binary_name, *extra_args, machine=3D"sim", + timeout=3D60.0): self.set_machine(machine) self.set_vm_arg("-display", "none") self.set_vm_arg("-kernel", self.binary(binary_name)) for flag, value in zip(extra_args[::2], extra_args[1::2]): self.set_vm_arg(flag, value) self.vm.launch() - self.vm.wait(timeout=3D60.0) + self.vm.wait(timeout=3Dtimeout) self.assertEqual(self.vm.exitcode(), 0, f"Test {binary_name} exited with " f"code {self.vm.exitcode()}, expected 0") @@ -62,6 +63,52 @@ def run_console_pattern(self, binary_name, pattern, *ext= ra_args, finally: self.vm.kill() =20 + def run_expect_crash(self, binary_name, log_pattern, *extra_args, + machine=3D"sim"): + """Run a test that is meant to crash. + + The standalone CRT exits with 255 from its unhandled-exception + handler, which also reports the cause in the log. + """ + self.set_machine(machine) + self.set_vm_arg("-display", "none") + self.set_vm_arg("-kernel", self.binary(binary_name)) + for flag, value in zip(extra_args[::2], extra_args[1::2]): + self.set_vm_arg(flag, value) + self.vm.launch() + self.vm.wait(timeout=3D60.0) + self.assertEqual(self.vm.exitcode(), 255, + f"{binary_name} exited with {self.vm.exitcode()},= " + "expected 255") + log =3D self.vm.get_log() or "" + self.assertTrue(re.search(log_pattern, log), + f"{log_pattern!r} not in the log of {binary_name}:" + f"\n{log}") + + def wait_for_log_pattern(self, pattern, count=3D1, timeout=3D30.0): + """Wait until the log of the running VM has @pattern @count times.= """ + deadline =3D time.monotonic() + timeout + log_path =3D self.vm._qemu_log_path + while time.monotonic() < deadline: + with open(log_path, "r", encoding=3D"utf-8", + errors=3D"replace") as f: + if f.read().count(pattern) >=3D count: + return + time.sleep(0.1) + self.fail(f"Timed out waiting for {count} of {pattern!r} in the lo= g") + + def run_hang_log_pattern(self, binary_name, pattern): + """Run a test that is meant to hang, and expect @pattern logged.""" + self.set_machine("sim") + self.set_vm_arg("-display", "none") + self.set_vm_arg("-kernel", self.binary(binary_name)) + self.set_vm_arg("-d", "guest_errors") + self.vm.launch() + try: + self.wait_for_log_pattern(pattern) + finally: + self.vm.kill() + def test_fopen(self): """fopen reads a file passed via --append and verifies its content= s.""" import tempfile @@ -144,5 +191,194 @@ def test_lock_verify(self): def test_single_step(self): self.run_exit_zero("single_step") =20 + def test_start(self): + """The start instruction resets the threads it names but not the + thread executing it.""" + self.run_exit_zero("start") + + def test_test_thread(self): + """Eight threads start, record their ids, and exit.""" + self.run_exit_zero("test-thread", "-smp", "cpus=3D8") + + def test_test_thread_single_threaded_tcg(self): + """test_thread with the vCPUs sharing one host thread.""" + self.run_exit_zero("test-thread", "-smp", "cpus=3D8", + "-accel", "tcg,thread=3Dsingle") + + def test_k0locklock(self): + """Locking k0 twice in a row hangs the thread, and is reported.""" + self.run_hang_log_pattern("k0locklock", "Double k0lock at PC") + + def test_tlblocklock(self): + """Locking the TLB twice in a row hangs the thread, and is reporte= d.""" + self.run_hang_log_pattern("tlblocklock", "Double tlblock at PC") + + def test_inf_loop(self): + """Four threads start, spin forever, and start again after a + system reset.""" + self.set_machine("sim") + self.set_vm_arg("-display", "none") + self.set_vm_arg("-kernel", self.binary("inf-loop")) + self.vm.launch() + try: + for i in range(4): + self.wait_for_log_pattern(f"Starting thread {i}") + self.vm.qmp("system_reset") + for i in range(4): + self.wait_for_log_pattern(f"Starting thread {i}", count=3D= 2) + finally: + self.vm.kill() + + def test_unaligned(self): + """A misaligned load raises the misaligned load exception.""" + self.run_expect_crash("unaligned", "Misaligned Load") + + def test_hvx_nocoproc(self): + """An HVX instruction with SSR:XE clear raises the coprocessor + exception.""" + self.run_expect_crash("hvx_nocoproc", + "Illegal Execution of Coprocessor Instructio= n") + + def test_neg_no_hmx(self): + """HMX instructions are invalid on a machine without HMX.""" + self.run_expect_crash("neg-no-hmx", "Invalid packet", + machine=3D"V68N_1024") + + def test_badva(self): + """Dual memory operations and TLB exceptions record the right BADV= A.""" + self.run_exit_zero("badva") + + def test_checkforpriv(self): + """Privileged instructions raise a privilege exception in user mod= e.""" + self.run_exit_zero("checkforpriv") + + def test_ciad_siad(self): + """The ciad and siad instructions clear and set interrupt state.""" + self.run_exit_zero("ciad-siad") + + def test_fastint(self): + """The fast L2VIC interface handles a large number of interrupts."= "" + self.run_exit_zero("fastint") + + def test_fastl2vic(self): + """The fast L2VIC interface sets and clears interrupt enables.""" + self.run_exit_zero("fastl2vic") + + def test_getcwd(self): + """The getcwd semihosting call fills a buffer with a valid path.""" + self.run_exit_zero("getcwd") + + def test_gregs(self): + """Guest registers g0-g31 keep or reject written values.""" + self.run_exit_zero("gregs") + + def test_hvx_64b(self): + """HVX 64-byte mode accesses raise the expected exceptions.""" + self.run_exit_zero("hvx_64b") + + def test_hvx_ext(self): + """HVX extension bits and qfloat operations across revisions.""" + self.run_exit_zero("hvx_ext") + + def test_int_range(self): + """The L2VIC interrupt range 1-1024 can be enabled and cleared.""" + self.run_exit_zero("int_range") + + def test_invalid_insn_for_rev(self): + """Instructions invalid for the revision raise an exception.""" + self.run_exit_zero("invalid_insn_for_rev") + + def test_invalid_opcode(self): + """Invalid opcodes raise an exception.""" + self.run_exit_zero("invalid_opcode") + + def test_k0lock(self): + """k0lock and k0unlock serialize several threads.""" + self.run_exit_zero("k0lock") + + def test_k0lock_syscfg(self): + """k0lock interacts correctly with SYSCFG changes.""" + self.run_exit_zero("k0lock-syscfg") + + def test_levelint(self): + """Level-triggered interrupts are delivered and cleared.""" + self.run_exit_zero("levelint") + + def test_mmu_asids(self): + """TLB entries with different ASIDs translate independently.""" + self.run_exit_zero("mmu_asids") + + def test_mmu_overlap(self): + """Overlapping TLB entries are rejected by the TLB write.""" + self.run_exit_zero("mmu_overlap") + + def test_mmu_page_size(self): + """Every page size from 4KB to 1GB translates data and code.""" + self.run_exit_zero("mmu_page_size") + + def test_mmu_permissions(self): + """TLB permission bits raise miss and permission exceptions.""" + self.run_exit_zero("mmu_permissions") + + def test_nmi_cross_thread(self): + """An NMI sent to another thread is delivered there.""" + self.run_exit_zero("nmi_cross_thread") + + def test_pendalot(self): + """1023 interrupts are pended, taken, and logged.""" + self.run_exit_zero("pendalot") + + def test_pend_wake_wait(self): + """Worker threads wait while software interrupts cycle.""" + self.run_exit_zero("pend_wake_wait") + + def test_qfloat_test(self): + """HVX qfloat arithmetic, comparisons, min/max, and conversions.""" + self.run_exit_zero("qfloat_test") + + def test_reg_reads(self): + """Reading the PMU registers and counting HVX packets.""" + self.run_exit_zero("reg-reads") + + def test_standalone_hw(self): + """The hardware thread and monitor instructions work.""" + self.run_exit_zero("standalone_hw") + + def test_swi(self): + """Software interrupts are delivered to the expected threads.""" + self.run_exit_zero("swi") + + def test_swi2(self): + """Software interrupts under load while masks and priorities chang= e.""" + self.run_exit_zero("swi2") + + def test_swi_wait(self): + """Software interrupts wake threads in wait mode.""" + self.run_exit_zero("swi_wait") + + def test_sys_atomics(self): + """Load-linked/store-conditional increments across threads.""" + self.run_exit_zero("sys_atomics") + + def test_thread_scheduling(self): + """Threads are scheduled and make progress.""" + self.run_exit_zero("thread_scheduling") + + def test_tlblock(self): + """tlblock and tlbunlock serialize several threads.""" + self.run_exit_zero("tlblock") + + def test_vid_reg(self): + """The VID register accepts valid values and rejects invalid ones.= """ + self.run_exit_zero("vid_reg") + + def test_vtcm_error(self): + """VTCM accesses outside the window raise an error.""" + self.run_exit_zero("vtcm_error") + + def test_rev(self): + """The revision register reports the V81 of the machine.""" + self.run_console_pattern("rev", "0x81", machine=3D"V81QA_1") + if __name__ =3D=3D "__main__": QemuSystemTest.main() --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198884; cv=none; d=zohomail.com; s=zohoarc; b=ITWcUHibh6zgS6cHACtxhRBIgo3GGfWz+3Q/eJl7OSB+VvoKmDQKjADPZ1RbB0y5kTyYDjfZ3rDQ6PQ8qghdedV3McVwSvO0uH/ffiyV1BmE4em7n1ZxTdm7Ee9rRyATsbXpZxMVyJ9AoXPMBMmasafpSj9AYNhRBMLtkt+9/NY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198884; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bDvN3WEh9P5zI8+tG4hXsV0UpZMtILD2Uv20NQRPblA=; b=gLjqX5CuV96/F6vugki+tGrRd26Z0q2wr1zDm7ipNG8qaTtKD2xp69rbywX9VjhFblGBQRRzd06+JXI0ggMEpXPoQD4I1ql1P/ZwFbhkTF5D5hpkjvfxYTZ3m48B96kC1kvqCrNpnscfjk0yC5MPi4+cOSux/9SMQyMI92ALVUM= 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 1795198884655366.94179999416735; Fri, 20 Nov 2026 10:21:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTEH-000681-He; Fri, 20 Nov 2026 13:20:57 -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 1xUTEE-00062R-EM for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:54 -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 1xUTEB-0000pv-8L for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:53 -0500 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AKGFs6I3830171 for ; Fri, 20 Nov 2026 18:20:50 GMT Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2sjwgmdv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:50 +0000 (GMT) Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-6f8edf0c859so2227091eaf.0 for ; Fri, 20 Nov 2026 10:20:50 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= bDvN3WEh9P5zI8+tG4hXsV0UpZMtILD2Uv20NQRPblA=; b=pGZlp3zZZHRIXR0N ihVyT6+EgYgZIk9Et8e93CxF4aZ46gcKCYjMHF8WEfrcQaSSbplQSfoBuzZhabrC f79mIaxtd1yBs1bF17L80ru7jRY/xy7VCVzxAGkmCqjllOW0X0y0dvN+q71Sy233 6MXU7z4lAbC0GSH4bnEZmobrNzUbI0Llaq6tn0SCEZyuTRvsc1q+upHnubWDGdX/ 8AK8cyuVl3hH9UzKmYu0aFgY5dPrifi/b4gSbICG24fLtWaL34np/Z3WfiJv3P3Z MmwWgam51V6E6BDkLOANR9VpyCIL4kec+xp4XxNmNnjXjy+AbY/yQrbfQ2ArRTip XwATEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198849; x=1795803649; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=bDvN3WEh9P5zI8+tG4hXsV0UpZMtILD2Uv20NQRPblA=; b=QHP81JlV21czNcOIfBVcmKMWRnPnc/vvD3GRmBLE3axcJzrNmf8uZeMv1QhuPiItrj LTcvqt4Gl8kUAJRRGyjHtNktIOz6j4Y6+I0Ux5bi4olpjro61x5NOGzdtmCWaF8Pvd57 22oAqSG7ML+ye1BSkAPlvnne7adZyLqOwDZlCNnhbsiFIEFZX98vog+2GSw2NlQX1fau VVnWkfByUMHbtOth+yvWFUvvVnzdKfbpv5btPZIV04nMQwHgRSetq2oCboAjZ4Am/9LV Kjv13B8D+kDNMIIas757VzXCY7Fi9rvAlBIPoG8NWMJzWF1wkLA2xsGYadGGhr0EKQIQ cfhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198849; x=1795803649; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=bDvN3WEh9P5zI8+tG4hXsV0UpZMtILD2Uv20NQRPblA=; b=WU3rgl6p5KhhN6QeYEWm6YOMNUFHdGFMj/CmW5jdRV9oXs7fc1qkNnjLLjUrRSM3Z2 TKn2vL8uTML9skRfY6yvKVrrBXpPxtEqOI8QzMiIW53R207SWfq0uzlLWkP55h2Y9oDW 5R6Ybrj/ZeehjAdqZ/h7gUG6zxFTgNY9w4nEaXaqgI7V5zvX5SHAshil0yJuEjLBohCV 6L8cdpyVISteZNbCSph4mVnB5tme5U9rMaR54LAELJj9iUYc+ZKZoohPezTUTvr+rlfu NCP94iMlw6ymTqiBlbchYxV8WWx8PeGQWd7oTTfQMgPbz4GnkpUP/JjyROoGYzY0yRfu EWbw== X-Gm-Message-State: APuU4Z/K8X7JssPY8eoySAUQectlOt6Cvl5gKxHirInlMqpYyCqNY9aQ fjAEEcHB/Q9xaKYXXGkAkJ4KZ283XSuLzIbwIfxHW3rNucVpxxe7y+3mpLF9JIKp6antJVJd6sZ 6bMaGDb77b1D92ymiRUmo+8yNR0MhxcRq3Jso7tB90a++KZVwxbSOII88AKdMYPT6qg== X-Gm-Gg: AYBFou3kcFIJqt0HxWqdiABDVmnN5XzghlxU0l43OTrhzjZmnQXFo0xUgEm4PYuQZZf iGSp6bjeXZTF+9vXTeBjbobOqdSv8+8HOBywGnt9sab+LSno8Q/cPPRUhwU+H1HBkKLrKqQjc+c p8YwQ3yhXQ3i1vWvMC3XjXcRWAMQDdymr6r4zZMPFCuD0h1l4kbTOzzR7gJ2etUKVd6nxDhlOmE LYqOmyFC4JBw2llrQlkUZ1KGs/qhZsWjN+a1dxQqgOaPOr3fin40x4jtCrwaM9yC8cSXPdQo1pg ELspfSitfrrhTdjkTNXoCI3Uz58TtZ+cufdJU/ISUfiVyt/UUJ/7/4X79k6nXf5DrkCZPDM+gsB 1kg9LNT9rSAlzR+1wcIxMDU23e9RxKqxyVZxByWMJJ4UPYbvlEswRpqXR+n4eoK0l1FGRYizKU+ palWv5jNs/2Ve4j4GA7DoraA== X-Received: by 2002:a05:6820:4df7:b0:704:2628:b1ba with SMTP id 006d021491bc7-71b3267b76emr3826166eaf.23.1795198849009; Fri, 20 Nov 2026 10:20:49 -0800 (PST) X-Received: by 2002:a05:6820:4df7:b0:704:2628:b1ba with SMTP id 006d021491bc7-71b3267b76emr3826134eaf.23.1795198848243; Fri, 20 Nov 2026 10:20:48 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 10/12] tests/tcg/hexagon: packet and COF corner cases Date: Fri, 20 Nov 2026 10:20:29 -0800 Message-Id: <20261120182031.560481-11-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 6pe7cWGrN3eFl0LSMK4ZaXAawAPl8nU1 X-Proofpoint-GUID: 6pe7cWGrN3eFl0LSMK4ZaXAawAPl8nU1 X-Authority-Analysis: v=2.4 cv=dZ4VTnXe c=1 sm=1 tr=0 ts=6b008f82 cx=c_pps a=lVi5GcDxkcJcfCmEjVJoaw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=nRz1P0UM28cUN3eQi-wA:9 a=QEXdDO2ut3YA:10 a=rBiNkAWo9uy_4UTK5NWh:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX4P+rMTdcILDD 2ynpoFZhFwzlVll11c2d6FrB/r2sTkPzkib9UodSnho78hKiQH/TRq2/MXhHbDMEBmGgDge8Rk1 BFnFIOjkpHeB1Ft5VSCmanovmeKBg8k= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MyBTYWx0ZWRfX7+z9WtBE29Qa TPGQxuGM0de41o6LePKoA2rDbWe3OWpycAvRPP9mLhkVzML9dJzsQm/W8W+6ForKan/cKzS90Bb nKtbpzmrKm3WTwOyjTGmLgldbs6nfhvMMXYTW6PQrPYrz/ieqirP7MydqJiJ36SOaMMCmxACwpU DL/cjY2ui1ht6RjghoVMTM38ZaCTCOBKZ5TjtDsXsDsc1pbuZqbV0OOAvd7Bg+PFDFJWcylKuWY CBt+b652rPbVazF56DSewSjymzSabP0ZnfAcNTyHmMfrUXVIzCbgVcdbRtIbqwwFgo4BP2gIr0K Rsd15cbUJ+nWL6aKomIWuXTArs/SqJDfVyKv6Wd99w77EkG4qJ9h+/As6NxxExULVrOFqvhlehI DBbwJAON5uVsBOWQNRqz10hr3ZYlbwC/GnjU9Prbv+hY7X7wOqv58VskEDSuRJcioGImNA7v4Un HpUtq97JPkdg0FfpScQ== 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 phishscore=0 spamscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200073 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198885796158500 Add tests for subtle packet semantics not yet covered: - Register, pair and half-register writes commit together, so parallel reads see the old values; .new store data may come from an extended or load producer. - Packed pred reads see the old bytes, auto-and before .new - Aliasing stores, cancelled ld/st does not postinc - Dual jumps, callr through LR, an overwritten jumpr target, and short sp3loop0 loops - M0, CS0 and M1 updates in a circ/brev packet apply to later packets only, and a saturating add reads the old USR.OVF before setting it. Link: https://lore.kernel.org/qemu-devel/20261117183629.2002840-4-marco.lie= bel@oss.qualcomm.com/ Signed-off-by: Brian Cain --- tests/tcg/hexagon/brev.c | 25 ++++++++ tests/tcg/hexagon/circ.c | 42 ++++++++++++ tests/tcg/hexagon/dual_stores.c | 34 ++++++++++ tests/tcg/hexagon/mem_noshuf.c | 58 +++++++++++++---- tests/tcg/hexagon/preg_alias.c | 58 +++++++++++++++++ tests/tcg/hexagon/test_cond_branch.c | 95 ++++++++++++++++++++++++++++ tests/tcg/hexagon/usr.c | 33 ++++++++++ tests/tcg/hexagon/test_dotnew.S | 34 +++++++++- tests/tcg/hexagon/test_packet.S | 46 +++++++++++++- 9 files changed, 412 insertions(+), 13 deletions(-) diff --git a/tests/tcg/hexagon/brev.c b/tests/tcg/hexagon/brev.c index 1473e309ee0..192107d4f30 100644 --- a/tests/tcg/hexagon/brev.c +++ b/tests/tcg/hexagon/brev.c @@ -149,6 +149,29 @@ int32_t sext8(int32_t x) */ int high_half[SIZE]; =20 +/* The first access uses old M1; the following access uses the new M1. */ +static void brev_test_packet(void) +{ + uintptr_t ptr =3D (uintptr_t)wbuf; + uint32_t first, second; + + wbuf[0] =3D 0x11223344; + wbuf[1] =3D 0x55667788; + asm volatile("m1 =3D %[old_inc]\n\t" + "{\n\t" + " m1 =3D %[new_inc]\n\t" + " %[first] =3D memw(%[ptr]++m1:brev)\n\t" + "}\n\t" + "%[second] =3D memw(%[ptr]++m1:brev)\n\t" + : [ptr] "+r"(ptr), [first] "=3D&r"(first), + [second] "=3Dr"(second) + : [old_inc] "r"(0x2000), [new_inc] "r"(0x4000) + : "m1", "memory"); + check32(first, 0x11223344); + check32(second, 0x55667788); + check32(ptr - (uintptr_t)wbuf, 0x6000); +} + int main() { void *p; @@ -178,6 +201,8 @@ int main() TEST_BREV_STORE_NEW(hnew, hbuf, 15); TEST_BREV_STORE_NEW(wnew, wbuf, 14); =20 + brev_test_packet(); + puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; } diff --git a/tests/tcg/hexagon/circ.c b/tests/tcg/hexagon/circ.c index 2a15c324242..a0d1500f5aa 100644 --- a/tests/tcg/hexagon/circ.c +++ b/tests/tcg/hexagon/circ.c @@ -423,6 +423,46 @@ static void circ_test_v3(void) } } =20 +/* Updating a modifier in the packet must not change that packet's wrap. */ +static void circ_test_packet(void) +{ + int32_t *ptr =3D &wbuf[3]; + int32_t result, modifier; + + init_wbuf(); + asm volatile("m0 =3D %[old_len]\n\t" + "cs0 =3D %[start]\n\t" + "{\n\t" + " m0 =3D %[new_len]\n\t" + " %[result] =3D memw(%[ptr]++#4:circ(m0))\n\t" + "}\n\t" + "%[modifier] =3D m0\n\t" + : [ptr] "+r"(ptr), [result] "=3Dr"(result), + [modifier] "=3Dr"(modifier) + : [start] "r"(wbuf), [old_len] "r"(16), [new_len] "r"(8) + : "m0", "cs0", "memory"); + check32(result, 3); + checkp(ptr, wbuf); + check32(modifier, 8); + + /* A same-packet CS0 write must likewise leave this wrap unchanged. */ + ptr =3D &wbuf[3]; + asm volatile("m0 =3D %[len]\n\t" + "cs0 =3D %[start]\n\t" + "{\n\t" + " cs0 =3D %[next]\n\t" + " %[result] =3D memw(%[ptr]++#4:circ(m0))\n\t" + "}\n\t" + "%[modifier] =3D cs0\n\t" + : [ptr] "+r"(ptr), [result] "=3Dr"(result), + [modifier] "=3Dr"(modifier) + : [start] "r"(wbuf), [len] "r"(16), [next] "r"(&wbuf[8]) + : "m0", "cs0", "memory"); + check32(result, 3); + checkp(ptr, wbuf); + check32(modifier, (uintptr_t)&wbuf[8]); +} + int main() { init_bbuf(); @@ -470,6 +510,8 @@ int main() =20 circ_test_v3(); =20 + circ_test_packet(); + puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; } diff --git a/tests/tcg/hexagon/dual_stores.c b/tests/tcg/hexagon/dual_store= s.c index 775458e0fc8..e6fae7fe9b2 100644 --- a/tests/tcg/hexagon/dual_stores.c +++ b/tests/tcg/hexagon/dual_stores.c @@ -42,6 +42,38 @@ typedef union { int8_t byte; } Dual; =20 +/* Cover partial overlap in both directions, retaining untouched guard byt= es. */ +static void test_partial_overlap(void) +{ + union { + uint64_t d; + uint32_t w[2]; + uint16_t h[4]; + } data; + + data.d =3D 0x8877665544332211ULL; + asm volatile("{\n\t" + " memw(%[word]) =3D %[wide]\n\t" + " memh(%[half]) =3D %[narrow]\n\t" + "}\n\t" + : + : [word] "r"(&data.w[0]), [half] "r"(&data.h[1]), + [wide] "r"(0xaabbccdd), [narrow] "r"(0x1234) + : "memory"); + check64(data.d, 0x887766551234ccddULL); + + data.d =3D 0x8877665544332211ULL; + asm volatile("{\n\t" + " memh(%[half]) =3D %[narrow]\n\t" + " memw(%[word]) =3D %[wide]\n\t" + "}\n\t" + : + : [word] "r"(&data.w[0]), [half] "r"(&data.h[1]), + [wide] "r"(0xaabbccdd), [narrow] "r"(0x1234) + : "memory"); + check64(data.d, 0x88776655aabbccddULL); +} + int main() { Dual d; @@ -50,6 +82,8 @@ int main() dual_stores(&d.word, &d.byte, 0x12345678, 0xff); check32(d.word, 0x123456ff); =20 + test_partial_overlap(); + puts(err ? "FAIL" : "PASS"); return err; } diff --git a/tests/tcg/hexagon/mem_noshuf.c b/tests/tcg/hexagon/mem_noshuf.c index 6263d5ef8e0..e4db6511d35 100644 --- a/tests/tcg/hexagon/mem_noshuf.c +++ b/tests/tcg/hexagon/mem_noshuf.c @@ -107,19 +107,23 @@ static inline int pred_lw_sw(bool pred, int32_t *p, i= nt32_t *q, } =20 static inline int pred_lw_sw_pi(bool pred, int32_t *p, int32_t *q, - int32_t x, int32_t y) + int32_t x, int32_t y, int32_t **q_after) { int ret; - asm volatile("p0 =3D cmp.eq(%5, #0)\n\t" - "%0 =3D %3\n\t" - "r7 =3D %2\n\t" + int32_t *after; + asm volatile("p0 =3D cmp.eq(%[pred], #0)\n\t" + "%[ret] =3D %[x]\n\t" + "r7 =3D %[q]\n\t" "{\n\t" - " memw(%1) =3D %4\n\t" - " if (!p0) %0 =3D memw(r7++#4)\n\t" - "}:mem_noshuf\n" - : "=3D&r"(ret) - : "r"(p), "r"(q), "r"(x), "r"(y), "r"(pred) + " memw(%[p]) =3D %[y]\n\t" + " if (!p0) %[ret] =3D memw(r7++#4)\n\t" + "}:mem_noshuf\n\t" + "%[after] =3D r7\n" + : [ret] "=3D&r"(ret), [after] "=3Dr"(after) + : [p] "r"(p), [q] "r"(q), [x] "r"(x), [y] "r"(y), + [pred] "r"(pred) : "r7", "p0", "memory"); + *q_after =3D after; return ret; } =20 @@ -195,10 +199,35 @@ typedef union { uint8_t ub[16]; } Memory; =20 +/* A cancelled store must also cancel its post-increment. */ +static void test_cancelled_postinc(void) +{ + for (int enabled =3D 0; enabled < 2; enabled++) { + uint32_t data[2] =3D { 0x55aa55aa, 0xabcdef01 }; + uint32_t *store_ptr =3D data; + uint32_t loaded; + + asm volatile("p0 =3D cmp.eq(%[enabled], #1)\n\t" + "{\n\t" + " if (p0) memw(%[ptr]++#4) =3D %[value]\n\t" + " %[loaded] =3D memw(%[base])\n\t" + "}:mem_noshuf\n\t" + : [loaded] "=3Dr"(loaded), [ptr] "+r"(store_ptr) + : [enabled] "r"(enabled), [base] "r"(data), + [value] "r"(0x11223344) + : "p0", "memory"); + check32(loaded, enabled ? 0x11223344 : 0x55aa55aa); + checkp(store_ptr, data + enabled); + check32(data[0], loaded); + check32(data[1], 0xabcdef01); + } +} + int main() { Memory n; uint32_t res32; + int32_t *pi_after; uint64_t res64; =20 /* @@ -387,13 +416,18 @@ int main() check32(n.w[0], 0xc0ffeeda); =20 n.w[0] =3D ~0; - res32 =3D pred_lw_sw_pi(false, &n.w[0], &n.w[0], 0x12345678, 0xc0ffeed= a); + res32 =3D pred_lw_sw_pi(false, &n.w[0], &n.w[0], 0x12345678, 0xc0ffeed= a, + &pi_after); check32(res32, 0x12345678); + /* The cancelled load must not post-increment its base. */ + checkp(pi_after, &n.w[0]); check32(n.w[0], 0xc0ffeeda); =20 n.w[0] =3D ~0; - res32 =3D pred_lw_sw_pi(true, &n.w[0], &n.w[0], 0x12345678, 0xc0ffeeda= ); + res32 =3D pred_lw_sw_pi(true, &n.w[0], &n.w[0], 0x12345678, 0xc0ffeeda, + &pi_after); check32(res32, 0xc0ffeeda); + checkp(pi_after, &n.w[1]); check32(n.w[0], 0xc0ffeeda); =20 n.d[0] =3D ~0LL; @@ -420,6 +454,8 @@ int main() check64(res64, 0xc0ffeedac0ffeedaLL); check64(n.d[0], 0xc0ffeedac0ffeedaLL); =20 + test_cancelled_postinc(); + puts(err ? "FAIL" : "PASS"); return err; } diff --git a/tests/tcg/hexagon/preg_alias.c b/tests/tcg/hexagon/preg_alias.c index 892ecbbdbf7..ed3413ab687 100644 --- a/tests/tcg/hexagon/preg_alias.c +++ b/tests/tcg/hexagon/preg_alias.c @@ -128,6 +128,61 @@ static void test_packet(void) check32(result, 0x0); } =20 +/* Packed predicate reads see the old bytes, not booleanized new values. */ +static void test_packet_alias(void) +{ + static const uint32_t inputs[] =3D { + 0x81421200, 0x81421212, 0x81421281, 0x814212ff, + }; + + for (int i =3D 0; i < ARRAY_SIZE(inputs); i++) { + uint32_t before, after, taken =3D 0; + + asm volatile("p3:0 =3D %[input]\n\t" + "{\n\t" + " p0 =3D cmp.eq(%[input], %[input])\n\t" + " %[before] =3D p3:0\n\t" + "}\n\t" + "%[after] =3D p3:0\n\t" + : [before] "=3D&r"(before), [after] "=3Dr"(after) + : [input] "r"(inputs[i]) + : "p0", "p1", "p2", "p3"); + check32(before, inputs[i]); + check32(after, inputs[i] | 0xff); + /* Also check an ordinary predicate consumer, independently of C4.= */ + asm volatile("p3:0 =3D %[input]\n\t" + "{\n\t" + " p0 =3D cmp.eq(%[input], %[input])\n\t" + " if (p0) %[taken] =3D #1\n\t" + "}\n\t" + : [taken] "+r"(taken) + : [input] "r"(inputs[i]) + : "p0", "p1", "p2", "p3"); + check32(taken, inputs[i] & 1); + } +} + +/* All writes to a predicate are ANDed before a .new consumer uses it. */ +static void test_packet_auto_and(void) +{ + for (int a =3D 0; a < 2; a++) { + for (int b =3D 0; b < 2; b++) { + uint32_t taken =3D 0; + + asm volatile("p0 =3D cmp.gt(%[a], %[a])\n\t" + "{\n\t" + " p0 =3D cmp.eq(%[a], #0)\n\t" + " p0 =3D cmp.eq(%[b], #0)\n\t" + " if (p0.new) %[taken] =3D #1\n\t" + "}\n\t" + : [taken] "+r"(taken) + : [a] "r"(a), [b] "r"(b) + : "p0"); + check32(taken, !a && !b); + } + } +} + int main() { uint32_t c4; @@ -195,6 +250,9 @@ int main() =20 test_packet(); =20 + test_packet_alias(); + test_packet_auto_and(); + puts(err ? "FAIL" : "PASS"); return err; } diff --git a/tests/tcg/hexagon/test_cond_branch.c b/tests/tcg/hexagon/test_= cond_branch.c index 73be8fbb43c..372f1dec8d9 100644 --- a/tests/tcg/hexagon/test_cond_branch.c +++ b/tests/tcg/hexagon/test_cond_branch.c @@ -151,11 +151,106 @@ static void check_endloop01(void) check32(count, 12); } =20 +/* The first taken branch wins, but a parallel store still commits. */ +static void check_dual_jump(void) +{ + for (int a =3D 0; a < 2; a++) { + for (int b =3D 0; b < 2; b++) { + uint32_t path, stored =3D 0; + + asm volatile("p0 =3D cmp.eq(%[a], #1)\n\t" + "p1 =3D cmp.eq(%[b], #1)\n\t" + "{\n\t" + " if (p0) jump:t 1f\n\t" + " if (p1) jump:nt 2f\n\t" + " memw(%[stored]) =3D #7\n\t" + "}\n\t" + "{ %[path] =3D #0; jump 3f }\n\t" + "1: { %[path] =3D #1; jump 3f }\n\t" + "2: { %[path] =3D #2 }\n\t" + "3:\n\t" + : [path] "=3Dr"(path) + : [a] "r"(a), [b] "r"(b), [stored] "r"(&stored) + : "p0", "p1", "memory"); + check32(path, a ? 1 : b ? 2 : 0); + check32(stored, 7); + } + } +} + +/* callr r31 reads the old LR before installing the return address in LR. = */ +static void check_callr_lr(void) +{ + uint32_t path, delta; + + asm volatile("r31 =3D ##1f\n\t" + "{ callr r31; r6 =3D ##2f }\n\t" + "2: { %[path] =3D #0; %[delta] =3D #1; jump 3f }\n\t" + "1: { %[path] =3D #1; %[delta] =3D sub(r31, r6) }\n\t" + "3:\n\t" + : [path] "=3Dr"(path), [delta] "=3Dr"(delta) + : + : "r6", "r31"); + check32(path, 1); + check32(delta, 0); +} + +/* An explicit target-register write also commits after the branch reads i= t. */ +static void check_jumpr_old_target(void) +{ + uint32_t path; + + asm volatile("{ r5 =3D ##1f; r6 =3D ##2f }\n\t" + "{ r5 =3D r6; jumpr r5 }\n\t" + "{ %[path] =3D #0; jump 3f }\n\t" + "1: { %[path] =3D #1; jump 3f }\n\t" + "2: { %[path] =3D #2 }\n\t" + "3:\n\t" + : [path] "=3Dr"(path) + : + : "r5", "r6"); + check32(path, 1); +} + +/* Short software-pipelined loops exercise the LPCFG/P3 transition boundar= y. */ +static void check_sp_loop(void) +{ + static const unsigned counts[] =3D { 1, 3, 4 }; + + for (int i =3D 0; i < ARRAY_SIZE(counts); i++) { + uint32_t iterations, active, pred, usr; + unsigned count =3D counts[i]; + + asm volatile("%[iterations] =3D #0\n\t" + "%[active] =3D #0\n\t" + "p3 =3D sp3loop0(1f, %[count])\n\t" + "1: {\n\t" + " if (p3) %[active] =3D add(%[active], #1)\n\t" + " %[iterations] =3D add(%[iterations], #1)\n\t" + "}:endloop0\n\t" + "%[pred] =3D p3\n\t" + "%[usr] =3D usr\n\t" + : [iterations] "=3D&r"(iterations), [active] "=3D&r"(= active), + [pred] "=3Dr"(pred), [usr] "=3Dr"(usr) + : [count] "r"(count) + : "p3", "sa0", "lc0", "usr"); + check32(iterations, count); + check32(active, count > 3 ? count - 3 : 0); + check32(pred, count >=3D 3 ? 0xff : 0); + check32((usr >> 8) & 3, count < 3 ? 3 - count : 0); + } +} + int main(void) { check_cond_call(); check_tstbit0_jump(); check_endloop01(); + check_sp_loop(); + + check_dual_jump(); + check_callr_lr(); + check_jumpr_old_target(); =20 puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; diff --git a/tests/tcg/hexagon/usr.c b/tests/tcg/hexagon/usr.c index ef1787c64c6..129e249da66 100644 --- a/tests/tcg/hexagon/usr.c +++ b/tests/tcg/hexagon/usr.c @@ -660,6 +660,37 @@ static void test_usr_packets(void) check32(usr_out & 0x3f, USR_OVF | USR_FPINPF); } =20 +/* A packet reads the old sticky OVF, then commits any new saturation. */ +static void test_usr_read_before_write(void) +{ + static const struct { + uint32_t initial, x, result, final; + } cases[] =3D { + { 0, 0x7fffffff, 0x7fffffff, USR_OVF }, + { USR_OVF, 1, 2, USR_OVF }, + { 0, 1, 2, 0 }, + }; + + for (int i =3D 0; i < ARRAY_SIZE(cases); i++) { + uint32_t result, before, after; + + asm volatile("usr =3D %[initial]\n\t" + "{\n\t" + " %[result] =3D add(%[x], %[one]):sat\n\t" + " %[before] =3D usr\n\t" + "}\n\t" + "%[after] =3D usr\n\t" + : [result] "=3Dr"(result), [before] "=3Dr"(before), + [after] "=3Dr"(after) + : [initial] "r"(cases[i].initial), [x] "r"(cases[i].x= ), + [one] "r"(1) + : "usr"); + check32(result, cases[i].result); + check32(before & USR_OVF, cases[i].initial); + check32(after & USR_OVF, cases[i].final); + } +} + int main() { TEST_R_OP_R(satub, 0, 0, USR_CLEAR); @@ -1151,6 +1182,8 @@ int main() =20 test_usr_packets(); =20 + test_usr_read_before_write(); + puts(err ? "FAIL" : "PASS"); return err; } diff --git a/tests/tcg/hexagon/test_dotnew.S b/tests/tcg/hexagon/test_dotne= w.S index b18b6a72e2e..1c2eeebc052 100644 --- a/tests/tcg/hexagon/test_dotnew.S +++ b/tests/tcg/hexagon/test_dotnew.S @@ -33,6 +33,38 @@ _start: } { deallocframe - p0 =3D cmp.eq(r3, #2); if (p0.new) jump:t pass + p0 =3D cmp.eq(r3, #2); if (p0.new) jump:t .Lcorner_cases jump fail } + +/* + * .new selects a producer through an unrelated instruction and an extende= r. + * The parallel ordinary read still sees the producer's input value. + */ +.Lcorner_cases: + { allocframe(#16) } + { r0 =3D #7; r1 =3D #11 } + { + r0 =3D ##0x12345678 + r3 =3D r0 + memw(sp+#0) =3D r0.new + } + { r4 =3D memw(sp+#0); r5 =3D ##0x12345678 } + { p0 =3D cmp.eq(r4, r5); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r3, #7); if (!p0.new) jump:nt fail } + +/* A load producer must forward the loaded value, not its old destination.= */ + { r0 =3D #37 } + { r0 =3D memw(sp+#0); memw(sp+#4) =3D r0.new } + { r4 =3D memw(sp+#4) } + { p0 =3D cmp.eq(r4, r5); if (!p0.new) jump:nt fail } + +/* Predicate.new gates the store independently of the data.new forwarding.= */ + { r0 =3D #13; r1 =3D #0; memw(sp+#8) =3D #19 } + { p0 =3D cmp.eq(r1, #0); r0 =3D #23; if (p0.new) memw(sp+#8) =3D r0.ne= w } + { r4 =3D memw(sp+#8) } + { p0 =3D cmp.eq(r4, #23); if (!p0.new) jump:nt fail } + { p0 =3D cmp.gt(r1, #0); r0 =3D #31; if (p0.new) memw(sp+#8) =3D r0.ne= w } + { r4 =3D memw(sp+#8) } + { p0 =3D cmp.eq(r4, #23); if (!p0.new) jump:nt fail } + { deallocframe; jump pass } diff --git a/tests/tcg/hexagon/test_packet.S b/tests/tcg/hexagon/test_packe= t.S index 9ec9d8d6fb7..7dfaaf9c3ca 100644 --- a/tests/tcg/hexagon/test_packet.S +++ b/tests/tcg/hexagon/test_packet.S @@ -24,6 +24,50 @@ _start: { deallocframe p0 =3D cmp.eq(r3, #4) - p0 =3D cmp.eq(r0, #10); if (p0.new) jump:t pass + p0 =3D cmp.eq(r0, #10); if (p0.new) jump:t .Lcorner_cases jump fail } + +/* Scalar and pair writes commit together, including reads of pair halves.= */ +.Lcorner_cases: + { r0 =3D #11; r1 =3D #22; r2 =3D #33; r3 =3D #44 } + { r0 =3D r1; r1 =3D r2; r2 =3D r0 } + { p0 =3D cmp.eq(r0, #22); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r1, #33); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r2, #11); if (!p0.new) jump:nt fail } + { r1:0 =3D r3:2; r3:2 =3D r1:0 } + { p0 =3D cmp.eq(r0, #11); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r1, #44); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r2, #22); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r3, #33); if (!p0.new) jump:nt fail } + + { r0.h =3D #0x1234; r5:4 =3D r1:0 } + { p0 =3D cmp.eq(r4, #11); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r5, #44); if (!p0.new) jump:nt fail } + { r6 =3D ##0x1234000b } + { p0 =3D cmp.eq(r0, r6); if (!p0.new) jump:nt fail } + +/* An accumulator reads its old destination, as does a parallel copy. */ + { r0 =3D #5; r1 =3D #3; r2 =3D #7 } + { r0 +=3D mpyi(r1, r2); r3 =3D r0 } + { p0 =3D cmp.eq(r0, #26); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r3, #5); if (!p0.new) jump:nt fail } + +/* A load does not forward to an ordinary store's data or base operands. */ + { allocframe(#16) } + { r0 =3D #17; r1 =3D #29; r20 =3D sp } + { memw(sp+#0) =3D r1 } + { r0 =3D memw(r20+#0); memw(r20+#4) =3D r0 } + { r2 =3D memw(sp+#4) } + { p0 =3D cmp.eq(r0, #29); if (!p0.new) jump:nt fail } + { p0 =3D cmp.eq(r2, #17); if (!p0.new) jump:nt fail } +/* Without :mem_noshuf, an aliasing load sees memory before the store. */ + { r0 =3D memw(r20+#0); memw(r20+#0) =3D r2 } + { p0 =3D cmp.eq(r0, #29); if (!p0.new) jump:nt fail } + { r4 =3D memw(r20+#0) } + { p0 =3D cmp.eq(r4, #17); if (!p0.new) jump:nt fail } + { r0 =3D memw(r20++#4); r3 =3D r20 } + { p0 =3D cmp.eq(r3, sp); if (!p0.new) jump:nt fail } + { r4 =3D sub(r20, sp) } + { p0 =3D cmp.eq(r4, #4); if (!p0.new) jump:nt fail } + { deallocframe; jump pass } --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198924; cv=none; d=zohomail.com; s=zohoarc; b=eC9l583mBwe/Tc9wGarP2ykSenSmtnrw94Bfnf2SnqADDbB2fjIRd2DuRVcPJ6AAboN9KZ8UmDktO1XkdAg4kaZ284XtiLaThlAD29F9fluSxC+xBKF5QJKjVezPCAg7CTiciKg6lQ+PmUQfAvV2heMiU23GZO2bQJIS0poePNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198924; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rFR9IveaGEdOSwUhmBMq9AQdusj381LWePfz/bin8Ic=; b=Ao5VPJUyB2OojGO43yPl5gkOpACpCu7EJ3KwNQsy+3SYFYyvmSvm52+PmREqNp9IvIqBA5xDgHSnXb4cFdkzcDr9dO/5kgrw5ji6YMYkEA7pYy2148ltXaBGwVKMY1MBN8m0BlBcp5MD0I8vzME7f0R/vVyGCHFOxzHWyMMownI= 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 179519892413777.6901840968842; Fri, 20 Nov 2026 10:22:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTEN-00069p-Dn; Fri, 20 Nov 2026 13:21: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 1xUTEE-00062Z-Rp for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:55 -0500 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xUTEC-0000q1-MH for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:54 -0500 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AKEfG302039943 for ; Fri, 20 Nov 2026 18:20:51 GMT Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2fjtub1t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:51 +0000 (GMT) Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-862a2ece202so1370600a34.2 for ; Fri, 20 Nov 2026 10:20:51 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rFR9IveaGEdOSwUhmBMq9AQdusj381LWePfz/bin8Ic=; b=I6W4BmAIDqONYD7d uCGeSXmWgOMXmnLsvGRcu5v4vozR93u4C7afr/nSiW8TPprNWVpojPeUkQLnpx2v mSIw1OgpS/UfS0aSctD1meKKLgTevAhElDb9lRM9P63evzxWhvVNY90+DOKq0Fbd aiq1hzpCqGFs86vMMWLFWF37e/r28p0ubwaQ++kzPrGZlF9frOsk4Bzdiok32BKd bV2SkdnOMwN5pfBPGvWNMsrihgKaT48BehB3YqdTpXlHENy5j3padOJyyXUe1ymg KN/nJ98Kse0iPaTMDV3JL4AQmkCzde9ebIr1UoekdK3y+5ed5JHrRpwvHD3pQXdG sqsUzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198851; x=1795803651; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=rFR9IveaGEdOSwUhmBMq9AQdusj381LWePfz/bin8Ic=; b=QzcPZdBxmwZlmESjsW9ugy7KdnazIONeBs6KLpjRBAWY8DJpHc4PCcZVVlOgFsoqN1 etk+cg8lysDsNY7FKXJbxM/CwbOu02m6zgnc1LrZepYLq+jzSuo42ccnsyCh2jPxn3hq +YO4Ezd8xHTtriCfOlmDgcNdI7woz9INURMKbOssMYCPdDzvgWwnI/0VH/10+r3OJJSc dDLaTMQfWSU3Ujo5JErf2KWIe2XuzXO+WBQYVYDN/Z0UzeIw1Af7WJav3e4cA0PyjUpX oHqzfJn4C5xUU40NK0IJPCVhJX1vonVF+sB6uqNFIWIHNDFX1fsD+IhT8aXn1rCZV1VM u7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198851; x=1795803651; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rFR9IveaGEdOSwUhmBMq9AQdusj381LWePfz/bin8Ic=; b=Y8G95SwxtK/LWfg3JtiTBcoMM3qMajGmi+T4j0scy10hXeNKvHiSasDx05inUXu4Yg Ht+DHwOOMPO1KS5wAQpbpGBx4elACHMKgIwEVlfYfuJwCYWv2IYqIELa91+wBr/U6r34 bfTV3GqdOxTVIBJpsvd/SQGyFAegh/F65U8dkcW1R640hWEaZvS+d3nwdIqodZhEglhj dQ7zr3BNx2epvr3FSOBZgQVjUrWoHpJHRROXbUd5KTOc+2siRoG6A6e8c1cxZHmfZ6Nn cGDG+rTdkzMv/WR18LB6bjviegJmmi+8onwzWjkYDETpDeSzEQHM53azWuHVVrVkKJb0 TkEg== X-Gm-Message-State: APuU4Z/5wY6U0n7yKmByG2zd0zi/gMrO7MJFND/FjiBs9fVSRiPVFwJ6 Yyw9JGPFBhTEZsQTvAqKhAgxo9sVZVEsUKizsSYaba9m/AFxXUBPXjgeSzxr8rzqCS+dGufBMEP w9ejbo6W2d84tu4MNdv8ThAqsrUJeZiDkaBZr497Wf5CrZHOkcr7CBnZWkj7C05t0jA== X-Gm-Gg: AYBFou2iqgTKRyQOE6KU44gtpYQeX74TtEBE6bILj4teqqhP1es0mRKllbq6wXP9mnw V32DAkOw9gdUNx4wHZm2oJ5sXE7gWhc7S9gxxfo0do9CF9jX1e2C4x2NaQ3sjbDz3fYT8YJekb9 4PGWROR8oE3gxDeYp+fRZFpSkggsu5+2oY6d4oztT9ECBl8gdJOlzXW+WIACAb8VYSOFQRNW5X1 BiMdhxcBROBqyh8+/+p8d7QM/C25te0cqxIw9cYPpunzlCl3iMxVoGqVC3L/58ZcsBpQKwypD9m BhgX2q9djdchFYzurQ7Ms5juZ5jGAUe/dJobwS4YM7bJiFXG8kKfpQ7maRphpsLZyGWSY4cWd+l zUsPCvcqrkWTquzMb/h27RTr1/zKEJXb7N4qc8C60wUHqea0r9598ACERCCRFRZBA/ayYUcquDj qwHfQDkDpgEDAhQv6RFpQUGQ== X-Received: by 2002:a05:6830:2708:b0:862:c4ae:7fca with SMTP id 46e09a7af769-86315a09772mr4753624a34.26.1795198850739; Fri, 20 Nov 2026 10:20:50 -0800 (PST) X-Received: by 2002:a05:6830:2708:b0:862:c4ae:7fca with SMTP id 46e09a7af769-86315a09772mr4753582a34.26.1795198850240; Fri, 20 Nov 2026 10:20:50 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 11/12] hw/hexagon: honor configured RAM backends Date: Fri, 20 Nov 2026 10:20:30 -0800 Message-Id: <20261120182031.560481-12-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: JTDfUxzIK6f4RoqvITejFp4dBIuolt2_ X-Proofpoint-GUID: JTDfUxzIK6f4RoqvITejFp4dBIuolt2_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX5VS1p7i+dhiT d2hojMHEPVKMb9x/YzxG9DzI1/kCRJg3ayVSfj6RRyecNnzRmR0nQOb22tphvOADCB/ZKhfkG8u VYgEgOrFOBY+inpUzSVoI6ZR1tBL9ZEBWTalAGmGPl6dhnZka/GdHr9VLWR+csudWLzLSFveL5O q50nplbAJp/6wWS0ToPV+7liHpm4oon1ZESnXSALdy3xvdg6S37PKUtEKNnnSF61TN+aqDPiHcA UBLVt4L2wP8rvm5/mlHp4L2CUYynKSkqJgq3zwrXzld0QFTEEwaRBKd7L6mw270S3kRztrOd8u6 b9Mz6Ubi/xMt7l8H5KEvHfoUlGU6UOAac0dfg1fcsu0UNIOVatTnhrQmDFEalMyUJbnRZTBRWW6 OxidoHJBWE1P3MwDhNOOElQ7P8ZX86XgUSVXnGr7s/zEmKPbSDPmDOI2/SHEHTohTafcmVIzBlL egIYnG3PNvL3pL0kWBQ== X-Authority-Analysis: v=2.4 cv=XcccX455 c=1 sm=1 tr=0 ts=6b008f83 cx=c_pps a=z9lCQkyTxNhZyzAvolXo/A==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=CClahisu4qSzJabnEcAA:9 a=QEXdDO2ut3YA:10 a=EyFUmsFV_t8cxB2kMr4A:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX9EMo7k+bB88F vM9doRnxw13r7xMyOUsUvb/klsC2RHb9fOENHRxotv5naZtlglbuL1Ls66cvUNA/1SqKPe+Ajx1 06U0IUCuPzgwjxHFnNqdztG2O1Hgucg= 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200072 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198926054158500 The Hexagon machines consumed the MachineState memory-backend configuration but always created and mapped a separate DDR region, so a memory backend given with -machine memory-backend=3D was never used as guest memory. Map the machine's configured RAM when present, so that file-backed and shared memory (as used by the migration tests) is actually guest memory. Keep the board-allocated RAM as the fallback. Add a regression test that writes guest DDR and verifies the bytes through the backing file. It fails without this change. Signed-off-by: Brian Cain --- hw/hexagon/hex-subsys.c | 10 +++++++--- tests/qtest/hexagon-config-test.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index 52ec0cadacc..1103d2b556c 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -163,12 +163,16 @@ void hex_subsys_create(HexagonCommonMachineState *hms, { MachineState *machine =3D MACHINE(hms); MemoryRegion *sysmem =3D get_system_memory(); + MemoryRegion *ram =3D machine->ram; size_t i; =20 /* Main DDR. */ - memory_region_init_ram(&hms->ram, NULL, "ddr.ram", machine->ram_size, - &error_fatal); - memory_region_add_subregion(sysmem, m_cfg->ddr_base, &hms->ram); + if (!ram) { + memory_region_init_ram(&hms->ram, NULL, "ddr.ram", machine->ram_si= ze, + &error_fatal); + ram =3D &hms->ram; + } + memory_region_add_subregion(sysmem, m_cfg->ddr_base, ram); =20 /* Config-table ROM and the blob that backs it. */ memory_region_init_rom(&hms->cfgtable_rom, NULL, "config_table.rom", diff --git a/tests/qtest/hexagon-config-test.c b/tests/qtest/hexagon-config= -test.c index 9554fce57ca..d4dc9a2d3f0 100644 --- a/tests/qtest/hexagon-config-test.c +++ b/tests/qtest/hexagon-config-test.c @@ -60,6 +60,31 @@ static void test_config_table(gconstpointer data) qtest_end(); } =20 +/* The virt machine maps DDR at guest physical address 0. */ +static void test_memory_backend(void) +{ + g_autofree char *path =3D NULL; + g_autofree char *args =3D NULL; + const uint8_t expected[] =3D { 0x12, 0x34, 0x56, 0x78 }; + uint8_t actual[4]; + int fd =3D g_file_open_tmp("hexagon-ram-XXXXXX", &path, NULL); + + g_assert_cmpint(fd, >=3D, 0); + g_assert_cmpint(ftruncate(fd, 16 * 1024 * 1024), =3D=3D, 0); + args =3D g_strdup_printf("-machine virt,memory-backend=3Dram -m 16M " + "-object memory-backend-file,id=3Dram,size=3D16= M," + "share=3Don,mem-path=3D%s", path); + qtest_start(args); + /* QEMU has the file open now, so nothing is left behind on failure. */ + unlink(path); + writel(0x1000, 0x78563412); + g_assert_cmpint(lseek(fd, 0x1000, SEEK_SET), =3D=3D, 0x1000); + g_assert_cmpint(read(fd, actual, sizeof(actual)), =3D=3D, sizeof(actua= l)); + g_assert_cmpmem(actual, sizeof(actual), expected, sizeof(expected)); + qtest_end(); + close(fd); +} + int main(int argc, char **argv) { size_t i; @@ -74,5 +99,6 @@ int main(int argc, char **argv) qtest_add_data_func(path, mc, test_config_table); } =20 + qtest_add_func("/config/memory-backend", test_memory_backend); return g_test_run(); } --=20 2.34.1 From nobody Mon Nov 23 04:26:29 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=1795198942; cv=none; d=zohomail.com; s=zohoarc; b=IlEL6LuZaQy9/wVWX4/X7PIvEuPear3R2qL74wM2aR6hAbAWiqe2DeLQ7wYsUWT2i5/Um9uZrt3bK65TDSx8CNkUryrT0LiHE8NTzJ4d+JvmuK5t1SC30tQ4Qhhpwb5lcO0k4jCQxDrt7Qg+uTKvo2qDOgGFbJCjkgIirBRiwv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795198942; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rP5KFfKFgBy93H239WRP7Escww7/PQa0uMZOFKHOh08=; b=NrIO9oEaf86nee9FDGQazBo2n9VKxfV0HqRZmARWHJveK3G7wZKLL+M/xESFtcdg0vZEK1CXtZSzKCZbIDsuYcs0eONBhM7nIAWVzoJOY3/qCeNFLnwMG0FAHxLCZd04NOqGGEJKZ3Q5PDXY/xwJ4Majek1HRoA6Io1Nxh4VItY= 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 1795198942397443.16151735417407; Fri, 20 Nov 2026 10:22:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xUTEQ-0006H7-H0; Fri, 20 Nov 2026 13:21: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 1xUTEF-00062f-Bg for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:55 -0500 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xUTED-0000q6-M4 for qemu-devel@nongnu.org; Fri, 20 Nov 2026 13:20:55 -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 6AKEfZo5048964 for ; Fri, 20 Nov 2026 18:20:52 GMT Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j2mm4hwmg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 20 Nov 2026 18:20:52 +0000 (GMT) Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-71ad455a8c1so721875eaf.2 for ; Fri, 20 Nov 2026 10:20:52 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-8631690fd36sm2698364a34.20.2026.11.20.10.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 10:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rP5KFfKFgBy93H239WRP7Escww7/PQa0uMZOFKHOh08=; b=C5lKDN1Z5u2UfN2+ pln/wTpbgWy9ChWTndCM8+ODYKwh5xOPmVSeuT8kk/37kbOwujn7R3YNPpv2rTYR 7I2OaxfUX+6jDi5bVHW6M34TKHpgbfb2Y4Y76nDXcFglDwGeLbc2n4hL96KXo2MT eldwqGr0SOUWkRmzYEbG6k1YiYwwnwiSjhXk7G6vQsKtYs51ZZHmapl8d17uowCl 3GJnFQ0lzmhgqI/4Hy7Nr27hUNrKRFfNolTc0mg8A9LjvmCLccLeZxZFwkrZ+4xA fYJmkYXugBL+jgrV3oQYauBpNhkDY1t2l+KPp21XZAV1mWAdp6U5xtZ+0pXrFBlb W9ob7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795198852; x=1795803652; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=rP5KFfKFgBy93H239WRP7Escww7/PQa0uMZOFKHOh08=; b=bqkHhTdQHhgJ5A7nq9QDYI1rR69/9zSaMg+R5YqCTp11VRZeXuy0j8mp/3q7JnDjLn U+Ey4+pMoEgdceKmCqf/osBjvQq20Ow3No6IQXLUAOsnE/GSi0Xk5YdSW+5HiaHD2BWp oSTHq0diCdOd+ZQL6ZQt1elpBTb1IZ8Yn9NSHNY77sALh0a8g3GM0oDnqieHs//gBSS2 M04QMpyx02y9pv5Ydpzt5w73gk7cEYhABZd8qkuTa+DgFHwBk4GkVzOp1yu3EGVzPcVK z7zJaFlKSCb1AJ5A1IsnLWJ3pLtZu5ycb1sZFf7LoOdB9nv86E2NZQ6HFOgtxXmvhm+P T7hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198852; x=1795803652; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rP5KFfKFgBy93H239WRP7Escww7/PQa0uMZOFKHOh08=; b=S8n/5cHPZWj5j7vWnPAt+DiTXAEPKRgG2qaFoyg5Y+UrtzmFJ0+oyQVrNrY8FUEsQP M1UUDxu2bvl5a0CmA+awWK9opXUlD9yh05vkzTqVz/k81VwFHCA5XOMiCHLRTVya+bgN NErBD6x0bwjV4oEmCTQO61T+eMA5Vz/96TLty5CpINFYAFrwK1wYtpWg7Muq0txUyJgA hUtUTVZw/0t1T5QtL7CuLSslnPCpy8L+TLtABkn6iVNAryZi4PpJMuN3BbPfYHB0UyXu MiMltXUUh9XtO1EBbdZ6Hn4Zn1owELOs6/fdfB9NFGTwcGByteJFKGbXDlYWKXacVQje N2Qg== X-Gm-Message-State: APuU4Z9QdOZ7fuwAuPz9e1ybp2T+1eU+7tgUXZgS1EVTBJoA2jkVonJD QMIAw8ZxNmS44Gv/W7a81rqwAFy2Z4wWxo23bwOCrY3FRizl4WyODVHKUAOFvcJypSMZBBmirhh LtZmCY32ckV+7p6l2kcvRQCtvgC6ylFQKqz4I6m8DRseT6GS+8oq9pqVUAosumA07wA== X-Gm-Gg: AYBFou3wef/kgslqZY+2vmf8rX6uQH443uf3i7UR5rwyqhW1rdC1v9o7JxZy78+sg1J nPXw1xMET9A4/f+h9l3GQEoOKYVwohehqyWx4JdE2oC6wGHBpddnmgIwpeR/+cbhKJMhTlLqXJz qoVx+/0LSo+/qbuexk56uROxlCh5707x2BV7yOxU14pC6IAfjnVddW50xfK19FQt4XZ6agDDGWZ sy1cryV5vtj978Idy7AUZ22J5PnevqT0M9MXRMYBsc1qcYjp4S+fJaHwJIS4nqGZ28nSxKNmDmi NuJRmPqkpJNS5Lrjq9kcI5iQTv0HTBjep/pQ9Hx8m9XtmPo/07GLw4Jq1zQpBd9I7nrt4b2dmzd cdWIvqbHoc5g5ATX3y7Lz6DF+0GpdXNQii9T+04xHp0qDbvyAJQyxGAV7E72cuBFwR51Br3uc1B AiraeahWgiCJQqxMIlhYGABA== X-Received: by 2002:a05:6820:f016:b0:70e:1dd8:6713 with SMTP id 006d021491bc7-71b39568e7cmr3098531eaf.71.1795198851976; Fri, 20 Nov 2026 10:20:51 -0800 (PST) X-Received: by 2002:a05:6820:f016:b0:70e:1dd8:6713 with SMTP id 006d021491bc7-71b39568e7cmr3098510eaf.71.1795198851569; Fri, 20 Nov 2026 10:20:51 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Brian Cain , Pierrick Bouvier , Laurent Vivier , Peter Xu , Paolo Bonzini Subject: [PATCH-for-11.2 v2 12/12] hw/hexagon: version the virt machine type Date: Fri, 20 Nov 2026 10:20:31 -0800 Message-Id: <20261120182031.560481-13-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> References: <20261120182031.560481-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: AZ8Ff4LkHjgti1yU5X6MWQtufHY3nii2 X-Authority-Analysis: v=2.4 cv=RZYFmFtv c=1 sm=1 tr=0 ts=6b008f84 cx=c_pps a=lVi5GcDxkcJcfCmEjVJoaw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=RWXkQjlZBxIzdYGjihoA:9 a=QEXdDO2ut3YA:10 a=rBiNkAWo9uy_4UTK5NWh:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX7nOi2KohVIL4 n+BETJfqACrISMXuMpNn658H56OgJ+1I57oo/fZPxMfgOXcfL5c1ae33cqIr1Rsmqrg6BgjO3MV db3UrHSXNecjzVTvwspCisDObs552lg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA3MiBTYWx0ZWRfX7HGBf2y4ysv8 +zBhoEdlvIRFV4Xhmp8mgO3KIVO+Z8qL9xi4ZbL7iqpqBAP6YNHD2DMKdBq7sU3S8Z46pYnLq/K qMaB7qlGSwtobmx5IV7ks2v81asWbtEqhSbxaSGhd2HzK16xR1zpBEIaNffkO/C/aWIoqT1yH/P iD0azHfluTtsmrDGBSlUqttKQ3DNUPsvOPRoEpGgfUuerKizthv5wVRnOzdVd/NmKD5JQOiQzUE O6uCF7MEZwNy5JUxO57HDj7s3G/NLTypaTXH+E69cmvLe/4CpOvuioNUcevqPfveT1g8Y5IyyG3 nOHNZtiZt6a0z4//RTnuwuzbBwkQqjaGjBcxkySLf4Vd8ZwVtgD2EscwoEufR2h7R2x4Avq9qLk KTEOQxo4foTfId5l2dPhJref77H7P49imkT5/v81SUreEKPUQYPMVulaPrcMHt3CTMnP8cfURuu xtQ9maDExitMwSzwEnA== X-Proofpoint-GUID: AZ8Ff4LkHjgti1yU5X6MWQtufHY3nii2 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-20_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 suspectscore=0 malwarescore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611200072 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1795198944304158500 Make the existing virt type abstract and add virt-11.2 as its only concrete type, aliased as "virt". Signed-off-by: Brian Cain --- docs/system/hexagon/machines.rst | 3 +++ hw/hexagon/virt.c | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/docs/system/hexagon/machines.rst b/docs/system/hexagon/machine= s.rst index a4760b7a5b1..3bdf5eac26e 100644 --- a/docs/system/hexagon/machines.rst +++ b/docs/system/hexagon/machines.rst @@ -29,6 +29,9 @@ hardware available to the guest, including CPUs, interrup= t controller, console, virtio devices, and accelerator capabilities. See :doc:`boot` for its boot protocol. =20 +``virt`` is an alias for the latest versioned machine type, currently +``virt-11.2``. + Board-specific CDSP and NSP machines ------------------------------------ =20 diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index 3327e28d121..7c798222ba6 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -161,7 +161,44 @@ static const TypeInfo virt_machine_types[] =3D { { .parent =3D TYPE_HEXAGON_COMMON_MACHINE, .instance_size =3D sizeof(HexagonVirtMachineState), .class_init =3D virt_class_init, + .abstract =3D true, .is_available =3D target_hexagon, } }; =20 DEFINE_TYPES(virt_machine_types) + +#define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \ + static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \ + ObjectClass *oc, \ + const void *data) \ + { \ + MachineClass *mc =3D MACHINE_CLASS(oc); \ + MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ + mc->desc =3D "QEMU " MACHINE_VER_STR(__VA_ARGS__) \ + " Hexagon Virtual Machine"; \ + MACHINE_VER_DEPRECATION(__VA_ARGS__); \ + if (latest) { \ + mc->alias =3D "virt"; \ + } \ + } \ + static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) =3D \ + { \ + .name =3D MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ + .parent =3D TYPE_HEXAGON_VIRT_MACHINE, \ + .class_init =3D MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ + .is_available =3D target_hexagon, \ + }; \ + static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ + { \ + MACHINE_VER_DELETION(__VA_ARGS__); \ + type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ + } \ + type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); + +#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \ + DEFINE_VIRT_MACHINE_IMPL(true, major, minor) + +static void virt_machine_11_2_options(MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(11, 2) --=20 2.34.1