From patchwork Fri Jul 8 15:15:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 588559 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp792498mab; Fri, 8 Jul 2022 09:04:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uVD9lJ50kkqSiaTcUk8GJyp8kZVJVZvmsYhrldohJOyABuhMsRgBpn+6Hsu1UrG9ATIzDc X-Received: by 2002:a37:9f88:0:b0:6b5:53f0:a71f with SMTP id i130-20020a379f88000000b006b553f0a71fmr2940320qke.179.1657296242408; Fri, 08 Jul 2022 09:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657296242; cv=none; d=google.com; s=arc-20160816; b=wP5MKaMsy9Cl7rrJoNyT9NtNg9rpzUBgoUpBpvdUx0TAMq8FJrsMKXBXnHrMlvFiJY 2/VAqDJj8a+wHvYRrPnoDq6XkDEwbYXQt/1Df4cZOQCHCd/IB3N7KVsgFwQKc9D0RPBX nXHPoESqtg9MWhQI7N7RHMw4TGvrYQTI4g2mxpo4A8UUgUv/kIpAROC5AihS1G424gZa FaXt5/w02mnohz80wTRSIvEcS5rWiCTNOmr6UoHCD3S1LGOQjixx8qQSAXKCs/3pYRNn tgTZZ82Yq1ro0bRVlAAzA3nJiENtN54vw2+g9EMNjztHwxSLyQopxfGGRuzwm0qRAcov f2Tw== 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=5PME71S11cSPKZ4C3ISqAJ4KA5QkjnbMhk+jE1tP2f8=; b=cA7xaoBOT2EzBKh0HltSM+Wx5V7ekxZ8D2ZVWFUFr+sqIuIwOlK9zfnZwyiaNEUuIM oiyx18+A4OwKigSjWcDs28bracTOL9GCSidrcD9E9ZCamG59U/izazso2irFYY8USy6X 6jWJpm4+FaPiEElcpOuZjNxEucWzOxENBcBsE+RNxHXGN119w5JF4pUPORHTGwKOcVCG ACklAesjylNOwSXylgdoJYdmVClroYpRaTXXdOgaxC29nttQf/5z/jHTpH6PJdqlxbFp RehIjLFlJ0DuRkD/xfz0tA0Y2C9Hw78yPfFHOEsE8D8P40a21IkIvhIlm0R2GVT37mOg Lvtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SvXHXwwr; 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 i1-20020a05620a248100b006b54151ad75si6087430qkn.3.2022.07.08.09.04.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jul 2022 09:04:02 -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=SvXHXwwr; 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]:59160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9qSY-0007Gk-0y for patch@linaro.org; Fri, 08 Jul 2022 12:04:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9pjX-0004Ps-NI for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:17:40 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:40672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9pjU-0002WJ-0V for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:17:30 -0400 Received: by mail-pg1-x533.google.com with SMTP id i190so10006052pge.7 for ; Fri, 08 Jul 2022 08:17:26 -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=5PME71S11cSPKZ4C3ISqAJ4KA5QkjnbMhk+jE1tP2f8=; b=SvXHXwwrb9UIIWa/IQI8vlHZiYEKQYfspABMDonF+Wqb7Zmul6sWgIjcs0m7hSFltQ Ntxrh6838agLRvEL9vNHu15nVOwOLkoi40QBMojgzsV3ErZQjLXpKZNy4SJRCNOIAKsR sCTJr0u19Q1ipUgteeqDQVSAsJAceVmmBwAAHna4Id7veoXbHwaDhFblSVxpXLpJGSte cPi0OKjo+OkbkFAunHCS2PwFGBx7wEb5WxUWfUNpTUw4rzCs0diFuRmuSJy8tPLKGyCs TlkdZX1LOK05AB4XydiQqracouR7Sez/oWAHJcgg07lpnV30N6i45MPfauy00+OSC1A6 5VNQ== 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=5PME71S11cSPKZ4C3ISqAJ4KA5QkjnbMhk+jE1tP2f8=; b=fbGQ9BHeVwxJ9VnO5+la4IOxyR6dBPAPL9oSP6Bn0HuwwlnnKPCqHROInY+Nmmd2za zPe/Zwde0/Vo2nhycmdLYm7x0hVO7bMe2JeBhwORnha3Z+hvegMM1gSS5fViyWLCr6dD Yxd5718zcQx6cXPHR3Tp/cCMcbyDPODz1CO6e4RmyLvOAX/OeAlfJsNCP6k+KqBozEmf lhlBKJ2ShyyeG7IHalcylfYn1eMq8Q+KmZ9rCLhPe3XEGxPoOM9y9SjZkvekoejuVjkR 9CBoXkbz8Kzp5FiqJRy1zHHrRdc/xl5MMWAgbekrR1dASxbph4dmT6QftgEgJfusAB9b YnxA== X-Gm-Message-State: AJIora/Jo7VJA6bn2K6GtJAW7xd+qOEoqhhG9J6OYW8Akw1d0AkrEdDC pNXWqdtUZDEw7IxX02d2itC1CfywGz43IR/R X-Received: by 2002:aa7:8895:0:b0:528:c6c7:c603 with SMTP id z21-20020aa78895000000b00528c6c7c603mr4542097pfe.46.1657293445432; Fri, 08 Jul 2022 08:17:25 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id n17-20020a056a0007d100b0051bada81bc7sm29085774pfu.161.2022.07.08.08.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 08:17:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v6 33/45] linux-user/aarch64: Clear tpidr2_el0 if CLONE_SETTLS Date: Fri, 8 Jul 2022 20:45:28 +0530 Message-Id: <20220708151540.18136-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708151540.18136-1-richard.henderson@linaro.org> References: <20220708151540.18136-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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=unavailable 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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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)