mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
- more config options
- bootdevice, iscsi, virtio-scsi fixes - build system patches for MinGW and config-devices.mak - qemu_mutex_lock_iothread deadlock fixes - another tiny patch from the record/replay series -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAABAgAGBQJU9DRyAAoJEL/70l94x66D5ZkH/2SPp4rrLIgotyzHTIaMvi+2 0gB7Bks9cDisFyiSgr6dqLp9CV1XMlv/NZl+z+H/7og96qhBWjAKVpG1J/En55bS vanFeWGYjINuQLnhC3pqBi2kmEkzBQSIMJZt9WnDydfQj/6Wgcr6iabOpd8eTjTz rqE/UcV2L1baFPLy/Wky2vg/a5Ug2rj+fqvjRdFB/Zx8yDYLcKYJlI8utSQexamE tUcxr/AqxNOoe6WZD7CCVNmHMHvajoOhWnVY4EgHDg8L3nNSgvDF3AjYfntU6A2y HjkS0ktvQK666oNo+ORRBzLe3s9nCfB1dMK2ZiKKyFfyuYD50d2N3oHKSAIsEJo= =AQjO -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging - more config options - bootdevice, iscsi, virtio-scsi fixes - build system patches for MinGW and config-devices.mak - qemu_mutex_lock_iothread deadlock fixes - another tiny patch from the record/replay series # gpg: Signature made Mon Mar 2 09:59:14 2015 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # 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: cpus: be more paranoid in avoiding deadlocks cpus: fix deadlock and segfault in qemu_mutex_lock_iothread virtio-scsi: Allocate op blocker reason before blocking Makefile.target: binary depends on config-devices Makefile: don't silence mak file test with V=1 Makefile: fix up parallel building under MSYS+MinGW iscsi: Handle write protected case in reopen Give ivshmem its own config option Create specific config option for "platform-bus" Add specific config options for PCI-E bridges bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd' timer: replace time() with QEMU_CLOCK_HOST virtio-scsi-dataplane: Call blk_set_aio_context within BQL block: Forbid bdrv_set_aio_context outside BQL scsi: give device a parent before setting properties Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3180aadb1f
10
Makefile
10
Makefile
@ -109,8 +109,8 @@ endif
|
||||
-include $(SUBDIR_DEVICES_MAK_DEP)
|
||||
|
||||
%/config-devices.mak: default-configs/%.mak
|
||||
$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@")
|
||||
@if test -f $@; then \
|
||||
$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@.tmp $<, " GEN $@.tmp")
|
||||
$(call quiet-command, if test -f $@; then \
|
||||
if cmp -s $@.old $@; then \
|
||||
mv $@.tmp $@; \
|
||||
cp -p $@ $@.old; \
|
||||
@ -126,7 +126,7 @@ endif
|
||||
else \
|
||||
mv $@.tmp $@; \
|
||||
cp -p $@ $@.old; \
|
||||
fi
|
||||
fi, " GEN $@");
|
||||
|
||||
defconfig:
|
||||
rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
|
||||
@ -197,9 +197,9 @@ ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
|
||||
|
||||
recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
|
||||
|
||||
$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h | $(BUILD_DIR)/version.lo
|
||||
$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h | $(BUILD_DIR)/version.lo
|
||||
$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.o")
|
||||
$(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h
|
||||
$(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc config-host.h
|
||||
$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.lo")
|
||||
|
||||
Makefile: $(version-obj-y) $(version-lobj-y)
|
||||
|
@ -175,9 +175,11 @@ all-obj-y += $(common-obj-y)
|
||||
all-obj-y += $(target-obj-y)
|
||||
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
|
||||
|
||||
$(QEMU_PROG_BUILD): config-devices.mak
|
||||
|
||||
# build either PROG or PROGW
|
||||
$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
|
||||
$(call LINK,$^)
|
||||
$(call LINK, $(filter-out %.mak, $^))
|
||||
|
||||
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
|
||||
$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
|
||||
|
@ -65,6 +65,7 @@ typedef struct IscsiLun {
|
||||
unsigned long *allocationmap;
|
||||
int cluster_sectors;
|
||||
bool use_16_for_rw;
|
||||
bool write_protected;
|
||||
} IscsiLun;
|
||||
|
||||
typedef struct IscsiTask {
|
||||
@ -1268,10 +1269,6 @@ out:
|
||||
/*
|
||||
* We support iscsi url's on the form
|
||||
* iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
|
||||
*
|
||||
* Note: flags are currently not used by iscsi_open. If this function
|
||||
* is changed such that flags are used, please examine iscsi_reopen_prepare()
|
||||
* to see if needs to be changed as well.
|
||||
*/
|
||||
static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
@ -1385,9 +1382,10 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
scsi_free_scsi_task(task);
|
||||
task = NULL;
|
||||
|
||||
iscsilun->write_protected = iscsi_is_write_protected(iscsilun);
|
||||
/* Check the write protect flag of the LUN if we want to write */
|
||||
if (iscsilun->type == TYPE_DISK && (flags & BDRV_O_RDWR) &&
|
||||
iscsi_is_write_protected(iscsilun)) {
|
||||
iscsilun->write_protected) {
|
||||
error_setg(errp, "Cannot open a write protected LUN as read-write");
|
||||
ret = -EACCES;
|
||||
goto out;
|
||||
@ -1541,13 +1539,17 @@ static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
sector_limits_lun2qemu(iscsilun->bl.opt_xfer_len, iscsilun);
|
||||
}
|
||||
|
||||
/* Since iscsi_open() ignores bdrv_flags, there is nothing to do here in
|
||||
* prepare. Note that this will not re-establish a connection with an iSCSI
|
||||
* target - it is effectively a NOP. */
|
||||
/* Note that this will not re-establish a connection with an iSCSI target - it
|
||||
* is effectively a NOP. */
|
||||
static int iscsi_reopen_prepare(BDRVReopenState *state,
|
||||
BlockReopenQueue *queue, Error **errp)
|
||||
{
|
||||
/* NOP */
|
||||
IscsiLun *iscsilun = state->bs->opaque;
|
||||
|
||||
if (state->flags & BDRV_O_RDWR && iscsilun->write_protected) {
|
||||
error_setg(errp, "Cannot open a write protected LUN as read-write");
|
||||
return -EACCES;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
13
bootdevice.c
13
bootdevice.c
@ -221,10 +221,15 @@ char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
|
||||
}
|
||||
|
||||
if (!ignore_suffixes) {
|
||||
d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, i->dev);
|
||||
if (d) {
|
||||
assert(!i->suffix);
|
||||
suffix = d;
|
||||
if (i->dev) {
|
||||
d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus,
|
||||
i->dev);
|
||||
if (d) {
|
||||
assert(!i->suffix);
|
||||
suffix = d;
|
||||
} else {
|
||||
suffix = g_strdup(i->suffix);
|
||||
}
|
||||
} else {
|
||||
suffix = g_strdup(i->suffix);
|
||||
}
|
||||
|
12
cpus.c
12
cpus.c
@ -778,7 +778,7 @@ static void qemu_tcg_init_cpu_signals(void)
|
||||
|
||||
static QemuMutex qemu_global_mutex;
|
||||
static QemuCond qemu_io_proceeded_cond;
|
||||
static bool iothread_requesting_mutex;
|
||||
static unsigned iothread_requesting_mutex;
|
||||
|
||||
static QemuThread io_thread;
|
||||
|
||||
@ -1025,6 +1025,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* process any pending work */
|
||||
exit_request = 1;
|
||||
|
||||
while (1) {
|
||||
tcg_exec_all();
|
||||
|
||||
@ -1115,15 +1118,16 @@ bool qemu_in_vcpu_thread(void)
|
||||
|
||||
void qemu_mutex_lock_iothread(void)
|
||||
{
|
||||
if (!tcg_enabled()) {
|
||||
atomic_inc(&iothread_requesting_mutex);
|
||||
if (!tcg_enabled() || !first_cpu) {
|
||||
qemu_mutex_lock(&qemu_global_mutex);
|
||||
atomic_dec(&iothread_requesting_mutex);
|
||||
} else {
|
||||
iothread_requesting_mutex = true;
|
||||
if (qemu_mutex_trylock(&qemu_global_mutex)) {
|
||||
qemu_cpu_kick_thread(first_cpu);
|
||||
qemu_mutex_lock(&qemu_global_mutex);
|
||||
}
|
||||
iothread_requesting_mutex = false;
|
||||
atomic_dec(&iothread_requesting_mutex);
|
||||
qemu_cond_broadcast(&qemu_io_proceeded_cond);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ CONFIG_PFLASH_CFI02=y
|
||||
CONFIG_MICRODRIVE=y
|
||||
CONFIG_USB_MUSB=y
|
||||
CONFIG_USB_EHCI_SYSBUS=y
|
||||
CONFIG_PLATFORM_BUS=y
|
||||
|
||||
CONFIG_ARM11MPCORE=y
|
||||
CONFIG_A9MPCORE=y
|
||||
@ -91,3 +92,7 @@ CONFIG_INTEGRATOR_DEBUG=y
|
||||
CONFIG_ALLWINNER_A10_PIT=y
|
||||
CONFIG_ALLWINNER_A10_PIC=y
|
||||
CONFIG_ALLWINNER_A10=y
|
||||
|
||||
CONFIG_XIO3130=y
|
||||
CONFIG_IOH3420=y
|
||||
CONFIG_I82801B11=y
|
||||
|
@ -43,3 +43,6 @@ CONFIG_IOAPIC=y
|
||||
CONFIG_ICC_BUS=y
|
||||
CONFIG_PVPANIC=y
|
||||
CONFIG_MEM_HOTPLUG=y
|
||||
CONFIG_XIO3130=y
|
||||
CONFIG_IOH3420=y
|
||||
CONFIG_I82801B11=y
|
||||
|
@ -35,3 +35,4 @@ CONFIG_SDHCI=y
|
||||
CONFIG_EDU=y
|
||||
CONFIG_VGA=y
|
||||
CONFIG_VGA_PCI=y
|
||||
CONFIG_IVSHMEM=$(CONFIG_KVM)
|
||||
|
@ -43,6 +43,7 @@ CONFIG_PREP=y
|
||||
CONFIG_MAC=y
|
||||
CONFIG_E500=y
|
||||
CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
|
||||
CONFIG_PLATFORM_BUS=y
|
||||
CONFIG_ETSEC=y
|
||||
CONFIG_LIBDECNUMBER=y
|
||||
# For PReP
|
||||
|
@ -44,6 +44,7 @@ CONFIG_PREP=y
|
||||
CONFIG_MAC=y
|
||||
CONFIG_E500=y
|
||||
CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
|
||||
CONFIG_PLATFORM_BUS=y
|
||||
CONFIG_ETSEC=y
|
||||
CONFIG_LIBDECNUMBER=y
|
||||
# For pSeries
|
||||
|
@ -43,3 +43,6 @@ CONFIG_IOAPIC=y
|
||||
CONFIG_ICC_BUS=y
|
||||
CONFIG_PVPANIC=y
|
||||
CONFIG_MEM_HOTPLUG=y
|
||||
CONFIG_XIO3130=y
|
||||
CONFIG_IOH3420=y
|
||||
CONFIG_I82801B11=y
|
||||
|
@ -14,4 +14,4 @@ common-obj-$(CONFIG_SOFTMMU) += machine.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += loader.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += platform-bus.o
|
||||
common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
|
||||
|
@ -19,9 +19,7 @@ common-obj-$(CONFIG_PUV3) += puv3_pm.o
|
||||
|
||||
common-obj-$(CONFIG_MACIO) += macio/
|
||||
|
||||
ifeq ($(CONFIG_PCI), y)
|
||||
obj-$(CONFIG_KVM) += ivshmem.o
|
||||
endif
|
||||
obj-$(CONFIG_IVSHMEM) += ivshmem.o
|
||||
|
||||
obj-$(CONFIG_REALVIEW) += arm_sysctl.o
|
||||
obj-$(CONFIG_NSERIES) += cbus.o
|
||||
|
@ -1,5 +1,6 @@
|
||||
common-obj-y += pci_bridge_dev.o
|
||||
common-obj-y += ioh3420.o xio3130_upstream.o xio3130_downstream.o
|
||||
common-obj-y += i82801b11.o
|
||||
common-obj-$(CONFIG_XIO3130) += xio3130_upstream.o xio3130_downstream.o
|
||||
common-obj-$(CONFIG_IOH3420) += ioh3420.o
|
||||
common-obj-$(CONFIG_I82801B11) += i82801b11.o
|
||||
# NewWorld PowerMac
|
||||
common-obj-$(CONFIG_DEC_PCI) += dec.o
|
||||
|
@ -221,11 +221,16 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
|
||||
const char *serial, Error **errp)
|
||||
{
|
||||
const char *driver;
|
||||
char *name;
|
||||
DeviceState *dev;
|
||||
Error *err = NULL;
|
||||
|
||||
driver = blk_is_sg(blk) ? "scsi-generic" : "scsi-disk";
|
||||
dev = qdev_create(&bus->qbus, driver);
|
||||
name = g_strdup_printf("legacy[%d]", unit);
|
||||
object_property_add_child(OBJECT(bus), name, OBJECT(dev), NULL);
|
||||
g_free(name);
|
||||
|
||||
qdev_prop_set_uint32(dev, "scsi-id", unit);
|
||||
if (bootindex >= 0) {
|
||||
object_property_set_int(OBJECT(dev), bootindex, "bootindex",
|
||||
|
@ -211,8 +211,6 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
|
||||
|
||||
s->dataplane_starting = true;
|
||||
|
||||
assert(!s->blocker);
|
||||
error_setg(&s->blocker, "block device is in use by data plane");
|
||||
/* Set up guest notifier (irq) */
|
||||
rc = k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, true);
|
||||
if (rc != 0) {
|
||||
@ -279,8 +277,6 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
|
||||
if (!s->dataplane_started || s->dataplane_stopping) {
|
||||
return;
|
||||
}
|
||||
error_free(s->blocker);
|
||||
s->blocker = NULL;
|
||||
s->dataplane_stopping = true;
|
||||
assert(s->ctx == iothread_get_aio_context(vs->conf.iothread));
|
||||
|
||||
|
@ -254,10 +254,8 @@ static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
|
||||
int target;
|
||||
int ret = 0;
|
||||
|
||||
if (s->dataplane_started && blk_get_aio_context(d->conf.blk) != s->ctx) {
|
||||
aio_context_acquire(s->ctx);
|
||||
blk_set_aio_context(d->conf.blk, s->ctx);
|
||||
aio_context_release(s->ctx);
|
||||
if (s->dataplane_started) {
|
||||
assert(blk_get_aio_context(d->conf.blk) == s->ctx);
|
||||
}
|
||||
/* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE". */
|
||||
req->resp.tmf.response = VIRTIO_SCSI_S_OK;
|
||||
@ -540,10 +538,8 @@ bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req)
|
||||
virtio_scsi_complete_cmd_req(req);
|
||||
return false;
|
||||
}
|
||||
if (s->dataplane_started && blk_get_aio_context(d->conf.blk) != s->ctx) {
|
||||
aio_context_acquire(s->ctx);
|
||||
blk_set_aio_context(d->conf.blk, s->ctx);
|
||||
aio_context_release(s->ctx);
|
||||
if (s->dataplane_started) {
|
||||
assert(blk_get_aio_context(d->conf.blk) == s->ctx);
|
||||
}
|
||||
req->sreq = scsi_req_new(d, req->req.cmd.tag,
|
||||
virtio_scsi_get_lun(req->req.cmd.lun),
|
||||
@ -767,6 +763,9 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||
return;
|
||||
}
|
||||
blk_op_block_all(sd->conf.blk, s->blocker);
|
||||
aio_context_acquire(s->ctx);
|
||||
blk_set_aio_context(sd->conf.blk, s->ctx);
|
||||
aio_context_release(s->ctx);
|
||||
}
|
||||
|
||||
if ((vdev->guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) {
|
||||
@ -904,6 +903,8 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
|
||||
virtio_scsi_save, virtio_scsi_load, s);
|
||||
s->migration_state_notifier.notify = virtio_scsi_migration_state_changed;
|
||||
add_migration_state_change_notifier(&s->migration_state_notifier);
|
||||
|
||||
error_setg(&s->blocker, "block device is in use by data plane");
|
||||
}
|
||||
|
||||
static void virtio_scsi_instance_init(Object *obj)
|
||||
@ -929,6 +930,8 @@ static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
VirtIOSCSI *s = VIRTIO_SCSI(dev);
|
||||
|
||||
error_free(s->blocker);
|
||||
|
||||
unregister_savevm(dev, "virtio-scsi", s);
|
||||
remove_migration_state_change_notifier(&s->migration_state_notifier);
|
||||
|
||||
|
@ -547,8 +547,7 @@ AioContext *bdrv_get_aio_context(BlockDriverState *bs);
|
||||
* Changes the #AioContext used for fd handlers, timers, and BHs by this
|
||||
* BlockDriverState and all its children.
|
||||
*
|
||||
* This function must be called from the old #AioContext or with a lock held so
|
||||
* the old #AioContext is not executing.
|
||||
* This function must be called with iothread lock held.
|
||||
*/
|
||||
void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Construct a target device config file from a default, pulling in any
|
||||
# files from include directives.
|
||||
|
||||
dest=$1.tmp
|
||||
dest=$1
|
||||
dep=`dirname $1`-`basename $1`.d
|
||||
src=$2
|
||||
src_dir=`dirname $src`
|
||||
|
12
vl.c
12
vl.c
@ -707,13 +707,17 @@ void vm_start(void)
|
||||
/***********************************************************/
|
||||
/* real time host monotonic timer */
|
||||
|
||||
static time_t qemu_time(void)
|
||||
{
|
||||
return qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* host time/date access */
|
||||
void qemu_get_timedate(struct tm *tm, int offset)
|
||||
{
|
||||
time_t ti;
|
||||
time_t ti = qemu_time();
|
||||
|
||||
time(&ti);
|
||||
ti += offset;
|
||||
if (rtc_date_offset == -1) {
|
||||
if (rtc_utc)
|
||||
@ -741,7 +745,7 @@ int qemu_timedate_diff(struct tm *tm)
|
||||
else
|
||||
seconds = mktimegm(tm) + rtc_date_offset;
|
||||
|
||||
return seconds - time(NULL);
|
||||
return seconds - qemu_time();
|
||||
}
|
||||
|
||||
static void configure_rtc_date_offset(const char *startdate, int legacy)
|
||||
@ -779,7 +783,7 @@ static void configure_rtc_date_offset(const char *startdate, int legacy)
|
||||
"'2006-06-17T16:01:21' or '2006-06-17'\n");
|
||||
exit(1);
|
||||
}
|
||||
rtc_date_offset = time(NULL) - rtc_start_date;
|
||||
rtc_date_offset = qemu_time() - rtc_start_date;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user