From patchwork Wed Mar 19 13:45:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 874726 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a90:0:b0:38f:210b:807b with SMTP id s16csp407122wru; Wed, 19 Mar 2025 06:46:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZceIIyKE6KVV8WRy/PRoyI7A46CFRgH10xTApG3NS5cTbIgTNBAQ1csLriyw3BvGfceVKIA==@linaro.org X-Google-Smtp-Source: AGHT+IH9CvH/U5si8isMY8aFaMNVOkNdeDZCGLpR1ETc0lmEsuZdi99Dt48WAL4RDBudMgYE8cfM X-Received: by 2002:a05:620a:31a8:b0:7c5:4194:bbcc with SMTP id af79cd13be357-7c5a83d29a7mr297508985a.29.1742392013612; Wed, 19 Mar 2025 06:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742392013; cv=none; d=google.com; s=arc-20240605; b=Y5skzrHGYVc1myzecUpkRiq+SECtYkibvbNBxGXSt/aNlU1TZjUtxgytxGuMboD8pl WNZoMa/9XbE9UhpX2OUxZZazQxiRs5O9cWEbeNkjYsDTBMjE6lP5x09hhue40aPAynsL Cbg8Nkx2SzEFw0ikbjviaGBgMrt7ViCmwxiRXBy7A1xHCU+kGj+FcfqkcrtqC1pyPSNT 3pWfpfH+G34wQVVV9PvUgiaak9gV2/jKXkc9gNXPEsUT8hWUgSr64DDUThdGx8daR8VC T4MQfYqbwp5mXct9FHs6nI2liPl+ksjvqG4QA1PEPVr+/+h9k0KTi9XonupBJnewbHWM twfw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7+uCNdGR7Q/g7PWEHJ64I2sH/b8RzXSLv7jzZO24+jg=; fh=oQsvFjElslmUPxsR6fJkm0Ezna1Yj9KV/ql5u2IKgnk=; b=Pj0vtqhb9l5bJ+c+TWwZ5D3w6yvr9RpLaxI3us8SXv9MuU2/WyJEt1Skayw38mTYUR jDaojecUV4ZS0uHEFXwypoth+B0xqrAst2DsCblpuIaGN0joX7cgmK+ymGF+OFCpbddD REj+Cfg8aMXfzpltY28F6HkIQ1ncJOhb2nJTnfxJAXWD/FYWAAQrWzuKcp5H1BF9XuAL +pnJhxvcoU6WwL4W8Qx8lSsaY8k+G5UGRMpYS6+W/MA/9ukva2oQm1Wf12akyDKAS2My yXbhF5nnp+oPm9GnM2gI9qRbu17sVRQ/Fs/SJY3yfpJzOmd2dXJvFIP+E832FYB3SueN LMiw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z81AiAA8; 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-7c573d342c5si1384550485a.635.2025.03.19.06.46.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Mar 2025 06:46:53 -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=z81AiAA8; 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 1tutk6-0003Uo-Ss; Wed, 19 Mar 2025 09:45:59 -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 1tutjw-0003LU-8z for qemu-devel@nongnu.org; Wed, 19 Mar 2025 09:45:50 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tutjt-000448-VN for qemu-devel@nongnu.org; Wed, 19 Mar 2025 09:45:47 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43cfecdd8b2so33504605e9.2 for ; Wed, 19 Mar 2025 06:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742391944; x=1742996744; 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=7+uCNdGR7Q/g7PWEHJ64I2sH/b8RzXSLv7jzZO24+jg=; b=z81AiAA88CtFA/u66YLSXWl6B92M1iKMX4SswGvwyLXJgP1u3jgx8DbRnHDjhBGd5U dCmELXfPITs10wH3Bzn0W4wWZtCXHPbK86KJ91Z9sqwwKdHiuq3+HlPcnJcEiDa6oGdw RvDA61yOLCqq6Utk0Pup4+miwEv8XCqU6lhZFSm8WDtokXadHgPY7c9wDe1OXqBC07ek r2pP+5uRKlzXR5f8YoYc1C6sVT7JLxNRh/05JSAT5eLUnwzplHa/NTpbj5B1558y2gd0 9i5pPD+y0Zwc4zAfSiA7ycG0uRc9rJxpaE5O/5G3CNJjBBY055iUZBfh4o9+iMUhSzjv fH+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742391944; x=1742996744; 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=7+uCNdGR7Q/g7PWEHJ64I2sH/b8RzXSLv7jzZO24+jg=; b=M8fBbCv4kMwVG/CpJzKZYjKwFBuOX0jDt/HBvhRpQHT8bws5gvRVqXm1dkUNIlE+lY lNO7+xRngbZHPGDdo5XFOr2lqKWe+yLUU49TLAbLQIeEOylbgcFIEAywmOU9WBFKKGeO 8Q/X4kwOMYjR4KCkILhTERRlUXo3HUV9qDg6JxrP5cFnaa/jzgKkmmaNicXBq8vxx2ZF Puj35cGCMSGveF2v4I6nuSheHw2C/SxbV+eOPD4z6Vj16WMOrYoOYtelfLD8jz1GD30q ma4TF3R797lEi/EgbZ6P65CejNVQZZEI/fKvN/boSiaGb1kXFRmPbCii/hiXM3OhnCxj 9yHg== X-Gm-Message-State: AOJu0Yz28Vqp0JddVUestbtiMtUJYrVQxiscRjHDre/sRDCdvVFhPw2j 5Bfz0qV7ELEqGDSoorKyu7GfAxryPQvo2ZCK9FuB4WAH17r3tMY7Pjf5tQ/C5sQ1S/7NVFSsAW7 c X-Gm-Gg: ASbGncsLVQxGCrG7Th8BGtr80wJQhkFDSFxdLtneL9et+wLmfYa9k7sZACQ4bliczfY W5Xq807BXFtAAmpIyCnB51UwLYTZ+HmnkQ4+85J5OrdY3seomZh3Y7oTULz9NWUFVBnPJpJ4m4x GTdQmX9hQ+bPLs9ledobfRnuHVwyQCG8Sc46R5u7Q19UtZoY/AScBpld03a8zewnuKMPFPwKxC4 ijxBT8nsDUfNDDsNVy3Rbd1mfuBtuFAlJdguu9pkROoaa96C7tJTTyitTgqdd8fTuQTpE8JKbs4 c9KIdMYsxwAzCWtaVRLow5C5ucwkFgJAOBdZ2A0+1GouvLhYQnHnRVeAx2Lou2g+M5Us2CJd4lr Ww+Mf2fHJG51BcJBEoMM= X-Received: by 2002:a05:600c:3d17:b0:43d:b51:46fb with SMTP id 5b1f17b1804b1-43d4378617dmr26394205e9.2.1742391944101; Wed, 19 Mar 2025 06:45:44 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d43f43ed6sm19274365e9.13.2025.03.19.06.45.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 19 Mar 2025 06:45:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Anton Johansson , Peter Maydell , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PATCH-for-10.1 07/12] tcg: Check TARGET_INSN_START_EXTRA_WORDS range at runtime Date: Wed, 19 Mar 2025 14:45:01 +0100 Message-ID: <20250319134507.45045-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250319134507.45045-1-philmd@linaro.org> References: <20250319134507.45045-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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 Define TARGET_INSN_START_WORDS_MAX and use it to check TARGET_INSN_START_EXTRA_WORDS at runtime in tb_gen_code(). Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé --- include/tcg/tcg-op.h | 4 +--- include/tcg/tcg.h | 2 ++ accel/tcg/translate-all.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 1f0d3b95304..0915043adf8 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -41,7 +41,7 @@ static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1) tcg_set_insn_start_param(op, 0, pc); tcg_set_insn_start_param(op, 1, a1); } -#elif TARGET_INSN_START_EXTRA_WORDS == 2 +#elif TARGET_INSN_START_EXTRA_WORDS >= 2 static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2) { unsigned insn_start_words = tcg_ctx->insn_start_words; @@ -52,8 +52,6 @@ static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2) tcg_set_insn_start_param(op, 1, a1); tcg_set_insn_start_param(op, 2, a2); } -#else -#error Unhandled TARGET_INSN_START_EXTRA_WORDS value #endif #if TARGET_LONG_BITS == 32 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 84d99508b65..92a23e10218 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -577,6 +577,8 @@ static inline TCGv_vec temp_tcgv_vec(TCGTemp *t) return (TCGv_vec)temp_tcgv_i32(t); } +#define TARGET_INSN_START_WORDS_MAX 3 + static inline TCGArg tcg_get_insn_param(TCGOp *op, int arg) { return op->args[arg]; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 54bba995a04..5e2a89dc474 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -66,6 +66,7 @@ #include "internal-target.h" #include "tcg/perf.h" #include "tcg/insn-start-words.h" +#include "tcg/tcg-op.h" TBContext tb_ctx; @@ -351,6 +352,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->tlb_dyn_max_bits = CPU_TLB_DYN_MAX_BITS; #endif tcg_ctx->insn_start_words = TARGET_INSN_START_WORDS; + tcg_debug_assert(tcg_ctx->insn_start_words <= TARGET_INSN_START_WORDS_MAX); #ifdef TCG_GUEST_DEFAULT_MO tcg_ctx->guest_mo = TCG_GUEST_DEFAULT_MO; #else