From patchwork Wed May 31 04:02:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 687239 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1062145wru; Tue, 30 May 2023 21:07:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45Tnv21kshzkdezF7pz2CQ8c+NzDqbDvpiDTxlWDUJA24Vcsgtl0Pf3i6g9bSdnHAsFjTg X-Received: by 2002:a05:622a:11c9:b0:3f3:90a8:6906 with SMTP id n9-20020a05622a11c900b003f390a86906mr5428038qtk.17.1685506057273; Tue, 30 May 2023 21:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685506057; cv=none; d=google.com; s=arc-20160816; b=kEwBAExyJ21v1OKdpgYxWHgaDJLm5qJHeZzL3EGXjVEc0Zix7v7vLXjV8h0YF5Qjgj rRNmsdeKaOERcY2labatpD4XSPbVJRaUOgcN+Ra0jBLB6/JwNnCjxI+JlK99iU9cDn3M kR49cX6UsOymcNHYNSnjScrPbrtXh86GyK11X5YWju4OL5/QCRLFxRzL2kVnchs+3xLT dqcu2zMyRl9hL9KoZitbD3poRNZg1MLDa555pugYvhA41W3Dlbsaoqi7l3uQVKYMc+wC kSBd/XJot8+RtPeVb9yDWKPSj8fAc2GuhTfNvgaY8fLQPsFqS2NzA+IMgSvkve4J3BJB xdKw== 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=ebG/JBGVQUzhkBt/ZqcczxWo6SU1DNkNqSEwarGUTCU=; b=JdQ49Jf1Ey+IN5U6IUG8oD/g4GaqzF5i0COmOl2cdJPSxJprdwTnTzbvUgWdjRYdSv fQXPg4W7fcGbFt0z1YF2rp7t4P6TZm6SGqPyiuJmmVNLAz0rKg294aSDupRiOtJk5OSE 9xHb6exK9Gc0sHppF4odd0seHidCmwj288l7Nw4wqf6PnWA2WX5an5KfGFUd1D4Vu3i8 T8zmTb+wzQAFSnj+THdA5drrIyVDUm/SZIQJtqEPI3uN32YKMiL0OsTUEC2YdA3Nr5oH jJyrbPA7Oe2iYYLazDQpI+k5AxeSoqESXLkkkJgoX8La+EnwaC4ge2tr27qZlaubiE5q QfqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vjsJrWaJ; 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 c9-20020ac87dc9000000b003f0842d3c40si7601872qte.703.2023.05.30.21.07.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 May 2023 21:07:37 -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=vjsJrWaJ; 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 1q4D3v-00076h-Ce; Wed, 31 May 2023 00:03:51 -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 1q4D3q-0006wr-Bl for qemu-devel@nongnu.org; Wed, 31 May 2023 00:03:47 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4D3n-0006B7-LS for qemu-devel@nongnu.org; Wed, 31 May 2023 00:03:46 -0400 Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-33bdab7b4caso1891035ab.3 for ; Tue, 30 May 2023 21:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685505821; x=1688097821; 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=ebG/JBGVQUzhkBt/ZqcczxWo6SU1DNkNqSEwarGUTCU=; b=vjsJrWaJVVqJBMPVoMZvP7TU5vCbhGX52ahQOAe87IuS5ZuZMKeQIAkZAxifzejYtI HaMVbpQK6tqSfdoy51S4QnQlGQFoAaRw0t9f//liDUO3Y1Z2fTS9C2wROgfsnjb8B6Mn i1dILwqsnnKXie3FNrlcjeiMDDUTLYpGaCUQo8fGBEgsnqP369Qnz1W5bNs84yYzVnCI OX8wxXSYzA5UtUot3xxHQGdNSNiXAAQaCt02mJVs1IFTQqRqci9LtVs37a7om0h5Xbhh /CF3r9UVMUaYFE4xvZI8hY6WH+IBjzLJo1goVYF7j/of38mc+SPxtSxqedwhetlDsJu5 VSmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685505821; x=1688097821; 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=ebG/JBGVQUzhkBt/ZqcczxWo6SU1DNkNqSEwarGUTCU=; b=dNBmWaeXQsO3Cs4OikisMLQHvH9wCGLAUW1rmIRY1kun+Vdvhq70Rhkv0opNnKSy7U FFievf+qfz3BuN1h5JWPG2VkkurDllIHeDgMcf5M6b5XN7pYozPgHKs3gh0+SInro8y4 ifhD7vXxWpqnmv18/DNmBupHG9rW7ckYEE0GMFR9SeXEBWUFuDamlvB76G1Vei+kZ8Wt Ev1x+Q8au+mVbMOhO8jovYaCcoz0XBAJHhwrjpDal+y979zoU++m2xY2h7399U2IoSVg rHuXdNkXdoVO4WMyoUiwM+uemQDwhTZ8y5FOqwJifyWMKv3hTv0iOret4bnzQnGVJzr3 Bqtg== X-Gm-Message-State: AC+VfDzN00FfmQ0LYhLW9XkP71H80uKiixtUC0Xfcm2DKmDzRwYSrxAV HIpIjnO4PPEgGQLjCeTwhgUCYYkeWbWxuoNzGnw= X-Received: by 2002:a92:d581:0:b0:33b:ad59:a8a9 with SMTP id a1-20020a92d581000000b0033bad59a8a9mr968457iln.9.1685505821397; Tue, 30 May 2023 21:03:41 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:1cd:ec7a:a720:ce9a]) by smtp.gmail.com with ESMTPSA id j12-20020a63fc0c000000b005348af1b84csm194814pgi.74.2023.05.30.21.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 21:03:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 13/48] tcg: Split out tcg/oversized-guest.h Date: Tue, 30 May 2023 21:02:55 -0700 Message-Id: <20230531040330.8950-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230531040330.8950-1-richard.henderson@linaro.org> References: <20230531040330.8950-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::131; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x131.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-bounces+patch=linaro.org@nongnu.org Move a use of TARGET_LONG_BITS out of tcg/tcg.h. Include the new file only where required. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/cpu_ldst.h | 3 +-- include/tcg/oversized-guest.h | 23 +++++++++++++++++++++++ include/tcg/tcg.h | 9 --------- accel/tcg/cputlb.c | 1 + accel/tcg/tcg-all.c | 1 + target/arm/ptw.c | 1 + target/riscv/cpu_helper.c | 1 + 7 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 include/tcg/oversized-guest.h diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index a43b34e46b..896f305ff3 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -326,8 +326,7 @@ static inline void clear_helper_retaddr(void) #else -/* Needed for TCG_OVERSIZED_GUEST */ -#include "tcg/tcg.h" +#include "tcg/oversized-guest.h" static inline target_ulong tlb_read_idx(const CPUTLBEntry *entry, MMUAccessType access_type) diff --git a/include/tcg/oversized-guest.h b/include/tcg/oversized-guest.h new file mode 100644 index 0000000000..641b9749ff --- /dev/null +++ b/include/tcg/oversized-guest.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Define TCG_OVERSIZED_GUEST + * Copyright (c) 2008 Fabrice Bellard + */ + +#ifndef EXEC_TCG_OVERSIZED_GUEST_H +#define EXEC_TCG_OVERSIZED_GUEST_H + +#include "tcg-target-reg-bits.h" +#include "cpu-param.h" + +/* + * Oversized TCG guests make things like MTTCG hard + * as we can't use atomics for cputlb updates. + */ +#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS +#define TCG_OVERSIZED_GUEST 1 +#else +#define TCG_OVERSIZED_GUEST 0 +#endif + +#endif diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 5fe90cbb42..021fc903ad 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -59,15 +59,6 @@ typedef uint64_t tcg_target_ulong; #error unsupported #endif -/* Oversized TCG guests make things like MTTCG hard - * as we can't use atomics for cputlb updates. - */ -#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS -#define TCG_OVERSIZED_GUEST 1 -#else -#define TCG_OVERSIZED_GUEST 0 -#endif - #if TCG_TARGET_NB_REGS <= 32 typedef uint32_t TCGRegSet; #elif TCG_TARGET_NB_REGS <= 64 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 6beaeb0a81..32a4817139 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -40,6 +40,7 @@ #include "qemu/plugin-memory.h" #endif #include "tcg/tcg-ldst.h" +#include "tcg/oversized-guest.h" #include "exec/helper-proto.h" /* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index a831f8d7c3..02af6a2891 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -28,6 +28,7 @@ #include "exec/replay-core.h" #include "sysemu/cpu-timers.h" #include "tcg/tcg.h" +#include "tcg/oversized-guest.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/accel.h" diff --git a/target/arm/ptw.c b/target/arm/ptw.c index b0d2a05403..b2dc223525 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -14,6 +14,7 @@ #include "cpu.h" #include "internals.h" #include "idau.h" +#include "tcg/oversized-guest.h" typedef struct S1Translate { diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 57d04385f1..56381aaf26 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -31,6 +31,7 @@ #include "sysemu/cpu-timers.h" #include "cpu_bits.h" #include "debug.h" +#include "tcg/oversized-guest.h" int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch) {