mirror of https://github.com/xemu-project/xemu.git
Bugfixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAABAgAGBQJdH7FgAAoJEL/70l94x66DdUUH+gLr/ZdjLIdfYy9cjcnevf4E cJlxdaW9KvUsK2uVgqQ/3b1yF+GCGk10n6n8ZTIbClhs+6NpqEMz5O3FA/Na6FGA 48M2DwJaJ2H9AG/lQBlSBNUZfLsEJ9rWy7DHvNut5XMJFuWGwdtF/jRhUm3KqaRq vAaOgcQHbzHU9W8r1NJ7l6pnPebeO7S0JQV+82T/ITTz2gEBDUkJ36boO6fedkVQ jLb9nZyG3CJXHm2WlxGO4hkqbLFzURnCi6imOh2rMdD8BCu1eIVl59tD1lC/A0xv Pp3xXnv9SgJXsV4/I/N3/nU85ZhGVMPQZXkxaajHPtJJ0rQq7FAG8PJMEj9yPe8= =poke -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging Bugfixes. # gpg: Signature made Fri 05 Jul 2019 21:21:52 BST # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # 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: ioapic: use irq number instead of vector in ioapic_eoi_broadcast hw/i386: Fix linker error when ISAPC is disabled Makefile: generate header file with the list of devices enabled target/i386: kvm: Fix when nested state is needed for migration minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak target/i386: fix feature check in hyperv-stub.c ioapic: clear irq_eoi when updating the ioapic redirect table entry intel_iommu: Fix unexpected unmaps during global unmap intel_iommu: Fix incorrect "end" for vtd_address_space_unmap i386/kvm: Fix build with -m32 checkpatch: do not warn for multiline parenthesized returned value pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
c4107e8208
|
@ -45,6 +45,9 @@ include $(SRC_PATH)/tests/tcg/Makefile.include
|
||||||
config-target.h: config-target.h-timestamp
|
config-target.h: config-target.h-timestamp
|
||||||
config-target.h-timestamp: config-target.mak
|
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
|
ifdef CONFIG_TRACE_SYSTEMTAP
|
||||||
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
|
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
|
||||||
|
|
||||||
|
@ -167,6 +170,7 @@ obj-y += hw/$(TARGET_BASE_ARCH)/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
generated-files-y += hmp-commands.h hmp-commands-info.h
|
generated-files-y += hmp-commands.h hmp-commands-info.h
|
||||||
|
generated-files-y += config-devices.h
|
||||||
|
|
||||||
endif # CONFIG_SOFTMMU
|
endif # CONFIG_SOFTMMU
|
||||||
|
|
||||||
|
|
|
@ -3363,11 +3363,28 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
|
||||||
return vtd_dev_as;
|
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. */
|
/* Unmap the whole range in the notifier's scope. */
|
||||||
static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
|
static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
|
||||||
{
|
{
|
||||||
IOMMUTLBEntry entry;
|
hwaddr size, remain;
|
||||||
hwaddr size;
|
|
||||||
hwaddr start = n->start;
|
hwaddr start = n->start;
|
||||||
hwaddr end = n->end;
|
hwaddr end = n->end;
|
||||||
IntelIOMMUState *s = as->iommu_state;
|
IntelIOMMUState *s = as->iommu_state;
|
||||||
|
@ -3379,48 +3396,46 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
|
||||||
* VT-d spec), otherwise we need to consider overflow of 64 bits.
|
* 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
|
* Don't need to unmap regions that is bigger than the whole
|
||||||
* VT-d supported address space size
|
* VT-d supported address space size
|
||||||
*/
|
*/
|
||||||
end = VTD_ADDRESS_SIZE(s->aw_bits);
|
end = VTD_ADDRESS_SIZE(s->aw_bits) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(start <= end);
|
assert(start <= end);
|
||||||
size = end - start;
|
size = remain = end - start + 1;
|
||||||
|
|
||||||
if (ctpop64(size) != 1) {
|
while (remain >= VTD_PAGE_SIZE) {
|
||||||
/*
|
IOMMUTLBEntry entry;
|
||||||
* This size cannot format a correct mask. Let's enlarge it to
|
uint64_t mask = get_naturally_aligned_size(start, remain, s->aw_bits);
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
assert(mask);
|
||||||
|
|
||||||
|
entry.iova = start;
|
||||||
|
entry.addr_mask = mask - 1;
|
||||||
entry.target_as = &address_space_memory;
|
entry.target_as = &address_space_memory;
|
||||||
/* Adjust iova for the size */
|
entry.perm = IOMMU_NONE;
|
||||||
entry.iova = n->start & ~(size - 1);
|
|
||||||
/* This field is meaningless for unmap */
|
/* This field is meaningless for unmap */
|
||||||
entry.translated_addr = 0;
|
entry.translated_addr = 0;
|
||||||
entry.perm = IOMMU_NONE;
|
|
||||||
entry.addr_mask = size - 1;
|
memory_region_notify_one(n, &entry);
|
||||||
|
|
||||||
|
start += mask;
|
||||||
|
remain -= mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(!remain);
|
||||||
|
|
||||||
trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
|
trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
|
||||||
VTD_PCI_SLOT(as->devfn),
|
VTD_PCI_SLOT(as->devfn),
|
||||||
VTD_PCI_FUNC(as->devfn),
|
VTD_PCI_FUNC(as->devfn),
|
||||||
entry.iova, size);
|
n->start, size);
|
||||||
|
|
||||||
map.iova = entry.iova;
|
map.iova = n->start;
|
||||||
map.size = entry.addr_mask;
|
map.size = size;
|
||||||
iova_tree_remove(as->iova_tree, &map);
|
iova_tree_remove(as->iova_tree, &map);
|
||||||
|
|
||||||
memory_region_notify_one(n, &entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vtd_address_space_unmap_all(IntelIOMMUState *s)
|
static void vtd_address_space_unmap_all(IntelIOMMUState *s)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
#include "config-devices.h"
|
||||||
|
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
@ -61,9 +62,11 @@
|
||||||
|
|
||||||
#define MAX_IDE_BUS 2
|
#define MAX_IDE_BUS 2
|
||||||
|
|
||||||
|
#ifdef CONFIG_IDE_ISA
|
||||||
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
|
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
|
||||||
static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
|
static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
|
||||||
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
|
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
|
||||||
|
#endif
|
||||||
|
|
||||||
/* PC hardware initialisation */
|
/* PC hardware initialisation */
|
||||||
static void pc_init1(MachineState *machine,
|
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[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
|
||||||
idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
|
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++) {
|
for(i = 0; i < MAX_IDE_BUS; i++) {
|
||||||
ISADevice *dev;
|
ISADevice *dev;
|
||||||
char busname[] = "ide.0";
|
char busname[] = "ide.0";
|
||||||
|
@ -268,9 +274,9 @@ static void pc_init1(MachineState *machine,
|
||||||
busname[4] = '0' + i;
|
busname[4] = '0' + i;
|
||||||
idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
|
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)) {
|
if (pcmc->pci_enabled && machine_usb(machine)) {
|
||||||
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
|
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
|
||||||
|
|
|
@ -245,8 +245,8 @@ void ioapic_eoi_broadcast(int vector)
|
||||||
s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
|
s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
|
||||||
|
|
||||||
if (!(entry & IOAPIC_LVT_MASKED) && (s->irr & (1 << n))) {
|
if (!(entry & IOAPIC_LVT_MASKED) && (s->irr & (1 << n))) {
|
||||||
++s->irq_eoi[vector];
|
++s->irq_eoi[n];
|
||||||
if (s->irq_eoi[vector] >= SUCCESSIVE_IRQ_MAX_COUNT) {
|
if (s->irq_eoi[n] >= SUCCESSIVE_IRQ_MAX_COUNT) {
|
||||||
/*
|
/*
|
||||||
* Real hardware does not deliver the interrupt immediately
|
* Real hardware does not deliver the interrupt immediately
|
||||||
* during eoi broadcast, and this lets a buggy guest make
|
* 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
|
* level-triggered interrupt. Emulate this behavior if we
|
||||||
* detect an interrupt storm.
|
* detect an interrupt storm.
|
||||||
*/
|
*/
|
||||||
s->irq_eoi[vector] = 0;
|
s->irq_eoi[n] = 0;
|
||||||
timer_mod_anticipate(s->delayed_ioapic_service_timer,
|
timer_mod_anticipate(s->delayed_ioapic_service_timer,
|
||||||
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
||||||
NANOSECONDS_PER_SECOND / 100);
|
NANOSECONDS_PER_SECOND / 100);
|
||||||
trace_ioapic_eoi_delayed_reassert(vector);
|
trace_ioapic_eoi_delayed_reassert(n);
|
||||||
} else {
|
} else {
|
||||||
ioapic_service(s);
|
ioapic_service(s);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s->irq_eoi[vector] = 0;
|
s->irq_eoi[n] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,6 +380,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
|
||||||
/* restore RO bits */
|
/* restore RO bits */
|
||||||
s->ioredtbl[index] &= IOAPIC_RW_BITS;
|
s->ioredtbl[index] &= IOAPIC_RW_BITS;
|
||||||
s->ioredtbl[index] |= ro_bits;
|
s->ioredtbl[index] |= ro_bits;
|
||||||
|
s->irq_eoi[index] = 0;
|
||||||
ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
|
ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
|
||||||
ioapic_service(s);
|
ioapic_service(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2296,7 +2296,8 @@ sub process {
|
||||||
$value =~ s/\([^\(\)]*\)/1/) {
|
$value =~ s/\([^\(\)]*\)/1/) {
|
||||||
}
|
}
|
||||||
#print "value<$value>\n";
|
#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);
|
ERROR("return is not a function, parentheses are not required\n" . $herecurr);
|
||||||
|
|
||||||
} elsif ($spacing !~ /\s+/) {
|
} elsif ($spacing !~ /\s+/) {
|
||||||
|
|
|
@ -58,6 +58,8 @@ case $line in
|
||||||
name=${line%=*}
|
name=${line%=*}
|
||||||
echo "#define $name 1"
|
echo "#define $name 1"
|
||||||
;;
|
;;
|
||||||
|
CONFIG_*=n) # configuration
|
||||||
|
;;
|
||||||
CONFIG_*=*) # configuration
|
CONFIG_*=*) # configuration
|
||||||
name=${line%=*}
|
name=${line%=*}
|
||||||
value=${line#*=}
|
value=${line#*=}
|
||||||
|
|
|
@ -688,11 +688,13 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
data = KconfigData(mode)
|
data = KconfigData(mode)
|
||||||
parser = KconfigParser(data)
|
parser = KconfigParser(data)
|
||||||
|
external_vars = set()
|
||||||
for arg in argv[3:]:
|
for arg in argv[3:]:
|
||||||
m = re.match(r'^(CONFIG_[A-Z0-9_]+)=([yn]?)$', arg)
|
m = re.match(r'^(CONFIG_[A-Z0-9_]+)=([yn]?)$', arg)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
name, value = m.groups()
|
name, value = m.groups()
|
||||||
parser.do_assignment(name, value == 'y')
|
parser.do_assignment(name, value == 'y')
|
||||||
|
external_vars.add(name[7:])
|
||||||
else:
|
else:
|
||||||
fp = open(arg, 'r')
|
fp = open(arg, 'r')
|
||||||
parser.parse_file(fp)
|
parser.parse_file(fp)
|
||||||
|
@ -700,6 +702,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
config = data.compute_config()
|
config = data.compute_config()
|
||||||
for key in sorted(config.keys()):
|
for key in sorted(config.keys()):
|
||||||
|
if key not in external_vars:
|
||||||
print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
|
print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
|
||||||
|
|
||||||
deps = open(argv[2], 'w')
|
deps = open(argv[2], 'w')
|
||||||
|
|
|
@ -1043,14 +1043,15 @@ static int hv_cpuid_check_and_set(CPUState *cs, struct kvm_cpuid2 *cpuid,
|
||||||
CPUX86State *env = &cpu->env;
|
CPUX86State *env = &cpu->env;
|
||||||
uint32_t r, fw, bits;
|
uint32_t r, fw, bits;
|
||||||
uint64_t deps;
|
uint64_t deps;
|
||||||
int i, dep_feat = 0;
|
int i, dep_feat;
|
||||||
|
|
||||||
if (!hyperv_feat_enabled(cpu, feature) && !cpu->hyperv_passthrough) {
|
if (!hyperv_feat_enabled(cpu, feature) && !cpu->hyperv_passthrough) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
deps = kvm_hyperv_properties[feature].dependencies;
|
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))) {
|
if (!(hyperv_feat_enabled(cpu, dep_feat))) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Hyper-V %s requires Hyper-V %s\n",
|
"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);
|
kvm_hyperv_properties[dep_feat].desc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
dep_feat++;
|
deps &= ~(1ull << dep_feat);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(kvm_hyperv_properties[feature].flags); i++) {
|
for (i = 0; i < ARRAY_SIZE(kvm_hyperv_properties[feature].flags); i++) {
|
||||||
|
|
|
@ -997,9 +997,8 @@ static bool vmx_nested_state_needed(void *opaque)
|
||||||
{
|
{
|
||||||
struct kvm_nested_state *nested_state = opaque;
|
struct kvm_nested_state *nested_state = opaque;
|
||||||
|
|
||||||
return ((nested_state->format == KVM_STATE_NESTED_FORMAT_VMX) &&
|
return (nested_state->format == KVM_STATE_NESTED_FORMAT_VMX &&
|
||||||
((nested_state->hdr.vmx.vmxon_pa != -1ull) ||
|
nested_state->hdr.vmx.vmxon_pa != -1ull);
|
||||||
(nested_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const VMStateDescription vmstate_vmx_nested_state = {
|
static const VMStateDescription vmstate_vmx_nested_state = {
|
||||||
|
|
Loading…
Reference in New Issue