* [Qemu-devel] [PULL 01/12] pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size()
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 02/12] checkpatch: do not warn for multiline parenthesized returned value Paolo Bonzini
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Igor Mammedov
From: Igor Mammedov <imammedo@redhat.com>
QEMU will crash when device-memory-region-size property is read if ms->device_memory
wasn't initialized yet.
Crash can be reproduced with:
$QEMU -preconfig -qmp unix:qmp_socket,server,nowait &
./scripts/qmp/qom-get -s qmp_socket /machine.device-memory-region-size
Instead of crashing return 0 if ms->device_memory hasn't been initialized.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1560174635-22602-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/pc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e96360b..552f340 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -2458,7 +2458,11 @@ pc_machine_get_device_memory_region_size(Object *obj, Visitor *v,
Error **errp)
{
MachineState *ms = MACHINE(obj);
- int64_t value = memory_region_size(&ms->device_memory->mr);
+ int64_t value = 0;
+
+ if (ms->device_memory) {
+ value = memory_region_size(&ms->device_memory->mr);
+ }
visit_type_int(v, name, &value, errp);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 02/12] checkpatch: do not warn for multiline parenthesized returned value
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 01/12] pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size() Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 03/12] i386/kvm: Fix build with -m32 Paolo Bonzini
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel
While indeed we do not want to have
return (a);
it is less clear that this applies to
return (a &&
b);
Some editors indent more nicely if you have parentheses, and some people's
eyes may appreciate that as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1561116534-21814-1-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c2aaf42..2f81371 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2296,7 +2296,8 @@ sub process {
$value =~ s/\([^\(\)]*\)/1/) {
}
#print "value<$value>\n";
- if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) {
+ if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/ &&
+ $line =~ /;$/) {
ERROR("return is not a function, parentheses are not required\n" . $herecurr);
} elsif ($spacing !~ /\s+/) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 03/12] i386/kvm: Fix build with -m32
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 01/12] pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size() Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 02/12] checkpatch: do not warn for multiline parenthesized returned value Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 04/12] intel_iommu: Fix incorrect "end" for vtd_address_space_unmap Paolo Bonzini
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Max Reitz
From: Max Reitz <mreitz@redhat.com>
find_next_bit() takes a pointer of type "const unsigned long *", but the
first argument passed here is a "uint64_t *". These types are
incompatible when compiling qemu with -m32.
Just use ctz64() instead.
Fixes: c686193072a47032d83cb4e131dc49ae30f9e5d
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190624193913.28343-1-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/kvm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index e4b4f57..31490bf 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1043,14 +1043,15 @@ static int hv_cpuid_check_and_set(CPUState *cs, struct kvm_cpuid2 *cpuid,
CPUX86State *env = &cpu->env;
uint32_t r, fw, bits;
uint64_t deps;
- int i, dep_feat = 0;
+ int i, dep_feat;
if (!hyperv_feat_enabled(cpu, feature) && !cpu->hyperv_passthrough) {
return 0;
}
deps = kvm_hyperv_properties[feature].dependencies;
- while ((dep_feat = find_next_bit(&deps, 64, dep_feat)) < 64) {
+ while (deps) {
+ dep_feat = ctz64(deps);
if (!(hyperv_feat_enabled(cpu, dep_feat))) {
fprintf(stderr,
"Hyper-V %s requires Hyper-V %s\n",
@@ -1058,7 +1059,7 @@ static int hv_cpuid_check_and_set(CPUState *cs, struct kvm_cpuid2 *cpuid,
kvm_hyperv_properties[dep_feat].desc);
return 1;
}
- dep_feat++;
+ deps &= ~(1ull << dep_feat);
}
for (i = 0; i < ARRAY_SIZE(kvm_hyperv_properties[feature].flags); i++) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 04/12] intel_iommu: Fix incorrect "end" for vtd_address_space_unmap
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (2 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 03/12] i386/kvm: Fix build with -m32 Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 05/12] intel_iommu: Fix unexpected unmaps during global unmap Paolo Bonzini
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Yan Zhao, Peter Xu
From: Yan Zhao <yan.y.zhao@intel.com>
IOMMUNotifier is with inclusive ranges, so we should check
against (VTD_ADDRESS_SIZE(s->aw_bits) - 1).
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
[peterx: split from another bigger patch]
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190624091811.30412-2-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/intel_iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 44b1231..719ce19 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3379,12 +3379,12 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
* VT-d spec), otherwise we need to consider overflow of 64 bits.
*/
- if (end > VTD_ADDRESS_SIZE(s->aw_bits)) {
+ if (end > VTD_ADDRESS_SIZE(s->aw_bits) - 1) {
/*
* Don't need to unmap regions that is bigger than the whole
* VT-d supported address space size
*/
- end = VTD_ADDRESS_SIZE(s->aw_bits);
+ end = VTD_ADDRESS_SIZE(s->aw_bits) - 1;
}
assert(start <= end);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 05/12] intel_iommu: Fix unexpected unmaps during global unmap
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (3 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 04/12] intel_iommu: Fix incorrect "end" for vtd_address_space_unmap Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 06/12] ioapic: clear irq_eoi when updating the ioapic redirect table entry Paolo Bonzini
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Xu
From: Peter Xu <peterx@redhat.com>
This is an replacement work of Yan Zhao's patch:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg625340.html
vtd_address_space_unmap() will do proper page mask alignment to make
sure each IOTLB message will have correct masks for notification
messages (2^N-1), but sometimes it can be expanded to even supercede
the registered range. That could lead to unexpected UNMAP of already
mapped regions in some other notifiers.
Instead of doing mindless expension of the start address and address
mask, we split the range into smaller ones and guarantee that each
small range will have correct masks (2^N-1) and at the same time we
should also try our best to generate as less IOTLB messages as
possible.
Reported-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Yan Zhao <yan.y.zhao@intel.com>
Message-Id: <20190624091811.30412-3-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/intel_iommu.c | 67 +++++++++++++++++++++++++++++++--------------------
1 file changed, 41 insertions(+), 26 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 719ce19..de86f53 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3363,11 +3363,28 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
return vtd_dev_as;
}
+static uint64_t get_naturally_aligned_size(uint64_t start,
+ uint64_t size, int gaw)
+{
+ uint64_t max_mask = 1ULL << gaw;
+ uint64_t alignment = start ? start & -start : max_mask;
+
+ alignment = MIN(alignment, max_mask);
+ size = MIN(size, max_mask);
+
+ if (alignment <= size) {
+ /* Increase the alignment of start */
+ return alignment;
+ } else {
+ /* Find the largest page mask from size */
+ return 1ULL << (63 - clz64(size));
+ }
+}
+
/* Unmap the whole range in the notifier's scope. */
static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
{
- IOMMUTLBEntry entry;
- hwaddr size;
+ hwaddr size, remain;
hwaddr start = n->start;
hwaddr end = n->end;
IntelIOMMUState *s = as->iommu_state;
@@ -3388,39 +3405,37 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
}
assert(start <= end);
- size = end - start;
+ size = remain = end - start + 1;
- if (ctpop64(size) != 1) {
- /*
- * This size cannot format a correct mask. Let's enlarge it to
- * suite the minimum available mask.
- */
- int n = 64 - clz64(size);
- if (n > s->aw_bits) {
- /* should not happen, but in case it happens, limit it */
- n = s->aw_bits;
- }
- size = 1ULL << n;
+ while (remain >= VTD_PAGE_SIZE) {
+ IOMMUTLBEntry entry;
+ uint64_t mask = get_naturally_aligned_size(start, remain, s->aw_bits);
+
+ assert(mask);
+
+ entry.iova = start;
+ entry.addr_mask = mask - 1;
+ entry.target_as = &address_space_memory;
+ entry.perm = IOMMU_NONE;
+ /* This field is meaningless for unmap */
+ entry.translated_addr = 0;
+
+ memory_region_notify_one(n, &entry);
+
+ start += mask;
+ remain -= mask;
}
- entry.target_as = &address_space_memory;
- /* Adjust iova for the size */
- entry.iova = n->start & ~(size - 1);
- /* This field is meaningless for unmap */
- entry.translated_addr = 0;
- entry.perm = IOMMU_NONE;
- entry.addr_mask = size - 1;
+ assert(!remain);
trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
VTD_PCI_SLOT(as->devfn),
VTD_PCI_FUNC(as->devfn),
- entry.iova, size);
+ n->start, size);
- map.iova = entry.iova;
- map.size = entry.addr_mask;
+ map.iova = n->start;
+ map.size = size;
iova_tree_remove(as->iova_tree, &map);
-
- memory_region_notify_one(n, &entry);
}
static void vtd_address_space_unmap_all(IntelIOMMUState *s)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 06/12] ioapic: clear irq_eoi when updating the ioapic redirect table entry
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (4 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 05/12] intel_iommu: Fix unexpected unmaps during global unmap Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 07/12] target/i386: fix feature check in hyperv-stub.c Paolo Bonzini
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Li Qiang
From: Li Qiang <liq3ea@163.com>
irq_eoi is used to count the number of irq injected during eoi
broadcast. It should be set to 0 when updating the ioapic's redirect
table entry.
Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190624151635.22494-1-liq3ea@163.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/intc/ioapic.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index 7074489..db9e518 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -380,6 +380,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
/* restore RO bits */
s->ioredtbl[index] &= IOAPIC_RW_BITS;
s->ioredtbl[index] |= ro_bits;
+ s->irq_eoi[index] = 0;
ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
ioapic_service(s);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 07/12] target/i386: fix feature check in hyperv-stub.c
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (5 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 06/12] ioapic: clear irq_eoi when updating the ioapic redirect table entry Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 08/12] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak Paolo Bonzini
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Vitaly Kuznetsov, Alex Bennée, Roman Kagan
From: Alex Bennée <alex.bennee@linaro.org>
Commit 2d384d7c8 broken the build when built with:
configure --without-default-devices --disable-user
The reason was the conversion of cpu->hyperv_synic to
cpu->hyperv_synic_kvm_only although the rest of the patch introduces a
feature checking mechanism. So I've fixed the KVM_EXIT_HYPERV_SYNIC in
hyperv-stub to do the same feature check as in the real hyperv.c
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Roman Kagan <rkagan@virtuozzo.com>
Message-Id: <20190624123835.28869-1-alex.bennee@linaro.org>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/hyperv-stub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/hyperv-stub.c b/target/i386/hyperv-stub.c
index fe548cb..0028527 100644
--- a/target/i386/hyperv-stub.c
+++ b/target/i386/hyperv-stub.c
@@ -15,7 +15,7 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
{
switch (exit->type) {
case KVM_EXIT_HYPERV_SYNIC:
- if (!cpu->hyperv_synic) {
+ if (!hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC)) {
return -1;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 08/12] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (6 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 07/12] target/i386: fix feature check in hyperv-stub.c Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 09/12] target/i386: kvm: Fix when nested state is needed for migration Paolo Bonzini
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel
When minikconf writes config-devices.mak, it includes all variables including
those from MINIKCONF_ARGS. This causes values from config-host.mak to "stick" to
the ones used in generating config-devices.mak, because config-devices.mak is
included after config-host.mak. Avoid this by omitting assignments coming
from the command line in the output of minikconf.
Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Tested-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/minikconf.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/minikconf.py b/scripts/minikconf.py
index 0ffc6c3..3109a81 100644
--- a/scripts/minikconf.py
+++ b/scripts/minikconf.py
@@ -688,11 +688,13 @@ if __name__ == '__main__':
data = KconfigData(mode)
parser = KconfigParser(data)
+ external_vars = set()
for arg in argv[3:]:
m = re.match(r'^(CONFIG_[A-Z0-9_]+)=([yn]?)$', arg)
if m is not None:
name, value = m.groups()
parser.do_assignment(name, value == 'y')
+ external_vars.add(name[7:])
else:
fp = open(arg, 'r')
parser.parse_file(fp)
@@ -700,7 +702,8 @@ if __name__ == '__main__':
config = data.compute_config()
for key in sorted(config.keys()):
- print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
+ if key not in external_vars:
+ print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
deps = open(argv[2], 'w')
for fname in data.previously_included:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 09/12] target/i386: kvm: Fix when nested state is needed for migration
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (7 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 08/12] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 10/12] Makefile: generate header file with the list of devices enabled Paolo Bonzini
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Liran Alon
From: Liran Alon <liran.alon@oracle.com>
When vCPU is in VMX operation and enters SMM mode,
it temporarily exits VMX operation but KVM maintained nested-state
still stores the VMXON region physical address, i.e. even when the
vCPU is in SMM mode then (nested_state->hdr.vmx.vmxon_pa != -1ull).
Therefore, there is no need to explicitly check for
KVM_STATE_NESTED_SMM_VMXON to determine if it is necessary
to save nested-state as part of migration stream.
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20190624230514.53326-1-liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/machine.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/target/i386/machine.c b/target/i386/machine.c
index 851b249..704ba6d 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -997,9 +997,8 @@ static bool vmx_nested_state_needed(void *opaque)
{
struct kvm_nested_state *nested_state = opaque;
- return ((nested_state->format == KVM_STATE_NESTED_FORMAT_VMX) &&
- ((nested_state->hdr.vmx.vmxon_pa != -1ull) ||
- (nested_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON)));
+ return (nested_state->format == KVM_STATE_NESTED_FORMAT_VMX &&
+ nested_state->hdr.vmx.vmxon_pa != -1ull);
}
static const VMStateDescription vmstate_vmx_nested_state = {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 10/12] Makefile: generate header file with the list of devices enabled
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (8 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 09/12] target/i386: kvm: Fix when nested state is needed for migration Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 11/12] hw/i386: Fix linker error when ISAPC is disabled Paolo Bonzini
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Julio Montes
From: Julio Montes <julio.montes@intel.com>
v2: generate config-devices.h which contains the list of devices enabled
Message-Id: <20190705143554.10295-1-julio.montes@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Julio Montes <julio.montes@intel.com>
---
Makefile.target | 4 ++++
scripts/create_config | 2 ++
2 files changed, 6 insertions(+)
diff --git a/Makefile.target b/Makefile.target
index 72c267f..7154e99 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -45,6 +45,9 @@ include $(SRC_PATH)/tests/tcg/Makefile.include
config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak
+config-devices.h: config-devices.h-timestamp
+config-devices.h-timestamp: config-devices.mak
+
ifdef CONFIG_TRACE_SYSTEMTAP
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
@@ -168,6 +171,7 @@ obj-y += hw/$(TARGET_BASE_ARCH)/
endif
generated-files-y += hmp-commands.h hmp-commands-info.h
+generated-files-y += config-devices.h
endif # CONFIG_SOFTMMU
diff --git a/scripts/create_config b/scripts/create_config
index d727e5e..00e86c8 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -58,6 +58,8 @@ case $line in
name=${line%=*}
echo "#define $name 1"
;;
+ CONFIG_*=n) # configuration
+ ;;
CONFIG_*=*) # configuration
name=${line%=*}
value=${line#*=}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 11/12] hw/i386: Fix linker error when ISAPC is disabled
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (9 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 10/12] Makefile: generate header file with the list of devices enabled Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-05 20:23 ` [Qemu-devel] [PULL 12/12] ioapic: use irq number instead of vector in ioapic_eoi_broadcast Paolo Bonzini
2019-07-08 11:48 ` [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Peter Maydell
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Julio Montes
From: Julio Montes <julio.montes@intel.com>
v2: include config-devices.h to use CONFIG_IDE_ISA
Message-Id: <20190705143554.10295-2-julio.montes@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Julio Montes <julio.montes@intel.com>
---
hw/i386/pc_piix.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index c07c4a5..cc04c01 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "config-devices.h"
#include "qemu/units.h"
#include "hw/hw.h"
@@ -61,9 +62,11 @@
#define MAX_IDE_BUS 2
+#ifdef CONFIG_IDE_ISA
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
+#endif
/* PC hardware initialisation */
static void pc_init1(MachineState *machine,
@@ -254,7 +257,10 @@ static void pc_init1(MachineState *machine,
}
idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
- } else {
+ pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
+ }
+#ifdef CONFIG_IDE_ISA
+else {
for(i = 0; i < MAX_IDE_BUS; i++) {
ISADevice *dev;
char busname[] = "ide.0";
@@ -268,9 +274,9 @@ static void pc_init1(MachineState *machine,
busname[4] = '0' + i;
idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
}
+ pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
}
-
- pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
+#endif
if (pcmc->pci_enabled && machine_usb(machine)) {
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 12/12] ioapic: use irq number instead of vector in ioapic_eoi_broadcast
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (10 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 11/12] hw/i386: Fix linker error when ISAPC is disabled Paolo Bonzini
@ 2019-07-05 20:23 ` Paolo Bonzini
2019-07-08 11:48 ` [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Peter Maydell
12 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-07-05 20:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Li Qiang
From: Li Qiang <liq3ea@163.com>
When emulating irqchip in qemu, such as following command:
x86_64-softmmu/qemu-system-x86_64 -m 1024 -smp 4 -hda /home/test/test.img
-machine kernel-irqchip=off --enable-kvm -vnc :0 -device edu -monitor stdio
We will get a crash with following asan output:
(qemu) /home/test/qemu5/qemu/hw/intc/ioapic.c:266:27: runtime error: index 35 out of bounds for type 'int [24]'
=================================================================
==113504==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61b000003114 at pc 0x5579e3c7a80f bp 0x7fd004bf8c10 sp 0x7fd004bf8c00
WRITE of size 4 at 0x61b000003114 thread T4
#0 0x5579e3c7a80e in ioapic_eoi_broadcast /home/test/qemu5/qemu/hw/intc/ioapic.c:266
#1 0x5579e3c6f480 in apic_eoi /home/test/qemu5/qemu/hw/intc/apic.c:428
#2 0x5579e3c720a7 in apic_mem_write /home/test/qemu5/qemu/hw/intc/apic.c:802
#3 0x5579e3b1e31a in memory_region_write_accessor /home/test/qemu5/qemu/memory.c:503
#4 0x5579e3b1e6a2 in access_with_adjusted_size /home/test/qemu5/qemu/memory.c:569
#5 0x5579e3b28d77 in memory_region_dispatch_write /home/test/qemu5/qemu/memory.c:1497
#6 0x5579e3a1b36b in flatview_write_continue /home/test/qemu5/qemu/exec.c:3323
#7 0x5579e3a1b633 in flatview_write /home/test/qemu5/qemu/exec.c:3362
#8 0x5579e3a1bcb1 in address_space_write /home/test/qemu5/qemu/exec.c:3452
#9 0x5579e3a1bd03 in address_space_rw /home/test/qemu5/qemu/exec.c:3463
#10 0x5579e3b8b979 in kvm_cpu_exec /home/test/qemu5/qemu/accel/kvm/kvm-all.c:2045
#11 0x5579e3ae4499 in qemu_kvm_cpu_thread_fn /home/test/qemu5/qemu/cpus.c:1287
#12 0x5579e4cbdb9f in qemu_thread_start util/qemu-thread-posix.c:502
#13 0x7fd0146376da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)
#14 0x7fd01436088e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x12188e
This is because in ioapic_eoi_broadcast function, we uses 'vector' to
index the 's->irq_eoi'. To fix this, we should uses the irq number.
Signed-off-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190622002119.126834-1-liq3ea@163.com>
---
hw/intc/ioapic.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index db9e518..c408749 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -245,8 +245,8 @@ void ioapic_eoi_broadcast(int vector)
s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
if (!(entry & IOAPIC_LVT_MASKED) && (s->irr & (1 << n))) {
- ++s->irq_eoi[vector];
- if (s->irq_eoi[vector] >= SUCCESSIVE_IRQ_MAX_COUNT) {
+ ++s->irq_eoi[n];
+ if (s->irq_eoi[n] >= SUCCESSIVE_IRQ_MAX_COUNT) {
/*
* Real hardware does not deliver the interrupt immediately
* during eoi broadcast, and this lets a buggy guest make
@@ -254,16 +254,16 @@ void ioapic_eoi_broadcast(int vector)
* level-triggered interrupt. Emulate this behavior if we
* detect an interrupt storm.
*/
- s->irq_eoi[vector] = 0;
+ s->irq_eoi[n] = 0;
timer_mod_anticipate(s->delayed_ioapic_service_timer,
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
NANOSECONDS_PER_SECOND / 100);
- trace_ioapic_eoi_delayed_reassert(vector);
+ trace_ioapic_eoi_delayed_reassert(n);
} else {
ioapic_service(s);
}
} else {
- s->irq_eoi[vector] = 0;
+ s->irq_eoi[n] = 0;
}
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze
2019-07-05 20:23 [Qemu-devel] [PULL 00/12] Misc bugfixes for QEMU hard freeze Paolo Bonzini
` (11 preceding siblings ...)
2019-07-05 20:23 ` [Qemu-devel] [PULL 12/12] ioapic: use irq number instead of vector in ioapic_eoi_broadcast Paolo Bonzini
@ 2019-07-08 11:48 ` Peter Maydell
12 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2019-07-08 11:48 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: QEMU Developers
On Fri, 5 Jul 2019 at 21:54, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 39d1b92b810793e02558e05efa23059f67520bc9:
>
> Merge remote-tracking branch 'remotes/bkoppelmann2/tags/pull-tricore-20190625' into staging (2019-07-01 13:47:21 +0100)
>
> are available in the git repository at:
>
>
> git://github.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 03f990a5e31e28c9a2794729638f2117e028bfa5:
>
> ioapic: use irq number instead of vector in ioapic_eoi_broadcast (2019-07-05 22:19:59 +0200)
>
> ----------------------------------------------------------------
> Bugfixes.
>
Applied v2, thanks (after checking that 11/12 had had
Julio's s-o-b line fixed.)
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread