OSDN Git Service

qmiga/qemu.git
6 years agolibqtest: Add qtest_[v]startf()
Eric Blake [Wed, 18 Oct 2017 14:20:27 +0000 (16:20 +0200)]
libqtest: Add qtest_[v]startf()

We have several callers that were formatting the argument strings
themselves; consolidate this effort by adding new convenience
functions directly in libqtest, and update some call-sites that
can benefit from it.

Note that the new functions qtest_startf() and qtest_vstartf()
behave more like qtest_init() (the caller must assign global_qtest
after the fact, rather than getting it implicitly set).  This helps
us prepare for future patches that get rid of the global variable,
by explicitly highlighting which tests still depend on it now.

Signed-off-by: Eric Blake <eblake@redhat.com>
[thuth: Dropped the hunks that do not apply cleanly to qemu master
 yet and added the missing g_free(args) in qtest_vstartf()]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1508336428-20511-2-git-send-email-thuth@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: refactor error handling for MSCH handler
Halil Pasic [Tue, 17 Oct 2017 14:04:53 +0000 (16:04 +0200)]
s390x: refactor error handling for MSCH handler

Simplify the error handling of the MSCH.  Let the code detecting the
condition tell (in a less ambiguous way) how it's to be handled. No
changes in behavior.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-8-pasic@linux.vnet.ibm.com>
[CH: fix return code for fctl != 0]
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: refactor error handling for HSCH handler
Halil Pasic [Tue, 17 Oct 2017 14:04:52 +0000 (16:04 +0200)]
s390x: refactor error handling for HSCH handler

Simplify the error handling of the HSCH.  Let the code detecting the
condition tell (in a less ambiguous way) how it's to be handled. No
changes in behavior.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-7-pasic@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: refactor error handling for CSCH handler
Halil Pasic [Tue, 17 Oct 2017 14:04:51 +0000 (16:04 +0200)]
s390x: refactor error handling for CSCH handler

Simplify the error handling of the CSCH.  Let the code detecting the
condition tell (in a less ambiguous way) how it's to be handled. No
changes in behavior.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-6-pasic@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: refactor error handling for XSCH handler
Halil Pasic [Tue, 17 Oct 2017 14:04:50 +0000 (16:04 +0200)]
s390x: refactor error handling for XSCH handler

Simplify the error handling of the XSCH.  Let the code detecting the
condition tell (in a less ambiguous way) how it's to be handled. No
changes in behavior.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-5-pasic@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: improve error handling for SSCH and RSCH
Halil Pasic [Tue, 17 Oct 2017 14:04:49 +0000 (16:04 +0200)]
s390x: improve error handling for SSCH and RSCH

Simplify the error handling of the SSCH and RSCH handler avoiding
arbitrary and cryptic error codes being used to tell how the instruction
is supposed to end.  Let the code detecting the condition tell how it's
to be handled in a less ambiguous way.  It's best to handle SSCH and RSCH
in one go as the emulation of the two shares a lot of code.

For passthrough this change isn't pure refactoring, but changes the way
kernel reported EFAULT is handled. After clarifying the kernel interface
we decided that EFAULT shall be mapped to unit exception.  Same goes for
unexpected error codes and absence of required ORB flags.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-4-pasic@linux.vnet.ibm.com>
Tested-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
[CH: cosmetic changes]
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/css: IO instr handler ending control
Halil Pasic [Tue, 17 Oct 2017 14:04:48 +0000 (16:04 +0200)]
s390x/css: IO instr handler ending control

CSS code needs to tell the IO instruction handlers located in ioinst.c
how the emulated instruction should be ended. Currently this is done by
returning generic (POSIX) error codes, and mapping them to outcomes like
condition codes. This makes bugs easy to create and hard to recognize.

As a preparation for moving away from (mis)using generic error codes for
flow control let us introduce a type which tells the instruction
handler function how to end the instruction, in a more straight-forward
and less ambiguous way.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-3-pasic@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
[CH: cosmetic changes]
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: move s390x_new_cpu() into board code
Igor Mammedov [Tue, 17 Oct 2017 15:13:23 +0000 (17:13 +0200)]
s390x: move s390x_new_cpu() into board code

s390-virtio-ccw.c is the sole user of s390x_new_cpu(),
so move this helper there.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1508253203-119237-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: fix cpu object referrence leak in s390x_new_cpu()
Igor Mammedov [Tue, 17 Oct 2017 13:41:19 +0000 (15:41 +0200)]
s390x: fix cpu object referrence leak in s390x_new_cpu()

object_new() returns cpu with refcnt == 1 and after realize
refcnt == 2*. s390x_new_cpu() as an owner of the first refcnt
should have released it on exit in both cases (on error and
success) to avoid it leaking. Do so for both cases.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1508247680-98800-2-git-send-email-imammedo@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/event-facility: variable-length event masks
Cornelia Huck [Wed, 11 Oct 2017 13:39:53 +0000 (09:39 -0400)]
s390x/event-facility: variable-length event masks

The architecture supports masks of variable length for sclp write
event mask. We currently only support 4 byte event masks, as that
is what Linux uses.

Let's extend this to the maximum mask length supported by the
architecture and return 0 to the guest for the mask bits we don't
support in core.

Initial patch by: Cornelia Huck <cornelia.huck@de.ibm.com>

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Message-Id: <1507729193-9747-1-git-send-email-jjherne@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/MAINTAINERS: add mailing list
Cornelia Huck [Thu, 5 Oct 2017 15:05:23 +0000 (17:05 +0200)]
s390x/MAINTAINERS: add mailing list

There's a new qemu-s390x@nongnu.org mailing list: add it to the
s390 sections.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agovirtio-ccw: Add the virtio-input devices for CCW bus
Farhan Ali [Mon, 9 Oct 2017 14:01:50 +0000 (10:01 -0400)]
virtio-ccw: Add the virtio-input devices for CCW bus

Wire up the virtio-input HID devices (keyboard, mouse, tablet)
for the CCW bus. The virtio-input is a virtio-1 device,
so disable legacy revision 0.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <6a8ea4c503ee32c2ca7fa608b5f2f547009be8ee.1507557166.git.alifm@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: special handling when starting a CPU with WAIT PSW
David Hildenbrand [Thu, 28 Sep 2017 20:37:08 +0000 (22:37 +0200)]
target/s390x: special handling when starting a CPU with WAIT PSW

When we try to start a CPU with a WAIT PSW, we have to take care that
TCG will actually try to continue executing instructions.

We must therefore really only unhalt the CPU if we don't have a WAIT
PSW. Also document the special order for restart interrupts, which
load a new PSW and change the state to operating.

To keep KVM working, simply don't have a look at the WAIT bit when
loading the PSW. Otherwise the behavior of a restart interrupt when
a CPU stopped would be changed.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-31-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: refactor stfl(e) to use s390_get_feat_block()
David Hildenbrand [Thu, 28 Sep 2017 20:37:07 +0000 (22:37 +0200)]
s390x/tcg: refactor stfl(e) to use s390_get_feat_block()

