Skip to contentSkip to conversation

Misc patches for 2017-09-19

GIT PULL Paolo Bonzini 2 participants 5 messages Sep 19, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit 11e06ce1ed28fd0ffcbc1e2436b72f3412b4ecc8:

Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2017-09-19 10:13:51 +0100)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 793d286eab5c6eedf68667a081f676a0323210b2:

docker: fix creation of archives (2017-09-19 14:43:11 +0200)

----------------------------------------------------------------
* warning improvements (Alistair)
* KVM code cleanup (David)
* scsi-block support for rerror/werror (Fam)
* support for >64 vCPUs in Windows (Gonglei)
* SCSI fix (Hannes)
* SSE bugfixes (Joseph)
* SmartOS compilation fixes (Kamil)
* Hyper-V frequency MSR support (Ladi)
* move more files to accel/tcg (Philippe, Thomas)
* multiboot validation (PJP)
* virtqueue size configuration for virtio-scsi (Richard)
* Hyper-V header cleanup (Roman)
* Maintainer email update (Guangrong)
* checkpatch.pl --branch (Daniel), fixes (Greg)
* introducing scsi/ (me)

----------------------------------------------------------------
Alistair Francis (8):
hw/i386: Improve some of the warning messages Convert remaining error_report() to warn_report() Convert single line fprintf(.../n) to warn_report() Convert multi-line fprintf() to warn_report() General warn report fixups
target/mips: Convert VM clock update prints to warn_report
Makefile: Remove libqemustub.a
Convert remaining single line fprintf() to warn_report()

Daniel P. Berrange (1):
scripts: let checkpatch.pl process an entire GIT branch

David Hildenbrand (6):
kvm: require JOIN_MEMORY_REGIONS_WORKS
kvm: factor out alignment of memory section
kvm: use start + size for memory ranges
kvm: we never have overlapping slots in kvm_set_phys_mem()
kvm: kvm_log_start/stop are only called with known sections
kvm: kvm_log_sync() is only called with known memory sections

Eric Blake (1):
osdep.h: Prohibit disabling assert() in supported builds

Fam Zheng (4):
scsi: Refactor scsi sense interpreting code
scsi: Improve scsi_sense_to_errno
scsi: Introduce scsi_sense_buf_to_errno
scsi-block: Support rerror/werror

Gonglei (1):
i386/cpu/hyperv: support over 64 vcpus for windows guests

Greg Kurz (1):
checkpatch: add hwaddr to @typeList

Hannes Reinecke (1):
scsi-bus: correct responses for INQUIRY and REQUEST SENSE

Joseph Myers (5):
target/i386: fix pmovsx/pmovzx in-place operations target/i386: set rip_offset for further SSE instructions target/i386: fix packusdw in-place operation target/i386: fix pcmpxstrx substring search target/i386: fix phminposuw in-place operation

Kamil Rytarowski (2):
memory: Rename queue to mrqueue (memory region queue) scsi/esp: Rename the ESP macro to ESP_STATE

Ladi Prosek (4):
i386/kvm: use a switch statement for MSR detection i386/kvm: set tsc_khz before configuring Hyper-V CPUID i386/kvm: introduce tsc_is_stable_and_known() i386/kvm: advertise Hyper-V frequency MSRs

Paolo Bonzini (7):
scsi: rename scsi_build_sense to scsi_convert_sense
scsi: move non-emulation specific code to scsi/
scsi: introduce scsi_build_sense
scsi: introduce sg_io_sense_from_errno
scsi: move block/scsi.h to include/scsi/constants.h target/i386: fix "info mem" for LA57 mode
docker: fix creation of archives

Philippe Mathieu-Daudé (3):
MAINTAINERS: update email, add missing test entry for megasas
test-qga: add missing qemu-ga tool dependency accel/hax: move hax-stub.c to accel/stubs/

Prasad J Pandit (1):
multiboot: validate multiboot header address values

Richard W.M. Jones (1):
virtio-scsi: Add virtqueue_size parameter allowing virtqueue size to be set.

Roman Kagan (2):
hyperv: add header with protocol definitions
update-linux-headers: prepare for hyperv.h removal

