Re: [Qemu-devel] [PATCH v2 0/6] target/arm: Some pieces of support for 32-bit Hyp mode

2018-08-22 Thread Luc Michel
On 8/20/18 5:30 PM, Peter Maydell wrote:
> Now we have virtualization support in the GICv2 emulation,
> I thought I'd have a look at how much we were still missing
> for being able to enable EL2 support for AArch32.
> This set of patches fixes some minor missing pieces:
>  * AArch32 HACTLR2
>  * AArch32 HCR, HCR2
>  * support for taking exceptions to Hyp mode
>  * boot AArch32 kernels in Hyp mode where available
> and I threw in a trivial bugfix:
>  * Clear CPSR.IL and CPSR.J on 32-bit exception entry
> since it would otherwise have a conflict with the refactoring
> of exception entry.
> 
> Changes v1->v2:
>  * some patches are now upstream
>  * v8-only registers no longer created for v7 CPUs
>  * split the "factor out exception-entry code" into
>its own patch
>  * new patch: clear CPSR.IL and CPSR.J
>  * new patch: boot kernels in Hyp mode if possible
> 
> (I still have the same "guest EL0 segv" issue as for v1
> if I actually enable the EL2 feature on Cortex-A15.)
> 

Reviewed-By: Luc Michel 

> thanks
> -- PMM
> 
> Peter Maydell (6):
>   target/arm: Implement RAZ/WI HACTLR2
>   target/arm: Implement AArch32 HCR and HCR2
>   target/arm: Factor out code for taking an AArch32 exception
>   target/arm: Implement support for taking exceptions to Hyp mode
>   target/arm: Clear CPSR.IL and CPSR.J on 32-bit exception entry
>   hw/arm/boot: AArch32 kernels should be started in Hyp mode if
> available
> 
>  hw/arm/boot.c   |  11 +++
>  target/arm/helper.c | 212 ++--
>  2 files changed, 196 insertions(+), 27 deletions(-)
> 



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH] tests/libqos: Utilize newer glib spawn check

2018-08-22 Thread Thomas Huth
On 2018-08-21 21:05, Eric Blake wrote:
> During development, I got a 'make check' failure that claimed:
> 
> qemu-img returned status code 32512
> **
> ERROR:tests/libqos/libqos.c:202:mkimg: assertion failed: (!rc)
> 
> But 32512 is too big for a normal exit status value, which means we
> failed to use WEXITSTATUS() to shift the bits to the desired value
> for printing.  However, instead of worrying about how to portably
> parse g_spawn()'s rc in the proper platform-dependent manner, it's
> better to just rely on the fact that we now require glib 2.40 (since
> commit e7b3af815) and can therefore use glib's portable checker
> instead, where the message under my same condition improves to:
> 
> Child process exited with code 127
> **
> ERROR:tests/libqos/libqos.c:192:mkimg: assertion failed: (ret && !err)
> 
> Signed-off-by: Eric Blake 
> 
> ---
> This appears to be the only remaining vestige of a comment mentioning
> glib < 2.40.
> ---
>  tests/libqos/libqos.c | 12 +---
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
> index 013ca68581c..c5141873448 100644
> --- a/tests/libqos/libqos.c
> +++ b/tests/libqos/libqos.c
> @@ -185,22 +185,12 @@ void mkimg(const char *file, const char *fmt, unsigned 
> size_mb)
>  cli = g_strdup_printf("%s create -f %s %s %uM", qemu_img_abs_path,
>fmt, file, size_mb);
>  ret = g_spawn_command_line_sync(cli, &out, &out2, &rc, &err);
> -if (err) {
> +if (err || !g_spawn_check_exit_status(rc, &err)) {
>  fprintf(stderr, "%s\n", err->message);
>  g_error_free(err);
>  }
>  g_assert(ret && !err);
> 
> -/* In glib 2.34, we have g_spawn_check_exit_status. in 2.12, we don't.
> - * glib 2.43.91 implementation assumes that any non-zero is an error for
> - * windows, but uses extra precautions for Linux. However,
> - * 0 is only possible if the program exited normally, so that should be
> - * sufficient for our purposes on all platforms, here. */
> -if (rc) {
> -fprintf(stderr, "qemu-img returned status code %d\n", rc);
> -}
> -g_assert(!rc);
> -
>  g_free(out);
>  g_free(out2);
>  g_free(cli);
> 

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] Modeling a device controlled by combination of GPIO and UART

2018-08-22 Thread Martin Schroeder via Qemu-devel
Thanks Peter.

I have set it up such that master device has qemu_irq array which it
initializes using qdev_init_gpio_out with number of gpio lines going
out and slave device calls qdev_init_gpio_in with a callback that
should be called when irq is raised. Then I connect them together at
higher level using qdev_connect_gpio_out as you said. Then master
calls qemu_set_irq with 1 or 0 depending on whether the gpio is high
or low.

This works, but not as I would expect. The handler that I supply to
the init_gpio_in is only being called very infrequently - perhaps once
every 50 toggles on the gpio pin. I need to make sure that it gets
called every time master device calls qemu_set_irq.

What's the mechanism behind this behavior and how can I deliver gpio
change to the slave?
On Tue, Aug 21, 2018 at 3:57 PM Peter Maydell  wrote:
>
> On 21 August 2018 at 14:29, Martin Schroeder via Qemu-devel
>  wrote:
> > I'd like to add a virtual device that is controlled by a couple of
> > GPIO pins on my controller (cortex-m4) and a serial port. I suppose I
> > can derive it from SSISlaveClass to make the new device a serial
> > slave.
> >
> > But how do I connect GPIOs?
> >
> > I want the slave device to be notified when guest firmware toggles a
> > gpio pin through the gpio driver which is an mmio device mapped into
> > the gpio memory area. So the GPIO driver currently keeps the state of
> > the pins internal to the driver. What I would like to do is somehow,
> > without requiring that the GPIO driver knows about the connected slave
> > device, deliver the notification of a gpio pin being toggled to the
> > slave device.
>
> The GPIO device should expose its outbound GPIO lines
> as qdev gpio lines. The slave device should have a GPIO line
> which is an input qdev gpio. The board code then connects the two
> together using
>   qdev_connect_gpio_out(your_gpio_device, i,
> qdev_get_gpio_in(slavedevice, j));
>
> which connects the GPIO controller's output GPIO i to
> slave device's input GPIO j.
>
> There are also _named() versions of these so you can
> give GPIO lines names rather than having them be unnamed
> (which makes the code a bit easier to understand, especially
> where the device isn't a gpio controller whose outputs are
> all just "the GPIO lines").
>
> thanks
> -- PMM



Re: [Qemu-devel] [RFC 00/15] s390: vfio-ccw dasd ipl support

2018-08-22 Thread Cornelia Huck
On Tue, 21 Aug 2018 15:31:55 -0400
"Jason J. Herne"  wrote:

> On 08/15/2018 07:48 AM, Cornelia Huck wrote:
> > On Thu,  5 Jul 2018 13:25:28 -0400
> > "Jason J. Herne"  wrote:
> >   
> >> This is to support booting from vfio-ccw dasd devices. We basically 
> >> implement
> >> the real hardware ipl procedure. This allows for booting Linux guests on
> >> vfio-ccw devices.
> >>
> >> vfio-ccw's channel program prefetch algorithm complicates ipl because most 
> >> ipl
> >> channel programs dynamically modify themselves. Details on the ipl process 
> >> and
> >> how we worked around this issue can be found in 
> >> docs/devel/s390-dasd-ipl.txt.  
> > 
> > Cleaning up my mail backlog... I think there were some comments; will
> > there be a new version forthcoming?
> >   
> 
> Yes there will. We're hitting a hang now and not sure if it is a device, 
> configuration or coding problem. Once I get that cleared up I'll be back 
> for round #2.
> 

Great, thanks for the info!



[Qemu-devel] [PATCH v1 8/8] s390x/tcg: refactor specification checking

2018-08-22 Thread David Hildenbrand
We can fit this nicely into less LOC, without harming readability.

