From nobody Mon Nov 23 05:10:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790477109; cv=none; d=zohomail.com; s=zohoarc; b=HIqj4UouYn5rPXWpuEb2XCYTZas7fr0AZeSUH05G5+UEpAussIGyAgSkfovTjYIaCFRfGpr735d+j3bu7bEmcMVugh2R/reYy01WiQ6vMsZwE/Sx2E8692VwiAzi7V7tBI3M2ToPjrLXm/qZA7lAY1Ebww3fy+GM/2WVZM6Aa9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790477109; 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=hajtpxF2Cztk5kuYRbyQnh/pr7a1DMFLfRCtDXBoNmY=; b=HnCkQX8394FR94sgUnsAzd8YEGhrgGy1Kpf4R6IZcv3y9V7ufKANZ/nMGM2br2eIfmqljTqUEnIMxqXaD0IwUoKLUH30cI+RrWB8jMddzD2lYAQLKNHIPHk5EIOfIXPepuQ9b7Hx0ktBvvUVsyA8ylgE0LoM/P66tA6+GURwGbQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790477109852992.6939932241822; Sat, 26 Sep 2026 19:45:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xAeru-00052a-Cm; Sat, 26 Sep 2026 22:43:58 -0400 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 1xAers-00051u-EY for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:56 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xAerq-0007Uf-4w for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:56 -0400 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68QNHIle1478410 for ; Sun, 27 Sep 2026 02:43:52 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 4gx526j89d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 27 Sep 2026 02:43:52 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-342b66c0b06so1404985eec.0 for ; Sat, 26 Sep 2026 19:43:52 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-145ac67c3f8sm15459747c88.3.2026.09.26.19.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2026 19:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= hajtpxF2Cztk5kuYRbyQnh/pr7a1DMFLfRCtDXBoNmY=; b=XRRBi1VO/3+O68gC 8EjHzW6Q0eLFlmSRyNZfyZy9kStzBRdgWjBkNV5Y943aXs7AUZUfg1/hl+/jkmUW wEGCDxuOYY585m1BCelUv6QuMmKRczDj4heDRdEqc7DrT4fOB7N2wOHemwrymAmU 4dFkhUeDeFFzgT4Bzd5IaTaFgpIaSkFbAQQON9n5lbk3iZX9+E+GOXpmL0IvFSxE lghSUT8Vls/3zRtlGiw7+/Fc4eaZB9SCT0SJmbr76PzrJXGMtgtOhMTBkmwxFQwS 0Qmr9orxhs2ZU8G5TxV/mS05kOmg4UZgmfykQeLwfFqx8qUHwb0+qameSMuShGqd nN6zng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790477031; x=1791081831; 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=hajtpxF2Cztk5kuYRbyQnh/pr7a1DMFLfRCtDXBoNmY=; b=iPpVkay7E7tJueTK0Y9sSyI3lCLSx2UiejsVwW0R+wZj5xGKYUKtZ6UxyeOwk6mXFS 63wjdRFV9KE1Vs7+gdsXdVLlfXXfx2+qupz/MK/kyYs1qDuK3wYNaHGsQuyNA0OltL5s yQFFMl/tjmlGBkRqyAg4XT7XD43oPkNlfhhOrNn1PDlC/QzR7B4603HnOGrSRcC2NCQt GbYuYkdZiwBxjs9FAFy0jCsHTjBkvUqMVYVunAmBWakEgzMq5L3zCaWpG3xfFjSXmWtf xGevHT0naC6iL6vasq3HMzem7IsAI6bu3npkKC1m+PdBMs0zXV9x6Z2LknNyho4U9CNX Q0RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790477031; x=1791081831; 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=hajtpxF2Cztk5kuYRbyQnh/pr7a1DMFLfRCtDXBoNmY=; b=2YCoDgAYq+WU0g8vHsrLNoiyNzVsd2JoRzT+oCySO7+oxDvsMJdkAbgVh6drWWqGDc 3YvhKSreMXcjqhunYgErzW9tgo4QYB8T13I6ZvlMaphYosbPyCa/a83T1NJpH2ss0QqH IJ4Riflsk7f4YQ2HdCJ3+Paz3dJwF7rEmKKxMmHVscT8efxXtOmHV6wXC6sSFJF2tWv+ RIo03bSxME8jVlKr8Zp4GLEqQaZ8lbUY7hh6j6ZHJAqa3c0spFneYBMwb8wRdnbytx9y agtoEfnG7cuWHX7cLapQmdgDRfG9wXVLNJy5aZqb87QnCe7gbLv407DwV5h5rklDumrU AgkA== X-Gm-Message-State: AFuF++klEz6XCN4TUGfkkF9cdwE2ZPqAxBkY6BmmIPi2G1k9LeXjkQyl tKP1YEL7eYeEqM/5nMQ2xZw4QSe3Mjl0hD1sAIt6Z2mB2W57RaSChnunyGlxb8uOH+e/GEiFray iwu62V369NYMe1eDO2kATjwFGM7D4P47QE8BUPzFZFvnw1eqZCjB5lvM4pvcmdlHg5A== X-Gm-Gg: AYBFou0NGJsP0noShgm5e9V1hYnxdsLpuTfIjdVG7KoowRqsUKKTKPdYf1IyQBnYpfe oisVUyqoy77wFOctxLWwXBE7YWuKtLkRFy7g7pnad3yY4i9BPTsYmwbkN2RqCuJ5wtHN/6apFrH nP7/Wy6Zkr+9Vg0v+dI4DcMIX5WOVKY/DTKMtqgeYGOhmw5icapF4mnJRmgLR9HvNTv95VnQ6pj t47hRt+meXOuS8WXnDD/uXIg9ok5AXpcP3ttF6HzjIoB+QDMXmucehilycCF6QI+g69PGeJFeSq TTk2Kun+sK6x3UFFPGMHjIneSfuIIL9f1rinHE882IYN6iyiszKWg/iNoeRqoGSZ3LP1FhyDXmc kZmY0NeRr3GDfhL02E+eHbD8U86MowW83Phx/0EeOFnYKvUM= X-Received: by 2002:a05:701b:4591:10b0:143:1bb1:3305 with SMTP id a92af1059eb24-146d0871d4emr4281487c88.22.1790477030413; Sat, 26 Sep 2026 19:43:50 -0700 (PDT) X-Received: by 2002:a05:701b:4591:10b0:143:1bb1:3305 with SMTP id a92af1059eb24-146d0871d4emr4281461c88.22.1790477029873; Sat, 26 Sep 2026 19:43:49 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Brian Cain , Helge Deller , Pierrick Bouvier , marco.liebel@oss.qualcomm.com, Laurent Vivier Subject: [PATCH 1/5] target/hexagon: emit explicit TCG memory barriers Date: Sat, 26 Sep 2026 19:43:43 -0700 Message-Id: <20260927024347.3545385-2-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> References: <20260927024347.3545385-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=VvS2kO2n c=1 sm=1 tr=0 ts=6ab882e8 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=4KcYvu_XbJg6GINjK8oA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-GUID: 8NTXnkFlW0vhiAISTe4qDftr1GM2Z208 X-Proofpoint-ORIG-GUID: 8NTXnkFlW0vhiAISTe4qDftr1GM2Z208 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX4jOg8NxgQr7y MIo0njBCE3VbD7omGYn4cRvuMdUsPnekUZ/rs+YzXZeks0i4BR2INZZwfxXGUxaqrAWRt4Z7GGQ mvSd0B9VqbduDK+Jn3OE/QpEw9CGriikAMmLF4nAtY/i4VSB1FHStuiUXJkIZLrmNz8UxRhTFds DvOOA5FlBN0r7OcsA0vbVsMzoaq53YdgHSFWXpw2RI0e9Wy8+S3eicJo4X7u+gBEiNCfXT1TUrY 4vVJi/lrEjjTucory+Sz8svqxBPjpwNBmLQ3xFP/KYJPtggQWHyXqfZ5CqttVnkIhPF7SDLS94p IH+ew2fsYoDQa7cBHoT/BMgcBtNjk94GaF/TaRRpfPgnlaNjrTAkykobmmpIIQS4di0Cfl1fj7o 5yySeBz07ci5gheZPpPV9Tzc0LMeLzbtKTTvAW2rHG1DHuS44VYGJzX58P2I9EHrH4gqR5xaHSG KPirLMu3zVl6JojLgjQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX+qb4s8pRE9k7 8ukOdT/HSTCEcXg4qHwojczg86U4I60u3ALSK9NYJzX70tEdUo0oxvWUfap4Inv/Exu/W8T8hsR 3S1Jy53p7M8vMe82YgkvXkTbh3+kkOQ= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-26_05,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609270010 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: 1790477112465158500 Generate release barriers before release and HVX scatter-release operations, acquire barriers after acquire loads, and full barriers for barrier, syncht, isync, and dmsyncht. Signed-off-by: Brian Cain Reviewed-by: Marco Liebel --- target/hexagon/translate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 827859e052c..1dae60c0390 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -831,12 +831,27 @@ static void mark_store_width(DisasContext *ctx) =20 static void gen_insn(DisasContext *ctx) { + uint16_t opcode =3D ctx->insn->opcode; + + if (GET_ATTRIB(opcode, A_RELEASE) || + GET_ATTRIB(opcode, A_CVI_SCATTER_RELEASE)) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); + } + if (ctx->insn->generate) { ctx->insn->generate(ctx); mark_store_width(ctx); } else { hex_gen_exception_end_tb(ctx, HEX_CAUSE_INVALID_OPCODE); } + + if (GET_ATTRIB(opcode, A_ACQUIRE)) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); + } + if (opcode =3D=3D Y2_barrier || opcode =3D=3D Y2_syncht || + opcode =3D=3D Y2_isync || opcode =3D=3D Y6_dmsyncht) { + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); + } } =20 /* --=20 2.34.1 From nobody Mon Nov 23 05:10:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790477116; cv=none; d=zohomail.com; s=zohoarc; b=kndaPp1Q0dxyGohVtzHfGVQoaPvxUnwYZCz1NQ5zHb0Q++jpMSJQ0mvoiyf5TomZvnuhFPh9O+uqDUsx2oWzJ0v+AU74i3xCr6qgcHzduOhQxWHhg9zR1gVSmdGiW6MD1mI9Zj2jgxB3QmrP9N3Yu+i/myRLv5gjfzV1YlYSa0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790477116; 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=vwBv1XNaXf0AV0dLDWbYf/cD8bQGK2OHFgJKP4zHzNA=; b=HQ9Ey1R/aFfpD+M7CHUc9eJLs39loiSkTueD8WonXml5cSmoHXFXkXk69FmN+GC0s9k/D8/8/PfJ1f81uek7mCJt7hxPB4vIm5nBNch9ru7+r6eZO6jwoZ25u203Denw2A1ZYH+SxhCdSR3SUQCTMYw9nyYCoOD4F/Z96DUMHEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179047711602641.723506932841815; Sat, 26 Sep 2026 19:45:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xAers-00051v-JM; Sat, 26 Sep 2026 22:43:56 -0400 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 1xAerr-00051d-Dj for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:55 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xAerp-0007Ul-Vc for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:55 -0400 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 68QGxnbn091342 for ; Sun, 27 Sep 2026 02:43:53 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 4gx5cgj8t3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 27 Sep 2026 02:43:52 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-30bcb065bfdso3481595eec.0 for ; Sat, 26 Sep 2026 19:43:52 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-145ac67c3f8sm15459747c88.3.2026.09.26.19.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2026 19:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vwBv1XNaXf0AV0dLDWbYf/cD8bQGK2OHFgJKP4zHzNA=; b=KNZNRUl7KeCTmlnf QwqHUwBf+fCp8cWWE0eqSPFEMo9myef6BCD4NKc98KWeg1S4LtJ6BMGJnZHpIaI0 h4e/dVL/4zpdAoWe+x1Gx90jzPPtZ1jmR75PRd92Bsd1eMKRGxvjkA0WtnQrYFCf HLKRk6XJk1OWvbrPY6VeX+E20dESip45I7koJ8elWe4HxcOexkufNfZOVe2n4zxK JzepYuppo5yLR4QbJ4oNfnUrlygY1dXX4tJ43tX+J2rbqC3b1KFhJdr7WUE3S3SA mjnqdZgmaBrtUXCsCRNZN+s+6ATxZvNpxXAodqa1MVvhzTyA3TIOhPeg44Ukukqk 21nXaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790477032; x=1791081832; 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=vwBv1XNaXf0AV0dLDWbYf/cD8bQGK2OHFgJKP4zHzNA=; b=WzXTHCAZfYRFQfYiHC17OcoYF0clhw68rboxBLwXNlqd9u8iTty4btHldu4yqJKQOg h2C/PHzZ90Bl+l9D+rzQmol46rT69huF9HjCWtbwB2Fy9OrVJNtfsi2a2bvxmJUCip/R DtuJjs0zEcrxRP5CAqqMT8TyZq58KMMjDmVAlSVGlImjaZeTKoTX92m/KfATFGSFkQY3 D/gmSh+y3AhpbM9a+pFofzTQXHhiLZPXX7dPdBqQlc5xvSGTStgLkrjman6THwu2TYLv vvpCyputAD+uNH7sXIt+KUs1BacsiV0zp1YpD96jtgsIEXHNolN5JfDGHn7D9Ei3s530 kukA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790477032; x=1791081832; 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=vwBv1XNaXf0AV0dLDWbYf/cD8bQGK2OHFgJKP4zHzNA=; b=LTGAwkUXevWBwqHC5xVtzNFQ/Y8dMJeTNtwwtL69+wuZQHla5xw6dquLKAOlWvo1fL l8A3VJCrvGmOO+DWiMFl8ACe7KEE1Zy3hbhU+IsDRkC2Q+xo3vjj+GscJ8Wi0o04Kylc OZ4l83Tc6Xb+afO3CXubtlORKxMoIkVxFGAw6I+f/q0XZgUUlwT8BBUWmQRRpsFnKEHu nqcWyliebvBTnP5sLfMYgU4OaPpHd1C9MmiZZFsk4fLSUpuE3MT+pxMKk4FtXK6id/06 6b5568NfOV29Rvma1ihDAPcw2FOhoBolh+m6LfxkNseUz2i050vAuyGD0f6WJC7zN/rJ 3l/g== X-Gm-Message-State: AFuF++nDBuJTcwu+cg1NoF3po6tMkP4d/quFDKNn2LVHxfIHDz5bnUaG 7D+s+UVTOm9EmWu8h3Xz1uDkdm0EKfsHDK84EAAtp3+r6ZF9FCEQjm3LOIycDxCVpmr6jsY1Dm/ RC9cSKjSF7F72musWXtuZYVp4ibknWUZ9x2wy7npA+iQYpK6jBYDmqTr0muOfzhMWEA== X-Gm-Gg: AYBFou15GITZHdRkrcOOjSxwB+wgiltDZ10NEtbgjWFBYtLLu1G3v/Ellk2jZFdzqVM YF5zo5zouu+UtYqBXiaox3E3JEs8Lp8ssXGBLw+nt7FCpodp8YkLM/yKRXQ8aGcwsyS61of3aqP GFSmgHYLNOu+/1p1UmcFnGLPOJhkBQjcOIplCuVgJzm8NoHG4QfWL1ayUbPjfQsZSpWaMZyh1TX WQlg3lA2N3WNWnab3xBTtBq7bwrAUQzQtK91+C9JAVSncrubHgJx4xyYlpfDQkP2IzfVNohuttX 4i+zA7YEFzaLIaJpmrJ5YZB2Upd93m06duj1z7omscE7abuvekRvXH/dw12JM0sIwjE51R6ZGeo B3MSrMN0CJqd4k+VqLLPGRuv74DizMrZHfuMe6l0wwqYj390= X-Received: by 2002:a05:701b:21c5:b0:13f:ad08:44aa with SMTP id a92af1059eb24-146ce491ecbmr5720226c88.13.1790477031854; Sat, 26 Sep 2026 19:43:51 -0700 (PDT) X-Received: by 2002:a05:701b:21c5:b0:13f:ad08:44aa with SMTP id a92af1059eb24-146ce491ecbmr5720192c88.13.1790477031248; Sat, 26 Sep 2026 19:43:51 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Brian Cain , Helge Deller , Pierrick Bouvier , marco.liebel@oss.qualcomm.com, Laurent Vivier Subject: [PATCH 2/5] target/hexagon: clear LL/SC reservations at context boundaries Date: Sat, 26 Sep 2026 19:43:44 -0700 Message-Id: <20260927024347.3545385-3-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> References: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX5mjl3y7Ovoog rXxCZrTbGgfTe0kAbizf9hCmqbZ241fVyX5ABoDrQ3+4vG7v77dxSfwXvQ88coYlQ1Tk0o/Z12f iTCpL5B63lbnksqVk7Dvv/0d3Rg+D1caLFnLfRXUmC8iSOkmJR7lG0LuohAd8W6mZ5D9DvPAPuM ZBEXxTxyZxoC1n/qHLcF7ruHtnVb0k79KtcjBr0vTSoq4gomXQy4lAc2j5YKwHzFwBoC/cVIxFc ayjLa7WGMJ6VIceARdCXiyz7mxpO/1u4mhHG5CgMx/7e6CFHbVItkfVB2arA4Nm+l+qhOPhd2HZ O7PLIrcX8WG/HWYrl+tnsKy0IL5sS0OlrtKLJC+N3Cum2cQXmJa2OXl6h1ZPX1zSMPDtlQq3m0B PM/KfC+gBkQnQ4QGbjAGZ7I73jCStVKCClvmTjb9x9+zRtvPfoULV6TBbTjIExLJPSrGHxvbcvh CxqKlLjbFIMDZ3owYhw== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX+yWn4Bb5VSYn s9+HaNuZdjMGWhr0WYQXaTTk0SQ7BElUFqydzFiLuoiJwswBboLJ2JQ9OiqhGZXQ58cMu7ZbELZ gBETxvdQcKlm9QeSPq9SfL3L0sjzS6s= X-Proofpoint-GUID: cgbJhIAhNDYolO34UR6ebl4Ep7liHh4a X-Authority-Analysis: v=2.4 cv=QvLLTlyd c=1 sm=1 tr=0 ts=6ab882e8 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=nIBb1lFIQW7svKiJGhEA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-ORIG-GUID: cgbJhIAhNDYolO34UR6ebl4Ep7liHh4a X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-26_05,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 impostorscore=0 phishscore=0 suspectscore=0 spamscore=0 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609270010 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: 1790477116955158500 Set llsc_addr to ~0 during reset and soft reset, and whenever linux-user returns to guest code for a trap or a signal. Reset previously left llsc_addr zero-initialized, so a store-conditional issued without a matching load-locked could match a guest address of zero. Signed-off-by: Brian Cain Reviewed-by: Marco Liebel --- linux-user/hexagon/cpu_loop.c | 4 ++++ target/hexagon/cpu.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index e4ef97a1184..e6bb3b62a9f 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -39,6 +39,10 @@ void cpu_loop(CPUHexagonState *env) cpu_exec_end(cs); qemu_process_cpu_events(cs); =20 + if (trapnr !=3D EXCP_ATOMIC && trapnr !=3D EXCP_YIELD) { + env->llsc_addr =3D ~0; + } + switch (trapnr) { case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 1f7d8a8df70..7347a3342ce 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -411,6 +411,7 @@ void hexagon_cpu_soft_reset(CPUHexagonState *env) HexagonCPU *cpu; =20 BQL_LOCK_GUARD(); + env->llsc_addr =3D ~0; env->t_sreg[HEX_SREG_SSR] =3D 0; hexagon_ssr_set_cause(env, HEX_CAUSE_RESET); =20 @@ -446,6 +447,8 @@ static void hexagon_cpu_reset_hold(Object *obj, ResetTy= pe type) =20 set_default_nan_mode(1, &env->hvx_fp_status); set_float_default_nan_pattern(0b01111111, &env->hvx_fp_status); + + env->llsc_addr =3D ~0; #ifndef CONFIG_USER_ONLY memset(env->t_sreg, 0, sizeof(uint32_t) * NUM_SREGS); memset(env->greg, 0, sizeof(uint32_t) * NUM_GREGS); --=20 2.34.1 From nobody Mon Nov 23 05:10:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790477109; cv=none; d=zohomail.com; s=zohoarc; b=GwDVHqibEamZf2Kr62XMCXEHt9n2vmtS91KwtkHi5NNmlrA5197/3aRAaNhQ/+n4FtBPbWA6UDKq4+x0wAenqJnyqxogw9QgvnuB2BS/TN/CQu8btFP0XUO7jVfCNQamMKAXZ3/J9jyvjJSSrZuc1Um2RC03/V6RVU7j1EhAJSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790477109; 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=zBYt8cFdzfyjjJx70fgYL1kIJytxJucH9oKmkDpbwfs=; b=kuLdYGDjhXDeoG8MZScdk5PaXXXxtPoVeJNT1biP+ZzRJqipzOyQOlpeXGsIncZub/InyrhMSiELR21Wt6yhcSYxWtOwxeEngm9ZpZgUbRfGgwVd/XvS9bD1puacQ1IyIXgoiloeHxReV5zONv7pi2Xy06sah2+iYvNGQliDYvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790477109646378.3073008402671; Sat, 26 Sep 2026 19:45:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xAerw-000536-6h; Sat, 26 Sep 2026 22:44:00 -0400 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 1xAerv-00052j-0O for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:59 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xAert-0007VL-AF for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:58 -0400 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68R1rexu1788180 for ; Sun, 27 Sep 2026 02:43:56 GMT Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gx526j89e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 27 Sep 2026 02:43:56 +0000 (GMT) Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-1438492fb40so2961206c88.1 for ; Sat, 26 Sep 2026 19:43:56 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-145ac67c3f8sm15459747c88.3.2026.09.26.19.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2026 19:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= zBYt8cFdzfyjjJx70fgYL1kIJytxJucH9oKmkDpbwfs=; b=Zquxe2p7BUzZZLTV CTTm5fPa9BQoMXjbBPtOTGwjmMfg3c6oXZiyyxl59JHUTndvTSVwmPYotnNKHsOU RRljUcQbYS6bsH86opi4oNB7HHE4aPRro/rCz3S3g5E/+5RLSQ90KiRdqyyBCdjn 8JJ87wwedkYcTBjwwaA0/GkFlFvq0F1btQfV3z7vtAM0Y3puJwcmyq0Sd6ZD7Gqd MLBRqVmu6mNa7DSLaTJy9eLYhbl6Q/b/Yq3u8kGHVw58M2pi3pKmSUmCyrybHMhc 24XcVa418D685fz0FavbjvdqHM0MhqiRACbapRM1mdzIsBFPgLi32kaXTd1Fdf4s 64LmKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790477035; x=1791081835; 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=zBYt8cFdzfyjjJx70fgYL1kIJytxJucH9oKmkDpbwfs=; b=c7NTn/6U9LDsCKHJHCBaTZdbdgnsjVEOR5dHBokjYUU0zw8fclZ15OAj0Z2QDBhsmy KI32SpoHDKW8/2EZZZGk263LLHKAO2mT+JXR8SlS1JR0JhxlYE9q7A7EnHF5cPLLvvP2 LhCplIAOKIxKU3lSCPcLs14FvnOA6huOEp56XKOWwIMWyeLEMt0ybbhIO6kL1DdXUd9p Xci5/ir4at45csUyl5ycbORusUQsN8PsgJR4ProSR+GFNyXC3wuqNTqOf8Spbx2AUKuK SyL56LZuTY4J09Fc5lzzlguaydaZ7VM4BwIFolCC2DBmakNOtJg91TdcumGGI0heJrCR SR1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790477035; x=1791081835; 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=zBYt8cFdzfyjjJx70fgYL1kIJytxJucH9oKmkDpbwfs=; b=iYFQ4IGJH9FNrmN4a5AQrKjm4vE5/z6QQMHmcGhm9Zc2vtG7y9d0hw1fT1GUSRxd2G Yqzp3oyIK8jrP0WLZif5WIO+CujAo+GDPxUgeM1E4uaX8bIP7kjXEppJVCC8jvANLpY2 md9RMwN4f2dYSQXkFYaEp0ztnXwdISAkyE+2/eu1/uWYbNYTIQ/K8EUqr9UzcOMz9Sad KIfFWL3IUftHrGe3abD00EX8pVxNz/bsNYSQ2RCTvtsQ0W9vxVVFRI7p6WfL43CJCixp H7HyL5cWPojgAKEDTQq80/Qq1IULhx171cB3rHputdUVpgHdZ3DEm9CFncD7LHbfVwcm dc1g== X-Gm-Message-State: AFuF++kEu2QYP/CopVOphc1UKTRpInAa8STukObZh3tUe22NSjlcCkgJ LhpR1D7tMzvqKFyOFjO9FdU1tuY4eeLVRSjJjSa8DU+ulHhMhj98c/lPHA+7dJjk/OrBoilcKnp 0uE2xZLvOPLgz1yO4E0VB42A6/UAZzcS0qkDRqhadEdl3Lj7HnmvgfiC4YYyblqHCvw== X-Gm-Gg: AYBFou1tDL0PUvxnfe5eXaSuJvcU4EeoSbw9bfRjyY1XTW4tDn5YVjZd1ZH+nU1Q2RY INCD5Kx95PkXCG2VFrXBPvejbksrebwSfkQcfYYZh/1OAcGCTnQkj4+cJ4ajoOJP2gwTd81bXE0 7/o6QCEwi1wVM7+gz3jXwQj6pLrx7WGcNvLhRZkXKTQ+5wp3dp2psrGkzUoR8PuWVIUKuSD42T3 8msjBApLzquwhuHQbafDysbnY1LIieWjdJVlagSfWl2GHraPbU/oqZgSIOmxLTfzp/Qo8wcE8Ef r2foHSCSP4dIGMR4pTSpsZRCxsfo1mW6u5Qa+X6nVOPsDi7xV59PcHToF03kV80g9FQe40ns2L9 y68ZeeeyhRpW6Bv9fpspwrRmYK1cQb4UsGEGxkoUllNVBwSI= X-Received: by 2002:a05:7022:4581:b0:143:26ed:2dd5 with SMTP id a92af1059eb24-146cfcd7046mr7354038c88.31.1790477034340; Sat, 26 Sep 2026 19:43:54 -0700 (PDT) X-Received: by 2002:a05:7022:4581:b0:143:26ed:2dd5 with SMTP id a92af1059eb24-146cfcd7046mr7354005c88.31.1790477033778; Sat, 26 Sep 2026 19:43:53 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Brian Cain , Helge Deller , Pierrick Bouvier , marco.liebel@oss.qualcomm.com, Laurent Vivier Subject: [PATCH 3/5] hw/hexagon: protect the shared architectural TLB Date: Sat, 26 Sep 2026 19:43:45 -0700 Message-Id: <20260927024347.3545385-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> References: <20260927024347.3545385-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=VvS2kO2n c=1 sm=1 tr=0 ts=6ab882ec cx=c_pps a=JYo30EpNSr/tUYqK9jHPoA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=rp48sNE5vvaaZFK1b3sA:9 a=QEXdDO2ut3YA:10 a=Fk4IpSoW4aLDllm1B1p-:22 X-Proofpoint-GUID: jKgld8Dsa8q57Tr4rblayrTn7dep-q11 X-Proofpoint-ORIG-GUID: jKgld8Dsa8q57Tr4rblayrTn7dep-q11 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX2RnYi6OFcX6L brrErFWPUH7dDhnzFIFSRW1mrL7tEx+JcK/ehqJJ3yhIkfAUN3uQ6HHDGMMneeW2xQ0YqGCgshc HSvUCmWJPBuWwbNx3hFtG6K4LXnQqnDQ+wNxh84AKOOdMTaArNOEVqL3FmYXdlcK0pFi9EZQoKI JbTM5Lu90PydJpyOxTnMgdbjRBbkFJMJN5Yv5+qcqIUPxhREcTpOVAQBW9x8S8dOrq4Z3E6IHYm wv8HdWFao3ibXVRBuY8YYHEDOBdAsRf4+pqKwP6N5NntPHeht5v21YeR6FzePLI9cQc0EQokWx7 D0ltQIglfDqGSvDUg9hOcn5LLgl9AUhnyCULGZhIQjvwZVhkwUu06n7kHp0mZKEd6TdDaV0GQ0Q KFRqUDGA17/qzG3d6X+Wg64IBfhAvx6EVI7BTvPRO01JAxashaCPUfO+Ju7u/f2hhHD2iUkkzdy GKYhiRhsbbEF/A8a8Yw== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX6HrqWFk1MQUK 6CVnsFtB200ELc/+sh8Khbs4MOgttBnng/yrEzK/wzXwRv0PvwXZbh9HAwcF7nJLDDLhlRTyDxZ 8DBFmmE+JBKrictHMVVLGYiLBtmAOlY= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-26_05,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609270010 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: 1790477112514158500 Add a mutex to HexagonTLBState and hold it while interacting with TLB entries. Signed-off-by: Brian Cain Reviewed-by: Marco Liebel --- include/hw/hexagon/hexagon_tlb.h | 5 ++++- hw/hexagon/hexagon_tlb.c | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/include/hw/hexagon/hexagon_tlb.h b/include/hw/hexagon/hexagon_= tlb.h index 6bc33c05452..56aa0b2beed 100644 --- a/include/hw/hexagon/hexagon_tlb.h +++ b/include/hw/hexagon/hexagon_tlb.h @@ -13,6 +13,7 @@ #include "exec/hwaddr.h" #include "exec/mmu-access-type.h" #include "monitor/hmp.h" +#include "qemu/thread.h" =20 #define TYPE_HEXAGON_TLB "hexagon-tlb" OBJECT_DECLARE_SIMPLE_TYPE(HexagonTLBState, HEXAGON_TLB) @@ -22,10 +23,12 @@ struct HexagonTLBState { =20 uint32_t num_entries; uint64_t *entries; + QemuMutex lock; }; =20 uint64_t hexagon_tlb_read(HexagonTLBState *tlb, uint32_t index); -void hexagon_tlb_write(HexagonTLBState *tlb, uint32_t index, uint64_t valu= e); +uint64_t hexagon_tlb_write(HexagonTLBState *tlb, uint32_t index, + uint64_t value); =20 bool hexagon_tlb_find_match(HexagonTLBState *tlb, uint32_t asid, uint32_t VA, MMUAccessType access_type, diff --git a/hw/hexagon/hexagon_tlb.c b/hw/hexagon/hexagon_tlb.c index 157d03e51bf..28601b78a6f 100644 --- a/hw/hexagon/hexagon_tlb.c +++ b/hw/hexagon/hexagon_tlb.c @@ -7,6 +7,7 @@ =20 #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/lockable.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/core/qdev-properties.h" #include "hw/core/resettable.h" @@ -162,6 +163,7 @@ bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t e= ntry) =20 void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb) { + QEMU_LOCK_GUARD(&tlb->lock); for (uint32_t i =3D 0; i < tlb->num_entries; i++) { hexagon_tlb_dump_entry(hmp, tlb->entries[i]); } @@ -303,13 +305,20 @@ static bool hex_tlb_is_match(uint64_t entry1, uint64_= t entry2, uint64_t hexagon_tlb_read(HexagonTLBState *tlb, uint32_t index) { g_assert(index < tlb->num_entries); + QEMU_LOCK_GUARD(&tlb->lock); return tlb->entries[index]; } =20 -void hexagon_tlb_write(HexagonTLBState *tlb, uint32_t index, uint64_t valu= e) +uint64_t hexagon_tlb_write(HexagonTLBState *tlb, uint32_t index, + uint64_t value) { + uint64_t old; + g_assert(index < tlb->num_entries); + QEMU_LOCK_GUARD(&tlb->lock); + old =3D tlb->entries[index]; tlb->entries[index] =3D value; + return old; } =20 bool hexagon_tlb_find_match(HexagonTLBState *tlb, uint32_t asid, @@ -323,6 +332,7 @@ bool hexagon_tlb_find_match(HexagonTLBState *tlb, uint3= 2_t asid, *excp =3D 0; *cause_code =3D 0; =20 + QEMU_LOCK_GUARD(&tlb->lock); for (uint32_t i =3D 0; i < tlb->num_entries; i++) { if (hex_tlb_entry_match(tlb->entries[i], asid, VA, access_type, PA, prot, size, excp, cause_code, mmu_idx)= ) { @@ -349,6 +359,7 @@ uint32_t hexagon_tlb_lookup(HexagonTLBState *tlb, uint3= 2_t asid, uint32_t not_found =3D 0x80000000; uint32_t idx =3D not_found; =20 + QEMU_LOCK_GUARD(&tlb->lock); *imprecise_exception =3D 0; for (uint32_t i =3D 0; i < tlb->num_entries; i++) { uint64_t entry =3D tlb->entries[i]; @@ -387,6 +398,7 @@ int hexagon_tlb_check_overlap(HexagonTLBState *tlb, uin= t64_t entry, int matches =3D 0; int last_match =3D 0; =20 + QEMU_LOCK_GUARD(&tlb->lock); for (uint32_t i =3D 0; i < tlb->num_entries; i++) { if (hex_tlb_is_match(entry, tlb->entries[i], false)) { matches++; @@ -412,6 +424,16 @@ uint32_t hexagon_tlb_get_num_entries(HexagonTLBState *= tlb) =20 static void hexagon_tlb_init(Object *obj) { + HexagonTLBState *s =3D HEXAGON_TLB(obj); + + qemu_mutex_init(&s->lock); +} + +static void hexagon_tlb_finalize(Object *obj) +{ + HexagonTLBState *s =3D HEXAGON_TLB(obj); + + qemu_mutex_destroy(&s->lock); } =20 static void hexagon_tlb_realize(DeviceState *dev, Error **errp) @@ -436,6 +458,8 @@ static void hexagon_tlb_unrealize(DeviceState *dev) static void hexagon_tlb_reset_hold(Object *obj, ResetType type) { HexagonTLBState *s =3D HEXAGON_TLB(obj); + + QEMU_LOCK_GUARD(&s->lock); if (s->entries) { memset(s->entries, 0, sizeof(uint64_t) * s->num_entries); } @@ -476,6 +500,7 @@ static const TypeInfo hexagon_tlb_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(HexagonTLBState), .instance_init =3D hexagon_tlb_init, + .instance_finalize =3D hexagon_tlb_finalize, .class_init =3D hexagon_tlb_class_init, }; =20 --=20 2.34.1 From nobody Mon Nov 23 05:10:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790477112; cv=none; d=zohomail.com; s=zohoarc; b=kQBSC/Qej3H5Dtj6jW9fW0gbDxZR4fVSSyD/rxvNdrEsYGScesaJB4H+B2N//DB7GrwGlJelvabw174eG33BoQbYB8b05YkhpBTYxPOgTLhkfpIBjZDoBJq4pJa9Z1QAhYRUcRJhUggozM94lNQm5/+rfdUw9Lm7hw81rjLHOxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790477112; 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=8NcmBAxi39EK2+wsdsFT9vJUAPDVjauXSLfke3uNBzk=; b=EJzlEX0saT4DzxqCynmTySXAa2YR9I5QbApwXCWX1mCqY504wcsNXCpyyeL/QTdJf1AjZgxGgxaHRBFNQ4ZhuXoX6jvm2aRRwm1txgbv8OxClwwsqI2E4vLVYkKPhGm/E8A3gpqseE7E2ToonN8BEPCUPv50l0DkwLXQwJPxGMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790477112375701.912226595519; Sat, 26 Sep 2026 19:45:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xAery-00053X-0m; Sat, 26 Sep 2026 22:44:02 -0400 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 1xAerw-000538-8h for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:44:00 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xAeru-0007VX-Bp for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:43:59 -0400 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 68QMnmj01200140 for ; Sun, 27 Sep 2026 02:43:57 GMT Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gx64uta6m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 27 Sep 2026 02:43:57 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-147be78cd56so2547489c88.1 for ; Sat, 26 Sep 2026 19:43:57 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-145ac67c3f8sm15459747c88.3.2026.09.26.19.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2026 19:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 8NcmBAxi39EK2+wsdsFT9vJUAPDVjauXSLfke3uNBzk=; b=dC8CQ9sNp9NN0xOW P+Nrxrvj/E/P77XesNsvkah1u1R6IWlBLkHVGUBOXz2/CICKXf5wcoPty7j5YlaB 1N0Z6F/LkTFFtxkb79WbXrhEDgAM6owW24iQfQPZ4/gCeSI122nwwpK7rkm7gSdc gm+wurlobkCthuK2+0v/e7vfERrSmJb58Um3EYwBiTnkIfuNxJ5Y0JYodWmW+bVo mldld61rpBh4dYKVvzFevtdBhc2dcmdRJiQKD5M5MT2bDztGWBK5yNt6zRkxLIMn AQp9iCuDK/w4JZWcaN5FJdjfYFoKdMK9Srs1uk/nWh1b6GNK8SyZjLom7E+5k58G xsQB/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790477036; x=1791081836; 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=8NcmBAxi39EK2+wsdsFT9vJUAPDVjauXSLfke3uNBzk=; b=j1kvbVOSAhQdQytldsnVAa+DMIRqLjQLa92PZf7MVlyCxWGrN7jE4pl0/HL3mcCA8N 6kpQE2jwQNGM5YLu687cQxau84zdfYhTnpJYDGpYdR61fpeNgPNUrLTWk2zkMaiTLiIU qLHzNBgjjRLrRHiskB0nZEME+GVWnsq7RISNFacS9cLWFgfPiI7PaXYPW1qStT4r1Qut +FCn9Zpk3C+kC88xM00wMtLnsPUY+axunIOqHBD/XeaK8wKReaGhkH+qavKFrez8sJa8 1Uqkjx7voot8D/NuNOnPvHgA4suIsYs72Zq37zxZhD3ngmtj+FF2KRFcQH83qdupTG+A sWig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790477036; x=1791081836; 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=8NcmBAxi39EK2+wsdsFT9vJUAPDVjauXSLfke3uNBzk=; b=PHZLBJKYEVGt+HA6/xXK/brJoiyl6erKbqB1B52jo4ieVtcz4ClOCBWWtSnI4UMpPe dwBVe3RGxyw5klgS0RLbKB77dvUvRykxmImw5i+RhS1Xb6FmfR08TcGWvs0XvvmW+1KG QNnZ8LAHaLqsAvFy6vzXKjCDjtQrjAq8Bfe3pR0yISnz2jpicdE5oxEMD8hu5HDlEC0H vqiWuTWXP26vQXtUaOyefAXKnWU35Xns9O5w4isR+oYCwBYvRmrz7WCSulhiDTNQCDl1 4tVbK3Szxdg8TQvsbETlpOqBV8uTC/KbQFjBNYAV9M4aGLHlfHfF96B197sI3yuTzfOi w0cA== X-Gm-Message-State: AFuF++mzcYcEYBL+ryl/2A/SHZ37eYwIUkdRtJAh53CoTvf4QvekNies Te97pUDSwSsspsUzItZxvvRJiQIKUPJsLTGayRBb+3q+iY2upXZMPKP9KlWAbzrkfky+5jzJyGY 5GwibeW2ocSHgZtvBkaUQGJS3GzSDDzCKIHIUJVQs2s1v74GZ1sWevx4V5Ba91mc1uw== X-Gm-Gg: AYBFou3UGdSDtK4peWqrYvZXwJVyhFi2E0GPAbNmLTe+JMbgZ7nXDBpO5KgaXhoRjUA YezGBm0yC4a0isWt8zubcoyRchnufp/2hUp6nUx9e0kQnLU0LWapJ1DgJkZj+gyJ4hMGej+OjxE DzRHCHntUVq829cTCKfxnYdiFpmuRjHty3GpsHN31PpB0nzkr3VuKrYbUs5bWU4Vsj1yZp+43rb JrFZbOX4u4xS+PTfczMuEOtfW4OPlouhbK1NTsBKgv4UhaEfdW3LM+dmkT+SjDcIHZ8H4rZKzRs 22sMGEZyhFn0k+4jznIBqcqZUkz0AQ2ssdQYMqwN+GA6DTBSxzuo8ODzUc7frlO+g3Zxtz26Hz/ MwWjQ/ZWaJ1T3U3jWGO/ZqdRCqEk3zJKDpsAUilq1TdQgaW8= X-Received: by 2002:a05:7022:29b:b0:13c:ec65:7bca with SMTP id a92af1059eb24-146ce680830mr5661409c88.13.1790477036106; Sat, 26 Sep 2026 19:43:56 -0700 (PDT) X-Received: by 2002:a05:7022:29b:b0:13c:ec65:7bca with SMTP id a92af1059eb24-146ce680830mr5661355c88.13.1790477034939; Sat, 26 Sep 2026 19:43:54 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Brian Cain , Helge Deller , Pierrick Bouvier , marco.liebel@oss.qualcomm.com, Laurent Vivier Subject: [PATCH 4/5] target/hexagon: publish TLB updates before flushing Date: Sat, 26 Sep 2026 19:43:46 -0700 Message-Id: <20260927024347.3545385-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> References: <20260927024347.3545385-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: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX5IshTKMN1DZg 4j6zqn3uA217qsxETUesSOc3OITarV+p0+qNFGkT8xSzRIyVn3OkKZyG8T1xuV+Reu2wjz+VKwq Tu/ZRx4ZKAR7UPKUJYRM4o7yY0n/URQ= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfXyv5VO2JbiCuB kErqY4F6X8VyUzXbXaVfboat86o4jo9fwxfDrlz/yZUgO50JHGJ8r93SSFoSq7PixdUSODA3/vd bCPYp4NpmyoZ5bI5Dg/nVSqaNhkPvkT04+xSuHxvvkx4HuMaSI9VT9QeuvL4h4inK89mQwXRkWI 62Lwv3MDnS+sSWBM8BELAnzoycFUEKDqZLKxDauV41dkWPQO0/QgHixuhHyqm55X3TlpfGNV/7y 6oG+3kHqWvLTjc3XuuHfvFFQHJgkoTzQrwkg7NjHMCEMmFiv4RQpV1YhFMUw5gsY+zu/geIF+A2 WsiG7vLQd4gtme2dCQISMsjDfqPN7qMRZECuKgCtRVrBthI5vhfhG4cafNIHdnWioR2syQSpFBT UFHuNzfa+FVb0t2CiTnbXkNEkcMQ56FDVQv6C2CjGIL/6GxvREG1vNvB8mYc9/UNhPkgFiai1N3 0dfUneZnxal7owiB0YA== X-Proofpoint-ORIG-GUID: ZTar1XiXkf7Nd68qR1YrwjFW8Xj9v8it X-Authority-Analysis: v=2.4 cv=E6xYNqdl c=1 sm=1 tr=0 ts=6ab882ed cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=lAqwrNyDy6uQVrA7iuQA:9 a=QEXdDO2ut3YA:10 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-GUID: ZTar1XiXkf7Nd68qR1YrwjFW8Xj9v8it X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-26_05,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609270010 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: 1790477112936158500 Replace the shared architectural entry first, release its lock, and only then call tlb_flush_all_cpus_synced() when a valid mapping was replaced. The old ordering flushed remote soft TLBs before publishing the replacement, allowing a resumed vCPU to refill the stale mapping. Signed-off-by: Brian Cain Reviewed-by: Marco Liebel --- target/hexagon/hex_mmu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/hexagon/hex_mmu.c b/target/hexagon/hex_mmu.c index d6ee7c40798..aa35f631447 100644 --- a/target/hexagon/hex_mmu.c +++ b/target/hexagon/hex_mmu.c @@ -31,14 +31,12 @@ void hex_tlbw(CPUHexagonState *env, uint32_t index, uin= t64_t value) { uint32_t myidx =3D fTLB_NONPOW2WRAP(fTLB_IDXMASK(index)); HexagonTLBState *tlb =3D env_archcpu(env)->tlb; - uint64_t old_entry =3D hexagon_tlb_read(tlb, myidx); - + uint64_t old_entry =3D hexagon_tlb_write(tlb, myidx, value); bool old_entry_valid =3D extract64(old_entry, 63, 1); if (old_entry_valid && hexagon_cpu_mmu_enabled(env)) { CPUState *cs =3D env_cpu(env); - tlb_flush(cs); + tlb_flush_all_cpus_synced(cs); } - hexagon_tlb_write(tlb, myidx, value); hex_log_tlbw(myidx, value); } =20 --=20 2.34.1 From nobody Mon Nov 23 05:10:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1790477109; cv=none; d=zohomail.com; s=zohoarc; b=fGgDKDbMlWDQ9nYJBWQytf02lzh9vFs98IdFHCJekqQxx++XljXAFFRoNDpeRMoJAwo9G2VJC4IzqryB4aVTZIu8jkmJmSpToNQQ9IsL1iCESm+IuCtVmaf1nPBS16HbSZ/gBWuSyHUxOkykRIjY7KcCP+CSZt+Iq2RLPVEWh5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790477109; 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=oy6OGQa50MeZomij2hCC8Ym4uBo/pN8V7bfusE6yIXI=; b=LO5qBsOo2d+DUr2H88s/kLFdFL8k+pp4i/8t/7ndfvjoEBsgyIa2f7i00QVCPvO47QhF3DVGLQ7QYjLTRoFGT5UfJAwGW3kUUIseYEM0tPuXD4gTVPIOJ/NNCL7CotHe5N4R8J3EpW28ea7Hhe6oYj2dqjrDz1AsV6XTJUReQYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1790477109856233.69066013254132; Sat, 26 Sep 2026 19:45:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xAerz-00053u-Dy; Sat, 26 Sep 2026 22:44:03 -0400 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 1xAerx-00053W-VS for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:44:01 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xAerw-0007Vy-Fe for qemu-devel@nongnu.org; Sat, 26 Sep 2026 22:44:01 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68QMMSRC893068 for ; Sun, 27 Sep 2026 02:43:59 GMT Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gx3dp2f6k-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 27 Sep 2026 02:43:59 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-14383177746so3496899c88.1 for ; Sat, 26 Sep 2026 19:43:59 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-145ac67c3f8sm15459747c88.3.2026.09.26.19.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2026 19:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= oy6OGQa50MeZomij2hCC8Ym4uBo/pN8V7bfusE6yIXI=; b=lYk76Rb49A5xIleA rSrECT30eelUHpS3TEPsRlSAOl0nEqNfT8Vxlk+qC3AWg0hy2+r4I/BixOlyq2jF vucwQLbeTxRsJ+fMeCTtwxLeeWRjQ8Ki1nfljx3HLO/o4l/jvelBHSRlUeuSGL0a ozMIw9ueyXBuUjcmH6scc5mz4oEf5ZEKvlJm2jsydKHCi0mqn1PfJyYoJ9HwXR8U 0Fh6xGof2ILEETLrPsfqU2K+EqQvRPteJCCngmkNqbYU6VKpnNkIh4BBnOQyujbC OdZ/qxcOxbrOrfog327vFIgEQBj5ukpaoQ2LkDlhpppfpzCZqNu41A5YLQFOUa4H kP0hsg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790477038; x=1791081838; 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=oy6OGQa50MeZomij2hCC8Ym4uBo/pN8V7bfusE6yIXI=; b=PO0+C9n3A/h/dE16oj2zRafiVpg8ZXKZxUYJMECX4oAMXCvspmcMJT16/lXO3/yHOQ I/ejrfHjjedwVp3c0/RMazKrWtBSlyhXZdpSTw1mK/SNgkdn0/1OEj7aedSdX48TZxry OsTksqm/DdxD0KrqUAm6m3fkBzlcXsZyk7FLwfMC1zkpdW1O5i0xBBXkAo20FmQC/QrN M008+8nGME8ugrnkwHQl//10urwzOvlYY/jYkCzePTek//r4cSKxlGikyybKpvjWLaFu ZHmQ5de2W2M8Tfv06r3XlHCiTvueBa7U/ym3l99fp0Wj9CWfuT/lX46ShwVaCShoLkRJ 3Eiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790477038; x=1791081838; 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=oy6OGQa50MeZomij2hCC8Ym4uBo/pN8V7bfusE6yIXI=; b=gdeoVU8RIwEIRLIZBzPFxc5Ptrc2PEG4ynr48lRJz1VPxSAd/0QNcdSxI3o/EbPZep 4es98ri+R1jT/FzhXk81OaTD/pXuTBMCy5EdavEx+m5SvWViAXrMB1KEO99+tSmRiUmB CyxW3Vv9nJyxWkW5bVPYNlyIZT9fsfI5jmlg/Gh+diGSfX607HnxUA/LqPFNNuBvDQ2E WQ4/yLAivFRd0TadEWm5PfzBvL80mYqmPiFHrplSSKOvtLdsdN1cwPU9nXXvS2BY7JOn ag4bJM8Kgyg+w/bZDA5dqaMa7XJoJYTPnME9cM0dUeavhpUY3kjGNsSrEE/jhtc+CWgt 6J/A== X-Gm-Message-State: AFuF++mYHGc47XWc8ZrJ5xqrfGoS9hX8bLvtOBqMm9A/8m436O86pJeg 4w4NTYC9pQOGrRRfGhcEQpICfjNOn4Pr7chsfhZLU3bpY/y+G4ebpoPm9VZxc764k2yjf4CTmiT Xx+f1w9tFbYrCkTNZq1Nhq3tRS0LHMeUMpIDuk9y/WlYHHiQCBTrx6qnxs2Utv9Lk/A== X-Gm-Gg: AYBFou0jWB7hjW9Z+Cuq5N3k+Ld3lyQrbsP/1pcCmom16SFao/6coGxoQ3tlVDmCpkN NKNp97i8rSaSHYFcZT2BuvPQZoyLtfZK9DRJqmZhG+LgnP9eyedge9wYeGudLmv2p+MRYVDsaee ZOD8NRriM5HLl/7Ky4OmQPcT8OEYBotsRWEsatU27g3tmtKWke8JAvaD80/sUb34MWXtcSz6o0v k3neloTLMKBo7iyOW33aEE0reaAaHj6Pfl+RaYD13N6M85/qFFilIx6ock9cFsuFhmVDAiXMGkD vOb6U3hURl8MkSz4RyUav+UZudXtXM2P+IF10Cf7qMfSIlP/o9d9AaC1/ykndrRzAMzCi5E6xdP ++ETTsGND9zc8pZLdKtq81cbJml8Lbm29ETQhiaI3IxJw4AI= X-Received: by 2002:a05:701b:4306:20b0:144:c113:77bc with SMTP id a92af1059eb24-146cfbdd1d1mr4711658c88.27.1790477037568; Sat, 26 Sep 2026 19:43:57 -0700 (PDT) X-Received: by 2002:a05:701b:4306:20b0:144:c113:77bc with SMTP id a92af1059eb24-146cfbdd1d1mr4711540c88.27.1790477036088; Sat, 26 Sep 2026 19:43:56 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: Brian Cain , Helge Deller , Pierrick Bouvier , marco.liebel@oss.qualcomm.com, Laurent Vivier Subject: [PATCH 5/5] tests/tcg/hexagon: cover LL/SC reservation clearing Date: Sat, 26 Sep 2026 19:43:47 -0700 Message-Id: <20260927024347.3545385-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> References: <20260927024347.3545385-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX5Xqd74X+ZjxZ JzCqLMAHw9ye+U6cHbn9dzPhv5QZyDV5DdecjEzDWYyktlnrUA+0VlSSbp/84RAZ2EfwLVT2fMY ooU8MdI/nRU1Jc1Od/eETvOlCP1bORSkqxUKAzKdfJxGW62nS/yqbGq3A1uy+kaV19T3iDQbvbu OmIO2ghr2X7HbeOKKqAc83slVcnYvtPPAc2TI0FLF1Q8EWze5RcqmJD3FJitKuoR1rY1HcTvL+n OX3Ztw9GDwJ5StjpRAsaLUBN/GqJwNQrQJIsiFnN/71OuqENQR6vVMzd5GN+6sEGf0osRvS4LT6 /spTzb9/IUH915gmJh+FnY+hHY6dd9xhhKxTEd7zf/uDQvBskY/0HvO6EYS2wj4w0BZ1HjmdayL 3tBcT1vw4OC9WQWzOHHxWi8y+FHngNi5WIimePJ8fbmfAX1QSYglswdRmVeXlsfSiLnaGLk8coK ybrFxLVPKspn8Xf/5EQ== X-Authority-Analysis: v=2.4 cv=QsXLTlyd c=1 sm=1 tr=0 ts=6ab882ef cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=OvsSgjh5XwAxDixGgywA:9 a=QEXdDO2ut3YA:10 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-GUID: GMtrLehsHzlcn_6vk83nYkXTZF0NEXAA X-Proofpoint-Spam-Info: AW1haW4tMjYwOTI3MDAxMCBTYWx0ZWRfX0devtGWiigTy UQqKimAD3SscqZq6bgjbrtdeYZGHgqQXO1qfDOkA3JuZAPNlK6EmppHqDcDjGxFqJ0evwKLwKwP fzrUMMOFSFt6SQA0RAd7b4VxqCIu1rY= X-Proofpoint-ORIG-GUID: GMtrLehsHzlcn_6vk83nYkXTZF0NEXAA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-26_05,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609270010 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: 1790477112467158500 Add load-locked and store-conditional helpers and check that a store-conditional with no preceding load-locked fails, and that returning from a syscall drops the reservation. Signed-off-by: Brian Cain Reviewed-by: Marco Liebel --- tests/tcg/hexagon/atomics.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/tcg/hexagon/atomics.c b/tests/tcg/hexagon/atomics.c index 1c2169b28bd..5017ca003f1 100644 --- a/tests/tcg/hexagon/atomics.c +++ b/tests/tcg/hexagon/atomics.c @@ -27,6 +27,30 @@ int err; =20 #include "hex_test.h" =20 +static inline int32_t load_locked32(int32_t *x) +{ + int32_t value; + + __asm__ __volatile__("%[value] =3D memw_locked(%[addr])" + : [value] "=3Dr"(value) + : [addr] "r"(x) + : "memory"); + return value; +} + +static inline int store_conditional32(int32_t *x, int32_t value) +{ + int result; + + __asm__ __volatile__( + "memw_locked(%[addr], p0) =3D %[value]\n\t" + "%[result] =3D p0" + : [result] "=3Dr"(result) + : [addr] "r"(x), [value] "r"(value) + : "p0", "memory"); + return result !=3D 0; +} + static inline int32_t atomic_inc32(int32_t *x) { int32_t old, dummy; @@ -89,6 +113,21 @@ static inline int64_t atomic_dec64(int64_t *x) volatile int32_t tick32 =3D 1; /* Using volatile because we are testing at= omics */ volatile int64_t tick64 =3D 1; /* Using volatile because we are testing at= omics */ =20 +static void test_reservations(void) +{ + int32_t value =3D 1; + + /* A store-conditional with no preceding load-locked must fail. */ + check32(store_conditional32(&value, 2), 0); + check32(value, 1); + + /* Returning from a syscall drops the reservation. */ + check32(load_locked32(&value), 1); + getpid(); + check32(store_conditional32(&value, 3), 0); + check32(value, 1); +} + void *thread1_func(void *arg) { for (int i =3D 0; i < LOOP_CNT; i++) { @@ -122,6 +161,7 @@ void test_pthread(void) =20 int main(int argc, char **argv) { + test_reservations(); test_pthread(); puts(err ? "FAIL" : "PASS"); return err; --=20 2.34.1