From patchwork Mon Jul 12 22:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=GZMw+CzO; 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 4GNzc311tSz9sRN for ; Tue, 13 Jul 2021 08:54:41 +1000 (AEST) Received: from localhost ([::1]:39402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34ow-0005AW-GT for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:54:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oG-00058i-Ss for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:56 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oE-0006rU-MY for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:56 -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=1626130435; x=1657666435; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7l28ZzBUUbFHFa9PqsazIA76P+TXl8IpMYJZ1WWuX5w=; b=GZMw+CzOwx6Pyp6zMpxJMTrEgbsRHnsLviEP5z9e5O+Of8ljEk+oGiAi EGGiX69zWt3fydaB4tNM+3D6GrO8lnjJYUEKtefqdPfzGLXo/1tVFMeaU lM7MAbnf/0vQBus//toOh/SWx7+fTsBTMef/s//dlfXLJse5GQNgvmqyz KRFa5yVqCNPqbPr3PVLozgU214A62qCITHlqfOzTqzUANHUSeSNHfYdDO uExQLF5n1jzEZ0MgCUd2qKfRF+e+nr3O0EZ5BaiGVLATvMCOHNfDRElHM cdh5CqhwPsRfd7UbCnhU9DaLJY08KcsEZj1zHlPIf+J6sXR0r8PnsDHka w==; IronPort-SDR: SNB2+Rtd6hs8Be4kgsfaYdxtqTrlWoaAOn8DOgM14PEm/xpv/i/KPLJZNx7VnV0hPrcpXusIj6 tDlTYNoTJdAHoYxS43sAvCMWbmTwY7Vdxbvt4JTQ7mIbxXCOnoeVlstXU8tcmU8Tgg3OIDyMkG MgJlSjtD2/lupLs+WMS6MMR27uOgWvuIx1OcfXuRKWQmxmbmE3HeGxOdJaTxtr7X4o/eUeIWK2 WRa8bZLPB0vYyrszfwhR8fvNZbvrjhjLmOdwsFlJMrkQ7pDnLqjnAkTb9wCAkQCMw+NQZPyzRB T34= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973300" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:52 +0800 IronPort-SDR: fMB0ct6KoVoS4/330inCc+06xc1GBbS5rUO/gqxI4DHQMtuyngMPo6DHjBhHHq9pRPX8/WsEWG 8vtuooWLChproSfu6pxULsG/24hGEJYFGVHzAAXUJ90MgLciTifNUKSPKwkKLyKHSBZ7qGFM1J eCStaPC8+Gxvbgx+bj8+Hq/TMjAsqR887WuCbcg/w2TKDCG6Roq0tMLFGUNUE01Z1BjuIB+AlM +uyvuGxKaNaV6Nc9EL4ZohwDxS7sSwVXuRKssc1NrcvimTbfloxykwCA3Aas4BEUk5qmPgAsHo pqzHnX5AhwLGKekI3PqzlDsd Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:57 -0700 IronPort-SDR: ob06jXvuG9HDCHLanckvSZoZd8E7M9d5YuUcAXHHlhtYflKnwq4UFDCrLpQZ0Oltk39rzbNciZ s/UgOPS9waPfq/IavwZlITTPE/HKzduoMMvkwO2g+gG/Y22gA9210XXtPtW0r24JBYv/XYdQA1 MMIZDH1NwZAzkZNPylP7PkseS41MvMcvbRdK1YLNJmb2dfcvb77EaO3vz905vY1GG/ZQRANlYW t+tz1sQ8NeY+TQDcJudCKkUoVboRqxzOk7kb07CUsl9Shp4v9z+LFfak+06KU8VXwBosk+VVkR Hhc= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:51 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 01/11] target/riscv: pmp: Fix some typos Date: Mon, 12 Jul 2021 15:53:38 -0700 Message-Id: <20210712225348.213819-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng %s/CSP/CSR %s/thie/the Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-id: 20210627115716.3552-1-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- target/riscv/pmp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 82ed020b10..54abf42583 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -456,7 +456,7 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, } /* - * Handle a write to a pmpcfg CSP + * Handle a write to a pmpcfg CSR */ void pmpcfg_csr_write(CPURISCVState *env, uint32_t reg_index, target_ulong val) @@ -483,7 +483,7 @@ void pmpcfg_csr_write(CPURISCVState *env, uint32_t reg_index, /* - * Handle a read from a pmpcfg CSP + * Handle a read from a pmpcfg CSR */ target_ulong pmpcfg_csr_read(CPURISCVState *env, uint32_t reg_index) { @@ -502,7 +502,7 @@ target_ulong pmpcfg_csr_read(CPURISCVState *env, uint32_t reg_index) /* - * Handle a write to a pmpaddr CSP + * Handle a write to a pmpaddr CSR */ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index, target_ulong val) @@ -540,7 +540,7 @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index, /* - * Handle a read from a pmpaddr CSP + * Handle a read from a pmpaddr CSR */ target_ulong pmpaddr_csr_read(CPURISCVState *env, uint32_t addr_index) { @@ -593,7 +593,7 @@ target_ulong mseccfg_csr_read(CPURISCVState *env) /* * Calculate the TLB size if the start address or the end address of - * PMP entry is presented in thie TLB page. + * PMP entry is presented in the TLB page. */ static target_ulong pmp_get_tlb_size(CPURISCVState *env, int pmp_index, target_ulong tlb_sa, target_ulong tlb_ea) From patchwork Mon Jul 12 22:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=nHjv+6to; 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 4GNzc31GMRz9sWd for ; Tue, 13 Jul 2021 08:54:42 +1000 (AEST) Received: from localhost ([::1]:39502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34oy-0005Es-Al for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oI-0005Ay-TS for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:58 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oH-0006rU-6g for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:58 -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=1626130438; x=1657666438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=04uox9uATPHL3afcoqaX+g7tK6s153iK9hY6jdlv9oc=; b=nHjv+6toyLcbL5k0qgjUNNhU62TBeQiSm00NEQVrVV5XwLFnG0kIi9a+ qkU8z+mGEWZjMeb721LnCv7i6IvvjQKY8dRTBHiKTVkKSY3xO3B6fvrA0 qaoL9iFj8eoBpkKExyUi4McpWwHY6tr1Fl/9xKL9MiQ/cYjDeFoBPCuLu tF3eJ5aCjEIZSiCLkr/kL0pZMaqsD+D0SlLGwW2VLLvLd9T87b4FR+82V QamCEDtmvQQrj0Ac6UsUEVubjRHtf49uMnNaQ1S32Qzfi2HXYMRLv/6SN PGL4xCBHIJ1A289EuwkxxEnPUhP66OK0ItpjdBAGJdX8POVWl2juo87d0 A==; IronPort-SDR: +8gK1zW1jhzxzsyGT955DzJYZSIsN5MO6OQu5eS/8Jbz4jIdajTpIfDCMukeCf4v65TnaTAexl V94aDo3y5w5BOWN8gJrC+obAAtDHctI0oj1QZfvwd/v4Suulk7gFazzlb/9TSgKQtUg0Z5BQyh 9NcnFMCh9kfpkM0FaqvPDGA57lkkRGdGxsXzv6eerEPn14x1lmtG+iL71C8Ufxnm/IvHxHl3l1 /hcIGVRzZFML17CxmlVev7JVL972AvBNTIz+1/X6gpvYuONGND1CUMf1I12FVGDnxrrFmpIa8w T4U= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973301" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:52 +0800 IronPort-SDR: CJ1EInN01U/YY9samxxNWSS8xYwHiRNNrOwmu0QOJBiqcYyTwr7k1QWew/MQlUK35tm887LOJk KAUoL8QMxl22ZMviowbc5BEQ8kgfjiRRSJRWcx4ctg7yd6zGE/5cjuSw82aylI/iBjrudJL0ka aR1UzaSxLFSGqRsCVjzeLBTMWrTaI0pcN5FsoecIU56e4ZzbnfRrMLOVmwBLfRHh+oZWLOF8+g 7aS+RdYHVeHUiyn/x0qJxducumys9IRFexT63ry5ki6PVeaMdE3OwTDkQ5bJMAoo2c5VERq7fA H0uqAZSPJ5HyWuwK19aObk4f Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:57 -0700 IronPort-SDR: p+IVZ6cWsSFqi2bF4vkczx6qg3cOLYolzenpDjSN9jSrb0aJUaQaAD6/9CCsqUkqSv4Hi5NQnc QT17wy9YuBuiT0YH7l3IQG1ho+Ya7o0O+UR/eNRkm+qCYBAnqolfVXnluYqmCytlCpPHHHjwRS Ol5ZXxlITl9ukZvCMnduLnF+BW9wdJ2GgOqWal8DjTm7pBh/eSYYgO26AnxnN0Oydy1WeJIsjF QVKZSkfgEzo8GHOMt8LOxz0Durbtg16LF5Dlat9QgZv+BYZ4kuYSO+OjsmjfP7mc1Utu8BzqJp OY0= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 02/11] target/riscv: csr: Remove redundant check in fp csr read/write routines Date: Mon, 12 Jul 2021 15:53:39 -0700 Message-Id: <20210712225348.213819-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The following check: if (!env->debugger && !riscv_cpu_fp_enabled(env)) { return -RISCV_EXCP_ILLEGAL_INST; } is redundant in fflags/frm/fcsr read/write routines, as the check was already done in fs(). Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 20210627120604.11116-1-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- target/riscv/csr.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index fe5628fea6..62b968326c 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -215,11 +215,6 @@ static RISCVException epmp(CPURISCVState *env, int csrno) static RISCVException read_fflags(CPURISCVState *env, int csrno, target_ulong *val) { -#if !defined(CONFIG_USER_ONLY) - if (!env->debugger && !riscv_cpu_fp_enabled(env)) { - return RISCV_EXCP_ILLEGAL_INST; - } -#endif *val = riscv_cpu_get_fflags(env); return RISCV_EXCP_NONE; } @@ -228,9 +223,6 @@ static RISCVException write_fflags(CPURISCVState *env, int csrno, target_ulong val) { #if !defined(CONFIG_USER_ONLY) - if (!env->debugger && !riscv_cpu_fp_enabled(env)) { - return RISCV_EXCP_ILLEGAL_INST; - } env->mstatus |= MSTATUS_FS; #endif riscv_cpu_set_fflags(env, val & (FSR_AEXC >> FSR_AEXC_SHIFT)); @@ -240,11 +232,6 @@ static RISCVException write_fflags(CPURISCVState *env, int csrno, static RISCVException read_frm(CPURISCVState *env, int csrno, target_ulong *val) { -#if !defined(CONFIG_USER_ONLY) - if (!env->debugger && !riscv_cpu_fp_enabled(env)) { - return RISCV_EXCP_ILLEGAL_INST; - } -#endif *val = env->frm; return RISCV_EXCP_NONE; } @@ -253,9 +240,6 @@ static RISCVException write_frm(CPURISCVState *env, int csrno, target_ulong val) { #if !defined(CONFIG_USER_ONLY) - if (!env->debugger && !riscv_cpu_fp_enabled(env)) { - return RISCV_EXCP_ILLEGAL_INST; - } env->mstatus |= MSTATUS_FS; #endif env->frm = val & (FSR_RD >> FSR_RD_SHIFT); @@ -265,11 +249,6 @@ static RISCVException write_frm(CPURISCVState *env, int csrno, static RISCVException read_fcsr(CPURISCVState *env, int csrno, target_ulong *val) { -#if !defined(CONFIG_USER_ONLY) - if (!env->debugger && !riscv_cpu_fp_enabled(env)) { - return RISCV_EXCP_ILLEGAL_INST; - } -#endif *val = (riscv_cpu_get_fflags(env) << FSR_AEXC_SHIFT) | (env->frm << FSR_RD_SHIFT); if (vs(env, csrno) >= 0) { @@ -283,9 +262,6 @@ static RISCVException write_fcsr(CPURISCVState *env, int csrno, target_ulong val) { #if !defined(CONFIG_USER_ONLY) - if (!env->debugger && !riscv_cpu_fp_enabled(env)) { - return RISCV_EXCP_ILLEGAL_INST; - } env->mstatus |= MSTATUS_FS; #endif env->frm = (val & FSR_RD) >> FSR_RD_SHIFT; From patchwork Mon Jul 12 22:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=MmKEl07H; 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 4GNzfs3fBFz9sRN for ; Tue, 13 Jul 2021 08:57:09 +1000 (AEST) Received: from localhost ([::1]:48112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34rL-0002qO-7y for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:57:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oJ-0005Bn-87 for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:59 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:47857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oH-0006u9-NJ for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:58 -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=1626130438; x=1657666438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cmebsk2YrhvouJOpHNJ/nTGaasT8su7IGqhbza6bBr8=; b=MmKEl07HXiL0KyQ1Y0QLyciRepb0tDgBHc7Ajvxl3OL7ngRGj1+pyfiG /jLS8nl5p9AoIP5y8OzuFND51wFjJQxC5pSHCKpnZ6Y1KueFhgHPjdK/k vbsPesZwtHhidM8DSoYQQPXeoSsoci9nXaWPjCuJ9jiEgqvu7K13DPDmE ZidzfInrpHpf6BsPdjlIRGIi6kRof4b+8KK5+MiYVO0bDToUfrI245GQG skbQTAWamgMOtEP3PIEnqY0B0+xKbkziIe9KdqOYOrZ2JWJfQMcJ55Op9 hiUHi96iS08DI9szBvLmkfdynAgTi/+LdFU1KqeOoAIDu0+z0AiONNwHU g==; IronPort-SDR: X59gFoHw3BwkVLq+uZ6OsnJOmaRD9sjoqm5ZMU35/tqEPlHWhx/2iWE0H4VsLmocPpUGxIth2g To66zncaRgOSFhtzlc2inzEaaU2yK+aqWWqbFFexNeox8rFRIwCyKXqiCcGG21XMK3apiTsIv+ KNql+U7tF2SDGd/q6FSdbBjFOTEol9CK3DwdoNFCB6Mf0UXmkvkacZDwSZ0yHZ3MnJzp+/6kXR 747OvPf1lu1NVeJ1vtQqFtahQXKfxPITJgn6Rd4kgQmY4/silBVZPBCMQw2e3FIIuSX+OKb/3j 490= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973302" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:52 +0800 IronPort-SDR: U5UtB+wKwvtQYGWvD1AGXbtBoHDP+Sx1zV+XLON90PXonyGHfqtV4v5V1YZKfAaHZjn529vvc2 RzuF/eGRTfm1sd6qW+qT407l+Q79DN0nNXXnkeRh9amwo2J+A+C62DrQLkpI1xG0NoQXfuPiRM WnRjzOVBCqjBGmCOzMYJEdTJZf64Vn8j5nS9mk9VCSwoss/VXFSkzG0yFq6JwfZN4HbG9PTFy2 O/imK/RWMfbjLW2R+qRgEHKrSqlXio4+DrXe/XUgFLfYNm2blEY0bWgBi3LzQ5csKEGHaiRPwD N4Sko6JVaWephWUK6qgNTgkB Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:58 -0700 IronPort-SDR: C2ypqy5akEdX009i+GXJHG+MXmIeEjU0Liz0qndzoOZkRvlSF3f/NqyGgH23AqGqZxugyitcbL LUw2JmWl3c9mxCSFUiq6o+GfZzPrIhA2D10MzrCUPm0+a2BYQfybEX5GdkZC08JJmvmcYk4d+e SgJj9rRn+RmdjhhTIQ1q/DF844jMf1NtNT/A6tolKsK7M9oZSZzAsvdjYr3bzXt/70zztBxwEo RisQ448p/gn4avd1u/iC0kgmakNGyqc5tRiOdY6gWXyOPR/H8uDS1RNG7CCj/XHaG6eqIFIOK+ E3A= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 03/11] docs/system: riscv: Fix CLINT name in the sifive_u doc Date: Mon, 12 Jul 2021 15:53:40 -0700 Message-Id: <20210712225348.213819-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng It's Core *Local* Interruptor, not 'Level'. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 20210627142816.19789-1-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- docs/system/riscv/sifive_u.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system/riscv/sifive_u.rst b/docs/system/riscv/sifive_u.rst index 32d0a1b85d..01108b5ecc 100644 --- a/docs/system/riscv/sifive_u.rst +++ b/docs/system/riscv/sifive_u.rst @@ -11,7 +11,7 @@ The ``sifive_u`` machine supports the following devices: * 1 E51 / E31 core * Up to 4 U54 / U34 cores -* Core Level Interruptor (CLINT) +* Core Local Interruptor (CLINT) * Platform-Level Interrupt Controller (PLIC) * Power, Reset, Clock, Interrupt (PRCI) * L2 Loosely Integrated Memory (L2-LIM) From patchwork Mon Jul 12 22:53:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504275 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Hhoe/Edw; 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 4GNzjH4Mpjz9sRN for ; Tue, 13 Jul 2021 08:59:15 +1000 (AEST) Received: from localhost ([::1]:54512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34tM-000748-NI for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:59:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oK-0005GL-Q6 for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:01 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oH-0006qj-Oz for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:00 -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=1626130438; x=1657666438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T7M2Jn/m9oUZiWeXDP9KO8IcaM1DA9eJTUHJ/HQ+0HA=; b=Hhoe/EdwKJHfg2XvGUtOHZEZLh1DtzD3JfFczzVIvL4q7fAzKSCNUHQK k6htv9un6qBcRTmbLM0QO5gyPxyXBPXscYhl50WouengUFFGZcnYZPTdT g4e9XAxRJSJDN4uXhdYHq6VKvng3EMQPO+qiLyJTmQbHVmeFZ+JsOP7JE CMa87tp2v1bNJtnSMIgbnmcMeOZ1bDMAYEyWRJngXlV1rYUo6/P7KLoIv haGr9Lf9VuyJGxHSXLonEFjG9Va4lrA+3F7S8+Iy7y6eFTID3UpTLwZrX POwTCByzPIkmrF8dINZ+5hiSsHUv2b67kqdPGpJLfZ/X+6/qTtJQOqjUj A==; IronPort-SDR: suT0OlMEt0jkP871IxvB54tsbqJvjedsKBr8P5psWGN1r05q9ioIRtFok13Bouqfb87TyEkxRe IZTXmN67Rf/gTbgAD996XbvMlngR8qadaArzSuDTKkLJvFE/eTK0x4JZkSy04KeLakAu0W5CdF UkW5oG4mCc7swy8BnnvRwrll22PNJAReKeox9zZlHblcvuUId2SzuCWkqj42+0OoB6IZrHVne2 jA4udQtx6ekZcaHGD6Y/XBZ3aieJPSGsDI3vTVRb8bOGSaGfd/VoyK+J3sn/paj0SsbEOQnpY5 vjQ= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973303" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:53 +0800 IronPort-SDR: iTtr10ax27FqYfZ82DLD1AXaIi+7Wmlg63V6vQ5RFfARLjnpnXPZ4AyonIYKdU9fj3MibNNFm6 CLgG7MsUwuPDD7b/+HF5aMWQcOflZZGEbrSlyIDD3pfgZTp4wcvCX937Mf/KabDfcZcFHNEDKM ULVVCDPk47GJC+bEGN2PyCRklYIBn8+uP0PqxtyOAoiEt4lkWl5VHWzuFXllyl7F07Fjz4mQNZ DPI+zUwE/QcFUH6BoANQ86pFzLW+12zPMyuhWmOKvf75HqHctdvF46CHtou4UtH1g7dfxIcUQY ABMwCW4MyXXEsZD4R2Sxu1Wy Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:58 -0700 IronPort-SDR: 3t2V9wwwDh40l8gvE1YA0A6LkDcycEARZlUEYov3UuoVGNMQO56M93lWI6vJAuoDQrvxDTSQGz X0x9SSlvmYFfINVaPfql9jgQdcJlnPr2TbY3YG5Mt2LbMjzzww9vYhmwj5mblY3XQGYc26dlHA EvMfl+3L4qo5US+k6kTRFwT2kzsMrtXDOt8ZcVxSLPcprsqLNYzhYO/vT4SkMtwoek9m47xVxe L2lBJR3CmqONdpkw0Pi9J7UxZgH0bPQgiwpMrcGTqHoWLxmHXaA/MQSt8dBlee6jjyRNX11dQC FEc= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 04/11] docs/system: riscv: Add documentation for virt machine Date: Mon, 12 Jul 2021 15:53:41 -0700 Message-Id: <20210712225348.213819-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng This adds detailed documentation for RISC-V `virt` machine, including the following information: - Supported devices - Hardware configuration information - Boot options - Running Linux kernel - Running U-Boot Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 20210627142816.19789-2-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- docs/system/riscv/virt.rst | 138 +++++++++++++++++++++++++++++++++++ docs/system/target-riscv.rst | 1 + 2 files changed, 139 insertions(+) create mode 100644 docs/system/riscv/virt.rst diff --git a/docs/system/riscv/virt.rst b/docs/system/riscv/virt.rst new file mode 100644 index 0000000000..3709f05797 --- /dev/null +++ b/docs/system/riscv/virt.rst @@ -0,0 +1,138 @@ +'virt' Generic Virtual Platform (``virt``) +========================================== + +The `virt` board is a platform which does not correspond to any real hardware; +it is designed for use in virtual machines. It is the recommended board type +if you simply want to run a guest such as Linux and do not care about +reproducing the idiosyncrasies and limitations of a particular bit of +real-world hardware. + +Supported devices +----------------- + +The ``virt`` machine supports the following devices: + +* Up to 8 generic RV32GC/RV64GC cores, with optional extensions +* Core Local Interruptor (CLINT) +* Platform-Level Interrupt Controller (PLIC) +* CFI parallel NOR flash memory +* 1 NS16550 compatible UART +* 1 Google Goldfish RTC +* 1 SiFive Test device +* 8 virtio-mmio transport devices +* 1 generic PCIe host bridge +* The fw_cfg device that allows a guest to obtain data from QEMU + +Note that the default CPU is a generic RV32GC/RV64GC. Optional extensions +can be enabled via command line parameters, e.g.: ``-cpu rv64,x-h=true`` +enables the hypervisor extension for RV64. + +Hardware configuration information +---------------------------------- + +The ``virt`` machine automatically generates a device tree blob ("dtb") +which it passes to the guest, if there is no ``-dtb`` option. This provides +information about the addresses, interrupt lines and other configuration of +the various devices in the system. Guest software should discover the devices +that are present in the generated DTB. + +If users want to provide their own DTB, they can use the ``-dtb`` option. +These DTBs should have the following requirements: + +* The number of subnodes of the /cpus node should match QEMU's ``-smp`` option +* The /memory reg size should match QEMU’s selected ram_size via ``-m`` +* Should contain a node for the CLINT device with a compatible string + "riscv,clint0" if using with OpenSBI BIOS images + +Boot options +------------ + +The ``virt`` machine can start using the standard -kernel functionality +for loading a Linux kernel, a VxWorks kernel, an S-mode U-Boot bootloader +with the default OpenSBI firmware image as the -bios. It also supports +the recommended RISC-V bootflow: U-Boot SPL (M-mode) loads OpenSBI fw_dynamic +firmware and U-Boot proper (S-mode), using the standard -bios functionality. + +Running Linux kernel +-------------------- + +Linux mainline v5.12 release is tested at the time of writing. To build a +Linux mainline kernel that can be booted by the ``virt`` machine in +64-bit mode, simply configure the kernel using the defconfig configuration: + +.. code-block:: bash + + $ export ARCH=riscv + $ export CROSS_COMPILE=riscv64-linux- + $ make defconfig + $ make + +To boot the newly built Linux kernel in QEMU with the ``virt`` machine: + +.. code-block:: bash + + $ qemu-system-riscv64 -M virt -smp 4 -m 2G \ + -display none -serial stdio \ + -kernel arch/riscv/boot/Image \ + -initrd /path/to/rootfs.cpio \ + -append "root=/dev/ram" + +To build a Linux mainline kernel that can be booted by the ``virt`` machine +in 32-bit mode, use the rv32_defconfig configuration. A patch is required to +fix the 32-bit boot issue for Linux kernel v5.12. + +.. code-block:: bash + + $ export ARCH=riscv + $ export CROSS_COMPILE=riscv64-linux- + $ curl https://patchwork.kernel.org/project/linux-riscv/patch/20210627135117.28641-1-bmeng.cn@gmail.com/mbox/ > riscv.patch + $ git am riscv.patch + $ make rv32_defconfig + $ make + +Replace ``qemu-system-riscv64`` with ``qemu-system-riscv32`` in the command +line above to boot the 32-bit Linux kernel. A rootfs image containing 32-bit +applications shall be used in order for kernel to boot to user space. + +Running U-Boot +-------------- + +U-Boot mainline v2021.04 release is tested at the time of writing. To build an +S-mode U-Boot bootloader that can be booted by the ``virt`` machine, use +the qemu-riscv64_smode_defconfig with similar commands as described above for Linux: + +.. code-block:: bash + + $ export CROSS_COMPILE=riscv64-linux- + $ make qemu-riscv64_smode_defconfig + +Boot the 64-bit U-Boot S-mode image directly: + +.. code-block:: bash + + $ qemu-system-riscv64 -M virt -smp 4 -m 2G \ + -display none -serial stdio \ + -kernel /path/to/u-boot.bin + +To test booting U-Boot SPL which in M-mode, which in turn loads a FIT image +that bundles OpenSBI fw_dynamic firmware and U-Boot proper (S-mode) together, +build the U-Boot images using riscv64_spl_defconfig: + +.. code-block:: bash + + $ export CROSS_COMPILE=riscv64-linux- + $ export OPENSBI=/path/to/opensbi-riscv64-generic-fw_dynamic.bin + $ make qemu-riscv64_spl_defconfig + +The minimal QEMU commands to run U-Boot SPL are: + +.. code-block:: bash + + $ qemu-system-riscv64 -M virt -smp 4 -m 2G \ + -display none -serial stdio \ + -bios /path/to/u-boot-spl \ + -device loader,file=/path/to/u-boot.itb,addr=0x80200000 + +To test 32-bit U-Boot images, switch to use qemu-riscv32_smode_defconfig and +riscv32_spl_defconfig builds, and replace ``qemu-system-riscv64`` with +``qemu-system-riscv32`` in the command lines above to boot the 32-bit U-Boot. diff --git a/docs/system/target-riscv.rst b/docs/system/target-riscv.rst index a5cc06b726..89a866e4f4 100644 --- a/docs/system/target-riscv.rst +++ b/docs/system/target-riscv.rst @@ -69,6 +69,7 @@ undocumented; you can get a complete list by running riscv/microchip-icicle-kit riscv/shakti-c riscv/sifive_u + riscv/virt RISC-V CPU firmware ------------------- From patchwork Mon Jul 12 22:53:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Z/xBzDnW; 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 4GNzm05Krlz9sRN for ; Tue, 13 Jul 2021 09:01:36 +1000 (AEST) Received: from localhost ([::1]:32798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34ve-00035u-7g for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 19:01:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oL-0005HK-8K for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:01 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oJ-0006rU-8q for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:00 -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=1626130440; x=1657666440; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+EgUTahH6YCZijgaJWZ8Oat+gfoPTmnES7jz53Ebji8=; b=Z/xBzDnWUFgS3U7rawBU9xg+ZJvQ+9y4tggvUMZQA/A1w70dzmJimTw/ 2EO2kaYAPJk2KxRMH+qaBbcXSdiGTJGccPC03S5lHGPLF4XjKin9mQh4L tSScmnFiYXTJF5bDjvPHM6wgpf6nl0nApRflWirUBfS29O+Yf9gfG0anD dLgWl7EcWeoxponsLf8wUfQyP9VMjonCJl+9vfn53crPCf/lHCBXaW7kE RCDGAjABehu1kxKGZb1uwIOvWRXsKDvh8bf0NvCT5/p9trp/pfneB5+3I HAsQ0H99/XmYKaWHTdzT4Dsv4HgNO5lm46fDnMfpKw19TW3ScBGEL5Uwz g==; IronPort-SDR: +twyEQ3jPKb/hSBeOLe3cOnHHzoJmglhkwFr4wWnJP3icD6ey26Gdy5fmRARtB2ChrbLRSbYeG Vibc5WfxNU8qET96HaexJ7RLBPNfvc9dYysgVfw4eBpdIo7dJhk1gXHToiLQTS0axsNsKWgimI 1fFqf7JaN1Ix6jVhAKDvwFWycx0fy31LX2A0n0OW+MvW3CCUhvyggLjUcEYrJw8j+z2Gjoq5/E vrK0i97WUPaCiOR1KLcB+8weZhh8dILcYbqkWKfORghj0SZ0HIR4D8RifzTfPPkJDPA1eide72 kXg= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973304" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:53 +0800 IronPort-SDR: D0fG5RijIDQsTuDyIdNy3ujfo1jUwGWaBURFPXmhd8De6AWfhxVV1VXeQ9gP94dMS+wxJTl/xp d5djXKoHFzwZ30DfaaUH2tkuqNotF3l/wYRwh07ce62k1ypPFlhdq33zSmYXk8TOlQ+iMQhPvP NlyQGIoYlYhE53NkZ2ZXGlj7QDUPkgyUAGCqz66lQyNJuozoXSR6t5lmiwx8MkyqNsMkbmt+Kr IP6TKT/ImlJX3YhV3LaBx88nh6CKzdsMuIqcTo4TN9XW8Nj+nDtsG6ZwDRQ7YP4IYM4o6ixruZ SsYTg70y+AFuKVlrkC0xbMeq Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:58 -0700 IronPort-SDR: 74UlS8yJ3f7uIZgG0+GuaSnZlOnTPKhR63xVxijGeuRbLzXLVY7ggGCGeSMgJ6pVvq2BHP1n3j QClmuQA2gqtvrb5UE/AqHtKy+u6SGB+6n2YxF7bk/ZKwngqrKNtAkJzxqkiJaXcHBJbz3UE2C/ EXqmTmUrEs59za3lZF5RmOKbooCgHzN0d+qlkE8KewrSdLAt8Z9npR38v1jiSL4mxZj5hmem/s SsGFKwzIGQyGrBlN0RS4qETtosM+6Bzj48rRpJ8sT3FMOQJqCnPKavc65wjKQa/gET7PUbH7oR gWU= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 05/11] target/riscv: hardwire bits in hideleg and hedeleg Date: Mon, 12 Jul 2021 15:53:42 -0700 Message-Id: <20210712225348.213819-6-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jose Martins , Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jose Martins The specification mandates for certain bits to be hardwired in the hypervisor delegation registers. This was not being enforced. Signed-off-by: Jose Martins Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-id: 20210522155902.374439-1-josemartins90@gmail.com [ Changes by AF: - Improve indentation ] Signed-off-by: Alistair Francis --- target/riscv/csr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 62b968326c..b904d2bcb0 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -411,6 +411,7 @@ static RISCVException read_timeh(CPURISCVState *env, int csrno, static const target_ulong delegable_ints = S_MODE_INTERRUPTS | VS_MODE_INTERRUPTS; +static const target_ulong vs_delegable_ints = VS_MODE_INTERRUPTS; static const target_ulong all_ints = M_MODE_INTERRUPTS | S_MODE_INTERRUPTS | VS_MODE_INTERRUPTS; static const target_ulong delegable_excps = @@ -433,6 +434,14 @@ static const target_ulong delegable_excps = (1ULL << (RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT)) | (1ULL << (RISCV_EXCP_VIRT_INSTRUCTION_FAULT)) | (1ULL << (RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT)); +static const target_ulong vs_delegable_excps = delegable_excps & + ~((1ULL << (RISCV_EXCP_S_ECALL)) | + (1ULL << (RISCV_EXCP_VS_ECALL)) | + (1ULL << (RISCV_EXCP_M_ECALL)) | + (1ULL << (RISCV_EXCP_INST_GUEST_PAGE_FAULT)) | + (1ULL << (RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT)) | + (1ULL << (RISCV_EXCP_VIRT_INSTRUCTION_FAULT)) | + (1ULL << (RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT))); static const target_ulong sstatus_v1_10_mask = SSTATUS_SIE | SSTATUS_SPIE | SSTATUS_UIE | SSTATUS_UPIE | SSTATUS_SPP | SSTATUS_FS | SSTATUS_XS | SSTATUS_SUM | SSTATUS_MXR; @@ -1039,7 +1048,7 @@ static RISCVException read_hedeleg(CPURISCVState *env, int csrno, static RISCVException write_hedeleg(CPURISCVState *env, int csrno, target_ulong val) { - env->hedeleg = val; + env->hedeleg = val & vs_delegable_excps; return RISCV_EXCP_NONE; } @@ -1053,7 +1062,7 @@ static RISCVException read_hideleg(CPURISCVState *env, int csrno, static RISCVException write_hideleg(CPURISCVState *env, int csrno, target_ulong val) { - env->hideleg = val; + env->hideleg = val & vs_delegable_ints; return RISCV_EXCP_NONE; } From patchwork Mon Jul 12 22:53:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=KOCzFFyS; 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 4GNzk46Gtvz9sRN for ; Tue, 13 Jul 2021 08:59:56 +1000 (AEST) Received: from localhost ([::1]:56898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34u2-0000BW-KO for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:59:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oL-0005JT-Nq for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:01 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:47857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oJ-0006u9-Ht for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:01 -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=1626130440; x=1657666440; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SbSzoMijwfPI2ZTclf3G3p+iRCTsIMjZDdCadjYDN2o=; b=KOCzFFySEAJqfgBsmp7+9JmTDBzAmCvGJiu5UT1wOUWHqYJugU0A3Hrh wNKRaT8towYFhGYk9n+tycO7hShSO2YAwPH7Bm1A23nRaxerUlj4Pg4bM 979k0L08+wWlZMnDBWeG+hEd25aXFpKddK1VVLiAuRRW7btqU6SUirZ4H reCUqG0951KRKGoQmdUcb7hLFRLEWe2KHSu4lptYFfEmTakYdWvX6AD7B 07qLXEbOvepvNEiI8JqVuk17lKNc1O9q8LepBMvjbZZmDw9rIwIiOxD4/ TkjNvHu6XYXr1ONv3wGbTCJkKjA97G7gQZ9N/QKg3yaVHPR/CAnDDDMyu A==; IronPort-SDR: EtHSrs+sUQPPwjHQGhUrMpUuKtcEEyt9zafabq4jiiH2LilJfZmavBjvJnJSyGmFf+KZLTNNj3 Hqfk43IG4cLye2wV7uzx13Z6XVNzMCIuFzt7VhOViISFJQk/kB64ZdtK2CU6AWXX782W9Y8gNy 5gzlJSlUS05u8j8sItAyXTgjVgnMDdqFELgsUXgJsuul0Sm4JO4/6DTownIpiK4HpQTxR8/gs+ P7kXoandswrHoaNMgRQ5u4hgtY2zv0Z1Yp3bjXk39fmLGKc1/fko62tG4GxyTtbTcS5D38cvXJ t5Y= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973305" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:53 +0800 IronPort-SDR: KovMBDMCy4V4sdunn981DxO86DQiv7F59WwiPIuko1T1Hf7/JaLScqOn4hUXdXZsnG2x5PFrPP nuiwQstboWtTq6nsxgEh2uCmpV8UIYhcqygZlqX8M7v9ZnIvjmZbRkrrClhVd2ErgbfwS3NBz6 LohPITVHMoz8pi9QsG2TI9TUr33VtmbG5E1DMJb9BHZp0WzJVPTp+NnxFq6yKsFSpVTiF3zayb M+gLgMjtrMGMZq6zfxVLF0R/gMSVf/ZI1dEhb/Y1/3Hdi4SNmEaPYIKNPiBUIj7BKzoPETmBdu hEvgUVU6f8SZtkZ35awNIj+5 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:58 -0700 IronPort-SDR: KsQU/4y6b/fYCIMzbbDqggKmyVBUG/8QrIKfd1gBwHm+8DICFdaelIfMNwgSMSSvx5Oq/6JWbj pEx+tgLsrF2zyqWYcROgCvBHDnIDL85s7DOJbmmJmdIj+iD7hMN1qJT7Ho7VVEGMUs+VEa3zWF f+cXjT2tyKdrkjsKQd65A5I+OqegrthL7bdtTYLJhJRW3/PA9nWrY4HjQSr+/TPI5UWnXWbY1e 7zEww7YfSB3d5erb8tVP4UHmWxgeRqyIVOBF25+HXfqRwT2pgMF/DQKwAXqBWsVnLjDN/S7Ett idw= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 06/11] docs/system: riscv: Update Microchip Icicle Kit for direct kernel boot Date: Mon, 12 Jul 2021 15:53:43 -0700 Message-Id: <20210712225348.213819-7-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng This adds a new section in the documentation to demonstrate how to use the new direct kernel boot feature for Microchip Icicle Kit, other than the HSS bootflow, using an upstream U-Boot v2021.07 image as an example. It also updates the truth table to have a new '-dtb' column which is required by direct kernel boot. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 20210706095045.1917913-1-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- docs/system/riscv/microchip-icicle-kit.rst | 54 +++++++++++++++++++--- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/docs/system/riscv/microchip-icicle-kit.rst b/docs/system/riscv/microchip-icicle-kit.rst index 54ced661e3..817d2aec9c 100644 --- a/docs/system/riscv/microchip-icicle-kit.rst +++ b/docs/system/riscv/microchip-icicle-kit.rst @@ -47,13 +47,13 @@ The user provided DTB should have the following requirements: QEMU follows below truth table to select which payload to execute: -===== ========== ======= --bios -kernel payload -===== ========== ======= - N N HSS - Y don't care HSS - N Y kernel -===== ========== ======= +===== ========== ========== ======= +-bios -kernel -dtb payload +===== ========== ========== ======= + N N don't care HSS + Y don't care don't care HSS + N Y Y kernel +===== ========== ========== ======= The memory is set to 1537 MiB by default which is the minimum required high memory size by HSS. A sanity check on ram size is performed in the machine @@ -106,4 +106,44 @@ HSS output is on the first serial port (stdio) and U-Boot outputs on the second serial port. U-Boot will automatically load the Linux kernel from the SD card image. +Direct Kernel Boot +------------------ + +Sometimes we just want to test booting a new kernel, and transforming the +kernel image to the format required by the HSS bootflow is tedious. We can +use '-kernel' for direct kernel booting just like other RISC-V machines do. + +In this mode, the OpenSBI fw_dynamic BIOS image for 'generic' platform is +used to boot an S-mode payload like U-Boot or OS kernel directly. + +For example, the following commands show building a U-Boot image from U-Boot +mainline v2021.07 for the Microchip Icicle Kit board: + +.. code-block:: bash + + $ export CROSS_COMPILE=riscv64-linux- + $ make microchip_mpfs_icicle_defconfig + +Then we can boot the machine by: + +.. code-block:: bash + + $ qemu-system-riscv64 -M microchip-icicle-kit -smp 5 -m 2G \ + -sd path/to/sdcard.img \ + -nic user,model=cadence_gem \ + -nic tap,ifname=tap,model=cadence_gem,script=no \ + -display none -serial stdio \ + -kernel path/to/u-boot/build/dir/u-boot.bin \ + -dtb path/to/u-boot/build/dir/u-boot.dtb + +CAVEATS: + +* Check the "stdout-path" property in the /chosen node in the DTB to determine + which serial port is used for the serial console, e.g.: if the console is set + to the second serial port, change to use "-serial null -serial stdio". +* The default U-Boot configuration uses CONFIG_OF_SEPARATE hence the ELF image + ``u-boot`` cannot be passed to "-kernel" as it does not contain the DTB hence + ``u-boot.bin`` has to be used which does contain one. To use the ELF image, + we need to change to CONFIG_OF_EMBED or CONFIG_OF_PRIOR_STAGE. + .. _HSS: https://github.com/polarfire-soc/hart-software-services From patchwork Mon Jul 12 22:53:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=fuua36Cb; 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 4GNzc31fYqz9sWk for ; Tue, 13 Jul 2021 08:54:42 +1000 (AEST) Received: from localhost ([::1]:39520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34oy-0005FY-J8 for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oH-00059K-Gv for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:57 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oF-0006rR-3o for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:53:57 -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=1626130434; x=1657666434; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9A8QWqswZ6UOntZKeMVseSxt7D5c/I+oM3IrzN5UJzI=; b=fuua36CbRkjfzTi/TmX6KrcYefBly7wIo1xlPk4rAp0ZUS/MbDDF8xRZ 3yyyh11C5cnNf8HrEIRiMUs+2hltxFyJEFKTHMNc1t/X1k2ip032WxGv1 RjjYf9peqETE0IYg8v9Wbdb9Nf+b9SfGaJqWLeQWyhBm72r9b4eczoMXV +gVdGvpI7Igp8I2oNGSR3ZQf8x3wsZICZFbYMEICOO08ftuEGK3tRq6rP UIPFt9kIh72ywkUYHCkbIO2kzkOvXAC4t/DRKzx27kKlGgFXJMsE5TJxf Iucuqq6/P7+r+Av9LSZVEzJDLp7h6nX6vvOeb6cL4ZUfNBlQy7IHmGhzl Q==; IronPort-SDR: GqXIkQ5/ECV4+AvyUAQc5bwAUUVZaSo6kbb4XncqZ0WKEN0Z3vmdtOB2Sk7WBAjIXsVK2cU4vN rCmKMUKZSO/B2rxlPKFfy+zDVnDwKtaMs7Y5N5Itgkz/cc1EAwWU7VfTWZdzZK14BmntWwSxqL oiFzk5YO1BodwqiMzA7GCPvJoG6EcrwPKngA2Cl7WMrK99Hg0uT6bEGyFhFJPdLwzOopvscg14 784mYtEOAadMA2aaLRlv0XKdhrFFMtWNVB36mkwhoqECVaqpQir+eTfQdtZ+oBqHgdiigSFJeu HqI= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174398528" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:51 +0800 IronPort-SDR: +qVYsec89Qg1+AsYnJCsD2pdwVRMDrI0VC0pIN7I0ibf64E0z1EaZVytwXOcoy2uX4vEODQQYO njNAB8PWMAatEZZmM3ctDen7xju+vkTx6OuDBzosrVaVHZZ8yUeQKinqMmlRJUTQrcq7eouYrS Z8ZbeMpBr4nzx3Cv8hFmfdnrvUtEUf2JvZSY1nHAKijBgzlgE8REmWm2WjiWWA4xLhGt0EC7R0 UdiQQnNvf5QhE0n3kuN/tEfMiRHmDjcXK/XXfgOihaG/BAXrqCiWN+u+0XQBjusdfbIqCysA/n 8TjvLbR8UjhtMRaof4NJZMqC Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:30:36 -0700 IronPort-SDR: TmR4Hp+G66+6Ic+siegIw8uANybTs/iUvgc/uAQXuJ5LwDKngpOQb2oI75A9SEA45jLuE5y7mQ KAx1UxFeCwSuD0t0dqnwCDrHgL6PFmULsC+9gcw4noYU1/2/Wel0nBGRXqADygJ3KS3XroMSma t+pVQEjcI5jL3WBE3gL7gWW55kWHJDGAVrIxUf7X6DXZQ6pf3nk/jw248E+v+fOEDHrUk36yFQ fFC6TP584r4RtfJIduUbAtb1pn/bmoUbCqQlb37CGyGs7zs03/b3m4CRBVTytJ7J3xTKeqaK9r n/c= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 07/11] hw/riscv: sifive_u: Correct the CLINT timebase frequency Date: Mon, 12 Jul 2021 15:53:44 -0700 Message-Id: <20210712225348.213819-8-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.144; envelope-from=prvs=820a0e1fd=alistair.francis@wdc.com; helo=esa5.hgst.iphmx.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present the CLINT timebase frequency is set to 10MHz on sifive_u, but on the real hardware the timebase frequency is 1Mhz. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 20210706102616.1922469-1-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- hw/riscv/sifive_u.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 273c86418c..e75ca38783 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -62,6 +62,9 @@ #include +/* CLINT timebase frequency */ +#define CLINT_TIMEBASE_FREQ 1000000 + static const MemMapEntry sifive_u_memmap[] = { [SIFIVE_U_DEV_DEBUG] = { 0x0, 0x100 }, [SIFIVE_U_DEV_MROM] = { 0x1000, 0xf000 }, @@ -165,7 +168,7 @@ static void create_fdt(SiFiveUState *s, const MemMapEntry *memmap, qemu_fdt_add_subnode(fdt, "/cpus"); qemu_fdt_setprop_cell(fdt, "/cpus", "timebase-frequency", - SIFIVE_CLINT_TIMEBASE_FREQ); + CLINT_TIMEBASE_FREQ); qemu_fdt_setprop_cell(fdt, "/cpus", "#size-cells", 0x0); qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 0x1); @@ -847,7 +850,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) sifive_clint_create(memmap[SIFIVE_U_DEV_CLINT].base, memmap[SIFIVE_U_DEV_CLINT].size, 0, ms->smp.cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, - SIFIVE_CLINT_TIMEBASE_FREQ, false); + CLINT_TIMEBASE_FREQ, false); if (!sysbus_realize(SYS_BUS_DEVICE(&s->prci), errp)) { return; From patchwork Mon Jul 12 22:53:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=oVm3/kjQ; 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 4GNzfr5xWCz9sRN for ; Tue, 13 Jul 2021 08:57:08 +1000 (AEST) Received: from localhost ([::1]:47974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34rK-0002lB-Ac for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oK-0005F0-EN for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:00 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oH-0006rR-R6 for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:00 -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=1626130436; x=1657666436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5qe5NSgZWinSdjj7ZsUlkyN3Gf/d5eMq2C8L+vF+ROQ=; b=oVm3/kjQ+ncv8dNkDpp2X6i0l23iPojQxdbXG2Qh6dsIBKkhwo7FRBRe qqm16c3bEZSvmYY9OCs0LK10xm1+JenMBAGLOBK0XnHcoIEjaI02MOKHZ vsPLivUCcmI777tGUyaZYVTvzP9P9er/20Zdbo0BX10/yo+mnHZSXSu3N FFGFRPwv4v/HbBQu7Mzp65k/WasogBTGIpevyv5WqKTFpKzibxqU/9lEW ceRDxvWyloaL0bJ9v+5TNbKPAOCdQEXBELoGM6ttUzTe0j3EKOI0APps9 44CEO3/XEQPXkFRmNmP7zlOiT3xHk+iPAnLy9x7Dx9zmkOiwCKSf+DIL9 g==; IronPort-SDR: jeyZLM/vmNnvt6dX5LqhHEfgk1cqeun9S9Vg5rWxeiPcVsWHQ1YmzsFLZMOaxRkmhKlyJF1AFH 1swTeUTp4W6Y+awfsqD89Y0stWtg63iswH+g3UMHGi+zZ2kOOQY79XbJIlWlS9lBRH1AzyJMt3 U9a5/9mZtGH0sfmfdnIVsWMDItuL8N7tjq25Zqxq0NVQWzVCkVTBCI1JBHZyCisuC4WemSunXM VzkyAs2DfDHH8gPyuJsYMqvdZCjCoJtrsWI6oD5oSmSZZZ4I+RT3vsNDoR72flgUqV/DNbPtzP bUM= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174398529" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:51 +0800 IronPort-SDR: MoRFZt/GBo9FpJFjE9AAlCxNBkgKe84UzSNaWqnFUZbagzWPUp3Sa9mL+WtgMz09ehuZs2dk6W YsUMY4lEn2kK6EWySsJSJJ81qf1JWGKwYHosoyT3xLT7lYZ1YBdjn3uplUuiF2SBlcR6ADqyO0 bYsDq5UP4n1GjGSQ4bI4CIvzkuHzTXpaRR6VfZwWo2qCZiDPTQ3clF8aw75HTpaLY5Fx3DEevN LKW/6TR444YKEjdsUum0MI8Ng9J61mNKtdxqKOdfPNnrQpRNda6S3PhTR5SWWxqMosu41vdZTZ emsdBQODifaTOOwBAYjCkwd2 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:30:36 -0700 IronPort-SDR: D41MzVei6yKbFLsNUuMxt19dyCdR9B4VHJQ4ajWVIfxVC78lVdOq+kmMUZDLe8HaYge0KcTF0e XLfi06tb0He3S24HcM+lsYm9JnbYWYMpbne7dqfIT1QjE/vu4MAWAhOVgmhzv8zwL+QUu6liyp XdbdxORinbmwQnrHB3aXW6D/7SvA99B7KbQ2c8ZwCZwsHiitr/Ts+Ce3AciqfIBK2bT0gvHxkr miAiYG9iI1gjrguuTSQKFeFvAXilw/jVZMpf0pA7xYZ6XGsSPmeyq+7SLM60rZqO86cQZLjNkO ZSA= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:52 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 08/11] hw/riscv: sifive_u: Make sure firmware info is 8-byte aligned Date: Mon, 12 Jul 2021 15:53:45 -0700 Message-Id: <20210712225348.213819-9-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.144; envelope-from=prvs=820a0e1fd=alistair.francis@wdc.com; helo=esa5.hgst.iphmx.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Currently the firmware dynamic info (fw_dyn) is put right after the reset vector, which is not 8-byte aligned on RV64. OpenSBI fw_dynamic uses ld to read contents from 'struct fw_dynamic_info', which expects fw_dyn to be on the 8-byte boundary, otherwise the misaligned load exception may happen. Fortunately this does not cause any issue on QEMU, as QEMU does support misaligned load. RV32 does not have any issue as it is 4-byte aligned already. Change to make sure it is 8-byte aligned which works for both RV32 and RV64. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 20210708143319.10441-1-bmeng.cn@gmail.com Signed-off-by: Alistair Francis --- hw/riscv/sifive_u.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index e75ca38783..87bbd10b21 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -602,10 +602,10 @@ static void sifive_u_machine_init(MachineState *machine) } /* reset vector */ - uint32_t reset_vec[11] = { + uint32_t reset_vec[12] = { s->msel, /* MSEL pin state */ 0x00000297, /* 1: auipc t0, %pcrel_hi(fw_dyn) */ - 0x02828613, /* addi a2, t0, %pcrel_lo(1b) */ + 0x02c28613, /* addi a2, t0, %pcrel_lo(1b) */ 0xf1402573, /* csrr a0, mhartid */ 0, 0, @@ -613,6 +613,7 @@ static void sifive_u_machine_init(MachineState *machine) start_addr, /* start: .dword */ start_addr_hi32, fdt_load_addr, /* fdt_laddr: .dword */ + 0x00000000, 0x00000000, /* fw_dyn: */ }; From patchwork Mon Jul 12 22:53:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ghRXEXEr; 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 4GNzgT42jSz9sRN for ; Tue, 13 Jul 2021 08:57:41 +1000 (AEST) Received: from localhost ([::1]:49556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34rr-0003nz-9F for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:57:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oK-0005FH-Gy for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:00 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oI-0006ux-DS for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:00 -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=1626130437; x=1657666437; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PxMspOk3+BuBy2D/exxvDUQtwHonT8cvBBgfO7w5J5c=; b=ghRXEXEr4s/C2VBtRiatj7liJxgxd+p/x/JLcJYxeFc12dxcPVHwYFBu j8kw6ZVWG3PM5BwaaFZ/Bcpctkk77zVMmJWLWrgn3+GFZgo98po8869Rk S/hM+0wOYW2oGwmSPZbs4DNoGGQ4G/Elc3OEUzlhcgSCxOTdrz9WeuP3L 3fXI6oj5b4hiE2K71e7AZ8NtTCCJ6ruyvludzQ77sRpTb2NvSN6W8t+RC cU6OLtn9T9nP8O05CPNdWQiwhSEID+U7XuriPpniYbFHvfQJTb+ON/Ctu TD0E95fxS5Bg2mClNUFDFO55HxNJNH0dmQMdlgrsdMJVaAFL1MKi04Etk Q==; IronPort-SDR: YN+iguIlvCDY5GprcwD5zMyQ27oh/x8D7M9hOuuk9POMbkHwOoAgXmQ280HECXdQl3Mq2tqxb6 tEKkv2HRpR1vVEuAELvpSEBPBgnQZ4Zy/rBonVqVAbuK7SmxfnvHJH9PkG5fTh2Kaqo9JlRN0W eoBOmrHDnyYC09JpigixySQ2dh5PTnZRTpVUvvySToB3Q1AztsFrqtBk/Ti6QZIYy3GE2EM4Pn eO200eqVhSLIxqJkfFjd+GldpKH0qK7M1fd+29SJz/rjCCY2zd/BouFs7GKA2ffcIpefzl3lWy n2A= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174398530" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:51 +0800 IronPort-SDR: 92JgdTVstpB/WO0lMLLS5sErWYzrCtxz4iQFcngMw/Rkd/4xPCklV4MrhB5OT9q+Ma5zm8bo13 thhv2w9kICwUsCdf0x9704ft8Nfq9p3z1fZJUJJfHFAJMjwwnHXa1FmJydukU/DT7+kcJYIbsD h6GpJ63NKMjcOyoyHFSTzfwKk4u2j4QZh2mSW5sq3xiKcFvi7T8hRw7tDYI48mrnT29mKBm3ZU +dw2zTLHrzvo1MB9H2YCLSJ7jhOt5goLtTyGr3+7IjkUZpblk8cUTL6rKTvWG4xB93lfPqA1EI 2i9fYwtHQOwxYVZMIeTWaHkY Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:30:36 -0700 IronPort-SDR: W9OGMe5SQza8L4lICspjxN4K33kzq3jxYxS6RWcsSr6zuOndeb0EMY2Fq+uvX2h+9J+9DXxlxc aEo9/RTN88g3duw2GReKODqooGK5cKd/hppzqfNeqH7UyVn/ThmUajEgk4c8nW8DsR93KLnhid 5kRGVGG6nQncadmhZdrUVXEM9icNEKO4LzBg19oHnv/l0zXrLi/3XmaGaoVrDc3OvLDd+D8fcA e03TNB5S7sawGL5V3m3eGscQs+WMsk14Oc0/IcDwLcuX7TS4DYhjKvfaJe1eMPFb3uCmFV59JE Bxo= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:53 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 09/11] char: ibex_uart: Update the register layout Date: Mon, 12 Jul 2021 15:53:46 -0700 Message-Id: <20210712225348.213819-10-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.153.144; envelope-from=prvs=820a0e1fd=alistair.francis@wdc.com; helo=esa5.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Update the register layout to match the latest OpenTitan bitstream. Signed-off-by: Alistair Francis Reviewed-by: Bin Meng Message-id: 25c8377d32f3e0f0a1a862c8a5092f8a9e3f9928.1625801868.git.alistair.francis@wdc.com --- hw/char/ibex_uart.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c index fe4b6c3c9e..6b0c9330bf 100644 --- a/hw/char/ibex_uart.c +++ b/hw/char/ibex_uart.c @@ -42,7 +42,8 @@ REG32(INTR_STATE, 0x00) FIELD(INTR_STATE, RX_OVERFLOW, 3, 1) REG32(INTR_ENABLE, 0x04) REG32(INTR_TEST, 0x08) -REG32(CTRL, 0x0C) +REG32(ALERT_TEST, 0x0C) +REG32(CTRL, 0x10) FIELD(CTRL, TX_ENABLE, 0, 1) FIELD(CTRL, RX_ENABLE, 1, 1) FIELD(CTRL, NF, 2, 1) @@ -52,25 +53,25 @@ REG32(CTRL, 0x0C) FIELD(CTRL, PARITY_ODD, 7, 1) FIELD(CTRL, RXBLVL, 8, 2) FIELD(CTRL, NCO, 16, 16) -REG32(STATUS, 0x10) +REG32(STATUS, 0x14) FIELD(STATUS, TXFULL, 0, 1) FIELD(STATUS, RXFULL, 1, 1) FIELD(STATUS, TXEMPTY, 2, 1) FIELD(STATUS, RXIDLE, 4, 1) FIELD(STATUS, RXEMPTY, 5, 1) -REG32(RDATA, 0x14) -REG32(WDATA, 0x18) -REG32(FIFO_CTRL, 0x1c) +REG32(RDATA, 0x18) +REG32(WDATA, 0x1C) +REG32(FIFO_CTRL, 0x20) FIELD(FIFO_CTRL, RXRST, 0, 1) FIELD(FIFO_CTRL, TXRST, 1, 1) FIELD(FIFO_CTRL, RXILVL, 2, 3) FIELD(FIFO_CTRL, TXILVL, 5, 2) -REG32(FIFO_STATUS, 0x20) +REG32(FIFO_STATUS, 0x24) FIELD(FIFO_STATUS, TXLVL, 0, 5) FIELD(FIFO_STATUS, RXLVL, 16, 5) -REG32(OVRD, 0x24) -REG32(VAL, 0x28) -REG32(TIMEOUT_CTRL, 0x2c) +REG32(OVRD, 0x28) +REG32(VAL, 0x2C) +REG32(TIMEOUT_CTRL, 0x30) static void ibex_uart_update_irqs(IbexUartState *s) { From patchwork Mon Jul 12 22:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=hUnUNTQ1; 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 4GNzmV02Qmz9sRN for ; Tue, 13 Jul 2021 09:02:02 +1000 (AEST) Received: from localhost ([::1]:34818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34w3-0004RD-OV for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 19:01:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oM-0005Nb-Od for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:02 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oL-0006qj-3G for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:02 -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=1626130442; x=1657666442; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cGua8vSKOZZ/PPn1kCw33FiPKJInMTSE/ByicFl93Ro=; b=hUnUNTQ1yJ2LwtHqVA6zZN/2/S8WDgbdQUfmqbK7OZdZ91nCJxPL7mas ov0RSDEib4VwWsI8HootX3sNLZRkZkw+zHLua4TF1wT4zA0856xh+0+3o CMAZMAYtOGsx19rDI0+WU1s0zBCbHezIIl9Xf/6tTtXE6qqqvyEJ01Y9r zXJhE5EgI70VbJN649+hIVu1QI5v80rnzVOASfMfG2+8jMgv8j22vspup FRBKG/yGZu8oxol2+j9kQtgjjRgifw2NEulkS7RFUvmpvdABMLiz1M+1h PE8E+xsi012Uo+MSVcNPIU+HcYVHQNxFiVPlGo3ojnkonFwXrUqQjj0JW A==; IronPort-SDR: XRC/pN4XbdaO6oBgSQt2UBqNKtuZC/WGhNrM3X3T9EbSNR+DZzbOiha0dB57d4MpBd8MgwJu+B e+jWuuQvbxwKEPWynL52bB0YrYBxKPOrBm0Oj3TwBf7kiPTPF+HFofIiBQWDaU6G23k6wJewtp ruVIqldxFHvaTy/pJgPsH0KqWZOPT7wbvLMD6EJzPTa5XwRC1T450Be2zw2RTt/dFGVdudYdQc 1ek0Pwf3jHG9plMKI32ovEoRv8eAFuAUhLCkU1adfT8rIP+x0xZVnUPsjX5I2Scbm/FpVhQH8u MCI= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973309" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:53 +0800 IronPort-SDR: 54e2c2SLgFBN8gk91YAAyj16y4JgfXhnac4Rnelq6lhCqtC+kda8/Fc1sQFbwwcNbiHmaBQxoN oaHMJfURAME3K6GU8IK65m8HzTOnsnbk9Gm5cLz9fRYSnZof+rdwpiD8p46pkatBFylAsIkuvm qoQPYOFTx8/TsYeMkZHEbpzQGeODTVn5wRlKaGpd7uREOeOZ2hKdC3S+xScLoD1lxfgwv1132E dTIx4phf2heQXbzFb/XZr5P7z1qED+6mKOS0nrU7qrc+TcIgbyEVZPGfxCWRr5dgKJq6tPUsqQ mtAtZg6Wa6NRflNthn7GuBoi Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:58 -0700 IronPort-SDR: Uf8v12WFu1L5BucXhx3qAdEzBg7mNbmoS7xo8NqEw0hgbi4Glv6uow3n24MX6vQmq+5XUnFyLy i5IepCZx+BBdQNsgjVCNtCK2FeIPdsVHUWKoii65c8k6TKh7CF1RJpmkhx6N9TosaktHluIz7d p089A5GEewVwEleemkrQjwmeP/jeQsAFCTzQm7FRYO62/ZDbKbZu6DB2NCZkrm2BC9xnqAYUPb x96GONfj9TXxi8UqtGYI1rZCK8N+VU/iftHD3nEYrtFU6VZ2Dbdec1Ygb/iMxGy9LIGil9drni zJM= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:53 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 10/11] hw/riscv: opentitan: Add the unimplement rv_core_ibex_peri Date: Mon, 12 Jul 2021 15:53:47 -0700 Message-Id: <20210712225348.213819-11-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Reviewed-by: Bin Meng Message-id: ed707782e84118e1b06a32fd79b70fecfb54ff82.1625801868.git.alistair.francis@wdc.com --- include/hw/riscv/opentitan.h | 1 + hw/riscv/opentitan.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index 86cceef698..a488f5e8ec 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -81,6 +81,7 @@ enum { IBEX_DEV_ALERT_HANDLER, IBEX_DEV_NMI_GEN, IBEX_DEV_OTBN, + IBEX_DEV_PERI, }; enum { diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index c5a7e3bacb..933c211b11 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -58,6 +58,7 @@ static const MemMapEntry ibex_memmap[] = { [IBEX_DEV_ALERT_HANDLER] = { 0x411b0000, 0x1000 }, [IBEX_DEV_NMI_GEN] = { 0x411c0000, 0x1000 }, [IBEX_DEV_OTBN] = { 0x411d0000, 0x10000 }, + [IBEX_DEV_PERI] = { 0x411f0000, 0x10000 }, }; static void opentitan_board_init(MachineState *machine) @@ -217,6 +218,8 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) memmap[IBEX_DEV_NMI_GEN].base, memmap[IBEX_DEV_NMI_GEN].size); create_unimplemented_device("riscv.lowrisc.ibex.otbn", memmap[IBEX_DEV_OTBN].base, memmap[IBEX_DEV_OTBN].size); + create_unimplemented_device("riscv.lowrisc.ibex.peri", + memmap[IBEX_DEV_PERI].base, memmap[IBEX_DEV_PERI].size); } static void lowrisc_ibex_soc_class_init(ObjectClass *oc, void *data) From patchwork Mon Jul 12 22:53:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1504276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=IOmsVN7r; 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 4GNzjm5yyyz9sWd for ; Tue, 13 Jul 2021 08:59:40 +1000 (AEST) Received: from localhost ([::1]:55982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m34tm-000827-Jk for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2021 18:59:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oO-0005Ul-DU for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:04 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m34oL-0006rU-Ix for qemu-devel@nongnu.org; Mon, 12 Jul 2021 18:54:04 -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=1626130442; x=1657666442; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z/ClrNoVNTB6Ni1MIH2PRYQ8QXs+hHuddAsSsBZMUC8=; b=IOmsVN7rXPUzRhjot+qcMvdr/2pZzkqOrgICc6uFVfFdv4q9TNtt1NhA HWaPUX0dBoj0FlBYKoS/H/7b+vbnZ6WUg71rBYBHYt1JOEZbMKCP52VYE CnoixNb4MfRy11fW/HJ/DHHHbYH8nr1irQmt0mHDz89HBtaXPYSmsxfFF DWIqazx2XZHERZrsvw3ULhsBC72X7mbVrxsnl3nJrwuZxWKEONE1N4nHH 5yb1uXGz4ONgOWYswxxVVrXs3WrDY5or+gNlqEjXG/GyzQTMXsa7Qi95t TtC2wRu1IL4X48dD2DhfZPuuTUfbBLBfhJfXNdBRr1iKFO9V14ZVRxP0s w==; IronPort-SDR: m2tHA/jJJMQjUWxPpuj6aWY6cuj9hfFwzQRPoF1NgWc2Qw4yXuOWp101hHKevEj21vJhaOaLzc O/PLvhVrhY4LkIC2ym9v/8WAg4tEjAvtjvZe/HEiyQ6GJG8qURoEIVqdS8Qv3wuX1Vxd/R0cF/ 845cuShNNHGbZ9DP2+rtZcavHrn4f8v80fXCuEiJYpSt5NY3wWy6Ms1fP1/dY6CzfL5Gqpci+o HIPJIgYMYT1Ul9dnbooGAIIFDCnnm2GUDT6yqpdUlHoRvq3kOXpBbBWNbILBfV92D33J8S2S8g ljY= X-IronPort-AV: E=Sophos;i="5.84,235,1620662400"; d="scan'208";a="174973311" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 Jul 2021 06:53:53 +0800 IronPort-SDR: m+zk5QR2QfSm7wbv+loSJSseOVMpEL/Y8wfQ7xvcgoNprlFxgptOJVMtsyfsOJr3Zqg4fJcSXi F8D41IlQU3HSHpGPn4v/VEgkQ46TnDAdln9QnnKWUe98UGLp9okx+n3bUkRG0XPyFcUusJlIOO Xl/KQonuhohgbQNM+My3BzC0/H5hw/lM/Xp/7BZSktIGFFcjKY3g68iczwHuxnrEVvZw8plsIN xvu6OWjhz7eS1BmFpM/1MY2Ix/cMDmEW5+hbnzpy6DGt3XADhc8QrV/0stgIGyOIn+lm9rApWF arP7TDiuB9wacz3RIloTW0Ik Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 15:31:59 -0700 IronPort-SDR: cdh3qVTW8ZFbUWiAN3/FDdlZMfZhgIEG+Mf7OpBGrUNg1RxRVSE5gpdSq3oV//Zs1V6heMgGeR f+gSL6/v913OTMrhyGySuBiPWpwMPi62OocirMZKqC+YwMB2vpH6kTH1inItopBHbIBorIEUTF KLLM9FrWn+Tv2oPR96YGP1AM4ryt7jiGJUf+phe6lySoi2ARgFiUMq70htpnyOvpJSSE2khHah i8J0bgrZyiFuaWvwi8p9tYc1qZ5ZONhHjxrQRkuKeohiyn8Va/NOztVgJMt1C6UoQGsG0YT495 uz8= WDCIronportException: Internal Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.248]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Jul 2021 15:53:53 -0700 From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 11/11] hw/riscv: opentitan: Add the flash alias Date: Mon, 12 Jul 2021 15:53:48 -0700 Message-Id: <20210712225348.213819-12-alistair.francis@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712225348.213819-1-alistair.francis@wdc.com> References: <20210712225348.213819-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=820a0e1fd=alistair.francis@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, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" OpenTitan has an alias of flash avaliable which is called virtual flash. Add support for that in the QEMU model. Signed-off-by: Alistair Francis Reviewed-by: Bin Meng Message-id: c9cfbd2dd840fd0076877b8ea4d6dcfce60db5e9.1625801868.git.alistair.francis@wdc.com --- include/hw/riscv/opentitan.h | 2 ++ hw/riscv/opentitan.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index a488f5e8ec..9f93bebdac 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -40,6 +40,7 @@ struct LowRISCIbexSoCState { MemoryRegion flash_mem; MemoryRegion rom; + MemoryRegion flash_alias; }; typedef struct OpenTitanState { @@ -54,6 +55,7 @@ enum { IBEX_DEV_ROM, IBEX_DEV_RAM, IBEX_DEV_FLASH, + IBEX_DEV_FLASH_VIRTUAL, IBEX_DEV_UART, IBEX_DEV_GPIO, IBEX_DEV_SPI, diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 933c211b11..36a41c8b5b 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -59,6 +59,7 @@ static const MemMapEntry ibex_memmap[] = { [IBEX_DEV_NMI_GEN] = { 0x411c0000, 0x1000 }, [IBEX_DEV_OTBN] = { 0x411d0000, 0x10000 }, [IBEX_DEV_PERI] = { 0x411f0000, 0x10000 }, + [IBEX_DEV_FLASH_VIRTUAL] = { 0x80000000, 0x80000 }, }; static void opentitan_board_init(MachineState *machine) @@ -134,8 +135,13 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) /* Flash memory */ memory_region_init_rom(&s->flash_mem, OBJECT(dev_soc), "riscv.lowrisc.ibex.flash", memmap[IBEX_DEV_FLASH].size, &error_fatal); + memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc), + "riscv.lowrisc.ibex.flash_virtual", &s->flash_mem, 0, + memmap[IBEX_DEV_FLASH_VIRTUAL].size); memory_region_add_subregion(sys_mem, memmap[IBEX_DEV_FLASH].base, &s->flash_mem); + memory_region_add_subregion(sys_mem, memmap[IBEX_DEV_FLASH_VIRTUAL].base, + &s->flash_alias); /* PLIC */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->plic), errp)) {