From patchwork Fri Sep 23 04:06:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986098 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 02FF6C6FA8E for ; Fri, 23 Sep 2022 04:11:11 +0000 (UTC) Received: from localhost ([::1]:40858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba1u-0004Sy-R0 for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:11:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyE-0001QU-0F for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:22 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyB-0005cr-IN for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:21 -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=1663906039; x=1695442039; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p6+YXUCXUGeZxwmJkeAS3Bk65F/JmDABn0hfm3dL3wI=; b=JM3oAOfsehweSVp9XKTuFqTSeJDq3WN/K+3o6yUt+9Otk+x1yd9RhrhE 8O2WIMK0Z9eC6b0YzjM1JNThPJ4zpzqoBMxbiS1jgSt0yUmm+HEYs6oOd 8/brBwxEjOUERc7Pmb6SKDsIRnzFxa73VWATwyggnB2vPSJ9Lhb3byZkV hMnBLlxAV3xopZQ1S+dxYj+hI6mNZxz/2XNARwdsiRiiaLzsg0XkWDBMr AhXz3cGu6hKcosHaqR9WR6xKioLPjb10x0dZDpCzaZzYPcXZTuMDTaMr/ NXTEBJVjCNcLJ1ckCvqXRQU5wOpAfeHhrSbbGzS8YGgNi49+39Jj1hyOp w==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510437" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:15 +0800 IronPort-SDR: /ZlEZ2SfCV6crCcs6Sql0spwdo8SXsEKvOseQFbf3LbuwV5eT/AkFVE+ge1CTBZzR+gd1oN44F nSiPh8b7kRRXajvFFGP0M2FXXI2Gg+6yxtJ4tISjkcAL6JLJmbABXPAIA40iowjsEx3iRaZbTW vN141Dp/cUVVaKMv94+dBrkyHmYdTN+7soUeWGr1wlLwERTf5RbvxhOUD+J3YQsW7eFMXwwEIX E17nKCQCXM3J5n7Ubk7rXXfVxwmlgq6N2NzAl96b7gJTOIXNo5q2VVKf++El8F3uuASj9rNoNx UGjWGc+HZxzfTykWYkzFO6Se Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:18 -0700 IronPort-SDR: tkjojc3xANSf5PcIdfo/6cwdazQdw3cryGHzNoaku/rRLGuqsPIcRN6eAYbuBe4lJ9PKhbpzEb cXa2IjFsnSt3u6HkSbPQ256ABfwcM668cYz4qu8BrX3BWvwX4Un23T+vtWaPDLhLBpeUUQRCEr pnG+/toZdBDddjev2VKi1jIJlIkrwBgUtMvdorhUyeYzRdftjziikhi3bJRQXczbDaQZ/9r2wS c0vyVqMhWdUQz4hI/G4lj24x64trShnKvwMXTLupclHJHpLYW5rG8CjqM0Vi9tN0K6onXUtyaL 5gg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:15 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdrz30vwz1Rwrq for ; Thu, 22 Sep 2022 21:07:15 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906034; x=1666498035; bh=p6+YXUCXUGeZxwmJke AS3Bk65F/JmDABn0hfm3dL3wI=; b=QdYxnzG2dqZah3KeyFi8XqydKwY2O7i3zu bke2CVHHgN9R1vXPJEh9eg17vwvHT2ZuMx72LDHGmRvynuYB9tXha1tZPnBaqeBx SkQF/yzl86GNd57qQOC6VR3Z+hOE+U4frZu10TOjoOuXtwK+RW+/WT38qZBzclB6 S1WQygpf/NgItY8cOO8gcYLYnzfVqBINQyoakXPe64AlqcFRwrtEOIsOlPwyUhEd sQha5RkVFjTygMIJOaXH8Ks01S4yZavrAILxk8cwjiiSUt5LLejpVxf6dLg2VLnB bHqR6SVMi+ObmxMBEW923XfdGA9F28rFetk1EtrOYKoaScEbiBmw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wDFeFADPsOxV for ; Thu, 22 Sep 2022 21:07:14 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdrw2Dzqz1RvTr; Thu, 22 Sep 2022 21:07:11 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Wilfred Mallawa , Alistair Francis , Andrew Jones Subject: [PULL 01/12] hw/ssi: ibex_spi: fixup typos in ibex_spi_host Date: Fri, 23 Sep 2022 14:06:53 +1000 Message-Id: <20220923040704.428285-2-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Wilfred Mallawa This patch fixes up minor typos in ibex_spi_host Signed-off-by: Wilfred Mallawa Reviewed-by: Alistair Francis Reviewed-by: Andrew Jones Message-Id: <20220823061201.132342-2-wilfred.mallawa@opensource.wdc.com> Signed-off-by: Alistair Francis --- hw/ssi/ibex_spi_host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ssi/ibex_spi_host.c b/hw/ssi/ibex_spi_host.c index d14580b409..601041d719 100644 --- a/hw/ssi/ibex_spi_host.c +++ b/hw/ssi/ibex_spi_host.c @@ -172,7 +172,7 @@ static void ibex_spi_host_irq(IbexSPIHostState *s) & R_INTR_STATE_SPI_EVENT_MASK; int err_irq = 0, event_irq = 0; - /* Error IRQ enabled and Error IRQ Cleared*/ + /* Error IRQ enabled and Error IRQ Cleared */ if (error_en && !err_pending) { /* Event enabled, Interrupt Test Error */ if (s->regs[IBEX_SPI_HOST_INTR_TEST] & R_INTR_TEST_ERROR_MASK) { @@ -434,7 +434,7 @@ static void ibex_spi_host_write(void *opaque, hwaddr addr, case IBEX_SPI_HOST_TXDATA: /* * This is a hardware `feature` where - * the first word written TXDATA after init is omitted entirely + * the first word written to TXDATA after init is omitted entirely */ if (s->init_status) { s->init_status = false; @@ -487,7 +487,7 @@ static void ibex_spi_host_write(void *opaque, hwaddr addr, break; case IBEX_SPI_HOST_ERROR_STATUS: /* - * Indicates that any errors that have occurred. + * Indicates any errors that have occurred. * When an error occurs, the corresponding bit must be cleared * here before issuing any further commands */ From patchwork Fri Sep 23 04:06:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 51BACC6FA8B for ; Fri, 23 Sep 2022 04:13:53 +0000 (UTC) Received: from localhost ([::1]:49486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba4W-0002Az-Ba for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:13:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyK-0001ao-NL for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:30 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyE-0005cr-2s for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:28 -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=1663906042; x=1695442042; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GpWNsywmIiVnPWbPCFwnpmmYH4mspYVpr/PGb/mfhdE=; b=UjXGcbpFcXkaf6yAPVgx0Yi/MgsiYYHyxUN7OCic/8j9vRrE1tyUlyfp OMb2rdlsyABFsAdhnZAqsNEj9Gt7OOLIEyixoIidQNucgho+voogCd/pc cunr3dXgid8g6GBBk2eaDCULhlAd3lpk0lMSCsbdAFfZpMx+HlmFef3gg GleRoHIg55K3AY9jKpwJE8HpxMSd/xU3qUifJnjRHXDsmTu6XISoZurpB MXsA7Lmmnud6U81VN6zRx9I/3H29hhd9JnIfGBeHDITmLCqvmvAj+xg35 GikEGh444JhWVDl+vorImaX70bVeate3fEVuBzNzvRovX2fxUN+nIVFsZ Q==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510438" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:18 +0800 IronPort-SDR: zxbYZKLkL4M4Gyg/218hyqfS5k4k44KQMHT1PXXnjLPYiAdco6BIKH5QqbBFGIj1l++MGFAjN3 4DTGKjhW8WHkQG5bCtd1FpuH4KW4rR5xZWylSTuaMLg6rfD6jIdn/bqePj0iE7pPjk2Hpuhw8n j9xCK/s5c5BAWndFKL5oJkDUAJIivvT82BgESdSxF3pM7UvbEv1tWqdzo0tXMSzVFKqC9YSq9s joQt09Q1C6rpZr4qXMf6oHOKQD6jicOqK50Pdx8S/tarqoI/nt+ILLeV1IJFGLANocDbi5GH9J HkkL90jiSGneTTQYOFU5I3uf Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:20 -0700 IronPort-SDR: TH0PA2ZO/7nJDmy6hHiD213BWdlxUQaUZdPBYn7WhFkQNRmLQjPU2MpLWshlFxp2SHvaxcLIBL 8gimtzFSSnSI5nVCE47+DRZzPHoxj6hg8MhEUEBPi4W0l7mFoqA9/bcE5WoJOSdkWz6yGHy1NS MGXXWFveIxWRYiNk8/MBgbKqNGiFaq7IEwbkaPDgcKxCvf69NRIgBAZrtQUgSq4MaPZMRyQeP6 qn9dl1N54ernvPaAWABgygG8hKo9BU+Ze4mlTVRf2hAjv6L0cfNp0riZ0trpZ7O5Mm9p4wD0sE g0E= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:18 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYds201xJz1Rwrq for ; Thu, 22 Sep 2022 21:07:18 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906037; x=1666498038; bh=GpWNsywmIiVnPWbPCF wnpmmYH4mspYVpr/PGb/mfhdE=; b=gP45jlKC6d4bK628BG8UToidRSboMy5jBQ 2Mm4brDvnD7vFAVqsIIgngmmwKIoBAB56WZhMdX2c+OlTOmWqVvnIwH5TFhBfUCr KbO14o4Kd7i8QY4P6o6n1WS1N4gqcFGIuc3ZYpSIGv6ugpE7FW57yhIjo5iIRoRB YEyca/qBhYOZo6+1UzcBGxiNkea7UNkFPlFWQBzJq3cldzXGqy9DlbmypjoJ7pqZ ZQwySzcxEdfE6ooIjAXAN59WafGfNleJnCySVylbeBraTT2reWjpUn54yFPIpug0 9FtjePSlvPzhGf5QkWrXES4L1oeE8bU1hFyD4VUjqCoh8cL3kktQ== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DMJEwsmyTKVs for ; Thu, 22 Sep 2022 21:07:17 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdrz4QD7z1RvLy; Thu, 22 Sep 2022 21:07:15 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Wilfred Mallawa , Alistair Francis Subject: [PULL 02/12] hw/ssi: ibex_spi: update reg addr Date: Fri, 23 Sep 2022 14:06:54 +1000 Message-Id: <20220923040704.428285-3-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Wilfred Mallawa Updates the `EVENT_ENABLE` register to offset `0x34` as per OpenTitan spec [1]. [1] https://docs.opentitan.org/hw/ip/spi_host/doc/#Reg_event_enable Signed-off-by: Wilfred Mallawa Reviewed-by: Alistair Francis Message-Id: <20220823061201.132342-5-wilfred.mallawa@opensource.wdc.com> Signed-off-by: Alistair Francis --- hw/ssi/ibex_spi_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ssi/ibex_spi_host.c b/hw/ssi/ibex_spi_host.c index 601041d719..94d7da9cc2 100644 --- a/hw/ssi/ibex_spi_host.c +++ b/hw/ssi/ibex_spi_host.c @@ -93,7 +93,7 @@ REG32(ERROR_STATUS, 0x30) FIELD(ERROR_STATUS, CMDINVAL, 3, 1) FIELD(ERROR_STATUS, CSIDINVAL, 4, 1) FIELD(ERROR_STATUS, ACCESSINVAL, 5, 1) -REG32(EVENT_ENABLE, 0x30) +REG32(EVENT_ENABLE, 0x34) FIELD(EVENT_ENABLE, RXFULL, 0, 1) FIELD(EVENT_ENABLE, TXEMPTY, 1, 1) FIELD(EVENT_ENABLE, RXWM, 2, 1) From patchwork Fri Sep 23 04:06:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 83BC2C6FA8B for ; Fri, 23 Sep 2022 04:11:15 +0000 (UTC) Received: from localhost ([::1]:40860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba1y-0004hm-Ex for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:11:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyI-0001WJ-0A for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:26 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyF-0005d0-FQ for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:24 -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=1663906043; x=1695442043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2aepwLmYndjeQUqiDDwWxQKp8PVopzzltTO9zBxY2SQ=; b=HqXGPw8x1OL4nZ+uUEtlKbqDYlsmm1hY8Tv7GAn/OqmnOq4VQ6b9Kd5I ebs0hRZRyI8Lko6Wsigmi+gMPVVeWMNVriv2RiAuTKQH9ikjnsIzgDLlo exjFh7e7IJ+2Z8jJwJxFFnQHn5BT4d9uowbJmNIXpv1KC0w7o8FlB4Mi+ esjWHdDkuQR8f/cvFY900vh5wSzNE0x9KKzLoCBQV1qg7fWk6/1ntSU0M I2J+i7gnIahEUIQ2uKup4AKLjUP8MB2HGXMnCM9fH0mou0TXppO9okx2C BtnTlzwvZwFYWzsxBXUChDkhhC+DNaIYNQfQsxd8j/aPnC7xWL+J1NgAZ Q==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510440" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:20 +0800 IronPort-SDR: LLi0kLGyzxOsK7172rMvdQxGUojctFXhNWQ10bDwRjO/u7/ffiTgpj0etBNKVpP/m9CqlLzPFY YD2tMxUjoxhuL9LLkyLWjKgJ4Y0eLKF7GlucZCtShm5Dz3SwHUCuLG7H67FEhvZjL8uhp8WG+1 AKcngN183p5hIrjH/LG3DyUUlddzhdhtj/mZCsOWwYpw7qrNK0d4Cxakdfs77r5+H6R27Cos7R VDWQY+KZzXLoRIvxCrUmU7WX0FMz+xaLmc5zHrOXVQIFmo93qLCYkk03MLs/hrKwSS6gNWtnlV xNtdNEDHdJm3CVvfh5ENDMFl Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:22 -0700 IronPort-SDR: VFS8i0NxB4ZEZOZ2njqU1deeKl2vIBxZdMYeJ4f2pRLu5hwMNk1ZI1K2GsarF14KROShgN2zNj CegefiGI3MoDenrkvkIKYRXMF5U2NHdm5wx9ocYZ8V+NNT3K2hsL8077506NUvHH+o9dG1c1qZ CGqd38nI3NFBMMLnQ8i4SvOgQHwnobA1o2cyD/s8pdHHitNLS8KYklG57KGUXlwx7K7kIDfenw 11Ov3eIUC9TetUe0JXar+8yqQK50Z43AQlB2tX2/qJazNXhqmAYMZ1guIc/HLyBk4H31ZcOhyU qaI= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:20 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYds36Tvtz1RwqL for ; Thu, 22 Sep 2022 21:07:19 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :mime-version:references:in-reply-to:x-mailer:message-id:date :subject:to:from; s=dkim; t=1663906039; x=1666498040; bh=2aepwLm YndjeQUqiDDwWxQKp8PVopzzltTO9zBxY2SQ=; b=Kwb6qwXuNR+LKQ/Il/C05Jw d9t2FHhdyNTnzKAPmT9q2/em2+NUC9VD77IFDrR2FQaF5DNKfrF0DX1yFx9GixK9 hbkVQp/1hCPnO+46MvZJHfbnnHMJyT/XBujK4JKTCW4NUrLbRYyX4fmbf9QoFB5K taMVGpFQz7pc6XlH7iZ9yTXX/YpLkCrseF23ZaxOl5Ta9fX3Jgkhq9wqs9PEHPuL 8D6mPgGVoU4tlvRE3w6Fn6gWxHiwIq+Mri6VXiao8DUS/VhJcUyU1boCTF5JnKll cNr4uVCsQfZ/xa2ZzAgqQYxeEr75jOTiWiFmma5P2r4ES93i0KBwXPKpbXx3ZWg= = X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KXA5oaIOyvNa for ; Thu, 22 Sep 2022 21:07:19 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYds168qGz1RvTp; Thu, 22 Sep 2022 21:07:17 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , Alistair Francis Subject: [PULL 03/12] docs/system: clean up code escape for riscv virt platform Date: Fri, 23 Sep 2022 14:06:55 +1000 Message-Id: <20220923040704.428285-4-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée The example code is rendered slightly mangled due to missing code block. Properly escape the code block and add shell prompt and qemu to fit in with the other examples on the page. Signed-off-by: Alex Bennée Reviewed-by: Alistair Francis Message-Id: <20220905163939.1599368-1-alex.bennee@linaro.org> Signed-off-by: Alistair Francis --- docs/system/riscv/virt.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/system/riscv/virt.rst b/docs/system/riscv/virt.rst index f8ecec95f3..4b16e41d7f 100644 --- a/docs/system/riscv/virt.rst +++ b/docs/system/riscv/virt.rst @@ -168,14 +168,19 @@ Enabling TPM A TPM device can be connected to the virt board by following the steps below. -First launch the TPM emulator +First launch the TPM emulator: - swtpm socket --tpm2 -t -d --tpmstate dir=/tmp/tpm \ +.. code-block:: bash + + $ swtpm socket --tpm2 -t -d --tpmstate dir=/tmp/tpm \ --ctrl type=unixio,path=swtpm-sock -Then launch QEMU with: +Then launch QEMU with some additional arguments to link a TPM device to the backend: + +.. code-block:: bash - ... + $ qemu-system-riscv64 \ + ... other args .... \ -chardev socket,id=chrtpm,path=swtpm-sock \ -tpmdev emulator,id=tpm0,chardev=chrtpm \ -device tpm-tis-device,tpmdev=tpm0 From patchwork Fri Sep 23 04:06:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 59E48C6FA8B for ; Fri, 23 Sep 2022 04:13:57 +0000 (UTC) Received: from localhost ([::1]:49488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba4a-0002RM-Gh for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyI-0001WS-Br for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:26 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyF-0005XX-Gc for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:26 -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=1663906043; x=1695442043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+KWxvID8/ZnnAhqL8VNp6KtA1Zxp1j2XC5T17FxQj4c=; b=QhMWS4u0hnhnHMn57IhG354L8UtHH/tjyhxDNwOL7DClNmQgSUNsDQSZ TCdfvrewX1Tg2bhZfZiBay06puHrw/or6N7OKYbi7qBIBiJJnyyxGq5ig zDxnpU6hAEjH708rXCcIJrFF24vLrUW0uusNtd1ZKQtWus8URbX2H4HLJ 8rezaysHeMSJFR1xhu93oIFJD6e9kHZg5ZMLpCkR5zjTfbrZ5SxJJKWEK BmwjePmnnwVwHUu6OWxx5V6jFpKwhVM4Jo/Z50gyp/+ryj1CytAXcowTc yOY2kpXQVTctqfg7mvwXE4Rb9utu1pqVUJVOwQ6A1vZL4N8Up9lhrTrMf w==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510454" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:22 +0800 IronPort-SDR: pS0iaDT9o6THNBngfrr2C4ktGnnm1p0Uhhc7pCuzrQW9mwH8DTu3G9vdrOAbU/655guBNEoUnf FKK/4WVrSfpJRV+ajYdiGJlG0VfhKs+CjI/qiApNbSVwET/PTb7tbqq669q3cI0Ml/eYxacX5x zScmc7btg2++Ah3kP4pSrxe8o4D2X46TuwxvjQWx/pnEuZq2DCwHPoc2qbFo57W+viRwknno1M NRxohZ71PzP6ct75vZQfpXQnGQ8U8pMxRKaSaV7U+5gPlob/yzoabwpbZz2j39ni0TmbgMgAJ7 W5SUhovZsDNFkwsdaplS5Rlk Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:25 -0700 IronPort-SDR: 1gTktriovkCMjb5cn4dUMWmQ1Eyq3bUH10PqC7gJ1JsRLwrtIKzzP1mX/z2C7fjiGwVDSw7Cmm AFzHFrEu9Xx4qNjiKWmAHjZwPiAtSEAZmOolOIZx1R7pso/w2DCoA8Q+to5sEgCl5JIvbEvk5D mir+oFa9HFSTITlxuw4rKI+0UimHr+RxXvFMg3lNuuU+U3pTQiZPLvNIKpT1KSu7zO+LcjGIKN PsoGgD9NsA2w76L0BKVmikbW+jIXJj4MZDQnN+P6SMvnPBd4sSHMiV0IyoLIm7SpuLnTi293ON p6s= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:22 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYds61jwpz1Rwrq for ; Thu, 22 Sep 2022 21:07:22 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906041; x=1666498042; bh=+KWxvID8/ZnnAhqL8V Np6KtA1Zxp1j2XC5T17FxQj4c=; b=UGx2SVdf+PILSNIk+Lb12PetBFSpwqUjIK 23Ur3ODryfIeHJqXCE5i14u1TlxvQYBKipWCocViTWUsDxxdSr11fKBCimfMHsI9 uEjcTQFd5sTs0fC4ZixJ7Ic302OrS2QNNoPsdxNjHkhZtoDeZxAfppZzfJSu10oG ENeJD6Rx8lm2g4dL+psgtl+eSj8JCAPo3f/iR1jZsbyTVmEbqYiviowVSbXdSGYo yVRRQD8HafgAiDsAqQ88b367cKdXa2CjF92S/+fcUmwq2aP++3a6pzew21a4h4ki PJtEh3EETQJH6WMEqiK6szvJsBXoutFlH0ryw9lWw23f+CDAx2sg== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AuOEe3bffjn3 for ; Thu, 22 Sep 2022 21:07:21 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYds40Jkvz1RvTp; Thu, 22 Sep 2022 21:07:19 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Rahul Pathak , Andrew Jones , Alistair Francis Subject: [PULL 04/12] target/riscv: Remove sideleg and sedeleg Date: Fri, 23 Sep 2022 14:06:56 +1000 Message-Id: <20220923040704.428285-5-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Rahul Pathak sideleg and sedeleg csrs are not part of riscv isa spec anymore, these csrs were part of N extension which is removed from the riscv isa specification. These commits removed all traces of these csrs from riscv spec (https://github.com/riscv/riscv-isa-manual) - commit f8d27f805b65 ("Remove or downgrade more references to N extension (#674)") commit b6cade07034d ("Remove N extension chapter for now") Signed-off-by: Rahul Pathak Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis Message-Id: <20220824145255.400040-1-rpathak@ventanamicro.com> Signed-off-by: Alistair Francis --- target/riscv/cpu_bits.h | 2 -- disas/riscv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 7be12cac2e..b762807e4e 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -190,8 +190,6 @@ /* Supervisor Trap Setup */ #define CSR_SSTATUS 0x100 -#define CSR_SEDELEG 0x102 -#define CSR_SIDELEG 0x103 #define CSR_SIE 0x104 #define CSR_STVEC 0x105 #define CSR_SCOUNTEREN 0x106 diff --git a/disas/riscv.c b/disas/riscv.c index 489c2ae5e8..f107d94c4c 100644 --- a/disas/riscv.c +++ b/disas/riscv.c @@ -1304,8 +1304,6 @@ static const char *csr_name(int csrno) case 0x0043: return "utval"; case 0x0044: return "uip"; case 0x0100: return "sstatus"; - case 0x0102: return "sedeleg"; - case 0x0103: return "sideleg"; case 0x0104: return "sie"; case 0x0105: return "stvec"; case 0x0106: return "scounteren"; From patchwork Fri Sep 23 04:06:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B580DC6FA8B for ; Fri, 23 Sep 2022 04:16:44 +0000 (UTC) Received: from localhost ([::1]:42620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba7H-0007nj-Q6 for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:16:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyJ-0001ZV-VA for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:27 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyI-0005d0-Ag for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:27 -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=1663906046; x=1695442046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DHQzmPIeQnXV7uw2Rg+3jXi+Skw1XkHJaFatBF3mOvA=; b=bMRdr+oFFgiUCT9y7H+uArDvaFNDkYNszYVHlX5Wib+aglfAWGl01hOL +uGctp0zYHKCMMvj3BTfUVXiNxFnemzPcAchcdmdbbJjbqGsPg/PGAK9v nYwEOCpdqH8ySCrfQbtkH2lGArtpalnJ01/VsKPWztSQkbdSATmnqb0xG 5iqk1VdWjIW9adP+v36uFVJ6cF2rvkL8rRhQFG6kAmbD1SxKzb8JQJS98 3a/gAS82JYmmMpMy3oiykx6UCktDNQmWM3dz38Cuoor27C96LQg3OJET1 3RXol2/ozHkVSyHGvBgi7hsgxAT46Hju6Rc0fpQTwGbg6gA/puCNPncCD A==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510462" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:24 +0800 IronPort-SDR: JH2//NmUS2YEwKqvTOe7zFzjOfWpxBVrnsKvJNj2qnR9uGwCxttVDdQ+us5bVCNZBu4XV1YyyW Vn8uQ7t5SpjLAmnq0h6q5Vou1WyJojTGB2ik2LZfH6o6qAfY4Uk5mHCtH1F2WcvDSE2RlkmfoK Rp94tY5z/2L1OFd6s87Lpt3tUyPnlQq2mPAtqkw3hLei9TLAofrfyeQZAwDyju2B3rIvhVgR0a vmKcKrTJzVfx0Vfs6vqo4pdNYx01//j+jY83Gf1XHmIlT3g/CcOMVoValg17KMSYp/TSeAwYt4 tc0q7vs1wiV8sV6bN0YWNUdA Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:27 -0700 IronPort-SDR: 3JxdYAkzdnojaSjWCjYyXWIeMYU5XZjPerMM/9pZRGn0ufUc+3gutxH6rzLmP+3eQ+riroE9hN MsfwuxsCguEQcsp5tR4iNqEt3+AXmxUYX0Dw9u41fn+nYI4uQbK5GwdoOHV94gS0gWr9sQmXz2 g2ZGYYEL8f+EHQaYmXdr77oTkiOWLNhUptdDVayJedUhwtZR1drNRTaiB4/OlYAVQKfu162lZs dwwGN4nRRW0XitdjbZZZH38KL5bCwpsuShswS8/SaO4e6/PFRZVnHAhUuo7qbdA12emhi0h8ta 7LM= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:24 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYds82Bdjz1RwqL for ; Thu, 22 Sep 2022 21:07:24 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906043; x=1666498044; bh=DHQzmPIeQnXV7uw2Rg +3jXi+Skw1XkHJaFatBF3mOvA=; b=cvrpB6XJ7ECatoYHxhgGkaIca5Ib6515tQ ytS9Os963F1jebJIIpn+pqHknyxZGoccXwRH1PU6hoqXfWoWt9BEKtgJRO8vlKNA sIwxJQ0zOlj9Ao6L7pXJ9eJuPkUEHr9zB0cpZC4t4DB3lYipVXO8z47rQELPsCxD MFvELzj20LF9bkug4MmOY9qoLJ4UFHEcDQH2GI2i26idLEckXxgsmLLM4uYAFrMi 8RwnrTjQr/7HyAxOJZkKYbBlSNpSlUSw/zPcNLtZflWYzDmPmlDf/UVMAQMNuJdy oIYfludotH1IQCAlV9yawbigYXT20s73+za3N8PJk4PPcHXrbUhA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id z3iUVmJZnTz9 for ; Thu, 22 Sep 2022 21:07:23 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYds616W6z1RvTr; Thu, 22 Sep 2022 21:07:21 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Weiwei Li , Junqiang Wang , Alistair Francis Subject: [PULL 05/12] target/riscv: fix csr check for cycle{h}, instret{h}, time{h}, hpmcounter3-31{h} Date: Fri, 23 Sep 2022 14:06:57 +1000 Message-Id: <20220923040704.428285-6-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Weiwei Li - modify check for mcounteren to work in all less-privilege mode - modify check for scounteren to work only when S mode is enabled - distinguish the exception type raised by check for scounteren between U and VU mode Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Reviewed-by: Alistair Francis Message-Id: <20220817083756.12471-1-liweiwei@iscas.ac.cn> Signed-off-by: Alistair Francis --- target/riscv/csr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index b96db1b62b..092b425196 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -98,17 +98,22 @@ static RISCVException ctr(CPURISCVState *env, int csrno) skip_ext_pmu_check: - if (((env->priv == PRV_S) && (!get_field(env->mcounteren, ctr_mask))) || - ((env->priv == PRV_U) && (!get_field(env->scounteren, ctr_mask)))) { + if (env->priv < PRV_M && !get_field(env->mcounteren, ctr_mask)) { return RISCV_EXCP_ILLEGAL_INST; } if (riscv_cpu_virt_enabled(env)) { - if (!get_field(env->hcounteren, ctr_mask) && - get_field(env->mcounteren, ctr_mask)) { + if (!get_field(env->hcounteren, ctr_mask) || + (env->priv == PRV_U && !get_field(env->scounteren, ctr_mask))) { return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; } } + + if (riscv_has_ext(env, RVS) && env->priv == PRV_U && + !get_field(env->scounteren, ctr_mask)) { + return RISCV_EXCP_ILLEGAL_INST; + } + #endif return RISCV_EXCP_NONE; } From patchwork Fri Sep 23 04:06:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 72016ECAAD8 for ; Fri, 23 Sep 2022 04:16:34 +0000 (UTC) Received: from localhost ([::1]:46098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba75-0007aJ-PF for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyN-0001ek-56 for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:31 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyL-0005cr-92 for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07: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=1663906049; x=1695442049; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LTxemXnZbcn8GfTEOjD2bvRM5CcWr0Uc+73Is0/SJyo=; b=n6A2gubvsouLqbDpYixhIJrCZp/7MZqJIxeLqLa0aQuMyPoZ/Nj8fVOS dWlZpnsWur7mYZiovZjGVMbdotV2ex6uNXwH2sxdBtE1PTcr02Rb2aSrn FcHw1KvA+OuucJDIyRxOeOtRHTdTzpLJuJy2S+1DOBsgOhTj482cukqsC QkyVNExY6Gs21F1xSzSG0CwVJJL/d75SU90cpnFno6ne5hhJ4mS5Is2Q5 9CFNTaWNgp18JvsOcxp2vkFi4vEm20Lxz6X6Q+glrwcO5Ks63eVrbeeUl WE2qANPh+16bTOPrgRxccq5nliosZ7myobF5OHFXJZisj2q/vI5FW/DjM A==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510468" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:28 +0800 IronPort-SDR: P4KY7srVABo/E2k9a8+O36WviIE7kSChk23JXdwbu+QhQ4bRfUwCbNLXd2AuswE5frP7WZBiPZ EMkbPedmjP+0ProTa5N/cQRTzCGSEaRQvar/Ow0JJGYkZ9V+uyoVM5hLj/KcMXmiCwqSOOdO58 JTJrZV2yOORo9hliPZlFRTJ0aPJ5FeR1YwUd4uihb/KIiC4+ZaPos5/Sibg5yud/Zt3xURPr3X rpG0Qdj4bu7EyzQI5kuKB3KIjeK3oAlWwE8Gi0JcAGk54mqwf1d7jevgsbXTxnBBo2qnyqOATw 0ls3EPEIHw5qjolxCk1vDt/n Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:30 -0700 IronPort-SDR: B84CXyIYKVPBjBR3B7YkMyWC1JQFMpIQEAFCPnks/Wnqu9Nvzqe6BlvTFwCwJKIw0Yt2X4gqw9 4TlHZeE9BCuysKHa9g3LLqaDu2+ug007TzZVvNFdfQ/C3apRqXhiWOxQDF/wIgDahIuM9FYi0O J8v3jAVYedUIVH16LtcZqHJbo2MO7ItA4P2y2BftaNtRynAMmbsFEPCMpVBcvg4mlhzYEJkZXN MKLpHQykoRrd8PRUNQtMv+8ti3DKZTRkJLsByJ75YYZp5uLKBAvSZMi8NXFWhbejTlCPYDamzH lzY= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:27 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsC4nF6z1RwqL for ; Thu, 22 Sep 2022 21:07:27 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906047; x=1666498048; bh=LTxemXnZbcn8GfTEOj D2bvRM5CcWr0Uc+73Is0/SJyo=; b=RNDlINbh5fDbupNFDobRw2oG+xgBGyfNfl a2nX+QVXrASPkgVHyoBxZOZx0ioVf5HVLdHa8xy3cqB3cbPat4Mm7jlxS3qMExj5 QzbpjAa3rVRSZDcbTu9BA2sxBQNiL/aK9XckMd1H34iBGDwxQGCvVsJJnzDjHUOI 2ruQ2hNTfu1MYcaMablA/XxS3457oW7ne/v7U/87+SRnTfxbqiQL4t6QCdezEFMQ VHDr92V99aAD9DQDocPMYIJaZtNc6ZCLIrQoorps5+BMVYBZYNQgW+KLMKnvuZi2 gEhjky6ruJlVy/gBewQ31vUEUq31+Z6cIEknWQc2kTxKweKJitjA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id lqUlvRXibcvv for ; Thu, 22 Sep 2022 21:07:27 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYds84g9Qz1RvLy; Thu, 22 Sep 2022 21:07:24 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Andrew Burgess , Alistair Francis Subject: [PULL 06/12] target/riscv: remove fflags, frm, and fcsr from riscv-*-fpu.xml Date: Fri, 23 Sep 2022 14:06:58 +1000 Message-Id: <20220923040704.428285-7-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrew Burgess While testing some changes to GDB's handling for the RISC-V registers fcsr, fflags, and frm, I spotted that QEMU includes these registers twice in the target description it sends to GDB, once in the fpu feature, and once in the csr feature. Right now things basically work OK, QEMU maps these registers onto two different register numbers, e.g. fcsr maps to both 68 and 73, and GDB can use either of these to access the register. However, GDB's target descriptions don't really work this way, each register should appear just once in a target description, mapping the register name onto the number GDB should use when accessing the register on the target. Duplicate register names actually result in duplicate registers on the GDB side, however, as the registers have the same name, the user can only access one of these registers. Currently GDB has a hack in place, specifically for RISC-V, to spot the duplicate copies of these three registers, and hide them from the user, ensuring the user only ever sees a single copy of each. In this commit I propose fixing this issue on the QEMU side, and in the process, simplify the fpu register handling a little. I think we should, remove fflags, frm, and fcsr from the two (32-bit and 64-bit) fpu feature xml files. These files will only contain the 32 core floating point register f0 to f31. The fflags, frm, and fcsr registers will continue to be advertised in the csr feature as they currently are. With that change made, I will simplify riscv_gdb_get_fpu and riscv_gdb_set_fpu, removing the extra handling for the 3 status registers. Signed-off-by: Andrew Burgess Reviewed-by: Alistair Francis Message-Id: <0fbf2a5b12e3210ff3867d5cf7022b3f3462c9c8.1661934573.git.aburgess@redhat.com> Signed-off-by: Alistair Francis --- target/riscv/gdbstub.c | 32 ++------------------------------ gdb-xml/riscv-32bit-fpu.xml | 4 ---- gdb-xml/riscv-64bit-fpu.xml | 4 ---- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 9ed049c29e..9974b7aac6 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -114,20 +114,6 @@ static int riscv_gdb_get_fpu(CPURISCVState *env, GByteArray *buf, int n) if (env->misa_ext & RVF) { return gdb_get_reg32(buf, env->fpr[n]); } - /* there is hole between ft11 and fflags in fpu.xml */ - } else if (n < 36 && n > 32) { - target_ulong val = 0; - int result; - /* - * CSR_FFLAGS is at index 1 in csr_register, and gdb says it is FP - * register 33, so we recalculate the map index. - * This also works for CSR_FRM and CSR_FCSR. - */ - result = riscv_csrrw_debug(env, n - 32, &val, - 0, 0); - if (result == RISCV_EXCP_NONE) { - return gdb_get_regl(buf, val); - } } return 0; } @@ -137,20 +123,6 @@ static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_t *mem_buf, int n) if (n < 32) { env->fpr[n] = ldq_p(mem_buf); /* always 64-bit */ return sizeof(uint64_t); - /* there is hole between ft11 and fflags in fpu.xml */ - } else if (n < 36 && n > 32) { - target_ulong val = ldtul_p(mem_buf); - int result; - /* - * CSR_FFLAGS is at index 1 in csr_register, and gdb says it is FP - * register 33, so we recalculate the map index. - * This also works for CSR_FRM and CSR_FCSR. - */ - result = riscv_csrrw_debug(env, n - 32, NULL, - val, -1); - if (result == RISCV_EXCP_NONE) { - return sizeof(target_ulong); - } } return 0; } @@ -404,10 +376,10 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) CPURISCVState *env = &cpu->env; if (env->misa_ext & RVD) { gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu, - 36, "riscv-64bit-fpu.xml", 0); + 32, "riscv-64bit-fpu.xml", 0); } else if (env->misa_ext & RVF) { gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu, - 36, "riscv-32bit-fpu.xml", 0); + 32, "riscv-32bit-fpu.xml", 0); } if (env->misa_ext & RVV) { gdb_register_coprocessor(cs, riscv_gdb_get_vector, riscv_gdb_set_vector, diff --git a/gdb-xml/riscv-32bit-fpu.xml b/gdb-xml/riscv-32bit-fpu.xml index 1eaae9119e..84a44ba8df 100644 --- a/gdb-xml/riscv-32bit-fpu.xml +++ b/gdb-xml/riscv-32bit-fpu.xml @@ -43,8 +43,4 @@ - - - - diff --git a/gdb-xml/riscv-64bit-fpu.xml b/gdb-xml/riscv-64bit-fpu.xml index 794854cc01..9856a9d1d3 100644 --- a/gdb-xml/riscv-64bit-fpu.xml +++ b/gdb-xml/riscv-64bit-fpu.xml @@ -49,8 +49,4 @@ - - - - From patchwork Fri Sep 23 04:06:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 739BAC6FA8B for ; Fri, 23 Sep 2022 04:20:08 +0000 (UTC) Received: from localhost ([::1]:40494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obaAZ-0002hy-1v for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:20:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyR-0001hq-1C for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:38 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyM-0005dr-VC for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:33 -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=1663906050; x=1695442050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NSdLJUes/A5o/LxxgY5E+Ys07xPrASvSUN2mRI+b+Tw=; b=Gx8qyD6tzDp5gh6e3nO4/2ktK1Vngu3s267brVZ84CrbyPFE7zU8YggQ fweKKXx9N/eJ23vGRu6Dw+IJymELXFDV1kV5LhbjCFxsLnTJ7pYwW/d0f SpUw+LgKJzRpFKCA2lNSVAiav8Qjwca8mJcThASikMutyWnOB1mNGPFEQ zSwA1efbyoifVTrclhVxtuqwOh9Mg/jskLYjHtpRKVxvQozhT3IMqBVkH 9La8x631EB9vtp1/3aCb4XMiuAukYEW48oKtEFvVX5gmkFsX1GXAj7mB4 nO+guW1ijMA5Q6c7Uxjl9wgE4PTwQ4FgD7HI2E8arckvgK+HZWRlVKZmB A==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208,217";a="212510473" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:30 +0800 IronPort-SDR: I+dJy7LTbnkRebHsd/B9KBQFiNkPcjhak+9IcaWj3Xj+B+8J/xr6BnO0VRPJ4nXBcEdaLasazJ zfeb+powIVQ0oXn+eDGSarI5rvcb2nGfjQdNGQobP3Blf/QITJM09RPKP7YdyY0n5DVvrVz4oq FDcmJkr18R8MwZxBmT7iFcsAkvjTxJNnhnuNY3JGlya/7IMDWX/+XNfFpZKoJF84oi46EF/r7S uKHXpBUKBXW1aPM8n/Q2rz9eAXunXqHon5QGuE/+xgusj6DGTW/F/1LdmBkgEUQQmi25QR3t+q iGGxFXM98X6D6cm5D3qnCbFX Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:32 -0700 IronPort-SDR: veny4s3IpDrzjcSeyZ+Q5iumWORpXq7OHXWTqrPAmPegdWS2GDxY4JotMndIzFquBBS9dPUtk5 6CnpNF4f1pD0EKSQn0xmwaSg4CfgFG/YNSji5NnBwYkzfUJoHX+ZPew/rwbxuovCTNdFoLF3j2 HmZu7CTGzGwlQ1GpK1fp8v3f5TCgYsCEvZIQHL83KgknzTsYQezNZMwKg9hPPeESToUQLw/8db ZTDTbabxJNpYzJGalXf1dl5aHO47gp0zOiEaq1Vi/sxn/NZ/DcR6UqWpYdI1siHPJYBuNLniLO clE= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:30 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsG0C6Sz1RvLy for ; Thu, 22 Sep 2022 21:07:30 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906049; x=1666498050; bh=NSdLJUes/A5o/LxxgY 5E+Ys07xPrASvSUN2mRI+b+Tw=; b=JaSr8/Je9Gdjor2x6Cy01mnJ7+zkolIHxK ogBnrOo05FO/uRnm6zrZKsjMxgugBU1GCYV3RMffQtghBainJhDRtbXpbiwnq2vb L0GLWtm8RJEoDLg052Q6+pIbc+NaREBWYrx7OEYAzdTROZgLTkMN2POB+b25aV3u i5zLXvSXqEm36jPJWPCoG42gXMcp8zrHqxlMalJlRbdaMYbmgfRxqLG9vAcGk7ZJ mj91QVXrtG/UKOIuaiTRpvenpYk9TeXD0DwveghvPmxtVwXgbiMI5j6mNSBwTJQK kFgx8y9YqmQcxNQBBLeEOiV4FtNRGfQ3aGJxaBqVHv0QTJtwhWjQ== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iFIDyVTXZOnO for ; Thu, 22 Sep 2022 21:07:29 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdsC4cN8z1RvTr; Thu, 22 Sep 2022 21:07:27 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Andrew Burgess , Alistair Francis , Palmer Dabbelt Subject: [PULL 07/12] target/riscv: remove fixed numbering from GDB xml feature files Date: Fri, 23 Sep 2022 14:06:59 +1000 Message-Id: <20220923040704.428285-8-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrew Burgess The fixed register numbering in the various GDB feature files for RISC-V only exists because these files were originally copied from the GDB source tree. However, the fixed numbering only exists in the GDB source tree so that GDB, when it connects to a target that doesn't provide a target description, will use a specific numbering scheme. That numbering scheme is designed to be compatible with the first versions of QEMU (for RISC-V), that didn't send a target description, and relied on a fixed numbering scheme. Because of the way that QEMU manages its target descriptions, recording the number of registers in each feature, and just relying on GDB's numbering starting from 0, then I propose that we remove all the fixed numbering from the RISC-V feature xml files, and just rely on the standard numbering scheme. Plenty of other targets manage their xml files this way, e.g. ARM, AArch64, Loongarch, m68k, rx, and s390. Signed-off-by: Andrew Burgess Acked-by: Alistair Francis Reviewed-by: Palmer Dabbelt Message-Id: <6069395f90e6fc24dac92197be815fedf42f5974.1661934573.git.aburgess@redhat.com> Signed-off-by: Alistair Francis --- gdb-xml/riscv-32bit-cpu.xml | 6 +----- gdb-xml/riscv-32bit-fpu.xml | 6 +----- gdb-xml/riscv-64bit-cpu.xml | 6 +----- gdb-xml/riscv-64bit-fpu.xml | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/gdb-xml/riscv-32bit-cpu.xml b/gdb-xml/riscv-32bit-cpu.xml index 0d07aaec85..466f2c0648 100644 --- a/gdb-xml/riscv-32bit-cpu.xml +++ b/gdb-xml/riscv-32bit-cpu.xml @@ -5,13 +5,9 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> - - - + diff --git a/gdb-xml/riscv-32bit-fpu.xml b/gdb-xml/riscv-32bit-fpu.xml index 84a44ba8df..24aa087031 100644 --- a/gdb-xml/riscv-32bit-fpu.xml +++ b/gdb-xml/riscv-32bit-fpu.xml @@ -5,13 +5,9 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> - - - + diff --git a/gdb-xml/riscv-64bit-cpu.xml b/gdb-xml/riscv-64bit-cpu.xml index b8aa424ae4..c4d83de09b 100644 --- a/gdb-xml/riscv-64bit-cpu.xml +++ b/gdb-xml/riscv-64bit-cpu.xml @@ -5,13 +5,9 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> - - - + diff --git a/gdb-xml/riscv-64bit-fpu.xml b/gdb-xml/riscv-64bit-fpu.xml index 9856a9d1d3..d0f17f9984 100644 --- a/gdb-xml/riscv-64bit-fpu.xml +++ b/gdb-xml/riscv-64bit-fpu.xml @@ -5,10 +5,6 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> - - @@ -17,7 +13,7 @@ - + From patchwork Fri Sep 23 04:07:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986102 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3815AC6FA8B for ; Fri, 23 Sep 2022 04:14:32 +0000 (UTC) Received: from localhost ([::1]:57844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oba59-00040g-Aq for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyS-0001iV-U7 for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:38 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyP-0005cr-4K for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07: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=1663906053; x=1695442053; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b02/TLqgF0kTES/41rCHOv0/nTxWSCUUk8n7CI4Sep4=; b=EK/rHMqaSfsncPhu6dd5nNsoGZGHyC93gjoShRhEQLfJkMeq0yjJH/mP UApZhXczD3PgP+eeJi5ibcIekMx18H44a5gYkEv8CLj+vAqb6fsxZUULg HCQ20tbyZvule8HaieEYwOPbaa2ofT54Y569vJBbKi5o1ikn7479Jlsh8 wjWFaa3WGzMJZfhAZytTvcz3J42RmHnfg14vDGLNjs1eCLQJrfzR0/6DQ 2OVgkiDbxSswEkAIEl4jC24kcNqGkWHdpQx1mayL4oqumuypaNUiiFUz+ PcH6Rj9RWjP+KeuuMiZ5gSHeFn1ceSV6kxwjG8fbKKfY2+ihRS+bFSx5d Q==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510475" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:32 +0800 IronPort-SDR: kAhrAUelKwpMv8iyJNGB0Vfnn85EIz9mR7LWyHqGdxPLKsO52x/wELznqzKEtZmN4UVZrfzIPv w38BDC502i/vOYH1buBN6rPGOrifqRzjTyWIXkng0lCzIYmM+Qs4/ptDdkf8pV50P64gHpeXnI 8z9n+rTFTh7u25p8Dib0H4BURPWwX3h8aq6fgCXqwm5FSmnbSJGFtmU2ToO9iPAYmkOlOMbgL4 vVPixiF1zQL53rcir4UrVGTmvuCcnvfsGB3JE1TmwLurL45cmlhajEpmjVUbddGjutjoMTQw38 lVfTVVuhz0bnPcHPSyENNyy8 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:34 -0700 IronPort-SDR: 2PzWZDTbODSc+BAH91BsHZEAIv/S2TzNsjwhYu8BuGcqgREVe9KVAsejricVM7A7JjayyqzhJU 35eQ15I+QrEONq1K18QrZJ9Kn5gfcJlo3+GKYZ/PaB8lLgId+gLhxE0H2mWDTVNGJw+dYrGLoh nnoA8d6k7EJFm82RbqxN7nIbkTn/T7b1+t37bgFAfakLPt4J3Orm5IsZbKuNvJg5W5Z5jOChT9 K1S8XJT5NsF3kO0XSknoQTLDT+seFd8GcSq+BtO68Di0zCP7LkwXTGH8U/BLbr4P+hh67Wmpqr IUM= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:32 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsJ15zRz1RwqL for ; Thu, 22 Sep 2022 21:07:32 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :mime-version:references:in-reply-to:x-mailer:message-id:date :subject:to:from; s=dkim; t=1663906051; x=1666498052; bh=b02/TLq gF0kTES/41rCHOv0/nTxWSCUUk8n7CI4Sep4=; b=YQ4HWFw6+uoJ2K9vrwigIuc Zcc0q4K74UhbiwwM9+ckX9XxgF/het6O/AlaC6EmiBHfeG4yRvwEtjNeE6wL05df ERF3MGwe0JrgZc9/Vc3JkDCPDxfUsDynypsjawUR97htVnc5ML7ZHIKRaiHeBKiT z+gChjvTQTYjmjDQGfwtZ8mC+b+OLV+C6DCiu9TZahWwgBVAzlqD0GHz4KjYDUKO eyc1eKdpHxI+WnuFtgU/IAACWGBp+98CFF4wSln73v/fFTburG22TB5Qg8v3n+NA /wGLUYuteOnCE7HAEFzTEk6SQ+4jlG22nLwrYn/RqPFMEl10SEE5oNSrSG+K3SA= = X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id km206DJWfQNa for ; Thu, 22 Sep 2022 21:07:31 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdsG1f2lz1RvTr; Thu, 22 Sep 2022 21:07:29 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 08/12] target/riscv: Set the CPU resetvec directly Date: Fri, 23 Sep 2022 14:07:00 +1000 Message-Id: <20220923040704.428285-9-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alistair Francis Instead of using our properties to set a config value which then might be used to set the resetvec (depending on your timing), let's instead just set the resetvec directly in the env struct. This allows us to set the reset vec from the command line with: -global driver=riscv.hart_array,property=resetvec,value=0x20000400 Signed-off-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220914101108.82571-2-alistair.francis@wdc.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.h | 3 +-- target/riscv/cpu.c | 13 +++---------- target/riscv/machine.c | 6 +++--- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 06751e1e3e..22344a620b 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -190,7 +190,7 @@ struct CPUArchState { /* This contains QEMU specific information about the virt state. */ target_ulong virt; target_ulong geilen; - target_ulong resetvec; + uint64_t resetvec; target_ulong mhartid; /* @@ -474,7 +474,6 @@ struct RISCVCPUConfig { bool pmp; bool epmp; bool debug; - uint64_t resetvec; bool short_isa_string; }; diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index aee14a239a..b29c88b9f0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -228,13 +228,6 @@ static void set_vext_version(CPURISCVState *env, int vext_ver) env->vext_ver = vext_ver; } -static void set_resetvec(CPURISCVState *env, target_ulong resetvec) -{ -#ifndef CONFIG_USER_ONLY - env->resetvec = resetvec; -#endif -} - static void riscv_any_cpu_init(Object *obj) { CPURISCVState *env = &RISCV_CPU(obj)->env; @@ -336,7 +329,6 @@ static void rv32_imafcu_nommu_cpu_init(Object *obj) set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVC | RVU); set_priv_version(env, PRIV_VERSION_1_10_0); - set_resetvec(env, DEFAULT_RSTVEC); cpu->cfg.mmu = false; } #endif @@ -676,7 +668,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) riscv_set_feature(env, RISCV_FEATURE_DEBUG); } - set_resetvec(env, cpu->cfg.resetvec); #ifndef CONFIG_USER_ONLY if (cpu->cfg.ext_sstc) { @@ -1079,7 +1070,9 @@ static Property riscv_cpu_properties[] = { DEFINE_PROP_UINT64("marchid", RISCVCPU, cfg.marchid, RISCV_CPU_MARCHID), DEFINE_PROP_UINT64("mimpid", RISCVCPU, cfg.mimpid, RISCV_CPU_MIMPID), - DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC), +#ifndef CONFIG_USER_ONLY + DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC), +#endif DEFINE_PROP_BOOL("short-isa-string", RISCVCPU, cfg.short_isa_string, false), diff --git a/target/riscv/machine.c b/target/riscv/machine.c index 41098f6ad0..c4e6b3bba4 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -308,8 +308,8 @@ static const VMStateDescription vmstate_pmu_ctr_state = { const VMStateDescription vmstate_riscv_cpu = { .name = "cpu", - .version_id = 4, - .minimum_version_id = 4, + .version_id = 5, + .minimum_version_id = 5, .post_load = riscv_cpu_post_load, .fields = (VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32), @@ -331,7 +331,7 @@ const VMStateDescription vmstate_riscv_cpu = { VMSTATE_UINT32(env.features, RISCVCPU), VMSTATE_UINTTL(env.priv, RISCVCPU), VMSTATE_UINTTL(env.virt, RISCVCPU), - VMSTATE_UINTTL(env.resetvec, RISCVCPU), + VMSTATE_UINT64(env.resetvec, RISCVCPU), VMSTATE_UINTTL(env.mhartid, RISCVCPU), VMSTATE_UINT64(env.mstatus, RISCVCPU), VMSTATE_UINT64(env.mip, RISCVCPU), From patchwork Fri Sep 23 04:07:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 54432ECAAD8 for ; Fri, 23 Sep 2022 04:24:11 +0000 (UTC) Received: from localhost ([::1]:36472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obaEU-0006tv-19 for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:24:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyV-0001j4-Qh for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:44 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyR-0005dr-Af for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:37 -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=1663906055; x=1695442055; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rGwlR4H3pAHbNK6RHizCRzWAmLwAdBJ0/NRbGNOIiKc=; b=KGRnBQ2SRx+jqiiedH+UW1PiBXzQjccsTLXsiC6aKhjD213g8sOVIoW6 n91W5CNcTVldxMtOmJ+4s1YwWsCZEX3MuagrGnUQIUX/2EYpW3uyQiNc+ YvRobeLWvNg6/VZPefCzHI/01TdzNesFYly6Bez3g2FNaqc/8ZTVL+789 bxQrHmxAOJgGd9hcBzKJXpHfqNlejsuAVBHyFGuikHSEBHRgHzF3mU4Ki 70+7zpbBE8yZPVpF8PGRvm8CAhbdOwWOYpcP6pgI3SK8KE9PQ/djkOsSO 2oLd2UvEpUag4naSs67n/L3nkJujihAnLNZglQG73k0ym54PYtOsPlQr6 Q==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510479" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:34 +0800 IronPort-SDR: qi0TL8xBdYgcnWOPjragi3POUmIaXo7tLqivICmlmj240GqfxcgziH5TiyksoRt1A+ULNGiiM3 MdQx9p0e173xLDjtW7dX1gXddnq28b1Y8VTLsgi+JBOEuxtFkUssymAXUPTSe9SOVTHznem2x1 LVmYeZjPMI9b0Ac+lALViL5g3Jb4iVeqiW5lOTzMTxpxXpi75nmAGwtE/vFt5RvhpJnN/ifpX7 o6kLornX0CUNiTY5hXwPo/dyCW1kuSQeseHJz5O0sSq8/Qh/WzqNWhuoFuo91/xhPCnVvjFg37 ZC/bfoObIwPVvtO9HetOaOeI Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:36 -0700 IronPort-SDR: Lv9BLiLKDD0hY6xxvwRn3FOhaTQmVoaPK2p9GClZOLf+vXyRph/4olrFRsyfmOh28ShbVGhOXf YCa9eUwy+8p4z2P1sASCio2jmcGLYi2X9IYo8MIdCqj0c9Pb5jgyp2qCwOW/kUAAY9LTP0N5RD 4KcbEmyV1F8KIJo1gfZ8M7nvY/Oe2J53sHPYsmCDLT/fY/8L9YwMdBQqBrRpZtYS90Zr7Hhene mBdF26P/4eSJuGEshHgwqcDSS1KR3qoSUFIv7gu8D9+sns2qGaMICutibvf3POCbrYCsmn/dtE x/8= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:34 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsK73JRz1RwqL for ; Thu, 22 Sep 2022 21:07:33 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906053; x=1666498054; bh=rGwlR4H3pAHbNK6RHi zCRzWAmLwAdBJ0/NRbGNOIiKc=; b=THY/Q2VSWBQn6ej5USVcbKBG+QfWiqXjT5 GtM4p1mZ2a/8TFbmXuMv2sOuIIODjmxe2xEMqAoYXtsVll9hpKIge1SSzMOp2XSP gjm1t2j1owbxmOQekIROC0M+zLXj1/O6tZydQ8d34ehEuXOyTZAVC89zXPLue+9b 5QKbDaO9fn3YT2704O/haCD04HIy2MaggVeKgx8s7QYi7F77TESBHl/QLc7O8hU5 JQBQXj2+AA1HoUItvxtX9TOx1CRYE7QNHqveosbFgw+ckKeePjQX9TKFzWj+Iah/ 2SsO4N1+zUXN2b+zQ+sHBs0fTML031+01y2hYWQsVkE4YxG3BYvg== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id HI2eTicwN9uT for ; Thu, 22 Sep 2022 21:07:33 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdsJ2rRPz1RvLy; Thu, 22 Sep 2022 21:07:31 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PULL 09/12] hw/riscv: opentitan: Fixup resetvec Date: Fri, 23 Sep 2022 14:07:01 +1000 Message-Id: <20220923040704.428285-10-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alistair Francis The resetvec for the OpenTitan machine ended up being set to an out of date value, so let's fix that and bump it to the correct start address (after the boot ROM) Fixes: bf8803c64d75 "hw/riscv: opentitan: bump opentitan version" Signed-off-by: Alistair Francis Message-Id: <20220914101108.82571-3-alistair.francis@wdc.com> Signed-off-by: Alistair Francis --- hw/riscv/opentitan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index af13dbe3b1..45c92c9bbc 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -142,7 +142,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) &error_abort); object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus, &error_abort); - object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x20000490, + object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x20000400, &error_abort); sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal); From patchwork Fri Sep 23 04:07:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8BAC9C6FA82 for ; Fri, 23 Sep 2022 04:27:55 +0000 (UTC) Received: from localhost ([::1]:48552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obaI6-0001Ti-H0 for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:27:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyY-0001jz-PH for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:45 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyU-0005ek-Jf for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07: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=1663906058; x=1695442058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vZU/43lRY2chLbAeJzOxBBpvBmMQMwxjZ66GSqjz1/4=; b=Gdtgsl4rmPztP0/+GM1NBvS3uRFcwjCBjpL0q9AmdpbUImx67yN/AUJV 2c8R6lmnLJevjNe5EPw1XhbYl04o2YpRWweVZbxQsunCzyMbkLRFVRWIW oebBgOfTyIXu1plwZXqjcNINuRYSWDLWjNPfYd7QGvJkReNvL6kR7DpME IPw4RvrhPHMByX0DxZhnSN56uHuHy7DE65KAlrcSrUvfwgtQs7fe0wFQL S9Teii+YeV3tkjI/mvgxm6+8ErY0UXfkr4bVnmmoxslBson4uBhp4Y1hf xgkLmekV+uiq+S0ddp2JhPeICgpZDtk4mnGTMuBWY2W/WqJxamPLs6afY Q==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510482" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:36 +0800 IronPort-SDR: Ytw1ckH8qcjD7+tyc4rOEV2z49l/9g9YJOULlha+lAIGwdpwdwVIcLEKVwWDZ/cfHL0NyQz4DU ZjLHbz189BoDhjldZTvkG6F7rNFZwXstRstGHbcjmmCB89re8lmqg3MK5CcyD+8wQ3Igh4SeG4 ugX84heOD5ety/v2Le0X8qiBfsh2TZN7grEmLserglUaqEH3+H7eGq1NGa2KeQj1ST04I9PVTI 4Wu39O7BtICs0Ly0itoL4mB/4HZbUTz2sOzKqYOoO4etRHieUnwCzjYoH5M4ibh/6fX8tv19NZ 9J7FpJrQiDXVyOmCHMs1CB0y Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:39 -0700 IronPort-SDR: Z9dFel/Csf9OWGuhyIGhJC5sWuXHSZi/YrRnbP6tClm00ChmZuEDVNdzC7+1mF80JW2lsY2r0g 0s0yq9ygDXAhg6eXoodYqw5RKQcw+xHwFGkZR79xW9IiVArKaMrfhPPtX4DtTHdsz3tnENICjO BNHX8G/qlhiw9KaWp8wIDXlGOj1xbChWQodg0wd/+VxHkVTtzQJzrQLHMeWbwqITARxJ0C++0l w46Ip25TIPfAJfAiDueTekBiQ+SpkeiUmfMeD5tYE6fnh0w/MuvPCyFzgQF+0IRqY83VzbHwhI tQg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:36 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsN2NjYz1RvTp for ; Thu, 22 Sep 2022 21:07:36 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :mime-version:references:in-reply-to:x-mailer:message-id:date :subject:to:from; s=dkim; t=1663906056; x=1666498057; bh=vZU/43l RY2chLbAeJzOxBBpvBmMQMwxjZ66GSqjz1/4=; b=cKfueAyXvm1D5N7YepF4tXQ DVZbTZOiniDYQ85XktxhD0RJ+WhuXI02an6qalakkBy3tff/xsLq16EAAa5yFuEn 6ALU0lgdLq4xJdd7XQ6Tzenlg8HjnHpxqu3U6wltvQIsnxuueCHGyhoiSzdSsL0v PAdQy0hOJFYZxzS5zOjIp88Ap9Y8VeNFr7n9TW9oDjSZqTxkYtgZVHBHTnD1Zw6K bg6Egawfe87Xqk61R8IKp8flslBdXIyD059fScVtEQccuJkVXPeXFg4IjRDCjPlf aPUMaC5wg1jVTeUpvVzwkb+PYnyUT+bhsrlJ4CLTFmxrinZGa1wFmpZl8WGQJCA= = X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id pOlSn0zcz5JY for ; Thu, 22 Sep 2022 21:07:36 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdsL1cmPz1RvLy; Thu, 22 Sep 2022 21:07:33 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 10/12] hw/riscv: opentitan: Expose the resetvec as a SoC property Date: Fri, 23 Sep 2022 14:07:02 +1000 Message-Id: <20220923040704.428285-11-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alistair Francis On the OpenTitan hardware the resetvec is fixed at the start of ROM. In QEMU we don't run the ROM code and instead just jump to the next stage. This means we need to be a little more flexible about what the resetvec is. This patch allows us to set the resetvec from the command line with something like this: -global driver=riscv.lowrisc.ibex.soc,property=resetvec,value=0x20000400 This way as the next stage changes we can update the resetvec. Signed-off-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220914101108.82571-4-alistair.francis@wdc.com> Signed-off-by: Alistair Francis --- include/hw/riscv/opentitan.h | 2 ++ hw/riscv/opentitan.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index 26d960f288..6665cd5794 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -46,6 +46,8 @@ struct LowRISCIbexSoCState { IbexTimerState timer; IbexSPIHostState spi_host[OPENTITAN_NUM_SPI_HOSTS]; + uint32_t resetvec; + MemoryRegion flash_mem; MemoryRegion rom; MemoryRegion flash_alias; diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 45c92c9bbc..be7ff1eea0 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -142,7 +142,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) &error_abort); object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus, &error_abort); - object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x20000400, + object_property_set_int(OBJECT(&s->cpus), "resetvec", s->resetvec, &error_abort); sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal); @@ -297,10 +297,16 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) memmap[IBEX_DEV_PERI].base, memmap[IBEX_DEV_PERI].size); } +static Property lowrisc_ibex_soc_props[] = { + DEFINE_PROP_UINT32("resetvec", LowRISCIbexSoCState, resetvec, 0x20000400), + DEFINE_PROP_END_OF_LIST() +}; + static void lowrisc_ibex_soc_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + device_class_set_props(dc, lowrisc_ibex_soc_props); dc->realize = lowrisc_ibex_soc_realize; /* Reason: Uses serial_hds in realize function, thus can't be used twice */ dc->user_creatable = false; From patchwork Fri Sep 23 04:07:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 33965C6FA90 for ; Fri, 23 Sep 2022 04:21:44 +0000 (UTC) Received: from localhost ([::1]:48434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obaC7-0003e1-3a for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:21:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZya-0001kF-Ks for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07:45 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyX-0005dr-Rv for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:07: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=1663906061; x=1695442061; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=49WlqYfO64I71tqOUFqqzaqviZGiRfGdnwt6HuZ6xNk=; b=qIJHMKy26SQqXK2rXTCfAAJPcpvrtSDIca6M2cfP6mrVKE8DXISNCNjR bUv7Bbr6GyBVHWy5IwrRL87skipR/laUEZf1F7P4WzNp+fwi3ZXrK36GO Ijncu+I9mOP471XUYgvtnBokWcRF5/8zeMCsOCviDahKxdlKYBePItdyk q1Youul7ky2uoiDBl7MUedzfMH1QVFTUpElQTvIp2uE84p9qQiFqBk7Ht KUx5/BOFC0mJt837V7+rvTyE0+CUIFEersjw0VrXonyx/Y6oc2KWSnpXG xymYWoq0TQbJ+jjDzqFi+XgSt6tjXTN0qFsDyJ5MRW5pn7enKeSSJkLYn w==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510487" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:40 +0800 IronPort-SDR: MhXRTS/2Ei7UQvjsoFn3KZCm4OeckVi3vGJK/NBqeLkTRZOg1mCjnNU/Aqa4d89uNB2FMbZ2gz v42Do0pMPyi3WAOqCNlsSFmdazTFNt9p7f3l0T9vT72YwRPBrjjAqcv1TO21RgyhzcnUsQnWQE 27Tc6FAC2+efENp1FFRcVzE5Co1+REBPnGIXuNN8xieUgKVDF3By/SA7CMc+yiuoVK23aYousm ppMMbLtoWKAlUBJtsoTXUTAVOQMyEOiOSiy7Zd8Zi49CSo5WPegwH0A87aEfTnrciS+4drDmrz SznVvM1R26dvSJ9p+CdPPMdM Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:42 -0700 IronPort-SDR: TKd1x61m6kU1sWKCwDrZ3RH3v4GJhdjgWgX6eX7iy7g7hsVqSn58NlH6yss6YBIzbq5OEpbgS9 H90rXPyz1mrp5RVfF9K2EkCESosvnJYhfCZBV6k0xBUlPlutOgoQsgjRFWkCNP6PHCzCjn0+8j xe2oofLbExtPkSn8aHwUYw3Lb2/jmvPmXyuaLsI/UPELFP6oqzZAMFwV7BS/KDK/Q7dAa5z/sW DIP3nImfu95yixxLNW5q6PyjotqOuoXhqFnURidRsMPvcUmdJ/+cHPIeIvFB0kPTXlGzkY9rXz qco= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:40 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsR4Ms0z1Rwtl for ; Thu, 22 Sep 2022 21:07:39 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1663906059; x=1666498060; bh=49WlqYfO64I71tqOUF qqzaqviZGiRfGdnwt6HuZ6xNk=; b=tDCyC30figVprxSoPuSUwJnW37ryc9pruY FNn5TQ3mGx+t68u1TITSFzL7FK4jI0dNoSWUPjRiH/ZAgvIbwmggrWR1Cv5R7Hk7 dWeqfeVnFE8GpTbBlmUZVIvPn2ObtpcsxIoL0642tK0Ep4GEQjWbKNTYo84qfZCS PYPeySru+FBqieBo6B5cxEiRChZT5xK7tWYH8XPyOx2GAG1QzRN5Ux7CMnt2UvSP EVQwnNYCorHWEZCH1wbr5L+Nbr7ay+jznUqbtr9yIoxjRzw/BwEyM95BPsozwkn0 XNxuBpM8AwT6GVp4hGwulBEwor1e1R8yfwsVQFborgbGU5OayX8A== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id BhAbIOPHVKI3 for ; Thu, 22 Sep 2022 21:07:39 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdsN3jwMz1RvLy; Thu, 22 Sep 2022 21:07:36 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Frank Chang , Jim Shu , Tommy Wu , Alistair Francis , LIU Zhiwei Subject: [PULL 11/12] target/riscv: Check the correct exception cause in vector GDB stub Date: Fri, 23 Sep 2022 14:07:03 +1000 Message-Id: <20220923040704.428285-12-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Frank Chang After RISCVException enum is introduced, riscv_csrrw_debug() returns RISCV_EXCP_NONE to indicate there's no error. RISC-V vector GDB stub should check the result against RISCV_EXCP_NONE instead of value 0. Otherwise, 'E14' packet would be incorrectly reported for vector CSRs when using "info reg vector" GDB command. Signed-off-by: Frank Chang Reviewed-by: Jim Shu Reviewed-by: Tommy Wu Reviewed-by: Alistair Francis Reviewed-by: LIU Zhiwei Message-Id: <20220918083245.13028-1-frank.chang@sifive.com> Signed-off-by: Alistair Francis --- target/riscv/gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 9974b7aac6..6e7bbdbd5e 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -183,7 +183,7 @@ static int riscv_gdb_get_vector(CPURISCVState *env, GByteArray *buf, int n) target_ulong val = 0; int result = riscv_csrrw_debug(env, csrno, &val, 0, 0); - if (result == 0) { + if (result == RISCV_EXCP_NONE) { return gdb_get_regl(buf, val); } @@ -210,7 +210,7 @@ static int riscv_gdb_set_vector(CPURISCVState *env, uint8_t *mem_buf, int n) target_ulong val = ldtul_p(mem_buf); int result = riscv_csrrw_debug(env, csrno, NULL, val, -1); - if (result == 0) { + if (result == RISCV_EXCP_NONE) { return sizeof(target_ulong); } From patchwork Fri Sep 23 04:07:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12986112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DEA44ECAAD8 for ; Fri, 23 Sep 2022 04:21:47 +0000 (UTC) Received: from localhost ([::1]:41726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obaCA-0003l6-GH for qemu-devel@archiver.kernel.org; Fri, 23 Sep 2022 00:21:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyy-0002cA-BP for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:08:08 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:63969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obZyj-0005ek-1J for qemu-devel@nongnu.org; Fri, 23 Sep 2022 00:08:08 -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=1663906072; x=1695442072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QyBVGcd6Cwcjc0ADM0uVkz/DPsRMQf9EmyGrDa37jrI=; b=rHSWSmKsQ9yL9gLLICNxsty+si9+Txr9YHjkGO8vtSu5PZsXejcSgoq0 tRagRHargMjfa83VTnUQHjWH2EP0lu1xoDo+KiWwfCqwChhF14l7htwEO XxDblPgpz2789Vi6UdYnyQPK6pMFc5o0+AFV97MlrTE2lZwnGT750G+3y auWEWQ9PIiuTnQi1gdFuYNHIWO7FKjMyQsPFhho0VO0tXDulJFrsrDSLz HnYsLlYyzfgU6T2KSVY7OrSKf58OZuHoQvAH6UCVMwQCg2t+upU6gwLhK a0WvG8c4F0nNXV59PZtMkCoxCN74T5plOOj97BBPVaZz/pWf1bkFDJRSR Q==; X-IronPort-AV: E=Sophos;i="5.93,337,1654531200"; d="scan'208";a="212510490" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Sep 2022 12:07:42 +0800 IronPort-SDR: LgfEjtvico6VRXnixxMuIDIqsHbbgBFyxd3ZitkAnfIniErtF9VTbttIm4bMr57FXVvffRfmoX CVXagxu/bM0DS0L4jOalil1DCGDTLk/J/+zKu7e1fIvaxfQQtvb4hV7Ive4DWir6uu78lqY7nC ugMJg6Pq1sgkeUMwWiIXtyQaHPvsIpLLmx5t0GA920gGsJtFe+O7UDhrnQ8t+qEWxbLhVdbM41 Vr7t9eYBo6AEYzloXrMo+4DI+UxpRDx7zYtNp4+gWNLorWwYmmtS1zxSWhHoPAxBP5J4nVAWVc DNkX85f7y7J/4nShYHQ8xxxM Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 20:27:44 -0700 IronPort-SDR: VZIVSIkI/SWDioTwdmJeUgB7dL5EF/UnHPJgrT2EL25a3JaOrmzJiFANOngHHWtckcS1NnVFwo KxWfBUxfxqKVVjBKSCeA7BV6Zj6Kg5Asj403RBr5MtA9YFHHiEAZQkL2rkOrt0EskehbaP0+EM SyJfFTz9ejVBSvPb0Sc9PayfNCifTarWeyuLaKKK1JL4zC9DQeCgr88PDWGayQSY5g1SkEjjr/ E/PIAIdHv+Rt60njom3eE4NeaFUcy8FHrn5RxLHDlxwrOTQiP9OKwKPNma083Df5t7xrfingTq kmM= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 22 Sep 2022 21:07:42 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MYdsT6fR6z1RwqL for ; Thu, 22 Sep 2022 21:07:41 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :mime-version:references:in-reply-to:x-mailer:message-id:date :subject:to:from; s=dkim; t=1663906061; x=1666498062; bh=QyBVGcd 6Cwcjc0ADM0uVkz/DPsRMQf9EmyGrDa37jrI=; b=c8DJN2FX7U/f5RTtegxb6JV z6aktqCgkkeExveFOZvNaMXbP8RC4BRznFfWdDby9oc//IZ+asylVKTjrQK6u10c xOMvVj5N7yB3z6vektqYd0+b8aG4wiM9kuojd7fSJtfJSha641R1QC6VIWOyMlMn 8n2XNXk+Odd223smukWH949/Dz/fYicLh7CPH0bwyHNqhbWsI991m6El3jtQWdP/ thDIjdoGR+3YxbsSnI37J07krY6ssyPU3KqBSgCFR47FDyOuWUUzYsKkRJy0j8/+ OfIDJMK9pTcdoH7YMAYul6WQHRMY38P4x57Zr6QhhBqyRIYQ8eytbHORb1UDvbA= = X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6Ug38rLdCNMj for ; Thu, 22 Sep 2022 21:07:41 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.167.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MYdsR5My2z1RvLy; Thu, 22 Sep 2022 21:07:39 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Bernhard Beschow , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 12/12] hw/riscv/sifive_e: Fix inheritance of SiFiveEState Date: Fri, 23 Sep 2022 14:07:04 +1000 Message-Id: <20220923040704.428285-13-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> References: <20220923040704.428285-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=2580c328f=alistair.francis@opensource.wdc.com; helo=esa6.hgst.iphmx.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, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bernhard Beschow SiFiveEState inherits from SysBusDevice while it's TypeInfo claims it to inherit from TYPE_MACHINE. This is an inconsistency which can cause undefined behavior such as memory corruption. Change SiFiveEState to inherit from MachineState since it is registered as a machine. Fixes: 0869490b1c ("riscv: sifive_e: Manually define the machine") Signed-off-by: Bernhard Beschow Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220922075232.33653-1-shentey@gmail.com> Signed-off-by: Alistair Francis --- include/hw/riscv/sifive_e.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h index 83604da805..d738745925 100644 --- a/include/hw/riscv/sifive_e.h +++ b/include/hw/riscv/sifive_e.h @@ -22,6 +22,7 @@ #include "hw/riscv/riscv_hart.h" #include "hw/riscv/sifive_cpu.h" #include "hw/gpio/sifive_gpio.h" +#include "hw/boards.h" #define TYPE_RISCV_E_SOC "riscv.sifive.e.soc" #define RISCV_E_SOC(obj) \ @@ -41,7 +42,7 @@ typedef struct SiFiveESoCState { typedef struct SiFiveEState { /*< private >*/ - SysBusDevice parent_obj; + MachineState parent_obj; /*< public >*/ SiFiveESoCState soc;