From nobody Sun Nov 24 20:24:06 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1720582175; cv=none; d=zohomail.com; s=zohoarc; b=S+POPVLUUW17fBLPiIVhlpp2JaJ8UeMZVWnNLWBsuKw+lIckp+kKG2zu+uTTulNt85uzpc+hDkyUguj4vkUbU64xnpTpR4DYUb6r82hjpiAmcXeojNpETwvo7U2bvWcl+iCy8m81FEiSLaIgzBJdXs7YyJdmfJt5hVMLvcEfOV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720582175; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UQDbI4dQxYEiVsf1Ot0F1qRfAVSgABx3q3P9I7cC36g=; b=hTsGCD/1JKyOwGCkEFn4+IwOvDvh5e0x2/aBMhtnMzBix7PoNzgclcbZeiyBBq+Lnh3uIOogVAoPgX0cD41Kks2iCYk1RN6qbJPmZ1NFPglZHy5lKSEStWA/T8Nm6Tn1xr9WrMtqbR2K2rH0JmNEsg2r7F41etiNoQDwfBmAXN0= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1720582175915705.9940110661487; Tue, 9 Jul 2024 20:29:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRO0O-0008Vk-3g; Tue, 09 Jul 2024 23:28:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sRO0I-0008EA-CS for qemu-devel@nongnu.org; Tue, 09 Jul 2024 23:28:27 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRO0C-0003it-W2 for qemu-devel@nongnu.org; Tue, 09 Jul 2024 23:28:26 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-25e43dda1edso3116553fac.0 for ; Tue, 09 Jul 2024 20:28:20 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438f5679sm2687280b3a.90.2024.07.09.20.28.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 20:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720582099; x=1721186899; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UQDbI4dQxYEiVsf1Ot0F1qRfAVSgABx3q3P9I7cC36g=; b=DmIFafITphyLYyXsvtquB1jVCp5pxicObUhFIqTBofT1+CwuBxvWDCnPP6GDjFH7GN nY9IxStXU6vnBc2ihI7hRs226qPtcUT/gBXDjFJbIhV8OOlsr2VZQNzAC8XrXpriqwgI 9dEZ8JZkiHJ4EGoGJ58HbUWY86WUCMyMjB95Qk3YYDkuaZXu7OcYA/t283zqfGq8KET2 Cdx+qdD+DTDid/Y84EQUqKvkayCGdYq69fLtr4C7knLB0e9SlOQVx11OUjfko9zS3aTc xCrPhBWw1+4C6KY4aHRiZmRqmRoQsLgQnYMftejbQUzWF6ZhHI/0QIjbJofo7aOLf/e2 se0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720582099; x=1721186899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UQDbI4dQxYEiVsf1Ot0F1qRfAVSgABx3q3P9I7cC36g=; b=EhGQZMH3jCtuRpFfVl5FCNDzRgZskb+ws9l5mK6eXmI2AnttIeKcdd3EtIh1l3D/RT Royn26otDA6uWUwixxDZ5zUuQ6AvJS3BYKQ9aIHBLM0h5vnxslkGJavlzLB0SN8qcRwI CijmLE5DnY85NY8QU4UV3S5fvGfw30418GEdLqcRMKRHIXolPCzD0u3GADuCe6VZhyzD 1tqNGuae+YfXVfF8NFqvzIPJ2L6Lmc3abQUF10Q2A3Pj6bfp5J7gXyID9z+R6KsF4UiO xS3jfM7aU+AIIkK2Ym9T+VhFge1uJp7xu4q/HkjY6vK10DUTm9h+S41TGUUDrafeGW9b gqZw== X-Gm-Message-State: AOJu0YwQiMopT0SCNJFZFD0qkqRyUG4KiOavxCiphsV+I1A+4NONvibO 2bFnlAuodYMl4UnQ+V5PdB7nvWowkGb5Db6hLl81k0LMW1CVn/J3YGRci+bBhh05/7RIGVslav9 u/FY= X-Google-Smtp-Source: AGHT+IFhWSFuP17FBVNgne4GduySXUU/b2J+3ZRTV0xsyDjzJNnzbm6PzbM31m6mZXHK+xG03NNa6g== X-Received: by 2002:a05:6870:f71d:b0:25d:f28b:74b7 with SMTP id 586e51a60fabf-25eaec16f3cmr3749063fac.40.1720582099181; Tue, 09 Jul 2024 20:28:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, balaton@eik.bme.hu, max.chou@sifive.com Subject: [PATCH v2 03/13] target/arm: Use set/clear_helper_retaddr in helper-a64.c Date: Tue, 9 Jul 2024 20:28:04 -0700 Message-ID: <20240710032814.104643-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240710032814.104643-1-richard.henderson@linaro.org> References: <20240710032814.104643-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x31.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @linaro.org) X-ZM-MESSAGEID: 1720582177753116600 Content-Type: text/plain; charset="utf-8" Use these in helper_dc_dva and the FEAT_MOPS routines to avoid a race condition with munmap in another thread. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/tcg/helper-a64.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 0ea8668ab4..c60d2a7ec9 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -928,6 +928,8 @@ uint32_t HELPER(sqrt_f16)(uint32_t a, void *fpstp) =20 void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) { + uintptr_t ra =3D GETPC(); + /* * Implement DC ZVA, which zeroes a fixed-length block of memory. * Note that we do not implement the (architecturally mandated) @@ -948,8 +950,6 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) =20 #ifndef CONFIG_USER_ONLY if (unlikely(!mem)) { - uintptr_t ra =3D GETPC(); - /* * Trap if accessing an invalid page. DC_ZVA requires that we sup= ply * the original pointer for an invalid page. But watchpoints requ= ire @@ -971,7 +971,9 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) } #endif =20 + set_helper_retaddr(ra); memset(mem, 0, blocklen); + clear_helper_retaddr(); } =20 void HELPER(unaligned_access)(CPUARMState *env, uint64_t addr, @@ -1120,7 +1122,9 @@ static uint64_t set_step(CPUARMState *env, uint64_t t= oaddr, } #endif /* Easy case: just memset the host memory */ + set_helper_retaddr(ra); memset(mem, data, setsize); + clear_helper_retaddr(); return setsize; } =20 @@ -1163,7 +1167,9 @@ static uint64_t set_step_tags(CPUARMState *env, uint6= 4_t toaddr, } #endif /* Easy case: just memset the host memory */ + set_helper_retaddr(ra); memset(mem, data, setsize); + clear_helper_retaddr(); mte_mops_set_tags(env, toaddr, setsize, *mtedesc); return setsize; } @@ -1497,7 +1503,9 @@ static uint64_t copy_step(CPUARMState *env, uint64_t = toaddr, uint64_t fromaddr, } #endif /* Easy case: just memmove the host memory */ + set_helper_retaddr(ra); memmove(wmem, rmem, copysize); + clear_helper_retaddr(); return copysize; } =20 @@ -1572,7 +1580,9 @@ static uint64_t copy_step_rev(CPUARMState *env, uint6= 4_t toaddr, * Easy case: just memmove the host memory. Note that wmem and * rmem here point to the *last* byte to copy. */ + set_helper_retaddr(ra); memmove(wmem - (copysize - 1), rmem - (copysize - 1), copysize); + clear_helper_retaddr(); return copysize; } =20 --=20 2.43.0