From patchwork Sat Sep 16 21:40:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723591 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1028477wro; Sat, 16 Sep 2023 14:43:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbU/8ZIe4ZjeUzDkre5X2fsAIhMeGNqWDG5Y5efD+EXvjTun1RKE70UzV01KDJFvz+5okK X-Received: by 2002:ac8:7dc6:0:b0:417:96ea:e982 with SMTP id c6-20020ac87dc6000000b0041796eae982mr7285817qte.63.1694900582063; Sat, 16 Sep 2023 14:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694900582; cv=none; d=google.com; s=arc-20160816; b=vq357q45U9OnU5pqxpSLugDfkkmE0wf6iyDJxozGBmGaS2IGBstJeUWnDDyuLxVgdQ PhpT7nuJCpjn5tdAgtq8NJqVNIFpbRSQBrDOFadtMuJJFMZvW1nKYQ6Rqx+5uxE34I90 qqXkb472y/ctsvYVC5Kz8LoS8gWoLBPa+2y+U5IhIyw6TNIbOsTXzWsDZGYHJAEYpsZH 2i64l16JxWNtB25ZfEwp2ekg5mqOKtzEBSB2eibCaeEic8m+El7uQPaAIyxosmDUWeUI MESp2CUPmJyxHMr271vE6CJQQfj0DLsecpiboyZ0qTVOcB54rplUEQAFfLXWZCgjAH84 W0ew== 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=GwL0g4t7pLWk/ND+/4S+A46VLWCkPxcxxcvyHi0Mx8k=; fh=d3q967Ss27yOZEBNWb7WV1pwIIYORDjfLhLmomzC17w=; b=QgC8Za5TLKR7tWdrs57Fc3ek3gxf3fCSuFViwYqsSsYFJI/qtgvRVcOOyb8EbUiW8z +f9/5mGRWkIFA3tgF8OyPT/+RdIyHFK5bsAHVzNPEIK5A3HfpFo3/cGS0liQAnQamfge 8YdwygjUZoPL5Wr8DRT3qEf5n4qSQWXInF1Dc6xZToSAeX50U5l7LRIJvWrQrTZrmCDg qcGlSYYLaKs4V3YXx1WknFe7lGqyUIpVc7na2z6mE6nzfsdSneHO5qV16RWuCwHnt+oj ds/9bBH+Ou+HrrYdv4E3YdFrsZvicZw8eGV4qyRpaMWizxVoCCdDsTBVtr6iLzX0brIy T1hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ElO/TSVx"; 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 w1-20020a0cb541000000b006472c40dfbbsi3974666qvd.97.2023.09.16.14.43.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2023 14:43:02 -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="ElO/TSVx"; 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 1qhd2z-0005BD-Ns; Sat, 16 Sep 2023 17:41:49 -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 1qhd2x-0005A5-8w for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:47 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhd2s-0000Sa-06 for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:47 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6bd0a0a6766so2164887a34.2 for ; Sat, 16 Sep 2023 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694900501; x=1695505301; 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=GwL0g4t7pLWk/ND+/4S+A46VLWCkPxcxxcvyHi0Mx8k=; b=ElO/TSVxTvZL684QYwJlQsvzDGYWPnnBFEkKPHa+FqccFMGW6y6/eSb2Ij4f3xLMya Dru1hXTasTPjxxSStJ8eF7n/QGYq7eZM4qsPJQr3hh1xHYJhB6AbPkT5navhtACB8obN ufcvs/joGRa6n8nclJGrqT093ILIR1HqTKl2KAS9lS8ea3Grj9HkuWY5W/A46OhsgLS3 ONc1uGo17Ah2LntJT77xs70QXE0UyOS2m8SQ3IzFeq+qLe+om4tBKU8g5TUg+xKIhuXC E0mZxyUm6g1cp25LcPzeyCpDD/teifvSDj1hHflEF3au/jX9YANd9hYhhRh6LtESfPFv LzXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694900501; x=1695505301; 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=GwL0g4t7pLWk/ND+/4S+A46VLWCkPxcxxcvyHi0Mx8k=; b=reoepyo+mCRufRxKvhSBhgfUY8a0oYPg/ZWRd79NqsoxjIsuQsy4/rF86MYF0GvffH VBdoJAP+8VJv2bozzwAX4UER1pLYgJcb9ZORyJBNGB2c8eR9V0yZSpQKqGq8r/fTcxSJ TGGXXzTZC7nNDn4fQN823n1xijo1eKXVKW/upLfxzaDUaGaOZ/+XmlFTHYoWTHJ+TKMH OKx0hGDBGjtdMpRCGibMTnm4BiZSe+EeoftfimdUkYE0NXKRZM9stTpeBDOOIfuG64RX q8157p8IjpBqd2g8mSfUviv8qvyl9HDoae0mtty4x8juYdLytP1npvWLoTGTbo8JT1k1 KVNA== X-Gm-Message-State: AOJu0YxF6SIWdljFInogOidkBIw3yAYi4on61QQRY7ZAWbIX0265zkbr 5TjPt+XPw3bglvkP+MRJhAiwUgZz+4t0P3Z0gHI= X-Received: by 2002:a05:6358:5929:b0:135:99fa:5040 with SMTP id g41-20020a056358592900b0013599fa5040mr5851475rwf.12.1694900500719; Sat, 16 Sep 2023 14:41:40 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id n21-20020aa79055000000b0068fde95aa93sm4871708pfo.135.2023.09.16.14.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 14:41:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, anjo@rev.ng Subject: [PATCH v3 15/39] tcg: Remove TCGContext.tlb_fast_offset Date: Sat, 16 Sep 2023 14:40:59 -0700 Message-Id: <20230916214123.525796-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916214123.525796-1-richard.henderson@linaro.org> References: <20230916214123.525796-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 Now that there is no padding between CPUNegativeOffsetState and CPUArchState, this value is constant across all targets. Reviewed-by: Anton Johansson Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 - accel/tcg/translate-all.c | 2 -- tcg/tcg.c | 15 +++++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 3cdbeaf460..7743868dc9 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -489,7 +489,6 @@ struct TCGContext { TCGType addr_type; /* TCG_TYPE_I32 or TCG_TYPE_I64 */ #ifdef CONFIG_SOFTMMU - int tlb_fast_offset; int page_mask; uint8_t page_bits; uint8_t tlb_dyn_max_bits; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 6fac5b7e29..83e07b830f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -344,8 +344,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->page_bits = TARGET_PAGE_BITS; tcg_ctx->page_mask = TARGET_PAGE_MASK; tcg_ctx->tlb_dyn_max_bits = CPU_TLB_DYN_MAX_BITS; - tcg_ctx->tlb_fast_offset = (int)offsetof(ArchCPU, parent_obj.neg.tlb.f) - - (int)offsetof(ArchCPU, env); #endif tcg_ctx->insn_start_words = TARGET_INSN_START_WORDS; #ifdef TCG_GUEST_DEFAULT_MO diff --git a/tcg/tcg.c b/tcg/tcg.c index 72b113ad53..c72790cdf1 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -406,7 +406,8 @@ static uintptr_t G_GNUC_UNUSED get_jmp_target_addr(TCGContext *s, int which) #if defined(CONFIG_SOFTMMU) && !defined(CONFIG_TCG_INTERPRETER) static int tlb_mask_table_ofs(TCGContext *s, int which) { - return s->tlb_fast_offset + which * sizeof(CPUTLBDescFast); + return (offsetof(CPUNegativeOffsetState, tlb.f[which]) - + sizeof(CPUNegativeOffsetState)); } #endif @@ -734,6 +735,13 @@ static const TCGTargetOpDef constraint_sets[] = { #include "tcg-target.c.inc" +#ifndef CONFIG_TCG_INTERPRETER +/* Validate CPUTLBDescFast placement. */ +QEMU_BUILD_BUG_ON((int)(offsetof(CPUNegativeOffsetState, tlb.f[0]) - + sizeof(CPUNegativeOffsetState)) + < MIN_TLB_MASK_TABLE_OFS); +#endif + static void alloc_tcg_plugin_context(TCGContext *s) { #ifdef CONFIG_PLUGIN @@ -1497,11 +1505,6 @@ void tcg_func_start(TCGContext *s) tcg_debug_assert(s->addr_type == TCG_TYPE_I32 || s->addr_type == TCG_TYPE_I64); -#if defined(CONFIG_SOFTMMU) && !defined(CONFIG_TCG_INTERPRETER) - tcg_debug_assert(s->tlb_fast_offset < 0); - tcg_debug_assert(s->tlb_fast_offset >= MIN_TLB_MASK_TABLE_OFS); -#endif - tcg_debug_assert(s->insn_start_words > 0); }