Signed-off-by: David Hildenbrand 
---
 target/s390x/translate.c | 34 ++
 1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 27d2405ef4..3675da1270 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -6053,34 +6053,12 @@ static DisasJumpType translate_one(CPUS390XState *env, 
DisasContext *s)
 
 /* Check for insn specification exceptions.  */
 if (insn->spec) {
-int spec = insn->spec, excp = 0, r;
-
-if (spec & SPEC_r1_even) {
-r = get_field(&f, r1);
-if (r & 1) {
-excp = PGM_SPECIFICATION;
-}
-}
-if (spec & SPEC_r2_even) {
-r = get_field(&f, r2);
-if (r & 1) {
-excp = PGM_SPECIFICATION;
-}
-}
-if (spec & SPEC_r3_even) {
-r = get_field(&f, r3);
-if (r & 1) {
-excp = PGM_SPECIFICATION;
-}
-}
-if ((spec & SPEC_r1_f128) && !is_fp_pair(get_field(&f, r1))) {
-excp = PGM_SPECIFICATION;
-}
-if ((spec & SPEC_r2_f128) && !is_fp_pair(get_field(&f, r2))) {
-excp = PGM_SPECIFICATION;
-}
-if (excp) {
-gen_program_exception(s, excp);
+if (((insn->spec & SPEC_r1_even) && (get_field(&f, r1) & 1)) ||
+((insn->spec & SPEC_r2_even) && (get_field(&f, r2) & 1)) ||
+((insn->spec & SPEC_r3_even) && (get_field(&f, r3) & 1)) ||
+((insn->spec & SPEC_r1_f128) && !is_fp_pair(get_field(&f, r1))) ||
+((insn->spec & SPEC_r2_f128) && !is_fp_pair(get_field(&f, r2 {
+gen_program_exception(s, PGM_SPECIFICATION);
 return DISAS_NORETURN;
 }
 }
-- 
2.17.1




[Qemu-devel] [PATCH v1 7/8] s390x/tcg: fix FP register pair checks

2018-08-22 Thread David Hildenbrand
Valid register pairs are 0/2, 1/3, 4/6, 5/7, 8/10, 9/11, 12/14, 13/15.

R1/R2 always selects the lower number, so the current checks are not
correct as e.g. 2/4 could be selected as a pair.

Signed-off-by: David Hildenbrand 
---
 target/s390x/translate.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 1ca6ef45a1..27d2405ef4 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -1110,7 +1110,7 @@ typedef struct {
 #define IF_HFP3 0x0004  /* r3 points at fp reg for HFP instructions */
 #define IF_BFP  0x0008  /* binary floating point instruction */
 #define IF_DFP  0x0010  /* decimal floating point instruction */
-#define IF_PRIV 0x0020  /* priviledged instruction */
+#define IF_PRIV 0x0020  /* privileged instruction */
 
 struct DisasInsn {
 unsigned opc:16;
@@ -5985,6 +5985,12 @@ static bool is_afp_reg(int reg)
 return reg % 2 || reg > 6;
 }
 
+static bool is_fp_pair(int reg)
+{
+/* 0,1,4,5,8,9,12,13: to exclude the others, check for single bit */
+return !(reg & 0x2);
+}
+
 static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s)
 {
 const DisasInsn *insn;
@@ -6013,7 +6019,7 @@ static DisasJumpType translate_one(CPUS390XState *env, 
DisasContext *s)
 
 /* process flags */
 if (insn->flags) {
-/* priviledged instruction */
+/* privileged instruction */
 if ((s->base.tb->flags & FLAG_MASK_PSTATE) && (insn->flags & IF_PRIV)) 
{
 gen_program_exception(s, PGM_PRIVILEGED);
 return DISAS_NORETURN;
@@ -6067,17 +6073,11 @@ static DisasJumpType translate_one(CPUS390XState *env, 
DisasContext *s)
 excp = PGM_SPECIFICATION;
 }
 }
-if (spec & SPEC_r1_f128) {
-r = get_field(&f, r1);
-if (r > 13) {
-excp = PGM_SPECIFICATION;
-}
+if ((spec & SPEC_r1_f128) && !is_fp_pair(get_field(&f, r1))) {
+excp = PGM_SPECIFICATION;
 }
-if (spec & SPEC_r2_f128) {
-r = get_field(&f, r2);
-if (r > 13) {
-excp = PGM_SPECIFICATION;
-}
+if ((spec & SPEC_r2_f128) && !is_fp_pair(get_field(&f, r2))) {
+excp = PGM_SPECIFICATION;
 }
 if (excp) {
 gen_program_exception(s, excp);
-- 
2.17.1




[Qemu-devel] [PATCH v1 5/8] s390x/tcg: check for AFP-register, BFP and DFP data exceptions

2018-08-22 Thread David Hildenbrand
With the annotated functions, we can now easily check this at a central
place.

DXC 1 is to be injected if an AFP register is used (for a HFP instruction)
when AFP is disabled.
DXC 2 is to be injected if a BFP instruction is used when AFP is
disabled.
DXC § is to be injected if a DFP instruction is used when AFP is
disabled.

Signed-off-by: David Hildenbrand 
---
 target/s390x/translate.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 8322c81e90..a0c834ebb9 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -6055,6 +6055,11 @@ static const DisasInsn *extract_insn(CPUS390XState *env, 
DisasContext *s,
 return info;
 }
 
+static bool is_afp_reg(int reg)
+{
+return reg % 2 || reg > 6;
+}
+
 static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s)
 {
 const DisasInsn *insn;
@@ -6081,6 +6086,34 @@ static DisasJumpType translate_one(CPUS390XState *env, 
DisasContext *s)
 }
 #endif
 
+/* process flags */
+if (insn->flags) {
+/* if AFP is not enabled, instructions and registers are forbidden */
+if (!(s->base.tb->flags & FLAG_MASK_AFP)) {
+uint8_t dxc = 0;
+
+if ((insn->flags & IF_HFP1) && is_afp_reg(get_field(&f, r1))) {
+dxc = 1;
+}
+if ((insn->flags & IF_HFP2) && is_afp_reg(get_field(&f, r2))) {
+dxc = 1;
+}
+if ((insn->flags & IF_HFP3) && is_afp_reg(get_field(&f, r3))) {
+dxc = 1;
+}
+if (insn->flags & IF_BFP) {
+dxc = 2;
+}
+if (insn->flags & IF_DFP) {
+dxc = 3;
+}
+if (dxc) {
+gen_data_exception(dxc);
+return DISAS_NORETURN;
+}
+}
+}
+
 /* Check for insn specification exceptions.  */
 if (insn->spec) {
 int spec = insn->spec, excp = 0, r;
-- 
2.17.1




[Qemu-devel] [PATCH v1 6/8] s390x/tcg: handle privileged instructions via flags

2018-08-22 Thread David Hildenbrand
Let's check this also at a central place.

Signed-off-by: David Hildenbrand 
---
 target/s390x/insn-data.def | 138 ++---
 target/s390x/translate.c   |  83 ++
 2 files changed, 76 insertions(+), 145 deletions(-)

diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 506c3de1d7..fe52d7b81c 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -961,126 +961,126 @@
 
 #ifndef CONFIG_USER_ONLY
 /* COMPARE AND SWAP AND PURGE */
-D(0xb250, CSP, RRE,   Z,   r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL)
-D(0xb98a, CSPG,RRE, DAT_ENH, r1_o, ra2, r1_P, 0, csp, 0, MO_TEQ)
+E(0xb250, CSP, RRE,   Z,   r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL, 
IF_PRIV)
+E(0xb98a, CSPG,RRE, DAT_ENH, r1_o, ra2, r1_P, 0, csp, 0, MO_TEQ, 
IF_PRIV)
 /* DIAGNOSE (KVM hypercall) */
-C(0x8300, DIAG,RSI,   Z,   0, 0, 0, 0, diag, 0)
+F(0x8300, DIAG,RSI,   Z,   0, 0, 0, 0, diag, 0, IF_PRIV)
 /* INSERT STORAGE KEY EXTENDED */
-C(0xb229, ISKE,RRE,   Z,   0, r2_o, new, r1_8, iske, 0)
+F(0xb229, ISKE,RRE,   Z,   0, r2_o, new, r1_8, iske, 0, IF_PRIV)
 /* INVALIDATE DAT TABLE ENTRY */
-C(0xb98e, IPDE,RRF_b, Z,   r1_o, r2_o, 0, 0, idte, 0)
+F(0xb98e, IPDE,RRF_b, Z,   r1_o, r2_o, 0, 0, idte, 0, IF_PRIV)
 /* INVALIDATE PAGE TABLE ENTRY */
-C(0xb221, IPTE,RRF_a, Z,   r1_o, r2_o, 0, 0, ipte, 0)
+F(0xb221, IPTE,RRF_a, Z,   r1_o, r2_o, 0, 0, ipte, 0, IF_PRIV)
 /* LOAD CONTROL */
-C(0xb700, LCTL,RS_a,  Z,   0, a2, 0, 0, lctl, 0)
-C(0xeb2f, LCTLG,   RSY_a, Z,   0, a2, 0, 0, lctlg, 0)
+F(0xb700, LCTL,RS_a,  Z,   0, a2, 0, 0, lctl, 0, IF_PRIV)
+F(0xeb2f, LCTLG,   RSY_a, Z,   0, a2, 0, 0, lctlg, 0, IF_PRIV)
 /* LOAD PROGRAM PARAMETER */
-C(0xb280, LPP, S,   LPP,   0, m2_64, 0, 0, lpp, 0)
+F(0xb280, LPP, S,   LPP,   0, m2_64, 0, 0, lpp, 0, IF_PRIV)
 /* LOAD PSW */
-C(0x8200, LPSW,S, Z,   0, a2, 0, 0, lpsw, 0)
+F(0x8200, LPSW,S, Z,   0, a2, 0, 0, lpsw, 0, IF_PRIV)
 /* LOAD PSW EXTENDED */
-C(0xb2b2, LPSWE,   S, Z,   0, a2, 0, 0, lpswe, 0)
+F(0xb2b2, LPSWE,   S, Z,   0, a2, 0, 0, lpswe, 0, IF_PRIV)
 /* LOAD REAL ADDRESS */
-C(0xb100, LRA, RX_a,  Z,   0, a2, r1, 0, lra, 0)
-C(0xe313, LRAY,RXY_a, LD,  0, a2, r1, 0, lra, 0)
-C(0xe303, LRAG,RXY_a, Z,   0, a2, r1, 0, lra, 0)
+F(0xb100, LRA, RX_a,  Z,   0, a2, r1, 0, lra, 0, IF_PRIV)
+F(0xe313, LRAY,RXY_a, LD,  0, a2, r1, 0, lra, 0, IF_PRIV)
+F(0xe303, LRAG,RXY_a, Z,   0, a2, r1, 0, lra, 0, IF_PRIV)
 /* LOAD USING REAL ADDRESS */
-C(0xb24b, LURA,RRE,   Z,   0, r2, new, r1_32, lura, 0)
-C(0xb905, LURAG,   RRE,   Z,   0, r2, r1, 0, lurag, 0)
+F(0xb24b, LURA,RRE,   Z,   0, r2, new, r1_32, lura, 0, IF_PRIV)
+F(0xb905, LURAG,   RRE,   Z,   0, r2, r1, 0, lurag, 0, IF_PRIV)
 /* MOVE TO PRIMARY */
-C(0xda00, MVCP,SS_d,  Z,   la1, a2, 0, 0, mvcp, 0)
+F(0xda00, MVCP,SS_d,  Z,   la1, a2, 0, 0, mvcp, 0, IF_PRIV)
 /* MOVE TO SECONDARY */
-C(0xdb00, MVCS,SS_d,  Z,   la1, a2, 0, 0, mvcs, 0)
+F(0xdb00, MVCS,SS_d,  Z,   la1, a2, 0, 0, mvcs, 0, IF_PRIV)
 /* PURGE TLB */
-C(0xb20d, PTLB,S, Z,   0, 0, 0, 0, ptlb, 0)
+F(0xb20d, PTLB,S, Z,   0, 0, 0, 0, ptlb, 0, IF_PRIV)
 /* RESET REFERENCE BIT EXTENDED */
-C(0xb22a, RRBE,RRE,   Z,   0, r2_o, 0, 0, rrbe, 0)
+F(0xb22a, RRBE,RRE,   Z,   0, r2_o, 0, 0, rrbe, 0, IF_PRIV)
 /* SERVICE CALL LOGICAL PROCESSOR (PV hypercall) */
-C(0xb220, SERVC,   RRE,   Z,   r1_o, r2_o, 0, 0, servc, 0)
+F(0xb220, SERVC,   RRE,   Z,   r1_o, r2_o, 0, 0, servc, 0, IF_PRIV)
 /* SET ADDRESS SPACE CONTROL FAST */
-C(0xb279, SACF,S, Z,   0, a2, 0, 0, sacf, 0)
+F(0xb279, SACF,S, Z,   0, a2, 0, 0, sacf, 0, IF_PRIV)
 /* SET CLOCK */
-C(0xb204, SCK, S, Z,   la2, 0, 0, 0, sck, 0)
+F(0xb204, SCK, S, Z,   la2, 0, 0, 0, sck, 0, IF_PRIV)
 /* SET CLOCK COMPARATOR */
-C(0xb206, SCKC,S, Z,   0, m2_64a, 0, 0, sckc, 0)
+F(0xb206, SCKC,S, Z,   0, m2_64a, 0, 0, sckc, 0, IF_PRIV)
 /* SET CLOCK PROGRAMMABLE FIELD */
-C(0x0107, SCKPF,   E, Z,   0, 0, 0, 0, sckpf, 0)
+F(0x0107, SCKPF,   E, Z,   0, 0, 0, 0, sckpf, 0, IF_PRIV)
 /* SET CPU TIMER */
-C(0xb208, SPT, S, Z,   0, m2_64a, 0, 0, spt, 0)
+F(0xb208, SPT, S, Z,   0, m2_64a, 0, 0, spt, 0, IF_PRIV)
 /* SET PREFIX */
-C(0xb210, SPX, S, Z,   0, m2_32ua, 0, 0, spx, 0)
+F(0xb210, SPX, S, Z,   0, m2_32ua, 0, 0, spx, 0, IF_PRIV)
 /* SET PSW KEY FROM ADDRESS */
-C(0xb20a, SPKA,S, Z,   0, a2, 0, 0, spka, 0)
+F(0xb20a, SPKA,S, Z,   0, a2, 0, 0, spka, 0, IF_PRIV)
 /* SET STORAGE KEY EXTENDED */
-C(0xb22b, SSKE,RRF_c, Z,   r1_o, r2_o, 0, 0, sske, 0)
+F(0xb22b, SSKE,RRF_c, Z,   r1_o, r2_o, 0, 0, sske, 0, IF_PRIV)
 /* SET SYSTEM M

[Qemu-devel] [PATCH v1 3/8] s390x/tcg: support flags for instructions

2018-08-22 Thread David Hildenbrand
Storing flags for instructions allows us to efficiently verify certain
properties at a central point. Examples might later be handling if
AFP is disabled in CR0, we are not in problem state, or if vector
instructions are disabled in CR0.

Signed-off-by: David Hildenbrand 
---
 target/s390x/insn-data.def |  3 +++
 target/s390x/translate.c   | 22 --
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 5c6f33ed9c..ff4a6ceaf5 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -3,6 +3,8 @@
  *
  *  C(OPC,NAME,FMT,   FAC, I1, I2, P, W, OP, CC)
  *  D(OPC,NAME,FMT,   FAC, I1, I2, P, W, OP, CC, DATA)
+ *  E(OPC,NAME,FMT,   FAC, I1, I2, P, W, OP, CC, DATA, FLAGS)
+ *  F(OPC,NAME,FMT,   FAC, I1, I2, P, W, OP, CC, FLAGS)
  *
  *  OPC  = (op << 8) | op2 where op is the major, op2 the minor opcode
  *  NAME = name of the opcode, used internally
@@ -15,6 +17,7 @@
  *  OP   = func op_xx does the bulk of the operation
  *  CC   = func cout_xx defines how cc should get set
  *  DATA = immediate argument to op_xx function
+ *  FLAGS = categorize the type of instruction (e.g. for advanced checks)
  *
  *  The helpers get called in order: I1, I2, P, OP, W, CC
  */
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index fa8468f0e1..e9cbeb2a1b 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -1114,6 +1114,7 @@ typedef struct {
 
 struct DisasInsn {
 unsigned opc:16;
+unsigned flags:16;
 DisasFormat fmt:8;
 unsigned fac:8;
 unsigned spec:8;
@@ -5796,17 +5797,24 @@ static void in2_insn(DisasContext *s, DisasFields *f, 
DisasOps *o)
search tree, rather than us having to post-process the table.  */
 
 #define C(OPC, NM, FT, FC, I1, I2, P, W, OP, CC) \
-D(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, 0)
+E(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, 0, 0)
 
-#define D(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D) insn_ ## NM,
+#define D(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D) \
+E(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D, 0)
+
+#define F(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, FL) \
+E(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, 0, FL)
+
+#define E(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D, FL) insn_ ## NM,
 
 enum DisasInsnEnum {
 #include "insn-data.def"
 };
 
-#undef D
-#define D(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D) {   \
+#undef E
+#define E(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D, FL) {   \
 .opc = OPC, \
+.flags = FL,\
 .fmt = FMT_##FT,\
 .fac = FAC_##FC,\
 .spec = SPEC_in1_##I1 | SPEC_in2_##I2 | SPEC_prep_##P | SPEC_wout_##W,  \
@@ -5877,8 +5885,8 @@ static const DisasInsn insn_info[] = {
 #include "insn-data.def"
 };
 
-#undef D
-#define D(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D) \
+#undef E
+#define E(OPC, NM, FT, FC, I1, I2, P, W, OP, CC, D, FL) \
 case OPC: return &insn_info[insn_ ## NM];
 
 static const DisasInsn *lookup_opc(uint16_t opc)
@@ -5890,6 +5898,8 @@ static const DisasInsn *lookup_opc(uint16_t opc)
 }
 }
 
+#undef F
+#undef E
 #undef D
 #undef C
 
-- 
2.17.1




[Qemu-devel] [PATCH v1 2/8] s390x/tcg: store in the TB flags if AFP is enabled

2018-08-22 Thread David Hildenbrand
We exit the TB when changing the control registers, so just like PSW
bits, this should always be consistent for a TB.

Using the PSW bit semantic makes things a lot easier compared to
manually defining the sapre, shifted bits.

Signed-off-by: David Hildenbrand 
---
 target/s390x/cpu.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 5e50c3a303..8c2320e882 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -255,6 +255,7 @@ extern const struct VMStateDescription vmstate_s390_cpu;
 
 /* PSW defines */
 #undef PSW_MASK_PER
+#undef PSW_MASK_UNUSED_2
 #undef PSW_MASK_DAT
 #undef PSW_MASK_IO
 #undef PSW_MASK_EXT
@@ -273,6 +274,7 @@ extern const struct VMStateDescription vmstate_s390_cpu;
 #undef PSW_MASK_ESA_ADDR
 
 #define PSW_MASK_PER0x4000ULL
+#define PSW_MASK_UNUSED_2   0x2000ULL
 #define PSW_MASK_DAT0x0400ULL
 #define PSW_MASK_IO 0x0200ULL
 #define PSW_MASK_EXT0x0100ULL
@@ -318,6 +320,9 @@ extern const struct VMStateDescription vmstate_s390_cpu;
 #define FLAG_MASK_PSW   (FLAG_MASK_PER | FLAG_MASK_DAT | 
FLAG_MASK_PSTATE \
 | FLAG_MASK_ASC | FLAG_MASK_64 | FLAG_MASK_32)
 
+/* we'll use some unused PSW positions to store CR flags in tb flags */
+#define FLAG_MASK_AFP   (PSW_MASK_UNUSED_2 >> FLAG_MASK_PSW_SHIFT)
+
 /* Control register 0 bits */
 #define CR0_LOWPROT 0x1000ULL
 #define CR0_SECONDARY   0x0400ULL
@@ -364,6 +369,9 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState* env, 
target_ulong *pc,
 *pc = env->psw.addr;
 *cs_base = env->ex_value;
 *flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;
+if (env->cregs[0] & CR0_AFP) {
+*flags |= FLAG_MASK_AFP;
+}
 }
 
 /* PER bits from control register 9 */
-- 
2.17.1




[Qemu-devel] [PATCH v1 1/8] s390x/tcg: factor out and fix DATA exception injection

2018-08-22 Thread David Hildenbrand
The DXC is to be stored in the low core, and only in the FPC in case AFP
is enabled in CR0.

Signed-off-by: David Hildenbrand 
---
 target/s390x/cpu.h |  1 +
 target/s390x/excp_helper.c | 28 
 target/s390x/fpu_helper.c  | 13 +++--
 target/s390x/helper.h  |  1 +
 target/s390x/tcg_s390x.h   |  2 ++
 target/s390x/translate.c   | 19 +--
 6 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 6f8861e554..5e50c3a303 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -322,6 +322,7 @@ extern const struct VMStateDescription vmstate_s390_cpu;
 #define CR0_LOWPROT 0x1000ULL
 #define CR0_SECONDARY   0x0400ULL
 #define CR0_EDAT0x0080ULL
+#define CR0_AFP 0x0004ULL
 #define CR0_EMERGENCY_SIGNAL_SC 0x4000ULL
 #define CR0_EXTERNAL_CALL_SC0x2000ULL
 #define CR0_CKC_SC  0x0800ULL
diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
index f0ce60cff2..f5cab94ec5 100644
--- a/target/s390x/excp_helper.c
+++ b/target/s390x/excp_helper.c
@@ -21,11 +21,13 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "internal.h"
+#include "exec/helper-proto.h"
 #include "qemu/timer.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "hw/s390x/ioinst.h"
 #include "exec/address-spaces.h"
+#include "tcg_s390x.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu/sysemu.h"
 #include "hw/s390x/s390_flic.h"
@@ -48,6 +50,32 @@
 do { } while (0)
 #endif
 
+void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
+   uintptr_t ra)
+{
+CPUState *cs = CPU(s390_env_get_cpu(env));
+
+g_assert(!(dxc & ~0xff));
+#if !defined(CONFIG_USER_ONLY)
+/* Store the DXC into the lowcore */
+stw_phys(cs->as, env->psa + offsetof(LowCore, data_exc_code), dxc);
+#endif
+
+/* Store the DXC into the FPC if AFP is enabled */
+if (env->cregs[0] & CR0_AFP) {
+env->fpc = (env->fpc & ~0xff00) | (dxc << 8);
+}
+s390_program_interrupt(env, PGM_DATA, ILEN_AUTO, ra);
+
+/* the following is not necessary, but allows us to use noreturn */
+cpu_loop_exit_restore(cs, ra);
+}
+
+void HELPER(data_exception)(CPUS390XState *env, uint32_t dxc)
+{
+tcg_s390_data_exception(env, dxc, GETPC());
+}
+
 #if defined(CONFIG_USER_ONLY)
 
 void s390_cpu_do_interrupt(CPUState *cs)
diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c
index 5c5b451b3b..1b662d2520 100644
--- a/target/s390x/fpu_helper.c
+++ b/target/s390x/fpu_helper.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "internal.h"
+#include "tcg_s390x.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/helper-proto.h"
@@ -40,14 +41,6 @@
  ? (mask / (from / to)) & to\
  : (mask & from) * (to / from))
 
-static void ieee_exception(CPUS390XState *env, uint32_t dxc, uintptr_t retaddr)
-{
-/* Install the DXC code.  */
-env->fpc = (env->fpc & ~0xff00) | (dxc << 8);
-/* Trap.  */
-s390_program_interrupt(env, PGM_DATA, ILEN_AUTO, retaddr);
-}
-
 /* Should be called after any operation that may raise IEEE exceptions.  */
 static void handle_exceptions(CPUS390XState *env, uintptr_t retaddr)
 {
@@ -75,7 +68,7 @@ static void handle_exceptions(CPUS390XState *env, uintptr_t 
retaddr)
 /* Send signals for enabled exceptions.  */
 s390_exc &= env->fpc >> 24;
 if (s390_exc) {
-ieee_exception(env, s390_exc, retaddr);
+tcg_s390_data_exception(env, s390_exc, retaddr);
 }
 }
 
@@ -773,6 +766,6 @@ void HELPER(sfas)(CPUS390XState *env, uint64_t val)
is also 1, a simulated-iee-exception trap occurs.  */
 s390_exc = (signalling >> 16) & (source >> 24);
 if (s390_exc) {
-ieee_exception(env, s390_exc | 3, GETPC());
+tcg_s390_data_exception(env, s390_exc | 3, GETPC());
 }
 }
diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index 97c60ca7bc..018e9dd414 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -1,4 +1,5 @@
 DEF_HELPER_2(exception, noreturn, env, i32)
+DEF_HELPER_2(data_exception, noreturn, env, i32)
 DEF_HELPER_FLAGS_4(nc, TCG_CALL_NO_WG, i32, env, i32, i64, i64)
 DEF_HELPER_FLAGS_4(oc, TCG_CALL_NO_WG, i32, env, i32, i64, i64)
 DEF_HELPER_FLAGS_4(xc, TCG_CALL_NO_WG, i32, env, i32, i64, i64)
diff --git a/target/s390x/tcg_s390x.h b/target/s390x/tcg_s390x.h
index 4e308aa0ce..f2c88d7402 100644
--- a/target/s390x/tcg_s390x.h
+++ b/target/s390x/tcg_s390x.h
@@ -14,5 +14,7 @@
 #define TCG_S390X_H
 
 void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque);
+void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
+   uintptr_t ra);
 
 #endif /* TCG_S390X_H */
diff --git a/target/s390x/translate.c b/target/s

[Qemu-devel] [PULL 02/19] check: Only test ne2000 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index b68555e94a..24c8a9b24c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -222,8 +222,8 @@ gcov-files-pci-y += hw/net/pcnet.c
 gcov-files-pci-y += hw/net/pcnet-pci.c
 check-qtest-pci-y += tests/eepro100-test$(EXESUF)
 gcov-files-pci-y += hw/net/eepro100.c
-check-qtest-pci-y += tests/ne2000-test$(EXESUF)
-gcov-files-pci-y += hw/net/ne2000.c
+check-qtest-pci-$(CONFIG_NE2000_PCI) += tests/ne2000-test$(EXESUF)
+gcov-files-pci-$(CONFIG_NE2000_PCI) += hw/net/ne2000.c
 check-qtest-pci-y += tests/nvme-test$(EXESUF)
 gcov-files-pci-y += hw/block/nvme.c
 check-qtest-pci-y += tests/ac97-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH v1 4/8] s390x/tcg: add instruction flags for floating point instructions

2018-08-22 Thread David Hildenbrand
These flags allow us to later on detect if a DATA program interrupt
is to be injected, and which DXC (1,2,3) is to be used.

Interestingly, some support FP instructions are considered as HFP
instructions (I assume simply because they were available very early).

Signed-off-by: David Hildenbrand 
---
 target/s390x/insn-data.def | 254 ++---
 target/s390x/translate.c   |   8 ++
 2 files changed, 135 insertions(+), 127 deletions(-)

diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index ff4a6ceaf5..506c3de1d7 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -32,11 +32,11 @@
 C(0xb9e8, AGRK,RRF_a, DO,  r2, r3, r1, 0, add, adds64)
 C(0xe308, AG,  RXY_a, Z,   r1, m2_64, r1, 0, add, adds64)
 C(0xe318, AGF, RXY_a, Z,   r1, m2_32s, r1, 0, add, adds64)
-C(0xb30a, AEBR,RRE,   Z,   e1, e2, new, e1, aeb, f32)
-C(0xb31a, ADBR,RRE,   Z,   f1_o, f2_o, f1, 0, adb, f64)
-C(0xb34a, AXBR,RRE,   Z,   0, x2_o, x1, 0, axb, f128)
-C(0xed0a, AEB, RXE,   Z,   e1, m2_32u, new, e1, aeb, f32)
-C(0xed1a, ADB, RXE,   Z,   f1_o, m2_64, f1, 0, adb, f64)
+F(0xb30a, AEBR,RRE,   Z,   e1, e2, new, e1, aeb, f32, IF_BFP)
+F(0xb31a, ADBR,RRE,   Z,   f1_o, f2_o, f1, 0, adb, f64, IF_BFP)
+F(0xb34a, AXBR,RRE,   Z,   0, x2_o, x1, 0, axb, f128, IF_BFP)
+F(0xed0a, AEB, RXE,   Z,   e1, m2_32u, new, e1, aeb, f32, IF_BFP)
+F(0xed1a, ADB, RXE,   Z,   f1_o, m2_64, f1, 0, adb, f64, IF_BFP)
 /* ADD HIGH */
 C(0xb9c8, AHHHR,   RRF_a, HW,  r2_sr32, r3_sr32, new, r1_32h, add, adds32)
 C(0xb9d8, AHHLR,   RRF_a, HW,  r2_sr32, r3, new, r1_32h, add, adds32)
@@ -151,7 +151,7 @@
 C(0xb241, CKSM,RRE,   Z,   r1_o, ra2, new, r1_32, cksm, 0)
 
 /* COPY SIGN */
-C(0xb372, CPSDR,   RRF_b, FPSSH, f3_o, f2_o, f1, 0, cps, 0)
+F(0xb372, CPSDR,   RRF_b, FPSSH, f3_o, f2_o, f1, 0, cps, 0, IF_HFP1 | 
IF_HFP2 | IF_HFP3)
 
 /* COMPARE */
 C(0x1900, CR,  RR_a,  Z,   r1_o, r2_o, 0, 0, 0, cmps32)
@@ -161,17 +161,17 @@
 C(0xb930, CGFR,RRE,   Z,   r1_o, r2_32s, 0, 0, 0, cmps64)
 C(0xe320, CG,  RXY_a, Z,   r1_o, m2_64, 0, 0, 0, cmps64)
 C(0xe330, CGF, RXY_a, Z,   r1_o, m2_32s, 0, 0, 0, cmps64)
-C(0xb309, CEBR,RRE,   Z,   e1, e2, 0, 0, ceb, 0)
-C(0xb319, CDBR,RRE,   Z,   f1_o, f2_o, 0, 0, cdb, 0)
-C(0xb349, CXBR,RRE,   Z,   x1_o, x2_o, 0, 0, cxb, 0)
-C(0xed09, CEB, RXE,   Z,   e1, m2_32u, 0, 0, ceb, 0)
-C(0xed19, CDB, RXE,   Z,   f1_o, m2_64, 0, 0, cdb, 0)
+F(0xb309, CEBR,RRE,   Z,   e1, e2, 0, 0, ceb, 0, IF_BFP)
+F(0xb319, CDBR,RRE,   Z,   f1_o, f2_o, 0, 0, cdb, 0, IF_BFP)
+F(0xb349, CXBR,RRE,   Z,   x1_o, x2_o, 0, 0, cxb, 0, IF_BFP)
+F(0xed09, CEB, RXE,   Z,   e1, m2_32u, 0, 0, ceb, 0, IF_BFP)
+F(0xed19, CDB, RXE,   Z,   f1_o, m2_64, 0, 0, cdb, 0, IF_BFP)
 /* COMPARE AND SIGNAL */
-C(0xb308, KEBR,RRE,   Z,   e1, e2, 0, 0, keb, 0)
-C(0xb318, KDBR,RRE,   Z,   f1_o, f2_o, 0, 0, kdb, 0)
-C(0xb348, KXBR,RRE,   Z,   x1_o, x2_o, 0, 0, kxb, 0)
-C(0xed08, KEB, RXE,   Z,   e1, m2_32u, 0, 0, keb, 0)
-C(0xed18, KDB, RXE,   Z,   f1_o, m2_64, 0, 0, kdb, 0)
+F(0xb308, KEBR,RRE,   Z,   e1, e2, 0, 0, keb, 0, IF_BFP)
+F(0xb318, KDBR,RRE,   Z,   f1_o, f2_o, 0, 0, kdb, 0, IF_BFP)
+F(0xb348, KXBR,RRE,   Z,   x1_o, x2_o, 0, 0, kxb, 0, IF_BFP)
+F(0xed08, KEB, RXE,   Z,   e1, m2_32u, 0, 0, keb, 0, IF_BFP)
+F(0xed18, KDB, RXE,   Z,   f1_o, m2_64, 0, 0, kdb, 0, IF_BFP)
 /* COMPARE IMMEDIATE */
 C(0xc20d, CFI, RIL_a, EI,  r1, i2, 0, 0, 0, cmps32)
 C(0xc20c, CGFI,RIL_a, EI,  r1, i2, 0, 0, 0, cmps64)
@@ -288,33 +288,33 @@
 C(0x4e00, CVD, RX_a,  Z,   r1_o, a2, 0, 0, cvd, 0)
 C(0xe326, CVDY,RXY_a, LD,  r1_o, a2, 0, 0, cvd, 0)
 /* CONVERT TO FIXED */
-C(0xb398, CFEBR,   RRF_e, Z,   0, e2, new, r1_32, cfeb, 0)
-C(0xb399, CFDBR,   RRF_e, Z,   0, f2_o, new, r1_32, cfdb, 0)
-C(0xb39a, CFXBR,   RRF_e, Z,   0, x2_o, new, r1_32, cfxb, 0)
-C(0xb3a8, CGEBR,   RRF_e, Z,   0, e2, r1, 0, cgeb, 0)
-C(0xb3a9, CGDBR,   RRF_e, Z,   0, f2_o, r1, 0, cgdb, 0)
-C(0xb3aa, CGXBR,   RRF_e, Z,   0, x2_o, r1, 0, cgxb, 0)
+F(0xb398, CFEBR,   RRF_e, Z,   0, e2, new, r1_32, cfeb, 0, IF_BFP)
+F(0xb399, CFDBR,   RRF_e, Z,   0, f2_o, new, r1_32, cfdb, 0, IF_BFP)
+F(0xb39a, CFXBR,   RRF_e, Z,   0, x2_o, new, r1_32, cfxb, 0, IF_BFP)
+F(0xb3a8, CGEBR,   RRF_e, Z,   0, e2, r1, 0, cgeb, 0, IF_BFP)
+F(0xb3a9, CGDBR,   RRF_e, Z,   0, f2_o, r1, 0, cgdb, 0, IF_BFP)
+F(0xb3aa, CGXBR,   RRF_e, Z,   0, x2_o, r1, 0, cgxb, 0, IF_BFP)
 /* CONVERT FROM FIXED */
-C(0xb394, CEFBR,   RRF_e, Z,   0, r2_32s, new, e1, cegb, 0)
-C(0xb395, CDFBR,   RRF_e, Z,   0, r2_32s, f1, 0, cdgb, 0)
-C(0xb396, CXFBR,   RRF_e, Z,   0, r2_32s, x1, 0, cxgb, 0)
-C(0xb3a4, CEGBR,   RRF_e, Z,   0, r2_o, new

[Qemu-devel] [PULL 00/19] Be able to disable several devices

2018-08-22 Thread Juan Quintela
The following changes since commit 13b7b188501d419a7d63c016e00065bcc693b7d4:

  Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180821-pull-request' 
into staging (2018-08-21 15:57:56 +0100)

are available in the Git repository at:

  git://github.com/juanquintela/qemu.git tags/check/20180822

for you to fetch changes up to 889d52a243fb6f1d19c92dec2c8055a7f4efbe22:

  check: Only test tpm devices when they are compiled in (2018-08-21 19:52:16 
+0200)


check/next for 20180822

This patch series enable the disable of several devices, and if they
are disabled, the checks for those devices are also disable.

This are only the parts that have been reviewed.  The rest of them
will be posted when all comments from reviews have been addressed.

As you can see, this only touches tests/Makefile.include

The changes for pvpanic are to make it the same that other devices.

Please apply, Juan.


Juan Quintela (19):
  check: Only test vmxnet3 when it is compiled in
  check: Only test ne2000 when it is compiled in
  check: Only test eepro100 when it is compiled in
  check: Only test pcnet when it is compiled in
  check: Only test rtl8139 when it is compiled in
  check: Only test es1370 when it is compiled in
  check: Only test ac97 when it is compiled in
  check: Only test hda when it is compiled in
  check: Only test ipack when it is compiled in
  check: Only test ioh3420 when it is compiled in
  check: Only test i82801b11 when it is compiled in
  check: Only test sdhci when it is compiled in
  check: Only test wdt_ib700 when it is compiled in
  check: Only test pvpanic when it is compiled in
  check: Only test nvme when it is compiled in
  check: Only test usb-ohci when it is compiled in
  check: Only test usb-uhci devices when they are compiled in
  check: Only test usb-ehci when it is compiled in
  check: Only test tpm devices when they are compiled in

 hw/misc/pvpanic.c |  11 -
 include/hw/misc/pvpanic.h |  11 -
 tests/Makefile.include| 100 +++---
 3 files changed, 61 insertions(+), 61 deletions(-)



[Qemu-devel] [PATCH v1 0/8] s390x/tcg: instruction flags and AFP registers

2018-08-22 Thread David Hildenbrand
I wanted to add AFP-register control related checks for a long time.
However, doing these checks in each and every relevant handler is ugly.

As I will need similar checks for vector instructions (yes, I'm looking into
that but it might take some time), I decided to introduce per-instruction
flags, that allow to to check such "instruction properties" globally.
Tagging e.g. privileged instructions that way turns out quite nice.

Of course, while at it some fixes and cleanups.

David Hildenbrand (8):
  s390x/tcg: factor out and fix DATA exception injection
  s390x/tcg: store in the TB flags if AFP is enabled
  s390x/tcg: support flags for instructions
  s390x/tcg: add instruction flags for floating point instructions
  s390x/tcg: check for AFP-register, BFP and DFP data exceptions
  s390x/tcg: handle privileged instructions via flags
  s390x/tcg: fix FP register pair checks
  s390x/tcg: refactor specification checking

 target/s390x/cpu.h |   9 +
 target/s390x/excp_helper.c |  28 +++
 target/s390x/fpu_helper.c  |  13 +-
 target/s390x/helper.h  |   1 +
 target/s390x/insn-data.def | 395 +++--
 target/s390x/tcg_s390x.h   |   2 +
 target/s390x/translate.c   | 197 --
 7 files changed, 320 insertions(+), 325 deletions(-)

-- 
2.17.1




[Qemu-devel] [PULL 01/19] check: Only test vmxnet3 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 760a0f18b6..b68555e94a 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -272,8 +272,8 @@ check-qtest-i386-y += tests/tco-test$(EXESUF)
 gcov-files-i386-y += hw/watchdog/watchdog.c hw/watchdog/wdt_ib700.c
 check-qtest-i386-y += $(check-qtest-pci-y)
 gcov-files-i386-y += $(gcov-files-pci-y)
-check-qtest-i386-y += tests/vmxnet3-test$(EXESUF)
-gcov-files-i386-y += hw/net/vmxnet3.c
+check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
+gcov-files-i386-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
 gcov-files-i386-y += hw/net/net_rx_pkt.c
 gcov-files-i386-y += hw/net/net_tx_pkt.c
 check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 07/19] check: Only test ac97 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 386e3db7d7..e90a8a251c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -226,8 +226,8 @@ check-qtest-pci-$(CONFIG_NE2000_PCI) += 
tests/ne2000-test$(EXESUF)
 gcov-files-pci-$(CONFIG_NE2000_PCI) += hw/net/ne2000.c
 check-qtest-pci-y += tests/nvme-test$(EXESUF)
 gcov-files-pci-y += hw/block/nvme.c
-check-qtest-pci-y += tests/ac97-test$(EXESUF)
-gcov-files-pci-y += hw/audio/ac97.c
+check-qtest-pci-$(CONFIG_AC97) += tests/ac97-test$(EXESUF)
+gcov-files-pci-$(CONFIG_AC97) += hw/audio/ac97.c
 check-qtest-pci-$(CONFIG_ES1370) += tests/es1370-test$(EXESUF)
 gcov-files-pci-$(CONFIG_ES1370) += hw/audio/es1370.c
 check-qtest-pci-y += $(check-qtest-virtio-y)
-- 
2.17.1




[Qemu-devel] [PULL 03/19] check: Only test eepro100 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 24c8a9b24c..b90041 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -220,8 +220,8 @@ gcov-files-pci-y += hw/net/rtl8139.c
 check-qtest-pci-y += tests/pcnet-test$(EXESUF)
 gcov-files-pci-y += hw/net/pcnet.c
 gcov-files-pci-y += hw/net/pcnet-pci.c
-check-qtest-pci-y += tests/eepro100-test$(EXESUF)
-gcov-files-pci-y += hw/net/eepro100.c
+check-qtest-pci-$(CONFIG_EEPRO100_PCI) += tests/eepro100-test$(EXESUF)
+gcov-files-pci-$(CONFIG_EEPRO100_PCI) += hw/net/eepro100.c
 check-qtest-pci-$(CONFIG_NE2000_PCI) += tests/ne2000-test$(EXESUF)
 gcov-files-pci-$(CONFIG_NE2000_PCI) += hw/net/ne2000.c
 check-qtest-pci-y += tests/nvme-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 05/19] check: Only test rtl8139 when it is compiled in

2018-08-22 Thread Juan Quintela
test-file-redirector uses rtl8139 in everything except s390.

Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 0a7101c0bf..bac1a7efe0 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -215,8 +215,8 @@ check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
 check-qtest-pci-y += tests/e1000e-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000e.c hw/net/e1000e_core.c
-check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
-gcov-files-pci-y += hw/net/rtl8139.c
+check-qtest-pci-$(CONFIG_RTL8139_PCI) += tests/rtl8139-test$(EXESUF)
+gcov-files-pci-$(CONFIG_RTL8139_PCI) += hw/net/rtl8139.c
 check-qtest-pci-$(CONFIG_PCNET_PCI) += tests/pcnet-test$(EXESUF)
 gcov-files-pci-$(CONFIG_PCNET_PCI) += hw/net/pcnet.c
 gcov-files-pci-$(CONFIG_PCNET_PCI) += hw/net/pcnet-pci.c
@@ -306,7 +306,7 @@ check-qtest-i386-$(CONFIG_TPM) += 
tests/tpm-tis-swtpm-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-tis-test$(EXESUF)
 check-qtest-i386-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-i386-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
-check-qtest-i386-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
+check-qtest-i386-$(CONFIG_RTL8139_PCI) += tests/test-filter-redirector$(EXESUF)
 check-qtest-i386-y += tests/migration-test$(EXESUF)
 check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF)
 check-qtest-i386-y += tests/numa-test$(EXESUF)
