[Qemu-devel] func call to safely shutdown VM and quit qemu?
Hi Is there a func call to safely shutdown VM and quit qemu? Thanksfrom Peter
Re: [Qemu-devel] [PATCH] exynos4210/mct: Avoid infinite loop on non incremental timers
On 12/01/2012 09:08 PM, Jean-Christophe DUBOIS wrote: Check for a 0 "distance" value to avoid infinite loop when the expired FCR timer was not programed with auto-increment. With this change the behavior is coherent with the same type of code in the exynos4210_gfrc_restart() function in the same file. Linux seems to mostly use this timer with auto-increment which explain why it is not a problem most of the time. However other OS might have a problem with this if they don't use the auto-increment feature. Signed-off-by: Jean-Christophe DUBOIS --- hw/exynos4210_mct.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/exynos4210_mct.c b/hw/exynos4210_mct.c index e79cd6a..31a41d5 100644 --- a/hw/exynos4210_mct.c +++ b/hw/exynos4210_mct.c @@ -568,7 +568,7 @@ static void exynos4210_gfrc_event(void *opaque) /* Reload FRC to reach nearest comparator */ s->g_timer.curr_comp = exynos4210_gcomp_find(s); distance = exynos4210_gcomp_get_distance(s, s->g_timer.curr_comp); -if (distance > MCT_GT_COUNTER_STEP) { +if ((distance > MCT_GT_COUNTER_STEP) || !distance) { You don't need additional braces here. distance = MCT_GT_COUNTER_STEP; } exynos4210_gfrc_set_count(&s->g_timer, distance); -- 1.7.9.5 Doesn't apply to current master, please, rebase: Applying: exynos4210/mct: Avoid infinite loop on non incremental timers error: patch failed: hw/exynos4210_mct.c:568 error: hw/exynos4210_mct.c: patch does not apply -- Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Centre, e-mail: e.voevo...@samsung.com
Re: [Qemu-devel] [RFC PATCH V4 0/6] Virtio refactoring.
On 30/11/2012 19:43, Peter Maydell wrote: On 30 November 2012 17:12, wrote: From: KONRAD Frederic I send this RFC, to know if you're all happy with the current structure of the device (QOM). The general layout of classes looks OK to me, which is why I've moved on to some more nitpicky stuff. I'll have a closer look next week and probably add some more comments later. -- PMM Ok, so I need to complete this, and refactor virtio-blk to fit this new structure. Is this making sense ? Fred.
Re: [Qemu-devel] func call to safely shutdown VM and quit qemu?
On Mon, Dec 3, 2012 at 9:43 AM, Peter Cheung wrote: > Hi >Is there a func call to safely shutdown VM and quit qemu? I am using qemu_system_shutdown_request(). I don't know it that's the best way of quitting, but it works for me. HTH, Laurent
Re: [Qemu-devel] [PATCH] target-i386:slightly refactor dr7 related function
On 2012-12-03 04:07, liguang wrote: > 1. define names of breakpoints in dr7 > 2. slightly refactor bits field of breakpoint >related functions. Two topics, (at least) two patches, please. The code is hairy - not your fault, you actually try to improve it. But splitting up makes review easier. Thanks in advance. > > Signed-off-by: liguang > --- > target-i386/cpu.h |6 > target-i386/helper.c | 59 > target-i386/machine.c |2 +- > target-i386/misc_helper.c |4 +- > target-i386/seg_helper.c |4 +- > 5 files changed, 48 insertions(+), 27 deletions(-) > > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > index 90ef1ff..2da6ea0 100644 > --- a/target-i386/cpu.h > +++ b/target-i386/cpu.h > @@ -231,6 +231,12 @@ > #define DR7_TYPE_SHIFT 16 > #define DR7_LEN_SHIFT 18 > #define DR7_FIXED_1 0x0400 > +#define DR7_L0_30x55 DR7_LOCAL_BP_MASK or so. > +#define DR7_MAX_BP 4 > +#define DR7_BP_INST 0x0 > +#define DR7_DATA_WR 0x1 > +#define DR7_IO_RW 0x2 > +#define DR7_DATA_RW 0x3 > > #define PG_PRESENT_BIT 0 > #define PG_RW_BIT1 > diff --git a/target-i386/helper.c b/target-i386/helper.c > index bf206cf..54d6712 100644 > --- a/target-i386/helper.c > +++ b/target-i386/helper.c > @@ -966,27 +966,26 @@ hwaddr cpu_get_phys_page_debug(CPUX86State *env, > target_ulong addr) > > void hw_breakpoint_insert(CPUX86State *env, int index) > { > -int type, err = 0; > +int type = 0, err = 0; > > switch (hw_breakpoint_type(env->dr[7], index)) { > -case 0: > +case DR7_BP_INST: > if (hw_breakpoint_enabled(env->dr[7], index)) > err = cpu_breakpoint_insert(env, env->dr[index], BP_CPU, > &env->cpu_breakpoint[index]); > break; > -case 1: > +case DR7_DATA_WR: > type = BP_CPU | BP_MEM_WRITE; > -goto insert_wp; > -case 2: > - /* No support for I/O watchpoints yet */ > -break; > -case 3: > -type = BP_CPU | BP_MEM_ACCESS; > -insert_wp: > +case DR7_DATA_RW: > +if (!type) > +type = BP_CPU | BP_MEM_ACCESS; Coding style. But, to be honest, I find the goto approach cleaner. Alternatively, test for "type" (or "wp_type") != 0 outside the switch, moving the cpu_watchpoint_insert there. > err = cpu_watchpoint_insert(env, env->dr[index], > hw_breakpoint_len(env->dr[7], index), > type, &env->cpu_watchpoint[index]); > break; > +case DR7_IO_RW: > + /* No support for I/O watchpoints yet */ > +break; > } > if (err) > env->cpu_breakpoint[index] = NULL; > @@ -997,15 +996,15 @@ void hw_breakpoint_remove(CPUX86State *env, int index) > if (!env->cpu_breakpoint[index]) > return; > switch (hw_breakpoint_type(env->dr[7], index)) { > -case 0: > +case DR7_BP_INST: > if (hw_breakpoint_enabled(env->dr[7], index)) > cpu_breakpoint_remove_by_ref(env, env->cpu_breakpoint[index]); > break; > -case 1: > -case 3: > +case DR7_DATA_WR: > +case DR7_DATA_RW: > cpu_watchpoint_remove_by_ref(env, env->cpu_watchpoint[index]); > break; > -case 2: > +case DR7_IO_RW: > /* No support for I/O watchpoints yet */ > break; > } > @@ -1014,22 +1013,38 @@ void hw_breakpoint_remove(CPUX86State *env, int index) > int check_hw_breakpoints(CPUX86State *env, int force_dr6_update) > { > target_ulong dr6; > -int reg, type; > +int index, type = 0; > int hit_enabled = 0; > > dr6 = env->dr[6] & ~0xf; > -for (reg = 0; reg < 4; reg++) { > -type = hw_breakpoint_type(env->dr[7], reg); > -if ((type == 0 && env->dr[reg] == env->eip) || > -((type & 1) && env->cpu_watchpoint[reg] && > - (env->cpu_watchpoint[reg]->flags & BP_WATCHPOINT_HIT))) { > -dr6 |= 1 << reg; > -if (hw_breakpoint_enabled(env->dr[7], reg)) > +for (index = 0; index < DR7_MAX_BP; index++) { > +switch (hw_breakpoint_type(env->dr[7], index)) { > +case DR7_BP_INST: > +if (env->dr[index] != env->eip) > +break; > +type = 1; "type" is not very telling as it is used here. Either continue to assign it to hw_breakpoint_type and clear it on DR7_IO_RW, or rename it to a boolean like "bp_match". > +break; > +case DR7_DATA_WR: > +case DR7_DATA_RW: > +if (!env->cpu_watchpoint[index]) > +break; > +if (!(env->cpu_watchpoint[index]->flags & BP_WATCHPOINT_HIT)) > +break; Let's fold these two into one. In general: coding style. > +type = 1; > +break; > +case DR7_IO_RW: > +break; > +} > +
[Qemu-devel] [PATCH 2/3] configure: also symlink *.aml files
Signed-off-by: Gerd Hoffmann --- configure |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 994f731..8483388 100755 --- a/configure +++ b/configure @@ -4190,6 +4190,7 @@ FILES="$FILES pc-bios/spapr-rtas/Makefile" FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" for bios_file in \ $source_path/pc-bios/*.bin \ +$source_path/pc-bios/*.aml \ $source_path/pc-bios/*.rom \ $source_path/pc-bios/*.dtb \ $source_path/pc-bios/openbios-* \ -- 1.7.1
[Qemu-devel] [PATCH 1/3] seabios: update to 3d11108f45818d75140530a184c05680f1be51ad
Most q35 patches landed in seabios upstream. Some cleanups and the mcfg table are still missing. So pci mmconfig will not work. Basic functionality is there though. Signed-off-by: Gerd Hoffmann --- pc-bios/acpi-dsdt.aml | Bin 4540 -> 4450 bytes pc-bios/bios.bin | Bin 131072 -> 131072 bytes pc-bios/q35-acpi-dsdt.aml | Bin 0 -> 8374 bytes roms/seabios |2 +- 4 files changed, 1 insertions(+), 1 deletions(-) create mode 100644 pc-bios/q35-acpi-dsdt.aml diff --git a/pc-bios/acpi-dsdt.aml b/pc-bios/acpi-dsdt.aml index bb3dd83a56f84131f9c9f968cbee9385931cecd3..dbc2114d36c1c57804a9a7e91f855a8445b3aafb 100644 GIT binary patch delta 465 zcmdm^{78w*CDSZ@Ky{DcK;lM@)0Ff3$&8+D3XrarpK&L0V}3CI yh-GHrP!d3xV}#QjU_jwChv^3s&=?M&F#@XaD2Z;8oGi~P%FMv^e{(LcKMMe(b##XS delta 618 zcmaixK}!Nb7>2*u+0|(@T495vi)|4lVVWJf)$We2X42v+1RIW*prc2ngXS+t#Cw6) z4&k*Q(LV_K30?HqPN^Fab$R(y}x|r(^4M%|`F|9fNG637%j;`Uxau@QuWR z*DEP!PIVDZ25sjvT(e&9)KktyCd(?W(YR?u0ifHs4-FbHf(KcI-}nYn>9UPlxP=MP zyMenAvd+tyc}xWnUMn&bFct`Fh9Ci=^DASDrx=K?1`Ja$4t_AG^atd>cTA|xb3k9$1WU`h-FX@(dn-wz_r6qhZg;+vzLh?dvAq62t YA*TtI1@2nRv2v%V*+$pnR diff --git a/pc-bios/bios.bin b/pc-bios/bios.bin index dc9b57ddc9a39f3d8ea75a8f23e3869c26144795..202ba076ca393f782040ee09ee2158f628fa41ad 100644 GIT binary patch delta 20272 zcmZ{M3tUvi`~IBew&KDrvM4Ah!h)!vppvMd2#BbtD1!HEN+-IhftS1hf#q?fw5hg> zmbc2vio|5WR1gJkmEtA5rIwe2tAcmD?*Dnu%4+?8Uq7FRo%7B+@4WNQ%scPQnPYCQ zIyYCnVpQ>7hjT(sTm)l-fVY4KU}QJOjsPbChwhBU^kggzD2ryS99Ynou{_{=;AgZ5?KyAg2Wl%9`NNr#?*rt zdpMXery-1e448*9)^8YN-vACH7+W@)u{A(3Pz9U-t^!uTeGFrV#xXW;JYy?>&A^Na zj4cAJlNmEiVXP~V4SWWCH6@2J3lh4ijI{w80QEG+etnU#E5NNRRG!UP60jV&4?F={ z%mF{p2QUGibHVc#W9dLP5V4T40l-AyCE!~iVliVqfuTSFkpDJgk8|?Tssfkn|<&)Bq;=t9oe z;g1*_`!VDLTY*FqW0QcKR-d3R03)#VQ^wk^LV?wcZTW(+KY*{+pg)1-8_)$n=2vLR z*J#~F#)bgz0at-$-!c{g=)PmDGw=m)8+iOZV_usW3;ltyfxxRjGWITzSHxJWV)Xxv zVrT(;3b<}z%pWNE1!H0>Om9Yalrk0tqycLHhcd=q0}cVpwxOSaB48`93)l-B1x^B2 zftx@h@C2CmD`UR{i??H}?0^D0(f>d1Wb6PCQ_k3fU5t&ZWb8-a4lr#u%naNEBKIH< z*ae&d>Vfns#(p`-*fyXZxC6}k4P}7Ofk(i1ze7P_EAT5&3)BI30f(GF7;^*K0NsFC zU@EZq5a>0q2Jjj11MvD0m<`wr_#I^|92f(X05!lBpnWZ5onWjxFajt&$=KRcjD?+s zyff$`pciln(EbI>zi^hZ3Baqs7QhVr3X}u80mC_%AISX&gA15)fw3&095@Qdz#~9+ z5xhVYkPJ)#vVf()DnP!3?f@Eq+dw1m=n`wi*kw2dKn*;)&(H^Weo*Y{I#|eQ9gash zrODlZo{a5>V_6P|QW1{ zBfttw{1gNCGsaR@!=%88FQDL;umG?V*uMrAT8qI8TwRB5*nk226_ouN4f_V&7P}Gs z0eHf(bOXKvHo~dQ`X2KeXtxOi?+1)@AmK+WM8J)oFtXuXLV+aUCBO)*0yY7E18sk1 zY}jT@SNNQgE$}nHFqQ!<09F8NfQnzx|8+=gg(LDPfw{~ubtwiS@D<=z#@Oj!F~YY) z>z#}p0|u6(D=N`d!13K!FZM7NzYmH5Ujy5K_4{GX-(V#m=y%``j0a%qA(R1rJzX2=$6(?x()vA!& zd|#_0s&nrA3-30n)9!qmx7g;KyOzmm;2F21JS(km1=BGmr8r9G%ffkIpU$d;mi!f; zA-<_C-I+AO;8>{lltvlUg~6~$t!B;+gpV#XB!KhGnhW z+8#A|5ApbS>+ZHkwUXPeO{bqBARr?-Vtz(yzXD4Q|QnZSdh2oDH zjEj5?n&{i^Onig13AoRH@J;qsisYaO43XU;QzzZX-)|*u4?n&4C_DETjR-h)Yb@QX z9Sx~1d5oX8YV=(`+RvaWy3ZH+y`VbK$baz*Qf+ADr~Lv{$&DYhovC`~9-rMd)b9`) zCZD`-)5<%uoA|0-to|O~);6ePEpdDTj&X{z(8OQdtAaylY~qv>3>vxWE^pRus>=yd z|BpsKt6h5`iSu@b2&EAfjaI8vF=olWY<;HgXJ1=0!1=90p9s1~<~&h-hYY~wc9&K6 z?()O_Q7+d=+|Juv*S^z;Rre5mIF&=4HeS2&H~#@!7?|Uf-^k|piqQ_x=qPFA6OAG- z-G)i_TFEM|ay}j`-)py)kDpYj{mE(hUs@JXQy1UJjqUxt*1~vFHCpx3(%MVYBTiX# z@_UWEynRT!p~x}n4RLu7bR7_^ozDyu6G%a&g1xu6OF+14>OI~opxcxesLqME(3MZn zpOYqA#*IXEDdKRV4*(sC$ccC15gU9SklvkbdK*Z`htn5#7U7GSILa>GgUZfKp*L`}p#^B<&;=_Z<7DPOt8i-KCIw72-aAm1(__PYP7w+*N1@?)ed zCCd^Fs_5^sS|}~LOagwb=bpi#tx4?Eh?=6?@~=;%moyI<}-H`<~=2%~VUf%=dqENAz*SYEA6*WcGI! zCwbp>-nB!DYU@p&*CA;TO-=cy28^jaB6){W`a^?C$@rKu5)A50U8yh3YNszIdey(E zyhTVy%|W|DORw>PAwQ`mJmifbk*XCpc-M}rdmn@qq$=r8W4yjFA!L+McXyXAYmj^k z$~Sdq4_kMJWeyUf?=}sQeHQNAsh#Sug?H%G)3f(eDZReWg-+R#@=MqGtWMr7Z`;s zsLDV0TmD{^q%uDMyL`aH{|NKye)Gz+`t8$EFQ9&!p`7Ig+7@k^jCaLwwo#JlY)xrx3L*EOisu~q}SDbfj zss@8AnCJ-x9ddk01-LDn3dJ*fh=NN#jq`@H{A}dcw&m*9d8#O+siIG)BFDSMYhKU^ zt(A)Qo_ki2b7t(*_U!N3np%FTXJ^f;O~#ftpDFf>3Km)_O=@B5pb1Yq2+U)9wbe|p zGbf+s`Mq9I%-74?d5c2l?!5zqmOP@jSNkq~q3GMEZ01LJ#|qQc*RZU*iGwIdJjGw? z{dG6RN568$w$ON_Hmx&YNC$B&{3flMQl)gve4Dy({9n9ZpCHxjGZ@02ZN^YzHTRmv z{Q!h1j;!hggFg*kWQ?CQd177liDGs19#xKvZbNZargOsHvpl1| zbT#za>~R&|M!UnOS8bN2+KHIxpQTyOcS0_OLT zz09?@I?F{|honUxvkE`jf;*0k#l>1Kh-G+`R~<*$t$QN^Ya+@mE-EF&i0!p^_ML(n z6#Rn!3Ry7yGX5ArcRDv13)TJ5T7pOm)96Kh!_W`ylwN zk;H9{^gg0xqC-CjDLcZw;xfqr=Eb$nq4+|ccfx8d4L_x2W#M2mE352uqUFL`Wjf~0 zFy6tJ0@_+iq0?NAx+OJPj?y8^-Sx5QAf3wUP>8@^VA4sO>k9yPrYe((3b8h#Mjm|M zO3PsNfP)PXlK0xdEDyMC5vF3sp$BOgLaWa4PqpfP45PGi5+;kQ7zEAhE+G0aXQ4zG z)3~z~k+c&jDJD?EQW3tE5iRcu5zS(AcXYANn0?UF+^7~-jzT-~%N=7VbM|#9`(S#i zNYcbvRN4!rrP?qe?3he{rL)lK)`l{r*lwMrnbB1^Aqe@q9P=LRc7}+0sp{TeWt4oH z7op@$LAA5%%jgI7x(a!U04hZa&A#R|;RFv%=;%2p7PT%!3~mhD1Zx;$HoEi43Co2H zel;O#qB09c9kIniUT`IP7>O*TbXXr`P#oqXcA@b;j|`!>TY+4Qp>T*}M2+-^#cP>H zw=~(HTBd0g7nRJ1Cw6G3v{F?=-e}AcYqoc0jF|MWsV%+#;2$N%=O`=0n!{*tWmR0L zP!$)(GOFXcG-K6q;hSNUs<<9Es^TIWs^g+q5e}^4VjY#AWVP~>a_%SM8RJ+LH^@ zHy*ze93fzeRg1sVtlH|hnP25%C;dN!=k!3SNQeI=-5-_wN4oAm(l0{EO2uOxH^zow z>Nv?BhtT9VLzWF`hDfMfrFV$UZ_LWR7jk&%kY?%PpENS8*tLxvKYmhi_&|T5SuT3R zsJ~MHkDJt$runj@EKS3MCR4RL$Xy4eYwZLnZMR%@fWI+lwog(r}K3~zcnbm z`0hS5DZ!wbh+*j~V#kMJ+1R9CSrva{SdHp-Y;pYXC60>E@
Re: [Qemu-devel] [PATCH v2 6/6] add vm state to backups
> +static void coroutine_fn backup_start_savevm(void *opaque) > +{ > +assert(backup_state.driver); > +assert(backup_state.writer); > +int ret; > +char *err = NULL; > +uint64_t remaining; > +int64_t maxlen; > +MigrationParams params = { > +.blk = 0, > +.shared = 0 > +}; > + > +int restart = 0; > + > +QEMUFile *file = qemu_fopen_ops(NULL, &backup_file_ops); > + > +ret = qemu_savevm_state_begin(file, ¶ms); > +if (ret < 0) { > +qemu_fclose(file); > +err = g_strdup("qemu_savevm_state_begin failed"); > +goto abort; > +} > + > +while (1) { > +ret = qemu_savevm_state_iterate(file); > +remaining = ram_bytes_remaining(); > + > +if (ret < 0) { > +qemu_fclose(file); > +err = g_strdup_printf("qemu_savevm_state_iterate error %d", ret); > +goto abort; > +} > + > +/* stop the VM if we use too much space, > + * or if remaining is just a few MB > + */ > +maxlen = ram_bytes_total(); > +size_t cpos = backup_state.buf_cluster_num * BACKUP_CLUSTER_SIZE; > +if ((remaining < 10) || ((cpos + remaining) >= maxlen)) { > +if (runstate_is_running()) { > +restart = 1; > +vm_stop(RUN_STATE_SAVE_VM); > + } > +} > + > +if (ret == 1) { /* finished */ > +if (runstate_is_running()) { > +restart = 1; > +vm_stop(RUN_STATE_SAVE_VM); > +} > + > +ret = qemu_savevm_state_complete(file); > +if (ret < 0) { > +qemu_fclose(file); > +err = g_strdup("qemu_savevm_state_complete error"); > +goto abort; > + > +} else { > +if (qemu_fclose(file) < 0) { > +error_setg(&backup_state.error, > + "backup_start_savevm: qemu_fclose failed"); > +goto abort; > +} > +if (backup_state.driver->complete_cb(backup_state.writer, > +backup_state.vmstate_dev_id, 0) < 0) { > +err = g_strdup("backup_start_savevm: complete_cb > failed"); > +goto abort; > +} > +backup_start_jobs(); backup_start_jobs() was called after qemu_savevm_state_complete(), and then VM got resumed with block backup jobs alone, would this cause saved vm state not sync with the saved block contents, if there is vmstate changing after backup_start_jobs()? > +goto out; > +} > +} > +} -- Best Regards Wenchao Xia
[Qemu-devel] [PULL for-1.3 0/3] seabios: q35 update
Hi, Most q35 seabios patches just landed upstream. So here we go with a last-minute pull to plumb the missing q35 bits. It obviously updates seabios again. It also adds autoloading for the acpi dsdt table. With this pull "qemu -M q35" JustWorks[tm]. please pull, Gerd The following changes since commit 01bbd8bf2caced5cb07939669f58d3a7bcc78092: Update version for 1.3.0-rc2 (2012-11-30 15:04:16 -0600) are available in the git repository at: git://git.kraxel.org/qemu seabios-3d11108 Gerd Hoffmann (3): seabios: update to 3d11108f45818d75140530a184c05680f1be51ad configure: also symlink *.aml files acpi: autoload dsdt configure |1 + hw/pc.c | 23 +++ hw/pc.h |1 + hw/pc_piix.c |1 + hw/pc_q35.c |1 + pc-bios/acpi-dsdt.aml | Bin 4540 -> 4450 bytes pc-bios/bios.bin | Bin 131072 -> 131072 bytes pc-bios/q35-acpi-dsdt.aml | Bin 0 -> 8374 bytes roms/seabios |2 +- 9 files changed, 28 insertions(+), 1 deletions(-) create mode 100644 pc-bios/q35-acpi-dsdt.aml
Re: [Qemu-devel] func call to safely shutdown VM and quit qemu?
> Date: Mon, 3 Dec 2012 10:30:41 +0100 > From: laurent.desnog...@gmail.com > To: mcheun...@hotmail.com > CC: qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] func call to safely shutdown VM and quit qemu? > > On Mon, Dec 3, 2012 at 9:43 AM, Peter Cheung wrote: > > Hi > >Is there a func call to safely shutdown VM and quit qemu? > > I am using qemu_system_shutdown_request(). I don't know it that's > the best way of quitting, but it works for me. > > HTH, > > Laurent > thanks gentleman
[Qemu-devel] [PATCH 3/3] acpi: autoload dsdt
Signed-off-by: Gerd Hoffmann --- hw/pc.c | 23 +++ hw/pc.h |1 + hw/pc_piix.c |1 + hw/pc_q35.c |1 + 4 files changed, 26 insertions(+), 0 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 2b5bbbf..2547c26 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -877,6 +877,29 @@ void pc_cpus_init(const char *cpu_model) } } +void pc_acpi_init(const char *default_dsdt) +{ +char *filename = NULL, *arg = NULL; + +if (acpi_tables != NULL) { +/* manually set via -acpitable, leave it alone */ +return; +} + +filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, default_dsdt); +if (filename == NULL) { +fprintf(stderr, "WARNING: failed to find %s\n", default_dsdt); +return; +} + +arg = g_strdup_printf("file=%s", filename); +if (acpi_table_add(arg) != 0) { +fprintf(stderr, "WARNING: failed to load %s\n", filename); +} +g_free(arg); +g_free(filename); +} + void *pc_memory_init(MemoryRegion *system_memory, const char *kernel_filename, const char *kernel_cmdline, diff --git a/hw/pc.h b/hw/pc.h index 2237e86..9ecccbb 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -79,6 +79,7 @@ void pc_register_ferr_irq(qemu_irq irq); void pc_acpi_smi_interrupt(void *opaque, int irq, int level); void pc_cpus_init(const char *cpu_model); +void pc_acpi_init(const char *default_dsdt); void *pc_memory_init(MemoryRegion *system_memory, const char *kernel_filename, const char *kernel_cmdline, diff --git a/hw/pc_piix.c b/hw/pc_piix.c index aa3e7f4..dbf5663 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -87,6 +87,7 @@ static void pc_init1(MemoryRegion *system_memory, void *fw_cfg = NULL; pc_cpus_init(cpu_model); +pc_acpi_init("acpi-dsdt.aml"); if (kvmclock_enabled) { kvmclock_create(); diff --git a/hw/pc_q35.c b/hw/pc_q35.c index 3429a9a..7a8d6fe 100644 --- a/hw/pc_q35.c +++ b/hw/pc_q35.c @@ -87,6 +87,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) qemu_irq *cmos_s3; pc_cpus_init(cpu_model); +pc_acpi_init("q35-acpi-dsdt.aml"); kvmclock_create(); -- 1.7.1
Re: [Qemu-devel] [PATCH] target-i386:slightly refactor dr7 related function
Am 03.12.2012 10:43, schrieb Jan Kiszka: > On 2012-12-03 04:07, liguang wrote: >> 1. define names of breakpoints in dr7 >> 2. slightly refactor bits field of breakpoint >>related functions. > > Two topics, (at least) two patches, please. The code is hairy - not your > fault, you actually try to improve it. But splitting up makes review > easier. Thanks in advance. I was going to request the same thing: Please first introduce the new constants, then do functional changes on top. When you do that, please remember to include a short cover letter and use git-send-email so that the patches stay together. :) The following link may be helpful for avoiding coding style issues: http://blog.vmsplice.net/2011/03/how-to-automatically-run-checkpatchpl.html Regards, 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] slow virtio network with vhost=on and multiple cores
Am 16.11.2012 um 12:00 schrieb Alexandre DERUMIER : >>> While trying to reproduce the bug, we just detected that it depends on the >>> hardware (mainboard) you run on. >>> >>> Sigh :-/ > > Hi, > > I can reproduce the bug on all my dell servers,differents generation (R710 > (intel),R815 (amd), 2950 (intel). > > They all use broadcom bnx2 network card (don't know if it can be related) > > host kernel : rhel 63 with 2.6.32 kernel > > guest kernel : 2.6.32 (debian squeeze, ubuntu). > > No problem with guest kernel 3.2 Have you had any further progress on this regression/problem? Thanks, Peter > > > > > - Mail original - > > De: "Dietmar Maurer" > À: "Peter Lieven" > Cc: "Stefan Hajnoczi" , "Peter Lieven" , > "Jan Kiszka" , qemu-devel@nongnu.org, "Michael S. Tsirkin" > > Envoyé: Vendredi 16 Novembre 2012 11:44:26 > Objet: Re: [Qemu-devel] slow virtio network with vhost=on and multiple cores > >>> I only tested with RHEL6.3 kernel on host. >> >> can you check if there is a difference on interrupt delivery between those >> two? >> >> cat /proc/interrupts should be sufficient after some traffic has flown. > > While trying to reproduce the bug, we just detected that it depends on the > hardware (mainboard) you run on. > > Sigh :-/
Re: [Qemu-devel] [PATCH RFT 0/5] usb: Clean up and extend SysBus EHCI
On Mon, Dec 03, 2012 at 07:59:55AM +0100, Gerd Hoffmann wrote: > Hi, > >> Gerd: In order for me to use this with the new-style Tegra2 model we >> will need to further move EHCISysBusState and the accompanying macros >> that this series adds into the hcd-ehci.h header so that it can be >> embedded into the SoC object. So if you're okay with my approach we'd >> need a v2. > >Looks good to me. Guess we want something simliar for UHCI ... > >> Also a question: Vincent's patch has a comment "multiple EHCI >> controllers support not ready". Is this still a known issue or resolved >> by now? > >I'm not aware of any. Hi Andreas, I'm aware of it today. For example, xilinx_zynq has two EHCI controllers. If I specify a usb device of type "usb-storage", the question is: which EHCI controller does the usb device attach to? The answer is dependent. 1. If I use "usbdevice" and pass the host usb device, such as: $ qemu -usb -usbdevice host:: The device will attach to the first EHCI controller. 2. If I use "device" and "usb-storage", such as: $ qemu -usb -device usb-storage,drive=ud -drive id=ud,file=usbdisk.img,if=none The device will attach to the second EHCI controller. Qemu doesn't provide some properties, such as "bus", to specify which EHCI controller the usb device attach to. If we use "device" and "usb-storage", we never attach the usb device to the specified EHCI controller. Liming Wang > >cheers, > Gerd
Re: [Qemu-devel] [PATCH 1.3] ehci-sysbus: Attach DMA context.
On Thu, Nov 29, 2012 at 12:05:14PM +1000, Peter Crosthwaite wrote: >On Thu, Nov 29, 2012 at 12:00 PM, walimis wrote: >> On Thu, Nov 29, 2012 at 11:43:18AM +1000, Peter Crosthwaite wrote: >>>This was left as NULL on the initial merge due to debate on the mailing list >>>on >>>how to handle DMA contexts for sysbus devices. Patch >>>9e11908f12f92e31ea94dc2a4c962c836cba9f2a was later merged to fix OHCI. This >>>is the, >>>equivalent fix for sysbus EHCI. >> >> I have also found this issue, but it's not the cause that xilinx >> ehci can't work with usb-storage disk. Do you have any update >> for xilinx ehci? >> > >Hi Liming, > >I haven't got around to looking into that one yet unfortunately. No >updates just yet - ill let you know if it resolves. It could very well >be a Linux bug as well so it needs to be investigated from both sides >of the fence. As said in another mail, I found that the root cause is that xilinx_zynq has two EHCI controller. If we use usb-storage disk, the disk will be attached to the second EHCI controller, which the kernel uses the first EHCI controller by default. For now, qemu doesn't support two EHCI controller, could we remove the second EHCI from xilinx_zynq? Liming Wang > >>> >>>Signed-off-by: Peter Crosthwaite >> >> Tested-by: Liming Wang >> > >Thanks. > >Regards, >Peter > >> Liming Wang >> >>>--- >>> hw/usb/hcd-ehci-sysbus.c |1 + >>> 1 files changed, 1 insertions(+), 0 deletions(-) >>> >>>diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c >>>index 1584079..803df92 100644 >>>--- a/hw/usb/hcd-ehci-sysbus.c >>>+++ b/hw/usb/hcd-ehci-sysbus.c >>>@@ -45,6 +45,7 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev) >>> >>> s->capsbase = 0x100; >>> s->opregbase = 0x140; >>>+s->dma = &dma_context_memory; >>> >>> usb_ehci_initfn(s, DEVICE(dev)); >>> sysbus_init_irq(dev, &s->irq); >>>-- >>>1.7.0.4 >>> >>> >>
Re: [Qemu-devel] [PATCH V6 08/10] Create four opts list related functions
On Fri, Nov 23, 2012 at 8:47 AM, Dong Xu Wang wrote: > +/* Create a new QemuOptsList and make its desc to the merge of first and > second. > + * It will allocate space for one new QemuOptsList plus enouth space for s/enouth/enough/ > +dest->name = "append_opts_list"; > +dest->implied_opt_name = NULL; > +dest->merge_lists = false; > +QTAILQ_INIT(&dest->head); > +while (first && (first->desc[i].name)) { > +if (!find_desc_by_name(dest->desc, first->desc[i].name)) { > +dest->desc[index].name = g_strdup(first->desc[i].name); > +dest->desc[index].help = g_strdup(first->desc[i].help); > +dest->desc[index].type = first->desc[i].type; > +dest->desc[index].def_print_str = > +g_strdup(first->desc[i].def_print_str); > +++index; > + } > +i++; 4-space indentation? scripts/checkpatch.pl normally detects problems with whitespace.
Re: [Qemu-devel] [PATCH RFT 0/5] usb: Clean up and extend SysBus EHCI
On 3 December 2012 11:58, walimis wrote: > For example, xilinx_zynq has two EHCI controllers. If I specify a usb > device of type "usb-storage", the question is: which EHCI controller does the > usb device attach to? The answer is dependent. > > 1. If I use "usbdevice" and pass the host usb device, such as: > > $ qemu -usb -usbdevice host:: > > The device will attach to the first EHCI controller. > > 2. If I use "device" and "usb-storage", such as: > > $ qemu -usb -device usb-storage,drive=ud -drive id=ud,file=usbdisk.img,if=none > > The device will attach to the second EHCI controller. This is a long standing bug which is caused by the legacy -usbdevice search looking through the list of usb buses in one direction, and the generic -device code looking through it in the other direction: http://lists.gnu.org/archive/html/qemu-devel/2011-06/msg00926.html > Qemu doesn't provide some properties, such as "bus", to specify which EHCI > controller the > usb device attach to. If we use "device" and "usb-storage", we never attach > the usb > device to the specified EHCI controller. -device certainly ought to let you specify a bus= property; you want to be able to specify the USB controller regardless of whether we sort out the ordering mess. If that doesn't work then we have a different bug. -- PMM
Re: [Qemu-devel] [PATCH RFT 0/5] usb: Clean up and extend SysBus EHCI
On Mon, Dec 03, 2012 at 12:10:02PM +, Peter Maydell wrote: >On 3 December 2012 11:58, walimis wrote: >> For example, xilinx_zynq has two EHCI controllers. If I specify a usb >> device of type "usb-storage", the question is: which EHCI controller does the >> usb device attach to? The answer is dependent. >> >> 1. If I use "usbdevice" and pass the host usb device, such as: >> >> $ qemu -usb -usbdevice host:: >> >> The device will attach to the first EHCI controller. >> >> 2. If I use "device" and "usb-storage", such as: >> >> $ qemu -usb -device usb-storage,drive=ud -drive >> id=ud,file=usbdisk.img,if=none >> >> The device will attach to the second EHCI controller. > >This is a long standing bug which is caused by the legacy >-usbdevice search looking through the list of usb buses >in one direction, and the generic -device code looking >through it in the other direction: > >http://lists.gnu.org/archive/html/qemu-devel/2011-06/msg00926.html > >> Qemu doesn't provide some properties, such as "bus", to specify which EHCI >> controller the >> usb device attach to. If we use "device" and "usb-storage", we never attach >> the usb >> device to the specified EHCI controller. > >-device certainly ought to let you specify a bus= property; Sorry, I don't know the bus= property. But why both EHCI controller are named "usb-bus.0"? How to distinguish the different usb usb? Liming Wang >you want to be able to specify the USB controller regardless >of whether we sort out the ordering mess. If that doesn't >work then we have a different bug. > >-- PMM
Re: [Qemu-devel] [PATCH V6 09/10] Use QemuOpts support in block layer
On Fri, Nov 23, 2012 at 8:47 AM, Dong Xu Wang wrote: > This patch will use QemuOpts related functions in block layer, add > a member bdrv_create_options to BlockDriver struct, it will return > a QemuOptsList pointer, which includes the image format's create > options. > > And create options's primary consumer is block creating related functions, > so modify them together. > > This patch also define a macro called STRINGIZER, it is used to convert > number to string. Please use osdep.h:stringify() instead of redefining this macro. > @@ -638,24 +638,18 @@ static int vdi_create(const char *filename, > QEMUOptionParameter *options) > logout("\n"); > > /* Read out options. */ > -while (options && options->name) { > -if (!strcmp(options->name, BLOCK_OPT_SIZE)) { > -bytes = options->value.n; > +if (opts) { > +bytes = qemu_opt_get_number(opts, BLOCK_OPT_SIZE, 0); > #if defined(CONFIG_VDI_BLOCK_SIZE) > -} else if (!strcmp(options->name, BLOCK_OPT_CLUSTER_SIZE)) { > -if (options->value.n) { > -/* TODO: Additional checks (SECTOR_SIZE * 2^n, ...). */ > -block_size = options->value.n; > -} > +block_size = qemu_opt_get_size(opts, > + BLOCK_OPT_CLUSTER_SIZE, > + DEFAULT_CLUSTER_SIZE); Please preserve the TODO comment. > #endif > #if defined(CONFIG_VDI_STATIC_IMAGE) > -} else if (!strcmp(options->name, BLOCK_OPT_STATIC)) { > -if (options->value.n) { > -image_type = VDI_TYPE_STATIC; > -} > -#endif > +if (qemu_opt_get_bool(opts, BLOCK_OPT_ENCRYPT, 0)) { > +image_type = VDI_TYPE_STATIC; s/BLOCK_OPT_ENCRYPT/BLOCK_OPT_STATIC/ > int disk_type; > int ret = -EIO; > > -/* Read out options */ > -total_size = get_option_parameter(options, BLOCK_OPT_SIZE)->value.n; > - > -disk_type_param = get_option_parameter(options, BLOCK_OPT_SUBFMT); > -if (disk_type_param && disk_type_param->value.s) { > -if (!strcmp(disk_type_param->value.s, "dynamic")) { > -disk_type = VHD_DYNAMIC; > -} else if (!strcmp(disk_type_param->value.s, "fixed")) { > -disk_type = VHD_FIXED; > +/* Read out opts */ > +if (opts) { > +total_size = qemu_opt_get_number(opts, BLOCK_OPT_SIZE, 0); > +disk_type_param = qemu_opt_get(opts, BLOCK_OPT_SUBFMT); > +if (disk_type_param) { > +if (!strcmp(disk_type_param, "dynamic")) { > +disk_type = VHD_DYNAMIC; > +} else if (!strcmp(disk_type_param, "fixed")) { > +disk_type = VHD_FIXED; > +} else { > +return -EINVAL; > +} > } else { > -return -EINVAL; > +disk_type = VHD_DYNAMIC; > } > -} else { > -disk_type = VHD_DYNAMIC; > } disk_type must be initialized even when opts == NULL. It's easiest to do: int disk_type = VHD_DYNAMIC; ... if (opts) { ... if (disk_type_param) { if (!strcmp(disk_type_param, "dynamic")) { disk_type = VHD_DYNAMIC; } else if (!strcmp(disk_type_param, "fixed")) { disk_type = VHD_FIXED; } else { return -EINVAL; } } }
Re: [Qemu-devel] [PATCH V6 00/10] replace QEMUOptionParameter with QemuOpts parser
On Fri, Nov 23, 2012 at 8:47 AM, Dong Xu Wang wrote: > Patch 1-3 are from Luiz, added Markus's comments, discussion could be found > here: > http://lists.nongnu.org/archive/html/qemu-devel/2012-07/msg02716.html > Patch 3 was changed according Paolo's comments. > > Patch 4-5: because qemu_opts_create can not fail while id is null, so create > function qemu_opts_create_nofail and use it. > > Patch 6: create function qemu_opt_set_number, like qemu_opt_set_bool. > > Patch 7: add def_value and use it in qemu_opts_print. > > Patch 8: Create functions to pair with QEMUOptionParameter parser. > > Patch 9: Use QemuOpts parser in Block. > > Patch 10: Remove QEMUOptionParameter parser related code. > > v5->v6: > 1) allocate enough space in append_opts_list function. > 2) judge if opts == NULL in block layer create functions. > 3) use bdrv_create_file(filename, NULL) in qcow_create funtion. > 4) made more readable while using qemu_opt_get_number funtion. > > v4->v5: > 1) Rewrite qemu_opts_create_nofail function based on Peter Maydell's comments. > 2) Use g_strdup_printf in qemu_opt_set_number. > 3) Rewrite qemu_opts_print. > 4) .bdrv_create_options returns pointer directly. Fix a bug about > "encryption". > 5) Check qemu_opt_get_number in raw-posix.c. > > v3->v4: > 1) Rebased to the newest source tree. > 2) Remove redundant "#include "block-cache.h" > 3) Other small changes. > > v2->v3: > 1) rewrite qemu_opt_set_bool and qemu_opt_set_number according Paolo's > coments. > 2) split patches to make review easier. > > v1->v2: > 1) add Luiz's patches. > 2) create qemu_opt_set_number() and qemu_opts_create_nofail() functions. > 3) add QemuOptsList map to drivers. > 4) use original opts parser, not creating new ones. > 5) fix other bugs. > > Dong Xu Wang (10): > qemu-option: opt_set(): split it up into more functions > qemu-option: qemu_opts_validate(): fix duplicated code > qemu-option: qemu_opt_set_bool(): fix code duplication > introduce qemu_opts_create_nofail function > use qemu_opts_create_nofail > create new function: qemu_opt_set_number > add def_print_str and use it in qemu_opts_print. > Create four opts list related functions > Use QemuOpts support in block layer > remove QEMUOptionParameter related functions and struct > > block.c | 91 +- > block.h |8 +- > block/cow.c | 46 +++--- > block/qcow.c | 60 +++--- > block/qcow2.c | 171 +- > block/qed.c | 86 +- > block/raw-posix.c | 65 > block/raw.c | 30 ++-- > block/sheepdog.c | 75 > block/vdi.c | 68 > block/vmdk.c | 74 > block/vpc.c | 65 --- > block/vvfat.c | 11 +- > block_int.h |6 +- > blockdev.c|2 +- > hw/watchdog.c |2 +- > qemu-config.c |4 +- > qemu-img.c| 63 +++ > qemu-option.c | 512 > ++--- > qemu-option.h | 39 + > qemu-sockets.c| 16 +- > vl.c | 12 +- > 22 files changed, 658 insertions(+), 848 deletions(-) This is close to being merged. I have posted a few small remaining comments. Stefan
Re: [Qemu-devel] [PATCH 1.3] ehci-sysbus: Attach DMA context.
Hi, > As said in another mail, I found that the root cause is that xilinx_zynq has > two EHCI controller. If we use usb-storage disk, the disk will be attached to > the second EHCI controller, which the kernel uses the first EHCI controller > by default. For the linux kernel it shouldn't matter where the usb stick is connected. Assuming it finds both ehci controllers. Does it? > For now, qemu doesn't support two EHCI controller, could we remove the second > EHCI from xilinx_zynq? Two controllers should work just fine. I'd suggest to find the root cause instead of doctoring like this. ehci + usb core are fine with two controllers & busses, maybe the arch plumbing (device tree?) misses something so the linux kernel doesn't find the second ehci controller. cheers, Gerd
Re: [Qemu-devel] [Qemu-trivial] [PATCH] qemu-common: Add definition for O_NONBLOCK
On Sun, Nov 18, 2012 at 11:41:20AM +0100, Stefan Weil wrote: > Am 18.11.2012 09:55, schrieb Paolo Bonzini: > >Il 17/11/2012 17:40, Stefan Weil ha scritto: > >>backends/rng-random.c which was added by commit > >>5c74521d249486fa3e749dbbf6d56a70d4d7235f needs > >>macro O_NONBLOCK. > >> > >>The macro O_NONBLOCK is not defined for all hosts. > >>Adding a default definition fixes builds for MinGW. > >> > >>Signed-off-by: Stefan Weil > >>--- > >> > >>This is a build fix. Therefore I'd appreciate if it could be > >>committed soon. > > > >This would make things blocking when they were supposed to be > >nonblocking, so I'd prefer not including it. I thought Anthony had a > >fix too? > > > >Paolo > > Yes, my patch is only a quick fix to enable builds with MinGW again. > > Anthony's patch solves the same problem by omitting the code in > comiplations for non-POSIX builds. > > My primary goal was fixing the build, so any of these two patches > is fine for me. > > A backends/rng-random.c which compiles with MinGW would be even better, > but maybe that needs a little more time. /dev/random is available with > MinGW, so there is no basic problem doing this. Anthony's rng POSIX build patch was merged, dropping this. Stefan
Re: [Qemu-devel] [Qemu-trivial] [PATCH] arm: a9mpcore: remove un-used ptimer_iomem field
On Mon, Nov 19, 2012 at 03:13:49PM +1000, Peter Crosthwaite wrote: > I'm guessing this is a hangover from a previous coreification of the mptimer > sub-module. This field is completely unused - removed. > > Signed-off-by: Peter Crosthwaite > --- > hw/a9mpcore.c |1 - > 1 files changed, 0 insertions(+), 1 deletions(-) Thanks, applied to the trivial patches tree: https://github.com/stefanha/qemu/commits/trivial-patches Stefan
Re: [Qemu-devel] [Qemu-trivial] [PATCH] Clean up pci_drive_hot_add()'s use of BlockInterfaceType
On Thu, Nov 22, 2012 at 03:16:36PM +0100, Markus Armbruster wrote: > pci_drive_hot_add() parameter type has the wrong type: int instead of > BlockInterfaceType. It's actually redundant, so we can just drop it. > > Signed-off-by: Markus Armbruster > --- > hw/device-hotplug.c | 11 --- > hw/pci-hotplug.c| 7 +++ > sysemu.h| 3 +-- > 3 files changed, 8 insertions(+), 13 deletions(-) Thanks, applied to the trivial patches tree: https://github.com/stefanha/qemu/commits/trivial-patches Stefan
Re: [Qemu-devel] [Qemu-trivial] [PATCH] Fix spelling in comments and documentation
On Fri, Nov 23, 2012 at 07:26:04AM +0100, Stefan Weil wrote: > These spelling bugs were found by codespell: > > supressing -> suppressing > transfered -> transferred > > Signed-off-by: Stefan Weil > --- > hw/usb.h |6 +++--- > tests/qemu-iotests/iotests.py |2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) Thanks, applied to the trivial patches tree: https://github.com/stefanha/qemu/commits/trivial-patches Stefan
Re: [Qemu-devel] [PATCH] qemu-options: Fix space at EOL
On Fri, Nov 23, 2012 at 09:52:39AM +0100, Michal Privoznik wrote: > There's no need to add a space at the end of line. > Moreover, it can make problems in some projects that > store the help output into a file (and run couple of > tests based on that) and have space at EOL forbidden. > > Signed-off-by: Michal Privoznik > --- > qemu-options.hx |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Thanks, applied to the trivial patches tree: https://github.com/stefanha/qemu/commits/trivial-patches Stefan
Re: [Qemu-devel] [Qemu-trivial] [PATCH] qemu-timer: Don't use RDTSC on 386s and 486s
On Fri, Nov 23, 2012 at 03:12:50PM +, Peter Maydell wrote: > Adjust the conditional which guards the implementation of > cpu_get_real_ticks() via RDTSC, so that we don't try to use it > on x86 CPUs which don't implement RDTSC. Instead we will fall > back to the no-cycle-counter-available default implementation. > > Reported-by: Yurij Popov > Signed-off-by: Peter Maydell > --- > qemu-timer.h |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/qemu-timer.h b/qemu-timer.h > index da7e97c..e35f163 100644 > --- a/qemu-timer.h > +++ b/qemu-timer.h > @@ -169,7 +169,7 @@ static inline int64_t cpu_get_real_ticks(void) > return retval; > } > > -#elif defined(__i386__) > +#elif defined(__i586__) > > static inline int64_t cpu_get_real_ticks(void) > { > -- > 1.7.9.5 Dropping this due to the issue with gcc __i586__ that has been discussed. Stefan
Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/2] pc_sysfw: Check for qemu_find_file() failure
On Fri, Nov 23, 2012 at 07:12:17PM +0100, Markus Armbruster wrote: > diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c > index 9d7c5f4..066c4fe 100644 > --- a/hw/pc_sysfw.c > +++ b/hw/pc_sysfw.c > @@ -84,6 +84,11 @@ static void pc_fw_add_pflash_drv(void) > bios_name = BIOS_FILENAME; > } > filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); > +if (!filename) { > +error_report("Can't open BIOS image %s: %s", > + bios_name, strerror(errno)); qemu_find_file() does not document that errno is set when returning NULL. I can't find other callers to qemu_find_file() that use errno either. Please add a doc comment to qemu_find_file() that errno will be set on NULL return, otherwise we can't rely on it in the caller. Stefan
Re: [Qemu-devel] [PATCH 2/2] pc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path
On Fri, Nov 23, 2012 at 07:12:18PM +0100, Markus Armbruster wrote: > Harmless, because we the error inevitably leads to another, fatal one > in pc_system_flash_init(): PC system firmware (pflash) not available. > Fix it anyway. > > Signed-off-by: Markus Armbruster > --- > hw/pc_sysfw.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Thanks, applied to the trivial patches tree: https://github.com/stefanha/qemu/commits/trivial-patches Stefan
Re: [Qemu-devel] [PATCH] net: Allow specifying ifname for qemu-bridge-helper
On Fri, Nov 30, 2012 at 03:35:46PM +0100, Paolo Bonzini wrote: > Il 30/11/2012 08:10, Mike Lovell ha scritto: > > On 10/12/2012 12:49 AM, Mike Lovell wrote: > >> This makes a few changes to allow ifname to be specified when using > >> qemu-bridge-helper with both the bridge and tap network interfaces. It > >> adds > >> the --ifname option to qemu-bridge-helper, removes the restriction > >> that ifname > >> cannot be specified with helper for the tap interface, and adds logic to > >> specify the --ifname option when exec'ing the helper. > > > > ping ... or syn. any other thoughts about this? > > I share Michael's perplexity. This feature could be exploitable. > > If we want to add this, the ifname should be subject to ACL rules just > like bridge names. For example you could have a special allow/deny > directive "allow foo@" which allows ifnames starting with "foo". This is a good idea. The default should be that you are not allowed to choose arbitrary interface names. Stefan
Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/2] pc_sysfw: Check for qemu_find_file() failure
Stefan Hajnoczi writes: > On Fri, Nov 23, 2012 at 07:12:17PM +0100, Markus Armbruster wrote: >> diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c >> index 9d7c5f4..066c4fe 100644 >> --- a/hw/pc_sysfw.c >> +++ b/hw/pc_sysfw.c >> @@ -84,6 +84,11 @@ static void pc_fw_add_pflash_drv(void) >> bios_name = BIOS_FILENAME; >> } >> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); >> +if (!filename) { >> +error_report("Can't open BIOS image %s: %s", >> + bios_name, strerror(errno)); > > qemu_find_file() does not document that errno is set when returning > NULL. I can't find other callers to qemu_find_file() that use errno > either. > > Please add a doc comment to qemu_find_file() that errno will be set on > NULL return, otherwise we can't rely on it in the caller. Good point, v2 coming.
Re: [Qemu-devel] slow HD performance in mingw
Am 30.11.2012 16:36, schrieb Roy Tam: > 2012/11/30 Roy Tam : >> Hello all, >> >> I noticed that QEMU(both 1.2.1 and git head) acts very slow when >> accessing HD. I wonder if it is a fault in my build environment? >> > > and in same environment, I can see the speed decreases when version bumps: > http://roy.dnsd.me/qemu-0.15.1.png > http://roy.dnsd.me/qemu-1.0.50.png > http://roy.dnsd.me/qemu-1.0.91.png > http://roy.dnsd.me/qemu-1.2.91.png Can you bisect the exact commits at which each of these degradation steps happened? Kevin
Re: [Qemu-devel] [PATCH RFT 0/5] usb: Clean up and extend SysBus EHCI
Hi, >>> Qemu doesn't provide some properties, such as "bus", to specify which EHCI >>> controller the >>> usb device attach to. If we use "device" and "usb-storage", we never >>> attach the usb >>> device to the specified EHCI controller. >> >> -device certainly ought to let you specify a bus= property; > > Sorry, I don't know the bus= property. > But why both EHCI controller are named "usb-bus.0"? How to distinguish the > different usb usb? That is the default name. For usb controllers added via -device the bus name is derived from the device name, i.e. '-device usb-ehci,id=ehci" gives you a bus named "ehci.0". For builtin devices that doesn't work though as you don't have to add them manually. Guess they should be explicitly named then by zynq_init(). cheers, Gerd
Re: [Qemu-devel] [PATCH RFT 0/5] usb: Clean up and extend SysBus EHCI
On 3 December 2012 13:37, Gerd Hoffmann wrote: >> But why both EHCI controller are named "usb-bus.0"? How to distinguish the >> different usb usb? > > That is the default name. For usb controllers added via -device the bus > name is derived from the device name, i.e. '-device usb-ehci,id=ehci" > gives you a bus named "ehci.0". > > For builtin devices that doesn't work though as you don't have to add > them manually. Guess they should be explicitly named then by zynq_init(). It would probably be nice if the qdev/qom layer explicitly failed attempts to create a bus with a name matching one we already have; then this kind of thing would be noticed earlier... -- PMM
Re: [Qemu-devel] [PATCH 1.3] ehci-sysbus: Attach DMA context.
On Mon, Dec 03, 2012 at 01:51:00PM +0100, Gerd Hoffmann wrote: > Hi, > >> As said in another mail, I found that the root cause is that xilinx_zynq has >> two EHCI controller. If we use usb-storage disk, the disk will be attached to >> the second EHCI controller, which the kernel uses the first EHCI controller >> by default. > >For the linux kernel it shouldn't matter where the usb stick is >connected. Assuming it finds both ehci controllers. Does it? The default device tree of linux kernel has only the first ehci controller support, so the kernel can't detect the second controller. But the usb-storage disk is attached to the second controller, so that the disk is failed to be detected by the linux kernel. > >> For now, qemu doesn't support two EHCI controller, could we remove the second >> EHCI from xilinx_zynq? > >Two controllers should work just fine. I'd suggest to find the root Yes, they work fine separately, but I don't know how to use them at the same time (I mean both controller have device attached) as I have mentioned in the another mail. Liming Wang >cause instead of doctoring like this. ehci + usb core are fine with two >controllers & busses, maybe the arch plumbing (device tree?) misses >something so the linux kernel doesn't find the second ehci controller. > >cheers, > Gerd >
Re: [Qemu-devel] [PATCH] tests: Add tests for fdsets
Am 14.11.2012 23:53, schrieb Corey Bryant: > Signed-off-by: Corey Bryant > --- > tests/qemu-iotests/044| 129 > ++ > tests/qemu-iotests/044.out| 5 ++ > tests/qemu-iotests/group | 1 + > tests/qemu-iotests/iotests.py | 12 > 4 files changed, 147 insertions(+) > create mode 100755 tests/qemu-iotests/044 > create mode 100644 tests/qemu-iotests/044.out Needs to be renamed to 045 now, but looks good otherwise. Reviewed-by: Kevin Wolf
[Qemu-devel] KVM call agenda for 2012-12-04
Hi Please send in any agenda topics you are interested in. - migration troubles from 1.2 -> 1.3 due to qemu-kvm integration Later, Juan.
[Qemu-devel] detecting seccomp sandbox capability via QMP
Hello, is there a way to check if QEMU was compiled with --enable-seccomp via QMP? Jan
Re: [Qemu-devel] [PATCH v3] vnc: added initial websocket protocol support
On Fri, Nov 23, 2012 at 08:00:47PM +0100, Tim Hardeck wrote: Thanks for the patch, Tim. Some general code review comments below. I hope someone has time to review the VNC and WebSocket specific stuff. I didn't check the details of buffers, whether the WebSocket spec is correctly implemented, etc. > QEMU does segfault if a regular VNC client connects to the Websocket > port and then disconnects because of several unitialized lists since > vnc_init_state wasn't run before. > The segfault could be fixed by applying my previously sent patches > "[PATCH 0/2] fix segfaults triggered by failed vnc handshakes". The segfault issue should be addressed before merging it. I think the response on that email thread was to fix the qemu-queue.h users rather than making it okay to remove an element that isn't on a list (especially because this relies on uninitialized elements having a NULL value). So is the next step to fix those list users in VNC code? > ## > +# VNC WS detection > +if test "$vnc" = "yes" -a "$vnc_ws" != "no" ; then > + cat > $TMPC < +#include > +int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return > 0; } > +EOF > + vnc_ws_cflags=`$pkg_config --cflags gnutls 2> /dev/null` > + vnc_ws_libs=`$pkg_config --libs gnutls 2> /dev/null` > + if compile_prog "$vnc_ws_cflags" "$vnc_ws_libs" ; then > +vnc_ws=yes > +libs_softmmu="$vnc_ws_libs $libs_softmmu" > + else > +if test "$vnc_ws" = "yes" ; then > + feature_not_found "vnc-ws" > +fi > +vnc_ws=no > + fi > +fi This is really testing for GnuTLS rather than WebSockets. This probing is duplicated from the VNC TLS option. I suggest probing GnuTLS once and then using the result for both vnc_tls and vnc_ws. That way we don't duplicate the GnuTLS code. > diff --git a/qemu-options.hx b/qemu-options.hx > index 9bb29d3..647071e 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -1096,6 +1096,14 @@ client is specified by the @var{display}. For reverse > network > connections (@var{host}:@var{d},@code{reverse}), the @var{d} argument > is a TCP port number, not a display number. > > +@item websocket > + > +Opens an additional TCP listening port dedicated to VNC Websocket > connections. > +By defintion the Websocket port is 5700+@var{display}. If @var{host} is s/defintion/definition/ > +char *vncws_extract_handshake_entry(const char *handshake, > +size_t handshake_len, const char *name) This function should be static. > +void vncws_process_handshake(VncState *vs, uint8_t *line, size_t size) > +{ > +char *protocols = vncws_extract_handshake_entry((const char *)line, size, > +"Sec-WebSocket-Protocol: "); > +char *version = vncws_extract_handshake_entry((const char *)line, size, > +"Sec-WebSocket-Version: "); > +char *key = vncws_extract_handshake_entry((const char *)line, size, > +"Sec-WebSocket-Key: "); > + > +if (protocols && version && key > + && g_strrstr(protocols, "binary") != NULL > + && strcmp(version, WS_SUPPORTED_VERSION) == 0 > + && strlen(key) == WS_CLIENT_KEY_LEN) { > +vncws_send_handshake_response(vs, key); Indentation should be 4 spaces. > +} else { > +VNC_DEBUG("Defective Websockets header or unsupported protocol\n"); > +vnc_client_error(vs); > +} > + > +g_free(protocols); > +g_free(version); > +g_free(key); > +} > + > +void vncws_send_handshake_response(VncState *vs, const char* key) This function should be static. > +{ > +char combined_key[WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1]; > +char response[WS_HANDSHAKE_MAX_LEN]; > +char hash[SHA1_DIGEST_LEN + 1]; Why +1 if this is a 20-byte SHA1 binary hash? > +char *accept = NULL; > +size_t hash_size = SHA1_DIGEST_LEN, response_size = 0; > +gnutls_datum_t in; > + > +/* create combined key */ > +pstrcpy(combined_key, WS_CLIENT_KEY_LEN + 1, key); > +pstrcat(combined_key, WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1, WS_GUID); > + > +/* hash and encode it */ > +in.data = (void *)combined_key; > +in.size = WS_CLIENT_KEY_LEN + WS_GUID_LEN; > +if (gnutls_fingerprint(GNUTLS_DIG_SHA1, &in, hash, &hash_size) > +== GNUTLS_E_SUCCESS) { > +accept = g_base64_encode((guchar *)hash, SHA1_DIGEST_LEN); > +} > +if (accept == NULL) { > +VNC_DEBUG("Hashing Websocket combined key failed\n"); > +vnc_client_error(vs); > +return; > +} > + > +/* create handshake response */ > +response_size = snprintf(response, WS_HANDSHAKE_MAX_LEN, > +WS_HANDSHAKE, accept); Please use sizeof(response) instead of WS_HANDSHAKE_MAX_LEN. It's safer to use sizeof() rather than repeating the constant so that the sizes still match up if the variable definition is changed. > +g_free(accept); > + > +vnc_write(vs, response, response_size); > +vnc_flush(vs); > + > +vs->encode_ws = 1;
Re: [Qemu-devel] [PATCH V10 2/8] hw/apm.c: replace register_ioport*
On 11/27/2012 08:46 PM, Jason Baron wrote: > On Tue, Nov 27, 2012 at 01:10:16AM +0100, Andreas Färber wrote: >> Am 19.09.2012 13:50, schrieb Julien Grall: >>> This patch replaces all register_ioport* by a MemorySection. >>> It permits to use the new Memory stuff like listener. >>> >>> Moreover, the PCI is added as an argument for apm_init, so we >>> can register IO inside the pci IO address space. >>> >>> Signed-off-by: Julien Grall >> >> Following today's q35 merge I needed the following diff to fix the build: >> >> diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c >> index 2fc83a4..7de5427 100644 >> --- a/hw/lpc_ich9.c >> +++ b/hw/lpc_ich9.c >> @@ -472,7 +472,7 @@ static int ich9_lpc_initfn(PCIDevice *d) >> lpc->isa_bus = isa_bus; >> >> ich9_cc_init(lpc); >> -apm_init(&lpc->apm, ich9_apm_ctrl_changed, lpc); >> +apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, lpc); >> return 0; >> } >> >> Julien/Jason, can you please verify that this is the correct device to pass? >> > > Looks correct to me. It's ok for me. Thanks, Julien
[Qemu-devel] read memory by virtual address?
Dear AllI can read memory by a physical address "cpu_physical_memory_map()", but how can i read it by linear address or virtual address? Thanksfrom Peter
[Qemu-devel] [PATCH 3/5] target-i386: postpone cpuid_level update to realize time
From: Igor Mammedov delay capping cpuid_level to 7 to realize time so property setters for cpuid_7_0_ebx_features and "level" could be used in any order/time between x86_cpu_initfn() and x86_cpu_realize(). Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 569acac..ee03652 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1380,9 +1380,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) if (kvm_check_features_against_host(x86_cpu_def) && enforce_cpuid) goto error; } -if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level < 7) { -x86_cpu_def->level = 7; -} return 0; error: @@ -2073,6 +2070,11 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp) void x86_cpu_realize(Object *obj, Error **errp) { X86CPU *cpu = X86_CPU(obj); +CPUX86State *env = &cpu->env; + +if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) { +env->cpuid_level = 7; +} #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); -- 1.7.11.7
[Qemu-devel] [PATCH 2/5] target-i386: use define for cpuid vendor string size
From: Igor Mammedov 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 89fd700..569acac 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1106,13 +1106,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; } @@ -1123,7 +1123,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 90ef1ff..386c4f6 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -510,6 +510,8 @@ #define CPUID_7_0_EBX_ADX (1 << 19) #define CPUID_7_0_EBX_SMAP (1 << 20) +#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.7
[Qemu-devel] [PATCH 4/5] add visitor for parsing hz[KMG] input string
From: Igor Mammedov Signed-off-by: Igor Mammedov Acked-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..74fe395 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 = 0; + +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.7
[Qemu-devel] [PATCH 1/5] target-i386: cpu: separate feature string parsing from CPU model lookup
Instead of using parsing the whole cpu_model string inside cpu_x86_find_by_name(), first split it into the CPU model name and the full feature string, then parse the feature string into pieces. When using CPU model classes, those two pieces of information will be used at different moments (CPU model name will be used to find CPU class, feature string will be used after CPU object was created), so making the split in two steps will make it easier to refactor the code later. This should also help on the CPU properties work, that will just need to replace the cpu_x86_parse_featurestr() logic (and can keep the CPU model lookup code as-is). Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 64 ++- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index c6c2ca0..89fd700 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1208,13 +1208,31 @@ 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(x86_def_t *x86_cpu_def, const char *name) { -unsigned int i; x86_def_t *def; -char *s = g_strdup(cpu_model); -char *featurestr, *name = strtok(s, ","); +for (def = x86_defs; def; def = def->next) +if (name && !strcmp(name, def->name)) +break; +if (kvm_enabled() && name && strcmp(name, "host") == 0) { +kvm_cpu_fill_host(x86_cpu_def); +} else if (!def) { +goto error; +} else { +memcpy(x86_cpu_def, def, sizeof(*def)); +} +return 0; +error: +return -1; +} + +/* Parse "+feature,-feature,feature=foo" CPU feature string + */ +static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) +{ +unsigned int i; +char *featurestr; /* Single 'key=value" string being parsed */ /* Features to be added*/ uint32_t plus_features = 0, plus_ext_features = 0; uint32_t plus_ext2_features = 0, plus_ext3_features = 0; @@ -1227,22 +1245,11 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) uint32_t minus_7_0_ebx_features = 0; uint32_t numvalue; -for (def = x86_defs; def; def = def->next) -if (name && !strcmp(name, def->name)) -break; -if (kvm_enabled() && name && strcmp(name, "host") == 0) { -kvm_cpu_fill_host(x86_cpu_def); -} else if (!def) { -goto error; -} else { -memcpy(x86_cpu_def, def, sizeof(*def)); -} - add_flagname_to_bitmaps("hypervisor", &plus_features, &plus_ext_features, &plus_ext2_features, &plus_ext3_features, &plus_kvm_features, &plus_svm_features, &plus_7_0_ebx_features); -featurestr = strtok(NULL, ","); +featurestr = features ? strtok(features, ",") : NULL; while (featurestr) { char *val; @@ -1376,11 +1383,9 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level < 7) { x86_cpu_def->level = 7; } -g_free(s); return 0; error: -g_free(s); return -1; } @@ -1490,11 +1495,25 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) CPUX86State *env = &cpu->env; x86_def_t def1, *def = &def1; Error *error = NULL; +char *name, *features; +gchar **model_pieces; memset(def, 0, sizeof(*def)); -if (cpu_x86_find_by_name(def, cpu_model) < 0) -return -1; +model_pieces = g_strsplit(cpu_model, ",", 2); +if (!model_pieces[0]) { +goto error; +} +name = model_pieces[0]; +features = model_pieces[1]; + +if (cpu_x86_find_by_name(def, name) < 0) { +goto error; +} + +if (cpu_x86_parse_featurestr(def, features) < 0) { +goto error; +} if (def->vendor1) { env->cpuid_vendor1 = def->vendor1; env->cpuid_vendor2 = def->vendor2; @@ -1553,7 +1572,12 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) error_free(error); return -1; } + +g_strfreev(model_pieces); return 0; +error: +g_strfreev(model_pieces); +return -1; } #if !defined(CONFIG_USER_ONLY) -- 1.7.11.7
[Qemu-devel] [PATCH 0/5] x86 CPU init cleanup, short version
Hi, This is a much shorter version of x86 CPU cleanup series[1] I sent earlier, including only what's really essential. I hope it will be easier to review and include, while Igor and I work on the CPU properties/subclasses code using this as base. [1] The one sent as: Subject: [Qemu-devel] [PATCH 00/17] target-i386: CPU init cleanup for CPU classes/properties Eduardo Habkost (1): target-i386: cpu: separate feature string parsing from CPU model lookup Igor Mammedov (4): target-i386: use define for cpuid vendor string size target-i386: postpone cpuid_level update to realize time add visitor for parsing hz[KMG] input string target-i386: use visit_type_hz to parse tsc_freq property value qapi/qapi-visit-core.c | 11 +++ qapi/qapi-visit-core.h | 2 ++ qapi/string-input-visitor.c | 22 + target-i386/cpu.c | 80 ++--- target-i386/cpu.h | 2 ++ 5 files changed, 90 insertions(+), 27 deletions(-) -- 1.7.11.7
[Qemu-devel] [PATCH 5/5] target-i386: use visit_type_hz to parse tsc_freq property value
From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Andreas Färber --- 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 ee03652..def801a 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1195,7 +1195,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, const int64_t max = INT64_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.7
Re: [Qemu-devel] [PATCH RFT 1/5] usb/ehci: Clean up SysBus and PCI EHCI split
On 12/02/2012 06:57 AM, Andreas Färber wrote: SysBus EHCI was introduced in a hurry before 1.3 Soft Freeze. To use QOM casts in place of DO_UPCAST() / FROM_SYSBUS(), we need an identifying type. Introduce generic abstract base types for PCI and SysBus EHCI to allow multiple types to access the shared fields. The VMSTATE_PCI_DEVICE() macro does not play nice with the QOM parent_obj naming convention, so defer that cleanup. Signed-off-by: Andreas Färber Cc: Peter Crosthwaite --- hw/usb/hcd-ehci-pci.c| 37 - hw/usb/hcd-ehci-sysbus.c | 20 2 Dateien geändert, 44 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-) diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c index 41dbb53..bb1a197 100644 --- a/hw/usb/hcd-ehci-pci.c +++ b/hw/usb/hcd-ehci-pci.c @@ -19,8 +19,12 @@ #include "hw/pci.h" #include "range.h" +#define TYPE_PCI_EHCI "pci-ehci-usb" +#define PCI_EHCI(obj) OBJECT_CHECK(EHCIPCIState, (obj), TYPE_PCI_EHCI) + typedef struct EHCIPCIState { PCIDevice pcidev; + EHCIState ehci; } EHCIPCIState; @@ -33,7 +37,7 @@ typedef struct EHCIPCIInfo { static int usb_ehci_pci_initfn(PCIDevice *dev) { -EHCIPCIState *i = DO_UPCAST(EHCIPCIState, pcidev, dev); +EHCIPCIState *i = PCI_EHCI(dev); EHCIState *s = &i->ehci; uint8_t *pci_conf = dev->config; @@ -83,7 +87,7 @@ static int usb_ehci_pci_initfn(PCIDevice *dev) static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int l) { -EHCIPCIState *i = DO_UPCAST(EHCIPCIState, pcidev, dev); +EHCIPCIState *i = PCI_EHCI(dev); bool busmaster; pci_default_write_config(dev, addr, val, l); @@ -115,12 +119,8 @@ static void ehci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); -EHCIPCIInfo *i = data; k->init = usb_ehci_pci_initfn; -k->vendor_id = i->vendor_id; -k->device_id = i->device_id; -k->revision = i->revision; k->class_id = PCI_CLASS_SERIAL_USB; k->config_write = usb_ehci_pci_write_config; k->no_hotplug = 1; @@ -128,6 +128,24 @@ static void ehci_class_init(ObjectClass *klass, void *data) dc->props = ehci_pci_properties; } +static const TypeInfo ehci_pci_type_info = { +.name = TYPE_PCI_EHCI, +.parent = TYPE_PCI_DEVICE, +.instance_size = sizeof(EHCIPCIState), +.abstract = true, +.class_init = ehci_class_init, +}; + +static void ehci_data_class_init(ObjectClass *klass, void *data) +{ +PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); +EHCIPCIInfo *i = data; + +k->vendor_id = i->vendor_id; +k->device_id = i->device_id; +k->revision = i->revision; +} + static struct EHCIPCIInfo ehci_pci_info[] = { { .name = "usb-ehci", @@ -150,12 +168,13 @@ static struct EHCIPCIInfo ehci_pci_info[] = { static void ehci_pci_register_types(void) { TypeInfo ehci_type_info = { -.parent= TYPE_PCI_DEVICE, -.instance_size = sizeof(EHCIPCIState), -.class_init= ehci_class_init, +.parent= TYPE_PCI_EHCI, +.class_init= ehci_data_class_init, }; int i; +type_register_static(&ehci_pci_type_info); + for (i = 0; i < ARRAY_SIZE(ehci_pci_info); i++) { ehci_type_info.name = ehci_pci_info[i].name; ehci_type_info.class_data = ehci_pci_info + i; diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 803df92..c7b68b2 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -18,8 +18,13 @@ #include "hw/usb/hcd-ehci.h" #include "hw/sysbus.h" +#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb" +#define SYS_BUS_EHCI(obj) \ +OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI) + typedef struct EHCISysBusState { -SysBusDevice busdev; +SysBusDevice parent_obj; + EHCIState ehci; } EHCISysBusState; @@ -40,7 +45,7 @@ static Property ehci_sysbus_properties[] = { static int usb_ehci_sysbus_initfn(SysBusDevice *dev) { -EHCISysBusState *i = FROM_SYSBUS(EHCISysBusState, dev); +EHCISysBusState *i = SYS_BUS_EHCI(dev); EHCIState *s = &i->ehci; s->capsbase = 0x100; @@ -63,15 +68,22 @@ static void ehci_sysbus_class_init(ObjectClass *klass, void *data) dc->props = ehci_sysbus_properties; } -TypeInfo ehci_xlnx_type_info = { -.name = "xlnx,ps7-usb", +static const TypeInfo ehci_type_info = { +.name = TYPE_SYS_BUS_EHCI, .parent= TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(EHCISysBusState), +.abstract = true, .class_init= ehci_sysbus_class_init, }; +static const TypeInfo ehci_xlnx_type_info = { +.name = "xlnx,ps7-usb", +.parent= TYPE_SYS_BUS_EHCI, +}; + static void ehci_sysbus_register_types(void) { +type_register_static(&ehci_type_info);
Re: [Qemu-devel] [PATCH RFT 2/5] usb/ehci: Move capsbase and opregbase into SysBus EHCI class
On 12/02/2012 06:57 AM, Andreas Färber wrote: This allows specific derived models to use different values. Signed-off-by: Andreas Färber --- hw/usb/hcd-ehci-sysbus.c | 26 -- 1 Datei geändert, 24 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index c7b68b2..38e82bb 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -21,6 +21,17 @@ #define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb" #define SYS_BUS_EHCI(obj) \ OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI) +#define SYS_BUS_EHCI_CLASS(class) \ +OBJECT_CLASS_CHECK(SysBusEHCIClass, (class), TYPE_SYS_BUS_EHCI) +#define SYS_BUS_EHCI_GET_CLASS(obj) \ +OBJECT_GET_CLASS(SysBusEHCIClass, (obj), TYPE_SYS_BUS_EHCI) + +typedef struct SysBusEHCIClass { +SysBusDeviceClass parent_class; + +uint16_t capsbase; +uint16_t opregbase; +} SysBusEHCIClass; typedef struct EHCISysBusState { SysBusDevice parent_obj; @@ -46,10 +57,11 @@ static Property ehci_sysbus_properties[] = { static int usb_ehci_sysbus_initfn(SysBusDevice *dev) { EHCISysBusState *i = SYS_BUS_EHCI(dev); +SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(dev); EHCIState *s = &i->ehci; -s->capsbase = 0x100; -s->opregbase = 0x140; +s->capsbase = sec->capsbase; +s->opregbase = sec->opregbase; s->dma = &dma_context_memory; usb_ehci_initfn(s, DEVICE(dev)); @@ -74,11 +86,21 @@ static const TypeInfo ehci_type_info = { .instance_size = sizeof(EHCISysBusState), .abstract = true, .class_init= ehci_sysbus_class_init, +.class_size= sizeof(SysBusEHCIClass), }; +static void ehci_xlnx_class_init(ObjectClass *oc, void *data) +{ +SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); + +sec->capsbase = 0x100; +sec->opregbase = 0x140; +} + static const TypeInfo ehci_xlnx_type_info = { .name = "xlnx,ps7-usb", .parent= TYPE_SYS_BUS_EHCI, +.class_init= ehci_xlnx_class_init, }; static void ehci_sysbus_register_types(void) Reviewed-by: Igor Mitsyanko -- Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: i.mitsya...@samsung.com
Re: [Qemu-devel] [PULL for-1.3 0/3] seabios: q35 update
On Mon, Dec 03, 2012 at 11:11:55AM +0100, Gerd Hoffmann wrote: > Hi, > > Most q35 seabios patches just landed upstream. So here we go with a > last-minute pull to plumb the missing q35 bits. It obviously updates > seabios again. It also adds autoloading for the acpi dsdt table. > > With this pull "qemu -M q35" JustWorks[tm]. > > please pull, > Gerd > Hi, Feel free to add my Acked-by: Jason Baron to the series. I've just been looking at WindowsXP support and there are a few issues that need to be resolved to make it work with the current q35 code. 1) legacy ide mode I can currently create a ide controller on the command-line using '-device'. However, on the real h/w there is an IDE compatibility mode which essentially advertises an ide controller at the same location that the ahci lives at. In fact, it changes the PCI device id. To deal with the fact that AHCI has 6 ports and thus 6 possible devices, it then adds a second controller for the remaining 2 disks. This shouldn't be too hard to emulate. But I'm wondering what we want the qemu interface to look like? A -machine options such as: '-machine q35,diskmode=ahci,ide,raid'? 2) HPET ACPI error This line: 'IRQNoFlags () {2, 8}' in the HPET acpi table is causing the folloing ACPI message (removing it makes it go away): " A problem has been detected and windows has been shut down to prevent damage to your computer. If this is the first time you've seen this Stop error screen, restart your computer. If this screen appears again, follow these steps: Check To be sure you have adequate disk space. If a driver is identified in The stop message, disable the driver or check with the manufacturer for driver updates. Try changing video adapters. Check with your hardware vendor for any BIOS updates. Disable BIOS memory options such as caching or shadowing. If you need to use safe mode to remove or disable components, restart your computer, press F8 To select Advanced startup opTions, and then select safe mode. Technical information: *** STOP: Ox007E (OxC005,OxFADF8FCEDA83,OxFADF90631540,O xFADF90630F50) ***acpi.sys - Address FADF8FCEDA83 base at FADF8FCDA000, DateStamp 42435eae " 3) irq table The irq table commit that makes windows 7 work, upsets Windows XP. If I back out seabios commit: 2114f50148c42e374586359d23b522483ca10e8d I do not get the following error: " A problem has been detected and windows has been shut down To prevent damage to your computer. If this is The first time you've seen this stop error screen, restart your computer. If this screen appears again, follow these steps: The BIOS in this sysTem is not fully ACPI compliant. Please contact your system vendor for an updated BIOS. If you are unable to obtain an updated BIOS or the latest BIOS supplied by your vendor is not ACPI compliant, you can turn off ACPI mode during textmode setup. To do this, press The F7 key when you are prompted To install storage drivers. The system will not notify you that the F7 key was pressed - it will silently disable ACPI and allow you to continue your installation. Technical informaTion: *** STOP: 0x00A5 (Ox00010006,OxFADF9C461108,0x,0 x) " Thanks, -Jason
Re: [Qemu-devel] [PATCH RFT 3/5] usb/ehci: Add SysBus EHCI device for Exynos4210
On 12/02/2012 06:57 AM, Andreas Färber wrote: It uses a different capsbase and opregbase than the Xilinx device. Signed-off-by: Liming Wang Signed-off-by: Andreas Färber Cc: Igor Mitsyanko --- hw/usb/hcd-ehci-sysbus.c | 15 +++ hw/usb/hcd-ehci.h|2 ++ 2 Dateien geändert, 17 Zeilen hinzugefügt(+) diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 38e82bb..2ac61e6 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -103,10 +103,25 @@ static const TypeInfo ehci_xlnx_type_info = { .class_init= ehci_xlnx_class_init, }; +static void ehci_exynos4210_class_init(ObjectClass *oc, void *data) +{ +SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); + +sec->capsbase = 0x0; +sec->opregbase = 0x40; +} Hi, Liming, where did you get value 0x40 for opregbase? My documentation states that its 0x10 for Exynos4210 soc. + +static const TypeInfo ehci_exynos4210_type_info = { +.name = TYPE_EXYNOS4210_EHCI, +.parent= TYPE_SYS_BUS_EHCI, +.class_init= ehci_exynos4210_class_init, +}; + static void ehci_sysbus_register_types(void) { type_register_static(&ehci_type_info); type_register_static(&ehci_xlnx_type_info); +type_register_static(&ehci_exynos4210_type_info); } type_init(ehci_sysbus_register_types) diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index d8078f4..b8b6461 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -314,6 +314,8 @@ struct EHCIState { bool int_req_by_async; }; +#define TYPE_EXYNOS4210_EHCI "exynos4210-usb" + Maybe use a more descriptive name "exynos4210-usb-ehci" here, for consistency with hcd-ehci-pci.c. But anyway, I tested it, it works fine) Reviewed-by: Igor Mitsyanko extern const VMStateDescription vmstate_ehci; void usb_ehci_initfn(EHCIState *s, DeviceState *dev); -- Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: i.mitsya...@samsung.com
Re: [Qemu-devel] [PATCH RFT 4/5] exynos4210: Add EHCI support
On 12/02/2012 06:57 AM, Andreas Färber wrote: From: Liming Wang Add EHCI USB host controller to exynos4210. Signed-off-by: Liming Wang [AF: Use type constant] Signed-off-by: Andreas Färber --- hw/exynos4210.c |7 +++ hw/exynos4210_gic.c |2 +- 2 Dateien geändert, 8 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/hw/exynos4210.c b/hw/exynos4210.c index 00d4db8..35d4936 100644 --- a/hw/exynos4210.c +++ b/hw/exynos4210.c @@ -27,6 +27,7 @@ #include "arm-misc.h" #include "loader.h" #include "exynos4210.h" +#include "usb/hcd-ehci.h" #define EXYNOS4210_CHIPID_ADDR 0x1000 @@ -72,6 +73,9 @@ /* Display controllers (FIMD) */ #define EXYNOS4210_FIMD0_BASE_ADDR 0x11C0 +/* EHCI */ +#define EXYNOS4210_EHCI_BASE_ADDR 0x1258 + static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, 0x09, 0x00, 0x00, 0x00 }; @@ -334,5 +338,8 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, s->irq_table[exynos4210_get_irq(11, 2)], NULL); +sysbus_create_simple(TYPE_EXYNOS4210_EHCI, EXYNOS4210_EHCI_BASE_ADDR, +s->irq_table[exynos4210_get_irq(28, 3)]); + return s; } diff --git a/hw/exynos4210_gic.c b/hw/exynos4210_gic.c index 4fea098..959de56 100644 --- a/hw/exynos4210_gic.c +++ b/hw/exynos4210_gic.c @@ -140,7 +140,7 @@ combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { EXT_GIC_ID_I2C4, EXT_GIC_ID_I2C5, EXT_GIC_ID_I2C6, EXT_GIC_ID_I2C7 }, /* int combiner group 28 */ -{ EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 }, +{ EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 , EXT_GIC_ID_USB_HOST}, /* int combiner group 29 */ { EXT_GIC_ID_HSMMC0, EXT_GIC_ID_HSMMC1, EXT_GIC_ID_HSMMC2, EXT_GIC_ID_HSMMC3, EXT_GIC_ID_SDMMC }, Reviewed-by: Igor Mitsyanko -- Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: i.mitsya...@samsung.com
Re: [Qemu-devel] read memory by virtual address?
On 12/03/2012 08:53 PM, Peter Cheung wrote: > Dear All > I can read memory by a physical > address "cpu_physical_memory_map()", but how can i read it by linear > address or virtual address? > > Thanks > from Peter Hi, Peter, you can use cpu_memory_rw_debug/cpu_get_phys_page_debug for this. -- Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: i.mitsya...@samsung.com
Re: [Qemu-devel] [PATCH 2/2 v3] Adding BAR0 for e500 PCI controller
On 10.10.2012, at 16:28, 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 complex (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 an 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. > > I can see one more issue, There are ATMUs emulated in hw/ppce500_pci.c, > but i do not see these being used for address translation. > So far that works because pci address space and local address space are 1:1 > mapped. BAR0 inbound translation + ATMU translation will complete the address > translation of inbound traffic. > > Signed-off-by: Bharat Bhushan > --- > v3: > - minor cleanup (variable name corrected from pci_ccsr to ccsr and > spelling in patch description) > > hw/ppc/e500-ccsr.h | 17 +++ > hw/ppc/e500.c | 56 +++ > hw/ppce500_pci.c | 29 ++- > 3 files changed, 92 insertions(+), 10 deletions(-) > create mode 100644 hw/ppc/e500-ccsr.h > > diff --git a/hw/ppc/e500-ccsr.h b/hw/ppc/e500-ccsr.h > new file mode 100644 > index 000..f20f51b > --- /dev/null > +++ b/hw/ppc/e500-ccsr.h > @@ -0,0 +1,17 @@ > +#ifndef E500_CCSR_H > +#define E500_CCSR_H > + > +#include "../sysbus.h" > + > +typedef struct PPCE500CCSRState { > +/*< private >*/ > +SysBusDevice parent; > +/*< public >*/ > + > +MemoryRegion ccsr_space; > +} PPCE500CCSRState; > + > +#define TYPE_CCSR "e500-ccsr" > +#define CCSR(obj) OBJECT_CHECK(PPCE500CCSRState, (obj), TYPE_CCSR) > + > +#endif /* E500_CCSR_H */ > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c > index 187def2..89ee2ef 100644 > --- a/hw/ppc/e500.c > +++ b/hw/ppc/e500.c > @@ -17,6 +17,7 @@ > #include "config.h" > #include "qemu-common.h" > #include "e500.h" > +#include "e500-ccsr.h" > #include "net.h" > #include "hw/hw.h" > #include "hw/pc.h" > @@ -423,8 +424,9 @@ void ppce500_init(PPCE500Params *params) > qemu_irq **irqs, *mpic; > DeviceState *dev; > CPUPPCState *firstenv = NULL; > -MemoryRegion *ccsr; > +MemoryRegion *ccsr_addr_space; > SysBusDevice *s; > +PPCE500CCSRState *ccsr; > > /* Setup CPUs */ > if (params->cpu_model == NULL) { > @@ -481,12 +483,18 @@ void ppce500_init(PPCE500Params *params) > vmstate_register_ram_global(ram); > memory_region_add_subregion(address_space_mem, 0, ram); > > -ccsr = g_malloc0(sizeof(MemoryRegion)); > -memory_region_init(ccsr, "e500-ccsr", MPC8544_CCSRBAR_SIZE); > -memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE, > ccsr); > +ccsr_addr_space = g_malloc0(sizeof(MemoryRegion)); x = a; > +dev = qdev_create(NULL, "e500-ccsr"); > +object_property_add_child(qdev_get_machine(), "e500-ccsr", > + OBJECT(dev), NULL); > +qdev_init_nofail(dev); > +ccsr = CCSR(dev); > +ccsr_addr_space = &ccsr->ccsr_space; x = b; without any use of x in between? I suppose the first one is simply redundant? The rest looks quite nice from what I can tell. Alex > +memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE, > +ccsr_addr_space); > > /* MPIC */ > -mpic = mpic_init(ccsr, MPC8544_MPIC_REGS_OFFSET, > +mpic = mpic_init(ccsr_addr_space, MPC8544_MPIC_REGS_OFFSET, > smp_cpus, irqs, NULL); > > if (!mpic) { > @@ -495,13 +503,13 @@ void ppce500_init(PPCE500Params *params) > > /* Serial */ > if (serial_hds[0]) { > -serial_mm_init(ccsr, MPC8544_SERIAL0_REGS_OFFSET, > +serial_mm_init(c
[Qemu-devel] [PATCH][RESEND] iscsi: add support for iSCSI NOPs
This patch will send NOP-Out PDUs every 5 seconds to the iSCSI target. If a consecutive number of NOP-In replies fail a reconnect is initiated. iSCSI NOPs help to ensure that the connection to the target is still operational. This should not, but in reality may be the case even if the TCP connection is still alive if there are bugs in either the target or the initiator implementation. Reported-by: Ronnie Sahlberg Signed-off-by: Peter Lieven --- block/iscsi.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index d0b1a10..fab4c8b 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -47,6 +47,9 @@ typedef struct IscsiLun { int block_size; uint64_t num_blocks; int events; + +QEMUTimer *nop_timer; +int nops_in_flight; } IscsiLun; typedef struct IscsiAIOCB { @@ -72,6 +75,9 @@ struct IscsiTask { int complete; }; +#define NOP_INTERVAL 5000 +#define MAX_NOP_FAILURES 3 + static void iscsi_bh_cb(void *p) { @@ -925,6 +931,35 @@ static char *parse_initiator_name(const char *target) } } +static void iscsi_nop_cb(struct iscsi_context *iscsi, int status, void *command_data, void *private_data) +{ +IscsiLun *iscsilun = private_data; + +if (iscsilun) { +iscsilun->nops_in_flight = 0; +} +} + +static void iscsi_nop_timed_event(void *opaque) +{ +IscsiLun *iscsilun = opaque; + +if (iscsilun->nops_in_flight > MAX_NOP_FAILURES) { +error_report("iSCSI: NOP timeout. Reconnecting..."); +iscsi_reconnect(iscsilun->iscsi); +iscsilun->nops_in_flight = 0; +} + +if (iscsi_nop_out_async(iscsilun->iscsi, iscsi_nop_cb, NULL, 0, iscsilun) != 0) { +error_report("iSCSI: failed to sent NOP-Out. Disabling NOP messages."); +return; +} + +qemu_mod_timer(iscsilun->nop_timer, qemu_get_clock_ms(rt_clock) + NOP_INTERVAL); +iscsi_set_events(iscsilun); +iscsilun->nops_in_flight++; +} + /* * We support iscsi url's on the form * iscsi://[%@][:]// @@ -1036,6 +1071,10 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags) ret = 0; +/* Set up a timer for sending out iSCSI NOPs */ +iscsilun->nop_timer = qemu_new_timer_ms(rt_clock, iscsi_nop_timed_event, iscsilun); +qemu_mod_timer(iscsilun->nop_timer, qemu_get_clock_ms(rt_clock) + NOP_INTERVAL); + out: if (initiator_name != NULL) { g_free(initiator_name); @@ -1058,6 +1097,10 @@ static void iscsi_close(BlockDriverState *bs) IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; +if (iscsilun->nop_timer) { +qemu_del_timer(iscsilun->nop_timer); +qemu_free_timer(iscsilun->nop_timer); +} qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), NULL, NULL, NULL, NULL); iscsi_destroy_context(iscsi); memset(iscsilun, 0, sizeof(IscsiLun)); -- 1.7.9.5
Re: [Qemu-devel] [Qemu-stable] [PATCH 1.3] make_device_config.sh: Fix target path in generated dependency file
On Sat, Oct 27, 2012 at 12:32:28PM +0400, Michael Tokarev wrote: > Ping? Ping. Fix still applicable for 1.3, also looking to pull it in for 1.2.2. > > /mjt > > On 18.09.2012 18:32, Andreas Färber wrote: > > Am 18.09.2012 14:29, schrieb Michael Tokarev: > >> Has it been applied to anything? I don't think so. > >> Is it still needed? > > > > Not in qemu.git yet, still applicable AFAICT. CC'ing Paolo. > > > > /-F > > > >> > >> Thanks, > >> > >> /mjt > >> > >> On 07.06.2012 20:23, Andreas Färber wrote: > >>> config-devices.mak.d is included from Makefile.target, i.e. from inside > >>> the *-softmmu/ directory. It included the directory path, so never > >>> applied to the actual config-devices.mak. Symptoms were spurious > >>> dependency issues with default-configs/pci.mak. > >>> > >>> Fix by using `basename` to strip the directory path. > >>> > >>> Reported-by: Gerhard Wiesinger > >>> Signed-off-by: Andreas Färber > >>> --- > >>> Seems I forgot to send this out before 1.1... > >>> > >>> scripts/make_device_config.sh |2 +- > >>> 1 files changed, 1 insertions(+), 1 deletions(-) > >>> > >>> diff --git a/scripts/make_device_config.sh b/scripts/make_device_config.sh > >>> index 5d14885..0778fe2 100644 > >>> --- a/scripts/make_device_config.sh > >>> +++ b/scripts/make_device_config.sh > >>> @@ -25,4 +25,4 @@ done > >>> process_includes $src > $dest > >>> > >>> cat $src $all_includes | grep -v '^include' > $dest > >>> -echo "$1: $all_includes" > $dep > >>> +echo "`basename $1`: $all_includes" > $dep > >> > > > > > >
[Qemu-devel] [PATCH] iscsi: add support for iovectors
This patch adds support for directly passing the iovec array from QEMUIOVector if libiscsi supports it. Signed-off-by: Peter Lieven --- block/iscsi.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index c0b70b3..6f3ee4a 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -55,7 +55,9 @@ typedef struct IscsiAIOCB { QEMUBH *bh; IscsiLun *iscsilun; struct scsi_task *task; +#if !defined(LIBISCSI_FEATURE_IOVECTOR) uint8_t *buf; +#endif int status; int canceled; size_t read_size; @@ -192,7 +194,9 @@ iscsi_aio_write16_cb(struct iscsi_context *iscsi, int status, trace_iscsi_aio_write16_cb(iscsi, status, acb, acb->canceled); +#if !defined(LIBISCSI_FEATURE_IOVECTOR) g_free(acb->buf); +#endif if (acb->canceled != 0) { return; @@ -225,7 +229,9 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num, size_t size; uint32_t num_sectors; uint64_t lba; +#if !defined(LIBISCSI_FEATURE_IOVECTOR) struct iscsi_data data; +#endif acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque); trace_iscsi_aio_writev(iscsi, sector_num, nb_sectors, opaque, acb); @@ -240,8 +246,11 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num, /* XXX we should pass the iovec to write16 to avoid the extra copy */ /* this will allow us to get rid of 'buf' completely */ size = nb_sectors * BDRV_SECTOR_SIZE; + +#if !defined(LIBISCSI_FEATURE_IOVECTOR) acb->buf = g_malloc(size); qemu_iovec_to_buf(acb->qiov, 0, acb->buf, size); +#endif acb->task = malloc(sizeof(struct scsi_task)); if (acb->task == NULL) { @@ -262,6 +271,17 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num, *(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors); acb->task->expxferlen = size; +#if defined(LIBISCSI_FEATURE_IOVECTOR) +if (iscsi_scsi_command_async(iscsi, iscsilun->lun, acb->task, + iscsi_aio_write16_cb, + NULL, + acb) != 0) { +scsi_free_scsi_task(acb->task); +qemu_aio_release(acb); +return NULL; +} +scsi_task_set_iov_out(acb->task, (struct scsi_iovec*) acb->qiov->iov, acb->qiov->niov); +#else data.data = acb->buf; data.size = size; @@ -274,6 +294,7 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num, qemu_aio_release(acb); return NULL; } +#endif iscsi_set_events(iscsilun); @@ -312,7 +333,9 @@ iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num, struct iscsi_context *iscsi = iscsilun->iscsi; IscsiAIOCB *acb; size_t qemu_read_size; +#if !defined(LIBISCSI_FEATURE_IOVECTOR) int i; +#endif uint64_t lba; uint32_t num_sectors; @@ -328,7 +351,9 @@ iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num, acb->bh = NULL; acb->status = -EINPROGRESS; acb->read_size = qemu_read_size; +#if !defined(LIBISCSI_FEATURE_IOVECTOR) acb->buf = NULL; +#endif /* If LUN blocksize is bigger than BDRV_BLOCK_SIZE a read from QEMU * may be misaligned to the LUN, so we may need to read some extra @@ -383,11 +408,15 @@ iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num, return NULL; } +#if defined(LIBISCSI_FEATURE_IOVECTOR) +scsi_task_set_iov_in(acb->task, (struct scsi_iovec*) acb->qiov->iov, acb->qiov->niov); +#else for (i = 0; i < acb->qiov->niov; i++) { scsi_task_add_data_in_buffer(acb->task, acb->qiov->iov[i].iov_len, acb->qiov->iov[i].iov_base); } +#endif iscsi_set_events(iscsilun); @@ -557,7 +586,9 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->canceled= 0; acb->bh = NULL; acb->status = -EINPROGRESS; +#if !defined(LIBISCSI_FEATURE_IOVECTOR) acb->buf = NULL; +#endif acb->ioh = buf; acb->task = malloc(sizeof(struct scsi_task)); -- 1.7.9.5
[Qemu-devel] [PATCH 5/?] hw/ds1338.c: Fix handling of DATE (wday) register
Per the datasheet, the DATE (wday) register is user defined. Implement this. Signed-off-by: Antoine Mathys --- hw/ds1338.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/ds1338.c b/hw/ds1338.c index 8f85635..c502934 100644 --- a/hw/ds1338.c +++ b/hw/ds1338.c @@ -20,6 +20,7 @@ typedef struct { I2CSlave i2c; int64_t offset; +uint8_t wday_offset; uint8_t nvram[NVRAM_SIZE]; int32_t ptr; bool addr_byte; @@ -33,6 +34,7 @@ static const VMStateDescription vmstate_ds1338 = { .fields = (VMStateField[]) { VMSTATE_I2C_SLAVE(i2c, DS1338State), VMSTATE_INT64(offset, DS1338State), +VMSTATE_UINT8(wday_offset, DS1338State), VMSTATE_UINT8_ARRAY(nvram, DS1338State, NVRAM_SIZE), VMSTATE_INT32(ptr, DS1338State), VMSTATE_BOOL(addr_byte, DS1338State), @@ -62,7 +64,7 @@ static void write_time(DS1338State *s, const struct tm *tm) } else { s->nvram[2] = to_bcd(tm->tm_hour); } -s->nvram[3] = to_bcd(tm->tm_wday + 1); +s->nvram[3] = to_bcd((tm->tm_wday + s->wday_offset) % 7 + 1); s->nvram[4] = to_bcd(tm->tm_mday); s->nvram[5] = to_bcd(tm->tm_mon + 1); s->nvram[6] = to_bcd(tm->tm_year - 100); @@ -164,7 +166,12 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data) } break; case 3: -now.tm_wday = from_bcd(data & 0x07) - 1; +{ +int user_wday = from_bcd(data & 0x07) - 1; +if ((user_wday >= 0) && (user_wday <= 6)) { +s->wday_offset = (user_wday - now.tm_wday + 7) % 7; +} +} break; case 4: now.tm_mday = from_bcd(data & 0x3f); @@ -194,6 +201,9 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data) static int ds1338_init(I2CSlave *i2c) { +DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c); +s->wday_offset = 0; + return 0; } -- 1.7.10.4
Re: [Qemu-devel] [RFC 05/10] qdev: move reset handler list from vl.c to hw/reset.c
On Fri, 30 Nov 2012 17:27:17 -0200 Eduardo Habkost wrote: > The core qdev code uses the reset handler list from vl.c, and > currently *-user has some hacks to make CPU reset work. > > This moves qemu_register_reset(), qemu_unregister_reset() and > qemu_devices_reset() to a new file, hw/reset.c, that can be used by qdev > and by *-user. > > Signed-off-by: Eduardo Habkost > --- > hw/Makefile.objs | 1 + > hw/ac97.c| 1 + > hw/acpi_ich9.c | 1 + patch doesn't apply to the current tree. -- Regards, Igor
[Qemu-devel] [ANNOUNCE] QEMU 1.3.0 release
Hi, On behalf of the QEMU Team, I'd like to announce the availability of the QEMU 1.3 release! http://wiki.qemu.org/download/qemu-1.3.0.tar.bz2 This release contains over 1700 changesets from 118 unique authors. See the ChangeLog on the wiki for a full changelog: http://wiki.qemu.org/ChangeLog/1.3 Major features include: - After nearly 6 years of work, all remaining differences between the qemu-kvm.git and qemu.git have been merged into qemu.git - QEMU can now use the Linux VFIO driver to assign PCI devices to a virtual machine. - USB3 has been vastly improved, including support for USB mass storage devices and MSI/MSI-X support for the XHCI controller. - New paravirtualized hardware random number generator device. - Glusterfs volumes can be accessed with "gluster://" URIs for "-drive" and similar options. Optionally the transport can also be specified, as in "gluster+tcp://" (other supported transports are "unix" and "rdma"). - A new block job is supported: live block commit (also known as "snapshot deletion") moves data from an image to another in the backing file chain. - A new block job is supported: live disk mirroring (also known as "storage migration") moves data from an image to another. - The sendkey monitor command is now available via QMP. - MIP Loongson Multimedia Instructions are now implemented. - MIPS32/64 ASE DSP Instructions are now implemented. - x86: the TSC frequency can be larger than 2.147 GHz. - TCG (emulation) supports the SMEP (Supervisor Mode Execution Prevention) and SMAP (Supervisor Mode Access Prevention) features of newer x86 processors. - New CPU models: "Haswell" and "Opteron_G5" - xtensa: Single precision floating point instructions are now implemented. - Emulation of the MC146818 real-time clock (used on PC and several other boards) does not wake up QEMU anymore every second to update the clock. - USB redirection now supports live migration. - Several bugs in the AHCI controller were fixed to support recent Windows versions. - qemu-img now can output information in JSON format using "qemu-img info --output=json". - NBD block devices can now be specified using URI syntax. "nbd://" defaults to TCP transport, while "nbd+tcp://" and "nbd+unix://" can be used (similar to Gluster) to specify it. - QEMU embeds an NBD server, accessible via the monitor. - Windows hosts support asynchronous disk I/O. - The monitor now remains responsive during incoming migration. The new NBD server is also available during incoming migration. - spice: QEMU will only send changed screen content to the Spice client when running in legacy VGA mode. - Improved support for sandboxing using seccomp mode 2 with libvirt I'd like to thank everyone who contributed to this release by submitting patches, testing out -rcs, or reporting bugs during the release process! Regards, Anthony Liguori
[Qemu-devel] [ANNOUNCE] 1.4 development tree is now open
Happy hacking! Regards, Anthony Liguori
Re: [Qemu-devel] [Bug 955379] Re: cmake hangs with qemu-arm-static
On 01.12.2012, at 12:27, Peter Maydell wrote: > On 1 December 2012 10:29, Janne Karhunen <955...@bugs.launchpad.net> wrote: >>> this blocks forever, because the thing that would wake it up is the >> signal handler writing to the pipe we're selecting on, but we will never >> run the signal handler until select exits >> >> Duh, makes sense, have to think about this. Thank you for great analysis >> :) >> >> Apparently have to dig into qemu's code to understand this better, but >> first thought was that do you think it would be possible to add some >> crude hack bit in qemu's signal handler which we could 'almost >> atomically' check prior to entering system poll/select/read/whatnot ? >> This bit would tell there are user signals queued and handlers should be >> executed first.. ? > > Nope, it's still not going to be non-racy that way (and it would still > be a pretty invasive change so it doesn't really make it easier either > I think). Could you please try and see if this patch makes a difference? http://repo.or.cz/w/qemu/agraf.git/patch/489924aa0115dc6cfcd4e91b0747da4ff8425d1f Alex
Re: [Qemu-devel] [RFC 05/10] qdev: move reset handler list from vl.c to hw/reset.c
On Fri, 30 Nov 2012 17:27:17 -0200 Eduardo Habkost wrote: > The core qdev code uses the reset handler list from vl.c, and > currently *-user has some hacks to make CPU reset work. > > This moves qemu_register_reset(), qemu_unregister_reset() and > qemu_devices_reset() to a new file, hw/reset.c, that can be used by qdev > and by *-user. > > Signed-off-by: Eduardo Habkost > --- [...] > diff --git a/hw/reset.c b/hw/reset.c > new file mode 100644 > index 000..5e34b80 > --- /dev/null > +++ b/hw/reset.c > @@ -0,0 +1,43 @@ > +#include "hw/reset.h" > +#include "qlist.h" missing #include for g_malloc/g_free [...] > diff --git a/xen-all.c b/xen-all.c > index 046cc2a..7d2a79f 100644 > --- a/xen-all.c > +++ b/xen-all.c > @@ -14,6 +14,7 @@ > #include "hw/pc.h" > #include "hw/xen_common.h" > #include "hw/xen_backend.h" > +#include "hw/reset.h" > #include "qmp-commands.h" > > #include "range.h" > -- > 1.7.11.7 > > Since you are going not include reset.o in *-user: although dedicated reset.c is nice to have perhaps you can drop reset.c /it's not very related to this series topic/ altogether to minimize scope of review and limit patch only to reset.h and qemu_register_reset(), qemu_unregister_reset() and qemu_devices_reset() stubs for *-user. -- Regards, Igor
[Qemu-devel] [RFC] 1.4 release schedule
Hi, Based on popular demand, I'd like to continue with a 3-month release cycle for the foreseeable future. One thing I'd like to "fix" though is to avoid major holidays during the -rc cycles. The best cycle I can figure is: Feb 15th May 15th Aug 15th Nov 15th To get us onto this schedule, we'll need to make 1.4 a short release but I still think there's ample time to ge stuff done. I've put up a strawman schedule on the wiki: http://wiki.qemu.org/Planning/1.4 Regards, Anthony Liguori
Re: [Qemu-devel] [RFC] 1.4 release schedule
I think you meant to change the 1.3.0 to 1.4.0 for the milestones on the Wiki. ;-) > -Original Message- > From: qemu-devel-bounces+ericj=mips@nongnu.org [mailto:qemu-devel- > bounces+ericj=mips@nongnu.org] On Behalf Of Anthony Liguori > Sent: Monday, December 03, 2012 1:30 PM > To: qemu-devel@nongnu.org > Subject: [Qemu-devel] [RFC] 1.4 release schedule > > > Hi, > > Based on popular demand, I'd like to continue with a 3-month release > cycle for the foreseeable future. One thing I'd like to "fix" though is > to avoid major holidays during the -rc cycles. > > The best cycle I can figure is: > > Feb 15th > May 15th > Aug 15th > Nov 15th > > To get us onto this schedule, we'll need to make 1.4 a short release but > I still think there's ample time to ge stuff done. > > I've put up a strawman schedule on the wiki: > > http://wiki.qemu.org/Planning/1.4 > > Regards, > > Anthony Liguori >
Re: [Qemu-devel] [RFC] 1.4 release schedule
"Johnson, Eric" writes: > I think you meant to change the 1.3.0 to 1.4.0 for the milestones on > the Wiki. ;-) Indeed, fixed now. Regards, Anthony Liguori > >> -Original Message- >> From: qemu-devel-bounces+ericj=mips@nongnu.org [mailto:qemu-devel- >> bounces+ericj=mips@nongnu.org] On Behalf Of Anthony Liguori >> Sent: Monday, December 03, 2012 1:30 PM >> To: qemu-devel@nongnu.org >> Subject: [Qemu-devel] [RFC] 1.4 release schedule >> >> >> Hi, >> >> Based on popular demand, I'd like to continue with a 3-month release >> cycle for the foreseeable future. One thing I'd like to "fix" though is >> to avoid major holidays during the -rc cycles. >> >> The best cycle I can figure is: >> >> Feb 15th >> May 15th >> Aug 15th >> Nov 15th >> >> To get us onto this schedule, we'll need to make 1.4 a short release but >> I still think there's ample time to ge stuff done. >> >> I've put up a strawman schedule on the wiki: >> >> http://wiki.qemu.org/Planning/1.4 >> >> Regards, >> >> Anthony Liguori >>
Re: [Qemu-devel] [Bug 955379] Re: cmake hangs with qemu-arm-static
On 3 December 2012 21:20, Alexander Graf wrote: > Could you please try and see if this patch makes a difference? > > http://repo.or.cz/w/qemu/agraf.git/patch/489924aa0115dc6cfcd4e91b0747da4ff8425d1f I think the answer will turn out to be "no" (though it's worth testing anyway), because the syscall we're blocking in in this case is select(), which is a syscall which will exit when a signal arrives anyway. That is, I think we're really hitting the race condition of the signal arriving while we're in QEMU's C code, rather than the stuck-in-blocking-syscall of the boehm GC case. -- PMM
[Qemu-devel] Patch Round-up for stable 1.2.2, freeze Wednesday
Hi everyone, The following new patches are queued for QEMU stable v1.2.2: https://github.com/mdroth/qemu/commits/stable-1.2-staging The release is planned for Tuesday, 12-11-2012: http://wiki.qemu.org/Planning/1.2 Please CC qemu-sta...@nongnu.org on any patches you think should be included in the release. The cut-off date is 12-05-2012 for new patches. Testing/feedback is greatly appreciated. Thanks! e1a0ffb e1000: Discard packets that are too long if !SBP and !LPE (Michael Contreras) 178ef3a stream: fix ratelimit_set_speed (Dietmar Maurer) cd00334 usb: fail usbdevice_create() when there is no USB bus (Stefan Hajnoczi) 8c9283c qxl: reload memslots after migration, when qxl is in UNDEFINED mode (Yonit Halperin) bf47da4 virtio-scsi: Fix subtle (guest) endian bug (David Gibson) ea08f3a virtio-scsi: Fix some endian bugs with virtio-scsi (David Gibson) cef2566 iscsi: do not assume device is zero initialized (Peter Lieven) 707f2b6 iscsi: fix deadlock during login (Peter Lieven) 972a2bf iscsi: fix segfault in url parsing (Peter Lieven) ff0 qapi: fix qapi_dealloc_type_size parameter type (Bruce Rogers) 54c6c5a qapi: handle visitor->type_size() in QapiDeallocVisitor (Stefan Hajnoczi) f05a3da qom: fix refcount of non-heap-allocated objects (Paolo Bonzini) 0aad8f1 PPC: Fix missing TRACE exception (Julio Guerra) a99cb0d hmp: do not crash on invalid SCSI hotplug (Paolo Bonzini) 5e19e49 qom: dynamic_cast of NULL is always NULL (Paolo Bonzini) 4fb9656 block: Fix regression for MinGW (assertion caused by short string) (Stefan Weil) 38c6d17 tci: Fix type of tci_read_label (Richard Henderson) 600a9ef qcow2: Fix refcount table size calculation (Kevin Wolf) ea79e15 configure: avoid compiler warning in pipe2 detection (Bruce Rogers) 4a8e490 target-openrisc: remove conflicting definitions from cpu.h (Aurelien Jarno) ede76ed tcg/arm: fix cross-endian qemu_st16 (Aurelien Jarno) ac914c1 tcg/arm: fix TLB access in qemu-ld/st ops (Aurelien Jarno) 357414d target-mips: fix wrong microMIPS opcode encoding (陳韋任 (Wei-Ren Chen)) f6b803d mips/malta: fix CBUS UART interrupt pin (Aurelien Jarno) 879c264 nbd: fixes to read-only handling (Paolo Bonzini) 382a582 m68k: Return semihosting errno values correctly (Meador Inge) 5c0d5ae tools: initialize main loop before block layer (Paolo Bonzini) 3dd59b4 xhci: fix usb name in caps (Gerd Hoffmann) 03e0441 target-sparc64: disable VGA cirrus (Aurelien Jarno) db6e5ab PPC: Bamboo: Fix memory size DT property (Alexander Graf) 7817b8d s390x: fix -initrd in virtio machine (Alexander Graf) 0dfd821 memory: fix rendering of a region obscured by another (Avi Kivity) e16d81d e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty (Dmitry Fleytman) 3dfbc51 target-i386: Allow tsc-frequency to be larger then 2.147G (Don Slutz) eb63b0c hw: Fix return value check for bdrv_read, bdrv_write (Stefan Weil) 4843c92 rtc: fix overflow in mktimegm (Paolo Bonzini) a106eaa qxl: always update displaysurface on resize (Gerd Hoffmann) 472da83 hw/qxl: qxl_dirty_surfaces: use uintptr_t (Alon Levy) 85c91ea uhci: Raise interrupt when requested even for non active tds (Hans de Goede) 5af7caa vnc: fix "info vnc" with "-vnc ..., reverse=on" (Paolo Bonzini) 0ae18b3 ui/vnc: Only report/use TIGHT_PNG encoding if enabled. (Joel Martin) 5a99c8c fix CONFIG_QEMU_HELPERDIR generation again (Michael Tokarev) 029eae1 configure: Fix CONFIG_QEMU_HELPERDIR generation (Jan Kiszka) block.c |3 +- block/iscsi.c | 260 +++ block/qcow2-refcount.c |3 +- configure |5 +- cutils.c|2 +- default-configs/sparc64-softmmu.mak |1 - hw/e1000.c | 17 ++- hw/mips_malta.c |3 +- hw/nand.c | 34 +++-- hw/onenand.c|2 +- hw/pci-hotplug.c|8 +- hw/ppc440_bamboo.c |2 +- hw/qxl-render.c |4 - hw/qxl.c|5 +- hw/s390-virtio.c|4 +- hw/sd.c | 16 ++- hw/usb/bus.c|7 + hw/usb/hcd-uhci.c | 10 +- hw/usb/hcd-xhci.c |4 +- hw/virtio-scsi.c| 12 +- include/qemu/ratelimit.h|2 +- memory.c| 12 +- nbd.c | 25 ++-- qapi/qapi-dealloc-visitor.c |6 + qemu-img.c |3 +- qemu-io.c |3 +- qom/object.c|6 +- target-i386/cpu.c |2 +- target-m68k/m68k-semi.c |2 +- target-mips/translate.c |2 +- target-openrisc/cpu.h | 18 --- target-ppc/translate.c |3 +- tcg/arm/tcg-target.c
[Qemu-devel] [PATCH 02/43] fix CONFIG_QEMU_HELPERDIR generation again
From: Michael Tokarev commit 38f419f35225 fixed a breakage with CONFIG_QEMU_HELPERDIR which has been introduced by 8bf188aa18ef7a8. But while techinically that fix has been correct, all other similar variables are handled differently. Make it consistent, and let scripts/create_config expand and capitalize the variable properly like for all other qemu_*dir variables. Signed-off-by: Michael Tokarev (cherry picked from commit f354b1a1ee7a1c72d51b42808724a2b10eec315f) Conflicts: configure Signed-off-by: Michael Roth --- configure |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index f01eb27..199a89b 100755 --- a/configure +++ b/configure @@ -3191,7 +3191,7 @@ echo "sysconfdir=$sysconfdir" >> $config_host_mak echo "qemu_confdir=$qemu_confdir" >> $config_host_mak echo "qemu_datadir=$qemu_datadir" >> $config_host_mak echo "qemu_docdir=$qemu_docdir" >> $config_host_mak -echo "CONFIG_QEMU_HELPERDIR=\"`eval echo $libexecdir`\"" >> $config_host_mak +echo "qemu_helperdir=$libexecdir" >> $config_host_mak echo "ARCH=$ARCH" >> $config_host_mak if test "$debug_tcg" = "yes" ; then -- 1.7.9.5
[Qemu-devel] [PATCH 03/43] ui/vnc: Only report/use TIGHT_PNG encoding if enabled.
From: Joel Martin If TIGHT_PNG is not enabled by the --enable-vnc-png configure flag then do not report to the client that it is supported. Also, since TIGHT_PNG is the same as the TIGHT encoding but with the filter/copy replaced with PNG data, adding it to the supported encodings list when it is disabled will cause the TIGHT encoding to be used even though the client requested TIGHT_PNG. Signed-off-by: Joel Martin Signed-off-by: Stefan Hajnoczi (cherry picked from commit fe3e7f2dc05225cdd2ba40defcd4e2581bebc5e0) Signed-off-by: Michael Roth --- ui/vnc.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/vnc.c b/ui/vnc.c index 01b2daf..18ec101 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1802,10 +1802,12 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vs->features |= VNC_FEATURE_TIGHT_MASK; vs->vnc_encoding = enc; break; +#ifdef CONFIG_VNC_PNG case VNC_ENCODING_TIGHT_PNG: vs->features |= VNC_FEATURE_TIGHT_PNG_MASK; vs->vnc_encoding = enc; break; +#endif case VNC_ENCODING_ZLIB: vs->features |= VNC_FEATURE_ZLIB_MASK; vs->vnc_encoding = enc; -- 1.7.9.5
[Qemu-devel] [PATCH 01/43] configure: Fix CONFIG_QEMU_HELPERDIR generation
From: Jan Kiszka We need to evaluate $libexecdir in configure, otherwise we literally end up with "${prefix}/libexec" instead of the absolute path as CONFIG_QEMU_HELPERDIR. Signed-off-by: Jan Kiszka Signed-off-by: Aurelien Jarno (cherry picked from commit 38f419f35225decdbaea9fe1fd00218f8924ce84) Conflicts: configure Signed-off-by: Michael Roth --- configure |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index bf1863e..f01eb27 100755 --- a/configure +++ b/configure @@ -3191,7 +3191,7 @@ echo "sysconfdir=$sysconfdir" >> $config_host_mak echo "qemu_confdir=$qemu_confdir" >> $config_host_mak echo "qemu_datadir=$qemu_datadir" >> $config_host_mak echo "qemu_docdir=$qemu_docdir" >> $config_host_mak -echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak +echo "CONFIG_QEMU_HELPERDIR=\"`eval echo $libexecdir`\"" >> $config_host_mak echo "ARCH=$ARCH" >> $config_host_mak if test "$debug_tcg" = "yes" ; then -- 1.7.9.5
[Qemu-devel] [PATCH 04/43] vnc: fix "info vnc" with "-vnc ..., reverse=on"
From: Paolo Bonzini When reverse connection is in use, there is no active VNC server socket. Because of this, getsockopt(-1, ...) is attempted and the following error is emitted: $ socat TCP-LISTEN:5900,reuseaddr TCP-LISTEN:5901,reuseaddr & $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc An undefined error has occurred Because however the host, family, service and auth fields are optional, we can just exit if there is no active server socket. $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc Server: Client: address: 127.0.0.1:5900 x509_dname: none username: none Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi (cherry picked from commit 417b0b88904fe1dd8c41bff8092dfbab0134d9cb) Signed-off-by: Michael Roth --- ui/vnc.c |4 1 file changed, 4 insertions(+) diff --git a/ui/vnc.c b/ui/vnc.c index 18ec101..66ae930 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -372,6 +372,10 @@ VncInfo *qmp_query_vnc(Error **errp) } } +if (vnc_display->lsock == -1) { +return info; +} + if (getsockname(vnc_display->lsock, (struct sockaddr *)&sa, &salen) == -1) { error_set(errp, QERR_UNDEFINED_ERROR); -- 1.7.9.5
[Qemu-devel] [PATCH 16/43] xhci: fix usb name in caps
From: Gerd Hoffmann Used to be "UTB" not "USB". Signed-off-by: Gerd Hoffmann (cherry picked from commit 0ebfb144e8ad3f2da436d630fdcc5aa9ab646341) Signed-off-by: Michael Roth --- hw/usb/hcd-xhci.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 333df59..30cb0d5 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2098,7 +2098,7 @@ static uint32_t xhci_cap_read(XHCIState *xhci, uint32_t reg) ret = 0x02000402; /* USB 2.0 */ break; case 0x24: /* Supported Protocol:04 */ -ret = 0x20425455; /* "USB " */ +ret = 0x20425355; /* "USB " */ break; case 0x28: /* Supported Protocol:08 */ ret = 0x0001 | (USB2_PORTS<<8); @@ -2110,7 +2110,7 @@ static uint32_t xhci_cap_read(XHCIState *xhci, uint32_t reg) ret = 0x0302; /* USB 3.0 */ break; case 0x34: /* Supported Protocol:04 */ -ret = 0x20425455; /* "USB " */ +ret = 0x20425355; /* "USB " */ break; case 0x38: /* Supported Protocol:08 */ ret = 0x | (USB2_PORTS+1) | (USB3_PORTS<<8); -- 1.7.9.5
[Qemu-devel] [PATCH 20/43] mips/malta: fix CBUS UART interrupt pin
From: Aurelien Jarno According to the MIPS Malta Developement Platform User's Manual, the i8259 interrupt controller is supposed to be connected to the hardware IRQ0, and the CBUS UART to the hardware interrupt 2. In QEMU they are both connected to hardware interrupt 0, the CBUS UART interrupt being wrong. This patch fixes that. It should be noted that the irq array in QEMU includes the software interrupts, hence env->irq[2] is the first hardware interrupt. Cc: Ralf Baechle Reviewed-by: Eric Johnson Signed-off-by: Aurelien Jarno (cherry picked from commit 68d001928b151a0c50f367c0bdca645b3d5e9ed3) Signed-off-by: Michael Roth --- hw/mips_malta.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/mips_malta.c b/hw/mips_malta.c index ad23f26..9289a28 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -860,7 +860,8 @@ void mips_malta_init (ram_addr_t ram_size, be = 0; #endif /* FPGA */ -malta_fpga_init(system_memory, FPGA_ADDRESS, env->irq[2], serial_hds[2]); +/* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 */ +malta_fpga_init(system_memory, FPGA_ADDRESS, env->irq[4], serial_hds[2]); /* Load firmware in flash / BIOS. */ dinfo = drive_get(IF_PFLASH, 0, fl_idx); -- 1.7.9.5
[Qemu-devel] [PATCH 13/43] s390x: fix -initrd in virtio machine
From: Alexander Graf When using -initrd in the virtio machine, we need to indicate the initrd start and size inside the kernel image. These parameters need to be stored in native endianness. Signed-off-by: Alexander Graf Acked-by: Richard Henderson Acked-by: Christian Borntraeger (cherry picked from commit 235a3f0bed3584fe65079ffa07c7a842971f261e) Signed-off-by: Michael Roth --- hw/s390-virtio.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c index 47eed35..12ae612 100644 --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -284,8 +284,8 @@ static void s390_init(ram_addr_t my_ram_size, } /* we have to overwrite values in the kernel image, which are "rom" */ -memcpy(rom_ptr(INITRD_PARM_START), &initrd_offset, 8); -memcpy(rom_ptr(INITRD_PARM_SIZE), &initrd_size, 8); +stq_p(rom_ptr(INITRD_PARM_START), initrd_offset); +stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size); } if (rom_ptr(KERN_PARM_AREA)) { -- 1.7.9.5
[Qemu-devel] [PATCH 15/43] target-sparc64: disable VGA cirrus
From: Aurelien Jarno OpenBIOS on sparc64 only support Standard VGA and not Cirrus VGA. Don't build Cirrus VGA support so that it can't be selected. This fixes the breakage introduced by commit f2898771. Reported-by: Richard Henderson Cc: Blue Swirl Signed-off-by: Aurelien Jarno Tested-by: Richard Henderson Signed-off-by: Blue Swirl (cherry picked from commit 0356404b0f1da939657cad1efeb556745cd430d5) Signed-off-by: Michael Roth --- default-configs/sparc64-softmmu.mak |1 - 1 file changed, 1 deletion(-) diff --git a/default-configs/sparc64-softmmu.mak b/default-configs/sparc64-softmmu.mak index c9a36c1..03e8b42 100644 --- a/default-configs/sparc64-softmmu.mak +++ b/default-configs/sparc64-softmmu.mak @@ -6,7 +6,6 @@ CONFIG_M48T59=y CONFIG_PTIMER=y CONFIG_VGA=y CONFIG_VGA_PCI=y -CONFIG_VGA_CIRRUS=y CONFIG_SERIAL=y CONFIG_PARALLEL=y CONFIG_PCKBD=y -- 1.7.9.5
[Qemu-devel] [PATCH 14/43] PPC: Bamboo: Fix memory size DT property
From: Alexander Graf Device tree properties need to be specified in big endian. Fix the bamboo memory size property accordingly. Signed-off-by: Alexander Graf CC: qemu-sta...@nongnu.org (cherry picked from commit 5232fa59b17b45c04bd24e0d38224964816bf391) Signed-off-by: Michael Roth --- hw/ppc440_bamboo.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c index c198071..9286438 100644 --- a/hw/ppc440_bamboo.c +++ b/hw/ppc440_bamboo.c @@ -59,7 +59,7 @@ static int bamboo_load_device_tree(target_phys_addr_t addr, { int ret = -1; #ifdef CONFIG_FDT -uint32_t mem_reg_property[] = { 0, 0, ramsize }; +uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(ramsize) }; char *filename; int fdt_size; void *fdt; -- 1.7.9.5
[Qemu-devel] [PATCH 17/43] tools: initialize main loop before block layer
From: Paolo Bonzini Tools were broken because they initialized the block layer while qemu_aio_context was still NULL. Reported-by: malc Signed-off-by: Paolo Bonzini Signed-off-by: malc (cherry picked from commit 2592c59a66d456fe98fe96cb5787b356c40ee66f) Signed-off-by: Michael Roth --- qemu-img.c |3 +-- qemu-io.c |3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 7615e91..c90ae4a 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1698,14 +1698,13 @@ int main(int argc, char **argv) error_set_progname(argv[0]); +qemu_init_main_loop(); bdrv_init(); if (argc < 2) help(); cmdname = argv[1]; argc--; argv++; -qemu_init_main_loop(); - /* find the command */ for(cmd = img_cmds; cmd->name != NULL; cmd++) { if (!strcmp(cmdname, cmd->name)) { diff --git a/qemu-io.c b/qemu-io.c index d0f4fb7..1ad7d3a 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -1892,9 +1892,8 @@ int main(int argc, char **argv) exit(1); } -bdrv_init(); - qemu_init_main_loop(); +bdrv_init(); /* initialize commands */ quit_init(); -- 1.7.9.5
[Qemu-devel] [PATCH 18/43] m68k: Return semihosting errno values correctly
From: Meador Inge Fixing a simple typo, s/errno/err/, that caused the error status from GDB semihosted system calls to be returned incorrectly. Signed-off-by: Meador Inge Reviewed-by: Andreas Färber Signed-off-by: Peter Maydell Signed-off-by: Blue Swirl (cherry picked from commit aed91c1bff5e568c7b0fbd0e1e7e2f9e62409e73) Signed-off-by: Michael Roth --- target-m68k/m68k-semi.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-m68k/m68k-semi.c b/target-m68k/m68k-semi.c index 3bb30cd..fed44ea 100644 --- a/target-m68k/m68k-semi.c +++ b/target-m68k/m68k-semi.c @@ -150,7 +150,7 @@ static void m68k_semi_cb(CPUM68KState *env, target_ulong ret, target_ulong err) } /* FIXME - handle put_user() failure */ put_user_u32(ret, args); -put_user_u32(errno, args + 4); +put_user_u32(err, args + 4); } #define ARG(n) \ -- 1.7.9.5
[Qemu-devel] [PATCH 21/43] target-mips: fix wrong microMIPS opcode encoding
From: "陳韋任 (Wei-Ren Chen)" While reading microMIPS decoding, I found a possible wrong opcode encoding. According to [1] page 166, the bits 13..12 for MULTU is 0x01 rather than 0x00. Please review, thanks. [1] MIPS Architecture for Programmers VolumeIV-e: The MIPS DSP Application-Specific Extension to the microMIPS32 Architecture Signed-off-by: Chen Wei-Ren Signed-off-by: Aurelien Jarno (cherry picked from commit 6801038bc52d61f81ac8a25fbe392f1bad982887) Signed-off-by: Michael Roth --- target-mips/translate.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-mips/translate.c b/target-mips/translate.c index 4e04e97..49907bb 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -9486,7 +9486,7 @@ enum { /* bits 13..12 for 0x32 */ MULT_ACC = 0x0, -MULTU_ACC = 0x0, +MULTU_ACC = 0x1, /* bits 15..12 for 0x2c */ SEB = 0x2, -- 1.7.9.5
[Qemu-devel] [PATCH 22/43] tcg/arm: fix TLB access in qemu-ld/st ops
From: Aurelien Jarno The TCG arm backend considers likely that the offset to the TLB entries does not exceed 12 bits for mem_index = 0. In practice this is not true for at least the MIPS target. The current patch fixes that by loading the bits 23-12 with a separate instruction, and using loads with address writeback, independently of the value of mem_idx. In total this allow a 24-bit offset, which is a lot more than needed. Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-sta...@nongnu.org Signed-off-by: Aurelien Jarno (cherry picked from commit d17bd1d8cc27f8c1a24c65f555a77a661c332b7f) Signed-off-by: Michael Roth --- tcg/arm/tcg-target.c | 78 +++--- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index aed3b53..fbad716 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -630,6 +630,22 @@ static inline void tcg_out_ld32_12(TCGContext *s, int cond, (rn << 16) | (rd << 12) | ((-im) & 0xfff)); } +/* Offset pre-increment with base writeback. */ +static inline void tcg_out_ld32_12wb(TCGContext *s, int cond, + int rd, int rn, tcg_target_long im) +{ +/* ldr with writeback and both register equals is UNPREDICTABLE */ +assert(rd != rn); + +if (im >= 0) { +tcg_out32(s, (cond << 28) | 0x05b0 | +(rn << 16) | (rd << 12) | (im & 0xfff)); +} else { +tcg_out32(s, (cond << 28) | 0x0530 | +(rn << 16) | (rd << 12) | ((-im) & 0xfff)); +} +} + static inline void tcg_out_st32_12(TCGContext *s, int cond, int rd, int rn, tcg_target_long im) { @@ -1062,7 +1078,7 @@ static inline void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, data_reg2, bswap; #ifdef CONFIG_SOFTMMU -int mem_index, s_bits; +int mem_index, s_bits, tlb_offset; TCGReg argreg; # if TARGET_LONG_BITS == 64 int addr_reg2; @@ -1102,19 +1118,15 @@ static inline void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc) TCG_REG_R0, TCG_REG_R8, CPU_TLB_SIZE - 1); tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_AREG0, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); -/* In the - * ldr r1 [r0, #(offsetof(CPUArchState, tlb_table[mem_index][0].addr_read))] - * below, the offset is likely to exceed 12 bits if mem_index != 0 and - * not exceed otherwise, so use an - * add r0, r0, #(mem_index * sizeof *CPUArchState.tlb_table) - * before. - */ -if (mem_index) +/* We assume that the offset is contained within 20 bits. */ +tlb_offset = offsetof(CPUArchState, tlb_table[mem_index][0].addr_read); +assert(tlb_offset & ~0xf == 0); +if (tlb_offset > 0xfff) { tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_REG_R0, -(mem_index << (TLB_SHIFT & 1)) | -((16 - (TLB_SHIFT >> 1)) << 8)); -tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R0, -offsetof(CPUArchState, tlb_table[0][0].addr_read)); +0xa00 | (tlb_offset >> 12)); +tlb_offset &= 0xfff; +} +tcg_out_ld32_12wb(s, COND_AL, TCG_REG_R1, TCG_REG_R0, tlb_offset); tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R1, TCG_REG_R8, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); /* Check alignment. */ @@ -1122,15 +1134,14 @@ static inline void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc) tcg_out_dat_imm(s, COND_EQ, ARITH_TST, 0, addr_reg, (1 << s_bits) - 1); # if TARGET_LONG_BITS == 64 -/* XXX: possibly we could use a block data load or writeback in - * the first access. */ -tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, -offsetof(CPUArchState, tlb_table[0][0].addr_read) + 4); +/* XXX: possibly we could use a block data load in the first access. */ +tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, 4); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addr_reg2, SHIFT_IMM_LSL(0)); # endif tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, -offsetof(CPUArchState, tlb_table[0][0].addend)); +offsetof(CPUTLBEntry, addend) +- offsetof(CPUTLBEntry, addr_read)); switch (opc) { case 0: @@ -1288,7 +1299,7 @@ static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, data_reg2, bswap; #ifdef CONFIG_SOFTMMU -int mem_index, s_bits; +int mem_index, s_bits, tlb_offset; TCGReg argreg; # if TARGET_LONG_BITS == 64 int addr_reg2; @@ -1325,19 +1336,15 @@ static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc) TCG_REG_R0, TCG
[Qemu-devel] [PATCH 05/43] uhci: Raise interrupt when requested even for non active tds
From: Hans de Goede According to the spec we must raise an interrupt when one is requested even for non active tds. Linux depends on this, for bulk transfers it runs an inactivity timer to work around a bug in early uhci revisions, when we take longer then 200 ms to process a packet, this timer goes of, and as part of the handling Linux then unlinks the qh, and relinks it after the frindex has increased by atleast 1, the problem is Linux only checks for the frindex increases on an interrupt, and we don't send that, causing the qh to go inactive for more then 32 frames, at which point we consider the packet cancelled. Signed-off-by: Hans de Goede Signed-off-by: Gerd Hoffmann (cherry picked from commit 883bca776daa43111e9c39008f0038f7c62ae723) Signed-off-by: Michael Roth --- hw/usb/hcd-uhci.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index cdc8bc3..c2f08e3 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -826,8 +826,16 @@ static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, USBEndpoint *ep; /* Is active ? */ -if (!(td->ctrl & TD_CTRL_ACTIVE)) +if (!(td->ctrl & TD_CTRL_ACTIVE)) { +/* + * ehci11d spec page 22: "Even if the Active bit in the TD is already + * cleared when the TD is fetched ... an IOC interrupt is generated" + */ +if (td->ctrl & TD_CTRL_IOC) { +*int_mask |= 0x01; +} return TD_RESULT_NEXT_QH; +} async = uhci_async_find_td(s, addr, td); if (async) { -- 1.7.9.5
[Qemu-devel] [PATCH 28/43] block: Fix regression for MinGW (assertion caused by short string)
From: Stefan Weil The local string tmp_filename is passed to function get_tmp_filename which expects a string with minimum size MAX_PATH for w32 hosts. MAX_PATH is 260 and PATH_MAX is 259, so tmp_filename was too short. Commit eba25057b9a5e19d10ace2bc7716667a31297169 introduced this regression. Signed-off-by: Stefan Weil Reviewed-by: Stefan Hajnoczi Signed-off-by: Blue Swirl (cherry picked from commit 89c9bc3d147fdaa932db99b0463b4af1d3e7cda1) Signed-off-by: Michael Roth --- block.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 4c0e7f5..e49a999 100644 --- a/block.c +++ b/block.c @@ -739,7 +739,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret; -char tmp_filename[PATH_MAX]; +/* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ +char tmp_filename[PATH_MAX + 1]; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; -- 1.7.9.5
[Qemu-devel] [PATCH 29/43] qom: dynamic_cast of NULL is always NULL
From: Paolo Bonzini Trying to cast a NULL value will cause a crash. Returning NULL is also sensible, and it is also what the type-unsafe DO_UPCAST macro does. Reported-by: Markus Armbruster Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori (cherry picked from commit b7f43fe46029d8fd0594cd599fa2599dcce0f553) Signed-off-by: Michael Roth --- qom/object.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qom/object.c b/qom/object.c index e3e9242..f33e84d 100644 --- a/qom/object.c +++ b/qom/object.c @@ -417,7 +417,7 @@ void object_delete(Object *obj) Object *object_dynamic_cast(Object *obj, const char *typename) { -if (object_class_dynamic_cast(object_get_class(obj), typename)) { +if (obj && object_class_dynamic_cast(object_get_class(obj), typename)) { return obj; } @@ -430,7 +430,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename) inst = object_dynamic_cast(obj, typename); -if (!inst) { +if (!inst && obj) { fprintf(stderr, "Object %p is not an instance of type %s\n", obj, typename); abort(); -- 1.7.9.5
[Qemu-devel] [PATCH 30/43] hmp: do not crash on invalid SCSI hotplug
From: Paolo Bonzini Commit 0d93692 (qdev: Convert busses to QEMU Object Model, 2012-05-02) removed a check on the type of the bus where a SCSI disk is hotplugged. However, hot-plugging to the wrong kind of device now causes a crash due to either a NULL pointer dereference (avoided by the previous patch) or a failed QOM cast. Instead, in this case we need to use object_dynamic_cast and check for the result, similar to what was done before that commit. Reported-by: Markus Armbruster Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori (cherry picked from commit b5007bcc9729acd995518c52eb1038c4d8416b5d) Signed-off-by: Michael Roth --- hw/pci-hotplug.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index e7fb780..0ca5546 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -80,7 +80,13 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, SCSIBus *scsibus; SCSIDevice *scsidev; -scsibus = SCSI_BUS(QLIST_FIRST(&adapter->child_bus)); +scsibus = (SCSIBus *) +object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)), +TYPE_SCSI_BUS); +if (!scsibus) { + error_report("Device is not a SCSI adapter"); + return -1; +} /* * drive_init() tries to find a default for dinfo->unit. Doesn't -- 1.7.9.5
[Qemu-devel] [PATCH 32/43] qom: fix refcount of non-heap-allocated objects
From: Paolo Bonzini The reference count for embedded objects is always one too low, because object_initialize_with_type returns with zero references to the object. This causes premature finalization of the object (or an assertion failure) after calling object_ref to add an extra reference and object_unref to remove it. The fix is to move the initial object_ref call from object_new_with_type to object_initialize_with_type. Acked-by: Andreas Färber Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori (cherry picked from commit 764b63125a77dab54ed405d493452a4e05679c2e) Signed-off-by: Michael Roth --- qom/object.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qom/object.c b/qom/object.c index f33e84d..5499318 100644 --- a/qom/object.c +++ b/qom/object.c @@ -307,6 +307,7 @@ void object_initialize_with_type(void *data, TypeImpl *type) memset(obj, 0, type->instance_size); obj->class = type->class; +object_ref(obj); QTAILQ_INIT(&obj->properties); object_init_with_type(obj, type); } @@ -395,7 +396,6 @@ Object *object_new_with_type(Type type) obj = g_malloc(type->instance_size); object_initialize_with_type(obj, type); -object_ref(obj); return obj; } -- 1.7.9.5
[Qemu-devel] [PATCH 31/43] PPC: Fix missing TRACE exception
From: Julio Guerra This patch fixes bug 1031698 : https://bugs.launchpad.net/qemu/+bug/1031698 If we look at the (truncated) translation of the conditional branch instruction in the test submitted in the bug post, the call to the exception helper is missing in the "bne-false" chunk of translated code : IN: bne-0x1800278 OUT: 0xb544236d: jne0xb5442396 0xb5442373: mov%ebp,(%esp) 0xb5442376: mov$0x44,%ebx 0xb544237b: mov%ebx,0x4(%esp) 0xb544237f: mov$0x1800278,%ebx 0xb5442384: mov%ebx,0x25c(%ebp) 0xb544238a: call 0x827475a ^^ 0xb5442396: mov%ebp,(%esp) 0xb5442399: mov$0x44,%ebx 0xb544239e: mov%ebx,0x4(%esp) 0xb54423a2: mov$0x1800270,%ebx 0xb54423a7: mov%ebx,0x25c(%ebp) Indeed, gen_exception(ctx, excp) called by gen_goto_tb (called by gen_bcond) changes ctx->exception's value to excp's : gen_bcond() { gen_goto_tb(ctx, 0, ctx->nip + li - 4); /* ctx->exception value is POWERPC_EXCP_BRANCH */ gen_goto_tb(ctx, 1, ctx->nip); /* ctx->exception now value is POWERPC_EXCP_TRACE */ } Making the following gen_goto_tb()'s test false during the second call : if ((ctx->singlestep_enabled & (CPU_BRANCH_STEP | CPU_SINGLE_STEP)) && ctx->exception == POWERPC_EXCP_BRANCH /* false...*/) { target_ulong tmp = ctx->nip; ctx->nip = dest; /* ... and this is the missing call */ gen_exception(ctx, POWERPC_EXCP_TRACE); ctx->nip = tmp; } So the patch simply adds the missing matching case, fixing our problem. Signed-off-by: Julio Guerra Signed-off-by: Alexander Graf (cherry picked from commit f0cc4aa8450376ca2aee3ebb09db71f9f2ff333b) Signed-off-by: Michael Roth --- target-ppc/translate.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index ac915cc..3c49ca9 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -3466,7 +3466,8 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) if (unlikely(ctx->singlestep_enabled)) { if ((ctx->singlestep_enabled & (CPU_BRANCH_STEP | CPU_SINGLE_STEP)) && -ctx->exception == POWERPC_EXCP_BRANCH) { +(ctx->exception == POWERPC_EXCP_BRANCH || + ctx->exception == POWERPC_EXCP_TRACE)) { target_ulong tmp = ctx->nip; ctx->nip = dest; gen_exception(ctx, POWERPC_EXCP_TRACE); -- 1.7.9.5
[Qemu-devel] [PATCH 27/43] tci: Fix type of tci_read_label
From: Richard Henderson Fixes the pointer truncation that was occurring for branches. Cc: Stefan Weil Cc: Blue Swirl Signed-off-by: Richard Henderson Reviewed-by: Stefan Weil Tested-by: Stefan Weil Signed-off-by: Blue Swirl (cherry picked from commit c6c5063c7a5bb1d3fe6b9931a1ec15294e39b8b1) Signed-off-by: Michael Roth --- tci.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tci.c b/tci.c index a4f7b78..bb456d2 100644 --- a/tci.c +++ b/tci.c @@ -338,9 +338,9 @@ static uint64_t tci_read_ri64(uint8_t **tb_ptr) } #endif -static target_ulong tci_read_label(uint8_t **tb_ptr) +static tcg_target_ulong tci_read_label(uint8_t **tb_ptr) { -target_ulong label = tci_read_i(tb_ptr); +tcg_target_ulong label = tci_read_i(tb_ptr); assert(label != 0); return label; } -- 1.7.9.5
[Qemu-devel] [PATCH 10/43] target-i386: Allow tsc-frequency to be larger then 2.147G
From: Don Slutz The check using INT_MAX (2147483647) is wrong in this case. Signed-off-by: Fred Oliveira Signed-off-by: Don Slutz Signed-off-by: Stefan Hajnoczi (cherry picked from commit 2e84849aa2cc7f220d3b3668f5f7e3c57bb1b590) Signed-off-by: Michael Roth --- 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 423e009..cbc172e 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -846,7 +846,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, { X86CPU *cpu = X86_CPU(obj); const int64_t min = 0; -const int64_t max = INT_MAX; +const int64_t max = INT64_MAX; int64_t value; visit_type_int(v, &value, name, errp); -- 1.7.9.5
[Qemu-devel] [PATCH 26/43] qcow2: Fix refcount table size calculation
From: Kevin Wolf A missing factor for the refcount table entry size in the calculation could mean that too little memory was allocated for the in-memory representation of the table, resulting in a buffer overflow. Signed-off-by: Kevin Wolf Reviewed-by: Michael Tokarev Tested-by: Michael Tokarev (cherry picked from commit a3548077062dd9dc2701ebffd931ba6eaef40bec) Signed-off-by: Michael Roth --- block/qcow2-refcount.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 5e3f915..96224d1 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -301,7 +301,8 @@ static int alloc_refcount_block(BlockDriverState *bs, uint64_t last_table_size; uint64_t blocks_clusters; do { -uint64_t table_clusters = size_to_clusters(s, table_size); +uint64_t table_clusters = +size_to_clusters(s, table_size * sizeof(uint64_t)); blocks_clusters = 1 + ((table_clusters + refcount_block_clusters - 1) / refcount_block_clusters); -- 1.7.9.5
[Qemu-devel] [PATCH 06/43] hw/qxl: qxl_dirty_surfaces: use uintptr_t
From: Alon Levy As suggested by Paolo Bonzini, to avoid possible integer overflow issues. Signed-off-by: Alon Levy Signed-off-by: Gerd Hoffmann (cherry picked from commit c5825ac6c861bfe1a4adfa27517931b56079e298) Signed-off-by: Michael Roth --- hw/qxl.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 59bf822..89e9ad9 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1703,7 +1703,7 @@ static void qxl_hw_text_update(void *opaque, console_ch_t *chardata) static void qxl_dirty_surfaces(PCIQXLDevice *qxl) { -intptr_t vram_start; +uintptr_t vram_start; int i; if (qxl->mode != QXL_MODE_NATIVE && qxl->mode != QXL_MODE_COMPAT) { @@ -1714,7 +1714,7 @@ static void qxl_dirty_surfaces(PCIQXLDevice *qxl) qxl_set_dirty(&qxl->vga.vram, qxl->shadow_rom.draw_area_offset, qxl->shadow_rom.surface0_area_size); -vram_start = (intptr_t)memory_region_get_ram_ptr(&qxl->vram_bar); +vram_start = (uintptr_t)memory_region_get_ram_ptr(&qxl->vram_bar); /* dirty the off-screen surfaces */ for (i = 0; i < NUM_SURFACES; i++) { -- 1.7.9.5
[Qemu-devel] [PATCH 34/43] qapi: fix qapi_dealloc_type_size parameter type
From: Bruce Rogers The second parameter to qapi_dealloc_type_size should be a uint64_t *, not a size_t *. This was causing our 32 bit x86 build to fail, since warnings are treated as errors. Signed-off-by: Bruce Rogers Reviewed-by: Michael Roth Reviewed-by: Stefan Weil Signed-off-by: Luiz Capitulino (cherry picked from commit 1d16252652688a775b244fffa1b9ac9b719ceffc) Signed-off-by: Michael Roth --- qapi/qapi-dealloc-visitor.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index a07b171..75214e7 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -132,7 +132,7 @@ static void qapi_dealloc_type_number(Visitor *v, double *obj, const char *name, { } -static void qapi_dealloc_type_size(Visitor *v, size_t *obj, const char *name, +static void qapi_dealloc_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp) { } -- 1.7.9.5
[Qemu-devel] [PATCH 33/43] qapi: handle visitor->type_size() in QapiDeallocVisitor
From: Stefan Hajnoczi visit_type_size() requires either visitor->type_size() or visitor_uint64() to be implemented, otherwise a NULL function pointer is invoked. It is possible to trigger this crash as follows: $ qemu-system-x86_64 -netdev tap,sndbuf=0,id=netdev0 \ -device virtio-blk-pci,netdev=netdev0 The 'sndbuf' option has type "size". Reviewed-by: Andreas Färber Reviewed-by: Michael Roth Signed-off-by: Stefan Hajnoczi Signed-off-by: Anthony Liguori (cherry picked from commit 0c26f2eca40d6c65ea9edc62a10e510dc7f65cc8) Signed-off-by: Michael Roth --- qapi/qapi-dealloc-visitor.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index a154523..a07b171 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -132,6 +132,11 @@ static void qapi_dealloc_type_number(Visitor *v, double *obj, const char *name, { } +static void qapi_dealloc_type_size(Visitor *v, size_t *obj, const char *name, + Error **errp) +{ +} + static void qapi_dealloc_type_enum(Visitor *v, int *obj, const char *strings[], const char *kind, const char *name, Error **errp) @@ -164,6 +169,7 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void) v->visitor.type_bool = qapi_dealloc_type_bool; v->visitor.type_str = qapi_dealloc_type_str; v->visitor.type_number = qapi_dealloc_type_number; +v->visitor.type_size = qapi_dealloc_type_size; QTAILQ_INIT(&v->stack); -- 1.7.9.5
Re: [Qemu-devel] [RFC 05/10] qdev: move reset handler list from vl.c to hw/reset.c
On Mon, Dec 03, 2012 at 10:20:03PM +0100, Igor Mammedov wrote: > On Fri, 30 Nov 2012 17:27:17 -0200 > Eduardo Habkost wrote: > > > The core qdev code uses the reset handler list from vl.c, and > > currently *-user has some hacks to make CPU reset work. > > > > This moves qemu_register_reset(), qemu_unregister_reset() and > > qemu_devices_reset() to a new file, hw/reset.c, that can be used by qdev > > and by *-user. > > > > Signed-off-by: Eduardo Habkost > > --- > [...] > > diff --git a/hw/reset.c b/hw/reset.c > > new file mode 100644 > > index 000..5e34b80 > > --- /dev/null > > +++ b/hw/reset.c > > @@ -0,0 +1,43 @@ > > +#include "hw/reset.h" > > +#include "qlist.h" > missing #include for g_malloc/g_free > > [...] > > diff --git a/xen-all.c b/xen-all.c > > index 046cc2a..7d2a79f 100644 > > --- a/xen-all.c > > +++ b/xen-all.c > > @@ -14,6 +14,7 @@ > > #include "hw/pc.h" > > #include "hw/xen_common.h" > > #include "hw/xen_backend.h" > > +#include "hw/reset.h" > > #include "qmp-commands.h" > > > > #include "range.h" > > -- > > 1.7.11.7 > > > > > Since you are going not include reset.o in *-user: > although dedicated reset.c is nice to have perhaps you can drop reset.c /it's > not very related to this series topic/ altogether to minimize scope of review > and limit patch only to reset.h and qemu_register_reset(), > qemu_unregister_reset() and qemu_devices_reset() stubs for *-user. I plan to remove this patch on the next respin of the series, and add qemu_[un]register_reset() stubs to *-user instead. When I sent this version of the series, I was still planning to include reset.o in *-user. -- Eduardo
[Qemu-devel] [PATCH 35/43] iscsi: fix segfault in url parsing
From: Peter Lieven If an invalid URL is specified iscsi_get_error(iscsi) is called with iscsi == NULL. Signed-off-by: Peter Lieven Signed-off-by: Paolo Bonzini (cherry picked from commit 8da1e18b0cf46b6c95c88bbad1cc50d6dd1bef4b) Signed-off-by: Michael Roth --- block/iscsi.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index fb001b9..817196a 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -951,8 +951,7 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags) iscsi_url = iscsi_parse_full_url(iscsi, filename); if (iscsi_url == NULL) { -error_report("Failed to parse URL : %s %s", filename, - iscsi_get_error(iscsi)); +error_report("Failed to parse URL : %s", filename); ret = -EINVAL; goto out; } -- 1.7.9.5
[Qemu-devel] [PATCH 38/43] virtio-scsi: Fix some endian bugs with virtio-scsi
From: David Gibson The virtio-scsi specification does not specify the correct endianness for fields in the request structure. It's therefore best to assume that it is "guest native" endian since that's the (stupid and poorly defined) norm in virtio. However, the qemu device for virtio-scsi has no byteswaps at all, and so will break if the guest has different endianness from the host. This patch fixes it by adding tswap() calls for the sense_len and resid fields in the request structure. In theory status_qualifier needs swaps as well, but that field is never actually touched. The tag field is a uint64_t, but since its value is completely arbitrary, it might as well be uint8_t[8] and so it does not need swapping. Cc: Paolo Bonzini Cc: Paul 'Rusty' Russell Signed-off-by: David Gibson Signed-off-by: Paolo Bonzini (cherry picked from commit 474ee55a18765e7de8f0b2cc00db5d26286bb24d) Signed-off-by: Michael Roth --- hw/virtio-scsi.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c index c1b47a8..c6d5290 100644 --- a/hw/virtio-scsi.c +++ b/hw/virtio-scsi.c @@ -424,15 +424,17 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, size_t resid) { VirtIOSCSIReq *req = r->hba_private; +uint32_t sense_len; req->resp.cmd->response = VIRTIO_SCSI_S_OK; req->resp.cmd->status = status; if (req->resp.cmd->status == GOOD) { -req->resp.cmd->resid = resid; +req->resp.cmd->resid = tswap32(resid); } else { req->resp.cmd->resid = 0; -req->resp.cmd->sense_len = -scsi_req_get_sense(r, req->resp.cmd->sense, VIRTIO_SCSI_SENSE_SIZE); +sense_len = scsi_req_get_sense(r, req->resp.cmd->sense, + VIRTIO_SCSI_SENSE_SIZE); +req->resp.cmd->sense_len = tswap32(sense_len); } virtio_scsi_complete_req(req); } -- 1.7.9.5
[Qemu-devel] [PATCH 42/43] stream: fix ratelimit_set_speed
From: Dietmar Maurer The formula to compute slice_quota was wrong since commit 6ef228fc. Signed-off-by: Dietmar Maurer Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf (cherry picked from commit e3980e28bb888bf643054770452998d1b4319609) Signed-off-by: Michael Roth --- include/qemu/ratelimit.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/ratelimit.h b/include/qemu/ratelimit.h index c6ac281..d1610f1 100644 --- a/include/qemu/ratelimit.h +++ b/include/qemu/ratelimit.h @@ -42,7 +42,7 @@ static inline void ratelimit_set_speed(RateLimit *limit, uint64_t speed, uint64_t slice_ns) { limit->slice_ns = slice_ns; -limit->slice_quota = ((double)speed * 10ULL) / slice_ns; +limit->slice_quota = ((double)speed * slice_ns)/10ULL; } #endif -- 1.7.9.5
[Qemu-devel] [PATCH 41/43] usb: fail usbdevice_create() when there is no USB bus
From: Stefan Hajnoczi Report an error instead of segfaulting when attaching a USB device to a machine with no USB busses: $ qemu-system-arm -machine vexpress-a9 \ -sd Fedora-17-armhfp-vexpress-mmcblk0.img \ -kernel vmlinuz-3.4.2-3.fc17.armv7hl \ -initrd initramfs-3.4.2-3.fc17.armv7hl.img \ -usbdevice disk:format=raw:test.img Note that the vexpress-a9 machine does not have a USB host controller. Reported-by: David Abdurachmanov Signed-off-by: Stefan Hajnoczi Signed-off-by: Gerd Hoffmann (cherry picked from commit c128d6a6d785eb9235a4f6dbd52f405ab8c60bee) Signed-off-by: Michael Roth --- hw/usb/bus.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index b649360..1f73a52 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -585,6 +585,13 @@ USBDevice *usbdevice_create(const char *cmdline) return NULL; } +if (!bus) { +error_report("Error: no usb bus to attach usbdevice %s, " + "please try -machine usb=on and check that " + "the machine model supports USB", driver); +return NULL; +} + if (!f->usbdevice_init) { if (*params) { error_report("usbdevice %s accepts no params", driver); -- 1.7.9.5
[Qemu-devel] [PATCH v2] exynos4210/mct: Avoid infinite loop on non incremental timers
Check for a 0 "distance" value to avoid infinite loop when the expired FCR timer was not programed with auto-increment. With this change the behavior is coherent with the same type of code in the exynos4210_gfrc_restart() function in the same file. Linux seems to mostly use this timer with auto-increment which explain why it is not a problem most of the time. However other OS might have a problem with this if they don't use the auto-increment feature. Signed-off-by: Jean-Christophe DUBOIS --- hw/exynos4210_mct.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/exynos4210_mct.c b/hw/exynos4210_mct.c index e79cd6a..37dbda9 100644 --- a/hw/exynos4210_mct.c +++ b/hw/exynos4210_mct.c @@ -568,7 +568,7 @@ static void exynos4210_gfrc_event(void *opaque) /* Reload FRC to reach nearest comparator */ s->g_timer.curr_comp = exynos4210_gcomp_find(s); distance = exynos4210_gcomp_get_distance(s, s->g_timer.curr_comp); -if (distance > MCT_GT_COUNTER_STEP) { +if (distance > MCT_GT_COUNTER_STEP || !distance) { distance = MCT_GT_COUNTER_STEP; } exynos4210_gfrc_set_count(&s->g_timer, distance); -- 1.7.10.4
[Qemu-devel] [PATCH 40/43] qxl: reload memslots after migration, when qxl is in UNDEFINED mode
From: Yonit Halperin The devram memslot stays active when qxl enters UNDEFINED mode (i.e, no primary surface). If migration has occurred while the device is in UNDEFINED stae, the memslots have to be reloaded at the destination. Fixes rhbz#874574 Signed-off-by: Yonit Halperin Signed-off-by: Gerd Hoffmann (cherry picked from commit fa98efe932d93a15ffa867f3b05149c8d1fc7c28) Signed-off-by: Michael Roth --- hw/qxl.c |1 + 1 file changed, 1 insertion(+) diff --git a/hw/qxl.c b/hw/qxl.c index 89e9ad9..e7e9dd9 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -2042,6 +2042,7 @@ static int qxl_post_load(void *opaque, int version) switch (newmode) { case QXL_MODE_UNDEFINED: +qxl_create_memslots(d); break; case QXL_MODE_VGA: qxl_create_memslots(d); -- 1.7.9.5