From patchwork Mon Jun 5 20:15:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 689232 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp2285765wru; Mon, 5 Jun 2023 13:18:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ531SYP4877PPGAgHmGd8S96AlRp/9bzU9E3JZPAkOXcR/l9pUagWVjdfL9sdg5yplvcb2D X-Received: by 2002:a05:620a:19a1:b0:75d:4a80:68a1 with SMTP id bm33-20020a05620a19a100b0075d4a8068a1mr1023014qkb.22.1685996305255; Mon, 05 Jun 2023 13:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685996305; cv=none; d=google.com; s=arc-20160816; b=ClZiteaYHx4xMNR78yt4t2sQUtm32N9JmVfP+w10NphMsgqotx36yC2VSTIdPQFEfM EZnu9Ebs3td+hXdAMxeSkWidx3ER0iOPDmgPTCUeEvkfGkP1zIFrpbR/cTciGheNCyZA 9qv4pwDWnWftlCBjt5ul0bIliM4cKS145QvQEiQxIwTZ2F546X+hMTU6wF0Jnc4PC+JF 1ULWhgDVBPhiyT/Nknvs+OplZBuYaBoIN796DPLdmT/t/we+g3eUK1AP2Z7t2saOZv2Q piXsKIS9MbqWKA1sqiCIRB09jJBKihqv/myaHFswBoKnt836MELYrpbR7shdFCS0zlkk S9Lg== 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=RkCtEWbpTKKm4r56ZDma5HyvkdOrZz+0sQ1Hw9whPpSmJQfxsPXOnph/AnIHXPgI8C /R+ktAXkmSnXF/ksDoVXfgp0v9mnT/hJlSzeEgf6MqmzkB70WzAtEs5f/aceBBpNAwev Hzmu5wsNoLDy/IOJcA6UCH7f3P0Yn+ifMTchOF8GlWwd7i8jerEWY+5dPe7bf1M4tui0 7f8WGx1pbL+McDmlI+ECFOIFEMYqiyp0KJR+oQwvVUOOsS3HzxE1b8vSvpj/rmGrIIuj nZPgavMsoHjh+T6Q0YgkwsZH7UkRiXRnvkP9eMpMPITLSmJ7LzarAk6wG1PS4Fp0WQpR Iciw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VUcR2ytQ; 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 u24-20020a05620a121800b0075eba0ba2ecsi1365705qkj.765.2023.06.05.13.18.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Jun 2023 13:18:25 -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=VUcR2ytQ; 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 1q6Gcb-0001rB-0A; Mon, 05 Jun 2023 16:16:09 -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 1q6GcX-0001pg-It for qemu-devel@nongnu.org; Mon, 05 Jun 2023 16:16:05 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6GcV-0003ri-Hc for qemu-devel@nongnu.org; Mon, 05 Jun 2023 16:16:05 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-650c89c7e4fso5357362b3a.0 for ; Mon, 05 Jun 2023 13:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685996162; x=1688588162; 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=VUcR2ytQlFmX9xl9zbseIZXL9gskOt6wYo4EcqPyKesph+tmkR5EYKqiai7hvbqUJV ekC0RQ2HzKvBIGK+dRySezM8r7wRhlh9q6v/dNfaMJRVGVmpWBcaSkl41xBtbiSorHZm m+jJTvIozLyL706b37s6PvRYqBgknmdiHbBwfQ2x1wazoilUxfBMUXlDP15F57sjG53q 6c3aKtZPUdJcI/T/y+/uJjW7tKnTjyOmSzIP4o4BfWtsJ1YN9qDGYmnuXbxUJ4LJB9no ovul8fn+tVMqQYIqHNH7107LOvmw+/2Wj/f21uUzlwDmG0mEcAoea8AAwVeL5W8aPgwq Ig1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685996162; x=1688588162; 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=FUqp+IuSPX5FnLeolKMXCx6FyAeh3nF7bHNKLyutgSOdlUS3gTFwRF0vBuMR3hnZZ0 NopTNW+sTXp4Leq4mGczLFi+ATkqLcvrgkBexWaH4wdW22sdIB8x8nTCA8M2Q86id0m9 rr7pVU5Fysb7qi/1c3FKZUq5BA34YCto/BXaUTIQSwMHMNXVDPRdBsChlZQ5GibQ7VyI 3CGb3IJVIWwvYLGqLJ4wQTwdK9VJfUFzgS/ErsAxTSCanRy6rjOQiLYvBFEa2+HKFrsr zMoCUOgk5kfiXWlzxUCk/sJCwUlx9mffUhfIGzIwq7M5PmutSCQT04USYt/UATy600U+ iW6g== X-Gm-Message-State: AC+VfDwusSbxYpkm7ZnPKFjmcFiGnHPSKEuEJ53Ey8KfNY38HKuHwUOW SYLhSowNsF0jANxoc0Sq/8VWHKuLY+vgWYMBQIU= X-Received: by 2002:aa7:8884:0:b0:64c:4f2f:a235 with SMTP id z4-20020aa78884000000b0064c4f2fa235mr910102pfe.30.1685996161899; Mon, 05 Jun 2023 13:16:01 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:3f85:a600:6a3e:e465]) by smtp.gmail.com with ESMTPSA id f18-20020aa78b12000000b0064d32771fa8sm5552924pfd.134.2023.06.05.13.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 13:16:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 13/52] tcg: Split out tcg/oversized-guest.h Date: Mon, 5 Jun 2023 13:15:09 -0700 Message-Id: <20230605201548.1596865-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605201548.1596865-1-richard.henderson@linaro.org> References: <20230605201548.1596865-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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) {