From nobody Mon Nov 23 04:26:37 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=1795119408; cv=none; d=zohomail.com; s=zohoarc; b=FM6FbP7s98paaWAGSy5BbW6wBOBKD21OH1fXd0U1+QGi5P1i7iyTO1TYgo4A9OfmF0LLdIU2or4U1kDVBOGXEVS/C4tIwMsqGTJCqD9P2RlxU8Jq06/RhncmWqGm/oP7PfmmYGaUqkvB3xTQLcw/VP1Bqoe0pmVUL9GA7f6pwQw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119408; 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=bCnkRnm0Uc+pTP7pIvwtA+oKroPqs2WbY6Bp+x3cHoE=; b=JtrLcP4L10QiC7Ek3nnIM6S6NdsLMPpl3mY+8fR+dfVtTEQuHZNRQ9TIxfqKmd4tazJ++FrwEySp4/b4ZcFSxJzClrNZZ0lhvAFkvOyX6/sDI1yneQtX+/eZUV62fxKQalawCobbibSgwb0UiZzGylYwWI7mcxK3ikvgX4AQBqs= 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 1795119408149912.5663682212188; Thu, 19 Nov 2026 12:16:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yc-0002sG-4r; Thu, 19 Nov 2026 15:16:34 -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 1xU8YP-0002oa-Qn for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:23 -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 1xU8YE-0000pj-VT for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:18 -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 6AJJ1SRu1936307 for ; Thu, 19 Nov 2026 20:16:08 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j22ugssrf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:07 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-3821eb27024so151463eec.1 for ; Thu, 19 Nov 2026 12:16:07 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:06 -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= bCnkRnm0Uc+pTP7pIvwtA+oKroPqs2WbY6Bp+x3cHoE=; b=Fb3al42958ZaJmUs J9h0yTztWDozAVGsOLrp1NttVg5fWvs2gNtvWHQYQMMiK/eZNBdDN9c1d6SNo0H9 keML7aBywPaNBUh4k8EJ4TQXibEu9ABdNtlaJHOksZIuyZ1/zyrU5atw2MqGNnkK ZUg1kSeXRVdikYL4kyPEEqV3Qqm3xxZlRX42csjSxx2eFSDAAKspYXWAa6ctgM2H +Tfyt+3eoVRz/9dCF3B7fIQ1kdSJsrYca1Ulup3PCzTyErKSyjC0a8zjCSwsvaul zDkqcrSDbfFXJuL8E0JdF9TvilOl6Xnn5ABpcqI2ZqFmFsUQMgtrKN72ESggThxn xHxn/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119367; x=1795724167; 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=bCnkRnm0Uc+pTP7pIvwtA+oKroPqs2WbY6Bp+x3cHoE=; b=dVVwBtVytxdPJQbQE8uBjbFv6Ijc3Mn4vxt+bjBghtKis25WsFdi1lKgjt3kgkzmPm HMgu7yM/IklvZ4YPQcH3XJxgShcUSLQlbyKKEQr/mqfRN69lA1jNx2MXOgHcXGlfQeNf h8ScoUyMS7e+dIGtIZs/RnwEew06mP2AtVFvLEMfof74Ht2gc0XsBhO+lyikDI6hqmo0 pf+J45Qr8OiwnoaSqt7oHyGwYytK2BKyZi/039sOk1/oMuAPJz6z5k40ZXUyT/yZrhZ4 FzEmZ0IN7Rd+9PjhHd4293/Olak3yiOq+KpazKTzKpp7YCz0acj7UEJkZKI6ZfbK9yvv zZKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119367; x=1795724167; 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=bCnkRnm0Uc+pTP7pIvwtA+oKroPqs2WbY6Bp+x3cHoE=; b=q7FtxQxB2FEWRyaL/RQZqyvp1AhIRqLqZDt5+RtW6QhhFfp5P4Fm9pVxpiey7KsTvm maBpm4VHoyF1Ao4CckmCavE48cD7u4U/B1Vim4jVrXEPB2dhzGf5bQH3qvmHDYYLPqwT rP2IF2JQ3o+0k/lE9kBEZp0EIPhkce6tGfDuiBunKBweO23injQuIuhztlCljQkGkoIE pj/FMEa+ZfCDlSLSbTxSMrJFrhB9CrhVFS3zfrA6Ms5uMYXLu5MJXIWwQ/eKoDn89w6G DToEhb9Dwp8lYkSjwexjFjM3UuRNomMB+oJ9q+fP3oXuO/KMEnEwbWbcKOJOrstYtX40 nccQ== X-Gm-Message-State: APuU4Z8+KVH2T9g6lrTA3bYlBwljKIr1AMVYcllixFoA8YUj2bpW8PBX Zs8a9KJvt0gsf20J6e0DYxw7KCIl3kbwOUXXf/Qnrit3s6p+Mq1/Kt3qrx1Hj8pr8568uz5SAO8 qzaMPFfplF97gpUHJmJNqJDrOghkBi8P0kJRN7/T/Lh0M7JBsoo/QcJIQ4hrB2ipRJg== X-Gm-Gg: AZFdTZdF3GiHoKBTNLxMAWqG0e4ROUe8bQsxCOeyCdHXaBE5UeCCEOTWX6O12WH3Q+P TRsYJrmPKp8X0d46R017UstDO7D1qs0iEmh4hofofD2XNOtOGFPjfMBjpDiLVw06TE85StCN5Si 7wKPSdQZbkRbSQv+urULJhDNoNczCfm69McVYOoByInlfs/P+R32wXbN2yXIR3r2hFlQYHALovI Y6gPaC688ZTmOt18KuU8g/7ywT5yrE7Q22XB6oJkwlrvf6lAodGm31dbgCIbvcGQReHA9B8HU1a BTgmBGlpSVhb45AHxFfo09xoYJnPjEfGqNQduhf7sDTKzziwTiZbtpcP3E4qfw5wsyGS/W9QkhI TvqP4iGKYEsnD3i801hEOR2h09suXamcoKPH7twNdzRK4VvymUe+k+qJ6pU5ugSjL6dyQirLlIA Xn+/GLL1NVPhEuMXMhFAxcgw== X-Received: by 2002:a05:7300:e91e:b0:384:2780:8757 with SMTP id 5a478bee46e88-38570a3e793mr437520eec.22.1795119367181; Thu, 19 Nov 2026 12:16:07 -0800 (PST) X-Received: by 2002:a05:7300:e91e:b0:384:2780:8757 with SMTP id 5a478bee46e88-38570a3e793mr437497eec.22.1795119366661; Thu, 19 Nov 2026 12:16:06 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu , Marco Liebel Subject: [PATCH-for-11.2 01/14] target/hexagon: read the old predicate value through C4 Date: Thu, 19 Nov 2026 12:15:50 -0800 Message-Id: <20261119201603.2377989-2-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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: AvAeZUdq6FByykSfhqCrSOfpaR7Th5gN X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX4R1FgXwqZ9RF dELEN0xI3oZ+4CpmwIUUHn1hiek88o0H6Sq+GeFdajQKyyBYSo1ejFVLXtFJQsgov75mImT6ZfF VfopWH4X2FBowG4a+39NsxQhV+hU9h8= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX2vguXeV0/I1C jOVghiZFV44+4+60VxE95cVBUxhQRLqmGCAZ2RWAJatA6u3UBxghuX86tY3S8ZO0rkLb+hXoX0t lK6pKmF1mt64IjVRn8WwRzBgEsXwPui+UghunqJCueuXa+twOoOQs5/uLt5wQLCwB0FbyKRVBEu DSK6wSBI1pIz1KsZUd3TEWC2hRpWvhC6LupRujci/HJHgUIrIy8OKJr/SHDCGXNO3cs6TsSKHyT Yq/dDW+YPPhZi7icNWFj8+C3n5zSVbDpRlE+jh81EzJgjL3dssSnkDD9KI9F8A1nbFxJS9A6W6O PUTCl+M3KwecUNHLfoEsl37TuF78W1fjDuMqlDJux68M77d6mhMlLow1s3IgK918tKW+mlByhoZ o8GjevtzviBltABirRwKHgRbm4V9zq9+uN5qbAIi+WOLbgjK+QHiI5o/47AGv0hFtZNmSbHM6RB NcrAUDwRw9Rn4sPmhEg== X-Authority-Analysis: v=2.4 cv=YeEodARf c=1 sm=1 tr=0 ts=6aff5908 cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==: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=9fZTsBWXyneHJwdpUA4A:9 a=QEXdDO2ut3YA:10 a=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-ORIG-GUID: AvAeZUdq6FByykSfhqCrSOfpaR7Th5gN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119409177158500 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 --- 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:37 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=1795119408; cv=none; d=zohomail.com; s=zohoarc; b=GKNNScxRxVfvDJs9//IjynxHgZIPOiF9nIeJfA1b/116pMUvb7+64F7oL69HuwvgdkC29+wi1gOFLsQDJ+DAbgdgZmhbJeNcMSVrqtE1cEdCONcAvEu9up6wUPUz5EOibZNGgmYZFzzQNKQMiL7jCo0tBuDQIHY3p0nmwelB0vA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119408; 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=yy3iZQOxjbn7sUE2fzUieBZDlaV7AekfIbOCamTwD8Q=; b=b6ZV7QgjhX+T7VgS5lrUpB1qQdlBp5icQNg2mYV1dUgI1DAnBkbu+L0F1LN3nyuFX1Xuho2E6d5oQ9H1mEG6SEmfm0aSImhWRvifNHSmPQjMzC7PgZxsx8NbLHm9MRL8BfEb2DvgygTQQ8kV0XN7MOejY40dmrVyaYTXmJcguGg= 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 1795119408092480.8980908445137; Thu, 19 Nov 2026 12:16:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8YO-0002n2-5Y; Thu, 19 Nov 2026 15:16:20 -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 1xU8YI-0002lP-1c for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:14 -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 1xU8YE-0000ps-T8 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:13 -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 6AJJ1jTW1936633 for ; Thu, 19 Nov 2026 20:16:09 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j22ugssrh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:09 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-384c78aa0dbso143878eec.0 for ; Thu, 19 Nov 2026 12:16:09 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:07 -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= yy3iZQOxjbn7sUE2fzUieBZDlaV7AekfIbOCamTwD8Q=; b=FW02KoevKkHE0577 tS0P8sV/I2JyZjjwZ2ju8lYosHDm5K1MVIfp5mbTTyvT9oCR+AxFRZLlmi3XzPYH 6cYIzbxuuwKK2y71WxtZYFG+588FjPdZmWQB8iFFz1q9/9O8YwUy1QX3qYtxjhhu srVhxycH6t8b7iOTZLCaZI0R3Dt0ses4sxfNZIyWRil8QE4BK4BwL7MbJ+Jfaq7N 03PbxYk+NJh0TVXMSyVsyFc2TxqV0MUtVi2IKGwGFQpPnwngAPDCi+HeWptGYOaQ Vv2qX+hB/OIw8BnnmDKy3qZ5XpX9klJb1TiEzP5DLHAt+u7M3SMwTBBRnebYrKKf ssWf8Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119368; x=1795724168; 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=yy3iZQOxjbn7sUE2fzUieBZDlaV7AekfIbOCamTwD8Q=; b=eTW7I59cRkEQr4qkRATuMq4cuebnDx0QSRSZ9R8C0KtGFlMocSXzH/FCYUYWHJ7IEM 6g1n0daaW6MSaTdjk5HNMF4BzgdZx8xSz8VLIDOsUakOzgx7rmdGQHfe/NizHeV1qOae N4RjCLTzNgRKeVDz53Q2XAh5Layirn0YZ03DtTLsCPYV8h7A8VQ1RZWyuuC038jNaOHp z7s+xXKpg//j/fv0WJaIdoTvfzjogFi/c1Hivj1orXREviHIA7my0YCeDFc/RZyM7GHo DtEBcefLlbfAWsIZOiJ/isCd5JdqfeqlEOtdpVMIPGl2PBMkO2JsL5Lf2zR1mOtwFfTz XdPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119368; x=1795724168; 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=yy3iZQOxjbn7sUE2fzUieBZDlaV7AekfIbOCamTwD8Q=; b=1Z8ZRtPPKtWUXC5zFSI9UPz6BVGEzeOgynL2Z7V8w2jz9IBRXC407ZSyzAHrQLmtPq /SwMKN+2nPeLYYF+AhtaOZE1LV1G1HhWmORwNIjiA277ENEa7gn/LHp9ioZ+SzYot36y xPOnHNCSy88wxDngyOlNo7LfcmqHec2u55WIGtYPIJVgXDhfpca4mq+uVsMPYm3Pr/TA 0kPkZfVh24B2eZrz9AjnQOB0u5GeUOYCOKO8+xaBBK+6+UiZ4jAQ3hYrUJe1K7cqo06B wEgLsaT35/wPWd4kB0aSxcX8oT6oNBltRju9WN2JIsm4SI48Cxz8XrWhbh2oTGLippaX ARig== X-Gm-Message-State: APuU4Z+/dp+taKd++/nkxFGH0gZba8NMABsuTYi+FnosQEVy7fHSXfoZ ONkwl+ESwprGJ1o0pnfRqWYlyvKX69J/TaUwpmzYh/irYcfCq7FHS2eA1NsPDNjCfqMrNWZU8Km u6F59tGHqPaWAyninwiZbkabr1c860ZsR1+wN3/2SiD8wjfXJpr8S8mdvpf1RxsrFqw== X-Gm-Gg: AZFdTZeT1JBThW8nY4lR/9SqZfPlTdZ2AmxNJmxI18sbSAMA/TyQP52qnm6V142UAlc PU2tWd4/gO9oeQCGLxrfA41C0e/1kzczani9CkhccBZHxeuS5LjTOPA3wQBnGLjZ17HsS0SiIyv SJ9Jru+x9ATRM5au3Oc416yni3YolUPs4UH/jDrhjS7v4yBvuyDcAeU9j9PjJh7GoF9Sv/xlnra ClaWGqBgcBnxxy3/a48k/jQUGy3ARiPvEcBWRpi19g49HetLMVtAlBJMhqv/G4trw52J1xRVU7g C2o9pts87+HT6fImBm4u9XYVZ1trU9/mbb+TgnBwI/9tXfB7wJC797D4B3DIPb/wCcFPoS2suJ+ 1uv5YVsZlbnuH1kPRit6Q7O7XPAk29JKdvZkmaOkb/HtkV9vogWTu+O9BwLgO6Br9jQ2roJflFt +ZKu345sRX+ErvUOnXG6q+5g== X-Received: by 2002:a05:693c:864c:10b0:377:a1c8:a628 with SMTP id 5a478bee46e88-3856f65dc4fmr450952eec.6.1795119368550; Thu, 19 Nov 2026 12:16:08 -0800 (PST) X-Received: by 2002:a05:693c:864c:10b0:377:a1c8:a628 with SMTP id 5a478bee46e88-3856f65dc4fmr450923eec.6.1795119367907; Thu, 19 Nov 2026 12:16:07 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu , Marco Liebel Subject: [PATCH-for-11.2 02/14] target/hexagon: bound packet lookahead to the current page Date: Thu, 19 Nov 2026 12:15:51 -0800 Message-Id: <20261119201603.2377989-3-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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: KoV9VSzzG3Y4UfIgAd7Bq1Y--sh6CKwh X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfXwghmvG9Jexvv XxPJqCUtb8Zw3fvm9uZBuaHk3zhiqLFOL2j2onJkehwdtPXX65OofUdbCKwGmEqrcdHJHWCwVTN Dln6U6gFv3KSgfuLLy3oFKb1HXYOWmE= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX6cjjElR7YE82 xok+dHFMgvI/VAaflPsmO0f2AmcoySri9IholoiwM5dqUV7+n/KChMsTUS6QVpUER6zufUFV5om 1jLDPok0X2CykfhuUkJmo98sRqTEqzUZ7lQuUvw8APINNPgQKizNB4y/hYTNnAJPdpyVdD+1wZS eAVsQyqghdykTE6OE0K0sRQTALyoKz+mY9uq1aBTuo7EcO2+dXLTABsW/aj9J47Zyw55O2qyQYl 4L12BX1ZnoFvFVBq6ZYQByCO6uTHnyTd7pP1xkTWcdkynXuucIjNYr/ICw1kRMexcZUu1eiywFG IIrzUkaWp3pwIHzPc9e5Yh+Tx/yS8Y59tALNswgnkUT3PC+pduCfuJzADFwBv6dQJ2hiCmpYCqH 2pdSVfP/kQ1JnbpbjlMuW/4VN3t7etNTA5tp7/5RzTGzLGyMicId/q8fwAbX7r3bJ2XrfhVttQX Yf6poCMrJNCCPUkRYEQ== X-Authority-Analysis: v=2.4 cv=YeEodARf c=1 sm=1 tr=0 ts=6aff5909 cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==: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=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-ORIG-GUID: KoV9VSzzG3Y4UfIgAd7Bq1Y--sh6CKwh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119409175158500 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 --- 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:37 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=1795119449; cv=none; d=zohomail.com; s=zohoarc; b=SXBzfijtyCYUbxFPrbfc3jpPlZyaXjiduwG1Cf60H1w31qfdOiYKd1WL1snq6G2eqZD4LM3Xi0rU50R95C1j6lqS93r3Br+OHxN2c641lS7UQQ2Uq/ABLKY0I0wQCV870X2kS52+IFF/BRoOgFn9yEykSMLJDiPtkmtvSMkVDa8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119449; 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=igJIbgif5VQBvJyeKWr25UFBSqAtIw/jSB1/+vqsY2eMEUWafcAdGYbkmJWySHs5pED2d9GnObHqpE6S+yeBhSxnvCwysMNiqkcUO33vAwmX9GGPYBniBX6CmA0iTXDvS0MwovKhgJWsEOmvdWYrHLnlc580g0x4lnWopEp2FtQ= 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 1795119449471611.4836728148078; Thu, 19 Nov 2026 12:17:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yd-0002sg-8O; Thu, 19 Nov 2026 15:16:35 -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 1xU8YJ-0002la-3T for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:15 -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 1xU8YG-0000qN-IW for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:14 -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 6AJJ1Xvr095604 for ; Thu, 19 Nov 2026 20:16:11 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1ayb6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:10 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-3837afac185so285052eec.1 for ; Thu, 19 Nov 2026 12:16:10 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:08 -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=HcN+cwQcpiAMAxVj SE0y2rc88hne/IVt3ORnvqWHCn2UIeH25YDR6Jp95ZpkWyagPVssB1CJjLpBxYWN qIIr8Qu9ev5G8fu+eejaSIhE5OmA4UHsA96nYw8ap4NeZu9kt2misgGmZQYXRgYn 9NuUY8khK2ERStKeFAsfS1nhzhbEs/MTe5JvJN25dLLn4IGKJWc14RIfR/YGczV4 0xkMRDS6c9jr8YfJRo7Uc7ErhcVJxCCr+Arnx6U3La19X9WVnjVqb/CY333Zbwcx oeo4DwToPVFv77P1djUyTOq7iqxQ7ZNPWP6BHfdqYlycrH9vF4GMOsaky13oL8EW RVHqHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119370; x=1795724170; 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=duWZOEdaeIMOKJc6UII/ucrpmo5Ktczvzu+/EiuSCJHSjsPDBvcf6uzUscoJEH5/k8 YZ1k1sWIotP122Ly7EsQhl1hGlQu8yKD7VHhPenyDK69foJAu44UzE0SqlPYxUWN10Iz AX7WlJe4C+sdvXy/XALiIJck+Hj7L21N8kKMUKiNLFh6B3JFQqHYId1RXgqZ8p+uryKo L5m0VQqYAJ81kLWjZ/jYITJLcSYa+lW/SwtvqKnOqGSo5Sn+SxQu7qM52Md058P260lh S8076FGvdTzKHNTYH/0rQLScWW+8i0cztNxT7IipLDKC+bkzS4X5R6molukGhA536VlR 78tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119370; x=1795724170; 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=Ce0ftlD5lqve7qtS47C+PB8E9Y4eWVnY8s5ciZoM/s59C375avA4X9o20pUcvP6WkY 29lBJwxhz/OTtTe01fDby06zTaNqeBP/HWCKl30/UaacSh1hhspbSuGaFVdYcRgx2k2P m2iJEWlRA7gF5y2k6ckYJWM1SJQQzfOazXN8+5XXLIg4gWDpyajIVM91BBV+t8wyes12 ePlNIbNLf5P8vECLl57ThaHoSozsu8742YIWIaVDrNqE5cFm5VAXrUPlfJyeuNhIx82T kpOYWzctm4uieNMFQuOfmLcBLr7FFViF/fOLOrqlVxJuG/psQOLRrAVCKLkVwotXPAmf vTaw== X-Gm-Message-State: APuU4Z9wB11fvF0gmfuTxAj02wE/ZkSwccdNvewuWH7XzkSO3I2NsiIB jD3VsU9qnkVTUdsKBL+bbNvNCwCiDVR5azT8W7NGQ1MxafpuI295qvKXlsT1mMTKcjS/JPG6LUe QwRv4xQAAY9o5kt04pZ4SnhzGC2hb1Xu7RG86VadY4uCpKFIRuHwwFfVrFoCVxSq9HA== X-Gm-Gg: AZFdTZdtBanLqd8R1XwaIfv+w9cUnhj0IgpdN3QVMWZQrOP4vdpO5UC8VDyvUbB6Vhp lOfQzuLh5fmXBOYFBANBx0u31PAX37Y9IDJ2gfGZ+oq5n0A8lAxV86lgNGMHVD0Otdw3xbgc/kf qfPXMvzQKxtptY5+x/1UBDN7pynSkxy9tDLv72yFnollLbHfU+mgcotovC9DzeYYvAl4/BldWwV mFRdT3pfQ2xOJUtlR8XY744u17WzbcF7T91Z0uN2mxkqLABihEblDGlxzT2X4usl7JWqvLq/TxE HbUrdAInrbxGDBfcgMpBeuHcvQtIOWcF0tBMTZObrPcVtcb9W6il75mvZhlUjQKlmi2A7vUQe0e pzkCE5ztYdEh11FhiSkdpFCGGQ7tTjNzqayo/zEBFbl9PZWKg1svdTxY7Cn/UDKPfph5R9gyB09 E5qKT8Y8+/utkO4IQlmCGBlQ== X-Received: by 2002:a05:693c:41cb:10b0:36a:7bb7:4609 with SMTP id 5a478bee46e88-3856f65cb00mr455005eec.34.1795119369875; Thu, 19 Nov 2026 12:16:09 -0800 (PST) X-Received: by 2002:a05:693c:41cb:10b0:36a:7bb7:4609 with SMTP id 5a478bee46e88-3856f65cb00mr454978eec.34.1795119369397; Thu, 19 Nov 2026 12:16:09 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 03/14] target/hexagon: fix get_exe_mode assertion in hexagon_stop_thread Date: Thu, 19 Nov 2026 12:15:52 -0800 Message-Id: <20261119201603.2377989-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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=PcBqFShd c=1 sm=1 tr=0 ts=6aff590a cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==: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=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-ORIG-GUID: UPkA1cNtbpltGIHcnigOAkP_ukAjMWtQ X-Proofpoint-GUID: UPkA1cNtbpltGIHcnigOAkP_ukAjMWtQ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX7x6UbiXhtDQ6 Ht38Pcu25P2Oo1AiRSfhmBpW+QBoxs7JbxxvEAoGGU0nMUP5kHTootRtUBs0bGDkBjEoNH41wmx KrYWi2e6AVvWbtAGsNshX7NjgwirIzTpYONZzlImIl4muw5VCVe+aQShjs2YzSUbPRMhhRvpfV2 ayEXgn69mNOZzRJ9knSvny90Kzfxs1WOSAQs8UBEVyzUY4UUpGjF4wgGogJxDr0+rpy+biWQWSi RRPCPDp+oCARqsDcj2iMnyCXfUtEc83OO/MaDqI1iHZXcyQK18jXLVRk6krif3Nj4ZHZpJgElVl 93MDtEAfUq/Tm0LNZIQNXTXFVDMHW68+zKVHO3e1jG2KJuVQQVGrS36OYDS6MkarnC3OBqzwdUP Eg6l0HDHk/lZYkVOsyKOvVtqCs3gX9R5ovYXkfu3ScDNFWOD2n4HHzYxB5zIShpjEUhj+8lghV+ 0c3BU1HhTg/3KIBGGGg== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX8AGY5VLQRsQt ESwf+CJQeB1JcfgNaFpSkQP4NOMyThubefOz/GvJltVjSxNcuvAy4h7TqqnlJvMqk+tJsf4RRjX T8BmHVbfKjDD858i1U6V4vpIwVO8m3s= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119451392158500 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:37 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=1795119410; cv=none; d=zohomail.com; s=zohoarc; b=TX4fuKe5HMucWo5mWUT5jRXfUDxVEq8RbJzCLM8aVEV6mR9oY23s7ctkWqw84L0Akf1DPk6ax6nA4Xp4kSRcQpC9k1mCohOpGr98mkXsQoAEwCP5FU1CxFscrevsL+/J8KqkBm/AQwTn9GjjtICY/6YcZSQ+4mnWrJqVn5LZwX4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119410; 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=J5rEBC+lhr3nAKK9/3n08x8549T2VE0lbc/lkPyD0Xp6aMAGmrknmZUrxcJjxFxgLE8CUwhj+URobE5LJVU45FI0dB+fX4K7zOS+i6qx6R6XBPpKwUVyQEYZnnnzm/nWXSws9T3zUyqWkglAgkSAabEpJNPjw7mhnY3m5466/ck= 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 179511941012778.03010305722285; Thu, 19 Nov 2026 12:16:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8YW-0002o7-IB; Thu, 19 Nov 2026 15:16:30 -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 1xU8YJ-0002ll-Hm for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:15 -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 1xU8YH-0000qY-IU for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:15 -0500 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJemv93279105 for ; Thu, 19 Nov 2026 20:16:12 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27fyg4a7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:12 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-375bac6bd21so100903eec.0 for ; Thu, 19 Nov 2026 12:16:12 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:09 -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=nJ8u1E2lxdk+s5du dm5BTpyUPVNqc8/RW6jYf/r8zP4iVUjzsuDxIfZaYgoSSL+aadoTzFdokR8ylPm1 sAPRu7sdeYFQl92LfNnN1vPfIXCImIL/rRrVDkk9It9AHTRmEecKgJLRVSR/Yid5 ZpFXx2NK9ePVgUZsUbst1owmSTHUBUTMAPZFxIUYiMhJ/gytpDSg8690qH9OX+a8 l560+WqGU8+QgdgbUGXn8ZeM1FQD4rGN7lC0iGdKQJu5FAHcl3pLSsGundJY6XiA tJOC0+Jx9TfoZdAAmVOvTnc/gxZadakqTh0D8mQkOdyYtsCTEJs5p9yJFF29UJX1 dv1/+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119372; x=1795724172; 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=f+c+II89VB5M5eVx32Z2y15JM317ioiD6xtSpdQ5eRQTFDQScOZE4+cXwE/nqvXa3U GvO6rDhWix/I4vCcGCmgI/fxpGpjAvC88kZ4FvISLN2tb3S08mTn6T6bxOEZ04REu+P/ QM4Es2lTtoYbg+DnYaSPaxVX8ZwE6vA+anSHi5yFnl84RKgubPUT/1zOuLtKXVbYuTTQ 4Xb4mlV9htzUeWJGvkGTre/E90YKLohFf7MiCKCafPpnkuYsLROOaPJabCMJ00UsM7Ma OI/8e1rM8SspWL0xFiTXxr7/qLl93yaglUvVLWKR7hleJ9jZc0Q+C+BA03gHyMHLIF3X pMVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119372; x=1795724172; 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=E2MIMpYLeV+BXITMIrx23C2zbq6Djh/zxf31rZ+d0nEZQ8Qz6I5Hz5U952+Qie9KY2 aKpKYx54CjSmu3hfpFD8h5AeP32huK4+abdJl3yC+AfZEpo39aL822pPaCrHGmP1FvQE UOIV8CuTivFTjzdPWM3byOFhdfxZ/BB6GqcQ5XB3mdrlMzvAsLAx726MObMQlSCBQrFP vq5iiiKvdHaiaMwdrA9l9vlPYctWmtPCyBlB+6Uiki++SNSnjwvVnA3yfzNOraXIZvtz 8mXV7YfqJR8G2Pi/7F/WrNKtX9HGg1n5dxXjbLZTYpDVnaXRInzSadEc9DlEJJ8UQRii 4J0Q== X-Gm-Message-State: APuU4Z+FNoXT3YCLxmt9ZSuaGt2CMcAPtOzpgR5CEVRwUBhjEAOptN1z i6+TINEg7FdlbQda7BtaHVxKh0XhCqyqyuqais/rnz/N+C/+0HLLivxzlJ6lpzeBldBtC8BiSvZ d63HXILuezd5/SX4TqKK1uyNLoqp35J52bRuvKLnmqCGq0aszvhDHA5EUlx3qjdglwg== X-Gm-Gg: AZFdTZdIQMS2Z0Tl/gwK+Oy8ki+4nCD3BOQAjFa712EQNfCnz/VgIHMk5dXD1BbUEnH R8G+G2UVdL0YGqo7hS/o3aRgIae52KUyOf2dm8VRw08jF7EplAGVIP5yHxLnz2r62ErS4yr4t3M MDy5PIJQjPi10pgsZ6SCa+6PHsSuTLhwdv2m+LBlr7vki0WbhUAmL9DjknpwWGqb12nAECNCMkv 1gpiiETNZsknEUgNHAyzJxNdW3qB0sEDMqlAaqyRdJLwCqzWu4qP36DAo6z8MNyz8rVYjD4IcmS p4vW9eeounwDbHJ9yVVaiN2Ahx4krmTit6FjOvkjCWgkCo1szBSbrGqNERRKDggvDHvFAcS8KGG wJDoHM9foGLhX+SKbW7mpJSuemhGZULm4hGpzfVfUYgOkTusmR5DlQS12YhW8BHg1/GbzkpzgE5 JIwixG9QXOHTNvQ/084GKjMg== X-Received: by 2002:a05:7300:cd86:b0:36c:a3ae:936e with SMTP id 5a478bee46e88-384b398741bmr2600303eec.5.1795119371484; Thu, 19 Nov 2026 12:16:11 -0800 (PST) X-Received: by 2002:a05:7300:cd86:b0:36c:a3ae:936e with SMTP id 5a478bee46e88-384b398741bmr2600265eec.5.1795119370911; Thu, 19 Nov 2026 12:16:10 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 04/14] target/hexagon: deliver floating point exceptions after the packet Date: Thu, 19 Nov 2026 12:15:53 -0800 Message-Id: <20261119201603.2377989-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX6fbsSGscY2U3 Qw6ilCuM+7PgXOivZQCCZjNHp2DPfeFPEI5YTpBYtQYF9K1qGknGj7f46QIQQqxMc1nQ7+zjULn N5qa/g5gIF2+dYVR4uEQfp7Ey9pXs88= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfXwO5+rXQiq7V0 7phZr3J+z85Lt+wnIcDlPLAbcxL7EtFGGR7edk67HkNRv6f0c50M/+x40Xs36vDUE7/RDYicZbu U1XvK0JvkwrCeZrZQe4cV2EiCNvsCo3dl3KqRwsH721ScC3Iz6h1rdQttEwlSrmEmlL8QetgQim C94RiyzuiSS1unZCEhjDz6Dz8RqBQNh9xr+H7E9RnNYUb4bnLGJKriCh0AE1iuZJJkoBredeG/n nZDcRTraubWvXFnaIOfoHlF6wXuCbl/y1imkF+MtNK9q8XzUmBco0/fRikh6HoJUZn6nlaWFCQW NqRw6i+ABiIoclpG/4x7zvVmgzNBZ9E8bfsBVCSD6thVnwapY3neYZEHzOgsHtLvL+mkG/Ruh4J UCv8xb5fTSzQgWGFyRFuL5m6XgrkPQTfjRVDhMUZGIOpLtanCE24EmTJcMNMx1MSwh4yCWRK4iY 1n2oilU0oFPawu31zmA== X-Authority-Analysis: v=2.4 cv=GZKCDgXL c=1 sm=1 tr=0 ts=6aff590c cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=WGR0rWkjfx4cIdXbClMA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-ORIG-GUID: ptFDuHQi7RDKEsRQnQHW21CBoOCD81tk X-Proofpoint-GUID: ptFDuHQi7RDKEsRQnQHW21CBoOCD81tk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119411064158500 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:37 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=1795119446; cv=none; d=zohomail.com; s=zohoarc; b=NAD0cGZvIUpcfNUOiQBbPaPwivELXGlEbmcKk4S0Oo8iKdb0LVKTCsrqSSmhlHYSKyIwblvwRIZ9vUgDgYE+DaGxl7KZsu2Onb0hzufsYDOiV839QRubWqw6OFsjfcEPGS9Ism7sr1UtmVgLyuaLZlefEf1Z/vB+jHsPnq79lKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119446; 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=O7alDVSOwZh+9/fMZjcZId+ysro5SyOBHhxnAQJK5uC28fAPCsV91xZ++lrX+UC9wiOqV1Oe75Rzl1TOZ7y1onR0eZiCQuaPbvjjz1OuswHAJfjP8AsCTRbRb47WECziRo8MnkEiok2aCoG7umo0qf3n6h8oxoeLwgTL9MZgiac= 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 1795119446368310.9457918352098; Thu, 19 Nov 2026 12:17:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yc-0002sd-LU; Thu, 19 Nov 2026 15:16:34 -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 1xU8YR-0002ok-EU for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:26 -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 1xU8YN-0000qn-US for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:23 -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 6AJJ1k7X3148672 for ; Thu, 19 Nov 2026 20:16:14 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1yx6ah2t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:13 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-3724667bc16so64026eec.1 for ; Thu, 19 Nov 2026 12:16:13 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:11 -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=gJDJvTRhb6nJpQQU Xp4JCmA1tr4pqUDz6OIUgh0/GB7pog/bXd5Rs5NkJ+93b/ofvwr47ByySAYLQSqD e0iJ6XicJ5Xalr0zSjkeuo+hHY5shnsLGFqZIklLPIdJNISIhqVq9EfpIYuIYQy/ 6+GmP8J9Gz8UMRXJwWlczsLToZUdvWf1klm/F9pEwa/kPhfoQQiNvgXITjaX+Tg7 iCLTEQo3fOrJJgYy8B0T5HNg7iVNIT7gZMAHcX+AjoIVqoFCuKWSENzcc8lIR/8y KFKiNciTfc1WUwBg/5qzh6BAcDqfFHLE9gjUVZBHvl42rcf995A8wL1ex/9KETgC nUCpMg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119373; x=1795724173; 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=jC/bpmqF8WhHOAW/sn7RmLRmJdhXzDDGwNGLZ9edaklZgh59Qem/2TRIpplP1z5ODY W4K/xHEB6F4SMwyl9ueKU1M4wAg1quephMspdahtewSe9AUiurLjQ5g9098IFod8nSgd Wottm/bro9de/t8HMRoecGLmkZ16/6NMgTrXPd79+l0GjWU6vxdCg/o4XfjzoGjJ19Sp y4X2JsvooBS3ALGuZrySf5XEajHdCxdvML9TvqHfX/YKfPWFoL+gs0a3If+N1B8x6KhS 3ix0hp+fup6IagLVe067kS0hO4+g67oY18rfANUX3Cou4LNEFuh7yQ3TYz8qr+43BuZ9 rt1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119373; x=1795724173; 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=1X88p3XEij0GCmduHDuaqFxfOEMNoWbvKsumLb8ai8L14Cw+m9xHrYLT8ICorZRU4r Pcgfv2px4emDDhnPTZsXlzvg/0qh7u+88fiNLN/u3+n8A+o2MM3i9erUzXCU49Ge9d+2 o7sA8lk5h7uY9kfFqHaYAf26NfEH6iOdF/1LNKuayxp8V6k1ZU5+E8OgPfU4TOUZCq3y mrvUqfr8AgMkLvKgisqCX1W+s3tX1uFEaBgaDe8vwcscR5yRtHl82touHCOAzqtFnQ9O 8euZ/kMySkY/74ZXMZP4cmwp0ODQK5halNWyunRlyvi7LhMbGoHQdKLIVwbWSBlDkN84 LwMA== X-Gm-Message-State: APuU4Z/h3q0GcZnyPRq1AfQx/3gULdfRzyR+uOsthxM11dYURnPtOvvm I51lPBqYOP8lnQmtvOQD7q/JWhk0c8nJrU5jUKXXSeN1Uj4C1R0+C1k04j1qRDUKxkAwB56NnjZ NP31Ebl7/SR9/wzywfjU/aJpBaLk6BEoDfIhMw2z24wtwcPUQmFs7KjCbQyTeb5eswQ== X-Gm-Gg: AZFdTZcIndnWasmunov1Jp0RtyI6U3Ei2raeFsV1NohE3+smsWj0ag7JJu81gm8TFox zxtE1IBsyAfmYkUapyrT6kVMeZZg8PXZ1v4sI7gG0fY0lvwiLyjvy4IkrACpc5qMQoEwi/fWRCh TzR56cvE9oRWuCa6dmGA2Xbd7ri9VVS5jb4TpOuTsyvYzGegFjoO/9SEpjwza6XqiHHSvYHWKsp 8FsR/HRR/gCtDtcQWhbZZ35/G2DBmokj6wc8P3qIy9LmWISkkUPHJsH+fgSaJIYdhnVIPl4yddK b9h6L17vnVVcvBb8tsz3HAKnQW8IHN8jDrc7sgyT3o6X/4uCDKUuxQYRmsv8vAAO3gg4W8SyxjD erfRy4mNmYS81tnZAN+F6aDDYjmjcNXrclrseSRhntVCtcSj3qIxcQu3Rt2p8G5pY+1mMT40qP9 74nNArPn9KEo46Z3SoVZXhHg== X-Received: by 2002:a05:7300:6b0a:b0:382:75b5:e77 with SMTP id 5a478bee46e88-384b4a80eeemr1971046eec.25.1795119372909; Thu, 19 Nov 2026 12:16:12 -0800 (PST) X-Received: by 2002:a05:7300:6b0a:b0:382:75b5:e77 with SMTP id 5a478bee46e88-384b4a80eeemr1971016eec.25.1795119372247; Thu, 19 Nov 2026 12:16:12 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 05/14] target/hexagon: report the faulting packet for stack limit exceptions Date: Thu, 19 Nov 2026 12:15:54 -0800 Message-Id: <20261119201603.2377989-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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: Lzu4OPwk5fazRJzxMafAL5sgV6deDto6 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX7eGRF4zo54BD lnvWATDJJoV5jIwfuxWpJIueVILMsaGJeTZtcb+ViBbkJHbbzo39AKQ2efcux9UD/bndVAnKPxh gujh+eQdo4PR6GgkD68CDGycI7KL3Qw= X-Proofpoint-ORIG-GUID: Lzu4OPwk5fazRJzxMafAL5sgV6deDto6 X-Authority-Analysis: v=2.4 cv=FPmOVOos c=1 sm=1 tr=0 ts=6aff590d cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==: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=ctcHP5N1X2NQA3O8W1oA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfXxB0MrWm5JFf2 J0741eWM8BCwzjMde52y+XrXPBXruQbb89EH1kyMfnpXFrMfHM++MJlZaSA18co8n59Fu6zA72F 3zP8K/QMxehxRnuM3sOB+W4X4la1ny1QDBQAwBI8dHJ9mgrYcHrvY7AAEkLkPEbAZi7ICO1oKng KDldYVUHAKozMdMYky452AN4lYtaSTkfakLKeHAgssJ85CVF0dPQh3AO8LOvIIhqC8H6cfXKoim pJt6bifoxL0QD7CzLl0qPr5KhXTSFjaQHsjeeWh/MYdexXjm7ZTe+K2WzgWCW+m0Tyvc/YZmYrq yHRgDT7enf6v/pUkpr8moQ902x/ub1fLLWjQowNvZca4C/eYwa4pf8krmY+GbNzbKY5GR4462ct 2vvYKOm/y3YmUj3SsCPyYh58TWrWhCsCRcuVyIFxYdwS3DiWNqAXlbgGngpmdjGc6kW3Ve3slsK i4p87SRCAHG8toT4U1Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119447383158500 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:37 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=1795119427; cv=none; d=zohomail.com; s=zohoarc; b=SHQMS3Ng5L4PhYxhCf0e8Q/s0gEI2l2iYLG6EDXPxiHywwVTaLu+7Q7Ath60nv2iXcrTF6kZaqs8rz8uvUry20F230l6jo1QWKKFCbJAJPneF+nA3BzK+FcZEEQp+eVsBCznyL7gCsvTCCYfgTQ0hRgafTXkdVo0NuiwRtvU/iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119427; 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=kbD3CfT7VRy4MHLrOQeISLn1YpZM8kKeaNtLhLM2wVWjhKtlWqvfniYiG4GwFwMTQLxiJ4VUzF2DiRe2o4aEEb+W2sv88tAikOlixjhuIJY/2B/hRgxjuoq4iNjLtob36s0qgiudQTNltlwmFi9IABVKQ1H+qR4HZ8156Nl6Gm0= 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 1795119427369786.2726933264609; Thu, 19 Nov 2026 12:17:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yc-0002sc-HV; Thu, 19 Nov 2026 15:16:34 -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 1xU8YR-0002om-IQ for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:24 -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 1xU8YN-0000rA-Ub for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:23 -0500 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1F6Y3594998 for ; Thu, 19 Nov 2026 20:16:15 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j255wh139-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:15 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-33c35f5ca6cso104994eec.1 for ; Thu, 19 Nov 2026 12:16:15 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:12 -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=oBsNMTxktF5JvzJy 0FFoNmrhvUGPXrj8uALVv0dj0Ax4ZvHEP/TKwK4hVbIbxW2QrsF80wCFTirTTVVU HK7vVlr+CQnVyNIOwu0Tg4NS6nyg3awAKiwbXjSNRLyC7e99ZsE95SX6yBXp/Ugb pE5E8945sg9SZLyUh5CqCXAy0u5YcHthT7ARjq47yVBmCgoZs1pxMVVuH34E3D81 GFXSLhPdZ3OEmYWT1fIGr174pBi++o51PG9T2UFIhTF04B35MlbUkt7hMtHSBZkp E0zH2CwfSG2ehgN48NuczY272kBPXNrEQxGHCvZ7hkpNAqk2pR9AgH19DUk9vVRO c1bEsQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119375; x=1795724175; 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=Jeo9G1cm4C0dNo4eLIWSTP0as/e+BcNaFP5WNh6niQiFY/vhO+SNvlf9DT8LG80Ynk 6YTFkP3M5FrhaB61LJpZRgldM2tEnSUsQXPbpy+yerF5cYERP4Op/DY68ERZclFQqcxq sDMkVHv5Hd0QUjAoWxksRfWHH39hxxJgyLyXVyahIw4XmfA2do8yPvukRnvxbXLrsnL6 lLK4cuXFHQBLmOMDjAANQV7RglzhhoJL1rId2DQ80gTtstbT0d0Cs5p3evbkqRgem1o+ Ci1jIT+8dI0nMoiRlNJvCGAhlP+un1wCfkw2Qlczx/4GfoY/sI9DEtcsGD4V9lxCRB3S 21rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119375; x=1795724175; 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=q0uUbGIsTQ5qn1Jxll9m6OQnh1REQ/FyvN1/4TjpBnDqqKTFWCzFGrwDPYdINrz6es 9WhmFnY1SvsTcfh6v3aV3r/LzjaWP6Q6WQy5aonKmc5xlMe+V7lVUXflA0MPKuY4qsku qxHQh7S33q9YWA0/qABb/7kOkWzHLc5OtQgSmXr4eKnPtjfrRWSuafhClXJl2If19+A9 4zCTjc/cGNmupgg8gKDrH68f2U060FkOMJLRY6W1rQv3VcKf9zR+CAD0q0lqPf/COQSj xzX3tArlUj5aUBOuBWQ3QF5QEu6xOfcvyrHO3Oc5G+9jCLprTF8O5ukDLzBsxa9ABh2w VkiQ== X-Gm-Message-State: APuU4Z9r6/vC8/OLTT2WKhU4YOmkYjxps8WxNQtD3f4MfSUSGqutGZSi hceC+w6i6ts07ZzTW+7IqF4EnReG/3kIq7m3jhN+sJ3YUo4G5gid8+Ux8NIKl3D6HLTOF4OIe1p m3QQUSnc0acMy+5J+XefFo2b2w6xEDmMCvFKl0pvyWlPBq4saUekb06LabTEnZAUWoQ== X-Gm-Gg: AZFdTZdeiCnOE+msZpNSZMfty3RNNk2f/NWvVntBmDKLussWUEskJ6L5sZkGTukHrxR akOMSj0cpstulExVR67E3RKU76RqjNu3UU+S9ISb7OjXEIvPeUqdZCx4wsfPHbMYRsEgTEEOIi6 /Dc2B0ZTg74sf71VvgIsP0oRPWAEXf54PxzaB+0R69tvGNLx8bipXXr3WLdHxeIg/4CdJ8GPtJL WuDh2OXwDsQyJBZk6wCLHsnaqkHvvwMXGB7Zplfci7/hyr1n5CzHUVKD5Cb1uQhelJHpUfZRC4X kqaX8SLYwJQYtOkhPk1dfwi8URJpvCUnYN+Zaors8rDsNo3FXULDTQa2JGbNcnYkSohQhuv7Uc6 so32KDgyf2xn+O5fQhSyqt+6tBhZ+OX/bqcOjOTwhlcgXIKtikYI8Pe0CgpvH8MWCjC4WgiJBjm KV+VMtCS1D60iWQStLO3Zi2g== X-Received: by 2002:a05:693c:860a:10b0:35f:8c5d:5928 with SMTP id 5a478bee46e88-3857073f3c4mr414679eec.30.1795119374527; Thu, 19 Nov 2026 12:16:14 -0800 (PST) X-Received: by 2002:a05:693c:860a:10b0:35f:8c5d:5928 with SMTP id 5a478bee46e88-3857073f3c4mr414652eec.30.1795119373847; Thu, 19 Nov 2026 12:16:13 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 06/14] target/hexagon: take exceptions for cache operations Date: Thu, 19 Nov 2026 12:15:55 -0800 Message-Id: <20261119201603.2377989-7-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX3BNFtDTqVVwN 6w0NjRO+C9yFJCqmq9e/U3AZxs7/TWd/2K4p653hOK6idPn32f/vFysBXtfrmRE3G8itzI9rqRS 3Imr7b7QOcya/OEWIWC+c0+JblGpbjY= X-Proofpoint-GUID: aUYXR0Qf5uh_RL_GXYyXsaAtJCUwhVkn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX2SeShfcLuP7H jrLihucOkMSE/GmFiIbQr/RYIYaY48wT873qBkGlb+nu7bNEbM/Y+PsZG8r18v8mr+EC/uWBIQM tsRaQBOF33kq+IqVhzJPJDe+2KW9PHUJhrUf8cEVH2LM+vovbIdb9EyWdfnDSqtC1mzhoHhY1BI 7nplBkZntmJBWg6FifT09uFb/sLiA2/ZC2mVrtd0kfoWppa0sxDAJqpUllX6b9V5sMkyBe2Lp3B c/HeiRe3M3OuxjJxItJOvtxt2jwHBVhfbrGCFK8KuqCxwGaeGEcxsW4eMX68OrUDTPBNZbhk/4N QN9X44HBmHGT2RHsw7YMlrWgt9x7kM+sB2ofs6tjNI1tVSbQKouCiVVaFOr65j/A64Zztnvy1Mr eJYAbFpMQ3bJmZ7dv9dwo80M5+qo6WlFzk+IUHbb1RQKXz2gTv8Rv4tAnuaSufC+vdV1+WwDKN5 b9jKFok7VwMl9GhZ9WA== X-Authority-Analysis: v=2.4 cv=da0VTnXe c=1 sm=1 tr=0 ts=6aff590f cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=7Y3dZtSKsafMCO3hotIA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-ORIG-GUID: aUYXR0Qf5uh_RL_GXYyXsaAtJCUwhVkn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119429286158500 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:37 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=1795119475; cv=none; d=zohomail.com; s=zohoarc; b=j/UfEHNwOOvhEzPOtJ5oqrNiblY6rxhNPm2nfZtXaINRv7eV5nM87SFNvdAkY6OG6TLVNZiGsZK2XRc3kd0ZlJ8TAkfBqyaVkpkGIgBpJoK0yFi0rtS+Xaz1qIwavOYRG5LKoSIc8v7EfH4AB1Ls/Dfl4qtAYcMuea63V4vKgYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119475; 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=gJfdVccjDuGG/O7fDVwm6FmK6ZpWT2M9uEz62qURy19DqtU4l6cn6sY94h4AhNdFrxWtr9XMD41LraW3Pl9fNM+FS7GP6fPj5jYebDZ9SCmEzsEikOfiK+MiiQIz4L2dPb4+H9JqSqLEj3DgxpWN16sRBlncSW2IT/cSZ4uSc2c= 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 1795119475211277.82470076156926; Thu, 19 Nov 2026 12:17:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yh-0002tb-2y; Thu, 19 Nov 2026 15:16:39 -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 1xU8YU-0002p6-35 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 1xU8YP-0000rF-JO for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:24 -0500 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1OdZ3814588 for ; Thu, 19 Nov 2026 20:16:16 GMT Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xc6u1vy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:16 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-38131260a5dso296525eec.0 for ; Thu, 19 Nov 2026 12:16:16 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:14 -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=Xdfq2j7rUef3Fpna j2Csxc0URkhz8jG7fn5kKJkuxnbvxX/DF1NXqDx7IB0l+0ePJtykYueDrvKIL/rd OvZuPSMiwfaGrKVuGrLnLNfDnoxNXPgdtPVyCPGi5AtWQboL9nlBozJi5zzhY3pK 9ZntwmhPz+Qap13dHOkD9YmZ6Zfzv/8wDhqp7pNf+q65ou9U6LTVie/SyZuhpfgk 1iMmshTCI1C861jjDzk/R7BEUNM30iIq3kHf5ZO4d1SgXh/q2q8PLJ3B0+O89LYm qGtwN2vX2WT3jk3BVWwiSLu+EFIq2F2lUxfEdFkldhnjh1Hl4E5E3QpG3j6tLkUu EAfNRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119376; x=1795724176; 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=GBZuBZcKDNaBAANqjMnbbTzPu5Dicf6pKVtM9KM6Q9Gz0Szb3CKZvMnlcXuiId+5WD xRqkrZ72fAMzzVd09XTEvMKxScKNo+ITyEBAgjkya1uQ0gk3FoonPuq/T2GlIYLgS5tX frqifSDo6HSpP8d8QIklP1H5f6zgheIGCl4+Om1A26awq/6J3P7R57dU68PdcU6s+kG1 Wv7WS6dvmjU3zqvIiimT6QOTA6pSUqpws/PcNUp2JTyeoceKEQTO+XV1dEjvjSRPQ6Xx 2lEDfoXcrmy9QEaU17pabwJtwwxcP4K/gr6s4SeDbrhd6NZDOuyNp7Wphas1IGZYFQsn eNcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119376; x=1795724176; 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=vM9Qgg+ky3ZdHGcYmcQbsCmgEcWplbRgshbR+T9dhtZpu41pSEOsK/rKHNK6LAqYye cIkitGZOkgPyZFRpAGhoaIIfFF375E0h5TV8kdsju504Z8UAczpj164454czyGEAbQMY HqHp9p5o6fLz50yGguvx/WJGioDv9jqM/3ZfKyOXHDQF3EekJx4NAmsgXqXsoXxD59vv EiSa4j5yL6glXcNUmqkeXyKtCbnaLT2dfXbsagN0EVfXnw0EXh2ZHm0Smofw+FBsHEiE +3/LR8Iph3GeYNn4Ma9/sH8l3VBt0xsOuG1JStXwAKeElHLC7nTAmh68YdKrX1Vt3tJg bQnQ== X-Gm-Message-State: APuU4Z+dBTw0x+Cvqo9JqeX7ei5TNimiI+70U+XjqVberYAg2stm8uVp QCI0W8Z7BidFNgJoPdewdQ3Zl+rgOjqet6zOJKTfoW8q+ScQw1NvRIQE15rmi2RQr3h39VSaol7 SrGE5Qqxw31Rq4E4SIrkzc8iiA3kv7nVHKWkwVtMf338vxwAYeMmlL2iAi7nmXv4dnA== X-Gm-Gg: AZFdTZchuIBPJGw81CTA1xFKiq5q0r5dU3lUb8oJfuG3nsLTBu7jWK/w/YnhzKxDRV5 I//+fKu53cu3AHOVkamBE36h/MSNIbUttEpNFavPOM5aaspu8od+agBc3l1xqf1AhzAf+NeBEk8 hTP4p2OovQ2U6nxNYie0fUhTrOTpQlvDggMQRct/SKeu2TnIxQ2G9W3BZnve4ycYmJ9wPLElj2z 2nLQCRzoKKL19waAONNcLkdmw2+YioPxm/ksadmbEctDf9GpDAi3J/VtIkw509EvigeXaSgsAA6 y9LyJIu7H2KPNn3cmg0jIvBeZzv9eSQUeZNT3pSkxAhr84d+ekqt3/J7JxjnIag4ao9W9qq3AXk RbvpEGap29FzbYFcvRhZGG3N0O8k7Dc+XNKEPDvKsS5BvWGRVBIbMf4+sbuoOhtNppvP9U29sJw UID75dv6/JnnJtMJulRzAhyA== X-Received: by 2002:a05:693c:8083:b0:377:678:2309 with SMTP id 5a478bee46e88-3856ef47a98mr463483eec.15.1795119375960; Thu, 19 Nov 2026 12:16:15 -0800 (PST) X-Received: by 2002:a05:693c:8083:b0:377:678:2309 with SMTP id 5a478bee46e88-3856ef47a98mr463454eec.15.1795119375364; Thu, 19 Nov 2026 12:16:15 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 07/14] target/hexagon: raise decode failures at the faulting packet Date: Thu, 19 Nov 2026 12:15:56 -0800 Message-Id: <20261119201603.2377989-8-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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=ef+o7LEH c=1 sm=1 tr=0 ts=6aff5910 cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=BJZ_eTHKON5vc81CckUA:9 a=QEXdDO2ut3YA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX2/z0ZzgReFlH YTkEQORVKmYwEM6F2a6cj955JWZ+uugdFOcTS3RHMgGQn0VYKBiOXqdGtMeYft761+XopGi/yue TAfCvSFo2q4gVQ+3VOoYrmpy7Am3djbFRySJE31moVGAlBqOsA1VBb0ETxhgCrA1mNPUK837RER YPPLGpzFJmSLMvlCVhILKX8ROmUvMepTYUqluaObLLSJsbsLR6NvDjy1pkDxdqBAVMi5KG5T3F+ 6B2hjVm09GfPRNZyGr6BXbdRj/X2eHgtl98FjFdwWj6klT7ReYT687PP4vdw5JTd8ciKWUAC10I qPML9y834hVovCs2t3qqOOaKkrzN6KzYnv1xAWRyBPBEgZ9FKBuLecO9nLVGfqd3AmPfwBrGqMw vbL1xgDdSFPcRVxrAXrfJ6B38unEt0E47Y655HNzRvic8RlqCjJfsT5Iy5bncxm3SwQwJIh6GvU jTOqvELzBvkW/uvFQgg== X-Proofpoint-ORIG-GUID: u5a7RYmx1c0x684hYdloeFveEMj21rpl X-Proofpoint-GUID: u5a7RYmx1c0x684hYdloeFveEMj21rpl X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX57VaVJ7KwgNM JOV1x40JOiJaRB4/rMI3q3Wmasmk2MdHPJCogjPFa3Ek+dShCdKdEKVWphRYjYNxddQjDnlaGNP UHGyyA5nMO9KU9/Nu5nM3WVGptSFfUU= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119477631158500 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:37 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=1795119408; cv=none; d=zohomail.com; s=zohoarc; b=SmIOJ991/iwTUONBUHT09FEiaRyqnbko1j41gNv3IFy35HT0ZHEq71seX9FPXgkbeSI9aiSyEGZ4W6N5u+/O1PnmRglu1jXhtmjvszNqC2pldCdlVHRTud8SQ+JGCv6ixZJ47DEJbcd3hFDEcrmjbW1rcO1pXHJ2kUhKdGcg8OE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119408; 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=RZ3IR3jzF6zhVIBnWelniEcSYfWJHO50VwkNXlBTX/hOTaLBir9r4APNZZLVWJT+Ug9EzukJnHVkGWno7wfEwTEKyMDVH3Mdoa/GuoaPfa2An7LPrXcH9K/vsuZ/6pSi0mTBiS96cwEL7FkRoDS6h4yt/TzbhNPuJIN7/vj0VRc= 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 1795119408837688.9401757591478; Thu, 19 Nov 2026 12:16:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yh-0002te-Ff; Thu, 19 Nov 2026 15:16:39 -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 1xU8YU-0002p4-1m for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 1xU8YP-0000rL-KX for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:24 -0500 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1DYV3594961 for ; Thu, 19 Nov 2026 20:16:18 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j255wh13e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:18 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-375bac6bd21so101038eec.0 for ; Thu, 19 Nov 2026 12:16:18 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:15 -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=eVMzjm7vIDX4IkNd KcqkdBB+fbRZl7BHYFOMRfaGwI+pCXiI12VZUHsPXkxJ8xfyhGQA/6HGkOX90Xnv xRf+dRHRsb/0OpOi1SItnfrenTyRCAckS5ndVZGiTNCe22ubV6bOQd9zS42TEyzl hnLxYkrpbX7A1/4jWksBp3mkPy7H1qq/hmyG7uAgjSQrUMhbxMPXNcwGRkypHvul pPx8nQ+0PfMI3RX3LbeOF7uZ1tQXE61NcIWM2Tjo/Z9U5/FzcXDzXf50Y9GqGEDg uvezGqQoLJyAotug/Zl01alq6+Sohr3jUMq9HPt7Dm+ps4IZBB4eQHfsN8+SF4Fg OdVniQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119377; x=1795724177; 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=fNXmaiGZoIIO6tm5NyZ+Y4kjOmG1pSDFfP0vZ6dZ5YNIbXo4QHXOEkn/OGe4Aw8iT7 k9WBx6m/IojnEnh50kks9jPr2AE4nGDl0vYRPi4HI3N3cfoxIlMqgu7kyN+R5nbPsZFa lpalSZwfeNEwdHa/ROZ3GTM9V/UwA4kdhJw0SdnpUjIgDmrczfVCmTBb3yKalr6vBpN6 FQuCoPl+kDfQHqecS5v9laWhQF0p+GsV/hje7lH76QdSfuh71yk8ewshwj+SkNU8+N2O tzmYb7z3kh70qZbM5PpPlugnKCCLQTDzWFvEPwrh5P2QNm2UfBeTqtmLbYRs3tAdeaBu gr7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119377; x=1795724177; 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=XT6nD+O4C3SZTqYWG9FDFGSEu4UW3lmyEE+Xsa+95r1fFahq6D5eq+CHu6cFns4mqS iDdBJ94AqAorXRveGiH65si5/C0PH710z4jNmB36GlwECEf9877xbGBY7QVoROhhmgBS 2ukW293UwrwLEG6/y85LMd3tTUTgKOg5Md8d1ytNERaPOFjevZZmSEVek4qs0MXU6ZuG ouRWaWFjMkc+gQV5YHKDttwoZRa9ItGcTPCNET5RSseHtKWVSL2fIxIOjl/Z1TVIDqTI qeI/uSa4w+QSqCjRUvvNLOsR9NLI0q7Oj9IhcWKfJewnO76xf9UZiPRbDsCH3Odyjt8g 8tUA== X-Gm-Message-State: APuU4Z863eUIcCEJz4TRWfWFeilyl79D0oBW5pbJBYtDsjNACrOIT3B2 a89yLJnUFKzxtmJMhocM6jXDkT8BJp1K9MOASWndWDyuatF53TQ98ZcNkdQ/EWtHTCmDIvpSOT1 xBJgiwxC6kzRluqBq3qqymkxgRWPj5ZWRWEnY8/ff0hE33dfcfX/xYSlFNfZO7tpr7g== X-Gm-Gg: AZFdTZcIoSxeqSQC6pkXMJA+hfrdQ0yD7pF60sPpVLXbNufY+Dg4m9R+1MuQ2/AIyYZ SoIXhl1ltdKxZWtqoIk25sEBQPY8ISsCqnnWQN5sQB7TWSbgV413CASC2bBB+3GMDPVp3Hbe98l jnBp/I6cT0ud6lDBwAaXoptTu6jDmggW+LlIUGSygUzlNaL7hcJLy6zFPsBn4/U+ECQ8/4K16JN ZHDEy7qtRuCYZncOQHHrT/54b5u8Shpdt1sjq3h7+Ugf7EOEYjTWK5vVymZURS4kwHTVBQAR94V Lnd1nxhzIaxG+aldiSg/T5tEarTj1J/+tUXbPyKB/fBATyrKBCNMzYbOSSjQWzzlKbVFUIQGdFO R/JhY1q2aehHDyKNC/Ri86Nbdz1gWU/NIOhdVFMmZ/T8ABRN3R25civo/uD2v5i4ylOtbWo77y0 DHoMb/lx6deeBzg1/s8HLRKg== X-Received: by 2002:a05:7301:2b5:b0:381:120a:c7e6 with SMTP id 5a478bee46e88-384b4a80ec6mr1926962eec.26.1795119377466; Thu, 19 Nov 2026 12:16:17 -0800 (PST) X-Received: by 2002:a05:7301:2b5:b0:381:120a:c7e6 with SMTP id 5a478bee46e88-384b4a80ec6mr1926932eec.26.1795119376994; Thu, 19 Nov 2026 12:16:16 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 08/14] hw/hexagon: update the glob-reg vmstate ver Date: Thu, 19 Nov 2026 12:15:57 -0800 Message-Id: <20261119201603.2377989-9-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX/oa5xfUYWhaJ YMRATuEgmrA4Blb4Vc9B9W99ZT/k0Dv1Tt29ZwONgaOv+ZYle8uKhtqeZpMOpd1M++mzWpxht76 MChs50RNvfBhmdvHFFlsFpHpTjhzfio= X-Proofpoint-GUID: fYEGqcFTk1oQ8eS4a-n1wH876WwIdp5- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX53gxRi0GMTDu Gu5pHg1uLp5NvgThuWUzQvzCmmie/QKkFl5jaG3slW+rqjp9UQ6Rgw/TlTMMKvzloqIxo/wDPCi jibGV6Blm+ZgsXIJxBnLCKymm2ov9N4f31yEFb2Zf6WHESqWiRQbWA2nn0zGF23s/hWi67SIMsg gYbQTNNwXlkjM+W/ZvaDWkTjhiuvpsUCAqZBUZZWF6Za7uR8BBmlfpuIMJ7XPZnmJStHan2Hj1O HdFlxfnUzZ/X8CLikObmsmip9FhvR70eesHpO0YkT2F7ksHjeW7EuJnnYh4bwvNwqSfkE4WjarW wMUi9flktZ/g+NiOYZRhF9vn03ep3nmdJ/VDqSNySjEAB11QxmVrIvgqF/G+uQhEa5nVTbcW1sI XL1uh6s/1AlAmtPtdyHstfcUJQhS3ewWkHUmdrhNZ4I9iYz69Zw97lhxdwZ/pIFjpK2QJKo+JjJ AmZyAvyOCnlzV6YF+bw== X-Authority-Analysis: v=2.4 cv=da0VTnXe c=1 sm=1 tr=0 ts=6aff5912 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=yPMIFQ6QiX0x8KKfrJsA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-ORIG-GUID: fYEGqcFTk1oQ8eS4a-n1wH876WwIdp5- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119411018158500 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:37 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=1795119461; cv=none; d=zohomail.com; s=zohoarc; b=cBWPM+S8g+ULHOl9ttE+5D6hcP3qReVynz1biB2MDZqFwwZPZI3KJ5w4aFxolyeQeeUVH6WBFbddGcXducRWzurJb23r3rzKRX3RVAX//xhj6Sky3Ko1LlR0ws2PrLYYIZFqIRwbuEWJoK97VfmE1sNVTIE/Sk0UYJnNsKwMNnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119461; 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=nojUDYLyi7fo8yZLF5dfv600ISL11+U5hc7sWt0CB5DcTzkfOGxr9fhyqLHW0QZEW95lbYwxdfXHoqfhAAsU/iJWfbGOGcJ9vp5ZBxiBEzAi592zCCAxkPqDVOJrkbfH2EiBoqyOShW2xDrsdjkD6bho3JbLAoDnY7AQxK0T7yE= 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 179511946120510.87720454337341; Thu, 19 Nov 2026 12:17:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yd-0002sf-3v; Thu, 19 Nov 2026 15:16:35 -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 1xU8YU-0002p7-S6 for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 1xU8YP-0000rf-Jh for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:26 -0500 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AJJ1Wi63814722 for ; Thu, 19 Nov 2026 20:16:20 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xc6u1wf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:20 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-33713e5e6daso175195eec.0 for ; Thu, 19 Nov 2026 12:16:20 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:17 -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=giJLORDwJV54VnYc R8s6L8lb+oz4gzaQAe0q/IxAAslJ57YR9Al6f0HW4TskjKqhRIhpfrq9MDqxlBZT 0je6nZuxWgWAkuRp7Ilpjd6VHMtPz4n42Ap135Zj+03IWMuqiCXnLMrbterNUDXQ 7ngy8B4TpDVbd6QN5YJeTDdEkGTmkPFL3zNljQUdcjEdYuTxXgdK7F7j9TidWbSb Spr3JiYDJVv7x2TPhAOc5Iui3kZNWDO1hOyhBllmzUulUui8DrphRd+1fmeferky Gyl6bMLnr/YfrbU6g6oIxz4TZ+Tlf0MDasQyYzGgFkNpcnes+zVmH+AwxRrrbW0/ t+WXxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119379; x=1795724179; 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=IbKtnXxqMmzlk5FByMRrUTW9Jb/PIsLL+cBzeUwAgN7se8JWcSENSD5AbJ+Ia3//KA kgqkn1KT6xC4YwZHSfErD6WWrimQGY0QuSKO5OjQp8yvMPMj5kYr7nqebhac9HYTRxwA 44eTFIJANF0hn/WsPOs7cd+TeisnnmvPSQcAf16gQdRAyhdmjcX//cBKenPZX25sdbbv JqKJOcwfwlsbNPrK7THVU8DtkYfOmSaUDRRy9x6Y1+rcThApMsTxlPI0T5ndQMxJ9rMK TiEJW1180Ax6j8nPq2V3DcjHvoPcKXTgpEwav85cNt3QRVXsd0MVKYGCD+rvlin+PUo8 Y8rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119379; x=1795724179; 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=1WsfdyDxm2a0YebhrKqbEDFaf7Fn589NJFv03T9/ePOt4ZyrJQIvF6B3Rbw+QSYPVh 6tZqotpi0lKFtm+xCc6gmJIn30Zh+MTqMROVp6MklUuwNIFAeStgNA6K+c5c9anyp7Sp 8UGZcmv89Ui2BSKIP+qaUK6kkBO5wbT9ezfpMEbiRGi1rL4TVQ83q02NG0d+OayYLnE4 R6/ynQ3aQFU9yIYl7iReTZFMblyaXFFv+jq/+d0jBB9UxMwQ7UUgdxW1azRQLJ+K1nzH MeHlaVctG2JZK9DbC1jegZdQeiMEkk9XnI86AREnxqN2UJidc9I3dXQrDAfLIIlVjres CpBw== X-Gm-Message-State: APuU4Z8uh4DK7vQdNOJ+EqJCfSOkcv8Xg49snB/psxHRNWrlt+V4tC3Q Lwf25MhHW6th2bMbbJVzJpq1kKyNP7pxI4id92YNR/ad2+2T9Zu8Ixwtd0XK/ePY3bNxHpHITp7 9+28piqe4IKfdbzUw1L6/0oIFidJsB+pJ/VQemiYnj6lxAy4x8GwKndCTMY5HxTmCTw== X-Gm-Gg: AZFdTZc6Vlfuc+7eftKH+H90wYBN/vuBcrbmA8hC+sfvetoaKIg1X4FnKIg9YnftzV3 sBNh81CuM0NArBKh+S0C+FuiWR6adQstffO8/1qUrXc6TfKOYsxPgWwaejgoOvoQjDS/KhYks0u w15+TmTDaYbsPhZGqHovdfAT+xivJSC6Uz0a/KkLzqLTPRM4Tcclwk/A0wLyk3v8E0ul5fzAvaY TDT42axq1JPtncjoeNgE52JZxVXLIsjoRSt0pylBo3T6jX0F3GNxltWFf+vublMJmjr6L0RdNNw AV5efJjIyCv2tw7j8o1uMosT3XoDvuN1FTV1ksG6W/oz+CHDI1sb7Kh3ZX5gkpXj0U9Pvre/IA2 0KwgRli7GdGJk1E3s/fL5Ao0CQjvU5nNa8NaJ1WNAXN0IZkVwNwcFj8iFe+w0y1p1x8omEYRZ0Y 5R7KJ8oheOaAikhU+gBCPV2w== X-Received: by 2002:a05:7300:e91e:b0:384:2780:8757 with SMTP id 5a478bee46e88-38570a3e793mr437988eec.22.1795119379046; Thu, 19 Nov 2026 12:16:19 -0800 (PST) X-Received: by 2002:a05:7300:e91e:b0:384:2780:8757 with SMTP id 5a478bee46e88-38570a3e793mr437956eec.22.1795119378272; Thu, 19 Nov 2026 12:16:18 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 09/14] tests/functional/hexagon: run the rest of the tests Date: Thu, 19 Nov 2026 12:15:58 -0800 Message-Id: <20261119201603.2377989-10-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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=ef+o7LEH c=1 sm=1 tr=0 ts=6aff5914 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=qC_FGOx9AAAA:8 a=5vFef2XoAAAA:20 a=EUspDBNiAAAA:8 a=yf9HDTBqmzeyJE9Vh_gA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 a=fsdK_YakeE02zTmptMdW:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX+tOj5T4xMN8b UdLoMwTcjPTHdR3N9A9KBn/D9oobG5cGxrm3e+1gbtu3l5LvV+j4RqciMf2/jpjSC50BFICkU6m d1DB2Mx/lrrxoxdzLJxnuNuXnQSCARDaNWYNVeaBy+f1dt1Qwo4lmOUDVfcivf4WepzTp7dsQgH oScha4C4Bmt8fahYsKPrco0YyLPRWYFTLIHqXx7RYSFKmLcUKP9wqfelkAxumbAfHfYjq8o8MEK UYUDXkFcJqcHnDgFopL0v4MBHdNx+ct1IBJFe+PAENB94BcwLLnyXsWElxS+9tMNUG5gsQ10twP ul2jpcxZYG/j0vIKPyf4MTE+DtwvpLrgIN2thKWCzhCu70rqOZQ6qh8zrMtAXj5eug1GeR5bK7m U/ivnbEoaS0oEBQybGbHP/xMNqc0PIKFCIyuOEkUMwy5xkMhrS7bLfFk2ZcXRCnykdA0dX91Lnu kO/i5hl/of2FbXDWp0A== X-Proofpoint-ORIG-GUID: dWnmndXd4oYGWBYrpYGK75Q3lnkUblVz X-Proofpoint-GUID: dWnmndXd4oYGWBYrpYGK75Q3lnkUblVz X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX6pECzZmOM0dc bGtqpgd++QaOLmf0XGLhjOWqcVECTuXaa1jApW3/iHg1cFTOvskt1DhqRIY7lkPIMLZAXZVO4+t K1S3c4N+LENb03eqXzVtdvQSlzjXyIA= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119463753158500 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:37 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=1795119462; cv=none; d=zohomail.com; s=zohoarc; b=SoPhTcmLQ/bTDAPpnmZ5+HM0VAc8vxFKe7HYEOz9/+fviYEe1MyFdANB0ry5M4iyAV/EzCstMr0VixdlUxhifU9d5kYKRb3l95L5tvpzw9UcnH5pl5aFwxE2PcSVU3fMmeSXI6c43kyB9mzWVqV2e4+v5jvjgTr8w9WhBHd++DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119462; 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=QDREzxO3SIdxpGzvqK4HNqStRz81W+ai7fSBL2IWhmt1hdHR5TunI0NmOpVV2qN4nZ4hYn+iqXH2G2FvqBUDRBMJXIWE8TXehU/bf06HIxwCej0lPAqTDzvDHtb1wO5TpvlOXtAnJnubP//8FUe4Vul4pGR5mgMvwOmx20T++Eg= 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 1795119462273277.7587651229177; Thu, 19 Nov 2026 12:17:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Ye-0002tF-W2; Thu, 19 Nov 2026 15:16:37 -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 1xU8YV-0002p9-9I for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 1xU8YR-0000rw-LX for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:27 -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 6AJJ1Xvu095604 for ; Thu, 19 Nov 2026 20:16:22 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1ayc2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:22 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-3846d5f54c1so114391eec.1 for ; Thu, 19 Nov 2026 12:16:22 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:18 -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=mIhRbcunbLTOY8hn FGOKqmtQZkJqL+cXK5x57/ww2/S7s12Fv9hfFl1Knf5I+jIjPwFYfnaHJb8huNfm BeKZDVh82uUAfwvexHRVru9spkiloWO5b/t5NqIcAHMxS7HlvS0DwLafUQvdVR02 BPRzjQl0xeexq1Di9p6Mysd92hPg3FcmXXTmYSpcaJBlNsq3ucnq3Dy99mgtnCta ScS0yMJaPeJrBLozGKmeXWKBhCufIojci/mEGUlGVGQRa3LS6n55lnk5clR0EwxD Va4LPwX9PI0suzf9L/Pn3DkYAx5pA4rTlw8Ip53thRt55nQ/1LTVydDxiAvYd1US 55PdQw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119381; x=1795724181; 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=BHAOWGSOEhbN+fDjmU2vQsv8OB9I+c6I9MhrvAeH9ko/9t8pUIZJByldP4cqiUR4FX 0p/Cs7zIqlvlPtxb1AKagUUNfHiRV2C3MLm3ePIRAk8V86JjXY7810KXNL39eLEPDxhd mqyb+G6dXzLfRGNlE128l0NQPgwoLOcFYwoDr9Oxc74042ucC6NNx0b7BSMQ+7HTQJRn 1RLcbwIHKlXcI0vkQhXiWEfW52rjQLIueCfTdHS9MU2HX4n580l++jVmEDaIjpJOM2dl H7WFqwQd9NzKwhHF37gJtTVHPWDl6mzHU7dHiAOY2/kTscDs8zJZT3iqcRADlxqhZNyp kAgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119381; x=1795724181; 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=qwZqYdgbHub2a2EHAwlBJcJAtdTM4IPYtFxu7wfV7gQ/ui0Nggzy65Q6bqt92sqtZj IG79E467mDJKFNYRicUag17ddtZBoEB3CSM+Zfl8/m9VL6Z4ud4dnVF/p1qGYGnTzEDn 9hs1eASVsyg4XiQAOFuogXb3O0+SwzhHpJWLgvvdTdaRKvRvZ3s94/wAshP5Z6y6O6tx WEVfY9Sbaqri4zoa8Y9Xp9cEDtk1Dk735hixp6A2kYBluFaOfi0xkivDjZ27C/vrknEa DVw8Iv+rm2LnHRGX8mW4leGcz2iWs2wJKxMef9fwHDDXuc0g8Uka2X2DrEpGHzwk+0Wn PEHA== X-Gm-Message-State: APuU4Z9Y00vub9Bc7CAj+JzYo1nOaAY2JJkjxYTjdu6FW8WVb+X+kmxY tV5bMw5qJEm1VRH/aSrye5q5IDZs412nkGwPIVtE7lROh++wQtmjEbKdjId0Ixw/hH+2pM4Dtk1 6LSQcCb6V7R+GJdkzYOq+8d9fj6GHmD2WM3X7go8GwAD/E/AemuwSDx0scDqHu9dzEg== X-Gm-Gg: AZFdTZe/VJT9itXXJ4WdomMZMgKl1fuekr2uTdyC1iGqjrcCJCifStIcP9dzXDV8rb5 B9zpFX5/gFGuSh+qQSFHT9qi8O8O3mNGfeFj92gFo0NrbBKNKc0vB5s99X0eQdGBX1FTs6jJiA7 9AXGCTaYNvX7+Wz6o30OINiVRT37LiuXw/eyc5exKHSvrWuVz3AGj/OYdLMZ8u9S0dbArDVfocq sA3yMT2ID77SuEZZ0HI1zIwY41tS4fdV3a9qn9/VD0dKZe6a/w3ZPX005bG+WlyACQK3qI6I7qd PUaAWrVt/Pr+5FtrfyrrCFLxe25VV0648Dr5lVDRk+/7bcSN4oE9/+8BObZZrXliBHUrR7UWOQk YWeX9BIHPw0yN83OobLQ4rAofzRp1x08S2p/AlSFeKEvm9+fzNz5/Ur4EL6TkbZqSGii750SzOL 9BRTE/Noc/HdZzHD+6C/TJvQ== X-Received: by 2002:a05:7301:c0a:b0:361:1dd6:531b with SMTP id 5a478bee46e88-385708450a3mr329812eec.26.1795119380694; Thu, 19 Nov 2026 12:16:20 -0800 (PST) X-Received: by 2002:a05:7301:c0a:b0:361:1dd6:531b with SMTP id 5a478bee46e88-385708450a3mr329772eec.26.1795119379690; Thu, 19 Nov 2026 12:16:19 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 10/14] tests/tcg/hexagon: packet and COF corner cases Date: Thu, 19 Nov 2026 12:15:59 -0800 Message-Id: <20261119201603.2377989-11-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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=PcBqFShd c=1 sm=1 tr=0 ts=6aff5916 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==: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=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=nRz1P0UM28cUN3eQi-wA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-ORIG-GUID: oroviqJOjyBTtU20PVqRedqcoBWVxy8r X-Proofpoint-GUID: oroviqJOjyBTtU20PVqRedqcoBWVxy8r X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX4/eFiVqhi2e7 W89Hzbs2e3rRoKs8S6VNDcQVWVgmRG9+G4+JD1vLD9Y3umncjABpDVlIhGfO+hpUmYZvqeuuW5t Gek+I3UTPDXYNXXjT6xAh0qHWUs+iPt+CdAVpwhAJXb1q8SHuHPuWKk3lEjESnr8yz+RImgdpld FzKjNpLGvWx3RhT22KJA3f/7BT7hbgvjrAqWFc7SPNosobAxl0k71ozsPNkvfy/m0ZPj6w6YYw0 BGqsNLIgMYHxisKZz0nzhAZmisTDHLAMBWlmpOzIrXw4Y93HeP9gsqvySN3QgbK3mpsYcvDHbXm 0eUu/VqCxLYC+OL9zCxDWSBWbq6c58IZTjxLVa74WB3uty2H/n9NuvTn5gNba1FSeqQx2SbSis7 FDP6XjtWEzlKof/cgS1RRHD1zF5rGqYibSaenD8Wf1Q1ZFcuubi5q7T41TRLj9eSezKRgkuLd9N 5yEYPXxvQjsBLQTG0zg== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX5FhK2rMdipGx VcStSVDZqnqRPun2cw6oczBRd6vjiuyK4tNuNkeAD7aIBKsNHMBW72qRomM831db43U2A5eJLPO cmDNNH2/94pDbhgctTUJYIuFl82ywDc= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119463737158500 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:37 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=1795119445; cv=none; d=zohomail.com; s=zohoarc; b=WUTgMoI9RqMKIUaUCeXNkcTRUWxUzPt8/CfY3TO4L5H++v+w+VEuwGHgioCVJ57FPLelJCfLKnsbInTkUXcvR+NabYCS9ib3yVZLfCmWDVPsGBKczzU2Cv/mRwkzsCqwHdacIJmxfEYOaborD5ycfpL5+GwhIunVkw/msIDmBZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119445; 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=VLOARMJGO4spZVoQCUm1oqPcEtDwyYxUaqkTAnqWIagVtGGD1eKjDB9gI/Hz/sIrYdl5UhykwkSHn/XAc/kU02Q5gbAGDTP9uZmGRaws+SFPoHnYgJUiLnfSMKFHnYyA/w1Ssox0Z1vcGPdNxbq36yktRwqmKstV4mXXR0vK8cY= 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 1795119445741943.5654434944887; Thu, 19 Nov 2026 12:17:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yf-0002tI-FY; Thu, 19 Nov 2026 15:16:37 -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 1xU8YU-0002p5-2M for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 1xU8YR-0000s4-Qy for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:25 -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 6AJJUXqH3367488 for ; Thu, 19 Nov 2026 20:16:23 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j27b5r5ve-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:22 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-3837afac185so285685eec.1 for ; Thu, 19 Nov 2026 12:16:22 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:20 -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=Cm5a3nDXYhDxtu+y omUFXXe23FvGg1J7KHpJq5ebmWso66la4qI0nhAS0q0QXpA+baUQTfcSOivlFhyq fXXVFPTxfO/bPSO1sMC7wcgDpLfIysK6lFocUZETHdpfKR2kyljJnWWgYqsU/RsA 01t2AGRGL7N/dxW5ENoyJKhcrpN09Dh4M8lz1LuQLqESDOisVgmxjIyTbNEsgJQ6 hSp/mEAM6VSLR0ZVbpQ6Bo8KuCoWttC6NmTmKkat7dQZ8A+uB9yJgV1cXuRYO438 N/KoqCjXBU4GSEJfVJrp6ySDJz5qdd4TN+gOI5Zv5L4ucPK1Nj3hr8kImQaia0Ot 4wMZrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119382; x=1795724182; 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=bmdyGE4oGcto7SvD7pQNLYgU2+W44/AlA2a7IPsDvcr8Uo0fBHBHV2p3Kq1di6hHKH nShl0kDeWjlOKSrVMhFpaInAR0J3V0dWir5M5SQiDLGcjojNJ2OQdp0fhUYBU8XRTuVK i24QFgz9UOwMJxh9sKMZN/GLHcH6C3zbOt3biW3FP2FZHoAhEPBA6jHCe229GunRrtPa iWXUy06VldqobZnGaSjVEBxFxLt7VTuAfkYDEyxC8TPowfKM6WGWR+I+KOFYJ5oNJsJq OdpjyI1ZF9i7zv2517XPWRfnDFxmbWttS2FeWabgCwx9+rf2sADhE726I48GceO2Y9JS Hibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119382; x=1795724182; 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=wEyfSZ/wh9VzUcDH2IFzPP3B4yZ1XJv59368QoXPMf5JMpiCna+/7gEmu266UKJw/2 61hGbpgVf56XF7gbevxh8yaBjVAvikSFxA3O5JSTnOE5EQmesT2rApLbrzZRo2Xl3jL8 IDXvhgIXTN/WLQxiBU6Bt7O384v31z2aeDGVpnVFqwDa7sCNktbFBfh6A3ix1ck+bp43 Dulq4UvAlUKqkv4w3DkwQnGlHivI8XKwqbZAP0zAmeFaPhYffyXxgj4sT0tJN+SNqyLp 6SCsqaKu8PhD0yhLad6nHlgQGNlG4eXiGRV0er/VuRZlbJ5pGX7fCeI3nK7s865zGi9Y 8uOA== X-Gm-Message-State: APuU4Z+2gCNXp8VkH+h9bKt9fN549u6X2EwSAlQ8YuJYC8app7z0rSyd OEbSYxLQhG4U+9YlfhnTV0V7RIO6eplAR8+xk0zO+cfmAcm1toBodHGmVmTZwXhluHqbHBxcmVw 7FSBCboYs/p9Q+I5EXSdBAExLVF09VzPCofDmpgSuxsT+HM7AyFtyTzsWGED4YBFuLA== X-Gm-Gg: AZFdTZfAusAG1QWUssnSWjgGuj3+aH8BBJrCrLqc+5lAFhLvAIK+qnB3whN8kSyKgCD K60OK4d/uWZjnAoegXhXRlfLBoI35v40409Z26/ADvd3SRsCkdVQ1vj3KRZVpLXIE8wc5VGFXTq 9KV55bVwW9zWmSWmrBjb/JXesj45LAznx2nvz/luUosyPOBtV+oBRyVFT0F86BLMpgy2BGdk2fm GIv9201MlebYTZsZBehJrsahv5U8MAQGsp7Vbr+MvZ8uiH0PRvhK/CvJEFf0j30+MS4BJ+6woEg KgGZMXODkPyrM6XHR8Qw++qMGS2OIKREykXX4dsQjl5D9bd/k7ddKANS4/OK6a5GMzxRiSCF+72 Awm1bowNWzK92XkA1I6uFfZc2ApshorZaErG1X6voFwl4J57Al2tn0gAqeN80erzhEGciUnNPu9 KO4EbS9oI1CdB8g2Q4N61J1w== X-Received: by 2002:a05:693c:88d9:20b0:383:9f52:e7b9 with SMTP id 5a478bee46e88-3856f03f434mr441841eec.19.1795119381607; Thu, 19 Nov 2026 12:16:21 -0800 (PST) X-Received: by 2002:a05:693c:88d9:20b0:383:9f52:e7b9 with SMTP id 5a478bee46e88-3856f03f434mr441807eec.19.1795119381027; Thu, 19 Nov 2026 12:16:21 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 11/14] hw/hexagon: honor configured RAM backends Date: Thu, 19 Nov 2026 12:16:00 -0800 Message-Id: <20261119201603.2377989-12-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX9MmQDypVBUM7 EM1sgN+RPoR5i8sE8bKAj3qJDu7JjX/M88wkgQqlgjUkqYsGanepl9EGQw97w4GgyNPGjpi5tpP Tzmq4ODMYZmfBmh/wqbh8ahygIBdUxE= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX1TMKMuUJJT0S IoEG9FScDDi4H7s4SVOG1jvaeMsRjAGj85YiijeqvrbFA1x6j0c32EO3vxbUdiUEqLfS6kDpIov rs11YiMh+mDxByHjmVyid9W7Kmng0/m9dE2WFUlblX46NGeozUJEo6/tHfceUkgVDXSaHsbjKrj ZJD6p4FhNQtHZPWwYBT7gcuHfh253ldr6M22T8ZiNmsW5TXZwAijX26WhMybIJseRa1rQDYielT NQuFrRt9Zo98TJe1iV4GQSZ1YkPZHHyN39AZCxdUZzZE/zBzO0WBRx72UjbbgNgK6i9u70BF/0H P62PpGvF9y+NfG3uKjC8YrAITXBLo8W9Ar/Fz4H+x0cpazChKpaH0DfwZJaNjSvFkHCIAYjhgH5 Q/CIan/+j6q3J2BhA6RMPaFovedsE5hx0rwzU9U3aVNAbchi0XswmiPqduIIxx3ba9sHST21yzJ fCc3GfVQ5TMqr+cASNw== X-Proofpoint-GUID: l8R13DqOGJKX5yacxXcFUq_oisF-e4C3 X-Proofpoint-ORIG-GUID: l8R13DqOGJKX5yacxXcFUq_oisF-e4C3 X-Authority-Analysis: v=2.4 cv=LPTz05W9 c=1 sm=1 tr=0 ts=6aff5916 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==: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=CClahisu4qSzJabnEcAA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119447378158500 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:37 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=1795119416; cv=none; d=zohomail.com; s=zohoarc; b=atoD1ZqFIla6oY4Sfo7+q8kCz07GQHpPRqRDb5P8O8d6h9BCt1aXc0iaaqAOAGYAYA7a9A71IxTm+4HlWBRe+JhSHGKDpFJeh20pz03hUoghnnYmqOGSbcvMSE/J/kvu2Dnzryu3Nt2Rq5lpMXB0L4835rmsgqK1xRn3lL0WcbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119416; 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=Oc6om9xTpsInKpuLrzT8riZ/wHX8kcQALQ8bLXX1zfbG2vC/3d1ozAzMZUMVR0BsqWqcLtOGT+94QGM4UQciWTqtcdnEFWdsrCz7fu0OU+S+o8QJenYkukeXdvhzr7uyxOD1TcM/xjXcayBo00XzUyayAihJxQtGzjNcfOqNdw0= 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 1795119416864201.5562064291587; Thu, 19 Nov 2026 12:16:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Ye-0002t3-Qy; Thu, 19 Nov 2026 15:16:36 -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 1xU8YW-0002pK-HL for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 1xU8YU-0000sy-VU for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:28 -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 6AJJ1LnG3655793 for ; Thu, 19 Nov 2026 20:16:26 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j20guajj4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:26 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-383f2d05c73so334086eec.0 for ; Thu, 19 Nov 2026 12:16:25 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:21 -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=Cu9JgKTxlUtNW6Ou mGYF3SQzdj+PUdHEhP086x6Vcjk4fHyuFKo5C+4Uhan9h5GSlsrGHG4C3Te2tewY lr4BcBkCxKFvlCfTWUNARIroHsaDBqC/4YP0aouf1srI+0GcZXJn7OxkGu/KbubI 8VP4iSk2E/xHI6i5V+LXUzlGnJbVOriZhlZtW6FVtHAi9TXN2w9pRqyeTGVUmKA6 qMdE7D//Ez5+R9mU8BFH95dlyQf+epvj3QXEahPyJ6Xc/pUSBJr9V2X71almzmx/ HV9xuvAssYndZcGC/UuKbSHYg/5eFOK9qiyGugL8TBDiLSCHvhrYFju1YqqQYq1V xT/HZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119385; x=1795724185; 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=CIfRbkQPgM95MPwqKdup8C1qrqrKMHd47qmMyeTfVYkiqCQtEFBUm938/fJSiiSb+O zxQj3TuwAU5E23VoZ2T8hbBxjgs+K004QNVYr/di0/2elMFCGB0cLXxV0p8Uy1g5uvyn USD5S/m/10+YYsAugUtffAHMOHdZhtEmbzUGyCdGZWQSnIYRtdeg0XlbOdcafWsE/Zrt WEcfvaBL2883rz6RPNNuTSyx81EKPbvLpABT0t5Yu12zKXwU7bd50DK/iAz2lRKIaxcn Wrp15buHqkCKORTOTDXScl/Mva6Wcel389EtM7/M7iK3NYxA9rrNskGvYD3tMGlu8tIy n6ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119385; x=1795724185; 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=ooNVE5R0hVSolSuJnWxhWeK482AZqBw+p8tgX8J99DP1CRbxtHZIDirGW7X7+4zVH6 ENLpaNIbNVWqJQPLSU9hCD6Z9gllhiJQWcF3NkGLvudqACqRH7Jywnmco8fdrTUUiIft P/T0D35Rxt0Ohm3WW+g7Fa0ycHaiaivCCTXr3CEa7asuxLVU61OFlWUVqcDFMUB4CvPO Wo2GZCz0GAmZ8hEHCslrM6ORW57iy6Mwf03afASWIqb2eyTlhJM2k+nBBuu7v8qGOoCn DJEgrmNCpbYDYeSiZkFxi/P51cAixe2Vf739GqOpzZkFQtgJpAckyIjYrM4OuKO/P4XX XdIQ== X-Gm-Message-State: APuU4Z+cDnyJIJf5s7u0mt7DoAjynFTBMecG4/USk4LHInwa3P0HH7Mg qdasMNTNwwFu3UfvRE1p+ysoYuyNa/qOISdtiZPO44vSRqktmteG41rlomMAUZtm+46l/XSSEom VC2+itXwlB4hmfaHB4B5/SMvMkGbkt3offBelj7tW75omPiBCeJeEvyrNXZmKg5TVdQ== X-Gm-Gg: AZFdTZee0SRWQIqZz1788kNeGun3nVtdlxThGc8fcRWyyIxVxggIwiWmNpWiyOi/LAv xLATlmqr4gviwlGgehG4qJDuc8d/zNp9grpx9uwYUvJVlyCeYEqHqKE/+9kvBucgQiNtT5PV1Yk F6rw5naBvIVPHBNqQbsvMSl774qpp7tWfQv91Rdz9RTLZFoiyMBxy7L9ecwa13FcBtE96Aoc2Ny B6XAqyHsCQVuSbB2tgB5IHAOCN1HjI66AIv5BDNURxnMeAVkq7ukn6diFbDlrdscCugngg8VA5w SFjVvAAeL78pPdorYgqEH7XdrwsR1HKOYyefINelCogIpIV1pmhQCeoOC1FADYTXN4A/oMaIExO Ie/z9Y0nHksxkPB7I/ghE0fk9iXgbneLGrKATIyTsE7OlUOO2zFXPrrbvqMayT+9ygu1yvmcnaz c0/1hZf8wQFJ9Zwbv+0uEGqw== X-Received: by 2002:a05:7300:8a9f:b0:36b:d3dd:2e9d with SMTP id 5a478bee46e88-38570354704mr390774eec.19.1795119384682; Thu, 19 Nov 2026 12:16:24 -0800 (PST) X-Received: by 2002:a05:7300:8a9f:b0:36b:d3dd:2e9d with SMTP id 5a478bee46e88-38570354704mr390736eec.19.1795119383927; Thu, 19 Nov 2026 12:16:23 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 12/14] hw/hexagon: version the virt machine type Date: Thu, 19 Nov 2026 12:16:01 -0800 Message-Id: <20261119201603.2377989-13-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfXzjRlrh8/AkqF Y2ei0Xe4Y+Wu2Ufao6EE+Dd+SIBQBpGgccAxnc/DO7Q56KXvhgkL0eRCW/3y4W3ns3K7uf+k9D+ GebmU8LcfGiggzHgTpdgwpgmhL8y33Y= X-Proofpoint-ORIG-GUID: CHhDSIhS3V64DqtpuSZVJplWlq5bUB9R X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX1NfMOQz+X739 PaAGdxeqiD3Kc3bMLKYG/dT0DDtLVCe+I+YkfoWz/ff9BUQTk5WzHNznb84MWEAzmuvQwyPXJcc oVAH3DLg5/3S1QrxxBiCLBZdx+3fAamfUHA69Uryn7p+6lws4IevoMxAx9ZEAknljzpdz9APWNC jmYOJwiWXVitGm6QHRHDnt99TB8A+ZlynsbPJgwuFpn/6Vwe+iGBTwf/t+UL/SMFdzUT6ucBQKv ffWVtnnix6UKJN6jhO39G1zGXLpFHbo2ibBHSxf7QrUkjfxdat31+a+dLIUnQdKy0VXVTs0FiDg yk3NNfmhhV2+AXcIb7NB2MCB3MBaofuUdMcMytYD1dZaPmGYzStehfisDWBc1SRXCkovy6LgRla MTwn+F1VOVkRMSiMEVKlqTsRttVBNfBOyU2MkoRmCQ46fRL4eNvnVnFHRCVKJNEBz53AGcnFm+m k7QEUymHfgm6EBdNIJQ== X-Proofpoint-GUID: CHhDSIhS3V64DqtpuSZVJplWlq5bUB9R X-Authority-Analysis: v=2.4 cv=XutvqlF9 c=1 sm=1 tr=0 ts=6aff591a cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==: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=RWXkQjlZBxIzdYGjihoA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119417104158500 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 From nobody Mon Nov 23 04:26:37 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=1795119429; cv=none; d=zohomail.com; s=zohoarc; b=jhKJ88kI/9qfMxv/5RfrM6/AoJ+5gg4v3DZ0eAlYJ60VsiXcNnfKDen7o16cg3GvvSTtenW+oPD5iyqpbM7IsDW1Z1sf/Zz5WbabScNcpmE7YDDHhDh5WdPEewvIP0FxSVhx2ZLsF577BI1Gl5oF85xmAXB4SeE3GOjwIrzq4EM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119429; 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=v7WOjRct8k984p7FgaW7Nz5ueLjk/+19SZu6vz5ct1Q=; b=Q8m0F4fU4tSI31ELhmMhxK3pMBlr7Qwzy++aOWghAjuvQqcOo53Ov3XFlaXdh8cNN85mNdhVQUM9hVjuTPqCfN3vvCDdnWfyzveHBY7Q8F8sZY/mbgtVKcqEd9Ko1X/096j7xBtsFjCQks2VfmB6SlwuTR8I6+S2X4cSkCTzbtc= 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 1795119429314232.68617828667732; Thu, 19 Nov 2026 12:17:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yg-0002tJ-Oc; Thu, 19 Nov 2026 15:16:39 -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 1xU8YZ-0002qk-6i for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:31 -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 1xU8YX-0000tF-2j for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:30 -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 6AJJ1jTZ1936633 for ; Thu, 19 Nov 2026 20:16:27 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j22ugssss-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:27 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-3837afac185so285928eec.1 for ; Thu, 19 Nov 2026 12:16:27 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:24 -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= v7WOjRct8k984p7FgaW7Nz5ueLjk/+19SZu6vz5ct1Q=; b=UZsAXGEVKdA2e/tF kctJqjR/80C0NH0VJnYwerxOhs/R3XyK605NQpbw5bO+IZhqoowljnBIcWunC3zr 8Vtd2OBLUCg+NhS+OnWUPGE6waSBKAFDcAd4+wIfbR6Wm6Nk9MQgbMXjMHm9CT+3 GG1HaS+FTGM19ht5DXwdMC0HDdA5OPUzcMyGuQSjLzjNcZ0Cjvb8OiSq4PUdwQId Ip/+8hnzhYxkVn+QQ3y7CQQy84X8Wxhz7t2/LnyvLPfjyZlNpBVWgeT3TQxdXhfD CExUBSxVTmVIi8BGbYpO2/OfctpMmriUD3tJ/D6NJHX/OpS+fKbgWg+YA/PoeUMB 1j9ZMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119387; x=1795724187; 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=v7WOjRct8k984p7FgaW7Nz5ueLjk/+19SZu6vz5ct1Q=; b=cgo9wcJFpya/xB9JHm+YTdcIkCsgnfRd0Qps72geZkQQFGXQ+za1X/4WQlKYxs/3Op y0c9bWTtmDMXeiORkRY8N/nVaQp80QmNJXHtfKeGR0EWxKxd0h1hxwsYoWLAuED2xy6Y mfwlpixm+6s4i6W5+q4tI2QimHxw2SEwtOyKSMejmt1w1ffOGpcEEvinJ233vhucb+5H BlcuvzXeKG+TZ7GUEcq6XUHoRIoAxee5isC2/eIgozEXsH3XnVDA6qxeCxwvIlk1j2ID QD4EhC4GuM2aIWRCSHWt5A+ygRQ2jdqcaYBwGOIkN07EN46BekBfUZxuG2PrX3tAEpIC pChQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119387; x=1795724187; 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=v7WOjRct8k984p7FgaW7Nz5ueLjk/+19SZu6vz5ct1Q=; b=CNL45AHCfXEgEhY4HfSC7SOEE0U55ubXhtu4fCWP7s7q1bdZfzJ+HUx9c300xDOh3H WN649FYvzNPiEypFpfd9l/KenYAOgWXNKR/KQzxX0w6GIQs8g4cmyrO2b1Jjse7v2Aup 4RfswjdAe0JgL4djcu9wQY/0rqh1MLKP1dBcIsdItzSU8QwKs5aYSmw4ZlJY3FXwKAcv XFnzrNZ4NgadeSmt76n28dhBPa1oCTgvtXPGgh+JxGyfy2uBsWX25Dncj11DqEVdHeEH tZgpWgHYcvOS081icl+8zoFaiZlwgWEcKJhMdUFBfOmsBe1PKVRKscuxPQaBH/0qr0dI zP1Q== X-Gm-Message-State: APuU4Z9uPccgNqsh2zIPYNffBT3a0AT3xyWmlu5++KIS0vm1ZlBVBIvZ nAClT0Y3DBD3sNLHtLNOrDS9K6ZZnFenhG+s8ayCJG6AY7rDts93E2bxbvNxyzuP6NUjfJkCWYh 8pcccykrKjNUV1fPJhPhyWXXVHkP1ufyBDzxXlIFtRDAgLKglNowcWf6nZr9VFKG2rw== X-Gm-Gg: AZFdTZe6YZdiROYTkCk7hObPtj7qVY/1wCUDaXp3mqSm11W1hUkdDHMYZsfcjOqmEe6 RrCCed1agwyq/iDdlZ/lQ96rMgnC8crUl9DEqSedEyn1yIWzY3Vz3VqdTONbSAHfJ4vzus58rZ7 b5QzIlFyAE8NHDVW7/vMKhm9neYXu68IEahQ4sNbOaPt0JPfH4LOFQsp76jofTsXSibeSGPsEk3 DoQdlRpJWp5phCLxvOJFtejjFLrwAzsfQ2ZMjb1ymWOwZeU1mLegSWOQbjoRk0wIjNEWSbL8iIi yXEwRFeyBu2KgpH8MparKjpUw87+Xma4wEymH/CeofnApODc5QAsLKzrKppuLzLvmQy80XgwlD4 yMc9f2UZ/VdjgTaNngjzKP7ioRkIU2muEuYatbRgt6U5VcJhPul+oVXN8hgOPljwzVsKz4H0V8e 90LiRppMADAP7RneAeSI3cng== X-Received: by 2002:a05:7300:6d03:b0:375:b560:a323 with SMTP id 5a478bee46e88-3856c0ce045mr696031eec.1.1795119386208; Thu, 19 Nov 2026 12:16:26 -0800 (PST) X-Received: by 2002:a05:7300:6d03:b0:375:b560:a323 with SMTP id 5a478bee46e88-3856c0ce045mr695969eec.1.1795119385288; Thu, 19 Nov 2026 12:16:25 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 13/14] tests/qtest/migration: add Hexagon to the migration framework Date: Thu, 19 Nov 2026 12:16:02 -0800 Message-Id: <20261119201603.2377989-14-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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: gRa_z7prLK95VZxfPtf9clbuOosif2L_ X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfXyAukYnEO15aN ilvhvGRF7XrcBf9anLNKvHtkhO0oE1DaeHJ9RYM0ccYEI3axzAmpNHFet0W7zlKVuPiwIgttsfY m3NhsIWEpOKny5Wxok1tdl60a70DOYU= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX4D2bH3Y8FvSj sxt+rI8JA2oYGSjF4FhT0BJaV8xnUw0ZsrJK2TVHOSeJ/JPrUiOx4vjJxz/wiu7Ag6SPvVFYEvD 32/xO342qo5mH+Z6WItHjoDCmCXRx1gQ0D4lExWyOQndAOJNlij+xFEbWAYRNp4BuKj/Yz5FN5w CDcuWqS04hD24cr89R78LAkie3tsZbEaboE0ofRF+NZKxFLy04HqxU56IlBE5C4B+4PGoaIbB6h 1JX/66JErKOkeEkkuNlE37eCk2vcg3QcWROR9V2f/dl+AT245gQJ4UDKua8kh0e3ozq+z0BkxfF aONG0Tq2qQzm+woch9RGK+cqjHF3Ck7Sjrg1wM4KNZsRzlG6RJKeabE9AKfrrgWJkw4clUBrjc1 A8tMn30uIBeOx4JBx8U/XMBn4xLV4ObptifLHSPaNbie8FWWh37+ZzDbPBK46oo8Ec3wF4mu2DU QhoUdeA6NW1lrIu6vKA== X-Authority-Analysis: v=2.4 cv=YeEodARf c=1 sm=1 tr=0 ts=6aff591b cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==: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=_1q8TScGQOYv1q39QtEA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-ORIG-GUID: gRa_z7prLK95VZxfPtf9clbuOosif2L_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119431365158500 Add a conventional dirty-page guest for the Hexagon virt machine, in the same form as the other architectures: it touches the first byte of each page of the test range in order and reports progress on the UART. Wire it into bootfile.c and framework.c, register migration-test for the Hexagon target, and add the new directory to the regeneration Makefile and to MAINTAINERS. The guest is checked in as generated instruction bytes, so running the test needs neither a cross compiler nor downloaded firmware. The guest link address comes from bootfile.h, so it is defined only once. Signed-off-by: Brian Cain --- MAINTAINERS | 1 + tests/qtest/migration/bootfile.h | 6 ++++ tests/qtest/migration/hexagon/a-b-kernel.h | 21 ++++++++++++ tests/qtest/migration/bootfile.c | 4 +++ tests/qtest/migration/framework.c | 8 +++++ tests/qtest/meson.build | 3 +- tests/qtest/migration/Makefile | 2 +- tests/qtest/migration/hexagon/Makefile | 30 ++++++++++++++++++ tests/qtest/migration/hexagon/a-b-kernel.S | 37 ++++++++++++++++++++++ 9 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 tests/qtest/migration/hexagon/a-b-kernel.h create mode 100644 tests/qtest/migration/hexagon/Makefile create mode 100644 tests/qtest/migration/hexagon/a-b-kernel.S diff --git a/MAINTAINERS b/MAINTAINERS index 15942aaba3a..5baf78faa55 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1396,6 +1396,7 @@ F: configs/devices/hexagon-softmmu/default.mak F: docs/system/hexagon/ F: tests/functional/hexagon/ F: tests/qtest/hexagon-config-test.c +F: tests/qtest/migration/hexagon/ F: tests/qtest/qcom-dsp-test.c F: docs/devel/hexagon-sys.rst F: pc-bios/hexagon* diff --git a/tests/qtest/migration/bootfile.h b/tests/qtest/migration/bootf= ile.h index a4060ea4f72..717de0b07e7 100644 --- a/tests/qtest/migration/bootfile.h +++ b/tests/qtest/migration/bootfile.h @@ -42,6 +42,12 @@ */ #define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024) =20 +/* Hexagon virt: keep the guest code below the test memory range. */ +#define HEXAGON_TEST_MEM_START (1 * 1024 * 1024) +#define HEXAGON_TEST_MEM_END (100 * 1024 * 1024) +#define HEXAGON_MACH_VIRT_UART 0x10000000 +#define HEXAGON_TEST_KERNEL_ADDR 0x10000 + /* LoongArch64 */ #define LOONGARCH_TEST_MEM_START (32 * 1024 * 1024) #define LOONGARCH_TEST_MEM_END (100 * 1024 * 1024) diff --git a/tests/qtest/migration/hexagon/a-b-kernel.h b/tests/qtest/migra= tion/hexagon/a-b-kernel.h new file mode 100644 index 00000000000..35ce5286ed1 --- /dev/null +++ b/tests/qtest/migration/hexagon/a-b-kernel.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This file is automatically generated from the assembly file in + * tests/qtest/migration/hexagon. Edit that file and then run "make" + * inside tests/qtest/migration to update, and then remember to send both + * the header and the assembler differences in your patch submission. + */ +unsigned char hexagon_kernel[] =3D { + 0x00, 0x40, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x78, 0x00, 0x40, 0x64, 0x00, + 0x01, 0xc0, 0x00, 0x78, 0x00, 0x40, 0x00, 0x01, 0x02, 0xc0, 0x00, 0x78, + 0x03, 0xc0, 0x00, 0x78, 0x04, 0xc0, 0x60, 0x70, 0x00, 0xc3, 0x04, 0xa1, + 0x40, 0x40, 0x00, 0x00, 0x04, 0xc0, 0x04, 0xb0, 0x00, 0xc1, 0x04, 0xf2, + 0xf8, 0xe0, 0xff, 0x5c, 0x23, 0xc8, 0x00, 0x78, 0x00, 0xc3, 0x02, 0xa1, + 0x05, 0xc0, 0x00, 0x78, 0x04, 0xc0, 0x60, 0x70, 0x03, 0xc0, 0x04, 0x91, + 0x23, 0xc0, 0x03, 0xb0, 0x00, 0xc3, 0x04, 0xa1, 0x40, 0x40, 0x00, 0x00, + 0x04, 0xc0, 0x04, 0xb0, 0x00, 0xc1, 0x04, 0xf2, 0xf4, 0xe0, 0xff, 0x5c, + 0x25, 0xc0, 0x05, 0xb0, 0xe5, 0xc3, 0x05, 0x76, 0x00, 0xc0, 0x05, 0x75, + 0xea, 0xe0, 0xff, 0x5c, 0x43, 0xc8, 0x00, 0x78, 0x00, 0xc3, 0x02, 0xa1, + 0x04, 0xc0, 0x40, 0x54, 0xe2, 0xff, 0xff, 0x59 +}; diff --git a/tests/qtest/migration/bootfile.c b/tests/qtest/migration/bootf= ile.c index e46ad09de76..af3f1c23712 100644 --- a/tests/qtest/migration/bootfile.c +++ b/tests/qtest/migration/bootfile.c @@ -19,6 +19,7 @@ #include "bootfile.h" #include "i386/a-b-bootblock.h" #include "aarch64/a-b-kernel.h" +#include "hexagon/a-b-kernel.h" #include "loongarch64/a-b-kernel.h" #include "ppc64/a-b-kernel.h" #include "s390x/a-b-bios.h" @@ -58,6 +59,9 @@ char *bootfile_create(const char *arch, const char *dir, = bool suspend_me) content =3D aarch64_kernel; len =3D sizeof(aarch64_kernel); g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); + } else if (strcmp(arch, "hexagon") =3D=3D 0) { + content =3D hexagon_kernel; + len =3D sizeof(hexagon_kernel); } else if (strcmp(arch, "loongarch64") =3D=3D 0) { content =3D loongarch64_kernel; len =3D sizeof(loongarch64_kernel); diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index b7aef6b21cb..e4b1b105267 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -367,6 +367,14 @@ int migrate_args(char **from, char **to, MigrateStart = *args) arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; + } else if (strcmp(arch, "hexagon") =3D=3D 0) { + memory_size =3D "150M"; + machine_alias =3D "virt"; + start_address =3D HEXAGON_TEST_MEM_START; + end_address =3D HEXAGON_TEST_MEM_END; + arch_opts =3D g_strdup_printf( + "-smp 1 -device loader,file=3D%s,addr=3D0x%x,cpu-num=3D0,force= -raw=3Don", + bootpath, HEXAGON_TEST_KERNEL_ADDR); } else if (strcmp(arch, "loongarch64") =3D=3D 0) { memory_size =3D "256M"; machine_alias =3D "virt"; diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 6e2938d913e..67410b3778f 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -330,7 +330,8 @@ qtests_riscv64 =3D ['riscv-csr-test'] + \ =20 qtests_hexagon =3D ['boot-serial-test', 'hexagon-config-test', 'l2vic-test= ', 'qcom-dsp-test', - 'qct-qtimer-test'] + 'qct-qtimer-test', + 'migration-test'] =20 qos_test_ss =3D ss.source_set() qos_test_ss.add( diff --git a/tests/qtest/migration/Makefile b/tests/qtest/migration/Makefile index 626e3974f7b..0cf7d528ca4 100644 --- a/tests/qtest/migration/Makefile +++ b/tests/qtest/migration/Makefile @@ -5,7 +5,7 @@ # See the COPYING file in the top-level directory. # =20 -TARGET_LIST =3D i386 aarch64 s390x ppc64 loongarch64 +TARGET_LIST =3D i386 aarch64 s390x ppc64 loongarch64 hexagon =20 SRC_PATH =3D ../../../.. =20 diff --git a/tests/qtest/migration/hexagon/Makefile b/tests/qtest/migration= /hexagon/Makefile new file mode 100644 index 00000000000..5000de63044 --- /dev/null +++ b/tests/qtest/migration/hexagon/Makefile @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +# To specify cross compiler prefix, use CROSS_PREFIX=3D +# $ make CROSS_PREFIX=3Dhexagon-unknown-linux-musl- +# The tools can also be overridden individually: CC, OBJCOPY and NM. +CC =3D $(or $(CROSS_PREFIX),hexagon-unknown-linux-musl-)clang +OBJCOPY =3D llvm-objcopy +NM =3D llvm-nm + +# $(call define-value,NAME,header) is the value of "#define NAME" in heade= r, +# so that load addresses are defined only once. +define-value =3D $(shell awk '$$2 =3D=3D "$(1)" { print $$3 }' $(2)) + +.PHONY: all clean +all: a-b-kernel.h + +a-b-kernel.h: hexagon.kernel + echo "$$__note" > $@ + xxd -i $< | sed -e '/.*int.*/d' >> $@ + +hexagon.kernel: hexagon.elf + $(OBJCOPY) -O binary --only-section=3D.text $< $@ + +hexagon.elf: a-b-kernel.S ../bootfile.h + $(CC) -mcpu=3Dhexagonv68 -nostdlib -static -fno-pie -Wl,--build-id=3Dnone= \ + -Wl,-Ttext=3D$(call define-value,HEXAGON_TEST_KERNEL_ADDR,../bootfile= .h) \ + -Wl,-e,_start $< -o $@ + +clean: + $(RM) *.kernel *.elf diff --git a/tests/qtest/migration/hexagon/a-b-kernel.S b/tests/qtest/migra= tion/hexagon/a-b-kernel.S new file mode 100644 index 00000000000..c54b82dfea1 --- /dev/null +++ b/tests/qtest/migration/hexagon/a-b-kernel.S @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Dirty one byte per page in order, reporting progress on the virt UART. = */ +#include "../bootfile.h" + +.text +.globl _start +_start: + r0 =3D ##HEXAGON_TEST_MEM_START + r1 =3D ##HEXAGON_TEST_MEM_END + r2 =3D ##HEXAGON_MACH_VIRT_UART + r3 =3D #0 + r4 =3D r0 +clean: + memb(r4) =3D r3 + r4 =3D add(r4, ##TEST_MEM_PAGE_SIZE) + p0 =3D cmp.eq(r4, r1) + if (!p0) jump clean + r3 =3D #'A' + memb(r2) =3D r3 + r5 =3D #0 +mainloop: + r4 =3D r0 +innerloop: + r3 =3D memb(r4) + r3 =3D add(r3, #1) + memb(r4) =3D r3 + r4 =3D add(r4, ##TEST_MEM_PAGE_SIZE) + p0 =3D cmp.eq(r4, r1) + if (!p0) jump innerloop + r5 =3D add(r5, #1) + r5 =3D and(r5, #31) + p0 =3D cmp.eq(r5, #0) + if (!p0) jump mainloop + r3 =3D #'B' + memb(r2) =3D r3 + pause(#1) + jump mainloop --=20 2.34.1 From nobody Mon Nov 23 04:26:37 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=1795119408; cv=none; d=zohomail.com; s=zohoarc; b=oLhcOpafLvwBJOe1bD7XK2I12OLzQtQuabRJuE+e3P24JH3PxGi8Q9O+tzsNulWPf37SJZUswSZhABRxLfwfvPEclUSUVcVOUE4MHhLoYoWlBJyyS/5D9NVIJkIjDDugqTEdv3kuPiAAjhdGLpD95WIYfy986AYr+V2yXyLaC+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795119408; 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=JTimi7jDrm3C4oanFW4vI86I431/VKYAwB7UIhwNbFA=; b=VRLsiq85IBRypkggPHuAmryuOOiRIaSmz3qkulDB56N7jBGRQffay/enwtSCkVhTxFFOWLnfh/4lXjf+SCm3Fo4GB7d52H4A2/qTxHXLOrM6qhBz55foIeVyZOHLbvNP4MTgiwiz7wuukouHLfKyrPVqY+ziPTy8mZd7NLLKdsM= 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 1795119408837465.12646028460983; Thu, 19 Nov 2026 12:16:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xU8Yi-0002uJ-QX; Thu, 19 Nov 2026 15:16:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xU8Yc-0002sF-1U for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:34 -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 1xU8YY-0000tQ-Qj for qemu-devel@nongnu.org; Thu, 19 Nov 2026 15:16:33 -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 6AJJ1TrI095221 for ; Thu, 19 Nov 2026 20:16:30 GMT Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j1xx1aycn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Nov 2026 20:16:29 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-3837afac185so286029eec.1 for ; Thu, 19 Nov 2026 12:16:29 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385616f0a3fsm1132085eec.0.2026.11.19.12.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 12:16:26 -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= JTimi7jDrm3C4oanFW4vI86I431/VKYAwB7UIhwNbFA=; b=S6RKQ9xN4iAD3go2 i0eVztmHTlvUiq8uJOCas4QEc4oBhUEszyaaBcbDJsFgAkZjLntxQJVjNgjA8vTc jAiHl3EcoG856HGrBj8h1PbeE6dQwYBPio+8fkYqaC9kDCWR0//hW9SSiHm0VEXX Ap45eXXwJtRoDkKIGefkIvsTm+c4ji4WBkav+hHeHY9iGKXEqkw3prg84/9LONUT 1dgf2LGOuaXuIxcGVkQqlNPWiyOMGJXkllwd1OFQTrsvhVfjJ+6m3IAIJ6IuepPL S+Vo8UAqbIAA0cmGBEgwBEivSEzJsA30HLFZltBj+mtBu2+XLYUqhl5EGJYCoLCH Yh0u6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795119389; x=1795724189; 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=JTimi7jDrm3C4oanFW4vI86I431/VKYAwB7UIhwNbFA=; b=XpJpE0xhr15p7hfSqCUvPABGi4XlKotgk/fGbDU7ebNds12YifI2LSMl0AoSmybgcn MzzfJdR7+GXyz9rD/qZ0cVlEH+2h0Oj2jRmTXBr712b2ceRu4IhJX4CWhcRlD9CpPGlC 4FVBzw/PGbt4OAiij7au8vCCfDAe8FYqdKNH3NEGzeTNrOkzu9UhV4JFfjcPOo6sTYg8 uT2ywd3UCAGO9KMUWHR639kFgqvkOmzBzH5E+HFdf2K5Oh7/mrMmctFJRhGTHs0MLcqi H3IaH97ffrVtZbiyJxZNMYKtkI3jywFBjJ6hn4M/CV32w5ZjiqQu2Kwoqd8H3sMQck2L wCzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795119389; x=1795724189; 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=JTimi7jDrm3C4oanFW4vI86I431/VKYAwB7UIhwNbFA=; b=JoWFJz7UupJrHh4GK5qPz1+/Nc4vjLUmlTWs2amGY17AoxX9ZsX5d+lVjP+IuHYsVH apcOu9xd/l5c63y3IksfCZVJAbMptv/9asc/U6VpzcGDeUcAxGWOtnYj8P/QPRNAWLR8 RvY38/cXwH5w+qiNz2ncGY3qtVWWHxPZWN5E89NHWFbCR6LpjBKDaVeS58GvHLzX9nRS Bo6ll0MJ/c5y77tgnQHdnln2xGfjxBGYJ5aGKmQ4hAotycu+7gojfoc7xmLnEauDHOP9 1kQIC0IkpuQqkWACo2sblt08o+XiwS7bzBAQrOn34WaguSV2Z4HMlgaGWH7mGEyn2Lhm IMeg== X-Gm-Message-State: APuU4Z9cVQqqkDoDLqI/pTwIauLBbSmKP4R7Aowl0wS9pJRd3fd2cQD0 m0SR4U+MMpjoU3YTkd+y3IfivPyOBQVX6+a1UaSpmfzTAahjA0MraCE6B8YiqvJKVYg846eCJgi 4dw8h0kCCPXYx3id+j9DD9U5O5FcwR7/9x3c5gmQjma5Ax9snHUdazqZmE/AN1Xs0oA== X-Gm-Gg: AZFdTZdHrXl8OUFpzd04O02GU4fH2376X8XL7zeP1Z5wttVysnhbsVNb/NoNnx0sBua ohXrqeHtJxI9JMtVmBFJTZTkhn/bYprjtxm0banVj9rvtFig6ON2FTpPb5OdnTOCDYSVN6q1/Gx 7I8RjdnTZA6u4QslK/yuIfTRqzyWw8XFeEb00U0PHOD7HjcG9VaY3vUrEMNFoM8wzaHJFa/4UDu XXfFSdBtrWqJN4badO+1o/OMWL1HGg7riSuuVE23BXwzXLwZpHN4Ev9lRJJebarpnCLcdXGIlzZ SisWzFEg581n6/G0R1mujlYVHEglCGcKH9VJ6CDQ2OzvjMOpZs6hPUnKvBqdCVvLmGgvdXWxHmL QNuVeWZtX69fSSgsfUsweA2EiBbXYZUJVE5zK1TradSmza+Nvj9L1QwjQkat8KLuCZQt2T1HTuW jGOBwKHvR6u/fmRPR/KNESBQ== X-Received: by 2002:a05:693c:80c2:b0:35d:4185:5395 with SMTP id 5a478bee46e88-3856eb492ccmr447032eec.16.1795119388316; Thu, 19 Nov 2026 12:16:28 -0800 (PST) X-Received: by 2002:a05:693c:80c2:b0:35d:4185:5395 with SMTP id 5a478bee46e88-3856eb492ccmr446995eec.16.1795119387431; Thu, 19 Nov 2026 12:16:27 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Laurent Vivier , Pierrick Bouvier , Paolo Bonzini , Brian Cain , Peter Xu Subject: [PATCH-for-11.2 14/14] tests/qtest: add a Hexagon migration state test Date: Thu, 19 Nov 2026 12:16:03 -0800 Message-Id: <20261119201603.2377989-15-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261119201603.2377989-1-brian.cain@oss.qualcomm.com> References: <20261119201603.2377989-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=PcBqFShd c=1 sm=1 tr=0 ts=6aff591d cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==: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=SRYKVlUu-rWCjNmT0-gA:9 a=QEXdDO2ut3YA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-ORIG-GUID: ywP7mD0MEFutHbcB5rJcMaHfAmR5Q4o2 X-Proofpoint-GUID: ywP7mD0MEFutHbcB5rJcMaHfAmR5Q4o2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfXzNBQ8FCvbPlv uG0O/dB6uVR9A2FKm4FpDpwfvoASVC+YAf4dpk8/WV7QaRC5jgpFbOm+n7wD3LEo6raXlRl4zmd VIs9E/k0bsjdwAuqaGTXUEElWVK+WBSalAknLNxEyyXvSZVPvDmaJm+Z1+k5BxMCvSCxMrILgy7 d/zsXQwKQ1xCmTpW9vbNFTC7lciDQrL9na8+vXd5KTvMpR27FAmniybMWd/0L7O9B3+fFHDaTpi fDWz5TF2vVpi0mGfEwE+1YAakd49Z/Ph9VJtNLCslF5Qr6oahjOkET3YvuBCPeN0Xxhy1E+8/Sh a/Pug5SzCFOQNLkgXXKHyrnB/27A6DgaRp4JET7lXz5EsQzJSoeO6fiFS9lpKmVgJBPugeZqBW5 c7R7hJJvPBPcJ5s0d9LUgK3hkQtljMS/8DrrUd+VFAoTNR15wEMjwfkM2THEJ4/mLtwewUIzauo wKUhq+x7b3EoEDsBH7Q== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE5MDA4MCBTYWx0ZWRfX4uAFRzE0QvS2 R10pdAkvepN52gfKPXxSl7Kj7YwtVj2qlP+82Q59oxEwUwDqbaqw+m+2xOgDOEDHSpwUAfkcL3Q q4b1oypCHxjVQ1z+nKKe08mvjEi5gaM= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-19_05,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611190080 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: 1795119411153158500 The shared migration test only checks that RAM migrates. Add a Hexagon specific qtest on the sm8975-nsp machine, with two hardware threads, that checks the architectural state a migration must carry: scalar and predicate registers, SSR and CCR context selection, distinct HVX and HLX register contents in two contexts, QTimer and L2VIC state, and a thread blocked on the K0 lock. It runs the same checkpoint through a stopped migration, a precopy migration paused before switchover, and an internal qcow2 snapshot (savevm/loadvm) in an already used VM. The guest uses raw HLX encodings, each annotated with its mnemonic, so that it can be regenerated with toolchains whose assembler lacks HLX support. The host test and the guest share the mailbox layout in state.h. The test waits for the second thread's PC with 'info registers' because QMP has no structured query for a CPU's PC or lock wait state. Signed-off-by: Brian Cain --- MAINTAINERS | 1 + tests/qtest/migration/hexagon/guest.h | 47 ++++ tests/qtest/migration/hexagon/state.h | 29 +++ tests/qtest/hexagon-migration-test.c | 312 +++++++++++++++++++++++++ tests/qtest/meson.build | 4 +- tests/qtest/migration/hexagon/Makefile | 22 +- tests/qtest/migration/hexagon/guest.S | 124 ++++++++++ 7 files changed, 536 insertions(+), 3 deletions(-) create mode 100644 tests/qtest/migration/hexagon/guest.h create mode 100644 tests/qtest/migration/hexagon/state.h create mode 100644 tests/qtest/hexagon-migration-test.c create mode 100644 tests/qtest/migration/hexagon/guest.S diff --git a/MAINTAINERS b/MAINTAINERS index 5baf78faa55..b3d0d1b4cbb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1396,6 +1396,7 @@ F: configs/devices/hexagon-softmmu/default.mak F: docs/system/hexagon/ F: tests/functional/hexagon/ F: tests/qtest/hexagon-config-test.c +F: tests/qtest/hexagon-migration-test.c F: tests/qtest/migration/hexagon/ F: tests/qtest/qcom-dsp-test.c F: docs/devel/hexagon-sys.rst diff --git a/tests/qtest/migration/hexagon/guest.h b/tests/qtest/migration/= hexagon/guest.h new file mode 100644 index 00000000000..c647274d733 --- /dev/null +++ b/tests/qtest/migration/hexagon/guest.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This file is automatically generated from the assembly file in + * tests/qtest/migration/hexagon. Edit that file and then run "make" + * inside tests/qtest/migration to update, and then remember to send both + * the header and the assembler differences in your patch submission. + */ +#define HEXAGON_PEER_LOCK_PC 0x80010198 +static const uint8_t guest_bin[] =3D { + 0x00, 0x48, 0x00, 0x08, 0x10, 0xc0, 0x00, 0x78, 0x00, 0xc0, 0x88, 0x6e, + 0x00, 0xc0, 0x00, 0x75, 0xbe, 0xc0, 0x20, 0x5c, 0x00, 0x44, 0x00, 0x08, + 0x00, 0xc0, 0x00, 0x78, 0x10, 0xc0, 0x00, 0x67, 0x00, 0xc0, 0x86, 0x6e, + 0x00, 0xdf, 0xc0, 0x8c, 0x06, 0xc0, 0x00, 0x67, 0xa0, 0xc6, 0x00, 0x78, + 0x40, 0xc0, 0xc0, 0x19, 0xe0, 0xca, 0x00, 0x78, 0x5f, 0xc0, 0xc0, 0x19, + 0x03, 0xc0, 0x80, 0x1f, 0x00, 0xc0, 0x86, 0x6e, 0x00, 0xdb, 0xc0, 0x8c, + 0x06, 0xc0, 0x00, 0x67, 0xc0, 0xc8, 0x00, 0x78, 0x40, 0xc0, 0xc0, 0x19, + 0x00, 0xcd, 0x00, 0x78, 0x5f, 0xc0, 0xc0, 0x19, 0x03, 0xc0, 0x9f, 0x1f, + 0x00, 0x40, 0x00, 0x01, 0x00, 0xc0, 0x00, 0x78, 0x07, 0xc0, 0x00, 0x67, + 0x48, 0x40, 0x00, 0x00, 0x8a, 0xc6, 0x00, 0x78, 0x2c, 0xe4, 0x2a, 0xe5, + 0x00, 0x40, 0x02, 0x01, 0x00, 0xc0, 0x00, 0x78, 0x07, 0xc0, 0x00, 0x67, + 0x59, 0x41, 0x00, 0x00, 0x0a, 0xc7, 0x00, 0x78, 0x2c, 0xe4, 0x2a, 0xe5, + 0x60, 0xc0, 0x20, 0x6c, 0x40, 0xc0, 0x00, 0x78, 0x20, 0xc0, 0x60, 0x64, + 0xfb, 0x76, 0xea, 0x0d, 0xf4, 0xc5, 0x00, 0x78, 0xc8, 0x50, 0x65, 0x07, + 0x15, 0xc2, 0x00, 0x78, 0xfc, 0x6b, 0x55, 0x0a, 0x00, 0xc0, 0x00, 0x78, + 0x04, 0xc0, 0x20, 0x62, 0x64, 0x45, 0x14, 0x03, 0xc0, 0xc4, 0x00, 0x78, + 0x00, 0xc0, 0x00, 0x67, 0x0b, 0xd4, 0x90, 0xa1, 0x81, 0xc0, 0x50, 0x3c, + 0x81, 0xc1, 0x90, 0x91, 0x21, 0xc0, 0x01, 0xb0, 0x0c, 0xc1, 0x90, 0xa1, + 0x00, 0xc0, 0x90, 0x91, 0x00, 0xc0, 0x00, 0x75, 0x06, 0xc0, 0x20, 0x5c, + 0x04, 0xc0, 0x40, 0x54, 0xf2, 0xff, 0xff, 0x59, 0x05, 0xd4, 0x90, 0xa1, + 0x06, 0xd5, 0x90, 0xa1, 0x00, 0xc0, 0x04, 0x6a, 0x07, 0xc0, 0x90, 0xa1, + 0x00, 0xc0, 0x86, 0x6e, 0x08, 0xc0, 0x90, 0xa1, 0x00, 0xc0, 0x87, 0x6e, + 0x09, 0xc0, 0x90, 0xa1, 0x00, 0xc0, 0x80, 0x6e, 0x0a, 0xc0, 0x90, 0xa1, + 0x40, 0x48, 0x00, 0x08, 0x00, 0xc0, 0x00, 0x78, 0x00, 0xc0, 0x20, 0x28, + 0x1f, 0xc1, 0x20, 0x28, 0x61, 0xe0, 0xff, 0x1e, 0x01, 0xc2, 0x20, 0x28, + 0x80, 0x48, 0x00, 0x08, 0x06, 0xc0, 0x00, 0x78, 0xac, 0x79, 0x00, 0xe5, + 0x06, 0xc0, 0x86, 0xa4, 0x00, 0xc0, 0x86, 0x6e, 0x20, 0xdb, 0xc0, 0x8c, + 0x06, 0xc0, 0x00, 0x67, 0x60, 0x48, 0x00, 0x08, 0x00, 0xc0, 0x00, 0x78, + 0x00, 0xc0, 0x20, 0x28, 0x1f, 0xc1, 0x20, 0x28, 0x61, 0xe0, 0xff, 0x1e, + 0x01, 0xc2, 0x20, 0x28, 0x00, 0x40, 0x00, 0x01, 0x00, 0xc0, 0x00, 0x78, + 0x07, 0xc0, 0x00, 0x67, 0xa0, 0x48, 0x00, 0x08, 0x06, 0xc0, 0x00, 0x78, + 0xac, 0x79, 0x00, 0xe5, 0x06, 0xc0, 0x86, 0xa4, 0x80, 0xc0, 0x20, 0x6c, + 0x01, 0xc2, 0x50, 0x3c, 0x04, 0xc0, 0x40, 0x54, 0xfe, 0xff, 0xff, 0x59, + 0xc0, 0x7b, 0xaf, 0x0c, 0xb6, 0xc1, 0x00, 0x78, 0x01, 0xc1, 0x50, 0x3c, + 0x60, 0xc0, 0x20, 0x6c, 0x0d, 0xd6, 0x90, 0xa1, 0x80, 0xc0, 0x20, 0x6c, + 0x81, 0xc1, 0x50, 0x3c, 0xee, 0xff, 0xff, 0x59 +}; diff --git a/tests/qtest/migration/hexagon/state.h b/tests/qtest/migration/= hexagon/state.h new file mode 100644 index 00000000000..6a4c05bd9d8 --- /dev/null +++ b/tests/qtest/migration/hexagon/state.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef HEXAGON_MIGRATION_STATE_H +#define HEXAGON_MIGRATION_STATE_H + +/* SM8975 NSP DDR and device map; mailbox fields are byte offsets. */ +#define STATE_KERNEL_ADDR 0x80010000 +#define STATE_MAILBOX 0x80020000 +#define STATE_RELEASE 0 +#define STATE_READY 4 +#define STATE_PEER_READY 8 +#define STATE_PEER_DONE 12 +#define STATE_DONE 16 +#define STATE_R20 20 +#define STATE_R21 24 +#define STATE_PREDICATES 28 +#define STATE_SSR 32 +#define STATE_CCR 36 +#define STATE_SGP0 40 +#define STATE_MEMORY 44 +#define STATE_HEARTBEAT 48 +#define STATE_PEER_R22 52 +#define STATE_HVX1 0x80021000 +#define STATE_HVX0 0x80021800 +#define STATE_HLX1 0x80022000 +#define STATE_HLX0 0x80022800 +#define STATE_QTIMER 0x263a1000 +#define STATE_L2VIC 0x26390000 + +#endif diff --git a/tests/qtest/hexagon-migration-test.c b/tests/qtest/hexagon-mig= ration-test.c new file mode 100644 index 00000000000..b9a774aa6a8 --- /dev/null +++ b/tests/qtest/hexagon-migration-test.c @@ -0,0 +1,312 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Same-build Hexagon migration and internal snapshot regression tests. */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "qobject/qdict.h" +#include "migration/hexagon/guest.h" +#include "migration/hexagon/state.h" +#include "migration/migration-qmp.h" + +#define TIMEOUT_US (30 * G_USEC_PER_SEC) + +/* QTimer registers; each frame is 0x1000 bytes after the previous one. */ +#define QTIMER_CNTPCT_LO 0x000 +#define QTIMER_CNTP_CVAL_LO(f) (0x020 + (f) * 0x1000) +#define QTIMER_CNTP_CTL(f) (0x02c + (f) * 0x1000) +#define QTIMER_CTL_ENABLE 1 +#define QTIMER_CTL_EXPIRED 5 /* enabled, IMASK clear, ISTATUS s= et */ + +/* L2VIC registers and the interrupt lines this test looks at. */ +#define L2VIC_INT_TYPEn 0x280 +#define L2VIC_SOFT_INTn 0x480 +#define L2VIC_INT_PENDINGn 0x500 +#define L2VIC_QTIMER0_IRQ 2 +#define L2VIC_QTIMER1_IRQ 3 +#define L2VIC_SOFT_IRQ 10 +#define PENDING_TIMER0_SOFT \ + ((1 << L2VIC_QTIMER0_IRQ) | (1 << L2VIC_SOFT_IRQ)) +#define PENDING_ALL (PENDING_TIMER0_SOFT | (1 << L2VIC_QTIMER1_IRQ)) + +static char *tmpdir; +static char *guest_path; + +static uint32_t mailbox_read(QTestState *vm, unsigned offset) +{ + return qtest_readl(vm, STATE_MAILBOX + offset); +} + +static void wait_word(QTestState *vm, uint64_t addr, uint32_t value) +{ + int64_t deadline =3D g_get_monotonic_time() + TIMEOUT_US; + + while (qtest_readl(vm, addr) !=3D value) { + g_assert_cmpint(g_get_monotonic_time(), <, deadline); + g_usleep(1000); + } +} + +static uint32_t qtimer_ctl(QTestState *vm, unsigned frame) +{ + return qtest_readl(vm, STATE_QTIMER + QTIMER_CNTP_CTL(frame)); +} + +static uint32_t l2vic_pending(QTestState *vm, uint32_t mask) +{ + return qtest_readl(vm, STATE_L2VIC + L2VIC_INT_PENDINGn) & mask; +} + +static uint64_t qtimer_deadline(QTestState *vm) +{ + return qtest_readq(vm, STATE_QTIMER + QTIMER_CNTP_CVAL_LO(1)); +} + +static uint64_t qtimer_count(QTestState *vm) +{ + return qtest_readq(vm, STATE_QTIMER + QTIMER_CNTPCT_LO); +} + +static void stop_vm(QTestState *vm) +{ + qtest_qmp_assert_success(vm, "{'execute':'stop'}"); + qtest_qmp_eventwait(vm, "STOP"); +} + +static QTestState *start_vm(const char *extra) +{ + return qtest_initf("-machine sm8975-nsp -m 16M -smp 2 " + "-accel tcg,thread=3Dsingle -icount shift=3D0,sleep= =3Doff " + "-device loader,file=3D%s,addr=3D0x%x,cpu-num=3D0," + "force-raw=3Don %s", guest_path, STATE_KERNEL_ADDR,= extra); +} + +static void wait_checkpoint(QTestState *vm) +{ + int64_t deadline =3D g_get_monotonic_time() + TIMEOUT_US; + g_autofree char *pc =3D g_strdup_printf("pc =3D 0x%08x", + HEXAGON_PEER_LOCK_PC); + + wait_word(vm, STATE_MAILBOX + STATE_READY, 1); + wait_word(vm, STATE_MAILBOX + STATE_PEER_READY, 1); + /* Wait until the second CPU has reached the blocking lock instruction= . */ + while (true) { + QDict *reply =3D qtest_qmp(vm, + "{'execute':'human-monitor-command','arguments':" + "{'command-line':'info registers','cpu-index':1}}"); + const char *output; + bool found; + + g_assert_true(qdict_haskey(reply, "return")); + output =3D qdict_get_str(reply, "return"); + found =3D strstr(output, pc) !=3D NULL; + + if (!found && g_get_monotonic_time() >=3D deadline) { + g_error("Expected %s in registers: %s", pc, output); + } + qobject_unref(reply); + if (found) { + break; + } + g_usleep(1000); + } + g_assert_cmphex(mailbox_read(vm, STATE_PEER_DONE), =3D=3D, 0); +} + +static void arm_future_timer(QTestState *vm) +{ + uint64_t now =3D qtimer_count(vm); + + /* Frame 1 has a deadline still in the future at the checkpoint. */ + qtest_writel(vm, STATE_QTIMER + QTIMER_CNTP_CTL(1), 0); + qtest_writeq(vm, STATE_QTIMER + QTIMER_CNTP_CVAL_LO(1), now + 1024); + qtest_writel(vm, STATE_QTIMER + QTIMER_CNTP_CTL(1), QTIMER_CTL_ENABLE); + g_assert_cmphex(qtimer_ctl(vm, 1), =3D=3D, QTIMER_CTL_ENABLE); +} + +static void prepare_devices(QTestState *vm) +{ + /* Dispatch frame 0's expiry callback before freezing the clock. */ + qtest_writeq(vm, STATE_QTIMER + QTIMER_CNTP_CVAL_LO(0), 0); + qtest_writel(vm, STATE_QTIMER + QTIMER_CNTP_CTL(0), QTIMER_CTL_ENABLE); + qtest_qmp_assert_success(vm, "{'execute':'cont'}"); + wait_word(vm, STATE_QTIMER + QTIMER_CNTP_CTL(0), QTIMER_CTL_EXPIRED); + stop_vm(vm); + arm_future_timer(vm); + /* Keep an independent software interrupt pending alongside the timer.= */ + qtest_writel(vm, STATE_L2VIC + L2VIC_INT_TYPEn, 1 << L2VIC_SOFT_IRQ); + qtest_writel(vm, STATE_L2VIC + L2VIC_SOFT_INTn, 1 << L2VIC_SOFT_IRQ); + g_assert_cmphex(qtimer_ctl(vm, 0), =3D=3D, QTIMER_CTL_EXPIRED); + g_assert_cmphex(l2vic_pending(vm, PENDING_TIMER0_SOFT), =3D=3D, + PENDING_TIMER0_SOFT); +} + +static void check_devices(QTestState *vm, uint64_t now, uint64_t compare) +{ + g_assert_cmphex(qtest_readl(vm, STATE_L2VIC + L2VIC_INT_TYPEn), =3D=3D, + 1 << L2VIC_SOFT_IRQ); + g_assert_cmphex(qtimer_count(vm), =3D=3D, now); + g_assert_cmphex(qtimer_deadline(vm), =3D=3D, compare); + g_assert_cmphex(qtimer_ctl(vm, 0), =3D=3D, QTIMER_CTL_EXPIRED); + g_assert_cmphex(qtimer_ctl(vm, 1), =3D=3D, QTIMER_CTL_ENABLE); + g_assert_cmphex(l2vic_pending(vm, PENDING_TIMER0_SOFT), =3D=3D, + PENDING_TIMER0_SOFT); +} + +static void check_bytes(QTestState *vm, uint64_t addr, size_t size, + uint16_t pattern) +{ + g_autofree uint8_t *data =3D g_malloc(size); + + qtest_memread(vm, addr, data, size); + for (size_t i =3D 0; i < size; i++) { + g_assert_cmphex(data[i], =3D=3D, (pattern >> (8 * (i & 1))) & 0xff= ); + } +} + +static void check_guest(QTestState *vm) +{ + qtest_writel(vm, STATE_MAILBOX + STATE_RELEASE, 1); + qtest_qmp_assert_success(vm, "{'execute':'cont'}"); + wait_word(vm, STATE_MAILBOX + STATE_DONE, 1); + wait_word(vm, STATE_MAILBOX + STATE_PEER_DONE, 1); + /* Check that the migrated deadline fires after resuming. */ + wait_word(vm, STATE_QTIMER + QTIMER_CNTP_CTL(1), QTIMER_CTL_EXPIRED); + stop_vm(vm); + g_assert_cmphex(mailbox_read(vm, STATE_R20), =3D=3D, 0xdeadbeef); + g_assert_cmphex(mailbox_read(vm, STATE_R21), =3D=3D, 0x76543210); + g_assert_cmphex(mailbox_read(vm, STATE_PREDICATES), =3D=3D, 0xa55aff00= ); + g_assert_cmphex(mailbox_read(vm, STATE_SSR), =3D=3D, 0x88020000); + g_assert_cmphex(mailbox_read(vm, STATE_CCR), =3D=3D, 0x10200000); + g_assert_cmphex(mailbox_read(vm, STATE_SGP0), =3D=3D, 0x31415926); + g_assert_cmphex(mailbox_read(vm, STATE_MEMORY), =3D=3D, 0xdeadbeef); + g_assert_cmphex(mailbox_read(vm, STATE_PEER_R22), =3D=3D, 0xcafef00d); + check_bytes(vm, STATE_HVX1, 128, 0x4646); + check_bytes(vm, STATE_HVX1 + 128, 128, 0x6868); + check_bytes(vm, STATE_HVX1 + 256, 128, 0x6868); + check_bytes(vm, STATE_HVX0, 128, 0x3535); + check_bytes(vm, STATE_HVX0 + 128, 128, 0x5757); + check_bytes(vm, STATE_HVX0 + 256, 128, 0x3535); + check_bytes(vm, STATE_HLX1, 2048, 0x5678); + check_bytes(vm, STATE_HLX0, 2048, 0x1234); + g_assert_cmphex(l2vic_pending(vm, PENDING_ALL), =3D=3D, PENDING_ALL); +} + +static void test_migration(gconstpointer opaque) +{ + g_autofree char *uri =3D g_strdup_printf("unix:%s/migrate.sock", tmpdi= r); + QTestState *source =3D start_vm(""); + QTestState *dest; + bool live =3D GPOINTER_TO_UINT(opaque); + uint64_t now, compare; + uint32_t heartbeat; + + wait_checkpoint(source); + stop_vm(source); + prepare_devices(source); + now =3D qtimer_count(source); + compare =3D qtimer_deadline(source); + heartbeat =3D mailbox_read(source, STATE_HEARTBEAT); + if (live) { + migrate_set_capability(source, "pause-before-switchover", true); + qtest_qmp_assert_success(source, "{'execute':'cont'}"); + } + dest =3D start_vm("-incoming defer -S"); + migrate_incoming_qmp(dest, uri, NULL, "{}"); + migrate_qmp(source, dest, uri, NULL, "{}"); + if (live) { + QDict *status; + + wait_for_migration_status(source, "pre-switchover", NULL); + status =3D qtest_qmp_assert_success_ref(source, + "{'execute':'query-status'}"); + g_assert_false(qdict_get_bool(status, "running")); + qobject_unref(status); + qtest_qmp_eventwait(source, "STOP"); + g_assert_cmpuint(mailbox_read(source, STATE_HEARTBEAT), >, heartbe= at); + arm_future_timer(source); + now =3D qtimer_count(source); + compare =3D qtimer_deadline(source); + heartbeat =3D mailbox_read(source, STATE_HEARTBEAT); + migrate_continue(source, "pre-switchover"); + } + wait_for_migration_complete(source); + wait_for_migration_complete(dest); + /* Kill the source before checking state or allowing the guest to fini= sh. */ + qtest_quit(source); + check_devices(dest, now, compare); + g_assert_cmphex(mailbox_read(dest, STATE_HEARTBEAT), =3D=3D, heartbeat= ); + check_guest(dest); + qtest_quit(dest); +} + +static void snapshot_command(QTestState *vm, const char *command) +{ + g_autofree char *output =3D qtest_hmp(vm, "%s checkpoint", command); + + g_assert_cmpstr(output, =3D=3D, ""); +} + +static void test_snapshot(void) +{ + g_autofree char *disk =3D g_strdup_printf("%s/state.qcow2", tmpdir); + g_autofree char *args =3D g_strdup_printf( + "-drive if=3Dnone,id=3Dstate,file=3D%s,format=3Dqcow2", disk); + QTestState *vm; + uint64_t now, compare; + uint32_t heartbeat; + + if (!have_qemu_img()) { + g_test_skip("qemu-img is required for qcow2 snapshot testing"); + return; + } + g_assert_true(mkimg(disk, "qcow2", 8)); + vm =3D start_vm(args); + wait_checkpoint(vm); + stop_vm(vm); + prepare_devices(vm); + now =3D qtimer_count(vm); + compare =3D qtimer_deadline(vm); + heartbeat =3D mailbox_read(vm, STATE_HEARTBEAT); + snapshot_command(vm, "savevm"); + /* Change registers, memory, context selection and lock state. */ + check_guest(vm); + qtest_writel(vm, STATE_MAILBOX + STATE_MEMORY, 0); + snapshot_command(vm, "loadvm"); + g_assert_cmphex(qtest_readl(vm, STATE_MAILBOX), =3D=3D, 0); + g_assert_cmphex(mailbox_read(vm, STATE_PEER_DONE), =3D=3D, 0); + g_assert_cmphex(mailbox_read(vm, STATE_DONE), =3D=3D, 0); + g_assert_cmphex(mailbox_read(vm, STATE_MEMORY), =3D=3D, 0xdeadbeef); + g_assert_cmphex(mailbox_read(vm, STATE_HEARTBEAT), =3D=3D, heartbeat); + check_devices(vm, now, compare); + check_guest(vm); + snapshot_command(vm, "delvm"); + qtest_quit(vm); + unlink(disk); +} + +int main(int argc, char **argv) +{ + int result; + + g_test_init(&argc, &argv, NULL); + if (qtest_has_accel("tcg")) { + tmpdir =3D g_dir_make_tmp("hexagon-migration-XXXXXX", NULL); + g_assert_nonnull(tmpdir); + guest_path =3D g_strdup_printf("%s/guest.bin", tmpdir); + g_assert_true(g_file_set_contents(guest_path, (const char *)guest_= bin, + sizeof(guest_bin), NULL)); + qtest_add_data_func("/migration/stopped", GUINT_TO_POINTER(false), + test_migration); + qtest_add_data_func("/migration/precopy", GUINT_TO_POINTER(true), + test_migration); + qtest_add_func("/migration/snapshot", test_snapshot); + } + result =3D g_test_run(); + if (tmpdir) { + unlink(guest_path); + g_free(guest_path); + g_assert_cmpint(rmdir(tmpdir), =3D=3D, 0); + g_free(tmpdir); + } + return result; +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 67410b3778f..2a987fcb49d 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -331,7 +331,7 @@ qtests_riscv64 =3D ['riscv-csr-test'] + \ qtests_hexagon =3D ['boot-serial-test', 'hexagon-config-test', 'l2vic-test= ', 'qcom-dsp-test', 'qct-qtimer-test', - 'migration-test'] + 'hexagon-migration-test', 'migration-test'] =20 qos_test_ss =3D ss.source_set() qos_test_ss.add( @@ -442,6 +442,8 @@ qtests =3D { [gio], 'erst-test': files('erst-test.c'), 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'], + 'hexagon-migration-test': files('migration/migration-qmp.c', + 'migration/migration-util.c'), 'migration-test': test_migration_files + migration_tls_files + migration= _colo_files, 'pxe-test': files('boot-sector.c'), 'pnv-xive2-test': files('pnv-xive2-common.c', 'pnv-xive2-flush-sync.c', diff --git a/tests/qtest/migration/hexagon/Makefile b/tests/qtest/migration= /hexagon/Makefile index 5000de63044..f9025ccb1a0 100644 --- a/tests/qtest/migration/hexagon/Makefile +++ b/tests/qtest/migration/hexagon/Makefile @@ -12,7 +12,7 @@ NM =3D llvm-nm define-value =3D $(shell awk '$$2 =3D=3D "$(1)" { print $$3 }' $(2)) =20 .PHONY: all clean -all: a-b-kernel.h +all: a-b-kernel.h guest.h =20 a-b-kernel.h: hexagon.kernel echo "$$__note" > $@ @@ -26,5 +26,23 @@ hexagon.elf: a-b-kernel.S ../bootfile.h -Wl,-Ttext=3D$(call define-value,HEXAGON_TEST_KERNEL_ADDR,../bootfile= .h) \ -Wl,-e,_start $< -o $@ =20 +# The state guest uses the HVX and HLX extensions of the SM8975 NSP and is +# linked where state.h says the host test loads it. +guest.h: guest.bin guest.elf + echo "$$__note" > $@ + $(NM) guest.elf | awk '$$3 =3D=3D "peer_lock" \ + { print "#define HEXAGON_PEER_LOCK_PC 0x"$$1 }' >> $@ + xxd -i guest.bin | sed -e 's/^unsigned char/static const uint8_t/' \ + -e '/unsigned int guest_bin_len/d' >> $@ + +guest.bin: guest.elf + $(OBJCOPY) -O binary --only-section=3D.text $< $@ + +guest.elf: guest.S state.h + $(CC) -mcpu=3Dhexagonv81 -mhvx -mhvx-length=3D128b -nostdlib -static \ + -fno-pie -Wl,--build-id=3Dnone \ + -Wl,-Ttext=3D$(call define-value,STATE_KERNEL_ADDR,state.h) \ + -Wl,-e,_start $< -o $@ + clean: - $(RM) *.kernel *.elf + $(RM) *.kernel *.elf *.bin diff --git a/tests/qtest/migration/hexagon/guest.S b/tests/qtest/migration/= hexagon/guest.S new file mode 100644 index 00000000000..74300d30367 --- /dev/null +++ b/tests/qtest/migration/hexagon/guest.S @@ -0,0 +1,124 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Migration checkpoint guest, loaded at 0x80010000 on sm8975-nsp. + * r16 points to the host/guest mailbox at 0x80020000. The host releases + * the checkpoint by writing 1 to mailbox[0]. No stack or runtime is used. + */ +#include "state.h" + +.text +.globl _start +_start: + r16 =3D ##STATE_MAILBOX + r0 =3D htid + p0 =3D cmp.eq(r0, #0) + if (!p0) jump peer + r0 =3D ##STATE_KERNEL_ADDR + evb =3D r0 + + /* Distinct state in two shared HVX contexts. */ + r0 =3D ssr + r0 =3D setbit(r0, #31) + ssr =3D r0 + r0 =3D #0x35 + v0.b =3D vsplat(r0) + r0 =3D #0x57 + v31.b =3D vsplat(r0) + q3 =3D vcmp.eq(v0.b, v0.b) + r0 =3D ssr + r0 =3D setbit(r0, #27) + ssr =3D r0 + r0 =3D #0x46 + v0.b =3D vsplat(r0) + r0 =3D #0x68 + v31.b =3D vsplat(r0) + q3 =3D vcmp.eq(v0.b, v31.b) + + /* + * Distinct patterns in the two shared HLX contexts. Raw encodings all= ow + * regeneration with assemblers that do not support HLX mnemonics. + */ + r0 =3D ##0x10000000 + ccr =3D r0 + r10 =3D ##0x1234 + .word 0xe52ae42c /* L6.h =3D r10.h */ + r0 =3D ##0x10200000 + ccr =3D r0 + r10 =3D ##0x5678 + .word 0xe52ae42c /* L6.h =3D r10.h */ + + /* Keep both an owner and a blocked waiter across the checkpoint. */ + k0lock + r0 =3D #2 + start(r0) + r20 =3D ##0xdeadbeef + r21 =3D ##0x76543210 + r0 =3D ##0xa55aff00 + p3:0 =3D r0 + r0 =3D ##0x31415926 + sgp0 =3D r0 + memw(r16 + #STATE_MEMORY) =3D r20 + memw(r16 + #STATE_READY) =3D #1 +checkpoint: + r1 =3D memw(r16 + #STATE_HEARTBEAT) + r1 =3D add(r1, #1) + memw(r16 + #STATE_HEARTBEAT) =3D r1 + r0 =3D memw(r16 + #STATE_RELEASE) + p0 =3D cmp.eq(r0, #0) + if (!p0) jump released + pause(#1) + jump checkpoint +released: + memw(r16 + #STATE_R20) =3D r20 + memw(r16 + #STATE_R21) =3D r21 + r0 =3D p3:0 + memw(r16 + #STATE_PREDICATES) =3D r0 + r0 =3D ssr + memw(r16 + #STATE_SSR) =3D r0 + r0 =3D ccr + memw(r16 + #STATE_CCR) =3D r0 + r0 =3D sgp0 + memw(r16 + #STATE_SGP0) =3D r0 + + /* Read the active contexts before changing the selection. */ + r0 =3D ##STATE_HVX1 + vmem(r0) =3D v0 + vmem(r0 + #1) =3D v31 + v1 =3D vmux(q3, v0, v31) + vmem(r0 + #2) =3D v1 + r6 =3D ##STATE_HLX1 + /* The producer and .new store form one packet. */ + .word 0xe50079ac /* L6.h =3D L6.h */ + .word 0xa486c006 /* mem(r6) =3D L6.new */ + + r0 =3D ssr + r0 =3D clrbit(r0, #27) + ssr =3D r0 + r0 =3D ##STATE_HVX0 + vmem(r0) =3D v0 + vmem(r0 + #1) =3D v31 + v1 =3D vmux(q3, v0, v31) + vmem(r0 + #2) =3D v1 + r0 =3D ##0x10000000 + ccr =3D r0 + r6 =3D ##STATE_HLX0 + /* The producer and .new store form one packet. */ + .word 0xe50079ac /* L6.h =3D L6.h */ + .word 0xa486c006 /* mem(r6) =3D L6.new */ + + k0unlock + memw(r16 + #STATE_DONE) =3D #1 +done: + pause(#1) + jump done + +peer: + r22 =3D ##0xcafef00d + memw(r16 + #STATE_PEER_READY) =3D #1 +.globl peer_lock +peer_lock: + k0lock + memw(r16 + #STATE_PEER_R22) =3D r22 + k0unlock + memw(r16 + #STATE_PEER_DONE) =3D #1 + jump done --=20 2.34.1