[Qemu-devel] [PATCH 0/5] POWER9 TCG enablement - part3
This series contains 14 new instructions for POWER9 described in ISA3.0. Patches: 01: Adds vector insert instructions. vinsertb - Vector Insert Byte vinserth - Vector Insert Halfword vinsertw - Vector Insert Word vinsertd - Vector Insert Doubleword 02: Adds vector extract instructions. vextractub - Vector Extract Unsigned Byte vextractuh - Vector Extract Unsigned Halfword vextractuw - Vector Extract Unsigned Word vextractd - Vector Extract Unsigned Doubleword 03: Adds vector count trailing zeros instructions. vctzb - Vector Count Trailing Zeros Byte vctzh - Vector Count Trailing Zeros Halfword vctzw - Vector Count Trailing Zeros Word vctzd - Vector Count Trailing Zeros Doubleword 04: Adds vbpermd-vector bit permute doubleword instruction. 05: Adds vpermr-vector permute right indexed instruction. target-ppc/helper.h | 14 + target-ppc/int_helper.c | 110 +++ target-ppc/translate/vmx-impl.c | 58 target-ppc/translate/vmx-ops.c | 39 +++--- 4 files changed, 213 insertions(+), 8 deletions(-)
[Qemu-devel] [PATCH 1/5] target-ppc: add vector insert instructions
The following vector insert instructions are added from ISA 3.0. vinsertb - Vector Insert Byte vinserth - Vector Insert Halfword vinsertw - Vector Insert Word vinsertd - Vector Insert Doubleword Signed-off-by: Rajalakshmi Srinivasaraghavan --- target-ppc/helper.h |4 target-ppc/int_helper.c | 21 + target-ppc/translate/vmx-impl.c | 10 ++ target-ppc/translate/vmx-ops.c | 19 ++- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 93ac9e1..0923779 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -250,6 +250,10 @@ DEF_HELPER_2(vspltisw, void, avr, i32) DEF_HELPER_3(vspltb, void, avr, avr, i32) DEF_HELPER_3(vsplth, void, avr, avr, i32) DEF_HELPER_3(vspltw, void, avr, avr, i32) +DEF_HELPER_3(vinsertb, void, avr, avr, i32) +DEF_HELPER_3(vinserth, void, avr, avr, i32) +DEF_HELPER_3(vinsertw, void, avr, avr, i32) +DEF_HELPER_3(vinsertd, void, avr, avr, i32) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr) DEF_HELPER_2(vupkhsb, void, avr, avr) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index 552b2e0..637f0b1 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -1790,6 +1790,27 @@ VSPLT(b, u8) VSPLT(h, u16) VSPLT(w, u32) #undef VSPLT +#if defined(HOST_WORDS_BIGENDIAN) +#define VINSERT(suffix, element, index) \ +void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ +{ \ +memcpy(&r->u8[SPLAT_ELEMENT(u8)], &b->element[index], \ + sizeof(r->element[0])); \ +} +#else +#define VINSERT(suffix, element, index) \ +void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ +{ \ +memcpy(&r->u8[(16 - splat) - sizeof(r->element[0])],\ + &b->element[(ARRAY_SIZE(r->element) - index) - 1], \ + sizeof(r->element[0])); \ +} +#endif +VINSERT(b, u8, 7) +VINSERT(h, u16, 3) +VINSERT(w, u32, 1) +VINSERT(d, u64, 0) +#undef VINSERT #undef SPLAT_ELEMENT #undef _SPLAT_MASKED diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index ac78caf..4940ae3 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -626,10 +626,20 @@ static void glue(gen_, name)(DisasContext *ctx) \ GEN_VXFORM_UIMM(vspltb, 6, 8); GEN_VXFORM_UIMM(vsplth, 6, 9); GEN_VXFORM_UIMM(vspltw, 6, 10); +GEN_VXFORM_UIMM(vinsertb, 6, 12); +GEN_VXFORM_UIMM(vinserth, 6, 13); +GEN_VXFORM_UIMM(vinsertw, 6, 14); +GEN_VXFORM_UIMM(vinsertd, 6, 15); GEN_VXFORM_UIMM_ENV(vcfux, 5, 12); GEN_VXFORM_UIMM_ENV(vcfsx, 5, 13); GEN_VXFORM_UIMM_ENV(vctuxs, 5, 14); GEN_VXFORM_UIMM_ENV(vctsxs, 5, 15); +GEN_VXFORM_DUAL(vspltisb, PPC_NONE, PPC2_ALTIVEC_207, + vinsertb, PPC_NONE, PPC2_ISA300); +GEN_VXFORM_DUAL(vspltish, PPC_NONE, PPC2_ALTIVEC_207, + vinserth, PPC_NONE, PPC2_ISA300); +GEN_VXFORM_DUAL(vspltisw, PPC_NONE, PPC2_ALTIVEC_207, + vinsertw, PPC_NONE, PPC2_ISA300); static void gen_vsldoi(DisasContext *ctx) { diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index 7449396..a5534da 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -41,6 +41,9 @@ GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x, PPC_NONE, PPC2_ALTIVEC_207) #define GEN_VXFORM_300(name, opc2, opc3)\ GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x, PPC_NONE, PPC2_ISA300) +#define GEN_VXFORM_300_EXT(name, opc2, opc3, inval) \ +GEN_HANDLER_E(name, 0x04, opc2, opc3, inval, PPC_NONE, PPC2_ISA300) + #define GEN_VXFORM_DUAL(name0, name1, opc2, opc3, type0, type1) \ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x, type0, type1) @@ -191,11 +194,17 @@ GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM_DUAL(vcmpgtfp, vcmpgtud, 3, 11, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE) -#define GEN_VXFORM_SIMM(name, opc2, opc3) \ -GEN_HANDLER(name, 0x04, opc2, opc3, 0x, PPC_ALTIVEC) -GEN_VXFORM_SIMM(vspltisb, 6, 12), -GEN_VXFORM_SIMM(vspltish, 6, 13), -GEN_VXFORM_SIMM(vspltisw, 6, 14), +#undef GEN_VXFORM_DUAL1 +#define GEN_VXFORM_DUAL1(name0, name1, opc2, opc3, inval0, inval1, type) \ +GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, \ + PPC_NONE) +GEN_VXFORM_DUAL1(vspltisb, vinsertb, 6, 12, 0x, 0x10, +
[Qemu-devel] [PATCH 3/5] target-ppc: add vector count trailing zeros instructions
The following vector count trailing zeros instructions are added from ISA 3.0. vctzb - Vector Count Trailing Zeros Byte vctzh - Vector Count Trailing Zeros Halfword vctzw - Vector Count Trailing Zeros Word vctzd - Vector Count Trailing Zeros Doubleword Signed-off-by: Rajalakshmi Srinivasaraghavan --- target-ppc/helper.h |4 target-ppc/int_helper.c | 15 +++ target-ppc/translate/vmx-impl.c | 19 +++ target-ppc/translate/vmx-ops.c |8 4 files changed, 46 insertions(+), 0 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 59e7b88..6e6e7b3 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -327,6 +327,10 @@ DEF_HELPER_2(vclzb, void, avr, avr) DEF_HELPER_2(vclzh, void, avr, avr) DEF_HELPER_2(vclzw, void, avr, avr) DEF_HELPER_2(vclzd, void, avr, avr) +DEF_HELPER_2(vctzb, void, avr, avr) +DEF_HELPER_2(vctzh, void, avr, avr) +DEF_HELPER_2(vctzw, void, avr, avr) +DEF_HELPER_2(vctzd, void, avr, avr) DEF_HELPER_2(vpopcntb, void, avr, avr) DEF_HELPER_2(vpopcnth, void, avr, avr) DEF_HELPER_2(vpopcntw, void, avr, avr) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index d545ec6..09f02f8 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -2090,6 +2090,21 @@ VGENERIC_DO(clzd, u64) #undef clzw #undef clzd +#define ctzb(v) ((v) ? ctz32((uint32_t)(v)) : 8) +#define ctzh(v) ((v) ? ctz32((uint32_t)(v)) : 16) +#define ctzw(v) ctz32((v)) +#define ctzd(v) ctz64((v)) + +VGENERIC_DO(ctzb, u8) +VGENERIC_DO(ctzh, u16) +VGENERIC_DO(ctzw, u32) +VGENERIC_DO(ctzd, u64) + +#undef ctzb +#undef ctzh +#undef ctzw +#undef ctzd + #define popcntb(v) ctpop8(v) #define popcnth(v) ctpop16(v) #define popcntw(v) ctpop32(v) diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index 8bd48f3..2cf8c8f 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -553,6 +553,21 @@ static void glue(gen_, name)(DisasContext *ctx) \ tcg_temp_free_ptr(rd); \ } +#define GEN_VXFORM_NOA_2(name, opc2, opc3, opc4)\ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ +TCGv_ptr rb, rd;\ +if (unlikely(!ctx->altivec_enabled)) { \ +gen_exception(ctx, POWERPC_EXCP_VPU); \ +return; \ +} \ +rb = gen_avr_ptr(rB(ctx->opcode)); \ +rd = gen_avr_ptr(rD(ctx->opcode)); \ +gen_helper_##name(rd, rb); \ +tcg_temp_free_ptr(rb); \ +tcg_temp_free_ptr(rd); \ +} + GEN_VXFORM_NOA(vupkhsb, 7, 8); GEN_VXFORM_NOA(vupkhsh, 7, 9); GEN_VXFORM_NOA(vupkhsw, 7, 25); @@ -723,6 +738,10 @@ GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) GEN_VXFORM_NOA(vclzw, 1, 30) GEN_VXFORM_NOA(vclzd, 1, 31) +GEN_VXFORM_NOA_2(vctzb, 1, 24, 28) +GEN_VXFORM_NOA_2(vctzh, 1, 24, 29) +GEN_VXFORM_NOA_2(vctzw, 1, 24, 30) +GEN_VXFORM_NOA_2(vctzd, 1, 24, 31) GEN_VXFORM_NOA(vpopcntb, 1, 28) GEN_VXFORM_NOA(vpopcnth, 1, 29) GEN_VXFORM_NOA(vpopcntw, 1, 30) diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index f0e2da2..47e51ef 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -44,6 +44,10 @@ GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x, PPC_NONE, PPC2_ISA300) #define GEN_VXFORM_300_EXT(name, opc2, opc3, inval) \ GEN_HANDLER_E(name, 0x04, opc2, opc3, inval, PPC_NONE, PPC2_ISA300) +#define GEN_VXFORM_300_EXT1(name, opc2, opc3, opc4) \ +GEN_HANDLER_E_2(name, 0x04, opc2, opc3, opc4, 0x, PPC_NONE, \ + PPC2_ISA300) + #define GEN_VXFORM_DUAL(name0, name1, opc2, opc3, type0, type1) \ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x, type0, type1) @@ -212,6 +216,10 @@ GEN_VXFORM_DUAL1(vspltish, vinserth, 6, 13, 0x, 0x10, GEN_VXFORM_DUAL1(vspltisw, vinsertw, 6, 14, 0x, 0x10, PPC2_ALTIVEC_207), GEN_VXFORM_300_EXT(vinsertd, 6, 15, 0x10), +GEN_VXFORM_300_EXT1(vctzb, 0x01, 0x18, 0x1C), +GEN_VXFORM_300_EXT1(vctzh, 0x01, 0x18, 0x1D), +GEN_VXFORM_300_EXT1(vctzw, 0x01, 0x18, 0x1E), +GEN_VXFORM_300_EXT1(vctzd, 0x01, 0x18, 0x1F), #define GEN_VXFORM_NOA(name, opc2, opc3)\ GEN_HANDLER(name, 0x04, opc2, opc3, 0x001f, PPC_ALTIVEC) -- 1.7.1
[Qemu-devel] [PATCH 2/5] target-ppc: add vector extract instructions
The following vector extract instructions are added from ISA 3.0. vextractub - Vector Extract Unsigned Byte vextractuh - Vector Extract Unsigned Halfword vextractuw - Vector Extract Unsigned Word vextractd - Vector Extract Unsigned Doubleword Signed-off-by: Rajalakshmi Srinivasaraghavan --- target-ppc/helper.h |4 target-ppc/int_helper.c | 31 +++ target-ppc/translate/vmx-impl.c | 10 ++ target-ppc/translate/vmx-ops.c | 10 +++--- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 0923779..59e7b88 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -250,6 +250,10 @@ DEF_HELPER_2(vspltisw, void, avr, i32) DEF_HELPER_3(vspltb, void, avr, avr, i32) DEF_HELPER_3(vsplth, void, avr, avr, i32) DEF_HELPER_3(vspltw, void, avr, avr, i32) +DEF_HELPER_3(vextractub, void, avr, avr, i32) +DEF_HELPER_3(vextractuh, void, avr, avr, i32) +DEF_HELPER_3(vextractuw, void, avr, avr, i32) +DEF_HELPER_3(vextractd, void, avr, avr, i32) DEF_HELPER_3(vinsertb, void, avr, avr, i32) DEF_HELPER_3(vinserth, void, avr, avr, i32) DEF_HELPER_3(vinsertw, void, avr, avr, i32) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index 637f0b1..d545ec6 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -1811,6 +1811,37 @@ VINSERT(h, u16, 3) VINSERT(w, u32, 1) VINSERT(d, u64, 0) #undef VINSERT +#if defined(HOST_WORDS_BIGENDIAN) +#define VEXTRACT(suffix, element, index) \ +void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ +{\ +int i; \ + \ +for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ +r->element[i] = 0; \ +}\ +memcpy(&r->element[index], &b->u8[SPLAT_ELEMENT(u8)],\ + sizeof(r->element[0])); \ +} +#else +#define VEXTRACT(suffix, element, index) \ +void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ +{\ +int i; \ + \ +for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ +r->element[i] = 0; \ +}\ +memcpy(&r->element[(ARRAY_SIZE(r->element) - index) - 1],\ + &b->u8[(16 - splat) - sizeof(r->element[0])], \ + sizeof(r->element[0])); \ +} +#endif +VEXTRACT(ub, u8, 7) +VEXTRACT(uh, u16, 3) +VEXTRACT(uw, u32, 1) +VEXTRACT(d, u64, 0) +#undef VEXTRACT #undef SPLAT_ELEMENT #undef _SPLAT_MASKED diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index 4940ae3..8bd48f3 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -626,6 +626,10 @@ static void glue(gen_, name)(DisasContext *ctx) \ GEN_VXFORM_UIMM(vspltb, 6, 8); GEN_VXFORM_UIMM(vsplth, 6, 9); GEN_VXFORM_UIMM(vspltw, 6, 10); +GEN_VXFORM_UIMM(vextractub, 6, 8); +GEN_VXFORM_UIMM(vextractuh, 6, 9); +GEN_VXFORM_UIMM(vextractuw, 6, 10); +GEN_VXFORM_UIMM(vextractd, 6, 11); GEN_VXFORM_UIMM(vinsertb, 6, 12); GEN_VXFORM_UIMM(vinserth, 6, 13); GEN_VXFORM_UIMM(vinsertw, 6, 14); @@ -634,6 +638,12 @@ GEN_VXFORM_UIMM_ENV(vcfux, 5, 12); GEN_VXFORM_UIMM_ENV(vcfsx, 5, 13); GEN_VXFORM_UIMM_ENV(vctuxs, 5, 14); GEN_VXFORM_UIMM_ENV(vctsxs, 5, 15); +GEN_VXFORM_DUAL(vspltb, PPC_NONE, PPC2_ALTIVEC_207, + vextractub, PPC_NONE, PPC2_ISA300); +GEN_VXFORM_DUAL(vsplth, PPC_NONE, PPC2_ALTIVEC_207, + vextractuh, PPC_NONE, PPC2_ISA300); +GEN_VXFORM_DUAL(vspltw, PPC_NONE, PPC2_ALTIVEC_207, + vextractuw, PPC_NONE, PPC2_ISA300); GEN_VXFORM_DUAL(vspltisb, PPC_NONE, PPC2_ALTIVEC_207, vinsertb, PPC_NONE, PPC2_ISA300); GEN_VXFORM_DUAL(vspltish, PPC_NONE, PPC2_ALTIVEC_207, diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index a5534da..f0e2da2 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -198,6 +198,13 @@ GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE) #define GEN_VXFORM_DUAL1(name0, name1, opc2, opc3, inval0, inval1, type) \
[Qemu-devel] [PATCH 5/5] target-ppc: add vector permute right indexed instruction
Add vpermr instruction from ISA 3.0. Signed-off-by: Rajalakshmi Srinivasaraghavan --- target-ppc/helper.h |1 + target-ppc/int_helper.c | 23 +++ target-ppc/translate/vmx-impl.c | 18 ++ target-ppc/translate/vmx-ops.c |1 + 4 files changed, 43 insertions(+), 0 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index d1d9418..3c476c9 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -270,6 +270,7 @@ DEF_HELPER_5(vmsumubm, void, env, avr, avr, avr, avr) DEF_HELPER_5(vmsummbm, void, env, avr, avr, avr, avr) DEF_HELPER_5(vsel, void, env, avr, avr, avr, avr) DEF_HELPER_5(vperm, void, env, avr, avr, avr, avr) +DEF_HELPER_5(vpermr, void, env, avr, avr, avr, avr) DEF_HELPER_4(vpkshss, void, env, avr, avr, avr) DEF_HELPER_4(vpkshus, void, env, avr, avr, avr) DEF_HELPER_4(vpkswss, void, env, avr, avr, avr) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index d8ad56f..79e4273 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -1126,6 +1126,29 @@ void helper_vperm(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, *r = result; } +void helper_vpermr(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, + ppc_avr_t *c) +{ +ppc_avr_t result; +int i; + +VECTOR_FOR_INORDER_I(i, u8) { +int s = c->u8[i] & 0x1f; +#if defined(HOST_WORDS_BIGENDIAN) +int index = s & 0xf; +#else +int index = 15 - (s & 0xf); +#endif + +if (s & 0x10) { +result.u8[i] = a->u8[15 - index]; +} else { +result.u8[i] = b->u8[15 - index]; +} +} +*r = result; +} + #if defined(HOST_WORDS_BIGENDIAN) #define VBPERMQ_INDEX(avr, i) ((avr)->u8[(i)]) #define VBPERMQ_DW(index) (((index) & 0x40) != 0) diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index 5ddff58..d13640f 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -728,6 +728,24 @@ static void gen_vmladduhm(DisasContext *ctx) tcg_temp_free_ptr(rd); } +static void gen_vpermr(DisasContext *ctx) +{ +TCGv_ptr ra, rb, rc, rd; +if (unlikely(!ctx->altivec_enabled)) { +gen_exception(ctx, POWERPC_EXCP_VPU); +return; +} +ra = gen_avr_ptr(rA(ctx->opcode)); +rb = gen_avr_ptr(rB(ctx->opcode)); +rc = gen_avr_ptr(rC(ctx->opcode)); +rd = gen_avr_ptr(rD(ctx->opcode)); +gen_helper_vpermr(cpu_env, rd, ra, rb, rc); +tcg_temp_free_ptr(ra); +tcg_temp_free_ptr(rb); +tcg_temp_free_ptr(rc); +tcg_temp_free_ptr(rd); +} + GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18) GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19) GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20) diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index eddb5eb..966f970 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -220,6 +220,7 @@ GEN_VXFORM_300_EXT1(vctzb, 0x01, 0x18, 0x1C), GEN_VXFORM_300_EXT1(vctzh, 0x01, 0x18, 0x1D), GEN_VXFORM_300_EXT1(vctzw, 0x01, 0x18, 0x1E), GEN_VXFORM_300_EXT1(vctzd, 0x01, 0x18, 0x1F), +GEN_VXFORM_300(vpermr, 0x1D, 0xFF), #define GEN_VXFORM_NOA(name, opc2, opc3)\ GEN_HANDLER(name, 0x04, opc2, opc3, 0x001f, PPC_ALTIVEC) -- 1.7.1
[Qemu-devel] [PATCH 4/5] target-ppc: add vector bit permute doubleword instruction
Add vbpermd instruction from ISA 3.0. Signed-off-by: Rajalakshmi Srinivasaraghavan --- target-ppc/helper.h |1 + target-ppc/int_helper.c | 20 target-ppc/translate/vmx-impl.c |1 + target-ppc/translate/vmx-ops.c |1 + 4 files changed, 23 insertions(+), 0 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 6e6e7b3..d1d9418 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -335,6 +335,7 @@ DEF_HELPER_2(vpopcntb, void, avr, avr) DEF_HELPER_2(vpopcnth, void, avr, avr) DEF_HELPER_2(vpopcntw, void, avr, avr) DEF_HELPER_2(vpopcntd, void, avr, avr) +DEF_HELPER_3(vbpermd, void, avr, avr, avr) DEF_HELPER_3(vbpermq, void, avr, avr, avr) DEF_HELPER_2(vgbbd, void, avr, avr) DEF_HELPER_3(vpmsumb, void, avr, avr, avr) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index 09f02f8..d8ad56f 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -1134,6 +1134,26 @@ void helper_vperm(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, #define VBPERMQ_DW(index) (((index) & 0x40) == 0) #endif +void helper_vbpermd(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) +{ +int i, j; +uint64_t perm = 0; + +VECTOR_FOR_INORDER_I(i, u64) { +perm = 0; +VECTOR_FOR_INORDER_I(j, u16) { +int index = VBPERMQ_INDEX(b, (i * 8) + j); +if (index < 64) { +uint64_t mask = (1ull << (63 - (index & 0x3F))); +if (a->u64[VBPERMQ_DW(index)] & mask) { +perm |= (0x80 >> j); +} +} +r->u64[i] = perm; +} +} +} + void helper_vbpermq(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i; diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.c index 2cf8c8f..5ddff58 100644 --- a/target-ppc/translate/vmx-impl.c +++ b/target-ppc/translate/vmx-impl.c @@ -754,6 +754,7 @@ GEN_VXFORM_DUAL(vclzw, PPC_NONE, PPC2_ALTIVEC_207, \ vpopcntw, PPC_NONE, PPC2_ALTIVEC_207) GEN_VXFORM_DUAL(vclzd, PPC_NONE, PPC2_ALTIVEC_207, \ vpopcntd, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXFORM(vbpermd, 6, 23); GEN_VXFORM(vbpermq, 6, 21); GEN_VXFORM_NOA(vgbbd, 6, 20); GEN_VXFORM(vpmsumb, 4, 16) diff --git a/target-ppc/translate/vmx-ops.c b/target-ppc/translate/vmx-ops.c index 47e51ef..eddb5eb 100644 --- a/target-ppc/translate/vmx-ops.c +++ b/target-ppc/translate/vmx-ops.c @@ -262,6 +262,7 @@ GEN_VXFORM_DUAL(vclzh, vpopcnth, 1, 29, PPC_NONE, PPC2_ALTIVEC_207), GEN_VXFORM_DUAL(vclzw, vpopcntw, 1, 30, PPC_NONE, PPC2_ALTIVEC_207), GEN_VXFORM_DUAL(vclzd, vpopcntd, 1, 31, PPC_NONE, PPC2_ALTIVEC_207), +GEN_VXFORM_300(vbpermd, 6, 23), GEN_VXFORM_207(vbpermq, 6, 21), GEN_VXFORM_207(vgbbd, 6, 20), GEN_VXFORM_207(vpmsumb, 4, 16), -- 1.7.1
Re: [Qemu-devel] [PATCH v5 5/8] irq: Add a new irq device that allows the ORing of lines
On 1 August 2016 at 03:21, Alistair Francis wrote: > On Tue, Jul 26, 2016 at 8:00 AM, Peter Maydell > wrote: >> The data in the memory pointed to by 'levels' is state, and you >> need to migrate it somehow. (Otherwise you'll give the wrong >> results the next time an input changes following a migration.) > > A simple vmstate should be enough for that right? Yes (but if you don't inherit from DeviceState you won't have anywhere convenient to hook it up). thanks -- PMM
Re: [Qemu-devel] [RFC PATCH 1/3] hw/arm/virt: add hotplug memory support
On Mon, 1 Aug 2016 00:35:35 + "kwangwoo@sk.com" wrote: > Hi Peter, > > Thanks a lot for your comments! I answered in line below. > > > -Original Message- > > From: Peter Maydell [mailto:peter.mayd...@linaro.org] > > Sent: Saturday, July 30, 2016 3:10 AM > > To: 이광우(LEE KWANGWOO) MS SW > > Cc: Xiao Guangrong; Michael S. Tsirkin; Igor Mammedov; Paolo Bonzini; > > Richard Henderson; Eduardo > > Habkost; Shannon Zhao; Shannon Zhao; QEMU Developers; qemu-arm; 정우석(CHUNG > > WOO SUK) MS SW; 김현철(KIM > > HYUNCHUL) MS SW > > Subject: Re: [RFC PATCH 1/3] hw/arm/virt: add hotplug memory support > > > > On 20 July 2016 at 01:49, Kwangwoo Lee wrote: > > > Add hotplug memory feature on aarch64 virt platfom. This patch is > > > required to emulate a DIMM type memory like NVDIMM. > > > > > > Signed-off-by: Kwangwoo Lee > > > --- > > > default-configs/aarch64-softmmu.mak | 1 + > > > hw/arm/virt.c | 110 > > > > > > include/hw/arm/virt.h | 3 + > > > 3 files changed, 114 insertions(+) > > > > > > diff --git a/default-configs/aarch64-softmmu.mak > > > b/default-configs/aarch64-softmmu.mak > > > index 2449483..5790cd2 100644 > > > --- a/default-configs/aarch64-softmmu.mak > > > +++ b/default-configs/aarch64-softmmu.mak > > > @@ -7,3 +7,4 @@ CONFIG_AUX=y > > > CONFIG_DDC=y > > > CONFIG_DPCD=y > > > CONFIG_XLNX_ZYNQMP=y > > > +CONFIG_MEM_HOTPLUG=y > > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > > > index a193b5a..f7ff411 100644 > > > --- a/hw/arm/virt.c > > > +++ b/hw/arm/virt.c > > > @@ -58,6 +58,8 @@ > > > #include "hw/smbios/smbios.h" > > > #include "qapi/visitor.h" > > > #include "standard-headers/linux/input.h" > > > +#include "hw/mem/pc-dimm.h" > > > +#include "hw/acpi/acpi.h" > > > > > > /* Number of external interrupt lines to configure the GIC with */ > > > #define NUM_IRQS 256 > > > @@ -91,6 +93,7 @@ typedef struct { > > > bool secure; > > > bool highmem; > > > int32_t gic_version; > > > +MemoryHotplugState hotplug_memory; > > > } VirtMachineState; > > > > > > #define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt") > > > @@ -1376,6 +1379,40 @@ static void machvirt_init(MachineState *machine) > > > guest_info_state->machine_done.notify = virt_guest_info_machine_done; > > > qemu_add_machine_init_done_notifier(&guest_info_state->machine_done); > > > > > > +/* initialize hotplug memory address space */ > > > +if (machine->ram_size < machine->maxram_size) { > > > +ram_addr_t hotplug_mem_size = machine->maxram_size - > > > machine->ram_size; > > > + > > > +if (machine->ram_slots > ACPI_MAX_RAM_SLOTS) { > > > +error_report("unsupported amount of memory slots: %"PRIu64, > > > > "number of" > > OK. I'll fix this. > > > > + machine->ram_slots); > > > +exit(EXIT_FAILURE); > > > +} > > > + > > > +if (QEMU_ALIGN_UP(machine->maxram_size, > > > + TARGET_PAGE_SIZE) != machine->maxram_size) { > > > +error_report("maximum memory size must by aligned to > > > multiple of " > > > > "must be" > > OK. I'll fix this > > > > + "%d bytes", TARGET_PAGE_SIZE); > > > +exit(EXIT_FAILURE); > > > +} > > > + > > > +vms->hotplug_memory.base = > > > + ROUND_UP(vbi->memmap[VIRT_MEM].base + > > > machine->ram_size, > > > + > > > ARCH_VIRT_HOTPLUG_MEM_ALIGN); > > > + > > > +if ((vms->hotplug_memory.base + hotplug_mem_size) < > > > +hotplug_mem_size) { > > > > This expression is confusing. Is it trying to test for overflow? > > When can that happen? > > Ah.. you are right. No need to check this. I'll remove this. Thanks! > > > > +error_report("unsupported amount of maximum memory: " > > > RAM_ADDR_FMT, > > > + machine->maxram_size); > > > +exit(EXIT_FAILURE); > > > +} > > > + > > > +memory_region_init(&vms->hotplug_memory.mr, OBJECT(vms), > > > + "hotplug-memory", hotplug_mem_size); > > > +memory_region_add_subregion(sysmem, vms->hotplug_memory.base, > > > +&vms->hotplug_memory.mr); > > > +} > > > + > > > vbi->bootinfo.ram_size = machine->ram_size; > > > vbi->bootinfo.kernel_filename = machine->kernel_filename; > > > vbi->bootinfo.kernel_cmdline = machine->kernel_cmdline; > > > @@ -1448,9 +1485,75 @@ static void virt_set_gic_version(Object *obj, > > > const char *value, Error **errp) > > > } > > > } > > > > > > +static void virt_dimm_plug(HotplugHandler *hotplug_dev, > > > + DeviceState *dev, Error **errp) > > > +{ > > > +VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); > > > +PCDIMMDevice *dimm = PC_DIMM(dev); > > > +PCDIMMDeviceClass *ddc = PC_DIMM_
[Qemu-devel] [PATCH] vhost: don't set vring call if no vector
We used to set vring call fd unconditionally even if guest driver does not use MSIX for this vritqueue at all. This will cause lots of unnecessary userspace access and other checks for drivers does not use interrupt at all (e.g virtio-net pmd). So check and clean vring call fd if guest does not use any vector for this virtqueue at all. Perf diffs (on rx) shows lots of cpus wasted on vhost_signal() were saved: # 28.12% -27.82% [vhost] [k] vhost_signal 14.44% -1.69% [kernel.vmlinux] [k] copy_user_generic_string 7.05% +1.53% [kernel.vmlinux] [k] __free_page_frag 6.51% +5.53% [vhost] [k] vhost_get_vq_desc ... Pktgen tests shows 15.8% improvement on rx pps and 6.5% on tx pps. Before: RX 2.08Mpps TX 1.35Mpps After: RX 2.41Mpps TX 1.44Mpps Signed-off-by: Jason Wang --- hw/virtio/vhost.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 3d0c807..bd051ab 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -822,6 +822,9 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, struct vhost_virtqueue *vq, unsigned idx) { +BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); +VirtioBusState *vbus = VIRTIO_BUS(qbus); +VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); hwaddr s, l, a; int r; int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx); @@ -912,8 +915,19 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, vhost_virtqueue_mask(dev, vdev, idx, false); } +if (k->query_guest_notifiers && +k->query_guest_notifiers(qbus->parent) && +virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) { +file.fd = -1; +r = dev->vhost_ops->vhost_set_vring_call(dev, &file); +if (r) { +goto fail_vector; +} +} + return 0; +fail_vector: fail_kick: fail_alloc: cpu_physical_memory_unmap(vq->ring, virtio_queue_get_ring_size(vdev, idx), -- 2.7.4
Re: [Qemu-devel] [PATCH 0/3] qdist fixes
On 25/07/2016 17:03, Emilio G. Cota wrote: > While fixing the return of a NULL string when printing an empty > dist (patch 3) (see background here [*]), I noticed there was > a leak in qdist (patch 1). Patch 2 is trivial. > > Thanks, > > Emilio > > [*] https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg05494.html > Queued all, thanks. Paolo
Re: [Qemu-devel] [RFC PATCH 1/3] hw/arm/virt: add hotplug memory support
On 1 August 2016 at 08:46, Igor Mammedov wrote: > On Mon, 1 Aug 2016 00:35:35 + > "kwangwoo@sk.com" wrote: >> > > +/* 1GB alignment for hotplug memory region */ >> > > +#define ARCH_VIRT_HOTPLUG_MEM_ALIGN (1ULL << 30) >> > >> > Where does the 1GB alignment come from? Why do we need 1GB >> > alignment for the base but only 1KB alignment for the size? >> >> The alignment value of hotplug_memory.base referred from i386 pc.c and ppc >> spapr.c. >> Could you suggest a proper range for this? > Base alignment comes from max supported hugepage size, Max hugepage size for any host? (if so, should be defined in a common header somewhere) Max hugepage size for ARM hosts? (if so, why is TCG different from KVM?, and should still be in a common header somewhere) > while > size alignment should depend on backend's page size Which page size do you have in mind here? TARGET_PAGE_SIZE is often not the right answer, since it doesn't correspond either to the actual page size being used by the host kernel or to the actual page size used by the guest kernel... thanks -- PMM
Re: [Qemu-devel] [PATCH] mptsas: Fix a migration compatible issue
On 26/07/2016 11:03, Cao jin wrote: > My previous commit 2e2aa316 removed internal flag msi_in_use, which > exists in vmstate, use VMSTATE_UNUSED for migration compatibility. > > Reported-by: Amit Shah > Suggested-by: Amit Shah > Cc: Markus Armbruster > Cc: Marcel Apfelbaum > Cc: Paolo Bonzini > Cc: Michael S. Tsirkin > Cc: Amit Shah > Signed-off-by: Cao jin > --- > hw/scsi/mptsas.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c > index c1a0649..0ed24d1 100644 > --- a/hw/scsi/mptsas.c > +++ b/hw/scsi/mptsas.c > @@ -1370,7 +1370,7 @@ static const VMStateDescription vmstate_mptsas = { > .post_load = mptsas_post_load, > .fields = (VMStateField[]) { > VMSTATE_PCI_DEVICE(dev, MPTSASState), > - > +VMSTATE_UNUSED(sizeof(bool)), /* Was msi_in_use */ This needs to be "1", not sizeof(bool), because vmstate_info_bool writes a single byte. I'll fix this and queue the patch (removing Amit's reviewed-by since it's effectively a different change). Paolo > VMSTATE_UINT32(state, MPTSASState), > VMSTATE_UINT8(who_init, MPTSASState), > VMSTATE_UINT8(doorbell_state, MPTSASState), >
Re: [Qemu-devel] [PATCH for-2.7] wxx: Truncate files used for character devices
On 26/07/2016 19:11, Stefan Weil wrote: > On Windows, such files were not truncated like on all other hosts. > Now we also test whether truncation is needed when running on Windows. > > Reported-by: Benjamin David Lunt > Signed-off-by: Stefan Weil > --- > qemu-char.c | 11 ++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/qemu-char.c b/qemu-char.c > index e4b8448..7de63c8 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -4197,14 +4197,23 @@ static CharDriverState *qmp_chardev_open_file(const > char *id, > ChardevFile *file = backend->u.file.data; > ChardevCommon *common = qapi_ChardevFile_base(file); > HANDLE out; > +DWORD flags; > > if (file->has_in) { > error_setg(errp, "input file not supported"); > return NULL; > } > > +if (file->has_append && file->append) { > +/* Append to file if it already exists. */ > +flags = OPEN_ALWAYS; > +} else { > +/* Truncate file if it already exists. */ > +flags = CREATE_ALWAYS; > +} > + > out = CreateFile(file->out, GENERIC_WRITE, FILE_SHARE_READ, NULL, GENERIC_WRITE does not include FILE_APPEND_DATA. You should also change the access rights to FILE_GENERIC_WRITE & ~FILE_WRITE_DATA in the append case; see commit 52074d0f662fc51293d4cde8077631f754784405 for a similar case in qemu-ga. Thanks, Paolo > - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); > + flags, FILE_ATTRIBUTE_NORMAL, NULL); > if (out == INVALID_HANDLE_VALUE) { > error_setg(errp, "open %s failed", file->out); > return NULL; >
Re: [Qemu-devel] [PATCH v2] i2c: fix migration regression introduced by broadcast support
On 27/07/2016 14:39, Igor Mammedov wrote: > QEMU fails migration with following error: > > qemu-system-x86_64: Missing section footer for i2c_bus > qemu-system-x86_64: load of migration failed: Invalid argument > > when migrating from: > qemu-system-x86_64-v2.6.0 -m 256M rhel72.img -M pc-i440fx-2.6 > to > qemu-system-x86_64-v2.7.0-rc0 -m 256M rhel72.img -M pc-i440fx-2.6 > > Regression is added by commit 2293c27f (i2c: implement broadcast write) > > Fix it by dropping 'broadcast' VMState introduced by 2293c27f and > reuse broadcast 0x00 address as broadcast flag in bus->saved_address. > Then if there were ongoing broadcast at migration time, set > bus->saved_address to it and at i2c_slave_post_load() time check > for it instead of transfering and using 'broadcast' VMState. > > As result of reusing existing saved_address VMState, no compat > glue will be needed to keep forward/backward compatiblity. which > makes fix much less intrusive. > > Signed-off-by: Igor Mammedov > --- > CC: fred.kon...@greensocs.com > CC: alistair.fran...@xilinx.com > CC: crosthwaite.pe...@gmail.com > CC: hyun.k...@xilinx.com > CC: peter.mayd...@linaro.org > > --- > hw/i2c/core.c | 10 +++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/hw/i2c/core.c b/hw/i2c/core.c > index abb3efb..4afbe0b 100644 > --- a/hw/i2c/core.c > +++ b/hw/i2c/core.c > @@ -17,6 +17,8 @@ struct I2CNode { > QLIST_ENTRY(I2CNode) next; > }; > > +#define I2C_BROADCAST 0x00 > + > struct I2CBus > { > BusState qbus; > @@ -47,6 +49,8 @@ static void i2c_bus_pre_save(void *opaque) > if (!QLIST_EMPTY(&bus->current_devs)) { > if (!bus->broadcast) { > bus->saved_address = > QLIST_FIRST(&bus->current_devs)->elt->address; > +} else { > +bus->saved_address = I2C_BROADCAST; > } > } > } > @@ -58,7 +62,6 @@ static const VMStateDescription vmstate_i2c_bus = { > .pre_save = i2c_bus_pre_save, > .fields = (VMStateField[]) { > VMSTATE_UINT8(saved_address, I2CBus), > -VMSTATE_BOOL(broadcast, I2CBus), > VMSTATE_END_OF_LIST() > } > }; > @@ -93,7 +96,7 @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int > recv) > I2CSlaveClass *sc; > I2CNode *node; > > -if (address == 0x00) { > +if (address == I2C_BROADCAST) { > /* > * This is a broadcast, the current_devs will be all the devices of > the > * bus. > @@ -221,7 +224,8 @@ static int i2c_slave_post_load(void *opaque, int > version_id) > I2CNode *node; > > bus = I2C_BUS(qdev_get_parent_bus(DEVICE(dev))); > -if ((bus->saved_address == dev->address) || (bus->broadcast)) { > +if ((bus->saved_address == dev->address) || > +(bus->saved_address == I2C_BROADCAST)) { > node = g_malloc(sizeof(struct I2CNode)); > node->elt = dev; > QLIST_INSERT_HEAD(&bus->current_devs, node, next); > That's better than both the v1 patch and my suggestion. Good! I've queued the patch and hope to send a pull request tomorrow. Paolo
Re: [Qemu-devel] [PATCH for-2.7 1/1] ide: fix halted IO segfault at reset
On 27/07/2016 00:07, John Snow wrote: > If one attempts to perform a system_reset after a failed IO request > that causes the VM to enter a paused state, QEMU will segfault trying > to free up the pending IO requests. > > These requests have already been completed and freed, though, so all > we need to do is free them before we enter the paused state. > > Existing AHCI tests verify that halted requests are still resumed > successfully after a STOP event. > > Signed-off-by: John Snow > --- > hw/ide/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/ide/core.c b/hw/ide/core.c > index 081c9eb..d117b7c 100644 > --- a/hw/ide/core.c > +++ b/hw/ide/core.c > @@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret) > } > if (ret < 0) { > if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { > +s->bus->dma->aiocb = NULL; > return; > } > } > The patch is (was, since it's committed :)) okay, but I think there is another bug in the REPORT case, where ide_rw_error and ide_atapi_io_error are not calling ide_set_inactive and thus are leaving s->bus->dma->aiocb non-NULL. Paolo
Re: [Qemu-devel] [PATCH] help: Update help to reflect that GTK is the default
On 27/07/2016 18:21, Colin Lord wrote: > Updates the messages displayed in the help option to reflect that GTK is > the default display, not SDL. > --- > qemu-options.hx | 16 > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/qemu-options.hx b/qemu-options.hx > index 8e0d9a5..5bec1d3 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -967,7 +967,7 @@ DEF("nographic", 0, QEMU_OPTION_nographic, > STEXI > @item -nographic > @findex -nographic > -Normally, QEMU uses SDL to display the VGA output. With this option, > +Normally, QEMU uses GTK to display the VGA output. With this option, IIRC SDL is the default if GTK is not enabled. So perhaps "uses GTK or SDL"? Since you are at it, replace "the VGA output" with "output (such as graphics, console, and the QEMU monitor)" > you can totally disable graphical output so that QEMU is a simple > command line application. The emulated serial port is redirected on > the console and muxed with the monitor (unless redirected elsewhere > @@ -977,12 +977,12 @@ the console and monitor. > ETEXI > > DEF("curses", 0, QEMU_OPTION_curses, > -"-curses use a curses/ncurses interface instead of SDL\n", > +"-curses use a curses/ncurses interface instead of GTK\n", Remove "instead of GTK" altogether? > QEMU_ARCH_ALL) > STEXI > @item -curses > @findex -curses > -Normally, QEMU uses SDL to display the VGA output. With this option, > +Normally, QEMU uses GTK to display the VGA output. With this option, Same as above ("GTK or SDL"). > QEMU can display the VGA output when in text mode using a > curses/ncurses interface. Nothing is displayed in graphical mode. > ETEXI > @@ -1034,6 +1034,14 @@ STEXI > Enable SDL. > ETEXI > > +DEF("gtk", 0, QEMU_OPTION_gtk, > +"-gtkenable GTK (default)\n", QEMU_ARCH_ALL) > +STEXI > +@item -gtk > +@findex -gtk > +Enable GTK. > +ETEXI We try to avoid adding new "-foo" options. All of them invariably end up requiring some sort of suboption, which is why we have "-display" now. > DEF("spice", HAS_ARG, QEMU_OPTION_spice, > "-spice [port=port][,tls-port=secured-port][,x509-dir=]\n" > " [,x509-key-file=][,x509-key-password=]\n" > @@ -1228,7 +1236,7 @@ DEF("vnc", HAS_ARG, QEMU_OPTION_vnc , > STEXI > @item -vnc @var{display}[,@var{option}[,@var{option}[,...]]] > @findex -vnc > -Normally, QEMU uses SDL to display the VGA output. With this option, > +Normally, QEMU uses GTK to display the VGA output. With this option, Same as above ("GTK or SDL"). Thanks, Paolo > you can have QEMU listen on VNC display @var{display} and redirect the VGA > display over the VNC session. It is very useful to enable the usb > tablet device when using this option (option @option{-usbdevice >
Re: [Qemu-devel] [PATCH] linux-user: Use correct alignment for long long on i386 guests
On Thu, Jul 28, 2016 at 12:57:59PM +0100, Peter Maydell wrote: > For i386, the ABI specifies that 'long long' (8 byte values) > need only be 4 aligned, but we were requiring them to be > 8-aligned. This meant we were laying out the target_epoll_event > structure wrongly. Add a suitable ifdef to abitypes.h to > specify the i386-specific alignment requirement. Thanks, applied all your patches upto this patch to: https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/for-next I take none of the patches are important enough to warrant including in 2.7? > Reported-by: Icenowy Zheng > Signed-off-by: Peter Maydell > --- > include/exec/user/abitypes.h | 4 > 1 file changed, 4 insertions(+) > > diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h > index a09d6c6..ba18860 100644 > --- a/include/exec/user/abitypes.h > +++ b/include/exec/user/abitypes.h > @@ -15,6 +15,10 @@ > #define ABI_LLONG_ALIGNMENT 2 > #endif > > +#if defined(TARGET_I386) && !defined(TARGET_X86_64) > +#define ABI_LLONG_ALIGNMENT 4 > +#endif > + > #ifndef ABI_SHORT_ALIGNMENT > #define ABI_SHORT_ALIGNMENT 2 > #endif > -- > 1.9.1 >
Re: [Qemu-devel] [PULL v2 for-2.7 02/15] qapi: change QmpInputVisitor to QSLIST
On 27/07/2016 23:37, Laszlo Ersek wrote: > It seems to me that QEMU deadlocks when it tries to emit the > SPICE_DISCONNECTED event. > > (Note that I can't find "handle SPICE_DISCONNECTED" in the libvirtd log > even in the successful case (i.e., when QEMU is built at the parent of > 3d344c2aabb7).) > > Apparently audio_atexit() is triggered when QEMU is returning from > main() -- or calling exit() --, which somehow results in QEMU trying to > send a SPICE_DISCONNECTED event through the monitor? I guess the monitor > has been long dead by then. > > Hmmm, this gives me an idea... What happens if I remove the following > fragment from my domain XML? > > >function='0x0'/> > > > Yeah, the hang disappears, shutdown works just fine. It's a spice audio > bug after all, apparently. Sorry for reporting it in this thread! :) I'm > adding Gerd to the address list. > > To reiterate: this patch (commit 3d344c2aabb7) does *not* cause the > symptom, it only exposes an independent bug that causes the symptom. > And, I can work around that for now, by removing sound devices. I think the issue here is that the monitor is gone by the time audio_atexit is called. It is caused by commit ca24a3358ecd2f17be7c8b117cfe8bc5e5f8. The fix is to move the audio_atexit call to main before qemu_chr_cleanup, but I'm not sure how to deal with coreaudio_atexit. Paolo
Re: [Qemu-devel] [RFC PATCH 1/3] hw/arm/virt: add hotplug memory support
On Mon, 1 Aug 2016 09:13:34 +0100 Peter Maydell wrote: > On 1 August 2016 at 08:46, Igor Mammedov wrote: > > On Mon, 1 Aug 2016 00:35:35 + > > "kwangwoo@sk.com" wrote: > > >> > > +/* 1GB alignment for hotplug memory region */ > >> > > +#define ARCH_VIRT_HOTPLUG_MEM_ALIGN (1ULL << 30) > >> > > >> > Where does the 1GB alignment come from? Why do we need 1GB > >> > alignment for the base but only 1KB alignment for the size? > >> > >> The alignment value of hotplug_memory.base referred from i386 pc.c and ppc > >> spapr.c. > >> Could you suggest a proper range for this? > > > Base alignment comes from max supported hugepage size, > > Max hugepage size for any host? (if so, should be defined > in a common header somewhere) > Max hugepage size for ARM hosts? (if so, why is TCG > different from KVM?, and should still be in a common > header somewhere) It's the same for TCG but it probably doesn't matter much there, main usage is to provide better performance with KVM. So I'd say it's host depended (for x86 it's 1Gb), probably other values for ARM and PPC > > > while > > size alignment should depend on backend's page size > > Which page size do you have in mind here? TARGET_PAGE_SIZE > is often not the right answer, since it doesn't > correspond either to the actual page size being used > by the host kernel or to the actual page size used > by the guest kernel... alignment comes from here: memory_region_get_alignment() exec:c MAX(page_size, QEMU_VMALLOC_ALIGN) so it's either backend's page size or a min chunk QEMU allocates memory to make KVM/valgrind/whatnot happy. > > thanks > -- PMM
Re: [Qemu-devel] VM CPU/Disk unexplained increase in resize time
A kind reminder about the following email. Thanks! > On 29 Jul 2016, at 11:30, Chathura M. Sarathchandra Magurawalage > <77.chath...@gmail.com> wrote: > > Hi, > > Does anyone know the reason for, VM resizing time to increase faster if you > continuously increase CPU or DISK resources by +1 (e.g. 1-2, 2-3, 3-4, 4-5). > Whereas, when you increase from 1 to any other (e.g. 1-2, 1-2, 1,3, 1-4, 1-5) > it takes less time in comparison. Can anyone give an explanation for this? I > have plotted two graphs. > > https://www.dropbox.com/s/5e8xrrctu0rcwx3/CPU%20scaling%20%20-%20continuous%20vs%20increasing%20from%201.png?dl=0 > https://www.dropbox.com/s/txpkb8k6mpyexv8/CPU%20scaling%20-%20increase%20from%201.png?dl=0 > > The first graph shows the VM CPU resize time (y axis) vs number of vCPUs (x > axis) of continuous (blue) and resize from a VM with 1 vCPU (green) > scenarios.The second graph shows the VM CPU resize time (y axis) vs number of > vCPUs (x axis), when resized from a VM with 1 vCPU at each step (The green > line in first graph). The error bars show the standard error of the gathered > values at each step, as I did resize multiple times to get a mean value. I > use openstack on x86 with KVM, although I have asked the openstack community > I could not yet find an answer to this. > > Thanks! >
Re: [Qemu-devel] [PATCH 2/4] nbd: Limit nbdflags to 16 bits
On 21/07/2016 21:34, Eric Blake wrote: > Furthermore, upstream NBD has never passed the global flags to > the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first > introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually > tried to OR the global flags with the transmission flags, with > the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9 > caused all earlier NBD 3.x clients to treat every export as > read-only; NBD 3.10 and later intentionally clip things to 16 > bits to pass only transmission flags). Qemu should follow suit, > since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE > and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior > during transmission. Should squash this in too: diff --git a/nbd/server.c b/nbd/server.c index 80fbb4d..6fa2f9c 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -575,7 +575,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) oldStyle = client->exp != NULL && !client->tlscreds; if (oldStyle) { -TRACE("advertising size %" PRIu64 " and flags %x", +TRACE("advertising size %" PRIu64 " and flags %" PRIx16, client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 8, NBD_CLIENT_MAGIC); stq_be_p(buf + 16, client->exp->size); @@ -605,7 +605,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) goto fail; } -TRACE("advertising size %" PRIu64 " and flags %x", +TRACE("advertising size %" PRIu64 " and flags %" PRIx16, client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 18, client->exp->size); stw_be_p(buf + 26, client->exp->nbdflags | myflags);
Re: [Qemu-devel] [PATCH 3/4] osdep: Document differences in rounding macros
On 21/07/2016 21:34, Eric Blake wrote: > Make it obvious which macros are safe in which situations. > > Useful since QEMU_ALIGN_UP and ROUND_UP both purport to do > the same thing, but differ on whether the alignment must be > a power of 2. > > Signed-off-by: Eric Blake > --- > include/qemu/osdep.h | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h > index fbb8759..9991fb0 100644 > --- a/include/qemu/osdep.h > +++ b/include/qemu/osdep.h > @@ -158,7 +158,8 @@ extern int daemon(int, int); > /* Round number down to multiple */ > #define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m)) > > -/* Round number up to multiple */ > +/* Round number up to multiple. Safe when m is not a power of 2 (see > + * ROUND_UP for a faster version when a power of 2 is guaranteed) */ > #define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m)) > > /* Check if n is a multiple of m */ > @@ -175,6 +176,9 @@ extern int daemon(int, int); > /* Check if pointer p is n-bytes aligned */ > #define QEMU_PTR_IS_ALIGNED(p, n) QEMU_IS_ALIGNED((uintptr_t)(p), (n)) > > +/* Round number up to multiple. Requires that d be a power of 2 (see > + * QEMU_ALIGN_UP for a safer but slower version on arbitrary > + * numbers) */ > #ifndef ROUND_UP > #define ROUND_UP(n,d) (((n) + (d) - 1) & -(d)) > #endif Ouch, this is ugly, especially since DIV_ROUND_UP does not require alignment! Not your fault of course, and the patch is arguably an improvement. Paolo
Re: [Qemu-devel] [PATCH v2] i2c: fix migration regression introduced by broadcast support
* Igor Mammedov (imamm...@redhat.com) wrote: > QEMU fails migration with following error: > > qemu-system-x86_64: Missing section footer for i2c_bus > qemu-system-x86_64: load of migration failed: Invalid argument > > when migrating from: > qemu-system-x86_64-v2.6.0 -m 256M rhel72.img -M pc-i440fx-2.6 > to > qemu-system-x86_64-v2.7.0-rc0 -m 256M rhel72.img -M pc-i440fx-2.6 > > Regression is added by commit 2293c27f (i2c: implement broadcast write) > > Fix it by dropping 'broadcast' VMState introduced by 2293c27f and > reuse broadcast 0x00 address as broadcast flag in bus->saved_address. > Then if there were ongoing broadcast at migration time, set > bus->saved_address to it and at i2c_slave_post_load() time check > for it instead of transfering and using 'broadcast' VMState. > > As result of reusing existing saved_address VMState, no compat > glue will be needed to keep forward/backward compatiblity. which > makes fix much less intrusive. > > Signed-off-by: Igor Mammedov Reviewed-by: Dr. David Alan Gilbert > --- > CC: fred.kon...@greensocs.com > CC: alistair.fran...@xilinx.com > CC: crosthwaite.pe...@gmail.com > CC: hyun.k...@xilinx.com > CC: peter.mayd...@linaro.org > > --- > hw/i2c/core.c | 10 +++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/hw/i2c/core.c b/hw/i2c/core.c > index abb3efb..4afbe0b 100644 > --- a/hw/i2c/core.c > +++ b/hw/i2c/core.c > @@ -17,6 +17,8 @@ struct I2CNode { > QLIST_ENTRY(I2CNode) next; > }; > > +#define I2C_BROADCAST 0x00 > + > struct I2CBus > { > BusState qbus; > @@ -47,6 +49,8 @@ static void i2c_bus_pre_save(void *opaque) > if (!QLIST_EMPTY(&bus->current_devs)) { > if (!bus->broadcast) { > bus->saved_address = > QLIST_FIRST(&bus->current_devs)->elt->address; > +} else { > +bus->saved_address = I2C_BROADCAST; > } > } > } > @@ -58,7 +62,6 @@ static const VMStateDescription vmstate_i2c_bus = { > .pre_save = i2c_bus_pre_save, > .fields = (VMStateField[]) { > VMSTATE_UINT8(saved_address, I2CBus), > -VMSTATE_BOOL(broadcast, I2CBus), > VMSTATE_END_OF_LIST() > } > }; > @@ -93,7 +96,7 @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int > recv) > I2CSlaveClass *sc; > I2CNode *node; > > -if (address == 0x00) { > +if (address == I2C_BROADCAST) { > /* > * This is a broadcast, the current_devs will be all the devices of > the > * bus. > @@ -221,7 +224,8 @@ static int i2c_slave_post_load(void *opaque, int > version_id) > I2CNode *node; > > bus = I2C_BUS(qdev_get_parent_bus(DEVICE(dev))); > -if ((bus->saved_address == dev->address) || (bus->broadcast)) { > +if ((bus->saved_address == dev->address) || > +(bus->saved_address == I2C_BROADCAST)) { > node = g_malloc(sizeof(struct I2CNode)); > node->elt = dev; > QLIST_INSERT_HEAD(&bus->current_devs, node, next); > -- > 2.7.4 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
Re: [Qemu-devel] [PATCH 4/4] block: Cater to iscsi with non-power-of-2 discard
On 28/07/2016 04:39, Eric Blake wrote: > On 07/27/2016 01:25 AM, Fam Zheng wrote: >> On Thu, 07/21 13:34, Eric Blake wrote: >>> +max_write_zeroes = max_write_zeroes / alignment * alignment; >> >> Not using QEMU_ALIGN_DOWN despite patch 3? > > Looks like I missed that on the rebase. Can fix if there is a reason for > a respin. Since Stefan acked this, I'm applying the patch and fixing it to use QEMU_ALIGN_DOWN. Paolo
[Qemu-devel] [PATCH v6 2/2] virtio-crypto: add conformance clauses
Add the conformance targets and clauses for virtio-crypto device. Signed-off-by: Gonglei --- conformance.tex | 30 ++ 1 file changed, 30 insertions(+) diff --git a/conformance.tex b/conformance.tex index f59e360..915a9f0 100644 --- a/conformance.tex +++ b/conformance.tex @@ -146,6 +146,21 @@ An SCSI host driver MUST conform to the following normative statements: \item \ref{drivernormative:Device Types / SCSI Host Device / Device Operation / Device Operation: eventq} \end{itemize} +\subsection{Crypto Driver Conformance}\label{sec:Conformance / Driver Conformance / Crypto Driver Conformance} + +An Crypto driver MUST conform to the following normative statements: + +\begin{itemize} +\item \ref{drivernormative:Device Types / Crypto Device / Device configuration layout / Driver Requirements: Device configuration layout} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Session operation / Session operation: create session / Driver Requirements: Session operation: create session} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Session operation / Session operation: destroy session / Driver Requirements: Session operation: destroy session} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: HASH operation / Driver Requirements: Crypto operation: HASH operation} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: MAC operation / Driver Requirements: Crypto operation: MAC operation} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: Symmetric algorithms operation / Driver Requirements: Crypto operation: Symmetric algorithms encryption} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: AEAD operation / Driver Requirements: Crypto operation: AEAD encryption} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: AEAD operation / Driver Requirements: Crypto operation: AEAD decryption} +\end{itemize} + \section{Device Conformance}\label{sec:Conformance / Device Conformance} A device MUST conform to the following normative statements: @@ -267,6 +282,21 @@ An SCSI host device MUST conform to the following normative statements: \item \ref{devicenormative:Device Types / SCSI Host Device / Device Operation / Device Operation: eventq} \end{itemize} +\subsection{Crypto Device Conformance}\label{sec:Conformance / Device Conformance / Crypto Device Conformance} + +An Crypto device MUST conform to the following normative statements: + +\begin{itemize} +\item \ref{drivernormative:Device Types / Crypto Device / Device configuration layout / Device Requirements: Device configuration layout} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Session operation / Session operation: create session / Device Requirements: Session operation: create session} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Session operation / Session operation: destroy session / Device Requirements: Session operation: destroy session} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: HASH operation / Device Requirements: Crypto operation: HASH operation} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: MAC operation / Device Requirements: Crypto operation: MAC operation} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: Symmetric algorithms operation / Device Requirements: Crypto operation: Symmetric algorithms encryption} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: AEAD operation / Device Requirements: Crypto operation: AEAD encryption} +\item \ref{drivernormative:Device Types / Crypto Device / Device Operation / Crypto operation / Crypto operation: AEAD operation / Device Requirements: Crypto operation: AEAD decryption} +\end{itemize} + \section{Legacy Interface: Transitional Device and Transitional Driver Conformance}\label{sec:Conformance / Legacy Interface: Transitional Device and -- 1.7.12.4
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
On Sat, Jul 30, 2016 at 05:57:02PM +0900, Namhyung Kim wrote: > On Thu, Jul 28, 2016 at 02:22:39PM +0100, Daniel P. Berrange wrote: > > > +static void virtio_pstore_from_filename(VirtIOPstore *s, char *name, > > > +char *buf, size_t sz, > > > +struct virtio_pstore_fileinfo > > > *info) > > > +{ > > > +snprintf(buf, sz, "%s/%s", s->directory, name); > > > + > > > +if (g_str_has_prefix(name, "dmesg-")) { > > > +info->type = VIRTIO_PSTORE_TYPE_DMESG; > > > +name += strlen("dmesg-"); > > > +} else if (g_str_has_prefix(name, "console-")) { > > > +info->type = VIRTIO_PSTORE_TYPE_CONSOLE; > > > +name += strlen("console-"); > > > +} else if (g_str_has_prefix(name, "unknown-")) { > > > +info->type = VIRTIO_PSTORE_TYPE_UNKNOWN; > > > +name += strlen("unknown-"); > > > +} [snip] > > > +struct virtio_pstore_fileinfo info; > > > +size_t offset = sizeof(*res) + sizeof(info); > > > + > > > +if (s->dirp == NULL) { > > > +return -1; > > > +} > > > + > > > +dent = readdir(s->dirp); > > > +while (dent) { > > > +if (dent->d_name[0] != '.') { > > > +break; > > > +} > > > +dent = readdir(s->dirp); > > > +} > > > + > > > +if (dent == NULL) { > > > +return 0; > > > +} > > > > So this seems to just be picking the first filename reported by > > readdir that isn't starting with '.'. Surely this can't the right > > logic when your corresponding do_write method can pick several > > different filenames, its potluck which do_read will give back. > > Do you mean that it'd be better to check a list of known filenames and > fail if not? No, I mean that you have several different VIRTIO_PSTORE_TYPE_nnn and use a different file for each constant. When reading this directory though you're not looking for the file corresponding to any given VIRTIO_PSTORE_TYPE_nnn - you're simply reading whichever file is found first. So you might have just read a TYPE_CONSOLE or have read a TYPE_DMESG - it surely doesn't make sense to randonly read either TYPE_CONSOLE or TYPE_DMESG based on whatever order readdir() lists the files. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PULL v2 for-2.7 02/15] qapi: change QmpInputVisitor to QSLIST
Hi - Original Message - > > > On 27/07/2016 23:37, Laszlo Ersek wrote: > > It seems to me that QEMU deadlocks when it tries to emit the > > SPICE_DISCONNECTED event. > > > > (Note that I can't find "handle SPICE_DISCONNECTED" in the libvirtd log > > even in the successful case (i.e., when QEMU is built at the parent of > > 3d344c2aabb7).) > > > > Apparently audio_atexit() is triggered when QEMU is returning from > > main() -- or calling exit() --, which somehow results in QEMU trying to > > send a SPICE_DISCONNECTED event through the monitor? I guess the monitor > > has been long dead by then. > > > > Hmmm, this gives me an idea... What happens if I remove the following > > fragment from my domain XML? > > > > > >> function='0x0'/> > > > > > > Yeah, the hang disappears, shutdown works just fine. It's a spice audio > > bug after all, apparently. Sorry for reporting it in this thread! :) I'm > > adding Gerd to the address list. > > > > To reiterate: this patch (commit 3d344c2aabb7) does *not* cause the > > symptom, it only exposes an independent bug that causes the symptom. > > And, I can work around that for now, by removing sound devices. > > I think the issue here is that the monitor is gone by the time > audio_atexit is called. It is caused by commit > ca24a3358ecd2f17be7c8b117cfe8bc5e5f8. > > The fix is to move the audio_atexit call to main before > qemu_chr_cleanup, but I'm not sure how to deal with coreaudio_atexit. alternatively, cleanup the monitor before cleaning up the chardev? I was just looking at that, see wip patch attached.From 6d8de90eaf12883a87721fa67b67cecfa9a67450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 1 Aug 2016 13:16:55 +0400 Subject: [PATCH] monitor: fix crash when leaving qemu with spice audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu. However, the monitor has still references to them, which may lead to crashes when running atexit() and trying to send monitor events: #0 0x7fffdb18f6f5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 #1 0x7fffdb1912fa in __GI_abort () at abort.c:89 #2 0x55c263e7 in error_exit (err=22, msg=0x55d47980 <__func__.13537> "qemu_mutex_lock") at util/qemu-thread-posix.c:39 #3 0x55c26488 in qemu_mutex_lock (mutex=0x567a2420) at util/qemu-thread-posix.c:66 #4 0x558c52db in qemu_chr_fe_write (s=0x567a2420, buf=0x5740dc40 "{\"timestamp\": {\"seconds\": 1470041716, \"microseconds\": 989699}, \"event\": \"SPICE_DISCONNECTED\", \"data\": {\"server\": {\"port\": \"5900\", \"family\": \"ipv4\", \"host\": \"127.0.0.1\"}, \"client\": {\"port\": \"40272\", \"f"..., len=240) at qemu-char.c:280 #5 0x55787cad in monitor_flush_locked (mon=0x567bd9e0) at /home/elmarco/src/qemu/monitor.c:311 #6 0x55787e46 in monitor_puts (mon=0x567bd9e0, str=0x567a44ef "") at /home/elmarco/src/qemu/monitor.c:353 #7 0x557880fe in monitor_json_emitter (mon=0x567bd9e0, data=0x567c73a0) at /home/elmarco/src/qemu/monitor.c:401 #8 0x557882d2 in monitor_qapi_event_emit (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x567c73a0) at /home/elmarco/src/qemu/monitor.c:472 #9 0x5578838f in monitor_qapi_event_queue (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x567c73a0, errp=0x7fffca88) at /home/elmarco/src/qemu/monitor.c:497 #10 0x55c15541 in qapi_event_send_spice_disconnected (server=0x571139d0, client=0x570d0db0, errp=0x566c0428 ) at qapi-event.c:1038 #11 0x55b11bc6 in channel_event (event=3, info=0x570d6c00) at ui/spice-core.c:248 #12 0x7fffdcc9983a in adapter_channel_event (event=3, info=0x570d6c00) at reds.c:120 #13 0x7fffdcc99a25 in reds_handle_channel_event (reds=0x567a9d60, event=3, info=0x570d6c00) at reds.c:324 #14 0x7fffdcc7d4c4 in main_dispatcher_self_handle_channel_event (self=0x567b28b0, event=3, info=0x570d6c00) at main-dispatcher.c:175 #15 0x7fffdcc7d5b1 in main_dispatcher_channel_event (self=0x567b28b0, event=3, info=0x570d6c00) at main-dispatcher.c:194 #16 0x7fffdcca7674 in reds_stream_push_channel_event (s=0x570d9910, event=3) at reds-stream.c:354 #17 0x7fffdcca749b in reds_stream_free (s=0x570d9910) at reds-stream.c:323 #18 0x7fffdccb5dad in snd_disconnect_channel (channel=0x576a89a0) at sound.c:229 #19 0x7fffdccb9e57 in snd_detach_common (worker=0x57739720) at sound.c:1589 #20 0x7fffdccb9f0e in snd_detach_playback (sin=0x569fe3f8) at sound.c:1602 #21 0x7fffdcca3373 in spice_server_remove_interface (sin=0x569fe3f8) at reds.c:3387 #22 0x558ff6e2 in line_out_fini (hw=0x569fe370) at audio/spiceaudio.c:152 #23 0x558f909e in audio_atexit () at audio/audio.c:1754 #24 0x7
[Qemu-devel] [PATCH v6 0/2] virtio-crypto: virtio crypto device specification
This is the specification (version 6) about a new virtio crypto device. After a big reconstruction, the spec (symmetric algos) is near to stabilize. This version fix some problems of formating and return value, etc. If you have any comments, please let me know, thanks :) CC: Michael S. Tsirkin CC: Cornelia Huck CC: Stefan Hajnoczi CC: Lingli Deng CC: Jani Kokkonen CC: Ola Liljedahl CC: Varun Sethi CC: Zeng Xin CC: Keating Brian CC: Ma Liang J CC: Griffin John CC: Hanweidong Changes from v6: - add conformance clauses for virtio crypto device. [Michael] - drop VIRTIO_CRYPTO_S_STARTED. [Michael] - fix some characters problems. [Stefan] - add a MAC algorithm, named VIRTIO_CRYPTO_MAC_ZUC_EIA3. [Zeng Xin] - add the fourth return code, named VIRTIO_CRYPTO_OP_INVSESS used for invalid session id when executing crypto operations. - drop some gpu stuff forgot to delete. [Michael] - convert tab to space all over the content. Changes from v4: - introduce crypto services into virtio crypto device. The services currently defined are CIPHER, MAC, HASH, AEAD, KDF, ASYM, PRIMITIVE. - define a unified crypto request format that is consisted of general header + service specific request, Where 'general header' is for all crypto request, 'service specific request' is composed of operation parameter + input data + output data in generally. operation parameter is algorithm-specific parameters, input data is the data should be operated , output data is the "operation result + result buffer". - redefine the algorithms and structure based on above crypto services. - rearrange the title and subtitle - Only support CIPHER, MAC, HASH and AEAD crypto services, and Xin will focus KDF, ASYM and PRIMITIVE services. - Some other corresponding fixes. - Make a formal patch using tex type. This version is a big reconstruction based on Zeng, Xin' comments, thanks a lot. Changes from v3: - Don't use enum is the spec but macros in specific structures. [Michael & Stefan] - Add two complete structures for session creation and closing, so that the spec is clear on how to lay out the request. [Stefan] - Definite the crypto operation request with assigned structure, in this way, each data request only occupies *one entry* of the Vring descriptor table, which *improves* the *throughput* of data transferring. Changes from v2: - Reserve virtio device ID 20 for crypto device. [Cornelia] - Drop all feature bits, those capabilities are offered by the device all the time. [Stefan & Cornelia] - Add a new section 1.4.2 for driver requirements. [Stefan] - Use definite type definition instead of enum type in some structure. [Stefan] - Add virtio_crypto_cipher_alg definition. [Stefan] - Add a "Device requirements" section as using MUST. [Stefan] - Some grammar nits fixes and typo fixes. [Stefan & Cornelia] - Add one VIRTIO_CRYPTO_S_STARTED status for the driver as the flag of virtio-crypto device started and can work now. Great thanks for Stefan and Cornelia! Changes from v1: - Drop the feature bit definition for each algorithm, and using config space instead [Cornelia] - Add multiqueue support and add corresponding feature bit - Update Encryption process and header definition - Add session operation process and add corresponding header description - Other better description in order to fit for virtio spec [Michael] - Some other trivial fixes. Gonglei (2): virtio-crypto: Add virtio crypto device specification virtio-crypto: Add conformance clauses conformance.tex | 30 +++ content.tex | 2 + virtio-crypto.tex | 793 ++ 3 files changed, 825 insertions(+) create mode 100644 virtio-crypto.tex -- 1.7.12.4
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
On Sat, Jul 30, 2016 at 05:38:27PM +0900, Namhyung Kim wrote: > Hello, > > On Thu, Jul 28, 2016 at 02:08:41PM +0100, Daniel P. Berrange wrote: > > On Thu, Jul 28, 2016 at 01:56:07PM +0100, Stefan Hajnoczi wrote: > > > On Thu, Jul 28, 2016 at 02:39:53PM +0900, Namhyung Kim wrote: > > > > On Thu, Jul 28, 2016 at 03:02:54AM +0300, Michael S. Tsirkin wrote: > > > > > On Thu, Jul 28, 2016 at 12:08:30AM +0900, Namhyung Kim wrote: > > > > > > +static ssize_t virtio_pstore_do_write(VirtIOPstore *s, struct > > > > > > iovec *out_sg, > > > > > > + unsigned int out_num, > > > > > > + struct virtio_pstore_req > > > > > > *req) > > > > > > +{ > > > > > > +char path[PATH_MAX]; > > > > > > +int fd; > > > > > > +ssize_t len; > > > > > > +unsigned short type; > > > > > > +int flags = O_WRONLY | O_CREAT; > > > > > > + > > > > > > +/* we already consume the req */ > > > > > > +iov_discard_front(&out_sg, &out_num, sizeof(*req)); > > > > > > + > > > > > > +virtio_pstore_to_filename(s, path, sizeof(path), req); > > > > > > + > > > > > > +type = le16_to_cpu(req->type); > > > > > > + > > > > > > +if (type == VIRTIO_PSTORE_TYPE_DMESG) { > > > > > > +flags |= O_TRUNC; > > > > > > +} else if (type == VIRTIO_PSTORE_TYPE_CONSOLE) { > > > > > > +flags |= O_APPEND; > > > > > > +} > > > > > > + > > > > > > +fd = open(path, flags, 0644); > > > > > > +if (fd < 0) { > > > > > > +error_report("cannot open %s", path); > > > > > > +return -1; > > > > > > +} > > > > > > +len = writev(fd, out_sg, out_num); > > > > > > +close(fd); > > > > > > + > > > > > > +return len; > > > > > > > > > > All this is blocking VM until host io completes. > > > > > > > > Hmm.. I don't know about the internals of qemu. So does it make guest > > > > stop? If so, that's what I want to do for _DMESG. :) As it's called > > > > only on kernel oops I think it's admittable. But for _CONSOLE, it > > > > needs to do asynchronously. Maybe I can add a thread to do the work. > > > > > > Please look at include/io/channel.h. QEMU is event-driven and tends to > > > use asynchronous I/O instead of spawning threads. The include/io/ APIs > > > allow you to do asynchronous I/O in the event loop. > > > > That is true, except for I/O to/from plain files - the QIOChannelFile > > impl doesn't do anything special (yet) to make that work correctly in > > non-blocking mode. Of course that could be fixed... > > Yep, I don't know how I can use the QIOChannelFile for async IO. > AFAICS it's just a wrapper for normal readv/writev. Who is > responsible to do these IO when I use the IO channel API? Also does > it guarantee that all IOs are processed in order? I'd suggest just using QIOChannelFile regardless - we need to fix the blocking behaviour already for sake of the qemu chardev code, and your code just adds more pressure to fix it. I/O will be done in the order in which you make the calls, as with regular POSIX I/O funcs you're currently using. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PULL v2 for-2.7 02/15] qapi: change QmpInputVisitor to QSLIST
On 01/08/2016 11:24, Marc-André Lureau wrote: > Hi > > - Original Message - >> >> >> On 27/07/2016 23:37, Laszlo Ersek wrote: >>> It seems to me that QEMU deadlocks when it tries to emit the >>> SPICE_DISCONNECTED event. >>> >>> (Note that I can't find "handle SPICE_DISCONNECTED" in the libvirtd log >>> even in the successful case (i.e., when QEMU is built at the parent of >>> 3d344c2aabb7).) >>> >>> Apparently audio_atexit() is triggered when QEMU is returning from >>> main() -- or calling exit() --, which somehow results in QEMU trying to >>> send a SPICE_DISCONNECTED event through the monitor? I guess the monitor >>> has been long dead by then. >>> >>> Hmmm, this gives me an idea... What happens if I remove the following >>> fragment from my domain XML? >>> >>> >>> >> function='0x0'/> >>> >>> >>> Yeah, the hang disappears, shutdown works just fine. It's a spice audio >>> bug after all, apparently. Sorry for reporting it in this thread! :) I'm >>> adding Gerd to the address list. >>> >>> To reiterate: this patch (commit 3d344c2aabb7) does *not* cause the >>> symptom, it only exposes an independent bug that causes the symptom. >>> And, I can work around that for now, by removing sound devices. >> >> I think the issue here is that the monitor is gone by the time >> audio_atexit is called. It is caused by commit >> ca24a3358ecd2f17be7c8b117cfe8bc5e5f8. >> >> The fix is to move the audio_atexit call to main before >> qemu_chr_cleanup, but I'm not sure how to deal with coreaudio_atexit. > > alternatively, cleanup the monitor before cleaning up the chardev? I was just > looking at that, see wip patch attached. This patch is a good idea because it avoids a dangling pointer (and avoids touching the mess that is coreaudio_atexit). Paolo
[Qemu-devel] [PATCH v6 1/2] virtio-crypto: Add virtio crypto device specification
The virtio crypto device is a virtual crypto device (ie. hardware crypto accelerator card). The virtio crypto device can provide five crypto services: CIPHER, MAC, HASH, AEAD, KDF, ASYM, PRIMITIVE. In this patch, CIPHER, MAC, HASH, AEAD services are introduced. Signed-off-by: Gonglei CC: Michael S. Tsirkin CC: Cornelia Huck CC: Stefan Hajnoczi CC: Lingli Deng CC: Jani Kokkonen CC: Ola Liljedahl CC: Varun Sethi CC: Zeng Xin CC: Keating Brian CC: Ma Liang J CC: Griffin John CC: Hanweidong --- content.tex | 2 + virtio-crypto.tex | 793 ++ 2 files changed, 795 insertions(+) create mode 100644 virtio-crypto.tex diff --git a/content.tex b/content.tex index 4b45678..ab75f78 100644 --- a/content.tex +++ b/content.tex @@ -5750,6 +5750,8 @@ descriptor for the \field{sense_len}, \field{residual}, \field{status_qualifier}, \field{status}, \field{response} and \field{sense} fields. +\input{virtio-crypto.tex} + \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} Currently there are three device-independent feature bits defined: diff --git a/virtio-crypto.tex b/virtio-crypto.tex new file mode 100644 index 000..9465de3 --- /dev/null +++ b/virtio-crypto.tex @@ -0,0 +1,793 @@ +\section{Crypto Device}\label{sec:Device Types / Crypto Device} + +The virtio crypto device is a virtual crypto device (ie. hardware +crypto accelerator card). The encryption and decryption requests of +are placed in the data queue, and handled by the real hardware crypto +accelerators finally. The second queue is the control queue, which +is used to create or destroy session for symmetric algorithms, and +to control some advanced features in the future. The virtio crypto +device can provide seven crypto services: CIPHER, MAC, HASH, AEAD, +KDF, ASYM, PRIMITIVE. + +\subsection{Device ID}\label{sec:Device Types / Crypto Device / Device ID} + +20 + +\subsection{Virtqueues}\label{sec:Device Types / Crypto Device / Virtqueues} + +\begin{description} +\item[0] dataq1 +\item[\ldots] +\item[N-1] dataqN +\item[N] controlq +\end{description} + +N is set by \field{max_dataqueues} (\field{max_dataqueues} >= 1). + +\subsection{Feature bits}\label{sec:Device Types / Crypto Device / Feature bits} + None currently defined + +\subsection{Device configuration layout}\label{sec:Device Types / Crypto Device / Device configuration layout} + +Thirteen driver-read-only configuration fields are currently defined. + +\begin{lstlisting} +struct virtio_crypto_config { +le32 version; +le16 status; +le16 max_dataqueues; +le32 crypto_services; +/* detailed algorithms mask */ +le32 cipher_algo_l; +le32 cipher_algo_h; +le32 hash_algo; +le32 mac_algo_l; +le32 mac_algo_h; +le32 asym_algo; +le32 kdf_algo; +le32 aead_algo; +le32 primitive_algo; +}; +\end{lstlisting} + +The first driver-read-only field, \field{version} specifies the virtio crypto's +version, which is reserved for back-compatibility in future.It's currently +defined for the version field: + +\begin{lstlisting} +#define VIRTIO_CRYPTO_VERSION_1 (1) +\end{lstlisting} + +One read-only bit (for the device) is currently defined for the \field{status} +field: VIRTIO_CRYPTO_S_HW_READY. + +\begin{lstlisting} +#define VIRTIO_CRYPTO_S_HW_READY (1 << 0) +\end{lstlisting} + +The following driver-read-only field, \field{max_dataqueuess} specifies the +maximum number of data virtqueues (dataq1\ldots dataqN). The crypto_services +shows the crypto services the virtio crypto supports. The service currently +defined are: + +\begin{lstlisting} +#define VIRTIO_CRYPTO_NO_SERVICE (0) /* cipher services */ +#define VIRTIO_CRYPTO_SERVICE_CIPHER (1) /* cipher services */ +#define VIRTIO_CRYPTO_SERVICE_HASH (2) /* hash service */ +#define VIRTIO_CRYPTO_SERVICE_MAC (3) /* MAC (Message Authentication Codes) service */ +#define VIRTIO_CRYPTO_SERVICE_AEAD (4) /* AEAD(Authenticated Encryption with Associated Data) service */ +\end{lstlisting} + +The last driver-read-only fields specify detailed algorithms mask which +the device offered for corresponding service. The below CIPHER algorithms +are defined currently: + +\begin{lstlisting} +#define VIRTIO_CRYPTO_NO_CIPHER 0 +#define VIRTIO_CRYPTO_CIPHER_ARC4 1 +#define VIRTIO_CRYPTO_CIPHER_AES_ECB2 +#define VIRTIO_CRYPTO_CIPHER_AES_CBC3 +#define VIRTIO_CRYPTO_CIPHER_AES_CTR4 +#define VIRTIO_CRYPTO_CIPHER_DES_ECB5 +#define VIRTIO_CRYPTO_CIPHER_DES_CBC6 +#define VIRTIO_CRYPTO_CIPHER_3DES_ECB 7 +#define VIRTIO_CRYPTO_CIPHER_3DES_CBC 8 +#define VIRTIO_CRYPTO_CIPHER_3DES_CTR 9 +#define VIRTIO_CRYPTO_CIPHER_KASUMI_F8 10 +#define VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA211 +#define VIRTIO_CRYPTO_CIPHER_AES_F8 12 +#define VIRTIO_CRYPTO_CIPHER_AES_XTS13 +#define VIRTIO_CRYPTO_CIPHER_ZUC_EEA3
[Qemu-devel] [PATCH] xen: handle inbound migration of VMs without ioreq server pages
VMs created on older versions on Xen will not have been provisioned with pages to support creation of non-default ioreq servers. In this case the ioreq server API is not supported and QEMU's only option is to fall back to using the default ioreq server pages as it did prior to commit 3996e85c ("Xen: Use the ioreq-server API when available"). This patch therefore changes the code in xen_common.h to stop considering a failure of xc_hvm_create_ioreq_server() as a hard failure but simply as an indication that the guest is too old to support the ioreq server API. Instead a boolean is set to cause reversion to old behaviour such that the default ioreq server is then used. Signed-off-by: Paul Durrant Cc: Stefano Stabellini Cc: Anthony Perard --- include/hw/xen/xen_common.h | 123 +++- trace-events| 1 + xen-hvm.c | 6 +-- 3 files changed, 90 insertions(+), 40 deletions(-) diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 640c31e..8707adc 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -107,6 +107,42 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom, #endif +static inline int xen_get_default_ioreq_server_info(xc_interface *xc, domid_t dom, +xen_pfn_t *ioreq_pfn, +xen_pfn_t *bufioreq_pfn, +evtchn_port_t *bufioreq_evtchn) +{ +unsigned long param; +int rc; + +rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m); +if (rc < 0) { +fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n"); +return -1; +} + +*ioreq_pfn = param; + +rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m); +if (rc < 0) { +fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n"); +return -1; +} + +*bufioreq_pfn = param; + +rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN, + ¶m); +if (rc < 0) { +fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n"); +return -1; +} + +*bufioreq_evtchn = param; + +return 0; +} + /* Xen before 4.5 */ #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 450 @@ -154,10 +190,9 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, { } -static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom, - ioservid_t *ioservid) +static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom, + ioservid_t *ioservid) { -return 0; } static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom, @@ -171,35 +206,8 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { -unsigned long param; -int rc; - -rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m); -if (rc < 0) { -fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n"); -return -1; -} - -*ioreq_pfn = param; - -rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m); -if (rc < 0) { -fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n"); -return -1; -} - -*bufioreq_pfn = param; - -rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN, - ¶m); -if (rc < 0) { -fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n"); -return -1; -} - -*bufioreq_evtchn = param; - -return 0; +return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn, bufioreq_pfn, + bufioreq_evtchn); } static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, @@ -212,6 +220,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, /* Xen 4.5 */ #else +static bool use_default_ioreq_server; + static inline void xen_map_memory_section(xc_interface *xc, domid_t dom, ioservid_t ioservid, MemoryRegionSection *section) @@ -220,6 +230,10 @@ static inline void xen_map_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size); hwaddr end_addr = start_addr + size - 1; +if (use_default_ioreq_server) { +return; +} + trace_xen_map_mmio_range(ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 1, start_addr, end_addr); @@ -233,6 +247,11 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size); hwa
Re: [Qemu-devel] [PATCH] xen: handle inbound migration of VMs without ioreq server pages
> -Original Message- > From: Paul Durrant [mailto:paul.durr...@citrix.com] > Sent: 01 August 2016 10:16 > To: xen-de...@lists.xenproject.org; qemu-devel@nongnu.org > Cc: Paul Durrant; Stefano Stabellini; Anthony Perard > Subject: [PATCH] xen: handle inbound migration of VMs without ioreq server > pages > > VMs created on older versions on Xen will not have been provisioned with > pages to support creation of non-default ioreq servers. In this case > the ioreq server API is not supported and QEMU's only option is to fall > back to using the default ioreq server pages as it did prior to > commit 3996e85c ("Xen: Use the ioreq-server API when available"). > > This patch therefore changes the code in xen_common.h to stop considering > a failure of xc_hvm_create_ioreq_server() as a hard failure but simply > as an indication that the guest is too old to support the ioreq server > API. Instead a boolean is set to cause reversion to old behaviour such > that the default ioreq server is then used. > > Signed-off-by: Paul Durrant > Cc: Stefano Stabellini > Cc: Anthony Perard Apologies, this should also be Reported-by: Olaf Hering > --- > include/hw/xen/xen_common.h | 123 > +++- > trace-events| 1 + > xen-hvm.c | 6 +-- > 3 files changed, 90 insertions(+), 40 deletions(-) > > diff --git a/include/hw/xen/xen_common.h > b/include/hw/xen/xen_common.h > index 640c31e..8707adc 100644 > --- a/include/hw/xen/xen_common.h > +++ b/include/hw/xen/xen_common.h > @@ -107,6 +107,42 @@ static inline int > xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom, > > #endif > > +static inline int xen_get_default_ioreq_server_info(xc_interface *xc, > domid_t dom, > +xen_pfn_t *ioreq_pfn, > +xen_pfn_t *bufioreq_pfn, > +evtchn_port_t > *bufioreq_evtchn) > +{ > +unsigned long param; > +int rc; > + > +rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m); > +if (rc < 0) { > +fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n"); > +return -1; > +} > + > +*ioreq_pfn = param; > + > +rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, > ¶m); > +if (rc < 0) { > +fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n"); > +return -1; > +} > + > +*bufioreq_pfn = param; > + > +rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN, > + ¶m); > +if (rc < 0) { > +fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n"); > +return -1; > +} > + > +*bufioreq_evtchn = param; > + > +return 0; > +} > + > /* Xen before 4.5 */ > #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 450 > > @@ -154,10 +190,9 @@ static inline void xen_unmap_pcidev(xc_interface > *xc, domid_t dom, > { > } > > -static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom, > - ioservid_t *ioservid) > +static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom, > + ioservid_t *ioservid) > { > -return 0; > } > > static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom, > @@ -171,35 +206,8 @@ static inline int > xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, > xen_pfn_t *bufioreq_pfn, > evtchn_port_t *bufioreq_evtchn) > { > -unsigned long param; > -int rc; > - > -rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m); > -if (rc < 0) { > -fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n"); > -return -1; > -} > - > -*ioreq_pfn = param; > - > -rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, > ¶m); > -if (rc < 0) { > -fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n"); > -return -1; > -} > - > -*bufioreq_pfn = param; > - > -rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN, > - ¶m); > -if (rc < 0) { > -fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n"); > -return -1; > -} > - > -*bufioreq_evtchn = param; > - > -return 0; > +return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn, > bufioreq_pfn, > + bufioreq_evtchn); > } > > static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, > @@ -212,6 +220,8 @@ static inline int > xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, > /* Xen 4.5 */ > #else > > +static bool use_default_ioreq_server; > + > static inline void xen_map_memory_section(xc_interface *xc, domid_t > dom, >ioservid_t ioservid, >
Re: [Qemu-devel] VM CPU/Disk unexplained increase in resize time
On Fri, 29 Jul 2016 11:30:00 +0100 "Chathura M. Sarathchandra Magurawalage" <77.chath...@gmail.com> wrote: > Hi, > > Does anyone know the reason for, VM resizing time to increase faster if you > continuously increase CPU or DISK resources by +1 (e.g. 1-2, 2-3, 3-4, 4-5). > Whereas, when you increase from 1 to any other (e.g. 1-2, 1-2, 1,3, 1-4, 1-5) > it takes less time in comparison. Can anyone give an explanation for this? I > have plotted two graphs. > > https://www.dropbox.com/s/5e8xrrctu0rcwx3/CPU%20scaling%20%20-%20continuous%20vs%20increasing%20from%201.png?dl=0 > https://www.dropbox.com/s/txpkb8k6mpyexv8/CPU%20scaling%20-%20increase%20from%201.png?dl=0 > > The first graph shows the VM CPU resize time (y axis) vs number of vCPUs (x > axis) of continuous (blue) and resize from a VM with 1 vCPU (green) > scenarios.The second graph shows the VM CPU resize time (y axis) vs number of > vCPUs (x axis), when resized from a VM with 1 vCPU at each step (The green > line in first graph). The error bars show the standard error of the gathered > values at each step, as I did resize multiple times to get a mean value. I > use openstack on x86 with KVM, although I have asked the openstack community > I could not yet find an answer to this. > > Thanks! > QEMU can add CPUs only by one CPU object at a time so from QEMU's point of view time of hotplugging a CPU more or less constant. I'd look farther up the stack for issue. CCing Peter, who might look at it from libvirt perspective.
Re: [Qemu-devel] [PATCH] fw_cfg: Make base type "fw_cfg" abstract
On 29/07/2016 10:08, Laszlo Ersek wrote: > On 07/29/16 09:29, Markus Armbruster wrote: >> Missed when commit 5712db6 split off "fw_cfg_io" and "fw_cfg_mem". >> >> Signed-off-by: Markus Armbruster >> --- >> hw/nvram/fw_cfg.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c >> index 2873030..0ccab2d 100644 >> --- a/hw/nvram/fw_cfg.c >> +++ b/hw/nvram/fw_cfg.c >> @@ -990,6 +990,7 @@ static void fw_cfg_class_init(ObjectClass *klass, void >> *data) >> static const TypeInfo fw_cfg_info = { >> .name = TYPE_FW_CFG, >> .parent= TYPE_SYS_BUS_DEVICE, >> +.abstract = true, >> .instance_size = sizeof(FWCfgState), >> .class_init= fw_cfg_class_init, >> }; >> > > Not sure how consistent we try to be about this: should the equal sign > (in the assignment) line up with the other equal signs? > > Looking for prior art, I ran > > git grep -E 'abstract {2,}= true' > > and it returned 27 hits. > > Functionally the patch is right, of course. And I think the whitespace > can be adjusted without a repost, if we agree it should be adjusted. > > Reviewed-by: Laszlo Ersek Tweaked and queued, thanks to both. Paolo
Re: [Qemu-devel] [PATCH v2] util/qemu-sockets: revert Yoda Conditions to normal
On 29/07/2016 11:20, Daniel P. Berrange wrote: > Reviewed-by: Daniel P. Berrange Queued, thanks for the patch and the review. Paolo
Re: [Qemu-devel] [PATCH] linux-user: Use correct alignment for long long on i386 guests
On 1 August 2016 at 10:04, Riku Voipio wrote: > On Thu, Jul 28, 2016 at 12:57:59PM +0100, Peter Maydell wrote: >> For i386, the ABI specifies that 'long long' (8 byte values) >> need only be 4 aligned, but we were requiring them to be >> 8-aligned. This meant we were laying out the target_epoll_event >> structure wrongly. Add a suitable ifdef to abitypes.h to >> specify the i386-specific alignment requirement. > > Thanks, applied all your patches upto this patch to: > > https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/for-next > > I take none of the patches are important enough to warrant including > in 2.7? I think I would suggest at least these for 2.7: linux-user: Use correct alignment for long long on i386 guests (fixes a real user-reported bug) linux-user: Fix memchr() argument in open_self_cmdline() linux-user: Don't write off end of new_utsname buffer (both buffer overruns that could plausibly happen) linux-user: Fix target_semid_ds structure definition (sysv semaphore completely broken on many guest archs) linux-user: Handle brk() attempts with very large sizes (because I'd like to be able to tell the gcc folks they can just test with QEMU 2.7) with perhaps the rest of the coverity-fixes on the maybe list. thanks -- PMM
Re: [Qemu-devel] [PATCH for-2.7] apic: fix broken migration for kvm-apic
On 29/07/2016 15:55, Igor Mammedov wrote: > commit f6e98444 (apic: Use apic_id as apic's migration instance_id) > breaks migration when in kernel irqchip is used for 2.6 and older > machine types. > > It applies compat property only for userspace 'apic' type > instead of applying it to all apic types inherited from > 'apic-common' type as it was supposed to do. > > Fix it by setting compat property 'legacy-instance-id' for > 'apic-common' type which affects inherited types (i.e. not > only 'apic' but also 'kvm-apic' types) > > Signed-off-by: Igor Mammedov > --- > include/hw/i386/pc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index c87c5c1..74c175c 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -388,7 +388,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t > *); > .value = "off",\ > },\ > {\ > -.driver = "apic",\ > +.driver = "apic-common",\ > .property = "legacy-instance-id",\ > .value= "on",\ > }, > Queued for 2.7, thanks. Paolo
Re: [Qemu-devel] [PATCH RFC] block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support
The original mail didn't appear to hit the list, so I'm avoiding trimming any quoted text for benefit of others. On Sun, Jul 31, 2016 at 06:06:30PM -0700, Ashish Mittal wrote: > This patch adds support for a new block device type called "vxhs". > Source code for the library that this code loads can be downloaded from: > https://github.com/MittalAshish/libqnio.git > > Signed-off-by: Ashish Mittal > --- > block/Makefile.objs |1 + > block/vxhs.c| 1460 > +++ > block/vxhs.h| 355 + > configure | 24 +- > 4 files changed, 1839 insertions(+), 1 deletion(-) > create mode 100644 block/vxhs.c > create mode 100644 block/vxhs.h > > diff --git a/block/Makefile.objs b/block/Makefile.objs > index 2593a2f..8ebda10 100644 > --- a/block/Makefile.objs > +++ b/block/Makefile.objs > @@ -20,6 +20,7 @@ block-obj-$(CONFIG_RBD) += rbd.o > block-obj-$(CONFIG_GLUSTERFS) += gluster.o > block-obj-$(CONFIG_ARCHIPELAGO) += archipelago.o > block-obj-$(CONFIG_LIBSSH2) += ssh.o > +block-obj-$(CONFIG_VXHS) += vxhs.o > block-obj-y += accounting.o dirty-bitmap.o > block-obj-y += write-threshold.o In this file I'd expect to see vxhs.so-cflags := $(VXHS_CFLAGS) vxhs.so-libs := $(VXHS_LIBS) to make QEMU link to the external library you are using > diff --git a/block/vxhs.c b/block/vxhs.c > new file mode 100644 > index 000..2949561 > --- /dev/null > +++ b/block/vxhs.c > @@ -0,0 +1,1460 @@ > +/* > + * QEMU Block driver for Veritas HyperScale (VxHS) > + * > + * This work is licensed under the terms of the GNU GPL, version 2. See > + * the COPYING file in the top-level directory. Use of GPLv2-only is deprecated in QEMU - we generally require new contributions to QEMU to be under the GPLv2-or-later license. > + * > + * Please follow QEMU coding guidelines while modifying this file. > + * The QEMU coding guidelines need to be followed because this driver has > + * to be submitted to QEMU community in near futute and we want to prevent > any > + * reduce the amount of work at that time. > + * QEMU coding guidelines can be found at : > + * > http://git.qemu-project.org/?p=qemu.git;a=blob_plain;f=CODING_STYLE;hb=HEAD THis comment can just be killed - all files submitted to QEMU are expected to comply with coding style, so this comment doesn't add anything. > + */ > + > +#include "vxhs.h" > + > +/* global variables (per-vm) */ > +static QNIOOps qnioops; > +static GModule *lib_qemuqnio_handle; > + > +/* qnio client ioapi_ctx */ > +static void *global_qnio_ctx; > + > +/* insure init once */ > +static pthread_mutex_t of_global_ctx_lock; > + > +/* HyperScale Driver Version */ > +int vxhs_drv_version = 8895; 'static' too. > + > +/* > + * Loading QNIO operation from qemuqnio library at run time. > + * It loads only when first vxhs_open called for a vDisk > + */ > +int vxhs_load_iio_ops(void) > +{ > +int i = 0; > + > +LibQNIOSymbol qnio_symbols[] = { > +{"qemu_iio_init", > +(gpointer *) &qnioops.qemu_iio_init}, > +{"qemu_open_iio_conn", > +(gpointer *) &qnioops.qemu_open_iio_conn}, > +{"qemu_iio_devopen", > +(gpointer *) &qnioops.qemu_iio_devopen}, > +{"qemu_iio_devclose", > +(gpointer *) &qnioops.qemu_iio_devclose}, > +{"qemu_iio_writev", > +(gpointer *) &qnioops.qemu_iio_writev}, > +{"qemu_iio_readv", > +(gpointer *) &qnioops.qemu_iio_readv}, > +{"qemu_iio_read", > +(gpointer *) &qnioops.qemu_iio_read}, > +{"qemu_iio_ioctl", > +(gpointer *) &qnioops.qemu_iio_ioctl}, > +{"qemu_iio_close", > +(gpointer *) &qnioops.qemu_iio_close}, > +{"qemu_iio_extract_msg_error", > +(gpointer *) &qnioops.qemu_iio_extract_msg_error}, > +{"qemu_iio_extract_msg_size", > +(gpointer *) &qnioops.qemu_iio_extract_msg_size}, > +{"qemu_iio_extract_msg_opcode", > +(gpointer *) &qnioops.qemu_iio_extract_msg_opcode}, > +{"qemu_initialize_lock", > +(gpointer *) &qnioops.qemu_initialize_lock}, > +{"qemu_spin_lock", > +(gpointer *) &qnioops.qemu_spin_lock}, > +{"qemu_spin_unlock", > +(gpointer *) &qnioops.qemu_spin_unlock}, > +{"qemu_destroy_lock", > +(gpointer *) &qnioops.qemu_destroy_lock}, > +{NULL} > +}; > + > +if (!g_module_supported()) { > +error_report("modules are not supported on this platform: %s", > + g_module_error()); > +return -EIO; > +} > + > +lib_qemuqnio_handle = g_module_open("libqnioshim.so", 0); > +if (!lib_qemuqnio_handle) { > +error_report("error loading libqnioshim.so: %s", g_module_error()); > +return -EIO; > +} > + > +g_module_make_reside
Re: [Qemu-devel] [PATCH for-2.8] qtail: clean up direct access to tqe_prev field
On 25/07/2016 14:47, Igor Mammedov wrote: > instead of accessing tqe_prev field dircetly outside > of queue.h use macros to check if element is in list > and make sure that afer element is removed from list > tqe_prev field could be used to do the same check. > > Signed-off-by: Igor Mammedov > --- > The patch is split from as cleanup is not urgent > [PATCH 0/6] Fix migration issues with arbitrary cpu-hot(un)plug > and made on top of > [PATCH v2 0/6] Fix migration issues with arbitrary cpu-hot(un)plug > > posting it to list so that it won't be forgotten or lost > and affected people could review it at there leisure time. > > --- > include/qemu/queue.h | 2 ++ > blockdev.c | 2 +- > exec.c | 3 +-- > net/filter.c | 2 +- > 4 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/include/qemu/queue.h b/include/qemu/queue.h > index c2b6c81..342073f 100644 > --- a/include/qemu/queue.h > +++ b/include/qemu/queue.h > @@ -407,6 +407,7 @@ struct { > \ > else\ > (head)->tqh_last = (elm)->field.tqe_prev; \ > *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ > +(elm)->field.tqe_prev = NULL; \ > } while (/*CONSTCOND*/0) > > #define QTAILQ_FOREACH(var, head, field)\ > @@ -430,6 +431,7 @@ struct { > \ > #define QTAILQ_EMPTY(head) ((head)->tqh_first == NULL) > #define QTAILQ_FIRST(head) ((head)->tqh_first) > #define QTAILQ_NEXT(elm, field) ((elm)->field.tqe_next) > +#define QTAILQ_IN_USE(elm, field)((elm)->field.tqe_prev != NULL) > > #define QTAILQ_LAST(head, headname) \ > (*(((struct headname *)((head)->tqh_last))->tqh_last)) > diff --git a/blockdev.c b/blockdev.c > index eafeba9..0b73158 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -4031,7 +4031,7 @@ void qmp_x_blockdev_del(bool has_id, const char *id, > goto out; > } > > -if (!blk && !bs->monitor_list.tqe_prev) { > +if (!blk && !QTAILQ_IN_USE(bs, monitor_list)) { > error_setg(errp, "Node %s is not owned by the monitor", > bs->node_name); > goto out; > diff --git a/exec.c b/exec.c > index 50e3ee2..8e8416b 100644 > --- a/exec.c > +++ b/exec.c > @@ -614,14 +614,13 @@ void cpu_exec_exit(CPUState *cpu) > CPUClass *cc = CPU_GET_CLASS(cpu); > > cpu_list_lock(); > -if (cpu->node.tqe_prev == NULL) { > +if (!QTAILQ_IN_USE(cpu, node)) { > /* there is nothing to undo since cpu_exec_init() hasn't been called > */ > cpu_list_unlock(); > return; > } > > QTAILQ_REMOVE(&cpus, cpu, node); > -cpu->node.tqe_prev = NULL; > cpu->cpu_index = UNASSIGNED_CPU_INDEX; > cpu_list_unlock(); > > diff --git a/net/filter.c b/net/filter.c > index 888fe6d..1dfd2ca 100644 > --- a/net/filter.c > +++ b/net/filter.c > @@ -239,7 +239,7 @@ static void netfilter_finalize(Object *obj) > } > > if (nf->netdev && !QTAILQ_EMPTY(&nf->netdev->filters) && > -nf->next.tqe_prev) { > +QTAILQ_IN_USE(nf, next)) { > QTAILQ_REMOVE(&nf->netdev->filters, nf, next); > } > g_free(nf->netdev_id); > Looks good, thanks! Paolo
Re: [Qemu-devel] [PATCH v2 0/3] Remove the obsolete non-blocking connect
On 28/07/2016 11:03, Cao jin wrote: > forget to cc maintainers in cover-letter.. Patches 1 and 2 look good, thanks! > On 07/28/2016 04:54 PM, Cao jin wrote: >> v2 changelog: >> 1. revert the yoda-condition in patch 2 (Daniel) >> >> Cao jin (3): >>util: remove the obsolete non-blocking connect >>util: fix some coding style issue >>migration/socket: fix typo in file header >> >> include/qemu/sockets.h | 7 +- >> io/channel-socket.c| 2 +- >> migration/socket.c | 4 +- >> net/socket.c | 2 +- >> util/qemu-sockets.c| 179 >> - >> 5 files changed, 33 insertions(+), 161 deletions(-) >> >
[Qemu-devel] [PATCHv3 RESEND] ppc: Rename #include'd .c files to .inc.c
Also while at it, group the #include statements in translate.c Signed-off-by: Benjamin Herrenschmidt --- target-ppc/translate.c | 40 +++--- .../translate/{dfp-impl.c => dfp-impl.inc.c} | 0 target-ppc/translate/{dfp-ops.c => dfp-ops.inc.c} | 0 target-ppc/translate/{fp-impl.c => fp-impl.inc.c} | 0 target-ppc/translate/{fp-ops.c => fp-ops.inc.c}| 0 .../translate/{spe-impl.c => spe-impl.inc.c} | 0 target-ppc/translate/{spe-ops.c => spe-ops.inc.c} | 0 .../translate/{vmx-impl.c => vmx-impl.inc.c} | 0 target-ppc/translate/{vmx-ops.c => vmx-ops.inc.c} | 0 .../translate/{vsx-impl.c => vsx-impl.inc.c} | 0 target-ppc/translate/{vsx-ops.c => vsx-ops.inc.c} | 0 11 files changed, 20 insertions(+), 20 deletions(-) rename target-ppc/translate/{dfp-impl.c => dfp-impl.inc.c} (100%) rename target-ppc/translate/{dfp-ops.c => dfp-ops.inc.c} (100%) rename target-ppc/translate/{fp-impl.c => fp-impl.inc.c} (100%) rename target-ppc/translate/{fp-ops.c => fp-ops.inc.c} (100%) rename target-ppc/translate/{spe-impl.c => spe-impl.inc.c} (100%) rename target-ppc/translate/{spe-ops.c => spe-ops.inc.c} (100%) rename target-ppc/translate/{vmx-impl.c => vmx-impl.inc.c} (100%) rename target-ppc/translate/{vmx-ops.c => vmx-ops.inc.c} (100%) rename target-ppc/translate/{vsx-impl.c => vsx-impl.inc.c} (100%) rename target-ppc/translate/{vsx-ops.c => vsx-ops.inc.c} (100%) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index fc3d371..d1837f8 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -5315,12 +5315,6 @@ static void gen_rfsvc(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -#include "translate/fp-impl.c" - -#include "translate/vmx-impl.c" - -#include "translate/vsx-impl.c" - /* svc is not implemented for now */ /* BookE specific instructions */ @@ -6107,10 +6101,6 @@ static void gen_maddhd_maddhdu(DisasContext *ctx) } #endif /* defined(TARGET_PPC64) */ -#include "translate/dfp-impl.c" - -#include "translate/spe-impl.c" - static void gen_tbegin(DisasContext *ctx) { if (unlikely(!ctx->tm_enabled)) { @@ -6190,6 +6180,16 @@ static inline void gen_##name(DisasContext *ctx) \ GEN_TM_PRIV_NOOP(treclaim); GEN_TM_PRIV_NOOP(trechkpt); +#include "translate/fp-impl.inc.c" + +#include "translate/vmx-impl.inc.c" + +#include "translate/vsx-impl.inc.c" + +#include "translate/dfp-impl.inc.c" + +#include "translate/spe-impl.inc.c" + static opcode_t opcodes[] = { GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0x, PPC_NONE), GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x0040, PPC_INTEGER), @@ -6714,16 +6714,6 @@ GEN_MAC_HANDLER(mulhhwu, 0x08, 0x00), GEN_MAC_HANDLER(mullhw, 0x08, 0x0D), GEN_MAC_HANDLER(mullhwu, 0x08, 0x0C), -#include "translate/fp-ops.c" - -#include "translate/vmx-ops.c" - -#include "translate/vsx-ops.c" - -#include "translate/dfp-ops.c" - -#include "translate/spe-ops.c" - GEN_HANDLER2_E(tbegin, "tbegin", 0x1F, 0x0E, 0x14, 0x01DFF800, \ PPC_NONE, PPC2_TM), GEN_HANDLER2_E(tend, "tend", 0x1F, 0x0E, 0x15, 0x01FFF800, \ @@ -6746,6 +6736,16 @@ GEN_HANDLER2_E(treclaim, "treclaim", 0x1F, 0x0E, 0x1D, 0x03E0F800, \ PPC_NONE, PPC2_TM), GEN_HANDLER2_E(trechkpt, "trechkpt", 0x1F, 0x0E, 0x1F, 0x03FFF800, \ PPC_NONE, PPC2_TM), + +#include "translate/fp-ops.inc.c" + +#include "translate/vmx-ops.inc.c" + +#include "translate/vsx-ops.inc.c" + +#include "translate/dfp-ops.inc.c" + +#include "translate/spe-ops.inc.c" }; #include "helper_regs.h" diff --git a/target-ppc/translate/dfp-impl.c b/target-ppc/translate/dfp-impl.inc.c similarity index 100% rename from target-ppc/translate/dfp-impl.c rename to target-ppc/translate/dfp-impl.inc.c diff --git a/target-ppc/translate/dfp-ops.c b/target-ppc/translate/dfp-ops.inc.c similarity index 100% rename from target-ppc/translate/dfp-ops.c rename to target-ppc/translate/dfp-ops.inc.c diff --git a/target-ppc/translate/fp-impl.c b/target-ppc/translate/fp-impl.inc.c similarity index 100% rename from target-ppc/translate/fp-impl.c rename to target-ppc/translate/fp-impl.inc.c diff --git a/target-ppc/translate/fp-ops.c b/target-ppc/translate/fp-ops.inc.c similarity index 100% rename from target-ppc/translate/fp-ops.c rename to target-ppc/translate/fp-ops.inc.c diff --git a/target-ppc/translate/spe-impl.c b/target-ppc/translate/spe-impl.inc.c similarity index 100% rename from target-ppc/translate/spe-impl.c rename to target-ppc/translate/spe-impl.inc.c diff --git a/target-ppc/translate/spe-ops.c b/target-ppc/translate/spe-ops.inc.c similarity index 100% rename from target-ppc/translate/spe-ops.c rename to target-ppc/translate/spe-ops.inc.c diff --git a/target-ppc/translate/vmx-impl.c b/target-ppc/translate/vmx-impl.inc.c similarity index 100% rename from target-ppc/translate/vmx-impl.c rename to target-ppc/translate/vmx-impl.inc.c diff --git a/target-ppc/translate/vmx-ops.c b/
Re: [Qemu-devel] [PATCH for 2.8 1/3] rules.mak: Don't extract libs from .mo-libs in link command
On 27/07/2016 08:26, Fam Zheng wrote: > For module build, .mo objects are passed to LINK and consumed in > process-archive-undefs. The reason behind that is documented in the > comment above process-archive-undefs. > > Similarly, extract-libs should be called with .mo filtered out too. > Otherwise, the .mo-libs are added to the link command incorrectly, > spoiling the purpose of modularization. > > Currently we don't have any .mo-libs usage, but it will be used soon > when we modularize more multi-source objects, like sdl and gtk. > > Reported-by: Colin Lord > Signed-off-by: Fam Zheng > --- > rules.mak | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/rules.mak b/rules.mak > index ed8e482..80705a7 100644 > --- a/rules.mak > +++ b/rules.mak > @@ -50,7 +50,7 @@ process-archive-undefs = $(filter-out %.a %.mo,$1) \ >$(call undefined-symbols,$(filter %.mo,$1 \ > $(filter %.a,$1) > > -extract-libs = $(strip $(foreach o,$1,$($o-libs))) > +extract-libs = $(strip $(foreach o,$(filter-out %.mo,$1),$($o-libs))) > expand-objs = $(strip $(sort $(filter %.o,$1)) \ >$(foreach o,$(filter %.mo,$1),$($o-objs)) \ >$(filter-out %.o %.mo,$1)) > Acked-by: Paolo Bonzini Paolo
Re: [Qemu-devel] [PATCH for 2.8 3/3] sdl: Modularize
On 27/07/2016 08:26, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > Makefile.objs | 1 + > configure | 4 +-- > include/qemu/module.h | 2 ++ > include/ui/console.h | 5 ++-- > ui/Makefile.objs | 2 ++ > ui/sdl-init.c | 75 > +++ > ui/sdl.c | 19 ++--- > ui/sdl2.c | 26 ++ > util/module.c | 6 + > vl.c | 5 +++- > 10 files changed, 111 insertions(+), 34 deletions(-) > create mode 100644 ui/sdl-init.c > > diff --git a/Makefile.objs b/Makefile.objs > index 6d5ddcf..08c5746 100644 > --- a/Makefile.objs > +++ b/Makefile.objs > @@ -62,6 +62,7 @@ common-obj-y += accel.o > common-obj-y += replay/ > > common-obj-y += ui/ > +common-obj-m += ui/ > common-obj-y += bt-host.o bt-vhci.o > bt-host.o-cflags := $(BLUEZ_CFLAGS) > > diff --git a/configure b/configure > index e04e59f..1b9be8f 100755 > --- a/configure > +++ b/configure > @@ -2533,7 +2533,6 @@ EOF > sdl_cflags="$sdl_cflags $x11_cflags" > sdl_libs="$sdl_libs $x11_libs" >fi > - libs_softmmu="$sdl_libs $libs_softmmu" > fi > > ## > @@ -5065,9 +5064,10 @@ if test "$modules" = "yes"; then >echo "CONFIG_MODULES=y" >> $config_host_mak > fi > if test "$sdl" = "yes" ; then > - echo "CONFIG_SDL=y" >> $config_host_mak > + echo "CONFIG_SDL=m" >> $config_host_mak >echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak >echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak > + echo "SDL_LIBS=$sdl_libs" >> $config_host_mak > fi > if test "$sdlabi" = "2.0"; then >echo "CONFIG_SDL2=y" >> $config_host_mak > diff --git a/include/qemu/module.h b/include/qemu/module.h > index 2370708..f5e012b 100644 > --- a/include/qemu/module.h > +++ b/include/qemu/module.h > @@ -44,6 +44,7 @@ typedef enum { > MODULE_INIT_OPTS, > MODULE_INIT_QAPI, > MODULE_INIT_QOM, > +MODULE_INIT_SDL, > MODULE_INIT_MAX > } module_init_type; > > @@ -51,6 +52,7 @@ typedef enum { > #define opts_init(function) module_init(function, MODULE_INIT_OPTS) > #define qapi_init(function) module_init(function, MODULE_INIT_QAPI) > #define type_init(function) module_init(function, MODULE_INIT_QOM) > +#define sdl_init(function) module_init(function, MODULE_INIT_SDL) > > void register_module_init(void (*fn)(void), module_init_type type); > void register_dso_module_init(void (*fn)(void), module_init_type type); > diff --git a/include/ui/console.h b/include/ui/console.h > index 2703a3a..1d9b0bb 100644 > --- a/include/ui/console.h > +++ b/include/ui/console.h > @@ -425,10 +425,11 @@ void surface_gl_setup_viewport(ConsoleGLState *gls, > > /* sdl.c */ > #ifdef CONFIG_SDL > -void sdl_display_early_init(int opengl); > +bool sdl_display_early_init(int opengl); > void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); > +void sdl_register_init_fun(void *fn); > #else > -static inline void sdl_display_early_init(int opengl) > +static inline bool sdl_display_early_init(int opengl) > { > /* This must never be called if CONFIG_SDL is disabled */ > error_report("SDL support is disabled"); > diff --git a/ui/Makefile.objs b/ui/Makefile.objs > index dc936f1..0b82650 100644 > --- a/ui/Makefile.objs > +++ b/ui/Makefile.objs > @@ -26,7 +26,9 @@ ifeq ($(CONFIG_OPENGL),y) > sdl.mo-objs += sdl2-gl.o > endif > endif > +common-obj-y += sdl-init.o > sdl.mo-cflags := $(SDL_CFLAGS) > +sdl.mo-libs := $(SDL_LIBS) > > ifeq ($(CONFIG_OPENGL),y) > common-obj-y += shader.o > diff --git a/ui/sdl-init.c b/ui/sdl-init.c > new file mode 100644 > index 000..6a780a4 > --- /dev/null > +++ b/ui/sdl-init.c > @@ -0,0 +1,75 @@ > +/* > + * QEMU SDL display driver init function > + * > + * Copyright (c) 2003 Fabrice Bellard > + * Copyright (c) 2016 Red Hat, Inc. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > copy > + * of this software and associated documentation files (the "Software"), to > deal > + * in the Software without restriction, including without limitation the > rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH
Re: [Qemu-devel] [PATCH for 2.8 3/3] sdl: Modularize
On 28/07/2016 07:17, Fam Zheng wrote: > On Wed, 07/27 19:23, Colin Lord wrote: >> On 07/27/2016 02:26 AM, Fam Zheng wrote: >>> Signed-off-by: Fam Zheng >>> --- >>> Makefile.objs | 1 + >>> configure | 4 +-- >>> include/qemu/module.h | 2 ++ >>> include/ui/console.h | 5 ++-- >>> ui/Makefile.objs | 2 ++ >>> ui/sdl-init.c | 75 >>> +++ >>> ui/sdl.c | 19 ++--- >>> ui/sdl2.c | 26 ++ >>> util/module.c | 6 + >>> vl.c | 5 +++- >>> 10 files changed, 111 insertions(+), 34 deletions(-) >>> create mode 100644 ui/sdl-init.c >>> >>> diff --git a/Makefile.objs b/Makefile.objs >>> index 6d5ddcf..08c5746 100644 >>> --- a/Makefile.objs >>> +++ b/Makefile.objs >>> @@ -62,6 +62,7 @@ common-obj-y += accel.o >>> common-obj-y += replay/ >>> >>> common-obj-y += ui/ >>> +common-obj-m += ui/ >>> common-obj-y += bt-host.o bt-vhci.o >>> bt-host.o-cflags := $(BLUEZ_CFLAGS) >>> >>> diff --git a/configure b/configure >>> index e04e59f..1b9be8f 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -2533,7 +2533,6 @@ EOF >>> sdl_cflags="$sdl_cflags $x11_cflags" >>> sdl_libs="$sdl_libs $x11_libs" >>>fi >>> - libs_softmmu="$sdl_libs $libs_softmmu" >>> fi >>> >>> ## >>> @@ -5065,9 +5064,10 @@ if test "$modules" = "yes"; then >>>echo "CONFIG_MODULES=y" >> $config_host_mak >>> fi >>> if test "$sdl" = "yes" ; then >>> - echo "CONFIG_SDL=y" >> $config_host_mak >>> + echo "CONFIG_SDL=m" >> $config_host_mak >>>echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak >>>echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak >>> + echo "SDL_LIBS=$sdl_libs" >> $config_host_mak >>> fi >>> if test "$sdlabi" = "2.0"; then >>>echo "CONFIG_SDL2=y" >> $config_host_mak >>> diff --git a/include/qemu/module.h b/include/qemu/module.h >>> index 2370708..f5e012b 100644 >>> --- a/include/qemu/module.h >>> +++ b/include/qemu/module.h >>> @@ -44,6 +44,7 @@ typedef enum { >>> MODULE_INIT_OPTS, >>> MODULE_INIT_QAPI, >>> MODULE_INIT_QOM, >>> +MODULE_INIT_SDL, >>> MODULE_INIT_MAX >>> } module_init_type; >>> >>> @@ -51,6 +52,7 @@ typedef enum { >>> #define opts_init(function) module_init(function, MODULE_INIT_OPTS) >>> #define qapi_init(function) module_init(function, MODULE_INIT_QAPI) >>> #define type_init(function) module_init(function, MODULE_INIT_QOM) >>> +#define sdl_init(function) module_init(function, MODULE_INIT_SDL) >>> >>> void register_module_init(void (*fn)(void), module_init_type type); >>> void register_dso_module_init(void (*fn)(void), module_init_type type); >>> diff --git a/include/ui/console.h b/include/ui/console.h >>> index 2703a3a..1d9b0bb 100644 >>> --- a/include/ui/console.h >>> +++ b/include/ui/console.h >>> @@ -425,10 +425,11 @@ void surface_gl_setup_viewport(ConsoleGLState *gls, >>> >>> /* sdl.c */ >>> #ifdef CONFIG_SDL >>> -void sdl_display_early_init(int opengl); >>> +bool sdl_display_early_init(int opengl); >>> void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); >>> +void sdl_register_init_fun(void *fn); >>> #else >>> -static inline void sdl_display_early_init(int opengl) >>> +static inline bool sdl_display_early_init(int opengl) >>> { >>> /* This must never be called if CONFIG_SDL is disabled */ >>> error_report("SDL support is disabled"); >>> diff --git a/ui/Makefile.objs b/ui/Makefile.objs >>> index dc936f1..0b82650 100644 >>> --- a/ui/Makefile.objs >>> +++ b/ui/Makefile.objs >>> @@ -26,7 +26,9 @@ ifeq ($(CONFIG_OPENGL),y) >>> sdl.mo-objs += sdl2-gl.o >>> endif >>> endif >>> +common-obj-y += sdl-init.o >>> sdl.mo-cflags := $(SDL_CFLAGS) >>> +sdl.mo-libs := $(SDL_LIBS) >>> >>> ifeq ($(CONFIG_OPENGL),y) >>> common-obj-y += shader.o >>> diff --git a/ui/sdl-init.c b/ui/sdl-init.c >>> new file mode 100644 >>> index 000..6a780a4 >>> --- /dev/null >>> +++ b/ui/sdl-init.c >>> @@ -0,0 +1,75 @@ >>> +/* >>> + * QEMU SDL display driver init function >>> + * >>> + * Copyright (c) 2003 Fabrice Bellard >>> + * Copyright (c) 2016 Red Hat, Inc. >>> + * >>> + * Permission is hereby granted, free of charge, to any person obtaining a >>> copy >>> + * of this software and associated documentation files (the "Software"), >>> to deal >>> + * in the Software without restriction, including without limitation the >>> rights >>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or >>> sell >>> + * copies of the Software, and to permit persons to whom the Software is >>> + * furnished to do so, subject to the following conditions: >>> + * >>> + * The above copyright notice and this permission notice shall be included >>> in >>> + * all copies or substantial portions of the Software. >>> + * >>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >>> OR >>> + * IMPLIED, INCLUDING BUT
Re: [Qemu-devel] [PATCH v2] x86: ioapic: conditionally upgrade IOAPIC version
On 26/07/2016 05:28, Peter Xu wrote: > IOMMU IR and IOAPIC legacy devices (e.g., e1000) cannot work well > together with some old Linux kernels (upstream before v4.0, or any > released RHEL kernels). This patch fixes it. > > The problem is that: some old linux kernels (with IR enabled) only > support IOAPIC chips with version 0x20. New kernels after commit d32932d > ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") > fixed this problem. To make sure we can work with even old kernels, > let's upgrade our IOAPIC to version 0x20. > > To make sure we have minimum impact on old systems, IOAPIC version is > only boosted to 0x20 when vIOMMU IR is enabled. Besides that, the old > version 0x11 is used. I'd rather do this conditional only on the machine type, but as you pointed out it's a bit late to change the default in QEMU 2.7. Therefore, for 2.7 you could add a property to the IOAPIC device, and document that you need "-global ioapic.version=0x20" for interrupt remapping to work with Linux <= 4.0. QEMU 2.8 can then flip the default for the new machine types. Thanks, Paolo > Signed-off-by: Peter Xu > --- > hw/intc/ioapic.c | 25 - > include/hw/i386/ioapic_internal.h | 3 +-- > 2 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c > index 2d3282a..cd3f283 100644 > --- a/hw/intc/ioapic.c > +++ b/hw/intc/ioapic.c > @@ -244,6 +244,23 @@ void ioapic_dump_state(Monitor *mon, const QDict *qdict) > } > } > > +static uint32_t ioapic_get_version(void) > +{ > +X86IOMMUState *iommu = x86_iommu_get_default(); > + > +/* > + * If we enabled vIOMMU IR, we provide a upgraded version of > + * IOAPIC 0x20, which support explicit EOI request from guest. > + * This fixes a bug that IR not working on some old upstream > + * kernels (before v4.0, commit d32932d) or most RHEL ones. > + */ > +if (iommu && iommu->intr_supported) { > +return 0x20; > +} > + > +return 0x11; > +} > + > static uint64_t > ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size) > { > @@ -265,7 +282,7 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int > size) > val = s->id << IOAPIC_ID_SHIFT; > break; > case IOAPIC_REG_VER: > -val = IOAPIC_VERSION | > +val = ioapic_get_version() | > ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); > break; > default: > @@ -354,6 +371,12 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, > } > } > break; > +case IOAPIC_EOI: > +if (size != 4 || ioapic_get_version() != 0x20) { > +break; > +} > +ioapic_eoi_broadcast(val); > +break; > } > > ioapic_update_kvm_routes(s); > diff --git a/include/hw/i386/ioapic_internal.h > b/include/hw/i386/ioapic_internal.h > index d89ea1b..6f266c3 100644 > --- a/include/hw/i386/ioapic_internal.h > +++ b/include/hw/i386/ioapic_internal.h > @@ -29,8 +29,6 @@ > > #define MAX_IOAPICS 1 > > -#define IOAPIC_VERSION 0x11 > - > #define IOAPIC_LVT_DEST_SHIFT 56 > #define IOAPIC_LVT_DEST_IDX_SHIFT 48 > #define IOAPIC_LVT_MASKED_SHIFT 16 > @@ -71,6 +69,7 @@ > > #define IOAPIC_IOREGSEL 0x00 > #define IOAPIC_IOWIN0x10 > +#define IOAPIC_EOI 0x40 > > #define IOAPIC_REG_ID 0x00 > #define IOAPIC_REG_VER 0x01 >
Re: [Qemu-devel] [PATCH for 2.8 3/3] sdl: Modularize
On Wed, Jul 27, 2016 at 02:26:17PM +0800, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > Makefile.objs | 1 + > configure | 4 +-- > include/qemu/module.h | 2 ++ > include/ui/console.h | 5 ++-- > ui/Makefile.objs | 2 ++ > ui/sdl-init.c | 75 > +++ > ui/sdl.c | 19 ++--- > ui/sdl2.c | 26 ++ > util/module.c | 6 + > vl.c | 5 +++- > 10 files changed, 111 insertions(+), 34 deletions(-) > create mode 100644 ui/sdl-init.c [snip] > diff --git a/vl.c b/vl.c > index a455947..fdbbe47 100644 > --- a/vl.c > +++ b/vl.c > @@ -4221,7 +4221,10 @@ int main(int argc, char **argv, char **envp) > } > > if (display_type == DT_SDL) { > -sdl_display_early_init(request_opengl); > +if (!sdl_display_early_init(request_opengl)) { > +error_report("Failed to initialize SDL"); > +exit(1); > +} > } SDL has some nasty stuff where it tries to replace main() with a call to SDL_main on certain platforms. Merely #include'ing SDL.h in vl.c causes this to happen on Win32 at least, perhaps other platforms too. I'm unclear if your modularization here will apply to all platforms or just Linux - g_module at least can work on Win32. Anyway, to fully support modularization without nasty surprises, we probably want to stop this main() replacement. I sent a patch for that last year https://lists.nongnu.org/archive/html/qemu-devel/2015-08/msg01631.html Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [QEMU v2 1/9] virtio-balloon: Remove needless precompiled directive
* Liang Li (liang.z...@intel.com) wrote: > Since there in wrapper around madvise(), the virtio-balloon > code is able to work without the precompiled directive, the > directive can be removed. > > Signed-off-by: Liang Li > Suggested-by: Thomas Huth This one could be posted separately. Reviewed-by: Dr. David Alan Gilbert > --- > hw/virtio/virtio-balloon.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c > index 1a22e6d..62931b3 100644 > --- a/hw/virtio/virtio-balloon.c > +++ b/hw/virtio/virtio-balloon.c > @@ -34,13 +34,11 @@ > > static void balloon_page(void *addr, int deflate) > { > -#if defined(__linux__) > if (!qemu_balloon_is_inhibited() && (!kvm_enabled() || > kvm_has_sync_mmu())) { > qemu_madvise(addr, BALLOON_PAGE_SIZE, > deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED); > } > -#endif > } > > static const char *balloon_stat_names[] = { > -- > 1.9.1 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
Re: [Qemu-devel] R: [PATCH v2] Unbreak FreeBSD build after optionrom update.
On 26/07/2016 23:07, Sean Bruno wrote: > > Thanks for the pointer to the right fix. Confirmed that your changes > DTRT for FreeBSD. > > I still need the LD_EMULATION addition, which I have sent to the list as > a separate patch for review. Great, thanks! Paolo
Re: [Qemu-devel] [PATCH 1/1] ehci: faster frame index calculation for skipped frames
On 07/27/2016 06:55 PM, Denis V. Lunev wrote: From: Evgeny Yakovlev ehci_update_frindex takes time linearly proportional to a number of uframes to calculate new frame index and raise FLR interrupts, which is a problem for large amounts of uframes. If we experience large delays between echi timer callbacks (i.e. because other periodic handlers have taken a lot of time to complete) we get a lot of skipped frames which then delay ehci timer callback more and this leads to deadlocking the system when ehci schedules next callback to be too soon. Observable behaviour is qemu consuming 100% host CPU time while guest is unresponsive. This misbehavior could happen for a while and QEMU does not get out from this state automatically without the patch. This change makes ehci_update_frindex execute in constant time. Signed-off-by: Evgeny Yakovlev Signed-off-by: Denis V. Lunev CC: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 43a8f7a..b093db7 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2206,29 +2206,28 @@ static void ehci_advance_periodic_state(EHCIState *ehci) static void ehci_update_frindex(EHCIState *ehci, int uframes) { -int i; - if (!ehci_enabled(ehci) && ehci->pstate == EST_INACTIVE) { return; } -for (i = 0; i < uframes; i++) { -ehci->frindex++; - -if (ehci->frindex == 0x2000) { -ehci_raise_irq(ehci, USBSTS_FLR); -} +/* Generate FLR interrupt if frame index rolls over 0x2000 */ +if ((ehci->frindex % 0x2000) + uframes >= 0x2000) { +ehci_raise_irq(ehci, USBSTS_FLR); +} -if (ehci->frindex == 0x4000) { -ehci_raise_irq(ehci, USBSTS_FLR); -ehci->frindex = 0; -if (ehci->usbsts_frindex >= 0x4000) { -ehci->usbsts_frindex -= 0x4000; -} else { -ehci->usbsts_frindex = 0; -} +/* How many times will frindex roll over 0x4000 with this frame count? + * usbsts_frindex is decremented by 0x4000 on rollover until it reaches 0 + */ +int rollovers = (ehci->frindex + uframes) / 0x4000; +if (rollovers > 0) { +if (ehci->usbsts_frindex >= (rollovers * 0x4000)) { +ehci->usbsts_frindex -= 0x4000 * rollovers; +} else { +ehci->usbsts_frindex = 0; } } + +ehci->frindex = (ehci->frindex + uframes) % 0x4000; } static void ehci_frame_timer(void *opaque) ping
Re: [Qemu-devel] [PATCH for 2.8?] x86: ioapic: ignore level irq during processing
On 31/07/2016 16:18, Peter Xu wrote: > For level triggered interrupts, we will get Remote IRR bit cleared after > guest kernel finished processing specific request. Before that, we > should ignore the same interrupt from triggering again. > > Signed-off-by: Peter Xu > --- > > I discovered this during debugging some IR issues. Only did very > minimum test with e1000, but IIUC this should be the correct behavior > for level triggered interrupts, and before that we might be sending > some extra interrupts to guest (while we should not). > > hw/intc/ioapic.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c > index 2d3282a..350f761 100644 > --- a/hw/intc/ioapic.c > +++ b/hw/intc/ioapic.c > @@ -129,9 +129,15 @@ static void ioapic_service(IOAPICCommonState *s) > } > continue; > } > -#else > -(void)coalesce; > #endif > + > +if (coalesce) { > +/* We are level triggered interrupts, and the > + * guest should be still working on previous one, > + * so skip it. */ > +continue; > +} > + > /* No matter whether IR is enabled, we translate > * the IOAPIC message into a MSI one, and its > * address space will decide whether we need a > The patch is okay for 2.7, as it matches what is done in the KVM split-irqchip case. Paolo
[Qemu-devel] KVM call for agenda for 2016-08-02
Hi Please, send any topic that you are interested in covering. At the end of Monday I will send an email with the agenda or the cancellation of the call, so hurry up. After discussions on the QEMU Summit, we are going to have always open a KVM call where you can add topics. Call details: By popular demand, a google calendar public entry with it https://www.google.com/calendar/embed?src=dG9iMXRqcXAzN3Y4ZXZwNzRoMHE4a3BqcXNAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ (Let me know if you have any problems with the calendar entry. I just gave up about getting right at the same time CEST, CET, EDT and DST). If you need phone number details, contact me privately Thanks, Juan.
[Qemu-devel] [PATCH for-2.7 0/2] Fix spice audio crash regression
From: Marc-André Lureau Hi, The monitor is being used atexit, during spice audio clean up, and this leads to a crash since the chardev are now being cleaned up at the end of main, before atexit handlers. Fix the crash by cleaning up the monitor when leaving, and restore the original event behaviour when leaving by cleaning up audio before that. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1355704 Marc-André Lureau (2): monitor: fix crash when leaving qemu with spice audio audio: clean up before monitor clean up monitor.c | 20 audio/audio.c | 26 ++ audio/audio.h | 3 +++ audio/coreaudio.c | 12 ++-- include/monitor/monitor.h | 1 + vl.c | 2 ++ 6 files changed, 46 insertions(+), 18 deletions(-) -- 2.9.0
[Qemu-devel] [PATCH for-2.7 2/2] audio: clean up before monitor clean up
From: Marc-André Lureau Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu, before the atexit() handlers. audio_cleanup() may use the monitor to notify of changes. For compatibility reasons, let's clean up audio before the monitor so it keeps emitting monitor events. The audio_atexit() function is made idempotent (so it can be called multiple times), and renamed to audio_cleanup(). Since coreaudio backend is using a 'isAtexit' code path, change it to check audio_is_cleaning_up() instead, so the path is taken during normal exit. Signed-off-by: Marc-André Lureau --- audio/audio.c | 26 ++ audio/audio.h | 3 +++ audio/coreaudio.c | 12 ++-- vl.c | 1 + 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 9d4dcc7..c845a44 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1739,13 +1739,21 @@ static void audio_vm_change_state_handler (void *opaque, int running, audio_reset_timer (s); } -static void audio_atexit (void) +static bool is_cleaning_up; + +bool audio_is_cleaning_up(void) +{ +return is_cleaning_up; +} + +void audio_cleanup(void) { AudioState *s = &glob_audio_state; -HWVoiceOut *hwo = NULL; -HWVoiceIn *hwi = NULL; +HWVoiceOut *hwo, *hwon; +HWVoiceIn *hwi, *hwin; -while ((hwo = audio_pcm_hw_find_any_out (hwo))) { +is_cleaning_up = true; +QLIST_FOREACH_SAFE(hwo, &glob_audio_state.hw_head_out, entries, hwon) { SWVoiceCap *sc; if (hwo->enabled) { @@ -1761,17 +1769,20 @@ static void audio_atexit (void) cb->ops.destroy (cb->opaque); } } +QLIST_REMOVE(hwo, entries); } -while ((hwi = audio_pcm_hw_find_any_in (hwi))) { +QLIST_FOREACH_SAFE(hwi, &glob_audio_state.hw_head_in, entries, hwin) { if (hwi->enabled) { hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); } hwi->pcm_ops->fini_in (hwi); +QLIST_REMOVE(hwi, entries); } if (s->drv) { s->drv->fini (s->drv_opaque); +s->drv = NULL; } } @@ -1799,7 +1810,7 @@ static void audio_init (void) QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); -atexit (audio_atexit); +atexit(audio_cleanup); s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); @@ -1966,8 +1977,7 @@ CaptureVoiceOut *AUD_add_capture ( QLIST_INSERT_HEAD (&s->cap_head, cap, entries); QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); -hw = NULL; -while ((hw = audio_pcm_hw_find_any_out (hw))) { +QLIST_FOREACH(hw, &glob_audio_state.hw_head_out, entries) { audio_attach_capture (hw); } return cap; diff --git a/audio/audio.h b/audio/audio.h index 11e56c9..c3c5198 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -163,4 +163,7 @@ static inline void *advance (void *p, int incr) int wav_start_capture (CaptureState *s, const char *path, int freq, int bits, int nchannels); +bool audio_is_cleaning_up(void); +void audio_cleanup(void); + #endif /* QEMU_AUDIO_H */ diff --git a/audio/coreaudio.c b/audio/coreaudio.c index d4ad224..c751420 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -36,8 +36,6 @@ #define MAC_OS_X_VERSION_10_6 1060 #endif -static int isAtexit; - typedef struct { int buffer_frames; int nbuffers; @@ -378,11 +376,6 @@ static inline UInt32 isPlaying (AudioDeviceID outputDeviceID) return result; } -static void coreaudio_atexit (void) -{ -isAtexit = 1; -} - static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name) { int err; @@ -630,7 +623,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw) int err; coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; -if (!isAtexit) { +if (!audio_is_cleaning_up()) { /* stop playback */ if (isPlaying(core->outputDeviceID)) { status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); @@ -673,7 +666,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...) case VOICE_DISABLE: /* stop playback */ -if (!isAtexit) { +if (!audio_is_cleaning_up()) { if (isPlaying(core->outputDeviceID)) { status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); @@ -697,7 +690,6 @@ static void *coreaudio_audio_init (void) CoreaudioConf *conf = g_malloc(sizeof(CoreaudioConf)); *conf = glob_conf; -atexit(coreaudio_atexit); return conf; } diff --git a/vl.c b/vl.c index a14c438..c4eeaff 100644 --- a/vl.c +++ b/vl.c @@ -4612,6 +4612,7 @@ int main(int argc, char **argv, char **envp) /* vhost-user must be cleaned up before chardevs. */ net_cleanup(); +audio_cleanup(); monitor_cleanup(); qemu_chr_cleanup(); -- 2.9.0
Re: [Qemu-devel] [QEMU v2 7/9] bitmap: Add a new bitmap_move function
* Liang Li (liang.z...@intel.com) wrote: > Sometimes, it is need to move a portion of bitmap to another place > in a large bitmap, if overlap happens, the bitmap_copy can't not > work correctly, we need a new function to do this work. > > Signed-off-by: Liang Li Reviewed-by: Dr. David Alan Gilbert > --- > include/qemu/bitmap.h | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h > index ec5146f..6ac89ca 100644 > --- a/include/qemu/bitmap.h > +++ b/include/qemu/bitmap.h > @@ -37,6 +37,7 @@ > * bitmap_set(dst, pos, nbits) Set specified bit area > * bitmap_set_atomic(dst, pos, nbits) Set specified bit area with atomic > ops > * bitmap_clear(dst, pos, nbits) Clear specified bit area > + * bitmap_move(dst, src, nbits) Move *src to *dst > * bitmap_test_and_clear_atomic(dst, pos, nbits)Test and clear area > * bitmap_find_next_zero_area(buf, len, pos, n, mask)Find bit free > area > */ > @@ -136,6 +137,18 @@ static inline void bitmap_copy(unsigned long *dst, const > unsigned long *src, > } > } > > +static inline void bitmap_move(unsigned long *dst, const unsigned long *src, > + long nbits) > +{ > +if (small_nbits(nbits)) { > +unsigned long tmp = *src; > +*dst = tmp; > +} else { > +long len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); > +memmove(dst, src, len); > +} > +} > + > static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, > const unsigned long *src2, long nbits) > { > -- > 1.9.1 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
[Qemu-devel] [PATCH for-2.7 1/2] monitor: fix crash when leaving qemu with spice audio
From: Marc-André Lureau Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu. However, the monitor has still references to them, which may lead to crashes when running atexit() and trying to send monitor events: #0 0x7fffdb18f6f5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 #1 0x7fffdb1912fa in __GI_abort () at abort.c:89 #2 0x55c263e7 in error_exit (err=22, msg=0x55d47980 <__func__.13537> "qemu_mutex_lock") at util/qemu-thread-posix.c:39 #3 0x55c26488 in qemu_mutex_lock (mutex=0x567a2420) at util/qemu-thread-posix.c:66 #4 0x558c52db in qemu_chr_fe_write (s=0x567a2420, buf=0x5740dc40 "{\"timestamp\": {\"seconds\": 1470041716, \"microseconds\": 989699}, \"event\": \"SPICE_DISCONNECTED\", \"data\": {\"server\": {\"port\": \"5900\", \"family\": \"ipv4\", \"host\": \"127.0.0.1\"}, \"client\": {\"port\": \"40272\", \"f"..., len=240) at qemu-char.c:280 #5 0x55787cad in monitor_flush_locked (mon=0x567bd9e0) at /home/elmarco/src/qemu/monitor.c:311 #6 0x55787e46 in monitor_puts (mon=0x567bd9e0, str=0x567a44ef "") at /home/elmarco/src/qemu/monitor.c:353 #7 0x557880fe in monitor_json_emitter (mon=0x567bd9e0, data=0x567c73a0) at /home/elmarco/src/qemu/monitor.c:401 #8 0x557882d2 in monitor_qapi_event_emit (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x567c73a0) at /home/elmarco/src/qemu/monitor.c:472 #9 0x5578838f in monitor_qapi_event_queue (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x567c73a0, errp=0x7fffca88) at /home/elmarco/src/qemu/monitor.c:497 #10 0x55c15541 in qapi_event_send_spice_disconnected (server=0x571139d0, client=0x570d0db0, errp=0x566c0428 ) at qapi-event.c:1038 #11 0x55b11bc6 in channel_event (event=3, info=0x570d6c00) at ui/spice-core.c:248 #12 0x7fffdcc9983a in adapter_channel_event (event=3, info=0x570d6c00) at reds.c:120 #13 0x7fffdcc99a25 in reds_handle_channel_event (reds=0x567a9d60, event=3, info=0x570d6c00) at reds.c:324 #14 0x7fffdcc7d4c4 in main_dispatcher_self_handle_channel_event (self=0x567b28b0, event=3, info=0x570d6c00) at main-dispatcher.c:175 #15 0x7fffdcc7d5b1 in main_dispatcher_channel_event (self=0x567b28b0, event=3, info=0x570d6c00) at main-dispatcher.c:194 #16 0x7fffdcca7674 in reds_stream_push_channel_event (s=0x570d9910, event=3) at reds-stream.c:354 #17 0x7fffdcca749b in reds_stream_free (s=0x570d9910) at reds-stream.c:323 #18 0x7fffdccb5dad in snd_disconnect_channel (channel=0x576a89a0) at sound.c:229 #19 0x7fffdccb9e57 in snd_detach_common (worker=0x57739720) at sound.c:1589 #20 0x7fffdccb9f0e in snd_detach_playback (sin=0x569fe3f8) at sound.c:1602 #21 0x7fffdcca3373 in spice_server_remove_interface (sin=0x569fe3f8) at reds.c:3387 #22 0x558ff6e2 in line_out_fini (hw=0x569fe370) at audio/spiceaudio.c:152 #23 0x558f909e in audio_atexit () at audio/audio.c:1754 #24 0x7fffdb1941e8 in __run_exit_handlers (status=0, listp=0x7fffdb5175d8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82 #25 0x7fffdb194235 in __GI_exit (status=) at exit.c:104 #26 0x7fffdb17b738 in __libc_start_main (main=0x558d7874 , argc=67, argv=0x7fffcf48, init=, fini=, rtld_fini=, stack_end=0x7fffcf38) at ../csu/libc-start.c:323 Add a monitor_cleanup() functions to remove all the monitors before cleaning up the chardev. Note that we are "losing" some events that used to be sent during atexit(). Signed-off-by: Marc-André Lureau --- monitor.c | 20 include/monitor/monitor.h | 1 + vl.c | 1 + 3 files changed, 22 insertions(+) diff --git a/monitor.c b/monitor.c index 5d68a5d..5c00373 100644 --- a/monitor.c +++ b/monitor.c @@ -635,6 +635,13 @@ static void monitor_data_init(Monitor *mon) static void monitor_data_destroy(Monitor *mon) { +if (mon->chr) { +qemu_chr_add_handlers(mon->chr, NULL, NULL, NULL, NULL); +} +if (monitor_is_qmp(mon)) { +json_message_parser_destroy(&mon->qmp.parser); +} +g_free(mon->rs); QDECREF(mon->outbuf); qemu_mutex_destroy(&mon->out_lock); } @@ -4196,6 +4203,19 @@ void monitor_init(CharDriverState *chr, int flags) qemu_mutex_unlock(&monitor_lock); } +void monitor_cleanup(void) +{ +Monitor *mon, *next; + +qemu_mutex_lock(&monitor_lock); +QLIST_FOREACH_SAFE(mon, &mon_list, entry, next) { +QLIST_REMOVE(mon, entry); +monitor_data_destroy(mon); +g_free(mon); +} +qemu_mutex_unlock(&monitor_lock); +} + static void bdrv_password_cb(void *opaque, const char *password, void *readline_opaque) { diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c5c9ea2..a714d8e 1006
Re: [Qemu-devel] [PATCH for-2.7 2/2] audio: clean up before monitor clean up
On 01/08/2016 13:23, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau > > Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu, > before the atexit() handlers. audio_cleanup() may use the monitor to > notify of changes. For compatibility reasons, let's clean up audio > before the monitor so it keeps emitting monitor events. > > The audio_atexit() function is made idempotent (so it can be called > multiple times), That's a very good idea, as it avoids having to establish exit notifiers as we did for net/. Reviewed-by: Paolo Bonzini The two patches conflict with each other, so it's probably easiest if one of Gerd or Markus takes both. Thanks, Paolo > and renamed to audio_cleanup(). Since coreaudio > backend is using a 'isAtexit' code path, change it to check > audio_is_cleaning_up() instead, so the path is taken during normal > exit. > > Signed-off-by: Marc-André Lureau > --- > audio/audio.c | 26 ++ > audio/audio.h | 3 +++ > audio/coreaudio.c | 12 ++-- > vl.c | 1 + > 4 files changed, 24 insertions(+), 18 deletions(-) > > diff --git a/audio/audio.c b/audio/audio.c > index 9d4dcc7..c845a44 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -1739,13 +1739,21 @@ static void audio_vm_change_state_handler (void > *opaque, int running, > audio_reset_timer (s); > } > > -static void audio_atexit (void) > +static bool is_cleaning_up; > + > +bool audio_is_cleaning_up(void) > +{ > +return is_cleaning_up; > +} > + > +void audio_cleanup(void) > { > AudioState *s = &glob_audio_state; > -HWVoiceOut *hwo = NULL; > -HWVoiceIn *hwi = NULL; > +HWVoiceOut *hwo, *hwon; > +HWVoiceIn *hwi, *hwin; > > -while ((hwo = audio_pcm_hw_find_any_out (hwo))) { > +is_cleaning_up = true; > +QLIST_FOREACH_SAFE(hwo, &glob_audio_state.hw_head_out, entries, hwon) { > SWVoiceCap *sc; > > if (hwo->enabled) { > @@ -1761,17 +1769,20 @@ static void audio_atexit (void) > cb->ops.destroy (cb->opaque); > } > } > +QLIST_REMOVE(hwo, entries); > } > > -while ((hwi = audio_pcm_hw_find_any_in (hwi))) { > +QLIST_FOREACH_SAFE(hwi, &glob_audio_state.hw_head_in, entries, hwin) { > if (hwi->enabled) { > hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); > } > hwi->pcm_ops->fini_in (hwi); > +QLIST_REMOVE(hwi, entries); > } > > if (s->drv) { > s->drv->fini (s->drv_opaque); > +s->drv = NULL; > } > } > > @@ -1799,7 +1810,7 @@ static void audio_init (void) > QLIST_INIT (&s->hw_head_out); > QLIST_INIT (&s->hw_head_in); > QLIST_INIT (&s->cap_head); > -atexit (audio_atexit); > +atexit(audio_cleanup); > > s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); > > @@ -1966,8 +1977,7 @@ CaptureVoiceOut *AUD_add_capture ( > QLIST_INSERT_HEAD (&s->cap_head, cap, entries); > QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); > > -hw = NULL; > -while ((hw = audio_pcm_hw_find_any_out (hw))) { > +QLIST_FOREACH(hw, &glob_audio_state.hw_head_out, entries) { > audio_attach_capture (hw); > } > return cap; > diff --git a/audio/audio.h b/audio/audio.h > index 11e56c9..c3c5198 100644 > --- a/audio/audio.h > +++ b/audio/audio.h > @@ -163,4 +163,7 @@ static inline void *advance (void *p, int incr) > int wav_start_capture (CaptureState *s, const char *path, int freq, > int bits, int nchannels); > > +bool audio_is_cleaning_up(void); > +void audio_cleanup(void); > + > #endif /* QEMU_AUDIO_H */ > diff --git a/audio/coreaudio.c b/audio/coreaudio.c > index d4ad224..c751420 100644 > --- a/audio/coreaudio.c > +++ b/audio/coreaudio.c > @@ -36,8 +36,6 @@ > #define MAC_OS_X_VERSION_10_6 1060 > #endif > > -static int isAtexit; > - > typedef struct { > int buffer_frames; > int nbuffers; > @@ -378,11 +376,6 @@ static inline UInt32 isPlaying (AudioDeviceID > outputDeviceID) > return result; > } > > -static void coreaudio_atexit (void) > -{ > -isAtexit = 1; > -} > - > static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name) > { > int err; > @@ -630,7 +623,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw) > int err; > coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; > > -if (!isAtexit) { > +if (!audio_is_cleaning_up()) { > /* stop playback */ > if (isPlaying(core->outputDeviceID)) { > status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); > @@ -673,7 +666,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, > ...) > > case VOICE_DISABLE: > /* stop playback */ > -if (!isAtexit) { > +if (!audio_is_cleaning_up()) { > if (isPlaying(core->outputDeviceID)) { > status = AudioDeviceStop(co
Re: [Qemu-devel] [PATCH for-2.7 2/2] audio: clean up before monitor clean up
Hi - Original Message - > From: Marc-André Lureau > > Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu, > before the atexit() handlers. audio_cleanup() may use the monitor to > notify of changes. For compatibility reasons, let's clean up audio > before the monitor so it keeps emitting monitor events. > > The audio_atexit() function is made idempotent (so it can be called > multiple times), and renamed to audio_cleanup(). Since coreaudio > backend is using a 'isAtexit' code path, change it to check > audio_is_cleaning_up() instead, so the path is taken during normal > exit. > > Signed-off-by: Marc-André Lureau > --- > audio/audio.c | 26 ++ > audio/audio.h | 3 +++ > audio/coreaudio.c | 12 ++-- > vl.c | 1 + > 4 files changed, 24 insertions(+), 18 deletions(-) > > diff --git a/audio/audio.c b/audio/audio.c > index 9d4dcc7..c845a44 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -1739,13 +1739,21 @@ static void audio_vm_change_state_handler (void > *opaque, int running, > audio_reset_timer (s); > } > > -static void audio_atexit (void) > +static bool is_cleaning_up; > + > +bool audio_is_cleaning_up(void) > +{ > +return is_cleaning_up; > +} > + > +void audio_cleanup(void) > { > AudioState *s = &glob_audio_state; > -HWVoiceOut *hwo = NULL; > -HWVoiceIn *hwi = NULL; > +HWVoiceOut *hwo, *hwon; > +HWVoiceIn *hwi, *hwin; > > -while ((hwo = audio_pcm_hw_find_any_out (hwo))) { > +is_cleaning_up = true; > +QLIST_FOREACH_SAFE(hwo, &glob_audio_state.hw_head_out, entries, hwon) { > SWVoiceCap *sc; > > if (hwo->enabled) { > @@ -1761,17 +1769,20 @@ static void audio_atexit (void) > cb->ops.destroy (cb->opaque); > } > } > +QLIST_REMOVE(hwo, entries); > } > > -while ((hwi = audio_pcm_hw_find_any_in (hwi))) { > +QLIST_FOREACH_SAFE(hwi, &glob_audio_state.hw_head_in, entries, hwin) { > if (hwi->enabled) { > hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); > } > hwi->pcm_ops->fini_in (hwi); > +QLIST_REMOVE(hwi, entries); > } > > if (s->drv) { > s->drv->fini (s->drv_opaque); > +s->drv = NULL; > } > } > > @@ -1799,7 +1810,7 @@ static void audio_init (void) > QLIST_INIT (&s->hw_head_out); > QLIST_INIT (&s->hw_head_in); > QLIST_INIT (&s->cap_head); > -atexit (audio_atexit); > +atexit(audio_cleanup); > > s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); > > @@ -1966,8 +1977,7 @@ CaptureVoiceOut *AUD_add_capture ( > QLIST_INSERT_HEAD (&s->cap_head, cap, entries); > QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); > > -hw = NULL; > -while ((hw = audio_pcm_hw_find_any_out (hw))) { > +QLIST_FOREACH(hw, &glob_audio_state.hw_head_out, entries) { > audio_attach_capture (hw); > } That hunk is unnecessary (although it removes the usage of an unpleasant glue function) > return cap; > diff --git a/audio/audio.h b/audio/audio.h > index 11e56c9..c3c5198 100644 > --- a/audio/audio.h > +++ b/audio/audio.h > @@ -163,4 +163,7 @@ static inline void *advance (void *p, int incr) > int wav_start_capture (CaptureState *s, const char *path, int freq, > int bits, int nchannels); > > +bool audio_is_cleaning_up(void); > +void audio_cleanup(void); > + > #endif /* QEMU_AUDIO_H */ > diff --git a/audio/coreaudio.c b/audio/coreaudio.c > index d4ad224..c751420 100644 > --- a/audio/coreaudio.c > +++ b/audio/coreaudio.c > @@ -36,8 +36,6 @@ > #define MAC_OS_X_VERSION_10_6 1060 > #endif > > -static int isAtexit; > - > typedef struct { > int buffer_frames; > int nbuffers; > @@ -378,11 +376,6 @@ static inline UInt32 isPlaying (AudioDeviceID > outputDeviceID) > return result; > } > > -static void coreaudio_atexit (void) > -{ > -isAtexit = 1; > -} > - > static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name) > { > int err; > @@ -630,7 +623,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw) > int err; > coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; > > -if (!isAtexit) { > +if (!audio_is_cleaning_up()) { > /* stop playback */ > if (isPlaying(core->outputDeviceID)) { > status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); > @@ -673,7 +666,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, > ...) > > case VOICE_DISABLE: > /* stop playback */ > -if (!isAtexit) { > +if (!audio_is_cleaning_up()) { > if (isPlaying(core->outputDeviceID)) { > status = AudioDeviceStop(core->outputDeviceID, > core->ioprocid); > @@ -697,7 +690,6 @@ static void *coreaudio_audio_init (void) > CoreaudioConf *conf = g_malloc(si
Re: [Qemu-devel] [PATCH 2/4] nbd: Limit nbdflags to 16 bits
On 08/01/2016 03:17 AM, Paolo Bonzini wrote: > > > On 21/07/2016 21:34, Eric Blake wrote: >> Furthermore, upstream NBD has never passed the global flags to >> the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first >> introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually >> tried to OR the global flags with the transmission flags, with >> the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9 >> caused all earlier NBD 3.x clients to treat every export as >> read-only; NBD 3.10 and later intentionally clip things to 16 >> bits to pass only transmission flags). Qemu should follow suit, >> since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE >> and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior >> during transmission. > > Should squash this in too: > > diff --git a/nbd/server.c b/nbd/server.c > index 80fbb4d..6fa2f9c 100644 > --- a/nbd/server.c > +++ b/nbd/server.c > @@ -575,7 +575,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData > *data) > > oldStyle = client->exp != NULL && !client->tlscreds; > if (oldStyle) { > -TRACE("advertising size %" PRIu64 " and flags %x", > +TRACE("advertising size %" PRIu64 " and flags %" PRIx16, >client->exp->size, client->exp->nbdflags | myflags); No, we shouldn't. Last time I tried that, we tickled a clang bug where %hx gripes when presented an 'int' argument, in spite of the int argument being computed as 'short | short'. See commit 2cb34749, and your discussion leading up to it: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg04663.html -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
On 29/07/2016 13:05, Cao jin wrote: > Cc: Paolo Bonzini > Cc: Peter Maydell > Cc Peter Crosthwaite > Cc: Richard Henderson > > Cao jin (3): > timer: update comments > cpus: rename local variable to meaningful one > cpus: update comments > > cpus.c | 13 +++-- > include/qemu/timer.h | 19 ++- > 2 files changed, 13 insertions(+), 19 deletions(-) > Thanks, these can go in 2.8. Paolo
Re: [Qemu-devel] [PATCH 2/4] nbd: Limit nbdflags to 16 bits
On 01/08/2016 13:43, Eric Blake wrote: > On 08/01/2016 03:17 AM, Paolo Bonzini wrote: >> >> >> On 21/07/2016 21:34, Eric Blake wrote: >>> Furthermore, upstream NBD has never passed the global flags to >>> the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first >>> introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually >>> tried to OR the global flags with the transmission flags, with >>> the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9 >>> caused all earlier NBD 3.x clients to treat every export as >>> read-only; NBD 3.10 and later intentionally clip things to 16 >>> bits to pass only transmission flags). Qemu should follow suit, >>> since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE >>> and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior >>> during transmission. >> >> Should squash this in too: >> >> diff --git a/nbd/server.c b/nbd/server.c >> index 80fbb4d..6fa2f9c 100644 >> --- a/nbd/server.c >> +++ b/nbd/server.c >> @@ -575,7 +575,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData >> *data) >> >> oldStyle = client->exp != NULL && !client->tlscreds; >> if (oldStyle) { >> -TRACE("advertising size %" PRIu64 " and flags %x", >> +TRACE("advertising size %" PRIu64 " and flags %" PRIx16, >>client->exp->size, client->exp->nbdflags | myflags); > > No, we shouldn't. Last time I tried that, we tickled a clang bug where > %hx gripes when presented an 'int' argument, in spite of the int > argument being computed as 'short | short'. See commit 2cb34749, and > your discussion leading up to it: > https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg04663.html Uff, you're right. :( I remembered the discussion, but not the outcome. Paolo
Re: [Qemu-devel] [PATCH for 2.8 3/3] sdl: Modularize
On Mi, 2016-07-27 at 14:26 +0800, Fam Zheng wrote: > Signed-off-by: Fam Zheng more verbose commit message please, especially for those (like me) who have not worked yet with modules. Will sdl be loaded unconditionally? Or only with -display sdl? What happens if the module is not present? The main benefit I see in modularizing the ui is that we can move the ui modules (and the UI libs dependency chain) to a separate rpm subpackage, can we start that with this series applied? Can modules have dependencies on other modules? When it comes to modularizing spice we will need that as qxl has a spice dependency ... cheers, Gerd
Re: [Qemu-devel] [PATCH RFC 1/1] arm64: add an option to turn on/off vpmu support
On Fri, 2016-07-29 at 08:54 +0200, Andrew Jones wrote: > On Thu, Jul 28, 2016 at 11:38:16AM -0500, Wei Huang wrote: > > > > This patch adds a pmu=[on/off] option to enable/disable vpmu support > > in guest vm. There are several reasons to justify this option. First > > vpmu can be problematic for cross-migration between different SoC as > > perf counters is architecture-dependent. It is more flexible to > > have an option to turn it on/off. Secondly it matches the -cpu pmu > > option in libivrt. This patch has been tested on both DT/ACPI modes. > > > > Signed-off-by: Wei Huang > > --- > > hw/arm/virt-acpi-build.c | 2 +- > > hw/arm/virt.c| 2 +- > > target-arm/cpu.c | 1 + > > target-arm/cpu.h | 5 +++-- > > target-arm/kvm64.c | 10 +- > > 5 files changed, 11 insertions(+), 9 deletions(-) > > > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > > index 28fc59c..dc5f66d 100644 > > --- a/hw/arm/virt-acpi-build.c > > +++ b/hw/arm/virt-acpi-build.c > > @@ -540,7 +540,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, > > VirtGuestInfo *guest_info) > > gicc->uid = i; > > gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); > > > > -if (armcpu->has_pmu) { > > +if (armcpu->enable_pmu) { > > gicc->performance_interrupt = > >cpu_to_le32(PPI(VIRTUAL_PMU_IRQ)); > > } > > } > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > > index a193b5a..6aea901 100644 > > --- a/hw/arm/virt.c > > +++ b/hw/arm/virt.c > > @@ -477,7 +477,7 @@ static void fdt_add_pmu_nodes(const VirtBoardInfo *vbi, > > int gictype) > > > > CPU_FOREACH(cpu) { > > armcpu = ARM_CPU(cpu); > > -if (!armcpu->has_pmu || > > +if (!armcpu->enable_pmu || > > !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ))) { > > return; > > } > > diff --git a/target-arm/cpu.c b/target-arm/cpu.c > > index ce8b8f4..f7daf81 100644 > > --- a/target-arm/cpu.c > > +++ b/target-arm/cpu.c > > @@ -1412,6 +1412,7 @@ static const ARMCPUInfo arm_cpus[] = { > > }; > > > > static Property arm_cpu_properties[] = { > > +DEFINE_PROP_BOOL("pmu", ARMCPU, enable_pmu, true), > > x86's pmu property defaults to off. I'm not sure if it's necessary to > have a consistent default between x86 and arm in order for libvirt to > be able to use it in the same way. We should confirm with libvirt > people. Anyway, I think I'd prefer we default off here, and then we > can default on in machine code for configurations that we want it by > default (only AArch64 KVM). Or, maybe we don't want it by default at > all? Possibly we should only set it on by default for virt-2.6, and > then, from 2.7 on, require users to opt-in to the feature. It makes > sense to require opting-in to features that can cause problems with > migration. After thinking about this a bit, I don't think it matters that much (from libvirt's point of view) whether the default is on or off - there are a bunch of other situations where the user is required to specify explicitly whether he wants the feature or not, and if he doesn't choose either side he will get whatever QEMU uses as a default. What's important is that the user can pick one or the other when it matters to him, and having a pmu property like the one x86 already has fits the bill. That said, defaulting to off looks like it would be the least confusing behaviour. > > +cpu->kvm_init_features[0] |= cpu->enable_pmu << KVM_ARM_VCPU_PMU_V3; > > > > /* Do KVM_ARM_VCPU_INIT ioctl */ > > ret = kvm_arm_vcpu_init(cs); > > OK, so this property will be exposed to all ARM cpu types, and if a user > turns it on, then it will stay on for all types, except when using KVM > with an aarch64 cpu type, and KVM doesn't support it. This could mislead > users to believe they'll get a pmu, by simply adding pmu=on, even when > they can't. I think we'd ideally keep has_pmu, and the current code that > sets it, and then add code like > > if (enable_pmu && !has_pmu) { >error_report("Warning: ...") > } > > somewhere. Unfortunately I don't think there's any one place we could > add that. We'd need to add it to every ARM machine type that cares about > not misleading users. Too bad cpu properties aren't whitelisted by > machines to avoid this issue. > > Anyway, all that said, I see this is just how cpu properties currently > work, so we probably don't need to worry about it for every machine. I > do still suggest we add the above warning to mach-virt though. I'm not sure a warning is enough: if I start a guest and explicitly ask for a PMU, I expect it to be there, or for the guest not to start at all. How does x86 behave in this regard? -- Andrea Bolognani / Red Hat / Virtualization
Re: [Qemu-devel] [PATCH v2 13/37] portio: keep references on portio
On 28/07/2016 16:37, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau > > The isa_register_portio_list() function allocates ioports > data/state. Let's keep the reference to this data on some owner. This > isn't enough to fix leaks, but at least, ASAN stops complaining of > direct leaks. Further cleanup would require calling > portio_list_del/destroy(). This is mostly not an issue because ISA devices are not hot-unpluggable, but the commit message is correct. Reviewed-by: Paolo Bonzini > Signed-off-by: Marc-André Lureau > --- > hw/audio/gus.c| 9 ++--- > hw/audio/sb16.c | 4 +++- > hw/block/fdc.c| 4 +++- > hw/char/parallel.c| 3 ++- > hw/display/vga-isa.c | 8 ++-- > hw/dma/i8257.c| 6 -- > hw/ide/core.c | 6 -- > hw/isa/isa-bus.c | 14 +- > include/hw/ide/internal.h | 2 ++ > include/hw/isa/i8257.h| 2 ++ > include/hw/isa/isa.h | 5 - > 11 files changed, 41 insertions(+), 22 deletions(-) > > diff --git a/hw/audio/gus.c b/hw/audio/gus.c > index 6c02646..3d08a65 100644 > --- a/hw/audio/gus.c > +++ b/hw/audio/gus.c > @@ -60,6 +60,8 @@ typedef struct GUSState { > int64_t last_ticks; > qemu_irq pic; > IsaDma *isa_dma; > +PortioList portio_list1; > +PortioList portio_list2; > } GUSState; > > static uint32_t gus_readb(void *opaque, uint32_t nport) > @@ -265,9 +267,10 @@ static void gus_realizefn (DeviceState *dev, Error > **errp) > s->samples = AUD_get_buffer_size_out (s->voice) >> s->shift; > s->mixbuf = g_malloc0 (s->samples << s->shift); > > -isa_register_portio_list (d, s->port, gus_portio_list1, s, "gus"); > -isa_register_portio_list (d, (s->port + 0x100) & 0xf00, > - gus_portio_list2, s, "gus"); > +isa_register_portio_list(d, &s->portio_list1, s->port, > + gus_portio_list1, s, "gus"); > +isa_register_portio_list(d, &s->portio_list2, (s->port + 0x100) & 0xf00, > + gus_portio_list2, s, "gus"); > > s->isa_dma = isa_get_dma(isa_bus_from_device(d), s->emu.gusdma); > k = ISADMA_GET_CLASS(s->isa_dma); > diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c > index 3a4a57a..6b4427f 100644 > --- a/hw/audio/sb16.c > +++ b/hw/audio/sb16.c > @@ -106,6 +106,7 @@ typedef struct SB16State { > /* mixer state */ > int mixer_nreg; > uint8_t mixer_regs[256]; > +PortioList portio_list; > } SB16State; > > static void SB_audio_callback (void *opaque, int free); > @@ -1378,7 +1379,8 @@ static void sb16_realizefn (DeviceState *dev, Error > **errp) > dolog ("warning: Could not create auxiliary timer\n"); > } > > -isa_register_portio_list (isadev, s->port, sb16_ioport_list, s, "sb16"); > +isa_register_portio_list(isadev, &s->portio_list, s->port, > + sb16_ioport_list, s, "sb16"); > > s->isa_hdma = isa_get_dma(isa_bus_from_device(isadev), s->hdma); > k = ISADMA_GET_CLASS(s->isa_hdma); > diff --git a/hw/block/fdc.c b/hw/block/fdc.c > index f73af7d..b79873a 100644 > --- a/hw/block/fdc.c > +++ b/hw/block/fdc.c > @@ -692,6 +692,7 @@ struct FDCtrl { > /* Timers state */ > uint8_t timer0; > uint8_t timer1; > +PortioList portio_list; > }; > > static FloppyDriveType get_fallback_drive_type(FDrive *drv) > @@ -2495,7 +2496,8 @@ static void isabus_fdc_realize(DeviceState *dev, Error > **errp) > FDCtrl *fdctrl = &isa->state; > Error *err = NULL; > > -isa_register_portio_list(isadev, isa->iobase, fdc_portio_list, fdctrl, > +isa_register_portio_list(isadev, &fdctrl->portio_list, > + isa->iobase, fdc_portio_list, fdctrl, > "fdc"); > > isa_init_irq(isadev, &fdctrl->irq, isa->irq); > diff --git a/hw/char/parallel.c b/hw/char/parallel.c > index 11c78fe..fa08566 100644 > --- a/hw/char/parallel.c > +++ b/hw/char/parallel.c > @@ -80,6 +80,7 @@ typedef struct ParallelState { > uint32_t last_read_offset; /* For debugging */ > /* Memory-mapped interface */ > int it_shift; > +PortioList portio_list; > } ParallelState; > > #define TYPE_ISA_PARALLEL "isa-parallel" > @@ -532,7 +533,7 @@ static void parallel_isa_realizefn(DeviceState *dev, > Error **errp) > s->status = dummy; > } > > -isa_register_portio_list(isadev, base, > +isa_register_portio_list(isadev, &s->portio_list, base, > (s->hw_driver >? &isa_parallel_portio_hw_list[0] >: &isa_parallel_portio_sw_list[0]), > diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c > index f5aff1c..1af9556 100644 > --- a/hw/display/vga-isa.c > +++ b/hw/display/vga-isa.c > @@ -39,6 +39,8 @@ typedef struct ISAVGAState { > ISADevice parent_obj; > > struct VGACommonState state; > +
Re: [Qemu-devel] [PATCH v2 19/37] char: disconnect peer when qemu_chr_free()
On 28/07/2016 16:37, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau > > chr_disconnect callback is used to cleanup server socket peer. This > removes some leaks when the chardev is freed. > > Signed-off-by: Marc-André Lureau > --- > qemu-char.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/qemu-char.c b/qemu-char.c > index e4b8448..6ed6dd6 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -4031,6 +4031,7 @@ static void qemu_chr_free_common(CharDriverState *chr) > > void qemu_chr_free(CharDriverState *chr) > { > +qemu_chr_disconnect(chr); > if (chr->chr_close) { > chr->chr_close(chr); > } > The patch, as is, would cause for example two calls to qemu_chr_be_event(chr, CHR_EVENT_CLOSED). It's also unnecessary to set up a watch on s->listen_ioc and to call qemu_chr_socket_restart_timer. I think the right fix is to extract the relevant parts of tcp_chr_disconnect into a new function (e.g. tcp_chr_free_connection) and call the function from tcp_chr_close. Paolo
Re: [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing
On 28/07/2016 16:37, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau > > Similarly to other chr_close callbacks, free char type specific data. > > Signed-off-by: Marc-André Lureau > --- > qemu-char.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/qemu-char.c b/qemu-char.c > index 6ed6dd6..e276485 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -786,6 +786,14 @@ static GSource *mux_chr_add_watch(CharDriverState *s, > GIOCondition cond) > return d->drv->chr_add_watch(d->drv, cond); > } > > +static void mux_chr_close(struct CharDriverState *chr) > +{ > +MuxDriver *d = chr->opaque; > + > +/* is more cleanup needed? */ Perhaps qemu_chr_free(d->drv)? Paolo > +g_free(d); > +} > + > static CharDriverState *qemu_chr_open_mux(const char *id, >ChardevBackend *backend, >ChardevReturn *ret, Error **errp) > @@ -810,6 +818,7 @@ static CharDriverState *qemu_chr_open_mux(const char *id, > chr->opaque = d; > d->drv = drv; > d->focus = -1; > +chr->chr_close = mux_chr_close; > chr->chr_write = mux_chr_write; > chr->chr_update_read_handler = mux_chr_update_read_handler; > chr->chr_accept_input = mux_chr_accept_input; >
Re: [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing
On 01/08/2016 14:50, Paolo Bonzini wrote: > > > On 28/07/2016 16:37, marcandre.lur...@redhat.com wrote: >> From: Marc-André Lureau >> >> Similarly to other chr_close callbacks, free char type specific data. >> >> Signed-off-by: Marc-André Lureau >> --- >> qemu-char.c | 9 + >> 1 file changed, 9 insertions(+) >> >> diff --git a/qemu-char.c b/qemu-char.c >> index 6ed6dd6..e276485 100644 >> --- a/qemu-char.c >> +++ b/qemu-char.c >> @@ -786,6 +786,14 @@ static GSource *mux_chr_add_watch(CharDriverState *s, >> GIOCondition cond) >> return d->drv->chr_add_watch(d->drv, cond); >> } >> >> +static void mux_chr_close(struct CharDriverState *chr) >> +{ >> +MuxDriver *d = chr->opaque; >> + >> +/* is more cleanup needed? */ > > Perhaps qemu_chr_free(d->drv)? Hmm, no, a qemu_chr_delete(mux) could conceivably delete d->drv too, but not a free. So the patch is okay with the comment removed. Paolo
Re: [Qemu-devel] [PATCH v2 33/37] tests: add qtest_add_data_func_full
On 07/29/2016 02:48 AM, Marc-André Lureau wrote: >>> +#if GLIB_CHECK_VERSION(2, 34, 0) >>> +gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str); >>> +g_test_add_data_func_full(path, data, fn, data_free_func); >>> +g_free(path); >>> +#else >>> +qtest_add_data_func(str, data, fn); >>> +#endif >> >> The commit message doesn't mention that the code is dependent on glib >> versions, nor that you are still leaking the data (data_free_func >> remains uncalled) on older glib. If it is intentional (under the >> argument that "anyone running on older glib can't care too much about >> memory leaks encountered only by the testsuite, and the leaks don't >> affect main qemu"), then stating that in the commit message would let me >> feel more comfortable giving an R-b. > > ok > >> Is there anything we can do even in older glib to unconditionally invoke >> the cleanup function in the right places? > > Yes, calling the undocumented g_test_add_vtable(), with some casts. Is > that acceptable? Since the older versions aren't changing, then yes, I would view back-compat casts along with a note saying "remove this once we can require new-enough glib" as acceptable. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH 5/5] ppc: Improve generation of conditional traps
On Sun, Jul 31, 2016 at 03:13:13PM +1000, Benjamin Herrenschmidt wrote: > Translate most conditions to TCG conditions and avoid the helper > for most of the common cases. > > Signed-off-by: Benjamin Herrenschmidt Reviewed-by: David Gibson The other patches in the series look good AFAICT, but I'm not really confident enough in TCG to have a good feeling. I'm hoping to get an R-b from rth before merging. > --- > target-ppc/translate.c | 168 > ++--- > 1 file changed, 132 insertions(+), 36 deletions(-) > > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 47eb9ed..561976f 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -3639,82 +3639,178 @@ static void gen_sc(DisasContext *ctx) > > /***Trap > ***/ > > -/* Check for unconditional traps (always or never) */ > -static bool check_unconditional_trap(DisasContext *ctx) > +static int TO2tcg[32] = { > +TCG_COND_NEVER, /* no condition */ > +TCG_COND_GTU, /* 0x01 u> */ > +TCG_COND_LTU, /* 0x02 u< */ > +TCG_COND_NE,/* 0x03 u< or u> -> NE */ > +TCG_COND_EQ,/* 0x04 = */ > +TCG_COND_GEU, /* 0x05 u> or = */ > +TCG_COND_LEU, /* 0x06 u< or = */ > +TCG_COND_ALWAYS,/* 0x07 u< or u> or = -> ALWAYS */ > +TCG_COND_GT,/* 0x08 > */ > +-1, /* 0x09 > or u> -> weird */ > +-1, /* 0x0a > or u< -> weird */ > +-1, /* 0x0b > or u< or u> -> weird */ > +TCG_COND_GE,/* 0x0c > or = */ > +-1, /* 0x0d > or = or u> */ > +-1, /* 0x0e > or = or u< */ > +-1, /* 0x0f > or = or u> or u< */ > +TCG_COND_LT,/* 0x10 < */ > +-1, /* 0x11 < or u> -> weird */ > +-1, /* 0x12 < or u< -> weird */ > +-1, /* 0x13 < or u< or u> -> weird */ > +TCG_COND_LE,/* 0x14 < or = */ > +-1, /* 0x15 < or = or u> -> weird */ > +-1, /* 0x16 < or = or u< -> weird */ > +TCG_COND_ALWAYS,/* 0x17 < or = or u< or u> -> ALWAYS */ > +TCG_COND_NE,/* 0x18 < or > -> NE */ > +-1, /* 0x19 < or > or u> -> weird */ > +-1, /* 0x1a < or > or u< -> weird */ > +-1, /* 0x1b < or > or u> or u< -> weird */ > +TCG_COND_ALWAYS,/* 0x1c < or > or = -> ALWAYS */ > +TCG_COND_ALWAYS,/* 0x1d < or > or = or u> -> ALWAYS */ > +TCG_COND_ALWAYS,/* 0x1e < or > or = or u< -> ALWAYS */ > +TCG_COND_ALWAYS,/* 0x1f < or > or = or u< -> ALWAYS */ > +}; > + > +#define TRAP_UNCOND (-1) > +#define TRAP_HELPER (-2) > + > +static int precheck_trap(DisasContext *ctx) > { > -/* Trap never */ > -if (TO(ctx->opcode) == 0) { > -return true; > +int cond = TO2tcg[TO(ctx->opcode)]; > + > +/* Weird traps go to helper */ > +if (cond < 0) { > +return TRAP_HELPER; > } > -/* Trap always */ > -if (TO(ctx->opcode) == 31) { > +/* Unconditionals */ > +if (cond == TCG_COND_ALWAYS) { > gen_exception_err(ctx, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_TRAP); > -return true; > +return TRAP_UNCOND; > } > -return false; > +if (cond == TCG_COND_NEVER) { > +return TRAP_UNCOND; > +} > +/* Invert the condition as we branch over the exception when the > + * condition is *not* met > + */ > +return tcg_invert_cond(cond); > +} > + > +static void gen_trap(DisasContext *ctx) > +{ > +TCGv_i32 t0, t1; > + > +t0 = tcg_const_i32(POWERPC_EXCP_PROGRAM); > +t1 = tcg_const_i32(POWERPC_EXCP_TRAP); > +gen_update_nip(ctx, ctx->nip - 4); > +gen_helper_raise_exception_err(cpu_env, t0, t1); > +tcg_temp_free_i32(t0); > +tcg_temp_free_i32(t1); > } > > /* tw */ > static void gen_tw(DisasContext *ctx) > { > -TCGv_i32 t0; > +int cond = precheck_trap(ctx); > +TCGLabel *l1; > +TCGv t0; > +TCGv t1; > > -if (check_unconditional_trap(ctx)) { > +if (cond == TRAP_UNCOND) { > +return; > +} else if (cond == TRAP_HELPER) { > +TCGv_i32 trapop = tcg_const_i32(TO(ctx->opcode)); > +gen_helper_tw(cpu_env, cpu_gpr[rA(ctx->opcode)], > + cpu_gpr[rB(ctx->opcode)], trapop); > +tcg_temp_free_i32(trapop); > return; > } > -t0 = tcg_const_i32(TO(ctx->opcode)); > -gen_helper_tw(cpu_env, cpu_gpr[rA(ctx->opcode)], > cpu_gpr[rB(ctx->opcode)], > - t0); > -tcg_temp_free_i32(t0); > +l1 = gen_new_label(); > +t0 = tcg_temp_new(); > +t1 = tcg_temp_new(); > +tcg_gen_ext32s_tl(t0, cpu_gpr[rA(ctx->opcode)]); > +tcg_gen_ext32s_tl(t1, cpu_gpr[rB(ctx->opcode)]); > +tcg_gen_brcond_tl(cond, t0, t1, l1); > +gen_trap(ctx); > +gen_set_la
Re: [Qemu-devel] [PATCH RFC 1/1] arm64: add an option to turn on/off vpmu support
On Mon, Aug 01, 2016 at 02:04:59PM +0200, Andrea Bolognani wrote: > On Fri, 2016-07-29 at 08:54 +0200, Andrew Jones wrote: > > On Thu, Jul 28, 2016 at 11:38:16AM -0500, Wei Huang wrote: > > > > > > This patch adds a pmu=[on/off] option to enable/disable vpmu support > > > in guest vm. There are several reasons to justify this option. First > > > vpmu can be problematic for cross-migration between different SoC as > > > perf counters is architecture-dependent. It is more flexible to > > > have an option to turn it on/off. Secondly it matches the -cpu pmu > > > option in libivrt. This patch has been tested on both DT/ACPI modes. > > > > > > Signed-off-by: Wei Huang > > > --- > > > hw/arm/virt-acpi-build.c | 2 +- > > > hw/arm/virt.c| 2 +- > > > target-arm/cpu.c | 1 + > > > target-arm/cpu.h | 5 +++-- > > > target-arm/kvm64.c | 10 +- > > > 5 files changed, 11 insertions(+), 9 deletions(-) > > > > > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > > > index 28fc59c..dc5f66d 100644 > > > --- a/hw/arm/virt-acpi-build.c > > > +++ b/hw/arm/virt-acpi-build.c > > > @@ -540,7 +540,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, > > > VirtGuestInfo *guest_info) > > > gicc->uid = i; > > > gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); > > > > > > -if (armcpu->has_pmu) { > > > +if (armcpu->enable_pmu) { > > > gicc->performance_interrupt = > > >cpu_to_le32(PPI(VIRTUAL_PMU_IRQ)); > > > } > > > } > > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > > > index a193b5a..6aea901 100644 > > > --- a/hw/arm/virt.c > > > +++ b/hw/arm/virt.c > > > @@ -477,7 +477,7 @@ static void fdt_add_pmu_nodes(const VirtBoardInfo > > > *vbi, int gictype) > > > > > > CPU_FOREACH(cpu) { > > > armcpu = ARM_CPU(cpu); > > > -if (!armcpu->has_pmu || > > > +if (!armcpu->enable_pmu || > > > !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ))) { > > > return; > > > } > > > diff --git a/target-arm/cpu.c b/target-arm/cpu.c > > > index ce8b8f4..f7daf81 100644 > > > --- a/target-arm/cpu.c > > > +++ b/target-arm/cpu.c > > > @@ -1412,6 +1412,7 @@ static const ARMCPUInfo arm_cpus[] = { > > > }; > > > > > > static Property arm_cpu_properties[] = { > > > +DEFINE_PROP_BOOL("pmu", ARMCPU, enable_pmu, true), > > > > x86's pmu property defaults to off. I'm not sure if it's necessary to > > have a consistent default between x86 and arm in order for libvirt to > > be able to use it in the same way. We should confirm with libvirt > > people. Anyway, I think I'd prefer we default off here, and then we > > can default on in machine code for configurations that we want it by > > default (only AArch64 KVM). Or, maybe we don't want it by default at > > all? Possibly we should only set it on by default for virt-2.6, and > > then, from 2.7 on, require users to opt-in to the feature. It makes > > sense to require opting-in to features that can cause problems with > > migration. > > After thinking about this a bit, I don't think it matters that > much (from libvirt's point of view) whether the default is on > or off - there are a bunch of other situations where the user > is required to specify explicitly whether he wants the feature > or not, and if he doesn't choose either side he will get > whatever QEMU uses as a default. > > What's important is that the user can pick one or the other > when it matters to him, and having a pmu property like the one > x86 already has fits the bill. > > That said, defaulting to off looks like it would be the least > confusing behaviour. OK, so the default is still up for debate. Pros of ONCons of ON ---- We already do it The default instance is less migratable Less typing on cmdline (libvirt covers typing for us anyway...) Pros of OFF Cons of OFF --- --- See 'Cons of ON' See 'Pros on ON' (virt-2.6 needs compat code) > > > > +cpu->kvm_init_features[0] |= cpu->enable_pmu << KVM_ARM_VCPU_PMU_V3; > > > > > > /* Do KVM_ARM_VCPU_INIT ioctl */ > > > ret = kvm_arm_vcpu_init(cs); > > > > OK, so this property will be exposed to all ARM cpu types, and if a user > > turns it on, then it will stay on for all types, except when using KVM > > with an aarch64 cpu type, and KVM doesn't support it. This could mislead > > users to believe they'll get a pmu, by simply adding pmu=on, even when > > they can't. I think we'd ideally keep has_pmu, and the current code that > > sets it, and then add code like > > > > if (enable_pmu && !has_pmu) { > >error_report("Warning: ...") > > } > > > > somewhere. Unfortunately I don't think there's any one place we could > > add that. We'd need to add it to every ARM machine type that cares about > > not misleading users. Too bad cpu properties aren't whitelisted by > > machin
Re: [Qemu-devel] [PATCH RFC 1/1] arm64: add an option to turn on/off vpmu support
On 1 August 2016 at 14:08, Andrew Jones wrote: > Peter had a good suggestion for this. We need to wrap the property > addition in an arm_feature check like the has_el3 property. That will > remove it from all cpu types that don't support it. Then there's no > need for the enable_pmu && !has_pmu check as the has_pmu part is covered > very early with the feature flag in arm_cpu_post_init(). Peter also > suggested we keep the 'has_pmu' name, rather than change it to > 'enable_pmu'. On that one I would disagree. 'has_pmu' indicates that the > feature is available at all, which it is to all cpu types that have the > arm feature, but not all users will want it enabled. 'enable_pmu', which > matches x86's naming, seems more appropriate for that. If you create the CPU with pmu=off then it does not have a PMU, and so has_pmu is false. I don't see any reason for the naming convention for the PMU to diverge from what we have for EL3 and for the MPU, where the property names and the struct fields both use 'has'. thanks -- PMM
Re: [Qemu-devel] [PATCH v4 01/11] block: Accept node-name for block-stream
On Thu 14 Jul 2016 03:28:04 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > block-stream to accept a node-name without lifting the restriction that > we're operating at a root node. > > In case of an invalid device name, the command returns the GenericError > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto
Re: [Qemu-devel] [PATCH RFC 1/1] arm64: add an option to turn on/off vpmu support
On Mon, 2016-08-01 at 15:08 +0200, Andrew Jones wrote: > > I'm not sure a warning is enough: if I start a guest and > > explicitly ask for a PMU, I expect it to be there, or for > > the guest not to start at all. How does x86 behave in this > > regard? > > Peter had a good suggestion for this. We need to wrap the property > addition in an arm_feature check like the has_el3 property. That will > remove it from all cpu types that don't support it. Wouldn't that mean that you'd be unable to use -cpu foo,pmu=off if CPU model 'foo' doesn't support a PMU? I'd expect that to work. I've played around with this a bit on x86 and it doesn't look like it necessarily behaves the way I'd expect it to, either, so maybe this is just a case of my expectations being unreasonable? :) -- Andrea Bolognani / Red Hat / Virtualization
Re: [Qemu-devel] [PATCH v4 02/11] block: Accept node-name for block-commit
On Thu 14 Jul 2016 03:28:05 PM CEST, Kevin Wolf wrote: > -blk = blk_by_name(device); > -if (!blk) { > -error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > - "Device '%s' not found", device); > +bs = qmp_get_root_bs(device, &local_err); > +if (!bs) { > +bs = bdrv_lookup_bs(device, device, NULL); > +if (!bs) { > +error_free(local_err); > +error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > + "Device '%s' not found", device); > +} else { > +error_propagate(errp, local_err); > +} > return; It seems that you're calling bdrv_lookup_bs() here twice, once in qmp_get_root_bs() and then again directly. If the purpose is to see whether the error is "device not found" or "device is not a root node" I think the code would be clearer if you do everything here. On a related note, you're keeping the DeviceNotFound error here, but not in block-stream. Wouldn't it be better to keep both APIs consistent? Berto
Re: [Qemu-devel] [PATCH RFC 1/1] arm64: add an option to turn on/off vpmu support
On 1 August 2016 at 14:26, Andrea Bolognani wrote: > On Mon, 2016-08-01 at 15:08 +0200, Andrew Jones wrote: >> > I'm not sure a warning is enough: if I start a guest and >> > explicitly ask for a PMU, I expect it to be there, or for >> > the guest not to start at all. How does x86 behave in this >> > regard? >> >> Peter had a good suggestion for this. We need to wrap the property >> addition in an arm_feature check like the has_el3 property. That will >> remove it from all cpu types that don't support it. > > Wouldn't that mean that you'd be unable to use > > -cpu foo,pmu=off > > if CPU model 'foo' doesn't support a PMU? I'd expect that > to work. The current precedent (has_el3) doesn't work like that: if foo isn't a CPU which can support EL3 then the property doesn't exist, and it's an error to try to set it. thanks -- PMM
Re: [Qemu-devel] [PATCH v4 04/11] block: Accept node-name for blockdev-mirror
On Thu 14 Jul 2016 03:28:07 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > blockdev-mirror to accept a node-name without lifting the restriction > that we're operating at a root node. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto
Re: [Qemu-devel] [PATCH v4 05/11] block: Accept node-name for blockdev-snapshot-delete-internal-sync
On Thu 14 Jul 2016 03:28:08 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > blockdev-snapshot-delete-internal-sync to accept a node-name without > lifting the restriction that we're operating at a root node. > > In case of an invalid device name, the command returns the GenericError > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto
Re: [Qemu-devel] [PATCH] virtio-blk: Remove stale comment about draining
On 08/01/16 04:53, Fam Zheng wrote: > This is stale after commit 6e40b3bf (virtio-blk: Use blk_drain() to > drain IO requests), remove it. > > Suggested-by: Laszlo Ersek > Signed-off-by: Fam Zheng > --- > hw/block/virtio-blk.c | 4 > 1 file changed, 4 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 89eca65..3468a21 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -656,10 +656,6 @@ static void virtio_blk_reset(VirtIODevice *vdev) > AioContext *ctx; > VirtIOBlockReq *req; > > -/* > - * This should cancel pending requests, but can't do nicely until there > - * are per-device request lists. > - */ > ctx = blk_get_aio_context(s->blk); > aio_context_acquire(ctx); > while (s->rq) { > The thing I mildly dislike about patches that consist purely of code removal is that they don't show up in "git blame", so it's hard to get credit for them :) Which is a shame, beacuse code deletion is the best kind of patch! :) Reviewed-by: Laszlo Ersek Cheers! Laszlo
Re: [Qemu-devel] [PATCH] util: Relax assertion in iov_copy()
On 25/07/2016 13:43, Shmulik Ladkani wrote: > From: Shmulik Ladkani > > In cases where iov_copy() is passed with zero 'bytes' argument and a > non-zero 'offset' argument, nothing gets copied - as expected. > > However since no copy iterations are performed, 'offset' is left > unaltered, leading to the final assert(offset == 0) to fail. > > Relax the assertion: if j (number of dst elements assigned) is zero, no > need to err. > > Only if j!=0 (some dst elements assigned) AND offset!=0 we should err. This is actually intended; the comment in qemu_iovec_concat_iov says why: assert(soffset == 0); /* offset beyond end of src */ so the pedantic fix could be (if I understand the issue correctly) to check for "offset || bytes" in the for condition. This is similar to what the other functions do (e.g. iov_from_buf_full). The performance effect should practically be absent. Paolo > Signed-off-by: Shmulik Ladkani > --- > util/iov.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Flow that led to the assertion was: > net_tx_pkt_rebuild_payload() > iov_copy(... , pkt->payload_len) > > where pkt->payload_len was correctly calculated to be 0 (a packet > carrying just ipv4 header, without any payload). > > An alternative is to place the below code, early in iov_copy(): > if (!bytes) > return 0; > > diff --git a/util/iov.c b/util/iov.c > index 003fcce..17de52d 100644 > --- a/util/iov.c > +++ b/util/iov.c > @@ -260,7 +260,7 @@ unsigned iov_copy(struct iovec *dst_iov, unsigned int > dst_iov_cnt, > bytes -= len; > offset = 0; > } > -assert(offset == 0); > +assert(j == 0 || offset == 0); > return j; > } > >
Re: [Qemu-devel] [PATCH] block/iscsi: Adding iser support in Libiscsi-QEMU
On 27/07/2016 12:02, Roy Shterman wrote: > iSER is a new transport layer supported in Libiscsi, > iSER provides a zero-copy RDMA capable interface that can > improve performance. > > New API is introduced in abstracion of the Libiscsi transport layer. > In order to use the new iSER transport, one need to add the ?iser option > at the end of Libiscsi URI. Hi, is it too late to use the URI scheme instead---for example iscsi+iser://.../... ? In any case this should not affect the QEMU bits. Paolo > For now iSER memory buffers are pre-allocated and pre-registered, > hence in order to work with iSER from QEMU, one need to enable MEMLOCK > attribute in the VM to be large enough for all iSER buffers and RDMA > resources. > > A new functionallity is also introduced in this commit, a new API > to deploy zero-copy command submission. iSER is differing from TCP in > data-path, hence IO vectors must be transferred already when queueing > the PDU. > > Signed-off-by: Roy Shterman > --- > block/iscsi.c | 45 + > 1 files changed, 41 insertions(+), 4 deletions(-) > > diff --git a/block/iscsi.c b/block/iscsi.c > index 7e78ade..6b95636 100644 > --- a/block/iscsi.c > +++ b/block/iscsi.c > @@ -41,6 +41,7 @@ > #include "qapi/qmp/qstring.h" > #include "crypto/secret.h" > > +#include "qemu/uri.h" > #include > #include > > @@ -484,6 +485,18 @@ iscsi_co_writev_flags(BlockDriverState *bs, int64_t > sector_num, int nb_sectors, > iscsi_co_init_iscsitask(iscsilun, &iTask); > retry: > if (iscsilun->use_16_for_rw) { > +#if LIBISCSI_API_VERSION >= (20160603) > +iTask.task = iscsi_write16_iov_task(iscsilun->iscsi, iscsilun->lun, > lba, > +NULL, num_sectors * > iscsilun->block_size, > +iscsilun->block_size, 0, 0, fua, > 0, 0, > +iscsi_co_generic_cb, &iTask, > (struct scsi_iovec *)iov->iov, iov->niov); > +} else { > +iTask.task = iscsi_write10_iov_task(iscsilun->iscsi, iscsilun->lun, > lba, > +NULL, num_sectors * > iscsilun->block_size, > +iscsilun->block_size, 0, 0, fua, > 0, 0, > +iscsi_co_generic_cb, &iTask, > (struct scsi_iovec *)iov->iov, iov->niov); > +} > +#else > iTask.task = iscsi_write16_task(iscsilun->iscsi, iscsilun->lun, lba, > NULL, num_sectors * > iscsilun->block_size, > iscsilun->block_size, 0, 0, fua, 0, > 0, > @@ -494,11 +507,14 @@ retry: > iscsilun->block_size, 0, 0, fua, 0, > 0, > iscsi_co_generic_cb, &iTask); > } > +#endif > if (iTask.task == NULL) { > return -ENOMEM; > } > +#if LIBISCSI_API_VERSION < (20160603) > scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov, >iov->niov); > +#endif > while (!iTask.complete) { > iscsi_set_events(iscsilun); > qemu_coroutine_yield(); > @@ -677,6 +693,19 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState > *bs, > iscsi_co_init_iscsitask(iscsilun, &iTask); > retry: > if (iscsilun->use_16_for_rw) { > +#if LIBISCSI_API_VERSION >= (20160603) > +iTask.task = iscsi_read16_iov_task(iscsilun->iscsi, iscsilun->lun, > lba, > + num_sectors * > iscsilun->block_size, > + iscsilun->block_size, 0, 0, 0, 0, > 0, > + iscsi_co_generic_cb, &iTask, > (struct scsi_iovec *)iov->iov, iov->niov); > +} else { > +iTask.task = iscsi_read10_iov_task(iscsilun->iscsi, iscsilun->lun, > lba, > + num_sectors * > iscsilun->block_size, > + iscsilun->block_size, > + 0, 0, 0, 0, 0, > + iscsi_co_generic_cb, &iTask, > (struct scsi_iovec *)iov->iov, iov->niov); > +} > +#else > iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba, > num_sectors * iscsilun->block_size, > iscsilun->block_size, 0, 0, 0, 0, 0, > @@ -688,11 +717,13 @@ retry: > 0, 0, 0, 0, 0, > iscsi_co_generic_cb, &iTask); > } > +#endif > if (iTask.task == NULL) { > return -ENOMEM; > } > +#if LIBISCSI_API_VERSION < (20160603) > scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, > iov->niov); > - > +#endif > while (!iTask.complete) { > iscsi_set_events(iscs
Re: [Qemu-devel] [PATCH] block/iscsi: Adding iser support in Libiscsi-QEMU
On 28/07/2016 10:45, Peter Lieven wrote: > > Furthermore I would suggest using LIBISCS_FEATURE_ISER and not the API > version in the > preprocessor commands. Actually I disagree with this suggestion. The new API could be used also if iSER is not used, can it? Thanks, Paolo
[Qemu-devel] [PATCH] MAINTAINERS: Add Host Memory Backends section
The hostmem code is closely related to the NUMA code, so I am willing to handle patches to those files and share the work with Igor (the original author of that code). Signed-off-by: Eduardo Habkost --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index d1439a8..5a9bef2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1177,6 +1177,13 @@ F: numa.c F: include/sysemu/numa.h T: git git://github.com/ehabkost/qemu.git numa +Host Memory Backends +M: Eduardo Habkost +M: Igor Mammedov +S: Maintained +F: backends/hostmem*.c +F: include/sysemu/hostmem.h + QAPI M: Markus Armbruster M: Michael Roth -- 2.5.5
Re: [Qemu-devel] [PATCH v4 06/11] block: Accept node-name for blockdev-snapshot-internal-sync
On Thu 14 Jul 2016 03:28:09 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > blockdev-snapshot-internal-sync to accept a node-name without lifting > the restriction that we're operating at a root node. > > In case of an invalid device name, the command returns the GenericError > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto
[Qemu-devel] [PATCH RFC] Addition of Veritas HyperScale VxHS block device support
This is a request to include a new block device protocol called vxhs in qemu. Following work items have been completed: (1) Rebase VxHS code to latest qemu master. (2) Removed all errors/warnings found by checkpatch.pl (3) Unit-tested qemu and qemu-io binaries to ensure that we are able to open a vxhs type vdisk and read/write to it. (4) Source code for the new network IO library (libqnio) that we use has been open sourced and can be downloaded from: https://github.com/MittalAshish/libqnio.git Ashish Mittal (1): block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support block/Makefile.objs |1 + block/vxhs.c| 1460 +++ block/vxhs.h| 355 + configure | 24 +- 4 files changed, 1839 insertions(+), 1 deletion(-) create mode 100644 block/vxhs.c create mode 100644 block/vxhs.h -- 2.5.5
[Qemu-devel] [PATCH RFC] block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support
This patch adds support for a new block device type called "vxhs". Source code for the library that this code loads can be downloaded from: https://github.com/MittalAshish/libqnio.git Signed-off-by: Ashish Mittal --- block/Makefile.objs |1 + block/vxhs.c| 1460 +++ block/vxhs.h| 355 + configure | 24 +- 4 files changed, 1839 insertions(+), 1 deletion(-) create mode 100644 block/vxhs.c create mode 100644 block/vxhs.h diff --git a/block/Makefile.objs b/block/Makefile.objs index 2593a2f..8ebda10 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -20,6 +20,7 @@ block-obj-$(CONFIG_RBD) += rbd.o block-obj-$(CONFIG_GLUSTERFS) += gluster.o block-obj-$(CONFIG_ARCHIPELAGO) += archipelago.o block-obj-$(CONFIG_LIBSSH2) += ssh.o +block-obj-$(CONFIG_VXHS) += vxhs.o block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o diff --git a/block/vxhs.c b/block/vxhs.c new file mode 100644 index 000..2949561 --- /dev/null +++ b/block/vxhs.c @@ -0,0 +1,1460 @@ +/* + * QEMU Block driver for Veritas HyperScale (VxHS) + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Please follow QEMU coding guidelines while modifying this file. + * The QEMU coding guidelines need to be followed because this driver has + * to be submitted to QEMU community in near futute and we want to prevent any + * reduce the amount of work at that time. + * QEMU coding guidelines can be found at : + * http://git.qemu-project.org/?p=qemu.git;a=blob_plain;f=CODING_STYLE;hb=HEAD + */ + +#include "vxhs.h" + +/* global variables (per-vm) */ +static QNIOOps qnioops; +static GModule *lib_qemuqnio_handle; + +/* qnio client ioapi_ctx */ +static void *global_qnio_ctx; + +/* insure init once */ +static pthread_mutex_t of_global_ctx_lock; + +/* HyperScale Driver Version */ +int vxhs_drv_version = 8895; + +/* + * Loading QNIO operation from qemuqnio library at run time. + * It loads only when first vxhs_open called for a vDisk + */ +int vxhs_load_iio_ops(void) +{ +int i = 0; + +LibQNIOSymbol qnio_symbols[] = { +{"qemu_iio_init", +(gpointer *) &qnioops.qemu_iio_init}, +{"qemu_open_iio_conn", +(gpointer *) &qnioops.qemu_open_iio_conn}, +{"qemu_iio_devopen", +(gpointer *) &qnioops.qemu_iio_devopen}, +{"qemu_iio_devclose", +(gpointer *) &qnioops.qemu_iio_devclose}, +{"qemu_iio_writev", +(gpointer *) &qnioops.qemu_iio_writev}, +{"qemu_iio_readv", +(gpointer *) &qnioops.qemu_iio_readv}, +{"qemu_iio_read", +(gpointer *) &qnioops.qemu_iio_read}, +{"qemu_iio_ioctl", +(gpointer *) &qnioops.qemu_iio_ioctl}, +{"qemu_iio_close", +(gpointer *) &qnioops.qemu_iio_close}, +{"qemu_iio_extract_msg_error", +(gpointer *) &qnioops.qemu_iio_extract_msg_error}, +{"qemu_iio_extract_msg_size", +(gpointer *) &qnioops.qemu_iio_extract_msg_size}, +{"qemu_iio_extract_msg_opcode", +(gpointer *) &qnioops.qemu_iio_extract_msg_opcode}, +{"qemu_initialize_lock", +(gpointer *) &qnioops.qemu_initialize_lock}, +{"qemu_spin_lock", +(gpointer *) &qnioops.qemu_spin_lock}, +{"qemu_spin_unlock", +(gpointer *) &qnioops.qemu_spin_unlock}, +{"qemu_destroy_lock", +(gpointer *) &qnioops.qemu_destroy_lock}, +{NULL} +}; + +if (!g_module_supported()) { +error_report("modules are not supported on this platform: %s", + g_module_error()); +return -EIO; +} + +lib_qemuqnio_handle = g_module_open("libqnioshim.so", 0); +if (!lib_qemuqnio_handle) { +error_report("error loading libqnioshim.so: %s", g_module_error()); +return -EIO; +} + +g_module_make_resident(lib_qemuqnio_handle); +while (qnio_symbols[i].name) { +const char *name = qnio_symbols[i].name; +if (!g_module_symbol(lib_qemuqnio_handle, name, qnio_symbols[i].addr)) { +error_report("%s could not be loaded from qnioops : %s", + name, g_module_error()); +return -EIO; +} +++i; +} +vxhsDbg("qnio ops loaded\n"); + +return 0; +} + +inline void vxhs_inc_acb_segment_count(void *ptr, int count) +{ +VXHSAIOCB *acb = (VXHSAIOCB *)ptr; +BDRVVXHSState *s = acb->common.bs->opaque; + +VXHS_SPIN_LOCK(s->vdisk_acb_lock); +acb->segments += count; +VXHS_SPIN_UNLOCK(s->vdisk_acb_lock); +} + +inline void vxhs_dec_acb_segment_count(void *ptr, int count) +{ +VXHSAIOCB *acb = (VXHSAIOCB *)ptr; +BDRVVXHSState *s = acb->common.bs->opaque; + +VXHS_SP
[Qemu-devel] [PATCH v3] x86: ioapic: add support for explicit EOI
Some old Linux kernels (upstream before v4.0), or any released RHEL kernels has problem in sending APIC EOI when IR is enabled. Meanwhile, many of them only support explicit EOI for IOAPIC, which is only introduced in IOAPIC version 0x20. This patch provide a way to boost QEMU IOAPIC to version 0x20, in order for QEMU to correctly receive EOI messages. Without boosting IOAPIC version to 0x20, kernels before commit d32932d ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") will have trouble enabling both IR and level-triggered interrupt devices (like e1000). To upgrade IOAPIC to version 0x20, we need to specify: -global ioapic.version=0x20 To be compatible with old systems, 0x11 will still be the default IOAPIC version. Here 0x11 and 0x20 are the only versions to be supported. One thing to mention: this patch only applies to emulated IOAPIC. It does not affect kernel IOAPIC behavior. Signed-off-by: Peter Xu --- hw/intc/ioapic.c | 22 +- include/hw/i386/ioapic_internal.h | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index 2d3282a..e8568d2 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "monitor/monitor.h" #include "hw/hw.h" #include "hw/i386/pc.h" @@ -265,7 +266,7 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size) val = s->id << IOAPIC_ID_SHIFT; break; case IOAPIC_REG_VER: -val = IOAPIC_VERSION | +val = s->version | ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); break; default: @@ -354,6 +355,13 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, } } break; +case IOAPIC_EOI: +/* Explicit EOI is only supported for IOAPIC version 0x20 */ +if (size != 4 || s->version != 0x20) { +break; +} +ioapic_eoi_broadcast(val); +break; } ioapic_update_kvm_routes(s); @@ -387,6 +395,12 @@ static void ioapic_realize(DeviceState *dev, Error **errp) { IOAPICCommonState *s = IOAPIC_COMMON(dev); +if (s->version != 0x11 && s->version != 0x20) { +error_report("IOAPIC only supports version 0x11 or 0x20 " + "(default: 0x11)."); +exit(1); +} + memory_region_init_io(&s->io_memory, OBJECT(s), &ioapic_io_ops, s, "ioapic", 0x1000); @@ -397,6 +411,11 @@ static void ioapic_realize(DeviceState *dev, Error **errp) qemu_add_machine_init_done_notifier(&s->machine_done); } +static Property ioapic_properties[] = { +DEFINE_PROP_UINT8("version", IOAPICCommonState, version, 0x11), +DEFINE_PROP_END_OF_LIST(), +}; + static void ioapic_class_init(ObjectClass *klass, void *data) { IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass); @@ -404,6 +423,7 @@ static void ioapic_class_init(ObjectClass *klass, void *data) k->realize = ioapic_realize; dc->reset = ioapic_reset_common; +dc->props = ioapic_properties; } static const TypeInfo ioapic_info = { diff --git a/include/hw/i386/ioapic_internal.h b/include/hw/i386/ioapic_internal.h index d89ea1b..a11d86d 100644 --- a/include/hw/i386/ioapic_internal.h +++ b/include/hw/i386/ioapic_internal.h @@ -29,8 +29,6 @@ #define MAX_IOAPICS 1 -#define IOAPIC_VERSION 0x11 - #define IOAPIC_LVT_DEST_SHIFT 56 #define IOAPIC_LVT_DEST_IDX_SHIFT 48 #define IOAPIC_LVT_MASKED_SHIFT 16 @@ -71,6 +69,7 @@ #define IOAPIC_IOREGSEL 0x00 #define IOAPIC_IOWIN0x10 +#define IOAPIC_EOI 0x40 #define IOAPIC_REG_ID 0x00 #define IOAPIC_REG_VER 0x01 @@ -109,6 +108,7 @@ struct IOAPICCommonState { uint32_t irr; uint64_t ioredtbl[IOAPIC_NUM_PINS]; Notifier machine_done; +uint8_t version; }; void ioapic_reset_common(DeviceState *dev); -- 2.7.4
Re: [Qemu-devel] [PATCH v2] x86: ioapic: conditionally upgrade IOAPIC version
On Mon, Aug 01, 2016 at 12:38:58PM +0200, Paolo Bonzini wrote: > > > On 26/07/2016 05:28, Peter Xu wrote: > > IOMMU IR and IOAPIC legacy devices (e.g., e1000) cannot work well > > together with some old Linux kernels (upstream before v4.0, or any > > released RHEL kernels). This patch fixes it. > > > > The problem is that: some old linux kernels (with IR enabled) only > > support IOAPIC chips with version 0x20. New kernels after commit d32932d > > ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") > > fixed this problem. To make sure we can work with even old kernels, > > let's upgrade our IOAPIC to version 0x20. > > > > To make sure we have minimum impact on old systems, IOAPIC version is > > only boosted to 0x20 when vIOMMU IR is enabled. Besides that, the old > > version 0x11 is used. > > I'd rather do this conditional only on the machine type, but as you > pointed out it's a bit late to change the default in QEMU 2.7. > Therefore, for 2.7 you could add a property to the IOAPIC device, and > document that you need "-global ioapic.version=0x20" for interrupt > remapping to work with Linux <= 4.0. QEMU 2.8 can then flip the default > for the new machine types. Yes, an property seems to be a better choice. V3 sent. Thanks! -- peterx
[Qemu-devel] [PATCH RFC] Addition of Veritas HyperScale VxHS block device support
This is a request to include a new block device protocol called vxhs in qemu. Following work items have been completed: (1) Rebase VxHS code to latest qemu master. (2) Removed all errors/warnings found by checkpatch.pl (3) Unit-tested qemu and qemu-io binaries to ensure that we are able to open a vxhs type vdisk and read/write to it. (4) Source code for the new network IO library (libqnio) that we use has been open sourced and can be downloaded from: https://github.com/MittalAshish/libqnio.git Ashish Mittal (1): block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support block/Makefile.objs |1 + block/vxhs.c| 1460 +++ block/vxhs.h| 355 + configure | 24 +- 4 files changed, 1839 insertions(+), 1 deletion(-) create mode 100644 block/vxhs.c create mode 100644 block/vxhs.h -- 2.5.5
Re: [Qemu-devel] [PATCH v4 08/11] block: Accept node-name for drive-backup
On Thu 14 Jul 2016 03:28:11 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > drive-backup and the corresponding transaction action to accept a > node-name without lifting the restriction that we're operating at a root > node. > > In case of an invalid device name, the command returns the GenericError > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto
Re: [Qemu-devel] [PATCH for 2.8?] x86: ioapic: ignore level irq during processing
On Mon, Aug 01, 2016 at 12:58:42PM +0200, Paolo Bonzini wrote: > > > On 31/07/2016 16:18, Peter Xu wrote: > > For level triggered interrupts, we will get Remote IRR bit cleared after > > guest kernel finished processing specific request. Before that, we > > should ignore the same interrupt from triggering again. > > > > Signed-off-by: Peter Xu > > --- > > > > I discovered this during debugging some IR issues. Only did very > > minimum test with e1000, but IIUC this should be the correct behavior > > for level triggered interrupts, and before that we might be sending > > some extra interrupts to guest (while we should not). > > > > hw/intc/ioapic.c | 10 -- > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c > > index 2d3282a..350f761 100644 > > --- a/hw/intc/ioapic.c > > +++ b/hw/intc/ioapic.c > > @@ -129,9 +129,15 @@ static void ioapic_service(IOAPICCommonState *s) > > } > > continue; > > } > > -#else > > -(void)coalesce; > > #endif > > + > > +if (coalesce) { > > +/* We are level triggered interrupts, and the > > + * guest should be still working on previous one, > > + * so skip it. */ > > +continue; > > +} > > + > > /* No matter whether IR is enabled, we translate > > * the IOAPIC message into a MSI one, and its > > * address space will decide whether we need a > > > > The patch is okay for 2.7, as it matches what is done in the KVM > split-irqchip case. Cool. It'll be nice to have it in 2.7 as well. Thanks, -- peterx
[Qemu-devel] [PATCH RFC] block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support
This patch adds support for a new block device type called "vxhs". Source code for the library that this code loads can be downloaded from: https://github.com/MittalAshish/libqnio.git Signed-off-by: Ashish Mittal --- block/Makefile.objs |1 + block/vxhs.c| 1460 +++ block/vxhs.h| 355 + configure | 24 +- 4 files changed, 1839 insertions(+), 1 deletion(-) create mode 100644 block/vxhs.c create mode 100644 block/vxhs.h diff --git a/block/Makefile.objs b/block/Makefile.objs index 2593a2f..8ebda10 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -20,6 +20,7 @@ block-obj-$(CONFIG_RBD) += rbd.o block-obj-$(CONFIG_GLUSTERFS) += gluster.o block-obj-$(CONFIG_ARCHIPELAGO) += archipelago.o block-obj-$(CONFIG_LIBSSH2) += ssh.o +block-obj-$(CONFIG_VXHS) += vxhs.o block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o diff --git a/block/vxhs.c b/block/vxhs.c new file mode 100644 index 000..2949561 --- /dev/null +++ b/block/vxhs.c @@ -0,0 +1,1460 @@ +/* + * QEMU Block driver for Veritas HyperScale (VxHS) + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Please follow QEMU coding guidelines while modifying this file. + * The QEMU coding guidelines need to be followed because this driver has + * to be submitted to QEMU community in near futute and we want to prevent any + * reduce the amount of work at that time. + * QEMU coding guidelines can be found at : + * http://git.qemu-project.org/?p=qemu.git;a=blob_plain;f=CODING_STYLE;hb=HEAD + */ + +#include "vxhs.h" + +/* global variables (per-vm) */ +static QNIOOps qnioops; +static GModule *lib_qemuqnio_handle; + +/* qnio client ioapi_ctx */ +static void *global_qnio_ctx; + +/* insure init once */ +static pthread_mutex_t of_global_ctx_lock; + +/* HyperScale Driver Version */ +int vxhs_drv_version = 8895; + +/* + * Loading QNIO operation from qemuqnio library at run time. + * It loads only when first vxhs_open called for a vDisk + */ +int vxhs_load_iio_ops(void) +{ +int i = 0; + +LibQNIOSymbol qnio_symbols[] = { +{"qemu_iio_init", +(gpointer *) &qnioops.qemu_iio_init}, +{"qemu_open_iio_conn", +(gpointer *) &qnioops.qemu_open_iio_conn}, +{"qemu_iio_devopen", +(gpointer *) &qnioops.qemu_iio_devopen}, +{"qemu_iio_devclose", +(gpointer *) &qnioops.qemu_iio_devclose}, +{"qemu_iio_writev", +(gpointer *) &qnioops.qemu_iio_writev}, +{"qemu_iio_readv", +(gpointer *) &qnioops.qemu_iio_readv}, +{"qemu_iio_read", +(gpointer *) &qnioops.qemu_iio_read}, +{"qemu_iio_ioctl", +(gpointer *) &qnioops.qemu_iio_ioctl}, +{"qemu_iio_close", +(gpointer *) &qnioops.qemu_iio_close}, +{"qemu_iio_extract_msg_error", +(gpointer *) &qnioops.qemu_iio_extract_msg_error}, +{"qemu_iio_extract_msg_size", +(gpointer *) &qnioops.qemu_iio_extract_msg_size}, +{"qemu_iio_extract_msg_opcode", +(gpointer *) &qnioops.qemu_iio_extract_msg_opcode}, +{"qemu_initialize_lock", +(gpointer *) &qnioops.qemu_initialize_lock}, +{"qemu_spin_lock", +(gpointer *) &qnioops.qemu_spin_lock}, +{"qemu_spin_unlock", +(gpointer *) &qnioops.qemu_spin_unlock}, +{"qemu_destroy_lock", +(gpointer *) &qnioops.qemu_destroy_lock}, +{NULL} +}; + +if (!g_module_supported()) { +error_report("modules are not supported on this platform: %s", + g_module_error()); +return -EIO; +} + +lib_qemuqnio_handle = g_module_open("libqnioshim.so", 0); +if (!lib_qemuqnio_handle) { +error_report("error loading libqnioshim.so: %s", g_module_error()); +return -EIO; +} + +g_module_make_resident(lib_qemuqnio_handle); +while (qnio_symbols[i].name) { +const char *name = qnio_symbols[i].name; +if (!g_module_symbol(lib_qemuqnio_handle, name, qnio_symbols[i].addr)) { +error_report("%s could not be loaded from qnioops : %s", + name, g_module_error()); +return -EIO; +} +++i; +} +vxhsDbg("qnio ops loaded\n"); + +return 0; +} + +inline void vxhs_inc_acb_segment_count(void *ptr, int count) +{ +VXHSAIOCB *acb = (VXHSAIOCB *)ptr; +BDRVVXHSState *s = acb->common.bs->opaque; + +VXHS_SPIN_LOCK(s->vdisk_acb_lock); +acb->segments += count; +VXHS_SPIN_UNLOCK(s->vdisk_acb_lock); +} + +inline void vxhs_dec_acb_segment_count(void *ptr, int count) +{ +VXHSAIOCB *acb = (VXHSAIOCB *)ptr; +BDRVVXHSState *s = acb->common.bs->opaque; + +VXHS_SP
Re: [Qemu-devel] [PATCH] vhost: don't set vring call if no vector
On Mon, Aug 01, 2016 at 04:07:58PM +0800, Jason Wang wrote: > We used to set vring call fd unconditionally even if guest driver does > not use MSIX for this vritqueue at all. This will cause lots of > unnecessary userspace access and other checks for drivers does not use > interrupt at all (e.g virtio-net pmd). So check and clean vring call > fd if guest does not use any vector for this virtqueue at > all. > > Perf diffs (on rx) shows lots of cpus wasted on vhost_signal() were saved: > > # > 28.12% -27.82% [vhost] [k] vhost_signal > 14.44% -1.69% [kernel.vmlinux] [k] copy_user_generic_string > 7.05% +1.53% [kernel.vmlinux] [k] __free_page_frag > 6.51% +5.53% [vhost] [k] vhost_get_vq_desc > ... > > Pktgen tests shows 15.8% improvement on rx pps and 6.5% on tx pps. > > Before: RX 2.08Mpps TX 1.35Mpps > After: RX 2.41Mpps TX 1.44Mpps > > Signed-off-by: Jason Wang > --- > hw/virtio/vhost.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 3d0c807..bd051ab 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -822,6 +822,9 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, > struct vhost_virtqueue *vq, > unsigned idx) > { > +BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); > +VirtioBusState *vbus = VIRTIO_BUS(qbus); > +VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); > hwaddr s, l, a; > int r; > int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx); > @@ -912,8 +915,19 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, > vhost_virtqueue_mask(dev, vdev, idx, false); > } > > +if (k->query_guest_notifiers && > +k->query_guest_notifiers(qbus->parent) && > +virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) { > +file.fd = -1; > +r = dev->vhost_ops->vhost_set_vring_call(dev, &file); > +if (r) { > +goto fail_vector; > +} > +} > + It's rather asymmetrical though. Wouldn't a better place be in vhost_virtqueue_mask? > return 0; > > +fail_vector: > fail_kick: > fail_alloc: > cpu_physical_memory_unmap(vq->ring, virtio_queue_get_ring_size(vdev, > idx), > -- > 2.7.4
Re: [Qemu-devel] [PATCH v4 07/11] block: Accept node-name for change-backing-file
On Thu 14 Jul 2016 03:28:10 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > change-backing-file to accept a node-name without lifting the > restriction that we're operating at a root node. > > In case of an invalid device name, the command returns the GenericError > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto
Re: [Qemu-devel] [PATCH] MAINTAINERS: Add Host Memory Backends section
On Mon, 1 Aug 2016 10:52:42 -0300 Eduardo Habkost wrote: > The hostmem code is closely related to the NUMA code, so I am > willing to handle patches to those files and share the work with > Igor (the original author of that code). > > Signed-off-by: Eduardo Habkost > --- > MAINTAINERS | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index d1439a8..5a9bef2 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1177,6 +1177,13 @@ F: numa.c > F: include/sysemu/numa.h > T: git git://github.com/ehabkost/qemu.git numa > > +Host Memory Backends > +M: Eduardo Habkost > +M: Igor Mammedov > +S: Maintained > +F: backends/hostmem*.c > +F: include/sysemu/hostmem.h > + > QAPI > M: Markus Armbruster > M: Michael Roth Acked-by: Igor Mammedov
Re: [Qemu-devel] [PATCH] block/iscsi: Adding iser support in Libiscsi-QEMU
On 8/1/2016 4:52 PM, Paolo Bonzini wrote: On 28/07/2016 10:45, Peter Lieven wrote: Furthermore I would suggest using LIBISCS_FEATURE_ISER and not the API version in the preprocessor commands. Actually I disagree with this suggestion. The new API could be used also if iSER is not used, can it? Yes, this is a new API to do zero-copy in TCP and iSER. Thanks, Paolo
Re: [Qemu-devel] [PATCH] Fix bsd-user build errors after 8642c1b81e0418df066a7960a7426d85a923a253
On 29 July 2016 at 17:02, Sean Bruno wrote: > LINK sparc-bsd-user/qemu-sparc > bsd-user/main.o: In function `cpu_loop': > /home/sbruno/bsd/qemu/bsd-user/main.c:515: undefined reference to > `cpu_sparc_exec' > c++: error: linker command failed with exit code 1 (use -v to see invocation) > gmake[1]: *** [Makefile:197: qemu-sparc] Error 1 > gmake: *** [Makefile:204: subdir-sparc-bsd-user] Error 2 > > LINK i386-bsd-user/qemu-i386 > bsd-user/main.o: In function `cpu_loop': > /home/sbruno/bsd/qemu/bsd-user/main.c:174: undefined reference to > `cpu_x86_exec' > c++: error: linker command failed with exit code 1 (use -v to see invocation) > gmake[1]: *** [Makefile:197: qemu-i386] Error 1 > gmake: *** [Makefile:204: subdir-i386-bsd-user] Error 2 > > Signed-off-by: Sean Bruno Applied to master, thanks. -- PMM
Re: [Qemu-devel] [PATCH v1 1/1] MAINTAINERS: Update the Xilinx maintainers
On 28 July 2016 at 17:55, Alistair Francis wrote: > Update the Xilinx maintainers documentation to simplify what we maintain > and cover all of our upstream code. > > Signed-off-by: Alistair Francis Mailing list seems not to have got this one second time around either -- maybe some spam filter dislikes the content for some reason. Anyway, applied to master. thanks -- PMM > --- > > MAINTAINERS | 30 ++ > 1 file changed, 14 insertions(+), 16 deletions(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 1d0e2c3..14183d3 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -449,23 +449,23 @@ S: Maintained > F: hw/*/versatile* > > Xilinx Zynq > +M: Edgar E. Iglesias > M: Alistair Francis > -M: Peter Crosthwaite > L: qemu-...@nongnu.org > S: Maintained > -F: hw/arm/xilinx_zynq.c > -F: hw/misc/zynq_slcr.c > +F: hw/*/xilinx_* > F: hw/*/cadence_* > -F: hw/ssi/xilinx_spips.c > +F: hw/misc/zynq_slcr.c > +F: include/hw/xilinx.h > +X: hw/ssi/xilinx_* > > Xilinx ZynqMP > M: Alistair Francis > -M: Peter Crosthwaite > +M: Edgar E. Iglesias > L: qemu-...@nongnu.org > S: Maintained > -F: hw/arm/xlnx-zynqmp.c > -F: hw/arm/xlnx-ep108.c > -F: include/hw/arm/xlnx-zynqmp.h > +F: hw/*/xlnx*.c > +F: include/hw/*/xlnx*.c > > ARM ACPI Subsystem > M: Shannon Zhao > @@ -948,14 +948,6 @@ S: Supported > F: hw/scsi/megasas.c > F: hw/scsi/mfi.h > > -Xilinx EDK > -M: Edgar E. Iglesias > -M: Alistair Francis > -M: Peter Crosthwaite > -S: Maintained > -F: hw/*/xilinx_* > -F: include/hw/xilinx.h > - > Network packet abstractions > M: Dmitry Fleytman > S: Maintained > @@ -1243,6 +1235,12 @@ F: docs/*qmp-* > F: scripts/qmp/ > T: git git://repo.or.cz/qemu/armbru.git qapi-next > > +Register API > +M: Alistair Francis > +S: Maintained > +F: hw/core/register.c > +F: include/hw/register.h > + > SLIRP > M: Samuel Thibault > M: Jan Kiszka > -- > 2.7.4
Re: [Qemu-devel] [PATCH] MAINTAINERS: Add Host Memory Backends section
Eduardo Habkost writes: > The hostmem code is closely related to the NUMA code, so I am > willing to handle patches to those files and share the work with > Igor (the original author of that code). > > Signed-off-by: Eduardo Habkost Thanks, Eduardo! Reviewed-by: Markus Armbruster
Re: [Qemu-devel] [PATCH v3] x86: ioapic: add support for explicit EOI
On Mon, 1 Aug 2016 21:59:19 +0800 Peter Xu wrote: > Some old Linux kernels (upstream before v4.0), or any released RHEL > kernels has problem in sending APIC EOI when IR is enabled. Meanwhile, > many of them only support explicit EOI for IOAPIC, which is only > introduced in IOAPIC version 0x20. This patch provide a way to boost s/provide/provides/ > QEMU IOAPIC to version 0x20, in order for QEMU to correctly receive EOI > messages. > > Without boosting IOAPIC version to 0x20, kernels before commit d32932d > ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces") > will have trouble enabling both IR and level-triggered interrupt devices > (like e1000). > > To upgrade IOAPIC to version 0x20, we need to specify: > > -global ioapic.version=0x20 > > To be compatible with old systems, 0x11 will still be the default IOAPIC > version. Here 0x11 and 0x20 are the only versions to be supported. Is there a reason not to default to 0x20 for new machine types and set 2.6 and older machine types to 0x11? > > One thing to mention: this patch only applies to emulated IOAPIC. It > does not affect kernel IOAPIC behavior. ^^^ which is ? > > Signed-off-by: Peter Xu > --- > hw/intc/ioapic.c | 22 +- > include/hw/i386/ioapic_internal.h | 4 ++-- > 2 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c > index 2d3282a..e8568d2 100644 > --- a/hw/intc/ioapic.c > +++ b/hw/intc/ioapic.c > @@ -21,6 +21,7 @@ > */ > > #include "qemu/osdep.h" > +#include "qemu/error-report.h" > #include "monitor/monitor.h" > #include "hw/hw.h" > #include "hw/i386/pc.h" > @@ -265,7 +266,7 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int > size) > val = s->id << IOAPIC_ID_SHIFT; > break; > case IOAPIC_REG_VER: > -val = IOAPIC_VERSION | > +val = s->version | > ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); > break; > default: > @@ -354,6 +355,13 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, > } > } > break; > +case IOAPIC_EOI: > +/* Explicit EOI is only supported for IOAPIC version 0x20 */ > +if (size != 4 || s->version != 0x20) { > +break; > +} > +ioapic_eoi_broadcast(val); > +break; > } > > ioapic_update_kvm_routes(s); > @@ -387,6 +395,12 @@ static void ioapic_realize(DeviceState *dev, Error > **errp) > { > IOAPICCommonState *s = IOAPIC_COMMON(dev); > > +if (s->version != 0x11 && s->version != 0x20) { > +error_report("IOAPIC only supports version 0x11 or 0x20 " > + "(default: 0x11)."); probably no need to say what's default here. > +exit(1); For erro handling realize() typically calls error_setg() + error_propagate() instead of directly error_report() + exit() It should work in this case as well as the caller ioapic_init_gsi()->qdev_init_nofail() will terminate QEMU is "realize" = true fails. > +} > + > memory_region_init_io(&s->io_memory, OBJECT(s), &ioapic_io_ops, s, >"ioapic", 0x1000); > > @@ -397,6 +411,11 @@ static void ioapic_realize(DeviceState *dev, Error > **errp) > qemu_add_machine_init_done_notifier(&s->machine_done); > } > > +static Property ioapic_properties[] = { > +DEFINE_PROP_UINT8("version", IOAPICCommonState, version, 0x11), > +DEFINE_PROP_END_OF_LIST(), > +}; > + > static void ioapic_class_init(ObjectClass *klass, void *data) > { > IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass); > @@ -404,6 +423,7 @@ static void ioapic_class_init(ObjectClass *klass, void > *data) > > k->realize = ioapic_realize; > dc->reset = ioapic_reset_common; > +dc->props = ioapic_properties; > } > > static const TypeInfo ioapic_info = { > diff --git a/include/hw/i386/ioapic_internal.h > b/include/hw/i386/ioapic_internal.h > index d89ea1b..a11d86d 100644 > --- a/include/hw/i386/ioapic_internal.h > +++ b/include/hw/i386/ioapic_internal.h > @@ -29,8 +29,6 @@ > > #define MAX_IOAPICS 1 > > -#define IOAPIC_VERSION 0x11 > - > #define IOAPIC_LVT_DEST_SHIFT 56 > #define IOAPIC_LVT_DEST_IDX_SHIFT 48 > #define IOAPIC_LVT_MASKED_SHIFT 16 > @@ -71,6 +69,7 @@ > > #define IOAPIC_IOREGSEL 0x00 > #define IOAPIC_IOWIN0x10 > +#define IOAPIC_EOI 0x40 > > #define IOAPIC_REG_ID 0x00 > #define IOAPIC_REG_VER 0x01 > @@ -109,6 +108,7 @@ struct IOAPICCommonState { > uint32_t irr; > uint64_t ioredtbl[IOAPIC_NUM_PINS]; > Notifier machine_done; > +uint8_t version; > }; > > void ioapic_reset_common(DeviceState *dev);
Re: [Qemu-devel] [PATCH v3] x86: ioapic: add support for explicit EOI
On 01/08/2016 16:43, Igor Mammedov wrote: > > To be compatible with old systems, 0x11 will still be the default IOAPIC > > version. Here 0x11 and 0x20 are the only versions to be supported. > > Is there a reason not to default to 0x20 for new machine types and > set 2.6 and older machine types to 0x11? See discussion in v2. It's just for safety, what you just said is indeed the plan for 2.8. This patch already provides the necessary infrastructure. Paolo