From patchwork Sat Sep 16 03:30:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723574 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp710377wro; Fri, 15 Sep 2023 20:38:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExJOqPgoqcD9Jf29YfPlcWCTFR6cor+evkdw6yE2QMZVDuf08JySvFgo6V0iNv2r3p6bKi X-Received: by 2002:ae9:e601:0:b0:768:4333:c584 with SMTP id z1-20020ae9e601000000b007684333c584mr3423056qkf.77.1694835525545; Fri, 15 Sep 2023 20:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694835525; cv=none; d=google.com; s=arc-20160816; b=BacVYz6lf522qPyDkVo+fAoJ4u20uzdW2huTIZNRKdXeYDCjAXU6Z8eRjxXevugY/X ZGjJRd6n9jjdx/Xn5O379sDEcSJVsazDbpGCSbKS1x0/J9zycXjQSwWedK/2vS3LSOpz tkP0g2XTMrSQ0WtsTPhOaYIAao+z8rIyul7FOkCdVem9J6RBr6ewDwvpx4m5toj6iePr uQnrJPtW7SfBbJjcKRB1B8LldUmV0vYWHfTlyAY8W5ZYFYbT89Dbp9l/CEM/ByoHk1TQ V20nkKVKT/5ZnIVD3fWiEwQxbYEtB64PTc8lgZuDqep/A84qNgSaBXMLmSP1hUOKe97v 9GUw== 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=UG+6oF1qA9HtR8kn5xL4s+bZVE8kzhMwk4Vv90T+jnY=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=plA9IIcnC+WMdcg5ZNPSAxWNBgjOMVmyKlTvjAAG/eTtjkQT3RgPoREsj6UnmD4P+G cJxcBWkaLzPWTusk7+gztTIGxzXgYvsNxpqw/Iakz1+lOwYt9YwItagXgvr3pfBder5L Y+EP9G6Y3Fl5VMVbIL52OQFtrZDbQwvojUi+fUxG0RRgeBq/NtRQstYMN6vr+wPfEXZT kgA4AZjhYOvVmie4aPxyD+FiBPyArvEnS2vXeTeD4TktzpkOxEsTLJOhopjZs4VL9Pbq iJgKLiTeWS1vbnddJOiH1kWe7eMl/RwPzpgyFw1R7g3wvkStwAaGI37gHz5mbT+W9eYd Lrwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cWJjN9XW; 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 qt19-20020a05620a8a1300b0076cda5ef77bsi3063905qkn.265.2023.09.15.20.38.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 20:38:45 -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=cWJjN9XW; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhM16-000652-Hc; Fri, 15 Sep 2023 23:30:44 -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 1qhM13-00063g-Sl for qemu-devel@nongnu.org; Fri, 15 Sep 2023 23:30:41 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhM12-00084k-CP for qemu-devel@nongnu.org; Fri, 15 Sep 2023 23:30:41 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-68fb2e9ebcdso2315167b3a.2 for ; Fri, 15 Sep 2023 20:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694835039; x=1695439839; 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=UG+6oF1qA9HtR8kn5xL4s+bZVE8kzhMwk4Vv90T+jnY=; b=cWJjN9XWqEPTQd6/gQzXDzFEy6Kl1kGvcrwAfyS5lxb8cdgarNSJRP5kXvbTFxb0q3 3uTVcWv/nnHPTjXrI/pz4FsB53vLhl9/MZ9bIdkGtV/eKa+S388rWsM52OM1Nr+zxhDx /8kRl4aYPVjNnYijyIJ8v47ZHIKRWmJgvXKLkK6U4oCypBHJCX2a98wQBNtF7ldswhXL pOBgrU5svrzulJwh9cDIyramoHP7FDLdiwBZnFxhHAt3fCOqr99cJE+BuBo/uf3xFdGz Kaj21siHPTRbEJDYrFTd6ltdN6zPBdD/Zy2LD8DNwg2/BuKn/wYuYj/O06tljXITEpfV xMoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694835039; x=1695439839; 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=UG+6oF1qA9HtR8kn5xL4s+bZVE8kzhMwk4Vv90T+jnY=; b=JGb2GNOHA8XYnPqKBDCwJ7MLtWuDrj/jPkdK5wWeiOPWMF7nN7YpDJTCLLkSLUXmH4 xzRVkMdRjHWLHw1WDvnjhoU/nfoCFGlhnCuaACHV9mI9mfRs2Ytg93EtOcTwVRmVwHbH kLnQvHVikCKlTmoJ5bZclGl7/2CZMgE2nSkwutIBSKtGhQ+HG2ObzpWn5a4YBC4CDeLg QbCoVay6sJv6lrDf8CtmbZ2XccIrab19ptbDgdQATz9YqskTv2b7+mMGb0FNOt+PQJQC n3Yud38MqFKYe/L/V3Y/TWlUpp7hn9D+l82v+HJaARobEBRzELR2YMoPPNSsvngU9uXR lVlQ== X-Gm-Message-State: AOJu0YzdxPJ9rAe5rBTqRyiWfnQGvNCWGyGamZPZDi7KUKbd2Mcb5l6M GkijlBAGFoNjzZIqHZ2E26vYfs3rTAIkrTp8dd0= X-Received: by 2002:a05:6a00:2484:b0:690:15c7:60c0 with SMTP id c4-20020a056a00248400b0069015c760c0mr4037130pfv.19.1694835039078; Fri, 15 Sep 2023 20:30:39 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id j26-20020aa783da000000b00687a4b70d1esm3577320pfn.218.2023.09.15.20.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 20:30:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 28/39] accel/tcg: Merge cpu_transaction_failed into io_failed Date: Fri, 15 Sep 2023 20:30:00 -0700 Message-Id: <20230916033011.479144-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916033011.479144-1-richard.henderson@linaro.org> References: <20230916033011.479144-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Push computation down into the if statements to the point the data is used. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fd1b07c5a3..f3635afb36 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1350,23 +1350,6 @@ static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, mmu_idx, retaddr); } -static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr, - vaddr addr, unsigned size, - MMUAccessType access_type, - int mmu_idx, MemTxAttrs attrs, - MemTxResult response, - uintptr_t retaddr) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (!cpu->ignore_memory_transaction_failures && - cc->tcg_ops->do_transaction_failed) { - cc->tcg_ops->do_transaction_failed(cpu, physaddr, addr, size, - access_type, mmu_idx, attrs, - response, retaddr); - } -} - static MemoryRegionSection * io_prepare(hwaddr *out_offset, CPUArchState *env, hwaddr xlat, MemTxAttrs attrs, vaddr addr, uintptr_t retaddr) @@ -1390,9 +1373,19 @@ static void io_failed(CPUArchState *env, CPUTLBEntryFull *full, vaddr addr, unsigned size, MMUAccessType access_type, int mmu_idx, MemTxResult response, uintptr_t retaddr) { - hwaddr physaddr = full->phys_addr | (addr & ~TARGET_PAGE_MASK); - cpu_transaction_failed(env_cpu(env), physaddr, addr, size, access_type, - mmu_idx, full->attrs, response, retaddr); + CPUState *cpu = env_cpu(env); + + if (!cpu->ignore_memory_transaction_failures) { + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (cc->tcg_ops->do_transaction_failed) { + hwaddr physaddr = full->phys_addr | (addr & ~TARGET_PAGE_MASK); + + cc->tcg_ops->do_transaction_failed(cpu, physaddr, addr, size, + access_type, mmu_idx, + full->attrs, response, retaddr); + } + } } static uint64_t io_readx(CPUArchState *env, CPUTLBEntryFull *full,