[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 05/11] target/riscv: Update CSR xip in CLIC mode
From: |
LIU Zhiwei |
Subject: |
[RFC PATCH 05/11] target/riscv: Update CSR xip in CLIC mode |
Date: |
Fri, 9 Apr 2021 15:48:51 +0800 |
The xip CSR appears hardwired to zero in CLIC mode, replaced by separate
memory-mapped interrupt pendings (clicintip[i]). Writes to xip will be
ignored and will not trap (i.e., no access faults).
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
---
target/riscv/csr.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 74bc7a08aa..f6c84b9fe4 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -735,6 +735,11 @@ static int rmw_mip(CPURISCVState *env, int csrno,
target_ulong *ret_value,
target_ulong mask = write_mask & delegable_ints & ~env->miclaim;
uint32_t old_mip;
+ /* The xip CSR appears hardwired to zero in CLIC mode. (Section 4.3) */
+ if (riscv_clic_is_clic_mode(env)) {
+ *ret_value = 0;
+ return 0;
+ }
if (mask) {
old_mip = riscv_cpu_update_mip(cpu, mask, (new_value & mask));
} else {
@@ -922,6 +927,11 @@ static int rmw_sip(CPURISCVState *env, int csrno,
target_ulong *ret_value,
if (riscv_cpu_virt_enabled(env)) {
ret = rmw_vsip(env, CSR_VSIP, ret_value, new_value, write_mask);
} else {
+ /* The xip CSR appears hardwired to zero in CLIC mode. (Section 4.3) */
+ if (riscv_clic_is_clic_mode(env)) {
+ *ret_value = 0;
+ return 0;
+ }
ret = rmw_mip(env, CSR_MSTATUS, ret_value, new_value,
write_mask & env->mideleg & sip_writable_mask);
}
--
2.25.1
- [RFC PATCH 00/11] RISC-V: support clic v0.9 specification, LIU Zhiwei, 2021/04/09
- [RFC PATCH 04/11] target/riscv: Update CSR xie in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 01/11] target/riscv: Add CLIC CSR mintstatus, LIU Zhiwei, 2021/04/09
- [RFC PATCH 08/11] target/riscv: Update CSR xnxti in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 05/11] target/riscv: Update CSR xip in CLIC mode,
LIU Zhiwei <=
- [RFC PATCH 09/11] target/riscv: Update CSR mclicbase in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 06/11] target/riscv: Update CSR xtvec in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 07/11] target/riscv: Update CSR xtvt in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 10/11] target/riscv: Update interrupt handling in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 11/11] target/riscv: Update interrupt return in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 02/11] target/riscv: Update CSR xintthresh in CLIC mode, LIU Zhiwei, 2021/04/09
- [RFC PATCH 03/11] hw/intc: Add CLIC device, LIU Zhiwei, 2021/04/09