From patchwork Tue Jun 18 01:31:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="cB/pcKUP"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SW3G3njBz9s3l for ; Tue, 18 Jun 2019 11:39:38 +1000 (AEST) Received: from localhost ([::1]:52952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd360-0002Ca-JB for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:39:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40876) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd307-0006cF-Ja for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd306-0008Ro-9p for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:31 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:60672) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd305-0008L1-Gs; Mon, 17 Jun 2019 21:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821609; x=1592357609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yjAxmHO+IlbgcE9s5eMCiJERcKojM3+lW9tXUnlXSrU=; b=cB/pcKUPRcGQKzDHIUan4UjlvWrAdL6lfYLEQZbqG12NK4m1IG8N0TGc kEqDeeRMBamty+vN93n2h0U7eSEbBf+q2q9poYGP44JlH+Ukv58wm6C7w kfto8cBZZxuSDBkIFQPymcYYBI8Jp45zRYCLR/RYIFdU2X3p0cPkXb/Ws zGl0s0x9VhmWhWvv+kbPVXcsq74d4kLnqMM+fxyQAzsuFDEp8LzopcQOI Klj2PntFlCsKiJQrtkm4Fv0IazeCcDIJmqiJBwiW1KePKi8LKhohyjrX8 S82YWKblCyr0jx1W5/lo1wkYcd49mwR2rmRVqPWcwu2lhrcAZ/I8Cr8cz g==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="115717009" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:23 +0800 IronPort-SDR: VG9tu8UusbKDclV52Qd+JWCPBXe80xj/UjdpEMallRNVW23hAcbkFcSpsYPRB7IGB+DP+QuAwD CLLVDblnEZ0DdUtBlJX06FWDm9iTN4b9Bgoz4mjwxcQ8XwEV50QA8GIxeqHnEPi6xD2XgzDdB1 eQfomJy+P/qiWXVeRVDiYEyVpJHcabBNbmHlRfJdTPObpbB0t+peFZH1AhViputiF4y4O7/Fmk 2L9/+YGsTwQGv2wE+YHBdV/wYcd2j6a1h5ekRKKm1nqKBF4d2TwUiagVoyCBOxfx2zIrZydVD0 ZpCajrvFv9WKskeEkUwa28HI Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 17 Jun 2019 18:32:55 -0700 IronPort-SDR: fYEWfEtGYkogHAAdOUQhiEpK0YpltRAVwxyjJ1ba6TtZ6/LYMtoK5UZXsF2+TBzCCrAm9UeKfM p5X8FFSipXFcnI74gK78VrATK4acqM1jQ0Khzr52kH/+6pfcRKsVf6uBJt8Mkr0yySIM/TTJkN ICGEkLqL8jcwiikC3JkblcrO7n6/6V6Nm6CGOCzJBVgCe3drfRBwwsaFsLg5S0WYdlMiJUvFyb xmZ/NZDZvLAbdeVcsUBgh2fxEYzRfBDQXQU6aXLZOaqLVkEe3b7uxPMINmE2/f5SWwCAdKkn6M uns= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Jun 2019 18:33:23 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:02 -0700 Message-Id: <1483cda620f3bff57b7c47ad74c44f586cfde4a5.1560821342.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [PATCH v1 1/9] target/riscv: Restructure deprecatd CPUs 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Restructure the deprecated CPUs to make it clear in the code that these are depreated. They are already marked as deprecated in qemu-deprecated.texi. There are no functional changes. Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 18 ++++++++++-------- target/riscv/cpu.h | 13 +++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 0632ac08cf..a4dd7ae6fc 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -558,18 +558,20 @@ static const TypeInfo riscv_cpu_type_infos[] = { DEFINE_CPU(TYPE_RISCV_CPU_ANY, riscv_any_cpu_init), #if defined(TARGET_RISCV32) DEFINE_CPU(TYPE_RISCV_CPU_BASE32, riscv_base32_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_RV32GCSU_V1_09_1, rv32gcsu_priv1_09_1_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_RV32GCSU_V1_10_0, rv32gcsu_priv1_10_0_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_RV32IMACU_NOMMU, rv32imacu_nommu_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E31, rv32imacu_nommu_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U34, rv32gcsu_priv1_10_0_cpu_init) + DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U34, rv32gcsu_priv1_10_0_cpu_init), + /* Depreacted */ + DEFINE_CPU(TYPE_RISCV_CPU_RV32IMACU_NOMMU, rv32imacu_nommu_cpu_init), + DEFINE_CPU(TYPE_RISCV_CPU_RV32GCSU_V1_09_1, rv32gcsu_priv1_09_1_cpu_init), + DEFINE_CPU(TYPE_RISCV_CPU_RV32GCSU_V1_10_0, rv32gcsu_priv1_10_0_cpu_init) #elif defined(TARGET_RISCV64) DEFINE_CPU(TYPE_RISCV_CPU_BASE64, riscv_base64_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_RV64GCSU_V1_09_1, rv64gcsu_priv1_09_1_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_RV64GCSU_V1_10_0, rv64gcsu_priv1_10_0_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_RV64IMACU_NOMMU, rv64imacu_nommu_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E51, rv64imacu_nommu_cpu_init), - DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U54, rv64gcsu_priv1_10_0_cpu_init) + DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U54, rv64gcsu_priv1_10_0_cpu_init), + /* Deprecated */ + DEFINE_CPU(TYPE_RISCV_CPU_RV64IMACU_NOMMU, rv64imacu_nommu_cpu_init), + DEFINE_CPU(TYPE_RISCV_CPU_RV64GCSU_V1_09_1, rv64gcsu_priv1_09_1_cpu_init), + DEFINE_CPU(TYPE_RISCV_CPU_RV64GCSU_V1_10_0, rv64gcsu_priv1_10_0_cpu_init) #endif }; diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index b47cde5017..1668d12018 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -35,16 +35,17 @@ #define TYPE_RISCV_CPU_ANY RISCV_CPU_TYPE_NAME("any") #define TYPE_RISCV_CPU_BASE32 RISCV_CPU_TYPE_NAME("rv32") #define TYPE_RISCV_CPU_BASE64 RISCV_CPU_TYPE_NAME("rv64") -#define TYPE_RISCV_CPU_RV32GCSU_V1_09_1 RISCV_CPU_TYPE_NAME("rv32gcsu-v1.9.1") -#define TYPE_RISCV_CPU_RV32GCSU_V1_10_0 RISCV_CPU_TYPE_NAME("rv32gcsu-v1.10.0") -#define TYPE_RISCV_CPU_RV32IMACU_NOMMU RISCV_CPU_TYPE_NAME("rv32imacu-nommu") -#define TYPE_RISCV_CPU_RV64GCSU_V1_09_1 RISCV_CPU_TYPE_NAME("rv64gcsu-v1.9.1") -#define TYPE_RISCV_CPU_RV64GCSU_V1_10_0 RISCV_CPU_TYPE_NAME("rv64gcsu-v1.10.0") -#define TYPE_RISCV_CPU_RV64IMACU_NOMMU RISCV_CPU_TYPE_NAME("rv64imacu-nommu") #define TYPE_RISCV_CPU_SIFIVE_E31 RISCV_CPU_TYPE_NAME("sifive-e31") #define TYPE_RISCV_CPU_SIFIVE_E51 RISCV_CPU_TYPE_NAME("sifive-e51") #define TYPE_RISCV_CPU_SIFIVE_U34 RISCV_CPU_TYPE_NAME("sifive-u34") #define TYPE_RISCV_CPU_SIFIVE_U54 RISCV_CPU_TYPE_NAME("sifive-u54") +/* Deprecated */ +#define TYPE_RISCV_CPU_RV32IMACU_NOMMU RISCV_CPU_TYPE_NAME("rv32imacu-nommu") +#define TYPE_RISCV_CPU_RV32GCSU_V1_09_1 RISCV_CPU_TYPE_NAME("rv32gcsu-v1.9.1") +#define TYPE_RISCV_CPU_RV32GCSU_V1_10_0 RISCV_CPU_TYPE_NAME("rv32gcsu-v1.10.0") +#define TYPE_RISCV_CPU_RV64IMACU_NOMMU RISCV_CPU_TYPE_NAME("rv64imacu-nommu") +#define TYPE_RISCV_CPU_RV64GCSU_V1_09_1 RISCV_CPU_TYPE_NAME("rv64gcsu-v1.9.1") +#define TYPE_RISCV_CPU_RV64GCSU_V1_10_0 RISCV_CPU_TYPE_NAME("rv64gcsu-v1.10.0") #define RV32 ((target_ulong)1 << (TARGET_LONG_BITS - 2)) #define RV64 ((target_ulong)2 << (TARGET_LONG_BITS - 2)) From patchwork Tue Jun 18 01:31:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="pkkFp++b"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SVxj6NM6z9s3C for ; Tue, 18 Jun 2019 11:34:48 +1000 (AEST) Received: from localhost ([::1]:52928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd31H-0006ct-MY for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:34:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40870) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd307-0006cD-A0 for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd306-0008Rg-9E for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:31 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:60676) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd305-0008My-Sb; Mon, 17 Jun 2019 21:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821610; x=1592357610; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cHdxWgwAn1Fa2k9YWEL6bbjXx/m3IzGg1kbVMyDLUYg=; b=pkkFp++bhIibAEiA/Phg7xVnPl6LW1U0ARF4O1VPeISdVaVciOBi6scm 30uiJ3P02yvACzbs5tZKkvsDdP6gtlCYkFyuZKgJUN8K2nNDV0fdWHNJ9 77SV1goaibVyQck/PEGMP9ifOjvMlgFOxVOJzSZyDJ0xBm1l2vl14YioB RRaU97kgTuLvvUU6z0xLrRvBKnX3XYHGRAT/yJ6UkchufsQCYN0+fCrnM oryjGJsIloknVLdj+rrxnCynWejrTAEBKq2vctIKUp3FJOyBLiWZFnaZu /X9iTzgT7O1jCt4ere0FakiMOXrzgUyKgpDQUiA4SWiaSJuFu75udJD32 w==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="115717014" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:26 +0800 IronPort-SDR: Q1vZTfuib2nLOuovSSZ6BOaoUqU0aO1BqkO7aRa05lnpDFSvAgPPyzYzabEM1eZq5hCeKekngY IXEYbgARaEcveCr0BZ3NpKtlF9a7DuwyeU4RGMfIQOQOGljQYp5cjtnQyU91e/MFS6uj9MCvC5 Fg0zrcWPmgJAfGOXS7O1M/qiYhvo9HPscRURrbMvjlvxaYitQRqPBIxh/JxfywcokZAQSe8cXs 2RPfyUsnOClU7miVZMqZxTh7/DT4ZRXFKAuufzixL9/tut71WywwZvXgK7wBKSPrriJM4CP8j5 ohVowmGgfYVOpJAbcJsuK+Jn Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 17 Jun 2019 18:32:58 -0700 IronPort-SDR: LfiNOx31Jhh63yW/q+w6WpP7ijeCH9ZZgJWlMoX7n8z0ndOn/wjssnBF2I+55OhCMOu38Bzc7E g0ExqrDSvEuSikkOXVFChDG4sPUncjhZLM7Nl0J9LymJCVNNVKZTzIoPk0V4TLN/rqwdr/DYt+ x1T5JhPtXiIUkf1AS89EmyNqAGX1dWsEhjrG7Zgo1tEFAfT/3M2nDfaPFFQgc75LArzocv8iQk xwTOiE0ZIfjl2yrI5sXiKrU30HnO8p1MNJFSeNfRMd4hlBnrkMJVuIYidT8g0Jw+//m7JNjkR6 qM8= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jun 2019 18:33:26 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:05 -0700 Message-Id: <88a6ea191c4ddc385f7ee1cdde58a27fcdc15855.1560821342.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [PATCH v1 2/9] target/riscv: Add the privledge spec version 1.11.0 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add support for the ratified RISC-V privledge spec. Signed-off-by: Alistair Francis --- target/riscv/cpu.h | 1 + target/riscv/insn_trans/trans_privileged.inc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 1668d12018..4e58c3b856 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -81,6 +81,7 @@ enum { #define USER_VERSION_2_02_0 0x00020200 #define PRIV_VERSION_1_09_1 0x00010901 #define PRIV_VERSION_1_10_0 0x00011000 +#define PRIV_VERSION_1_11_0 0x00011100 #define TRANSLATE_FAIL 1 #define TRANSLATE_SUCCESS 0 diff --git a/target/riscv/insn_trans/trans_privileged.inc.c b/target/riscv/insn_trans/trans_privileged.inc.c index 664d6ba3f2..c5e4b3e49a 100644 --- a/target/riscv/insn_trans/trans_privileged.inc.c +++ b/target/riscv/insn_trans/trans_privileged.inc.c @@ -90,7 +90,7 @@ static bool trans_wfi(DisasContext *ctx, arg_wfi *a) static bool trans_sfence_vma(DisasContext *ctx, arg_sfence_vma *a) { #ifndef CONFIG_USER_ONLY - if (ctx->priv_ver == PRIV_VERSION_1_10_0) { + if (ctx->priv_ver >= PRIV_VERSION_1_10_0) { gen_helper_tlb_flush(cpu_env); return true; } From patchwork Tue Jun 18 01:31:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="ASPNVYy6"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SW3H09K3z9sBp for ; Tue, 18 Jun 2019 11:39:39 +1000 (AEST) Received: from localhost ([::1]:52954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd361-0002Dz-3I for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:39:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40880) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd307-0006cG-Py for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd306-0008SK-OU for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:31 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:60680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd306-0008QF-Bs; Mon, 17 Jun 2019 21:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821610; x=1592357610; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M1eC63nLbKo5deTZERedixlrYYiXU7yvY+1DteOQC7U=; b=ASPNVYy6lMfsDq8k6wCpWFo0QGPoOvbr1Bsu3mjzWk/DcjubxvoH5RXR bZrYr+yip2vn8aR2xtXiSxXd/i/wmVQRo+hpjL7NfcCTYrNkH3wpxPIkR j+LhCeHK531arcyVayM8Z6J120E16HMNQyLaDHZwbuEvm/4pAmO31a2+a clKBfEUI2xeNnkuD2qPYlcwM/T1E351qVH8DO9KsTW/SngI0NdZbsEIla 3uokkyjmn716ML9RwPjtE6y6d19WhSAxnRLMCml36PRQntyz1TsgNGIax ivfJwo31R0Yb3ZQ1sm2mwnLgg9QnEBccuJrawTgHTGFtWAOksKWPryHuq Q==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="115717022" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:29 +0800 IronPort-SDR: Ofxj6kIPdmhmNMpf2yZrgoiWwwj/W/JIsJVdv/jUEbHIB573cWbIztjHB2sZbFk660MkSmFvem 2W0w0YI51ZPyxbor8QPjJ9bysAEpea0pzTU+imcJKV50XNpTxPXTMsK/8KyQDUw6tNF7ny2BOK jfy4pI3LfCHsTHHROQqRexGUpB8t8sM+JnB5l4BqJgI9OsWf6D+iaKlzcXoOzjPl3yuejv9wKl p0Jb4ZyAEz0yMWNZPR9olslRPaWw85xC9HMK/z3e1qczqXdM7Eo83DmSIzvH1ndAx/kFQwNIfQ ltlQ9EgKAWh1ZVXYWRSskN1n Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 17 Jun 2019 18:33:01 -0700 IronPort-SDR: 6uJu5WczK5Mj6IXKS8b+FVfSFKlHedeA+FruTcYD+I1m3OiY6xBoM2gwJYp0NrGqSSzkc6ICjc 17/iDvAEdIBCf01S6Z41iJArsRsshnYFh0f6iHQGktjSYqJuicR1DhcvzUCtG36iEU0tq1hYP9 XuXfbwJeHLjnOEiAl2xticJwQZhB+oYK5b6Tk1YPTrxIBQ3jiLUP4mU/rb4/+tty0eqPpSyV8W IBfcU1QrbwHj2mnuklsxcbXR0APcCPdR30InCa0MJGa/wqDweUoyjh1QUEKbTpQO+j86/GgnAD A+Q= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jun 2019 18:33:29 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:08 -0700 Message-Id: X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [PATCH v1 3/9] target/riscv: Comment in the mcountinhibit CSR 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a comment for the new mcountinhibit which conflicts with the CSR_MUCOUNTEREN from version 1.09.1. This can be updated when we remove 1.09.1. Signed-off-by: Alistair Francis --- target/riscv/cpu_bits.h | 1 + target/riscv/csr.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 47450a3cdb..11f971ad5d 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -136,6 +136,7 @@ #define CSR_MCOUNTEREN 0x306 /* Legacy Counter Setup (priv v1.9.1) */ +/* Update to #define CSR_MCOUNTINHIBIT 0x320 for 1.11.0 */ #define CSR_MUCOUNTEREN 0x320 #define CSR_MSCOUNTEREN 0x321 #define CSR_MHCOUNTEREN 0x322 diff --git a/target/riscv/csr.c b/target/riscv/csr.c index c67d29e206..437387fd28 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -461,18 +461,20 @@ static int write_mcounteren(CPURISCVState *env, int csrno, target_ulong val) return 0; } +/* This regiser is replaced with CSR_MCOUNTINHIBIT in 1.11.0 */ static int read_mscounteren(CPURISCVState *env, int csrno, target_ulong *val) { - if (env->priv_ver > PRIV_VERSION_1_09_1) { + if (env->priv_ver > PRIV_VERSION_1_09_1 && env->priv_ver < PRIV_VERSION_1_11_0) { return -1; } *val = env->mcounteren; return 0; } +/* This regiser is replaced with CSR_MCOUNTINHIBIT in 1.11.0 */ static int write_mscounteren(CPURISCVState *env, int csrno, target_ulong val) { - if (env->priv_ver > PRIV_VERSION_1_09_1) { + if (env->priv_ver > PRIV_VERSION_1_09_1 && env->priv_ver < PRIV_VERSION_1_11_0) { return -1; } env->mcounteren = val; From patchwork Tue Jun 18 01:31:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="MYOC1BCo"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SVy14fGfz9s3C for ; Tue, 18 Jun 2019 11:35:05 +1000 (AEST) Received: from localhost ([::1]:52934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd31b-0006ga-LM for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:35:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40926) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd309-0006cs-PK for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd308-0008Ue-NY for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:33 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:54812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd308-0008Ta-Ec; Mon, 17 Jun 2019 21:33:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821612; x=1592357612; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fQX+cG1dHeaRtULmRePJFSd6JTXSO12ulMWO1V2QRmM=; b=MYOC1BCozjgb87Rjk92azcqd8ptHW8nb3+HyhWg+hJ3/kAtQERQxcbZ/ cy0SjsPsoJ+v2pw4ut/p3Q+zuxFOiBNWC0nnl2SmM29xK4QksXwcc8N+I /zX5tF3Y6AqVGZmpyABkmNLA1Ze8m5M3P5ff4OFRpqltUcdRspQZ3ALcU sdUM+SYs0tDL1uZOODYcSH/vF38z7vCXiBMDZ2STQkT6X9pdkCPn2lHL9 dqcVQPJUzUtnNylPrgz8g+w1KqKh0OJ0kD1EqKSO5xBGzJw+ooie8r/Dg k9V9YfROJPRsmmJhlc8UGZPKHGwUII6DesseBNqTC/zFtKPGRYLk0RvT0 Q==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="112457248" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:31 +0800 IronPort-SDR: NQSOEOZiLa4568M+FVKFKvvyq2EameQZqdrkof07Ax8bpixmr4BNMU4Au6RMMOFjOQcII2a+nN fshcX80/9Mbdpd/vdQGAibyNO9BXGtdE8kNudiM0jf6Qj12s6j5Lt+16equn5eHtL7YdWs88aM q7o4iqkmGasMRrPgRVPgEc2lloOYTaGNnI2kf9efOtKwhutVC/6GMB88IIZm7D6N6dM9rkBHZ8 qNrHFQl/LcY0BgG79EgypVIO7t3XbjcYkCyuSMxx06F1fHz80f5hG7j0LtgkjTxADegIszM4Zg pqtx8VQBnDEIg+PD2KwZ0jS3 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 17 Jun 2019 18:33:01 -0700 IronPort-SDR: PnhoWeBSZG2DKf0SQU9P6AF2lge+IA7BxVUUis0mxYjgcpYY8FoPcsNal+MiWkIgfcgizQ7vYX TH55qx0pFtg8RnJtRcRjXtujxJKFMFNe0gtNFMR+MNi4NgZt30XbNHxmgCeWvQrpsmJQ8wvFmM 9hWvqnysb5v/ubdnxKD371Zca2r6Ms+epFZwlfIbSF9JwjTveqL3kEP78txqntxL/3q6myZy8w bzB7dc5PAi3fOstwggdD+j8iB1JC9SsAAtboqlj5HWigh8upDi8EMclrqmKy0EyS3Vnksg0sm4 Qh8= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Jun 2019 18:33:31 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:11 -0700 Message-Id: <313968903b6233d286c32bb0f52ac1620033a761.1560821342.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.154.45 Subject: [Qemu-devel] [PATCH v1 4/9] target/riscv: Set privledge spec 1.11.0 as default 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Set the priv spec version 1.11.0 as the default and allow selecting it via the command line. Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a4dd7ae6fc..a23d83921a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -111,7 +111,7 @@ static void riscv_any_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RVXLEN | RVI | RVM | RVA | RVF | RVD | RVC | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_10_0); + set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_11_0); set_resetvec(env, DEFAULT_RSTVEC); } @@ -316,7 +316,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) RISCVCPU *cpu = RISCV_CPU(dev); CPURISCVState *env = &cpu->env; RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(dev); - int priv_version = PRIV_VERSION_1_10_0; + int priv_version = PRIV_VERSION_1_11_0; int user_version = USER_VERSION_2_02_0; target_ulong target_misa = 0; Error *local_err = NULL; @@ -328,7 +328,9 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) } if (cpu->cfg.priv_spec) { - if (!g_strcmp0(cpu->cfg.priv_spec, "v1.10.0")) { + if (!g_strcmp0(cpu->cfg.priv_spec, "v1.11.0")) { + priv_version = PRIV_VERSION_1_11_0; + } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.10.0")) { priv_version = PRIV_VERSION_1_10_0; } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.9.1")) { priv_version = PRIV_VERSION_1_09_1; From patchwork Tue Jun 18 01:31:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="FJchp/Z0"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SVyL6Hhcz9s3C for ; Tue, 18 Jun 2019 11:35:22 +1000 (AEST) Received: from localhost ([::1]:52936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd31s-0006nX-Or for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:35:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40969) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd30C-0006hL-EV for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd30B-00005z-AT for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:36 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:60680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd30A-0008QF-Uf; Mon, 17 Jun 2019 21:33:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821615; x=1592357615; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tqX0fYHQddrpY4KXEEAbz2+C779KVIJCqxSKXh0arRw=; b=FJchp/Z01A5fmDXCvNKYqOX/3R2AiWMy5qApG0DT/vEHHHjPoFOhXZ8V b5+jabbP0b0snfIk6LLw7ASCw/0OjjzvXD+aDNK4vF5fxzr07YnvWzXkV vgE9Gb5WOf8XQTxj69A2kFrDKHRD8oP83zRs0b8JO4+eVdArM1kpQx60z bC6tFT8lUE6U9tLv2cNzAD2FULisskfiR7f3J57AS/m/N5PKT1+PJYCMt VJJBCIEdCn7CLlR7/jsbOFgO22xvxnbYG9FVaZALJi8/CQV/cNPQ3mDsc 5SxmWG5NanayFReXDvj21xANCyLVNSUJQPktsjcW0zu0hu9DB1kL+2RJ2 g==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="115717034" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:34 +0800 IronPort-SDR: cp9ajpirFhe8vkpB/SRmOQGjypRngaLzn/Qu8ZpYkjVt9vT8hxP0pUfuN2OExOnVQdi28+nKx1 DkAdFdu+p4Iv5qjjL7eyC7rHAya4Glouj4/ARKNy6g316SVmGmGmUF0bpkOnhg5/VptCVoNIr1 0BpbRsN1x3A9kW+vrrsnXDPxvhdybwqE5lmO7/zKSkcoSzCRMYnnwVVyAnw+IyzGzOQvSZY7ea GPGyWvb2ygi4C6mri144HMSFRgQ3ZhD2N+7X1DUHXmByrPPGW+enqJcXlTU8ko0TjroPMHOq2Q yfJeseQoraBko+hUmBZifApe Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 17 Jun 2019 18:33:07 -0700 IronPort-SDR: nL3S6vzMVwNY/N+ThlmOTPSJdMsRn9vKFmo6aWI4e84Mye16/5V6GAKGBKc++GOilzDaqdCfEA qOr0g4i5eICi6QMa92qz5Y8yCfo3n2zkBWJ580PQfssCjFKoUHYWAT8HCt483oaGcufTQ1WpQo wcO64g2W/gFTPYfiujwPJs10zhqpESjPTcN+sLNwL5oGBuNQT4wr0uQu6nkq5S6Zkr5lGxiarN qqeDUYOAh5AAeKbVZ9xuEoBs/1cc6mz8lOmb0Q7PfQhZjKcRqPMwbauzaADOWd3aPtbl2V979o H+w= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jun 2019 18:33:34 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:13 -0700 Message-Id: <6a7392df062afc1d7b4914d92da43f0711ec14ec.1560821342.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [PATCH v1 5/9] qemu-deprecated.texi: Deprecate the RISC-V privledge spec 1.09.1 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Deprecate the RISC-V privledge spec version 1.09.1 in favour of the new 1.10.0 and the ratified 1.11.0. Signed-off-by: Alistair Francis --- qemu-deprecated.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 50292d820b..b1111debf7 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -138,6 +138,14 @@ The ``acl_show'', ``acl_reset'', ``acl_policy'', ``acl_add'', and ``acl_remove'' commands are deprecated with no replacement. Authorization for VNC should be performed using the pluggable QAuthZ objects. +@section Guest Emulator ISAs + +@subsection RISC-V ISA privledge specification version 1.09.1 (since 4.1) + +The RISC-V ISA privledge specification version 1.09.1 has been deprecated. +QEMU supports both the newer version 1.10.0 and the ratified version 1.11.0, these +should be used instead of the 1.09.1 version. + @section System emulator CPUS @subsection RISC-V ISA CPUs (since 4.1) From patchwork Tue Jun 18 01:31:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="WNctb61J"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SW5h5msPz9s3l for ; Tue, 18 Jun 2019 11:41:44 +1000 (AEST) Received: from localhost ([::1]:52988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd382-0005Kn-Se for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:41:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41013) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd30H-0006sy-Da for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd30G-0000BX-CS for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:41 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:24430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd30G-0000A1-1s; Mon, 17 Jun 2019 21:33:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821621; x=1592357621; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1DnzSt3sQDws/SE2q/bnTC49Un43YEdEs+g3y0l0KYg=; b=WNctb61J+9jHlFBAgYh955a4Ph0+0hfnoBpOThMXwwnnFb4ukPB3vLsY yjR3EokVYZk5fclcc4cpTQj8WvKj0Ez2jxd57Vvt/Cnr6wna8fRyC0jzb 15tVyxIGZg25wO3L/pl6mfWFQuEtJ9I44wwCiZMkhMFR51AcnNnkRABLv U82kQtZ+QR0G6WD/L2vIrTsznmYFQZBDFwkHYPPs+O7ni1NeBqohnyYYx n96EIO9sE1dhRBxaAq/G+03avlcel2EGncONmGXflhLjYOBUJAhya1OZt dAlZHdb54cxTYF5+yPvGm7lld7hcMsRVzOz3TvLtvlrhv/JbqWPHnv7+Q g==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="112055101" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:38 +0800 IronPort-SDR: YBoaTcgeHuQmWtwjEceuKgQyr62f5QVv4gAALma4fWRDHiFiGuoesIcrltWCdHHWSmA54lt7Lw PP1PWZqnN5ErtDbspe0/Fur7dHKPVzbD2dTgQltA/HYtbvUdVI5F5p3CJV20HLRs+PjeMzOrmY 0KI1mx0b39/eTnvPE3FXSt5cNMtxtMrW0xgY0JtyuNDAX02Tzqho3hm5i9KFEs/VC7o0vD4Xa4 uI6DiMe/o2/I76+3Z/7EyAfXR2wC//jW2ORzvNsB3NeU+E6kBnbmTewwVUzyAf6YeMfFI17GaK m2VjdZo3XV7EfPzRMqqNw/ow Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 17 Jun 2019 18:33:07 -0700 IronPort-SDR: RS7siusuP5TGzbvWZZ2x2Mnk/ZZGiH2qzf91ExeyColmx7cSvCM/UFjSCxzQNojCLyEaC+nnCX idkYNfgS85CERjr4Ejc6POxMOo/flTPyg3HeXNLd8Hh+tqy0MT4Xb+x9CzDaGfHZ91dNu+sWDG u6Qq1twsya0N4qHTjNcskpM1Zgk1Q2PZajbeilxeU0/0sgAbH5BwXXZDsOOhB5nZU+zY7ytnBo Jw9UbVYgYjdqRC0hmZC2yM4ZFRwhrPKcupTOU64V/FmEvj0VfklKdWLgwmEn6OukMO0iDdNDrw hUQ= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Jun 2019 18:33:37 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:16 -0700 Message-Id: X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [PATCH v1 6/9] target/riscv: Require either I or E base extension 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a23d83921a..21bfaa9722 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -373,6 +373,12 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) return; } + if (!cpu->cfg.ext_i && !cpu->cfg.ext_e) { + error_setg(errp, + "Either I or E extension must be set"); + return; + } + if (cpu->cfg.ext_g && !(cpu->cfg.ext_i & cpu->cfg.ext_m & cpu->cfg.ext_a & cpu->cfg.ext_f & cpu->cfg.ext_d)) { From patchwork Tue Jun 18 01:31:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="MuT29wwK"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SW7p0nblz9s3l for ; Tue, 18 Jun 2019 11:43:34 +1000 (AEST) Received: from localhost ([::1]:53004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd39o-0007MB-6v for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:43:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41024) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd30I-0006vf-JL for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd30H-0000CR-6s for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:42 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:24430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd30G-0000A1-Rj; Mon, 17 Jun 2019 21:33:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821621; x=1592357621; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PhCUtrqF7yEAsHBc4uhl3pPi0G+raSB/DW34xH+qBXU=; b=MuT29wwKEB0DJ2WSba9/q82ueFBrzuCbsEWlN73X0FiHq12/0Tt+mehG 3JnDC5Kta7f4AGa62mqgp6Se1W1BwP6ROSTdRU4RzlEH4s6QAiS8/6bW+ CY132+rzQ304LOtDT6TxUmUzVjj9d+yNSs01JEXn3LDrWYzDTPuNjaOcf HKGevQA+nxlwQFKURI68LtqO7TPrlggEz00IDxbxe82jRqiWJMgcxeICr n4E6Dooo6Dtu4zDWHzlDoJZxioTTXmO4YVgugwlZl95vdvm/pJVJJtFs1 FJyIhN6QUO5nzhaBO7SbAjR9Wmc+6mZ4vbu2T4Y+kccJK9fDkKO24+cSh w==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="112055104" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:41 +0800 IronPort-SDR: N3ufcin+DTbSh1gHE2mMW7bXW0Ec0nS9zLBWz+57eh40y0HX6n3QWac8fcWiqdo1eVStqBEP+P I0yE8QgRNduGNP7xkzzyORfhbmX1LwB4m0dLCDKdggCZ6+b9rTm3etVl0MnVEX3XYepvRMHsQe q3oGA6b7QpvNA7qWT/CpuFTP9QBVIQf9+5veS1qzBDblZ+wkyrPFg0fSfqy6+M7giCyA4DghnL 37sytLWbKL3qQeDPcoHik75h8TwpDjekbv7+WpnwpN6TfZVvydN9BkVx9zTvtf/iszAQkvNHkc cELOZyKHuhXQw8kytCHHOrtb Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 17 Jun 2019 18:33:10 -0700 IronPort-SDR: pw5EqYkyx4rgnErmzenbDgD0AWqTrOYnrhyoZIBsPUSuW/X7Ar7gwOBPZm8IYE8+GNMTv6LZVq 81MNybvCnNxkhz9FoQabOTJGmT8A0DBhIfoAvwDiyhPVgFsG5270ZwgAxq1fCLAlBZA4jL10Nv OdWQ7xk0WDLXAkgq8SQowq97+oCaRqyO/dDKZ3lUNlS1oCdH/mDDbIdSE7RfnJNfyn3z7rke09 gwn/o2uD+SxzLkYKARLBdgLeGFS3HsN64JS0rfdQ+z9z2Lb/dL1Lph+PsY+/O6vy76iTPkhx7z 2bY= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Jun 2019 18:33:40 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:19 -0700 Message-Id: <8d6536823ee1969cd5effbf58b2041ce44f08eec.1560821342.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [PATCH v1 7/9] target/riscv: Remove user version information 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove the user version information. This was never used and never publically exposed in a release of QEMU, so let's just remove it. In future to manage versions we can extend the extension properties to specify version. Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 32 +++++++++----------------------- target/riscv/cpu.h | 2 -- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 21bfaa9722..ddbe922958 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -89,9 +89,8 @@ static void set_misa(CPURISCVState *env, target_ulong misa) env->misa_mask = env->misa = misa; } -static void set_versions(CPURISCVState *env, int user_ver, int priv_ver) +static void set_priv_version(CPURISCVState *env, int priv_ver) { - env->user_ver = user_ver; env->priv_ver = priv_ver; } @@ -111,7 +110,7 @@ static void riscv_any_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RVXLEN | RVI | RVM | RVA | RVF | RVD | RVC | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_11_0); + set_priv_version(env, PRIV_VERSION_1_11_0); set_resetvec(env, DEFAULT_RSTVEC); } @@ -128,7 +127,7 @@ static void rv32gcsu_priv1_09_1_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RV32 | RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_09_1); + set_priv_version(env, PRIV_VERSION_1_09_1); set_resetvec(env, DEFAULT_RSTVEC); set_feature(env, RISCV_FEATURE_MMU); set_feature(env, RISCV_FEATURE_PMP); @@ -138,7 +137,7 @@ static void rv32gcsu_priv1_10_0_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RV32 | RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_10_0); + set_priv_version(env, PRIV_VERSION_1_10_0); set_resetvec(env, DEFAULT_RSTVEC); set_feature(env, RISCV_FEATURE_MMU); set_feature(env, RISCV_FEATURE_PMP); @@ -148,7 +147,7 @@ static void rv32imacu_nommu_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RV32 | RVI | RVM | RVA | RVC | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_10_0); + set_priv_version(env, PRIV_VERSION_1_10_0); set_resetvec(env, DEFAULT_RSTVEC); set_feature(env, RISCV_FEATURE_PMP); } @@ -166,7 +165,7 @@ static void rv64gcsu_priv1_09_1_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RV64 | RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_09_1); + set_priv_version(env, PRIV_VERSION_1_09_1); set_resetvec(env, DEFAULT_RSTVEC); set_feature(env, RISCV_FEATURE_MMU); set_feature(env, RISCV_FEATURE_PMP); @@ -176,7 +175,7 @@ static void rv64gcsu_priv1_10_0_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RV64 | RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_10_0); + set_priv_version(env, PRIV_VERSION_1_10_0); set_resetvec(env, DEFAULT_RSTVEC); set_feature(env, RISCV_FEATURE_MMU); set_feature(env, RISCV_FEATURE_PMP); @@ -186,7 +185,7 @@ static void rv64imacu_nommu_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; set_misa(env, RV64 | RVI | RVM | RVA | RVC | RVU); - set_versions(env, USER_VERSION_2_02_0, PRIV_VERSION_1_10_0); + set_priv_version(env, PRIV_VERSION_1_10_0); set_resetvec(env, DEFAULT_RSTVEC); set_feature(env, RISCV_FEATURE_PMP); } @@ -317,7 +316,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) CPURISCVState *env = &cpu->env; RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(dev); int priv_version = PRIV_VERSION_1_11_0; - int user_version = USER_VERSION_2_02_0; target_ulong target_misa = 0; Error *local_err = NULL; @@ -342,18 +340,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) } } - if (cpu->cfg.user_spec) { - if (!g_strcmp0(cpu->cfg.user_spec, "v2.02.0")) { - user_version = USER_VERSION_2_02_0; - } else { - error_setg(errp, - "Unsupported user spec version '%s'", - cpu->cfg.user_spec); - return; - } - } - - set_versions(env, user_version, priv_version); + set_priv_version(env, priv_version); set_resetvec(env, DEFAULT_RSTVEC); if (cpu->cfg.mmu) { @@ -454,7 +441,6 @@ static Property riscv_cpu_properties[] = { DEFINE_PROP_BOOL("s", RISCVCPU, cfg.ext_s, true), DEFINE_PROP_BOOL("u", RISCVCPU, cfg.ext_u, true), DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec), - DEFINE_PROP_STRING("user_spec", RISCVCPU, cfg.user_spec), DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), DEFINE_PROP_END_OF_LIST(), diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 4e58c3b856..a558c353f0 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -78,7 +78,6 @@ enum { RISCV_FEATURE_MISA }; -#define USER_VERSION_2_02_0 0x00020200 #define PRIV_VERSION_1_09_1 0x00010901 #define PRIV_VERSION_1_10_0 0x00011000 #define PRIV_VERSION_1_11_0 0x00011100 @@ -104,7 +103,6 @@ struct CPURISCVState { target_ulong badaddr; - target_ulong user_ver; target_ulong priv_ver; target_ulong misa; target_ulong misa_mask; From patchwork Tue Jun 18 01:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="ECp8H+q9"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SW5m0gzVz9s3l for ; Tue, 18 Jun 2019 11:41:48 +1000 (AEST) Received: from localhost ([::1]:52992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd386-0005SN-6G for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:41:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41054) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd30U-0006yL-Bu for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd30K-0000He-5u for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:48 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:24430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd30J-0000A1-HE; Mon, 17 Jun 2019 21:33:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821624; x=1592357624; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ve7Ap2V5Mkzuo0d+Wcq3sQxhlCvQxeKzZZrn5vyIJDU=; b=ECp8H+q9NOjnPlJvWupXQmAadkLWhNBcEJ2h6cv3bATQBGLld+CPkxLh eoIwk/vmq7JOwkTFggWLDCdkcYQAxVOQc8MfvzIXs2+5T47PVRG43mujy R9RhcXrH58ha+OAcfdVwqWmVFsdMuaE5TAnOFLEXlDp51/c0LCe5T3YmZ Ak/o1SHBawA00xJ+TLQZ1j5kJs3ZV05nugmdKPyEDrKK7bBMF82/uSonc hO/qlqw5VOvuD3JP/LUmh1zdPJliPGtmZC0aOsYlJMzXAyMy9eH/E60kk tzzpQdKCGxyq2a15+J+ycQrXZnSTJcIOjhQ0D2HA8HQ416gMYXJdBct2s w==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="112055106" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:43 +0800 IronPort-SDR: ZhQj4XHgkWXVSjUqRGOx0ABHujaYrrIWVqhsZdSar8fQMqxA792Hwrd9eJE/GScz6tb461x5rA VvQpkM0/0Wg0lLFXi+UQsfr/7Y2RFJOx8zvzFYqqtwXrt4Iiycl23neI5yafRduoepsoyywgTI 0c3AQmWDgWWpJokNzfzTspy2IJWmVkdbHJcVm3UPeZXgQ2SToKAz51bLzEY4wRcbC86MVKYZH5 xXGele0dZCtm4kPQ/fG1i6Aw9Cx2Agr+4lNOGTLe+yotAMCEfV5npNcmeAvzdecpB7bHyZxqMh 7+bLqEiKt9EDfx4fRH24qGDD Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 17 Jun 2019 18:33:13 -0700 IronPort-SDR: h2r49Tu76lOiElmHZIxKCo4Ci+Vm4kHWtUvtBTOi+ET5XNLkwZySy8+uOF+QQO51i5p/hBltGU 3e5ER8uFdAHtlsRWqBX4cimCldQZJ3iv3/6opkROw3mK6XbpeMoODmAz3JQHKUCFeMSqN0PoK4 p5HovBl88flZMEZKVqehgxBPK/RDRXFlxHUnQiC1SsYuFu8SoMs3gs8nVNWbSJ14ZOVokDgQ0x 91oWU9NlA8h22Hfnm9AoimYFJdCDVRXMAlmQIhtnFaIFiXU9ZLTxLCPuMx6pCwVvWgnXnHy2Uk bxg= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jun 2019 18:33:43 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:22 -0700 Message-Id: <4ae1c7156ed0e8b0d2441c9e5954dfe623792d13.1560821342.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [PATCH v1 8/9] target/riscv: Add support for disabling/enabling Counters 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add support for disabling/enabling the "Counters" extension. Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 1 + target/riscv/csr.c | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index ddbe922958..5af1c9b38c 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -440,6 +440,7 @@ static Property riscv_cpu_properties[] = { DEFINE_PROP_BOOL("c", RISCVCPU, cfg.ext_c, true), DEFINE_PROP_BOOL("s", RISCVCPU, cfg.ext_s, true), DEFINE_PROP_BOOL("u", RISCVCPU, cfg.ext_u, true), + DEFINE_PROP_BOOL("Counters", RISCVCPU, cfg.ext_counters, true), DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec), DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index a558c353f0..786f620564 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -221,6 +221,7 @@ typedef struct RISCVCPU { bool ext_c; bool ext_s; bool ext_u; + bool ext_counters; char *priv_spec; char *user_spec; diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 437387fd28..a9aa8ab1b5 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -56,8 +56,15 @@ static int fs(CPURISCVState *env, int csrno) static int ctr(CPURISCVState *env, int csrno) { #if !defined(CONFIG_USER_ONLY) + CPUState *cs = env_cpu(env); + RISCVCPU *cpu = RISCV_CPU(cs); uint32_t ctr_en = ~0u; + if (!cpu->cfg.ext_counters) { + /* The Counters extensions is not enabled */ + return -1; + } + if (env->priv < PRV_M) { ctr_en &= env->mcounteren; } From patchwork Tue Jun 18 01:31:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1117596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="pd1UHrMv"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45SW4B1Vfmz9sBp for ; Tue, 18 Jun 2019 11:40:26 +1000 (AEST) Received: from localhost ([::1]:52970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd36k-00037T-D1 for incoming@patchwork.ozlabs.org; Mon, 17 Jun 2019 21:40:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41073) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hd30Z-0006zC-Pt for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:34:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hd30W-0000Ri-2A for qemu-devel@nongnu.org; Mon, 17 Jun 2019 21:33:58 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:24430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hd30P-0000A1-B2; Mon, 17 Jun 2019 21:33:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1560821630; x=1592357630; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uH8d/1+DYmxt/Xfe8gKKkT1GvkSK1xuKXxkSixU4Pc0=; b=pd1UHrMvpKCOIzmVrfA9KMzYBSNEkVMHt0xraEKC50MMN0RzFEYRNiJQ G13fhd/AduBmBeugmEs7oiKU/GejMbukju/hc6TT38HTI4bau7z5gip9s klNvq2MCPlyfr/F0L9Z/Z3L6s6BWWpwTonW3OdjZfFQQ+H2WRAoeRhYQx erUYKMlCjSdvTInHuVDIiyXJ8U4z2HuS5gY1Xs6S0wB2SZV5zkdP9N3Ld pA7v+7NAj2GhjJF91sdZXLB818pvE1i3jZLyG9rWWHgT7/DMRFqHjCmNd pAHdNFF32OtDYeRYniIMWj2whqXk+Y4wKMSVniLp4qyLtyVpUUE+o0Bje g==; X-IronPort-AV: E=Sophos;i="5.63,386,1557158400"; d="scan'208";a="112055111" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2019 09:33:46 +0800 IronPort-SDR: mH6/vsWpBn+SZNGPzspR0dN5sgjpMWvW2sDL7iT5jD3h4qtw0+mglclnlka63oncxYDcDO0AAz xb0K+c+4/wZOMEZIGSx80fgYQLUiAdgi+oW0OxTPgggiA4AVbIjL+vpnLyOxphg4waXL4WGQMT HAIDfKherUyiVKFq6h8t8OHT/5DfahFHUyf7uNtjDc7K7KS6nqnMJyCFk5vAJDw6IFWyzpmB9D eKz1pXoXBv4iyCnL9sFWN8Hypta6ZduGQRUXtXB19eE8H/Ze6o1sLm6ukmIfHKryhqsdfiBEne Azxwde8w9zZgsap6sSkcNrf4 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 17 Jun 2019 18:33:15 -0700 IronPort-SDR: lNFw6ircjrCK71GcwOT2l+NmTHmvbYfifZJ4pmli0yXcGnYb9INWjrbEYNG5hWu32wMpi+Xx1J UaNWvvWQiRWcgczt3t3yT5idls7zSuG4gy9reLHxkZ1YNtEBK/s4w2+lhI9XKGbwuEiwlLywlJ 33pC2dZG6LV+1r4oLb2/NICe4kVJc0+KPzg45wPUsfHZk2PIqbigx2hT2o9C28PaDznY4wib8M lUKv/EolHNC0k6QGIl3r1H/pyOAdYUnSOmo3YJZOOpUZzcVPFw8G4TKGWOYpt/RYSJy7TMZtvl 37k= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jun 2019 18:33:46 -0700 From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Mon, 17 Jun 2019 18:31:25 -0700 Message-Id: X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [PATCH v1 9/9] target/riscv: Add Zifencei and Zicsr as command line options 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: alistair23@gmail.com, palmer@sifive.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" For completeness let's add Zifencei and Zicsr as command line options, even though they can't be disabled at the moment. Signed-off-by: Alistair Francis Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 9 +++++++++ target/riscv/cpu.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 5af1c9b38c..53cf8607f7 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -409,6 +409,13 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) set_misa(env, RVXLEN | target_misa); } + if (!cpu->cfg.ext_ifencei) { + warn_report("QEMU does not support disabling Zifencei"); + } + if (!cpu->cfg.ext_icsr) { + warn_report("QEMU does not support disabling Zicsr"); + } + riscv_cpu_register_gdb_regs_for_features(cs); qemu_init_vcpu(cs); @@ -441,6 +448,8 @@ static Property riscv_cpu_properties[] = { DEFINE_PROP_BOOL("s", RISCVCPU, cfg.ext_s, true), DEFINE_PROP_BOOL("u", RISCVCPU, cfg.ext_u, true), DEFINE_PROP_BOOL("Counters", RISCVCPU, cfg.ext_counters, true), + DEFINE_PROP_BOOL("Zifencei", RISCVCPU, cfg.ext_ifencei, true), + DEFINE_PROP_BOOL("Zicsr", RISCVCPU, cfg.ext_icsr, true), DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec), DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 786f620564..b4c212dfcf 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -222,6 +222,8 @@ typedef struct RISCVCPU { bool ext_s; bool ext_u; bool ext_counters; + bool ext_ifencei; + bool ext_icsr; char *priv_spec; char *user_spec;