diff options
-rwxr-xr-x | configure | 14 | ||||
-rw-r--r-- | hw/pci/pci.c | 2 | ||||
-rw-r--r-- | include/hw/virtio/virtio.h | 2 | ||||
-rw-r--r-- | target/i386/cpu.c | 32 | ||||
-rw-r--r-- | target/i386/cpu.h | 2 | ||||
-rw-r--r-- | util/event_notifier-posix.c | 2 | ||||
-rw-r--r-- | util/event_notifier-win32.c | 1 |
7 files changed, 41 insertions, 14 deletions
@@ -323,6 +323,7 @@ replication="yes" supported_cpu="no" supported_os="no" +bogus_os="no" # parse CC options first for opt do @@ -694,7 +695,10 @@ Linux) supported_os="yes" ;; *) - error_exit "Unsupported host OS $targetos" + # This is a fatal error, but don't report it yet, because we + # might be going to just print the --help text, or it might + # be the result of a missing compiler. + bogus_os="yes" ;; esac @@ -1460,6 +1464,14 @@ if ! compile_prog ; then error_exit "\"$cc\" cannot build an executable (is your linker broken?)" fi +if test "$bogus_os" = "yes"; then + # Now that we know that we're not printing the help and that + # the compiler works (so the results of the check_defines we used + # to identify the OS are reliable), if we didn't recognize the + # host OS we should stop now. + error_exit "Unrecognized host OS $targetos" +fi + # Check that the C++ compiler exists and works with the C compiler if has $cxx; then cat > $TMPC <<EOF diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e6b08e1988..bd8043c460 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev) pci_dev->bus->devices[pci_dev->devfn] = NULL; pci_config_free(pci_dev); + memory_region_del_subregion(&pci_dev->bus_master_container_region, + &pci_dev->bus_master_enable_region); address_space_destroy(&pci_dev->bus_master_as); } diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 15efcf2057..7b6edbafd7 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -34,7 +34,7 @@ struct VirtQueue; static inline hwaddr vring_align(hwaddr addr, unsigned long align) { - return (addr + align - 1) & ~(align - 1); + return QEMU_ALIGN_UP(addr, align); } typedef struct VirtQueue VirtQueue; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7aa762245a..13c0985f11 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3373,15 +3373,19 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) GList *l; Error *local_err = NULL; - /*TODO: cpu->max_features incorrectly overwrites features - * set using "feat=on|off". Once we fix this, we can convert + /*TODO: Now cpu->max_features doesn't overwrite features + * set using QOM properties, and we can convert * plus_features & minus_features to global properties * inside x86_cpu_parse_featurestr() too. */ if (cpu->max_features) { for (w = 0; w < FEATURE_WORDS; w++) { - env->features[w] = - x86_cpu_get_supported_feature_word(w, cpu->migratable); + /* Override only features that weren't set explicitly + * by the user. + */ + env->features[w] |= + x86_cpu_get_supported_feature_word(w, cpu->migratable) & + ~env->user_features[w]; } } @@ -3692,15 +3696,17 @@ static void x86_cpu_unrealizefn(DeviceState *dev, Error **errp) } typedef struct BitProperty { - uint32_t *ptr; + FeatureWord w; uint32_t mask; } BitProperty; static void x86_cpu_get_bit_prop(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + X86CPU *cpu = X86_CPU(obj); BitProperty *fp = opaque; - bool value = (*fp->ptr & fp->mask) == fp->mask; + uint32_t f = cpu->env.features[fp->w]; + bool value = (f & fp->mask) == fp->mask; visit_type_bool(v, name, &value, errp); } @@ -3708,6 +3714,7 @@ static void x86_cpu_set_bit_prop(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { DeviceState *dev = DEVICE(obj); + X86CPU *cpu = X86_CPU(obj); BitProperty *fp = opaque; Error *local_err = NULL; bool value; @@ -3724,10 +3731,11 @@ static void x86_cpu_set_bit_prop(Object *obj, Visitor *v, const char *name, } if (value) { - *fp->ptr |= fp->mask; + cpu->env.features[fp->w] |= fp->mask; } else { - *fp->ptr &= ~fp->mask; + cpu->env.features[fp->w] &= ~fp->mask; } + cpu->env.user_features[fp->w] |= fp->mask; } static void x86_cpu_release_bit_prop(Object *obj, const char *name, @@ -3745,7 +3753,7 @@ static void x86_cpu_release_bit_prop(Object *obj, const char *name, */ static void x86_cpu_register_bit_prop(X86CPU *cpu, const char *prop_name, - uint32_t *field, + FeatureWord w, int bitnr) { BitProperty *fp; @@ -3755,11 +3763,11 @@ static void x86_cpu_register_bit_prop(X86CPU *cpu, op = object_property_find(OBJECT(cpu), prop_name, NULL); if (op) { fp = op->opaque; - assert(fp->ptr == field); + assert(fp->w == w); fp->mask |= mask; } else { fp = g_new0(BitProperty, 1); - fp->ptr = field; + fp->w = w; fp->mask = mask; object_property_add(OBJECT(cpu), prop_name, "bool", x86_cpu_get_bit_prop, @@ -3787,7 +3795,7 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu, /* aliases don't use "|" delimiters anymore, they are registered * manually using object_property_add_alias() */ assert(!strchr(name, '|')); - x86_cpu_register_bit_prop(cpu, name, &cpu->env.features[w], bitnr); + x86_cpu_register_bit_prop(cpu, name, w, bitnr); } static GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 07401ad9fe..c4602ca80d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1147,6 +1147,8 @@ typedef struct CPUX86State { uint32_t cpuid_vendor3; uint32_t cpuid_version; FeatureWordArray features; + /* Features that were explicitly enabled/disabled */ + FeatureWordArray user_features; uint32_t cpuid_model[12]; /* MTRRs */ diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 7e40252ade..acdbe3b483 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -81,8 +81,10 @@ void event_notifier_cleanup(EventNotifier *e) { if (e->rfd != e->wfd) { close(e->rfd); + e->rfd = -1; } close(e->wfd); + e->wfd = -1; } int event_notifier_get_fd(const EventNotifier *e) diff --git a/util/event_notifier-win32.c b/util/event_notifier-win32.c index 519fb59123..62c53b0a99 100644 --- a/util/event_notifier-win32.c +++ b/util/event_notifier-win32.c @@ -25,6 +25,7 @@ int event_notifier_init(EventNotifier *e, int active) void event_notifier_cleanup(EventNotifier *e) { CloseHandle(e->event); + e->event = NULL; } HANDLE event_notifier_get_handle(EventNotifier *e) |