Re: [Qemu-devel] [PATCH v2] target-cris: Fix buffer overflow
On Fri, Sep 07, 2012 at 10:36:08PM +0200, Stefan Weil wrote: > Report from smatch: > > target-cris/translate.c:3464 cpu_dump_state(32) error: > buffer overflow 'env->sregs' 4 <= 255 > > sregs is declared 'uint32_t sregs[4][16]', so the first index must be > less than 4 or ARRAY_SIZE(env->sregs). Thanks Stefan, applied > > Signed-off-by: Stefan Weil > --- > > I did not fix tabs, therefore checkpatch.pl reports an error. > > Changes in V2: > > * Use ARRAY_SIZE (suggested by Edgar). > > target-cris/translate.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/target-cris/translate.c b/target-cris/translate.c > index 1ad9ec7..34c0452 100644 > --- a/target-cris/translate.c > +++ b/target-cris/translate.c > @@ -3458,7 +3458,7 @@ void cpu_dump_state (CPUCRISState *env, FILE *f, > fprintf_function cpu_fprintf, > } > srs = env->pregs[PR_SRS]; > cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs); > - if (srs < 256) { > + if (srs < ARRAY_SIZE(env->sregs)) { > for (i = 0; i < 16; i++) { > cpu_fprintf(f, "s%2.2d=%8.8x ", > i, env->sregs[srs][i]); > -- > 1.7.10 >
Re: [Qemu-devel] QEMU (no kvm) Win7 (64bit) boot error
Am 08.09.2012 02:48, schrieb Clemens Kolbitsch: Hi guys, I need to run Win7 64bit in Qemu without KVM support. I found a few messages concerning the "unsupported architecture" problem (Windows shows a BSOD with "STOP 0x005D ..." on boot), for example http://lists.gnu.org/archive/html/qemu-devel/2011-03/msg01623.html or http://permalink.gmane.org/gmane.comp.emulators.qemu/92457 but I don't think there was ever a solution to the problem - at least what is proposed does not work (I've tried stable and GIT versions). Since I have a decent background of modifying the Qemu internals, I'm more than happy to contribute to solving this issue, but I'm not sure if anyone is currently working on it (i.e., I don't want to start at 0 in case someone is about to release a patch). Please let me know if there is already a know solution/workaround or whoever might be working on it, please ping me so we can sync. BTW, in case this is necessary, here are the details of what I need/what is not working: Qemu: current git-trunk, x86_64-softmmu$ ./qemu-system-x86_64 --version QEMU emulator version 1.2.50, Copyright (c) 2003-2008 Fabrice Bellard host: 64bit, Ubuntu LTS12.04 guest: 64bit Windows 7, no KVM possible Thanks! -Clemens Hi Clemens, AFAIK, nobody is working on this issue which exists for a long time now. It would be great if you could find a solution to make QEMU without KVM work with Windows guests. Regards, Stefan W. PS: It's QEMU, not Qemu. I modified the subject in my reply :-)
Re: [Qemu-devel] [PATCH 18/21] target-cris: switch to AREG0 free mode
> > > case 6: > > > > > > Similarly to what I reported for the microblaze and sh4 target, I think > > > we should not start using cpu_single_env (a global variable) to replace > > > env (a global variable stored in a register). > > > > > > It is possible to pass env through the subroutine, though it is more > > > complicated there than for other targets. I have therefore done the work > > > and I have attached the two resulting patches to this mail. > > > > Hi Aurelien! > > > > I agree with your comment and change. The indentation looks a bit odd > > here though. The CRISv32 port used tabs when written but some patches > > have made it in that used space, so it's become a bit of a mess. Maybe > > it's time to convert it to the QEMU codingstyle? > > Yes, I tried to make script/checkpatch.pl happy as I know Blue Swirl > really care about that. > > > From my point of view, I think we should either keep the tabs or change > > the whole file for 4 space indent. > > > > I've got nothing against applying your patch as is and then on top of that > > the mechanical untabification, to avoid extra work on your side. > > > > As you prefer, I can also provide the same patches with tabs instead. OK, please keep your patch and when it's applied I'll put an untabification on top. Cheers, Edgar
[Qemu-devel] buildbot failure in qemu on block_mingw32
The Buildbot has detected a new failure on builder block_mingw32 while building qemu. Full details are available at: http://buildbot.b1-systems.de/qemu/builders/block_mingw32/builds/318 Buildbot URL: http://buildbot.b1-systems.de/qemu/ Buildslave for this Build: kraxel_rhel61 Build Reason: The Nightly scheduler named 'nightly_block' triggered this build Build Source Stamp: [branch block] HEAD Blamelist: BUILD FAILED: failed compile sincerely, -The Buildbot
[Qemu-devel] Qemu (no kvm) Win7 (64bit) boot error
Hi guys, I need to run Win7 64bit in Qemu without KVM support. I found a few messages concerning the "unsupported architecture" problem (Windows shows a BSOD with "STOP 0x005D ..." on boot), for example http://lists.gnu.org/archive/html/qemu-devel/2011-03/msg01623.html or http://permalink.gmane.org/gmane.comp.emulators.qemu/92457 but I don't think there was ever a solution to the problem - at least what is proposed does not work (I've tried stable and GIT versions). Since I have a decent background of modifying the Qemu internals, I'm more than happy to contribute to solving this issue, but I'm not sure if anyone is currently working on it (i.e., I don't want to start at 0 in case someone is about to release a patch). Please let me know if there is already a know solution/workaround or whoever might be working on it, please ping me so we can sync. BTW, in case this is necessary, here are the details of what I need/what is not working: Qemu: current git-trunk, x86_64-softmmu$ ./qemu-system-x86_64 --version QEMU emulator version 1.2.50, Copyright (c) 2003-2008 Fabrice Bellard host: 64bit, Ubuntu LTS12.04 guest: 64bit Windows 7, no KVM possible Thanks! -Clemens
Re: [Qemu-devel] [PATCH v2] target-mips: Implement Loongson Multimedia Instructions
On Fri, Mar 30, 2012 at 01:13:13PM -0400, Richard Henderson wrote: > Implements all of the COP2 instructions except for the S > family of comparisons. The documentation is unclear for those. > > Signed-off-by: Richard Henderson > --- > > v2: Rebased vs master. > > Makefile.target |3 + > target-mips/helper.h | 59 > target-mips/lmi_helper.c | 744 > ++ > target-mips/translate.c | 372 +++- > 4 files changed, 1176 insertions(+), 2 deletions(-) > create mode 100644 target-mips/lmi_helper.c > > diff --git a/Makefile.target b/Makefile.target > index 44b2e83..35ca860 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -99,6 +99,9 @@ endif > libobj-$(TARGET_SPARC) += int32_helper.o > libobj-$(TARGET_SPARC64) += int64_helper.o > libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o > +ifeq ($(TARGET_BASE_ARCH), mips) > +libobj-y += lmi_helper.o > +endif > > libobj-y += disas.o > libobj-$(CONFIG_TCI_DIS) += tci-dis.o > diff --git a/target-mips/helper.h b/target-mips/helper.h > index 76fb451..15db21e 100644 > --- a/target-mips/helper.h > +++ b/target-mips/helper.h > @@ -297,4 +297,63 @@ DEF_HELPER_0(rdhwr_ccres, tl) > DEF_HELPER_1(pmon, void, int) > DEF_HELPER_0(wait, void) > > +/* Loongson multimedia functions. */ > +DEF_HELPER_FLAGS_2(paddsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(paddush, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(paddh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(paddw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(paddsb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(paddusb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(paddb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(psubsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psubush, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psubh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psubw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psubsb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psubusb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psubb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(pshufh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(packsswh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(packsshb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(packushb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(punpcklhw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(punpckhhw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(punpcklbh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(punpckhbh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(punpcklwd, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(punpckhwd, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(pavgh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pavgb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pmaxsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pminsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pmaxub, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pminub, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(pcmpeqw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pcmpgtw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pcmpeqh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pcmpgth, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pcmpeqb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pcmpgtb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(psllw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psllh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psrlw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psrlh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psraw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(psrah, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(pmullh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pmulhh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pmulhuh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > +DEF_HELPER_FLAGS_2(pmaddhw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64) > + > +DEF_HELPER_FLAGS_2(pasubub, TC
Re: [Qemu-devel] [PATCH 13/22] add visitor for parsing hz[KMG] input string
Don Slutz wrote: On 09/07/12 18:47, Igor Mammedov wrote: On Fri, 7 Sep 2012 18:12:00 -0400 Don Slutz wrote: On 09/07/12 16:55, Igor Mammedov wrote: Signed-off-by: Igor Mammedov Acked-by: Andreas Färber -- v2: * replaced _hz suffix for frequency visitor by _freq suffix suggested-by: Andreas Färber * fixed typo & extra space spotted-by: Andreas Färber --- qapi/qapi-visit-core.c | 11 +++ qapi/qapi-visit-core.h | 2 ++ qapi/string-input-visitor.c | 22 ++ 3 files changed, 35 insertions(+) diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 7a82b63..5c8705e 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -311,3 +311,14 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[], g_free(enum_str); *obj = value; } + +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp) +{ +if (!error_is_set(errp)) { +if (v->type_freq) { +v->type_freq(v, obj, name, errp); +} else { +v->type_int(v, obj, name, errp); +} +} +} diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h index 60aceda..e5e7dd7 100644 --- a/qapi/qapi-visit-core.h +++ b/qapi/qapi-visit-core.h @@ -62,6 +62,7 @@ struct Visitor void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); +void (*type_freq)(Visitor *v, int64_t *obj, const char *name, Error **errp); }; void visit_start_handle(Visitor *v, void **obj, const char *kind, @@ -91,5 +92,6 @@ void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp); #endif diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 497eb9a..47d2a84 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -110,6 +110,27 @@ static void parse_start_optional(Visitor *v, bool *present, *present = true; } +static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, +Error **errp) +{ +StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); +char *endp = (char *) siv->string; +long long val; I get: cc1: warnings being treated as errors qapi/string-input-visitor.c: In function 'parse_type_freq': qapi/string-input-visitor.c:118: error: 'val' may be used uninitialized in this function make: *** [qapi/string-input-visitor.o] Error 1 make: *** Waiting for unfinished jobs FC17 with default configure settings doesn't complain. And I really do not see how it could be. Which the change: diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 47d2a84..74fe395 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -115,7 +115,7 @@ static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, { StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); char *endp = (char *) siv->string; -long long val; +long long val = 0; errno = 0; if (siv->string) { Fixes it for me. + +errno = 0; +if (siv->string) { +val = strtosz_suffix_unit(siv->string, &endp, + STRTOSZ_DEFSUFFIX_B, 1000); +} +if (!siv->string || val == -1 || *endp) { I am using CentOS 6.3 so a different compiler. This is the line that has the issue. If !siv->string is true the 1st if does not set val. val is then checked for -1. Opps, This is not correct. I was going too fast. After more thought, I will agree that C says that val will not be used un-initialized. So it looks to me like a compiler bug. Since the warning says "val' may be used uninitialized.." gcc is "not" reporting a real coding error. This all said, I think the extra init of val (to 0 or -1) is better then requiring a compiler upgrade. +error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, + "a value representable as a non-negative int64"); +return; +} + +*obj = val; +} + Visitor *string_input_get_visitor(StringInputVisitor *v) { return &v->visitor; @@ -132,6 +153,7 @@ StringInputVisitor *string_input_visitor_new(const char *str) v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_optional = parse_start_optional; +v->visitor.type_freq = parse_type_freq; v->string = str; return v; -Don Slutz
Re: [Qemu-devel] [PATCH] MIPS/user: Fix reset CPU state initialization
On Fri, Jun 08, 2012 at 02:04:40AM +0100, Maciej W. Rozycki wrote: > > This change updates the CPU reset sequence to use a common piece of code > that figures out CPU state flags, fixing the problem with MIPS_HFLAG_COP1X > not being set where applicable that causes floating-point MADD family > instructions (and other instructions from the MIPS IV FP subset) to trap. > > As compute_hflags is now shared between op_helper.c and translate.c, the > function is now moved to a common header. There are no changes to this > function. > > The problem was seen with the 24Kf MIPS32r2 processor in user emulation. > The new approach prevents system and user emulation from diverging -- all > the hflags state is initialized in one place now. > > Signed-off-by: Maciej W. Rozycki > --- > > This is effectively a follow-up to Nathan's FCR0 fix -- please apply. > > Maciej Thanks, applied. > qemu-mips-hflags.patch > Index: qemu-git-trunk/target-mips/cpu.h > === > --- qemu-git-trunk.orig/target-mips/cpu.h 2012-06-07 03:15:53.645461055 > +0100 > +++ qemu-git-trunk/target-mips/cpu.h 2012-06-07 03:18:48.345427587 +0100 > @@ -753,4 +753,53 @@ static inline void cpu_pc_from_tb(CPUMIP > env->hflags |= tb->flags & MIPS_HFLAG_BMASK; > } > > +static inline void compute_hflags(CPUMIPSState *env) > +{ > +env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | > + MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | > + MIPS_HFLAG_UX); > +if (!(env->CP0_Status & (1 << CP0St_EXL)) && > +!(env->CP0_Status & (1 << CP0St_ERL)) && > +!(env->hflags & MIPS_HFLAG_DM)) { > +env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; > +} > +#if defined(TARGET_MIPS64) > +if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) || > +(env->CP0_Status & (1 << CP0St_PX)) || > +(env->CP0_Status & (1 << CP0St_UX))) { > +env->hflags |= MIPS_HFLAG_64; > +} > +if (env->CP0_Status & (1 << CP0St_UX)) { > +env->hflags |= MIPS_HFLAG_UX; > +} > +#endif > +if ((env->CP0_Status & (1 << CP0St_CU0)) || > +!(env->hflags & MIPS_HFLAG_KSU)) { > +env->hflags |= MIPS_HFLAG_CP0; > +} > +if (env->CP0_Status & (1 << CP0St_CU1)) { > +env->hflags |= MIPS_HFLAG_FPU; > +} > +if (env->CP0_Status & (1 << CP0St_FR)) { > +env->hflags |= MIPS_HFLAG_F64; > +} > +if (env->insn_flags & ISA_MIPS32R2) { > +if (env->active_fpu.fcr0 & (1 << FCR0_F64)) { > +env->hflags |= MIPS_HFLAG_COP1X; > +} > +} else if (env->insn_flags & ISA_MIPS32) { > +if (env->hflags & MIPS_HFLAG_64) { > +env->hflags |= MIPS_HFLAG_COP1X; > +} > +} else if (env->insn_flags & ISA_MIPS4) { > +/* All supported MIPS IV CPUs use the XX (CU3) to enable > + and disable the MIPS IV extensions to the MIPS III ISA. > + Some other MIPS IV CPUs ignore the bit, so the check here > + would be too restrictive for them. */ > +if (env->CP0_Status & (1 << CP0St_CU3)) { > +env->hflags |= MIPS_HFLAG_COP1X; > +} > +} > +} > + > #endif /* !defined (__MIPS_CPU_H__) */ > Index: qemu-git-trunk/target-mips/op_helper.c > === > --- qemu-git-trunk.orig/target-mips/op_helper.c 2012-06-07 > 03:15:53.645461055 +0100 > +++ qemu-git-trunk/target-mips/op_helper.c2012-06-07 03:18:48.345427587 > +0100 > @@ -32,55 +32,6 @@ > static inline void cpu_mips_tlb_flush (CPUMIPSState *env, int flush_global); > #endif > > -static inline void compute_hflags(CPUMIPSState *env) > -{ > -env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | > - MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU | > - MIPS_HFLAG_UX); > -if (!(env->CP0_Status & (1 << CP0St_EXL)) && > -!(env->CP0_Status & (1 << CP0St_ERL)) && > -!(env->hflags & MIPS_HFLAG_DM)) { > -env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU; > -} > -#if defined(TARGET_MIPS64) > -if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) || > -(env->CP0_Status & (1 << CP0St_PX)) || > -(env->CP0_Status & (1 << CP0St_UX))) { > -env->hflags |= MIPS_HFLAG_64; > -} > -if (env->CP0_Status & (1 << CP0St_UX)) { > -env->hflags |= MIPS_HFLAG_UX; > -} > -#endif > -if ((env->CP0_Status & (1 << CP0St_CU0)) || > -!(env->hflags & MIPS_HFLAG_KSU)) { > -env->hflags |= MIPS_HFLAG_CP0; > -} > -if (env->CP0_Status & (1 << CP0St_CU1)) { > -env->hflags |= MIPS_HFLAG_FPU; > -} > -if (env->CP0_Status & (1 << CP0St_FR)) { > -env->hflags |= MIPS_HFLAG_F64; > -} > -if (env->insn_flags & ISA_MIPS32R2) { > -if (env->active_fpu.fcr0
[Qemu-devel] buildbot failure in qemu on default_x86_64_rhel61
The Buildbot has detected a new failure on builder default_x86_64_rhel61 while building qemu. Full details are available at: http://buildbot.b1-systems.de/qemu/builders/default_x86_64_rhel61/builds/369 Buildbot URL: http://buildbot.b1-systems.de/qemu/ Buildslave for this Build: kraxel_rhel61 Build Reason: The Nightly scheduler named 'nightly_default' triggered this build Build Source Stamp: [branch master] HEAD Blamelist: BUILD FAILED: failed test sincerely, -The Buildbot
[Qemu-devel] [Bug 1047576] [NEW] qemu unittest emulator failure on latest git master
Public bug reported: Running the emulator unittest, using the cmdline: 16:01:30 INFO | Running emulator 16:01:30 INFO | Running qemu command (reformatted): 16:01:30 INFO | /home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 16:01:30 INFO | -S 16:01:30 INFO | -name 'unittest_vm' 16:01:30 INFO | -nodefaults 16:01:30 INFO | -chardev socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 16:01:30 INFO | -chardev socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 16:01:30 INFO | -chardev socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 16:01:30 INFO | -m 512 16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 16:01:30 INFO | -kernel '/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat' 16:01:30 INFO | -vnc :0 16:01:30 INFO | -chardev file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 16:01:30 INFO | -device testdev,chardev=testlog 16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none 16:01:30 INFO | -boot order=cdn,once=c,menu=off 16:01:30 INFO | -S 16:01:30 INFO | -enable-kvm We get 16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, output in /tmp/testlog-20120907-155940-WomlFZY3 16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1 16:01:32 INFO | [qemu output] emulation failure 16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 RCX=f000 RDX=0044d2b0 16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 RBP=eff8 RSP=0044d2b0 16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 R10= R11= 16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 R14=1fff5000 R15= 16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] CPL=0 II=0 A20=1 SMM=0 HLT=0 16:01:32 INFO | [qemu output] ES =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] CS =0008 00a09b00 DPL=0 CS64 [-RA] 16:01:32 INFO | [qemu output] SS = 16:01:32 INFO | [qemu output] DS =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] FS =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] GS =0010 0044c370 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] LDT= 8200 DPL=0 LDT 16:01:32 INFO | [qemu output] TR =0048 0040a452 8b00 DPL=0 TSS64-busy 16:01:32 INFO | [qemu output] GDT= 0040a00a 0447 16:01:32 INFO | [qemu output] IDT= 0fff 16:01:32 INFO | [qemu output] CR0=80010011 CR2= CR3=1000 CR4=0020 16:01:32 INFO | [qemu output] DR0= DR1= DR2= DR3= 16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400 16:01:32 INFO | [qemu output] EFER=0500 16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 48 89 e9 48 89 c5 48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 40 0f 94 c6 40 0f b6 f6 21 c6 More logs will be attached to this bug report. ** Affects: qemu Importance: Undecided Status: New ** Tags: unittest -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1047576 Title: qemu unittest emulator failure on latest git master Status in QEMU: New Bug description: Running the emulator unittest, using the cmdline: 16:01:30 INFO | Running emulator 16:01:30 INFO | Running qemu command (reformatted): 16:01:30 INFO | /home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 16:01:30 INFO | -S 16:01:30 INFO | -name 'unittest_vm' 16:01:30 INFO | -nodefaults 16:01:30 INFO | -chardev socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 16:01:30 INFO | -chardev socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 16:01:30 INFO | -chardev socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907
[Qemu-devel] [Bug 1047576] Re: qemu unittest emulator failure on latest git master
** Attachment added: "results.tar.bz2" https://bugs.launchpad.net/bugs/1047576/+attachment/3299328/+files/results.tar.bz2 -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1047576 Title: qemu unittest emulator failure on latest git master Status in QEMU: New Bug description: Running the emulator unittest, using the cmdline: 16:01:30 INFO | Running emulator 16:01:30 INFO | Running qemu command (reformatted): 16:01:30 INFO | /home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 16:01:30 INFO | -S 16:01:30 INFO | -name 'unittest_vm' 16:01:30 INFO | -nodefaults 16:01:30 INFO | -chardev socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 16:01:30 INFO | -chardev socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 16:01:30 INFO | -chardev socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 16:01:30 INFO | -m 512 16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 16:01:30 INFO | -kernel '/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat' 16:01:30 INFO | -vnc :0 16:01:30 INFO | -chardev file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 16:01:30 INFO | -device testdev,chardev=testlog 16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none 16:01:30 INFO | -boot order=cdn,once=c,menu=off 16:01:30 INFO | -S 16:01:30 INFO | -enable-kvm We get 16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, output in /tmp/testlog-20120907-155940-WomlFZY3 16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1 16:01:32 INFO | [qemu output] emulation failure 16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 RCX=f000 RDX=0044d2b0 16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 RBP=eff8 RSP=0044d2b0 16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 R10= R11= 16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 R14=1fff5000 R15= 16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] CPL=0 II=0 A20=1 SMM=0 HLT=0 16:01:32 INFO | [qemu output] ES =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] CS =0008 00a09b00 DPL=0 CS64 [-RA] 16:01:32 INFO | [qemu output] SS = 16:01:32 INFO | [qemu output] DS =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] FS =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] GS =0010 0044c370 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] LDT= 8200 DPL=0 LDT 16:01:32 INFO | [qemu output] TR =0048 0040a452 8b00 DPL=0 TSS64-busy 16:01:32 INFO | [qemu output] GDT= 0040a00a 0447 16:01:32 INFO | [qemu output] IDT= 0fff 16:01:32 INFO | [qemu output] CR0=80010011 CR2= CR3=1000 CR4=0020 16:01:32 INFO | [qemu output] DR0= DR1= DR2= DR3= 16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400 16:01:32 INFO | [qemu output] EFER=0500 16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 48 89 e9 48 89 c5 48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 40 0f 94 c6 40 0f b6 f6 21 c6 More logs will be attached to this bug report. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1047576/+subscriptions
[Qemu-devel] [Bug 1047576] Re: qemu unittest emulator failure on latest git master
Adding relevant qemu and unittest versions software_version_qemu_kvm=git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git:master:4c3e02beed9878a5f760eeceb6cd42c475cf0127 software_version_kvm_unit_tests=git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git:master:09b657b6d3a80d0424b8b370462a77d284117926 -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1047576 Title: qemu unittest emulator failure on latest git master Status in QEMU: New Bug description: Running the emulator unittest, using the cmdline: 16:01:30 INFO | Running emulator 16:01:30 INFO | Running qemu command (reformatted): 16:01:30 INFO | /home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 16:01:30 INFO | -S 16:01:30 INFO | -name 'unittest_vm' 16:01:30 INFO | -nodefaults 16:01:30 INFO | -chardev socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 16:01:30 INFO | -chardev socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 16:01:30 INFO | -chardev socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait 16:01:30 INFO | -device isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 16:01:30 INFO | -m 512 16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 16:01:30 INFO | -kernel '/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat' 16:01:30 INFO | -vnc :0 16:01:30 INFO | -chardev file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 16:01:30 INFO | -device testdev,chardev=testlog 16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none 16:01:30 INFO | -boot order=cdn,once=c,menu=off 16:01:30 INFO | -S 16:01:30 INFO | -enable-kvm We get 16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, output in /tmp/testlog-20120907-155940-WomlFZY3 16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1 16:01:32 INFO | [qemu output] emulation failure 16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 RCX=f000 RDX=0044d2b0 16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 RBP=eff8 RSP=0044d2b0 16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 R10= R11= 16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 R14=1fff5000 R15= 16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] CPL=0 II=0 A20=1 SMM=0 HLT=0 16:01:32 INFO | [qemu output] ES =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] CS =0008 00a09b00 DPL=0 CS64 [-RA] 16:01:32 INFO | [qemu output] SS = 16:01:32 INFO | [qemu output] DS =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] FS =0010 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] GS =0010 0044c370 00c09300 DPL=0 DS [-WA] 16:01:32 INFO | [qemu output] LDT= 8200 DPL=0 LDT 16:01:32 INFO | [qemu output] TR =0048 0040a452 8b00 DPL=0 TSS64-busy 16:01:32 INFO | [qemu output] GDT= 0040a00a 0447 16:01:32 INFO | [qemu output] IDT= 0fff 16:01:32 INFO | [qemu output] CR0=80010011 CR2= CR3=1000 CR4=0020 16:01:32 INFO | [qemu output] DR0= DR1= DR2= DR3= 16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400 16:01:32 INFO | [qemu output] EFER=0500 16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 48 89 e9 48 89 c5 48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 40 0f 94 c6 40 0f b6 f6 21 c6 More logs will be attached to this bug report. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1047576/+subscriptions
Re: [Qemu-devel] [PATCH] iSCSI: We need to support SG_IO also from iscsi_ioctl()
ping? On Thu, Aug 30, 2012 at 5:28 PM, Ronnie Sahlberg wrote: > We need to support SG_IO from the synchronous iscsi_ioctl() since > scsi-block uses this to do an INQ to the device to discover its properties > This patch makes scsi-block work with iscsi. > > Signed-off-by: Ronnie Sahlberg > --- > block/iscsi.c | 20 +++- > 1 files changed, 19 insertions(+), 1 deletions(-) > > diff --git a/block/iscsi.c b/block/iscsi.c > index 355ce65..189ab6f 100644 > --- a/block/iscsi.c > +++ b/block/iscsi.c > @@ -537,7 +537,8 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int > status, > > #define SG_ERR_DRIVER_SENSE0x08 > > -if (status == SCSI_STATUS_CHECK_CONDITION && acb->task->datain.size >= > 2) { > +if (status == SCSI_STATUS_CHECK_CONDITION > +&& acb->task->datain.size >= 2) { > int ss; > > acb->ioh->driver_status |= SG_ERR_DRIVER_SENSE; > @@ -622,9 +623,17 @@ static BlockDriverAIOCB > *iscsi_aio_ioctl(BlockDriverState *bs, > return &acb->common; > } > > + > +static void ioctl_cb(void *opaque, int status) > +{ > +int *p_status = opaque; > +*p_status = status; > +} > + > static int iscsi_ioctl(BlockDriverState *bs, unsigned long int req, void > *buf) > { > IscsiLun *iscsilun = bs->opaque; > +int status; > > switch (req) { > case SG_GET_VERSION_NUM: > @@ -633,6 +642,15 @@ static int iscsi_ioctl(BlockDriverState *bs, unsigned > long int req, void *buf) > case SG_GET_SCSI_ID: > ((struct sg_scsi_id *)buf)->scsi_type = iscsilun->type; > break; > +case SG_IO: > +status = -EINPROGRESS; > +iscsi_aio_ioctl(bs, req, buf, ioctl_cb, &status); > + > +while (status == -EINPROGRESS) { > +qemu_aio_wait(); > +} > + > +return 0; > default: > return -1; > } > -- > 1.7.3.1 >
[Qemu-devel] [Bug 1047470] [NEW] qemu/kvm hangs reading from serial console
Public bug reported: This is for a qemu-kvm running on RHEL 5, so it's pretty old, but i think the problem still exists in 1.2 We have conman running on our hosts, connecting to the kvm/qemu's using virsh console which just opens up the console /dev/pts/slave that qemu opens up when run with options -nographic -serial mon:pty Sometimes virsh console exits and then qemu locks up. My guess is that something like this happens: virsh console exits qemu does a select() on /dev/ptmx (and other FDs) select() returns the FD of /dev/ptmx in the read-fdset qemu does a read() read() returns -1 (EIO) qemu does other stuff for a while select() ... /dev/ptmx read() .. EIO other stuff select() ... read() ... select() ... read() ... select() conman starts a new virsh console that connects qemu does a read() read() blocks b/c there is now a writer on the tty slave So i don't see any way around this, given the sorta rudi- mentary semantics of TTY IO on Linux (not that i know of any platform that does it better ... ?), except ... maybe qemu should fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) in qemu-char.c:qemu_char_open_pty() and be prepared to handle E_WOULDBLOCK|E_AGAIN in qemu-char.c:fd_chr_read() ... ? --buck [*] i think, b/c in the old version we are running, sometimes the guest spits out the ^] character to its console, and virsh console reads it and doesn't check to see if its from stdin or the pty and exits, which, i think, can be fixed like this: --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix 2012-09-06 10:30:43.606997191 -0400 +++ libvirt-0.8.2/tools/console.c 2012-09-06 10:34:52.154000464 -0400 @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) { /* Quit if end of file, or we got the Ctrl-] key */ if (!got || +fds[i].fd == STDIN_FILENO && (got == 1 && buf[0] == CTRL_CLOSE_BRACKET)) goto done; ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1047470 Title: qemu/kvm hangs reading from serial console Status in QEMU: New Bug description: This is for a qemu-kvm running on RHEL 5, so it's pretty old, but i think the problem still exists in 1.2 We have conman running on our hosts, connecting to the kvm/qemu's using virsh console which just opens up the console /dev/pts/slave that qemu opens up when run with options -nographic -serial mon:pty Sometimes virsh console exits and then qemu locks up. My guess is that something like this happens: virsh console exits qemu does a select() on /dev/ptmx (and other FDs) select() returns the FD of /dev/ptmx in the read-fdset qemu does a read() read() returns -1 (EIO) qemu does other stuff for a while select() ... /dev/ptmx read() .. EIO other stuff select() ... read() ... select() ... read() ... select() conman starts a new virsh console that connects qemu does a read() read() blocks b/c there is now a writer on the tty slave So i don't see any way around this, given the sorta rudi- mentary semantics of TTY IO on Linux (not that i know of any platform that does it better ... ?), except ... maybe qemu should fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) in qemu-char.c:qemu_char_open_pty() and be prepared to handle E_WOULDBLOCK|E_AGAIN in qemu-char.c:fd_chr_read() ... ? --buck [*] i think, b/c in the old version we are running, sometimes the guest spits out the ^] character to its console, and virsh console reads it and doesn't check to see if its from stdin or the pty and exits, which, i think, can be fixed like this: --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix 2012-09-06 10:30:43.606997191 -0400 +++ libvirt-0.8.2/tools/console.c 2012-09-06 10:34:52.154000464 -0400 @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) { /* Quit if end of file, or we got the Ctrl-] key */ if (!got || +fds[i].fd == STDIN_FILENO && (got == 1 && buf[0] == CTRL_CLOSE_BRACKET)) goto done; To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1047470/+subscriptions
[Qemu-devel] [Bug 1047470] Re: qemu/kvm hangs reading from serial console
** Description changed: This is for a qemu-kvm running on RHEL 5, so it's pretty old, but i think the problem still exists in 1.2 We have conman running on our hosts, connecting to the kvm/qemu's using - virsh console + virsh console which just opens up the console /dev/pts/slave that qemu opens up when run with options - -nographic - -serial mon:pty + -nographic + -serial mon:pty - Sometimes virsh console exits and then qemu locks up. + Sometimes virsh console exits and then qemu locks up[*]. My guess is that something like this happens: virsh console exits qemu does a select() on /dev/ptmx (and other FDs) select() returns the FD of /dev/ptmx in the read-fdset qemu does a read() read() returns -1 (EIO) qemu does other stuff for a while select() ... /dev/ptmx read() .. EIO other stuff select() ... read() ... select() ... read() ... select() conman starts a new virsh console that connects qemu does a read() read() blocks b/c there is now a writer on the tty slave So i don't see any way around this, given the sorta rudi- mentary semantics of TTY IO on Linux (not that i know of any platform that does it better ... ?), except ... maybe qemu should - fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) + fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) in qemu-char.c:qemu_char_open_pty() - and be prepared to handle E_WOULDBLOCK|E_AGAIN in + and be prepared to handle E_WOULDBLOCK|E_AGAIN in qemu-char.c:fd_chr_read() ... ? --buck [*] i think, b/c in the old version we are running, sometimes - the guest spits out the - ^] - character to its console, and virsh console reads it and - doesn't check to see if its from stdin or the pty and exits, - which, i think, can be fixed like this: + the guest spits out the + ^] + character to its console, and virsh console reads it and + doesn't check to see if its from stdin or the pty and exits, + which, i think, can be fixed like this: --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix 2012-09-06 10:30:43.606997191 -0400 +++ libvirt-0.8.2/tools/console.c 2012-09-06 10:34:52.154000464 -0400 @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) { - /* Quit if end of file, or we got the Ctrl-] key */ - if (!got || + /* Quit if end of file, or we got the Ctrl-] key */ + if (!got || +fds[i].fd == STDIN_FILENO && - (got == 1 && - buf[0] == CTRL_CLOSE_BRACKET)) - goto done; + (got == 1 && + buf[0] == CTRL_CLOSE_BRACKET)) + goto done; -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1047470 Title: qemu/kvm hangs reading from serial console Status in QEMU: New Bug description: This is for a qemu-kvm running on RHEL 5, so it's pretty old, but i think the problem still exists in 1.2 We have conman running on our hosts, connecting to the kvm/qemu's using virsh console which just opens up the console /dev/pts/slave that qemu opens up when run with options -nographic -serial mon:pty Sometimes virsh console exits and then qemu locks up[*]. My guess is that something like this happens: virsh console exits qemu does a select() on /dev/ptmx (and other FDs) select() returns the FD of /dev/ptmx in the read-fdset qemu does a read() read() returns -1 (EIO) qemu does other stuff for a while select() ... /dev/ptmx read() .. EIO other stuff select() ... read() ... select() ... read() ... select() conman starts a new virsh console that connects qemu does a read() read() blocks b/c there is now a writer on the tty slave So i don't see any way around this, given the sorta rudi- mentary semantics of TTY IO on Linux (not that i know of any platform that does it better ... ?), except ... maybe qemu should fcntl(master_fd, F_SETFL, flags | O_NONBLOCK) in qemu-char.c:qemu_char_open_pty() and be prepared to handle E_WOULDBLOCK|E_AGAIN in qemu-char.c:fd_chr_read() ... ? --buck [*] i think, b/c in the old version we are running, sometimes the guest spits out the ^] character to its console, and virsh console reads it and doesn't check to see if its from stdin or the pty and exits, which, i think, can be fixed like this: --- libvirt-0.8.2/tools/console.c.ctrl_close_bracket_handling_fix 2012-09-06 10:30:43.606997191 -0400 +++ libvirt-0.8.2/tools/console.c 2012-09-06 10:34:52.154000464 -0400 @@ -155,6 +155,7 @@ int vshRunConsole(const char *tty) { /* Quit if end of file, or we got the Ctrl-] key */ if (!got || +
Re: [Qemu-devel] [PATCH] iSCSI: We dont need to explicitely call qemu_notify_event() any more
Ping? On Thu, Aug 30, 2012 at 4:56 PM, Ronnie Sahlberg wrote: > We no longer need to explicitely call qemu_notify_event() any more since this > is now done automatically any time the filehandles we listen to change. > > Signed-off-by: Ronnie Sahlberg > --- > block/iscsi.c |6 -- > 1 files changed, 0 insertions(+), 6 deletions(-) > > diff --git a/block/iscsi.c b/block/iscsi.c > index 0b96165..355ce65 100644 > --- a/block/iscsi.c > +++ b/block/iscsi.c > @@ -167,12 +167,6 @@ iscsi_set_events(IscsiLun *iscsilun) > > } > > -/* If we just added an event, the callback might be delayed > - * unless we call qemu_notify_event(). > - */ > -if (ev & ~iscsilun->events) { > -qemu_notify_event(); > -} > iscsilun->events = ev; > } > > -- > 1.7.3.1 >
Re: [Qemu-devel] [PATCH 13/22] add visitor for parsing hz[KMG] input string
On 09/07/12 18:47, Igor Mammedov wrote: On Fri, 7 Sep 2012 18:12:00 -0400 Don Slutz wrote: On 09/07/12 16:55, Igor Mammedov wrote: Signed-off-by: Igor Mammedov Acked-by: Andreas Färber -- v2: * replaced _hz suffix for frequency visitor by _freq suffix suggested-by: Andreas Färber * fixed typo & extra space spotted-by: Andreas Färber --- qapi/qapi-visit-core.c | 11 +++ qapi/qapi-visit-core.h | 2 ++ qapi/string-input-visitor.c | 22 ++ 3 files changed, 35 insertions(+) diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 7a82b63..5c8705e 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -311,3 +311,14 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[], g_free(enum_str); *obj = value; } + +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp) +{ +if (!error_is_set(errp)) { +if (v->type_freq) { +v->type_freq(v, obj, name, errp); +} else { +v->type_int(v, obj, name, errp); +} +} +} diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h index 60aceda..e5e7dd7 100644 --- a/qapi/qapi-visit-core.h +++ b/qapi/qapi-visit-core.h @@ -62,6 +62,7 @@ struct Visitor void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); +void (*type_freq)(Visitor *v, int64_t *obj, const char *name, Error **errp); }; void visit_start_handle(Visitor *v, void **obj, const char *kind, @@ -91,5 +92,6 @@ void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp); #endif diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 497eb9a..47d2a84 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -110,6 +110,27 @@ static void parse_start_optional(Visitor *v, bool *present, *present = true; } +static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, +Error **errp) +{ +StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); +char *endp = (char *) siv->string; +long long val; I get: cc1: warnings being treated as errors qapi/string-input-visitor.c: In function 'parse_type_freq': qapi/string-input-visitor.c:118: error: 'val' may be used uninitialized in this function make: *** [qapi/string-input-visitor.o] Error 1 make: *** Waiting for unfinished jobs FC17 with default configure settings doesn't complain. And I really do not see how it could be. Which the change: diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 47d2a84..74fe395 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -115,7 +115,7 @@ static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, { StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); char *endp = (char *) siv->string; -long long val; +long long val = 0; errno = 0; if (siv->string) { Fixes it for me. + +errno = 0; +if (siv->string) { +val = strtosz_suffix_unit(siv->string, &endp, + STRTOSZ_DEFSUFFIX_B, 1000); +} +if (!siv->string || val == -1 || *endp) { I am using CentOS 6.3 so a different compiler. This is the line that has the issue. If !siv->string is true the 1st if does not set val. val is then checked for -1. +error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, + "a value representable as a non-negative int64"); +return; +} + +*obj = val; +} + Visitor *string_input_get_visitor(StringInputVisitor *v) { return &v->visitor; @@ -132,6 +153,7 @@ StringInputVisitor *string_input_visitor_new(const char *str) v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_optional = parse_start_optional; +v->visitor.type_freq = parse_type_freq; v->string = str; return v; -Don Slutz -Don Slutz
Re: [Qemu-devel] [PATCH 13/22] add visitor for parsing hz[KMG] input string
On Fri, 7 Sep 2012 18:12:00 -0400 Don Slutz wrote: > On 09/07/12 16:55, Igor Mammedov wrote: > > Signed-off-by: Igor Mammedov > > Acked-by: Andreas Färber > > -- > > v2: > >* replaced _hz suffix for frequency visitor by _freq suffix > > suggested-by: Andreas Färber > >* fixed typo & extra space spotted-by: Andreas Färber > > --- > > qapi/qapi-visit-core.c | 11 +++ > > qapi/qapi-visit-core.h | 2 ++ > > qapi/string-input-visitor.c | 22 ++ > > 3 files changed, 35 insertions(+) > > > > diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c > > index 7a82b63..5c8705e 100644 > > --- a/qapi/qapi-visit-core.c > > +++ b/qapi/qapi-visit-core.c > > @@ -311,3 +311,14 @@ void input_type_enum(Visitor *v, int *obj, const char > > *strings[], > > g_free(enum_str); > > *obj = value; > > } > > + > > +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error > > **errp) > > +{ > > +if (!error_is_set(errp)) { > > +if (v->type_freq) { > > +v->type_freq(v, obj, name, errp); > > +} else { > > +v->type_int(v, obj, name, errp); > > +} > > +} > > +} > > diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h > > index 60aceda..e5e7dd7 100644 > > --- a/qapi/qapi-visit-core.h > > +++ b/qapi/qapi-visit-core.h > > @@ -62,6 +62,7 @@ struct Visitor > > void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error > > **errp); > > /* visit_type_size() falls back to (*type_uint64)() if type_size is > > unset */ > > void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error > > **errp); > > +void (*type_freq)(Visitor *v, int64_t *obj, const char *name, Error > > **errp); > > }; > > > > void visit_start_handle(Visitor *v, void **obj, const char *kind, > > @@ -91,5 +92,6 @@ void visit_type_size(Visitor *v, uint64_t *obj, const > > char *name, Error **errp); > > void visit_type_bool(Visitor *v, bool *obj, const char *name, Error > > **errp); > > void visit_type_str(Visitor *v, char **obj, const char *name, Error > > **errp); > > void visit_type_number(Visitor *v, double *obj, const char *name, Error > > **errp); > > +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error > > **errp); > > > > #endif > > diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c > > index 497eb9a..47d2a84 100644 > > --- a/qapi/string-input-visitor.c > > +++ b/qapi/string-input-visitor.c > > @@ -110,6 +110,27 @@ static void parse_start_optional(Visitor *v, bool > > *present, > > *present = true; > > } > > > > +static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, > > +Error **errp) > > +{ > > +StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); > > +char *endp = (char *) siv->string; > > +long long val; > I get: > > cc1: warnings being treated as errors > qapi/string-input-visitor.c: In function 'parse_type_freq': > qapi/string-input-visitor.c:118: error: 'val' may be used uninitialized > in this function > make: *** [qapi/string-input-visitor.o] Error 1 > make: *** Waiting for unfinished jobs FC17 with default configure settings doesn't complain. And I really do not see how it could be. > Which the change: > > > diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c > index 47d2a84..74fe395 100644 > --- a/qapi/string-input-visitor.c > +++ b/qapi/string-input-visitor.c > @@ -115,7 +115,7 @@ static void parse_type_freq(Visitor *v, int64_t > *obj, const char *name, > { > StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); > char *endp = (char *) siv->string; > -long long val; > +long long val = 0; > errno = 0; > if (siv->string) { > > Fixes it for me. > > > + > > +errno = 0; > > +if (siv->string) { > > +val = strtosz_suffix_unit(siv->string, &endp, > > + STRTOSZ_DEFSUFFIX_B, 1000); > > +} > > +if (!siv->string || val == -1 || *endp) { > > +error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, > > + "a value representable as a non-negative int64"); > > +return; > > +} > > + > > +*obj = val; > > +} > > + > > Visitor *string_input_get_visitor(StringInputVisitor *v) > > { > > return &v->visitor; > > @@ -132,6 +153,7 @@ StringInputVisitor *string_input_visitor_new(const char > > *str) > > v->visitor.type_str = parse_type_str; > > v->visitor.type_number = parse_type_number; > > v->visitor.start_optional = parse_start_optional; > > +v->visitor.type_freq = parse_type_freq; > > > > v->string = str; > > return v; >-Don Slutz -- Regards, Igor
Re: [Qemu-devel] [PATCH 13/22] add visitor for parsing hz[KMG] input string
On 09/07/12 16:55, Igor Mammedov wrote: Signed-off-by: Igor Mammedov Acked-by: Andreas Färber -- v2: * replaced _hz suffix for frequency visitor by _freq suffix suggested-by: Andreas Färber * fixed typo & extra space spotted-by: Andreas Färber --- qapi/qapi-visit-core.c | 11 +++ qapi/qapi-visit-core.h | 2 ++ qapi/string-input-visitor.c | 22 ++ 3 files changed, 35 insertions(+) diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 7a82b63..5c8705e 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -311,3 +311,14 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[], g_free(enum_str); *obj = value; } + +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp) +{ +if (!error_is_set(errp)) { +if (v->type_freq) { +v->type_freq(v, obj, name, errp); +} else { +v->type_int(v, obj, name, errp); +} +} +} diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h index 60aceda..e5e7dd7 100644 --- a/qapi/qapi-visit-core.h +++ b/qapi/qapi-visit-core.h @@ -62,6 +62,7 @@ struct Visitor void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); +void (*type_freq)(Visitor *v, int64_t *obj, const char *name, Error **errp); }; void visit_start_handle(Visitor *v, void **obj, const char *kind, @@ -91,5 +92,6 @@ void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp); #endif diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 497eb9a..47d2a84 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -110,6 +110,27 @@ static void parse_start_optional(Visitor *v, bool *present, *present = true; } +static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, +Error **errp) +{ +StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); +char *endp = (char *) siv->string; +long long val; I get: cc1: warnings being treated as errors qapi/string-input-visitor.c: In function 'parse_type_freq': qapi/string-input-visitor.c:118: error: 'val' may be used uninitialized in this function make: *** [qapi/string-input-visitor.o] Error 1 make: *** Waiting for unfinished jobs Which the change: diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 47d2a84..74fe395 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -115,7 +115,7 @@ static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, { StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); char *endp = (char *) siv->string; -long long val; +long long val = 0; errno = 0; if (siv->string) { Fixes it for me. + +errno = 0; +if (siv->string) { +val = strtosz_suffix_unit(siv->string, &endp, + STRTOSZ_DEFSUFFIX_B, 1000); +} +if (!siv->string || val == -1 || *endp) { +error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, + "a value representable as a non-negative int64"); +return; +} + +*obj = val; +} + Visitor *string_input_get_visitor(StringInputVisitor *v) { return &v->visitor; @@ -132,6 +153,7 @@ StringInputVisitor *string_input_visitor_new(const char *str) v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_optional = parse_start_optional; +v->visitor.type_freq = parse_type_freq; v->string = str; return v; -Don Slutz
Re: [Qemu-devel] [PATCH 18/22] target-i386: parse cpu_model string into set of stringified properties
On 09/07/12 16:55, Igor Mammedov wrote: cpu_model string does represent features in following format: ([+-]feat)|(feat=foo)|(feat) which makes it impossible directly use property infrastructure to set features on CPU. This patch introduces parser that splits CPU name from cpu_model and converts legacy features string into canonized set of strings that is compatible with property manipulation infrastructure. PS: * later it could be used as a hook to convert legacy command line features to global properties. Then marked as deprecated and removed with -cpu option in the future. * compiler complains that it's unused function but I guess it is easier for review this way Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 52 1 file changed, 52 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0543e62..2c9cd6b 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1332,6 +1332,58 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) env->cpuid_xlevel2 = def->xlevel2; } +/* convert legacy cpumodel string to string cpu_name and + * a uniforms set of custom features that will be applied to CPU + * using object_property_parse() + */ +static void compat_normalize_cpu_model(const char *cpu_model, char **cpu_name, +QDict **features, Error **errp) +{ + +char *s = g_strdup(cpu_model); +char *featurestr, *sptr; + +*cpu_name = strtok_r(s, ",", &sptr); I get: cc1: warnings being treated as errors /root/qemu-cpu-v2/target-i386/cpu.c: In function 'cpu_x86_register': /root/qemu-cpu-v2/target-i386/cpu.c:1341: error: 'sptr' may be used uninitialized in this function /root/qemu-cpu-v2/target-i386/cpu.c:1341: note: 'sptr' was declared here And the change: diff --git a/target-i386/cpu.c b/target-i386/cpu.c index e7964a3..af50a8f 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1338,7 +1338,7 @@ static void compat_normalize_cpu_model(const char *cpu_model, char **cpu_name, { char *s = g_strdup(cpu_model); -char *featurestr, *sptr; +char *featurestr, *sptr = NULL; *cpu_name = strtok_r(s, ",", &sptr); *features = qdict_new(); fixes this for me. +*features = qdict_new(); + +featurestr = strtok_r(NULL, ",", &sptr); +while (featurestr) { +char *val; +if (featurestr[0] == '+') { +/* + * preseve legacy behaviour, if feature was disabled once + * do not allow to enable it again + */ +if (!qdict_haskey(*features, featurestr + 1)) { +qdict_put(*features, featurestr + 1, qstring_from_str("on")); +} +} else if (featurestr[0] == '-') { +qdict_put(*features, featurestr + 1, qstring_from_str("off")); +} else { +val = strchr(featurestr, '='); +if (val) { +*val = 0; val++; +if (!strcmp(featurestr, "vendor")) { +qdict_put(*features, "vendor-override", + qstring_from_str("on")); +qdict_put(*features, featurestr, qstring_from_str(val)); +} else if (!strcmp(featurestr, "tsc_freq")) { +qdict_put(*features, "tsc-frequency", + qstring_from_str(val)); +} else { +qdict_put(*features, featurestr, qstring_from_str(val)); +} +} else { +qdict_put(*features, featurestr, qstring_from_str("on")); +} +} + +featurestr = strtok_r(NULL, ",", &sptr); +} + +return; +} + static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, const char *cpu_model, Error **errp) { -Don Slutz
[Qemu-devel] [PATCH 07/22] target-i386: convert cpuid features into properties
Signed-off-by: Igor Mammedov -- v2: * replaced mask/ffs tricks by plain 'for (bit = 0; bit < 32; bit++)' as suggested by Eduardo Habkost v3: * check if property exists before adding it * rebased on top of "i386: cpu: remove duplicate feature names" http://www.mail-archive.com/qemu-devel@nongnu.org/msg129458.html place ext2_feature_name for AMD case into setter, so that not to clutter x86_cpu_realize() with property specific code. fix for convert cpuid features --- target-i386/cpu.c | 124 +- 1 file changed, 114 insertions(+), 10 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index cac9024..ae3bc9d 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -833,6 +833,114 @@ static int check_features_against_host(x86_def_t *guest_def) return rv; } +static bool is_feature_set(const char *name, const uint32_t featbitmap, + const char **featureset) +{ +uint32_t bit; + +for (bit = 0; bit < 32; ++bit) { +if (featureset[bit] && !altcmp(name, NULL, featureset[bit])) { +if (featbitmap & (1 << bit)) { +return true; +} +} +} +return false; +} + +static void x86_cpuid_get_feature(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +X86CPU *cpu = X86_CPU(obj); +CPUX86State *env = &cpu->env; +bool value = true; + +if (!is_feature_set(name, env->cpuid_features, feature_name) && + !is_feature_set(name, env->cpuid_ext_features, ext_feature_name) && + !is_feature_set(name, env->cpuid_ext2_features, ext2_feature_name) && + !is_feature_set(name, env->cpuid_ext3_features, ext3_feature_name) && + !is_feature_set(name, env->cpuid_kvm_features, kvm_feature_name) && + !is_feature_set(name, env->cpuid_svm_features, svm_feature_name)) { +value = false; +} + +visit_type_bool(v, &value, name, errp); +} + +static void x86_cpuid_set_feature(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +X86CPU *cpu = X86_CPU(obj); +CPUX86State *env = &cpu->env; +uint32_t mask = 0; +uint32_t *dst_features; +bool value; + +visit_type_bool(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} + +if (lookup_feature(&mask, name, NULL, feature_name)) { +dst_features = &env->cpuid_features; +} else if (lookup_feature(&mask, name, NULL, ext_feature_name)) { +dst_features = &env->cpuid_ext_features; +} else if (lookup_feature(&mask, name, NULL, ext2_feature_name)) { +dst_features = &env->cpuid_ext2_features; +} else if (lookup_feature(&mask, name, NULL, ext3_feature_name)) { +dst_features = &env->cpuid_ext3_features; +} else if (lookup_feature(&mask, name, NULL, kvm_feature_name)) { +dst_features = &env->cpuid_kvm_features; +} else if (lookup_feature(&mask, name, NULL, svm_feature_name)) { +dst_features = &env->cpuid_svm_features; +} else { +error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); +return; +} + +if (value) { +*dst_features |= mask; +} else { +*dst_features &= ~mask; +} + +/* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on + * CPUID[1].EDX. + */ +if (dst_features == &env->cpuid_features && +env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 && +env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 && +env->cpuid_vendor3 == CPUID_VENDOR_AMD_3) { +env->cpuid_ext2_features &= ~CPUID_EXT2_AMD_ALIASES; +env->cpuid_ext2_features |= *dst_features & CPUID_EXT2_AMD_ALIASES; +} +} + +static void x86_register_cpuid_properties(Object *obj, const char **featureset) +{ +uint32_t bit; + +for (bit = 0; bit < 32; ++bit) { +if (featureset[bit]) { +char *feature_name, *save_ptr; +char buf[32]; +if (strlen(featureset[bit]) > sizeof(buf) - 1) { +abort(); +} +pstrcpy(buf, sizeof(buf), featureset[bit]); +feature_name = strtok_r(buf, "|", &save_ptr); +while (feature_name) { +if (!object_property_find(obj, feature_name, NULL)) { +object_property_add(obj, feature_name, "bool", +x86_cpuid_get_feature, +x86_cpuid_set_feature, NULL, NULL, NULL); +} +feature_name = strtok_r(NULL, "|", &save_ptr); +} +} +} +} + static void x86_cpuid_version_get_family(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { @@ -1126,16 +1234,6 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) en
[Qemu-devel] [PATCH 08/22] target-i386: add stubs for hyperv_(vapic_recommended|relaxed_timing_enabled|get_spinlock_retries)()
It's needed for the next 3 patches to avoid build breakage when qemu is built with --disable-kvm option. Signed-off-by: Igor Mammedov Reported-by: Eduardo Habkost --- target-i386/hyperv.h | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target-i386/hyperv.h b/target-i386/hyperv.h index bacb1d4..7bd4d9e 100644 --- a/target-i386/hyperv.h +++ b/target-i386/hyperv.h @@ -30,16 +30,19 @@ void hyperv_enable_vapic_recommended(bool val); void hyperv_enable_relaxed_timing(bool val); void hyperv_set_spinlock_retries(int val); +bool hyperv_vapic_recommended(void); +bool hyperv_relaxed_timing_enabled(void); +int hyperv_get_spinlock_retries(void); #else static inline void hyperv_enable_vapic_recommended(bool val) { } static inline void hyperv_enable_relaxed_timing(bool val) { } static inline void hyperv_set_spinlock_retries(int val) { } +static inline bool hyperv_vapic_recommended(void) { return false; } +static inline bool hyperv_relaxed_timing_enabled(void) { return false; } +static inline int hyperv_get_spinlock_retries(void) { return 0; } #endif bool hyperv_enabled(void); bool hyperv_hypercall_available(void); -bool hyperv_vapic_recommended(void); -bool hyperv_relaxed_timing_enabled(void); -int hyperv_get_spinlock_retries(void); #endif /* QEMU_HW_HYPERV_H */ -- 1.7.11.4
[Qemu-devel] [PATCH 09/22] target-i386: convert 'hv_spinlocks' feature into property
Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index ae3bc9d..7d45c6c 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1203,6 +1203,32 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, cpu->env.tsc_khz = value / 1000; } +#if !defined(CONFIG_USER_ONLY) +static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +int64_t value = hyperv_get_spinlock_retries(); + +visit_type_int(v, &value, name, errp); +} + +static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +int64_t value; + +visit_type_int(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} +if (!value) { +error_set(errp, QERR_PROPERTY_VALUE_BAD, "", name, "0"); +return; +} +hyperv_set_spinlock_retries(value); +} +#endif + static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) { CPUX86State *env = &cpu->env; @@ -2034,6 +2060,11 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "tsc-frequency", "int", x86_cpuid_get_tsc_freq, x86_cpuid_set_tsc_freq, NULL, NULL, NULL); +#if !defined(CONFIG_USER_ONLY) +object_property_add(obj, "hv_spinlocks", "int", +x86_get_hv_spinlocks, +x86_set_hv_spinlocks, NULL, NULL, NULL); +#endif x86_register_cpuid_properties(obj, feature_name); x86_register_cpuid_properties(obj, ext_feature_name); x86_register_cpuid_properties(obj, ext2_feature_name); -- 1.7.11.4
[Qemu-devel] [PATCH 12/22] target-i386: convert 'check' and 'enforce' features into properties
Signed-off-by: Igor Mammedov -- v2: * restore original behavior, check features against host before they might be filtered out by TCG masks. spotted-by: Eduardo Habkost --- target-i386/cpu.c | 68 ++- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3b802ea..7ff9645 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -114,8 +114,8 @@ typedef struct model_features_t { uint32_t cpuid; } model_features_t; -int check_cpuid = 0; -int enforce_cpuid = 0; +bool check_cpuid; +bool enforce_cpuid; void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) @@ -807,19 +807,20 @@ static int unavailable_host_feature(struct model_features_t *f, uint32_t mask) * their way to the guest. Note: ft[].check_feat ideally should be * specified via a guest_def field to suppress report of extraneous flags. */ -static int check_features_against_host(x86_def_t *guest_def) +static int check_features_against_host(X86CPU *cpu) { +CPUX86State *env = &cpu->env; x86_def_t host_def; uint32_t mask; int rv, i; struct model_features_t ft[] = { -{&guest_def->features, &host_def.features, +{&env->cpuid_features, &host_def.features, ~0, feature_name, 0x}, -{&guest_def->ext_features, &host_def.ext_features, +{&env->cpuid_ext_features, &host_def.ext_features, ~CPUID_EXT_HYPERVISOR, ext_feature_name, 0x0001}, -{&guest_def->ext2_features, &host_def.ext2_features, +{&env->cpuid_ext2_features, &host_def.ext2_features, ~PPRO_FEATURES, ext2_feature_name, 0x8000}, -{&guest_def->ext3_features, &host_def.ext3_features, +{&env->cpuid_ext3_features, &host_def.ext3_features, ~CPUID_EXT3_SVM, ext3_feature_name, 0x8001}}; cpu_x86_fill_host(&host_def); @@ -1269,6 +1270,43 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque, } #endif +static void x86_cpuid_get_check(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +visit_type_bool(v, &check_cpuid, name, errp); +} + +static void x86_cpuid_set_check(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +bool value; + +visit_type_bool(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} +check_cpuid = value; +} + +static void x86_cpuid_get_enforce(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +visit_type_bool(v, &enforce_cpuid, name, errp); +} + +static void x86_cpuid_set_enforce(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +bool value; + +visit_type_bool(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} +enforce_cpuid = value; +object_property_set_bool(obj, value, "check", errp); +} + static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) { CPUX86State *env = &cpu->env; @@ -1474,10 +1512,6 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, x86_cpu_def->ext3_features &= ~minus_ext3_features; x86_cpu_def->kvm_features &= ~minus_kvm_features; x86_cpu_def->svm_features &= ~minus_svm_features; -if (check_cpuid) { -if (check_features_against_host(x86_cpu_def) && enforce_cpuid) -goto error; -} g_free(s); return 0; @@ -2047,6 +2081,12 @@ void x86_cpu_realize(Object *obj, Error **errp) X86CPU *cpu = X86_CPU(obj); CPUX86State *env = &cpu->env; +if (check_cpuid && check_features_against_host(cpu) +&& enforce_cpuid) { +error_set(errp, QERR_PERMISSION_DENIED); +return; +} + if (!kvm_enabled()) { env->cpuid_features &= TCG_FEATURES; env->cpuid_ext_features &= TCG_EXT_FEATURES; @@ -2100,6 +2140,12 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "tsc-frequency", "int", x86_cpuid_get_tsc_freq, x86_cpuid_set_tsc_freq, NULL, NULL, NULL); +object_property_add(obj, "check", "bool", +x86_cpuid_get_check, +x86_cpuid_set_check, NULL, NULL, NULL); +object_property_add(obj, "enforce", "bool", +x86_cpuid_get_enforce, +x86_cpuid_set_enforce, NULL, NULL, NULL); #if !defined(CONFIG_USER_ONLY) object_property_add(obj, "hv_spinlocks", "int", x86_get_hv_spinlocks, -- 1.7.11.4
[Qemu-devel] [PATCH 01/22] target-i386: return Error from cpu_x86_find_by_name()
it will allow to use property setters there later. Signed-off-by: Igor Mammedov -- v2: style change, add braces (reqested by Blue Swirl) --- target-i386/cpu.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index ac12139..a89bdc4 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1086,7 +1086,8 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, cpu->env.tsc_khz = value / 1000; } -static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) +static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, +const char *cpu_model, Error **errp) { unsigned int i; x86_def_t *def; @@ -1241,6 +1242,11 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) fprintf(stderr, "feature string `%s' not in format (+feature|-feature|feature=xyz)\n", featurestr); goto error; } + +if (error_is_set(errp)) { +goto error; +} + featurestr = strtok(NULL, ","); } x86_cpu_def->features |= plus_features; @@ -1264,6 +1270,9 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) error: g_free(s); +if (!error_is_set(errp)) { +error_set(errp, QERR_INVALID_PARAMETER_COMBINATION); +} return -1; } @@ -1350,8 +1359,10 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) memset(def, 0, sizeof(*def)); -if (cpu_x86_find_by_name(def, cpu_model) < 0) -return -1; +if (cpu_x86_find_by_name(cpu, def, cpu_model, &error) < 0) { +goto out; +} + if (def->vendor1) { env->cpuid_vendor1 = def->vendor1; env->cpuid_vendor2 = def->vendor2; @@ -1401,6 +1412,8 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) env->cpuid_svm_features &= TCG_SVM_FEATURES; } object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error); + +out: if (error_is_set(&error)) { error_free(error); return -1; -- 1.7.11.4
[Qemu-devel] [PATCH 05/22] target-i386: move out CPU features initialization in separate func
later it could be used in cpu_x86_find_by_name() to init CPU from found cpu_def Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost -- v2: - rebased on top of "i386: cpu: remove duplicate feature names" http://www.mail-archive.com/qemu-devel@nongnu.org/msg129458.html --- target-i386/cpu.c | 84 +-- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 567ad69..ff8c78e 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1086,6 +1086,49 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, cpu->env.tsc_khz = value / 1000; } +static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) +{ +CPUX86State *env = &cpu->env; + +if (def->vendor1) { +env->cpuid_vendor1 = def->vendor1; +env->cpuid_vendor2 = def->vendor2; +env->cpuid_vendor3 = def->vendor3; +} else { +env->cpuid_vendor1 = CPUID_VENDOR_INTEL_1; +env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2; +env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3; +} +env->cpuid_vendor_override = def->vendor_override; +object_property_set_int(OBJECT(cpu), def->level, "level", errp); +object_property_set_int(OBJECT(cpu), def->family, "family", errp); +object_property_set_int(OBJECT(cpu), def->model, "model", errp); +object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp); +object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp); +object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp); +object_property_set_int(OBJECT(cpu), (int64_t)def->tsc_khz * 1000, +"tsc-frequency", errp); +env->cpuid_features = def->features; +env->cpuid_ext_features = def->ext_features; +env->cpuid_ext2_features = def->ext2_features; +env->cpuid_ext3_features = def->ext3_features; +env->cpuid_kvm_features = def->kvm_features; +env->cpuid_svm_features = def->svm_features; +env->cpuid_ext4_features = def->ext4_features; +env->cpuid_7_0_ebx = def->cpuid_7_0_ebx_features; +env->cpuid_xlevel2 = def->xlevel2; + +/* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on + * CPUID[1].EDX. + */ +if (env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 && +env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 && +env->cpuid_vendor3 == CPUID_VENDOR_AMD_3) { +env->cpuid_ext2_features &= ~CPUID_EXT2_AMD_ALIASES; +env->cpuid_ext2_features |= (def->features & CPUID_EXT2_AMD_ALIASES); +} +} + static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, const char *cpu_model, Error **errp) { @@ -1353,7 +1396,6 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) int cpu_x86_register(X86CPU *cpu, const char *cpu_model) { -CPUX86State *env = &cpu->env; x86_def_t def1, *def = &def1; Error *error = NULL; @@ -1363,45 +1405,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) goto out; } -if (def->vendor1) { -env->cpuid_vendor1 = def->vendor1; -env->cpuid_vendor2 = def->vendor2; -env->cpuid_vendor3 = def->vendor3; -} else { -env->cpuid_vendor1 = CPUID_VENDOR_INTEL_1; -env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2; -env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3; -} -env->cpuid_vendor_override = def->vendor_override; -object_property_set_int(OBJECT(cpu), def->level, "level", &error); -object_property_set_int(OBJECT(cpu), def->family, "family", &error); -object_property_set_int(OBJECT(cpu), def->model, "model", &error); -object_property_set_int(OBJECT(cpu), def->stepping, "stepping", &error); -env->cpuid_features = def->features; -env->cpuid_ext_features = def->ext_features; -env->cpuid_ext2_features = def->ext2_features; -env->cpuid_ext3_features = def->ext3_features; -object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", &error); -env->cpuid_kvm_features = def->kvm_features; -env->cpuid_svm_features = def->svm_features; -env->cpuid_ext4_features = def->ext4_features; -env->cpuid_7_0_ebx = def->cpuid_7_0_ebx_features; -env->cpuid_xlevel2 = def->xlevel2; -object_property_set_int(OBJECT(cpu), (int64_t)def->tsc_khz * 1000, -"tsc-frequency", &error); - -/* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on - * CPUID[1].EDX. - */ -if (env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 && -env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 && -env->cpuid_vendor3 == CPUID_VENDOR_AMD_3) { -env->cpuid_ext2_features &= ~CPUID_EXT2_AMD_ALIASES; -env->cpuid_ext2_features |= (def->features & CPUID_EXT2_AMD_ALIASES); -} - - -object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error); +cpudef_2_x86_cpu(cpu, def, &erro
[Qemu-devel] [PATCH 19/22] target-i386: use properties to set/unset user specified features on CPU
[ehabkost: rebase on top of latest qemu.git master, where default KVM features are set differently Signed-off-by: Igor Mammedov Signed-off-by: Eduardo Habkost -- v2: * fix error of initializing from incorrect cpu model definition use x86_cpu_def instead of def. spotted-by: Eduardo Habkost * add missing env in cpu_x86_find_by_name() * added cpu_x86_set_props() to make following code movement more clean. suggested-by: Eduardo Habkost * init name and feature to NULL, to avoid freeing uninitialized mem --- target-i386/cpu.c | 188 +++--- 1 file changed, 36 insertions(+), 152 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 2c9cd6b..be1be84 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -214,22 +214,6 @@ static bool lookup_feature(uint32_t *pval, const char *s, const char *e, return found; } -static void add_flagname_to_bitmaps(const char *flagname, uint32_t *features, -uint32_t *ext_features, -uint32_t *ext2_features, -uint32_t *ext3_features, -uint32_t *kvm_features, -uint32_t *svm_features) -{ -if (!lookup_feature(features, flagname, NULL, feature_name) && -!lookup_feature(ext_features, flagname, NULL, ext_feature_name) && -!lookup_feature(ext2_features, flagname, NULL, ext2_feature_name) && -!lookup_feature(ext3_features, flagname, NULL, ext3_feature_name) && -!lookup_feature(kvm_features, flagname, NULL, kvm_feature_name) && -!lookup_feature(svm_features, flagname, NULL, svm_feature_name)) -fprintf(stderr, "CPU feature %s not found\n", flagname); -} - typedef struct x86_def_t { struct x86_def_t *next; const char *name; @@ -1325,7 +1309,6 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) env->cpuid_ext_features = def->ext_features; env->cpuid_ext2_features = def->ext2_features; env->cpuid_ext3_features = def->ext3_features; -env->cpuid_kvm_features = def->kvm_features; env->cpuid_svm_features = def->svm_features; env->cpuid_ext4_features = def->ext4_features; env->cpuid_7_0_ebx = def->cpuid_7_0_ebx_features; @@ -1384,22 +1367,34 @@ static void compat_normalize_cpu_model(const char *cpu_model, char **cpu_name, return; } +/* Set features on X86CPU object based on a QDict */ +static void cpu_x86_set_props(X86CPU *cpu, QDict *features, Error **errp) +{ +const QDictEntry *ent; + +for (ent = qdict_first(features); ent; ent = qdict_next(features, ent)) { +const QString *qval = qobject_to_qstring(qdict_entry_value(ent)); +object_property_parse(OBJECT(cpu), qstring_get_str(qval), + qdict_entry_key(ent), errp); +if (error_is_set(errp)) { +return; +} +} +} + static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, const char *cpu_model, Error **errp) { x86_def_t *def; -char *s = g_strdup(cpu_model); -char *featurestr, *name = strtok(s, ","); -/* Features to be added*/ -uint32_t plus_features = 0, plus_ext_features = 0; -uint32_t plus_ext2_features = 0, plus_ext3_features = 0; -uint32_t plus_kvm_features = 0, plus_svm_features = 0; -/* Features to be removed */ -uint32_t minus_features = 0, minus_ext_features = 0; -uint32_t minus_ext2_features = 0, minus_ext3_features = 0; -uint32_t minus_kvm_features = 0, minus_svm_features = 0; -uint32_t numvalue; +CPUX86State *env = &cpu->env; +QDict *features = NULL; +char *name = NULL; + +compat_normalize_cpu_model(cpu_model, &name, &features, errp); +if (error_is_set(errp)) { +goto error; +} for (def = x86_defs; def; def = def->next) if (name && !strcmp(name, def->name)) @@ -1412,8 +1407,10 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, memcpy(x86_cpu_def, def, sizeof(*def)); } +cpudef_2_x86_cpu(cpu, x86_cpu_def, errp); + #if defined(CONFIG_KVM) -plus_kvm_features = (1 << KVM_FEATURE_CLOCKSOURCE) | +env->cpuid_kvm_features = (1 << KVM_FEATURE_CLOCKSOURCE) | (1 << KVM_FEATURE_NOP_IO_DELAY) | (1 << KVM_FEATURE_MMU_OP) | (1 << KVM_FEATURE_CLOCKSOURCE2) | @@ -1421,134 +1418,23 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, (1 << KVM_FEATURE_STEAL_TIME) | (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT); #else -plus_kvm_features = 0; +env->cpuid_kvm_features = 0; #endif -add_flagname_to_bitmaps("hypervisor", &plus_features, -&plus_ext_features, &plus_ext2_features, &plus_ext3_features, -&plus_kvm_features, &plus_svm_features); - -featurestr = strtok(NULL, ","); +object_property_set_b
[Qemu-devel] [PATCH 15/22] target-i386: introduce vendor-override property
currently 'cpuid_vendor_override' can be set only via cmd line cpu_model string. But setting it in 'vendor' property prevents using 'vendor' property on its own without setting cpuid_vendor_override. So fix/remove enabling cpuid_vendor_override from "vendor" property setter. It's up-to cpu_model string parser to maintain legacy behavior when user overrides vendor on command line. v2: - convert cpuid_vendor_override to bool to reflect its real usage Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 31 +-- target-i386/cpu.h | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 1e10388..5362fe6 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1133,7 +1133,6 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value, env->cpuid_vendor2 |= ((uint8_t)value[i + 4]) << (8 * i); env->cpuid_vendor3 |= ((uint8_t)value[i + 8]) << (8 * i); } -env->cpuid_vendor_override = 1; } static char *x86_cpuid_get_model_id(Object *obj, Error **errp) @@ -1307,6 +1306,31 @@ static void x86_cpuid_set_enforce(Object *obj, Visitor *v, void *opaque, object_property_set_bool(obj, value, "check", errp); } +static void +x86_cpuid_get_vendor_override(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +X86CPU *cpu = X86_CPU(obj); +CPUX86State *env = &cpu->env; + +visit_type_bool(v, &env->cpuid_vendor_override, name, errp); +} + +static void +x86_cpuid_set_vendor_override(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +X86CPU *cpu = X86_CPU(obj); +CPUX86State *env = &cpu->env; +bool value; + +visit_type_bool(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} +env->cpuid_vendor_override = value; +} + static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) { CPUX86State *env = &cpu->env; @@ -1320,7 +1344,7 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2; env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3; } -env->cpuid_vendor_override = def->vendor_override; +object_property_set_bool(OBJECT(cpu), true, "vendor-override", errp); object_property_set_int(OBJECT(cpu), def->level, "level", errp); object_property_set_int(OBJECT(cpu), def->family, "family", errp); object_property_set_int(OBJECT(cpu), def->model, "model", errp); @@ -2134,6 +2158,9 @@ static void x86_cpu_initfn(Object *obj) object_property_add_str(obj, "vendor", x86_cpuid_get_vendor, x86_cpuid_set_vendor, NULL); +object_property_add(obj, "vendor-override", "bool", +x86_cpuid_get_vendor_override, +x86_cpuid_set_vendor_override, NULL, NULL, NULL); object_property_add_str(obj, "model-id", x86_cpuid_get_model_id, x86_cpuid_set_model_id, NULL); diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 4995084..4f525ee 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -774,7 +774,7 @@ typedef struct CPUX86State { uint32_t cpuid_ext2_features; uint32_t cpuid_ext3_features; uint32_t cpuid_apic_id; -int cpuid_vendor_override; +bool cpuid_vendor_override; /* Store the results of Centaur's CPUID instructions */ uint32_t cpuid_xlevel2; uint32_t cpuid_ext4_features; -- 1.7.11.4
[Qemu-devel] [PATCH 10/22] target-i386: convert 'hv_relaxed' feature into property
Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 7d45c6c..6331eab 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1227,6 +1227,26 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque, } hyperv_set_spinlock_retries(value); } + +static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +bool value = hyperv_relaxed_timing_enabled(); + +visit_type_bool(v, &value, name, errp); +} + +static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +bool value; + +visit_type_bool(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} +hyperv_enable_relaxed_timing(value); +} #endif static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) @@ -2064,6 +2084,9 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "hv_spinlocks", "int", x86_get_hv_spinlocks, x86_set_hv_spinlocks, NULL, NULL, NULL); +object_property_add(obj, "hv_relaxed", "bool", +x86_get_hv_relaxed, +x86_set_hv_relaxed, NULL, NULL, NULL); #endif x86_register_cpuid_properties(obj, feature_name); x86_register_cpuid_properties(obj, ext_feature_name); -- 1.7.11.4
[Qemu-devel] [PATCH 22/22] target-i386: cleanup cpu_x86_find_by_name(), only fill x86_def_t in it
Do in cpu_x86_find_by_name() only what name implies. i.e. leave only cpudef search and copy/fill passed in x86_def_t structure. and move out of it cpu_model parsing and CPU initializing into cpu_x86_register(). Plus add hints to where blocks should go when cpu_x86_register() is disbanded. Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 55 --- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6063904..e7964a3 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1401,43 +1401,21 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, { x86_def_t *def; -QDict *features = NULL; -char *name = NULL; - -compat_normalize_cpu_model(cpu_model, &name, &features, errp); -if (error_is_set(errp)) { -goto error; -} - -for (def = x86_defs; def; def = def->next) -if (name && !strcmp(name, def->name)) +for (def = x86_defs; def; def = def->next) { +if (!strcmp(cpu_model, def->name)) { break; -if (kvm_enabled() && name && strcmp(name, "host") == 0) { +} +} +if (kvm_enabled() && strcmp(cpu_model, "host") == 0) { cpu_x86_fill_host(x86_cpu_def); } else if (!def) { -goto error; +error_set(errp, QERR_DEVICE_NOT_FOUND, cpu_model); +return -1; } else { memcpy(x86_cpu_def, def, sizeof(*def)); } -cpudef_2_x86_cpu(cpu, x86_cpu_def, errp); - -cpu_x86_set_props(cpu, features, errp); -QDECREF(features); -if (error_is_set(errp)) { -goto error; -} - -g_free(name); return 0; - -error: -g_free(name); -QDECREF(features); -if (!error_is_set(errp)) { -error_set(errp, QERR_INVALID_PARAMETER_COMBINATION); -} -return -1; } /* generate a composite string into buf of all cpuid names in featureset @@ -1519,14 +1497,29 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) { x86_def_t def1, *def = &def1; Error *error = NULL; +QDict *features = NULL; +char *name = NULL; -memset(def, 0, sizeof(*def)); +/* for CPU subclasses should go into cpu_x86_init() before object_new() */ +compat_normalize_cpu_model(cpu_model, &name, &features, &error); +if (error_is_set(&error)) { +goto out; +} -if (cpu_x86_find_by_name(cpu, def, cpu_model, &error) < 0) { +/* this block should be replaced by CPU subclasses */ +memset(def, 0, sizeof(*def)); +if (cpu_x86_find_by_name(cpu, def, name, &error) < 0) { goto out; } +cpudef_2_x86_cpu(cpu, def, &error); + +/* for CPU subclasses should go between object_new() and + * x86_cpu_realize() */ +cpu_x86_set_props(cpu, features, &error); out: +QDECREF(features); +g_free(name); if (error_is_set(&error)) { fprintf(stderr, "%s\n", error_get_pretty(error)); error_free(error); -- 1.7.11.4
[Qemu-devel] [PATCH 06/22] target-i386: xlevel should be more than 0x80000000, move fixup into setter
Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- target-i386/cpu.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index ff8c78e..cac9024 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -973,8 +973,17 @@ static void x86_cpuid_set_xlevel(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { X86CPU *cpu = X86_CPU(obj); +uint32_t value; -visit_type_uint32(v, &cpu->env.cpuid_xlevel, name, errp); +visit_type_uint32(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} + +if (value < 0x8000) { +value += 0x8000; +} +cpu->env.cpuid_xlevel = value; } static char *x86_cpuid_get_vendor(Object *obj, Error **errp) @@ -1229,9 +1238,6 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, fprintf(stderr, "bad numerical value %s\n", val); goto error; } -if (numvalue < 0x8000) { -numvalue += 0x8000; -} x86_cpu_def->xlevel = numvalue; } else if (!strcmp(featurestr, "vendor")) { if (strlen(val) != 12) { -- 1.7.11.4
[Qemu-devel] [PATCH 14/22] target-i386: use visit_type_hz to parse tsc_freq property value
Signed-off-by: Igor Mammedov v2: * use visit_type_freq() which replaced visit_type_hz() --- target-i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 7ff9645..1e10388 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1191,7 +1191,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, const int64_t max = INT_MAX; int64_t value; -visit_type_int(v, &value, name, errp); +visit_type_freq(v, &value, name, errp); if (error_is_set(errp)) { return; } -- 1.7.11.4
[Qemu-devel] [PATCH 18/22] target-i386: parse cpu_model string into set of stringified properties
cpu_model string does represent features in following format: ([+-]feat)|(feat=foo)|(feat) which makes it impossible directly use property infrastructure to set features on CPU. This patch introduces parser that splits CPU name from cpu_model and converts legacy features string into canonized set of strings that is compatible with property manipulation infrastructure. PS: * later it could be used as a hook to convert legacy command line features to global properties. Then marked as deprecated and removed with -cpu option in the future. * compiler complains that it's unused function but I guess it is easier for review this way Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 52 1 file changed, 52 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0543e62..2c9cd6b 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1332,6 +1332,58 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) env->cpuid_xlevel2 = def->xlevel2; } +/* convert legacy cpumodel string to string cpu_name and + * a uniforms set of custom features that will be applied to CPU + * using object_property_parse() + */ +static void compat_normalize_cpu_model(const char *cpu_model, char **cpu_name, +QDict **features, Error **errp) +{ + +char *s = g_strdup(cpu_model); +char *featurestr, *sptr; + +*cpu_name = strtok_r(s, ",", &sptr); +*features = qdict_new(); + +featurestr = strtok_r(NULL, ",", &sptr); +while (featurestr) { +char *val; +if (featurestr[0] == '+') { +/* + * preseve legacy behaviour, if feature was disabled once + * do not allow to enable it again + */ +if (!qdict_haskey(*features, featurestr + 1)) { +qdict_put(*features, featurestr + 1, qstring_from_str("on")); +} +} else if (featurestr[0] == '-') { +qdict_put(*features, featurestr + 1, qstring_from_str("off")); +} else { +val = strchr(featurestr, '='); +if (val) { +*val = 0; val++; +if (!strcmp(featurestr, "vendor")) { +qdict_put(*features, "vendor-override", + qstring_from_str("on")); +qdict_put(*features, featurestr, qstring_from_str(val)); +} else if (!strcmp(featurestr, "tsc_freq")) { +qdict_put(*features, "tsc-frequency", + qstring_from_str(val)); +} else { +qdict_put(*features, featurestr, qstring_from_str(val)); +} +} else { +qdict_put(*features, featurestr, qstring_from_str("on")); +} +} + +featurestr = strtok_r(NULL, ",", &sptr); +} + +return; +} + static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, const char *cpu_model, Error **errp) { -- 1.7.11.4
[Qemu-devel] [PATCH 20/22] target-i386: move init of "hypervisor" feature into CPU initializer from cpudef
"hypervisor" CPU feature is unconditionally enabled/overridden even if it's cleared in cpudef. Moving it inside CPU initializer from cpudef will help to split cpu_x86_find_by_name() into default init and user settable properties. Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index be1be84..fe67823 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1313,6 +1313,8 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) env->cpuid_ext4_features = def->ext4_features; env->cpuid_7_0_ebx = def->cpuid_7_0_ebx_features; env->cpuid_xlevel2 = def->xlevel2; + +object_property_set_bool(OBJECT(cpu), true, "hypervisor", errp); } /* convert legacy cpumodel string to string cpu_name and @@ -1421,8 +1423,6 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, env->cpuid_kvm_features = 0; #endif -object_property_set_bool(OBJECT(cpu), true, "hypervisor", errp); - cpu_x86_set_props(cpu, features, errp); QDECREF(features); if (error_is_set(errp)) { -- 1.7.11.4
[Qemu-devel] [PATCH 11/22] target-i386: convert 'hv_vapic' feature into property
Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6331eab..3b802ea 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1247,6 +1247,26 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque, } hyperv_enable_relaxed_timing(value); } + +static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +bool value = hyperv_vapic_recommended(); + +visit_type_bool(v, &value, name, errp); +} + +static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ +bool value; + +visit_type_bool(v, &value, name, errp); +if (error_is_set(errp)) { +return; +} +hyperv_enable_vapic_recommended(value); +} #endif static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) @@ -2087,6 +2107,9 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "hv_relaxed", "bool", x86_get_hv_relaxed, x86_set_hv_relaxed, NULL, NULL, NULL); +object_property_add(obj, "hv_vapic", "bool", +x86_set_hv_vapic, +x86_get_hv_vapic, NULL, NULL, NULL); #endif x86_register_cpuid_properties(obj, feature_name); x86_register_cpuid_properties(obj, ext_feature_name); -- 1.7.11.4
[Qemu-devel] [PATCH 00/22 v2] target-i386: convert CPU features into properties
Build and run tested in FC17 host with x86_64-linux-user, x86_64-softmmu targets git tree for testing: https://github.com/imammedo/qemu/tree/x86-cpu-properties.v2 Igor Mammedov (22): target-i386: return Error from cpu_x86_find_by_name() target-i386: cpu_x86_register(): report error from property setter target-i386: if x86_cpu_realize() failed report error and do cleanup target-i386: filter out not TCG features if running without kvm at realize time target-i386: move out CPU features initialization in separate func target-i386: xlevel should be more than 0x8000, move fixup into setter target-i386: convert cpuid features into properties target-i386: add stubs for hyperv_(vapic_recommended|relaxed_timing_enabled|get_spinlock_retries)() target-i386: convert 'hv_spinlocks' feature into property target-i386: convert 'hv_relaxed' feature into property target-i386: convert 'hv_vapic' feature into property target-i386: convert 'check' and 'enforce' features into properties add visitor for parsing hz[KMG] input string target-i386: use visit_type_hz to parse tsc_freq property value target-i386: introduce vendor-override property target-i386: use define for cpuid vendor string size target-i386: replace uint32_t vendor fields by vendor string in x86_def_t target-i386: parse cpu_model string into set of stringified properties target-i386: use properties to set/unset user specified features on CPU target-i386: move init of "hypervisor" feature into CPU initializer from cpudef target-i386: move default init of cpuid_kvm_features bitmap into CPU initializer from cpudef target-i386: cleanup cpu_x86_find_by_name(), only fill x86_def_t in it qapi/qapi-visit-core.c | 11 + qapi/qapi-visit-core.h | 2 + qapi/string-input-visitor.c | 22 ++ target-i386/cpu.c | 723 +++- target-i386/cpu.h | 10 +- target-i386/helper.c| 9 +- target-i386/hyperv.h| 9 +- 7 files changed, 498 insertions(+), 288 deletions(-) -- 1.7.11.4
[Qemu-devel] [PATCH 02/22] target-i386: cpu_x86_register(): report error from property setter
Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index a89bdc4..3f80069 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1415,6 +1415,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) out: if (error_is_set(&error)) { +fprintf(stderr, "%s\n", error_get_pretty(error)); error_free(error); return -1; } -- 1.7.11.4
Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
On Sat, Sep 8, 2012 at 12:22 AM, Stefan Weil wrote: > Am 06.09.2012 14:48, schrieb Max Filippov: > >> On Thu, Sep 6, 2012 at 8:45 AM, Stefan Weil wrote: >>> >>> Am 06.09.2012 02:36, schrieb Max Filippov: >>> Put the following errno value mappings under #ifdef: xtensa-semi.c: In function 'errno_h2g': xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function) xtensa-semi.c:113: error: (Each undeclared identifier is reported only once xtensa-semi.c:113: error: for each function it appears in.) xtensa-semi.c:113: error: array index in initializer not of integer type xtensa-semi.c:113: error: (near initialization for 'guest_errno') xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function) xtensa-semi.c:124: error: array index in initializer not of integer type xtensa-semi.c:124: error: (near initialization for 'guest_errno') xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function) xtensa-semi.c:134: error: array index in initializer not of integer type xtensa-semi.c:134: error: (near initialization for 'guest_errno') Signed-off-by: Max Filippov --- >>> >>> Is semi hosting a useful feature when QEMU runs on a Windows host? >> >> >> It should be if windows is POSIX enough. >> >>> If not, you could conditionally compile the whole semi hosting code >>> for non Windows only. >>> >>> If yes, what about the differences in system calls between UNIX like >>> operating systems and Windows? Should the code for 'open' add O_BINARY? >> >> >> ...otherwise \n will turn to \r\n? IIRC this behaviour was tunable at the >> system >> level under cygwin. Not under mingw? >> >> Is there a list of such differences? > > Signed-off-by: Stefan Weil > > Blue, please take the patch as it is and commit it: > compilation for MinGW is currently broken, and the patch fixes that. > > The system calls should be handled by a separate patch. > > Yes, 'open' with MinGW opens files in text mode by default. > That implies automatic translation from \n to \r\n on writes > and vice versa on read. It also implies that seeking can give > unexpected results. Looks like open flags need mapping for bits other than O_RD/WR/RDWR, I'll post a patch. > Or-ing the flags for open with O_BINARY would fix the problem > and works also for other OS were we define O_BINARY = 0. > > Like Cygwin, MinGW also supports linking with binmode.o. > That file changes the default for open to binary mode, > so all open calls in QEMU would automatically be binary. > > Maybe that second alternative is the better one. > > I noticed that lseek takes an int32_t offset. Is this > intentional? It limits file size to 2 GiB. Yes, unfortunately offset is passed in single 32-bit register. > I did not see other potential problems with the system calls. Thanks for the review, Stefan. -- Thanks. -- Max
[Qemu-devel] [PATCH 13/22] add visitor for parsing hz[KMG] input string
Signed-off-by: Igor Mammedov Acked-by: Andreas Färber -- v2: * replaced _hz suffix for frequency visitor by _freq suffix suggested-by: Andreas Färber * fixed typo & extra space spotted-by: Andreas Färber --- qapi/qapi-visit-core.c | 11 +++ qapi/qapi-visit-core.h | 2 ++ qapi/string-input-visitor.c | 22 ++ 3 files changed, 35 insertions(+) diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 7a82b63..5c8705e 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -311,3 +311,14 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[], g_free(enum_str); *obj = value; } + +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp) +{ +if (!error_is_set(errp)) { +if (v->type_freq) { +v->type_freq(v, obj, name, errp); +} else { +v->type_int(v, obj, name, errp); +} +} +} diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h index 60aceda..e5e7dd7 100644 --- a/qapi/qapi-visit-core.h +++ b/qapi/qapi-visit-core.h @@ -62,6 +62,7 @@ struct Visitor void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); +void (*type_freq)(Visitor *v, int64_t *obj, const char *name, Error **errp); }; void visit_start_handle(Visitor *v, void **obj, const char *kind, @@ -91,5 +92,6 @@ void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); +void visit_type_freq(Visitor *v, int64_t *obj, const char *name, Error **errp); #endif diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 497eb9a..47d2a84 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -110,6 +110,27 @@ static void parse_start_optional(Visitor *v, bool *present, *present = true; } +static void parse_type_freq(Visitor *v, int64_t *obj, const char *name, +Error **errp) +{ +StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); +char *endp = (char *) siv->string; +long long val; + +errno = 0; +if (siv->string) { +val = strtosz_suffix_unit(siv->string, &endp, + STRTOSZ_DEFSUFFIX_B, 1000); +} +if (!siv->string || val == -1 || *endp) { +error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, + "a value representable as a non-negative int64"); +return; +} + +*obj = val; +} + Visitor *string_input_get_visitor(StringInputVisitor *v) { return &v->visitor; @@ -132,6 +153,7 @@ StringInputVisitor *string_input_visitor_new(const char *str) v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_optional = parse_start_optional; +v->visitor.type_freq = parse_type_freq; v->string = str; return v; -- 1.7.11.4
[Qemu-devel] [PATCH 17/22] target-i386: replace uint32_t vendor fields by vendor string in x86_def_t
Vendor property setter takes string as vendor value but cpudefs use uint32_t vendor[123] fields to define vendor value. It makes it difficult to unify and use property setter for values from cpudefs. To allow simplify code by using vendor property setter, vendor[123] fields are converted into vendor[13] array to keep its value. And vendor property setter is used to access/set value on CPU. [ehabkost: rebase on top of my unduplicate-features branch] [ehabkost: fix the new CPU models to use the string .vendor field, too, on the CPU model array] [ehabkost: keep CPUID_VENDOR_AMD_[123] #defines, as they are used in the AMD CPU feature alias handling] Signed-off-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 92 +++ target-i386/cpu.h | 6 ++-- 2 files changed, 27 insertions(+), 71 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 8b021a2..0543e62 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -234,7 +234,7 @@ typedef struct x86_def_t { struct x86_def_t *next; const char *name; uint32_t level; -uint32_t vendor1, vendor2, vendor3; +char vendor[CPUID_VENDOR_SZ + 1]; int family; int model; int stepping; @@ -298,9 +298,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "qemu64", .level = 4, -.vendor1 = CPUID_VENDOR_AMD_1, -.vendor2 = CPUID_VENDOR_AMD_2, -.vendor3 = CPUID_VENDOR_AMD_3, +.vendor = CPUID_VENDOR_AMD, .family = 6, .model = 2, .stepping = 3, @@ -317,9 +315,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "phenom", .level = 5, -.vendor1 = CPUID_VENDOR_AMD_1, -.vendor2 = CPUID_VENDOR_AMD_2, -.vendor3 = CPUID_VENDOR_AMD_3, +.vendor = CPUID_VENDOR_AMD, .family = 16, .model = 2, .stepping = 3, @@ -363,9 +359,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "kvm64", .level = 5, -.vendor1 = CPUID_VENDOR_INTEL_1, -.vendor2 = CPUID_VENDOR_INTEL_2, -.vendor3 = CPUID_VENDOR_INTEL_3, +.vendor = CPUID_VENDOR_INTEL, .family = 15, .model = 6, .stepping = 1, @@ -464,9 +458,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "athlon", .level = 2, -.vendor1 = CPUID_VENDOR_AMD_1, -.vendor2 = CPUID_VENDOR_AMD_2, -.vendor3 = CPUID_VENDOR_AMD_3, +.vendor = CPUID_VENDOR_AMD, .family = 6, .model = 2, .stepping = 3, @@ -498,9 +490,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "Conroe", .level = 2, -.vendor1 = CPUID_VENDOR_INTEL_1, -.vendor2 = CPUID_VENDOR_INTEL_2, -.vendor3 = CPUID_VENDOR_INTEL_3, +.vendor = CPUID_VENDOR_INTEL, .family = 6, .model = 2, .stepping = 3, @@ -518,9 +508,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "Penryn", .level = 2, -.vendor1 = CPUID_VENDOR_INTEL_1, -.vendor2 = CPUID_VENDOR_INTEL_2, -.vendor3 = CPUID_VENDOR_INTEL_3, +.vendor = CPUID_VENDOR_INTEL, .family = 6, .model = 2, .stepping = 3, @@ -539,9 +527,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "Nehalem", .level = 2, -.vendor1 = CPUID_VENDOR_INTEL_1, -.vendor2 = CPUID_VENDOR_INTEL_2, -.vendor3 = CPUID_VENDOR_INTEL_3, +.vendor = CPUID_VENDOR_INTEL, .family = 6, .model = 2, .stepping = 3, @@ -560,9 +546,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "Westmere", .level = 11, -.vendor1 = CPUID_VENDOR_INTEL_1, -.vendor2 = CPUID_VENDOR_INTEL_2, -.vendor3 = CPUID_VENDOR_INTEL_3, +.vendor = CPUID_VENDOR_INTEL, .family = 6, .model = 44, .stepping = 1, @@ -582,9 +566,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "SandyBridge", .level = 0xd, -.vendor1 = CPUID_VENDOR_INTEL_1, -.vendor2 = CPUID_VENDOR_INTEL_2, -.vendor3 = CPUID_VENDOR_INTEL_3, +.vendor = CPUID_VENDOR_INTEL, .family = 6, .model = 42, .stepping = 1, @@ -607,9 +589,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "Opteron_G1", .level = 5, -.vendor1 = CPUID_VENDOR_AMD_1, -.vendor2 = CPUID_VENDOR_AMD_2, -.vendor3 = CPUID_VENDOR_AMD_3, +.vendor = CPUID_VENDOR_AMD, .family = 15, .model = 6, .stepping = 1, @@ -631,9 +611,7 @@ static x86_def_t builtin_x86_defs[] = { { .name = "Opteron_G2", .level = 5, -.vendor1 = CPUID_VENDOR_AMD_1, -.vendor2 = CPUID_VENDOR_AMD_2, -.vendor3 = CPUID_VENDOR_AMD_3, +.vendor = CPUID_VENDOR_AMD
[Qemu-devel] [PATCH 04/22] target-i386: filter out not TCG features if running without kvm at realize time
Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3f80069..567ad69 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1400,17 +1400,7 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) env->cpuid_ext2_features |= (def->features & CPUID_EXT2_AMD_ALIASES); } -if (!kvm_enabled()) { -env->cpuid_features &= TCG_FEATURES; -env->cpuid_ext_features &= TCG_EXT_FEATURES; -env->cpuid_ext2_features &= (TCG_EXT2_FEATURES -#ifdef TARGET_X86_64 -| CPUID_EXT2_SYSCALL | CPUID_EXT2_LM -#endif -); -env->cpuid_ext3_features &= TCG_EXT3_FEATURES; -env->cpuid_svm_features &= TCG_SVM_FEATURES; -} + object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error); out: @@ -1881,6 +1871,19 @@ static void mce_init(X86CPU *cpu) void x86_cpu_realize(Object *obj, Error **errp) { X86CPU *cpu = X86_CPU(obj); +CPUX86State *env = &cpu->env; + +if (!kvm_enabled()) { +env->cpuid_features &= TCG_FEATURES; +env->cpuid_ext_features &= TCG_EXT_FEATURES; +env->cpuid_ext2_features &= (TCG_EXT2_FEATURES +#ifdef TARGET_X86_64 +| CPUID_EXT2_SYSCALL | CPUID_EXT2_LM +#endif +); +env->cpuid_ext3_features &= TCG_EXT3_FEATURES; +env->cpuid_svm_features &= TCG_SVM_FEATURES; +} #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); -- 1.7.11.4
Re: [Qemu-devel] [PATCH 00/22 v2] target-i386: convert CPU features into properties
On Fri, 7 Sep 2012 22:54:49 +0200 Igor Mammedov wrote: > git tree for testing: > https://github.com/imammedo/qemu/tree/x86-cpu-properties.v2 > here are series it depends on: [Qemu-devel] [PATCH 0/7] x86 CPU patches that didn't get into 1.2 http://www.mail-archive.com/qemu-devel@nongnu.org/msg129240.html [Qemu-devel] [PATCH 0/5] i386: cpu: remove duplicate feature names http://www.mail-archive.com/qemu-devel@nongnu.org/msg129458.html -- Regards, Igor
[Qemu-devel] [PATCH 03/22] target-i386: if x86_cpu_realize() failed report error and do cleanup
Signed-off-by: Igor Mammedov Acked-by: Andreas Färber --- target-i386/helper.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target-i386/helper.c b/target-i386/helper.c index 8a5da3d..a0e4c89 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1151,6 +1151,7 @@ X86CPU *cpu_x86_init(const char *cpu_model) { X86CPU *cpu; CPUX86State *env; +Error *error = NULL; cpu = X86_CPU(object_new(TYPE_X86_CPU)); env = &cpu->env; @@ -1161,8 +1162,12 @@ X86CPU *cpu_x86_init(const char *cpu_model) return NULL; } -x86_cpu_realize(OBJECT(cpu), NULL); - +x86_cpu_realize(OBJECT(cpu), &error); +if (error_is_set(&error)) { +error_free(error); +object_delete(OBJECT(cpu)); +return NULL; +} return cpu; } -- 1.7.11.4
[Qemu-devel] [PATCH 16/22] target-i386: use define for cpuid vendor string size
Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 6 +++--- target-i386/cpu.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 5362fe6..8b021a2 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1102,13 +1102,13 @@ static char *x86_cpuid_get_vendor(Object *obj, Error **errp) char *value; int i; -value = (char *)g_malloc(12 + 1); +value = (char *)g_malloc(CPUID_VENDOR_SZ + 1); for (i = 0; i < 4; i++) { value[i] = env->cpuid_vendor1 >> (8 * i); value[i + 4] = env->cpuid_vendor2 >> (8 * i); value[i + 8] = env->cpuid_vendor3 >> (8 * i); } -value[12] = '\0'; +value[CPUID_VENDOR_SZ] = '\0'; return value; } @@ -1119,7 +1119,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value, CPUX86State *env = &cpu->env; int i; -if (strlen(value) != 12) { +if (strlen(value) != CPUID_VENDOR_SZ) { error_set(errp, QERR_PROPERTY_VALUE_BAD, "", "vendor", value); return; diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 4f525ee..b6bcdf1 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -474,6 +474,8 @@ #define CPUID_SVM_PAUSEFILTER (1 << 10) #define CPUID_SVM_PFTHRESHOLD (1 << 12) +#define CPUID_VENDOR_SZ 12 + #define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */ #define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */ #define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */ -- 1.7.11.4
[Qemu-devel] [PATCH 21/22] target-i386: move default init of cpuid_kvm_features bitmap into CPU initializer from cpudef
Moving it inside CPU initializer from cpudef will help to split cpu_x86_find_by_name() into default init and user settable properties. [ehabkost: rebase on top of latest qemu.git master, where the bitmap initialization is now different] [imammedo: fix whitespace Signed-off-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index fe67823..6063904 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1314,6 +1314,18 @@ static void cpudef_2_x86_cpu(X86CPU *cpu, x86_def_t *def, Error **errp) env->cpuid_7_0_ebx = def->cpuid_7_0_ebx_features; env->cpuid_xlevel2 = def->xlevel2; +#if defined(CONFIG_KVM) +env->cpuid_kvm_features = (1 << KVM_FEATURE_CLOCKSOURCE) | +(1 << KVM_FEATURE_NOP_IO_DELAY) | +(1 << KVM_FEATURE_MMU_OP) | +(1 << KVM_FEATURE_CLOCKSOURCE2) | +(1 << KVM_FEATURE_ASYNC_PF) | +(1 << KVM_FEATURE_STEAL_TIME) | +(1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT); +#else +env->cpuid_kvm_features = 0; +#endif + object_property_set_bool(OBJECT(cpu), true, "hypervisor", errp); } @@ -1389,7 +1401,6 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, { x86_def_t *def; -CPUX86State *env = &cpu->env; QDict *features = NULL; char *name = NULL; @@ -1411,18 +1422,6 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, cpudef_2_x86_cpu(cpu, x86_cpu_def, errp); -#if defined(CONFIG_KVM) -env->cpuid_kvm_features = (1 << KVM_FEATURE_CLOCKSOURCE) | -(1 << KVM_FEATURE_NOP_IO_DELAY) | -(1 << KVM_FEATURE_MMU_OP) | -(1 << KVM_FEATURE_CLOCKSOURCE2) | -(1 << KVM_FEATURE_ASYNC_PF) | -(1 << KVM_FEATURE_STEAL_TIME) | -(1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT); -#else -env->cpuid_kvm_features = 0; -#endif - cpu_x86_set_props(cpu, features, errp); QDECREF(features); if (error_is_set(errp)) { -- 1.7.11.4
Re: [Qemu-devel] [PATCH 2/3] g3beige: add a video card only when requested
On 07.09.2012, at 22:45, Aurelien Jarno wrote: > On Fri, Sep 07, 2012 at 08:58:06PM +0200, Alexander Graf wrote: >> >> >> On 07.09.2012, at 17:27, Aurelien Jarno wrote: >> >>> The g3beige machine always add a video card, even when the "-vga none" >>> is passed. Fix that by checking if it is enabled or not before >>> instanciating it. >>> >>> Cc: Alexander Graf >>> Signed-off-by: Aurelien Jarno >>> --- >>> hw/ppc_oldworld.c |4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c >>> index 1dcd8a6..363b0e5 100644 >>> --- a/hw/ppc_oldworld.c >>> +++ b/hw/ppc_oldworld.c >>> @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, >>> pci_bus = pci_grackle_init(0xfec0, pic, >>> get_system_memory(), >>> get_system_io()); >>> -pci_vga_init(pci_bus); >>> +if (std_vga_enabled) { >>> +pci_vga_init(pci_bus); >> >> Shouldn't we try to have some generic function that can create any PCI VGA >> adapter for us? We might want to throw a cirrus or qxl one in a g3beige. >> > > Other hardware supporting different videocard are using this kind of > code (a bit more complicated for PC as it allow the card to be on the > ISA or on the PCI bus): > > |/* Optional PCI video card */ > |if (cirrus_vga_enabled) { > |pci_cirrus_vga_init(pci_bus); > |} else if (vmsvga_enabled) { > |pci_vmsvga_init(pci_bus); > |} else if (std_vga_enabled) { > |pci_vga_init(pci_bus); > |} Yup. Can we move that to some generic pci file so that we don't have to copy it all over the place? Alex
Re: [Qemu-devel] [PATCH 2/3] g3beige: add a video card only when requested
On 07.09.2012, at 22:45, Aurelien Jarno wrote: > On Fri, Sep 07, 2012 at 08:58:06PM +0200, Alexander Graf wrote: >> >> >> On 07.09.2012, at 17:27, Aurelien Jarno wrote: >> >>> The g3beige machine always add a video card, even when the "-vga none" >>> is passed. Fix that by checking if it is enabled or not before >>> instanciating it. >>> >>> Cc: Alexander Graf >>> Signed-off-by: Aurelien Jarno >>> --- >>> hw/ppc_oldworld.c |4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c >>> index 1dcd8a6..363b0e5 100644 >>> --- a/hw/ppc_oldworld.c >>> +++ b/hw/ppc_oldworld.c >>> @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, >>> pci_bus = pci_grackle_init(0xfec0, pic, >>> get_system_memory(), >>> get_system_io()); >>> -pci_vga_init(pci_bus); >>> +if (std_vga_enabled) { >>> +pci_vga_init(pci_bus); >> >> Shouldn't we try to have some generic function that can create any PCI VGA >> adapter for us? We might want to throw a cirrus or qxl one in a g3beige. >> > > Other hardware supporting different videocard are using this kind of > code (a bit more complicated for PC as it allow the card to be on the > ISA or on the PCI bus): > > |/* Optional PCI video card */ > |if (cirrus_vga_enabled) { > |pci_cirrus_vga_init(pci_bus); > |} else if (vmsvga_enabled) { > |pci_vmsvga_init(pci_bus); > |} else if (std_vga_enabled) { > |pci_vga_init(pci_bus); > |} Yup. Can we move that to some generic pci file so that we don't have to copy it all over the place? Alex
Re: [Qemu-devel] [PATCH 2/3] g3beige: add a video card only when requested
On Fri, Sep 07, 2012 at 08:58:06PM +0200, Alexander Graf wrote: > > > On 07.09.2012, at 17:27, Aurelien Jarno wrote: > > > The g3beige machine always add a video card, even when the "-vga none" > > is passed. Fix that by checking if it is enabled or not before > > instanciating it. > > > > Cc: Alexander Graf > > Signed-off-by: Aurelien Jarno > > --- > > hw/ppc_oldworld.c |4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c > > index 1dcd8a6..363b0e5 100644 > > --- a/hw/ppc_oldworld.c > > +++ b/hw/ppc_oldworld.c > > @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, > > pci_bus = pci_grackle_init(0xfec0, pic, > >get_system_memory(), > >get_system_io()); > > -pci_vga_init(pci_bus); > > +if (std_vga_enabled) { > > +pci_vga_init(pci_bus); > > Shouldn't we try to have some generic function that can create any PCI VGA > adapter for us? We might want to throw a cirrus or qxl one in a g3beige. > Other hardware supporting different videocard are using this kind of code (a bit more complicated for PC as it allow the card to be on the ISA or on the PCI bus): |/* Optional PCI video card */ |if (cirrus_vga_enabled) { |pci_cirrus_vga_init(pci_bus); |} else if (vmsvga_enabled) { |pci_vmsvga_init(pci_bus); |} else if (std_vga_enabled) { |pci_vga_init(pci_bus); |} -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
[Qemu-devel] [PATCH v2] target-cris: Fix buffer overflow
Report from smatch: target-cris/translate.c:3464 cpu_dump_state(32) error: buffer overflow 'env->sregs' 4 <= 255 sregs is declared 'uint32_t sregs[4][16]', so the first index must be less than 4 or ARRAY_SIZE(env->sregs). Signed-off-by: Stefan Weil --- I did not fix tabs, therefore checkpatch.pl reports an error. Changes in V2: * Use ARRAY_SIZE (suggested by Edgar). target-cris/translate.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-cris/translate.c b/target-cris/translate.c index 1ad9ec7..34c0452 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -3458,7 +3458,7 @@ void cpu_dump_state (CPUCRISState *env, FILE *f, fprintf_function cpu_fprintf, } srs = env->pregs[PR_SRS]; cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs); - if (srs < 256) { + if (srs < ARRAY_SIZE(env->sregs)) { for (i = 0; i < 16; i++) { cpu_fprintf(f, "s%2.2d=%8.8x ", i, env->sregs[srs][i]); -- 1.7.10
Re: [Qemu-devel] [PATCH 4/5] virtio-scsi: Add start/stop functionality for vhost-scsi
Il 07/09/2012 21:23, Nicholas A. Bellinger ha scritto: >> > Please create a completely separate device vhost-scsi-pci instead (or >> > virtio-scsi-tcm-pci, or something like that). It is used completely >> > differently from virtio-scsi-pci, it does not make sense to conflate the >> > two. >> > > Ok, I need to figure out what this will involve over the next days, and > will likely have some more questions for you to get a standlone > vhost-scsi-pci up and running. > > Also just curious (question for Anthony + QEMU folks), how long can we > expect the QEMU 1.3 merge window to be open..? wiki.qemu.org/Planning/1.3 - no hurry, until November 15th. Paolo
Re: [Qemu-devel] [RFC v2] Migration thread
Il 07/09/2012 21:52, Juan Quintela ha scritto: > This is the breakpoint. > > buffered_file: Move from using a timer to use a thread > > Everything before this could be integrated Today, from there, it needs > still more 'thought". True, on the other hand, the split ramlist mutex etc. would be premature. Paolo
Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
Am 06.09.2012 14:48, schrieb Max Filippov: On Thu, Sep 6, 2012 at 8:45 AM, Stefan Weil wrote: Am 06.09.2012 02:36, schrieb Max Filippov: Put the following errno value mappings under #ifdef: xtensa-semi.c: In function 'errno_h2g': xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function) xtensa-semi.c:113: error: (Each undeclared identifier is reported only once xtensa-semi.c:113: error: for each function it appears in.) xtensa-semi.c:113: error: array index in initializer not of integer type xtensa-semi.c:113: error: (near initialization for 'guest_errno') xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function) xtensa-semi.c:124: error: array index in initializer not of integer type xtensa-semi.c:124: error: (near initialization for 'guest_errno') xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function) xtensa-semi.c:134: error: array index in initializer not of integer type xtensa-semi.c:134: error: (near initialization for 'guest_errno') Signed-off-by: Max Filippov --- Is semi hosting a useful feature when QEMU runs on a Windows host? It should be if windows is POSIX enough. If not, you could conditionally compile the whole semi hosting code for non Windows only. If yes, what about the differences in system calls between UNIX like operating systems and Windows? Should the code for 'open' add O_BINARY? ...otherwise \n will turn to \r\n? IIRC this behaviour was tunable at the system level under cygwin. Not under mingw? Is there a list of such differences? Signed-off-by: Stefan Weil Blue, please take the patch as it is and commit it: compilation for MinGW is currently broken, and the patch fixes that. The system calls should be handled by a separate patch. Yes, 'open' with MinGW opens files in text mode by default. That implies automatic translation from \n to \r\n on writes and vice versa on read. It also implies that seeking can give unexpected results. Or-ing the flags for open with O_BINARY would fix the problem and works also for other OS were we define O_BINARY = 0. Like Cygwin, MinGW also supports linking with binmode.o. That file changes the default for open to binary mode, so all open calls in QEMU would automatically be binary. Maybe that second alternative is the better one. I noticed that lseek takes an int32_t offset. Is this intentional? It limits file size to 2 GiB. I did not see other potential problems with the system calls. Thanks, Stefan W.
Re: [Qemu-devel] [PATCH 2/3] g3beige: add a video card only when requested
On 07.09.2012, at 17:27, Aurelien Jarno wrote: > The g3beige machine always add a video card, even when the "-vga none" > is passed. Fix that by checking if it is enabled or not before > instanciating it. > > Cc: Alexander Graf > Signed-off-by: Aurelien Jarno > --- > hw/ppc_oldworld.c |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c > index 1dcd8a6..363b0e5 100644 > --- a/hw/ppc_oldworld.c > +++ b/hw/ppc_oldworld.c > @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, > pci_bus = pci_grackle_init(0xfec0, pic, >get_system_memory(), >get_system_io()); > -pci_vga_init(pci_bus); > +if (std_vga_enabled) { > +pci_vga_init(pci_bus); Shouldn't we try to have some generic function that can create any PCI VGA adapter for us? We might want to throw a cirrus or qxl one in a g3beige. Alex > +} > > escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0], >serial_hds[1], ESCC_CLOCK, 4); > -- > 1.7.10.4 >
Re: [Qemu-devel] [RFC v2] Migration thread
Paolo Bonzini wrote: > Il 07/09/2012 18:23, Juan Quintela ha scritto: >> >> Hi >> >> here is v2 of the migration thread series. There is still some "issues" >> with locking in the error paths (they are at 54 patches now). >> >> Changes from v1: >> - migration stats series are included >> - migration bitmap sync trace-events to know how long it takes >> - file->last_error use almost removed >> reworked functions to return real error codes and work with that. >> Some more work needed here. >> - new savevm for live migration pending method. see last commit for >> details. > > Can you start factoring out any cleanup that can be applied independently? This is the breakpoint. buffered_file: Move from using a timer to use a thread Everything before this could be integrated Today, from there, it needs still more 'thought". As said, buffered_file.c is almost gone, and file->last_error is almost gone. That were the things that I wanted to clean to be able to split the generation of migration data and its writting. Later, Juan.
[Qemu-devel] [PATCH] qxl: Ignore set_client_capabilities pre/post migrate
The recent introduction of set_client_capabilities has broken (seamless) migration by trying to call qxl_send_events pre (seamless incoming) and post (*) migration, triggering the following assert: qxl_send_events: Assertion `qemu_spice_display_is_running(&d->ssd)' failed. The solution is easy, pre migration the guest will have already received the client caps on the migration source side, and post migration there no longer is a guest, so we can simply ignore the set_client_capabilities call in both those scenarios. *) Post migration, so not fatal for to the migration itself, but still a crash Signed-off-by: Hans de Goede --- hw/qxl.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/qxl.c b/hw/qxl.c index 045432e..1b400f1 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -953,6 +953,11 @@ static void interface_set_client_capabilities(QXLInstance *sin, { PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); +if (runstate_check(RUN_STATE_INMIGRATE) || +runstate_check(RUN_STATE_POSTMIGRATE)) { +return; +} + qxl->shadow_rom.client_present = client_present; memcpy(qxl->shadow_rom.client_capabilities, caps, sizeof(caps)); qxl->rom->client_present = client_present; -- 1.7.12
[Qemu-devel] [PULL for usb-next]: Add support for live-migration to usb-redir (v2)
Hi Gerd, I'm very happy to present to you a pull-request for usb-redir live-migration support. I've tested this combined with Spice seamless migration, and it can successful: 1) migrate a vm while running "dd if=/dev/zero of=/dev/sdb1 bs=32K" inside the guest with sdb being a redirect USB-2 mass storage device. 2) migrate a vm while running camorama inside the vm showing a 720p video from a redirected USB-2 webcam at 30 fps! Note this is based on usb-next rather then master / usb.62, since one of my patches would otherwise conflict with your recent ehci changes. Changes in v2: - As discussed drop the "usb: Migrate over device speed and speedmask" patch The following changes since commit a44fd2e0c66b2276f586948702e5ebc7136fdb73: usb-host: allow emulated (non-async) control requests without USBPacket (2012-09-06 12:03:41 +0200) are available in the git repository at: git://people.freedesktop.org/~jwrdegoede/qemu usb-for-gerd for you to fetch changes up to 6ef0b771704ca898a44c1f9ea41ab98590fc2e84: usb-redir: Add chardev open / close debug logging (2012-09-07 21:27:16 +0200) Hans de Goede (8): ehci: Don't set seen to 0 when removing unseen queue-heads ehci: Walk async schedule before and after migration ehci: Don't process too much frames in 1 timer tick usb-redir: Change cancelled packet code into a generic packet-id queue usb-redir: Add an already_in_flight packet-id queue usb-redir: Store max_packet_size in endp_data usb-redir: Add support for migration usb-redir: Add chardev open / close debug logging hw/usb/hcd-ehci.c | 61 ++- hw/usb/redirect.c | 500 ++ 2 files changed, 522 insertions(+), 39 deletions(-) Thanks & Regards, Hans
Re: [Qemu-devel] [PATCH 4/5] virtio-scsi: Add start/stop functionality for vhost-scsi
On Fri, 2012-09-07 at 18:00 +0200, Paolo Bonzini wrote: > Il 07/09/2012 08:48, Nicholas A. Bellinger ha scritto: > > Cc: Stefan Hajnoczi > > Cc: Zhi Yong Wu > > Cc: Michael S. Tsirkin > > Cc: Paolo Bonzini > > Signed-off-by: Nicholas Bellinger > > --- > > hw/virtio-pci.c |2 ++ > > hw/virtio-scsi.c | 49 + > > hw/virtio-scsi.h |1 + > > 3 files changed, 52 insertions(+), 0 deletions(-) > > Please create a completely separate device vhost-scsi-pci instead (or > virtio-scsi-tcm-pci, or something like that). It is used completely > differently from virtio-scsi-pci, it does not make sense to conflate the > two. > Ok, I need to figure out what this will involve over the next days, and will likely have some more questions for you to get a standlone vhost-scsi-pci up and running. Also just curious (question for Anthony + QEMU folks), how long can we expect the QEMU 1.3 merge window to be open..? Thanks Paolo! --nab
Re: [Qemu-devel] [Qemu-ppc] [PATCH: RFC] Adding BAR0 for e500 PCI controller
On 09/07/2012 03:08 AM, Alexander Graf wrote: > > > On 07.09.2012, at 01:15, Scott Wood wrote: > >> On 09/03/2012 01:44 AM, Bhushan Bharat-R65777 wrote: >>> >>> -Original Message- From: Wood Scott-B07421 Sent: Wednesday, August 15, 2012 6:59 AM To: Bhushan Bharat-R65777 Cc: qemu-devel@nongnu.org; qemu-...@nongnu.org; ag...@suse.de; Bhushan Bharat- R65777 Subject: Re: [Qemu-ppc] [PATCH: RFC] Adding BAR0 for e500 PCI controller On 08/14/2012 07:50 AM, Bharat Bhushan wrote: > PCI Root complex have TYPE-1 configuration header while PCI > endpoint have type-0 configuration header. The type-1 > configuration header have a BAR (BAR0). In Freescale PCI > controller BAR0 is used for mapping pci address space to CCSR > address space. This can used for 2 purposes: 1) for MSI interrupt > generation 2) Allow CCSR registers access when configured as PCI > endpoint, which I am not sure is a use case with QEMU-KVM guest. > > What I observed is that when guest read the size of BAR0 of host > controller configuration header (TYPE1 header) then it always > reads it as 0. When looking into the QEMU hw/ppce500_pci.c, I do > not find the PCI controller device registering BAR0. I do not > find any other controller also doing so may they do not use > BAR0. > > There are two issues when BAR0 is not there (which I can think > of): 1) There should be BAR0 emulated for PCI Root comaplex > (TYPE1 header) and when reading the size of BAR0, it should give > size as per real h/w. > > 2) Do we need this BAR0 inbound address translation? When BAR0 is > of non-zero size then it will be configured for PCI address space > to local address(CCSR) space translation on inbound access. The > primary use case is for MSI interrupt generation. The device is > configured with a address offsets in PCI address space, which > will be translated to MSI interrupt generation MPIC registers. > Currently I do not understand the MSI interrupt generation > mechanism in QEMU and also IIRC we do not use QEMU MSI interrupt > mechanism on e500 guest machines. But this BAR0 will be used when > using MSI on e500. This patch is only trying to address #1, right? I don't see any connection from this BAR to CCSR. > +memory_region_init_io(&h->bar0, &pci_host_conf_be_ops, h, + > "PCIHOST-bar0", 0x100); 0x0100 is correct for e500mc-based systems, but it should be 0x0010 for e500v2-based systems. >>> >>> Scott, >>> >>> Currently we have a generic e500 machine which have CCSR size >>> 0x0010 (MPC8544_CCSRBAR_SIZE). We do not have e500mc and e500v2 >>> machines. So should we make this 0x0010 as per generic e500 >>> machine? >> >> Yes, but structure it so that board code decides the size, not the PCI code. >> >>> Can we somehow pass this via qdev/varargs from machine emulation code >>> (hw/ppc/e500.c) ? >> >> Possibly, though it may not be the best idea to express every single >> aspect of intercomponent integration via qdev -- maybe that's best left >> for things that are reasonably user-tweakable. If CCSR size is user >> tweakable, it would be somewhere other than the PCI controller. > > It depends. Qdev properties are basically object constructor > parameters. So if you were weiting C++ code and would have a > constructor that gets the size as argument, it would end up being > modeled as qdev property. > > If however actual functionality differs, thus you would in OO speech > create a subclass / child class, then you are better off creating a > new device struct. > > In this case, I'm not sure. They are different devices really, but > are close enough that the differences could be expressed through qdev > properties. I wasn't suggesting that they be different devices. I was suggesting that this isn't a property of the PCI controller, but rather of some other entity to which the PCI controller connects. So maybe a reference to the associated CCSR object would be a qdev parameter, but not the size of that CCSR. -Scott
Re: [Qemu-devel] [PULL for usb-next]: Add support for live-migration to usb-redir
Hi, On 09/07/2012 01:47 PM, Hans de Goede wrote: Hi Gerd, I'm very happy to present to you a pull-request for usb-redir live-migration support. I've tested this combined with Spice seamless migration, and it can successful: 1) migrate a vm while running "dd if=/dev/zero of=/dev/sdb1 bs=32K" inside the guest with sdb being a redirect USB-2 mass storage device. 2) migrate a vm while running camorama inside the vm showing a 720p video from a redirected USB-2 webcam at 30 fps! Note this is based on usb-next rather then master / usb.62, since one of my patches would otherwise conflict with your recent ehci changes. The following changes since commit a44fd2e0c66b2276f586948702e5ebc7136fdb73: usb-host: allow emulated (non-async) control requests without USBPacket (2012-09-06 12:03:41 +0200) are available in the git repository at: git://people.freedesktop.org/~jwrdegoede/qemu usb-for-gerd for you to fetch changes up to 5f5f0f1eaa29ec1cb07fc906acf917d5648b3bcf: usb-redir: Add chardev open / close debug logging (2012-09-07 13:44:49 +0200) Hans de Goede (9): ehci: Don't set seen to 0 when removing unseen queue-heads ehci: Walk async schedule before and after migration ehci: Don't process too much frames in 1 timer tick usb: Migrate over device speed and speedmask Hmm, thinking more about this, this one is only necessary for usb-redir, since for normal devices both get set from the descriptors of the device + the port speedmask, which are const from a migration pov, so no need to migrate them. And usb-redir itself can re-construct them in its post_load function since it migrates over the usb-redir device_info struct already. So let me respin this patch set, dropping the above patch... usb-redir: Change cancelled packet code into a generic packet-id queue usb-redir: Add an already_in_flight packet-id queue usb-redir: Store max_packet_size in endp_data usb-redir: Add support for migration and instead set speed and speedmask from this patch. usb-redir: Add chardev open / close debug logging hw/usb.h | 4 +- hw/usb/bus.c | 2 + hw/usb/hcd-ehci.c | 61 ++- hw/usb/redirect.c | 482 ++ 4 files changed, 508 insertions(+), 41 deletions(-) Regards, Hans
Re: [Qemu-devel] [RFC v2 PATCH 3/6] blockdev: rename block_stream_cb to a generic block_job_cb
Il 07/09/2012 19:04, Jeff Cody ha scritto: > On 09/07/2012 12:27 PM, Paolo Bonzini wrote: >> Il 30/08/2012 20:47, Jeff Cody ha scritto: >>> @@ -53,6 +53,8 @@ static const int if_max_devs[IF_COUNT] = { >>> [IF_SCSI] = 7, >>> }; >>> >>> +static void block_job_cb(void *opaque, int ret); >>> + >>> /* >>> * We automatically delete the drive when a device using it gets >>> * unplugged. Questionable feature, but we can't just drop it. >> >> Can you avoid the forward declaration? >> >> Paolo >> > > Yes, sure - honestly, I added this patch in, but I assumed that the > similar patch of yours to support mirroring would go in first, making > this patch moot. I now took this patch of yours in my tree (minus the forward declaration), so... Paolo
Re: [Qemu-devel] [RFC v2] Migration thread
Il 07/09/2012 18:23, Juan Quintela ha scritto: > > Hi > > here is v2 of the migration thread series. There is still some "issues" > with locking in the error paths (they are at 54 patches now). > > Changes from v1: > - migration stats series are included > - migration bitmap sync trace-events to know how long it takes > - file->last_error use almost removed > reworked functions to return real error codes and work with that. > Some more work needed here. > - new savevm for live migration pending method. see last commit for > details. Can you start factoring out any cleanup that can be applied independently? Paolo > Please test and comment. > > Later, Juan. > > The following changes since commit 6e4c0d1f03d6ab407509c32fab7cb4b8230f57ff: > > hw/pl110: Fix spelling of 'palette' (2012-09-06 17:04:33 +0200) > > are available in the git repository at: > > http://repo.or.cz/r/qemu/quintela.git migration-thread-v2 > > for you to fetch changes up to 688feac0fbc287920dff537ed13fb8483c064f7f: > > savem: Add calculating a new save_live migration method: pending > (2012-09-07 14:00:35 +0200) > > > Juan Quintela (49): > buffered_file: g_realloc() can't fail > fix migration sync > migration: store end_time in a local variable > migration: print total downtime for final phase of migration > migration: rename expected_time to expected_downtime > migration: export migrate_get_current() > migration: print expected downtime in info migrate > savevm: Factorize ram globals reset in its own function > ram: introduce migration_bitmap_set_dirty() > ram: Introduce migration_bitmap_test_and_reset_dirty() > ram: Export last_ram_offset() > ram: introduce migration_bitmap_sync() > ram: create trace event for migration sync bitmap > Separate migration bitmap > migration: Add dirty_pages_rate to query migrate output > buffered_file: rename opaque to migration_state > buffered_file: opaque is MigrationState > buffered_file: unfold migrate_fd_put_buffer > buffered_file: unfold migrate_fd_put_ready > buffered_file: unfold migrate_fd_put_buffer > buffered_file: unfold migrate_fd_put_buffer > buffered_file: We can access directly to bandwidth_limit > buffered_file: callers of buffered_flush() already check for errors > buffered_file: make buffered_flush return the error code > migration: make migrate_fd_wait_for_unfreeze() return errors > savevm: unexport qemu_fflush > viritio-net: use qemu_get_buffer() in a temp buffer > savevm: Remove qemu_fseek() > savevm: make qemu_fflush() return an error code > savevm: unfold qemu_fclose_internal() > savevm: unexport qemu_ftell() > savevm: make qemu_fill_buffer() be consistent > savevm: Only qemu_fflush() can generate errors > buffered_file: buffered_put_buffer() don't need to set last_error > block-migration: make flush_blks() return errors > block-migration: Switch meaning of return value > block-migration: handle errors with the return codes correctly > savevm: un-export qemu_file_set_error() > savevm: make qemu_file_put_notify() return errors > buffered_file: Move from using a timer to use a thread > migration: make qemu_fopen_ops_buffered() return void > migration: stop all cpus correctly > migration: make writes blocking > migration: remove unfreeze logic > migration: take finer locking > buffered_file: Unfold the trick to restart generating migration data > buffered_file: don't flush on put buffer > buffered_file: unfold buffered_append in buffered_put_buffer > savem: Add calculating a new save_live migration method: pending > > Paolo Bonzini (2): > split MRU ram list > BufferedFile: append, then flush > > Umesh Deshpande (2): > add a version number to ram_list > protect the ramlist with a separate mutex > > arch_init.c | 174 > block-migration.c | 100 + > buffered_file.c | 213 > +- > buffered_file.h | 12 +-- > cpu-all.h | 17 - > exec-obsolete.h | 10 --- > exec.c| 45 ++-- > hmp.c | 12 +++ > hw/virtio-net.c | 4 +- > migration-exec.c | 2 - > migration-fd.c| 6 -- > migration-tcp.c | 2 +- > migration-unix.c | 2 - > migration.c | 151 +++--- > migration.h | 10 +++ > qapi-schema.json | 18 - > qemu-file.h | 11 --- > qmp-commands.hx | 9 +++ > savevm.c | 144 ++-- > sysemu.h | 1 + > trace-events | 4 + > vmstate.h | 1 + > 22 files changed, 498 insertions
Re: [Qemu-devel] [RFC v2 PATCH 3/6] blockdev: rename block_stream_cb to a generic block_job_cb
On 09/07/2012 12:27 PM, Paolo Bonzini wrote: > Il 30/08/2012 20:47, Jeff Cody ha scritto: >> @@ -53,6 +53,8 @@ static const int if_max_devs[IF_COUNT] = { >> [IF_SCSI] = 7, >> }; >> >> +static void block_job_cb(void *opaque, int ret); >> + >> /* >> * We automatically delete the drive when a device using it gets >> * unplugged. Questionable feature, but we can't just drop it. > > Can you avoid the forward declaration? > > Paolo > Yes, sure - honestly, I added this patch in, but I assumed that the similar patch of yours to support mirroring would go in first, making this patch moot.
Re: [Qemu-devel] [RFC v2 PATCH 3/6] blockdev: rename block_stream_cb to a generic block_job_cb
Il 30/08/2012 20:47, Jeff Cody ha scritto: > @@ -53,6 +53,8 @@ static const int if_max_devs[IF_COUNT] = { > [IF_SCSI] = 7, > }; > > +static void block_job_cb(void *opaque, int ret); > + > /* > * We automatically delete the drive when a device using it gets > * unplugged. Questionable feature, but we can't just drop it. Can you avoid the forward declaration? Paolo
[Qemu-devel] [RFC v2] Migration thread
Hi here is v2 of the migration thread series. There is still some "issues" with locking in the error paths (they are at 54 patches now). Changes from v1: - migration stats series are included - migration bitmap sync trace-events to know how long it takes - file->last_error use almost removed reworked functions to return real error codes and work with that. Some more work needed here. - new savevm for live migration pending method. see last commit for details. Please test and comment. Later, Juan. The following changes since commit 6e4c0d1f03d6ab407509c32fab7cb4b8230f57ff: hw/pl110: Fix spelling of 'palette' (2012-09-06 17:04:33 +0200) are available in the git repository at: http://repo.or.cz/r/qemu/quintela.git migration-thread-v2 for you to fetch changes up to 688feac0fbc287920dff537ed13fb8483c064f7f: savem: Add calculating a new save_live migration method: pending (2012-09-07 14:00:35 +0200) Juan Quintela (49): buffered_file: g_realloc() can't fail fix migration sync migration: store end_time in a local variable migration: print total downtime for final phase of migration migration: rename expected_time to expected_downtime migration: export migrate_get_current() migration: print expected downtime in info migrate savevm: Factorize ram globals reset in its own function ram: introduce migration_bitmap_set_dirty() ram: Introduce migration_bitmap_test_and_reset_dirty() ram: Export last_ram_offset() ram: introduce migration_bitmap_sync() ram: create trace event for migration sync bitmap Separate migration bitmap migration: Add dirty_pages_rate to query migrate output buffered_file: rename opaque to migration_state buffered_file: opaque is MigrationState buffered_file: unfold migrate_fd_put_buffer buffered_file: unfold migrate_fd_put_ready buffered_file: unfold migrate_fd_put_buffer buffered_file: unfold migrate_fd_put_buffer buffered_file: We can access directly to bandwidth_limit buffered_file: callers of buffered_flush() already check for errors buffered_file: make buffered_flush return the error code migration: make migrate_fd_wait_for_unfreeze() return errors savevm: unexport qemu_fflush viritio-net: use qemu_get_buffer() in a temp buffer savevm: Remove qemu_fseek() savevm: make qemu_fflush() return an error code savevm: unfold qemu_fclose_internal() savevm: unexport qemu_ftell() savevm: make qemu_fill_buffer() be consistent savevm: Only qemu_fflush() can generate errors buffered_file: buffered_put_buffer() don't need to set last_error block-migration: make flush_blks() return errors block-migration: Switch meaning of return value block-migration: handle errors with the return codes correctly savevm: un-export qemu_file_set_error() savevm: make qemu_file_put_notify() return errors buffered_file: Move from using a timer to use a thread migration: make qemu_fopen_ops_buffered() return void migration: stop all cpus correctly migration: make writes blocking migration: remove unfreeze logic migration: take finer locking buffered_file: Unfold the trick to restart generating migration data buffered_file: don't flush on put buffer buffered_file: unfold buffered_append in buffered_put_buffer savem: Add calculating a new save_live migration method: pending Paolo Bonzini (2): split MRU ram list BufferedFile: append, then flush Umesh Deshpande (2): add a version number to ram_list protect the ramlist with a separate mutex arch_init.c | 174 block-migration.c | 100 + buffered_file.c | 213 +- buffered_file.h | 12 +-- cpu-all.h | 17 - exec-obsolete.h | 10 --- exec.c| 45 ++-- hmp.c | 12 +++ hw/virtio-net.c | 4 +- migration-exec.c | 2 - migration-fd.c| 6 -- migration-tcp.c | 2 +- migration-unix.c | 2 - migration.c | 151 +++--- migration.h | 10 +++ qapi-schema.json | 18 - qemu-file.h | 11 --- qmp-commands.hx | 9 +++ savevm.c | 144 ++-- sysemu.h | 1 + trace-events | 4 + vmstate.h | 1 + 22 files changed, 498 insertions(+), 450 deletions(-)
Re: [Qemu-devel] ping Re: [RFC PATCH 00/13] Embedded NBD server
Am 07.09.2012 17:50, schrieb Paolo Bonzini: > Il 27/08/2012 17:00, Paolo Bonzini ha scritto: >> The part where I need >> a second opinion and/or ack is patch 12 and 13. They fix the case of >> a disk being unplugged while NBD export is active. To do this I add a >> NotifierList to a BlockDriverState. Does this look okay, or is it too >> ad hoc? > > Ping... Kevin/Stefan, could you look at just these two patches: > > http://permalink.gmane.org/gmane.comp.emulators.qemu/167411 > [12/13] block: add close notifiers > > http://permalink.gmane.org/gmane.comp.emulators.qemu/167410 > [13/13] nbd: add notifier to close exports when the image is closed > > and if you need some context: > > http://permalink.gmane.org/gmane.comp.emulators.qemu/167400 > [09/13] qmp: add NBD server commands > > > Everything else is totally uninteresting. I was planning to review it in more detail next week, but I just had a quick look. I'm not sure if automatically shutting down the NBD server when the guest stops using it is always right (for removable media it could even be an eject from the guest), but introducing a notifier list doesn't look too bad. We can probably use it for other things that are currently hardcoded in bdrv_close() with some if statements, like disabling I/O throttling, cancelling a block job, etc. Kevin
[Qemu-devel] Linux KVM, Windows 7 guest choppy sound
Hi, I apologize if this isn't the right venue for this message, but this mailing list seems a bit more active than qemu-discuss. Background: I am running OpenSUSE 12.1. I fixed audio issues in VM guests by setting the following in qemu.conf: vnc_allow_host_audio = 1 I also set user= and group= to allow qemu-kvm to run as the same user as I am logged in as. This allowed qemu-kvm to send audio to pulseaudio. My issue: I am using the ICH6 virtual audio driver in my VMs. In my Linux VMs, the sound works perfectly without any issues. In my Windows 7 VM, the sound works with the exception of static and choppiness in the audio. Has anyone else seen this or have any ideas for a fix? Thanks! Regards Erik
Re: [Qemu-devel] [PATCH 4/5] virtio-scsi: Add start/stop functionality for vhost-scsi
Il 07/09/2012 08:48, Nicholas A. Bellinger ha scritto: > Cc: Stefan Hajnoczi > Cc: Zhi Yong Wu > Cc: Michael S. Tsirkin > Cc: Paolo Bonzini > Signed-off-by: Nicholas Bellinger > --- > hw/virtio-pci.c |2 ++ > hw/virtio-scsi.c | 49 + > hw/virtio-scsi.h |1 + > 3 files changed, 52 insertions(+), 0 deletions(-) Please create a completely separate device vhost-scsi-pci instead (or virtio-scsi-tcm-pci, or something like that). It is used completely differently from virtio-scsi-pci, it does not make sense to conflate the two. Paolo
Re: [Qemu-devel] [RFC v2 PATCH 2/6] block: add live block commit functionality
On 09/06/2012 05:16 PM, Eric Blake wrote: > On 09/06/2012 02:37 PM, Jeff Cody wrote: >> On 09/06/2012 10:00 AM, Kevin Wolf wrote: >>> Am 30.08.2012 20:47, schrieb Jeff Cody: This adds the live commit coroutine. This iteration focuses on the commit only below the active layer, and not the active layer itself. The behaviour is similar to block streaming; the sectors are walked through, and anything that exists above 'base' is committed back down into base. At the end, intermediate images are deleted, and the chain stitched together. Images are restored to their original open flags upon completion. > >> >>> What should we do with backing files that are smaller than the image to >>> commit? In this version, data is copied up to the size of the backing >>> file, and then we get -EIO from bdrv_co_do_writev(). >>> >> >> We could leave it like that, and let it receive -EIO in that case. >> Alternatively, we could try and determine before the commit if the data >> will fit in the base, and return -ENOSPC if not. > > Neither sounds appealing. Why can't we first try to resize the base to > the new data size being committed, and only fall back to -ENOSPC or -EIO > if the resize fails? > OK - we will attempt to resize the base, and return the appropriate error on failure or if unsupported for the format.
[Qemu-devel] ping Re: [RFC PATCH 00/13] Embedded NBD server
Il 27/08/2012 17:00, Paolo Bonzini ha scritto: > The part where I need > a second opinion and/or ack is patch 12 and 13. They fix the case of > a disk being unplugged while NBD export is active. To do this I add a > NotifierList to a BlockDriverState. Does this look okay, or is it too > ad hoc? Ping... Kevin/Stefan, could you look at just these two patches: http://permalink.gmane.org/gmane.comp.emulators.qemu/167411 [12/13] block: add close notifiers http://permalink.gmane.org/gmane.comp.emulators.qemu/167410 [13/13] nbd: add notifier to close exports when the image is closed and if you need some context: http://permalink.gmane.org/gmane.comp.emulators.qemu/167400 [09/13] qmp: add NBD server commands Everything else is totally uninteresting. Paolo
Re: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering
On Fri, Sep 07, 2012 at 04:04:16PM +0100, Peter Maydell wrote: > On 7 September 2012 15:56, Aurelien Jarno wrote: > > On Thu, Aug 23, 2012 at 05:39:39PM +0200, Aurelien Jarno wrote: > >> The lan9118 emulation tries to compute the multicast index by calling > >> directly the crc32() function from zlib, but fails to get the correct > >> result. > >> > >> Use the common compute_mcast_idx() function instead, which gives the > >> correct result. This fixes IPv6 support. > >> > >> Signed-off-by: Aurelien Jarno > >> --- > >> hw/lan9118.c |2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/hw/lan9118.c b/hw/lan9118.c > >> index ff0a50b..ceaf96f 100644 > >> --- a/hw/lan9118.c > >> +++ b/hw/lan9118.c > >> @@ -500,7 +500,7 @@ static int lan9118_filter(lan9118_state *s, const > >> uint8_t *addr) > >> } > >> } else { > >> /* Hash matching */ > >> -hash = (crc32(~0, addr, 6) >> 26); > >> +hash = compute_mcast_idx(addr); > >> if (hash & 0x20) { > >> return (s->mac_hashh >> (hash & 0x1f)) & 1; > >> } else { > > > > Ping? > > > > For the record the Linux kernel uses the ether_crc() function for > > smsc911x.c, but also for 8139cp.c, 8139too.c and ethoc.c, which use > > compute_mcast_idx() on the QEMU side. > > Looks ok to me. I did check the data sheet, which helpfully doesn't > say exactly what the CRC function is, and also the zlib docs (which > suggest we should use something that isn't what we were doing here). > So I guess > > Reviewed-by: Peter Maydell > > Happy for you to commit directly or I can put it in arm-devs.next > if you prefer. > Thanks for the review, I have applied it. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
[Qemu-devel] [PATCH 3/3] mac99: add a video card only when requested
The mac99 machine always add a video card, even when the "-vga none" is passed. Fix that by checking if it is enabled or not before instanciating it. Cc: Alexander Graf Signed-off-by: Aurelien Jarno --- hw/ppc_newworld.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index e95cfe8..6db8b3a 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -330,7 +330,9 @@ static void ppc_core99_init (ram_addr_t ram_size, machine_arch = ARCH_MAC99; } /* init basic PC hardware */ -pci_vga_init(pci_bus); +if (std_vga_enabled) { +pci_vga_init(pci_bus); +} escc_mem = escc_init(0, pic[0x25], pic[0x24], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); -- 1.7.10.4
[Qemu-devel] [PATCH 1/3] sun4u: add a video card only when requested
The sun4u machine always add a video card, even when "-vga none" is passed. Fix that by checking if it is enabled or not before instanciating it. Cc: Blue Swirl Signed-off-by: Aurelien Jarno --- hw/sun4u.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/sun4u.c b/hw/sun4u.c index 07cd042..c6bf6eb 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -821,7 +821,9 @@ static void sun4uv_init(MemoryRegion *address_space_mem, ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, env, IVEC_MAX); pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_bus2, &pci_bus3, &pbm_irqs); -pci_vga_init(pci_bus); +if (std_vga_enabled) { +pci_vga_init(pci_bus); +} // XXX Should be pci_bus3 isa_bus = pci_ebus_init(pci_bus, -1, pbm_irqs); -- 1.7.10.4
[Qemu-devel] [PATCH 2/3] g3beige: add a video card only when requested
The g3beige machine always add a video card, even when the "-vga none" is passed. Fix that by checking if it is enabled or not before instanciating it. Cc: Alexander Graf Signed-off-by: Aurelien Jarno --- hw/ppc_oldworld.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index 1dcd8a6..363b0e5 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -250,7 +250,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, pci_bus = pci_grackle_init(0xfec0, pic, get_system_memory(), get_system_io()); -pci_vga_init(pci_bus); +if (std_vga_enabled) { +pci_vga_init(pci_bus); +} escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); -- 1.7.10.4
Re: [Qemu-devel] [PATCH] musicpal: Fix flash mapping
On 7 September 2012 15:53, Jan Kiszka wrote: > On 2012-09-07 16:41, Peter Maydell wrote: >> On 7 September 2012 00:03, Jan Kiszka wrote: >>> +pflash_cfi02_register(0x1-MP_FLASH_SIZE_MAX, NULL, >> >> I don't think this will compile on a 32 bit system, will it? >> You probably want an ULL suffix. > > It does as the result always fits in 32 bits. But I can add that if you > prefer. I think I had a misconception of this bit of the C standard. C will pick a type big enough to fit the constant value (which will in this case be a 64 bit type of some kind), even without an ULL suffix. So you're right, it's OK. Reviewed-by: Peter Maydell -- PMM
Re: [Qemu-devel] [RFC v2 PATCH 1/6] block: add support functions for live commit, to find and delete images.
On 09/07/2012 06:19 AM, Kevin Wolf wrote: > Am 06.09.2012 16:59, schrieb Jeff Cody: >> On 09/06/2012 09:23 AM, Kevin Wolf wrote: >>> Am 30.08.2012 20:47, schrieb Jeff Cody: Add bdrv_find_child(), and bdrv_delete_intermediate(). bdrv_find_child(): given 'bs' and the active (topmost) BDS of an image chain, find the image that is the immediate top of 'bs' bdrv_delete_intermediate(): Given 3 BDS (active, top, base), delete images above base up to and including top, and set base to be the parent of top's child node. E.g., this converts: bottom <- base <- intermediate <- top <- active to bottom <- base <- active where top == active is permitted, although active will not be deleted. Signed-off-by: Jeff Cody >>> >>> At first, when just reading the function name, I thought this would >>> actually delete the image file. Of course, it only removes it from the >>> backing file chain, but leaves the image file around. I don't have a >>> good suggestion, but if someone has a better name, I think we should >>> change it. >> >> Hmm, the naming seems consistent with bdrv_delete(), which does not >> actually delete the image files either (and, that is essentially what >> this does... calls bdrv_delete(), on the intermediate images). >> >> However, here are some other name proposals: >> >>* bdrv_disconnect_intermediate() >>* bdrv_drop_intermediate() >>* bdrv_shorten_chain() > > bdrv_drop_intermediate() sounds good to me. > >>> + +typedef struct BlkIntermediateStates { +BlockDriverState *bs; +QSIMPLEQ_ENTRY(BlkIntermediateStates) entry; +} BlkIntermediateStates; + + +/* deletes images above 'base' up to and including 'top', and sets the image + * above 'top' to have base as its backing file. + * + * E.g., this will convert the following chain: + * bottom <- base <- intermediate <- top <- active + * + * to + * + * bottom <- base <- active + * + * It is allowed for bottom==base, in which case it converts: + * + * base <- intermediate <- top <- active + * + * to + * + * base <- active + * + * It is also allowed for top==active, except in that case active is not + * deleted: >>> >>> Hm, makes the interface inconsistent. Shouldn't you be using top == >>> intermediate and it would work without any special casing? >>> >> >> To remain consistent, maybe we should define it as an error if >> top==active, and return error in that case? The caller can be >> responsible for checking for that - if the caller wants to merge down >> the active layer, there are additional steps to be taken anyway. > > Yes, why not. > > And we can always revisit when implementing the additional functionality. > +/* we could not find the image above 'top', this is an error */ +goto exit; +} + +/* if the active and top image passed in are the same, then we + * can't delete the active, so we start one below + */ +intermediate = (active == top) ? active->backing_hd : top; >>> >>> Aha. So intermediate is used to undo the special case. Now we're always >>> on the last image to be deleted. >>> >>> This is equivalent to an unconditional new_top_bs->backing_hd. > > How about changing this to use the simpler unconditional version? Sure - since active == top is now an error, there is no reason for the more complicated logic. And at this point, the statement (new_top_bs->backing_hd == top) should always be true. > > Kevin >
[Qemu-devel] [PATCH] target-sparc: fix fcmp{s, d, q} instructions wrt exception
fcmp{s,d,q} instructions are supposed to ignore quiet NaN (contrary to the fcmpe{s,d,q} instructions), but the current code is wrongly setting the NV exception in that case. Moreover the current code is duplicated: first the arguments are checked for NaN to generate an exception, and later in case the comparison is unordered (which can only happens if one of the argument is a NaN), the same check is done to generate an exception. Fix that by calling clear_float_exceptions() followed by check_ieee_exceptions() as for the other floating point instructions. Use the _compare_quiet functions for fcmp{s,d,q} and the _compare ones for fcmpe{s,d,q}. Simplify the flag setting by not clearing a flag that is set the line just below. This fix allows the math glibc testsuite to pass. Cc: Blue Swirl Signed-off-by: Aurelien Jarno --- target-sparc/fop_helper.c | 67 ++--- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/target-sparc/fop_helper.c b/target-sparc/fop_helper.c index 9c64ef8..f4b62a5 100644 --- a/target-sparc/fop_helper.c +++ b/target-sparc/fop_helper.c @@ -334,34 +334,28 @@ void helper_fsqrtq(CPUSPARCState *env) } #define GEN_FCMP(name, size, reg1, reg2, FS, E) \ -void glue(helper_, name) (CPUSPARCState *env)\ +void glue(helper_, name) (CPUSPARCState *env) \ { \ -env->fsr &= FSR_FTT_NMASK; \ -if (E && (glue(size, _is_any_nan)(reg1) || \ - glue(size, _is_any_nan)(reg2)) && \ -(env->fsr & FSR_NVM)) { \ -env->fsr |= FSR_NVC;\ -env->fsr |= FSR_FTT_IEEE_EXCP; \ -helper_raise_exception(env, TT_FP_EXCP);\ +int ret;\ +clear_float_exceptions(env);\ +if (E) {\ +ret = glue(size, _compare)(reg1, reg2, &env->fp_status);\ +} else {\ +ret = glue(size, _compare_quiet)(reg1, reg2,\ + &env->fp_status); \ } \ -switch (glue(size, _compare) (reg1, reg2, &env->fp_status)) { \ +check_ieee_exceptions(env); \ +switch (ret) { \ case float_relation_unordered: \ -if ((env->fsr & FSR_NVM)) { \ -env->fsr |= FSR_NVC;\ -env->fsr |= FSR_FTT_IEEE_EXCP; \ -helper_raise_exception(env, TT_FP_EXCP);\ -} else {\ -env->fsr &= ~((FSR_FCC1 | FSR_FCC0) << FS); \ -env->fsr |= (FSR_FCC1 | FSR_FCC0) << FS;\ -env->fsr |= FSR_NVA;\ -} \ +env->fsr |= (FSR_FCC1 | FSR_FCC0) << FS;\ +env->fsr |= FSR_NVA;\ break; \ case float_relation_less: \ -env->fsr &= ~((FSR_FCC1 | FSR_FCC0) << FS); \ +env->fsr &= ~(FSR_FCC1) << FS; \ env->fsr |= FSR_FCC0 << FS; \ break; \ case float_relation_greater:\ -env->fsr &= ~((FSR_FCC1 | FSR_FCC0) << FS); \ +env->fsr &= ~(FSR_FCC0) << FS; \ env->fsr |= FSR_FCC1 << FS; \ break; \ default:\ @@ -370,34 +364,27 @@ void helper_fsqrtq(CPUSPARCState *env) } \ } #define GEN_FCMP_T(name, size, FS, E) \ -void glue(helper_, name)(CPUSPARCState *env, size src1, size src2) \ +void glue(helper_, name)(CPUSPARCState *env, s
[Qemu-devel] [PATCH] pflash_cfi01: fix vendor specific extended query
pflash_cfi01 announces a version number of 1.1, which implies "Protection Register Information" and "Burst Read information" sections, which are not provided. Decrease the version number to 1.0 so that only the "Protection Register Information" section is needed. Set the number of protection fields (0x3f) to 0x01, as 0x00 means 256 protections field, which makes the CFI table bigger than the current implementation, causing some kernels to fail to read it. Signed-off-by: Aurelien Jarno --- hw/pflash_cfi01.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index d1c7423..d56b51a 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -711,7 +711,7 @@ pflash_t *pflash_cfi01_register(target_phys_addr_t base, pfl->cfi_table[0x33] = 'I'; pfl->cfi_table[0x34] = '1'; -pfl->cfi_table[0x35] = '1'; +pfl->cfi_table[0x35] = '0'; pfl->cfi_table[0x36] = 0x00; pfl->cfi_table[0x37] = 0x00; @@ -723,6 +723,8 @@ pflash_t *pflash_cfi01_register(target_phys_addr_t base, pfl->cfi_table[0x3b] = 0x00; pfl->cfi_table[0x3c] = 0x00; +pfl->cfi_table[0x3f] = 0x01; /* Number of protection fields */ + return pfl; } -- 1.7.10.4
Re: [Qemu-devel] [PATCH v6 2/2] block: Support GlusterFS as a QEMU block backend
Il 07/09/2012 17:06, Bharata B Rao ha scritto: > qemu_gluster_aio_event_reader() is the node->io_read in qemu_aio_wait(). > > qemu_aio_wait() calls node->io_read() which calls qemu_gluster_complete_aio(). > Before we return back to qemu_aio_wait(), many other things happen: > > bdrv_close() gets called from qcow2_create2() > This closes the gluster connection, closes the pipe, does > qemu_set_fd_hander(read_pipe_fd, NULL, NULL, NULL, NULL), which results > in the AioHandler node being deleted from aio_handlers list. > > Now qemu_gluster_aio_event_reader (node->io_read) which was called from > qemu_aio_wait() finally completes and goes ahead and accesses "node" > which has already been deleted. This causes segfault. > > So I think the option 1 (scheduling a BH from node->io_read) would > be better for gluster. This is a bug that has to be fixed anyway. There are provisions in aio.c, but they are broken apparently. Can you try this: diff --git a/aio.c b/aio.c index 0a9eb10..99b8b72 100644 --- a/aio.c +++ b/aio.c @@ -119,7 +119,7 @@ bool qemu_aio_wait(void) return true; } -walking_handlers = 1; +walking_handlers++; FD_ZERO(&rdfds); FD_ZERO(&wrfds); @@ -147,7 +147,7 @@ bool qemu_aio_wait(void) } } -walking_handlers = 0; +walking_handlers--; /* No AIO operations? Get us out of here */ if (!busy) { @@ -159,7 +159,7 @@ bool qemu_aio_wait(void) /* if we have any readable fds, dispatch event */ if (ret > 0) { -walking_handlers = 1; +walking_handlers++; /* we have to walk very carefully in case * qemu_aio_set_fd_handler is called while we're walking */ @@ -187,7 +187,7 @@ bool qemu_aio_wait(void) } } -walking_handlers = 0; +walking_handlers--; } return true; Paolo
Re: [Qemu-devel] [PATCH v6 2/2] block: Support GlusterFS as a QEMU block backend
On Thu, Sep 06, 2012 at 12:29:30PM +0200, Kevin Wolf wrote: > Am 06.09.2012 12:18, schrieb Paolo Bonzini: > > Il 06/09/2012 12:07, Kevin Wolf ha scritto: > >>> The AIOCB is already invalid at the time the callback is entered, so we > >>> could release it before the call. However, not all implementation of > >>> AIO are ready for that and I'm not really in the mood for large scale > >>> refactoring... > >> > >> But the way, what I'd really want to see in the end is to get rid of > >> qemu_aio_flush() and replace it by .bdrv_drain() callbacks in each > >> BlockDriver. The way we're doing it today is a layering violation. > > > > That's quite difficult. Completion of an I/O operation can trigger > > another I/O operation on another block device, and so on until we go > > back to the first device (think of a hypothetical RAID-5 device). > > You always have a tree of BDSes, and children should only ever trigger > completion of I/O operations in their parents. Am I missing anything? > > >> Doesn't change anything about this problem, though. So the options that > >> we have are: > >> > >> 1. Delay the callback using a BH. Doing this in each driver is ugly. > >>But is there actually more than one possible callback in today's > >>coroutine world? I only see bdrv_co_io_em_complete(), which could > >>reenter the coroutine from a BH. > > > > Easy and safe, but it feels a bit like a timebomb. Also, I'm not > > entirely sure of _why_ the bottom half works. :) > > Hm, safe and time bomb is contradictory in my book. :-) > > The bottom half work because we're not reentering the qcow2_create > coroutine immediately, so the gluster AIO callback can complete all of > its cleanup work without being interrupted by code that might wait on > this particular request and create a deadlock this way. > > >> 2. Delay the callback by just calling it later when the cleanup has > >>been completed and .io_flush() can return 0. You say that it's hard > >>to implement for some drivers, except if the AIOCB are leaked until > >>the end of functions like qcow2_create(). > > > > ... which is what we do in posix-aio-compat.c; nobody screamed so far. > > True. Would be easy to fix in posix-aio-compat, though, or can a > callback expect that the AIOCB is still valid? > > > Not really hard, it just has to be assessed for each driver separately. > > We can just do it in gluster and refactor it later. > > Okay, so let's keep it as an option for now. I tried this approach (option 2) in gluster and I was able to go past the hang I was seeing earlier, but this causes other problems. Let me restate what I am doing so that you could tell me if I am indeed following the option 2 you mention above. I am doing the cleanup first (qemu_aio_count-- and releasing the AIOCB) before calling the callback at the end. static void qemu_gluster_complete_aio(GlusterAIOCB *acb, BDRVGlusterState *s) { int ret; bool *finished = acb->finished; BlockDriverCompletionFunc *cb = acb->common.cb; void *opaque = acb->common.opaque; if (!acb->ret || acb->ret == acb->size) { ret = 0; /* Success */ } else if (acb->ret < 0) { ret = acb->ret; /* Read/Write failed */ } else { ret = -EIO; /* Partial read/write - fail it */ } s->qemu_aio_count--; qemu_aio_release(acb); cb(opaque, ret); if (finished) { *finished = true; } } static void qemu_gluster_aio_event_reader(void *opaque) { BDRVGlusterState *s = opaque; ssize_t ret; do { char *p = (char *)&s->event_acb; ret = read(s->fds[GLUSTER_FD_READ], p + s->event_reader_pos, sizeof(s->event_acb) - s->event_reader_pos); if (ret > 0) { s->event_reader_pos += ret; if (s->event_reader_pos == sizeof(s->event_acb)) { s->event_reader_pos = 0; qemu_gluster_complete_aio(s->event_acb, s); //s->qemu_aio_count--; } } } while (ret < 0 && errno == EINTR); } qemu_gluster_aio_event_reader() is the node->io_read in qemu_aio_wait(). qemu_aio_wait() calls node->io_read() which calls qemu_gluster_complete_aio(). Before we return back to qemu_aio_wait(), many other things happen: bdrv_close() gets called from qcow2_create2() This closes the gluster connection, closes the pipe, does qemu_set_fd_hander(read_pipe_fd, NULL, NULL, NULL, NULL), which results in the AioHandler node being deleted from aio_handlers list. Now qemu_gluster_aio_event_reader (node->io_read) which was called from qemu_aio_wait() finally completes and goes ahead and accesses "node" which has already been deleted. This causes segfault. So I think the option 1 (scheduling a BH from node->io_read) would be better for gluster. Regards, Bharata.
Re: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering
On 7 September 2012 15:56, Aurelien Jarno wrote: > On Thu, Aug 23, 2012 at 05:39:39PM +0200, Aurelien Jarno wrote: >> The lan9118 emulation tries to compute the multicast index by calling >> directly the crc32() function from zlib, but fails to get the correct >> result. >> >> Use the common compute_mcast_idx() function instead, which gives the >> correct result. This fixes IPv6 support. >> >> Signed-off-by: Aurelien Jarno >> --- >> hw/lan9118.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/hw/lan9118.c b/hw/lan9118.c >> index ff0a50b..ceaf96f 100644 >> --- a/hw/lan9118.c >> +++ b/hw/lan9118.c >> @@ -500,7 +500,7 @@ static int lan9118_filter(lan9118_state *s, const >> uint8_t *addr) >> } >> } else { >> /* Hash matching */ >> -hash = (crc32(~0, addr, 6) >> 26); >> +hash = compute_mcast_idx(addr); >> if (hash & 0x20) { >> return (s->mac_hashh >> (hash & 0x1f)) & 1; >> } else { > > Ping? > > For the record the Linux kernel uses the ether_crc() function for > smsc911x.c, but also for 8139cp.c, 8139too.c and ethoc.c, which use > compute_mcast_idx() on the QEMU side. Looks ok to me. I did check the data sheet, which helpfully doesn't say exactly what the CRC function is, and also the zlib docs (which suggest we should use something that isn't what we were doing here). So I guess Reviewed-by: Peter Maydell Happy for you to commit directly or I can put it in arm-devs.next if you prefer. -- PMM
Re: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering
On Thu, Aug 23, 2012 at 05:39:39PM +0200, Aurelien Jarno wrote: > The lan9118 emulation tries to compute the multicast index by calling > directly the crc32() function from zlib, but fails to get the correct > result. > > Use the common compute_mcast_idx() function instead, which gives the > correct result. This fixes IPv6 support. > > Signed-off-by: Aurelien Jarno > --- > hw/lan9118.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/lan9118.c b/hw/lan9118.c > index ff0a50b..ceaf96f 100644 > --- a/hw/lan9118.c > +++ b/hw/lan9118.c > @@ -500,7 +500,7 @@ static int lan9118_filter(lan9118_state *s, const uint8_t > *addr) > } > } else { > /* Hash matching */ > -hash = (crc32(~0, addr, 6) >> 26); > +hash = compute_mcast_idx(addr); > if (hash & 0x20) { > return (s->mac_hashh >> (hash & 0x1f)) & 1; > } else { Ping? For the record the Linux kernel uses the ether_crc() function for smsc911x.c, but also for 8139cp.c, 8139too.c and ethoc.c, which use compute_mcast_idx() on the QEMU side. To test it, just run this machine with a Linux kernel with IPv6 support on an IPv6-enabled network with router advertisement, it should get an IPv6 address automatically. It doesn't without this patch. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] musicpal: Fix flash mapping
On 2012-09-07 16:41, Peter Maydell wrote: > On 7 September 2012 00:03, Jan Kiszka wrote: >> The old arithmetic assumed 32 physical address bits which is no longer >> true for ARM since 3cc0cd61f4. >> >> Signed-off-by: Jan Kiszka >> --- >> hw/musicpal.c |4 ++-- >> 1 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/hw/musicpal.c b/hw/musicpal.c >> index ad725b5..10c2c16 100644 >> --- a/hw/musicpal.c >> +++ b/hw/musicpal.c >> @@ -1583,7 +1583,7 @@ static void musicpal_init(ram_addr_t ram_size, >> * image is smaller than 32 MB. >> */ >> #ifdef TARGET_WORDS_BIGENDIAN >> -pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, NULL, >> +pflash_cfi02_register(0x1-MP_FLASH_SIZE_MAX, NULL, > > I don't think this will compile on a 32 bit system, will it? > You probably want an ULL suffix. It does as the result always fits in 32 bits. But I can add that if you prefer. Jan signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] qemu 1.2 : lsi controller + scsi-block don't boot.
Thanks, But Why does it work with lsi + scsi-hd and not scsi-block? For now I'll use scsi-hd for these (very old) guests, it's not a problem. - Mail original - De: "Paolo Bonzini" À: "Alexandre DERUMIER" Cc: qemu-devel@nongnu.org Envoyé: Vendredi 7 Septembre 2012 16:48:39 Objet: Re: qemu 1.2 : lsi controller + scsi-block don't boot. Il 07/09/2012 14:35, Alexandre DERUMIER ha scritto: > I'm trying to boot scsi-block device with lsi controller, and it doesn't > boot. (don't find devices). > > > lsi + scsi-block : don't boot > > lsi + scsi-hd : boot > > virtio-scsi + scsi-block : boot The LSI driver in SeaBIOS is really a "best effort" driver, it's not fun to debug it either... just don't use it, pick up the virtio-scsi backport that is in CentOS and lobby your distro to include it... Paolo
Re: [Qemu-devel] qemu 1.2 : lsi controller + scsi-block don't boot.
Il 07/09/2012 14:35, Alexandre DERUMIER ha scritto: > I'm trying to boot scsi-block device with lsi controller, and it doesn't > boot. (don't find devices). > > > lsi + scsi-block : don't boot > > lsi + scsi-hd : boot > > virtio-scsi + scsi-block : boot The LSI driver in SeaBIOS is really a "best effort" driver, it's not fun to debug it either... just don't use it, pick up the virtio-scsi backport that is in CentOS and lobby your distro to include it... Paolo
Re: [Qemu-devel] [PATCH 18/21] target-cris: switch to AREG0 free mode
On Fri, Sep 07, 2012 at 04:40:03PM +0200, Edgar E. Iglesias wrote: > On Fri, Sep 07, 2012 at 04:18:41PM +0200, Aurelien Jarno wrote: > > On Sun, Sep 02, 2012 at 05:33:47PM +, Blue Swirl wrote: > > > Add an explicit CPUState parameter instead of relying on AREG0 > > > and switch to AREG0 free mode. > > > > > > Signed-off-by: Blue Swirl > > > --- > > > configure |2 +- > > > target-cris/Makefile.objs |2 - > > > target-cris/helper.c|4 +- > > > target-cris/helper.h| 34 > > > target-cris/op_helper.c | 89 > > > +-- > > > target-cris/translate.c | 50 --- > > > target-cris/translate_v10.c | 22 +- > > > 7 files changed, 101 insertions(+), 102 deletions(-) > > > > > > diff --git a/configure b/configure > > > index e464d2f..d760e07 100755 > > > --- a/configure > > > +++ b/configure > > > @@ -3829,7 +3829,7 @@ symlink "$source_path/Makefile.target" > > > "$target_dir/Makefile" > > > > > > > > > case "$target_arch2" in > > > - alpha | arm* | i386 | lm32 | m68k | microblaze* | or32 | s390x | > > > sparc* | unicore32 | x86_64 | xtensa* | ppc*) > > > + alpha | arm* | cris | i386 | lm32 | m68k | microblaze* | or32 | s390x > > > | sparc* | unicore32 | x86_64 | xtensa* | ppc*) > > > echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak > > >;; > > > esac > > > diff --git a/target-cris/Makefile.objs b/target-cris/Makefile.objs > > > index 4b09e8c..afb87bc 100644 > > > --- a/target-cris/Makefile.objs > > > +++ b/target-cris/Makefile.objs > > > @@ -1,4 +1,2 @@ > > > obj-y += translate.o op_helper.o helper.o cpu.o > > > obj-$(CONFIG_SOFTMMU) += mmu.o machine.o > > > - > > > -$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) > > > diff --git a/target-cris/helper.c b/target-cris/helper.c > > > index bfbc29e..1bdb7e2 100644 > > > --- a/target-cris/helper.c > > > +++ b/target-cris/helper.c > > > @@ -151,7 +151,7 @@ static void do_interruptv10(CPUCRISState *env) > > > } > > > > > > /* Now that we are in kernel mode, load the handlers address. */ > > > - env->pc = ldl_code(env->pregs[PR_EBP] + ex_vec * 4); > > > +env->pc = cpu_ldl_code(env, env->pregs[PR_EBP] + ex_vec * 4); > > > env->locked_irq = 1; > > > env->pregs[PR_CCS] |= F_FLAG_V10; /* set F. */ > > > > > > @@ -233,7 +233,7 @@ void do_interrupt(CPUCRISState *env) > > > /* Now that we are in kernel mode, load the handlers address. > > > This load may not fault, real hw leaves that behaviour as > > > undefined. */ > > > - env->pc = ldl_code(env->pregs[PR_EBP] + ex_vec * 4); > > > +env->pc = cpu_ldl_code(env, env->pregs[PR_EBP] + ex_vec * 4); > > > > > > /* Clear the excption_index to avoid spurios hw_aborts for recursive > > > bus faults. */ > > > diff --git a/target-cris/helper.h b/target-cris/helper.h > > > index 093063a..b575524 100644 > > > --- a/target-cris/helper.h > > > +++ b/target-cris/helper.h > > > @@ -1,26 +1,26 @@ > > > #include "def-helper.h" > > > > > > -DEF_HELPER_1(raise_exception, void, i32) > > > -DEF_HELPER_1(tlb_flush_pid, void, i32) > > > -DEF_HELPER_1(spc_write, void, i32) > > > +DEF_HELPER_2(raise_exception, void, env, i32) > > > +DEF_HELPER_2(tlb_flush_pid, void, env, i32) > > > +DEF_HELPER_2(spc_write, void, env, i32) > > > DEF_HELPER_3(dump, void, i32, i32, i32) > > > -DEF_HELPER_0(rfe, void); > > > -DEF_HELPER_0(rfn, void); > > > +DEF_HELPER_1(rfe, void, env); > > > +DEF_HELPER_1(rfn, void, env); > > > > > > -DEF_HELPER_2(movl_sreg_reg, void, i32, i32) > > > -DEF_HELPER_2(movl_reg_sreg, void, i32, i32) > > > +DEF_HELPER_3(movl_sreg_reg, void, env, i32, i32) > > > +DEF_HELPER_3(movl_reg_sreg, void, env, i32, i32) > > > > > > DEF_HELPER_FLAGS_1(lz, TCG_CALL_PURE, i32, i32); > > > -DEF_HELPER_FLAGS_3(btst, TCG_CALL_PURE, i32, i32, i32, i32); > > > +DEF_HELPER_FLAGS_4(btst, TCG_CALL_PURE, i32, env, i32, i32, i32); > > > > > > -DEF_HELPER_FLAGS_3(evaluate_flags_muls, TCG_CALL_PURE, i32, i32, i32, > > > i32) > > > -DEF_HELPER_FLAGS_3(evaluate_flags_mulu, TCG_CALL_PURE, i32, i32, i32, > > > i32) > > > -DEF_HELPER_FLAGS_4(evaluate_flags_mcp, TCG_CALL_PURE, i32, i32, i32, > > > i32, i32) > > > -DEF_HELPER_FLAGS_4(evaluate_flags_alu_4, TCG_CALL_PURE, i32, i32, i32, > > > i32, i32) > > > -DEF_HELPER_FLAGS_4(evaluate_flags_sub_4, TCG_CALL_PURE, i32, i32, i32, > > > i32, i32) > > > -DEF_HELPER_FLAGS_2(evaluate_flags_move_4, TCG_CALL_PURE, i32, i32, i32) > > > -DEF_HELPER_FLAGS_2(evaluate_flags_move_2, TCG_CALL_PURE, i32, i32, i32) > > > -DEF_HELPER_0(evaluate_flags, void) > > > -DEF_HELPER_0(top_evaluate_flags, void) > > > +DEF_HELPER_FLAGS_4(evaluate_flags_muls, TCG_CALL_PURE, i32, env, i32, > > > i32, i32) > > > +DEF_HELPER_FLAGS_4(evaluate_flags_mulu, TCG_CALL_PURE, i32, env, i32, > > > i32, i32) > > > +DEF_HELPER_FLAGS_5(evaluate_flags_mcp, TCG_CALL_PURE, i32, env, i32, > > > i32, i32, i32) > > > +DEF_HELPE
[Qemu-devel] [Bug 962880] Re: having a tr_TR.UTF-8 locale creates problems during compile
** Changed in: qemu Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/962880 Title: having a tr_TR.UTF-8 locale creates problems during compile Status in QEMU: Fix Released Bug description: Default locale; /opt/test/qemu-1.0.1# locale LANG=tr_TR.UTF-8 LC_CTYPE="tr_TR.UTF-8" ... LC_IDENTIFICATION="tr_TR.UTF-8" LC_ALL= -- ./configure && make . . . /opt/test/qemu-1.0.1/vl.c: In function 'main': /opt/test/qemu-1.0.1/vl.c:2248: hata: 'CONFIG_QEMU_CONFDIR' bildirilmemiş (bu işlevde ilk kullanımı) /opt/test/qemu-1.0.1/vl.c:2248: hata: (Bildirilmemiş her betimleyici görüldüğü her işlev /opt/test/qemu-1.0.1/vl.c:2248: hata: için sadece bir kez raporlanır.) /opt/test/qemu-1.0.1/vl.c:2248: hata: expected ')' before string constant /opt/test/qemu-1.0.1/vl.c:3090: hata: 'CONFIG_QEMU_DATADIR' bildirilmemiş (bu işlevde ilk kullanımı) make[1]: *** [vl.o] Hata 1 make: *** [subdir-libhw64] Hata 2 -- if we examine the config-host.h (look at the "i" characters) #define CONFIG_QEMU_PREFiX "/usr/local" #define CONFIG_QEMU_BiNDiR "/usr/local/bin" #define CONFIG_QEMU_LiBDiR "/usr/local/lib" #define CONFIG_QEMU_iNCLUDEDiR "/usr/local/include" #define CONFIG_QEMU_MANDiR "/usr/local/share/man" #define CONFIG_QEMU_DATADiR "/usr/local/share/qemu" #define CONFIG_QEMU_SYSCONFDiR "/usr/local/etc" #define CONFIG_QEMU_DOCDiR "/usr/local/share/doc/qemu" #define CONFIG_QEMU_CONFDiR "/usr/local/etc/qemu" --- changing LC_ALL and LC_LANG to POSIX (C) solves the problem. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/962880/+subscriptions
[Qemu-devel] [Bug 957622] Re: kvm -kernel with grub multiboot kernel dumps core or exits
** Changed in: qemu Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/957622 Title: kvm -kernel with grub multiboot kernel dumps core or exits Status in QEMU: Fix Released Status in “qemu-kvm” package in Ubuntu: Fix Released Bug description: I attempted to use kvm -kernel with a grub multiboot image, specifically grub-maverick-20100729.img at [1]. That file was built using [2] $ url="http://bazaar.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds/download/head:/grubmaverick20100729-20100729071944-bevge631maio9jpl-2/grub-maverick-20100729.img"; $ wget $url -O grub-maverick-20100729.img $ qemu-img create -f qcow2 disk.img 1G $ kvm -curses -kernel grub-maverick-20100729.img -drive file=disk.img,if=virtio This process works fine on oneiric and you will see a curses interface, and some output of grub looking for a image to boot. On my laptop (with kvm support), I saw: $ kvm -curses -kernel grub-maverick-20100729.img -drive file=disk.img,if=virtio; fread() failed $ echo $? 1 On a kvm guest (via openstack instance), it crashed differently: $ kvm -curses -kernel grub-maverick-20100729.img -drive file=disk.img,if=virtio Could not access KVM kernel module: No such file or directory failed to initialize KVM: No such file or directory Back to tcg accelerator. GLib-ERROR **: /build/buildd/glib2.0-2.31.20/./glib/gmem.c:165: failed to allocate 4293918720 bytes Trace/breakpoint trap (core dumped) Just for a test, I tried loading kvm-amd, got nested kvm virtualization, but the instance fails the same way. -- [1] http://bazaar.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds/files/head:/loaders/ [2] http://bazaar.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds/view/head:/mk-image-mb-loader ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: kvm (not installed) ProcVersionSignature: User Name 3.2.0-18.29-virtual 3.2.9 Uname: Linux 3.2.0-18-virtual x86_64 ApportVersion: 1.94.1-0ubuntu2 Architecture: amd64 CurrentDmesg: [27230.320857] init: qemu-kvm pre-start process (8659) terminated with status 1 [27230.361904] init: qemu-kvm post-stop process (8664) terminated with status 1 [27249.426836] kvm[9021] trap int3 ip:7f44c2bbc13b sp:7fff447e1120 error:0 [27263.380598] kvm[9283] trap int3 ip:7f3fba9f713b sp:7fff8b55d1a0 error:0 Date: Sat Mar 17 01:48:13 2012 Ec2AMI: ami- Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: unavailable Ec2Ramdisk: unavailable KvmCmdLine: Error: command ['ps', '-C', 'kvm', '-F'] failed with exit code 1: UIDPID PPID CSZ RSS PSR STIME TTY TIME CMD Lsusb: Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd MachineType: Bochs Bochs ProcEnviron: TERM=screen PATH=(custom, user) LANG=en_US.UTF-8 SHELL=/bin/bash ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-18-virtual root=LABEL=cloudimg-rootfs ro console=ttyS0 ProcModules: acpiphp 24231 0 - Live 0x floppy 70365 0 - Live 0x psmouse 87603 0 - Live 0x serio_raw 13211 0 - Live 0x virtio_balloon 13108 0 - Live 0x SourcePackage: qemu-kvm UpgradeStatus: No upgrade log present (probably fresh install) dmi.bios.date: 01/01/2007 dmi.bios.vendor: Bochs dmi.bios.version: Bochs dmi.chassis.type: 1 dmi.chassis.vendor: Bochs dmi.modalias: dmi:bvnBochs:bvrBochs:bd01/01/2007:svnBochs:pnBochs:pvr:cvnBochs:ct1:cvr: dmi.product.name: Bochs dmi.sys.vendor: Bochs To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/957622/+subscriptions
Re: [Qemu-devel] [PATCH 02/21] target-s390x: split FPU ops
On Fri, Sep 07, 2012 at 04:30:51PM +0200, Andreas Färber wrote: > Am 07.09.2012 06:26, schrieb Alexander Graf: > > Quoting Richard Henderson : > > > >> On 09/06/2012 11:42 AM, Alexander Graf wrote: > >>> Richard, while at it, could you please check the s390x tcg target? > >>> Running any target on there seems to break in the TLB code for me. > >> > >> I did successfully run a simple linux-user test directly off blue's > >> patch set. It exercised a bit of fp and system calls (printf). > >> > >> I don't have a system environment set up at the moment... > > > > Ah, I am referring to s390x host code. Running qemu-system-x86_64 on > > s390x is what breaks for me. > > If, e.g., arm works on master that might rather point to tcg/s390x/ > CONFIG_PASS_AREG0 mode. > This is likely the case. The register shift code in CONFIG_PASS_AREG0 case uses 3 registers for stores and 4 for loads. It should be the reverse. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] musicpal: Fix flash mapping
On 7 September 2012 00:03, Jan Kiszka wrote: > The old arithmetic assumed 32 physical address bits which is no longer > true for ARM since 3cc0cd61f4. > > Signed-off-by: Jan Kiszka > --- > hw/musicpal.c |4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/musicpal.c b/hw/musicpal.c > index ad725b5..10c2c16 100644 > --- a/hw/musicpal.c > +++ b/hw/musicpal.c > @@ -1583,7 +1583,7 @@ static void musicpal_init(ram_addr_t ram_size, > * image is smaller than 32 MB. > */ > #ifdef TARGET_WORDS_BIGENDIAN > -pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, NULL, > +pflash_cfi02_register(0x1-MP_FLASH_SIZE_MAX, NULL, I don't think this will compile on a 32 bit system, will it? You probably want an ULL suffix. -- PMM
[Qemu-devel] [Bug 1022331] Re: -cpu ? causes confusion when directory has 1-character length filenames
** Changed in: qemu Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1022331 Title: -cpu ? causes confusion when directory has 1-character length filenames Status in QEMU: Fix Released Bug description: When user is in a directory with 1-character long filenames, parameter -cpu ? causes shell to expand ? into filename, which can cause a very confused user. One solution would be to replace/add alias to -cpu ?, for example -cpulist To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1022331/+subscriptions
Re: [Qemu-devel] [PATCH] configure: fix seccomp check
Am 06.09.2012 22:40, schrieb Yann E. MORIN: > Currently, if libseccomp is missing but the user explicitly requested > seccomp support using --enable-seccomp, configure silently ignores the > situation and disables seccomp support. > > This is unlike all other tests that explicitly fail in such situation. > > Fix that. > > Signed-off-by: "Yann E. MORIN" Reviewed-by: Andreas Färber Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 18/21] target-cris: switch to AREG0 free mode
On Fri, Sep 07, 2012 at 04:18:41PM +0200, Aurelien Jarno wrote: > On Sun, Sep 02, 2012 at 05:33:47PM +, Blue Swirl wrote: > > Add an explicit CPUState parameter instead of relying on AREG0 > > and switch to AREG0 free mode. > > > > Signed-off-by: Blue Swirl > > --- > > configure |2 +- > > target-cris/Makefile.objs |2 - > > target-cris/helper.c|4 +- > > target-cris/helper.h| 34 > > target-cris/op_helper.c | 89 > > +-- > > target-cris/translate.c | 50 --- > > target-cris/translate_v10.c | 22 +- > > 7 files changed, 101 insertions(+), 102 deletions(-) > > > > diff --git a/configure b/configure > > index e464d2f..d760e07 100755 > > --- a/configure > > +++ b/configure > > @@ -3829,7 +3829,7 @@ symlink "$source_path/Makefile.target" > > "$target_dir/Makefile" > > > > > > case "$target_arch2" in > > - alpha | arm* | i386 | lm32 | m68k | microblaze* | or32 | s390x | sparc* > > | unicore32 | x86_64 | xtensa* | ppc*) > > + alpha | arm* | cris | i386 | lm32 | m68k | microblaze* | or32 | s390x | > > sparc* | unicore32 | x86_64 | xtensa* | ppc*) > > echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak > >;; > > esac > > diff --git a/target-cris/Makefile.objs b/target-cris/Makefile.objs > > index 4b09e8c..afb87bc 100644 > > --- a/target-cris/Makefile.objs > > +++ b/target-cris/Makefile.objs > > @@ -1,4 +1,2 @@ > > obj-y += translate.o op_helper.o helper.o cpu.o > > obj-$(CONFIG_SOFTMMU) += mmu.o machine.o > > - > > -$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) > > diff --git a/target-cris/helper.c b/target-cris/helper.c > > index bfbc29e..1bdb7e2 100644 > > --- a/target-cris/helper.c > > +++ b/target-cris/helper.c > > @@ -151,7 +151,7 @@ static void do_interruptv10(CPUCRISState *env) > > } > > > > /* Now that we are in kernel mode, load the handlers address. */ > > - env->pc = ldl_code(env->pregs[PR_EBP] + ex_vec * 4); > > +env->pc = cpu_ldl_code(env, env->pregs[PR_EBP] + ex_vec * 4); > > env->locked_irq = 1; > > env->pregs[PR_CCS] |= F_FLAG_V10; /* set F. */ > > > > @@ -233,7 +233,7 @@ void do_interrupt(CPUCRISState *env) > > /* Now that we are in kernel mode, load the handlers address. > >This load may not fault, real hw leaves that behaviour as > >undefined. */ > > - env->pc = ldl_code(env->pregs[PR_EBP] + ex_vec * 4); > > +env->pc = cpu_ldl_code(env, env->pregs[PR_EBP] + ex_vec * 4); > > > > /* Clear the excption_index to avoid spurios hw_aborts for recursive > >bus faults. */ > > diff --git a/target-cris/helper.h b/target-cris/helper.h > > index 093063a..b575524 100644 > > --- a/target-cris/helper.h > > +++ b/target-cris/helper.h > > @@ -1,26 +1,26 @@ > > #include "def-helper.h" > > > > -DEF_HELPER_1(raise_exception, void, i32) > > -DEF_HELPER_1(tlb_flush_pid, void, i32) > > -DEF_HELPER_1(spc_write, void, i32) > > +DEF_HELPER_2(raise_exception, void, env, i32) > > +DEF_HELPER_2(tlb_flush_pid, void, env, i32) > > +DEF_HELPER_2(spc_write, void, env, i32) > > DEF_HELPER_3(dump, void, i32, i32, i32) > > -DEF_HELPER_0(rfe, void); > > -DEF_HELPER_0(rfn, void); > > +DEF_HELPER_1(rfe, void, env); > > +DEF_HELPER_1(rfn, void, env); > > > > -DEF_HELPER_2(movl_sreg_reg, void, i32, i32) > > -DEF_HELPER_2(movl_reg_sreg, void, i32, i32) > > +DEF_HELPER_3(movl_sreg_reg, void, env, i32, i32) > > +DEF_HELPER_3(movl_reg_sreg, void, env, i32, i32) > > > > DEF_HELPER_FLAGS_1(lz, TCG_CALL_PURE, i32, i32); > > -DEF_HELPER_FLAGS_3(btst, TCG_CALL_PURE, i32, i32, i32, i32); > > +DEF_HELPER_FLAGS_4(btst, TCG_CALL_PURE, i32, env, i32, i32, i32); > > > > -DEF_HELPER_FLAGS_3(evaluate_flags_muls, TCG_CALL_PURE, i32, i32, i32, i32) > > -DEF_HELPER_FLAGS_3(evaluate_flags_mulu, TCG_CALL_PURE, i32, i32, i32, i32) > > -DEF_HELPER_FLAGS_4(evaluate_flags_mcp, TCG_CALL_PURE, i32, i32, i32, i32, > > i32) > > -DEF_HELPER_FLAGS_4(evaluate_flags_alu_4, TCG_CALL_PURE, i32, i32, i32, > > i32, i32) > > -DEF_HELPER_FLAGS_4(evaluate_flags_sub_4, TCG_CALL_PURE, i32, i32, i32, > > i32, i32) > > -DEF_HELPER_FLAGS_2(evaluate_flags_move_4, TCG_CALL_PURE, i32, i32, i32) > > -DEF_HELPER_FLAGS_2(evaluate_flags_move_2, TCG_CALL_PURE, i32, i32, i32) > > -DEF_HELPER_0(evaluate_flags, void) > > -DEF_HELPER_0(top_evaluate_flags, void) > > +DEF_HELPER_FLAGS_4(evaluate_flags_muls, TCG_CALL_PURE, i32, env, i32, i32, > > i32) > > +DEF_HELPER_FLAGS_4(evaluate_flags_mulu, TCG_CALL_PURE, i32, env, i32, i32, > > i32) > > +DEF_HELPER_FLAGS_5(evaluate_flags_mcp, TCG_CALL_PURE, i32, env, i32, i32, > > i32, i32) > > +DEF_HELPER_FLAGS_5(evaluate_flags_alu_4, TCG_CALL_PURE, i32, env, i32, > > i32, i32, i32) > > +DEF_HELPER_FLAGS_5(evaluate_flags_sub_4, TCG_CALL_PURE, i32, env, i32, > > i32, i32, i32) > > +DEF_HELPER_FLAGS_3(evaluate_flags_move_4, TCG_CALL_PURE, i32, env, i32, > > i32) > > +DEF_HELPER_
[Qemu-devel] [Bug 584121] Re: migration always fails on 32bit qemu-kvm-0.12+ (sigsegv)
** Changed in: qemu Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/584121 Title: migration always fails on 32bit qemu-kvm-0.12+ (sigsegv) Status in QEMU: Fix Released Bug description: On a 32bit host (or when running 32bit userspace on 64bit host), migration always fails with a crash of qemu-kvm process. See http://marc.info/?l=kvm&m=127351472231666 for more information. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/584121/+subscriptions
[Qemu-devel] [Bug 948675] Re: QEMU is crashing when called with "-vga none"
** Changed in: qemu Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/948675 Title: QEMU is crashing when called with "-vga none" Status in QEMU: Fix Released Status in “qemu-kvm” package in Ubuntu: Invalid Bug description: QEMU is crashing when called with "-vga none". This regression was inserted in e5ad936b0fd7dfd7fd7908be6f9f1ca88f63b96b. QEMU line: /home/fidencio/dev/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel /home/fidencio/src/linux-2.6/arch/x86_64/boot/bzImage -append "root=nfs rw nfsrootdebug console=ttyS0 ip=192.168.122.2:192.168.122.1:192.168.122.1:255.255.255.0 nfsroot=192.168.122.1:/home/fidencio/fedora14-minimal" -device e1000,vlan=0 -serial stdio -net tap,script=/home/fidencio/dev/etc/qemu-ifup -vga none Backtrace: #0 0x557ac976 in is_romd (pd=2048) at /home/fidencio/src/qemu/exec.c:2110 #1 0x557ac9e3 in is_ram_rom_romd (pd=804864) at /home/fidencio/src/qemu/exec.c:2115 #2 0x557ad05a in cpu_register_physical_memory_log (section= 0x72daf6f0, readable=true, readonly=false) at /home/fidencio/src/qemu/exec.c:2587 #3 0x557e4d47 in as_memory_range_add (as=0x55c34980, fr= 0x7fffec002950) at /home/fidencio/src/qemu/memory.c:317 #4 0x557e6b49 in address_space_update_topology_pass (as= 0x55c34980, old_view=..., new_view=..., adding=true) at /home/fidencio/src/qemu/memory.c:763 #5 0x557e6c3f in address_space_update_topology (as=0x55c34980) at /home/fidencio/src/qemu/memory.c:779 #6 0x557e6d0c in memory_region_update_topology (mr=0x5646d2c0) at /home/fidencio/src/qemu/memory.c:798 #7 0x557e8e16 in memory_region_add_subregion_common (mr= 0x5646d2c0, offset=792576, subregion=0x564a6130) at /home/fidencio/src/qemu/memory.c:1352 #8 0x557e8ede in memory_region_add_subregion_overlap (mr= 0x5646d2c0, offset=792576, subregion=0x564a6130, priority=1000) at /home/fidencio/src/qemu/memory.c:1372 #9 0x557dfebe in vapic_map_rom_writable (s=0x564a3d30) at /home/fidencio/src/qemu/hw/kvmvapic.c:587 #10 0x557dff06 in vapic_prepare (s=0x564a3d30) at /home/fidencio/src/qemu/hw/kvmvapic.c:593 #11 0x557e0001 in vapic_write (opaque=0x564a3d30, addr=0, data=32, size=2) at /home/fidencio/src/qemu/hw/kvmvapic.c:632 #12 0x557e4b84 in memory_region_write_accessor (opaque=0x564a6068, addr=0, value=0x72dafb00, size=2, shift=0, mask=65535) at /home/fidencio/src/qemu/memory.c:274 #13 0x557e4c66 in access_with_adjusted_size (addr=0, value= 0x72dafb00, size=2, access_size_min=1, access_size_max=4, access= 0x557e4b0c , opaque=0x564a6068) at /home/fidencio/src/qemu/memory.c:304 #14 0x557e5412 in memory_region_iorange_write (iorange=0x564a60b0, offset=0, width=2, data=32) at /home/fidencio/src/qemu/memory.c:440 #15 0x557d0ab6 in ioport_writew_thunk (opaque=0x564a60b0, addr= 126, data=32) at /home/fidencio/src/qemu/ioport.c:218 #16 0x557d0411 in ioport_write (index=1, address=126, data=32) at /home/fidencio/src/qemu/ioport.c:82 #17 0x557d0f3d in cpu_outw (addr=126, val=32) at /home/fidencio/src/qemu/ioport.c:281 #18 0x557d537c in kvm_handle_io (port=126, data=0x77ff4000, direction=1, size=2, count=1) at /home/fidencio/src/qemu/kvm-all.c:1015 #19 0x557d594a in kvm_cpu_exec (env=0x56492f20) at /home/fidencio/src/qemu/kvm-all.c:1160 #20 0x557a5d69 in qemu_kvm_cpu_thread_fn (arg=0x56492f20) at /home/fidencio/src/qemu/cpus.c:733 #21 0x7651dd90 in start_thread (arg=0x72db0700) at pthread_create.c:309 #22 0x7578148d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115 To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/948675/+subscriptions
[Qemu-devel] [Bug 1044727] Re: -kernel does not work for multiboot ELF kernels
** Changed in: qemu Status: New => Fix Committed -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1044727 Title: -kernel does not work for multiboot ELF kernels Status in QEMU: Fix Committed Bug description: The multiboot header of a kernel image can contain the entry point and memory segment information. If it does not the kernel should have an ELF header that describes the memory segments and contains the entry point. http://www.gnu.org/software/grub/manual/multiboot/multiboot.html #Header-layout I have such a multiboot ELF kernel that can be loaded fine with grub and grub2 but not with the qemu -kernel flag. According to the ELF spec the entry field in the ELF header should contain the virtual address of the multiboot entry code. Qemu sets up the memory regions using the paddr fields from the ELF sections and then tries to start the kernel using the virtual entry address. This will fail with >> qemu: fatal: Trying to execute code outside RAM or ROM I wrote a simple kernel that can be used to reproduce this bug. Get this archive http://os.inf.tu-dresden.de/~hschild/asmkernel.tar.gz It contains the simple kernel, its source, plus grub and grub2 binaries to boot the kernel in qemu. The HOWTO file contains the command lines you should be using to rebuild the kernel and boot it an bare qemu or with one of the two bootloaders. Find a patch that will fix this issue here: http://os.inf.tu-dresden.de/~hschild/qemu-fix-elf-entry.patch To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1044727/+subscriptions
Re: [Qemu-devel] [PATCH 02/21] target-s390x: split FPU ops
Am 07.09.2012 06:26, schrieb Alexander Graf: > Quoting Richard Henderson : > >> On 09/06/2012 11:42 AM, Alexander Graf wrote: >>> Richard, while at it, could you please check the s390x tcg target? >>> Running any target on there seems to break in the TLB code for me. >> >> I did successfully run a simple linux-user test directly off blue's >> patch set. It exercised a bit of fp and system calls (printf). >> >> I don't have a system environment set up at the moment... > > Ah, I am referring to s390x host code. Running qemu-system-x86_64 on > s390x is what breaks for me. If, e.g., arm works on master that might rather point to tcg/s390x/ CONFIG_PASS_AREG0 mode. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 3/7] block: raw-posix image file reopen
On 09/07/2012 06:40 AM, Kevin Wolf wrote: Am 06.09.2012 17:34, schrieb Corey Bryant: On 09/06/2012 05:23 AM, Kevin Wolf wrote: Am 05.09.2012 18:43, schrieb Jeff Cody: +} + +int fcntl_flags = O_APPEND | O_ASYNC | O_NONBLOCK; +#ifdef O_NOATIME +fcntl_flags |= O_NOATIME; +#endif +if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) { +/* dup the original fd */ +/* TODO: use qemu fcntl wrapper */ +raw_s->fd = fcntl(s->fd, F_DUPFD_CLOEXEC, 0); +if (raw_s->fd == -1) { +ret = -1; +goto error; +} +ret = fcntl_setfl(raw_s->fd, raw_s->open_flags); +} else { +raw_s->fd = qemu_open(state->bs->filename, raw_s->open_flags, 0644); +if (raw_s->fd == -1) { +ret = -1; +} Ignoring this part for now, with qemu_dup_flags() it's going to look a bit different. In particular, I'm hoping that we don't get a second fcntl_flags enumeration here, but can just fall back to qemu_open() whenever qemu_dup_flags() fails. That will require modification to qemu_dup_flags()... I believe qemu_dup_flags() silently filters out fcntl incompatible flags. Maybe it would be best to create a small helper function in osdep.c, that fetches the fcntl_flags. Then qemu_dup_flags() and this function would use the same helper to fetch fcntl_flags. The results of that would determine if we call qemu_dup_flags() or qemu_open(). Although, I do think it makes sense to always try qemu_open() if qemu_dup_flags() fails for some reason. I'm curious why you can't always call qemu_open(). I believe the original reason was that qemu_open() is more likely to fail, for example if the image file has been renamed/moved/deleted since the first open. You could still use fcntl() on an existing file descriptor, but reopening would fail. Some things to consider so that fd passing doesn't break when a reopen occurs. Mainly all the concerns revolve around how fd passing keeps track of references to fd sets (note: adding and removing fd set references is all done in qemu_open and qemu_close). * When reopening, qemu_open needs to be called before qemu_close. This will prevent the reference list for an fdset from becoming empty. If qemu_close is called before qemu_open, the reference list can become empty, and the fdset could be cleaned up before the qemu_open. Then qemu_open would fail. Will automatically be right when we properly implement transactional semantics. * qemu_open/qemu_close need to be used rather than open/close so that the references for fd passing are properly accounted for. Congratulations, you've just discovered a bug in Jeff's patches. It was a good idea to CC you. ;-) * I don't think you want to call qemu_dup_flags directly since it doesn't update the reference list for fd passing. Only qemu_open and qemu_close update the reference list. That's a good point, too. So probably a small wrapper that just updates the reference list in addition? You could do that. And yes you'd have to add code to add the new dup fd to an fdset's dup_fds list if in fact the fd that you dup'd was a member of an fdset's dup_fds list (see how qemu_close() and qemu_open() do this). But wouldn't it be easier to just go through qemu_close() then qemu_open() to perform the reopen? Then you don't have to add this extra code to account for fd passing. -- Regards, Corey If we can modify qemu_dup_flags() to fail if it can't provide the right set of flags, then I think we should do it - and I think we can. Even for the existing cases with fd passing it shouldn't break anything, but only add an additional safety check. And if touching the function motivates Corey to write some fd passing test cases so that you can't break it, even better. ;-) :) Sorry, I do plan to do this soon. I've just been side-tracked with some other things. No problem, it was just such a great opportunity to remind you. ;-) Kevin
Re: [Qemu-devel] [PATCH v2] qom: Reject attempts to add a property that already exists
Am 07.09.2012 15:55, schrieb Peter Maydell: > Reject attempts to add a property to an object if one of > that name already exists. This is always a bug in the caller; > this is merely diagnosing it gracefully rather than behaving > oddly later. > > Signed-off-by: Peter Maydell Looks fine to me, Reviewed-by: Andreas Färber /-F -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH] fix entry pointer for ELF kernels loaded with -kernel option
On Wed, Sep 05, 2012 at 03:11:13PM +0200, Kevin Wolf wrote: > Am 05.09.2012 14:56, schrieb Henning Schild: > > Find a hopefully proper patch attached. Take it or leave it. > > > > Signed-off-by: Henning Schild > > Reviewed-by: Kevin Wolf > > Aurelien, I think in the past you committed some changes in this area. > Does this look good to you and can you get it committed? > Thanks, committed. > > --- > > hw/elf_ops.h | 11 +++ > > 1 files changed, 11 insertions(+), 0 deletions(-) > > > > diff --git a/hw/elf_ops.h b/hw/elf_ops.h > > index fa65ce2..731a983 100644 > > --- a/hw/elf_ops.h > > +++ b/hw/elf_ops.h > > @@ -269,6 +269,17 @@ static int glue(load_elf, SZ)(const char *name, > > int fd, > > addr = ph->p_paddr; > > } > > > > +/* the entry pointer in the ELF header is a virtual > > + * address, if the text segments paddr and vaddr differ > > + * we need to adjust the entry */ > > +if (pentry && !translate_fn && > > +ph->p_vaddr != ph->p_paddr && > > +ehdr.e_entry >= ph->p_vaddr && > > +ehdr.e_entry < ph->p_vaddr + ph->p_filesz && > > +ph->p_flags & PF_X) { > > +*pentry = ehdr.e_entry - ph->p_vaddr + ph->p_paddr; > > +} > > + > > snprintf(label, sizeof(label), "phdr #%d: %s", i, name); > > rom_add_blob_fixed(label, data, mem_size, addr); > > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
[Qemu-devel] [PATCH v2 3/9] tcg/optimize: simplify or/xor r, a, 0 cases
or/xor r, a, 0 is equivalent to a mov r, a. Reviewed-by: Richard Henderson Signed-off-by: Aurelien Jarno --- tcg/optimize.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index 63f970d..0db849e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -331,6 +331,8 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): +CASE_OP_32_64(or): +CASE_OP_32_64(xor): if (temps[args[1]].state == TCG_TEMP_CONST) { /* Proceed with possible constant folding. */ break; -- 1.7.10.4