@@ -356,7 +356,7 @@ gcov-files-ppc64-y += hw/usb/hcd-xhci.c
 check-qtest-ppc64-y += $(check-qtest-virtio-y)
 check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-ppc64-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
-check-qtest-ppc64-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
+check-qtest-ppc64-$(CONFIG_RTL8139_PCI) += 
tests/test-filter-redirector$(EXESUF)
 check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
 check-qtest-ppc64-y += tests/numa-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 10/19] check: Only test ioh3420 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 7d13966055..7891e27849 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -280,8 +280,8 @@ check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
 check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
 gcov-files-i386-y += hw/pci-bridge/i82801b11.c
-check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
-gcov-files-i386-y += hw/pci-bridge/ioh3420.c
+check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
+gcov-files-i386-$(CONFIG_IOH3420) += hw/pci-bridge/ioh3420.c
 check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ohci.c
 check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 06/19] check: Only test es1370 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index bac1a7efe0..386e3db7d7 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -228,8 +228,8 @@ check-qtest-pci-y += tests/nvme-test$(EXESUF)
 gcov-files-pci-y += hw/block/nvme.c
 check-qtest-pci-y += tests/ac97-test$(EXESUF)
 gcov-files-pci-y += hw/audio/ac97.c
-check-qtest-pci-y += tests/es1370-test$(EXESUF)
-gcov-files-pci-y += hw/audio/es1370.c
+check-qtest-pci-$(CONFIG_ES1370) += tests/es1370-test$(EXESUF)
+gcov-files-pci-$(CONFIG_ES1370) += hw/audio/es1370.c
 check-qtest-pci-y += $(check-qtest-virtio-y)
 gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
 check-qtest-pci-y += tests/tpci200-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 14/19] check: Only test pvpanic when it is compiled in

2018-08-22 Thread Juan Quintela
It was not possible to compile out pvpanic.  Use the same trick
than applesmc.

Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 hw/misc/pvpanic.c | 11 ---
 include/hw/misc/pvpanic.h | 11 ++-
 tests/Makefile.include|  4 ++--
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index b26250dec9..9d8961ba0c 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -99,17 +99,6 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error 
**errp)
 isa_register_ioport(d, &s->io, s->ioport);
 }
 
-#define PVPANIC_IOPORT_PROP "ioport"
-
-uint16_t pvpanic_port(void)
-{
-Object *o = object_resolve_path_type("", TYPE_PVPANIC, NULL);
-if (!o) {
-return 0;
-}
-return object_property_get_uint(o, PVPANIC_IOPORT_PROP, NULL);
-}
-
 static Property pvpanic_isa_properties[] = {
 DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505),
 DEFINE_PROP_END_OF_LIST(),
diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h
index 36a54e270c..1ee071a703 100644
--- a/include/hw/misc/pvpanic.h
+++ b/include/hw/misc/pvpanic.h
@@ -16,6 +16,15 @@
 
 #define TYPE_PVPANIC "pvpanic"
 
-uint16_t pvpanic_port(void);
+#define PVPANIC_IOPORT_PROP "ioport"
+
+static inline uint16_t pvpanic_port(void)
+{
+Object *o = object_resolve_path_type("", TYPE_PVPANIC, NULL);
+if (!o) {
+return 0;
+}
+return object_property_get_uint(o, PVPANIC_IOPORT_PROP, NULL);
+}
 
 #endif
diff --git a/tests/Makefile.include b/tests/Makefile.include
index da153ac566..5d50bf1074 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -276,8 +276,8 @@ check-qtest-i386-$(CONFIG_VMXNET3_PCI) += 
tests/vmxnet3-test$(EXESUF)
 gcov-files-i386-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
 gcov-files-i386-y += hw/net/net_rx_pkt.c
 gcov-files-i386-y += hw/net/net_tx_pkt.c
-check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
-gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
+check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
+gcov-files-i386-$(CONFIG_PVPANIC) += i386-softmmu/hw/misc/pvpanic.c
 check-qtest-i386-$(CONFIG_I82801B11) += tests/i82801b11-test$(EXESUF)
 gcov-files-i386-$(CONFIG_I82801B11) += hw/pci-bridge/i82801b11.c
 check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 04/19] check: Only test pcnet when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index b90041..0a7101c0bf 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -217,9 +217,9 @@ check-qtest-pci-y += tests/e1000e-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000e.c hw/net/e1000e_core.c
 check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
 gcov-files-pci-y += hw/net/rtl8139.c
-check-qtest-pci-y += tests/pcnet-test$(EXESUF)
-gcov-files-pci-y += hw/net/pcnet.c
-gcov-files-pci-y += hw/net/pcnet-pci.c
+check-qtest-pci-$(CONFIG_PCNET_PCI) += tests/pcnet-test$(EXESUF)
+gcov-files-pci-$(CONFIG_PCNET_PCI) += hw/net/pcnet.c
+gcov-files-pci-$(CONFIG_PCNET_PCI) += hw/net/pcnet-pci.c
 check-qtest-pci-$(CONFIG_EEPRO100_PCI) += tests/eepro100-test$(EXESUF)
 gcov-files-pci-$(CONFIG_EEPRO100_PCI) += hw/net/eepro100.c
 check-qtest-pci-$(CONFIG_NE2000_PCI) += tests/ne2000-test$(EXESUF)
-- 
2.17.1




Re: [Qemu-devel] [PATCH 1/9] hw/intc/arm_gic: Document QEMU interface

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> The GICv2's QEMU interface (sysbus MMIO regions, IRQs,
> etc) is now quite complicated with the addition of the
> virtualization extensions. Add a comment in the header
> file which documents it.
> 
> Signed-off-by: Peter Maydell 
> ---
> I needed to write this out to figure out what I was
> connecting to what in the a15mpcore object :-)
> ---
>  include/hw/intc/arm_gic.h | 35 +++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/include/hw/intc/arm_gic.h b/include/hw/intc/arm_gic.h
> index 42bb535fd45..989bc837606 100644
> --- a/include/hw/intc/arm_gic.h
> +++ b/include/hw/intc/arm_gic.h
> @@ -18,6 +18,41 @@
>   * with this program; if not, see .
>   */
>  
> +/*
> + * QEMU interface:
> + *  + QOM property "num-cpu": number of CPUs to support
> + *  + QOM property "num-irq": number of IRQs (including both SPIs and PPIs)
> + *  + QOM property "revision": GIC version (1 or 2), or 0 for the 11MPCore 
> GIC
> + *  + QOM property "has-security-extensions": set true if the GIC should
> + *implement the security extensions
> + *  + QOM property "has-virtualization-extensions": set true if the GIC 
> should
> + *implement the virtualization extensions
> + *  + unnamed GPIO inputs: (where P is number of PPIs, i.e. num-irq - 32)
"where P is the number of SPIs"
> + *[0..P-1]  SPIs
> + *[P..P+31] PPIs for CPU 0
> + *[P+32..P+63] PPIs for CPU 1
> + *...
> + *  + sysbus IRQ 0 : IRQ
> + *  + sysbus IRQ 1 : FIQ
> + *  + sysbus IRQ 2 : VIRQ (exists even if virt extensions not present)
> + *  + sysbus IRQ 3 : VFIQ (exists even if virt extensions not present)
> + *  + sysbus IRQ 4 : maintenance IRQ for CPU i/f 0 (only if virt extns 
> present)
> + *  + sysbus IRQ 5 : maintenance IRQ for CPU i/f 1 (only if virt extns 
> present)
I think it's more like

For a GIC supporting N CPUs:
  + sysbus IRQ 0: IRQ for CPU 0
  + ...
  + sysbus IRQ N-1: IRQ for CPU N-1

  + sysbus IRQ N: FIQ for CPU 0
  + ...
  + sysbus IRQ 2*N-1: FIQ for CPU N-1

  + sysbus IRQ 2*N: VIRQ for CPU 0
  + ...
  + sysbus IRQ 3*N-1: VIRQ for CPU N-1

  + sysbus IRQ 3*N: VFIQ for CPU 0
  + ...
  + sysbus IRQ 4*N-1: VFIQ for CPU N-1

  + sysbus IRQ 4*N: maintenance IRQ for CPU i/f 0 (only if virt extns
present)
  + ...
  + sysbus IRQ 5*N-1: maintenance IRQ for CPU i/f N-1 (only if virt
extns present)

> + *...
> + *  + sysbus MMIO regions: (in order; numbers will vary depending on
> + *whether virtualization extensions are present and on number of cores)
> + *- distributor registers (GICD*)
> + *- CPU interface for the accessing core (GICC*)
> + *- virtual interface control registers (GICH*) (only if virt extns 
> present)
> + *- virtual CPU interface for the accessing core (GICV*) (only if virt)
> + *- CPU 0 CPU interface registers
> + *- CPU 1 CPU interface registers
> + *  ...
> + *- CPU 0 VCPU interface registers (only if virt extns present)
CPU 0 virtual interface (GICH*)
> + *- CPU 1 VCPU interface registers (only if virt extns present)
CPU 1 virtual interface (GICH*)
> + *  ...> + */
> +
>  #ifndef HW_ARM_GIC_H
>  #define HW_ARM_GIC_H
>  
> 



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PULL 12/19] check: Only test sdhci when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index d5029c4aaa..9fcd4ce24b 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -311,7 +311,7 @@ check-qtest-i386-y += tests/migration-test$(EXESUF)
 check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF)
 check-qtest-i386-y += tests/numa-test$(EXESUF)
 check-qtest-x86_64-y += $(check-qtest-i386-y)
-check-qtest-x86_64-y += tests/sdhci-test$(EXESUF)
+check-qtest-x86_64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst 
i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
 
@@ -385,11 +385,11 @@ gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
 check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
 gcov-files-arm-y += hw/timer/arm_mptimer.c
 check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
-check-qtest-arm-y += tests/sdhci-test$(EXESUF)
+check-qtest-arm-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
 check-qtest-arm-y += tests/hexloader-test$(EXESUF)
 
 check-qtest-aarch64-y = tests/numa-test$(EXESUF)
-check-qtest-aarch64-y += tests/sdhci-test$(EXESUF)
+check-qtest-aarch64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
 check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
 
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
-- 
2.17.1




[Qemu-devel] [PULL 08/19] check: Only test hda when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index e90a8a251c..ff8534056a 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -243,8 +243,8 @@ gcov-files-pci-y += hw/display/vga-pci.c
 gcov-files-pci-y += hw/display/virtio-gpu.c
 gcov-files-pci-y += hw/display/virtio-gpu-pci.c
 gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c
-check-qtest-pci-y += tests/intel-hda-test$(EXESUF)
-gcov-files-pci-y += hw/audio/intel-hda.c hw/audio/hda-codec.c
+check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
+gcov-files-pci-$(CONFIG_HDA) += hw/audio/intel-hda.c hw/audio/hda-codec.c
 check-qtest-pci-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
 gcov-files-pci-y += hw/misc/ivshmem.c
 check-qtest-pci-y += tests/megasas-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 09/19] check: Only test ipack when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index ff8534056a..7d13966055 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -232,10 +232,10 @@ check-qtest-pci-$(CONFIG_ES1370) += 
tests/es1370-test$(EXESUF)
 gcov-files-pci-$(CONFIG_ES1370) += hw/audio/es1370.c
 check-qtest-pci-y += $(check-qtest-virtio-y)
 gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
-check-qtest-pci-y += tests/tpci200-test$(EXESUF)
-gcov-files-pci-y += hw/ipack/tpci200.c
-check-qtest-pci-y += $(check-qtest-ipack-y)
-gcov-files-pci-y += $(gcov-files-ipack-y)
+check-qtest-pci-$(CONFIG_IPACK) += tests/tpci200-test$(EXESUF)
+gcov-files-pci-$(CONFIG_IPACK) += hw/ipack/tpci200.c
+check-qtest-pci-$(CONFIG_IPACK) += $(check-qtest-ipack-y)
+gcov-files-pci-$(CONFIG_IPACK) += $(gcov-files-ipack-y)
 check-qtest-pci-y += tests/display-vga-test$(EXESUF)
 gcov-files-pci-y += hw/display/vga.c
 gcov-files-pci-y += hw/display/cirrus_vga.c
-- 
2.17.1




[Qemu-devel] [PULL 11/19] check: Only test i82801b11 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 7891e27849..d5029c4aaa 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -278,8 +278,8 @@ gcov-files-i386-y += hw/net/net_rx_pkt.c
 gcov-files-i386-y += hw/net/net_tx_pkt.c
 check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
-check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
-gcov-files-i386-y += hw/pci-bridge/i82801b11.c
+check-qtest-i386-$(CONFIG_I82801B11) += tests/i82801b11-test$(EXESUF)
+gcov-files-i386-$(CONFIG_I82801B11) += hw/pci-bridge/i82801b11.c
 check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
 gcov-files-i386-$(CONFIG_IOH3420) += hw/pci-bridge/ioh3420.c
 check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 19/19] check: Only test tpm devices when they are compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index de296ed3e1..6dc8d06f4c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -302,10 +302,10 @@ check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += 
tests/vhost-user-test$(EX
 ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
 check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += 
tests/vhost-user-test$(EXESUF)
 endif
-check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-swtpm-test$(EXESUF)
-check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-test$(EXESUF)
-check-qtest-i386-$(CONFIG_TPM) += tests/tpm-tis-swtpm-test$(EXESUF)
-check-qtest-i386-$(CONFIG_TPM) += tests/tpm-tis-test$(EXESUF)
+check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-swtpm-test$(EXESUF)
+check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-test$(EXESUF)
+check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-swtpm-test$(EXESUF)
+check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-test$(EXESUF)
 check-qtest-i386-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-i386-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-i386-$(CONFIG_RTL8139_PCI) += tests/test-filter-redirector$(EXESUF)
-- 
2.17.1




Re: [Qemu-devel] [PATCH 3/9] hw/arm/vexpress: Connect VIRQ and VFIQ

2018-08-22 Thread Luc Michel
On 8/21/18 3:28 PM, Peter Maydell wrote:
> Connect the VIRQ and VFIQ lines from the GIC to the CPU;
> these exist always for both CPU and GIC whether the
> virtualization extensions are enabled or not, so we
> can just unconditionally connect them.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/arm/vexpress.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index 5bfe2e43487..dc47ed84c20 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -251,6 +251,10 @@ static void init_cpus(const char *cpu_type, const char 
> *privdev,
>  sysbus_connect_irq(busdev, n, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
>  sysbus_connect_irq(busdev, n + smp_cpus,
> qdev_get_gpio_in(cpudev, ARM_CPU_FIQ));
> +sysbus_connect_irq(busdev, n + 2 * smp_cpus,
> +   qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));
> +sysbus_connect_irq(busdev, n + 3 * smp_cpus,
> +   qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
>  }
>  }
>  
> 



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH V11 15/20] net/net.c: Add net client type check function for COLO

2018-08-22 Thread Jason Wang




On 2018年08月21日 17:26, Zhang Chen wrote:



On Tue, Aug 21, 2018 at 11:27 AM Jason Wang > wrote:




On 2018年08月12日 04:59, Zhang Chen wrote:
> From: Zhang Chen mailto:chen.zh...@intel.com>>
>
> We add is_colo_support_client_type() to check the net client
type for
> COLO-compare. Currently we just support TAP.
> Suggested by Jason.
>
> Signed-off-by: Zhang Chen mailto:zhangc...@gmail.com>>
> Signed-off-by: Zhang Chen mailto:chen.zh...@intel.com>>
> ---

This needs more works:

- Forbid vhost
- Deal with hotplug

Looks not a must for this series, so to speed up the process, you
may do
it on top.


Do you mean this patch we can stay this status currently?

Thanks
Zhang Chen


Sorry for being unclear, I mean we need a complete solution rather than 
partial one.


Thanks




[Qemu-devel] [PULL 13/19] check: Only test wdt_ib700 when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9fcd4ce24b..da153ac566 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -267,9 +267,9 @@ check-qtest-i386-y += tests/ipmi-bt-test$(EXESUF)
 check-qtest-i386-y += tests/i440fx-test$(EXESUF)
 check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
 check-qtest-i386-y += tests/drive_del-test$(EXESUF)
-check-qtest-i386-y += tests/wdt_ib700-test$(EXESUF)
+check-qtest-i386-$(CONFIG_WDT_IB700) += tests/wdt_ib700-test$(EXESUF)
+gcov-files-i386-$(CONFIG_WDT_IB700) += hw/watchdog/watchdog.c 
hw/watchdog/wdt_ib700.c
 check-qtest-i386-y += tests/tco-test$(EXESUF)
-gcov-files-i386-y += hw/watchdog/watchdog.c hw/watchdog/wdt_ib700.c
 check-qtest-i386-y += $(check-qtest-pci-y)
 gcov-files-i386-y += $(gcov-files-pci-y)
 check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
-- 
2.17.1




Re: [Qemu-devel] [PATCH 2/9] hw/intc/arm_gic: Make per-cpu GICH memory regions 0x200 bytes large

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> Reduce the size of the per-cpu GICH memory regions from 0x1000
> to 0x200. The registers only cover 0x200 bytes, and the Cortex-A15
> wants to map them at a spacing of 0x200 bytes apart. Having the
> region be too large interferes with mapping them like that, so
> reduce it.
> 
> Signed-off-by: Peter Maydell 

Reviewed-By: Luc Michel 