Thomas Huth (1):

      default-configs: Replace $(and ...) with $(call land, ...)

Xiao Guangrong (1):
MAINTAINERS: update mail address for NVDIMM

 MAINTAINERS                                |  14 +-
 Makefile                                   |   7 +-
 Makefile.objs                              |   2 +-
 Makefile.target                            |   3 +-
 accel/kvm/kvm-all.c                        | 242 ++++---------
 accel/stubs/Makefile.objs                  |   1 +
 hax-stub.c => accel/stubs/hax-stub.c       |   0
 block/iscsi.c                              |  51 +--
 block/qcow2.c                              |   9 +-
 block/vvfat.c                              |   7 +-
 default-configs/pci.mak                    |   2 +-
 default-configs/ppc-softmmu.mak            |   2 +-
 default-configs/ppc64-softmmu.mak          |   4 +-
 default-configs/s390x-softmmu.mak          |   2 +-
 docs/devel/build-system.txt                |  18 +-
 hw/acpi/core.c                             |  10 +-
 hw/arm/vexpress.c                          |   4 +-
 hw/block/virtio-blk.c                      |   2 +-
 hw/i386/acpi-build.c                       |  15 +-
 hw/i386/multiboot.c                        |  19 +
 hw/i386/pc.c                               |   9 +-
 hw/i386/pc_q35.c                           |   8 +-
 hw/i386/xen/xen-mapcache.c                 |   5 +-
 hw/mips/mips_malta.c                       |   4 +-
 hw/mips/mips_r4k.c                         |   5 +-
 hw/misc/applesmc.c                         |   2 +-
 hw/s390x/s390-virtio.c                     |  18 +-
 hw/scsi/esp.c                              |  10 +-
 hw/scsi/megasas.c                          |   2 +-
 hw/scsi/mptendian.c                        |   2 +-
 hw/scsi/mptsas.c                           |   8 +-
 hw/scsi/scsi-bus.c                         | 440 ++---------------------
 hw/scsi/scsi-disk.c                        |  43 ++-
 hw/scsi/scsi-generic.c                     |  50 +--
 hw/scsi/spapr_vscsi.c                      |   2 +-
 hw/scsi/virtio-scsi-dataplane.c            |   2 +-
 hw/scsi/virtio-scsi.c                      |  10 +-
 hw/scsi/vmw_pvscsi.c                       |   2 +-
 hw/usb/dev-uas.c                           |   2 +-
 hw/usb/hcd-ehci.c                          |   5 +-
 hw/virtio/virtio-balloon.c                 |   3 +-
 hw/virtio/virtio.c                         |   6 +-
 include/hw/i386/pc.h                       |   5 +
 include/hw/ide/internal.h                  |   2 +-
 include/hw/scsi/scsi.h                     |  94 +----
 include/hw/virtio/virtio-scsi.h            |   2 +-
 include/qemu/osdep.h                       |  16 +
 include/{block/scsi.h => scsi/constants.h} |   2 -
 include/scsi/utils.h                       | 124 +++++++
 memory.c                                   |  22 +-
 net/hub.c                                  |  10 +-
 net/net.c                                  |  15 +-
 qga/vss-win32.c                            |   3 +-
 scripts/checkpatch.pl                      | 139 ++++++--
 scripts/update-linux-headers.sh            |   4 +-
 scsi/Makefile.objs                         |   1 +
 scsi/utils.c                               | 538 +++++++++++++++++++++++++++++
 target/i386/cpu.c                          |  30 +-
 target/i386/cpu.h                          |  12 +-
 target/i386/hax-mem.c                      |   6 +-
 target/i386/hyperv-proto.h                 | 260 ++++++++++++++
 target/i386/hyperv.c                       |   6 +-
 target/i386/kvm.c                          | 195 ++++++-----
 target/i386/machine.c                      |  15 +-
 target/i386/monitor.c                      |   8 +-
 target/i386/ops_sse.h                      |  47 +--
 target/i386/translate.c                    |   3 +-
 target/mips/kvm.c                          |  10 +-
 target/ppc/translate_init.c                |  17 +-
 target/s390x/kvm.c                         |   4 +-
 tests/Makefile.include                     |  11 +-
 tests/docker/Makefile.include              |   1 -
 tests/virtio-scsi-test.c                   |   2 +-
 trace/control.c                            |   4 +-
 trace/simple.c                             |   3 +-
 ui/keymaps.c                               |  10 +-
 ui/spice-display.c                         |   2 +-
 util/cutils.c                              |   3 +-
 util/main-loop.c                           |   6 +-
 79 files changed, 1572 insertions(+), 1112 deletions(-)
 rename hax-stub.c => accel/stubs/hax-stub.c (100%)
 rename include/{block/scsi.h => scsi/constants.h} (99%)
 create mode 100644 include/scsi/utils.h
 create mode 100644 scsi/Makefile.objs
 create mode 100644 scsi/utils.c
 create mode 100644 target/i386/hyperv-proto.h