Refactor it to use s390_get_feat_block(). Directly write into the mapped
lowcore with stfl and make sure it is really only compiled if needed.

While at it, add an alignment check for STFLE and avoid
potential_page_fault() by properly restoring the CPU state.

Due to s390_get_feat_block(), we will now also indicate the
"Configuration-z-architectural-mode", which is with new SIGP code the
right thing to do.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-30-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: unlock NMI
David Hildenbrand [Thu, 28 Sep 2017 20:37:06 +0000 (22:37 +0200)]
s390x/tcg: unlock NMI

Nothing hindering us anymore from unlocking the restart code (used for
NMI).

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-29-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/cpumodel: allow to enable SENSE RUNNING STATUS for qemu
David Hildenbrand [Thu, 28 Sep 2017 20:37:05 +0000 (22:37 +0200)]
s390x/cpumodel: allow to enable SENSE RUNNING STATUS for qemu

As we properly implement it, allow to enable it.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-28-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: switch to new SIGP handling code
David Hildenbrand [Thu, 28 Sep 2017 20:37:04 +0000 (22:37 +0200)]
s390x/tcg: switch to new SIGP handling code

This effectively enables experimental SMP support. Floating interrupts are
still a mess, so allow it but print a big warning. There also seems
to be a problem with CPU hotplug (after the main loop started).

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-27-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[CH: changed insn-data.def as pointed out by Richard]
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: flush the tlb on SIGP SET PREFIX
David Hildenbrand [Thu, 28 Sep 2017 20:37:03 +0000 (22:37 +0200)]
s390x/tcg: flush the tlb on SIGP SET PREFIX

Thanks to Aurelien Jarno for doing this in his prototype.

We can flush the whole TLB as this should happen really rarely.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-26-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: implement STOP and RESET interrupts for TCG
David Hildenbrand [Thu, 28 Sep 2017 20:37:02 +0000 (22:37 +0200)]
s390x/tcg: implement STOP and RESET interrupts for TCG

Implement them like KVM implements/handles them. Both can only be
triggered via SIGP instructions. RESET has (almost) the lowest priority if
the CPU is running, and the highest if the CPU is STOPPED. This is handled
in SIGP code already. On delivery, we only have to care about the
"CPU running" scenario.

STOP is defined to be delivered after all other interrupts have been
delivered. Therefore it has the actual lowest priority.

As both can wake up a CPU if sleeping, indicate them correctly to
external code (e.g. cpu_has_work()).

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-25-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: implement SIGP CONDITIONAL EMERGENCY SIGNAL
David Hildenbrand [Thu, 28 Sep 2017 20:37:01 +0000 (22:37 +0200)]
s390x/tcg: implement SIGP CONDITIONAL EMERGENCY SIGNAL

Mostly analogous to the kernel/KVM version (so I assume the checks are
correct :) ). As a preparation for TCG.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-24-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: implement SIGP EMERGENCY SIGNAL
David Hildenbrand [Thu, 28 Sep 2017 20:37:00 +0000 (22:37 +0200)]
s390x/tcg: implement SIGP EMERGENCY SIGNAL

As preparation for TCG.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-23-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: implement SIGP EXTERNAL CALL
David Hildenbrand [Thu, 28 Sep 2017 20:36:59 +0000 (22:36 +0200)]
s390x/tcg: implement SIGP EXTERNAL CALL

As preparation for TCG.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-22-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: implement SIGP SENSE
David Hildenbrand [Thu, 28 Sep 2017 20:36:58 +0000 (22:36 +0200)]
s390x/tcg: implement SIGP SENSE

Add it as preparation for TCG. Sensing could later be done completely
lockless.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-21-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: implement SIGP SENSE RUNNING STATUS
David Hildenbrand [Thu, 28 Sep 2017 20:36:57 +0000 (22:36 +0200)]
s390x/tcg: implement SIGP SENSE RUNNING STATUS

Preparation for TCG, for KVM is this is completely handled in the
kernel.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-20-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: factor out actual handling of STOP interrupts
David Hildenbrand [Thu, 28 Sep 2017 20:36:56 +0000 (22:36 +0200)]
s390x/kvm: factor out actual handling of STOP interrupts

For KVM, the KVM module decides when a STOP can be performed (when the
STOP interrupt can be processed). Factor it out so we can use it
later for TCG.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-19-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: factor out SIGP code into sigp.c
David Hildenbrand [Thu, 28 Sep 2017 20:36:54 +0000 (22:36 +0200)]
s390x/kvm: factor out SIGP code into sigp.c

We want to use the same code base for TCG, so let's cleanly factor it
out.

The sigp mutex is currently not really needed, as everything is
protected by the iothread mutex. But this could change later, so leave
it in place and initialize it properly from common code.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-17-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: drop two debug prints
David Hildenbrand [Thu, 28 Sep 2017 20:36:53 +0000 (22:36 +0200)]
s390x/kvm: drop two debug prints

Preparation for moving it out of kvm.c.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-16-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: factor out storing of adtl CPU status
David Hildenbrand [Thu, 28 Sep 2017 20:36:52 +0000 (22:36 +0200)]
s390x/kvm: factor out storing of adtl CPU status

Called from SIGP code to be factored out, so let's move it. Add a
FIXME for TCG code in the future.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-15-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: factor out storing of CPU status
David Hildenbrand [Thu, 28 Sep 2017 20:36:51 +0000 (22:36 +0200)]
s390x/kvm: factor out storing of CPU status

Factor it out into s390_store_status(), to be used also by TCG later on.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-14-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: generalize SIGP stop and restart interrupt injection
David Hildenbrand [Thu, 28 Sep 2017 20:36:50 +0000 (22:36 +0200)]
s390x/kvm: generalize SIGP stop and restart interrupt injection

Preparation for factoring it out into !kvm code.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-13-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: pass ipb directly into handle_sigp()
David Hildenbrand [Thu, 28 Sep 2017 20:36:49 +0000 (22:36 +0200)]
s390x/kvm: pass ipb directly into handle_sigp()

No need to pass kvm_run. Pass parameters alphabetically ordered.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-12-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: interpret PSW_MASK_WAIT only for TCG
David Hildenbrand [Thu, 28 Sep 2017 20:36:48 +0000 (22:36 +0200)]
target/s390x: interpret PSW_MASK_WAIT only for TCG

KVM handles the wait PSW itself and triggers a WAIT ICPT in case it
really wants to sleep (disabled wait).

This will later allow us to change the order of loading a restart
interrupt and setting a CPU to OPERATING on SIGP RESTART without
changing KVM behavior.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-11-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: handle WAIT PSWs during interrupt injection
David Hildenbrand [Thu, 28 Sep 2017 20:36:47 +0000 (22:36 +0200)]
s390x/tcg: handle WAIT PSWs during interrupt injection

If we encounter a WAIT PSW, we have to halt immediately. Using
cpu_loop_exit() at this point feels wrong. Simply leaving
cs->exception_index set doesn't result in an immediate stop.