> ---
>  hw/intc/arm_gic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
> index c1b35fc1ee2..542b4b93eab 100644
> --- a/hw/intc/arm_gic.c
> +++ b/hw/intc/arm_gic.c
> @@ -2084,7 +2084,7 @@ static void arm_gic_realize(DeviceState *dev, Error 
> **errp)
>  for (i = 0; i < s->num_cpu; i++) {
>  memory_region_init_io(&s->vifaceiomem[i + 1], OBJECT(s),
>&gic_viface_ops, &s->backref[i],
> -  "gic_viface", 0x1000);
> +  "gic_viface", 0x200);
>  sysbus_init_mmio(sbd, &s->vifaceiomem[i + 1]);
>  }
>  }
> 



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH 5/9] hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> Connect the VIRQ and VFIQ lines from the GIC to the CPU;
> these exist always for both CPU and GIC whether the
> virtualization extensions are enabled or not, so we
> can just unconditionally connect them.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/arm/fsl-imx6ul.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
> index 258f4706234..4b56bfa8d16 100644
> --- a/hw/arm/fsl-imx6ul.c
> +++ b/hw/arm/fsl-imx6ul.c
> @@ -207,6 +207,10 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error 
> **errp)
>  irq = qdev_get_gpio_in(d, ARM_CPU_IRQ);
>  sysbus_connect_irq(sbd, i, irq);
>  sysbus_connect_irq(sbd, i + smp_cpus, qdev_get_gpio_in(d, 
> ARM_CPU_FIQ));
> +sysbus_connect_irq(sbd, i + 2 * smp_cpus,
> +   qdev_get_gpio_in(d, ARM_CPU_VIRQ));
> +sysbus_connect_irq(sbd, i + 3 * smp_cpus,
> +   qdev_get_gpio_in(d, ARM_CPU_VFIQ));
>  }
>  
>  /*
> 



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PULL 15/19] check: Only test nvme when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 5d50bf1074..fcccd12ff3 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -224,8 +224,8 @@ check-qtest-pci-$(CONFIG_EEPRO100_PCI) += 
tests/eepro100-test$(EXESUF)
 gcov-files-pci-$(CONFIG_EEPRO100_PCI) += hw/net/eepro100.c
 check-qtest-pci-$(CONFIG_NE2000_PCI) += tests/ne2000-test$(EXESUF)
 gcov-files-pci-$(CONFIG_NE2000_PCI) += hw/net/ne2000.c
-check-qtest-pci-y += tests/nvme-test$(EXESUF)
-gcov-files-pci-y += hw/block/nvme.c
+check-qtest-pci-$(CONFIG_NVME_PCI) += tests/nvme-test$(EXESUF)
+gcov-files-pci-$(CONFIG_NVME_PCI) += hw/block/nvme.c
 check-qtest-pci-$(CONFIG_AC97) += tests/ac97-test$(EXESUF)
 gcov-files-pci-$(CONFIG_AC97) += hw/audio/ac97.c
 check-qtest-pci-$(CONFIG_ES1370) += tests/es1370-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PULL 16/19] check: Only test usb-ohci when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index fcccd12ff3..fc32a68ee9 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -282,8 +282,8 @@ check-qtest-i386-$(CONFIG_I82801B11) += 
tests/i82801b11-test$(EXESUF)
 gcov-files-i386-$(CONFIG_I82801B11) += hw/pci-bridge/i82801b11.c
 check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
 gcov-files-i386-$(CONFIG_IOH3420) += hw/pci-bridge/ioh3420.c
-check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
-gcov-files-i386-y += hw/usb/hcd-ohci.c
+check-qtest-i386-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
+gcov-files-i386-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
 check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-uhci.c
 check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
@@ -347,8 +347,8 @@ check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF)
 check-qtest-ppc64-y += tests/migration-test$(EXESUF)
 check-qtest-ppc64-y += tests/rtas-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
-check-qtest-ppc64-y += tests/usb-hcd-ohci-test$(EXESUF)
-gcov-files-ppc64-y += hw/usb/hcd-ohci.c
+check-qtest-ppc64-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
+gcov-files-ppc64-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
 check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF)
 gcov-files-ppc64-y += hw/usb/hcd-uhci.c
 check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF)
-- 
2.17.1




Re: [Qemu-devel] [PATCH 6/9] hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> Connect the VIRQ and VFIQ lines from the GIC to the CPU;
> these exist always for both CPU and GIC whether the
> virtualization extensions are enabled or not, so we
> can just unconditionally connect them.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/arm/fsl-imx7.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
> index d5e26855a55..7663ad68610 100644
> --- a/hw/arm/fsl-imx7.c
> +++ b/hw/arm/fsl-imx7.c
> @@ -209,6 +209,10 @@ static void fsl_imx7_realize(DeviceState *dev, Error 
> **errp)
>  sysbus_connect_irq(sbd, i, irq);
>  irq = qdev_get_gpio_in(d, ARM_CPU_FIQ);
>  sysbus_connect_irq(sbd, i + smp_cpus, irq);
> +irq = qdev_get_gpio_in(d, ARM_CPU_VIRQ);
> +sysbus_connect_irq(sbd, i + 2 * smp_cpus, irq);
> +irq = qdev_get_gpio_in(d, ARM_CPU_VFIQ);
> +sysbus_connect_irq(sbd, i + 3 * smp_cpus, irq);
>  }
>  
>  /*
> 



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v2 1/3] qapi: add x-query-block-graph

2018-08-22 Thread Max Reitz
On 2018-08-20 20:38, Vladimir Sementsov-Ogievskiy wrote:
> 20.08.2018 16:44, Max Reitz wrote:
>> On 2018-08-20 12:20, Vladimir Sementsov-Ogievskiy wrote:
>>> 18.08.2018 00:03, Max Reitz wrote:
 On 2018-08-17 22:32, Eric Blake wrote:
> On 08/17/2018 01:04 PM, Vladimir Sementsov-Ogievskiy wrote:
>> Add a new command, returning block nodes graph.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy
>> 
>> ---
>>     qapi/block-core.json  | 116
>> ++
>> +##
>> +# @BlockGraphEdge:
>> +#
>> +# Block Graph edge description for x-query-block-graph.
>> +#
>> +# @parent: parent id
>> +#
>> +# @child: child id
>> +#
>> +# @name: name of the relation (examples are 'file' and 'backing')
> Can this be made into a QAPI enum? (It would have ripple effects to
> existing code, but might be a worthwhile cleanup).
>
>> +#
>> +# @perm: granted permissions for the parent operating on the child
>> +#
>> +# @shared-perm: permissions that can still be granted to other users
>> of the
>> +#   child while it is still attached this parent
>> +#
>> +# Since: 3.1
>> +##
>> +{ 'struct': 'BlockGraphEdge',
>> +  'data': { 'parent': 'uint64', 'child': 'uint64',
>> +    'name': 'str', 'perm': [ 'BlockPermission' ],
>> +    'shared-perm': [ 'BlockPermission' ] } }
>> +
>> +##
>> +# @x-query-block-graph:
>> +#
>> +# Get the block graph.
>> +#
>> +# Since: 3.1
>> +##
>> +{ 'command': 'x-query-block-graph', 'returns': 'BlockGraph' }
> Why is this command given an x- prefix?  What would it take to promote
> it from experimental to fully supported?
 This is just a very bad reasons, but I'll give it anyway: We really
 want
 such a command but still don't have one.  So I doubt this is exactly
 what we want. :-)

 A better reason is that we probably do not want a single command to
 return the whole block graph.  Do we want the command to just return
 info for a single node, including just the node names of the children?
 Do we want the command to include child info on request (but start from
 a user-specified root)?

 Also, the interface is...  Er, weird?  Honestly, I don't quite see why
 we would want it like this without x-.

 Why use newly generated IDs instead of node names?  Why are those RAM
 addresses?  That is just so fishy.

 Because parents can be non-nodes?  Well, I suppose you better not
 include them in the graph like this, then.

 I don't see why the query command we want would include non-BDSs at
 all.

 It may be useful for debugging, so, er, well, with an x-debug- prefix,
 OK.  But the question then is whether it's useful enough to warrant
 having a separate query command that isn't precisely the command we
 want
 anyway.
>>>
 The first question we probably have to ask is whether the query command
 needs to output parent information.  If not, querying would probably
 start at some named node and then you'd go down from there (either with
 many queries or through a single one).

 If so, well, then we can still output parent information, but I'd say
 that then is purely informational and we don't need to "generate" new
 IDs for them.  Just have either a node-name there or a user-readable
 description (like it was in v1; although it has to be noted that such a
 user-readable description is useless to a management layer), but these
 new IDs are really not something I like.

> Overall, the command looks quite useful; and the fact that you
> produced
> some nice .dot graphs from it for visualization seems like it is worth
> considering this as a permanent API addition.  The question, then,
> is if
> the interface is right, or if it needs any tweaks (like using an enum
> instead of open-coded string for the relation between parent and
> child),
> as a reason for keeping the x- prefix.
 You can use x-debug- even when you decide to keep a command.

 I see no reason why a command should hastily not get an x- prefix just
 because it may be useful enough.  If it really is and we really see the
 interface is good (which I really don't think it is), then we can
 always
 drop it later.

 Max

>> +++ b/block.c
>> @@ -4003,6 +4003,86 @@ BlockDeviceInfoList
>> *bdrv_named_nodes_list(Error **errp)
>>     return list;
>>     }
>>     +#define QAPI_LIST_ADD(list, element) do { \
>> +    typeof(list) _tmp = g_new(typeof(*(list)), 1); \
>> +    _tmp->value = (element); \
>> +    _tmp->next = (list); \
>> +    list = _tmp; \
>> +} while (0)
> Hmm - this seems like a frequently observed pattern - should it be
> somethi

Re: [Qemu-devel] [PATCH 8/9] hw/arm/vexpress: Don't set info->secure_boot if CPU doesn't have EL3

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> Don't request that the arm_load_kernel() code should boot in secure
> state if the CPU doesn't have a secure state. Currently this
> doesn't make a difference because the boot.c code only examines
> the secure_boot flag in code guarded by an ARM_FEATURE_EL3 check,
> but upcoming changes for supporting booting into Hyp mode will
> change that.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/arm/vexpress.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index dc47ed84c20..3631f4de3a4 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -705,8 +705,8 @@ static void vexpress_common_init(MachineState *machine)
>  daughterboard->bootinfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30;
>  daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr;
>  daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb;
> -/* Indicate that when booting Linux we should be in secure state */
> -daughterboard->bootinfo.secure_boot = true;
> +/* When booting Linux we should be in secure state if the CPU has one. */
> +daughterboard->bootinfo.secure_boot = vms->secure;
>  arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);
>  }
>  
> 



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH 7/9] hw/cpu/a15mpcore: If CPU has EL2, enable it on the GIC and wire it up

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> For the A15MPCore internal peripheral object, we handle GIC
> security extensions support by checking whether the CPUs
> have EL3 enabled; if so then we enable it also on the GIC.
> Handle the virtualization extensions in the same way: if the
> CPU has EL2 then enable it on the GIC and wire up the
> virtualization-specific memory regions and the maintenance
> interrupt.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/cpu/a15mpcore.c | 31 ---
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c
> index 43c10794938..226ce8900f2 100644
> --- a/hw/cpu/a15mpcore.c
> +++ b/hw/cpu/a15mpcore.c
> @@ -53,6 +53,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error 
> **errp)
>  int i;
>  Error *err = NULL;
>  bool has_el3;
> +bool has_el2;
>  Object *cpuobj;
>  
>  gicdev = DEVICE(&s->gic);
> @@ -67,6 +68,10 @@ static void a15mp_priv_realize(DeviceState *dev, Error 
> **errp)
>  has_el3 = object_property_find(cpuobj, "has_el3", NULL) &&
>  object_property_get_bool(cpuobj, "has_el3", &error_abort);
>  qdev_prop_set_bit(gicdev, "has-security-extensions", has_el3);
> +/* Similarly for virtualization support */
> +has_el2 = object_property_find(cpuobj, "has_el2", NULL) &&
> +object_property_get_bool(cpuobj, "has_el2", &error_abort);
> +qdev_prop_set_bit(gicdev, "has-virtualization-extensions", has_el2);
>  }
>  
>  object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
> @@ -103,20 +108,40 @@ static void a15mp_priv_realize(DeviceState *dev, Error 
> **errp)
>qdev_get_gpio_in(gicdev,
> ppibase + 
> timer_irq[irq]));
>  }
> +if (has_el2) {
> +/* Connect the GIC maintenance interrupt to PPI ID 25 */
> +sysbus_connect_irq(SYS_BUS_DEVICE(gicdev), i + 4 * s->num_cpu,
> +   qdev_get_gpio_in(gicdev, ppibase + 25));
> +}
>  }
>  
>  /* Memory map (addresses are offsets from PERIPHBASE):
>   *  0x-0x0fff -- reserved
>   *  0x1000-0x1fff -- GIC Distributor
>   *  0x2000-0x3fff -- GIC CPU interface
> - *  0x4000-0x4fff -- GIC virtual interface control (not modelled)
> - *  0x5000-0x5fff -- GIC virtual interface control (not modelled)
> - *  0x6000-0x7fff -- GIC virtual CPU interface (not modelled)
> + *  0x4000-0x4fff -- GIC virtual interface control for this CPU
> + *  0x5000-0x51ff -- GIC virtual interface control for CPU 0
> + *  0x5200-0x53ff -- GIC virtual interface control for CPU 1
> + *  0x5400-0x55ff -- GIC virtual interface control for CPU 2
> + *  0x5600-0x57ff -- GIC virtual interface control for CPU 3
> + *  0x6000-0x7fff -- GIC virtual CPU interface
>   */
>  memory_region_add_subregion(&s->container, 0x1000,
>  sysbus_mmio_get_region(busdev, 0));
>  memory_region_add_subregion(&s->container, 0x2000,
>  sysbus_mmio_get_region(busdev, 1));
> +if (has_el2) {
> +memory_region_add_subregion(&s->container, 0x4000,
> +sysbus_mmio_get_region(busdev, 2));
> +memory_region_add_subregion(&s->container, 0x6000,
> +sysbus_mmio_get_region(busdev, 3));
> +for (i = 0; i < s->num_cpu; i++) {
> +hwaddr base = 0x5000 + i * 0x200;
> +MemoryRegion *mr = sysbus_mmio_get_region(busdev,
> +  4 + s->num_cpu + i);
> +memory_region_add_subregion(&s->container, base, mr);
> +}
> +}
>  }
>  
>  static Property a15mp_priv_properties[] = {
> 



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PULL 17/19] check: Only test usb-uhci devices when they are compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index fc32a68ee9..0b8fb4637c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -284,8 +284,8 @@ check-qtest-i386-$(CONFIG_IOH3420) += 
tests/ioh3420-test$(EXESUF)
 gcov-files-i386-$(CONFIG_IOH3420) += hw/pci-bridge/ioh3420.c
 check-qtest-i386-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-i386-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
-check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
-gcov-files-i386-y += hw/usb/hcd-uhci.c
+check-qtest-i386-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
+gcov-files-i386-$(CONFIG_USB_UHCI) += hw/usb/hcd-uhci.c
 check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
@@ -349,8 +349,8 @@ check-qtest-ppc64-y += tests/rtas-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-ppc64-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
-check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF)
-gcov-files-ppc64-y += hw/usb/hcd-uhci.c
+check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
+gcov-files-ppc64-$(CONFIG_USB_UHCI) += hw/usb/hcd-uhci.c
 check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF)
 gcov-files-ppc64-y += hw/usb/hcd-xhci.c
 check-qtest-ppc64-y += $(check-qtest-virtio-y)
-- 
2.17.1




Re: [Qemu-devel] [PATCH 9/9] hw/arm/vexpress: Add "virtualization" property controlling presence of EL2

2018-08-22 Thread Luc Michel


