acpi,pc,build bug fixes

Here are some bugfixes for 2.0.
 
 A bugfix for acpi for pci bridges, and a build fix for
 old systems without pthread_setname_np: both fix regressions
 so we definitely want to include them.
 HPET fix is not for a regression but looks very safe,
 fixes a nasty bug and has been on list for a while.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJTNWRMAAoJECgfDbjSjVRp6CoH/A3iLi+jkV4EhQQzU8U6vOmi
 PIV71600rZd29u4hk6w5pyev6yyXSBwatmWk+vzHvINUIcc22KUue+773nXPW/fH
 3oIgTwjKndE98V5vTSeOgOdD7iFuWlcgHQHLXXMsgpY1hVMS/1kidZdb+36o8euI
 kdE+AxYGXS8Z3oBRFfROpT4v0UZ17qIaL4tqA4JJWMh/A3Qp3HY+ffU3ODAvKSQw
 KWVWmKvbh82I25HOvALoMwtu26x48jhzu586pHBuEsHgTJKKBrAUdWph+2f1eSC+
 xTgduKWEgK6Z9dCYDQwDaM8CqNzjqVzfgRu0RCSHtgTxCWaIN3dQbxEFi7WQ2Yo=
 =dfqJ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi,pc,build bug fixes

Here are some bugfixes for 2.0.

A bugfix for acpi for pci bridges, and a build fix for
old systems without pthread_setname_np: both fix regressions
so we definitely want to include them.
HPET fix is not for a regression but looks very safe,
fixes a nasty bug and has been on list for a while.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Fri 28 Mar 2014 12:00:12 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  acpi: fix ACPI generation for pci bridges
  Don't enable a HPET timer if HPET is disabled
  Detect pthread_setname_np at configure time

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-03-28 13:46:28 +00:00
commit 3b6144bdbb
5 changed files with 52 additions and 6 deletions

28
configure vendored
View File

@ -2712,6 +2712,24 @@ if test "$mingw32" != yes -a "$pthread" = no; then
"Make sure to have the pthread libs and headers installed." "Make sure to have the pthread libs and headers installed."
fi fi
# check for pthread_setname_np
pthread_setname_np=no
cat > $TMPC << EOF
#include <pthread.h>
static void *f(void *p) { return NULL; }
int main(void)
{
pthread_t thread;
pthread_create(&thread, 0, f, 0);
pthread_setname_np(thread, "QEMU");
return 0;
}
EOF
if compile_prog "" "$pthread_lib" ; then
pthread_setname_np=yes
fi
########################################## ##########################################
# rbd probe # rbd probe
if test "$rbd" != "no" ; then if test "$rbd" != "no" ; then
@ -4648,6 +4666,16 @@ if test "$rdma" = "yes" ; then
echo "CONFIG_RDMA=y" >> $config_host_mak echo "CONFIG_RDMA=y" >> $config_host_mak
fi fi
# Hold two types of flag:
# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
# a thread we have a handle to
# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
# platform
if test "$pthread_setname_np" = "yes" ; then
echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
fi
if test "$tcg_interpreter" = "yes"; then if test "$tcg_interpreter" = "yes"; then
QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
elif test "$ARCH" = "sparc64" ; then elif test "$ARCH" = "sparc64" ; then

View File

@ -841,7 +841,7 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
pc = PCI_DEVICE_GET_CLASS(pdev); pc = PCI_DEVICE_GET_CLASS(pdev);
dc = DEVICE_GET_CLASS(pdev); dc = DEVICE_GET_CLASS(pdev);
if (pc->class_id == PCI_CLASS_BRIDGE_ISA) { if (pc->class_id == PCI_CLASS_BRIDGE_ISA || pc->is_bridge) {
set_bit(slot, slot_device_system); set_bit(slot, slot_device_system);
} }
@ -882,7 +882,7 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF); memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF);
patch_pcivga(i, pcihp); patch_pcivga(i, pcihp);
} else if (system) { } else if (system) {
/* Nothing to do: system devices are in DSDT. */ /* Nothing to do: system devices are in DSDT or in SSDT above. */
} else if (present) { } else if (present) {
void *pcihp = acpi_data_push(bus_table, void *pcihp = acpi_data_push(bus_table,
ACPI_PCINOHP_SIZEOF); ACPI_PCINOHP_SIZEOF);

View File

@ -506,7 +506,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
timer->cmp = (uint32_t)timer->cmp; timer->cmp = (uint32_t)timer->cmp;
timer->period = (uint32_t)timer->period; timer->period = (uint32_t)timer->period;
} }
if (activating_bit(old_val, new_val, HPET_TN_ENABLE)) { if (activating_bit(old_val, new_val, HPET_TN_ENABLE) &&
hpet_enabled(s)) {
hpet_set_timer(timer); hpet_set_timer(timer);
} else if (deactivating_bit(old_val, new_val, HPET_TN_ENABLE)) { } else if (deactivating_bit(old_val, new_val, HPET_TN_ENABLE)) {
hpet_del_timer(timer); hpet_del_timer(timer);

View File

@ -32,6 +32,13 @@ static bool name_threads;
void qemu_thread_naming(bool enable) void qemu_thread_naming(bool enable)
{ {
name_threads = enable; name_threads = enable;
#ifndef CONFIG_THREAD_SETNAME_BYTHREAD
/* This is a debugging option, not fatal */
if (enable) {
fprintf(stderr, "qemu: thread naming not supported on this host\n");
}
#endif
} }
static void error_exit(int err, const char *msg) static void error_exit(int err, const char *msg)
@ -394,6 +401,16 @@ void qemu_event_wait(QemuEvent *ev)
} }
} }
/* Attempt to set the threads name; note that this is for debug, so
* we're not going to fail if we can't set it.
*/
static void qemu_thread_set_name(QemuThread *thread, const char *name)
{
#ifdef CONFIG_PTHREAD_SETNAME_NP
pthread_setname_np(thread->thread, name);
#endif
}
void qemu_thread_create(QemuThread *thread, const char *name, void qemu_thread_create(QemuThread *thread, const char *name,
void *(*start_routine)(void*), void *(*start_routine)(void*),
void *arg, int mode) void *arg, int mode)
@ -420,11 +437,9 @@ void qemu_thread_create(QemuThread *thread, const char *name,
if (err) if (err)
error_exit(err, __func__); error_exit(err, __func__);
#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
if (name_threads) { if (name_threads) {
pthread_setname_np(thread->thread, name); qemu_thread_set_name(thread, name);
} }
#endif
pthread_sigmask(SIG_SETMASK, &oldset, NULL); pthread_sigmask(SIG_SETMASK, &oldset, NULL);

View File

@ -22,6 +22,8 @@ void qemu_thread_naming(bool enable)
{ {
/* But note we don't actually name them on Windows yet */ /* But note we don't actually name them on Windows yet */
name_threads = enable; name_threads = enable;
fprintf(stderr, "qemu: thread naming not supported on this host\n");
} }
static void error_exit(int err, const char *msg) static void error_exit(int err, const char *msg)