This is also necessary to properly handle SIGP STOP interrupts later.

The CPU_INTERRUPT_HALT will be processed immediately and properly set
the CPU to halted (also resetting cs->exception_index to EXCP_HLT)

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-10-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: factor out handling of WAIT PSW into s390_handle_wait()
David Hildenbrand [Thu, 28 Sep 2017 20:36:46 +0000 (22:36 +0200)]
target/s390x: factor out handling of WAIT PSW into s390_handle_wait()

This will now also detect crashes under TCG. We can directly use
cpu->env.psw.addr instead of kvm_run, as we do a cpu_synchronize_state().

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-9-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: a CPU cannot switch state due to an interrupt
David Hildenbrand [Thu, 28 Sep 2017 20:36:45 +0000 (22:36 +0200)]
s390x/tcg: a CPU cannot switch state due to an interrupt

Going to OPERATING here looks wrong. A CPU should even never be
!OPERATING at this point. Unhalting will already be done in
cpu_handle_halt() if there is work, so we can drop this statement
completely.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-8-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: STOPPED cpus can never wake up
David Hildenbrand [Thu, 28 Sep 2017 20:36:44 +0000 (22:36 +0200)]
s390x/tcg: STOPPED cpus can never wake up

Interrupts can't wake such CPUs up. SIGP from other CPUs has to be used
to toggle the state.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-7-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: take care of external interrupt subclasses
David Hildenbrand [Thu, 28 Sep 2017 20:36:43 +0000 (22:36 +0200)]
s390x/tcg: take care of external interrupt subclasses

We can now let go of INTERRUPT_EXT. When cr0 changes, we have to
revalidate if we now have a pending external interrupt, just like
when the PSW (or SYSTEM MASK only) changes.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-6-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: rework checking for deliverable interrupts
David Hildenbrand [Thu, 28 Sep 2017 20:36:42 +0000 (22:36 +0200)]
s390x/tcg: rework checking for deliverable interrupts

Currently, enabling/disabling of interrupts is not really supported.

Let's improve interrupt handling code by explicitly checking for
deliverable interrupts only. This is the first step. Checking for
external interrupt subclasses will be done next.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-5-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: injection of emergency signals and external calls
David Hildenbrand [Thu, 28 Sep 2017 20:36:41 +0000 (22:36 +0200)]
s390x/tcg: injection of emergency signals and external calls

Preparation for new TCG SIGP code. Especially also prepare for
indicating that another external call is already pending.

Take care of interrupt priority.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-4-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: cleanup service interrupt injection
David Hildenbrand [Thu, 28 Sep 2017 20:36:40 +0000 (22:36 +0200)]
s390x/tcg: cleanup service interrupt injection

There are still some leftovers from old virtio interrupts in there.
Most importantly, we don't have to queue service interrupts anymore.
Just like KVM, we can simply multiplex the SCLP service interrupts and
avoid the queue.

Also, now only valid parameters/cpu_addr will be stored on service
interrupts.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-3-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/tcg: turn INTERRUPT_EXT into a mask
David Hildenbrand [Thu, 28 Sep 2017 20:36:39 +0000 (22:36 +0200)]
s390x/tcg: turn INTERRUPT_EXT into a mask

External interrupts are currently all handled like floating external
interrupts, they are queued. Let's prepare for a split of floating
and local interrupts by turning INTERRUPT_EXT into a mask.

While we can have various floating external interrupts of one kind, there
is usually only one (or a fixed number) of the local external interrupts.

So turn INTERRUPT_EXT into a mask and properly indicate the kind of
external interrupt. Floating interrupts will have to moved out of
one CPU instance later once we have SMP support.

The only floating external interrupts used right now are SERVICE
interrupts, so let's use that name. Following patches will clean up
SERVICE interrupt injection.

This get's rid of the ugly special handling for cpu timer and clock
comparator interrupts. And we really only store the parameters as
defined by the PoP.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170928203708.9376-2-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/css: be more consistent if broken beyond repair
Halil Pasic [Wed, 4 Oct 2017 15:41:37 +0000 (17:41 +0200)]
s390x/css: be more consistent if broken beyond repair

