From patchwork Tue Apr 22 19:26:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 883147 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2602040wrs; Tue, 22 Apr 2025 13:13:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXO0Dt2ggKau6a8ZHYoIt55iuaCZQSj9mZCTH/N1wxvCYsFmUSKZ8/ObrEXdP2cJwbi9HeSsg==@linaro.org X-Google-Smtp-Source: AGHT+IGO58eVsoTP81IUUCEti9oKOg1GT/T6arwr22I7SthLVLKVBIlsMQxPK9gQcUUgumEy/Lj+ X-Received: by 2002:a17:907:7f86:b0:aca:d276:fa5 with SMTP id a640c23a62f3a-ace3ef0beffmr52260566b.0.1745352795414; Tue, 22 Apr 2025 13:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745352795; cv=none; d=google.com; s=arc-20240605; b=ANmk7uIywB6c9R+5jkILCTXoyFa9Eh5uC2i4JhlWqCvoFqp8YSbkI6NOLCzQoAKhAM tTjSvbHQzeacXca14qbOuJA2VoYxYd5e6XzIf6+W0F8JEJrDcn0OBBq7B2voahqOszQc 2s9/Cgtj6X06AhNWUz4/EBZD1zjGnnCDHkRrolC9mwN5qbjwiSSHMPd0o1UkN9MZQ1RI udhf6/u8+Txi0uQY27hFl8PutTZ9x7W8K03ZEipEKadyM/w1/ydnTwbMHpzXqKPOjVrF YEqZ6TcLThKeG7HKQAmgKB8X8VkVIAubo7o0s5xcltukJCFpMNBG9QGCrqZbVYMqZTGA BRgw== 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=qcw0j/NlWHHUFrSWrBThXyu3TLmFkd4CNoNN4KpSa40=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=Up+RfdwEEZy8EQTKxWQF6xSLiIQ+YS4EPR1XhBMmoXwsFS4VjkGIcx3D0x3L8nYmSq hCARI1lefUba1zYCtqcsv/QaLSILd4gFoYxex8j/FCJTrgDPo0AOV4CGkH0kHblmjzGc Gg/+9An03fopT2f/T8YrnAX446vd1xLIsDX2Ualxl5nXlkkIdLxI1ORfBYkDQIR73wja TEDm+2qRuXoe1s2/KawNTyHq3oTrZpzJRFcYw7R+Im2Shy+eAbWBVbVGwpVGTvar5Y/C v//dhVzPHUW6IDQubF1fMPdfU4Vnra59NRj8XISF1Dx0sNsc0EpsmbX8AnKM8zoWpQtM 7BkA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tRvwom6x; 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 a640c23a62f3a-acb6ec0befdsi693692066b.241.2025.04.22.13.13.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Apr 2025 13:13:15 -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=tRvwom6x; 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 1u7JQx-00013B-Kc; Tue, 22 Apr 2025 15:37:31 -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 1u7JLW-0000BL-K0 for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:31:55 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7JLU-0006as-At for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:31:54 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-22c3407a87aso84188125ad.3 for ; Tue, 22 Apr 2025 12:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745350310; x=1745955110; 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=qcw0j/NlWHHUFrSWrBThXyu3TLmFkd4CNoNN4KpSa40=; b=tRvwom6xp9qKY4ahcO1/L3Ry2UUWyv+xm8rP9Y/RXbp8yy+69llJ2ICrcRbQwa5SSQ TBSIU4hDHUEGWcJMan/hBPHXxCmi7P1ruuy/sGhjoFcSr5sJWm7K5MJFMCUcicPpKxkD ZkY/TWWqRV/+zSRm2u3nPSDiVkBXAN5gR4bCNB9r3H4/z238O1KhWqClKkt1hqlp91Lt e9Tv8qQNb1rGx+ePIIa5ZrPmoSy3hOECcsad89vQuZy8xqF/EtaQ2jt/WmzHMAIbvOKL SKrRh2+5YUK1rhOGNNOI/t+xGA1c+MuoM3DdMxKvlvSjN2LxJiA5XGERMuvjal9SSc73 5lPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745350310; x=1745955110; 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=qcw0j/NlWHHUFrSWrBThXyu3TLmFkd4CNoNN4KpSa40=; b=ApqHQsrmC358OhdcS+D+FW09vCfexfK7V2eK/9QC5VUS6IRcMEbjmZ2LWZg/LghlFV 7z4lr/bJoshLIRDVNb6txxvVeIKMKt1S5pT0tc9iUyvKSHOmYhaxei59X+QrDIbPWpO3 mBT4aEUuhpc4O6hLRpa2JsvVTLiqytKuz1hbE4GxdTCZgB++NwtjQLVqgVh3Xi755rMH L9tKx7+W4VK2RP7HiDMCI/AyGha0KSfrotwlQzBWBQoCtW0xw8vnOX2ckhWiYXgUHYiI wJ1OLYwky10LmYWaxd2hk9vGTRHk1Dxw5WnA0ngXOeUyux1DnXTLVwu9w3jiLQ5R0W19 IpYA== X-Gm-Message-State: AOJu0Yy8TNLtj6Gi6p7EX/M/Dv/V0n4ZX3FA1AltFemja1wCWi8Xwj0f 26zEqmzH9RDOZfD8GaiMSkE72X2zCPI8faFilKsxjPCY0Cq/nikPbJL7DDL09UJ2uDS1hX0ZZj5 d X-Gm-Gg: ASbGnctIaJ7jNR/8VCY6BFpU5LILc5uK8D4QfU6D+stdz/EZouOUgGCU5xlniCPKU8e ZavN+/hY/RVvJVqA/SzKgOGmygRA1LpVnb4z5mc2yFRxYZ54RQyYwH9WuS1wi2qRWnRRmOb5tVK SjpshKF21MD+EZYDt3zy0Iu8WK7Z4xCCkQFlfDi95RyMl9gJrtmgPRf/YqUkaQw6H/51qP6VrE3 8u/Y+uriCnpkYB45VOIpnBYFsGZD+3bzwURug4e+vD0hsAOGxY6eGIqnMpKwb/XOWuj1am/ysxY 6fHtktVswzxv0DWrReunFGB8saWbG/70A9AktldI12QZxTJ+Smc7Ti9DYKAbF/w3YSF0RNI1ch8 = X-Received: by 2002:a17:903:3bad:b0:220:f59b:6e6 with SMTP id d9443c01a7336-22c5356798amr208685535ad.8.1745350310640; Tue, 22 Apr 2025 12:31:50 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c50bdda3bsm89312635ad.27.2025.04.22.12.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 12:31:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH 045/147] target/xtensa: Restrict semihosting tests to system mode Date: Tue, 22 Apr 2025 12:26:34 -0700 Message-ID: <20250422192819.302784-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250422192819.302784-1-richard.henderson@linaro.org> References: <20250422192819.302784-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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 We do not set CONFIG_SEMIHOSTING in configs/targets/xtensa*-linux-user.mak. Do not raise SIGILL for user-only unconditionally. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 4f02cefde3..cb817b3119 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -35,14 +35,14 @@ #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/qemu-print.h" -#include "semihosting/semihost.h" #include "exec/translator.h" #include "exec/translation-block.h" - #include "exec/helper-proto.h" #include "exec/helper-gen.h" - #include "exec/log.h" +#ifndef CONFIG_USER_ONLY +#include "semihosting/semihost.h" +#endif #define HELPER_H "helper.h" #include "exec/helper-info.c.inc" @@ -2241,17 +2241,15 @@ static uint32_t test_exceptions_simcall(DisasContext *dc, const OpcodeArg arg[], const uint32_t par[]) { - bool is_semi = semihosting_enabled(dc->cring != 0); -#ifdef CONFIG_USER_ONLY - bool ill = true; -#else - /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */ - bool ill = dc->config->hw_version <= 250002 && !is_semi; -#endif - if (ill || !is_semi) { - qemu_log_mask(LOG_GUEST_ERROR, "SIMCALL but semihosting is disabled\n"); +#ifndef CONFIG_USER_ONLY + if (semihosting_enabled(dc->cring != 0)) { + return 0; } - return ill ? XTENSA_OP_ILL : 0; +#endif + qemu_log_mask(LOG_GUEST_ERROR, "SIMCALL but semihosting is disabled\n"); + + /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */ + return dc->config->hw_version <= 250002 ? XTENSA_OP_ILL : 0; } static void translate_simcall(DisasContext *dc, const OpcodeArg arg[],