From patchwork Sun May 17 21:58:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 11554407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D081912 for ; Sun, 17 May 2020 22:12:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1217E20758 for ; Sun, 17 May 2020 22:12:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K6oSefrg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1217E20758 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaRWk-0006hF-1Y for patchwork-qemu-devel@patchwork.kernel.org; Sun, 17 May 2020 18:12:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaRIi-0001wc-My for qemu-devel@nongnu.org; Sun, 17 May 2020 17:58:33 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:33115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaRIi-0005hr-0J for qemu-devel@nongnu.org; Sun, 17 May 2020 17:58:28 -0400 Received: by mail-pl1-x62a.google.com with SMTP id t7so3405447plr.0 for ; Sun, 17 May 2020 14:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K7IZYqiMOjR0HQghYXo05JFCNaL5rLGE+wUsI9wohsk=; b=K6oSefrg8DdYmiqRbnzY0/C7MXymusT6BUOrMCnS6TneDq7z4IdWhX+bUdqhs0S9V9 4AZCdSQPcf7Aco5Yu5Fmi5vOwPNKYWgHENcIY9/DADwSpQgRlHVKtLhYfx8VRWy7YOoc 4bmU6i1iK5C034HZ4y4wjh1HglQP+R6fwHv0b31BXZvVRtsBMfT9nz7LED8blOaonbrt S1/fW2Q94TFx5wncwRSXz92RvZdnmIXLFKDbOExxZ0XuoVL4ygqPGD5D5AzNkqs7Ku8X y+c+HwZ4y71/2X5cLgyGbhPmH5RqMbrccb0YRYCSw128ZndoPPuGAY76hcE43H1mwPMU elLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K7IZYqiMOjR0HQghYXo05JFCNaL5rLGE+wUsI9wohsk=; b=E8qPsl41FdPpuq978i2PkCfaR3A3xyNuCsgjDm7I/W2z8CBy4cFwbvQp/EYicqX3Yh CeqXalUrIjBOQLrh/5Er/Yx9FzCrvACCPB5GgxQw9IlypfbyZCJfXuwUj5MxJqYNITRp c5X9aPi7jcwhwWYaLS00ZdUtnrJ1utJuK/Tyy2V6a7Eug6Qj7Amu2mak6UXaZF92XREv qEtkUDXra5f6nWra3D+S54GGoQB3q8Q5KXLyWFFC1YMp6pAMylKvXAKgbmy++P1k9PIj eGxblYbCYv6sGLCbsUi8BQjjhNiiHpxESM9pdD0UnMlD67A9w/kxGrzRSMmUoOs+n5OM 5f9Q== X-Gm-Message-State: AOAM533HFL4HbQI0TgXHYzZM0q82F3EdQsipgbH9Mx+K9KzagwJVyKyU v9//FfZTGv5yoSQj4eGRWYxzyu5d X-Google-Smtp-Source: ABdhPJxh2IGhgm5+W2XBJf7h6TxmyC662A/NlKfBDpl8PbYrejqkXN0CXK7Xn2ImbEbG7S5r9d6TLQ== X-Received: by 2002:a17:90a:d17:: with SMTP id t23mr16239808pja.77.1589752705836; Sun, 17 May 2020 14:58:25 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net ([2601:641:400:e00:ed54:ef93:7dc5:e673]) by smtp.gmail.com with ESMTPSA id h14sm6670139pjc.46.2020.05.17.14.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 14:58:25 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Subject: [PATCH 1/2] target/xtensa: fetch HW version from configuration overlay Date: Sun, 17 May 2020 14:58:13 -0700 Message-Id: <20200517215814.19623-2-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200517215814.19623-1-jcmvbkbc@gmail.com> References: <20200517215814.19623-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=jcmvbkbc@gmail.com; helo=mail-pl1-x62a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 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, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Xtensa architecture has features which behavior depends on hardware version. Provide hardware version information to translators: add XtensaConfig::hw_version and use XCHAL_HW_VERSION from configuration overlay to initialize it. Signed-off-by: Max Filippov --- target/xtensa/cpu.h | 1 + target/xtensa/overlay_tool.h | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 7a46dccbe11b..32749378bfc7 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -464,6 +464,7 @@ struct XtensaConfig { XtensaMemory sysrom; XtensaMemory sysram; + unsigned hw_version; uint32_t configid[2]; void *isa_internal; diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h index cab532095c9e..a994e69b6e96 100644 --- a/target/xtensa/overlay_tool.h +++ b/target/xtensa/overlay_tool.h @@ -60,8 +60,9 @@ #define XCHAL_RESET_VECTOR1_VADDR XCHAL_RESET_VECTOR_VADDR #endif -#ifndef XCHAL_HW_MIN_VERSION -#define XCHAL_HW_MIN_VERSION 0 +#ifndef XCHAL_HW_VERSION +#define XCHAL_HW_VERSION (XCHAL_HW_VERSION_MAJOR * 100 \ + + XCHAL_HW_VERSION_MINOR) #endif #ifndef XCHAL_LOOP_BUFFER_SIZE @@ -100,7 +101,7 @@ XCHAL_OPTION(XCHAL_HAVE_FP, XTENSA_OPTION_FP_COPROCESSOR) | \ XCHAL_OPTION(XCHAL_HAVE_RELEASE_SYNC, XTENSA_OPTION_MP_SYNCHRO) | \ XCHAL_OPTION(XCHAL_HAVE_S32C1I, XTENSA_OPTION_CONDITIONAL_STORE) | \ - XCHAL_OPTION(((XCHAL_HAVE_S32C1I && XCHAL_HW_MIN_VERSION >= 230000) || \ + XCHAL_OPTION(((XCHAL_HAVE_S32C1I && XCHAL_HW_VERSION >= 230000) || \ XCHAL_HAVE_EXCLUSIVE), XTENSA_OPTION_ATOMCTL) | \ XCHAL_OPTION(XCHAL_HAVE_DEPBITS, XTENSA_OPTION_DEPBITS) | \ /* Interrupts and exceptions */ \ @@ -498,6 +499,7 @@ } #define CONFIG_SECTION \ + .hw_version = XCHAL_HW_VERSION, \ .configid = { \ XCHAL_HW_CONFIGID0, \ XCHAL_HW_CONFIGID1, \ From patchwork Sun May 17 21:58:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 11554397 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22EE290 for ; Sun, 17 May 2020 22:04:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E362220735 for ; Sun, 17 May 2020 22:04:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I09d9MZ9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E362220735 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaROI-0003ip-6A for patchwork-qemu-devel@patchwork.kernel.org; Sun, 17 May 2020 18:04:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaRIn-0001wt-9n for qemu-devel@nongnu.org; Sun, 17 May 2020 17:58:33 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:35991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaRIj-0005iJ-FR for qemu-devel@nongnu.org; Sun, 17 May 2020 17:58:29 -0400 Received: by mail-pl1-x641.google.com with SMTP id f15so3396275plr.3 for ; Sun, 17 May 2020 14:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GuKQ1OZpzNXkTUoxhwG03FMhbt3mmT8xFQUFvn4BBPI=; b=I09d9MZ9lto32k2IMHynP085zNmSWLdiO2KzA0dTqvngSalq9WWsZVDxmhYReiree5 Z4cTgzMi0A7VfHSqiTC8kpV7o0gIY5tTeODHCzYOeB7S7cAreQpgvHHlsqJYINdqhZQT aF2wGkVYaFE4MpVX9l/Nt/kKug0T3lwPqvKSlKmzLeYRhm+v67lKVqqa5gRIDOO45v3H U1DWG1rPitFEHkKqnJS+IgJJeIJL9Yh9jUfAdXx9N4CtDhStElKrAaM2tha+ACrsTofx Lfzmo2fNuMQ8cJoS9UTxRKipAYgEV8E4+neByrKJif+n37qHxM6CJbQavfv+WlrQfIRe YUZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GuKQ1OZpzNXkTUoxhwG03FMhbt3mmT8xFQUFvn4BBPI=; b=OgTS31t5Of+rgfVri03SKftrUEweSfOD3yJPpqRQ+ERVRsIK0uSA0PPQ8+47p3328Z 12qt1IUa6G/ePm95PDZaaZ1RFEumEq03bO1rFOFxCNa9kQzzlUQbDD3OBg4EgiMVYC6Q lL7YJzKIpbX/3TSpUPO5OviyUlaAF2qxaLVcMqCwTsadRneVJ0Jp8vwdQ/zta3nsI79/ wa5Isl4aY34jQ1etWa6jyMrPS3yWWj3CHny+ejn3W/JNf6eTHAXCs3VpS5/MxfGg6aWm nrJh3rGrFRRZvD+Zu5owcFz2fZeZgOupLvjQ7axoXX7r/Lq0YwQb+3lhIvQHGa9jCa2d vq2Q== X-Gm-Message-State: AOAM531oHPZ4cWs7yIkzceTiOUA1ASZr84Mm7FXsSlK/xLSabmwao7qf uTsaJDOUI1m0UCX6DirVTiIsA2Mk X-Google-Smtp-Source: ABdhPJz4uzJgQPiwVRUL8S5r4MfgE2RV9kmjjRvsOaSZfDw2lqqBAP0DNSi0ie6oi/RjZ315YzLNXg== X-Received: by 2002:a17:90a:248a:: with SMTP id i10mr16839706pje.174.1589752707411; Sun, 17 May 2020 14:58:27 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net ([2601:641:400:e00:ed54:ef93:7dc5:e673]) by smtp.gmail.com with ESMTPSA id h14sm6670139pjc.46.2020.05.17.14.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 14:58:26 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Subject: [PATCH 2/2] target/xtensa: fix simcall for newer hardware Date: Sun, 17 May 2020 14:58:14 -0700 Message-Id: <20200517215814.19623-3-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200517215814.19623-1-jcmvbkbc@gmail.com> References: <20200517215814.19623-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::641; envelope-from=jcmvbkbc@gmail.com; helo=mail-pl1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 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, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" After Xtensa release RE.2 simcall opcode has become nop for the hardware instead of illegal instruction. Signed-off-by: Max Filippov --- target/xtensa/translate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 546d2fa2facf..4bc15252c8a5 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -2367,9 +2367,10 @@ static bool test_ill_simcall(DisasContext *dc, const OpcodeArg arg[], #ifdef CONFIG_USER_ONLY bool ill = true; #else - bool ill = !semihosting_enabled(); + /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */ + bool ill = dc->config->hw_version <= 250002 && !semihosting_enabled(); #endif - if (ill) { + if (ill || !semihosting_enabled()) { qemu_log_mask(LOG_GUEST_ERROR, "SIMCALL but semihosting is disabled\n"); } return ill; @@ -2379,7 +2380,9 @@ static void translate_simcall(DisasContext *dc, const OpcodeArg arg[], const uint32_t par[]) { #ifndef CONFIG_USER_ONLY - gen_helper_simcall(cpu_env); + if (semihosting_enabled()) { + gen_helper_simcall(cpu_env); + } #endif }