From patchwork Tue Jun 28 04:21:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 585484 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp420338mab; Mon, 27 Jun 2022 21:56:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t359RL8q6VcfkvqtBr2T8ji//+MQuqGxQ3jUwN811QkngzwMc7jJJpOhJypCy9UCBajK80 X-Received: by 2002:a05:6214:2605:b0:470:2cf3:82f2 with SMTP id gu5-20020a056214260500b004702cf382f2mr958944qvb.124.1656392169799; Mon, 27 Jun 2022 21:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656392169; cv=none; d=google.com; s=arc-20160816; b=HNKyscO/FfqaVs63qxBVngFBPlRhBNtn2mRvo/YS+isL8AwyHFKZZWq2aXqMfIEowg uGlPvxkkXBEcRL9GvYx0dnG2HMWzB7zPnw10dI95uIlB8toPXoLmuXHP8aw8Tj5N/a8q eHrqoaRTlJOMkuyUY42SHzJNobuxEvbhKv4Ir/BYc1pI4+pek1zHU5rcdxWC37UYp1oQ H0K27DJw+R+YLSG4egp8MyaI8ulkkzDuhXkmYhlexS99KghmAxDtGpogc6h+zmfpkcXQ OSaHpIQK1DNgsBoFb9+BZWY0nWvW6BP2n9dYTpeOeBkfavqu5XzgyUIED0GTB3ZDr1yd GBvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h8NNZqBa/oaHcQdJifd9wVEds8arqW1sbQgko9Vs+gQ=; b=fNSbDrJagIfIj7WerjkzN6CGSQV0X6JyztLs6xx+jpU8xpcupbBjutHoO4MaHxEbbZ ZZj/beT6NwRl5aPFrMqu4nmJdfeN9DumRsLN9AWjG71BR5WIO0S2c7ucksOTJvk26eTz y8U5w9l6lSwaQ/PJ7qHCe668u6c48wtXFsspsc4gXyP8QcHrHlCVnPgv7W9mgemAMx2B RHSfXElaZJ1J/V2oVhlv+yZ9RslDydjGFb8zObIkY63nn9fdOUzme7SK/Rg3xHUwwG2c ktPyAeZ7ALU2CAS+sDJs1GALpiaZYEuhU1v3SJd77A5mXlCf0mh+DEAjlNI6F6RzbFlv bGsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y2x5BqQu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gf1-20020a056214250100b00467d48e83c5si7908244qvb.408.2022.06.27.21.56.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 21:56:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y2x5BqQu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o63Gi-0001zH-HV for patch@linaro.org; Tue, 28 Jun 2022 00:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o62kR-0002om-C2 for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:47 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:46612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o62kO-0003vl-Fs for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:46 -0400 Received: by mail-pl1-x62c.google.com with SMTP id q18so9948866pld.13 for ; Mon, 27 Jun 2022 21:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h8NNZqBa/oaHcQdJifd9wVEds8arqW1sbQgko9Vs+gQ=; b=Y2x5BqQuJUT7L7s9ZfBDTQkmSgsAXZkm0wo8r3elruj8sASAQSfwJlOyyOTvuyHWGG mHpnenItkofw/LO/xc6LvPlI9DZGkuh6I4os/uQQIRWgjlCN68C283qlf1O1e1Ov1z/B nLR+d/uL5FX8hnHcfqn4NH4FwcFqjdGH8dbFmsKIuJkcQDxtHHsNB2ay7dVHjqfamQg2 Xc5u5J960qp4HOg5F+YD6vvjzidBW1KoUG1203tDSXQgMBj5+zsncu1YXIvGTXO/6ZJ6 tUYav39LszqtUc0NAVNO0M9Pb1b3Z23It7cyMn6yvGR2z6ic2Cn10iFW0ILTGNO+Dr0q M2dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h8NNZqBa/oaHcQdJifd9wVEds8arqW1sbQgko9Vs+gQ=; b=iWucglytDtaH6Q3gsfuwip/QqT3h97Zm73AS1q182uFA3FK5YCbDwXX/QWNRKDnI3m r+rmULyMI3WxK0b8FpSWO1z4WLGB58uiMyFN0LRvmdBFFfoGrrohhXZBiT2pgV0jDAW2 fVXqrou0MMrm7hqcVblSf/hiAomZpe3cwU1bOsGqdS3FXqXMTPiQ39d95/uCuAwE89ez RHZaW47dIcqX2r8CH7gTadvtACR32MWqRxfCALsRIGlIcmETOLqwZwpAoWT5QObFNoeH /nF7lOjdygwG+2UzRCDtpRJGbMziHMv8vok7ouZaP8e6RY077Q07oz0QUfydnptttoHX h70A== X-Gm-Message-State: AJIora/O3R3EpRVP00tXa3Kbi5d+gQGm+39zbbXojDcmEqkvv1OFvutp f8z4dSsPZ38NTRc9AQP1go+e8ptt1Fkumw== X-Received: by 2002:a17:90b:4b42:b0:1ed:f6f:ff2 with SMTP id mi2-20020a17090b4b4200b001ed0f6f0ff2mr25916066pjb.131.1656390161288; Mon, 27 Jun 2022 21:22:41 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id jg6-20020a17090326c600b0016a087cfad8sm7994929plb.264.2022.06.27.21.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:22:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v4 33/45] linux-user/aarch64: Clear tpidr2_el0 if CLONE_SETTLS Date: Tue, 28 Jun 2022 09:51:05 +0530 Message-Id: <20220628042117.368549-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628042117.368549-1-richard.henderson@linaro.org> References: <20220628042117.368549-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/aarch64/target_cpu.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux-user/aarch64/target_cpu.h b/linux-user/aarch64/target_cpu.h index 97a477bd3e..f90359faf2 100644 --- a/linux-user/aarch64/target_cpu.h +++ b/linux-user/aarch64/target_cpu.h @@ -34,10 +34,13 @@ static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags) static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls) { - /* Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is + /* + * Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is * different from AArch32 Linux, which uses TPIDRRO. */ env->cp15.tpidr_el[0] = newtls; + /* TPIDR2_EL0 is cleared with CLONE_SETTLS. */ + env->cp15.tpidr2_el0 = 0; } static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)