Re: gitlab/cirrus auth token failure
On 22/10/21 20:31, Richard Henderson wrote: Hi Daniel, you win the cookie because you committed cirrus.yml. I should have reported this before the weekend, but at some point this week the auth tokens expired(?). All of the cirrus-run tests are now failing: cirrus_run.api.CirrusAPIError: API returned 1 error(s): [ { 'extensions': {'classification': 'DataFetchingException'}, 'locations': [{'column': 13, 'line': 5}], 'message': 'Exception while fetching data (/createBuild) : ' 'AccessTokenAuthorization(token=[MASKED]) ' "doesn't have permissions to create builds for " '5748266831446016!', 'path': ['createBuild']}] It seems to have fixed itself for kvm-unit-tests, so maybe it was just a temporary issue within cirrus itself? Paolo
Re: [PATCH 15/33] target/mips: Convert MSA load/store instruction format to decodetree
On 10/24/21 06:53, Richard Henderson wrote: > On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: >> +#define TRANS_DF_E(NAME, trans_func, gen_func) \ >> + TRANS_CHECK(NAME, check_msa_access(ctx), trans_func, \ >> + gen_func##_b, gen_func##_h, gen_func##_w, >> gen_func##_d) > > I think this would be better as a table. > > #define TRANS_DF_E(NAME, trans_func, gen_func) \ > static void (* const NAME##_tab[4])(TCGv_ptr, TCGv_i32, TCGV) = { \ > gen_func##_b, gen_func##_h, gen_func##_w, gen_func##_d) \ > }; \ > TRANS_MSA(trans_func, NAME##_tag[a->df]) Nice tip! Thanks :>
Re: [PATCH 05/33] target/mips: Have check_msa_access() return a boolean
On 10/24/21 03:02, Richard Henderson wrote: > On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: >> Have check_msa_access() return a boolean value so we can >> return early if MSA is not enabled. >> >> Signed-off-by: Philippe Mathieu-Daudé >> --- >> target/mips/tcg/msa_translate.c | 20 +--- >> 1 file changed, 13 insertions(+), 7 deletions(-) >> >> diff --git a/target/mips/tcg/msa_translate.c >> b/target/mips/tcg/msa_translate.c >> index 3ef912da6b8..9e0a08fe335 100644 >> --- a/target/mips/tcg/msa_translate.c >> +++ b/target/mips/tcg/msa_translate.c >> @@ -293,19 +293,19 @@ void msa_translate_init(void) >> } >> } >> -static inline int check_msa_access(DisasContext *ctx) >> +static inline bool check_msa_access(DisasContext *ctx) >> { >> if (unlikely((ctx->hflags & MIPS_HFLAG_FPU) && >> !(ctx->hflags & MIPS_HFLAG_F64))) { >> gen_reserved_instruction(ctx); >> - return 0; >> + return false; >> } >> if (unlikely(!(ctx->hflags & MIPS_HFLAG_MSA))) { >> generate_exception_end(ctx, EXCP_MSADIS); >> - return 0; >> + return false; >> } > > When we return false, we have raised an exception. > >> @@ -354,7 +354,9 @@ static bool gen_msa_BxZ_V(DisasContext *ctx, int >> wt, int s16, TCGCond cond) >> { >> TCGv_i64 t0; >> - check_msa_access(ctx); >> + if (!check_msa_access(ctx)) { >> + return false; >> + } > > ... which means that here we should return true, meaning that we have > recognized the instruction and emitted some code for it. In this case: > we have recognized that the instruction is valid but not enabled. > > Otherwise, we will return to decode_opc and (eventually) emit another > gen_reserved_instruction. Yes, this is what I intended to do. I incorrectly copied/pasted 'false' then it spread all over the file. Thanks for catching this.
Re: [PATCH 0/5] hw/sh4: Codeing style fixes
On 10/24/21 02:40, BALATON Zoltan wrote: > This fixes coding style of files belonging to SH4 system emulation > which were not following current QEMU coding style requirements. > > BALATON Zoltan (5): > hw/sh4: Coding style: Remove tabs > hw/sh4: Coding style: Fix multi-line comments > hw/sh4: Coding style: White space fixes > hw/sh4: Coding style: Add missing braces > hw/sh4: Coding style: Remove unnecessary casts Reviewed-by: Philippe Mathieu-Daudé
[PATCH] ui/gtk: Update the refresh rate for gl-area too
This is a bugfix that stretches all the way back to January 2020, where I initially introduced this problem and potential solutions. A quick recap of the issue: QEMU did not sync up with the monitors refresh rate causing the VM to render frames that were NOT displayed to the user. That "fix" allowed QEMU to obtain the screen refreshrate information from the system using GDK API's and was for GTK only. Well, I'm back with the same issue again. But this time on Wayland. And I did NOT realize there was YET another screen refresh rate function, this time for Wayland specifically. Thankfully the fix was simple and without much hassle. Thanks, Nikola PS: It seems that my patch has gone missing from the mailing list, hence I'm sending it again. Sorry for any inconveniences. Signed-off-by: Nikola Pavlica --- ui/gtk-gl-area.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index b23523748e..afcb29f658 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -112,6 +112,9 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl) { VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); +vc->gfx.dcl.update_interval = gd_monitor_update_interval( +vc->window ? vc->window : vc->gfx.drawing_area); + if (!vc->gfx.gls) { if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { return; -- 2.33.0
[PATCH 0/4] target/alpha,arm,ppc: More uses of tcg_constant()
Few more cases where we can use tcg_constant(). Philippe Mathieu-Daudé (4): target/alpha: Use tcg_constant_i64() in gen_call_pal() target/arm: Use tcg_constant_i64() in do_sat_addsub_64() target/ppc: Use tcg_constant_tl() in gen_op_cmp() target/ppc: Use tcg_constant_i32() in gen_ld/st() target/alpha/translate.c | 9 +++-- target/arm/translate-sve.c | 17 target/ppc/translate.c | 40 -- 3 files changed, 28 insertions(+), 38 deletions(-) -- 2.31.1
[PATCH 3/4] target/ppc: Use tcg_constant_tl() in gen_op_cmp()
Avoid using a TCG temporary by moving the compared values to the constant pool. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/translate.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 518337bcb7f..507f6699f47 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1430,23 +1430,20 @@ static opc_handler_t invalid_handler = { static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf) { TCGv t0 = tcg_temp_new(); -TCGv t1 = tcg_temp_new(); TCGv_i32 t = tcg_temp_new_i32(); -tcg_gen_movi_tl(t0, CRF_EQ); -tcg_gen_movi_tl(t1, CRF_LT); tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU), - t0, arg0, arg1, t1, t0); -tcg_gen_movi_tl(t1, CRF_GT); + t0, arg0, arg1, + tcg_constant_tl(CRF_LT), tcg_constant_tl(CRF_EQ)); tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU), - t0, arg0, arg1, t1, t0); + t0, arg0, arg1, + tcg_constant_tl(CRF_GT), t0); tcg_gen_trunc_tl_i32(t, t0); tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so); tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t); tcg_temp_free(t0); -tcg_temp_free(t1); tcg_temp_free_i32(t); } -- 2.31.1
[PATCH 2/4] target/arm: Use tcg_constant_i64() in do_sat_addsub_64()
The immediate value used for comparison is constant and read-only. Move it to the constant pool. This frees a TCG temporary for unsigned saturation opcodes. Signed-off-by: Philippe Mathieu-Daudé --- target/arm/translate-sve.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index bc91a641711..76b5fe9f313 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1943,20 +1943,20 @@ static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) { TCGv_i64 t0 = tcg_temp_new_i64(); -TCGv_i64 t1 = tcg_temp_new_i64(); TCGv_i64 t2; if (u) { if (d) { tcg_gen_sub_i64(t0, reg, val); -tcg_gen_movi_i64(t1, 0); -tcg_gen_movcond_i64(TCG_COND_LTU, reg, reg, val, t1, t0); +t2 = tcg_constant_i64(0); +tcg_gen_movcond_i64(TCG_COND_LTU, reg, reg, val, t2, t0); } else { tcg_gen_add_i64(t0, reg, val); -tcg_gen_movi_i64(t1, -1); -tcg_gen_movcond_i64(TCG_COND_LTU, reg, t0, reg, t1, t0); +t2 = tcg_constant_i64(-1); +tcg_gen_movcond_i64(TCG_COND_LTU, reg, t0, reg, t2, t0); } } else { +TCGv_i64 t1 = tcg_temp_new_i64(); if (d) { /* Detect signed overflow for subtraction. */ tcg_gen_xor_i64(t0, reg, val); @@ -1966,7 +1966,7 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) /* Bound the result. */ tcg_gen_movi_i64(reg, INT64_MIN); -t2 = tcg_const_i64(0); +t2 = tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_LT, reg, t0, t2, reg, t1); } else { /* Detect signed overflow for addition. */ @@ -1977,13 +1977,12 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) /* Bound the result. */ tcg_gen_movi_i64(t1, INT64_MAX); -t2 = tcg_const_i64(0); +t2 = tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_LT, reg, t0, t2, t1, reg); } -tcg_temp_free_i64(t2); +tcg_temp_free_i64(t1); } tcg_temp_free_i64(t0); -tcg_temp_free_i64(t1); } /* Similarly with a vector and a scalar operand. */ -- 2.31.1
[PATCH 1/4] target/alpha: Use tcg_constant_i64() in gen_call_pal()
Avoid using a TCG temporary by moving the flag and exception address to the constant pool. Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index a4c3f43e720..326d4216aad 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1191,20 +1191,17 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode) return gen_excp(ctx, EXCP_CALL_PAL, palcode); #else { -TCGv tmp = tcg_temp_new(); uint64_t exc_addr = ctx->base.pc_next; uint64_t entry = ctx->palbr; if (ctx->tbflags & ENV_FLAG_PAL_MODE) { exc_addr |= 1; } else { -tcg_gen_movi_i64(tmp, 1); -st_flag_byte(tmp, ENV_FLAG_PAL_SHIFT); +st_flag_byte(tcg_constant_i64(1), ENV_FLAG_PAL_SHIFT); } -tcg_gen_movi_i64(tmp, exc_addr); -tcg_gen_st_i64(tmp, cpu_env, offsetof(CPUAlphaState, exc_addr)); -tcg_temp_free(tmp); +tcg_gen_st_i64(tcg_constant_i64(exc_addr), + cpu_env, offsetof(CPUAlphaState, exc_addr)); entry += (palcode & 0x80 ? 0x2000 + (palcode - 0x80) * 64 -- 2.31.1
[PATCH 4/4] target/ppc: Use tcg_constant_i32() in gen_ld/st()
Avoid using a TCG temporary by moving the MemOp index to the constant pool. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/translate.c | 29 + 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 507f6699f47..9a4ae61a39d 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3347,15 +3347,14 @@ static void gen_lq(DisasContext *ctx) if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { if (HAVE_ATOMIC128) { -TCGv_i32 oi = tcg_temp_new_i32(); +TCGv_i32 oi; if (ctx->le_mode) { -tcg_gen_movi_i32(oi, make_memop_idx(MO_LEQ, ctx->mem_idx)); +oi = tcg_constant_i32(make_memop_idx(MO_LEQ, ctx->mem_idx)); gen_helper_lq_le_parallel(lo, cpu_env, EA, oi); } else { -tcg_gen_movi_i32(oi, make_memop_idx(MO_BEQ, ctx->mem_idx)); +oi = tcg_constant_i32(make_memop_idx(MO_BEQ, ctx->mem_idx)); gen_helper_lq_be_parallel(lo, cpu_env, EA, oi); } -tcg_temp_free_i32(oi); tcg_gen_ld_i64(hi, cpu_env, offsetof(CPUPPCState, retxh)); } else { /* Restart with exclusive lock. */ @@ -3458,17 +3457,16 @@ static void gen_std(DisasContext *ctx) if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { if (HAVE_ATOMIC128) { -TCGv_i32 oi = tcg_temp_new_i32(); +TCGv_i32 oi; if (ctx->le_mode) { -tcg_gen_movi_i32(oi, make_memop_idx(MO_LE | MO_128, -ctx->mem_idx)); +oi = tcg_constant_i32(make_memop_idx(MO_LE | MO_128, + ctx->mem_idx)); gen_helper_stq_le_parallel(cpu_env, EA, lo, hi, oi); } else { -tcg_gen_movi_i32(oi, make_memop_idx(MO_BE | MO_128, -ctx->mem_idx)); +oi = tcg_constant_i32(make_memop_idx(MO_BE | MO_128, + ctx->mem_idx)); gen_helper_stq_be_parallel(cpu_env, EA, lo, hi, oi); } -tcg_temp_free_i32(oi); } else { /* Restart with exclusive lock. */ gen_helper_exit_atomic(cpu_env); @@ -4065,17 +4063,16 @@ static void gen_lqarx(DisasContext *ctx) if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { if (HAVE_ATOMIC128) { -TCGv_i32 oi = tcg_temp_new_i32(); +TCGv_i32 oi; if (ctx->le_mode) { -tcg_gen_movi_i32(oi, make_memop_idx(MO_LE | MO_128 | MO_ALIGN, -ctx->mem_idx)); +oi = tcg_constant_i32(make_memop_idx(MO_LE | MO_128 | MO_ALIGN, + ctx->mem_idx)); gen_helper_lq_le_parallel(lo, cpu_env, EA, oi); } else { -tcg_gen_movi_i32(oi, make_memop_idx(MO_BE | MO_128 | MO_ALIGN, -ctx->mem_idx)); +oi = tcg_constant_i32(make_memop_idx(MO_BE | MO_128 | MO_ALIGN, + ctx->mem_idx)); gen_helper_lq_be_parallel(lo, cpu_env, EA, oi); } -tcg_temp_free_i32(oi); tcg_gen_ld_i64(hi, cpu_env, offsetof(CPUPPCState, retxh)); } else { /* Restart with exclusive lock. */ -- 2.31.1
Re: [PATCH 17/33] target/mips: Convert MSA FILL opcode to decodetree
On 10/24/21 07:04, Richard Henderson wrote: > On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: >> Convert the FILL opcode (Vector Fill from GPR) to decodetree. >> >> Signed-off-by: Philippe Mathieu-Daudé >> --- >> target/mips/tcg/msa.decode | 2 ++ >> target/mips/tcg/msa_translate.c | 40 +++-- >> 2 files changed, 30 insertions(+), 12 deletions(-) >> +static bool trans_FILL(DisasContext *ctx, arg_msa_r *a) >> +{ >> + TCGv_i32 twd; >> + TCGv_i32 tws; >> + TCGv_i32 tdf; >> + >> + if (!check_msa_access(ctx)) { >> + return false; >> + } >> + >> + if (TARGET_LONG_BITS != 64 && a->df == DF_DOUBLE) { >> + /* Double format valid only for MIPS64 */ >> + gen_reserved_instruction(ctx); >> + return true; >> + } > > I expect this reserved check should be above the MSA is disabled check, > within check_msa_access. > >> + twd = tcg_const_i32(a->wd); >> + tws = tcg_const_i32(a->ws); > > tcg_constant_i32. Hmm I am confused here, only 'df' is constant, 'ws' is GPR[$rs]. Since it is limited in [0,32[ and used read-only by the helper, we can also pass it as constant?
Re: [PATCH 17/33] target/mips: Convert MSA FILL opcode to decodetree
On 10/24/21 9:44 AM, Philippe Mathieu-Daudé wrote: On 10/24/21 07:04, Richard Henderson wrote: On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: Convert the FILL opcode (Vector Fill from GPR) to decodetree. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 2 ++ target/mips/tcg/msa_translate.c | 40 +++-- 2 files changed, 30 insertions(+), 12 deletions(-) +static bool trans_FILL(DisasContext *ctx, arg_msa_r *a) +{ + TCGv_i32 twd; + TCGv_i32 tws; + TCGv_i32 tdf; + + if (!check_msa_access(ctx)) { + return false; + } + + if (TARGET_LONG_BITS != 64 && a->df == DF_DOUBLE) { + /* Double format valid only for MIPS64 */ + gen_reserved_instruction(ctx); + return true; + } I expect this reserved check should be above the MSA is disabled check, within check_msa_access. + twd = tcg_const_i32(a->wd); + tws = tcg_const_i32(a->ws); tcg_constant_i32. Hmm I am confused here, only 'df' is constant, 'ws' is GPR[$rs]. Since it is limited in [0,32[ and used read-only by the helper, we can also pass it as constant? What? You're passing the constant ws to the helper, not the contents of the gpr -- that's what the helper is expecting. r~
Re: [PATCH 20/33] target/mips: Convert MSA 3RF instruction format to decodetree (DF_HALF)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +static bool trans_msa_3rf(DisasContext *ctx, arg_msa_r *a, + enum CPUMIPSMSADataFormat df_base, + void (*gen_msa_3rf)(TCGv_ptr, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32)) +{ +TCGv_i32 twd = tcg_const_i32(a->wd); +TCGv_i32 tws = tcg_const_i32(a->ws); +TCGv_i32 twt = tcg_const_i32(a->wt); +/* adjust df value for floating-point instruction */ +TCGv_i32 tdf = tcg_constant_i32(a->df + df_base); I think it would be better to decode df completely in decodetree. E.g. %df_hw21:1 !function=plus_1 @3rf_hw .. . wt:5 ws:5 wd:5 .. &msa_r df=%df_hw %df_wd21:1 !function=plus_2 @3rf_wd .. . wt:5 ws:5 wd:5 .. &msa_r df=%df_wd Maybe I should get that !expression=(x+1) syntax going soon... r~
Re: [PATCH 20/33] target/mips: Convert MSA 3RF instruction format to decodetree (DF_HALF)
On 10/24/21 10:37 AM, Richard Henderson wrote: On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +static bool trans_msa_3rf(DisasContext *ctx, arg_msa_r *a, + enum CPUMIPSMSADataFormat df_base, + void (*gen_msa_3rf)(TCGv_ptr, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32)) +{ + TCGv_i32 twd = tcg_const_i32(a->wd); + TCGv_i32 tws = tcg_const_i32(a->ws); + TCGv_i32 twt = tcg_const_i32(a->wt); + /* adjust df value for floating-point instruction */ + TCGv_i32 tdf = tcg_constant_i32(a->df + df_base); I think it would be better to decode df completely in decodetree. E.g. %df_hw 21:1 !function=plus_1 @3rf_hw .. . wt:5 ws:5 wd:5 .. &msa_r df=%df_hw %df_wd 21:1 !function=plus_2 @3rf_wd .. . wt:5 ws:5 wd:5 .. &msa_r df=%df_wd Meant to say, with that changed, Reviewed-by: Richard Henderson r~
Re: [PATCH 21/33] target/mips: Convert MSA 3RF instruction format to decodetree (DF_WORD)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: Convert 3-register floating-point or fixed-point operations to decodetree. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 37 ++ target/mips/tcg/msa_translate.c | 213 ++-- 2 files changed, 74 insertions(+), 176 deletions(-) With the decode fixed as per the previous, Reviewed-by: Richard Henderson r~
Re: [PATCH 22/33] target/mips: Convert MSA 3R instruction format to decodetree (part 1/4)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +TCGv_i32 twd = tcg_const_i32(a->wd); +TCGv_i32 tws = tcg_const_i32(a->ws); +TCGv_i32 twt = tcg_const_i32(a->wt); tcg_constant_i32, otherwise, Reviewed-by: Richard Henderson r~
Re: [PATCH 22/33] target/mips: Convert MSA 3R instruction format to decodetree (part 1/4)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +static bool trans_msa_3r_df(DisasContext *ctx, arg_msa_r *a, +void (*gen_msa_3r_df)(TCGv_ptr, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32)) +{ +TCGv_i32 tdf = tcg_constant_i32(a->df); +TCGv_i32 twd = tcg_const_i32(a->wd); +TCGv_i32 tws = tcg_const_i32(a->ws); +TCGv_i32 twt = tcg_const_i32(a->wt); + +gen_msa_3r_df(cpu_env, tdf, twd, tws, twt); Missing check_msa_access. r~
Re: [PATCH 23/33] target/mips: Convert MSA 3R instruction format to decodetree (part 2/4)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +static bool trans_msa_3r(DisasContext *ctx, arg_msa_r *a, + void (*gen_msa_3r_b)(TCGv_ptr, TCGv_i32, + TCGv_i32, TCGv_i32), + void (*gen_msa_3r_h)(TCGv_ptr, TCGv_i32, + TCGv_i32, TCGv_i32), + void (*gen_msa_3r_w)(TCGv_ptr, TCGv_i32, + TCGv_i32, TCGv_i32), + void (*gen_msa_3r_d)(TCGv_ptr, TCGv_i32, + TCGv_i32, TCGv_i32)) Use a table, like before. +{ +TCGv_i32 twd = tcg_const_i32(a->wd); +TCGv_i32 tws = tcg_const_i32(a->ws); +TCGv_i32 twt = tcg_const_i32(a->wt); tcg_constant_i32. Check for NULL and return false, then do check_msa_access. r~
Re: [PATCH 24/33] target/mips: Convert MSA 3R instruction format to decodetree (part 3/4)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: Convert BINSL (Vector Bit Insert Left) and BINSR (Vector Bit Insert Right) opcodes to decodetree. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 3 +++ target/mips/tcg/msa_translate.c | 37 +++-- 2 files changed, 6 insertions(+), 34 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 25/33] target/mips: Convert MSA 3R instruction format to decodetree (part 4/4)
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: Convert 3-register operations to decodetree. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 53 ++ target/mips/tcg/msa_translate.c | 916 ++-- 2 files changed, 106 insertions(+), 863 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 00/33] target/mips: Fully convert MSA opcodes to decodetree
在 2021/10/23 22:47, Philippe Mathieu-Daudé 写道: Hi, This series converts 2000+ lines of switch() code to decodetree description, so this hard-to-review/modify switch is auto generated by the decodetree script. This is a big win for maintenance (and indeed the convertion revealed 2 bugs). Massive convertions are - beside being often boring - bug-prone. In this series we re-start running the MSA tests (the tests are run automagically in the 'build-user-static' job on gitlab CI). Although boring, the conversion is very clean, so I hope it will be easy enough to review. The TRANS*() macros are heavily used. When possible, constant fields are hold with tcg_constant(). Note, various opcodes can be optimized using TCG host vectors. We won't address that in this series, as it makes the resulting review harder. We will post that in a following series. Here we simply dummy-convert. The resulting msa.decode file is quite pleasant to look at, and the diff-stat is encouraging: number of LoC halved. Regards, Thanks that's really helpful! For the whole series: Reviewed-by: Jiaxun Yang Double checked decode tree opcode with manual. Thanks. - Jiaxun Phil. git: https://gitlab.com/philmd/qemu.git tree/mips-msa-decodetree Based-on: <20211023164329.328137-1-f4...@amsat.org> Philippe Mathieu-Daudé (33): tests/tcg: Fix some targets default cross compiler path target/mips: Fix MSA MADDV.B opcode target/mips: Fix MSA MSUBV.B opcode tests/tcg/mips: Run MSA opcodes tests on user-mode emulation target/mips: Have check_msa_access() return a boolean target/mips: Use enum definitions from CPUMIPSMSADataFormat enum target/mips: Rename sa16 -> sa, bz_df -> bz -> bz_v target/mips: Convert MSA LDI opcode to decodetree target/mips: Introduce generic TRANS_CHECK() for decodetree helpers target/mips: Extract df_extract() helper target/mips: Convert MSA I5 instruction format to decodetree target/mips: Convert MSA BIT instruction format to decodetree target/mips: Convert MSA SHF opcode to decodetree target/mips: Convert MSA I8 instruction format to decodetree target/mips: Convert MSA load/store instruction format to decodetree target/mips: Convert MSA 2RF instruction format to decodetree target/mips: Convert MSA FILL opcode to decodetree target/mips: Convert MSA 2R instruction format to decodetree target/mips: Convert MSA VEC instruction format to decodetree target/mips: Convert MSA 3RF instruction format to decodetree (DF_HALF) target/mips: Convert MSA 3RF instruction format to decodetree (DF_WORD) target/mips: Convert MSA 3R instruction format to decodetree (part 1/4) target/mips: Convert MSA 3R instruction format to decodetree (part 2/4) target/mips: Convert MSA 3R instruction format to decodetree (part 3/4) target/mips: Convert MSA 3R instruction format to decodetree (part 4/4) target/mips: Convert MSA ELM instruction format to decodetree target/mips: Convert MSA COPY_U opcode to decodetree target/mips: Convert MSA COPY_S and INSERT opcodes to decodetree target/mips: Convert MSA MOVE.V opcode to decodetree target/mips: Convert CFCMSA and CTCMSA opcodes to decodetree target/mips: Remove generic MSA opcode target/mips: Remove one MSA unnecessary decodetree overlap group target/mips: Adjust style in msa_translate_init() tests/tcg/mips/ase-msa.mak | 30 + target/mips/tcg/translate.h|9 + target/mips/tcg/msa.decode | 231 ++- target/mips/tcg/msa_helper.c | 64 +- target/mips/tcg/msa_translate.c| 2781 +++- MAINTAINERS|1 + tests/tcg/configure.sh | 14 +- tests/tcg/mips/Makefile.target |5 + tests/tcg/mips64/Makefile.target |9 + tests/tcg/mips64el/Makefile.target | 12 + tests/tcg/mipsel/Makefile.target |9 + 11 files changed, 1052 insertions(+), 2113 deletions(-) create mode 100644 tests/tcg/mips/ase-msa.mak create mode 100644 tests/tcg/mips64/Makefile.target create mode 100644 tests/tcg/mips64el/Makefile.target create mode 100644 tests/tcg/mipsel/Makefile.target
Re: [PATCH 22/33] target/mips: Convert MSA 3R instruction format to decodetree (part 1/4)
On 10/24/21 19:52, Richard Henderson wrote: > On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: >> +static bool trans_msa_3r_df(DisasContext *ctx, arg_msa_r *a, >> + void (*gen_msa_3r_df)(TCGv_ptr, TCGv_i32, >> TCGv_i32, >> + TCGv_i32, TCGv_i32)) >> +{ >> + TCGv_i32 tdf = tcg_constant_i32(a->df); >> + TCGv_i32 twd = tcg_const_i32(a->wd); >> + TCGv_i32 tws = tcg_const_i32(a->ws); >> + TCGv_i32 twt = tcg_const_i32(a->wt); >> + >> + gen_msa_3r_df(cpu_env, tdf, twd, tws, twt); > > Missing check_msa_access. It is included in TRANS_MSA(). How could I make that clearer? The style I follow is: - trans_UPPER() -> direct implementation - trans_lower() -> called via TRANS_xxx() macro
Re: [PATCH 00/33] target/mips: Fully convert MSA opcodes to decodetree
On 10/24/21 20:26, Jiaxun Yang wrote: > Thanks that's really helpful! > > For the whole series: > > Reviewed-by: Jiaxun Yang > > Double checked decode tree opcode with manual. Thank you! I'll respin addressing Richard comments but won't change the msa.decode file, so I'll include your R-b tag. Regards, Phil.
Re: [PATCH 22/33] target/mips: Convert MSA 3R instruction format to decodetree (part 1/4)
On 10/24/21 11:57 AM, Philippe Mathieu-Daudé wrote: On 10/24/21 19:52, Richard Henderson wrote: On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +static bool trans_msa_3r_df(DisasContext *ctx, arg_msa_r *a, + void (*gen_msa_3r_df)(TCGv_ptr, TCGv_i32, TCGv_i32, + TCGv_i32, TCGv_i32)) +{ + TCGv_i32 tdf = tcg_constant_i32(a->df); + TCGv_i32 twd = tcg_const_i32(a->wd); + TCGv_i32 tws = tcg_const_i32(a->ws); + TCGv_i32 twt = tcg_const_i32(a->wt); + + gen_msa_3r_df(cpu_env, tdf, twd, tws, twt); Missing check_msa_access. It is included in TRANS_MSA(). How could I make that clearer? The style I follow is: - trans_UPPER() -> direct implementation - trans_lower() -> called via TRANS_xxx() macro Hmm. I dunno. Especially since some of the cases require checking for the null function pointer *before* the access check. How many trans helpers do you wind up with in the end? Perhaps drop TRANS_MSA entirely? r~
Re: [PATCH 26/33] target/mips: Convert MSA ELM instruction format to decodetree
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +static bool trans_msa_elm_df(DisasContext *ctx, arg_msa_elm *a, + void (*gen_msa_elm_df)(TCGv_ptr, TCGv_i32, +TCGv_i32, TCGv_i32, +TCGv_i32)) +{ +TCGv_i32 twd; +TCGv_i32 tws; +TCGv_i32 tdf; +TCGv_i32 tn; +uint32_t df, n; + +if (!df_extract(df_elm, a->df, &df, &n)) { +gen_reserved_instruction(ctx); +return true; +} Again, I think this should happen before the access check. You could even return false from these extractions, because they represent an invalid encoding for this instruction. In a different context, there could be another grouped insn that matches. +twd = tcg_const_i32(a->wd); +tws = tcg_const_i32(a->ws); tcg_constant_i32. r~
Re: [PATCH 27/33] target/mips: Convert MSA COPY_U opcode to decodetree
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +#define TRANS_DF_W64(NAME, trans_func, gen_func) \ +TRANS_CHECK(NAME, check_msa_access(ctx), trans_func, \ +DF_HALF, DF_WORD, \ +gen_func##_b, gen_func##_h, gen_func##_w, NULL) Again with the table. +static bool trans_msa_elm_d64(DisasContext *ctx, arg_msa_elm *a, + enum CPUMIPSMSADataFormat df_max32, + enum CPUMIPSMSADataFormat df_max64, I think you should just arrange for the entries in the table to be null when the element variant is not defined. +twd = tcg_const_i32(a->wd); +tws = tcg_const_i32(a->ws); tcg_constant_i32. r~
Re: [PATCH 28/33] target/mips: Convert MSA COPY_S and INSERT opcodes to decodetree
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: Convert the COPY_S (Element Copy to GPR Signed) opcode and INSERT (GPR Insert Element) opcode to decodetree. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 2 + target/mips/tcg/msa_translate.c | 92 - 2 files changed, 12 insertions(+), 82 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 29/33] target/mips: Convert MSA MOVE.V opcode to decodetree
On 10/23/21 2:47 PM, Philippe Mathieu-Daudé wrote: +tsr = tcg_const_i32(a->ws); +tdt = tcg_const_i32(a->wd); tcg_constant_i32. Otherwise, Reviewed-by: Richard Henderson r~
Re: [PATCH 30/33] target/mips: Convert CFCMSA and CTCMSA opcodes to decodetree
On 10/23/21 2:48 PM, Philippe Mathieu-Daudé wrote: Convert the CFCMSA (Copy From Control MSA register) and CTCMSA (Copy To Control MSA register) opcodes to decodetree. Since they respectively overlap with the SLDI and SPLATI opcodes, use decodetree overlap groups. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 10 +++- target/mips/tcg/msa_translate.c | 95 - 2 files changed, 42 insertions(+), 63 deletions(-) There are a couple of tcg_const_i32 that should be tcg_constant_i32, but otherwise, Reviewed-by: Richard Henderson r~
Re: [PATCH 31/33] target/mips: Remove generic MSA opcode
On 10/23/21 2:48 PM, Philippe Mathieu-Daudé wrote: All opcodes have been converted to decodetree. The generic MSA handler is now pointless, remove it. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 2 -- target/mips/tcg/msa_translate.c | 7 --- 2 files changed, 9 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 32/33] target/mips: Remove one MSA unnecessary decodetree overlap group
On 10/23/21 2:48 PM, Philippe Mathieu-Daudé wrote: Only the MSA generic opcode was overlapping with the other instructions. Since the previous commit removed it, we can now remove the overlap group. The decodetree script forces us to re-indent the opcodes. Diff trivial to review using `git-diff --ignore-all-space`. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa.decode | 398 ++--- 1 file changed, 198 insertions(+), 200 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 33/33] target/mips: Adjust style in msa_translate_init()
On 10/23/21 2:48 PM, Philippe Mathieu-Daudé wrote: While the first 'off' variable assignment is unused, it helps to better understand the code logic. Move the assignation where it would have been used so it is easier to compare the MSA registers based on FPU ones versus the MSA specific registers. Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/msa_translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 1/4] target/alpha: Use tcg_constant_i64() in gen_call_pal()
On 10/24/21 9:16 AM, Philippe Mathieu-Daudé wrote: Avoid using a TCG temporary by moving the flag and exception address to the constant pool. Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 2/4] target/arm: Use tcg_constant_i64() in do_sat_addsub_64()
On 10/24/21 9:16 AM, Philippe Mathieu-Daudé wrote: The immediate value used for comparison is constant and read-only. Move it to the constant pool. This frees a TCG temporary for unsigned saturation opcodes. Signed-off-by: Philippe Mathieu-Daudé --- target/arm/translate-sve.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 3/4] target/ppc: Use tcg_constant_tl() in gen_op_cmp()
On 10/24/21 9:16 AM, Philippe Mathieu-Daudé wrote: Avoid using a TCG temporary by moving the compared values to the constant pool. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/translate.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH 4/4] target/ppc: Use tcg_constant_i32() in gen_ld/st()
On 10/24/21 9:16 AM, Philippe Mathieu-Daudé wrote: Avoid using a TCG temporary by moving the MemOp index to the constant pool. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/translate.c | 29 + 1 file changed, 13 insertions(+), 16 deletions(-) Reviewed-by: Richard Henderson r~
Re: [PATCH v3 13/21] target/riscv: support for 128-bit shift instructions
Le 20/10/2021 à 21:06, Richard Henderson a écrit : > On 10/19/21 2:48 AM, Frédéric Pétrot wrote: > > Hmm. 3 * (and + shift + cmp + cmov) + 2 * (sub + or) = 16 ops. > Not horrible... > > Let's see. > > ls = sh & 63; 1 > rs = -sh & 63; 3 > hs = sh & 64; 4 > > ll = s1l << ls; 5 > h0 = s1h << ls; 6 > lr = s1l >> rs; 7 > h1 = h0 | lr; 8 > > dl = hs ? 0 : ll; 10 > dh = hs ? ll : h1; 12 > > That seems right, and would be 4 ops smaller. > Would need testing of course. Nice ! The case when sh is 0 is specific, so we need an additional cmov, but this is still 3 ops better. Frédéric > > > r~ -- +---+ | Frédéric Pétrot, Pr. Grenoble INP-Ensimag/TIMA, Ensimag deputy director | | Mob/Pho: +33 6 74 57 99 65/+33 4 76 57 48 70 Ad augusta per angusta | | http://tima.univ-grenoble-alpes.fr frederic.pet...@univ-grenoble-alpes.fr | +---+
UASP and Streams
I have a question about the emulation of streams and UASP with the two xhci controller options QEMU supports: qemu-xhci and nec-usb-xhci It is my understanding that the UASP code checks to see if streams are supported by simply checking if the device is a Super Speed Device? https://gitlab.com/qemu-project/qemu/-/blob/master/hw/usb/dev-uas.c#L338 static bool uas_using_streams(UASDevice *uas) { return uas->dev.speed == USB_SPEED_SUPER; } The "qemu-xhci" xHC option supports streams, however the "nec-usb-xhci" xHC option does not. xHC:HCCPARAMS1: Bits 15:12 = 7 on the former and 0 on the latter. Also, the above code assumes the device attached supports streams. My question is, does QEMU's current implementation of UASP assume that streams are supported by the xHCI xHC? If so, UASP won't work with the "nec-usb-xhci" xHC option. Also, if the Guest OS doesn't support streams on a xHC that does--by this OS setting the correct values in the xHCI EndPoint's Context ( MaxPStreams = 0, LSA = 0, HID = 1, etc. )--a correct emulation should still work without streams, correct? Is the above information a correct assumption on the current UASP emulation, or have I missed something all-together? Anyway, I thank all of you who have put in so much time and effort into this emulator. It is much appreciated. Ben
Re: [PATCH 3/4] target/ppc: Use tcg_constant_tl() in gen_op_cmp()
On Sun, Oct 24, 2021 at 06:16:18PM +0200, Philippe Mathieu-Daudé wrote: > Avoid using a TCG temporary by moving the compared values > to the constant pool. > > Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson > --- > target/ppc/translate.c | 11 --- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/target/ppc/translate.c b/target/ppc/translate.c > index 518337bcb7f..507f6699f47 100644 > --- a/target/ppc/translate.c > +++ b/target/ppc/translate.c > @@ -1430,23 +1430,20 @@ static opc_handler_t invalid_handler = { > static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf) > { > TCGv t0 = tcg_temp_new(); > -TCGv t1 = tcg_temp_new(); > TCGv_i32 t = tcg_temp_new_i32(); > > -tcg_gen_movi_tl(t0, CRF_EQ); > -tcg_gen_movi_tl(t1, CRF_LT); > tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU), > - t0, arg0, arg1, t1, t0); > -tcg_gen_movi_tl(t1, CRF_GT); > + t0, arg0, arg1, > + tcg_constant_tl(CRF_LT), tcg_constant_tl(CRF_EQ)); > tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU), > - t0, arg0, arg1, t1, t0); > + t0, arg0, arg1, > + tcg_constant_tl(CRF_GT), t0); > > tcg_gen_trunc_tl_i32(t, t0); > tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so); > tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t); > > tcg_temp_free(t0); > -tcg_temp_free(t1); > tcg_temp_free_i32(t); > } > -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature
Re: [PATCH 4/4] target/ppc: Use tcg_constant_i32() in gen_ld/st()
On Sun, Oct 24, 2021 at 06:16:19PM +0200, Philippe Mathieu-Daudé wrote: > Avoid using a TCG temporary by moving the MemOp index > to the constant pool. > > Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson > --- > target/ppc/translate.c | 29 + > 1 file changed, 13 insertions(+), 16 deletions(-) > > diff --git a/target/ppc/translate.c b/target/ppc/translate.c > index 507f6699f47..9a4ae61a39d 100644 > --- a/target/ppc/translate.c > +++ b/target/ppc/translate.c > @@ -3347,15 +3347,14 @@ static void gen_lq(DisasContext *ctx) > > if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { > if (HAVE_ATOMIC128) { > -TCGv_i32 oi = tcg_temp_new_i32(); > +TCGv_i32 oi; > if (ctx->le_mode) { > -tcg_gen_movi_i32(oi, make_memop_idx(MO_LEQ, ctx->mem_idx)); > +oi = tcg_constant_i32(make_memop_idx(MO_LEQ, ctx->mem_idx)); > gen_helper_lq_le_parallel(lo, cpu_env, EA, oi); > } else { > -tcg_gen_movi_i32(oi, make_memop_idx(MO_BEQ, ctx->mem_idx)); > +oi = tcg_constant_i32(make_memop_idx(MO_BEQ, ctx->mem_idx)); > gen_helper_lq_be_parallel(lo, cpu_env, EA, oi); > } > -tcg_temp_free_i32(oi); > tcg_gen_ld_i64(hi, cpu_env, offsetof(CPUPPCState, retxh)); > } else { > /* Restart with exclusive lock. */ > @@ -3458,17 +3457,16 @@ static void gen_std(DisasContext *ctx) > > if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { > if (HAVE_ATOMIC128) { > -TCGv_i32 oi = tcg_temp_new_i32(); > +TCGv_i32 oi; > if (ctx->le_mode) { > -tcg_gen_movi_i32(oi, make_memop_idx(MO_LE | MO_128, > -ctx->mem_idx)); > +oi = tcg_constant_i32(make_memop_idx(MO_LE | MO_128, > + ctx->mem_idx)); > gen_helper_stq_le_parallel(cpu_env, EA, lo, hi, oi); > } else { > -tcg_gen_movi_i32(oi, make_memop_idx(MO_BE | MO_128, > -ctx->mem_idx)); > +oi = tcg_constant_i32(make_memop_idx(MO_BE | MO_128, > + ctx->mem_idx)); > gen_helper_stq_be_parallel(cpu_env, EA, lo, hi, oi); > } > -tcg_temp_free_i32(oi); > } else { > /* Restart with exclusive lock. */ > gen_helper_exit_atomic(cpu_env); > @@ -4065,17 +4063,16 @@ static void gen_lqarx(DisasContext *ctx) > > if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { > if (HAVE_ATOMIC128) { > -TCGv_i32 oi = tcg_temp_new_i32(); > +TCGv_i32 oi; > if (ctx->le_mode) { > -tcg_gen_movi_i32(oi, make_memop_idx(MO_LE | MO_128 | > MO_ALIGN, > -ctx->mem_idx)); > +oi = tcg_constant_i32(make_memop_idx(MO_LE | MO_128 | > MO_ALIGN, > + ctx->mem_idx)); > gen_helper_lq_le_parallel(lo, cpu_env, EA, oi); > } else { > -tcg_gen_movi_i32(oi, make_memop_idx(MO_BE | MO_128 | > MO_ALIGN, > -ctx->mem_idx)); > +oi = tcg_constant_i32(make_memop_idx(MO_BE | MO_128 | > MO_ALIGN, > + ctx->mem_idx)); > gen_helper_lq_be_parallel(lo, cpu_env, EA, oi); > } > -tcg_temp_free_i32(oi); > tcg_gen_ld_i64(hi, cpu_env, offsetof(CPUPPCState, retxh)); > } else { > /* Restart with exclusive lock. */ -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature
Re: gitlab/cirrus auth token failure
On 10/24/21 12:42 AM, Paolo Bonzini wrote: On 22/10/21 20:31, Richard Henderson wrote: Hi Daniel, you win the cookie because you committed cirrus.yml. I should have reported this before the weekend, but at some point this week the auth tokens expired(?). All of the cirrus-run tests are now failing: cirrus_run.api.CirrusAPIError: API returned 1 error(s): [ { 'extensions': {'classification': 'DataFetchingException'}, 'locations': [{'column': 13, 'line': 5}], 'message': 'Exception while fetching data (/createBuild) : ' 'AccessTokenAuthorization(token=[MASKED]) ' "doesn't have permissions to create builds for " '5748266831446016!', 'path': ['createBuild']}] It seems to have fixed itself for kvm-unit-tests, so maybe it was just a temporary issue within cirrus itself? It's still failing today. r~
Re: [PATCH v16 5/8] [RISCV_PM] Print new PM CSRs in QEMU logs
On Sat, Oct 23, 2021 at 4:27 AM Alexey Baturo wrote: > > Signed-off-by: Alexey Baturo Reviewed-by: Alistair Francis Alistair > --- > target/riscv/cpu.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index 6b767a4a0b..16fac64806 100644 > --- a/target/riscv/cpu.c > +++ b/target/riscv/cpu.c > @@ -271,6 +271,13 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f, > int flags) > CSR_MSCRATCH, > CSR_SSCRATCH, > CSR_SATP, > +CSR_MMTE, > +CSR_UPMBASE, > +CSR_UPMMASK, > +CSR_SPMBASE, > +CSR_SPMMASK, > +CSR_MPMBASE, > +CSR_MPMMASK, > }; > > for (int i = 0; i < ARRAY_SIZE(dump_csrs); ++i) { > -- > 2.30.2 > >
[PATCH] hw/riscv: opentitan: Fixup the PLIC context addresses
From: Alistair Francis Fixup the PLIC context address to correctly support the threshold and claim register. Fixes: ef63100648 ("hw/riscv: opentitan: Update to the latest build") Signed-off-by: Alistair Francis --- hw/riscv/opentitan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 83e1511f28..c531450b9f 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -161,8 +161,8 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp) qdev_prop_set_uint32(DEVICE(&s->plic), "pending-base", 0x1000); qdev_prop_set_uint32(DEVICE(&s->plic), "enable-base", 0x2000); qdev_prop_set_uint32(DEVICE(&s->plic), "enable-stride", 0x18); -qdev_prop_set_uint32(DEVICE(&s->plic), "context-base", 0x24); -qdev_prop_set_uint32(DEVICE(&s->plic), "context-stride", 4); +qdev_prop_set_uint32(DEVICE(&s->plic), "context-base", 0x20); +qdev_prop_set_uint32(DEVICE(&s->plic), "context-stride", 8); qdev_prop_set_uint32(DEVICE(&s->plic), "aperture-size", memmap[IBEX_DEV_PLIC].size); if (!sysbus_realize(SYS_BUS_DEVICE(&s->plic), errp)) { -- 2.31.1
Re: [PATCH] hw/riscv: opentitan: Fixup the PLIC context addresses
On Mon, Oct 25, 2021 at 12:07 PM Alistair Francis wrote: > > From: Alistair Francis > > Fixup the PLIC context address to correctly support the threshold and > claim register. > > Fixes: ef63100648 ("hw/riscv: opentitan: Update to the latest build") > Signed-off-by: Alistair Francis > --- > hw/riscv/opentitan.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Bin Meng
Re: [PATCH v16 0/8] RISC-V Pointer Masking implementation
On Sat, Oct 23, 2021 at 4:23 AM Alexey Baturo wrote: > > v15: > Renamed pm into pointer_masking in machine state. > > v14: > Addressed Richard's comments from previous series. > > v13: > Rebased QEMU and addressed Richard's comment. > > v12: > Updated function for adjusting address with pointer masking to allocate and > use temp register. > > v11: > Addressed a few style issues Alistair mentioned in the previous review. > > If this patch series would be accepted, I think my further attention would be > to: > - Support pm for memory operations for RVV > - Add proper csr and support pm for memory operations for Hypervisor mode > - Support address wrapping on unaligned accesses as @Richard mentioned > previously > > Thanks! > > Alexey Baturo (7): > [RISCV_PM] Add J-extension into RISC-V > [RISCV_PM] Add CSR defines for RISC-V PM extension > [RISCV_PM] Support CSRs required for RISC-V PM extension except for > the h-mode > [RISCV_PM] Add J extension state description > [RISCV_PM] Print new PM CSRs in QEMU logs > [RISCV_PM] Support pointer masking for RISC-V for i/c/f/d/a types of > instructions > [RISCV_PM] Allow experimental J-ext to be turned on > > Anatoly Parshintsev (1): > [RISCV_PM] Implement address masking functions required for RISC-V > Pointer Masking extension Thanks! Applied to riscv-to-apply.next I added a "target/riscv: " prefix to each patch title to indicate that the patches are for RISC-V. Alistair > > target/riscv/cpu.c | 13 ++ > target/riscv/cpu.h | 15 ++ > target/riscv/cpu_bits.h | 96 > target/riscv/cpu_helper.c | 18 ++ > target/riscv/csr.c | 285 > target/riscv/insn_trans/trans_rva.c.inc | 3 + > target/riscv/insn_trans/trans_rvd.c.inc | 2 + > target/riscv/insn_trans/trans_rvf.c.inc | 2 + > target/riscv/insn_trans/trans_rvi.c.inc | 2 + > target/riscv/machine.c | 27 +++ > target/riscv/translate.c| 43 > 11 files changed, 506 insertions(+) > > -- > 2.30.2 > >
[PATCH v4 5/5] block: Deprecate transaction type drive-backup
Several moons ago, Vladimir posted Subject: [PATCH v2 3/3] qapi: deprecate drive-backup Date: Wed, 5 May 2021 16:58:03 +0300 Message-Id: <20210505135803.67896-4-vsement...@virtuozzo.com> https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg01394.html with this TODO: We also need to deprecate drive-backup transaction action.. But union members in QAPI doesn't support 'deprecated' feature. I tried to dig a bit, but failed :/ Markus, could you please help with it? At least by advice? This is one way to resolve it. Sorry it took so long. John explored another way, namely adding feature flags to union branches. Could also be useful, say to add different features to branches in multiple unions sharing the same tag enum. Signed-off-by: Markus Armbruster --- qapi/transaction.json | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qapi/transaction.json b/qapi/transaction.json index d175b5f863..381a2df782 100644 --- a/qapi/transaction.json +++ b/qapi/transaction.json @@ -54,6 +54,10 @@ # @blockdev-snapshot-sync: since 1.1 # @drive-backup: Since 1.6 # +# Features: +# @deprecated: Member @drive-backup is deprecated. Use member +# @blockdev-backup instead. +# # Since: 1.1 ## { 'enum': 'TransactionActionKind', @@ -62,7 +66,7 @@ 'block-dirty-bitmap-disable', 'block-dirty-bitmap-merge', 'blockdev-backup', 'blockdev-snapshot', 'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync', -'drive-backup' ] } +{ 'name': 'drive-backup', 'features': [ 'deprecated' ] } ] } ## # @AbortWrapper: -- 2.31.1
[PATCH v4 3/5] qapi: Move compat policy from QObject to generic visitor
The next commit needs to access compat policy from the generic visitor core. Move it there from qobject input and output visitor. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- include/qapi/qobject-input-visitor.h | 4 include/qapi/qobject-output-visitor.h | 4 include/qapi/visitor-impl.h | 3 +++ include/qapi/visitor.h| 9 + qapi/qapi-visit-core.c| 9 + qapi/qmp-dispatch.c | 4 ++-- qapi/qobject-input-visitor.c | 14 +- qapi/qobject-output-visitor.c | 14 +- 8 files changed, 25 insertions(+), 36 deletions(-) diff --git a/include/qapi/qobject-input-visitor.h b/include/qapi/qobject-input-visitor.h index 8d69388810..95985e25e5 100644 --- a/include/qapi/qobject-input-visitor.h +++ b/include/qapi/qobject-input-visitor.h @@ -15,7 +15,6 @@ #ifndef QOBJECT_INPUT_VISITOR_H #define QOBJECT_INPUT_VISITOR_H -#include "qapi/qapi-types-compat.h" #include "qapi/visitor.h" typedef struct QObjectInputVisitor QObjectInputVisitor; @@ -59,9 +58,6 @@ typedef struct QObjectInputVisitor QObjectInputVisitor; */ Visitor *qobject_input_visitor_new(QObject *obj); -void qobject_input_visitor_set_policy(Visitor *v, - CompatPolicyInput deprecated); - /* * Create a QObject input visitor for @obj for use with keyval_parse() * diff --git a/include/qapi/qobject-output-visitor.h b/include/qapi/qobject-output-visitor.h index f2a2f92a00..2b1726baf5 100644 --- a/include/qapi/qobject-output-visitor.h +++ b/include/qapi/qobject-output-visitor.h @@ -15,7 +15,6 @@ #define QOBJECT_OUTPUT_VISITOR_H #include "qapi/visitor.h" -#include "qapi/qapi-types-compat.h" typedef struct QObjectOutputVisitor QObjectOutputVisitor; @@ -54,7 +53,4 @@ typedef struct QObjectOutputVisitor QObjectOutputVisitor; */ Visitor *qobject_output_visitor_new(QObject **result); -void qobject_output_visitor_set_policy(Visitor *v, - CompatPolicyOutput deprecated); - #endif diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 3b950f6e3d..72b6537bef 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -122,6 +122,9 @@ struct Visitor /* Must be set */ VisitorType type; +/* Optional */ +struct CompatPolicy compat_policy; + /* Must be set for output visitors, optional otherwise. */ void (*complete)(Visitor *v, void *opaque); diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index b3c9ef7a81..dcb96018a9 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -16,6 +16,7 @@ #define QAPI_VISITOR_H #include "qapi/qapi-builtin-types.h" +#include "qapi/qapi-types-compat.h" /* * The QAPI schema defines both a set of C data types, and a QMP wire @@ -477,6 +478,14 @@ bool visit_deprecated_accept(Visitor *v, const char *name, Error **errp); */ bool visit_deprecated(Visitor *v, const char *name); +/* + * Set policy for handling deprecated management interfaces. + * + * Intended use: call visit_set_policy(v, &compat_policy) when + * visiting management interface input or output. + */ +void visit_set_policy(Visitor *v, CompatPolicy *policy); + /* * Visit an enum value. * diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index a641adec51..066f77a26d 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -19,6 +19,10 @@ #include "qapi/visitor-impl.h" #include "trace.h" +/* Zero-initialization must result in default policy */ +QEMU_BUILD_BUG_ON(COMPAT_POLICY_INPUT_ACCEPT || COMPAT_POLICY_OUTPUT_ACCEPT); + + void visit_complete(Visitor *v, void *opaque) { assert(v->type != VISITOR_OUTPUT || v->complete); @@ -153,6 +157,11 @@ bool visit_deprecated(Visitor *v, const char *name) return true; } +void visit_set_policy(Visitor *v, CompatPolicy *policy) +{ +v->compat_policy = *policy; +} + bool visit_is_input(Visitor *v) { return v->type == VISITOR_INPUT; diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 59600210ce..7e943a0af5 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -32,7 +32,7 @@ Visitor *qobject_input_visitor_new_qmp(QObject *obj) { Visitor *v = qobject_input_visitor_new(obj); -qobject_input_visitor_set_policy(v, compat_policy.deprecated_input); +visit_set_policy(v, &compat_policy); return v; } @@ -40,7 +40,7 @@ Visitor *qobject_output_visitor_new_qmp(QObject **result) { Visitor *v = qobject_output_visitor_new(result); -qobject_output_visitor_set_policy(v, compat_policy.deprecated_output); +visit_set_policy(v, &compat_policy); return v; } diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index 04b790412e..71b24a4429 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -14,7 +14,6 @@ #include "qemu/osdep.h" #include -#include "qapi/compat-p
[PATCH v4 0/5] qapi: Add feature flags to enum members
PATCH 1+2 add feature flags to enum members. Awkward due to an introspection design mistake; see PATCH 1 for details. PATCH 3+4 implement policy deprecated-input={reject,crash} for enum values. Policy deprecated-output=hide is not implemented, because we can't hide a value without hiding the entire member, which is almost certainly more than the requester of this policy bargained for. Perhaps we want a new policy deprecated-output=hide-or-else-crash to help us catch unwanted use of deprecated enum values. Perhaps we want deprecated-output=hide to behave that way together with deprecated-input=crash. Or even always. Thoughts? PATCH 5 puts the new feature flags to use. It's RFC because it makes sense only on top of Vladimir's deprecation of drive-backup. See its commit message for a reference. I prefer to commit new features together with a use outside tests/. PATCH 5 adds such a use, but it's RFC, because it depends on Vladimir's work. Perhaps another use pops up. I can delay this work in the hope of a use becoming ready, but the feature flags work I have in the pipeline will eventually force my hand. v4: * PATCH 1: Deprecate SchemaInfoEnum member @values. * PATCH 2: Doc tweak v3: * PATCH 1+2: Update qapi-code-gen.rst [Kevin, Eric] * PATCH 4: Commit message typo [Eric], doc update moved to PATCH 2 * PATCH 5: Doc comment FIXME resolved [Kevin] v2: * Rebased with straightforward conflicts. * PATCH 1-4: No longer RFC. * PATCH 1: "Since" information fixed [Eric]. Commit message updated to reflect feedback. * PATCH 2: Commit message amended to point out special feature flag 'deprecated' is ignored at this stage. * PATCH 4: Documentation updated. Commit message tweaked. Markus Armbruster (5): qapi: Enable enum member introspection to show more than name qapi: Add feature flags to enum members qapi: Move compat policy from QObject to generic visitor qapi: Implement deprecated-input={reject,crash} for enum values block: Deprecate transaction type drive-backup docs/about/deprecated.rst | 6 docs/devel/qapi-code-gen.rst | 29 ++- qapi/compat.json | 3 ++ qapi/introspect.json | 28 -- qapi/transaction.json | 6 +++- include/qapi/qobject-input-visitor.h | 4 --- include/qapi/qobject-output-visitor.h | 4 --- include/qapi/util.h | 6 +++- include/qapi/visitor-impl.h | 3 ++ include/qapi/visitor.h| 9 ++ qapi/qapi-visit-core.c| 27 +++-- qapi/qmp-dispatch.c | 4 +-- qapi/qobject-input-visitor.c | 14 + qapi/qobject-output-visitor.c | 14 + scripts/qapi/expr.py | 3 +- scripts/qapi/introspect.py| 19 +--- scripts/qapi/schema.py| 22 -- scripts/qapi/types.py | 17 ++- tests/qapi-schema/doc-good.json | 5 +++- tests/qapi-schema/doc-good.out| 3 ++ tests/qapi-schema/doc-good.txt| 3 ++ .../qapi-schema/enum-dict-member-unknown.err | 2 +- tests/qapi-schema/qapi-schema-test.json | 3 +- tests/qapi-schema/qapi-schema-test.out| 1 + tests/qapi-schema/test-qapi.py| 1 + 25 files changed, 174 insertions(+), 62 deletions(-) -- 2.31.1
[PATCH v4 4/5] qapi: Implement deprecated-input={reject, crash} for enum values
This copies the code implementing the policy from qapi/qmp-dispatch.c to qapi/qobject-input-visitor.c. Tolerable, but if we acquire more copies, we should look into factoring them out. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Tested-by: Peter Krempa Acked-by: Peter Krempa --- qapi/compat.json | 3 ++- include/qapi/util.h| 6 +- qapi/qapi-visit-core.c | 18 +++--- scripts/qapi/types.py | 17 - 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/qapi/compat.json b/qapi/compat.json index 1d2b76f00c..74a8493d3d 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -42,7 +42,8 @@ # with feature 'deprecated'. We may want to extend it to cover # semantic aspects, CLI, and experimental features. # -# Limitation: not implemented for deprecated enumeration values. +# Limitation: deprecated-output policy @hide is not implemented for +# enumeration values. They behave the same as with policy @accept. # # @deprecated-input: how to handle deprecated input (default 'accept') # @deprecated-output: how to handle deprecated output (default 'accept') diff --git a/include/qapi/util.h b/include/qapi/util.h index d7bfb30e25..257c600f99 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -11,9 +11,13 @@ #ifndef QAPI_UTIL_H #define QAPI_UTIL_H +/* QEnumLookup flags */ +#define QAPI_ENUM_DEPRECATED 1 + typedef struct QEnumLookup { const char *const *array; -int size; +const unsigned char *const flags; +const int size; } QEnumLookup; const char *qapi_enum_lookup(const QEnumLookup *lookup, int val); diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 066f77a26d..49136ae88e 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -393,7 +393,7 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj, const QEnumLookup *lookup, Error **errp) { int64_t value; -char *enum_str; +g_autofree char *enum_str = NULL; if (!visit_type_str(v, name, &enum_str, errp)) { return false; @@ -402,11 +402,23 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj, value = qapi_enum_parse(lookup, enum_str, -1, NULL); if (value < 0) { error_setg(errp, QERR_INVALID_PARAMETER, enum_str); -g_free(enum_str); return false; } -g_free(enum_str); +if (lookup->flags && (lookup->flags[value] & QAPI_ENUM_DEPRECATED)) { +switch (v->compat_policy.deprecated_input) { +case COMPAT_POLICY_INPUT_ACCEPT: +break; +case COMPAT_POLICY_INPUT_REJECT: +error_setg(errp, "Deprecated value '%s' disabled by policy", + enum_str); +return false; +case COMPAT_POLICY_INPUT_CRASH: +default: +abort(); +} +} + *obj = value; return true; } diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 831294fe42..ab2441adc9 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -38,6 +38,8 @@ def gen_enum_lookup(name: str, members: List[QAPISchemaEnumMember], prefix: Optional[str] = None) -> str: +max_index = c_enum_const(name, '_MAX', prefix) +flags = '' ret = mcgen(''' const QEnumLookup %(c_name)s_lookup = { @@ -52,13 +54,26 @@ def gen_enum_lookup(name: str, ''', index=index, name=memb.name) ret += memb.ifcond.gen_endif() +if 'deprecated' in (f.name for f in memb.features): +flags += mcgen(''' +[%(index)s] = QAPI_ENUM_DEPRECATED, +''', + index=index) + +if flags: +ret += mcgen(''' +}, +.flags = (const unsigned char[%(max_index)s]) { +''', + max_index=max_index) +ret += flags ret += mcgen(''' }, .size = %(max_index)s }; ''', - max_index=c_enum_const(name, '_MAX', prefix)) + max_index=max_index) return ret -- 2.31.1
[PATCH v4 2/5] qapi: Add feature flags to enum members
This is quite similar to commit 84ab008687 "qapi: Add feature flags to struct members", only for enums instead of structs. Special feature flag 'deprecated' is silently ignored there. This is okay only because it will be implemented shortly. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- docs/devel/qapi-code-gen.rst | 16 +- qapi/compat.json | 2 ++ qapi/introspect.json | 5 - scripts/qapi/expr.py | 3 ++- scripts/qapi/introspect.py| 5 +++-- scripts/qapi/schema.py| 22 +-- tests/qapi-schema/doc-good.json | 5 - tests/qapi-schema/doc-good.out| 3 +++ tests/qapi-schema/doc-good.txt| 3 +++ .../qapi-schema/enum-dict-member-unknown.err | 2 +- tests/qapi-schema/qapi-schema-test.json | 3 ++- tests/qapi-schema/qapi-schema-test.out| 1 + tests/qapi-schema/test-qapi.py| 1 + 13 files changed, 57 insertions(+), 14 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index d267889d2c..4071c9074a 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -200,7 +200,9 @@ Syntax:: '*if': COND, '*features': FEATURES } ENUM-VALUE = STRING - | { 'name': STRING, '*if': COND } + | { 'name': STRING, + '*if': COND, + '*features': FEATURES } Member 'enum' names the enum type. @@ -706,8 +708,10 @@ QEMU shows a certain behaviour. Special features -Feature "deprecated" marks a command, event, or struct member as -deprecated. It is not supported elsewhere so far. +Feature "deprecated" marks a command, event, enum value, or struct +member as deprecated. It is not supported elsewhere so far. +Interfaces so marked may be withdrawn in future releases in accordance +with QEMU's deprecation policy. Naming rules and reserved names @@ -1157,7 +1161,8 @@ and "variants". "members" is a JSON array describing the object's common members, if any. Each element is a JSON object with members "name" (the member's -name), "type" (the name of its type), and optionally "default". The +name), "type" (the name of its type), "features" (a JSON array of +feature strings), and "default". The latter two are optional. The member is optional if "default" is present. Currently, "default" can only have value null. Other values are reserved for future extensions. The "members" array is in no particular order; clients @@ -1234,7 +1239,8 @@ The SchemaInfo for an enumeration type has meta-type "enum" and variant member "members". "members" is a JSON array describing the enumeration values. Each -element is a JSON object with member "name" (the member's name). The +element is a JSON object with member "name" (the member's name), and +optionally "features" (a JSON array of feature strings). The "members" array is in no particular order; clients must search the entire array when learning whether a particular value is supported. diff --git a/qapi/compat.json b/qapi/compat.json index ae3afc22df..1d2b76f00c 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -42,6 +42,8 @@ # with feature 'deprecated'. We may want to extend it to cover # semantic aspects, CLI, and experimental features. # +# Limitation: not implemented for deprecated enumeration values. +# # @deprecated-input: how to handle deprecated input (default 'accept') # @deprecated-output: how to handle deprecated output (default 'accept') # diff --git a/qapi/introspect.json b/qapi/introspect.json index 9683e884f8..183148b2e9 100644 --- a/qapi/introspect.json +++ b/qapi/introspect.json @@ -167,10 +167,13 @@ # # @name: the member's name, as defined in the QAPI schema. # +# @features: names of features associated with the member, in no +#particular order. +# # Since: 6.2 ## { 'struct': 'SchemaInfoEnumMember', - 'data': { 'name': 'str' } } + 'data': { 'name': 'str', '*features': [ 'str' ] } } ## # @SchemaInfoArray: diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 819ea6ad97..3cb389e875 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -472,7 +472,7 @@ def check_enum(expr: _JSONObject, info: QAPISourceInfo) -> None: for m in members] for member in members: source = "'data' member" -check_keys(member, info, source, ['name'], ['if']) +check_keys(member, info, source, ['name'], ['if', 'features']) member_name = member['name'] check_name_is_str(member_name, info, source) source = "%s '%s'" % (source, member_name) @@ -483,6 +483,7 @@ def check_enum(expr: _JSONObject, info: QAPISourceInfo) -> None: permit_upper=permissive, permit_underscore=perm
[PATCH v4 1/5] qapi: Enable enum member introspection to show more than name
The next commit will add feature flags to enum members. There's a problem, though: query-qmp-schema shows an enum type's members as an array of member names (SchemaInfoEnum member @values). If it showed an array of objects with a name member, we could simply add more members to these objects. Since it's just strings, we can't. I can see three ways to correct this design mistake: 1. Do it the way we should have done it, plus compatibility goo. We want a ['SchemaInfoEnumMember'] member in SchemaInfoEnum. Since changing @values would be a compatibility break, add a new member @members instead. @values is now redundant. In my testing, output of qemu-system-x86_64's query-qmp-schema grows by 11% (18.5KiB). We can deprecate @values now and drop it later. This will break outmoded clients. Well-behaved clients such as libvirt are expected to break cleanly. 2. Like 1, but omit "boring" elements of @member, and empty @member. @values does not become redundant. @members augments it. Somewhat cumbersome, but output of query-qmp-schema grows only as we make enum members non-boring. There is nothing to deprecate here. 3. Versioned query-qmp-schema. query-qmp-schema provides either @values or @members. The QMP client can select which version it wants. There is no redundant output. We can deprecate old versions and eventually drop them. This will break outmoded clients. Breaking cleanly is easier than for 1. While 1 and 2 operate within the common rules for compatible evolution apply (section "Compatibility considerations" in docs/devel/qapi-code-gen.rst), 3 bypasses them. Attractive when operating within the rules is just too awkward. Not the case here. This commit implements 1. Libvirt developers prefer it. Deprecate @values in favour of @members. Since query-qmp-schema compatibility is pretty fundamental for management applications, an extended grace period is advised. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Tested-by: Peter Krempa Acked-by: Peter Krempa --- docs/about/deprecated.rst| 6 ++ docs/devel/qapi-code-gen.rst | 15 +++ qapi/introspect.json | 25 +++-- scripts/qapi/introspect.py | 18 ++ 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 0bed6ecb1d..be19317470 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -228,6 +228,12 @@ Use the more generic commands ``block-export-add`` and ``block-export-del`` instead. As part of this deprecation, where ``nbd-server-add`` used a single ``bitmap``, the new ``block-export-add`` uses a list of ``bitmaps``. +``query-qmp-schema`` return value member ``values`` (since 6.2) +''' + +Member ``values`` in return value elements with meta-type ``enum`` is +deprecated. Use ``members`` instead. + System accelerators --- diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index b2569de486..d267889d2c 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -1231,14 +1231,21 @@ Example: the SchemaInfo for ['str'] :: "element-type": "str" } The SchemaInfo for an enumeration type has meta-type "enum" and -variant member "values". The values are listed in no particular -order; clients must search the entire enum when learning whether a -particular value is supported. +variant member "members". + +"members" is a JSON array describing the enumeration values. Each +element is a JSON object with member "name" (the member's name). The +"members" array is in no particular order; clients must search the +entire array when learning whether a particular value is supported. Example: the SchemaInfo for MyEnum from section `Enumeration types`_ :: { "name": "MyEnum", "meta-type": "enum", - "values": [ "value1", "value2", "value3" ] } + "members": [ +{ "name": "value1" }, +{ "name": "value2" }, +{ "name": "value3" } + ] } The SchemaInfo for a built-in type has the same name as the type in the QAPI schema (see section `Built-in Types`_), with one exception diff --git a/qapi/introspect.json b/qapi/introspect.json index 39bd303778..9683e884f8 100644 --- a/qapi/introspect.json +++ b/qapi/introspect.json @@ -142,14 +142,35 @@ # # Additional SchemaInfo members for meta-type 'enum'. # -# @values: the enumeration type's values, in no particular order. +# @members: the enum type's members, in no particular order +# (since 6.2). +# +# @values: the enumeration type's member names, in no particular order. +# Redundant with @members. Just for backward compatibility. +# +# Features: +# @deprecated: Member @values is deprecated. Use @members instead. # # Values of this type are JSON string on the wire. # # Since: 2.5
[Bug 1761798] Re: live migration intermittently fails in CI with "VQ 0 size 0x80 Guest index 0x12c inconsistent with Host index 0x134: delta 0xfff8"
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1761798 Title: live migration intermittently fails in CI with "VQ 0 size 0x80 Guest index 0x12c inconsistent with Host index 0x134: delta 0xfff8" Status in OpenStack Compute (nova): Expired Status in QEMU: Expired Bug description: Seen here: http://logs.openstack.org/37/522537/20/check/legacy-tempest-dsvm- multinode-live- migration/8de6e74/logs/subnode-2/libvirt/qemu/instance-0002.txt.gz 2018-04-05T21:48:38.205752Z qemu-system-x86_64: -chardev pty,id=charserial0,logfile=/dev/fdset/1,logappend=on: char device redirected to /dev/pts/0 (label charserial0) warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5] 2018-04-05T21:48:43.153268Z qemu-system-x86_64: VQ 0 size 0x80 Guest index 0x12c inconsistent with Host index 0x134: delta 0xfff8 2018-04-05T21:48:43.153288Z qemu-system-x86_64: Failed to load virtio-blk:virtio 2018-04-05T21:48:43.153292Z qemu-system-x86_64: error while loading state for instance 0x0 of device ':00:04.0/virtio-blk' 2018-04-05T21:48:43.153347Z qemu-system-x86_64: load of migration failed: Operation not permitted 2018-04-05 21:48:43.198+: shutting down, reason=crashed And in the n-cpu logs on the other host: http://logs.openstack.org/37/522537/20/check/legacy-tempest-dsvm- multinode-live-migration/8de6e74/logs/screen-n- cpu.txt.gz#_Apr_05_21_48_43_257541 There is a related Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1450524 The CI job failures are at present using the Pike UCA: ii libvirt-bin 3.6.0-1ubuntu6.2~cloud0 ii qemu-system-x86 1:2.10+dfsg-0ubuntu3.5~cloud0 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1761798/+subscriptions
[Bug 1761798] Re: live migration intermittently fails in CI with "VQ 0 size 0x80 Guest index 0x12c inconsistent with Host index 0x134: delta 0xfff8"
[Expired for OpenStack Compute (nova) because there has been no activity for 60 days.] ** Changed in: nova Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1761798 Title: live migration intermittently fails in CI with "VQ 0 size 0x80 Guest index 0x12c inconsistent with Host index 0x134: delta 0xfff8" Status in OpenStack Compute (nova): Expired Status in QEMU: Expired Bug description: Seen here: http://logs.openstack.org/37/522537/20/check/legacy-tempest-dsvm- multinode-live- migration/8de6e74/logs/subnode-2/libvirt/qemu/instance-0002.txt.gz 2018-04-05T21:48:38.205752Z qemu-system-x86_64: -chardev pty,id=charserial0,logfile=/dev/fdset/1,logappend=on: char device redirected to /dev/pts/0 (label charserial0) warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5] 2018-04-05T21:48:43.153268Z qemu-system-x86_64: VQ 0 size 0x80 Guest index 0x12c inconsistent with Host index 0x134: delta 0xfff8 2018-04-05T21:48:43.153288Z qemu-system-x86_64: Failed to load virtio-blk:virtio 2018-04-05T21:48:43.153292Z qemu-system-x86_64: error while loading state for instance 0x0 of device ':00:04.0/virtio-blk' 2018-04-05T21:48:43.153347Z qemu-system-x86_64: load of migration failed: Operation not permitted 2018-04-05 21:48:43.198+: shutting down, reason=crashed And in the n-cpu logs on the other host: http://logs.openstack.org/37/522537/20/check/legacy-tempest-dsvm- multinode-live-migration/8de6e74/logs/screen-n- cpu.txt.gz#_Apr_05_21_48_43_257541 There is a related Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1450524 The CI job failures are at present using the Pike UCA: ii libvirt-bin 3.6.0-1ubuntu6.2~cloud0 ii qemu-system-x86 1:2.10+dfsg-0ubuntu3.5~cloud0 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1761798/+subscriptions
Re: [PATCH v3 1/5] qapi: Enable enum member introspection to show more than name
Markus Armbruster writes: > The next commit will add feature flags to enum members. There's a > problem, though: query-qmp-schema shows an enum type's members as an > array of member names (SchemaInfoEnum member @values). If it showed > an array of objects with a name member, we could simply add more > members to these objects. Since it's just strings, we can't. > > I can see three ways to correct this design mistake: > > 1. Do it the way we should have done it, plus compatibility goo. > >We want a ['SchemaInfoEnumMember'] member in SchemaInfoEnum. Since >changing @values would be a compatibility break, add a new member >@members instead. > >@values is now redundant. In my testing, output of >qemu-system-x86_64's query-qmp-schema grows by 11% (18.5KiB). > >We can deprecate @values now and drop it later. This will break >outmoded clients. Well-behaved clients such as libvirt are >expected to break cleanly. > > 2. Like 1, but omit "boring" elements of @member, and empty @member. > >@values does not become redundant. @members augments it. Somewhat >cumbersome, but output of query-qmp-schema grows only as we make >enum members non-boring. > >There is nothing to deprecate here. > > 3. Versioned query-qmp-schema. > >query-qmp-schema provides either @values or @members. The QMP >client can select which version it wants. There is no redundant >output. > >We can deprecate old versions and eventually drop them. This will >break outmoded clients. Breaking cleanly is easier than for 1. > >While 1 and 2 operate within the common rules for compatible >evolution apply (section "Compatibility considerations" in >docs/devel/qapi-code-gen.rst), 3 bypasses them. Attractive when >operating within the rules is just too awkward. Not the case here. > > This commit implements 1. Libvirt developers prefer it. > > Signed-off-by: Markus Armbruster > Reviewed-by: Eric Blake > Tested-by: Peter Krempa > Acked-by: Peter Krempa I meant to deprecate @values, but forgot. I should really do it right away, because... > --- > docs/devel/qapi-code-gen.rst | 15 +++ > qapi/introspect.json | 21 +++-- > scripts/qapi/introspect.py | 18 ++ > 3 files changed, 44 insertions(+), 10 deletions(-) > > diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst > index b2569de486..d267889d2c 100644 > --- a/docs/devel/qapi-code-gen.rst > +++ b/docs/devel/qapi-code-gen.rst > @@ -1231,14 +1231,21 @@ Example: the SchemaInfo for ['str'] :: >"element-type": "str" } > > The SchemaInfo for an enumeration type has meta-type "enum" and > -variant member "values". The values are listed in no particular > -order; clients must search the entire enum when learning whether a > -particular value is supported. > +variant member "members". > + > +"members" is a JSON array describing the enumeration values. Each > +element is a JSON object with member "name" (the member's name). The > +"members" array is in no particular order; clients must search the > +entire array when learning whether a particular value is supported. > > Example: the SchemaInfo for MyEnum from section `Enumeration types`_ :: > > { "name": "MyEnum", "meta-type": "enum", > - "values": [ "value1", "value2", "value3" ] } > + "members": [ > +{ "name": "value1" }, > +{ "name": "value2" }, > +{ "name": "value3" } > + ] } > > The SchemaInfo for a built-in type has the same name as the type in > the QAPI schema (see section `Built-in Types`_), with one exception ... this doesn't document @values anymore, only @members. Done in v5. [...]
Re: [PATCH v4 5/5] block: Deprecate transaction type drive-backup
I neglected to put RFC in the subject.
[PATCH 3/9] qapi: Eliminate QCO_NO_OPTIONS for a slight simplification
Signed-off-by: Markus Armbruster --- include/qapi/qmp/dispatch.h | 1 - monitor/misc.c | 3 +-- scripts/qapi/commands.py| 5 + 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 075203dc67..0ce88200b9 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -21,7 +21,6 @@ typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); typedef enum QmpCommandOptions { -QCO_NO_OPTIONS= 0x0, QCO_NO_SUCCESS_RESP = (1U << 0), QCO_ALLOW_OOB = (1U << 1), QCO_ALLOW_PRECONFIG = (1U << 2), diff --git a/monitor/misc.c b/monitor/misc.c index ffe7966870..3556b177f6 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -230,8 +230,7 @@ static void monitor_init_qmp_commands(void) qmp_init_marshal(&qmp_commands); -qmp_register_command(&qmp_commands, "device_add", qmp_device_add, - QCO_NO_OPTIONS); +qmp_register_command(&qmp_commands, "device_add", qmp_device_add, 0); QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 3654825968..c8a975528f 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -229,15 +229,12 @@ def gen_register_command(name: str, if coroutine: options += ['QCO_COROUTINE'] -if not options: -options = ['QCO_NO_OPTIONS'] - ret = mcgen(''' qmp_register_command(cmds, "%(name)s", qmp_marshal_%(c_name)s, %(opts)s); ''', name=name, c_name=c_name(name), -opts=" | ".join(options)) +opts=' | '.join(options) or 0) return ret -- 2.31.1
[PATCH 6/9] qapi: Generalize command policy checking
The code to check command policy can see special feature flag 'deprecated' as command flag QCO_DEPRECATED. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. To let me make it visible, add member @special_features (a bitset of QapiSpecialFeature) to QmpCommand, and adjust the generator to pass it through qmp_register_command(). Then replace "QCO_DEPRECATED in @flags" by QAPI_DEPRECATED in @special_features", and drop QCO_DEPRECATED. Signed-off-by: Markus Armbruster --- include/qapi/qmp/dispatch.h | 5 +++-- monitor/misc.c | 6 -- qapi/qmp-dispatch.c | 2 +- qapi/qmp-registry.c | 4 +++- storage-daemon/qemu-storage-daemon.c | 3 ++- scripts/qapi/commands.py | 9 - 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 0ce88200b9..1e4240fd0d 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -25,7 +25,6 @@ typedef enum QmpCommandOptions QCO_ALLOW_OOB = (1U << 1), QCO_ALLOW_PRECONFIG = (1U << 2), QCO_COROUTINE = (1U << 3), -QCO_DEPRECATED= (1U << 4), } QmpCommandOptions; typedef struct QmpCommand @@ -34,6 +33,7 @@ typedef struct QmpCommand /* Runs in coroutine context if QCO_COROUTINE is set */ QmpCommandFunc *fn; QmpCommandOptions options; +unsigned special_features; QTAILQ_ENTRY(QmpCommand) node; bool enabled; const char *disable_reason; @@ -42,7 +42,8 @@ typedef struct QmpCommand typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList; void qmp_register_command(QmpCommandList *cmds, const char *name, - QmpCommandFunc *fn, QmpCommandOptions options); + QmpCommandFunc *fn, QmpCommandOptions options, + unsigned special_features); const QmpCommand *qmp_find_command(const QmpCommandList *cmds, const char *name); void qmp_disable_command(QmpCommandList *cmds, const char *name, diff --git a/monitor/misc.c b/monitor/misc.c index 3556b177f6..c2d227a07c 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -230,11 +230,13 @@ static void monitor_init_qmp_commands(void) qmp_init_marshal(&qmp_commands); -qmp_register_command(&qmp_commands, "device_add", qmp_device_add, 0); +qmp_register_command(&qmp_commands, "device_add", + qmp_device_add, 0, 0); QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", - qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG); + qmp_marshal_qmp_capabilities, + QCO_ALLOW_PRECONFIG, 0); } /* Set the current CPU defined by the user. Callers must hold BQL. */ diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 7e943a0af5..8cca18c891 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -176,7 +176,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, "The command %s has not been found", command); goto out; } -if (cmd->options & QCO_DEPRECATED) { +if (cmd->special_features & 1u << QAPI_DEPRECATED) { switch (compat_policy.deprecated_input) { case COMPAT_POLICY_INPUT_ACCEPT: break; diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index f78c064aae..485bc5e6fc 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -16,7 +16,8 @@ #include "qapi/qmp/dispatch.h" void qmp_register_command(QmpCommandList *cmds, const char *name, - QmpCommandFunc *fn, QmpCommandOptions options) + QmpCommandFunc *fn, QmpCommandOptions options, + unsigned special_features) { QmpCommand *cmd = g_malloc0(sizeof(*cmd)); @@ -27,6 +28,7 @@ void qmp_register_command(QmpCommandList *cmds, const char *name, cmd->fn = fn; cmd->enabled = true; cmd->options = options; +cmd->special_features = special_features; QTAILQ_INSERT_TAIL(cmds, cmd, node); } diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c index 10a1a33761..52cf17e8ac 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -146,7 +146,8 @@ static void init_qmp_commands(void) QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", - qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG); + qmp_marshal_qmp_capabilities, + QCO_ALLOW_PRECONFIG, 0); } static int getopt_set_loc(int argc, char **argv, const char *optstring, diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index c8a
[PATCH 4/9] qapi: Tools for sets of special feature flags in generated code
New enum QapiSpecialFeature enumerates the special feature flags. New helper gen_special_features() returns code to represent a collection of special feature flags as a bitset. The next few commits will put them to use. Signed-off-by: Markus Armbruster --- include/qapi/util.h| 4 scripts/qapi/gen.py| 13 + scripts/qapi/schema.py | 3 +++ 3 files changed, 20 insertions(+) diff --git a/include/qapi/util.h b/include/qapi/util.h index 257c600f99..7a8d5c7d72 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -11,6 +11,10 @@ #ifndef QAPI_UTIL_H #define QAPI_UTIL_H +typedef enum { +QAPI_DEPRECATED, +} QapiSpecialFeature; + /* QEnumLookup flags */ #define QAPI_ENUM_DEPRECATED 1 diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 2ec1e7b3b6..9d07b88cf6 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -29,6 +29,7 @@ mcgen, ) from .schema import ( +QAPISchemaFeature, QAPISchemaIfCond, QAPISchemaModule, QAPISchemaObjectType, @@ -37,6 +38,18 @@ from .source import QAPISourceInfo +def gen_special_features(features: QAPISchemaFeature): +ret = '' +sep = '' + +for feat in features: +if feat.is_special(): +ret += ('%s1u << QAPI_%s' % (sep, feat.name.upper())) +sep = ' | ' + +return ret or '0' + + class QAPIGen: def __init__(self, fname: str): self.fname = fname diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 6d5f46509a..55f82d7389 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -725,6 +725,9 @@ def connect_doc(self, doc): class QAPISchemaFeature(QAPISchemaMember): role = 'feature' +def is_special(self): +return self.name in ('deprecated') + class QAPISchemaObjectTypeMember(QAPISchemaMember): def __init__(self, name, info, typ, optional, ifcond=None, features=None): -- 2.31.1
[PATCH 2/9] qapi: Mark unstable QMP parts with feature 'unstable'
Add special feature 'unstable' everywhere the name starts with 'x-', except for InputBarrierProperties member x-origin and MemoryBackendProperties member x-use-canonical-path-for-ramblock-id, because these two are actually stable. Signed-off-by: Markus Armbruster --- qapi/block-core.json | 123 +++ qapi/migration.json | 35 +--- qapi/misc.json | 6 ++- qapi/qom.json| 11 ++-- 4 files changed, 130 insertions(+), 45 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 6d3217abb6..ce2c1352cb 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1438,6 +1438,9 @@ # # @x-perf: Performance options. (Since 6.0) # +# Features: +# @unstable: Member @x-perf is experimental. +# # Note: @on-source-error and @on-target-error only affect background # I/O. If an error occurs during a guest write request, the device's # rerror/werror actions will be used. @@ -1452,7 +1455,9 @@ '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', '*auto-finalize': 'bool', '*auto-dismiss': 'bool', -'*filter-node-name': 'str', '*x-perf': 'BackupPerf' } } +'*filter-node-name': 'str', +'*x-perf': { 'type': 'BackupPerf', + 'features': [ 'unstable' ] } } } ## # @DriveBackup: @@ -1916,9 +1921,13 @@ # # Get the block graph. # +# Features: +# @unstable: This command is meant for debugging. +# # Since: 4.0 ## -{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph' } +{ 'command': 'x-debug-query-block-graph', 'returns': 'XDbgBlockGraph', + 'features': [ 'unstable' ] } ## # @drive-mirror: @@ -2257,6 +2266,9 @@ # # Get bitmap SHA256. # +# Features: +# @unstable: This command is meant for debugging. +# # Returns: - BlockDirtyBitmapSha256 on success # - If @node is not a valid block device, DeviceNotFound # - If @name is not found or if hashing has failed, GenericError with an @@ -2265,7 +2277,8 @@ # Since: 2.10 ## { 'command': 'x-debug-block-dirty-bitmap-sha256', - 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' } + 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256', + 'features': [ 'unstable' ] } ## # @blockdev-mirror: @@ -2495,27 +2508,57 @@ # # Properties for throttle-group objects. # -# The options starting with x- are aliases for the same key without x- in -# the @limits object. As indicated by the x- prefix, this is not a stable -# interface and may be removed or changed incompatibly in the future. Use -# @limits for a supported stable interface. -# # @limits: limits to apply for this throttle group # +# Features: +# @unstable: All members starting with x- are aliases for the same key +#without x- in the @limits object. This is not a stable +#interface and may be removed or changed incompatibly in +#the future. Use @limits for a supported stable +#interface. +# # Since: 2.11 ## { 'struct': 'ThrottleGroupProperties', 'data': { '*limits': 'ThrottleLimits', -'*x-iops-total' : 'int', '*x-iops-total-max' : 'int', -'*x-iops-total-max-length' : 'int', '*x-iops-read' : 'int', -'*x-iops-read-max' : 'int', '*x-iops-read-max-length' : 'int', -'*x-iops-write' : 'int', '*x-iops-write-max' : 'int', -'*x-iops-write-max-length' : 'int', '*x-bps-total' : 'int', -'*x-bps-total-max' : 'int', '*x-bps-total-max-length' : 'int', -'*x-bps-read' : 'int', '*x-bps-read-max' : 'int', -'*x-bps-read-max-length' : 'int', '*x-bps-write' : 'int', -'*x-bps-write-max' : 'int', '*x-bps-write-max-length' : 'int', -'*x-iops-size' : 'int' } } +'*x-iops-total': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-total-max': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-total-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-read': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-read-max': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-read-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-write': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-write-max': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-iops-write-max-length': { 'type': 'int', + 'features': [ 'unstable' ] }, +'*x-bps-total': { 'type': 'int', + 'features
[PATCH 5/9] qapi: Generalize struct member policy checking
The generated visitor functions call visit_deprecated_accept() and visit_deprecated() when visiting a struct member with special feature flag 'deprecated'. This makes the feature flag visible to the actual visitors. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. To let me make it visible, replace these functions by visit_policy_reject() and visit_policy_skip(), which take the member's special features as an argument. Note that the new functions have the opposite sense, i.e. the return value flips. Signed-off-by: Markus Armbruster --- include/qapi/visitor-impl.h | 6 -- include/qapi/visitor.h| 17 + qapi/qapi-forward-visitor.c | 16 +--- qapi/qapi-visit-core.c| 22 -- qapi/qobject-input-visitor.c | 15 ++- qapi/qobject-output-visitor.c | 9 ++--- qapi/trace-events | 4 ++-- scripts/qapi/visit.py | 14 +++--- 8 files changed, 63 insertions(+), 40 deletions(-) diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 72b6537bef..2badec5ba4 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -114,10 +114,12 @@ struct Visitor void (*optional)(Visitor *v, const char *name, bool *present); /* Optional */ -bool (*deprecated_accept)(Visitor *v, const char *name, Error **errp); +bool (*policy_reject)(Visitor *v, const char *name, + unsigned special_features, Error **errp); /* Optional */ -bool (*deprecated)(Visitor *v, const char *name); +bool (*policy_skip)(Visitor *v, const char *name, +unsigned special_features); /* Must be set */ VisitorType type; diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index dcb96018a9..d53a84c9ba 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -461,22 +461,31 @@ void visit_end_alternate(Visitor *v, void **obj); bool visit_optional(Visitor *v, const char *name, bool *present); /* - * Should we reject deprecated member @name? + * Should we reject member @name due to policy? + * + * @special_features is the member's special features encoded as a + * bitset of QapiSpecialFeature. * * @name must not be NULL. This function is only useful between * visit_start_struct() and visit_end_struct(), since only objects * have deprecated members. */ -bool visit_deprecated_accept(Visitor *v, const char *name, Error **errp); +bool visit_policy_reject(Visitor *v, const char *name, + unsigned special_features, Error **errp); /* - * Should we visit deprecated member @name? + * + * Should we skip member @name due to policy? + * + * @special_features is the member's special features encoded as a + * bitset of QapiSpecialFeature. * * @name must not be NULL. This function is only useful between * visit_start_struct() and visit_end_struct(), since only objects * have deprecated members. */ -bool visit_deprecated(Visitor *v, const char *name); +bool visit_policy_skip(Visitor *v, const char *name, + unsigned special_features); /* * Set policy for handling deprecated management interfaces. diff --git a/qapi/qapi-forward-visitor.c b/qapi/qapi-forward-visitor.c index a4b111e22a..25d098aa8a 100644 --- a/qapi/qapi-forward-visitor.c +++ b/qapi/qapi-forward-visitor.c @@ -246,25 +246,27 @@ static void forward_field_optional(Visitor *v, const char *name, bool *present) visit_optional(ffv->target, name, present); } -static bool forward_field_deprecated_accept(Visitor *v, const char *name, -Error **errp) +static bool forward_field_policy_reject(Visitor *v, const char *name, +unsigned special_features, +Error **errp) { ForwardFieldVisitor *ffv = to_ffv(v); if (!forward_field_translate_name(ffv, &name, errp)) { return false; } -return visit_deprecated_accept(ffv->target, name, errp); +return visit_policy_reject(ffv->target, name, special_features, errp); } -static bool forward_field_deprecated(Visitor *v, const char *name) +static bool forward_field_policy_skip(Visitor *v, const char *name, + unsigned special_features) { ForwardFieldVisitor *ffv = to_ffv(v); if (!forward_field_translate_name(ffv, &name, NULL)) { return false; } -return visit_deprecated(ffv->target, name); +return visit_policy_skip(ffv->target, name, special_features); } static void forward_field_complete(Visitor *v, void *opaque) @@ -313,8 +315,8 @@ Visitor *visitor_forward_field(Visitor *target, const char *from, const char *to v->visitor.type_any = forward_field_type_any; v->visitor.type_null = forward_field_type_null; v->visitor.optional = forward_field_optional; -v->visitor.de
[PATCH 9/9] qapi: Extend -compat to set policy for unstable interfaces
New option parameters unstable-input and unstable-output set policy for unstable interfaces just like deprecated-input and deprecated-output set policy for deprecated interfaces (see commit 6dd75472d5 "qemu-options: New -compat to set policy for deprecated interfaces"). This is intended for testing users of the management interfaces. It is experimental. For now, this covers only syntactic aspects of QMP, i.e. stuff tagged with feature 'unstable'. We may want to extend it to cover semantic aspects, or the command line. Note that there is no good way for management application to detect presence of these new option parameters: they are not visible output of query-qmp-schema or query-command-line-options. Tolerable, because it's meant for testing. If running with -compat fails, skip the test. Signed-off-by: Markus Armbruster --- qapi/compat.json | 6 +- include/qapi/util.h | 1 + qapi/qmp-dispatch.c | 6 ++ qapi/qobject-output-visitor.c | 8 ++-- qemu-options.hx | 20 +++- scripts/qapi/events.py| 10 ++ scripts/qapi/schema.py| 10 ++ 7 files changed, 49 insertions(+), 12 deletions(-) diff --git a/qapi/compat.json b/qapi/compat.json index 74a8493d3d..9bc9804abb 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -47,9 +47,13 @@ # # @deprecated-input: how to handle deprecated input (default 'accept') # @deprecated-output: how to handle deprecated output (default 'accept') +# @unstable-input: how to handle unstable input (default 'accept') +# @unstable-output: how to handle unstable output (default 'accept') # # Since: 6.0 ## { 'struct': 'CompatPolicy', 'data': { '*deprecated-input': 'CompatPolicyInput', -'*deprecated-output': 'CompatPolicyOutput' } } +'*deprecated-output': 'CompatPolicyOutput', +'*unstable-input': 'CompatPolicyInput', +'*unstable-output': 'CompatPolicyOutput' } } diff --git a/include/qapi/util.h b/include/qapi/util.h index 0cc98db9f9..81a2b13a33 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -13,6 +13,7 @@ typedef enum { QAPI_DEPRECATED, +QAPI_UNSTABLE, } QapiSpecialFeature; typedef struct QEnumLookup { diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index e29ade134c..c5c6e521a2 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -59,6 +59,12 @@ bool compat_policy_input_ok(unsigned special_features, error_class, kind, name, errp)) { return false; } +if ((special_features & (1u << QAPI_UNSTABLE)) +&& !compat_policy_input_ok1("Unstable", +policy->unstable_input, +error_class, kind, name, errp)) { +return false; +} return true; } diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c index b5c6564cbb..74770edd73 100644 --- a/qapi/qobject-output-visitor.c +++ b/qapi/qobject-output-visitor.c @@ -212,8 +212,12 @@ static bool qobject_output_type_null(Visitor *v, const char *name, static bool qobject_output_policy_skip(Visitor *v, const char *name, unsigned special_features) { -return !(special_features && 1u << QAPI_DEPRECATED) -|| v->compat_policy.deprecated_output == COMPAT_POLICY_OUTPUT_HIDE; +CompatPolicy *pol = &v->compat_policy; + +return ((special_features & 1u << QAPI_DEPRECATED) +&& pol->deprecated_output == COMPAT_POLICY_OUTPUT_HIDE) +|| ((special_features & 1u << QAPI_UNSTABLE) +&& pol->unstable_output == COMPAT_POLICY_OUTPUT_HIDE); } /* Finish building, and return the root object. diff --git a/qemu-options.hx b/qemu-options.hx index 5f375bbfa6..f051536b63 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3641,7 +3641,9 @@ DEFHEADING(Debug/Expert options:) DEF("compat", HAS_ARG, QEMU_OPTION_compat, "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept|hide]\n" -"Policy for handling deprecated management interfaces\n", +"Policy for handling deprecated management interfaces\n" +"-compat [unstable-input=accept|reject|crash][,unstable-output=accept|hide]\n" +"Policy for handling unstable management interfaces\n", QEMU_ARCH_ALL) SRST ``-compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}]`` @@ -3659,6 +3661,22 @@ SRST Suppress deprecated command results and events Limitation: covers only syntactic aspects of QMP. + +``-compat [unstable-input=@var{input-policy}][,unstable-output=@var{output-policy}]`` +Set policy for handling unstable management interfaces (experimental): + +``unstable-input=accept`` (default) +Accept unstable commands and arguments +``unstable-input=reject`` +Reject unstable commands and arguments +
[PATCH 1/9] qapi: New special feature flag "unstable"
By convention, names starting with "x-" are experimental. The parts of external interfaces so named may be withdrawn or changed incompatibly in future releases. Drawback: promoting something from experimental to stable involves a name change. Client code needs to be updated. Moreover, the convention is not universally observed: * QOM type "input-barrier" has properties "x-origin", "y-origin". Looks accidental, but it's ABI since 4.2. * QOM types "memory-backend-file", "memory-backend-memfd", "memory-backend-ram", and "memory-backend-epc" have a property "x-use-canonical-path-for-ramblock-id" that is documented to be stable despite its name. We could document these exceptions, but documentation helps only humans. We want to recognize "unstable" in code, like "deprecated". Replace the convention by a new special feature flag "unstable". It will be recognized by the QAPI generator, like the existing feature flag "deprecated", and unlike regular feature flags. This commit updates documentation and prepares tests. The next commit updates the QAPI schema. The remaining patches update the QAPI generator and wire up -compat policy checking. Signed-off-by: Markus Armbruster --- docs/devel/qapi-code-gen.rst| 9 ++--- tests/qapi-schema/qapi-schema-test.json | 7 +-- tests/qapi-schema/qapi-schema-test.out | 5 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index 4071c9074a..38f2d7aad3 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -713,6 +713,10 @@ member as deprecated. It is not supported elsewhere so far. Interfaces so marked may be withdrawn in future releases in accordance with QEMU's deprecation policy. +Feature "unstable" marks a command, event, enum value, or struct +member as unstable. It is not supported elsewhere so far. Interfaces +so marked may be withdrawn or changed incompatibly in future releases. + Naming rules and reserved names --- @@ -746,9 +750,8 @@ Member name ``u`` and names starting with ``has-`` or ``has_`` are reserved for the generator, which uses them for unions and for tracking optional members. -Any name (command, event, type, member, or enum value) beginning with -``x-`` is marked experimental, and may be withdrawn or changed -incompatibly in a future release. +Names beginning with ``x-`` used to signify "experimental". This +convention has been replaced by special feature "unstable". Pragmas ``command-name-exceptions`` and ``member-name-exceptions`` let you violate naming rules. Use for new code is strongly discouraged. See diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index b677ab861d..43b8697002 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -273,7 +273,7 @@ 'data': { 'foo': { 'type': 'int', 'features': [ 'deprecated' ] } }, 'features': [ 'feature1' ] } { 'struct': 'FeatureStruct2', - 'data': { 'foo': 'int' }, + 'data': { 'foo': { 'type': 'int', 'features': [ 'unstable' ] } }, 'features': [ { 'name': 'feature1' } ] } { 'struct': 'FeatureStruct3', 'data': { 'foo': 'int' }, @@ -331,7 +331,7 @@ { 'command': 'test-command-features1', 'features': [ 'deprecated' ] } { 'command': 'test-command-features3', - 'features': [ 'feature1', 'feature2' ] } + 'features': [ 'unstable', 'feature1', 'feature2' ] } { 'command': 'test-command-cond-features1', 'features': [ { 'name': 'feature1', 'if': 'TEST_IF_FEATURE_1'} ] } @@ -348,3 +348,6 @@ { 'event': 'TEST_EVENT_FEATURES1', 'features': [ 'deprecated' ] } + +{ 'event': 'TEST_EVENT_FEATURES2', + 'features': [ 'unstable' ] } diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index 16846dbeb8..1f9585fa9b 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -308,6 +308,7 @@ object FeatureStruct1 feature feature1 object FeatureStruct2 member foo: int optional=False +feature unstable feature feature1 object FeatureStruct3 member foo: int optional=False @@ -373,6 +374,7 @@ command test-command-features1 None -> None feature deprecated command test-command-features3 None -> None gen=True success_response=True boxed=False oob=False preconfig=False +feature unstable feature feature1 feature feature2 command test-command-cond-features1 None -> None @@ -394,6 +396,9 @@ event TEST_EVENT_FEATURES0 FeatureStruct1 event TEST_EVENT_FEATURES1 None boxed=False feature deprecated +event TEST_EVENT_FEATURES2 None +boxed=False +feature unstable module include/sub-module.json include sub-sub-module.json object SecondArrayRef -- 2.31.1
[PATCH 7/9] qapi: Generalize enum member policy checking
The code to check enumeration value policy can see special feature flag 'deprecated' in QEnumLookup member flags[value]. I want to make feature flag 'unstable' visible there as well, so I can add policy for it. Instead of extending flags[], replace it by @special_features (a bitset of QapiSpecialFeature), because that's how special features get passed around elsewhere. Signed-off-by: Markus Armbruster --- include/qapi/util.h| 5 + qapi/qapi-visit-core.c | 3 ++- scripts/qapi/types.py | 22 -- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/qapi/util.h b/include/qapi/util.h index 7a8d5c7d72..0cc98db9f9 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -15,12 +15,9 @@ typedef enum { QAPI_DEPRECATED, } QapiSpecialFeature; -/* QEnumLookup flags */ -#define QAPI_ENUM_DEPRECATED 1 - typedef struct QEnumLookup { const char *const *array; -const unsigned char *const flags; +const unsigned char *const special_features; const int size; } QEnumLookup; diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index b4a81f1757..5572d90efb 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -407,7 +407,8 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj, return false; } -if (lookup->flags && (lookup->flags[value] & QAPI_ENUM_DEPRECATED)) { +if (lookup->special_features +&& (lookup->special_features[value] & QAPI_DEPRECATED)) { switch (v->compat_policy.deprecated_input) { case COMPAT_POLICY_INPUT_ACCEPT: break; diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index ab2441adc9..3013329c24 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -16,7 +16,7 @@ from typing import List, Optional from .common import c_enum_const, c_name, mcgen -from .gen import QAPISchemaModularCVisitor, ifcontext +from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext from .schema import ( QAPISchema, QAPISchemaEnumMember, @@ -39,7 +39,7 @@ def gen_enum_lookup(name: str, members: List[QAPISchemaEnumMember], prefix: Optional[str] = None) -> str: max_index = c_enum_const(name, '_MAX', prefix) -flags = '' +feats = '' ret = mcgen(''' const QEnumLookup %(c_name)s_lookup = { @@ -54,19 +54,21 @@ def gen_enum_lookup(name: str, ''', index=index, name=memb.name) ret += memb.ifcond.gen_endif() -if 'deprecated' in (f.name for f in memb.features): -flags += mcgen(''' -[%(index)s] = QAPI_ENUM_DEPRECATED, -''', - index=index) -if flags: +special_features = gen_special_features(memb.features) +if special_features != '0': +feats += mcgen(''' +[%(index)s] = %(special_features)s, +''', + index=index, special_features=special_features) + +if feats: ret += mcgen(''' }, -.flags = (const unsigned char[%(max_index)s]) { +.special_features = (const unsigned char[%(max_index)s]) { ''', max_index=max_index) -ret += flags +ret += feats ret += mcgen(''' }, -- 2.31.1
[PATCH 8/9] qapi: Factor out compat_policy_input_ok()
The code to check policy for handling deprecated input is triplicated. Factor it out into compat_policy_input_ok() before I mess with it in the next commit. Signed-off-by: Markus Armbruster --- include/qapi/compat-policy.h | 7 + qapi/qapi-visit-core.c | 18 + qapi/qmp-dispatch.c | 51 +++- qapi/qobject-input-visitor.c | 19 +++--- 4 files changed, 55 insertions(+), 40 deletions(-) diff --git a/include/qapi/compat-policy.h b/include/qapi/compat-policy.h index 1083f95122..8b7b25c0b5 100644 --- a/include/qapi/compat-policy.h +++ b/include/qapi/compat-policy.h @@ -13,10 +13,17 @@ #ifndef QAPI_COMPAT_POLICY_H #define QAPI_COMPAT_POLICY_H +#include "qapi/error.h" #include "qapi/qapi-types-compat.h" extern CompatPolicy compat_policy; +bool compat_policy_input_ok(unsigned special_features, +const CompatPolicy *policy, +ErrorClass error_class, +const char *kind, const char *name, +Error **errp); + /* * Create a QObject input visitor for @obj for use with QMP * diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 5572d90efb..a1ddfe8831 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qapi/visitor.h" @@ -408,18 +409,11 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj, } if (lookup->special_features -&& (lookup->special_features[value] & QAPI_DEPRECATED)) { -switch (v->compat_policy.deprecated_input) { -case COMPAT_POLICY_INPUT_ACCEPT: -break; -case COMPAT_POLICY_INPUT_REJECT: -error_setg(errp, "Deprecated value '%s' disabled by policy", - enum_str); -return false; -case COMPAT_POLICY_INPUT_CRASH: -default: -abort(); -} +&& !compat_policy_input_ok(lookup->special_features[value], + &v->compat_policy, + ERROR_CLASS_GENERIC_ERROR, + "value", enum_str, errp)) { +return false; } *obj = value; diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 8cca18c891..e29ade134c 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -28,6 +28,40 @@ CompatPolicy compat_policy; +static bool compat_policy_input_ok1(const char *adjective, +CompatPolicyInput policy, +ErrorClass error_class, +const char *kind, const char *name, +Error **errp) +{ +switch (policy) { +case COMPAT_POLICY_INPUT_ACCEPT: +return true; +case COMPAT_POLICY_INPUT_REJECT: +error_set(errp, error_class, "%s %s %s disabled by policy", + adjective, kind, name); +return false; +case COMPAT_POLICY_INPUT_CRASH: +default: +abort(); +} +} + +bool compat_policy_input_ok(unsigned special_features, +const CompatPolicy *policy, +ErrorClass error_class, +const char *kind, const char *name, +Error **errp) +{ +if ((special_features & 1u << QAPI_DEPRECATED) +&& !compat_policy_input_ok1("Deprecated", +policy->deprecated_input, +error_class, kind, name, errp)) { +return false; +} +return true; +} + Visitor *qobject_input_visitor_new_qmp(QObject *obj) { Visitor *v = qobject_input_visitor_new(obj); @@ -176,19 +210,10 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, "The command %s has not been found", command); goto out; } -if (cmd->special_features & 1u << QAPI_DEPRECATED) { -switch (compat_policy.deprecated_input) { -case COMPAT_POLICY_INPUT_ACCEPT: -break; -case COMPAT_POLICY_INPUT_REJECT: -error_set(&err, ERROR_CLASS_COMMAND_NOT_FOUND, - "Deprecated command %s disabled by policy", - command); -goto out; -case COMPAT_POLICY_INPUT_CRASH: -default: -abort(); -} +if (!compat_policy_input_ok(cmd->special_features, &compat_policy, +ERROR_CLASS_COMMAND_NOT_FOUND, +"command", command, &err)) { +goto out; } if (!cmd->enabled) { error_set(&err, ERROR_CLASS_COMMAND_NOT_FOUND, diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index fda485614b..f0b4c7ca9d 100644 --- a/qapi/qobject-
[PATCH 0/9] Configurable policy for handling unstable interfaces
Option -compat lets you configure what to do when deprecated interfaces get used. This series extends this to unstable interfaces. Works the same way. Intended for testing users of the management interfaces. It is experimental. To make it possible, I replace the "x-" naming convention by special feature flag "unstable". See PATCH 1 for rationale. Based on my "[PATCH v4 0/5] qapi: Add feature flags to enum members" Based-on: Message-Id: <20211025042405.3762351-1-arm...@redhat.com> Markus Armbruster (9): qapi: New special feature flag "unstable" qapi: Mark unstable QMP parts with feature 'unstable' qapi: Eliminate QCO_NO_OPTIONS for a slight simplification qapi: Tools for sets of special feature flags in generated code qapi: Generalize struct member policy checking qapi: Generalize command policy checking qapi: Generalize enum member policy checking qapi: Factor out compat_policy_input_ok() qapi: Extend -compat to set policy for unstable interfaces docs/devel/qapi-code-gen.rst| 9 +- qapi/block-core.json| 123 +--- qapi/compat.json| 6 +- qapi/migration.json | 35 +-- qapi/misc.json | 6 +- qapi/qom.json | 11 ++- include/qapi/compat-policy.h| 7 ++ include/qapi/qmp/dispatch.h | 6 +- include/qapi/util.h | 8 +- include/qapi/visitor-impl.h | 6 +- include/qapi/visitor.h | 17 +++- monitor/misc.c | 7 +- qapi/qapi-forward-visitor.c | 16 +-- qapi/qapi-visit-core.c | 41 qapi/qmp-dispatch.c | 57 --- qapi/qmp-registry.c | 4 +- qapi/qobject-input-visitor.c| 22 ++--- qapi/qobject-output-visitor.c | 13 ++- storage-daemon/qemu-storage-daemon.c| 3 +- qapi/trace-events | 4 +- qemu-options.hx | 20 +++- scripts/qapi/commands.py| 12 +-- scripts/qapi/events.py | 10 +- scripts/qapi/gen.py | 13 +++ scripts/qapi/schema.py | 11 ++- scripts/qapi/types.py | 22 +++-- scripts/qapi/visit.py | 14 +-- tests/qapi-schema/qapi-schema-test.json | 7 +- tests/qapi-schema/qapi-schema-test.out | 5 + 29 files changed, 353 insertions(+), 162 deletions(-) -- 2.31.1
Re: [PATCH v16 3/8] [RISCV_PM] Support CSRs required for RISC-V PM extension except for the h-mode
On Sat, Oct 23, 2021 at 4:34 AM Alexey Baturo wrote: > > Signed-off-by: Alexey Baturo > Reviewed-by: Alistair Francis > --- > target/riscv/cpu.c | 2 + > target/riscv/cpu.h | 11 ++ > target/riscv/csr.c | 285 + > 3 files changed, 298 insertions(+) > > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index 788fa0b11c..6b767a4a0b 100644 > --- a/target/riscv/cpu.c > +++ b/target/riscv/cpu.c > @@ -367,6 +367,8 @@ static void riscv_cpu_reset(DeviceState *dev) > env->mcause = 0; > env->pc = env->resetvec; > env->two_stage_lookup = false; > +/* mmte is supposed to have pm.current hardwired to 1 */ > +env->mmte |= (PM_EXT_INITIAL | MMTE_M_PM_CURRENT); > #endif > cs->exception_index = RISCV_EXCP_NONE; > env->load_res = -1; > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h > index 1cfc6a53a0..b2422e3f99 100644 > --- a/target/riscv/cpu.h > +++ b/target/riscv/cpu.h > @@ -238,6 +238,17 @@ struct CPURISCVState { > > /* True if in debugger mode. */ > bool debugger; > + > +/* > + * CSRs for PointerMasking extension > + */ > +target_ulong mmte; > +target_ulong mpmmask; > +target_ulong mpmbase; > +target_ulong spmmask; > +target_ulong spmbase; > +target_ulong upmmask; > +target_ulong upmbase; > #endif > > float_status fp_status; > diff --git a/target/riscv/csr.c b/target/riscv/csr.c > index 69e4d65fcd..7dd7bb7fbf 100644 > --- a/target/riscv/csr.c > +++ b/target/riscv/csr.c > @@ -192,6 +192,16 @@ static RISCVException hmode32(CPURISCVState *env, int > csrno) > > } > > +/* Checks if PointerMasking registers could be accessed */ > +static RISCVException pointer_masking(CPURISCVState *env, int csrno) > +{ > +/* Check if j-ext is present */ > +if (riscv_has_ext(env, RVJ)) { > +return RISCV_EXCP_NONE; > +} > +return RISCV_EXCP_ILLEGAL_INST; > +} > + > static RISCVException pmp(CPURISCVState *env, int csrno) > { > if (riscv_feature(env, RISCV_FEATURE_PMP)) { > @@ -1425,6 +1435,268 @@ static RISCVException write_pmpaddr(CPURISCVState > *env, int csrno, > return RISCV_EXCP_NONE; > } > > +/* > + * Functions to access Pointer Masking feature registers > + * We have to check if current priv lvl could modify > + * csr in given mode > + */ > +static bool check_pm_current_disabled(CPURISCVState *env, int csrno) > +{ > +int csr_priv = get_field(csrno, 0x300); > +int pm_current; > + > +/* > + * If priv lvls differ that means we're accessing csr from higher priv > lvl, > + * so allow the access > + */ > +if (env->priv != csr_priv) { > +return false; > +} > +switch (env->priv) { > +case PRV_M: > +pm_current = get_field(env->mmte, M_PM_CURRENT); > +break; > +case PRV_S: > +pm_current = get_field(env->mmte, S_PM_CURRENT); > +break; > +case PRV_U: > +pm_current = get_field(env->mmte, U_PM_CURRENT); > +break; > +default: > +g_assert_not_reached(); > +} > +/* It's same priv lvl, so we allow to modify csr only if pm.current==1 */ > +return !pm_current; > +} > + > +static RISCVException read_mmte(CPURISCVState *env, int csrno, > +target_ulong *val) > +{ > +*val = env->mmte & MMTE_MASK; > +return RISCV_EXCP_NONE; > +} > + > +static RISCVException write_mmte(CPURISCVState *env, int csrno, > + target_ulong val) > +{ > +uint64_t mstatus; > +target_ulong wpri_val = val & MMTE_MASK; > + > +if (val != wpri_val) { > +qemu_log_mask(LOG_GUEST_ERROR, > + "MMTE: WPRI violation written 0x%lx vs expected > 0x%lx\n", > + val, wpri_val); This and other log messages fail to build for both RV64 and RV32. The target_ulong can either be 32-bit or 64-bit, so printing with %lx doesn't work. You can use TARGET_FMT_lx instead Also, while re-sending this can you prefix the commit messages with "target/riscv: " Alistair > +} > +/* for machine mode pm.current is hardwired to 1 */ > +wpri_val |= MMTE_M_PM_CURRENT; > + > +/* hardwiring pm.instruction bit to 0, since it's not supported yet */ > +wpri_val &= ~(MMTE_M_PM_INSN | MMTE_S_PM_INSN | MMTE_U_PM_INSN); > +env->mmte = wpri_val | PM_EXT_DIRTY; > + > +/* Set XS and SD bits, since PM CSRs are dirty */ > +mstatus = env->mstatus | MSTATUS_XS; > +write_mstatus(env, csrno, mstatus); > +return RISCV_EXCP_NONE; > +} > + > +static RISCVException read_smte(CPURISCVState *env, int csrno, > +target_ulong *val) > +{ > +*val = env->mmte & SMTE_MASK; > +return RISCV_EXCP_NONE; > +} > + > +static RISCVException write_smte(CPURISCVState *env, int csrno, > + target_ulong val) > +{ > +target_ulong wpri_val = val & SMTE_MASK; > + > +if (val != wpri_val) { > +qemu_
Re: [PATCH v8 43/78] target/riscv: rvv-1.0: integer add-with-carry/subtract-with-borrow
On Fri, Oct 15, 2021 at 6:26 PM wrote: > > From: Frank Chang > > * Only do carry-in or borrow-in if is masked (vm=0). > * Remove clear function from helper functions as the tail elements > are unchanged in RVV 1.0. > > Signed-off-by: Frank Chang Reviewed-by: Alistair Francis Alistair > --- > target/riscv/insn32.decode | 20 ++-- > target/riscv/insn_trans/trans_rvv.c.inc | 2 +- > target/riscv/vector_helper.c| 21 ++--- > 3 files changed, 17 insertions(+), 26 deletions(-) > > diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode > index f83c8daf24e..9c4089d7a7b 100644 > --- a/target/riscv/insn32.decode > +++ b/target/riscv/insn32.decode > @@ -378,16 +378,16 @@ vwsubu_wv 110110 . . . 010 . 1010111 > @r_vm > vwsubu_wx 110110 . . . 110 . 1010111 @r_vm > vwsub_wv110111 . . . 010 . 1010111 @r_vm > vwsub_wx110111 . . . 110 . 1010111 @r_vm > -vadc_vvm01 1 . . 000 . 1010111 @r_vm_1 > -vadc_vxm01 1 . . 100 . 1010111 @r_vm_1 > -vadc_vim01 1 . . 011 . 1010111 @r_vm_1 > -vmadc_vvm 010001 1 . . 000 . 1010111 @r_vm_1 > -vmadc_vxm 010001 1 . . 100 . 1010111 @r_vm_1 > -vmadc_vim 010001 1 . . 011 . 1010111 @r_vm_1 > -vsbc_vvm010010 1 . . 000 . 1010111 @r_vm_1 > -vsbc_vxm010010 1 . . 100 . 1010111 @r_vm_1 > -vmsbc_vvm 010011 1 . . 000 . 1010111 @r_vm_1 > -vmsbc_vxm 010011 1 . . 100 . 1010111 @r_vm_1 > +vadc_vvm01 0 . . 000 . 1010111 @r_vm_1 > +vadc_vxm01 0 . . 100 . 1010111 @r_vm_1 > +vadc_vim01 0 . . 011 . 1010111 @r_vm_1 > +vmadc_vvm 010001 . . . 000 . 1010111 @r_vm > +vmadc_vxm 010001 . . . 100 . 1010111 @r_vm > +vmadc_vim 010001 . . . 011 . 1010111 @r_vm > +vsbc_vvm010010 0 . . 000 . 1010111 @r_vm_1 > +vsbc_vxm010010 0 . . 100 . 1010111 @r_vm_1 > +vmsbc_vvm 010011 . . . 000 . 1010111 @r_vm > +vmsbc_vxm 010011 . . . 100 . 1010111 @r_vm > vand_vv 001001 . . . 000 . 1010111 @r_vm > vand_vx 001001 . . . 100 . 1010111 @r_vm > vand_vi 001001 . . . 011 . 1010111 @r_vm > diff --git a/target/riscv/insn_trans/trans_rvv.c.inc > b/target/riscv/insn_trans/trans_rvv.c.inc > index 1fcde9f4df4..f3003d023e5 100644 > --- a/target/riscv/insn_trans/trans_rvv.c.inc > +++ b/target/riscv/insn_trans/trans_rvv.c.inc > @@ -1547,7 +1547,7 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) >\ > > /* > * For vadc and vsbc, an illegal instruction exception is raised if the > - * destination vector register is v0 and LMUL > 1. (Section 12.3) > + * destination vector register is v0 and LMUL > 1. (Section 12.4) > */ > static bool opivv_vadc_check(DisasContext *s, arg_rmrr *a) > { > diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c > index 6891f28116f..54405d898b9 100644 > --- a/target/riscv/vector_helper.c > +++ b/target/riscv/vector_helper.c > @@ -944,7 +944,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void > *vs2, \ > for (i = 0; i < vl; i++) {\ > ETYPE s1 = *((ETYPE *)vs1 + H(i));\ > ETYPE s2 = *((ETYPE *)vs2 + H(i));\ > -uint8_t carry = vext_elem_mask(v0, i);\ > +ETYPE carry = vext_elem_mask(v0, i); \ >\ > *((ETYPE *)vd + H(i)) = DO_OP(s2, s1, carry); \ > } \ > @@ -969,7 +969,7 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, > void *vs2,\ > \ > for (i = 0; i < vl; i++) { \ > ETYPE s2 = *((ETYPE *)vs2 + H(i)); \ > -uint8_t carry = vext_elem_mask(v0, i); \ > +ETYPE carry = vext_elem_mask(v0, i); \ > \ > *((ETYPE *)vd + H(i)) = DO_OP(s2, (ETYPE)(target_long)s1, carry);\ > }\ > @@ -994,20 +994,15 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void > *vs2, \ >CPURISCVState *env, uint32_t desc) \ > { \ > uint32_t vl = env->vl;\ > -uint32_t vlmax = vext_max_
Re: [PATCH v8 51/78] target/riscv: rvv-1.0: floating-point slide instructions
On Fri, Oct 15, 2021 at 6:38 PM wrote: > > From: Frank Chang > > Add the following instructions: > > * vfslide1up.vf > * vfslide1down.vf > > Signed-off-by: Frank Chang Reviewed-by: Alistair Francis Alistair > --- > target/riscv/helper.h | 7 ++ > target/riscv/insn32.decode | 2 + > target/riscv/insn_trans/trans_rvv.c.inc | 16 +++ > target/riscv/vector_helper.c| 141 > 4 files changed, 121 insertions(+), 45 deletions(-) > > diff --git a/target/riscv/helper.h b/target/riscv/helper.h > index 304c12494d4..012d0343771 100644 > --- a/target/riscv/helper.h > +++ b/target/riscv/helper.h > @@ -1071,6 +1071,13 @@ DEF_HELPER_6(vslide1down_vx_h, void, ptr, ptr, tl, > ptr, env, i32) > DEF_HELPER_6(vslide1down_vx_w, void, ptr, ptr, tl, ptr, env, i32) > DEF_HELPER_6(vslide1down_vx_d, void, ptr, ptr, tl, ptr, env, i32) > > +DEF_HELPER_6(vfslide1up_vf_h, void, ptr, ptr, i64, ptr, env, i32) > +DEF_HELPER_6(vfslide1up_vf_w, void, ptr, ptr, i64, ptr, env, i32) > +DEF_HELPER_6(vfslide1up_vf_d, void, ptr, ptr, i64, ptr, env, i32) > +DEF_HELPER_6(vfslide1down_vf_h, void, ptr, ptr, i64, ptr, env, i32) > +DEF_HELPER_6(vfslide1down_vf_w, void, ptr, ptr, i64, ptr, env, i32) > +DEF_HELPER_6(vfslide1down_vf_d, void, ptr, ptr, i64, ptr, env, i32) > + > DEF_HELPER_6(vrgather_vv_b, void, ptr, ptr, ptr, ptr, env, i32) > DEF_HELPER_6(vrgather_vv_h, void, ptr, ptr, ptr, ptr, env, i32) > DEF_HELPER_6(vrgather_vv_w, void, ptr, ptr, ptr, ptr, env, i32) > diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode > index 7548b71efdb..c5cc14c45c4 100644 > --- a/target/riscv/insn32.decode > +++ b/target/riscv/insn32.decode > @@ -577,6 +577,8 @@ vfsgnjn_vv 001001 . . . 001 . 1010111 > @r_vm > vfsgnjn_vf 001001 . . . 101 . 1010111 @r_vm > vfsgnjx_vv 001010 . . . 001 . 1010111 @r_vm > vfsgnjx_vf 001010 . . . 101 . 1010111 @r_vm > +vfslide1up_vf 001110 . . . 101 . 1010111 @r_vm > +vfslide1down_vf 00 . . . 101 . 1010111 @r_vm > vmfeq_vv011000 . . . 001 . 1010111 @r_vm > vmfeq_vf011000 . . . 101 . 1010111 @r_vm > vmfne_vv011100 . . . 001 . 1010111 @r_vm > diff --git a/target/riscv/insn_trans/trans_rvv.c.inc > b/target/riscv/insn_trans/trans_rvv.c.inc > index e59fc5a01d8..7ee1e122e8e 100644 > --- a/target/riscv/insn_trans/trans_rvv.c.inc > +++ b/target/riscv/insn_trans/trans_rvv.c.inc > @@ -3120,6 +3120,22 @@ GEN_OPIVX_TRANS(vslidedown_vx, slidedown_check) > GEN_OPIVX_TRANS(vslide1down_vx, slidedown_check) > GEN_OPIVI_TRANS(vslidedown_vi, IMM_ZX, vslidedown_vx, slidedown_check) > > +/* Vector Floating-Point Slide Instructions */ > +static bool fslideup_check(DisasContext *s, arg_rmrr *a) > +{ > +return slideup_check(s, a) && > + require_rvf(s); > +} > + > +static bool fslidedown_check(DisasContext *s, arg_rmrr *a) > +{ > +return slidedown_check(s, a) && > + require_rvf(s); > +} > + > +GEN_OPFVF_TRANS(vfslide1up_vf, fslideup_check) > +GEN_OPFVF_TRANS(vfslide1down_vf, fslidedown_check) > + > /* Vector Register Gather Instruction */ > static bool vrgather_vv_check(DisasContext *s, arg_rmrr *a) > { > diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c > index d79f59e443e..7fa5189af4e 100644 > --- a/target/riscv/vector_helper.c > +++ b/target/riscv/vector_helper.c > @@ -4455,57 +4455,108 @@ GEN_VEXT_VSLIDEDOWN_VX(vslidedown_vx_h, uint16_t, H2) > GEN_VEXT_VSLIDEDOWN_VX(vslidedown_vx_w, uint32_t, H4) > GEN_VEXT_VSLIDEDOWN_VX(vslidedown_vx_d, uint64_t, H8) > > -#define GEN_VEXT_VSLIDE1UP_VX(NAME, ETYPE, H) \ > -void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \ > - CPURISCVState *env, uint32_t desc) \ > -{ \ > -uint32_t vm = vext_vm(desc); \ > -uint32_t vl = env->vl;\ > -uint32_t i; \ > - \ > -for (i = 0; i < vl; i++) {\ > -if (!vm && !vext_elem_mask(v0, i)) { \ > -continue; \ > -} \ > -if (i == 0) { \ > -*((ETYPE *)vd + H(i)) = s1; \ > -} else { \ > -*((ETYPE *)vd + H(i)) = *((ETYPE *)vs2 + H(i - 1)); \ > -}
Re: [PATCH v8 61/78] target/riscv: rvv-1.0: floating-point/integer type-convert instructions
On Fri, Oct 15, 2021 at 6:43 PM wrote: > > From: Frank Chang > > Add the following instructions: > > * vfcvt.rtz.xu.f.v > * vfcvt.rtz.x.f.v > > Also adjust GEN_OPFV_TRANS() to accept multiple floating-point rounding > modes. > > Signed-off-by: Frank Chang Reviewed-by: Alistair Francis Alistair > --- > target/riscv/insn32.decode | 11 ++-- > target/riscv/insn_trans/trans_rvv.c.inc | 84 +++-- > 2 files changed, 59 insertions(+), 36 deletions(-) > > diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode > index 20b3095f56c..02064f8ec98 100644 > --- a/target/riscv/insn32.decode > +++ b/target/riscv/insn32.decode > @@ -585,10 +585,13 @@ vmfge_vf01 . . . 101 . 1010111 > @r_vm > vfclass_v 010011 . . 1 001 . 1010111 @r2_vm > vfmerge_vfm 010111 0 . . 101 . 1010111 @r_vm_0 > vfmv_v_f010111 1 0 . 101 . 1010111 @r2 > -vfcvt_xu_f_v100010 . . 0 001 . 1010111 @r2_vm > -vfcvt_x_f_v 100010 . . 1 001 . 1010111 @r2_vm > -vfcvt_f_xu_v100010 . . 00010 001 . 1010111 @r2_vm > -vfcvt_f_x_v 100010 . . 00011 001 . 1010111 @r2_vm > + > +vfcvt_xu_f_v 010010 . . 0 001 . 1010111 @r2_vm > +vfcvt_x_f_v010010 . . 1 001 . 1010111 @r2_vm > +vfcvt_f_xu_v 010010 . . 00010 001 . 1010111 @r2_vm > +vfcvt_f_x_v010010 . . 00011 001 . 1010111 @r2_vm > +vfcvt_rtz_xu_f_v 010010 . . 00110 001 . 1010111 @r2_vm > +vfcvt_rtz_x_f_v010010 . . 00111 001 . 1010111 @r2_vm > vfwcvt_xu_f_v 100010 . . 01000 001 . 1010111 @r2_vm > vfwcvt_x_f_v100010 . . 01001 001 . 1010111 @r2_vm > vfwcvt_f_xu_v 100010 . . 01010 001 . 1010111 @r2_vm > diff --git a/target/riscv/insn_trans/trans_rvv.c.inc > b/target/riscv/insn_trans/trans_rvv.c.inc > index 676336a5200..b1ea15517c0 100644 > --- a/target/riscv/insn_trans/trans_rvv.c.inc > +++ b/target/riscv/insn_trans/trans_rvv.c.inc > @@ -1,5 +1,4 @@ > /* > - * RISC-V translation routines for the RVV Standard Extension. > * > * Copyright (c) 2020 T-Head Semiconductor Co., Ltd. All rights reserved. > * > @@ -2368,34 +2367,41 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) > vext_check_ss(s, a->rd, a->rs2, a->vm); > } > > -#define GEN_OPFV_TRANS(NAME, CHECK)\ > -static bool trans_##NAME(DisasContext *s, arg_rmr *a) \ > -{ \ > -if (CHECK(s, a)) { \ > -uint32_t data = 0; \ > -static gen_helper_gvec_3_ptr * const fns[3] = {\ > -gen_helper_##NAME##_h, \ > -gen_helper_##NAME##_w, \ > -gen_helper_##NAME##_d, \ > -}; \ > -TCGLabel *over = gen_new_label(); \ > -gen_set_rm(s, RISCV_FRM_DYN); \ > -tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \ > - \ > -data = FIELD_DP32(data, VDATA, VM, a->vm); \ > -data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \ > -tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \ > - vreg_ofs(s, a->rs2), cpu_env, \ > - s->vlen / 8, s->vlen / 8, data, \ > - fns[s->sew - 1]); \ > -mark_vs_dirty(s); \ > -gen_set_label(over); \ > -return true; \ > -} \ > -return false; \ > +static bool do_opfv(DisasContext *s, arg_rmr *a, > +gen_helper_gvec_3_ptr *fn, > +bool (*checkfn)(DisasContext *, arg_rmr *), > +int rm) > +{ > +if (checkfn(s, a)) { > +uint32_t data = 0; > +TCGLabel *over = gen_new_label(); > +gen_set_rm(s, rm); > +tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); > + > +data = FIELD_DP32(data, VDATA, VM, a->vm); > +data = FIELD_DP32(data, VDATA, LMUL, s->lmul); > +tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), > + vreg_ofs(s, a->rs2), cpu_env, > + s->vlen / 8, s->vlen / 8, data, fn); > +mark_vs_dirty(s); > +gen_set_label(over); > +return true; > +} > +return false; >
Re: [PATCH] block/export/fuse.c: fix musl build
22.10.2021 12:52, Fabrice Fontaine пишет: Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb and avoid the following build failure on musl: ../block/export/fuse.c: In function 'fuse_fallocate': ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { | ^~~~ Fixes: - http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b Signed-off-by: Fabrice Fontaine --- block/export/fuse.c | 4 1 file changed, 4 insertions(+) diff --git a/block/export/fuse.c b/block/export/fuse.c index 2e3bf8270b..823c126d23 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -31,6 +31,10 @@ #include #include +#if defined(CONFIG_FALLOCATE_ZERO_RANGE) shouldn't it be "if !defined" ? /mjt +#include +#endif + #ifdef __linux__ #include #endif
Re: [PATCH v8 72/78] target/riscv: set mstatus.SD bit when writing fp CSRs
On Fri, Oct 15, 2021 at 6:44 PM wrote: > > From: Frank Chang > > Signed-off-by: Frank Chang Hey Frank, You will need to rebase this on the latest master branch. Alistair > --- > target/riscv/csr.c | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/target/riscv/csr.c b/target/riscv/csr.c > index 9f51626a3d8..3929abb112a 100644 > --- a/target/riscv/csr.c > +++ b/target/riscv/csr.c > @@ -224,7 +224,8 @@ static RISCVException write_fflags(CPURISCVState *env, > int csrno, > target_ulong val) > { > #if !defined(CONFIG_USER_ONLY) > -env->mstatus |= MSTATUS_FS; > +target_ulong sd = riscv_cpu_is_32bit(env) ? MSTATUS32_SD : MSTATUS64_SD; > +env->mstatus |= MSTATUS_FS | sd; > #endif > riscv_cpu_set_fflags(env, val & (FSR_AEXC >> FSR_AEXC_SHIFT)); > return RISCV_EXCP_NONE; > @@ -241,7 +242,8 @@ static RISCVException write_frm(CPURISCVState *env, int > csrno, > target_ulong val) > { > #if !defined(CONFIG_USER_ONLY) > -env->mstatus |= MSTATUS_FS; > +target_ulong sd = riscv_cpu_is_32bit(env) ? MSTATUS32_SD : MSTATUS64_SD; > +env->mstatus |= MSTATUS_FS | sd; > #endif > env->frm = val & (FSR_RD >> FSR_RD_SHIFT); > return RISCV_EXCP_NONE; > @@ -259,7 +261,8 @@ static RISCVException write_fcsr(CPURISCVState *env, int > csrno, > target_ulong val) > { > #if !defined(CONFIG_USER_ONLY) > -env->mstatus |= MSTATUS_FS; > +target_ulong sd = riscv_cpu_is_32bit(env) ? MSTATUS32_SD : MSTATUS64_SD; > +env->mstatus |= MSTATUS_FS | sd; > #endif > env->frm = (val & FSR_RD) >> FSR_RD_SHIFT; > riscv_cpu_set_fflags(env, (val & FSR_AEXC) >> FSR_AEXC_SHIFT); > -- > 2.25.1 > >
Re: [PATCH v8 65/78] target/riscv: rvv-1.0: relax RV_VLEN_MAX to 1024-bits
On Fri, Oct 15, 2021 at 6:43 PM wrote: > > From: Frank Chang > > Signed-off-by: Frank Chang Reviewed-by: Alistair Francis Alistair > > -- > --- > target/riscv/cpu.h | 2 +- > target/riscv/insn_trans/trans_rvv.c.inc | 4 ++-- > target/riscv/vector_helper.c| 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h > index 9b2af4e4d0e..49eece111e2 100644 > --- a/target/riscv/cpu.h > +++ b/target/riscv/cpu.h > @@ -101,7 +101,7 @@ typedef struct CPURISCVState CPURISCVState; > #include "pmp.h" > #endif > > -#define RV_VLEN_MAX 256 > +#define RV_VLEN_MAX 1024 > > FIELD(VTYPE, VLMUL, 0, 3) > FIELD(VTYPE, VSEW, 3, 3) > diff --git a/target/riscv/insn_trans/trans_rvv.c.inc > b/target/riscv/insn_trans/trans_rvv.c.inc > index 92a23b52e49..dcb96c954ec 100644 > --- a/target/riscv/insn_trans/trans_rvv.c.inc > +++ b/target/riscv/insn_trans/trans_rvv.c.inc > @@ -567,8 +567,8 @@ static bool ldst_us_trans(uint32_t vd, uint32_t rs1, > uint32_t data, > base = get_gpr(s, rs1, EXT_NONE); > > /* > - * As simd_desc supports at most 256 bytes, and in this implementation, > - * the max vector group length is 2048 bytes. So split it into two parts. > + * As simd_desc supports at most 2048 bytes, and in this implementation, > + * the max vector group length is 4096 bytes. So split it into two parts. > * > * The first part is vlen in bytes, encoded in maxsz of simd_desc. > * The second part is lmul, encoded in data of simd_desc. > diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c > index 37b2451bd05..70ddc55e16b 100644 > --- a/target/riscv/vector_helper.c > +++ b/target/riscv/vector_helper.c > @@ -124,7 +124,7 @@ static inline int32_t vext_lmul(uint32_t desc) > static inline uint32_t vext_max_elems(uint32_t desc, uint32_t esz) > { > /* > - * As simd_desc support at most 256 bytes, the max vlen is 256 bits. > + * As simd_desc support at most 2048 bytes, the max vlen is 1024 bits. > * so vlen in bytes (vlenb) is encoded as maxsz. > */ > uint32_t vlenb = simd_maxsz(desc); > -- > 2.25.1 > >