Signature · 1 line
2.13.5
#1 lore raw

[Qemu-devel] [PULL 43/50] update-linux-headers: prepare for hyperv.h removal

From: Roman Kagan <[email protected]>

All definitions related to Hyper-V emulation are now taken from the QEMU own header, so the one imported from the kernel is no longer needed.

Unfortunately it's included by kvm_para.h.

So, until this is fixed in the kernel, teach the header harvesting script to substitute kernel's hyperv.h with a dummy.

Message-Id: <[email protected]>

---
 scripts/update-linux-headers.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/update-linux-headers.sh +3 -1
index 2f906c4d16..ad80fe3fca 100755
@@ -104,7 +104,9 @@ for arch in $ARCHLIST; do
         cp "$tmpdir/include/asm/unistd-common.h" "$output/linux-headers/asm-arm/"
     fi
     if [ $arch = x86 ]; then
-        cp_portable "$tmpdir/include/asm/hyperv.h" "$output/include/standard-headers/asm-x86/"
+        cat <<-EOF >"$output/include/standard-headers/asm-x86/hyperv.h"
+        /* this is a temporary placeholder until kvm_para.h stops including it */
+        EOF
         cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/"
         cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/"
         cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/"
Signature · 1 line
2.13.5
#2 lore raw

[Qemu-devel] [PULL 42/50] hyperv: add header with protocol definitions

In reply to Paolo Bonzini

From: Roman Kagan <[email protected]>

The definitions for Hyper-V emulation are currently taken from a header imported from the Linux kernel.

However, as these describe a third-party protocol rather than a kernel API, it probably wasn't a good idea to publish it in the kernel uapi.

This patch introduces a header that provides all the necessary definitions, superseding the one coming from the kernel.

The new header supports (temporary) coexistence with the kernel one. The constants explicitly named in the Hyper-V specification (e.g. msr numbers) are defined in a non-conflicting way. Other constants and types have got new names.

While at this, the protocol data structures are defined in a more conventional way, without bitfields, enums, and excessive unions.

The code using this stuff is adjusted, too; it can now be built both with and without the kernel header in the tree.

Message-Id: <[email protected]>

---
 target/i386/cpu.c          |   4 +-
 target/i386/cpu.h          |  10 +-
 target/i386/hyperv-proto.h | 260 +++++++++++++++++++++++++++++++++++++++++++++
 target/i386/hyperv.c       |   6 +-
 target/i386/kvm.c          |  62 ++++++-----
 target/i386/machine.c      |  15 ++-
 6 files changed, 306 insertions(+), 51 deletions(-)
 create mode 100644 target/i386/hyperv-proto.h
target/i386/cpu.c +2 -2
index 40c3091edf..4b0fa0613b 100644
@@ -3934,12 +3934,12 @@ static GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs)
     CPUX86State *env = &cpu->env;
     GuestPanicInformation *panic_info = NULL;
 
