From patchwork Sat Oct 5 20:05:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832995 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1338643wra; Sat, 5 Oct 2024 13:07:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWH/kxRl9g165BzPdfJ6apCXlpIrroyB5x30fyI9DZR1mH9UfKQlLkJ/T5kOdK2jg1wIbOFEQ==@linaro.org X-Google-Smtp-Source: AGHT+IEDePCjrElGGatOBJKQOmRmxG+s/7PUqMRCTWJ3humF7cLjoP1HCmnrmF4qkOSZvRFI1Xda X-Received: by 2002:a05:620a:25cd:b0:7a1:e37c:bde0 with SMTP id af79cd13be357-7ae67e75d05mr1878876485a.24.1728158867543; Sat, 05 Oct 2024 13:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728158867; cv=none; d=google.com; s=arc-20240605; b=kCaD5P5v8Lbj4kLNl4pxvkhPOR8H3uA/r0UGX0uqol6qB4OALBoUnfdyNh4VjQvnfj g1PuFe24OgLkyQAgFxJmtlSuksOkYA5mLh4JNLCyrXKvMpafybuhowB3p/7XuYpsAFr0 gjtgq7YaHDSn01GIRzqPjK2Aqzn6AA/qOhPQmvX1M9SVY1RWHsCFr+vUBAIRtz9eHpM1 b5pK0rcPqDpDlz8pAUpjjDHLRnmPcvjT33GXULpHAu+opYL5trwu06ZGqOEc61DPAB+i F+e1jDHu7ftFcXfUKl2NlD57Lx7XOmOFZDget5+yfmTUsTkawokFGsL6Hn3tVgI6JrB0 7Dyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=irfgPGGIAUHZVTJOmBvNpfB+bdbCcTVofkC/LEnkZY0=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=Hzkwvt1spsCzNP/5f36Ecmp3X8/05tP6zvdvXuL2N9OLuKwzMInxWZt3RZuQt978Xj xb3n2thHy+tCTE7h627JBOsoxGBXCGatYtzj6pm5jYdnZWH+whh0mtRxP593pGwWNF54 NH9in82KdofmVZwfY3uBkh6K+0h6WIB5b9RX5cUsq8pswNTiuJVbxQvOAiRo/4xmckbW 8kb0omPi6i/NQD1PfS/mR/qwKHfh+BD62dzODmwiqXSaH8JT/ZryUoTkuGz38ccV+3n/ sPtlMPLKOZX4pqOy3GIc9zskRloTT0p/M6XspQA+auhpnF9JqCcSCmdoJ0XEl75Z0rmd nTRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dX/WTlZw"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75762d24si248397785a.439.2024.10.05.13.07.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 13:07:47 -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="dX/WTlZw"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxB2V-0006F4-1n; Sat, 05 Oct 2024 16:06:07 -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 1sxB2T-0006EW-Jx for qemu-devel@nongnu.org; Sat, 05 Oct 2024 16:06:05 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxB2R-0001hg-KG for qemu-devel@nongnu.org; Sat, 05 Oct 2024 16:06:05 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-20bb92346caso20346165ad.0 for ; Sat, 05 Oct 2024 13:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158762; x=1728763562; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=irfgPGGIAUHZVTJOmBvNpfB+bdbCcTVofkC/LEnkZY0=; b=dX/WTlZwAjAIn6QJe49vS10p5cBHMO6/Th3ib15WpJfX0Hs55vNC2Km6sueXMsozMc gMqEH1DY+JukhPiQaUAGxIO36A5wqEPlwXdoTJumIm7Ilj8rFmM7uVgASCcc56pOe/Ip Eabq9dRFsRm7X58J/QKulV0RHkWrwQI+OrT+wtf+CYaZ+sdRjMtDK9NhHytT3pzsg8Mi o1TXtuBkUekLVOxzar/hPnetub3Edd/XVNl0IYGlIJzrUifSnGjrBRlPTcKnwmtooUl8 08Sdsvz4RZkJD1DatKLrURQhjJayXrLCSIFq5Bz/4JeQwFqETgbiLJDGx0KqqC2soCgz ZAKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158762; x=1728763562; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=irfgPGGIAUHZVTJOmBvNpfB+bdbCcTVofkC/LEnkZY0=; b=EdWqclTQX9CD+cOr7j4ziY96vZOo7Lm4RZt6KWIjjbDKQHaizgXAN5G9SAUXdsxyTe WUb13u4ikuv1T5W2xHqKhT1nGObpNHPCx9yRjxwrLOaL6jDo8izElZwuHlDJz7g9/aWS MdUP+VQnU1QJtMOJM7RhCWC0bc67l+fqpw090eEwEr4uLGS1jPSuNN178zXBKIDuPo9/ 8Tjicdgeolda/kX/t1m9y7HZ4KlM7GiVa/GIqGcJvsJV8iiK6eFGsNlPi4f2yuK3wNfi u6Y2dounjD0GmvVP1yLXZJx2kiczL8f+/Ma6mvXpoGjkHTCaCF9XIE1eS4FWZEgDDIHd 70UQ== X-Gm-Message-State: AOJu0YzW/qpQ5GWxmjb5/rwudDNUpdYxcmyF2TXUOwRFa6DMxFG2oZYB zqFTg44M2up5EnL16DKV6/hAYKjI8EIfUMiUYqdGfRXirzwZRKXRXYU7MhKkFn4m+3s6dJ3MxtR 0 X-Received: by 2002:a17:903:2349:b0:20b:a9b2:b558 with SMTP id d9443c01a7336-20be199e341mr163370935ad.28.1728158761815; Sat, 05 Oct 2024 13:06:01 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 00/21] accel/tcg: Introduce tlb_fill_align hook Date: Sat, 5 Oct 2024 13:05:39 -0700 Message-ID: <20241005200600.493604-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 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 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-bounces+patch=linaro.org@nongnu.org This new hook will allow targets to recognize an alignment fault with the correct priority with respect to other faults that can be raised by paging. This should fix several hppa fault priority issues, most importantly that access permissions come before alignment. [ Helge, I find that my old hppa system images would not boot, and a scratch re-install of debian 12 failed (networking error?). Would you please test? It would be nice to have a self-contained regression test for this, using a port of the multiarch/system minilib, but that's a larger job.] This should fix the documented error in the Arm alignment fault due to memory type. [ Also untested. I should be possible to leverate aarch64/system/boot.S to manage this, but it's still tricky. ] Changes for v2: - Include the arm_cpu_tlb_fill_align patch. Oops! - Improve some commentary in target/arm/ptw.c. r~ Richard Henderson (21): accel/tcg: Assert noreturn from write-only page for atomics accel/tcg: Expand tlb_fill for 3 callers include/exec/memop: Move get_alignment_bits from tcg.h include/exec/memop: Rename get_alignment_bits include/exec/memop: Introduce memop_atomicity_bits hw/core/tcg-cpu-ops: Introduce tlb_fill_align hook accel/tcg: Use the tlb_fill_align hook target/hppa: Add MemOp argument to hppa_get_physical_address target/hppa: Perform access rights before protection id check target/hppa: Fix priority of T, D, and B page faults target/hppa: Handle alignment faults in hppa_get_physical_address target/hppa: Add hppa_cpu_tlb_fill_align target/arm: Pass MemOp to get_phys_addr target/arm: Pass MemOp to get_phys_addr_with_space_nogpc target/arm: Pass MemOp to get_phys_addr_gpc target/arm: Pass MemOp to get_phys_addr_nogpc target/arm: Pass MemOp through get_phys_addr_twostage target/arm: Pass MemOp to get_phys_addr_lpae target/arm: Move device detection earlier in get_phys_addr_lpae target/arm: Add arm_cpu_tlb_fill_align target/arm: Fix alignment fault priority in get_phys_addr_lpae include/exec/memop.h | 47 +++++++++++ include/hw/core/tcg-cpu-ops.h | 25 ++++++ include/tcg/tcg.h | 23 ------ target/arm/internals.h | 9 ++- target/hppa/cpu.h | 5 +- accel/tcg/cputlb.c | 142 +++++++++++++++++---------------- accel/tcg/user-exec.c | 4 +- target/alpha/cpu.c | 1 + target/arm/cpu.c | 1 + target/arm/helper.c | 4 +- target/arm/ptw.c | 141 ++++++++++++++++++-------------- target/arm/tcg/cpu-v7m.c | 1 + target/arm/tcg/m_helper.c | 8 +- target/arm/tcg/tlb_helper.c | 27 ++++++- target/arm/tcg/translate-a64.c | 4 +- target/avr/cpu.c | 1 + target/hppa/cpu.c | 1 + target/hppa/int_helper.c | 2 +- target/hppa/mem_helper.c | 50 ++++++++---- target/hppa/op_helper.c | 2 +- target/i386/tcg/tcg-cpu.c | 1 + target/loongarch/cpu.c | 1 + target/m68k/cpu.c | 1 + target/microblaze/cpu.c | 1 + target/mips/cpu.c | 1 + target/openrisc/cpu.c | 1 + target/ppc/cpu_init.c | 1 + target/riscv/tcg/tcg-cpu.c | 1 + target/rx/cpu.c | 1 + target/s390x/cpu.c | 1 + target/sh4/cpu.c | 1 + target/sparc/cpu.c | 1 + target/tricore/cpu.c | 1 + target/xtensa/cpu.c | 1 + target/xtensa/translate.c | 2 +- tcg/tcg-op-ldst.c | 6 +- tcg/tcg.c | 2 +- tcg/arm/tcg-target.c.inc | 4 +- tcg/sparc64/tcg-target.c.inc | 2 +- 39 files changed, 329 insertions(+), 199 deletions(-)