On 8/21/18 3:28 PM, Peter Maydell wrote:
> Add a "virtualization" property to the vexpress-a15 board,
> controlling presence of EL2. As with EL3, we default to
> enabling it, but the user can disable it if they have an
> older guest which can't cope with it being present.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/arm/vexpress.c | 56 ---
>  1 file changed, 53 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index 3631f4de3a4..c02d18ee618 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -172,6 +172,7 @@ typedef struct {
>  typedef struct {
>  MachineState parent;
>  bool secure;
> +bool virt;
>  } VexpressMachineState;
>  
>  #define TYPE_VEXPRESS_MACHINE   "vexpress"
> @@ -203,7 +204,7 @@ struct VEDBoardInfo {
>  };
>  
>  static void init_cpus(const char *cpu_type, const char *privdev,
> -  hwaddr periphbase, qemu_irq *pic, bool secure)
> +  hwaddr periphbase, qemu_irq *pic, bool secure, bool 
> virt)
>  {
>  DeviceState *dev;
>  SysBusDevice *busdev;
> @@ -216,6 +217,11 @@ static void init_cpus(const char *cpu_type, const char 
> *privdev,
>  if (!secure) {
>  object_property_set_bool(cpuobj, false, "has_el3", NULL);
>  }
> +if (!virt) {
> +if (object_property_find(cpuobj, "has_el2", NULL)) {
> +object_property_set_bool(cpuobj, false, "has_el2", NULL);
> +}
> +}
>  
>  if (object_property_find(cpuobj, "reset-cbar", NULL)) {
>  object_property_set_int(cpuobj, periphbase,
> @@ -289,7 +295,8 @@ static void a9_daughterboard_init(const 
> VexpressMachineState *vms,
>  memory_region_add_subregion(sysmem, 0x6000, ram);
>  
>  /* 0x1e00 A9MPCore (SCU) private memory region */
> -init_cpus(cpu_type, TYPE_A9MPCORE_PRIV, 0x1e00, pic, vms->secure);
> +init_cpus(cpu_type, TYPE_A9MPCORE_PRIV, 0x1e00, pic,
> +  vms->secure, vms->virt);
>  
>  /* Daughterboard peripherals : 0x1002 .. 0x2000 */
>  
> @@ -370,7 +377,8 @@ static void a15_daughterboard_init(const 
> VexpressMachineState *vms,
>  memory_region_add_subregion(sysmem, 0x8000, ram);
>  
>  /* 0x2c00 A15MPCore private memory region (GIC) */
> -init_cpus(cpu_type, TYPE_A15MPCORE_PRIV, 0x2c00, pic, vms->secure);
> +init_cpus(cpu_type, TYPE_A15MPCORE_PRIV, 0x2c00, pic, vms->secure,
> +  vms->virt);
>  
>  /* A15 daughterboard peripherals: */
>  
> @@ -724,6 +732,20 @@ static void vexpress_set_secure(Object *obj, bool value, 
> Error **errp)
>  vms->secure = value;
>  }
>  
> +static bool vexpress_get_virt(Object *obj, Error **errp)
> +{
> +VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
> +
> +return vms->virt;
> +}
> +
> +static void vexpress_set_virt(Object *obj, bool value, Error **errp)
> +{
> +VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
> +
> +vms->virt = value;
> +}
> +
>  static void vexpress_instance_init(Object *obj)
>  {
>  VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
> @@ -738,6 +760,32 @@ static void vexpress_instance_init(Object *obj)
>  NULL);
>  }
>  
> +static void vexpress_a15_instance_init(Object *obj)
> +{
> +VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
> +
> +/*
> + * For the vexpress-a15, EL2 is by default enabled if EL3 is,
> + * but can also be specifically set to on or off.
> + */
> +vms->virt = true;
> +object_property_add_bool(obj, "virtualization", vexpress_get_virt,
> + vexpress_set_virt, NULL);
> +object_property_set_description(obj, "virtualization",
> +"Set on/off to enable/disable the ARM "
> +"Virtualization Extensions "
> +"(defaults to same as 'secure')",
> +NULL);
> +}
> +
> +static void vexpress_a9_instance_init(Object *obj)
> +{
> +VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
> +
> +/* The A9 doesn't have the virt extensions */
> +vms->virt = false;
> +}
> +
>  static void vexpress_class_init(ObjectClass *oc, void *data)
>  {
>  MachineClass *mc = MACHINE_CLASS(oc);
> @@ -784,12 +832,14 @@ static const TypeInfo vexpress_a9_info = {
>  .name = TYPE_VEXPRESS_A9_MACHINE,
>  .parent = TYPE_VEXPRESS_MACHINE,
>  .class_init = vexpress_a9_class_init,
> +.instance_init = vexpress_a9_instance_init,
>  };
>  
>  static const TypeInfo vexpress_a15_info = {
>  .name = TYPE_VEXPRESS_A15_MACHINE,
>  .parent = TYPE_VEXPRESS_MACHINE,
>  .class_init = vexpress_a15_class_init,
> +.instance_init = vexpress_a15_instance_init,
>  };
>  
>  static void vexpress_machine_init(void)
> 



signature.asc
Description: OpenPGP digit

[Qemu-devel] [PULL 18/19] check: Only test usb-ehci when it is compiled in

2018-08-22 Thread Juan Quintela
The ehci test also test uhci.  Welcome to the worderfull world of USB.

Signed-off-by: Juan Quintela 
Reviewed-by: Thomas Huth 
---
 tests/Makefile.include | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 0b8fb4637c..de296ed3e1 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -286,8 +286,10 @@ check-qtest-i386-$(CONFIG_USB_OHCI) += 
tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-i386-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
 check-qtest-i386-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
 gcov-files-i386-$(CONFIG_USB_UHCI) += hw/usb/hcd-uhci.c
+ifeq ($(CONFIG_USB_ECHI)$(CONFIG_USB_UHCI),yy)
 check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
-gcov-files-i386-y += hw/usb/hcd-ehci.c
+endif
+gcov-files-i386-$(CONFIG_USB_EHCI) += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
 check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH] hw/scsi/mptsas: Classify the device as "storage"

2018-08-22 Thread Thomas Huth
Each device should ideally have a category, so put the mptsas1068 device
into the "storage" category.

Signed-off-by: Thomas Huth 
---
 hw/scsi/mptsas.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index 4176e87..929404f 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1431,6 +1431,7 @@ static void mptsas1068_class_init(ObjectClass *oc, void 
*data)
 dc->reset = mptsas_reset;
 dc->vmsd = &vmstate_mptsas;
 dc->desc = "LSI SAS 1068";
+set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
 }
 
 static const TypeInfo mptsas_info = {
-- 
1.8.3.1




Re: [Qemu-devel] [PATCH V11 16/20] filter: Add handle_event method for NetFilterClass

2018-08-22 Thread Jason Wang




On 2018年08月21日 17:25, Zhang Chen wrote:

On Tue, Aug 21, 2018 at 11:30 AM Jason Wang  wrote:



On 2018年08月12日 04:59, Zhang Chen wrote:

Filter needs to process the event of checkpoint/failover or
other event passed by COLO frame.

Signed-off-by: zhanghailiang 
---
   include/net/filter.h |  5 +
   net/filter.c | 17 +
   net/net.c| 28 
   3 files changed, 50 insertions(+)

diff --git a/include/net/filter.h b/include/net/filter.h
index 435acd6f82..49da666ac0 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -38,6 +38,8 @@ typedef ssize_t (FilterReceiveIOV)(NetFilterState *nc,

   typedef void (FilterStatusChanged) (NetFilterState *nf, Error **errp);

+typedef void (FilterHandleEvent) (NetFilterState *nf, int event, Error

**errp);

+
   typedef struct NetFilterClass {
   ObjectClass parent_class;

@@ -45,6 +47,7 @@ typedef struct NetFilterClass {
   FilterSetup *setup;
   FilterCleanup *cleanup;
   FilterStatusChanged *status_changed;
+FilterHandleEvent *handle_event;
   /* mandatory */
   FilterReceiveIOV *receive_iov;
   } NetFilterClass;
@@ -77,4 +80,6 @@ ssize_t qemu_netfilter_pass_to_next(NetClientState

*sender,

   int iovcnt,
   void *opaque);

+void colo_notify_filters_event(int event, Error **errp);
+
   #endif /* QEMU_NET_FILTER_H */
diff --git a/net/filter.c b/net/filter.c
index 2fd7d7d663..0f17eba143 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -17,6 +17,8 @@
   #include "net/vhost_net.h"
   #include "qom/object_interfaces.h"
   #include "qemu/iov.h"
+#include "net/colo.h"
+#include "migration/colo.h"

   static inline bool qemu_can_skip_netfilter(NetFilterState *nf)
   {
@@ -245,11 +247,26 @@ static void netfilter_finalize(Object *obj)
   g_free(nf->netdev_id);
   }

+static void dummy_handle_event(NetFilterState *nf, int event, Error

**errp)

+{

It's in fact not a "dummy" handler, Maybe it's better to rename it as
"default".


OK, I will rename it in next version.



+switch (event) {
+case COLO_EVENT_CHECKPOINT:
+break;
+case COLO_EVENT_FAILOVER:
+object_property_set_str(OBJECT(nf), "off", "status", errp);

I think filter is a generic infrastructure, so it's better not have COLO
specific things like this. You can either add a generic name or have a
dedicated helper to just disable all net filters.


Maybe we can rename it to "EVENT_CHECKPOINT" and "EVENT_FAILOVER" looks
better?



I think registering notifier to COLO is better. For disabling filter, we 
can have a generic dedicated helpers to do this.


Btw, I remember we allow disabling filter through qmp, if it's true, we 
probably need some notification to management, but this can be done in 
the future.



+break;
+default:
+break;
+}
+}
+
   static void netfilter_class_init(ObjectClass *oc, void *data)
   {
   UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
+NetFilterClass *nfc = NETFILTER_CLASS(oc);

   ucc->complete = netfilter_complete;
+nfc->handle_event = dummy_handle_event;
   }

   static const TypeInfo netfilter_info = {
diff --git a/net/net.c b/net/net.c
index a77ea88fff..b4f6a2efb2 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1331,6 +1331,34 @@ void hmp_info_network(Monitor *mon, const QDict

*qdict)

   }
   }

+void colo_notify_filters_event(int event, Error **errp)
+{
+NetClientState *nc, *peer;
+NetClientDriver type;
+NetFilterState *nf;
+NetFilterClass *nfc = NULL;
+Error *local_err = NULL;
+
+QTAILQ_FOREACH(nc, &net_clients, next) {
+peer = nc->peer;
+type = nc->info->type;
+if (!peer || type != NET_CLIENT_DRIVER_TAP) {
+continue;
+}

The check the TAP is redundant with previous patch.


OK, I will remove it.



+QTAILQ_FOREACH(nf, &nc->filters, next) {
+nfc =  NETFILTER_GET_CLASS(OBJECT(nf));
+if (!nfc->handle_event) {

Looks like this won't happen.


It will happen. like filter-mirror and filter-redirector haven't this event.


But you do:

  static void netfilter_class_init(ObjectClass *oc, void *data)
  {
  UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
+    NetFilterClass *nfc = NETFILTER_CLASS(oc);

  ucc->complete = netfilter_complete;
+    nfc->handle_event = dummy_handle_event;
  }

?

Thanks



Thanks
Zhang Chen



Thanks


+continue;
+}
+nfc->handle_event(nf, event, &local_err);
+if (local_err) {
+error_propagate(errp, local_err);
+return;
+}
+}
+}
+}
+
   void qmp_set_link(const char *name, bool up, Error **errp)
   {
   NetClientState *ncs[MAX_QUEUE_NUM];







Re: [Qemu-devel] [PATCH 4/9] hw/arm/highbank: Connect VIRQ and VFIQ

2018-08-22 Thread Luc Michel
On 8/21/18 3:28 PM, Peter Maydell wrote:
> Connect the VIRQ and VFIQ lines from the GIC to the CPU;
> these exist always for both CPU and GIC whether the
> virtualization extensions are enabled or not, so we
> can just unconditionally connect them.
> 
> Signed-off-by: Peter Maydell 

Reviewed-by: Luc Michel 

> ---
>  hw/arm/highbank.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
> index 6d42fce2c37..fb9efa02c35 100644
> --- a/hw/arm/highbank.c
> +++ b/hw/arm/highbank.c
> @@ -243,6 +243,8 @@ static void calxeda_init(MachineState *machine, enum 
> cxmachines machine_id)
>  int n;
>  qemu_irq cpu_irq[4];
>  qemu_irq cpu_fiq[4];
> +qemu_irq cpu_virq[4];
> +qemu_irq cpu_vfiq[4];
>  MemoryRegion *sysram;
>  MemoryRegion *dram;
>  MemoryRegion *sysmem;
> @@ -282,6 +284,8 @@ static void calxeda_init(MachineState *machine, enum 
> cxmachines machine_id)
>  object_property_set_bool(cpuobj, true, "realized", &error_fatal);
>  cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ);
>  cpu_fiq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ);
> +cpu_virq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_VIRQ);
> +cpu_vfiq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_VFIQ);
>  }
>  
>  sysmem = get_system_memory();
> @@ -329,6 +333,8 @@ static void calxeda_init(MachineState *machine, enum 
> cxmachines machine_id)
>  for (n = 0; n < smp_cpus; n++) {
>  sysbus_connect_irq(busdev, n, cpu_irq[n]);
>  sysbus_connect_irq(busdev, n + smp_cpus, cpu_fiq[n]);
> +sysbus_connect_irq(busdev, n + 2 * smp_cpus, cpu_virq[n]);
> +sysbus_connect_irq(busdev, n + 3 * smp_cpus, cpu_vfiq[n]);
>  }
>  
>  for (n = 0; n < 128; n++) {
> 



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH] Remove deprecated -balloon option

2018-08-22 Thread David Hildenbrand
On 21.08.2018 12:05, Thomas Huth wrote:
> The "-balloon" option has been replaced by "-device virtio-balloon".
> It's been marked as deprecated since two releases, and nobody
> complained, so let's remove it now.
> 
> Signed-off-by: Thomas Huth 
> ---
>  docs/virtio-balloon-stats.txt |  6 +++---
>  qemu-deprecated.texi  |  5 -
>  qemu-options.hx   | 10 --
>  vl.c  | 36 
>  4 files changed, 3 insertions(+), 54 deletions(-)
> 
> diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt
> index 9985e1d..1732cc8 100644
> --- a/docs/virtio-balloon-stats.txt
> +++ b/docs/virtio-balloon-stats.txt
> @@ -61,9 +61,9 @@ It's also important to note the following:
> respond to the request the timer will never be re-armed, which has
> the same effect as disabling polling
>  
> -Here are a few examples. QEMU is started with '-balloon virtio', which
> -generates '/machine/peripheral-anon/device[1]' as the QOM path for the
> -balloon device.
> +Here are a few examples. QEMU is started with '-device virtio-balloon',
> +which generates '/machine/peripheral-anon/device[1]' as the QOM path for
> +the balloon device.
>  
>  Enable polling with 2 seconds interval:
>  
> diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
> index 67b7211..0714017 100644
> --- a/qemu-deprecated.texi
> +++ b/qemu-deprecated.texi
> @@ -106,11 +106,6 @@ enabled via the ``-machine usb=on'' argument.
>  
>  The ``-nodefconfig`` argument is a synonym for ``-no-user-config``.
>  
> -@subsection -balloon (since 2.12.0)
> -
> -The @option{--balloon virtio} argument has been superseded by
> -@option{--device virtio-balloon}.
> -
>  @subsection -fsdev handle (since 2.12.0)
>  
>  The ``handle'' fsdev backend does not support symlinks and causes the 9p
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 4efdedf..47c6b92 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -454,16 +454,6 @@ modprobe i810_audio clocking=48000
>  @end example
>  ETEXI
>  
> -DEF("balloon", HAS_ARG, QEMU_OPTION_balloon,
> -"-balloon virtio[,addr=str]\n"
> -"enable virtio balloon device (deprecated)\n", 
> QEMU_ARCH_ALL)
> -STEXI
> -@item -balloon virtio[,addr=@var{addr}]
> -@findex -balloon
> -Enable virtio balloon device, optionally with PCI address @var{addr}. This
> -option is deprecated, use @option{-device virtio-balloon} instead.
> -ETEXI
> -
>  DEF("device", HAS_ARG, QEMU_OPTION_device,
>  "-device driver[,prop[=value][,...]]\n"
>  "add device (based on driver)\n"
> diff --git a/vl.c b/vl.c
> index 16b913f..f952f01 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2127,36 +2127,6 @@ static void parse_display(const char *p)
>  }
>  }
>  
> -static int balloon_parse(const char *arg)
> -{
> -QemuOpts *opts;
> -
> -warn_report("This option is deprecated. "
> -"Use '--device virtio-balloon' to enable the balloon 
> device.");
> -
> -if (strcmp(arg, "none") == 0) {
> -return 0;
> -}
> -
> -if (!strncmp(arg, "virtio", 6)) {
> -if (arg[6] == ',') {
> -/* have params -> parse them */
> -opts = qemu_opts_parse_noisily(qemu_find_opts("device"), arg + 7,
> -   false);
> -if (!opts)
> -return  -1;
> -} else {
> -/* create empty opts */
> -opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
> -&error_abort);
> -}
> -qemu_opt_set(opts, "driver", "virtio-balloon", &error_abort);
> -return 0;
> -}
> -
> -return -1;
> -}
> -
>  char *qemu_find_file(int type, const char *name)
>  {
>  int i;
> @@ -3659,12 +3629,6 @@ int main(int argc, char **argv, char **envp)
>  case QEMU_OPTION_no_hpet:
>  no_hpet = 1;
>  break;
> -case QEMU_OPTION_balloon:
> -if (balloon_parse(optarg) < 0) {
> -error_report("unknown -balloon argument %s", optarg);
> -exit(1);
> -}
> -break;
>  case QEMU_OPTION_no_reboot:
>  no_reboot = 1;
>  break;
> 

Nice to see this go.

Reviewed-by: David Hildenbrand 

-- 

Thanks,

David / dhildenb



Re: [Qemu-devel] [PULL 27/74] checkpatch: allow space in more places before a bracket

2018-08-22 Thread Paolo Bonzini
On 21/08/2018 20:38, Linus Torvalds wrote:
> This is commit 38dca988bb20 ("checkpatch: allow space between colon
> and bracket") upstream, why is that not mentioned anywhere?

Trivially because I used "git commit -c" instead of "git cherry-pick" (I
don't remember exactly why, probably I did the patch quickly and only
later noticed that Linux had already fixed the same thing).  I did
mention Linux commit daebc534ac in the commit message, but not 38dca988bb20.

Paolo

> *Please* mention the upstream commits when back-porting things.
> 
>  Linus
> 
> 
> On Tue, Aug 21, 2018 at 10:03 AM Paolo Bonzini  wrote:
>>
>> From: Heinrich Schuchardt 
>>
>> Allow a space between a colon and subsequent opening bracket.  This
>> sequence may occur in inline assembler statements like




Re: [Qemu-devel] [PATCH] qapi/migration.json: fix the description for "query-migrate" output

2018-08-22 Thread Juan Quintela
 wrote:
> From: jialina01 
>
> In the return for command "query-migrate", time information like
> "total-time", "setup-time", "downtime", is not included in ram
> json-object.
>
> So fix the description in migration.json by unpacking those information
> from ram json-object.
>
> Signed-off-by: jialina01 
> Signed-off-by: chaiwen 

Reviewed-by: Juan Quintela 

queued



Re: [Qemu-devel] [PATCH] migrate/cpu-throttle: Add max-cpu-throttle migration parameter

2018-08-22 Thread Juan Quintela
Li Qiang  wrote:
> Currently, the default maximum CPU throttle for migration is
> 99(CPU_THROTTLE_PCT_MAX). This is too big and can make a remarkable
> performance effect for the guest. We see a lot of packets latency
> exceed 500ms when the CPU_THROTTLE_PCT_MAX reached. This patch set
> adds a new max-cpu-throttle parameter to limit the CPU throttle.
>
> Signed-off-by: Li Qiang 

Reviewed-by: Juan Quintela 




[Qemu-devel] [PATCH] pc: acpi: revert back to 1 SRAT entry for hotpluggable area

2018-08-22 Thread Igor Mammedov
Commit
  10efd7e108 "pc: acpi: fix memory hotplug regression by reducing stub SRAT 
entry size"
attemped to fix hotplug regression introduced by
  848a1cc1e "hw/acpi-build: build SRAT memory affinity structures for DIMM 
devices"

fixed issue for Windows/3.0+ linux kernels, however it regressed 2.6 based
kernels (RHEL6) to the point where guest might crash at boot.
Reason is that 2.6 kernel discards SRAT table due too small last entry
which down the road leads to crashes. Hack I've tried in 10efd7e108 is also
not ACPI spec compliant according to which whole possible RAM should be
described in SRAT. Revert 10efd7e108 to fix regression for 2.6 based kernels.

With 10efd7e108 reverted, I've also tried splitting SRAT table statically
in different ways %/node and %/slot but Windows still fails to online
2nd pc-dimm hot-plugged into node 0 (as described in 10efd7e108) and
sometimes even coldplugged pc-dimms where affected with static SRAT
partitioning.
The only known so far way where Windows stays happy is when we have 1
SRAT entry in the last node covering all hotplug area.

Revert 848a1cc1e until we come up with a way to avoid regression
on Windows with hotplug area split in several entries.
Tested this with 2.6/3.0 based kernels (RHEL6/7) and WS20[08/12/12R2/16]).

Signed-off-by: Igor Mammedov 
---
CC: haozhong.zh...@intel.com
CC: m...@redhat.com
CC: qemu-sta...@nongnu.org
CC: ehabk...@redhat.com
CC: ler...@redhat.com
---
 hw/i386/acpi-build.c | 73 +---
 1 file changed, 12 insertions(+), 61 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index e1ee8ae..1599caa 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2251,64 +2251,6 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, 
GArray *tcpalog)
 #define HOLE_640K_START  (640 * KiB)
 #define HOLE_640K_END   (1 * MiB)
 
-static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
-   uint64_t len, int default_node)
-{
-MemoryDeviceInfoList *info_list = qmp_memory_device_list();
-MemoryDeviceInfoList *info;
-MemoryDeviceInfo *mi;
-PCDIMMDeviceInfo *di;
-uint64_t end = base + len, cur, size;
-bool is_nvdimm;
-AcpiSratMemoryAffinity *numamem;
-MemoryAffinityFlags flags;
-
-for (cur = base, info = info_list;
- cur < end;
- cur += size, info = info->next) {
-numamem = acpi_data_push(table_data, sizeof *numamem);
-
-if (!info) {
-/*
- * Entry is required for Windows to enable memory hotplug in OS
- * and for Linux to enable SWIOTLB when booted with less than
- * 4G of RAM. Windows works better if the entry sets proximity
- * to the highest NUMA node in the machine at the end of the
- * reserved space.
- * Memory devices may override proximity set by this entry,
- * providing _PXM method if necessary.
- */
-build_srat_memory(numamem, end - 1, 1, default_node,
-  MEM_AFFINITY_HOTPLUGGABLE | 
MEM_AFFINITY_ENABLED);
-break;
-}
-
-mi = info->value;
-is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
-di = !is_nvdimm ? mi->u.dimm.data : mi->u.nvdimm.data;
-
-if (cur < di->addr) {
-build_srat_memory(numamem, cur, di->addr - cur, default_node,
-  MEM_AFFINITY_HOTPLUGGABLE | 
MEM_AFFINITY_ENABLED);
-numamem = acpi_data_push(table_data, sizeof *numamem);
-}
-
-size = di->size;
-
-flags = MEM_AFFINITY_ENABLED;
-if (di->hotpluggable) {
-flags |= MEM_AFFINITY_HOTPLUGGABLE;
-}
-if (is_nvdimm) {
-flags |= MEM_AFFINITY_NON_VOLATILE;
-}
-
-build_srat_memory(numamem, di->addr, size, di->node, flags);
-}
-
-qapi_free_MemoryDeviceInfoList(info_list);
-}
-
 static void
 build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
 {
@@ -2414,10 +2356,19 @@ build_srat(GArray *table_data, BIOSLinker *linker, 
MachineState *machine)
 build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
 }
 
+/*
+ * Entry is required for Windows to enable memory hotplug in OS
+ * and for Linux to enable SWIOTLB when booted with less than
+ * 4G of RAM. Windows works better if the entry sets proximity
+ * to the highest NUMA node in the machine.
+ * Memory devices may override proximity set by this entry,
+ * providing _PXM method if necessary.
+ */
 if (hotplugabble_address_space_size) {
-build_srat_hotpluggable_memory(table_data, 
machine->device_memory->base,
-   hotplugabble_address_space_size,
-   pcms->numa_nodes - 1);
+numamem = acpi_data_push(table_data, sizeof *numamem);
+build_srat_

Re: [Qemu-devel] [PATCH 3/3] ui: remove support for SDL1.2 in favour of SDL2

2018-08-22 Thread Daniel P . Berrangé
On Wed, Aug 08, 2018 at 02:51:01PM +0100, Peter Maydell wrote:
> On 8 August 2018 at 11:49, Daniel P. Berrangé  wrote:
> > SDL1.2 was deprecated in the 2.12.0 release with:
> >
> >   commit e52c6ba34149b4f39c3fd60e59ee32b809db2bfa
> >   Author: Daniel P. Berrange 
> >   Date:   Mon Jan 15 14:25:33 2018 +
> >
> > ui: deprecate use of SDL 1.2 in favour of 2.0 series
> >
> > The SDL 2.0 release was made in Aug, 2013:
> >
> >   https://www.libsdl.org/release/
> >
> > That will soon be 4 + 1/2 years ago, which is enough time to consider
> > the 2.0 series widely supported.
> >
> > Thus we deprecate the SDL 1.2 support, which will allow us to delete it
> > in the last release of 2018. By this time, SDL 2.0 will be more than 5
> > years old.
> >
> > Signed-off-by: Daniel P. Berrange 
> > Reviewed-by: Marc-André Lureau 
> > Message-id: 20180115142533.24585-1-berra...@redhat.com
> > Signed-off-by: Gerd Hoffmann 
> >
> > It is thus able to be removed in the 3.1.0 release.
> 
> At least one of the BSD VMs in tests/vm/ is still using SDL1.2.
> I think we should update that VM before we drop SDL1.2 support.

I confirmed that the freebsd & netbsd images still work as SDL just gets
automatically disabled by configure. The openbsd image breaks hard though
because SDL is the only available audio backend on openbsd, effectively
making SDL a mandatory requirement.

So we definitely need to update the openbsd image to have SDL2.


Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



[Qemu-devel] [PATCH v3 01/10] configure: We don't want to clean configuration files

2018-08-22 Thread Juan Quintela
If you don't want to compile everything, you configure
config-devices.mak.  And then make clean remove it, and make will
create a default one without your configuration.  Fix it by not
removing it on clean target.  Remove it instead on distclean.

Signed-off-by: Juan Quintela 

--

Remove it instead on distclean.

Signed-off-by: Juan Quintela 
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index b7c6e57de6..fe623e4634 100644
--- a/Makefile
+++ b/Makefile
@@ -752,7 +752,7 @@ clean:
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
rm -f $$d/qemu-options.def; \
 done
-   rm -f $(SUBDIR_DEVICES_MAK) config-all-devices.mak
+   rm -f config-all-devices.mak
 
 VERSION ?= $(shell cat VERSION)
 
@@ -764,6 +764,7 @@ qemu-%.tar.bz2:
 distclean: clean
rm -f config-host.mak config-host.h* config-host.ld $(DOCS) 
qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
rm -f config-all-devices.mak config-all-disas.mak config.status
+   rm -f $(SUBDIR_DEVICES_MAK)
rm -f po/*.mo tests/qemu-iotests/common.env
rm -f roms/seabios/config.mak roms/vgabios/config.mak
rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
-- 
2.17.1




[Qemu-devel] [PATCH v3 04/10] check: Only test usb-xhci-nec when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 15296be246..9a918f7655 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -290,8 +290,9 @@ endif
 gcov-files-i386-$(CONFIG_USB_EHCI) += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
-check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
-gcov-files-i386-y += hw/usb/hcd-xhci.c
+check-qtest-i386-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
+gcov-files-i386-$(CONFIG_USB_XHCI) += hw/usb/hcd-xhci.c
+gcov-files-i386-$(CONFIG_USB_XHCI) += hw/usb/hcd-xhci-nec.c
 check-qtest-i386-y += tests/cpu-plug-test$(EXESUF)
 check-qtest-i386-y += tests/q35-test$(EXESUF)
 check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
@@ -349,8 +350,8 @@ check-qtest-ppc64-$(CONFIG_USB_OHCI) += 
tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-ppc64-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
 check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
 gcov-files-ppc64-$(CONFIG_USB_UHCI) += hw/usb/hcd-uhci.c
-check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF)
-gcov-files-ppc64-y += hw/usb/hcd-xhci.c
+check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
+gcov-files-ppc64-$(CONFIG_USB_XHCI) += hw/usb/hcd-xhci.c
 check-qtest-ppc64-y += $(check-qtest-virtio-y)
 check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-ppc64-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH v3 03/10] check: Only test isa-testdev when it is compiled in

2018-08-22 Thread Juan Quintela
Once there, untangle endianness-test and boot-serial-test.

Signed-off-by: Juan Quintela 

--

boot-serial-test don't depend on isa-testdev.  Thanks Thomas.

Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index a705793381..15296be246 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -248,7 +248,7 @@ gcov-files-pci-y += hw/misc/ivshmem.c
 check-qtest-pci-y += tests/megasas-test$(EXESUF)
 gcov-files-pci-y += hw/scsi/megasas.c
 
-check-qtest-i386-y = tests/endianness-test$(EXESUF)
+check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
 gcov-files-i386-y = hw/block/fdc.c
 check-qtest-i386-y += tests/ide-test$(EXESUF)
@@ -321,15 +321,15 @@ check-qtest-m68k-y = tests/boot-serial-test$(EXESUF)
 
 check-qtest-microblaze-y = tests/boot-serial-test$(EXESUF)
 
-check-qtest-mips-y = tests/endianness-test$(EXESUF)
-
-check-qtest-mips64-y = tests/endianness-test$(EXESUF)
-
-check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
-
 check-qtest-moxie-y = tests/boot-serial-test$(EXESUF)
 
-check-qtest-ppc-y = tests/endianness-test$(EXESUF)
+check-qtest-mips-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+
+check-qtest-mips64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+
+check-qtest-mips64el-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+
+check-qtest-ppc-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
 check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
@@ -360,16 +360,16 @@ check-qtest-ppc64-y += tests/numa-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
 check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
 
-check-qtest-sh4-y = tests/endianness-test$(EXESUF)
+check-qtest-sh4-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 
-check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
+check-qtest-sh4eb-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 
 check-qtest-sparc-y = tests/prom-env-test$(EXESUF)
 check-qtest-sparc-y += tests/m48t59-test$(EXESUF)
 gcov-files-sparc-y = hw/timer/m48t59.c
 check-qtest-sparc-y += tests/boot-serial-test$(EXESUF)
 
-check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
+check-qtest-sparc64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-sparc64-y += tests/prom-env-test$(EXESUF)
 check-qtest-sparc64-y += tests/boot-serial-test$(EXESUF)
 
-- 
2.17.1




[Qemu-devel] [PATCH v3 02/10] check: Use land/lor when possible

2018-08-22 Thread Juan Quintela
So everythig is (a bit) more consistent

Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 6dc8d06f4c..a705793381 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -98,11 +98,9 @@ check-unit-y += tests/test-block-backend$(EXESUF)
 check-unit-y += tests/test-x86-cpuid$(EXESUF)
 # all code tested by test-x86-cpuid is inside topology.h
 gcov-files-test-x86-cpuid-y =
-ifeq ($(CONFIG_SOFTMMU),y)
-check-unit-y += tests/test-xbzrle$(EXESUF)
-gcov-files-test-xbzrle-y = migration/xbzrle.c
-check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
-endif
+check-unit-$(CONFIG_SOFTMMU) += tests/test-xbzrle$(EXESUF)
+gcov-files-test-xbzrle-$(CONFIG_SOFTMMU) = migration/xbzrle.c
+check-unit-$(call land, $(CONFIG_SOFTMMU), $(CONFIG_POSIX)) += 
tests/test-vmstate$(EXESUF)
 check-unit-y += tests/test-cutils$(EXESUF)
 gcov-files-test-cutils-y += util/cutils.c
 check-unit-y += tests/test-shift128$(EXESUF)
@@ -299,9 +297,7 @@ check-qtest-i386-y += tests/q35-test$(EXESUF)
 check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
 gcov-files-i386-y += hw/pci-host/q35.c
 check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += 
tests/vhost-user-test$(EXESUF)
-ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
-check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += 
tests/vhost-user-test$(EXESUF)
-endif
+check-qtest-x86_64-$(call lor, $(CONFIG_VHOST_USER_NET_TEST_i386), 
$(CONFIG_VHOST_USER_NET_TEST_x86_64)) += tests/vhost-user-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-swtpm-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-swtpm-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH v3 00/10] Don't check disabled drivers

2018-08-22 Thread Juan Quintela
Hi

In this v3 series:
- Redo the make clean removal of config-devices.mak

- Remove the CONFIG_SERIAL bits, real solution require more thought (I
  tried to run boot-serial-test on all the architectures with serial
  and it was not good).  Too many coments, will try to do some cleanup
  first.

- isa-testdev: I think that one is ok now
- remove x86_64-softmmu instead of i386-softmmu, consistence is great.
- ivshm: it is trivial
- endiannes: I think now it is correct

- xhci-nec: Now also check for ppc64.  I was tying to test xhci (and
  the other hcds) all architectures.  Let's say that it was not pretty
  either.

This are the patches that I think that are ready to go, please review.

Later, Juan

[v2]
this are the patches from v1 that have been reviewed.  Minor changes
in spelled done.  I expect to move those for 3.1.  I will post the
changes and additons on top of this one.

Complain now, or I will send the pull once 3.1 opens.

ToDo:
- I am working on virtio-pci being split
- I plan to integrate virtio-ccw split from Thomas
- I started trying to "untangle" q35 and piix, but it is really deppe
  tangled.

Should I sent the pull request directly, or go through maintainers?

Thanks, Juan.


[v2]
We can disable drivers with "-softmmu/config-devices.mak".  But
if we remove drivers there and do "make check", we still try to test
that devices (that are compiled in).  This is a list with the removal
of the ovbious ones.

While I was doing this I fonund:
- we remove -softmmu/config-devices.mak when we do make clean
  That is an "user" configuration file, we shouldn't do that.
- Use land/lor for consistence
- CONFIG_SERIAL was defined twice for all configurations that include
  pci.mak, fix it.
- pvpanic: We can do the same tricks that everywhere to be able to
  compile it out.

To do a better job, we are in trouble because we only have
"config-devices.mak", but not config-devices.h, so we can't disable
part of the tests/files when we don't want them.  Bigger culprits here
are usb and virtio devices, basically all of them depend of the others
one way or another.

Motivation:

- I compile *lots* of times a day, so it is great to be able to
  compile less devices, it takes less time.
- But if I want to do make check, I need to compile basically a full
  configuration for that platform, so we are at square one.

There are still things that still take too long:
- e1000*/virtio-net pxe test.  It takes more than one second for each,
  and we have e1000/virtio-net/e1000p/virtio-net(again).
- qom tests.  We check _all_ machine types here.  In fast mode, IMHO
  we would only want something like pc-3.0 and q35-30 in fast mode
  (in slow mode everything is ok).
- migration tests: yes, they also took around 5-6 seconds in total,
  and we are adding new tests.  Something needs to be done here.

Time to do "make check" on my laptop (reasonably fast laptop from this
Jannuary) is almost 3mins.  This makes it too long to run continously
for testing that I haven't broken anything.

In another submission I wil send some examples on "how" to disable
other drivers that we can't do now.  But it requires that we generate
config-devices.h to be able to apply them (or yet more complicated
things of registration, see how virtio devices needs to be disabled)

Please review, Juan.


Juan Quintela (10):
  configure: We don't want to clean configuration files
  check: Use land/lor when possible
  check: Only test isa-testdev when it is compiled in
  check: Only test usb-xhci-nec when it is compiled in
  x86_64-softmmu: Configuration is identical to i386-softmmu
  check: Only test ivshm when it is compiled in
  check: Only test boot-serial when sga is compiled in
  check: Move VMXNET3 test to common
  check: Move endianess test to common
  check: Move wdt_ib700 test to common

 Makefile   |  3 +-
 default-configs/x86_64-softmmu.mak | 67 +-
 tests/Makefile.include | 51 ---
 3 files changed, 21 insertions(+), 100 deletions(-)

-- 
2.17.1




[Qemu-devel] [PATCH v3 05/10] x86_64-softmmu: Configuration is identical to i386-softmmu

2018-08-22 Thread Juan Quintela
If we ever changed that, just make the things that are different
explicit.

Signed-off-by: Juan Quintela 
---
 default-configs/x86_64-softmmu.mak | 67 +-
 1 file changed, 1 insertion(+), 66 deletions(-)

diff --git a/default-configs/x86_64-softmmu.mak 
b/default-configs/x86_64-softmmu.mak
index 0390b4303c..64b2ee2960 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -1,68 +1,3 @@
 # Default configuration for x86_64-softmmu
 
-include pci.mak
-include sound.mak
-include usb.mak
-CONFIG_QXL=$(CONFIG_SPICE)
-CONFIG_VGA_ISA=y
-CONFIG_VGA_CIRRUS=y
-CONFIG_VMWARE_VGA=y
-CONFIG_VMXNET3_PCI=y
-CONFIG_VIRTIO_VGA=y
-CONFIG_VMMOUSE=y
-CONFIG_IPMI=y
-CONFIG_IPMI_LOCAL=y
-CONFIG_IPMI_EXTERN=y
-CONFIG_ISA_IPMI_KCS=y
-CONFIG_ISA_IPMI_BT=y
-CONFIG_SERIAL=y
-CONFIG_SERIAL_ISA=y
-CONFIG_PARALLEL=y
-CONFIG_I8254=y
-CONFIG_PCSPK=y
-CONFIG_PCKBD=y
-CONFIG_FDC=y
-CONFIG_ACPI=y
-CONFIG_ACPI_X86=y
-CONFIG_ACPI_X86_ICH=y
-CONFIG_ACPI_MEMORY_HOTPLUG=y
-CONFIG_ACPI_CPU_HOTPLUG=y
-CONFIG_APM=y
-CONFIG_I8257=y
-CONFIG_IDE_ISA=y
-CONFIG_IDE_PIIX=y
-CONFIG_NE2000_ISA=y
-CONFIG_HPET=y
-CONFIG_APPLESMC=y
-CONFIG_I8259=y
-CONFIG_PFLASH_CFI01=y
-CONFIG_TPM_TIS=$(CONFIG_TPM)
-CONFIG_TPM_CRB=$(CONFIG_TPM)
-CONFIG_MC146818RTC=y
-CONFIG_PCI_PIIX=y
-CONFIG_WDT_IB700=y
-CONFIG_ISA_DEBUG=y
-CONFIG_ISA_TESTDEV=y
-CONFIG_VMPORT=y
-CONFIG_SGA=y
-CONFIG_LPC_ICH9=y
-CONFIG_PCI_Q35=y
-CONFIG_APIC=y
-CONFIG_IOAPIC=y
-CONFIG_PVPANIC=y
-CONFIG_MEM_HOTPLUG=y
-CONFIG_NVDIMM=y
-CONFIG_ACPI_NVDIMM=y
-CONFIG_PCIE_PORT=y
-CONFIG_XIO3130=y
-CONFIG_IOH3420=y
-CONFIG_I82801B11=y
-CONFIG_SMBIOS=y
-CONFIG_HYPERV_TESTDEV=$(CONFIG_KVM)
-CONFIG_PXB=y
-CONFIG_ACPI_VMGENID=y
-CONFIG_FW_CFG_DMA=y
-CONFIG_I2C=y
-CONFIG_SEV=$(CONFIG_KVM)
-CONFIG_VTD=y
-CONFIG_AMD_IOMMU=y
+include i386-softmmu.mak
-- 
2.17.1




[Qemu-devel] [PATCH v3 08/10] check: Move VMXNET3 test to common

2018-08-22 Thread Juan Quintela
We protect it with CONFIG_VMXNET3_PCI now, so no need to also put it
on i386.

Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index d524e1bdeb..91ffde3103 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -247,6 +247,8 @@ check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += 
tests/ivshmem-test$(EXESUF)
 gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
 check-qtest-pci-y += tests/megasas-test$(EXESUF)
 gcov-files-pci-y += hw/scsi/megasas.c
+check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
+gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
 
 check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -270,8 +272,6 @@ gcov-files-i386-$(CONFIG_WDT_IB700) += 
hw/watchdog/watchdog.c hw/watchdog/wdt_ib
 check-qtest-i386-y += tests/tco-test$(EXESUF)
 check-qtest-i386-y += $(check-qtest-pci-y)
 gcov-files-i386-y += $(gcov-files-pci-y)
-check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
-gcov-files-i386-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
 gcov-files-i386-y += hw/net/net_rx_pkt.c
 gcov-files-i386-y += hw/net/net_tx_pkt.c
 check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH v3 06/10] check: Only test ivshm when it is compiled in

