From patchwork Mon Mar 2 17:58:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184095 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2680223ile; Mon, 2 Mar 2020 09:58:59 -0800 (PST) X-Google-Smtp-Source: ADFU+vsmgWDzNQjFLhStNfiySkiZNFw9QerKg7O6WDAsFz0Y9L7vikaEpmKSe9n61QjDpWZwa4U6 X-Received: by 2002:a37:7c47:: with SMTP id x68mr480610qkc.8.1583171939504; Mon, 02 Mar 2020 09:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583171939; cv=none; d=google.com; s=arc-20160816; b=BRw5965rQe7t+hXALvY5/XWI7yEdYi+rBJUZdZqDfSgL3oSDWdRQ/xmDOLi1Pk8iBb rDGTlBWJKZHr8i9oGhMMBpM4B1MKUNvc9gel9gr2asrzGNFjK52TPYweOUgBrULpNo8v TqJI9OWnXSHXCKlsawB8om33mTL9qZkGFFzqB+D7crmIbNnHgPa3elA25eYezemFPD5U uCHjd+LTO/yDms7Cdb3LiGunPk9ygueRhOMVHAoW10ni9ybk4cEs3BbY1vIPuTV3SzTK iDj14FacdxvgQ5OiR059MyM8M26toIgRnsWd1id8AY83+pNRNrPlrhTcaqQpK1DV2Co+ Hdlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=9C1wlp8smjmp404ViBx+09KVCvZn3cMFmruSUtBUGyI=; b=Rl88gV7MCTq1ycIA8k3uVN0Gxxhfiq0aPlr8QkaXYTNtVJCJEwM8Pheb5hc0p6S0WW HYqvBK200vauKWD202ESm03nlwQ7zEJnifpvGSvQMqIgo2nGbfSTOIPqJfUlxADuFR3D E8uuElJIL4E/hk6yVn+HFAamxic1UTlhIlaXdL5OYjhIj7imKlFbIeNIT1Ejav4mNy7f QbRkTcbLlrdahpV0KlPrzmlvUy0Bt3uZao7wI/fpSdBln44JcK/KVlLl9j+TyBKITLIx i39FJMl3xSFZyu0J9x8WJBdovx3YEDUEz8X6083DD/9tZB2v4IYcifikWE4T4nXS2bti mhgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rx6Enlj2; 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 p22si5987362qtn.382.2020.03.02.09.58.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Mar 2020 09:58:59 -0800 (PST) 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=rx6Enlj2; 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]:36306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8pLG-0006tV-U1 for patch@linaro.org; Mon, 02 Mar 2020 12:58:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38990) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8pKs-0006aN-GZ for qemu-devel@nongnu.org; Mon, 02 Mar 2020 12:58:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j8pKr-0007X6-87 for qemu-devel@nongnu.org; Mon, 02 Mar 2020 12:58:34 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:44638) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j8pKr-0007Wo-31 for qemu-devel@nongnu.org; Mon, 02 Mar 2020 12:58:33 -0500 Received: by mail-pg1-x52c.google.com with SMTP id a14so167394pgb.11 for ; Mon, 02 Mar 2020 09:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9C1wlp8smjmp404ViBx+09KVCvZn3cMFmruSUtBUGyI=; b=rx6Enlj24DsMW9PHpcIavuaDcnAp6zntEtNmcmQ7NGyUvsIj6oHq71izN4zK2zNSU8 O+1fKfdKJNFEfPvqU08vmz9vt6hw/jznXzhSG1B9p5c/drlDnXOa0jMIqo08h5A9Qp6v Uf66eKXlhfGX5n4QmdrP7ZavC9PoRKXw6DadMUmpLsd0QYNo3nW3iue50pr0NyytAC2m ALopL3ND3jiKX16spYPhu/0cf9BwHUhMvPc/7drMJth+sDbRCrC7SB/Zb9eMPONms3Gr 9bYlK1wpz67JBZbcdbb+aDD1/h5ahqbjIghzJ6QMcaj5i9gD9JM8Z0aFXVyDEFQJCFNe GIRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9C1wlp8smjmp404ViBx+09KVCvZn3cMFmruSUtBUGyI=; b=oTU8PVu66nLSCyEB5NXLN0GnWxwbF050ZTk/9riAhudSBM6PAzt4BizlVKJC0PsAtt PuUnAez19WYd0SvZE+3hfqA9TTcvBYGs8GFXEuFK7frA9yeLy9EmNnl5S68yHoHak57q d9CnA5ex1eccMA0+JaYbflVOVLdjTI1rsYnoMJYUD43LaWZNZg+Nesw3mbnRVSTDIi8z VWy3xksSNLgjy7L1UIhvsEwJzUIT2wW9e+Hv104vhKzwh2TOpesMN5pWoR9Kpqfg++rl dD4TAaYQ9eA4PsnJE7hPM4emBWErapt2EthfEsqqUl91gZJVe0D6q/sIbwrwixLn9WSv vN7g== X-Gm-Message-State: ANhLgQ3os1uYxLn29+XXXyunDUOYoVeXx7DmGC+Jk3BOiTq7Wjdn3kPR GyaFdYSxe00kXnxBgBgMpa4WOy7miZE= X-Received: by 2002:a63:df0a:: with SMTP id u10mr112178pgg.282.1583171911542; Mon, 02 Mar 2020 09:58:31 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id s18sm99510pjp.24.2020.03.02.09.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 09:58:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 0/9] target/arm: Misc cleanups surrounding TBI Date: Mon, 2 Mar 2020 09:58:20 -0800 Message-Id: <20200302175829.2183-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Changes for v2: * Improve commit message in "Optimize cpu_mmu_index". * Add "Introduce core_to_aa64_mmu_idx". * Use it in "Apply TBI to ESR_ELx in helper_exception_return". Blurb for v1: We have a bug at present wherein we do not supply the memory tag to the memory system, so that on fault FAR_ELx does not contain the correct value. For system mode, we already handle ignoring TBI in get_phys_addr_lpae, as long as we don't actually drop the tag during translation. For user mode, we don't have that option, so for now we must simply accept that we'll get the wrong value in the siginfo_t. In the process of looking at all that I found: * Exception return was not applying TBI in copying ELR_ELx to PC, - Extracting the current mmu_idx can be improved, - Replicating the TBI bits can allow bit 55 to be used unconditionally, eliminating a test. * DC_ZVA was not handling TBI (now only for user-mode) - The helper need not have been in op_helper.c, - The helper could have better tcg markup. * TBI still applies when translation is disabled, and we weren't raising AddressSpace for bad physical addresses. * SVE hasn't been updated to handle TBI. I have done nothing about this for now. For the moment, system mode will work properly, while user-only will only work without tags. I'll have to touch the same places to add MTE support, so it'll get done shortly. r~ Richard Henderson (9): target/arm: Replicate TBI/TBID bits for single range regimes target/arm: Optimize cpu_mmu_index target/arm: Introduce core_to_aa64_mmu_idx target/arm: Apply TBI to ESR_ELx in helper_exception_return target/arm: Move helper_dc_zva to helper-a64.c target/arm: Use DEF_HELPER_FLAGS for helper_dc_zva target/arm: Clean address for DC ZVA target/arm: Check addresses for disabled regimes target/arm: Disable clean_data_tbi for system mode target/arm/cpu.h | 23 ++++---- target/arm/helper-a64.h | 1 + target/arm/helper.h | 1 - target/arm/internals.h | 6 ++ target/arm/helper-a64.c | 114 ++++++++++++++++++++++++++++++++++++- target/arm/helper.c | 44 +++++++++++--- target/arm/op_helper.c | 93 ------------------------------ target/arm/translate-a64.c | 15 ++++- 8 files changed, 182 insertions(+), 115 deletions(-) -- 2.20.1