-    if (env->features[FEAT_HYPERV_EDX] & HV_X64_GUEST_CRASH_MSR_AVAILABLE) {
+    if (env->features[FEAT_HYPERV_EDX] & HV_GUEST_CRASH_MSR_AVAILABLE) {
         panic_info = g_malloc0(sizeof(GuestPanicInformation));
 
         panic_info->type = GUEST_PANIC_INFORMATION_TYPE_HYPER_V;
 
-        assert(HV_X64_MSR_CRASH_PARAMS >= 5);
+        assert(HV_CRASH_PARAMS >= 5);
         panic_info->u.hyper_v.arg1 = env->msr_hv_crash_params[0];
         panic_info->u.hyper_v.arg2 = env->msr_hv_crash_params[1];
         panic_info->u.hyper_v.arg3 = env->msr_hv_crash_params[2];
target/i386/cpu.h +5 -5
index 5c726f3e4b..0f80de1b1e 100644
@@ -22,7 +22,7 @@
 
 #include "qemu-common.h"
 #include "cpu-qom.h"
-#include "standard-headers/asm-x86/hyperv.h"
+#include "hyperv-proto.h"
 
 #ifdef TARGET_X86_64
 #define TARGET_LONG_BITS 64
@@ -1095,15 +1095,15 @@ typedef struct CPUX86State {
     uint64_t msr_hv_guest_os_id;
     uint64_t msr_hv_vapic;
     uint64_t msr_hv_tsc;
-    uint64_t msr_hv_crash_params[HV_X64_MSR_CRASH_PARAMS];
+    uint64_t msr_hv_crash_params[HV_CRASH_PARAMS];
     uint64_t msr_hv_runtime;
     uint64_t msr_hv_synic_control;
     uint64_t msr_hv_synic_version;
     uint64_t msr_hv_synic_evt_page;
     uint64_t msr_hv_synic_msg_page;
-    uint64_t msr_hv_synic_sint[HV_SYNIC_SINT_COUNT];
-    uint64_t msr_hv_stimer_config[HV_SYNIC_STIMER_COUNT];
-    uint64_t msr_hv_stimer_count[HV_SYNIC_STIMER_COUNT];
+    uint64_t msr_hv_synic_sint[HV_SINT_COUNT];
+    uint64_t msr_hv_stimer_config[HV_STIMER_COUNT];
+    uint64_t msr_hv_stimer_count[HV_STIMER_COUNT];
 
     /* exception/interrupt handling */
     int error_code;
target/i386/hyperv-proto.h new file +260 -0

260 lines not on this page · raw message

target/i386/hyperv.c +3 -3
index 8545574568..a050c9d2d1 100644
@@ -14,7 +14,7 @@
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
 #include "hyperv.h"
-#include "standard-headers/asm-x86/hyperv.h"
+#include "hyperv-proto.h"
 
 int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
 {
@@ -50,8 +50,8 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
 
         code  = exit->u.hcall.input & 0xffff;
         switch (code) {
-        case HVCALL_POST_MESSAGE:
-        case HVCALL_SIGNAL_EVENT:
+        case HV_POST_MESSAGE:
+        case HV_SIGNAL_EVENT:
         default:
             exit->u.hcall.result = HV_STATUS_INVALID_HYPERCALL_CODE;
             return 0;
target/i386/kvm.c +30 -32

163 lines not on this page · raw message

target/i386/machine.c +6 -9
index eab33725a3..29cc58eda9 100644
@@ -587,7 +587,7 @@ static bool hyperv_crash_enable_needed(void *opaque)
     CPUX86State *env = &cpu->env;
     int i;
 
-    for (i = 0; i < HV_X64_MSR_CRASH_PARAMS; i++) {
+    for (i = 0; i < HV_CRASH_PARAMS; i++) {
         if (env->msr_hv_crash_params[i]) {
             return true;
         }
@@ -601,8 +601,7 @@ static const VMStateDescription vmstate_msr_hyperv_crash = {
     .minimum_version_id = 1,
     .needed = hyperv_crash_enable_needed,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT64_ARRAY(env.msr_hv_crash_params,
-                             X86CPU, HV_X64_MSR_CRASH_PARAMS),
+        VMSTATE_UINT64_ARRAY(env.msr_hv_crash_params, X86CPU, HV_CRASH_PARAMS),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -660,8 +659,7 @@ static const VMStateDescription vmstate_msr_hyperv_synic = {
         VMSTATE_UINT64(env.msr_hv_synic_control, X86CPU),
         VMSTATE_UINT64(env.msr_hv_synic_evt_page, X86CPU),
         VMSTATE_UINT64(env.msr_hv_synic_msg_page, X86CPU),
-        VMSTATE_UINT64_ARRAY(env.msr_hv_synic_sint, X86CPU,
-                             HV_SYNIC_SINT_COUNT),
+        VMSTATE_UINT64_ARRAY(env.msr_hv_synic_sint, X86CPU, HV_SINT_COUNT),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -686,10 +684,9 @@ static const VMStateDescription vmstate_msr_hyperv_stimer = {
     .minimum_version_id = 1,
     .needed = hyperv_stimer_enable_needed,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_config,
-                             X86CPU, HV_SYNIC_STIMER_COUNT),
-        VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_count,
-                             X86CPU, HV_SYNIC_STIMER_COUNT),
+        VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_config, X86CPU,
+                             HV_STIMER_COUNT),
+        VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_count, X86CPU, HV_STIMER_COUNT),
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
2.13.5
#3 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · Paolo Bonzini

The following changes since commit 11e06ce1ed28fd0ffcbc1e2436b72f3412b4ecc8:

Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2017-09-19 10:13:51 +0100)

are available in the git repository at:

Quoted 7 lines

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 793d286eab5c6eedf68667a081f676a0323210b2:

docker: fix creation of archives (2017-09-19 14:43:11 +0200)

----------------------------------------------------------------

Hi. This fails to link tests/ptimer_test on OSX:

LINK tests/ptimer-test
duplicate symbol _qemu_bh_delete in:
tests/ptimer-test-stubs.o
libqemuutil.a(async.o)
duplicate symbol _qemu_clock_get_ns in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _timer_init_tl in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _qemu_clock_deadline_ns_all in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _timer_del in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _main_loop_tlg in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _timer_mod in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _qemu_bh_new in:
tests/ptimer-test-stubs.o
libqemuutil.a(main-loop.o)
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

(I'll leave the rest of the merge tests running to see if they find anything else.)

thanks
-- PMM

#4 lore raw
Quoted 19 lines · Peter Maydell

LINK tests/ptimer-test
duplicate symbol _qemu_bh_delete in:
tests/ptimer-test-stubs.o
libqemuutil.a(async.o)
duplicate symbol _qemu_clock_get_ns in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _timer_init_tl in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _qemu_clock_deadline_ns_all in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _timer_del in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _main_loop_tlg in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)

Quoted 8 lines

duplicate symbol _timer_mod in:
tests/ptimer-test-stubs.o
libqemuutil.a(qemu-timer.o)
duplicate symbol _qemu_bh_new in:
tests/ptimer-test-stubs.o
libqemuutil.a(main-loop.o)
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What the patches changes is essentially

-tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o libqemustub.a
+ libqemuutil.a
+tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o libqemuutil.a

so I think what happens is that OS X was previously favoring a file from libqemustub.a, while now it favors a file from libqemuutil.a, which brings in async.o and main-loop.o.

Luckily it is pretty easy to drop libqemuutil.a from this test, which makes sense since it provides its own mock timer subsystem:

tests/Makefile.include +1 -1
index 0c644626e8..baa10e362d 100644
@@ -618,7 +618,7 @@ tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
 tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
 tests/test-base64$(EXESUF): tests/test-base64.o \
 	libqemuutil.a
-tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o $(test-util-obj-y)
+tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
 
 tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
 
tests/ptimer-test-stubs.c +4 -0
index 8a1b0a336c..ca5cc3b13b 100644
@@ -30,6 +30,10 @@ QEMUTimerListGroup main_loop_tlg;
 
 int64_t ptimer_test_time_ns;
 
+/* Do not artificially limit period - see hw/core/ptimer.c.  */
+int use_icount = 1;
+bool qtest_allowed;
+
 void timer_init_tl(QEMUTimer *ts,
                    QEMUTimerList *timer_list, int scale,
                    QEMUTimerCB *cb, void *opaque)

Paolo

Quoted 2 lines

(I'll leave the rest of the merge tests running to see if they find anything else.)