2018-08-22 Thread Juan Quintela
Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9a918f7655..116e93cdb6 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -243,8 +243,8 @@ gcov-files-pci-y += hw/display/virtio-gpu-pci.c
 gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c
 check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
 gcov-files-pci-$(CONFIG_HDA) += hw/audio/intel-hda.c hw/audio/hda-codec.c
-check-qtest-pci-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
-gcov-files-pci-y += hw/misc/ivshmem.c
+check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
+gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
 check-qtest-pci-y += tests/megasas-test$(EXESUF)
 gcov-files-pci-y += hw/scsi/megasas.c
 
@@ -358,7 +358,7 @@ check-qtest-ppc64-$(CONFIG_POSIX) += 
tests/test-filter-mirror$(EXESUF)
 check-qtest-ppc64-$(CONFIG_RTL8139_PCI) += 
tests/test-filter-redirector$(EXESUF)
 check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
 check-qtest-ppc64-y += tests/numa-test$(EXESUF)
-check-qtest-ppc64-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
+check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
 check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
 
 check-qtest-sh4-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH v3 10/10] check: Move wdt_ib700 test to common

2018-08-22 Thread Juan Quintela
It is protected by CONFIG_WDT_IB700.

Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index f646cd0524..adfce0be95 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -250,6 +250,8 @@ gcov-files-pci-y += hw/scsi/megasas.c
 check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
 gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
 check-qtest-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+check-qtest-$(CONFIG_WDT_IB700) += tests/wdt_ib700-test$(EXESUF)
+gcov-files-$(CONFIG_WDT_IB700) += hw/watchdog/watchdog.c 
hw/watchdog/wdt_ib700.c
 
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
 gcov-files-i386-y = hw/block/fdc.c
@@ -267,8 +269,6 @@ check-qtest-i386-y += tests/ipmi-bt-test$(EXESUF)
 check-qtest-i386-y += tests/i440fx-test$(EXESUF)
 check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
 check-qtest-i386-y += tests/drive_del-test$(EXESUF)
-check-qtest-i386-$(CONFIG_WDT_IB700) += tests/wdt_ib700-test$(EXESUF)
-gcov-files-i386-$(CONFIG_WDT_IB700) += hw/watchdog/watchdog.c 
hw/watchdog/wdt_ib700.c
 check-qtest-i386-y += tests/tco-test$(EXESUF)
 check-qtest-i386-y += $(check-qtest-pci-y)
 gcov-files-i386-y += $(gcov-files-pci-y)
-- 
2.17.1




[Qemu-devel] [PATCH v3 07/10] check: Only test boot-serial when sga is compiled in

2018-08-22 Thread Juan Quintela
This is only for x86* architecture.

Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 116e93cdb6..d524e1bdeb 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -257,7 +257,7 @@ check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
 gcov-files-i386-y += hw/block/hd-geometry.c
 check-qtest-i386-y += tests/boot-order-test$(EXESUF)
 check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
-check-qtest-i386-y += tests/boot-serial-test$(EXESUF)
+check-qtest-i386-$(CONFIG_SGA) += tests/boot-serial-test$(EXESUF)
 check-qtest-i386-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
 check-qtest-i386-y += tests/ipmi-kcs-test$(EXESUF)
-- 
2.17.1




[Qemu-devel] [PATCH v3 09/10] check: Move endianess test to common

2018-08-22 Thread Juan Quintela
It is already protected by CONFIG_ISA_TESTDEV in all architectures.

Signed-off-by: Juan Quintela 
---
 tests/Makefile.include | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 91ffde3103..f646cd0524 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -249,8 +249,8 @@ check-qtest-pci-y += tests/megasas-test$(EXESUF)
 gcov-files-pci-y += hw/scsi/megasas.c
 check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
 gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
+check-qtest-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 
-check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
 gcov-files-i386-y = hw/block/fdc.c
 check-qtest-i386-y += tests/ide-test$(EXESUF)
@@ -324,13 +324,6 @@ check-qtest-microblaze-y = tests/boot-serial-test$(EXESUF)
 
 check-qtest-moxie-y = tests/boot-serial-test$(EXESUF)
 
-check-qtest-mips-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
-
-check-qtest-mips64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
-
-check-qtest-mips64el-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
-
-check-qtest-ppc-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
 check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
@@ -361,16 +354,11 @@ check-qtest-ppc64-y += tests/numa-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
 check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
 
-check-qtest-sh4-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
-
-check-qtest-sh4eb-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
-
 check-qtest-sparc-y = tests/prom-env-test$(EXESUF)
 check-qtest-sparc-y += tests/m48t59-test$(EXESUF)
 gcov-files-sparc-y = hw/timer/m48t59.c
 check-qtest-sparc-y += tests/boot-serial-test$(EXESUF)
 
-check-qtest-sparc64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-sparc64-y += tests/prom-env-test$(EXESUF)
 check-qtest-sparc64-y += tests/boot-serial-test$(EXESUF)
 
-- 
2.17.1




Re: [Qemu-devel] [PATCH v6 01/11] migration: disable RDMA WRITE after postcopy started

2018-08-22 Thread Juan Quintela
Lidong Chen  wrote:
> From: Lidong Chen 
>
> RDMA WRITE operations are performed with no notification to the destination
> qemu, then the destination qemu can not wakeup. This patch disable RDMA WRITE
> after postcopy started.
>
> Signed-off-by: Lidong Chen 
> Reviewed-by: Dr. David Alan Gilbert 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v6 04/11] migration: Stop rdma yielding during incoming postcopy

2018-08-22 Thread Juan Quintela
Lidong Chen  wrote:
> From: Lidong Chen 
>
> During incoming postcopy, the destination qemu will invoke
> qemu_rdma_wait_comp_channel in a seprate thread. So does not use rdma
> yield, and poll the completion channel fd instead.
>
> Signed-off-by: Lidong Chen 
> Reviewed-by: Dr. David Alan Gilbert 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH] pc: acpi: revert back to 1 SRAT entry for hotpluggable area

2018-08-22 Thread Laszlo Ersek
On 08/22/18 11:46, Igor Mammedov wrote:
> Commit
>   10efd7e108 "pc: acpi: fix memory hotplug regression by reducing stub SRAT 
> entry size"
> attemped to fix hotplug regression introduced by
>   848a1cc1e "hw/acpi-build: build SRAT memory affinity structures for DIMM 
> devices"
> 
> fixed issue for Windows/3.0+ linux kernels, however it regressed 2.6 based
> kernels (RHEL6) to the point where guest might crash at boot.
> Reason is that 2.6 kernel discards SRAT table due too small last entry
> which down the road leads to crashes. Hack I've tried in 10efd7e108 is also
> not ACPI spec compliant according to which whole possible RAM should be
> described in SRAT. Revert 10efd7e108 to fix regression for 2.6 based kernels.
> 
> With 10efd7e108 reverted, I've also tried splitting SRAT table statically
> in different ways %/node and %/slot but Windows still fails to online
> 2nd pc-dimm hot-plugged into node 0 (as described in 10efd7e108) and
> sometimes even coldplugged pc-dimms where affected with static SRAT
> partitioning.
> The only known so far way where Windows stays happy is when we have 1
> SRAT entry in the last node covering all hotplug area.
> 
> Revert 848a1cc1e until we come up with a way to avoid regression
> on Windows with hotplug area split in several entries.
> Tested this with 2.6/3.0 based kernels (RHEL6/7) and WS20[08/12/12R2/16]).
> 
> Signed-off-by: Igor Mammedov 
> ---
> CC: haozhong.zh...@intel.com
> CC: m...@redhat.com
> CC: qemu-sta...@nongnu.org
> CC: ehabk...@redhat.com
> CC: ler...@redhat.com
> ---
>  hw/i386/acpi-build.c | 73 
> +---
>  1 file changed, 12 insertions(+), 61 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index e1ee8ae..1599caa 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2251,64 +2251,6 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, 
> GArray *tcpalog)
>  #define HOLE_640K_START  (640 * KiB)
>  #define HOLE_640K_END   (1 * MiB)
>  
> -static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
> -   uint64_t len, int default_node)
> -{
> -MemoryDeviceInfoList *info_list = qmp_memory_device_list();
> -MemoryDeviceInfoList *info;
> -MemoryDeviceInfo *mi;
> -PCDIMMDeviceInfo *di;
> -uint64_t end = base + len, cur, size;
> -bool is_nvdimm;
> -AcpiSratMemoryAffinity *numamem;
> -MemoryAffinityFlags flags;
> -
> -for (cur = base, info = info_list;
> - cur < end;
> - cur += size, info = info->next) {
> -numamem = acpi_data_push(table_data, sizeof *numamem);
> -
> -if (!info) {
> -/*
> - * Entry is required for Windows to enable memory hotplug in OS
> - * and for Linux to enable SWIOTLB when booted with less than
> - * 4G of RAM. Windows works better if the entry sets proximity
> - * to the highest NUMA node in the machine at the end of the
> - * reserved space.
> - * Memory devices may override proximity set by this entry,
> - * providing _PXM method if necessary.
> - */
> -build_srat_memory(numamem, end - 1, 1, default_node,
> -  MEM_AFFINITY_HOTPLUGGABLE | 
> MEM_AFFINITY_ENABLED);
> -break;
> -}
> -
> -mi = info->value;
> -is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
> -di = !is_nvdimm ? mi->u.dimm.data : mi->u.nvdimm.data;
> -
> -if (cur < di->addr) {
> -build_srat_memory(numamem, cur, di->addr - cur, default_node,
> -  MEM_AFFINITY_HOTPLUGGABLE | 
> MEM_AFFINITY_ENABLED);
> -numamem = acpi_data_push(table_data, sizeof *numamem);
> -}
> -
> -size = di->size;
> -
> -flags = MEM_AFFINITY_ENABLED;
> -if (di->hotpluggable) {
> -flags |= MEM_AFFINITY_HOTPLUGGABLE;
> -}
> -if (is_nvdimm) {
> -flags |= MEM_AFFINITY_NON_VOLATILE;
> -}
> -
> -build_srat_memory(numamem, di->addr, size, di->node, flags);
> -}
> -
> -qapi_free_MemoryDeviceInfoList(info_list);
> -}
> -
>  static void
>  build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
>  {
> @@ -2414,10 +2356,19 @@ build_srat(GArray *table_data, BIOSLinker *linker, 
> MachineState *machine)
>  build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
>  }
>  
> +/*
> + * Entry is required for Windows to enable memory hotplug in OS
> + * and for Linux to enable SWIOTLB when booted with less than
> + * 4G of RAM. Windows works better if the entry sets proximity
> + * to the highest NUMA node in the machine.
> + * Memory devices may override proximity set by this entry,
> + * providing _PXM method if necessary.
> + */
>  if (hotplugabble_address_space_size) {
> -bui

Re: [Qemu-devel] [PATCH v6 05/11] migration: implement io_set_aio_fd_handler function for RDMA QIOChannel

2018-08-22 Thread Juan Quintela
Lidong Chen  wrote:
> From: Lidong Chen 
>
> if qio_channel_rdma_readv return QIO_CHANNEL_ERR_BLOCK, the destination qemu
> crash.
>
> The backtrace is:
> (gdb) bt
> #0  0x in ?? ()
> #1  0x008db50e in qio_channel_set_aio_fd_handler (ioc=0x38111e0, 
> ctx=0x3726080,
> io_read=0x8db841 , io_write=0x0, 
> opaque=0x38111e0) at io/channel.c:
> #2  0x008db952 in qio_channel_set_aio_fd_handlers (ioc=0x38111e0) 
> at io/channel.c:438
> #3  0x008dbab4 in qio_channel_yield (ioc=0x38111e0, 
> condition=G_IO_IN) at io/channel.c:47
> #4  0x007a870b in channel_get_buffer (opaque=0x38111e0, 
> buf=0x440c038 "", pos=0, size=327
> at migration/qemu-file-channel.c:83
> #5  0x007a70f6 in qemu_fill_buffer (f=0x440c000) at 
> migration/qemu-file.c:299
> #6  0x007a79d0 in qemu_peek_byte (f=0x440c000, offset=0) at 
> migration/qemu-file.c:562
> #7  0x007a7a22 in qemu_get_byte (f=0x440c000) at 
> migration/qemu-file.c:575
> #8  0x007a7c78 in qemu_get_be32 (f=0x440c000) at 
> migration/qemu-file.c:655
> #9  0x007a0508 in qemu_loadvm_state (f=0x440c000) at 
> migration/savevm.c:2126
> #10 0x00794141 in process_incoming_migration_co (opaque=0x0) at 
> migration/migration.c:366
> #11 0x0095c598 in coroutine_trampoline (i0=84033984, i1=0) at 
> util/coroutine-ucontext.c:1
> #12 0x7f9c0db56d40 in ?? () from /lib64/libc.so.6
> #13 0x7f96fe858760 in ?? ()
> #14 0x in ?? ()
>
> RDMA QIOChannel not implement io_set_aio_fd_handler. so
> qio_channel_set_aio_fd_handler will access NULL pointer.
>
> Signed-off-by: Lidong Chen 
> Reviewed-by: Juan Quintela 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v6 06/11] migration: invoke qio_channel_yield only when qemu_in_coroutine()

2018-08-22 Thread Juan Quintela
Lidong Chen  wrote:
> From: Lidong Chen 
>
> when qio_channel_read return QIO_CHANNEL_ERR_BLOCK, the source qemu crash.
>
> The backtrace is:
> (gdb) bt
> #0  0x7fb20aba91d7 in raise () from /lib64/libc.so.6
> #1  0x7fb20abaa8c8 in abort () from /lib64/libc.so.6
> #2  0x7fb20aba2146 in __assert_fail_base () from /lib64/libc.so.6
> #3  0x7fb20aba21f2 in __assert_fail () from /lib64/libc.so.6
> #4  0x008dba2d in qio_channel_yield (ioc=0x22f9e20, 
> condition=G_IO_IN) at io/channel.c:460
> #5  0x007a870b in channel_get_buffer (opaque=0x22f9e20, 
> buf=0x3d54038 "", pos=0, size=32768)
> at migration/qemu-file-channel.c:83
> #6  0x007a70f6 in qemu_fill_buffer (f=0x3d54000) at 
> migration/qemu-file.c:299
> #7  0x007a79d0 in qemu_peek_byte (f=0x3d54000, offset=0) at 
> migration/qemu-file.c:562
> #8  0x007a7a22 in qemu_get_byte (f=0x3d54000) at 
> migration/qemu-file.c:575
> #9  0x007a7c46 in qemu_get_be16 (f=0x3d54000) at 
> migration/qemu-file.c:647
> #10 0x00796db7 in source_return_path_thread (opaque=0x2242280) at 
> migration/migration.c:1794
> #11 0x009428fa in qemu_thread_start (args=0x3e58420) at 
> util/qemu-thread-posix.c:504
> #12 0x7fb20af3ddc5 in start_thread () from /lib64/libpthread.so.0
> #13 0x7fb20ac6b74d in clone () from /lib64/libc.so.6
>
> This patch fixed by invoke qio_channel_yield only when qemu_in_coroutine().
>
> Signed-off-by: Lidong Chen 
> Reviewed-by: Juan Quintela 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v6 07/11] migration: poll the cm event while wait RDMA work request completion

