1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | From: Alistair Francis <alistair.francis@wdc.com> |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit c5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1: | 3 | The following changes since commit 3757b0d08b399c609954cf57f273b1167e5d7a8d: |
4 | 4 | ||
5 | Merge tag 'qemu-sparc-20211121' of git://github.com/mcayland/qemu into staging (2021-11-21 14:12:25 +0100) | 5 | Merge tag 'pull-request-2022-05-18' of https://gitlab.com/thuth/qemu into staging (2022-05-20 08:04:30 -0700) |
6 | 6 | ||
7 | are available in the Git repository at: | 7 | are available in the Git repository at: |
8 | 8 | ||
9 | git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122 | 9 | git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20220525 |
10 | 10 | ||
11 | for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3: | 11 | for you to fetch changes up to 8fe63fe8e512d77583d6798acd2164f1fa1e40ab: |
12 | 12 | ||
13 | hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset (2021-11-22 10:46:22 +1000) | 13 | hw/core: loader: Set is_linux to true for VxWorks uImage (2022-05-24 10:38:50 +1000) |
14 | 14 | ||
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | Seventh RISC-V PR for QEMU 6.2 | 16 | Third RISC-V PR for QEMU 7.1 |
17 | 17 | ||
18 | - Deprecate IF_NONE for SiFive OTP | 18 | * Fixes for accessing VS hypervisor CSRs |
19 | - Don't reset SiFive OTP content | 19 | * Improvements for RISC-V Vector extension |
20 | * Fixes for accessing mtimecmp | ||
21 | * Add new short-isa-string CPU option | ||
22 | * Improvements to RISC-V machine error handling | ||
23 | * Disable the "G" extension by default internally, no functional change | ||
24 | * Enforce floating point extension requirements | ||
25 | * Cleanup ISA extension checks | ||
26 | * Resolve redundant property accessors | ||
27 | * Fix typo of mimpid cpu option | ||
28 | * Improvements for virtulisation | ||
29 | * Add zicsr/zifencei to isa_string | ||
30 | * Support for VxWorks uImage | ||
20 | 31 | ||
21 | ---------------------------------------------------------------- | 32 | ---------------------------------------------------------------- |
22 | Philippe Mathieu-Daudé (1): | 33 | Anup Patel (4): |
23 | hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset | 34 | target/riscv: Fix csr number based privilege checking |
35 | target/riscv: Fix hstatus.GVA bit setting for traps taken from HS-mode | ||
36 | target/riscv: Set [m|s]tval for both illegal and virtual instruction traps | ||
37 | hw/riscv: virt: Fix interrupt parent for dynamic platform devices | ||
24 | 38 | ||
25 | Thomas Huth (1): | 39 | Atish Patra (1): |
26 | hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE | 40 | hw/intc: Pass correct hartid while updating mtimecmp |
27 | 41 | ||
28 | docs/about/deprecated.rst | 6 ++++++ | 42 | Bernhard Beschow (2): |
29 | hw/misc/sifive_u_otp.c | 22 +++++++++++++--------- | 43 | hw/vfio/pci-quirks: Resolve redundant property getters |
30 | 2 files changed, 19 insertions(+), 9 deletions(-) | 44 | hw/riscv/sifive_u: Resolve redundant property accessors |
31 | 45 | ||
46 | Bin Meng (2): | ||
47 | hw/core: Sync uboot_image.h from U-Boot v2022.01 | ||
48 | hw/core: loader: Set is_linux to true for VxWorks uImage | ||
49 | |||
50 | Dylan Reid (1): | ||
51 | target/riscv: Fix VS mode hypervisor CSR access | ||
52 | |||
53 | Frank Chang (1): | ||
54 | target/riscv: Fix typo of mimpid cpu option | ||
55 | |||
56 | Hongren (Zenithal) Zheng (1): | ||
57 | target/riscv: add zicsr/zifencei to isa_string | ||
58 | |||
59 | Tsukasa OI (9): | ||
60 | target/riscv: Move Zhinx* extensions on ISA string | ||
61 | target/riscv: Add short-isa-string option | ||
62 | hw/riscv: Make CPU config error handling generous (virt/spike) | ||
63 | hw/riscv: Make CPU config error handling generous (sifive_e/u/opentitan) | ||
64 | target/riscv: Fix coding style on "G" expansion | ||
65 | target/riscv: Disable "G" by default | ||
66 | target/riscv: Change "G" expansion | ||
67 | target/riscv: FP extension requirements | ||
68 | target/riscv: Move/refactor ISA extension checks | ||
69 | |||
70 | Weiwei Li (1): | ||
71 | target/riscv: check 'I' and 'E' after checking 'G' in riscv_cpu_realize | ||
72 | |||
73 | eopXD (1): | ||
74 | target/riscv: rvv: Fix early exit condition for whole register load/store | ||
75 | |||
76 | hw/core/uboot_image.h | 213 +++++++++++++++++++++----------- | ||
77 | target/riscv/cpu.h | 12 +- | ||
78 | hw/core/loader.c | 15 +++ | ||
79 | hw/intc/riscv_aclint.c | 3 +- | ||
80 | hw/riscv/opentitan.c | 2 +- | ||
81 | hw/riscv/sifive_e.c | 2 +- | ||
82 | hw/riscv/sifive_u.c | 28 +---- | ||
83 | hw/riscv/spike.c | 2 +- | ||
84 | hw/riscv/virt.c | 27 ++-- | ||
85 | hw/vfio/pci-quirks.c | 34 ++--- | ||
86 | target/riscv/cpu.c | 91 ++++++++++---- | ||
87 | target/riscv/cpu_helper.c | 4 +- | ||
88 | target/riscv/csr.c | 26 ++-- | ||
89 | target/riscv/translate.c | 17 ++- | ||
90 | target/riscv/insn_trans/trans_rvv.c.inc | 58 +++++---- | ||
91 | 15 files changed, 325 insertions(+), 209 deletions(-) | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Dylan Reid <dylan@rivosinc.com> | ||
1 | 2 | ||
3 | VS mode access to hypervisor CSRs should generate virtual, not illegal, | ||
4 | instruction exceptions. | ||
5 | |||
6 | Don't return early and indicate an illegal instruction exception when | ||
7 | accessing a hypervisor CSR from VS mode. Instead, fall through to the | ||
8 | `hmode` predicate to return the correct virtual instruction exception. | ||
9 | |||
10 | Signed-off-by: Dylan Reid <dgreid@rivosinc.com> | ||
11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
12 | Message-Id: <20220506165456.297058-1-dgreid@rivosinc.com> | ||
13 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | --- | ||
15 | target/riscv/csr.c | 10 +++++----- | ||
16 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
17 | |||
18 | diff --git a/target/riscv/csr.c b/target/riscv/csr.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/riscv/csr.c | ||
21 | +++ b/target/riscv/csr.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static inline RISCVException riscv_csrrw_check(CPURISCVState *env, | ||
23 | #if !defined(CONFIG_USER_ONLY) | ||
24 | int effective_priv = env->priv; | ||
25 | |||
26 | - if (riscv_has_ext(env, RVH) && | ||
27 | - env->priv == PRV_S && | ||
28 | - !riscv_cpu_virt_enabled(env)) { | ||
29 | + if (riscv_has_ext(env, RVH) && env->priv == PRV_S) { | ||
30 | /* | ||
31 | - * We are in S mode without virtualisation, therefore we are in HS Mode. | ||
32 | + * We are in either HS or VS mode. | ||
33 | * Add 1 to the effective privledge level to allow us to access the | ||
34 | - * Hypervisor CSRs. | ||
35 | + * Hypervisor CSRs. The `hmode` predicate will determine if access | ||
36 | + * should be allowed(HS) or if a virtual instruction exception should be | ||
37 | + * raised(VS). | ||
38 | */ | ||
39 | effective_priv++; | ||
40 | } | ||
41 | -- | ||
42 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: eopXD <eop.chen@sifive.com> | ||
1 | 2 | ||
3 | Vector whole register load instructions have EEW encoded in the opcode, | ||
4 | so we shouldn't take SEW here. Vector whole register store instructions | ||
5 | are always EEW=8. | ||
6 | |||
7 | Signed-off-by: eop Chen <eop.chen@sifive.com> | ||
8 | Reviewed-by: Frank Chang <frank.chang@sifive.com> | ||
9 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-Id: <165181414065.18540.14828125053334599921-0@git.sr.ht> | ||
11 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
12 | --- | ||
13 | target/riscv/insn_trans/trans_rvv.c.inc | 58 +++++++++++++------------ | ||
14 | 1 file changed, 31 insertions(+), 27 deletions(-) | ||
15 | |||
16 | diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/riscv/insn_trans/trans_rvv.c.inc | ||
19 | +++ b/target/riscv/insn_trans/trans_rvv.c.inc | ||
20 | @@ -XXX,XX +XXX,XX @@ GEN_VEXT_TRANS(vle64ff_v, MO_64, r2nfvm, ldff_op, ld_us_check) | ||
21 | typedef void gen_helper_ldst_whole(TCGv_ptr, TCGv, TCGv_env, TCGv_i32); | ||
22 | |||
23 | static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf, | ||
24 | - gen_helper_ldst_whole *fn, DisasContext *s, | ||
25 | - bool is_store) | ||
26 | + uint32_t width, gen_helper_ldst_whole *fn, | ||
27 | + DisasContext *s, bool is_store) | ||
28 | { | ||
29 | - uint32_t evl = (s->cfg_ptr->vlen / 8) * nf / (1 << s->sew); | ||
30 | + uint32_t evl = (s->cfg_ptr->vlen / 8) * nf / width; | ||
31 | TCGLabel *over = gen_new_label(); | ||
32 | tcg_gen_brcondi_tl(TCG_COND_GEU, cpu_vstart, evl, over); | ||
33 | |||
34 | @@ -XXX,XX +XXX,XX @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf, | ||
35 | * load and store whole register instructions ignore vtype and vl setting. | ||
36 | * Thus, we don't need to check vill bit. (Section 7.9) | ||
37 | */ | ||
38 | -#define GEN_LDST_WHOLE_TRANS(NAME, ARG_NF, IS_STORE) \ | ||
39 | +#define GEN_LDST_WHOLE_TRANS(NAME, ARG_NF, WIDTH, IS_STORE) \ | ||
40 | static bool trans_##NAME(DisasContext *s, arg_##NAME * a) \ | ||
41 | { \ | ||
42 | if (require_rvv(s) && \ | ||
43 | QEMU_IS_ALIGNED(a->rd, ARG_NF)) { \ | ||
44 | - return ldst_whole_trans(a->rd, a->rs1, ARG_NF, gen_helper_##NAME, \ | ||
45 | - s, IS_STORE); \ | ||
46 | + return ldst_whole_trans(a->rd, a->rs1, ARG_NF, WIDTH, \ | ||
47 | + gen_helper_##NAME, s, IS_STORE); \ | ||
48 | } \ | ||
49 | return false; \ | ||
50 | } | ||
51 | |||
52 | -GEN_LDST_WHOLE_TRANS(vl1re8_v, 1, false) | ||
53 | -GEN_LDST_WHOLE_TRANS(vl1re16_v, 1, false) | ||
54 | -GEN_LDST_WHOLE_TRANS(vl1re32_v, 1, false) | ||
55 | -GEN_LDST_WHOLE_TRANS(vl1re64_v, 1, false) | ||
56 | -GEN_LDST_WHOLE_TRANS(vl2re8_v, 2, false) | ||
57 | -GEN_LDST_WHOLE_TRANS(vl2re16_v, 2, false) | ||
58 | -GEN_LDST_WHOLE_TRANS(vl2re32_v, 2, false) | ||
59 | -GEN_LDST_WHOLE_TRANS(vl2re64_v, 2, false) | ||
60 | -GEN_LDST_WHOLE_TRANS(vl4re8_v, 4, false) | ||
61 | -GEN_LDST_WHOLE_TRANS(vl4re16_v, 4, false) | ||
62 | -GEN_LDST_WHOLE_TRANS(vl4re32_v, 4, false) | ||
63 | -GEN_LDST_WHOLE_TRANS(vl4re64_v, 4, false) | ||
64 | -GEN_LDST_WHOLE_TRANS(vl8re8_v, 8, false) | ||
65 | -GEN_LDST_WHOLE_TRANS(vl8re16_v, 8, false) | ||
66 | -GEN_LDST_WHOLE_TRANS(vl8re32_v, 8, false) | ||
67 | -GEN_LDST_WHOLE_TRANS(vl8re64_v, 8, false) | ||
68 | - | ||
69 | -GEN_LDST_WHOLE_TRANS(vs1r_v, 1, true) | ||
70 | -GEN_LDST_WHOLE_TRANS(vs2r_v, 2, true) | ||
71 | -GEN_LDST_WHOLE_TRANS(vs4r_v, 4, true) | ||
72 | -GEN_LDST_WHOLE_TRANS(vs8r_v, 8, true) | ||
73 | +GEN_LDST_WHOLE_TRANS(vl1re8_v, 1, 1, false) | ||
74 | +GEN_LDST_WHOLE_TRANS(vl1re16_v, 1, 2, false) | ||
75 | +GEN_LDST_WHOLE_TRANS(vl1re32_v, 1, 4, false) | ||
76 | +GEN_LDST_WHOLE_TRANS(vl1re64_v, 1, 8, false) | ||
77 | +GEN_LDST_WHOLE_TRANS(vl2re8_v, 2, 1, false) | ||
78 | +GEN_LDST_WHOLE_TRANS(vl2re16_v, 2, 2, false) | ||
79 | +GEN_LDST_WHOLE_TRANS(vl2re32_v, 2, 4, false) | ||
80 | +GEN_LDST_WHOLE_TRANS(vl2re64_v, 2, 8, false) | ||
81 | +GEN_LDST_WHOLE_TRANS(vl4re8_v, 4, 1, false) | ||
82 | +GEN_LDST_WHOLE_TRANS(vl4re16_v, 4, 2, false) | ||
83 | +GEN_LDST_WHOLE_TRANS(vl4re32_v, 4, 4, false) | ||
84 | +GEN_LDST_WHOLE_TRANS(vl4re64_v, 4, 8, false) | ||
85 | +GEN_LDST_WHOLE_TRANS(vl8re8_v, 8, 1, false) | ||
86 | +GEN_LDST_WHOLE_TRANS(vl8re16_v, 8, 2, false) | ||
87 | +GEN_LDST_WHOLE_TRANS(vl8re32_v, 8, 4, false) | ||
88 | +GEN_LDST_WHOLE_TRANS(vl8re64_v, 8, 8, false) | ||
89 | + | ||
90 | +/* | ||
91 | + * The vector whole register store instructions are encoded similar to | ||
92 | + * unmasked unit-stride store of elements with EEW=8. | ||
93 | + */ | ||
94 | +GEN_LDST_WHOLE_TRANS(vs1r_v, 1, 1, true) | ||
95 | +GEN_LDST_WHOLE_TRANS(vs2r_v, 2, 1, true) | ||
96 | +GEN_LDST_WHOLE_TRANS(vs4r_v, 4, 1, true) | ||
97 | +GEN_LDST_WHOLE_TRANS(vs8r_v, 8, 1, true) | ||
98 | |||
99 | /* | ||
100 | *** Vector Integer Arithmetic Instructions | ||
101 | -- | ||
102 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Atish Patra <atishp@rivosinc.com> | ||
1 | 2 | ||
3 | timecmp update function should be invoked with hartid for which | ||
4 | timecmp is being updated. The following patch passes the incorrect | ||
5 | hartid to the update function. | ||
6 | |||
7 | Fixes: e2f01f3c2e13 ("hw/intc: Make RISC-V ACLINT mtime MMIO register writable") | ||
8 | |||
9 | Signed-off-by: Atish Patra <atishp@rivosinc.com> | ||
10 | Reviewed-by: Frank Chang <frank.chang@sifive.com> | ||
11 | Reviewed-by: Anup Patel <anup@brainfault.org> | ||
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Message-Id: <20220513221458.1192933-1-atishp@rivosinc.com> | ||
14 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
15 | --- | ||
16 | hw/intc/riscv_aclint.c | 3 ++- | ||
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/intc/riscv_aclint.c | ||
22 | +++ b/hw/intc/riscv_aclint.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr, | ||
24 | continue; | ||
25 | } | ||
26 | riscv_aclint_mtimer_write_timecmp(mtimer, RISCV_CPU(cpu), | ||
27 | - i, env->timecmp); | ||
28 | + mtimer->hartid_base + i, | ||
29 | + env->timecmp); | ||
30 | } | ||
31 | return; | ||
32 | } | ||
33 | -- | ||
34 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | This commit moves ISA string conversion for Zhinx and Zhinxmin extensions. | ||
4 | Because extension category ordering of "H" is going to be after "V", | ||
5 | their ordering is going to be valid (on canonical order). | ||
6 | |||
7 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
8 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-Id: <7a988aedb249b6709f9ce5464ff359b60958ca54.1652181972.git.research_trasio@irq.a4lg.com> | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | --- | ||
12 | target/riscv/cpu.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/riscv/cpu.c | ||
18 | +++ b/target/riscv/cpu.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char **isa_str, int max_str_len) | ||
20 | ISA_EDATA_ENTRY(zfh, ext_zfh), | ||
21 | ISA_EDATA_ENTRY(zfhmin, ext_zfhmin), | ||
22 | ISA_EDATA_ENTRY(zfinx, ext_zfinx), | ||
23 | - ISA_EDATA_ENTRY(zhinx, ext_zhinx), | ||
24 | - ISA_EDATA_ENTRY(zhinxmin, ext_zhinxmin), | ||
25 | ISA_EDATA_ENTRY(zdinx, ext_zdinx), | ||
26 | ISA_EDATA_ENTRY(zba, ext_zba), | ||
27 | ISA_EDATA_ENTRY(zbb, ext_zbb), | ||
28 | @@ -XXX,XX +XXX,XX @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char **isa_str, int max_str_len) | ||
29 | ISA_EDATA_ENTRY(zkt, ext_zkt), | ||
30 | ISA_EDATA_ENTRY(zve32f, ext_zve32f), | ||
31 | ISA_EDATA_ENTRY(zve64f, ext_zve64f), | ||
32 | + ISA_EDATA_ENTRY(zhinx, ext_zhinx), | ||
33 | + ISA_EDATA_ENTRY(zhinxmin, ext_zhinxmin), | ||
34 | ISA_EDATA_ENTRY(svinval, ext_svinval), | ||
35 | ISA_EDATA_ENTRY(svnapot, ext_svnapot), | ||
36 | ISA_EDATA_ENTRY(svpbmt, ext_svpbmt), | ||
37 | -- | ||
38 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | Because some operating systems don't correctly parse long ISA extension | ||
4 | string, this commit adds short-isa-string boolean option to disable | ||
5 | generating long ISA extension strings on Device Tree. | ||
6 | |||
7 | For instance, enabling Zfinx and Zdinx extensions and booting Linux (5.17 or | ||
8 | earlier) with FPU support caused a kernel panic. | ||
9 | |||
10 | Operating Systems which short-isa-string might be helpful: | ||
11 | |||
12 | 1. Linux (5.17 or earlier) | ||
13 | 2. FreeBSD (at least 14.0-CURRENT) | ||
14 | 3. OpenBSD (at least current development version) | ||
15 | |||
16 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
17 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
18 | Message-Id: <7c1fe5f06b0a7646a47e9bcdddb1042bb60c69c8.1652181972.git.research_trasio@irq.a4lg.com> | ||
19 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
20 | --- | ||
21 | target/riscv/cpu.h | 2 ++ | ||
22 | target/riscv/cpu.c | 6 +++++- | ||
23 | 2 files changed, 7 insertions(+), 1 deletion(-) | ||
24 | |||
25 | diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/target/riscv/cpu.h | ||
28 | +++ b/target/riscv/cpu.h | ||
29 | @@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig { | ||
30 | bool aia; | ||
31 | bool debug; | ||
32 | uint64_t resetvec; | ||
33 | + | ||
34 | + bool short_isa_string; | ||
35 | }; | ||
36 | |||
37 | typedef struct RISCVCPUConfig RISCVCPUConfig; | ||
38 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/riscv/cpu.c | ||
41 | +++ b/target/riscv/cpu.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = { | ||
43 | DEFINE_PROP_BOOL("x-aia", RISCVCPU, cfg.aia, false), | ||
44 | |||
45 | DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC), | ||
46 | + | ||
47 | + DEFINE_PROP_BOOL("short-isa-string", RISCVCPU, cfg.short_isa_string, false), | ||
48 | DEFINE_PROP_END_OF_LIST(), | ||
49 | }; | ||
50 | |||
51 | @@ -XXX,XX +XXX,XX @@ char *riscv_isa_string(RISCVCPU *cpu) | ||
52 | } | ||
53 | } | ||
54 | *p = '\0'; | ||
55 | - riscv_isa_string_ext(cpu, &isa_str, maxlen); | ||
56 | + if (!cpu->cfg.short_isa_string) { | ||
57 | + riscv_isa_string_ext(cpu, &isa_str, maxlen); | ||
58 | + } | ||
59 | return isa_str; | ||
60 | } | ||
61 | |||
62 | -- | ||
63 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | If specified CPU configuration is not valid, not just it prints error | ||
4 | message, it aborts and generates core dumps (depends on the operating | ||
5 | system). This kind of error handling should be used only when a serious | ||
6 | runtime error occurs. | ||
7 | |||
8 | This commit makes error handling on CPU configuration more generous on | ||
9 | virt/spike machines. It now just prints error message and quits (without | ||
10 | coredumps and aborts). | ||
11 | |||
12 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Message-Id: <d17381d3ea4992808cf1894f379ca67220f61b45.1652509778.git.research_trasio@irq.a4lg.com> | ||
15 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
16 | --- | ||
17 | hw/riscv/spike.c | 2 +- | ||
18 | hw/riscv/virt.c | 2 +- | ||
19 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/riscv/spike.c | ||
24 | +++ b/hw/riscv/spike.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void spike_board_init(MachineState *machine) | ||
26 | base_hartid, &error_abort); | ||
27 | object_property_set_int(OBJECT(&s->soc[i]), "num-harts", | ||
28 | hart_count, &error_abort); | ||
29 | - sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_abort); | ||
30 | + sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal); | ||
31 | |||
32 | /* Core Local Interruptor (timer and IPI) for each socket */ | ||
33 | riscv_aclint_swi_create( | ||
34 | diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/hw/riscv/virt.c | ||
37 | +++ b/hw/riscv/virt.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_init(MachineState *machine) | ||
39 | base_hartid, &error_abort); | ||
40 | object_property_set_int(OBJECT(&s->soc[i]), "num-harts", | ||
41 | hart_count, &error_abort); | ||
42 | - sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_abort); | ||
43 | + sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal); | ||
44 | |||
45 | if (!kvm_enabled()) { | ||
46 | if (s->have_aclint) { | ||
47 | -- | ||
48 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | If specified CPU configuration is not valid, not just it prints error | ||
4 | message, it aborts and generates core dumps (depends on the operating | ||
5 | system). This kind of error handling should be used only when a serious | ||
6 | runtime error occurs. | ||
7 | |||
8 | This commit makes error handling on CPU configuration more generous on | ||
9 | sifive_e/u and opentitan machines. It now just prints error message and | ||
10 | quits (without coredumps and aborts). | ||
11 | |||
12 | This is separate from spike/virt because it involves different type | ||
13 | (TYPE_RISCV_HART_ARRAY) on sifive_e/u and opentitan machines. | ||
14 | |||
15 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
16 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
17 | Message-Id: <09e61e58a7543da44bdb0e0f5368afc8903b4aa6.1652509778.git.research_trasio@irq.a4lg.com> | ||
18 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
19 | --- | ||
20 | hw/riscv/opentitan.c | 2 +- | ||
21 | hw/riscv/sifive_e.c | 2 +- | ||
22 | hw/riscv/sifive_u.c | 4 ++-- | ||
23 | 3 files changed, 4 insertions(+), 4 deletions(-) | ||
24 | |||
25 | diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/riscv/opentitan.c | ||
28 | +++ b/hw/riscv/opentitan.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) | ||
30 | object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus, | ||
31 | &error_abort); | ||
32 | object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x8080, &error_abort); | ||
33 | - sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_abort); | ||
34 | + sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal); | ||
35 | |||
36 | /* Boot ROM */ | ||
37 | memory_region_init_rom(&s->rom, OBJECT(dev_soc), "riscv.lowrisc.ibex.rom", | ||
38 | diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/riscv/sifive_e.c | ||
41 | +++ b/hw/riscv/sifive_e.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp) | ||
43 | |||
44 | object_property_set_str(OBJECT(&s->cpus), "cpu-type", ms->cpu_type, | ||
45 | &error_abort); | ||
46 | - sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_abort); | ||
47 | + sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal); | ||
48 | |||
49 | /* Mask ROM */ | ||
50 | memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom", | ||
51 | diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/riscv/sifive_u.c | ||
54 | +++ b/hw/riscv/sifive_u.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) | ||
56 | qdev_prop_set_string(DEVICE(&s->u_cpus), "cpu-type", s->cpu_type); | ||
57 | qdev_prop_set_uint64(DEVICE(&s->u_cpus), "resetvec", 0x1004); | ||
58 | |||
59 | - sysbus_realize(SYS_BUS_DEVICE(&s->e_cpus), &error_abort); | ||
60 | - sysbus_realize(SYS_BUS_DEVICE(&s->u_cpus), &error_abort); | ||
61 | + sysbus_realize(SYS_BUS_DEVICE(&s->e_cpus), &error_fatal); | ||
62 | + sysbus_realize(SYS_BUS_DEVICE(&s->u_cpus), &error_fatal); | ||
63 | /* | ||
64 | * The cluster must be realized after the RISC-V hart array container, | ||
65 | * as the container's CPU object is only created on realize, and the | ||
66 | -- | ||
67 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | Because ext_? members are boolean variables, operator `&&' should be | ||
4 | used instead of `&'. | ||
5 | |||
6 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Víctor Colombo <victor.colombo@eldorado.org.br> | ||
9 | Message-Id: <91633f8349253656dd08bc8dc36498a9c7538b10.1652583332.git.research_trasio@irq.a4lg.com> | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | --- | ||
12 | target/riscv/cpu.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/riscv/cpu.c | ||
18 | +++ b/target/riscv/cpu.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
20 | return; | ||
21 | } | ||
22 | |||
23 | - if (cpu->cfg.ext_g && !(cpu->cfg.ext_i & cpu->cfg.ext_m & | ||
24 | - cpu->cfg.ext_a & cpu->cfg.ext_f & | ||
25 | + if (cpu->cfg.ext_g && !(cpu->cfg.ext_i && cpu->cfg.ext_m && | ||
26 | + cpu->cfg.ext_a && cpu->cfg.ext_f && | ||
27 | cpu->cfg.ext_d)) { | ||
28 | warn_report("Setting G will also set IMAFD"); | ||
29 | cpu->cfg.ext_i = true; | ||
30 | -- | ||
31 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | Because "G" virtual extension expands to "IMAFD", we cannot separately | ||
4 | disable extensions like "F" or "D" without disabling "G". Because all | ||
5 | "IMAFD" are enabled by default, it's harmless to disable "G" by default. | ||
6 | |||
7 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-Id: <cab7205f1d7668f642fa242386543334af6bc1bd.1652583332.git.research_trasio@irq.a4lg.com> | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | --- | ||
12 | target/riscv/cpu.c | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/riscv/cpu.c | ||
18 | +++ b/target/riscv/cpu.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = { | ||
20 | /* Defaults for standard extensions */ | ||
21 | DEFINE_PROP_BOOL("i", RISCVCPU, cfg.ext_i, true), | ||
22 | DEFINE_PROP_BOOL("e", RISCVCPU, cfg.ext_e, false), | ||
23 | - DEFINE_PROP_BOOL("g", RISCVCPU, cfg.ext_g, true), | ||
24 | + DEFINE_PROP_BOOL("g", RISCVCPU, cfg.ext_g, false), | ||
25 | DEFINE_PROP_BOOL("m", RISCVCPU, cfg.ext_m, true), | ||
26 | DEFINE_PROP_BOOL("a", RISCVCPU, cfg.ext_a, true), | ||
27 | DEFINE_PROP_BOOL("f", RISCVCPU, cfg.ext_f, true), | ||
28 | -- | ||
29 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | On ISA version 20190608 or later, "G" expands to "IMAFD_Zicsr_Zifencei". | ||
4 | Both "Zicsr" and "Zifencei" are enabled by default and "G" is supposed to | ||
5 | be (virtually) enabled as well, it should be safe to change its expansion. | ||
6 | |||
7 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-Id: <d1b5be550a2893a0fd32c928f832d2ff7bfafe35.1652583332.git.research_trasio@irq.a4lg.com> | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | --- | ||
12 | target/riscv/cpu.c | 7 +++++-- | ||
13 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/riscv/cpu.c | ||
18 | +++ b/target/riscv/cpu.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
20 | |||
21 | if (cpu->cfg.ext_g && !(cpu->cfg.ext_i && cpu->cfg.ext_m && | ||
22 | cpu->cfg.ext_a && cpu->cfg.ext_f && | ||
23 | - cpu->cfg.ext_d)) { | ||
24 | - warn_report("Setting G will also set IMAFD"); | ||
25 | + cpu->cfg.ext_d && | ||
26 | + cpu->cfg.ext_icsr && cpu->cfg.ext_ifencei)) { | ||
27 | + warn_report("Setting G will also set IMAFD_Zicsr_Zifencei"); | ||
28 | cpu->cfg.ext_i = true; | ||
29 | cpu->cfg.ext_m = true; | ||
30 | cpu->cfg.ext_a = true; | ||
31 | cpu->cfg.ext_f = true; | ||
32 | cpu->cfg.ext_d = true; | ||
33 | + cpu->cfg.ext_icsr = true; | ||
34 | + cpu->cfg.ext_ifencei = true; | ||
35 | } | ||
36 | |||
37 | if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinx || | ||
38 | -- | ||
39 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | QEMU allowed inconsistent configurations that made floating point | ||
4 | arithmetic effectively unusable. | ||
5 | |||
6 | This commit adds certain checks for consistent FP arithmetic: | ||
7 | |||
8 | - F requires Zicsr | ||
9 | - Zfinx requires Zicsr | ||
10 | - Zfh/Zfhmin require F | ||
11 | - D requires F | ||
12 | - V requires D | ||
13 | |||
14 | Because F/D/Zicsr are enabled by default (and an error will not occur unless | ||
15 | we manually disable one or more of prerequisites), this commit just enforces | ||
16 | the user to give consistent combinations. | ||
17 | |||
18 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
19 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
20 | Message-Id: <00e7b1c6060dab32ac7d49813b1ca84d3eb63298.1652583332.git.research_trasio@irq.a4lg.com> | ||
21 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
22 | --- | ||
23 | target/riscv/cpu.c | 25 +++++++++++++++++++++++++ | ||
24 | 1 file changed, 25 insertions(+) | ||
25 | |||
26 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/riscv/cpu.c | ||
29 | +++ b/target/riscv/cpu.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
31 | cpu->cfg.ext_ifencei = true; | ||
32 | } | ||
33 | |||
34 | + if (cpu->cfg.ext_f && !cpu->cfg.ext_icsr) { | ||
35 | + error_setg(errp, "F extension requires Zicsr"); | ||
36 | + return; | ||
37 | + } | ||
38 | + | ||
39 | + if ((cpu->cfg.ext_zfh || cpu->cfg.ext_zfhmin) && !cpu->cfg.ext_f) { | ||
40 | + error_setg(errp, "Zfh/Zfhmin extensions require F extension"); | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | + if (cpu->cfg.ext_d && !cpu->cfg.ext_f) { | ||
45 | + error_setg(errp, "D extension requires F extension"); | ||
46 | + return; | ||
47 | + } | ||
48 | + | ||
49 | + if (cpu->cfg.ext_v && !cpu->cfg.ext_d) { | ||
50 | + error_setg(errp, "V extension requires D extension"); | ||
51 | + return; | ||
52 | + } | ||
53 | + | ||
54 | if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinx || | ||
55 | cpu->cfg.ext_zhinxmin) { | ||
56 | cpu->cfg.ext_zfinx = true; | ||
57 | } | ||
58 | |||
59 | + if (cpu->cfg.ext_zfinx && !cpu->cfg.ext_icsr) { | ||
60 | + error_setg(errp, "Zfinx extension requires Zicsr"); | ||
61 | + return; | ||
62 | + } | ||
63 | + | ||
64 | if (cpu->cfg.ext_zk) { | ||
65 | cpu->cfg.ext_zkn = true; | ||
66 | cpu->cfg.ext_zkr = true; | ||
67 | -- | ||
68 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
1 | 2 | ||
3 | We should separate "check" and "configure" steps as possible. | ||
4 | This commit separates both steps except vector/Zfinx-related checks. | ||
5 | |||
6 | Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-Id: <c3145fa37a529484cf3047c8cb9841e9effad4b0.1652583332.git.research_trasio@irq.a4lg.com> | ||
9 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | --- | ||
11 | target/riscv/cpu.c | 31 ++++++++++++++++--------------- | ||
12 | 1 file changed, 16 insertions(+), 15 deletions(-) | ||
13 | |||
14 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/riscv/cpu.c | ||
17 | +++ b/target/riscv/cpu.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
19 | return; | ||
20 | } | ||
21 | |||
22 | + if ((cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) && !cpu->cfg.ext_f) { | ||
23 | + error_setg(errp, "Zve32f/Zve64f extensions require F extension"); | ||
24 | + return; | ||
25 | + } | ||
26 | + | ||
27 | + /* Set the ISA extensions, checks should have happened above */ | ||
28 | if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinx || | ||
29 | cpu->cfg.ext_zhinxmin) { | ||
30 | cpu->cfg.ext_zfinx = true; | ||
31 | } | ||
32 | |||
33 | - if (cpu->cfg.ext_zfinx && !cpu->cfg.ext_icsr) { | ||
34 | - error_setg(errp, "Zfinx extension requires Zicsr"); | ||
35 | - return; | ||
36 | + if (cpu->cfg.ext_zfinx) { | ||
37 | + if (!cpu->cfg.ext_icsr) { | ||
38 | + error_setg(errp, "Zfinx extension requires Zicsr"); | ||
39 | + return; | ||
40 | + } | ||
41 | + if (cpu->cfg.ext_f) { | ||
42 | + error_setg(errp, | ||
43 | + "Zfinx cannot be supported together with F extension"); | ||
44 | + return; | ||
45 | + } | ||
46 | } | ||
47 | |||
48 | if (cpu->cfg.ext_zk) { | ||
49 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
50 | cpu->cfg.ext_zksh = true; | ||
51 | } | ||
52 | |||
53 | - /* Set the ISA extensions, checks should have happened above */ | ||
54 | if (cpu->cfg.ext_i) { | ||
55 | ext |= RVI; | ||
56 | } | ||
57 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
58 | } | ||
59 | set_vext_version(env, vext_version); | ||
60 | } | ||
61 | - if ((cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) && !cpu->cfg.ext_f) { | ||
62 | - error_setg(errp, "Zve32f/Zve64f extension depends upon RVF."); | ||
63 | - return; | ||
64 | - } | ||
65 | if (cpu->cfg.ext_j) { | ||
66 | ext |= RVJ; | ||
67 | } | ||
68 | - if (cpu->cfg.ext_zfinx && ((ext & (RVF | RVD)) || cpu->cfg.ext_zfh || | ||
69 | - cpu->cfg.ext_zfhmin)) { | ||
70 | - error_setg(errp, | ||
71 | - "'Zfinx' cannot be supported together with 'F', 'D', 'Zfh'," | ||
72 | - " 'Zfhmin'"); | ||
73 | - return; | ||
74 | - } | ||
75 | |||
76 | set_misa(env, env->misa_mxl, ext); | ||
77 | } | ||
78 | -- | ||
79 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Bernhard Beschow <shentey@gmail.com> | ||
1 | 2 | ||
3 | The QOM API already provides getters for uint64 and uint32 values, so reuse | ||
4 | them. | ||
5 | |||
6 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-Id: <20220301225220.239065-2-shentey@gmail.com> | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | --- | ||
12 | hw/vfio/pci-quirks.c | 34 +++++++++------------------------- | ||
13 | 1 file changed, 9 insertions(+), 25 deletions(-) | ||
14 | |||
15 | diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/vfio/pci-quirks.c | ||
18 | +++ b/hw/vfio/pci-quirks.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static int vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp) | ||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | -static void vfio_pci_nvlink2_get_tgt(Object *obj, Visitor *v, | ||
24 | - const char *name, | ||
25 | - void *opaque, Error **errp) | ||
26 | -{ | ||
27 | - uint64_t tgt = (uintptr_t) opaque; | ||
28 | - visit_type_uint64(v, name, &tgt, errp); | ||
29 | -} | ||
30 | - | ||
31 | -static void vfio_pci_nvlink2_get_link_speed(Object *obj, Visitor *v, | ||
32 | - const char *name, | ||
33 | - void *opaque, Error **errp) | ||
34 | -{ | ||
35 | - uint32_t link_speed = (uint32_t)(uintptr_t) opaque; | ||
36 | - visit_type_uint32(v, name, &link_speed, errp); | ||
37 | -} | ||
38 | - | ||
39 | int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev, Error **errp) | ||
40 | { | ||
41 | int ret; | ||
42 | @@ -XXX,XX +XXX,XX @@ int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev, Error **errp) | ||
43 | nv2reg->size, p); | ||
44 | QLIST_INSERT_HEAD(&vdev->bars[0].quirks, quirk, next); | ||
45 | |||
46 | - object_property_add(OBJECT(vdev), "nvlink2-tgt", "uint64", | ||
47 | - vfio_pci_nvlink2_get_tgt, NULL, NULL, | ||
48 | - (void *) (uintptr_t) cap->tgt); | ||
49 | + object_property_add_uint64_ptr(OBJECT(vdev), "nvlink2-tgt", | ||
50 | + (uint64_t *) &cap->tgt, | ||
51 | + OBJ_PROP_FLAG_READ); | ||
52 | trace_vfio_pci_nvidia_gpu_setup_quirk(vdev->vbasedev.name, cap->tgt, | ||
53 | nv2reg->size); | ||
54 | free_exit: | ||
55 | @@ -XXX,XX +XXX,XX @@ int vfio_pci_nvlink2_init(VFIOPCIDevice *vdev, Error **errp) | ||
56 | QLIST_INSERT_HEAD(&vdev->bars[0].quirks, quirk, next); | ||
57 | } | ||
58 | |||
59 | - object_property_add(OBJECT(vdev), "nvlink2-tgt", "uint64", | ||
60 | - vfio_pci_nvlink2_get_tgt, NULL, NULL, | ||
61 | - (void *) (uintptr_t) captgt->tgt); | ||
62 | + object_property_add_uint64_ptr(OBJECT(vdev), "nvlink2-tgt", | ||
63 | + (uint64_t *) &captgt->tgt, | ||
64 | + OBJ_PROP_FLAG_READ); | ||
65 | trace_vfio_pci_nvlink2_setup_quirk_ssatgt(vdev->vbasedev.name, captgt->tgt, | ||
66 | atsdreg->size); | ||
67 | |||
68 | - object_property_add(OBJECT(vdev), "nvlink2-link-speed", "uint32", | ||
69 | - vfio_pci_nvlink2_get_link_speed, NULL, NULL, | ||
70 | - (void *) (uintptr_t) capspeed->link_speed); | ||
71 | + object_property_add_uint32_ptr(OBJECT(vdev), "nvlink2-link-speed", | ||
72 | + &capspeed->link_speed, | ||
73 | + OBJ_PROP_FLAG_READ); | ||
74 | trace_vfio_pci_nvlink2_setup_quirk_lnkspd(vdev->vbasedev.name, | ||
75 | capspeed->link_speed); | ||
76 | free_exit: | ||
77 | -- | ||
78 | 2.35.3 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Bernhard Beschow <shentey@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Once a "One Time Programmable" is programmed, it shouldn't be reset. | 3 | The QOM API already provides accessors for uint32 values, so reuse them. |
4 | 4 | ||
5 | Do not re-initialize the OTP content in the DeviceReset handler, | 5 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> |
6 | initialize it once in the DeviceRealize one. | 6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | |||
8 | Fixes: 9fb45c62ae8 ("riscv: sifive: Implement a model for SiFive FU540 OTP") | ||
9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
11 | Message-Id: <20211119104757.331579-1-f4bug@amsat.org> | 8 | Message-Id: <20220301225220.239065-3-shentey@gmail.com> |
12 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 9 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
13 | --- | 10 | --- |
14 | hw/misc/sifive_u_otp.c | 13 +++++-------- | 11 | hw/riscv/sifive_u.c | 24 ++++-------------------- |
15 | 1 file changed, 5 insertions(+), 8 deletions(-) | 12 | 1 file changed, 4 insertions(+), 20 deletions(-) |
16 | 13 | ||
17 | diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c | 14 | diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/misc/sifive_u_otp.c | 16 | --- a/hw/riscv/sifive_u.c |
20 | +++ b/hw/misc/sifive_u_otp.c | 17 | +++ b/hw/riscv/sifive_u.c |
21 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_machine_set_start_in_flash(Object *obj, bool value, Error * |
22 | 19 | s->start_in_flash = value; | |
23 | if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) { | 20 | } |
24 | error_setg(errp, "failed to read the initial flash content"); | 21 | |
25 | + return; | 22 | -static void sifive_u_machine_get_uint32_prop(Object *obj, Visitor *v, |
26 | } | 23 | - const char *name, void *opaque, |
27 | } | 24 | - Error **errp) |
28 | } | 25 | -{ |
26 | - visit_type_uint32(v, name, (uint32_t *)opaque, errp); | ||
29 | -} | 27 | -} |
30 | - | 28 | - |
31 | -static void sifive_u_otp_reset(DeviceState *dev) | 29 | -static void sifive_u_machine_set_uint32_prop(Object *obj, Visitor *v, |
30 | - const char *name, void *opaque, | ||
31 | - Error **errp) | ||
32 | -{ | 32 | -{ |
33 | - SiFiveUOTPState *s = SIFIVE_U_OTP(dev); | 33 | - visit_type_uint32(v, name, (uint32_t *)opaque, errp); |
34 | 34 | -} | |
35 | /* Initialize all fuses' initial value to 0xFFs */ | 35 | - |
36 | memset(s->fuse, 0xff, sizeof(s->fuse)); | 36 | static void sifive_u_machine_instance_init(Object *obj) |
37 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_reset(DeviceState *dev) | 37 | { |
38 | serial_data = s->serial; | 38 | SiFiveUState *s = RISCV_U_MACHINE(obj); |
39 | if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD, | 39 | |
40 | &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) { | 40 | s->start_in_flash = false; |
41 | - error_report("write error index<%d>", index); | 41 | s->msel = 0; |
42 | + error_setg(errp, "failed to write index<%d>", index); | 42 | - object_property_add(obj, "msel", "uint32", |
43 | + return; | 43 | - sifive_u_machine_get_uint32_prop, |
44 | } | 44 | - sifive_u_machine_set_uint32_prop, NULL, &s->msel); |
45 | 45 | + object_property_add_uint32_ptr(obj, "msel", &s->msel, | |
46 | serial_data = ~(s->serial); | 46 | + OBJ_PROP_FLAG_READWRITE); |
47 | if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD, | 47 | object_property_set_description(obj, "msel", |
48 | &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) { | 48 | "Mode Select (MSEL[3:0]) pin state"); |
49 | - error_report("write error index<%d>", index + 1); | 49 | |
50 | + error_setg(errp, "failed to write index<%d>", index + 1); | 50 | s->serial = OTP_SERIAL; |
51 | + return; | 51 | - object_property_add(obj, "serial", "uint32", |
52 | } | 52 | - sifive_u_machine_get_uint32_prop, |
53 | } | 53 | - sifive_u_machine_set_uint32_prop, NULL, &s->serial); |
54 | 54 | + object_property_add_uint32_ptr(obj, "serial", &s->serial, | |
55 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_class_init(ObjectClass *klass, void *data) | 55 | + OBJ_PROP_FLAG_READWRITE); |
56 | 56 | object_property_set_description(obj, "serial", "Board serial number"); | |
57 | device_class_set_props(dc, sifive_u_otp_properties); | ||
58 | dc->realize = sifive_u_otp_realize; | ||
59 | - dc->reset = sifive_u_otp_reset; | ||
60 | } | 57 | } |
61 | 58 | ||
62 | static const TypeInfo sifive_u_otp_info = { | ||
63 | -- | 59 | -- |
64 | 2.31.1 | 60 | 2.35.3 |
65 | |||
66 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Weiwei Li <liweiwei@iscas.ac.cn> | ||
1 | 2 | ||
3 | - setting ext_g will implicitly set ext_i | ||
4 | |||
5 | Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn> | ||
6 | Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-Id: <20220518012611.6772-1-liweiwei@iscas.ac.cn> | ||
9 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | --- | ||
11 | target/riscv/cpu.c | 24 ++++++++++++------------ | ||
12 | 1 file changed, 12 insertions(+), 12 deletions(-) | ||
13 | |||
14 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/riscv/cpu.c | ||
17 | +++ b/target/riscv/cpu.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
19 | uint32_t ext = 0; | ||
20 | |||
21 | /* Do some ISA extension error checking */ | ||
22 | - if (cpu->cfg.ext_i && cpu->cfg.ext_e) { | ||
23 | - error_setg(errp, | ||
24 | - "I and E extensions are incompatible"); | ||
25 | - return; | ||
26 | - } | ||
27 | - | ||
28 | - if (!cpu->cfg.ext_i && !cpu->cfg.ext_e) { | ||
29 | - error_setg(errp, | ||
30 | - "Either I or E extension must be set"); | ||
31 | - return; | ||
32 | - } | ||
33 | - | ||
34 | if (cpu->cfg.ext_g && !(cpu->cfg.ext_i && cpu->cfg.ext_m && | ||
35 | cpu->cfg.ext_a && cpu->cfg.ext_f && | ||
36 | cpu->cfg.ext_d && | ||
37 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) | ||
38 | cpu->cfg.ext_ifencei = true; | ||
39 | } | ||
40 | |||
41 | + if (cpu->cfg.ext_i && cpu->cfg.ext_e) { | ||
42 | + error_setg(errp, | ||
43 | + "I and E extensions are incompatible"); | ||
44 | + return; | ||
45 | + } | ||
46 | + | ||
47 | + if (!cpu->cfg.ext_i && !cpu->cfg.ext_e) { | ||
48 | + error_setg(errp, | ||
49 | + "Either I or E extension must be set"); | ||
50 | + return; | ||
51 | + } | ||
52 | + | ||
53 | if (cpu->cfg.ext_f && !cpu->cfg.ext_icsr) { | ||
54 | error_setg(errp, "F extension requires Zicsr"); | ||
55 | return; | ||
56 | -- | ||
57 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Frank Chang <frank.chang@sifive.com> | ||
1 | 2 | ||
3 | "mimpid" cpu option was mistyped to "mipid". | ||
4 | |||
5 | Fixes: 9951ba94 ("target/riscv: Support configuarable marchid, mvendorid, mipid CSR values") | ||
6 | Signed-off-by: Frank Chang <frank.chang@sifive.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-Id: <20220523153147.15371-1-frank.chang@sifive.com> | ||
9 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | --- | ||
11 | target/riscv/cpu.h | 2 +- | ||
12 | target/riscv/cpu.c | 4 ++-- | ||
13 | target/riscv/csr.c | 8 ++++---- | ||
14 | 3 files changed, 7 insertions(+), 7 deletions(-) | ||
15 | |||
16 | diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/riscv/cpu.h | ||
19 | +++ b/target/riscv/cpu.h | ||
20 | @@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig { | ||
21 | |||
22 | uint32_t mvendorid; | ||
23 | uint64_t marchid; | ||
24 | - uint64_t mipid; | ||
25 | + uint64_t mimpid; | ||
26 | |||
27 | /* Vendor-specific custom extensions */ | ||
28 | bool ext_XVentanaCondOps; | ||
29 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/target/riscv/cpu.c | ||
32 | +++ b/target/riscv/cpu.c | ||
33 | @@ -XXX,XX +XXX,XX @@ | ||
34 | #define RISCV_CPU_MARCHID ((QEMU_VERSION_MAJOR << 16) | \ | ||
35 | (QEMU_VERSION_MINOR << 8) | \ | ||
36 | (QEMU_VERSION_MICRO)) | ||
37 | -#define RISCV_CPU_MIPID RISCV_CPU_MARCHID | ||
38 | +#define RISCV_CPU_MIMPID RISCV_CPU_MARCHID | ||
39 | |||
40 | static const char riscv_single_letter_exts[] = "IEMAFDQCPVH"; | ||
41 | |||
42 | @@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = { | ||
43 | |||
44 | DEFINE_PROP_UINT32("mvendorid", RISCVCPU, cfg.mvendorid, 0), | ||
45 | DEFINE_PROP_UINT64("marchid", RISCVCPU, cfg.marchid, RISCV_CPU_MARCHID), | ||
46 | - DEFINE_PROP_UINT64("mipid", RISCVCPU, cfg.mipid, RISCV_CPU_MIPID), | ||
47 | + DEFINE_PROP_UINT64("mimpid", RISCVCPU, cfg.mimpid, RISCV_CPU_MIMPID), | ||
48 | |||
49 | DEFINE_PROP_BOOL("svinval", RISCVCPU, cfg.ext_svinval, false), | ||
50 | DEFINE_PROP_BOOL("svnapot", RISCVCPU, cfg.ext_svnapot, false), | ||
51 | diff --git a/target/riscv/csr.c b/target/riscv/csr.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/target/riscv/csr.c | ||
54 | +++ b/target/riscv/csr.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static RISCVException read_marchid(CPURISCVState *env, int csrno, | ||
56 | return RISCV_EXCP_NONE; | ||
57 | } | ||
58 | |||
59 | -static RISCVException read_mipid(CPURISCVState *env, int csrno, | ||
60 | - target_ulong *val) | ||
61 | +static RISCVException read_mimpid(CPURISCVState *env, int csrno, | ||
62 | + target_ulong *val) | ||
63 | { | ||
64 | CPUState *cs = env_cpu(env); | ||
65 | RISCVCPU *cpu = RISCV_CPU(cs); | ||
66 | |||
67 | - *val = cpu->cfg.mipid; | ||
68 | + *val = cpu->cfg.mimpid; | ||
69 | return RISCV_EXCP_NONE; | ||
70 | } | ||
71 | |||
72 | @@ -XXX,XX +XXX,XX @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { | ||
73 | /* Machine Information Registers */ | ||
74 | [CSR_MVENDORID] = { "mvendorid", any, read_mvendorid }, | ||
75 | [CSR_MARCHID] = { "marchid", any, read_marchid }, | ||
76 | - [CSR_MIMPID] = { "mimpid", any, read_mipid }, | ||
77 | + [CSR_MIMPID] = { "mimpid", any, read_mimpid }, | ||
78 | [CSR_MHARTID] = { "mhartid", any, read_mhartid }, | ||
79 | |||
80 | [CSR_MCONFIGPTR] = { "mconfigptr", any, read_zero, | ||
81 | -- | ||
82 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Anup Patel <apatel@ventanamicro.com> | ||
1 | 2 | ||
3 | When hypervisor and VS CSRs are accessed from VS-mode or VU-mode, | ||
4 | the riscv_csrrw_check() function should generate virtual instruction | ||
5 | trap instead illegal instruction trap. | ||
6 | |||
7 | Fixes: 0a42f4c44088 (" target/riscv: Fix CSR perm checking for HS mode") | ||
8 | Signed-off-by: Anup Patel <apatel@ventanamicro.com> | ||
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Reviewed-by: Frank Chang <frank.chang@sifive.com> | ||
11 | Message-Id: <20220511144528.393530-2-apatel@ventanamicro.com> | ||
12 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | --- | ||
14 | target/riscv/csr.c | 8 ++++++-- | ||
15 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/target/riscv/csr.c b/target/riscv/csr.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/riscv/csr.c | ||
20 | +++ b/target/riscv/csr.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static inline RISCVException riscv_csrrw_check(CPURISCVState *env, | ||
22 | int read_only = get_field(csrno, 0xC00) == 3; | ||
23 | int csr_min_priv = csr_ops[csrno].min_priv_ver; | ||
24 | #if !defined(CONFIG_USER_ONLY) | ||
25 | - int effective_priv = env->priv; | ||
26 | + int csr_priv, effective_priv = env->priv; | ||
27 | |||
28 | if (riscv_has_ext(env, RVH) && env->priv == PRV_S) { | ||
29 | /* | ||
30 | @@ -XXX,XX +XXX,XX @@ static inline RISCVException riscv_csrrw_check(CPURISCVState *env, | ||
31 | effective_priv++; | ||
32 | } | ||
33 | |||
34 | - if (!env->debugger && (effective_priv < get_field(csrno, 0x300))) { | ||
35 | + csr_priv = get_field(csrno, 0x300); | ||
36 | + if (!env->debugger && (effective_priv < csr_priv)) { | ||
37 | + if (csr_priv == (PRV_S + 1) && riscv_cpu_virt_enabled(env)) { | ||
38 | + return RISCV_EXCP_VIRT_INSTRUCTION_FAULT; | ||
39 | + } | ||
40 | return RISCV_EXCP_ILLEGAL_INST; | ||
41 | } | ||
42 | #endif | ||
43 | -- | ||
44 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Anup Patel <apatel@ventanamicro.com> | ||
1 | 2 | ||
3 | Currently, QEMU does not set hstatus.GVA bit for traps taken from | ||
4 | HS-mode into HS-mode which breaks the Xvisor nested MMU test suite | ||
5 | on QEMU. This was working previously. | ||
6 | |||
7 | This patch updates riscv_cpu_do_interrupt() to fix the above issue. | ||
8 | |||
9 | Fixes: 86d0c457396b ("target/riscv: Fixup setting GVA") | ||
10 | Signed-off-by: Anup Patel <apatel@ventanamicro.com> | ||
11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
12 | Message-Id: <20220511144528.393530-3-apatel@ventanamicro.com> | ||
13 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | --- | ||
15 | target/riscv/cpu_helper.c | 3 +-- | ||
16 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/riscv/cpu_helper.c | ||
21 | +++ b/target/riscv/cpu_helper.c | ||
22 | @@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs) | ||
23 | case RISCV_EXCP_INST_PAGE_FAULT: | ||
24 | case RISCV_EXCP_LOAD_PAGE_FAULT: | ||
25 | case RISCV_EXCP_STORE_PAGE_FAULT: | ||
26 | - write_gva = true; | ||
27 | + write_gva = env->two_stage_lookup; | ||
28 | tval = env->badaddr; | ||
29 | break; | ||
30 | case RISCV_EXCP_ILLEGAL_INST: | ||
31 | @@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs) | ||
32 | /* Trap into HS mode */ | ||
33 | env->hstatus = set_field(env->hstatus, HSTATUS_SPV, false); | ||
34 | htval = env->guest_phys_fault_addr; | ||
35 | - write_gva = false; | ||
36 | } | ||
37 | env->hstatus = set_field(env->hstatus, HSTATUS_GVA, write_gva); | ||
38 | } | ||
39 | -- | ||
40 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Anup Patel <apatel@ventanamicro.com> | ||
1 | 2 | ||
3 | Currently, the [m|s]tval CSRs are set with trapping instruction encoding | ||
4 | only for illegal instruction traps taken at the time of instruction | ||
5 | decoding. | ||
6 | |||
7 | In RISC-V world, a valid instructions might also trap as illegal or | ||
8 | virtual instruction based to trapping bits in various CSRs (such as | ||
9 | mstatus.TVM or hstatus.VTVM). | ||
10 | |||
11 | We improve setting of [m|s]tval CSRs for all types of illegal and | ||
12 | virtual instruction traps. | ||
13 | |||
14 | Signed-off-by: Anup Patel <apatel@ventanamicro.com> | ||
15 | Reviewed-by: Frank Chang <frank.chang@sifive.com> | ||
16 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
17 | Message-Id: <20220511144528.393530-4-apatel@ventanamicro.com> | ||
18 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
19 | --- | ||
20 | target/riscv/cpu.h | 8 +++++++- | ||
21 | target/riscv/cpu.c | 2 ++ | ||
22 | target/riscv/cpu_helper.c | 1 + | ||
23 | target/riscv/translate.c | 17 +++++++++++++---- | ||
24 | 4 files changed, 23 insertions(+), 5 deletions(-) | ||
25 | |||
26 | diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/riscv/cpu.h | ||
29 | +++ b/target/riscv/cpu.h | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | |||
32 | #define TCG_GUEST_DEFAULT_MO 0 | ||
33 | |||
34 | +/* | ||
35 | + * RISC-V-specific extra insn start words: | ||
36 | + * 1: Original instruction opcode | ||
37 | + */ | ||
38 | +#define TARGET_INSN_START_EXTRA_WORDS 1 | ||
39 | + | ||
40 | #define TYPE_RISCV_CPU "riscv-cpu" | ||
41 | |||
42 | #define RISCV_CPU_TYPE_SUFFIX "-" TYPE_RISCV_CPU | ||
43 | @@ -XXX,XX +XXX,XX @@ struct CPUArchState { | ||
44 | target_ulong frm; | ||
45 | |||
46 | target_ulong badaddr; | ||
47 | - uint32_t bins; | ||
48 | + target_ulong bins; | ||
49 | |||
50 | target_ulong guest_phys_fault_addr; | ||
51 | |||
52 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/target/riscv/cpu.c | ||
55 | +++ b/target/riscv/cpu.c | ||
56 | @@ -XXX,XX +XXX,XX @@ void restore_state_to_opc(CPURISCVState *env, TranslationBlock *tb, | ||
57 | } else { | ||
58 | env->pc = data[0]; | ||
59 | } | ||
60 | + env->bins = data[1]; | ||
61 | } | ||
62 | |||
63 | static void riscv_cpu_reset(DeviceState *dev) | ||
64 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_reset(DeviceState *dev) | ||
65 | env->mcause = 0; | ||
66 | env->miclaim = MIP_SGEIP; | ||
67 | env->pc = env->resetvec; | ||
68 | + env->bins = 0; | ||
69 | env->two_stage_lookup = false; | ||
70 | |||
71 | /* Initialized default priorities of local interrupts. */ | ||
72 | diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/target/riscv/cpu_helper.c | ||
75 | +++ b/target/riscv/cpu_helper.c | ||
76 | @@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs) | ||
77 | tval = env->badaddr; | ||
78 | break; | ||
79 | case RISCV_EXCP_ILLEGAL_INST: | ||
80 | + case RISCV_EXCP_VIRT_INSTRUCTION_FAULT: | ||
81 | tval = env->bins; | ||
82 | break; | ||
83 | default: | ||
84 | diff --git a/target/riscv/translate.c b/target/riscv/translate.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/target/riscv/translate.c | ||
87 | +++ b/target/riscv/translate.c | ||
88 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
89 | /* PointerMasking extension */ | ||
90 | bool pm_mask_enabled; | ||
91 | bool pm_base_enabled; | ||
92 | + /* TCG of the current insn_start */ | ||
93 | + TCGOp *insn_start; | ||
94 | } DisasContext; | ||
95 | |||
96 | static inline bool has_ext(DisasContext *ctx, uint32_t ext) | ||
97 | @@ -XXX,XX +XXX,XX @@ static void generate_exception_mtval(DisasContext *ctx, int excp) | ||
98 | |||
99 | static void gen_exception_illegal(DisasContext *ctx) | ||
100 | { | ||
101 | - tcg_gen_st_i32(tcg_constant_i32(ctx->opcode), cpu_env, | ||
102 | - offsetof(CPURISCVState, bins)); | ||
103 | - | ||
104 | generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST); | ||
105 | } | ||
106 | |||
107 | @@ -XXX,XX +XXX,XX @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc) | ||
108 | /* Include decoders for factored-out extensions */ | ||
109 | #include "decode-XVentanaCondOps.c.inc" | ||
110 | |||
111 | +static inline void decode_save_opc(DisasContext *ctx, target_ulong opc) | ||
112 | +{ | ||
113 | + assert(ctx->insn_start != NULL); | ||
114 | + tcg_set_insn_start_param(ctx->insn_start, 1, opc); | ||
115 | + ctx->insn_start = NULL; | ||
116 | +} | ||
117 | + | ||
118 | static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) | ||
119 | { | ||
120 | /* | ||
121 | @@ -XXX,XX +XXX,XX @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) | ||
122 | |||
123 | /* Check for compressed insn */ | ||
124 | if (extract16(opcode, 0, 2) != 3) { | ||
125 | + decode_save_opc(ctx, opcode); | ||
126 | if (!has_ext(ctx, RVC)) { | ||
127 | gen_exception_illegal(ctx); | ||
128 | } else { | ||
129 | @@ -XXX,XX +XXX,XX @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) | ||
130 | opcode32 = deposit32(opcode32, 16, 16, | ||
131 | translator_lduw(env, &ctx->base, | ||
132 | ctx->base.pc_next + 2)); | ||
133 | + decode_save_opc(ctx, opcode32); | ||
134 | ctx->opcode = opcode32; | ||
135 | ctx->pc_succ_insn = ctx->base.pc_next + 4; | ||
136 | |||
137 | @@ -XXX,XX +XXX,XX @@ static void riscv_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) | ||
138 | { | ||
139 | DisasContext *ctx = container_of(dcbase, DisasContext, base); | ||
140 | |||
141 | - tcg_gen_insn_start(ctx->base.pc_next); | ||
142 | + tcg_gen_insn_start(ctx->base.pc_next, 0); | ||
143 | + ctx->insn_start = tcg_last_op(); | ||
144 | } | ||
145 | |||
146 | static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
147 | -- | ||
148 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Anup Patel <apatel@ventanamicro.com> | ||
1 | 2 | ||
3 | When both APLIC and IMSIC are present in virt machine, the APLIC should | ||
4 | be used as parent interrupt controller for dynamic platform devices. | ||
5 | |||
6 | In case of multiple sockets, we should prefer interrupt controller of | ||
7 | socket0 for dynamic platform devices. | ||
8 | |||
9 | Fixes: 3029fab64309 ("hw/riscv: virt: Add support for generating | ||
10 | platform FDT entries") | ||
11 | Signed-off-by: Anup Patel <apatel@ventanamicro.com> | ||
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Message-Id: <20220511144528.393530-9-apatel@ventanamicro.com> | ||
14 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
15 | --- | ||
16 | hw/riscv/virt.c | 25 ++++++++++++------------- | ||
17 | 1 file changed, 12 insertions(+), 13 deletions(-) | ||
18 | |||
19 | diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/riscv/virt.c | ||
22 | +++ b/hw/riscv/virt.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void create_fdt_socket_plic(RISCVVirtState *s, | ||
24 | qemu_fdt_setprop_cell(mc->fdt, plic_name, "phandle", | ||
25 | plic_phandles[socket]); | ||
26 | |||
27 | - platform_bus_add_all_fdt_nodes(mc->fdt, plic_name, | ||
28 | - memmap[VIRT_PLATFORM_BUS].base, | ||
29 | - memmap[VIRT_PLATFORM_BUS].size, | ||
30 | - VIRT_PLATFORM_BUS_IRQ); | ||
31 | + if (!socket) { | ||
32 | + platform_bus_add_all_fdt_nodes(mc->fdt, plic_name, | ||
33 | + memmap[VIRT_PLATFORM_BUS].base, | ||
34 | + memmap[VIRT_PLATFORM_BUS].size, | ||
35 | + VIRT_PLATFORM_BUS_IRQ); | ||
36 | + } | ||
37 | |||
38 | g_free(plic_name); | ||
39 | |||
40 | @@ -XXX,XX +XXX,XX @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap, | ||
41 | } | ||
42 | qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle); | ||
43 | |||
44 | - platform_bus_add_all_fdt_nodes(mc->fdt, imsic_name, | ||
45 | - memmap[VIRT_PLATFORM_BUS].base, | ||
46 | - memmap[VIRT_PLATFORM_BUS].size, | ||
47 | - VIRT_PLATFORM_BUS_IRQ); | ||
48 | - | ||
49 | g_free(imsic_name); | ||
50 | |||
51 | /* S-level IMSIC node */ | ||
52 | @@ -XXX,XX +XXX,XX @@ static void create_fdt_socket_aplic(RISCVVirtState *s, | ||
53 | riscv_socket_fdt_write_id(mc, mc->fdt, aplic_name, socket); | ||
54 | qemu_fdt_setprop_cell(mc->fdt, aplic_name, "phandle", aplic_s_phandle); | ||
55 | |||
56 | - platform_bus_add_all_fdt_nodes(mc->fdt, aplic_name, | ||
57 | - memmap[VIRT_PLATFORM_BUS].base, | ||
58 | - memmap[VIRT_PLATFORM_BUS].size, | ||
59 | - VIRT_PLATFORM_BUS_IRQ); | ||
60 | + if (!socket) { | ||
61 | + platform_bus_add_all_fdt_nodes(mc->fdt, aplic_name, | ||
62 | + memmap[VIRT_PLATFORM_BUS].base, | ||
63 | + memmap[VIRT_PLATFORM_BUS].size, | ||
64 | + VIRT_PLATFORM_BUS_IRQ); | ||
65 | + } | ||
66 | |||
67 | g_free(aplic_name); | ||
68 | |||
69 | -- | ||
70 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Hongren (Zenithal) Zheng" <i@zenithal.me> | ||
1 | 2 | ||
3 | Zicsr/Zifencei is not in 'I' since ISA version 20190608, | ||
4 | thus to fully express the capability of the CPU, | ||
5 | they should be exposed in isa_string. | ||
6 | |||
7 | Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me> | ||
8 | Tested-by: Jiatai He <jiatai2021@iscas.ac.cn> | ||
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-Id: <YoTqwpfrodveJ7CR@Sun> | ||
11 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
12 | --- | ||
13 | target/riscv/cpu.c | 2 ++ | ||
14 | 1 file changed, 2 insertions(+) | ||
15 | |||
16 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/riscv/cpu.c | ||
19 | +++ b/target/riscv/cpu.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char **isa_str, int max_str_len) | ||
21 | * extensions by an underscore. | ||
22 | */ | ||
23 | struct isa_ext_data isa_edata_arr[] = { | ||
24 | + ISA_EDATA_ENTRY(zicsr, ext_icsr), | ||
25 | + ISA_EDATA_ENTRY(zifencei, ext_ifencei), | ||
26 | ISA_EDATA_ENTRY(zfh, ext_zfh), | ||
27 | ISA_EDATA_ENTRY(zfhmin, ext_zfhmin), | ||
28 | ISA_EDATA_ENTRY(zfinx, ext_zfinx), | ||
29 | -- | ||
30 | 2.35.3 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Bin Meng <bin.meng@windriver.com> | |
2 | |||
3 | Sync uboot_image.h from upstream U-Boot v2022.01 release [1]. | ||
4 | |||
5 | [1] https://source.denx.de/u-boot/u-boot/-/blob/v2022.01/include/image.h | ||
6 | |||
7 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-Id: <20220324134812.541274-1-bmeng.cn@gmail.com> | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | --- | ||
12 | hw/core/uboot_image.h | 213 ++++++++++++++++++++++++++++-------------- | ||
13 | 1 file changed, 142 insertions(+), 71 deletions(-) | ||
14 | |||
15 | diff --git a/hw/core/uboot_image.h b/hw/core/uboot_image.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/core/uboot_image.h | ||
18 | +++ b/hw/core/uboot_image.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | +/* SPDX-License-Identifier: GPL-2.0+ */ | ||
21 | /* | ||
22 | + * (C) Copyright 2008 Semihalf | ||
23 | + * | ||
24 | * (C) Copyright 2000-2005 | ||
25 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||
26 | - * | ||
27 | - * See file CREDITS for list of people who contributed to this | ||
28 | - * project. | ||
29 | - * | ||
30 | - * This program is free software; you can redistribute it and/or | ||
31 | - * modify it under the terms of the GNU General Public License as | ||
32 | - * published by the Free Software Foundation; either version 2 of | ||
33 | - * the License, or (at your option) any later version. | ||
34 | - * | ||
35 | - * This program is distributed in the hope that it will be useful, | ||
36 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
37 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
38 | - * GNU General Public License for more details. | ||
39 | - * | ||
40 | - * You should have received a copy of the GNU General Public License along | ||
41 | - * with this program; if not, see <http://www.gnu.org/licenses/>. | ||
42 | - * | ||
43 | ******************************************************************** | ||
44 | * NOTE: This header file defines an interface to U-Boot. Including | ||
45 | * this (unmodified) header file in another file is considered normal | ||
46 | @@ -XXX,XX +XXX,XX @@ | ||
47 | |||
48 | /* | ||
49 | * Operating System Codes | ||
50 | + * | ||
51 | + * The following are exposed to uImage header. | ||
52 | + * New IDs *MUST* be appended at the end of the list and *NEVER* | ||
53 | + * inserted for backward compatibility. | ||
54 | */ | ||
55 | -#define IH_OS_INVALID 0 /* Invalid OS */ | ||
56 | -#define IH_OS_OPENBSD 1 /* OpenBSD */ | ||
57 | -#define IH_OS_NETBSD 2 /* NetBSD */ | ||
58 | -#define IH_OS_FREEBSD 3 /* FreeBSD */ | ||
59 | -#define IH_OS_4_4BSD 4 /* 4.4BSD */ | ||
60 | -#define IH_OS_LINUX 5 /* Linux */ | ||
61 | -#define IH_OS_SVR4 6 /* SVR4 */ | ||
62 | -#define IH_OS_ESIX 7 /* Esix */ | ||
63 | -#define IH_OS_SOLARIS 8 /* Solaris */ | ||
64 | -#define IH_OS_IRIX 9 /* Irix */ | ||
65 | -#define IH_OS_SCO 10 /* SCO */ | ||
66 | -#define IH_OS_DELL 11 /* Dell */ | ||
67 | -#define IH_OS_NCR 12 /* NCR */ | ||
68 | -#define IH_OS_LYNXOS 13 /* LynxOS */ | ||
69 | -#define IH_OS_VXWORKS 14 /* VxWorks */ | ||
70 | -#define IH_OS_PSOS 15 /* pSOS */ | ||
71 | -#define IH_OS_QNX 16 /* QNX */ | ||
72 | -#define IH_OS_U_BOOT 17 /* Firmware */ | ||
73 | -#define IH_OS_RTEMS 18 /* RTEMS */ | ||
74 | -#define IH_OS_ARTOS 19 /* ARTOS */ | ||
75 | -#define IH_OS_UNITY 20 /* Unity OS */ | ||
76 | +enum { | ||
77 | + IH_OS_INVALID = 0, /* Invalid OS */ | ||
78 | + IH_OS_OPENBSD, /* OpenBSD */ | ||
79 | + IH_OS_NETBSD, /* NetBSD */ | ||
80 | + IH_OS_FREEBSD, /* FreeBSD */ | ||
81 | + IH_OS_4_4BSD, /* 4.4BSD */ | ||
82 | + IH_OS_LINUX, /* Linux */ | ||
83 | + IH_OS_SVR4, /* SVR4 */ | ||
84 | + IH_OS_ESIX, /* Esix */ | ||
85 | + IH_OS_SOLARIS, /* Solaris */ | ||
86 | + IH_OS_IRIX, /* Irix */ | ||
87 | + IH_OS_SCO, /* SCO */ | ||
88 | + IH_OS_DELL, /* Dell */ | ||
89 | + IH_OS_NCR, /* NCR */ | ||
90 | + IH_OS_LYNXOS, /* LynxOS */ | ||
91 | + IH_OS_VXWORKS, /* VxWorks */ | ||
92 | + IH_OS_PSOS, /* pSOS */ | ||
93 | + IH_OS_QNX, /* QNX */ | ||
94 | + IH_OS_U_BOOT, /* Firmware */ | ||
95 | + IH_OS_RTEMS, /* RTEMS */ | ||
96 | + IH_OS_ARTOS, /* ARTOS */ | ||
97 | + IH_OS_UNITY, /* Unity OS */ | ||
98 | + IH_OS_INTEGRITY, /* INTEGRITY */ | ||
99 | + IH_OS_OSE, /* OSE */ | ||
100 | + IH_OS_PLAN9, /* Plan 9 */ | ||
101 | + IH_OS_OPENRTOS, /* OpenRTOS */ | ||
102 | + IH_OS_ARM_TRUSTED_FIRMWARE, /* ARM Trusted Firmware */ | ||
103 | + IH_OS_TEE, /* Trusted Execution Environment */ | ||
104 | + IH_OS_OPENSBI, /* RISC-V OpenSBI */ | ||
105 | + IH_OS_EFI, /* EFI Firmware (e.g. GRUB2) */ | ||
106 | + | ||
107 | + IH_OS_COUNT, | ||
108 | +}; | ||
109 | |||
110 | /* | ||
111 | * CPU Architecture Codes (supported by Linux) | ||
112 | + * | ||
113 | + * The following are exposed to uImage header. | ||
114 | + * New IDs *MUST* be appended at the end of the list and *NEVER* | ||
115 | + * inserted for backward compatibility. | ||
116 | */ | ||
117 | -#define IH_CPU_INVALID 0 /* Invalid CPU */ | ||
118 | -#define IH_CPU_ALPHA 1 /* Alpha */ | ||
119 | -#define IH_CPU_ARM 2 /* ARM */ | ||
120 | -#define IH_CPU_I386 3 /* Intel x86 */ | ||
121 | -#define IH_CPU_IA64 4 /* IA64 */ | ||
122 | -#define IH_CPU_MIPS 5 /* MIPS */ | ||
123 | -#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */ | ||
124 | -#define IH_CPU_PPC 7 /* PowerPC */ | ||
125 | -#define IH_CPU_S390 8 /* IBM S390 */ | ||
126 | -#define IH_CPU_SH 9 /* SuperH */ | ||
127 | -#define IH_CPU_SPARC 10 /* Sparc */ | ||
128 | -#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */ | ||
129 | -#define IH_CPU_M68K 12 /* M68K */ | ||
130 | -#define IH_CPU_NIOS 13 /* Nios-32 */ | ||
131 | -#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ | ||
132 | -#define IH_CPU_NIOS2 15 /* Nios-II */ | ||
133 | -#define IH_CPU_BLACKFIN 16 /* Blackfin */ | ||
134 | -#define IH_CPU_AVR32 17 /* AVR32 */ | ||
135 | +enum { | ||
136 | + IH_ARCH_INVALID = 0, /* Invalid CPU */ | ||
137 | + IH_ARCH_ALPHA, /* Alpha */ | ||
138 | + IH_ARCH_ARM, /* ARM */ | ||
139 | + IH_ARCH_I386, /* Intel x86 */ | ||
140 | + IH_ARCH_IA64, /* IA64 */ | ||
141 | + IH_ARCH_MIPS, /* MIPS */ | ||
142 | + IH_ARCH_MIPS64, /* MIPS 64 Bit */ | ||
143 | + IH_ARCH_PPC, /* PowerPC */ | ||
144 | + IH_ARCH_S390, /* IBM S390 */ | ||
145 | + IH_ARCH_SH, /* SuperH */ | ||
146 | + IH_ARCH_SPARC, /* Sparc */ | ||
147 | + IH_ARCH_SPARC64, /* Sparc 64 Bit */ | ||
148 | + IH_ARCH_M68K, /* M68K */ | ||
149 | + IH_ARCH_NIOS, /* Nios-32 */ | ||
150 | + IH_ARCH_MICROBLAZE, /* MicroBlaze */ | ||
151 | + IH_ARCH_NIOS2, /* Nios-II */ | ||
152 | + IH_ARCH_BLACKFIN, /* Blackfin */ | ||
153 | + IH_ARCH_AVR32, /* AVR32 */ | ||
154 | + IH_ARCH_ST200, /* STMicroelectronics ST200 */ | ||
155 | + IH_ARCH_SANDBOX, /* Sandbox architecture (test only) */ | ||
156 | + IH_ARCH_NDS32, /* ANDES Technology - NDS32 */ | ||
157 | + IH_ARCH_OPENRISC, /* OpenRISC 1000 */ | ||
158 | + IH_ARCH_ARM64, /* ARM64 */ | ||
159 | + IH_ARCH_ARC, /* Synopsys DesignWare ARC */ | ||
160 | + IH_ARCH_X86_64, /* AMD x86_64, Intel and Via */ | ||
161 | + IH_ARCH_XTENSA, /* Xtensa */ | ||
162 | + IH_ARCH_RISCV, /* RISC-V */ | ||
163 | + | ||
164 | + IH_ARCH_COUNT, | ||
165 | +}; | ||
166 | |||
167 | /* | ||
168 | * Image Types | ||
169 | @@ -XXX,XX +XXX,XX @@ | ||
170 | * U-Boot's command interpreter; this feature is especially | ||
171 | * useful when you configure U-Boot to use a real shell (hush) | ||
172 | * as command interpreter (=> Shell Scripts). | ||
173 | + * | ||
174 | + * The following are exposed to uImage header. | ||
175 | + * New IDs *MUST* be appended at the end of the list and *NEVER* | ||
176 | + * inserted for backward compatibility. | ||
177 | */ | ||
178 | |||
179 | -#define IH_TYPE_INVALID 0 /* Invalid Image */ | ||
180 | -#define IH_TYPE_STANDALONE 1 /* Standalone Program */ | ||
181 | -#define IH_TYPE_KERNEL 2 /* OS Kernel Image */ | ||
182 | -#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ | ||
183 | -#define IH_TYPE_MULTI 4 /* Multi-File Image */ | ||
184 | -#define IH_TYPE_FIRMWARE 5 /* Firmware Image */ | ||
185 | -#define IH_TYPE_SCRIPT 6 /* Script file */ | ||
186 | -#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ | ||
187 | -#define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */ | ||
188 | -#define IH_TYPE_KERNEL_NOLOAD 14 /* OS Kernel Image (noload) */ | ||
189 | +enum { | ||
190 | + IH_TYPE_INVALID = 0, /* Invalid Image */ | ||
191 | + IH_TYPE_STANDALONE, /* Standalone Program */ | ||
192 | + IH_TYPE_KERNEL, /* OS Kernel Image */ | ||
193 | + IH_TYPE_RAMDISK, /* RAMDisk Image */ | ||
194 | + IH_TYPE_MULTI, /* Multi-File Image */ | ||
195 | + IH_TYPE_FIRMWARE, /* Firmware Image */ | ||
196 | + IH_TYPE_SCRIPT, /* Script file */ | ||
197 | + IH_TYPE_FILESYSTEM, /* Filesystem Image (any type) */ | ||
198 | + IH_TYPE_FLATDT, /* Binary Flat Device Tree Blob */ | ||
199 | + IH_TYPE_KWBIMAGE, /* Kirkwood Boot Image */ | ||
200 | + IH_TYPE_IMXIMAGE, /* Freescale IMXBoot Image */ | ||
201 | + IH_TYPE_UBLIMAGE, /* Davinci UBL Image */ | ||
202 | + IH_TYPE_OMAPIMAGE, /* TI OMAP Config Header Image */ | ||
203 | + IH_TYPE_AISIMAGE, /* TI Davinci AIS Image */ | ||
204 | + /* OS Kernel Image, can run from any load address */ | ||
205 | + IH_TYPE_KERNEL_NOLOAD, | ||
206 | + IH_TYPE_PBLIMAGE, /* Freescale PBL Boot Image */ | ||
207 | + IH_TYPE_MXSIMAGE, /* Freescale MXSBoot Image */ | ||
208 | + IH_TYPE_GPIMAGE, /* TI Keystone GPHeader Image */ | ||
209 | + IH_TYPE_ATMELIMAGE, /* ATMEL ROM bootable Image */ | ||
210 | + IH_TYPE_SOCFPGAIMAGE, /* Altera SOCFPGA CV/AV Preloader */ | ||
211 | + IH_TYPE_X86_SETUP, /* x86 setup.bin Image */ | ||
212 | + IH_TYPE_LPC32XXIMAGE, /* x86 setup.bin Image */ | ||
213 | + IH_TYPE_LOADABLE, /* A list of typeless images */ | ||
214 | + IH_TYPE_RKIMAGE, /* Rockchip Boot Image */ | ||
215 | + IH_TYPE_RKSD, /* Rockchip SD card */ | ||
216 | + IH_TYPE_RKSPI, /* Rockchip SPI image */ | ||
217 | + IH_TYPE_ZYNQIMAGE, /* Xilinx Zynq Boot Image */ | ||
218 | + IH_TYPE_ZYNQMPIMAGE, /* Xilinx ZynqMP Boot Image */ | ||
219 | + IH_TYPE_ZYNQMPBIF, /* Xilinx ZynqMP Boot Image (bif) */ | ||
220 | + IH_TYPE_FPGA, /* FPGA Image */ | ||
221 | + IH_TYPE_VYBRIDIMAGE, /* VYBRID .vyb Image */ | ||
222 | + IH_TYPE_TEE, /* Trusted Execution Environment OS Image */ | ||
223 | + IH_TYPE_FIRMWARE_IVT, /* Firmware Image with HABv4 IVT */ | ||
224 | + IH_TYPE_PMMC, /* TI Power Management Micro-Controller Firmware */ | ||
225 | + IH_TYPE_STM32IMAGE, /* STMicroelectronics STM32 Image */ | ||
226 | + IH_TYPE_SOCFPGAIMAGE_V1, /* Altera SOCFPGA A10 Preloader */ | ||
227 | + IH_TYPE_MTKIMAGE, /* MediaTek BootROM loadable Image */ | ||
228 | + IH_TYPE_IMX8MIMAGE, /* Freescale IMX8MBoot Image */ | ||
229 | + IH_TYPE_IMX8IMAGE, /* Freescale IMX8Boot Image */ | ||
230 | + IH_TYPE_COPRO, /* Coprocessor Image for remoteproc*/ | ||
231 | + IH_TYPE_SUNXI_EGON, /* Allwinner eGON Boot Image */ | ||
232 | + | ||
233 | + IH_TYPE_COUNT, /* Number of image types */ | ||
234 | +}; | ||
235 | |||
236 | /* | ||
237 | * Compression Types | ||
238 | + * | ||
239 | + * The following are exposed to uImage header. | ||
240 | + * New IDs *MUST* be appended at the end of the list and *NEVER* | ||
241 | + * inserted for backward compatibility. | ||
242 | */ | ||
243 | -#define IH_COMP_NONE 0 /* No Compression Used */ | ||
244 | -#define IH_COMP_GZIP 1 /* gzip Compression Used */ | ||
245 | -#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ | ||
246 | +enum { | ||
247 | + IH_COMP_NONE = 0, /* No Compression Used */ | ||
248 | + IH_COMP_GZIP, /* gzip Compression Used */ | ||
249 | + IH_COMP_BZIP2, /* bzip2 Compression Used */ | ||
250 | + IH_COMP_LZMA, /* lzma Compression Used */ | ||
251 | + IH_COMP_LZO, /* lzo Compression Used */ | ||
252 | + IH_COMP_LZ4, /* lz4 Compression Used */ | ||
253 | + IH_COMP_ZSTD, /* zstd Compression Used */ | ||
254 | + | ||
255 | + IH_COMP_COUNT, | ||
256 | +}; | ||
257 | |||
258 | #define IH_MAGIC 0x27051956 /* Image Magic Number */ | ||
259 | #define IH_NMLEN 32 /* Image Name Length */ | ||
260 | |||
261 | /* | ||
262 | - * all data in network byte order (aka natural aka bigendian) | ||
263 | + * Legacy format image header, | ||
264 | + * all data in network byte order (aka natural aka bigendian). | ||
265 | */ | ||
266 | - | ||
267 | typedef struct uboot_image_header { | ||
268 | uint32_t ih_magic; /* Image Header Magic Number */ | ||
269 | uint32_t ih_hcrc; /* Image Header CRC Checksum */ | ||
270 | -- | ||
271 | 2.35.3 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | 2 | ||
3 | Configuring a drive with "if=none" is meant for creation of a backend | 3 | VxWorks 7 uses the same boot interface as the Linux kernel on Arm |
4 | only, it should not get automatically assigned to a device frontend. | 4 | (64-bit only), PowerPC and RISC-V architectures. Add logic to set |
5 | Use "if=pflash" for the One-Time-Programmable device instead (like | 5 | is_linux to true for VxWorks uImage for these architectures in |
6 | it is e.g. also done for the efuse device in hw/arm/xlnx-zcu102.c). | 6 | load_uboot_image(). |
7 | 7 | ||
8 | Since the old way of configuring the device has already been published | 8 | Signed-off-by: Bin Meng <bin.meng@windriver.com> |
9 | with the previous QEMU versions, we cannot remove this immediately, but | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | have to deprecate it and support it for at least two more releases. | ||
11 | |||
12 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
13 | Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
15 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
16 | Message-id: 20211119102549.217755-1-thuth@redhat.com | 11 | Message-Id: <20220324134812.541274-2-bmeng.cn@gmail.com> |
17 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 12 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
18 | --- | 13 | --- |
19 | docs/about/deprecated.rst | 6 ++++++ | 14 | hw/core/loader.c | 15 +++++++++++++++ |
20 | hw/misc/sifive_u_otp.c | 9 ++++++++- | 15 | 1 file changed, 15 insertions(+) |
21 | 2 files changed, 14 insertions(+), 1 deletion(-) | ||
22 | 16 | ||
23 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst | 17 | diff --git a/hw/core/loader.c b/hw/core/loader.c |
24 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/docs/about/deprecated.rst | 19 | --- a/hw/core/loader.c |
26 | +++ b/docs/about/deprecated.rst | 20 | +++ b/hw/core/loader.c |
27 | @@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``. | 21 | @@ -XXX,XX +XXX,XX @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, |
28 | However, short-form booleans are deprecated and full explicit ``arg_name=on`` | 22 | if (is_linux) { |
29 | form is preferred. | 23 | if (hdr->ih_os == IH_OS_LINUX) { |
30 | 24 | *is_linux = 1; | |
31 | +``-drive if=none`` for the sifive_u OTP device (since 6.2) | 25 | + } else if (hdr->ih_os == IH_OS_VXWORKS) { |
32 | +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | 26 | + /* |
33 | + | 27 | + * VxWorks 7 uses the same boot interface as the Linux kernel |
34 | +Using ``-drive if=none`` to configure the OTP device of the sifive_u | 28 | + * on Arm (64-bit only), PowerPC and RISC-V architectures. |
35 | +RISC-V machine is deprecated. Use ``-drive if=pflash`` instead. | 29 | + */ |
36 | + | 30 | + switch (hdr->ih_arch) { |
37 | 31 | + case IH_ARCH_ARM64: | |
38 | QEMU Machine Protocol (QMP) commands | 32 | + case IH_ARCH_PPC: |
39 | ------------------------------------ | 33 | + case IH_ARCH_RISCV: |
40 | diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c | 34 | + *is_linux = 1; |
41 | index XXXXXXX..XXXXXXX 100644 | 35 | + break; |
42 | --- a/hw/misc/sifive_u_otp.c | 36 | + default: |
43 | +++ b/hw/misc/sifive_u_otp.c | 37 | + *is_linux = 0; |
44 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp) | 38 | + break; |
45 | TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE); | 39 | + } |
46 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); | 40 | } else { |
47 | 41 | *is_linux = 0; | |
48 | - dinfo = drive_get_next(IF_NONE); | 42 | } |
49 | + dinfo = drive_get_next(IF_PFLASH); | ||
50 | + if (!dinfo) { | ||
51 | + dinfo = drive_get_next(IF_NONE); | ||
52 | + if (dinfo) { | ||
53 | + warn_report("using \"-drive if=none\" for the OTP is deprecated, " | ||
54 | + "use \"-drive if=pflash\" instead."); | ||
55 | + } | ||
56 | + } | ||
57 | if (dinfo) { | ||
58 | int ret; | ||
59 | uint64_t perm; | ||
60 | -- | 43 | -- |
61 | 2.31.1 | 44 | 2.35.3 |
62 | |||
63 | diff view generated by jsdifflib |