Calling do_subchannel_work with no function control flags set in SCSW is
a programming error. Currently we handle this differently in
do_subchannel_work_virtual and do_subchannel_work_passthrough. Let's be
consistent and guard with a common assert against this programming error.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171004154144.88995-2-pasic@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agoS390: use g_new() family of functions
Marc-André Lureau [Fri, 6 Oct 2017 23:49:21 +0000 (20:49 -0300)]
S390: use g_new() family of functions

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: more changes in hw/s390x/css.c, added target/s390x/cpu_models.c]
Message-Id: <20171006235023.11952-27-f4bug@amsat.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2017-10-19-1' into...
Peter Maydell [Fri, 20 Oct 2017 09:49:55 +0000 (10:49 +0100)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2017-10-19-1' into staging

Merge tpm 2017/10/19 v1

# gpg: Signature made Thu 19 Oct 2017 16:42:39 BST
# gpg:                using RSA key 0x75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2017-10-19-1: (21 commits)
  tpm: move recv_data_callback to TPM interface
  tpm: add a QOM TPM interface
  tpm-tis: fold TPMTISEmuState in TPMState
  tpm-tis: remove tpm_tis.h header
  tpm-tis: move TPMState to TIS header
  tpm: remove locty_data from TPMState
  tpm-emulator: fix error handling
  tpm: add TPMBackendCmd to hold the request state
  tpm: remove locty argument from receive_cb
  tpm: remove needless cast
  tpm: remove unused TPMBackendCmd
  tpm: remove configure_tpm() hop
  tpm: remove init() class method
  tpm: remove TPMDriverOps
  tpm: move TPMSizedBuffer to tpm_tis.h
  tpm: remove tpm_register_driver()
  tpm: replace tpm_get_backend_driver() to drop be_drivers
  tpm: lookup tpm backend class in tpm_driver_find_by_type()
  tpm: make tpm_get_backend_driver() static
  tpm-tis: remove RAISE_STS_IRQ
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging
Peter Maydell [Fri, 20 Oct 2017 09:14:39 +0000 (10:14 +0100)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging

Update OpenBIOS images

# gpg: Signature made Thu 19 Oct 2017 20:08:44 BST
# gpg:                using RSA key 0x5BC2C56FAE0F321F
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>"
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-openbios-signed:
  Update OpenBIOS images to 83818bd built from submodule.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoUpdate OpenBIOS images to 83818bd built from submodule.
Mark Cave-Ayland [Thu, 19 Oct 2017 19:08:04 +0000 (20:08 +0100)]
Update OpenBIOS images to 83818bd built from submodule.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
6 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging
Peter Maydell [Thu, 19 Oct 2017 17:42:51 +0000 (18:42 +0100)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging

qemu-sparc update

# gpg: Signature made Thu 19 Oct 2017 07:50:16 BST
# gpg:                using RSA key 0x5BC2C56FAE0F321F
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>"
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-sparc-signed:
  sun4u: fix assert when adding NICs which aren't the in-built model
  sun4u: update PCI topology to include simba PCI bridges

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/seabios-1.11-prerelease-20171019...
Peter Maydell [Thu, 19 Oct 2017 17:06:30 +0000 (18:06 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/seabios-1.11-prerelease-20171019-pull-request' into staging

seabios: update to 1.11 prerelease

# gpg: Signature made Thu 19 Oct 2017 09:19:33 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/seabios-1.11-prerelease-20171019-pull-request:
  seabios: update to 1.11 prerelease

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agobuild: Fix dtc-checkout race condition in Makefile
Aaron Lindsay [Wed, 18 Oct 2017 18:40:23 +0000 (14:40 -0400)]
build: Fix dtc-checkout race condition in Makefile

This was introduced by:
    commit aef45d51d1204f3335fb99de6658e0c5612c2b67
    Author: Daniel P. Berrange <berrange@redhat.com>
    Date:   Fri Sep 29 11:11:56 2017 +0100

build: automatically handle GIT submodule checkout for dtc

On my system, I see the following with a fresh clone:

% ./configure --disable-gtk --target-list=aarch64-softmmu
% make -j8
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     config-host.h
mkdir -p dtc/libfdt
  GIT     ui/keycodemapdb dtc
mkdir -p dtc/tests
  GEN     qemu-options.def
[snip]
  GEN     migration/trace.h
make: *** [git-submodule-update] Error 1
make: *** Waiting for unfinished jobs....

Upon closer inspection, the root cause of the error is:

% git submodule update --init ui/keycodemapdb dtc
fatal: destination path 'dtc' already exists and is not an empty directory.
Clone of 'git://git.qemu-project.org/dtc.git' into submodule path 'dtc' failed

This patch fixes this race condition by forcing the 'dtc/%' rule which caused
'dtc' to be non-empty to wait on '.git-submodule-status'.

Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 1508352023-28591-1-git-send-email-alindsay@codeaurora.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotpm: move recv_data_callback to TPM interface
Marc-André Lureau [Mon, 9 Oct 2017 22:56:02 +0000 (00:56 +0200)]
tpm: move recv_data_callback to TPM interface

Simplify the TPM backend setup, move callback to TPM interface.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: add a QOM TPM interface
Marc-André Lureau [Mon, 9 Oct 2017 22:56:01 +0000 (00:56 +0200)]
tpm: add a QOM TPM interface

This will simplify backend / interface objects relationship, so the
frontend interface will simply have to implement the TPM QOM interface.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm-tis: fold TPMTISEmuState in TPMState
Marc-André Lureau [Mon, 9 Oct 2017 22:56:00 +0000 (00:56 +0200)]
tpm-tis: fold TPMTISEmuState in TPMState

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm-tis: remove tpm_tis.h header
Marc-André Lureau [Mon, 9 Oct 2017 22:55:59 +0000 (00:55 +0200)]
tpm-tis: remove tpm_tis.h header

The definitions are now private to TIS implementation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm-tis: move TPMState to TIS header
Marc-André Lureau [Mon, 9 Oct 2017 22:55:58 +0000 (00:55 +0200)]
tpm-tis: move TPMState to TIS header

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove locty_data from TPMState
Marc-André Lureau [Mon, 9 Oct 2017 22:55:57 +0000 (00:55 +0200)]
tpm: remove locty_data from TPMState

Keep it internal to tpm-tis instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm-emulator: fix error handling
Marc-André Lureau [Mon, 9 Oct 2017 22:55:56 +0000 (00:55 +0200)]
tpm-emulator: fix error handling

The previous patch cleaned up a bit error handling, and exposed an
existing bug: error_report_err() could be called with a NULL error.
Instead, make tpm_emulator_set_locality() set the error.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: add TPMBackendCmd to hold the request state
Marc-André Lureau [Mon, 9 Oct 2017 22:55:55 +0000 (00:55 +0200)]
tpm: add TPMBackendCmd to hold the request state

This simplifies a bit locality handling, and argument passing, and
could pave the way to queuing requests (if that makes sense).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove locty argument from receive_cb
Marc-André Lureau [Mon, 9 Oct 2017 22:55:54 +0000 (00:55 +0200)]
tpm: remove locty argument from receive_cb

The tpm_state is passed as argument, the assert() is pointless since
we give it the value of tpm_state->locty_number already.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove needless cast
Marc-André Lureau [Mon, 9 Oct 2017 22:55:53 +0000 (00:55 +0200)]
tpm: remove needless cast

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove unused TPMBackendCmd
Marc-André Lureau [Mon, 9 Oct 2017 22:55:52 +0000 (00:55 +0200)]
tpm: remove unused TPMBackendCmd

There is only handling of request so far in both backends.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove configure_tpm() hop
Marc-André Lureau [Mon, 9 Oct 2017 22:55:51 +0000 (00:55 +0200)]
tpm: remove configure_tpm() hop

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove init() class method
Marc-André Lureau [Mon, 9 Oct 2017 22:55:50 +0000 (00:55 +0200)]
tpm: remove init() class method

No backend use it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove TPMDriverOps
Marc-André Lureau [Mon, 9 Oct 2017 22:55:49 +0000 (00:55 +0200)]
tpm: remove TPMDriverOps

Use TPMBackendClass to hold class methods/fields.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: move TPMSizedBuffer to tpm_tis.h
Marc-André Lureau [Mon, 9 Oct 2017 22:55:48 +0000 (00:55 +0200)]
tpm: move TPMSizedBuffer to tpm_tis.h

Close to where it's being used.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: remove tpm_register_driver()
Marc-André Lureau [Mon, 9 Oct 2017 22:55:47 +0000 (00:55 +0200)]
tpm: remove tpm_register_driver()

No more users of be_drivers[], drop that too.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: replace tpm_get_backend_driver() to drop be_drivers
Marc-André Lureau [Mon, 9 Oct 2017 22:55:46 +0000 (00:55 +0200)]
tpm: replace tpm_get_backend_driver() to drop be_drivers

Use tpm_driver_find_by_type() instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: lookup tpm backend class in tpm_driver_find_by_type()
Marc-André Lureau [Mon, 9 Oct 2017 22:55:45 +0000 (00:55 +0200)]
tpm: lookup tpm backend class in tpm_driver_find_by_type()

One step towards removing TPMDriverOps and driver registration.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm: make tpm_get_backend_driver() static
Marc-André Lureau [Mon, 9 Oct 2017 22:55:44 +0000 (00:55 +0200)]
tpm: make tpm_get_backend_driver() static

No need to export the function.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm-tis: remove RAISE_STS_IRQ
Marc-André Lureau [Mon, 9 Oct 2017 22:55:43 +0000 (00:55 +0200)]
tpm-tis: remove RAISE_STS_IRQ

This look like temporary hacking code. It shouldn't be necessary in
release code, or there should be a runtime option for it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agotpm-tis: remove unused hw_access argument
Marc-André Lureau [Mon, 9 Oct 2017 22:55:42 +0000 (00:55 +0200)]
tpm-tis: remove unused hw_access argument

This argument is always false, simplify the code.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Thu, 19 Oct 2017 14:38:07 +0000 (15:38 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* TCG 8-byte atomic accesses bugfix (Andrew)
* Report disk rotation rate (Daniel)
* Report invalid scsi-disk block size configuration (Mark)
* KVM and memory API MemoryListener fixes (David, Maxime, Peter Xu)
* x86 CPU hotplug crash fix (Igor)
* Load/store API documentation (Peter Maydell)
* Small fixes by myself and Thomas
* qdev DEVICE_DELETED deferral (Michael)

# gpg: Signature made Wed 18 Oct 2017 10:56:24 BST
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (29 commits)
  scsi: reject configurations with logical block size > physical block size
  qdev: defer DEVICE_DEL event until instance_finalize()
  Revert "qdev: Free QemuOpts when the QOM path goes away"
  qdev: store DeviceState's canonical path to use when unparenting
  qemu-pr-helper: use new libmultipath API
  watch_mem_write: implement 8-byte accesses
  notdirty_mem_write: implement 8-byte accesses
  memory: reuse section_from_flat_range()
  kvm: simplify kvm_align_section()
  kvm: region_add and region_del is not called on updates
  kvm: fix error message when failing to unregister slot
  kvm: tolerate non-existing slot for log_start/log_stop/log_sync
  kvm: fix alignment of ram address
  memory: call log_start after region_add
  target/i386: trap on instructions longer than >15 bytes
  target/i386: introduce x86_ld*_code
  tco: add trace events
  docs/devel/loads-stores.rst: Document our various load and store APIs
  nios2: define tcg_env
  build: remove CONFIG_LIBDECNUMBER
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20171018' into staging
Peter Maydell [Thu, 19 Oct 2017 13:39:30 +0000 (14:39 +0100)]
Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20171018' into staging

Linux-user updates for Qemu 2.11

# gpg: Signature made Wed 18 Oct 2017 13:20:14 BST
# gpg:                using RSA key 0xB44890DEDE3C9BC0
# gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>"
# gpg:                 aka "Riku Voipio <riku.voipio@linaro.org>"
# Primary key fingerprint: FF82 03C8 C391 98AE 0581  41EF B448 90DE DE3C 9BC0

* remotes/riku/tags/pull-linux-user-20171018:
  linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values
  linux-user/main: support dfilter
  linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers
  linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31
  linux-user: Tidy and enforce reserved_va initialization
  tcg: Fix off-by-one in assert in page_set_flags
  linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests
  linux-user: remove duplicate break in syscall
  target/m68k,linux-user: manage FP registers in ucontext
  linux-user: fix O_TMPFILE handling

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/opengl-20171017-pull-request' into...
Peter Maydell [Thu, 19 Oct 2017 11:09:53 +0000 (12:09 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/opengl-20171017-pull-request' into staging

ui: opengl updates for dma-buf support.

# gpg: Signature made Tue 17 Oct 2017 12:13:36 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/opengl-20171017-pull-request:
  egl-headless: add dmabuf support
  egl-helpers: add egl_texture_blit and egl_texture_blend
  egl-helpers: add dmabuf import support
  opengl: add flipping vertex shader
  opengl: move shader init from console-gl.c to shader.c
  console: add support for dmabufs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/vga-20171017-pull-request' into...
Peter Maydell [Thu, 19 Oct 2017 09:53:19 +0000 (10:53 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20171017-pull-request' into staging

cirrus: bugfixes, with some vga cleanups.

# gpg: Signature made Tue 17 Oct 2017 09:24:37 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/vga-20171017-pull-request:
  cirrus: fix oob access in mode4and5 write functions
  vga: add ram_addr_t cast
  vga: handle cirrus vbe mode wraparounds.
  vga: drop line_offset variable

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoseabios: update to 1.11 prerelease
Gerd Hoffmann [Thu, 19 Oct 2017 07:46:29 +0000 (09:46 +0200)]
seabios: update to 1.11 prerelease

This is the seabios update for qemu 2.11.  Well, almost, seabios is in
freeze for the upcoming 1.11 release.  This updates seabios to current
git master snapshot, and it will be updated again to 1.11 final before
the 2.11 release.

With this two-step seabios gets some more wide testing before the actual
release and the update to 1.11 final (which will most likely happen
after qemu freeze) should have bugfix patches only.

git shortlog
============

Aleksandr Bezzubikov (3):
      pci: refactor pci_find_capapibilty to get bdf as the first argument instead of the whole pci_device
      pci: add QEMU-specific PCI capability structure
      pci: enable RedHat PCI bridges to reserve additional resources on PCI init

Ben Warren (5):
      QEMU DMA: Add DMA write capability
      romfile-loader: Switch to using named structs
      QEMU fw_cfg: Add command to write back address of file
      QEMU fw_cfg: Add functions for accessing files by key
      QEMU fw_cfg: Write fw_cfg back on S3 resume

Daniel Verkamp (5):
      nvme: support NVMe 1.0 controllers
      nvme: extend command timeout to 5 seconds
      nvme: fix reversed loop condition in cmd_readwrite
      nvme: fix extraction of status code bits
      nvme: fix copy-paste mistake in comment

Filippo Sironi (1):
      nvme: Use the Maximum Queue Entries Supported (MQES) to initialize I/O queues

Gerd Hoffmann (7):
      usb: add hub portmap
      usb-xhci: use hub portmap
      std: add cp437 to unicode map
      kbd: make enqueue_key public, add ascii_to_keycode
      romfile: add support for constant files.
      paravirt: serial console configuration.
      add serial console support

Igor Mammedov (1):
      drop "etc/boot-cpus" fw_cfg file and reuse legacy QEMU_CFG_NB_CPUS

Jason Wang (1):
      virtio: IOMMU support

Julian Stecklina (2):
      block: add NVMe boot support
      nvme: fix out of memory behavior

Julius Werner (1):
      coreboot: Adapt to upstream CBMEM console changes

Kevin O'Connor (26):
      usb: Make usb_time_sigatt variable static
      tpm: Add comment banners to tcg.c separating major parts of spec
      tpm: Don't call tpm_set_failure() from tpm12_get_capability()
      tpm: Move code around in tcgbios.c to keep like code together
      acpi: Generalize find_fadt() and find_tcpa_by_rsdp() into find_acpi_table()
      tpm: Don't call tpm_build_and_send_cmd() from tpm20_stirrandom()
      tpm: Rework tpm_build_and_send_cmd() into tpm_simple_cmd()
      ps2port: Disable keyboard/mouse prior to resetting ps2 controller
      docs: Note release dates for 1.10.1 and 1.10.2
      resume: Don't attempt to use generic reboot mechanisms on QEMU
      boot: Increase description size in boot menu
      src: Minor - remove tab characters that slipped into SeaBIOS C code
      NVMe: Allow NVMe to be enabled on real hardware
      smm: Backup and restore A20 on an SMI based mode switch
      stacks: Make sure to initialize Call16Data
      stacks: Don't update the A20 settings if they haven't changed
      stacks: There is no need to disable NMI if it is already disabled
      vga: Fix bug in stdvga_get_linesize()
      docs: Fix typos in Memory_Model.md
      tcgbios: Fix use of unitialized variable
      boot: Rename drive_g to drive
      disk: Don't require the 'struct drive_s' to be in the f-segment
      block: Rename disk_op_s->drive_gf to drive_fl
      virtio: Allocate drive_s storage in low memory
      xhci: Build TRBs directly in xhci_trb_queue()
      xhci: Verify the device is still present in xhci_cmd_submit()

Ladi Prosek (1):
      ahci: Set upper 32-bit registers to zero

Patrick Rudolph (4):
      SeaVGABios/cbvga: Advertise correct pixel format
      SeaVGABIOS/vbe: Query driver for scanline pitch v2
      SeaVGABios/cbvga: Use active mode to clear screen
      SeaVGABios/cbvga: Advertise compatible VESA modes

Paul Menzel (1):
      vgasrc: Increase debug level

Petr Berky (1):
      config: Add function to check if fw_cfg exists

Ricardo Ribalda Delgado (1):
      serialio: Support for mmap serial ports

Roman Kagan (11):
      blockcmd: accept only disks and CD-ROMs
      blockcmd: generic SCSI luns enumeration
      virtio-scsi: enumerate luns with REPORT LUNS
      esp-scsi: enumerate luns with REPORT LUNS
      usb-uas: enumerate luns with REPORT LUNS
      pvscsi: fix the comment about lun enumeration
      mpt-scsi: try to enumerate luns with REPORT LUNS
      lsi-scsi: reset in case of a serious problem
      lsi-scsi: try to enumerate luns with REPORT LUNS
      blockcmd: start REPORT_LUNS with the smallest buffer
      Revert "lsi-scsi: reset in case of a serious problem"

Stefan Berger (1):
      tpm: Log TPM 2 digest structure in little endian format

Youness Alaoui (1):
      nvme: Enable NVMe support for non-qemu hardware

Zeh, Werner (1):
      ahci: Disable Native Command Queueing

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agosun4u: fix assert when adding NICs which aren't the in-built model
Mark Cave-Ayland [Sun, 15 Oct 2017 09:05:59 +0000 (10:05 +0100)]
sun4u: fix assert when adding NICs which aren't the in-built model

Commit 8d93297 introduced a bug whereby non-inbuilt NICs are realized before
setting the default MAC address causing an assert. Switch NIC creation
over from pci_create_simple() to pci_create() which works exactly the
same except omitting the realize as originally intended.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
6 years agosun4u: update PCI topology to include simba PCI bridges
Mark Cave-Ayland [Sun, 11 Jun 2017 09:12:08 +0000 (10:12 +0100)]
sun4u: update PCI topology to include simba PCI bridges

This patch updates the sun4u model to being much closer to a real Ultra 5
by moving devices behind the 2 simba PCI bridges (A and B) as found on real
hardware.

The most noticeable change introduced by this patchset is that in-built devices
are no longer attached to the PCI root bus, but instead behind PCI bridge A.
Along with this the interrupt routing is updated accordingly to match the
official documentation.

Since the existing code currently bypasses the PCI bridge interrupt
swizzling, the interrupt mapping functions are reorganised so that
pci_pbm_map_irq() is used by the PCI bridges and pci_apb_map_irq() is
used by the PCI host bridge.

Behind the sabre PCI host bridge, the PCI IO space now needs to be
split into two separate halves at 0x8000000. Therefore we also setup a new
PCI IO space region of increased size on the PCI host bridge and enable
32-bit PCI IO accesses to allow IO accesses to reach devices behind PCI
bridge B correctly.

As part of this change we also combine the onboard sunhme NIC and the ebus
into a single multi-function device as done on a real Ultra 5. For other
NICs the existing behaviour is preserved, i.e. we initialise them and
place them into the next free slot on PCI bus B.

Finally we mark the physically unavailable slots (plus slot 0 in busA) as
reserved to ensure that users can't plug devices into non-existent slots
which will break interrupt routing.

Note: since this commit changes PCI topology and interrupt routing, an
updated openbios-sparc64 binary is included with this commit containing the
associated changes to maintain bisectability.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
6 years agoscsi: reject configurations with logical block size > physical block size
Mark Kanda [Mon, 16 Oct 2017 20:17:04 +0000 (15:17 -0500)]
scsi: reject configurations with logical block size > physical block size

Logical block size of a SCSI disk should never be larger than
physical block size. From an ATA/SCSI perspective, it makes no sense
to have the logical block size greater than the physical block size,
and it cannot even be effectively expressed in the command set. The
whole point of adding the physical block size to the ATA/SCSI command
set was to communicate a desire for a larger block size (than logical),
while maintaining backwards compatibility with legacy 512 byte block
size.

When setting logical_block_size > physical_block_size, QEMU cannot express
it in READ CAPACITY(16) output, and all it can do is set the physical
block exponent to 0 (i.e. logical_block_size == physical_block_size).
Reporting the error properly, however, is better.

Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Message-Id: <1508185024-5840-1-git-send-email-mark.kanda@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqdev: defer DEVICE_DEL event until instance_finalize()
Michael Roth [Mon, 16 Oct 2017 22:23:15 +0000 (17:23 -0500)]
qdev: defer DEVICE_DEL event until instance_finalize()

DEVICE_DEL is currently emitted when a Device is unparented, as
opposed to when it is finalized. The main design motivation for this
seems to be that after unparent()/unrealize(), the Device is no
longer visible to the guest, and thus the operation is complete
from the perspective of management.

However, there are cases where remaining host-side cleanup is also
pertinent to management. The is generally handled by treating these
resources as aspects of the "backend", which can be managed via
separate interfaces/events, such as blockdev_add/del, netdev_add/del,
object_add/del, etc, but some devices do not have this level of
compartmentalization, namely vfio-pci, and possibly to lend themselves
well to it.

In the case of vfio-pci, the "backend" cleanup happens as part of
the finalization of the vfio-pci device itself, in particular the
cleanup of the VFIO group FD. Failing to wait for this cleanup can
result in tools like libvirt attempting to rebind the device to
the host while it's still being used by VFIO, which can result in
host crashes or other misbehavior depending on the host driver.

Deferring DEVICE_DEL still affords us the ability to manage backends
explicitly, while also addressing cases like vfio-pci's, so we
implement that approach here.

An alternative proposal involving having VFIO emit a separate event
to denote completion of host-side cleanup was discussed, but the
prevailing opinion seems to be that it is not worth the added
complexity, and leaves the issue open for other Device implementations
to solve in the future.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20171016222315.407-4-mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoRevert "qdev: Free QemuOpts when the QOM path goes away"
Michael Roth [Mon, 16 Oct 2017 22:23:14 +0000 (17:23 -0500)]
Revert "qdev: Free QemuOpts when the QOM path goes away"

This reverts commit abed886ec60cf239a03515cf0b30fb11fa964c44.

This patch originally addressed an issue where a DEVICE_DELETED
event could be emitted (in device_unparent()) before a Device's
QemuOpts were cleaned up (in device_finalize()), leading to a
"duplicate ID" error if management attempted to immediately add
a device with the same ID in response to the DEVICE_DELETED event.

An alternative will be implemented in a subsequent patch where we
defer the DEVICE_DELETED event until device_finalize(), which would
also prevent the race, so we revert the original fix in preparation.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20171016222315.407-3-mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqdev: store DeviceState's canonical path to use when unparenting
Michael Roth [Mon, 16 Oct 2017 22:23:13 +0000 (17:23 -0500)]
qdev: store DeviceState's canonical path to use when unparenting

device_unparent(dev, ...) is called when a device is unparented,
either directly, or as a result of a parent device being
finalized, and handles some final cleanup for the device. Part
of this includes emiting a DEVICE_DELETED QMP event to notify
management, which includes the device's path in the composition
tree as provided by object_get_canonical_path().

object_get_canonical_path() assumes the device is still connected
to the machine/root container, and will assert otherwise, but
in some situations this isn't the case:

If the parent is finalized as a result of object_unparent(), it
will still be attached to the composition tree at the time any
children are unparented as a result of that same call to
object_unparent(). However, in some cases, object_unparent()
will complete without finalizing the parent device, due to
lingering references that won't be released till some time later.
One such example is if the parent has MemoryRegion children (which
take a ref on their parent), who in turn have AddressSpace's (which
take a ref on their regions), since those AddressSpaces get cleaned
up asynchronously by the RCU thread.

In this case qdev:device_unparent() may be called for a child Device
that no longer has a path to the root/machine container, causing
object_get_canonical_path() to assert.

Fix this by storing the canonical path during realize() so the
information will still be available for device_unparent() in such
cases.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20171016222315.407-2-mdroth@linux.vnet.ibm.com>
[Clear dev->canonical_path at the post_realize_fail label, which is
 cleaner.  Suggested by David Gibson. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqemu-pr-helper: use new libmultipath API
Paolo Bonzini [Tue, 17 Oct 2017 18:11:58 +0000 (20:11 +0200)]
qemu-pr-helper: use new libmultipath API

libmultipath has recently changed its API.  The new API supports multi-threaded
clients better.  Unfortunately there is no backwards-compatibility, so we just
switch to the new one.  Running QEMU compiled with the new library on the old
library will likely crash, while doing the opposite will cause QEMU not to
start at all (because udev, get_multipath_config and put_multipath_config
are undefined).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agowatch_mem_write: implement 8-byte accesses
Paolo Bonzini [Tue, 17 Oct 2017 12:16:05 +0000 (14:16 +0200)]
watch_mem_write: implement 8-byte accesses

Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should
always turn into atomic 8-byte writes on the host, however a write
write watchpoint would end up tearing the 8-byte write into two 4-byte
writes in access_with_adjusted_size().

Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agonotdirty_mem_write: implement 8-byte accesses
Andrew Baumann [Fri, 13 Oct 2017 18:19:13 +0000 (11:19 -0700)]
notdirty_mem_write: implement 8-byte accesses

Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should
always turn into atomic 8-byte writes on the host, however if we missed
in the softmmu, and the TLB line was marked as not dirty, then we
would end up tearing the 8-byte write into two 4-byte writes in
access_with_adjusted_size().

Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Message-Id: <20171013181913.7556-1-Andrew.Baumann@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agomemory: reuse section_from_flat_range()
David Hildenbrand [Mon, 16 Oct 2017 14:43:02 +0000 (16:43 +0200)]
memory: reuse section_from_flat_range()

We can use section_from_flat_range() instead of manually initializing.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-8-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agokvm: simplify kvm_align_section()
David Hildenbrand [Mon, 16 Oct 2017 14:43:01 +0000 (16:43 +0200)]
kvm: simplify kvm_align_section()

Use ROUND_UP and simplify the code a bit.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-7-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agokvm: region_add and region_del is not called on updates
David Hildenbrand [Mon, 16 Oct 2017 14:43:00 +0000 (16:43 +0200)]
kvm: region_add and region_del is not called on updates

Attributes are not updated via region_add()/region_del(). Attribute changes
lead to a delete first, followed by a new add.

If this would ever not be the case, we would get an error when trying to
register the new slot.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-6-david@redhat.com>
Tested-by: Joe Clifford <joeclifford@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agokvm: fix error message when failing to unregister slot
David Hildenbrand [Mon, 16 Oct 2017 14:42:59 +0000 (16:42 +0200)]
kvm: fix error message when failing to unregister slot

"overlapping" is a leftover, let's drop it.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-5-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agokvm: tolerate non-existing slot for log_start/log_stop/log_sync
David Hildenbrand [Mon, 16 Oct 2017 14:42:58 +0000 (16:42 +0200)]
kvm: tolerate non-existing slot for log_start/log_stop/log_sync

If we want to trap every access to a section, we might not have a
slot. So let's just tolerate if we don't have one.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-4-david@redhat.com>
Tested-by: Joe Clifford <joeclifford@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agokvm: fix alignment of ram address
David Hildenbrand [Mon, 16 Oct 2017 14:42:57 +0000 (16:42 +0200)]
kvm: fix alignment of ram address

Fix the wrong calculation of the delta, used to align the ram address.

This only strikes if alignment has to be done.

Reported-by: Joe Clifford <joeclifford@gmail.com>
Fixes: 5ea69c2e3614 ("kvm: factor out alignment of memory section")
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-3-david@redhat.com>
Tested-by: Joe Clifford <joeclifford@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agomemory: call log_start after region_add
David Hildenbrand [Mon, 16 Oct 2017 14:42:56 +0000 (16:42 +0200)]
memory: call log_start after region_add

It might be confusing for some listener implementations that implement
both, region_add and log_start (e.g. KVM) if we call log_start before an
actual region was added using region_add.

This makes current KVM code trigger an assertion
("kvm_section_update_flags: error finding slot"). So let's just reverse
the order instead of tolerating log_start on yet unknown regions.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171016144302.24284-2-david@redhat.com>
Tested-by: Joe Clifford <joeclifford@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agolinux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values
Peter Maydell [Thu, 12 Oct 2017 15:30:45 +0000 (16:30 +0100)]
linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values

The TARGET_MTIOCTOP/TARGET_MTIOCGET/TARGET_MTIOCPOS values
were being defined in terms of host struct types, but
these structures are such that their size might differ
on different hosts. Switch to using a target struct
definition instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
6 years agolinux-user/main: support dfilter
Alex Bennée [Tue, 17 Oct 2017 10:35:14 +0000 (11:35 +0100)]
linux-user/main: support dfilter

This adds the -dfilter support to linux-user. There is a minor
checkpatch complaint about formatting which I've ignored for aesthetic
reasons.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20171017' into staging
Peter Maydell [Tue, 17 Oct 2017 14:26:51 +0000 (15:26 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20171017' into staging

ppc patch queue 2017-10-17

Here's the currently accumulated set of ppc patches for qemu.

  * The biggest set here is the ppc parts of Igor Mammedov's cleanups
    to cpu model handling
  * The above also includes a generic patches which are required as
    prerequisites for the ppc parts.  They don't seem to have been
    merged by Eduardo yet, so I hope they're ok to include here.
  * Apart from that it's basically just assorted bug fixes and cleanups

# gpg: Signature made Tue 17 Oct 2017 05:20:03 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.11-20171017: (34 commits)
  spapr_cpu_core: rewrite machine type sanity check
  spapr_pci: fail gracefully with non-pseries machine types
  spapr: Correct RAM size calculation for HPT resizing
  ppc: pnv: consolidate type definitions and batch register them
  ppc: pnv: drop PnvChipClass::cpu_model field
  ppc: pnv: define core types statically
  ppc: pnv: drop PnvCoreClass::cpu_oc field
  ppc: pnv: normalize core/chip type names
  ppc: pnv: use generic cpu_model parsing
  ppc: spapr: use generic cpu_model parsing
  ppc: move ppc_cpu_lookup_alias() before its first user
  ppc: spapr: use cpu model names as tcg defaults instead of aliases
  ppc: spapr: register 'host' core type along with the rest of core types
  ppc: spapr: use cpu type name directly
  ppc: spapr: define core types statically
  ppc: move '-cpu foo,compat=xxx' parsing into ppc_cpu_parse_featurestr()
  ppc: spapr: replace ppc_cpu_parse_features() with cpu_parse_cpu_model()
  ppc: 40p/prep: replace cpu_model with cpu_type
  ppc: virtex-ml507: replace cpu_model with cpu_type
  ppc: replace cpu_model with cpu_type on ref405ep,taihu boards
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging
Peter Maydell [Tue, 17 Oct 2017 12:13:03 +0000 (13:13 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging

trivial patches for 2017-10-16

# gpg: Signature made Mon 16 Oct 2017 21:32:05 BST
# gpg:                using RSA key 0x701B4F6B1A693E59
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* remotes/mjt/tags/trivial-patches-fetch:
  Add myself as maintainer for TPM code
  filter-mirror: segfault when specifying non existent device
  MAINTAINERS: Track default-configs/pci.mak
  MAINTAINERS: Fix Sun4v file
  MAINTAINERS: Clean up SCSI device section
  include/hw/or-irq.h: Drop unused in_irqs field
  io: Add missing GCC_FMT_ATTR (fix -Werror=suggest-attribute=format)
  os-posix: Drop misleading comment
  linux-user: Add some random ioctls
  futex: add missing header guards
  ui/gtk: Fix deprecation of vte_terminal_copy_clipboard
  gitignore: ignore check-qlit test
  linux-user: remove duplicate break in syscall
  qemu-doc.texi: remove trailing whitespace

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/berrange/tags/pull-qio-2017-10-16-1' into staging
Peter Maydell [Tue, 17 Oct 2017 10:29:51 +0000 (11:29 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/pull-qio-2017-10-16-1' into staging

Merge QIO 2017/10/16 v1

# gpg: Signature made Mon 16 Oct 2017 17:10:54 BST
# gpg:                using RSA key 0xBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/pull-qio-2017-10-16-1:
  io: fix mem leak in websock error path
  io: add trace points for websocket HTTP protocol headers
  io: cope with websock 'Connection' header having multiple values
  io: get rid of bounce buffering in websock write path
  io: pass a struct iovec into qio_channel_websock_encode
  io: get rid of qio_channel_websock_encode helper method
  io: simplify websocket ping reply handling
  io: monitor encoutput buffer size from websocket GSource
  sockets: Handle race condition between binds to the same port
  sockets: factor out create_fast_reuse_socket
  sockets: factor out a new try_bind() function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging
Peter Maydell [Tue, 17 Oct 2017 09:44:23 +0000 (10:44 +0100)]
Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging

This fixes a potential data leak to the guest.

# gpg: Signature made Mon 16 Oct 2017 16:08:25 BST
# gpg:                using DSA key 0x02FC3AEB0101DBC2
# gpg: Good signature from "Greg Kurz <groug@kaod.org>"
# gpg:                 aka "Greg Kurz <groug@free.fr>"
# gpg:                 aka "Greg Kurz <gkurz@linux.vnet.ibm.com>"
# gpg:                 aka "Gregory Kurz (Groug) <groug@free.fr>"
# gpg:                 aka "[jpeg image of size 3330]"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 2BD4 3B44 535E C0A7 9894  DBA2 02FC 3AEB 0101 DBC2

* remotes/gkurz/tags/for-upstream:
  9pfs: use g_malloc0 to allocate space for xattr

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20171016-pull-request' into...
Peter Maydell [Tue, 17 Oct 2017 09:03:33 +0000 (10:03 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20171016-pull-request' into staging

ui: use keycodemapdb for key code mappings, part one (v2)
ui: add qemu-keymap, update reverse keymaps (for qemu -k $map)
ui: fix for vte 0.50
ui: gtk texture fix

# gpg: Signature made Mon 16 Oct 2017 14:12:49 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20171016-pull-request:
  gtk: fix wrong id between texture and framebuffer
  ui/gtk: Fix deprecation of vte_terminal_copy_clipboard
  pc-bios/keymaps: keymaps update
  Add pc-bios/keymaps/Makefile
  tools: add qemu-keymap
  ui: don't export qemu_input_event_new_key
  ui: convert key events to QKeyCodes immediately
  ui: convert common input code to keycodemapdb
  ui: add keycodemapdb repository as a GIT submodule
  docker: don't rely on submodules existing in the main checkout
  build: automatically handle GIT submodule checkout for dtc

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoegl-headless: add dmabuf support
Gerd Hoffmann [Tue, 10 Oct 2017 13:54:53 +0000 (15:54 +0200)]
egl-headless: add dmabuf support

Add support for the new dmabuf interface.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20171010135453.6704-7-kraxel@redhat.com

6 years agoegl-helpers: add egl_texture_blit and egl_texture_blend
Gerd Hoffmann [Tue, 10 Oct 2017 13:54:52 +0000 (15:54 +0200)]
egl-helpers: add egl_texture_blit and egl_texture_blend

egl_texture_blit() blits a texture, simliar to egl_fb_blit() but by
rendering the texture to the screen instead of using a framebuffer blit.

egl_texture_blend() renders a texture with alpha blending, will be used
to render the cursor to the screen.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20171010135453.6704-6-kraxel@redhat.com