2018-08-22 Thread Juan Quintela
Lidong Chen  wrote:
> From: Lidong Chen 
>
> If the peer qemu is crashed, the qemu_rdma_wait_comp_channel function
> maybe loop forever. so we should also poll the cm event fd, and when
> receive RDMA_CM_EVENT_DISCONNECTED and RDMA_CM_EVENT_DEVICE_REMOVAL,
> we consider some error happened.
>
> Signed-off-by: Lidong Chen 
> Signed-off-by: Gal Shachaf 
> Signed-off-by: Aviad Yehezkel 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v3 01/10] configure: We don't want to clean configuration files

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> If you don't want to compile everything, you configure
> config-devices.mak.  And then make clean remove it, and make will
> create a default one without your configuration.  Fix it by not
> removing it on clean target.  Remove it instead on distclean.

Sounds like a good idea!

> Signed-off-by: Juan Quintela 
> 
> --
> 
> Remove it instead on distclean.
> 
> Signed-off-by: Juan Quintela 

Please remove the duplicated Sob. Then you can add:

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [PATCH v6 08/11] migration: implement the shutdown for RDMA QIOChannel

2018-08-22 Thread Juan Quintela
Lidong Chen  wrote:
> From: Lidong Chen 
>
> Because RDMA QIOChannel not implement shutdown function,
> If the to_dst_file was set error, the return path thread
> will wait forever. and the migration thread will wait
> return path thread exit.
>
> the backtrace of return path thread is:
>
> (gdb) bt
> #0  0x7f372a76bb0f in ppoll () from /lib64/libc.so.6
> #1  0x0071dc24 in qemu_poll_ns (fds=0x7ef7091d0580, nfds=2, 
> timeout=1)
> at qemu-timer.c:325
> #2  0x006b2fba in qemu_rdma_wait_comp_channel (rdma=0xd424000)
> at migration/rdma.c:1501
> #3  0x006b3191 in qemu_rdma_block_for_wrid (rdma=0xd424000, 
> wrid_requested=4000,
> byte_len=0x7ef7091d0640) at migration/rdma.c:1580
> #4  0x006b3638 in qemu_rdma_exchange_get_response (rdma=0xd424000,
> head=0x7ef7091d0720, expecting=3, idx=0) at migration/rdma.c:1726
> #5  0x006b3ad6 in qemu_rdma_exchange_recv (rdma=0xd424000, 
> head=0x7ef7091d0720,
> expecting=3) at migration/rdma.c:1903
> #6  0x006b5d03 in qemu_rdma_get_buffer (opaque=0x6a57dc0, 
> buf=0x5c80030 "", pos=8,
> size=32768) at migration/rdma.c:2714
> #7  0x006a9635 in qemu_fill_buffer (f=0x5c8) at 
> migration/qemu-file.c:232
> #8  0x006a9ecd in qemu_peek_byte (f=0x5c8, offset=0)
> at migration/qemu-file.c:502
> #9  0x006a9f1f in qemu_get_byte (f=0x5c8) at 
> migration/qemu-file.c:515
> #10 0x006aa162 in qemu_get_be16 (f=0x5c8) at 
> migration/qemu-file.c:591
> #11 0x006a46d3 in source_return_path_thread (
> opaque=0xd826a0 ) at 
> migration/migration.c:1331
> #12 0x7f372aa49e25 in start_thread () from /lib64/libpthread.so.0
> #13 0x7f372a77635d in clone () from /lib64/libc.so.6
>
> the backtrace of migration thread is:
>
> (gdb) bt
> #0  0x7f372aa4af57 in pthread_join () from /lib64/libpthread.so.0
> #1  0x007d5711 in qemu_thread_join (thread=0xd826f8 
> )
> at util/qemu-thread-posix.c:504
> #2  0x006a4bc5 in await_return_path_close_on_source (
> ms=0xd826a0 ) at migration/migration.c:1460
> #3  0x006a53e4 in migration_completion (s=0xd826a0 
> ,
> current_active_state=4, old_vm_running=0x7ef7089cf976, 
> start_time=0x7ef7089cf980)
> at migration/migration.c:1695
> #4  0x006a5c54 in migration_thread (opaque=0xd826a0 
> )
> at migration/migration.c:1837
> #5  0x7f372aa49e25 in start_thread () from /lib64/libpthread.so.0
> #6  0x7f372a77635d in clone () from /lib64/libc.so.6
>
> Signed-off-by: Lidong Chen 
> Reviewed-by: Dr. David Alan Gilbert 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH] tests/migration-test: Turn kvm_hv message into a g_debug message

2018-08-22 Thread Juan Quintela
Thomas Huth  wrote:
> When running "make check" on a non-POWER host, there is currently an ugly
> line in the output like this:
>
>   [...]
>   GTESTER check-qtest-nios2
>   GTESTER check-qtest-or1k
>   GTESTER check-qtest-ppc64
> Skipping test: kvm_hv not available Skipping test: kvm_hv not available 
> Skipping test: kvm_hv not available Skipping test: kvm_hv not available   
> GTESTER check-qtest-ppcemb
>   GTESTER check-qtest-ppc
>   GTESTER check-qtest-riscv32
>   GTESTER check-qtest-riscv64
>   [...]
>
> Move the check to the beginning of the main function instead, so that
> we do not have to test the condition again and again for each test,
> and better use g_test_message() instead of g_print() here, like it is
> also done in ufd_version_check() already.
>
> Signed-off-by: Thomas Huth 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v3 02/10] check: Use land/lor when possible

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> So everythig is (a bit) more consistent
> 
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
[...]
> @@ -299,9 +297,7 @@ check-qtest-i386-y += tests/q35-test$(EXESUF)
>  check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
>  gcov-files-i386-y += hw/pci-host/q35.c
>  check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += 
> tests/vhost-user-test$(EXESUF)
> -ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
> -check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += 
> tests/vhost-user-test$(EXESUF)
> -endif
> +check-qtest-x86_64-$(call lor, $(CONFIG_VHOST_USER_NET_TEST_i386), 
> $(CONFIG_VHOST_USER_NET_TEST_x86_64)) += tests/vhost-user-test$(EXESUF)

I think that is the wrong condition. It's rather "!i386 AND x86_64" that
you have to test here. Since that line will get incredibly long with the
$(call ...) expressions, I'd suggest to rather drop this hunk, I think
it's more readable the way it is.

 Thomas



Re: [Qemu-devel] Slow boot in QEMU with virtio-scsi disks

2018-08-22 Thread Greg Kurz
On Sat, 11 Aug 2018 19:39:56 +0200
Oleksandr Natalenko  wrote:

> Hi.
> 
> On 11.08.2018 14:23, Ming Lei wrote:
> > Please test for-4.19/block:
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/log/?h=for-4.19/block
> > 
> > This slow boot issue should have been fixed by the following commits:
> > 
> > 1311326cf475 blk-mq: avoid to synchronize rcu inside 
> > blk_cleanup_queue()
> > 97889f9ac24f blk-mq: remove synchronize_rcu() from 
> > blk_mq_del_queue_tag_set()
> > 5815839b3ca1 blk-mq: introduce new lock for protecting 
> > hctx->dispatch_wait
> > 2278d69f030f blk-mq: don't pass **hctx to blk_mq_mark_tag_wait()
> > 8ab6bb9ee8d0 blk-mq: cleanup blk_mq_get_driver_tag()  
> 
> Indeed, I can confirm that these commits fix the issue.
> 
> Thanks a lot.
> 

So do I.

Thanks Ming Lei for the fix !

Cheers,

--
Greg



Re: [Qemu-devel] [PATCH v3 03/10] check: Only test isa-testdev when it is compiled in

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> Once there, untangle endianness-test and boot-serial-test.
> 
> Signed-off-by: Juan Quintela 
> 
> --
> 
> boot-serial-test don't depend on isa-testdev.  Thanks Thomas.
> 
> Signed-off-by: Juan Quintela 

Please remove the duplicated Sob.

> @@ -321,15 +321,15 @@ check-qtest-m68k-y = tests/boot-serial-test$(EXESUF)
>  
>  check-qtest-microblaze-y = tests/boot-serial-test$(EXESUF)
>  
> -check-qtest-mips-y = tests/endianness-test$(EXESUF)
> -
> -check-qtest-mips64-y = tests/endianness-test$(EXESUF)
> -
> -check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
> -
>  check-qtest-moxie-y = tests/boot-serial-test$(EXESUF)
>  
> -check-qtest-ppc-y = tests/endianness-test$(EXESUF)
> +check-qtest-mips-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> +
> +check-qtest-mips64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> +
> +check-qtest-mips64el-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> +
> +check-qtest-ppc-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)

Maybe keep moxie after mips? So that they stay in alphabetical order?

When you fixed the nits:

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [PATCH v4 02/10] migration: fix counting normal page for compression

2018-08-22 Thread Juan Quintela
guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong 
>
> The compressed page is not normal page
>
> Reviewed-by: Peter Xu 
> Signed-off-by: Xiao Guangrong 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v4 03/10] migration: introduce save_zero_page_to_file

2018-08-22 Thread Juan Quintela
guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong 
>
> It will be used by the compression threads
>
> Reviewed-by: Peter Xu 

Reviewed-by: Juan Quintela 

> Signed-off-by: Xiao Guangrong 
> ---
>  migration/ram.c | 40 ++--
>  1 file changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index d631b9a6fe..49ace30614 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1667,27 +1667,47 @@ static void migration_bitmap_sync(RAMState *rs)
>  /**
>   * save_zero_page: send the zero page to the stream

Fixed by hand, should be save_zero_page_to_file




Re: [Qemu-devel] [PATCH v3 04/10] check: Only test usb-xhci-nec when it is compiled in

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 15296be246..9a918f7655 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -290,8 +290,9 @@ endif
>  gcov-files-i386-$(CONFIG_USB_EHCI) += hw/usb/hcd-ehci.c
>  gcov-files-i386-y += hw/usb/dev-hid.c
>  gcov-files-i386-y += hw/usb/dev-storage.c
> -check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
> -gcov-files-i386-y += hw/usb/hcd-xhci.c
> +check-qtest-i386-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
> +gcov-files-i386-$(CONFIG_USB_XHCI) += hw/usb/hcd-xhci.c
> +gcov-files-i386-$(CONFIG_USB_XHCI) += hw/usb/hcd-xhci-nec.c
>  check-qtest-i386-y += tests/cpu-plug-test$(EXESUF)
>  check-qtest-i386-y += tests/q35-test$(EXESUF)
>  check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
> @@ -349,8 +350,8 @@ check-qtest-ppc64-$(CONFIG_USB_OHCI) += 
> tests/usb-hcd-ohci-test$(EXESUF)
>  gcov-files-ppc64-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
>  check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
>  gcov-files-ppc64-$(CONFIG_USB_UHCI) += hw/usb/hcd-uhci.c
> -check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF)
> -gcov-files-ppc64-y += hw/usb/hcd-xhci.c
> +check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
> +gcov-files-ppc64-$(CONFIG_USB_XHCI) += hw/usb/hcd-xhci.c

Add hcd-xhci-nec.c here, too?

Anyway:

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [PATCH v4 04/10] migration: drop the return value of do_compress_ram_page

2018-08-22 Thread Juan Quintela
guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong 
>
> It is not used and cleans the code up a little
>
> Reviewed-by: Peter Xu 
> Signed-off-by: Xiao Guangrong 
Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v3 05/10] x86_64-softmmu: Configuration is identical to i386-softmmu

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> If we ever changed that, just make the things that are different
> explicit.
> 
> Signed-off-by: Juan Quintela 
> ---
>  default-configs/x86_64-softmmu.mak | 67 +-
>  1 file changed, 1 insertion(+), 66 deletions(-)

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [PATCH v4 06/10] migration: hold the lock only if it is really needed

2018-08-22 Thread Juan Quintela
guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong 
>
> Try to hold src_page_req_mutex only if the queue is not
> empty
>
> Reviewed-by: Dr. David Alan Gilbert 
> Reviewed-by: Peter Xu 
> Signed-off-by: Xiao Guangrong 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v4 05/10] migration: move handle of zero page to the thread

2018-08-22 Thread Juan Quintela
guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong 
>
> Detecting zero page is not a light work, moving it to the thread to
> speed the main thread up, btw, handling ram_release_pages() for the
> zero page is moved to the thread as well
>
> Reviewed-by: Peter Xu 
> Signed-off-by: Xiao Guangrong 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v4 01/10] migration: do not wait for free thread

2018-08-22 Thread Juan Quintela
guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong 
>
> Instead of putting the main thread to sleep state to wait for
> free compression thread, we can directly post it out as normal
> page that reduces the latency and uses CPUs more efficiently
>
> A parameter, compress-wait-thread, is introduced, it can be
> enabled if the user really wants the old behavior
>
> Reviewed-by: Peter Xu 
> Signed-off-by: Xiao Guangrong 

Reviewed-by: Juan Quintela 



Re: [Qemu-devel] [PATCH v3 06/10] check: Only test ivshm when it is compiled in

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 9a918f7655..116e93cdb6 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -243,8 +243,8 @@ gcov-files-pci-y += hw/display/virtio-gpu-pci.c
>  gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c
>  check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
>  gcov-files-pci-$(CONFIG_HDA) += hw/audio/intel-hda.c hw/audio/hda-codec.c
> -check-qtest-pci-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
> -gcov-files-pci-y += hw/misc/ivshmem.c
> +check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
> +gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
>  check-qtest-pci-y += tests/megasas-test$(EXESUF)
>  gcov-files-pci-y += hw/scsi/megasas.c
>  
> @@ -358,7 +358,7 @@ check-qtest-ppc64-$(CONFIG_POSIX) += 
> tests/test-filter-mirror$(EXESUF)
>  check-qtest-ppc64-$(CONFIG_RTL8139_PCI) += 
> tests/test-filter-redirector$(EXESUF)
>  check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
>  check-qtest-ppc64-y += tests/numa-test$(EXESUF)
> -check-qtest-ppc64-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF)
> +check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
>  check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)

I guess we could add a line a la:

gcov-files-ppc64-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c

here, too, but since that's a pre-existing problem:

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [PATCH] char: Enable build of pty on macOS

2018-08-22 Thread Paolo Bonzini
On 21/08/2018 20:29, Peter Maydell wrote:
>>
>>  #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)  \
>>  || defined(__NetBSD__) || defined(__OpenBSD__) || 
>> defined(__DragonFly__) \
>> -|| defined(__GLIBC__)
>> +|| defined(__GLIBC__) || defined(__APPLE__)
> We should fix this by figuring out what the code is actually looking
> for (ie what OS functions), having a configure test for those
> functions, and dropping the big long list of OS ifdefs. Otherwise
> we've just got exactly the same problem for the next unix-ish
> OS that comes along...

It's really looking only for qemu_openpty_raw, which in turn is compiled
for all CONFIG_POSIX systems.  Because the file is already compiled for
CONFIG_POSIX only, the #ifdef is a legacy of the time before
chardev/char-pty.c was split out of qemu-char.c.  It can be removed.

Paolo



Re: [Qemu-devel] [PATCH v3 08/10] check: Move VMXNET3 test to common

2018-08-22 Thread Thomas Huth
On 2018-08-22 12:41, Juan Quintela wrote:
> Thomas Huth  wrote:
>> On 2018-08-22 11:54, Juan Quintela wrote:
>>> We protect it with CONFIG_VMXNET3_PCI now, so no need to also put it
>>> on i386.
>>>
>>> Signed-off-by: Juan Quintela 
>>> ---
>>>  tests/Makefile.include | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>>> index d524e1bdeb..91ffde3103 100644
>>> --- a/tests/Makefile.include
>>> +++ b/tests/Makefile.include
>>> @@ -247,6 +247,8 @@ check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) +=
>>> tests/ivshmem-test$(EXESUF)
>>>  gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
>>>  check-qtest-pci-y += tests/megasas-test$(EXESUF)
>>>  gcov-files-pci-y += hw/scsi/megasas.c
>>> +check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
>>> +gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>>>  
>>>  check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>>>  check-qtest-i386-y += tests/fdc-test$(EXESUF)
>>> @@ -270,8 +272,6 @@ gcov-files-i386-$(CONFIG_WDT_IB700) +=
>>> hw/watchdog/watchdog.c hw/watchdog/wdt_ib
>>>  check-qtest-i386-y += tests/tco-test$(EXESUF)
>>>  check-qtest-i386-y += $(check-qtest-pci-y)
>>>  gcov-files-i386-y += $(gcov-files-pci-y)
>>> -check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
>>> -gcov-files-i386-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>>>  gcov-files-i386-y += hw/net/net_rx_pkt.c
>>>  gcov-files-i386-y += hw/net/net_tx_pkt.c
>>>  check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
>>
>> It shouldn't matter much ... it's a x86-only device, so we could also
>> keep it there? Or is there an urgent reason to move it?
> 
> I was trying to minimize the amount that are architecture specific.  In
> this particular case it is defined already on i386-softmmu.mak.  So, why
> should we maintain that info in two places?

Ok, fair.

Reviewed-by: Thomas Huth 

> Anyways, I had to stop soon this "cleanup" because there are things like
> boot-serial-test that don't work on all the boards that define
> CONFIG_SERIAL :-(

Which ones are missing? Feel free to contribute small assembler programs
there to increase the test coverage ;-)

 Thomas



Re: [Qemu-devel] [PATCH v3 08/10] check: Move VMXNET3 test to common

2018-08-22 Thread Juan Quintela
Thomas Huth  wrote:
> On 2018-08-22 11:54, Juan Quintela wrote:
>> We protect it with CONFIG_VMXNET3_PCI now, so no need to also put it
>> on i386.
>> 
>> Signed-off-by: Juan Quintela 
>> ---
>>  tests/Makefile.include | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>> index d524e1bdeb..91ffde3103 100644
>> --- a/tests/Makefile.include
>> +++ b/tests/Makefile.include
>> @@ -247,6 +247,8 @@ check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) +=
>> tests/ivshmem-test$(EXESUF)
>>  gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
>>  check-qtest-pci-y += tests/megasas-test$(EXESUF)
>>  gcov-files-pci-y += hw/scsi/megasas.c
>> +check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
>> +gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>>  
>>  check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>>  check-qtest-i386-y += tests/fdc-test$(EXESUF)
>> @@ -270,8 +272,6 @@ gcov-files-i386-$(CONFIG_WDT_IB700) +=
>> hw/watchdog/watchdog.c hw/watchdog/wdt_ib
>>  check-qtest-i386-y += tests/tco-test$(EXESUF)
>>  check-qtest-i386-y += $(check-qtest-pci-y)
>>  gcov-files-i386-y += $(gcov-files-pci-y)
>> -check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
>> -gcov-files-i386-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>>  gcov-files-i386-y += hw/net/net_rx_pkt.c
>>  gcov-files-i386-y += hw/net/net_tx_pkt.c
>>  check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
>
> It shouldn't matter much ... it's a x86-only device, so we could also
> keep it there? Or is there an urgent reason to move it?

I was trying to minimize the amount that are architecture specific.  In
this particular case it is defined already on i386-softmmu.mak.  So, why
should we maintain that info in two places?

Anyways, I had to stop soon this "cleanup" because there are things like
boot-serial-test that don't work on all the boards that define
CONFIG_SERIAL :-(

Later, Juan.



[Qemu-devel] [PATCH] char-pty: remove unnecessary #ifdef

2018-08-22 Thread Paolo Bonzini
For some reason __APPLE__ was not checked in pty code.  However, the #ifdef
is redundant: this file is already compiled only if CONFIG_POSIX, same as
util/qemu-openpty.c which it uses.

Reported-by: Roman Bolshakov 
Signed-off-by: Paolo Bonzini 
---
 chardev/char-pty.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/chardev/char-pty.c b/chardev/char-pty.c
index 68fd4e20c3..e8d9a53476 100644
--- a/chardev/char-pty.c
+++ b/chardev/char-pty.c
@@ -31,10 +31,6 @@
 
 #include "chardev/char-io.h"
 
-#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)  \
-|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-|| defined(__GLIBC__)
-
 typedef struct {
 Chardev parent;
 QIOChannel *ioc;
@@ -299,5 +295,3 @@ static void register_types(void)
 }
 
 type_init(register_types);
-
-#endif
-- 
2.17.1




Re: [Qemu-devel] [PATCH v3 09/10] check: Move endianess test to common

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> It is already protected by CONFIG_ISA_TESTDEV in all architectures.
> 
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 14 +-
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 91ffde3103..f646cd0524 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -249,8 +249,8 @@ check-qtest-pci-y += tests/megasas-test$(EXESUF)
>  gcov-files-pci-y += hw/scsi/megasas.c
>  check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
>  gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
> +check-qtest-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>  
> -check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>  check-qtest-i386-y += tests/fdc-test$(EXESUF)
>  gcov-files-i386-y = hw/block/fdc.c
>  check-qtest-i386-y += tests/ide-test$(EXESUF)
> @@ -324,13 +324,6 @@ check-qtest-microblaze-y = 
> tests/boot-serial-test$(EXESUF)
>  
>  check-qtest-moxie-y = tests/boot-serial-test$(EXESUF)
>  
> -check-qtest-mips-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> -
> -check-qtest-mips64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> -
> -check-qtest-mips64el-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> -
> -check-qtest-ppc-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>  check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
>  check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
>  check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
> @@ -361,16 +354,11 @@ check-qtest-ppc64-y += tests/numa-test$(EXESUF)
>  check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
>  check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
>  
> -check-qtest-sh4-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> -
> -check-qtest-sh4eb-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> -
>  check-qtest-sparc-y = tests/prom-env-test$(EXESUF)
>  check-qtest-sparc-y += tests/m48t59-test$(EXESUF)
>  gcov-files-sparc-y = hw/timer/m48t59.c
>  check-qtest-sparc-y += tests/boot-serial-test$(EXESUF)
>  
> -check-qtest-sparc64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>  check-qtest-sparc64-y += tests/prom-env-test$(EXESUF)
>  check-qtest-sparc64-y += tests/boot-serial-test$(EXESUF)

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [PATCH v3 10/10] check: Move wdt_ib700 test to common

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> It is protected by CONFIG_WDT_IB700.
> 
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index f646cd0524..adfce0be95 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -250,6 +250,8 @@ gcov-files-pci-y += hw/scsi/megasas.c
>  check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
>  gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>  check-qtest-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
> +check-qtest-$(CONFIG_WDT_IB700) += tests/wdt_ib700-test$(EXESUF)
> +gcov-files-$(CONFIG_WDT_IB700) += hw/watchdog/watchdog.c 
> hw/watchdog/wdt_ib700.c
>  
>  check-qtest-i386-y += tests/fdc-test$(EXESUF)
>  gcov-files-i386-y = hw/block/fdc.c
> @@ -267,8 +269,6 @@ check-qtest-i386-y += tests/ipmi-bt-test$(EXESUF)
>  check-qtest-i386-y += tests/i440fx-test$(EXESUF)
>  check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
>  check-qtest-i386-y += tests/drive_del-test$(EXESUF)
> -check-qtest-i386-$(CONFIG_WDT_IB700) += tests/wdt_ib700-test$(EXESUF)
> -gcov-files-i386-$(CONFIG_WDT_IB700) += hw/watchdog/watchdog.c 
> hw/watchdog/wdt_ib700.c
>  check-qtest-i386-y += tests/tco-test$(EXESUF)
>  check-qtest-i386-y += $(check-qtest-pci-y)
>  gcov-files-i386-y += $(gcov-files-pci-y)

Reviewed-by: Thomas Huth 



Re: [Qemu-devel] [libvirt] clean/simple Q35 support in libvirt+QEMU for guest OSes that don't support virtio-1.0

2018-08-22 Thread Andrea Bolognani
On Tue, 2018-08-21 at 14:21 -0400, Laine Stump wrote:
> On 08/17/2018 06:35 AM, Andrea Bolognani wrote:
> > If we decide we want to explicitly spell out the options instead
> > of relying on QEMU changing behavior based on the slot type, which
> > is probably a good idea anyway, I think we should have
> > 
> >   virtio-0.9 => disable-legacy=no,disable-modern=no
> >   virtio-1.0 => disable-legacy=yes,disable-modern=no
> > 
> > There's basically no reason to have a device legacy-only rather
> > than transitional, and spelling out both options instead of only
> > one of them just seems more robust.
> 
> I agree with both of those, but the counter-argument is that "virtio"
> already describes a transitional device like your proposal for
> virtio-0.9 (at least today), and it makes the versioned models less
> orthogonal. In the end, I could go either way...

Yeah, Dan already made that argument and convinced me that we
should use virtio-0.9 for legacy only, virtio-1.0 for modern only
and plain virtio for no enforced behavior / transitional.

> The problem I can see with the virtio-1.0 model name is that if
> management applications start putting that into their XML (even though
> "virtio" would yield a working guest), the guests will be unable to
> migrate to another machine that has the same version of qemu, but an
> older libvirt that doesn't understand the virtio-1.0 model number. If
> that's acceptable, then management apps can being always specifying the
> version for virtio whether it's old or new. If not, then they should
> continue to use plain "virtio" unless they specifically need to force
> virtio-0.9.

Well, even using virtio-0.9 could be considered problematic,
because at least from the QEMU point of view there's nothing
preventing the guest from working correctly as long as the version
is recent enough that disable-legacy/disable-modern are available.

AFAIK management applications such as oVirt and OpenStack usually
require specific, reasonably recent versions of QEMU and libvirt,
so they could make sure virtio-0.9 and virtio-1.0 are understood
by all nodes in the cluster that way.

For something like virt-manager where the coupling is loose
perhaps it would make sense to use virtio-0.9 only on q35 when
the OS requires it and plain virtio everywhere else for the time
being, then switch to always using virtio-0.9 and virtio-1.0
after a Reasonable Amount of Time™ has passed.

-- 
Andrea Bolognani / Red Hat / Virtualization




Re: [Qemu-devel] [PATCH v3 08/10] check: Move VMXNET3 test to common

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> We protect it with CONFIG_VMXNET3_PCI now, so no need to also put it
> on i386.
> 
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index d524e1bdeb..91ffde3103 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -247,6 +247,8 @@ check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += 
> tests/ivshmem-test$(EXESUF)
>  gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
>  check-qtest-pci-y += tests/megasas-test$(EXESUF)
>  gcov-files-pci-y += hw/scsi/megasas.c
> +check-qtest-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
> +gcov-files-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>  
>  check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
>  check-qtest-i386-y += tests/fdc-test$(EXESUF)
> @@ -270,8 +272,6 @@ gcov-files-i386-$(CONFIG_WDT_IB700) += 
> hw/watchdog/watchdog.c hw/watchdog/wdt_ib
>  check-qtest-i386-y += tests/tco-test$(EXESUF)
>  check-qtest-i386-y += $(check-qtest-pci-y)
>  gcov-files-i386-y += $(gcov-files-pci-y)
> -check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
> -gcov-files-i386-$(CONFIG_VMXNET3_PCI) += hw/net/vmxnet3.c
>  gcov-files-i386-y += hw/net/net_rx_pkt.c
>  gcov-files-i386-y += hw/net/net_tx_pkt.c
>  check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)

It shouldn't matter much ... it's a x86-only device, so we could also
keep it there? Or is there an urgent reason to move it?

 Thomas



Re: [Qemu-devel] [PATCH v3 07/10] check: Only test boot-serial when sga is compiled in

2018-08-22 Thread Thomas Huth
On 2018-08-22 11:54, Juan Quintela wrote:
> This is only for x86* architecture.
> 
> Signed-off-by: Juan Quintela 
> ---
>  tests/Makefile.include | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 116e93cdb6..d524e1bdeb 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -257,7 +257,7 @@ check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
>  gcov-files-i386-y += hw/block/hd-geometry.c
>  check-qtest-i386-y += tests/boot-order-test$(EXESUF)
>  check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
> -check-qtest-i386-y += tests/boot-serial-test$(EXESUF)
> +check-qtest-i386-$(CONFIG_SGA) += tests/boot-serial-test$(EXESUF)

Reviewed-by: Thomas Huth 

Off-topic: I wonder whether we could even deprecate the SGA device
nowadays, since the main seabios now can redirect the console to the
serial port, too?

 Thomas



Re: [Qemu-devel] [PATCH 2/7] jobs: canonize Error object

2018-08-22 Thread Max Reitz
On 2018-08-21 02:10, John Snow wrote:
> 
> 
> On 08/17/2018 03:04 PM, John Snow wrote:
>> +error_setg_errno(&job->err, -job->ret, "job failed");
> 
> Kevin specifically asked for me to change this, and I lost it in the
> shuffle. I'll send a v3 now, since there are enough nits to warrant it,
> and I think I want to adjust a few things to set up the "part II"
> portion of this changeset a little more nicely.

But error_setg_errno() uses either strerror() or
g_win32_error_message(), depending on the host OS.  I prefer that over a
blind strerror(), to be honest.

In general, it might make sense to introduce a qemu_strerror() (which
g_strdup()s strerror() on Linux, I presume, so it's compatible with
Win32); or to allow passing a NULL format to error_setg_errno() so you
only get the error string.

Max



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [libvirt] clean/simple Q35 support in libvirt+QEMU for guest OSes that don't support virtio-1.0

2018-08-22 Thread Daniel P . Berrangé
On Wed, Aug 22, 2018 at 12:36:27PM +0200, Andrea Bolognani wrote:
> On Tue, 2018-08-21 at 14:21 -0400, Laine Stump wrote:
> > On 08/17/2018 06:35 AM, Andrea Bolognani wrote:
> > > If we decide we want to explicitly spell out the options instead
> > > of relying on QEMU changing behavior based on the slot type, which
> > > is probably a good idea anyway, I think we should have
> > > 
> > >   virtio-0.9 => disable-legacy=no,disable-modern=no
> > >   virtio-1.0 => disable-legacy=yes,disable-modern=no
> > > 
> > > There's basically no reason to have a device legacy-only rather
> > > than transitional, and spelling out both options instead of only
> > > one of them just seems more robust.
> > 
> > I agree with both of those, but the counter-argument is that "virtio"
> > already describes a transitional device like your proposal for
> > virtio-0.9 (at least today), and it makes the versioned models less
> > orthogonal. In the end, I could go either way...
> 
> Yeah, Dan already made that argument and convinced me that we
> should use virtio-0.9 for legacy only, virtio-1.0 for modern only
> and plain virtio for no enforced behavior / transitional.
> 
> > The problem I can see with the virtio-1.0 model name is that if
> > management applications start putting that into their XML (even though
> > "virtio" would yield a working guest), the guests will be unable to
> > migrate to another machine that has the same version of qemu, but an
> > older libvirt that doesn't understand the virtio-1.0 model number. If
> > that's acceptable, then management apps can being always specifying the
> > version for virtio whether it's old or new. If not, then they should
> > continue to use plain "virtio" unless they specifically need to force
> > virtio-0.9.
> 
> Well, even using virtio-0.9 could be considered problematic,
> because at least from the QEMU point of view there's nothing
> preventing the guest from working correctly as long as the version
> is recent enough that disable-legacy/disable-modern are available.
> 
> AFAIK management applications such as oVirt and OpenStack usually
> require specific, reasonably recent versions of QEMU and libvirt,
> so they could make sure virtio-0.9 and virtio-1.0 are understood
> by all nodes in the cluster that way.

Of course this is not a new scenario - any time an app makes use of a new
feature exposed in libvirt there's a chance that guests using that feature
will not be migratable to older libvirt. The apps and/or administrators
deploying them, have to decide on the cost/benefit tradeoff.

I think this will have an impact on ability of apps to adopt use of the
virtio-0.9/1.0 device model variants though. Both oVirt and OpenStack
do care about live migration to older versions, at least at certain
periods in time. For example, during a live upgrade scenario, 

This dovetails into Laine querying about the domain capabilities not
currently reporting info on the available device models. In the case
that migration to older verisons is needed, the dom capabilities info
won't be looked at anyway, as they don't wish to blindly use a feature
that just happens to exist in the current version.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [Qemu-devel] [PATCH 1/7] jobs: change start callback to run callback

2018-08-22 Thread Max Reitz
On 2018-08-17 21:04, John Snow wrote:
> Presently we codify the entry point for a job as the "start" callback,
> but a more apt name would be "run" to clarify the idea that when this
> function returns we consider the job to have "finished," except for
> any cleanup which occurs in separate callbacks later.
> 
> As part of this clarification, change the signature to include an error
> object and a return code. The error ptr is not yet used, and the return
> code while captured, will be overwritten by actions in the job_completed
> function.
> 
> Signed-off-by: John Snow 
> ---
>  block/backup.c|  7 ---
>  block/commit.c|  7 ---
>  block/create.c|  8 +---
>  block/mirror.c| 10 ++
>  block/stream.c|  7 ---
>  include/qemu/job.h|  2 +-
>  job.c |  6 +++---
>  tests/test-bdrv-drain.c   |  7 ---
>  tests/test-blockjob-txn.c | 16 
>  tests/test-blockjob.c |  7 ---
>  10 files changed, 43 insertions(+), 34 deletions(-)

[...]

> diff --git a/job.c b/job.c
> index fa671b431a..898260b2b3 100644
> --- a/job.c
> +++ b/job.c
> @@ -544,16 +544,16 @@ static void coroutine_fn job_co_entry(void *opaque)
>  {
>  Job *job = opaque;
>  
> -assert(job && job->driver && job->driver->start);
> +assert(job && job->driver && job->driver->run);
>  job_pause_point(job);
> -job->driver->start(job);
> +job->ret = job->driver->run(job, NULL);
>  }

Hmmm, this breaks the iff relationship with job->error.  We might call
job_update_rc() afterwards, but then job_completed() would need to free
it if it overwrites it with the error description from a potential error
object.

Also, I suspect the following patches might fix the relationship anyway?
 (But then an "XXX: This does not hold right now, but will be fixed in a
future patch" in the documentation of Job.error might help.)

Max



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH 2/7] jobs: canonize Error object

2018-08-22 Thread Max Reitz
On 2018-08-17 21:04, John Snow wrote:
> Jobs presently use both an Error object in the case of the create job,
> and char strings in the case of generic errors elsewhere.
> 
> Unify the two paths as just j->err, and remove the extra argument from
> job_completed. The integer error code for job_completed is kept for now
> for use by pre-emptive cancellation.
> 
> Signed-off-by: John Snow 
> ---
>  block/backup.c|  2 +-
>  block/commit.c|  2 +-
>  block/create.c|  5 ++---
>  block/mirror.c|  2 +-
>  block/stream.c|  2 +-
>  include/qemu/job.h| 10 --
>  job-qmp.c |  5 +++--
>  job.c | 19 ++-
>  tests/test-bdrv-drain.c   |  2 +-
>  tests/test-blockjob-txn.c |  2 +-
>  tests/test-blockjob.c |  2 +-
>  11 files changed, 22 insertions(+), 31 deletions(-)

So...  Why does this patch come before removing the @ret parameter from
job_completed()?

[...]

> diff --git a/include/qemu/job.h b/include/qemu/job.h
> index 9cf463d228..5c92c53ef0 100644
> --- a/include/qemu/job.h
> +++ b/include/qemu/job.h
> @@ -124,12 +124,12 @@ typedef struct Job {
>  /** Estimated progress_current value at the completion of the job */
>  int64_t progress_total;
>  
> -/** Error string for a failed job (NULL if, and only if, job->ret == 0) 
> */
> -char *error;
> -
>  /** ret code passed to job_completed. */
>  int ret;
>  
> +/** Error object for a failed job **/
> +Error *err;
> +

Is there a reason why you remove the iff relationship?

(Maybe because job_completed() still receives @ret? :-))

Max

>  /** The completion function that will be called when the job completes.  
> */
>  BlockCompletionFunc *cb;
>  



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH 2/7] jobs: canonize Error object

2018-08-22 Thread Max Reitz
On 2018-08-17 21:04, John Snow wrote:
> Jobs presently use both an Error object in the case of the create job,
> and char strings in the case of generic errors elsewhere.
> 
> Unify the two paths as just j->err, and remove the extra argument from
> job_completed. The integer error code for job_completed is kept for now
> for use by pre-emptive cancellation.
> 
> Signed-off-by: John Snow 
> ---
>  block/backup.c|  2 +-
>  block/commit.c|  2 +-
>  block/create.c|  5 ++---
>  block/mirror.c|  2 +-
>  block/stream.c|  2 +-
>  include/qemu/job.h| 10 --
>  job-qmp.c |  5 +++--
>  job.c | 19 ++-
>  tests/test-bdrv-drain.c   |  2 +-
>  tests/test-blockjob-txn.c |  2 +-
>  tests/test-blockjob.c |  2 +-
>  11 files changed, 22 insertions(+), 31 deletions(-)

(Accidentally deleted this part from my first reply)

> diff --git a/job.c b/job.c
> index 898260b2b3..c9de1af556 100644
> --- a/job.c
> +++ b/job.c

[...]

> @@ -535,7 +535,6 @@ void job_drain(Job *job)
>  }
>  }
>  
> -
>  /**
>   * All jobs must allow a pause point before entering their job proper. This
>   * ensures that jobs can be paused prior to being started, then resumed 
> later.

If anything, you should remove one empty line after this function. ;-)

Max



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH] ppc: Remove deprecated ppcemb target

2018-08-22 Thread David Gibson
On Tue, Aug 21, 2018 at 01:27:48PM +0200, Thomas Huth wrote:
> There is no known available OS for ppc around anymore that uses page
> sizes below 4k, so it does not make much sense that we keep wasting
> our time on building and testing the ppcemb-softmmu target. It has
> been deprecated since two releases, and nobody complained, so let's
> remove this now.
> 
> Signed-off-by: Thomas Huth 

Applied, thanks.

> ---
>  configure  | 13 +++--
>  cpus.c |  1 -
>  default-configs/ppcemb-softmmu.mak | 23 ---
>  hw/ppc/ppc405_boards.c | 14 --
>  hw/ppc/ppc440_bamboo.c |  7 ---
>  hw/ppc/sam460ex.c  |  7 ---
>  hw/ppc/virtex_ml507.c  |  7 ---
>  include/exec/poison.h  |  1 -
>  qapi/common.json   |  2 +-
>  qemu-deprecated.texi   |  6 --
>  target/ppc/cpu-qom.h   |  2 --
>  target/ppc/cpu.h   | 16 
>  target/ppc/kvm.c   |  4 +---
>  target/ppc/mmu_helper.c|  6 +++---
>  target/ppc/translate_init.inc.c| 35 +--
>  tests/machine-none-test.c  |  1 -
>  16 files changed, 9 insertions(+), 136 deletions(-)
>  delete mode 100644 default-configs/ppcemb-softmmu.mak
> 
> diff --git a/configure b/configure
> index e7bddc0..0fc55eb 100755
> --- a/configure
> +++ b/configure
> @@ -195,8 +195,7 @@ supported_kvm_target() {
>  i386:i386 | i386:x86_64 | i386:x32 | \
>  x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
>  mips:mips | mipsel:mips | \
> -ppc:ppc | ppcemb:ppc | ppc64:ppc | \
> -ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \
> +ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | \
>  s390x:s390x)
>  return 0
>  ;;
> @@ -6935,7 +6934,7 @@ if test "$linux" = "yes" ; then
>i386|x86_64|x32)
>  linux_arch=x86
>  ;;
> -  ppcemb|ppc|ppc64)
> +  ppc|ppc64)
>  linux_arch=powerpc
>  ;;
>s390x)
> @@ -6965,7 +6964,7 @@ target_name=$(echo $target | cut -d '-' -f 1)
>  target_bigendian="no"
>  
>  case "$target_name" in
> -  
> armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
> +  
> armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
>target_bigendian=yes
>;;
>  esac
> @@ -7093,12 +7092,6 @@ case "$target_name" in
>  gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml 
> power-spe.xml"
>  target_compiler=$cross_cc_powerpc
>;;
> -  ppcemb)
> -TARGET_BASE_ARCH=ppc
> -TARGET_ABI_DIR=ppc
> -gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml 
> power-spe.xml"
> -target_compiler=$cross_cc_ppcemb
> -  ;;
>ppc64)
>  TARGET_BASE_ARCH=ppc
>  TARGET_ABI_DIR=ppc
> diff --git a/cpus.c b/cpus.c
> index b5844b7..80ca683 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -2203,7 +2203,6 @@ static CpuInfoArch 
> sysemu_target_to_cpuinfo_arch(SysEmuTarget target)
>  return CPU_INFO_ARCH_X86;
>  
>  case SYS_EMU_TARGET_PPC:
> -case SYS_EMU_TARGET_PPCEMB:
>  case SYS_EMU_TARGET_PPC64:
>  return CPU_INFO_ARCH_PPC;
>  
> diff --git a/default-configs/ppcemb-softmmu.mak 
> b/default-configs/ppcemb-softmmu.mak
> deleted file mode 100644
> index ac44f15..000
> --- a/default-configs/ppcemb-softmmu.mak
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -# Default configuration for ppcemb-softmmu
> -
> -include pci.mak
> -include sound.mak
> -include usb.mak
> -CONFIG_PPC4XX=y
> -CONFIG_M48T59=y
> -CONFIG_SERIAL=y
> -CONFIG_SERIAL_ISA=y
> -CONFIG_I8257=y
> -CONFIG_OPENPIC=y
> -CONFIG_PFLASH_CFI01=y
> -CONFIG_PFLASH_CFI02=y
> -CONFIG_PTIMER=y
> -CONFIG_I8259=y
> -CONFIG_XILINX=y
> -CONFIG_XILINX_ETHLITE=y
> -CONFIG_USB_EHCI_SYSBUS=y
> -CONFIG_SM501=y
> -CONFIG_DDC=y
> -CONFIG_IDE_SII3112=y
> -CONFIG_I2C=y
> -CONFIG_BITBANG_I2C=y
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index 7011107..3a54d52 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -202,13 +202,6 @@ static void ref405ep_init(MachineState *machine)
>  DriveInfo *dinfo;
>  MemoryRegion *sysmem = get_system_memory();
>  
> -#ifdef TARGET_PPCEMB
> -if (!qtest_enabled()) {
> -warn_report("qemu-system-ppcemb is deprecated, "
> -"please use qemu-system-ppc instead.");
> -}
> -#endif
> -
>  /* XXX: fix this */
>  memory_region_allocate_system_memory(&ram_memories[0], NULL, 
> "ef405ep.ram",
>   0x0800);
> @@ -503,13 +496,6 @@ static void taihu_405ep_init(MachineState *machine)
>  int fl_idx, fl_sectors;
>  DriveInfo *dinfo;
>  
> -#ifdef TARGET_PPCEMB
> -if (!qtest_enabled()) {
> -warn_repor

Re: [Qemu-devel] [PATCH 3/7] jobs: add exit shim

2018-08-22 Thread Max Reitz
On 2018-08-17 21:04, John Snow wrote:
> All jobs do the same thing when they leave their running loop:
> - Store the return code in a structure
> - wait to receive this structure in the main thread
> - signal job completion via job_completed
> 
> Few jobs do anything beyond exactly this. Consolidate this exit
> logic for a net reduction in SLOC.
> 
> More seriously, when we utilize job_defer_to_main_loop_bh to call
> a function that calls job_completed, job_finalize_single will run
> in a context where it has recursively taken the aio_context lock,
> which can cause hangs if it puts down a reference that causes a flush.
> 
> You can observe this in practice by looking at mirror_exit's careful
> placement of job_completed and bdrv_unref calls.
> 
> If we centralize job exiting, we can signal job completion from outside
> of the aio_context, which should allow for job cleanup code to run with
> only one lock, which makes cleanup callbacks less tricky to write.
> 
> Signed-off-by: John Snow 
> ---
>  include/qemu/job.h |  7 +++
>  job.c  | 19 +++
>  2 files changed, 26 insertions(+)

Currently all jobs do this, the question of course is why.  The answer
is because they are block jobs that need to do some graph manipulation
in the main thread, right?

OK, that's reasonable enough, that sounds like even non-block jobs may
need this (i.e. modify some global qemu state that you can only do in
the main loop).  Interestingly, the create job only calls
job_completed() of which it says nowhere that it needs to be executed in
the main loop.

...on second thought, do we really want to execute job_complete() in the
main loop?  First of all, all of the transactional functions will run in
the main loop.  Which makes sense, but it isn't noted anywhere.
Secondly, we may end up calling JobDriver.user_resume(), which is
probably not something we want to call in the main loop.

OTOH, job_finish_sync() is something that has to be run in the main loop
because it polls the main loop (and as far as my FUSE experiments have
told me, polling a foreign AioContext doesn't work).

So...  I suppose it would be nice if we had a real distinction which
functions are run in which AioContext.  It seems like we indeed want to
run job_completed() in the main loop, but what to do about the
user_resume() call in job_cancel_async()?

(And it should be noted for all of the transactional methods that they
are called in the main loop.)


OK, so that's that.  Now that I know what it's for, I'd like to ask for
a different name.  exit() means kill the process.  JobDriver.exit() will
not mean kill the job.  That's where I get a headache.

This function is for allowing the job to carry out global qemu state
modifications in the main loop.  Neither is that exiting in the sense
that the job is destroyed (as this is done only later, and the job gets
to take part in it through the transactional callbacks, and .free()),
nor is it exiting in the sense that the job needs to do all
pre-transactional clean-ups here (they are supposed to do that in .run()
-- *unlees* something needs the main loop).

I'd like .main_loop_settle().  Or .main_loop_post_run().  I think it's
OK to have names that aren't as cool and tense as possible, when in
return they actually tell you what they're doing.  (Sure,
.main_loop_post_run() sounds really stupid, but it tells you exactly
when the function is called and what it's for.)

(Maybe the problem of all your naming woes really is just that you
always try to find a single word that describes what's going on :-) -- I
don't want to go into ProblemSolveFactoryObserverFactorySingleton
either, but it's OK to use an underscore once in a while.)

Max



signature.asc
Description: OpenPGP digital signature


  1   2   3   >