Compare commits
135 Commits
for_autote
...
pull-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
496eacaa67 | ||
|
|
5cce173323 | ||
|
|
6686ce3f16 | ||
|
|
764ba3ae51 | ||
|
|
29c838cdc9 | ||
|
|
9049736ec7 | ||
|
|
d7b2529792 | ||
|
|
c615091793 | ||
|
|
866323f39d | ||
|
|
6e82e4bce1 | ||
|
|
508249952c | ||
|
|
dcfb3beb51 | ||
|
|
0fc9f8ea28 | ||
|
|
ba3f0e2545 | ||
|
|
e0cf11f31c | ||
|
|
471fae3c98 | ||
|
|
126b8bbdfe | ||
|
|
4b80ab2b7d | ||
|
|
3e5feb6202 | ||
|
|
5dd7a535b7 | ||
|
|
d2966f804d | ||
|
|
a435612616 | ||
|
|
bb337ac978 | ||
|
|
805167adcb | ||
|
|
2b464e13f0 | ||
|
|
5f37fd8e29 | ||
|
|
dc1e1350f8 | ||
|
|
d14b9d79be | ||
|
|
4e2c0b2a4a | ||
|
|
62f7dbde4c | ||
|
|
f1fb9f0dc0 | ||
|
|
b21ab1fc21 | ||
|
|
f3c2bda216 | ||
|
|
ca79373653 | ||
|
|
d0652b5765 | ||
|
|
ccb0c7e122 | ||
|
|
4b3bcd016d | ||
|
|
ed7ce6c0f9 | ||
|
|
ab39ee452d | ||
|
|
3b4a548944 | ||
|
|
2a24a7bade | ||
|
|
e033209583 | ||
|
|
65935f070a | ||
|
|
3a1f426828 | ||
|
|
9e8f441a7e | ||
|
|
e29c962804 | ||
|
|
6893f07466 | ||
|
|
1f1b4c008e | ||
|
|
f60eeb0c5d | ||
|
|
e60ec06357 | ||
|
|
1bf5902de0 | ||
|
|
2c44b19c19 | ||
|
|
3b3c1694cf | ||
|
|
ff33476772 | ||
|
|
d6ca4277ee | ||
|
|
9f6f7ca149 | ||
|
|
0a4a0312bf | ||
|
|
58e8b33518 | ||
|
|
1e81aba5ac | ||
|
|
4ef0defbad | ||
|
|
d139e9a6cf | ||
|
|
1322629b4f | ||
|
|
027a247bbf | ||
|
|
1204854501 | ||
|
|
a30c4eb2ce | ||
|
|
355df30554 | ||
|
|
3de3d698d9 | ||
|
|
8684e85ca9 | ||
|
|
22b2aeb82c | ||
|
|
ae5fdc81a1 | ||
|
|
eaa2ddbb76 | ||
|
|
f9cfd6555a | ||
|
|
ae08fd5a36 | ||
|
|
6b932c0a5f | ||
|
|
a91e21186f | ||
|
|
c23f23b970 | ||
|
|
1e4db05957 | ||
|
|
417349e6e9 | ||
|
|
f9b9d292af | ||
|
|
41fc9050fe | ||
|
|
acff3e48b7 | ||
|
|
b7c69719d2 | ||
|
|
1ea6305a83 | ||
|
|
7c59364d03 | ||
|
|
4aab6282f8 | ||
|
|
bfa3ab6197 | ||
|
|
a4969e90b8 | ||
|
|
000d6042da | ||
|
|
ffffbb369f | ||
|
|
74526eb018 | ||
|
|
3782f60d20 | ||
|
|
69976894c1 | ||
|
|
950fe0aa3f | ||
|
|
6b64640dd2 | ||
|
|
3307ed7b3f | ||
|
|
a93a3982a6 | ||
|
|
bcb225550d | ||
|
|
1b6bc94d5d | ||
|
|
b192af8acc | ||
|
|
25940fa7e5 | ||
|
|
d5941ddae8 | ||
|
|
c6a8c3283f | ||
|
|
6e40b3bfc7 | ||
|
|
97b0385a34 | ||
|
|
2f388b93a1 | ||
|
|
f406c03c09 | ||
|
|
6966b2a071 | ||
|
|
a3206972a9 | ||
|
|
a5d4d7b580 | ||
|
|
006a5edebe | ||
|
|
6f2b9a5b24 | ||
|
|
a0b1a66ea3 | ||
|
|
cc7a8ea740 | ||
|
|
d49b683644 | ||
|
|
4629ed1e98 | ||
|
|
485febc6d1 | ||
|
|
8b53a19675 | ||
|
|
c6bd8c706a | ||
|
|
75158ebbe2 | ||
|
|
c6bf0f7ffa | ||
|
|
1459407e88 | ||
|
|
70b9433109 | ||
|
|
f006cf7fa9 | ||
|
|
4caa489d13 | ||
|
|
d282842999 | ||
|
|
ed238ba2a0 | ||
|
|
a5ec494e27 | ||
|
|
d49190c420 | ||
|
|
5bcda5f734 | ||
|
|
e549d2aaeb | ||
|
|
dd41eea771 | ||
|
|
ae50212ff7 | ||
|
|
19f2db5c84 | ||
|
|
34acbc9522 | ||
|
|
fc48ffc39e |
@@ -740,6 +740,12 @@ S: Supported
|
|||||||
F: hw/s390x/virtio-ccw.[hc]
|
F: hw/s390x/virtio-ccw.[hc]
|
||||||
T: git git://github.com/cohuck/qemu virtio-ccw-upstr
|
T: git git://github.com/cohuck/qemu virtio-ccw-upstr
|
||||||
|
|
||||||
|
virtio-input
|
||||||
|
M: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
S: Maintained
|
||||||
|
F: hw/input/virtio-input*.c
|
||||||
|
F: include/hw/virtio/virtio-input.h
|
||||||
|
|
||||||
virtio-serial
|
virtio-serial
|
||||||
M: Amit Shah <amit.shah@redhat.com>
|
M: Amit Shah <amit.shah@redhat.com>
|
||||||
S: Supported
|
S: Supported
|
||||||
|
|||||||
20
Makefile
20
Makefile
@@ -3,6 +3,11 @@
|
|||||||
# Always point to the root of the build tree (needs GNU make).
|
# Always point to the root of the build tree (needs GNU make).
|
||||||
BUILD_DIR=$(CURDIR)
|
BUILD_DIR=$(CURDIR)
|
||||||
|
|
||||||
|
# Before including a proper config-host.mak, assume we are in the source tree
|
||||||
|
SRC_PATH=.
|
||||||
|
|
||||||
|
UNCHECKED_GOALS := %clean TAGS cscope ctags
|
||||||
|
|
||||||
# All following code might depend on configuration variables
|
# All following code might depend on configuration variables
|
||||||
ifneq ($(wildcard config-host.mak),)
|
ifneq ($(wildcard config-host.mak),)
|
||||||
# Put the all: rule here so that config-host.mak can contain dependencies.
|
# Put the all: rule here so that config-host.mak can contain dependencies.
|
||||||
@@ -38,7 +43,7 @@ config-host.mak: $(SRC_PATH)/configure
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
config-host.mak:
|
config-host.mak:
|
||||||
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
||||||
@echo "Please call configure before running make!"
|
@echo "Please call configure before running make!"
|
||||||
@exit 1
|
@exit 1
|
||||||
endif
|
endif
|
||||||
@@ -449,15 +454,20 @@ endif
|
|||||||
test speed: all
|
test speed: all
|
||||||
$(MAKE) -C tests/tcg $@
|
$(MAKE) -C tests/tcg $@
|
||||||
|
|
||||||
|
.PHONY: ctags
|
||||||
|
ctags:
|
||||||
|
rm -f $@
|
||||||
|
find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
|
||||||
|
|
||||||
.PHONY: TAGS
|
.PHONY: TAGS
|
||||||
TAGS:
|
TAGS:
|
||||||
rm -f $@
|
rm -f $@
|
||||||
find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
|
find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
|
||||||
|
|
||||||
cscope:
|
cscope:
|
||||||
rm -f ./cscope.*
|
rm -f "$(SRC_PATH)"/cscope.*
|
||||||
find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
|
find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
|
||||||
cscope -b
|
cscope -b -i"$(SRC_PATH)/cscope.files"
|
||||||
|
|
||||||
# opengl shader programs
|
# opengl shader programs
|
||||||
ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
|
ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
|
||||||
@@ -600,7 +610,7 @@ endif # CONFIG_WIN
|
|||||||
|
|
||||||
# Add a dependency on the generated files, so that they are always
|
# Add a dependency on the generated files, so that they are always
|
||||||
# rebuilt before other object files
|
# rebuilt before other object files
|
||||||
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
||||||
Makefile: $(GENERATED_HEADERS)
|
Makefile: $(GENERATED_HEADERS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "ui/qemu-spice.h"
|
#include "ui/qemu-spice.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "qapi-types.h"
|
#include "qapi-types.h"
|
||||||
#include "qapi-visit.h"
|
#include "qapi-visit.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
#include "qom/object_interfaces.h"
|
#include "qom/object_interfaces.h"
|
||||||
|
|
||||||
|
|||||||
@@ -140,19 +140,20 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
|
|||||||
RngEgd *s = RNG_EGD(b);
|
RngEgd *s = RNG_EGD(b);
|
||||||
|
|
||||||
if (s->chr_name == NULL) {
|
if (s->chr_name == NULL) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||||
"chardev", "a valid character device");
|
"chardev", "a valid character device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->chr = qemu_chr_find(s->chr_name);
|
s->chr = qemu_chr_find(s->chr_name);
|
||||||
if (s->chr == NULL) {
|
if (s->chr == NULL) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, s->chr_name);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", s->chr_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_chr_fe_claim(s->chr) != 0) {
|
if (qemu_chr_fe_claim(s->chr) != 0) {
|
||||||
error_set(errp, QERR_DEVICE_IN_USE, s->chr_name);
|
error_setg(errp, QERR_DEVICE_IN_USE, s->chr_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
|
|||||||
RngEgd *s = RNG_EGD(b);
|
RngEgd *s = RNG_EGD(b);
|
||||||
|
|
||||||
if (b->opened) {
|
if (b->opened) {
|
||||||
error_set(errp, QERR_PERMISSION_DENIED);
|
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||||
} else {
|
} else {
|
||||||
g_free(s->chr_name);
|
g_free(s->chr_name);
|
||||||
s->chr_name = g_strdup(value);
|
s->chr_name = g_strdup(value);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static void rng_random_opened(RngBackend *b, Error **errp)
|
|||||||
RndRandom *s = RNG_RANDOM(b);
|
RndRandom *s = RNG_RANDOM(b);
|
||||||
|
|
||||||
if (s->filename == NULL) {
|
if (s->filename == NULL) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||||
"filename", "a valid filename");
|
"filename", "a valid filename");
|
||||||
} else {
|
} else {
|
||||||
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK);
|
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK);
|
||||||
@@ -98,7 +98,7 @@ static void rng_random_set_filename(Object *obj, const char *filename,
|
|||||||
RndRandom *s = RNG_RANDOM(obj);
|
RndRandom *s = RNG_RANDOM(obj);
|
||||||
|
|
||||||
if (b->opened) {
|
if (b->opened) {
|
||||||
error_set(errp, QERR_PERMISSION_DENIED);
|
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!value && s->opened) {
|
if (!value && s->opened) {
|
||||||
error_set(errp, QERR_PERMISSION_DENIED);
|
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!value && s->opened) {
|
if (!value && s->opened) {
|
||||||
error_set(errp, QERR_PERMISSION_DENIED);
|
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,13 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "monitor/monitor.h"
|
#include "qemu-common.h"
|
||||||
#include "exec/cpu-common.h"
|
#include "exec/cpu-common.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
#include "sysemu/balloon.h"
|
#include "sysemu/balloon.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/qmp/qjson.h"
|
#include "qapi/qmp/qjson.h"
|
||||||
|
|
||||||
static QEMUBalloonEvent *balloon_event_fn;
|
static QEMUBalloonEvent *balloon_event_fn;
|
||||||
@@ -96,7 +97,7 @@ void qmp_balloon(int64_t target, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target <= 0) {
|
if (target <= 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
block.c
24
block.c
@@ -26,7 +26,9 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/qmp/qjson.h"
|
#include "qapi/qmp/qjson.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
@@ -583,7 +585,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Return the raw BlockDriver * to scsi-generic devices or empty drives */
|
/* Return the raw BlockDriver * to scsi-generic devices or empty drives */
|
||||||
if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) {
|
if (bdrv_is_sg(bs) || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) {
|
||||||
*pdrv = &bdrv_raw;
|
*pdrv = &bdrv_raw;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -615,7 +617,7 @@ static int refresh_total_sectors(BlockDriverState *bs, int64_t hint)
|
|||||||
BlockDriver *drv = bs->drv;
|
BlockDriver *drv = bs->drv;
|
||||||
|
|
||||||
/* Do not attempt drv->bdrv_getlength() on scsi-generic devices */
|
/* Do not attempt drv->bdrv_getlength() on scsi-generic devices */
|
||||||
if (bs->sg)
|
if (bdrv_is_sg(bs))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* query actual device if possible, otherwise just trust the hint */
|
/* query actual device if possible, otherwise just trust the hint */
|
||||||
@@ -946,7 +948,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
|||||||
|
|
||||||
assert(bdrv_opt_mem_align(bs) != 0);
|
assert(bdrv_opt_mem_align(bs) != 0);
|
||||||
assert(bdrv_min_mem_align(bs) != 0);
|
assert(bdrv_min_mem_align(bs) != 0);
|
||||||
assert((bs->request_alignment != 0) || bs->sg);
|
assert((bs->request_alignment != 0) || bdrv_is_sg(bs));
|
||||||
|
|
||||||
qemu_opts_del(opts);
|
qemu_opts_del(opts);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2698,7 +2700,7 @@ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)
|
|||||||
error_setg(errp, "Node '%s' is not encrypted",
|
error_setg(errp, "Node '%s' is not encrypted",
|
||||||
bdrv_get_device_or_node_name(bs));
|
bdrv_get_device_or_node_name(bs));
|
||||||
} else if (bdrv_set_key(bs, key) < 0) {
|
} else if (bdrv_set_key(bs, key) < 0) {
|
||||||
error_set(errp, QERR_INVALID_PASSWORD);
|
error_setg(errp, QERR_INVALID_PASSWORD);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (bdrv_key_required(bs)) {
|
if (bdrv_key_required(bs)) {
|
||||||
@@ -3511,7 +3513,7 @@ void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap,
|
|||||||
void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap)
|
void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap)
|
||||||
{
|
{
|
||||||
assert(bdrv_dirty_bitmap_enabled(bitmap));
|
assert(bdrv_dirty_bitmap_enabled(bitmap));
|
||||||
hbitmap_reset(bitmap->bitmap, 0, bitmap->size);
|
hbitmap_reset_all(bitmap->bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector,
|
void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector,
|
||||||
@@ -3526,18 +3528,6 @@ void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bdrv_reset_dirty(BlockDriverState *bs, int64_t cur_sector,
|
|
||||||
int nr_sectors)
|
|
||||||
{
|
|
||||||
BdrvDirtyBitmap *bitmap;
|
|
||||||
QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) {
|
|
||||||
if (!bdrv_dirty_bitmap_enabled(bitmap)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
hbitmap_reset(bitmap->bitmap, cur_sector, nr_sectors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advance an HBitmapIter to an arbitrary offset.
|
* Advance an HBitmapIter to an arbitrary offset.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "block/block.h"
|
#include "block/block.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qemu/ratelimit.h"
|
#include "qemu/ratelimit.h"
|
||||||
|
|
||||||
#define BACKUP_CLUSTER_BITS 16
|
#define BACKUP_CLUSTER_BITS 16
|
||||||
@@ -37,7 +38,7 @@ typedef struct CowRequest {
|
|||||||
typedef struct BackupBlockJob {
|
typedef struct BackupBlockJob {
|
||||||
BlockJob common;
|
BlockJob common;
|
||||||
BlockDriverState *target;
|
BlockDriverState *target;
|
||||||
/* bitmap for sync=dirty-bitmap */
|
/* bitmap for sync=incremental */
|
||||||
BdrvDirtyBitmap *sync_bitmap;
|
BdrvDirtyBitmap *sync_bitmap;
|
||||||
MirrorSyncMode sync_mode;
|
MirrorSyncMode sync_mode;
|
||||||
RateLimit limit;
|
RateLimit limit;
|
||||||
@@ -197,7 +198,7 @@ static void backup_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
|||||||
BackupBlockJob *s = container_of(job, BackupBlockJob, common);
|
BackupBlockJob *s = container_of(job, BackupBlockJob, common);
|
||||||
|
|
||||||
if (speed < 0) {
|
if (speed < 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||||
@@ -364,7 +365,7 @@ static void coroutine_fn backup_run(void *opaque)
|
|||||||
qemu_coroutine_yield();
|
qemu_coroutine_yield();
|
||||||
job->common.busy = true;
|
job->common.busy = true;
|
||||||
}
|
}
|
||||||
} else if (job->sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) {
|
} else if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
|
||||||
ret = backup_run_incremental(job);
|
ret = backup_run_incremental(job);
|
||||||
} else {
|
} else {
|
||||||
/* Both FULL and TOP SYNC_MODE's require copying.. */
|
/* Both FULL and TOP SYNC_MODE's require copying.. */
|
||||||
@@ -472,7 +473,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||||
!bdrv_iostatus_is_enabled(bs)) {
|
!bdrv_iostatus_is_enabled(bs)) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
error_setg(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,10 +497,10 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) {
|
if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
|
||||||
if (!sync_bitmap) {
|
if (!sync_bitmap) {
|
||||||
error_setg(errp, "must provide a valid bitmap name for "
|
error_setg(errp, "must provide a valid bitmap name for "
|
||||||
"\"dirty-bitmap\" sync mode");
|
"\"incremental\" sync mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +535,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
job->on_target_error = on_target_error;
|
job->on_target_error = on_target_error;
|
||||||
job->target = target;
|
job->target = target;
|
||||||
job->sync_mode = sync_mode;
|
job->sync_mode = sync_mode;
|
||||||
job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP ?
|
job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ?
|
||||||
sync_bitmap : NULL;
|
sync_bitmap : NULL;
|
||||||
job->common.len = len;
|
job->common.len = len;
|
||||||
job->common.co = qemu_coroutine_create(backup_run);
|
job->common.co = qemu_coroutine_create(backup_run);
|
||||||
|
|||||||
@@ -700,6 +700,11 @@ int blk_flush_all(void)
|
|||||||
return bdrv_flush_all();
|
return bdrv_flush_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void blk_drain(BlockBackend *blk)
|
||||||
|
{
|
||||||
|
bdrv_drain(blk->bs);
|
||||||
|
}
|
||||||
|
|
||||||
void blk_drain_all(void)
|
void blk_drain_all(void)
|
||||||
{
|
{
|
||||||
bdrv_drain_all();
|
bdrv_drain_all();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qemu/ratelimit.h"
|
#include "qemu/ratelimit.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -186,7 +187,7 @@ static void commit_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
|||||||
CommitBlockJob *s = container_of(job, CommitBlockJob, common);
|
CommitBlockJob *s = container_of(job, CommitBlockJob, common);
|
||||||
|
|
||||||
if (speed < 0) {
|
if (speed < 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qapi/qmp/qbool.h"
|
#include "qapi/qmp/qbool.h"
|
||||||
|
#include "qapi/qmp/qstring.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
// #define DEBUG_CURL
|
// #define DEBUG_CURL
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
|
|||||||
102
block/io.c
102
block/io.c
@@ -26,6 +26,7 @@
|
|||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/throttle-groups.h"
|
#include "block/throttle-groups.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
|
|
||||||
#define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
|
#define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
|
||||||
|
|
||||||
@@ -232,17 +233,6 @@ static bool bdrv_requests_pending(BlockDriverState *bs)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bdrv_drain_one(BlockDriverState *bs)
|
|
||||||
{
|
|
||||||
bool bs_busy;
|
|
||||||
|
|
||||||
bdrv_flush_io_queue(bs);
|
|
||||||
bdrv_start_throttled_reqs(bs);
|
|
||||||
bs_busy = bdrv_requests_pending(bs);
|
|
||||||
bs_busy |= aio_poll(bdrv_get_aio_context(bs), bs_busy);
|
|
||||||
return bs_busy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for pending requests to complete on a single BlockDriverState subtree
|
* Wait for pending requests to complete on a single BlockDriverState subtree
|
||||||
*
|
*
|
||||||
@@ -255,8 +245,13 @@ static bool bdrv_drain_one(BlockDriverState *bs)
|
|||||||
*/
|
*/
|
||||||
void bdrv_drain(BlockDriverState *bs)
|
void bdrv_drain(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
while (bdrv_drain_one(bs)) {
|
bool busy = true;
|
||||||
|
|
||||||
|
while (busy) {
|
||||||
/* Keep iterating */
|
/* Keep iterating */
|
||||||
|
bdrv_flush_io_queue(bs);
|
||||||
|
busy = bdrv_requests_pending(bs);
|
||||||
|
busy |= aio_poll(bdrv_get_aio_context(bs), busy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,6 +272,7 @@ void bdrv_drain_all(void)
|
|||||||
/* Always run first iteration so any pending completion BHs run */
|
/* Always run first iteration so any pending completion BHs run */
|
||||||
bool busy = true;
|
bool busy = true;
|
||||||
BlockDriverState *bs = NULL;
|
BlockDriverState *bs = NULL;
|
||||||
|
GSList *aio_ctxs = NULL, *ctx;
|
||||||
|
|
||||||
while ((bs = bdrv_next(bs))) {
|
while ((bs = bdrv_next(bs))) {
|
||||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
@@ -286,17 +282,30 @@ void bdrv_drain_all(void)
|
|||||||
block_job_pause(bs->job);
|
block_job_pause(bs->job);
|
||||||
}
|
}
|
||||||
aio_context_release(aio_context);
|
aio_context_release(aio_context);
|
||||||
|
|
||||||
|
if (!g_slist_find(aio_ctxs, aio_context)) {
|
||||||
|
aio_ctxs = g_slist_prepend(aio_ctxs, aio_context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (busy) {
|
while (busy) {
|
||||||
busy = false;
|
busy = false;
|
||||||
|
|
||||||
|
for (ctx = aio_ctxs; ctx != NULL; ctx = ctx->next) {
|
||||||
|
AioContext *aio_context = ctx->data;
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
|
|
||||||
while ((bs = bdrv_next(bs))) {
|
|
||||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
|
||||||
|
|
||||||
aio_context_acquire(aio_context);
|
aio_context_acquire(aio_context);
|
||||||
busy |= bdrv_drain_one(bs);
|
while ((bs = bdrv_next(bs))) {
|
||||||
|
if (aio_context == bdrv_get_aio_context(bs)) {
|
||||||
|
bdrv_flush_io_queue(bs);
|
||||||
|
if (bdrv_requests_pending(bs)) {
|
||||||
|
busy = true;
|
||||||
|
aio_poll(aio_context, busy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
busy |= aio_poll(aio_context, false);
|
||||||
aio_context_release(aio_context);
|
aio_context_release(aio_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,6 +320,7 @@ void bdrv_drain_all(void)
|
|||||||
}
|
}
|
||||||
aio_context_release(aio_context);
|
aio_context_release(aio_context);
|
||||||
}
|
}
|
||||||
|
g_slist_free(aio_ctxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1521,28 +1531,54 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Coroutine wrapper for bdrv_get_block_status() */
|
static int64_t coroutine_fn bdrv_co_get_block_status_above(BlockDriverState *bs,
|
||||||
static void coroutine_fn bdrv_get_block_status_co_entry(void *opaque)
|
BlockDriverState *base,
|
||||||
|
int64_t sector_num,
|
||||||
|
int nb_sectors,
|
||||||
|
int *pnum)
|
||||||
|
{
|
||||||
|
BlockDriverState *p;
|
||||||
|
int64_t ret = 0;
|
||||||
|
|
||||||
|
assert(bs != base);
|
||||||
|
for (p = bs; p != base; p = p->backing_hd) {
|
||||||
|
ret = bdrv_co_get_block_status(p, sector_num, nb_sectors, pnum);
|
||||||
|
if (ret < 0 || ret & BDRV_BLOCK_ALLOCATED) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* [sector_num, pnum] unallocated on this layer, which could be only
|
||||||
|
* the first part of [sector_num, nb_sectors]. */
|
||||||
|
nb_sectors = MIN(nb_sectors, *pnum);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Coroutine wrapper for bdrv_get_block_status_above() */
|
||||||
|
static void coroutine_fn bdrv_get_block_status_above_co_entry(void *opaque)
|
||||||
{
|
{
|
||||||
BdrvCoGetBlockStatusData *data = opaque;
|
BdrvCoGetBlockStatusData *data = opaque;
|
||||||
BlockDriverState *bs = data->bs;
|
|
||||||
|
|
||||||
data->ret = bdrv_co_get_block_status(bs, data->sector_num, data->nb_sectors,
|
data->ret = bdrv_co_get_block_status_above(data->bs, data->base,
|
||||||
|
data->sector_num,
|
||||||
|
data->nb_sectors,
|
||||||
data->pnum);
|
data->pnum);
|
||||||
data->done = true;
|
data->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Synchronous wrapper around bdrv_co_get_block_status().
|
* Synchronous wrapper around bdrv_co_get_block_status_above().
|
||||||
*
|
*
|
||||||
* See bdrv_co_get_block_status() for details.
|
* See bdrv_co_get_block_status_above() for details.
|
||||||
*/
|
*/
|
||||||
int64_t bdrv_get_block_status(BlockDriverState *bs, int64_t sector_num,
|
int64_t bdrv_get_block_status_above(BlockDriverState *bs,
|
||||||
|
BlockDriverState *base,
|
||||||
|
int64_t sector_num,
|
||||||
int nb_sectors, int *pnum)
|
int nb_sectors, int *pnum)
|
||||||
{
|
{
|
||||||
Coroutine *co;
|
Coroutine *co;
|
||||||
BdrvCoGetBlockStatusData data = {
|
BdrvCoGetBlockStatusData data = {
|
||||||
.bs = bs,
|
.bs = bs,
|
||||||
|
.base = base,
|
||||||
.sector_num = sector_num,
|
.sector_num = sector_num,
|
||||||
.nb_sectors = nb_sectors,
|
.nb_sectors = nb_sectors,
|
||||||
.pnum = pnum,
|
.pnum = pnum,
|
||||||
@@ -1551,11 +1587,11 @@ int64_t bdrv_get_block_status(BlockDriverState *bs, int64_t sector_num,
|
|||||||
|
|
||||||
if (qemu_in_coroutine()) {
|
if (qemu_in_coroutine()) {
|
||||||
/* Fast-path if already in coroutine context */
|
/* Fast-path if already in coroutine context */
|
||||||
bdrv_get_block_status_co_entry(&data);
|
bdrv_get_block_status_above_co_entry(&data);
|
||||||
} else {
|
} else {
|
||||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
||||||
co = qemu_coroutine_create(bdrv_get_block_status_co_entry);
|
co = qemu_coroutine_create(bdrv_get_block_status_above_co_entry);
|
||||||
qemu_coroutine_enter(co, &data);
|
qemu_coroutine_enter(co, &data);
|
||||||
while (!data.done) {
|
while (!data.done) {
|
||||||
aio_poll(aio_context, true);
|
aio_poll(aio_context, true);
|
||||||
@@ -1564,6 +1600,14 @@ int64_t bdrv_get_block_status(BlockDriverState *bs, int64_t sector_num,
|
|||||||
return data.ret;
|
return data.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t bdrv_get_block_status(BlockDriverState *bs,
|
||||||
|
int64_t sector_num,
|
||||||
|
int nb_sectors, int *pnum)
|
||||||
|
{
|
||||||
|
return bdrv_get_block_status_above(bs, bs->backing_hd,
|
||||||
|
sector_num, nb_sectors, pnum);
|
||||||
|
}
|
||||||
|
|
||||||
int coroutine_fn bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,
|
int coroutine_fn bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,
|
||||||
int nb_sectors, int *pnum)
|
int nb_sectors, int *pnum)
|
||||||
{
|
{
|
||||||
@@ -2255,7 +2299,8 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
|
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
|
||||||
|
bdrv_is_sg(bs)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2367,8 +2412,6 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bdrv_reset_dirty(bs, sector_num, nb_sectors);
|
|
||||||
|
|
||||||
/* Do nothing if disabled. */
|
/* Do nothing if disabled. */
|
||||||
if (!(bs->open_flags & BDRV_O_UNMAP)) {
|
if (!(bs->open_flags & BDRV_O_UNMAP)) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2378,6 +2421,8 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bdrv_set_dirty(bs, sector_num, nb_sectors);
|
||||||
|
|
||||||
max_discard = MIN_NON_ZERO(bs->bl.max_discard, BDRV_REQUEST_MAX_SECTORS);
|
max_discard = MIN_NON_ZERO(bs->bl.max_discard, BDRV_REQUEST_MAX_SECTORS);
|
||||||
while (nb_sectors > 0) {
|
while (nb_sectors > 0) {
|
||||||
int ret;
|
int ret;
|
||||||
@@ -2561,4 +2606,5 @@ void bdrv_flush_io_queue(BlockDriverState *bs)
|
|||||||
} else if (bs->file) {
|
} else if (bs->file) {
|
||||||
bdrv_flush_io_queue(bs->file);
|
bdrv_flush_io_queue(bs->file);
|
||||||
}
|
}
|
||||||
|
bdrv_start_throttled_reqs(bs);
|
||||||
}
|
}
|
||||||
|
|||||||
116
block/iscsi.c
116
block/iscsi.c
@@ -38,6 +38,7 @@
|
|||||||
#include "qemu/iov.h"
|
#include "qemu/iov.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
|
#include "qapi/qmp/qstring.h"
|
||||||
|
|
||||||
#include <iscsi/iscsi.h>
|
#include <iscsi/iscsi.h>
|
||||||
#include <iscsi/scsi-lowlevel.h>
|
#include <iscsi/scsi-lowlevel.h>
|
||||||
@@ -69,6 +70,7 @@ typedef struct IscsiLun {
|
|||||||
bool dpofua;
|
bool dpofua;
|
||||||
bool has_write_same;
|
bool has_write_same;
|
||||||
bool force_next_flush;
|
bool force_next_flush;
|
||||||
|
bool request_timed_out;
|
||||||
} IscsiLun;
|
} IscsiLun;
|
||||||
|
|
||||||
typedef struct IscsiTask {
|
typedef struct IscsiTask {
|
||||||
@@ -99,7 +101,8 @@ typedef struct IscsiAIOCB {
|
|||||||
#endif
|
#endif
|
||||||
} IscsiAIOCB;
|
} IscsiAIOCB;
|
||||||
|
|
||||||
#define EVENT_INTERVAL 250
|
/* libiscsi uses time_t so its enough to process events every second */
|
||||||
|
#define EVENT_INTERVAL 1000
|
||||||
#define NOP_INTERVAL 5000
|
#define NOP_INTERVAL 5000
|
||||||
#define MAX_NOP_FAILURES 3
|
#define MAX_NOP_FAILURES 3
|
||||||
#define ISCSI_CMD_RETRIES ARRAY_SIZE(iscsi_retry_times)
|
#define ISCSI_CMD_RETRIES ARRAY_SIZE(iscsi_retry_times)
|
||||||
@@ -166,6 +169,19 @@ static inline unsigned exp_random(double mean)
|
|||||||
return -mean * log((double)rand() / RAND_MAX);
|
return -mean * log((double)rand() / RAND_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SCSI_STATUS_TASK_SET_FULL and SCSI_STATUS_TIMEOUT were introduced
|
||||||
|
* in libiscsi 1.10.0 as part of an enum. The LIBISCSI_API_VERSION
|
||||||
|
* macro was introduced in 1.11.0. So use the API_VERSION macro as
|
||||||
|
* a hint that the macros are defined and define them ourselves
|
||||||
|
* otherwise to keep the required libiscsi version at 1.9.0 */
|
||||||
|
#if !defined(LIBISCSI_API_VERSION)
|
||||||
|
#define QEMU_SCSI_STATUS_TASK_SET_FULL 0x28
|
||||||
|
#define QEMU_SCSI_STATUS_TIMEOUT 0x0f000002
|
||||||
|
#else
|
||||||
|
#define QEMU_SCSI_STATUS_TASK_SET_FULL SCSI_STATUS_TASK_SET_FULL
|
||||||
|
#define QEMU_SCSI_STATUS_TIMEOUT SCSI_STATUS_TIMEOUT
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
|
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
|
||||||
void *command_data, void *opaque)
|
void *command_data, void *opaque)
|
||||||
@@ -186,13 +202,19 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
|
|||||||
iTask->do_retry = 1;
|
iTask->do_retry = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* status 0x28 is SCSI_TASK_SET_FULL. It was first introduced
|
if (status == SCSI_STATUS_BUSY ||
|
||||||
* in libiscsi 1.10.0. Hardcode this value here to avoid
|
status == QEMU_SCSI_STATUS_TIMEOUT ||
|
||||||
* the need to bump the libiscsi requirement to 1.10.0 */
|
status == QEMU_SCSI_STATUS_TASK_SET_FULL) {
|
||||||
if (status == SCSI_STATUS_BUSY || status == 0x28) {
|
|
||||||
unsigned retry_time =
|
unsigned retry_time =
|
||||||
exp_random(iscsi_retry_times[iTask->retries - 1]);
|
exp_random(iscsi_retry_times[iTask->retries - 1]);
|
||||||
error_report("iSCSI Busy/TaskSetFull (retry #%u in %u ms): %s",
|
if (status == QEMU_SCSI_STATUS_TIMEOUT) {
|
||||||
|
/* make sure the request is rescheduled AFTER the
|
||||||
|
* reconnect is initiated */
|
||||||
|
retry_time = EVENT_INTERVAL * 2;
|
||||||
|
iTask->iscsilun->request_timed_out = true;
|
||||||
|
}
|
||||||
|
error_report("iSCSI Busy/TaskSetFull/TimeOut"
|
||||||
|
" (retry #%u in %u ms): %s",
|
||||||
iTask->retries, retry_time,
|
iTask->retries, retry_time,
|
||||||
iscsi_get_error(iscsi));
|
iscsi_get_error(iscsi));
|
||||||
aio_timer_init(iTask->iscsilun->aio_context,
|
aio_timer_init(iTask->iscsilun->aio_context,
|
||||||
@@ -276,20 +298,26 @@ iscsi_set_events(IscsiLun *iscsilun)
|
|||||||
iscsilun);
|
iscsilun);
|
||||||
iscsilun->events = ev;
|
iscsilun->events = ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* newer versions of libiscsi may return zero events. In this
|
|
||||||
* case start a timer to ensure we are able to return to service
|
|
||||||
* once this situation changes. */
|
|
||||||
if (!ev) {
|
|
||||||
timer_mod(iscsilun->event_timer,
|
|
||||||
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iscsi_timed_set_events(void *opaque)
|
static void iscsi_timed_check_events(void *opaque)
|
||||||
{
|
{
|
||||||
IscsiLun *iscsilun = opaque;
|
IscsiLun *iscsilun = opaque;
|
||||||
|
|
||||||
|
/* check for timed out requests */
|
||||||
|
iscsi_service(iscsilun->iscsi, 0);
|
||||||
|
|
||||||
|
if (iscsilun->request_timed_out) {
|
||||||
|
iscsilun->request_timed_out = false;
|
||||||
|
iscsi_reconnect(iscsilun->iscsi);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* newer versions of libiscsi may return zero events. Ensure we are able
|
||||||
|
* to return to service once this situation changes. */
|
||||||
iscsi_set_events(iscsilun);
|
iscsi_set_events(iscsilun);
|
||||||
|
|
||||||
|
timer_mod(iscsilun->event_timer,
|
||||||
|
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -627,10 +655,6 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState *bs)
|
|||||||
IscsiLun *iscsilun = bs->opaque;
|
IscsiLun *iscsilun = bs->opaque;
|
||||||
struct IscsiTask iTask;
|
struct IscsiTask iTask;
|
||||||
|
|
||||||
if (bs->sg) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!iscsilun->force_next_flush) {
|
if (!iscsilun->force_next_flush) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1096,16 +1120,37 @@ static char *parse_initiator_name(const char *target)
|
|||||||
return iscsi_name;
|
return iscsi_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int parse_timeout(const char *target)
|
||||||
|
{
|
||||||
|
QemuOptsList *list;
|
||||||
|
QemuOpts *opts;
|
||||||
|
const char *timeout;
|
||||||
|
|
||||||
|
list = qemu_find_opts("iscsi");
|
||||||
|
if (list) {
|
||||||
|
opts = qemu_opts_find(list, target);
|
||||||
|
if (!opts) {
|
||||||
|
opts = QTAILQ_FIRST(&list->head);
|
||||||
|
}
|
||||||
|
if (opts) {
|
||||||
|
timeout = qemu_opt_get(opts, "timeout");
|
||||||
|
if (timeout) {
|
||||||
|
return atoi(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void iscsi_nop_timed_event(void *opaque)
|
static void iscsi_nop_timed_event(void *opaque)
|
||||||
{
|
{
|
||||||
IscsiLun *iscsilun = opaque;
|
IscsiLun *iscsilun = opaque;
|
||||||
|
|
||||||
if (iscsi_get_nops_in_flight(iscsilun->iscsi) > MAX_NOP_FAILURES) {
|
if (iscsi_get_nops_in_flight(iscsilun->iscsi) >= MAX_NOP_FAILURES) {
|
||||||
error_report("iSCSI: NOP timeout. Reconnecting...");
|
error_report("iSCSI: NOP timeout. Reconnecting...");
|
||||||
iscsi_reconnect(iscsilun->iscsi);
|
iscsilun->request_timed_out = true;
|
||||||
}
|
} else if (iscsi_nop_out_async(iscsilun->iscsi, NULL, NULL, 0, NULL) != 0) {
|
||||||
|
|
||||||
if (iscsi_nop_out_async(iscsilun->iscsi, NULL, NULL, 0, NULL) != 0) {
|
|
||||||
error_report("iSCSI: failed to sent NOP-Out. Disabling NOP messages.");
|
error_report("iSCSI: failed to sent NOP-Out. Disabling NOP messages.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1263,10 +1308,13 @@ static void iscsi_attach_aio_context(BlockDriverState *bs,
|
|||||||
timer_mod(iscsilun->nop_timer,
|
timer_mod(iscsilun->nop_timer,
|
||||||
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
|
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
|
||||||
|
|
||||||
/* Prepare a timer for a delayed call to iscsi_set_events */
|
/* Set up a timer for periodic calls to iscsi_set_events and to
|
||||||
|
* scan for command timeout */
|
||||||
iscsilun->event_timer = aio_timer_new(iscsilun->aio_context,
|
iscsilun->event_timer = aio_timer_new(iscsilun->aio_context,
|
||||||
QEMU_CLOCK_REALTIME, SCALE_MS,
|
QEMU_CLOCK_REALTIME, SCALE_MS,
|
||||||
iscsi_timed_set_events, iscsilun);
|
iscsi_timed_check_events, iscsilun);
|
||||||
|
timer_mod(iscsilun->event_timer,
|
||||||
|
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iscsi_modesense_sync(IscsiLun *iscsilun)
|
static void iscsi_modesense_sync(IscsiLun *iscsilun)
|
||||||
@@ -1321,7 +1369,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
int i, ret = 0;
|
int i, ret = 0, timeout = 0;
|
||||||
|
|
||||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||||
@@ -1391,6 +1439,16 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* timeout handling is broken in libiscsi before 1.15.0 */
|
||||||
|
timeout = parse_timeout(iscsi_url->target);
|
||||||
|
#if defined(LIBISCSI_API_VERSION) && LIBISCSI_API_VERSION >= 20150621
|
||||||
|
iscsi_set_timeout(iscsi, timeout);
|
||||||
|
#else
|
||||||
|
if (timeout) {
|
||||||
|
error_report("iSCSI: ignoring timeout value for libiscsi <1.15.0");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (iscsi_full_connect_sync(iscsi, iscsi_url->portal, iscsi_url->lun) != 0) {
|
if (iscsi_full_connect_sync(iscsi, iscsi_url->portal, iscsi_url->lun) != 0) {
|
||||||
error_setg(errp, "iSCSI: Failed to connect to LUN : %s",
|
error_setg(errp, "iSCSI: Failed to connect to LUN : %s",
|
||||||
iscsi_get_error(iscsi));
|
iscsi_get_error(iscsi));
|
||||||
@@ -1739,6 +1797,10 @@ static QemuOptsList qemu_iscsi_opts = {
|
|||||||
.name = "initiator-name",
|
.name = "initiator-name",
|
||||||
.type = QEMU_OPT_STRING,
|
.type = QEMU_OPT_STRING,
|
||||||
.help = "Initiator iqn name to use when connecting",
|
.help = "Initiator iqn name to use when connecting",
|
||||||
|
},{
|
||||||
|
.name = "timeout",
|
||||||
|
.type = QEMU_OPT_NUMBER,
|
||||||
|
.help = "Request timeout in seconds (default 0 = no timeout)",
|
||||||
},
|
},
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qemu/ratelimit.h"
|
#include "qemu/ratelimit.h"
|
||||||
#include "qemu/bitmap.h"
|
#include "qemu/bitmap.h"
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ typedef struct MirrorBlockJob {
|
|||||||
int in_flight;
|
int in_flight;
|
||||||
int sectors_in_flight;
|
int sectors_in_flight;
|
||||||
int ret;
|
int ret;
|
||||||
|
bool unmap;
|
||||||
} MirrorBlockJob;
|
} MirrorBlockJob;
|
||||||
|
|
||||||
typedef struct MirrorOp {
|
typedef struct MirrorOp {
|
||||||
@@ -163,6 +165,8 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
|
|||||||
int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector;
|
int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector;
|
||||||
uint64_t delay_ns = 0;
|
uint64_t delay_ns = 0;
|
||||||
MirrorOp *op;
|
MirrorOp *op;
|
||||||
|
int pnum;
|
||||||
|
int64_t ret;
|
||||||
|
|
||||||
s->sector_num = hbitmap_iter_next(&s->hbi);
|
s->sector_num = hbitmap_iter_next(&s->hbi);
|
||||||
if (s->sector_num < 0) {
|
if (s->sector_num < 0) {
|
||||||
@@ -289,8 +293,22 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
|
|||||||
s->in_flight++;
|
s->in_flight++;
|
||||||
s->sectors_in_flight += nb_sectors;
|
s->sectors_in_flight += nb_sectors;
|
||||||
trace_mirror_one_iteration(s, sector_num, nb_sectors);
|
trace_mirror_one_iteration(s, sector_num, nb_sectors);
|
||||||
|
|
||||||
|
ret = bdrv_get_block_status_above(source, NULL, sector_num,
|
||||||
|
nb_sectors, &pnum);
|
||||||
|
if (ret < 0 || pnum < nb_sectors ||
|
||||||
|
(ret & BDRV_BLOCK_DATA && !(ret & BDRV_BLOCK_ZERO))) {
|
||||||
bdrv_aio_readv(source, sector_num, &op->qiov, nb_sectors,
|
bdrv_aio_readv(source, sector_num, &op->qiov, nb_sectors,
|
||||||
mirror_read_complete, op);
|
mirror_read_complete, op);
|
||||||
|
} else if (ret & BDRV_BLOCK_ZERO) {
|
||||||
|
bdrv_aio_write_zeroes(s->target, sector_num, op->nb_sectors,
|
||||||
|
s->unmap ? BDRV_REQ_MAY_UNMAP : 0,
|
||||||
|
mirror_write_complete, op);
|
||||||
|
} else {
|
||||||
|
assert(!(ret & BDRV_BLOCK_DATA));
|
||||||
|
bdrv_aio_discard(s->target, sector_num, op->nb_sectors,
|
||||||
|
mirror_write_complete, op);
|
||||||
|
}
|
||||||
return delay_ns;
|
return delay_ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,7 +591,7 @@ static void mirror_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
|||||||
MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
|
MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
|
||||||
|
|
||||||
if (speed < 0) {
|
if (speed < 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||||
@@ -598,7 +616,7 @@ static void mirror_complete(BlockJob *job, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!s->synced) {
|
if (!s->synced) {
|
||||||
error_set(errp, QERR_BLOCK_JOB_NOT_READY,
|
error_setg(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||||
bdrv_get_device_name(job->bs));
|
bdrv_get_device_name(job->bs));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -651,6 +669,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
int64_t buf_size,
|
int64_t buf_size,
|
||||||
BlockdevOnError on_source_error,
|
BlockdevOnError on_source_error,
|
||||||
BlockdevOnError on_target_error,
|
BlockdevOnError on_target_error,
|
||||||
|
bool unmap,
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque, Error **errp,
|
void *opaque, Error **errp,
|
||||||
const BlockJobDriver *driver,
|
const BlockJobDriver *driver,
|
||||||
@@ -667,7 +686,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||||
!bdrv_iostatus_is_enabled(bs)) {
|
!bdrv_iostatus_is_enabled(bs)) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
error_setg(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,6 +704,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
s->base = base;
|
s->base = base;
|
||||||
s->granularity = granularity;
|
s->granularity = granularity;
|
||||||
s->buf_size = MAX(buf_size, granularity);
|
s->buf_size = MAX(buf_size, granularity);
|
||||||
|
s->unmap = unmap;
|
||||||
|
|
||||||
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp);
|
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp);
|
||||||
if (!s->dirty_bitmap) {
|
if (!s->dirty_bitmap) {
|
||||||
@@ -703,21 +723,22 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
int64_t speed, uint32_t granularity, int64_t buf_size,
|
int64_t speed, uint32_t granularity, int64_t buf_size,
|
||||||
MirrorSyncMode mode, BlockdevOnError on_source_error,
|
MirrorSyncMode mode, BlockdevOnError on_source_error,
|
||||||
BlockdevOnError on_target_error,
|
BlockdevOnError on_target_error,
|
||||||
|
bool unmap,
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
bool is_none_mode;
|
bool is_none_mode;
|
||||||
BlockDriverState *base;
|
BlockDriverState *base;
|
||||||
|
|
||||||
if (mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) {
|
if (mode == MIRROR_SYNC_MODE_INCREMENTAL) {
|
||||||
error_setg(errp, "Sync mode 'dirty-bitmap' not supported");
|
error_setg(errp, "Sync mode 'incremental' not supported");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
|
is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
|
||||||
base = mode == MIRROR_SYNC_MODE_TOP ? bs->backing_hd : NULL;
|
base = mode == MIRROR_SYNC_MODE_TOP ? bs->backing_hd : NULL;
|
||||||
mirror_start_job(bs, target, replaces,
|
mirror_start_job(bs, target, replaces,
|
||||||
speed, granularity, buf_size,
|
speed, granularity, buf_size,
|
||||||
on_source_error, on_target_error, cb, opaque, errp,
|
on_source_error, on_target_error, unmap, cb, opaque, errp,
|
||||||
&mirror_job_driver, is_none_mode, base);
|
&mirror_job_driver, is_none_mode, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +786,7 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
|||||||
|
|
||||||
bdrv_ref(base);
|
bdrv_ref(base);
|
||||||
mirror_start_job(bs, base, NULL, speed, 0, 0,
|
mirror_start_job(bs, base, NULL, speed, 0, 0,
|
||||||
on_error, on_error, cb, opaque, &local_err,
|
on_error, on_error, false, cb, opaque, &local_err,
|
||||||
&commit_active_job_driver, false, base);
|
&commit_active_job_driver, false, base);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include <nfsc/libnfs.h>
|
#include <nfsc/libnfs.h>
|
||||||
|
|
||||||
|
#define QEMU_NFS_MAX_READAHEAD_SIZE 1048576
|
||||||
|
|
||||||
typedef struct NFSClient {
|
typedef struct NFSClient {
|
||||||
struct nfs_context *context;
|
struct nfs_context *context;
|
||||||
struct nfsfh *fh;
|
struct nfsfh *fh;
|
||||||
@@ -327,6 +329,11 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename,
|
|||||||
nfs_set_tcp_syncnt(client->context, val);
|
nfs_set_tcp_syncnt(client->context, val);
|
||||||
#ifdef LIBNFS_FEATURE_READAHEAD
|
#ifdef LIBNFS_FEATURE_READAHEAD
|
||||||
} else if (!strcmp(qp->p[i].name, "readahead")) {
|
} else if (!strcmp(qp->p[i].name, "readahead")) {
|
||||||
|
if (val > QEMU_NFS_MAX_READAHEAD_SIZE) {
|
||||||
|
error_report("NFS Warning: Truncating NFS readahead"
|
||||||
|
" size to %d", QEMU_NFS_MAX_READAHEAD_SIZE);
|
||||||
|
val = QEMU_NFS_MAX_READAHEAD_SIZE;
|
||||||
|
}
|
||||||
nfs_set_readahead(client->context, val);
|
nfs_set_readahead(client->context, val);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -520,13 +520,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
|
|||||||
}
|
}
|
||||||
case QTYPE_QBOOL: {
|
case QTYPE_QBOOL: {
|
||||||
QBool *value = qobject_to_qbool(obj);
|
QBool *value = qobject_to_qbool(obj);
|
||||||
func_fprintf(f, "%s", qbool_get_int(value) ? "true" : "false");
|
func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QTYPE_QERROR: {
|
|
||||||
QString *value = qerror_human((QError *)obj);
|
|
||||||
func_fprintf(f, "%s", qstring_get_str(value));
|
|
||||||
QDECREF(value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qemu/aes.h"
|
#include "qemu/aes.h"
|
||||||
#include "migration/migration.h"
|
#include "migration/migration.h"
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
char version[64];
|
char version[64];
|
||||||
snprintf(version, sizeof(version), "QCOW version %" PRIu32,
|
snprintf(version, sizeof(version), "QCOW version %" PRIu32,
|
||||||
header.version);
|
header.version);
|
||||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||||
bdrv_get_device_or_node_name(bs), "qcow", version);
|
bdrv_get_device_or_node_name(bs), "qcow", version);
|
||||||
ret = -ENOTSUP;
|
ret = -ENOTSUP;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|||||||
@@ -940,6 +940,7 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_in_cluster = s->cluster_size - offset_into_cluster(s, offset);
|
free_in_cluster = s->cluster_size - offset_into_cluster(s, offset);
|
||||||
|
do {
|
||||||
if (!offset || free_in_cluster < size) {
|
if (!offset || free_in_cluster < size) {
|
||||||
int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size);
|
int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size);
|
||||||
if (new_cluster < 0) {
|
if (new_cluster < 0) {
|
||||||
@@ -953,6 +954,7 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
|
|||||||
|
|
||||||
assert(offset);
|
assert(offset);
|
||||||
ret = update_refcount(bs, offset, size, 1, false, QCOW2_DISCARD_NEVER);
|
ret = update_refcount(bs, offset, size, 1, false, QCOW2_DISCARD_NEVER);
|
||||||
|
} while (ret == -EAGAIN);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/qcow2.h"
|
#include "block/qcow2.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
|
|
||||||
void qcow2_free_snapshots(BlockDriverState *bs)
|
void qcow2_free_snapshots(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs,
|
|||||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||||
bdrv_get_device_or_node_name(bs), "qcow2", msg);
|
bdrv_get_device_or_node_name(bs), "qcow2", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf(buf, sizeof(buf), "%" PRIx64,
|
snprintf(buf, sizeof(buf), "%" PRIx64,
|
||||||
s->header.features & ~QED_FEATURE_MASK);
|
s->header.features & ~QED_FEATURE_MASK);
|
||||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||||
bdrv_get_device_or_node_name(bs), "QED", buf);
|
bdrv_get_device_or_node_name(bs), "QED", buf);
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qapi/qmp/qbool.h"
|
#include "qapi/qmp/qbool.h"
|
||||||
#include "qapi/qmp/qdict.h"
|
#include "qapi/qmp/qdict.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/qmp/qint.h"
|
#include "qapi/qmp/qint.h"
|
||||||
#include "qapi/qmp/qjson.h"
|
#include "qapi/qmp/qjson.h"
|
||||||
#include "qapi/qmp/qlist.h"
|
#include "qapi/qmp/qlist.h"
|
||||||
@@ -800,7 +801,7 @@ static int quorum_valid_threshold(int threshold, int num_children, Error **errp)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (threshold < 1) {
|
if (threshold < 1) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||||
"vote-threshold", "value >= 1");
|
"vote-threshold", "value >= 1");
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
@@ -1024,9 +1025,9 @@ static void quorum_refresh_filename(BlockDriverState *bs)
|
|||||||
qdict_put_obj(opts, QUORUM_OPT_VOTE_THRESHOLD,
|
qdict_put_obj(opts, QUORUM_OPT_VOTE_THRESHOLD,
|
||||||
QOBJECT(qint_from_int(s->threshold)));
|
QOBJECT(qint_from_int(s->threshold)));
|
||||||
qdict_put_obj(opts, QUORUM_OPT_BLKVERIFY,
|
qdict_put_obj(opts, QUORUM_OPT_BLKVERIFY,
|
||||||
QOBJECT(qbool_from_int(s->is_blkverify)));
|
QOBJECT(qbool_from_bool(s->is_blkverify)));
|
||||||
qdict_put_obj(opts, QUORUM_OPT_REWRITE,
|
qdict_put_obj(opts, QUORUM_OPT_REWRITE,
|
||||||
QOBJECT(qbool_from_int(s->rewrite_corrupted)));
|
QOBJECT(qbool_from_bool(s->rewrite_corrupted)));
|
||||||
qdict_put_obj(opts, "children", QOBJECT(children));
|
qdict_put_obj(opts, "children", QOBJECT(children));
|
||||||
|
|
||||||
bs->full_open_options = opts;
|
bs->full_open_options = opts;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
#include "qemu/iov.h"
|
#include "qemu/iov.h"
|
||||||
#include "raw-aio.h"
|
#include "raw-aio.h"
|
||||||
#include "qapi/util.h"
|
#include "qapi/util.h"
|
||||||
|
#include "qapi/qmp/qstring.h"
|
||||||
|
|
||||||
#if defined(__APPLE__) && (__MACH__)
|
#if defined(__APPLE__) && (__MACH__)
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
@@ -57,6 +59,7 @@
|
|||||||
#include <linux/fd.h>
|
#include <linux/fd.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/hdreg.h>
|
#include <linux/hdreg.h>
|
||||||
|
#include <scsi/sg.h>
|
||||||
#ifdef __s390__
|
#ifdef __s390__
|
||||||
#include <asm/dasd.h>
|
#include <asm/dasd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -94,15 +97,19 @@
|
|||||||
#include <xfs/xfs.h>
|
#include <xfs/xfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define DEBUG_FLOPPY
|
|
||||||
|
|
||||||
//#define DEBUG_BLOCK
|
//#define DEBUG_BLOCK
|
||||||
#if defined(DEBUG_BLOCK)
|
|
||||||
#define DEBUG_BLOCK_PRINT(formatCstr, ...) do { if (qemu_log_enabled()) \
|
#ifdef DEBUG_BLOCK
|
||||||
{ qemu_log(formatCstr, ## __VA_ARGS__); qemu_log_flush(); } } while (0)
|
# define DEBUG_BLOCK_PRINT 1
|
||||||
#else
|
#else
|
||||||
#define DEBUG_BLOCK_PRINT(formatCstr, ...)
|
# define DEBUG_BLOCK_PRINT 0
|
||||||
#endif
|
#endif
|
||||||
|
#define DPRINTF(fmt, ...) \
|
||||||
|
do { \
|
||||||
|
if (DEBUG_BLOCK_PRINT) { \
|
||||||
|
printf(fmt, ## __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* OS X does not have O_DSYNC */
|
/* OS X does not have O_DSYNC */
|
||||||
#ifndef O_DSYNC
|
#ifndef O_DSYNC
|
||||||
@@ -303,9 +310,9 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
|
|||||||
char *buf;
|
char *buf;
|
||||||
size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize());
|
size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize());
|
||||||
|
|
||||||
/* For /dev/sg devices the alignment is not really used.
|
/* For SCSI generic devices the alignment is not really used.
|
||||||
With buffered I/O, we don't have any restrictions. */
|
With buffered I/O, we don't have any restrictions. */
|
||||||
if (bs->sg || !s->needs_alignment) {
|
if (bdrv_is_sg(bs) || !s->needs_alignment) {
|
||||||
bs->request_alignment = 1;
|
bs->request_alignment = 1;
|
||||||
s->buf_align = 1;
|
s->buf_align = 1;
|
||||||
return;
|
return;
|
||||||
@@ -1018,6 +1025,7 @@ static ssize_t handle_aiocb_rw(RawPosixAIOData *aiocb)
|
|||||||
static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
||||||
{
|
{
|
||||||
struct xfs_flock64 fl;
|
struct xfs_flock64 fl;
|
||||||
|
int err;
|
||||||
|
|
||||||
memset(&fl, 0, sizeof(fl));
|
memset(&fl, 0, sizeof(fl));
|
||||||
fl.l_whence = SEEK_SET;
|
fl.l_whence = SEEK_SET;
|
||||||
@@ -1025,8 +1033,9 @@ static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
|||||||
fl.l_len = bytes;
|
fl.l_len = bytes;
|
||||||
|
|
||||||
if (xfsctl(NULL, s->fd, XFS_IOC_ZERO_RANGE, &fl) < 0) {
|
if (xfsctl(NULL, s->fd, XFS_IOC_ZERO_RANGE, &fl) < 0) {
|
||||||
DEBUG_BLOCK_PRINT("cannot write zero range (%s)\n", strerror(errno));
|
err = errno;
|
||||||
return -errno;
|
DPRINTF("cannot write zero range (%s)\n", strerror(errno));
|
||||||
|
return -err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1035,6 +1044,7 @@ static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
|||||||
static int xfs_discard(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
static int xfs_discard(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
||||||
{
|
{
|
||||||
struct xfs_flock64 fl;
|
struct xfs_flock64 fl;
|
||||||
|
int err;
|
||||||
|
|
||||||
memset(&fl, 0, sizeof(fl));
|
memset(&fl, 0, sizeof(fl));
|
||||||
fl.l_whence = SEEK_SET;
|
fl.l_whence = SEEK_SET;
|
||||||
@@ -1042,8 +1052,9 @@ static int xfs_discard(BDRVRawState *s, int64_t offset, uint64_t bytes)
|
|||||||
fl.l_len = bytes;
|
fl.l_len = bytes;
|
||||||
|
|
||||||
if (xfsctl(NULL, s->fd, XFS_IOC_UNRESVSP64, &fl) < 0) {
|
if (xfsctl(NULL, s->fd, XFS_IOC_UNRESVSP64, &fl) < 0) {
|
||||||
DEBUG_BLOCK_PRINT("cannot punch hole (%s)\n", strerror(errno));
|
err = errno;
|
||||||
return -errno;
|
DPRINTF("cannot punch hole (%s)\n", strerror(errno));
|
||||||
|
return -err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2076,15 +2087,38 @@ static void hdev_parse_filename(const char *filename, QDict *options,
|
|||||||
qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
|
qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool hdev_is_sg(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
|
||||||
|
struct stat st;
|
||||||
|
struct sg_scsi_id scsiid;
|
||||||
|
int sg_version;
|
||||||
|
|
||||||
|
if (stat(bs->filename, &st) >= 0 && S_ISCHR(st.st_mode) &&
|
||||||
|
!bdrv_ioctl(bs, SG_GET_VERSION_NUM, &sg_version) &&
|
||||||
|
!bdrv_ioctl(bs, SG_GET_SCSI_ID, &scsiid)) {
|
||||||
|
DPRINTF("SG device found: type=%d, version=%d\n",
|
||||||
|
scsiid.scsi_type, sg_version);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
const char *filename = qdict_get_str(options, "filename");
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
const char *filename = qdict_get_str(options, "filename");
|
||||||
|
|
||||||
if (strstart(filename, "/dev/cdrom", NULL)) {
|
if (strstart(filename, "/dev/cdrom", NULL)) {
|
||||||
kern_return_t kernResult;
|
kern_return_t kernResult;
|
||||||
io_iterator_t mediaIterator;
|
io_iterator_t mediaIterator;
|
||||||
@@ -2113,16 +2147,6 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
s->type = FTYPE_FILE;
|
s->type = FTYPE_FILE;
|
||||||
#if defined(__linux__)
|
|
||||||
{
|
|
||||||
char resolved_path[ MAXPATHLEN ], *temp;
|
|
||||||
|
|
||||||
temp = realpath(filename, resolved_path);
|
|
||||||
if (temp && strstart(temp, "/dev/sg", NULL)) {
|
|
||||||
bs->sg = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = raw_open_common(bs, options, flags, 0, &local_err);
|
ret = raw_open_common(bs, options, flags, 0, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -2132,6 +2156,9 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Since this does ioctl the device must be already opened */
|
||||||
|
bs->sg = hdev_is_sg(bs);
|
||||||
|
|
||||||
if (flags & BDRV_O_RDWR) {
|
if (flags & BDRV_O_RDWR) {
|
||||||
ret = check_hdev_writable(s);
|
ret = check_hdev_writable(s);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -2160,16 +2187,12 @@ static int fd_open(BlockDriverState *bs)
|
|||||||
(qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->fd_open_time) >= FD_OPEN_TIMEOUT) {
|
(qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->fd_open_time) >= FD_OPEN_TIMEOUT) {
|
||||||
qemu_close(s->fd);
|
qemu_close(s->fd);
|
||||||
s->fd = -1;
|
s->fd = -1;
|
||||||
#ifdef DEBUG_FLOPPY
|
DPRINTF("Floppy closed\n");
|
||||||
printf("Floppy closed\n");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (s->fd < 0) {
|
if (s->fd < 0) {
|
||||||
if (s->fd_got_error &&
|
if (s->fd_got_error &&
|
||||||
(qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->fd_error_time) < FD_OPEN_TIMEOUT) {
|
(qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->fd_error_time) < FD_OPEN_TIMEOUT) {
|
||||||
#ifdef DEBUG_FLOPPY
|
DPRINTF("No floppy (open delayed)\n");
|
||||||
printf("No floppy (open delayed)\n");
|
|
||||||
#endif
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
s->fd = qemu_open(bs->filename, s->open_flags & ~O_NONBLOCK);
|
s->fd = qemu_open(bs->filename, s->open_flags & ~O_NONBLOCK);
|
||||||
@@ -2178,14 +2201,10 @@ static int fd_open(BlockDriverState *bs)
|
|||||||
s->fd_got_error = 1;
|
s->fd_got_error = 1;
|
||||||
if (last_media_present)
|
if (last_media_present)
|
||||||
s->fd_media_changed = 1;
|
s->fd_media_changed = 1;
|
||||||
#ifdef DEBUG_FLOPPY
|
DPRINTF("No floppy\n");
|
||||||
printf("No floppy\n");
|
|
||||||
#endif
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_FLOPPY
|
DPRINTF("Floppy opened\n");
|
||||||
printf("Floppy opened\n");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (!last_media_present)
|
if (!last_media_present)
|
||||||
s->fd_media_changed = 1;
|
s->fd_media_changed = 1;
|
||||||
@@ -2453,9 +2472,7 @@ static int floppy_media_changed(BlockDriverState *bs)
|
|||||||
fd_open(bs);
|
fd_open(bs);
|
||||||
ret = s->fd_media_changed;
|
ret = s->fd_media_changed;
|
||||||
s->fd_media_changed = 0;
|
s->fd_media_changed = 0;
|
||||||
#ifdef DEBUG_FLOPPY
|
DPRINTF("Floppy changed=%d\n", ret);
|
||||||
printf("Floppy changed=%d\n", ret);
|
|
||||||
#endif
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/thread-pool.h"
|
#include "block/thread-pool.h"
|
||||||
#include "qemu/iov.h"
|
#include "qemu/iov.h"
|
||||||
|
#include "qapi/qmp/qstring.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "block/snapshot.h"
|
#include "block/snapshot.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
|
|
||||||
QemuOptsList internal_snapshot_opts = {
|
QemuOptsList internal_snapshot_opts = {
|
||||||
.name = "snapshot",
|
.name = "snapshot",
|
||||||
@@ -229,7 +230,7 @@ int bdrv_snapshot_delete(BlockDriverState *bs,
|
|||||||
{
|
{
|
||||||
BlockDriver *drv = bs->drv;
|
BlockDriver *drv = bs->drv;
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||||
return -ENOMEDIUM;
|
return -ENOMEDIUM;
|
||||||
}
|
}
|
||||||
if (!snapshot_id && !name) {
|
if (!snapshot_id && !name) {
|
||||||
@@ -315,7 +316,7 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs,
|
|||||||
BlockDriver *drv = bs->drv;
|
BlockDriver *drv = bs->drv;
|
||||||
|
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||||
return -ENOMEDIUM;
|
return -ENOMEDIUM;
|
||||||
}
|
}
|
||||||
if (!snapshot_id && !name) {
|
if (!snapshot_id && !name) {
|
||||||
|
|||||||
@@ -30,9 +30,11 @@
|
|||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
#include "qemu/uri.h"
|
#include "qemu/uri.h"
|
||||||
#include "qapi/qmp/qint.h"
|
#include "qapi/qmp/qint.h"
|
||||||
|
#include "qapi/qmp/qstring.h"
|
||||||
|
|
||||||
/* DEBUG_SSH=1 enables the DPRINTF (debugging printf) statements in
|
/* DEBUG_SSH=1 enables the DPRINTF (debugging printf) statements in
|
||||||
* this block driver code.
|
* this block driver code.
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qemu/ratelimit.h"
|
#include "qemu/ratelimit.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -227,7 +228,7 @@ static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
|||||||
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
|
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
|
||||||
|
|
||||||
if (speed < 0) {
|
if (speed < 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||||
@@ -250,7 +251,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base,
|
|||||||
if ((on_error == BLOCKDEV_ON_ERROR_STOP ||
|
if ((on_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||||
on_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
on_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||||
!bdrv_iostatus_is_enabled(bs)) {
|
!bdrv_iostatus_is_enabled(bs)) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "on-error");
|
error_setg(errp, QERR_INVALID_PARAMETER, "on-error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -324,9 +324,14 @@ void throttle_group_config(BlockDriverState *bs, ThrottleConfig *cfg)
|
|||||||
ThrottleState *ts = bs->throttle_state;
|
ThrottleState *ts = bs->throttle_state;
|
||||||
ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts);
|
ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts);
|
||||||
qemu_mutex_lock(&tg->lock);
|
qemu_mutex_lock(&tg->lock);
|
||||||
throttle_config(ts, tt, cfg);
|
|
||||||
/* throttle_config() cancels the timers */
|
/* throttle_config() cancels the timers */
|
||||||
tg->any_timer_armed[0] = tg->any_timer_armed[1] = false;
|
if (timer_pending(tt->timers[0])) {
|
||||||
|
tg->any_timer_armed[0] = false;
|
||||||
|
}
|
||||||
|
if (timer_pending(tt->timers[1])) {
|
||||||
|
tg->any_timer_armed[1] = false;
|
||||||
|
}
|
||||||
|
throttle_config(ts, tt, cfg);
|
||||||
qemu_mutex_unlock(&tg->lock);
|
qemu_mutex_unlock(&tg->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "block/vhdx.h"
|
#include "block/vhdx.h"
|
||||||
|
|
||||||
|
|||||||
12
block/vmdk.c
12
block/vmdk.c
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "migration/migration.h"
|
#include "migration/migration.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
@@ -645,7 +647,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
|||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
|
snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
|
||||||
le32_to_cpu(header.version));
|
le32_to_cpu(header.version));
|
||||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||||
bdrv_get_device_or_node_name(bs), "vmdk", buf);
|
bdrv_get_device_or_node_name(bs), "vmdk", buf);
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
} else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
|
} else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
|
||||||
@@ -1688,12 +1690,12 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|||||||
/* write all the data */
|
/* write all the data */
|
||||||
ret = bdrv_pwrite(bs, 0, &magic, sizeof(magic));
|
ret = bdrv_pwrite(bs, 0, &magic, sizeof(magic));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
ret = bdrv_pwrite(bs, sizeof(magic), &header, sizeof(header));
|
ret = bdrv_pwrite(bs, sizeof(magic), &header, sizeof(header));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1713,7 +1715,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|||||||
ret = bdrv_pwrite(bs, le64_to_cpu(header.rgd_offset) * BDRV_SECTOR_SIZE,
|
ret = bdrv_pwrite(bs, le64_to_cpu(header.rgd_offset) * BDRV_SECTOR_SIZE,
|
||||||
gd_buf, gd_buf_size);
|
gd_buf, gd_buf_size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1725,7 +1727,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|||||||
ret = bdrv_pwrite(bs, le64_to_cpu(header.gd_offset) * BDRV_SECTOR_SIZE,
|
ret = bdrv_pwrite(bs, le64_to_cpu(header.gd_offset) * BDRV_SECTOR_SIZE,
|
||||||
gd_buf, gd_buf_size);
|
gd_buf, gd_buf_size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "migration/migration.h"
|
#include "migration/migration.h"
|
||||||
#include "qapi/qmp/qint.h"
|
#include "qapi/qmp/qint.h"
|
||||||
#include "qapi/qmp/qbool.h"
|
#include "qapi/qmp/qbool.h"
|
||||||
|
#include "qapi/qmp/qstring.h"
|
||||||
|
|
||||||
#ifndef S_IWGRP
|
#ifndef S_IWGRP
|
||||||
#define S_IWGRP 0
|
#define S_IWGRP 0
|
||||||
@@ -322,6 +323,7 @@ typedef struct BDRVVVFATState {
|
|||||||
|
|
||||||
int fat_type; /* 16 or 32 */
|
int fat_type; /* 16 or 32 */
|
||||||
array_t fat,directory,mapping;
|
array_t fat,directory,mapping;
|
||||||
|
char volume_label[11];
|
||||||
|
|
||||||
unsigned int cluster_size;
|
unsigned int cluster_size;
|
||||||
unsigned int sectors_per_cluster;
|
unsigned int sectors_per_cluster;
|
||||||
@@ -859,7 +861,7 @@ static int init_directories(BDRVVVFATState* s,
|
|||||||
{
|
{
|
||||||
direntry_t* entry=array_get_next(&(s->directory));
|
direntry_t* entry=array_get_next(&(s->directory));
|
||||||
entry->attributes=0x28; /* archive | volume label */
|
entry->attributes=0x28; /* archive | volume label */
|
||||||
memcpy(entry->name, "QEMU VVFAT ", sizeof(entry->name));
|
memcpy(entry->name, s->volume_label, sizeof(entry->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now build FAT, and write back information into directory */
|
/* Now build FAT, and write back information into directory */
|
||||||
@@ -968,7 +970,8 @@ static int init_directories(BDRVVVFATState* s,
|
|||||||
bootsector->u.fat16.signature=0x29;
|
bootsector->u.fat16.signature=0x29;
|
||||||
bootsector->u.fat16.id=cpu_to_le32(0xfabe1afd);
|
bootsector->u.fat16.id=cpu_to_le32(0xfabe1afd);
|
||||||
|
|
||||||
memcpy(bootsector->u.fat16.volume_label,"QEMU VVFAT ",11);
|
memcpy(bootsector->u.fat16.volume_label, s->volume_label,
|
||||||
|
sizeof(bootsector->u.fat16.volume_label));
|
||||||
memcpy(bootsector->fat_type,(s->fat_type==12?"FAT12 ":s->fat_type==16?"FAT16 ":"FAT32 "),8);
|
memcpy(bootsector->fat_type,(s->fat_type==12?"FAT12 ":s->fat_type==16?"FAT16 ":"FAT32 "),8);
|
||||||
bootsector->magic[0]=0x55; bootsector->magic[1]=0xaa;
|
bootsector->magic[0]=0x55; bootsector->magic[1]=0xaa;
|
||||||
|
|
||||||
@@ -1007,6 +1010,11 @@ static QemuOptsList runtime_opts = {
|
|||||||
.type = QEMU_OPT_BOOL,
|
.type = QEMU_OPT_BOOL,
|
||||||
.help = "Create a floppy rather than a hard disk image",
|
.help = "Create a floppy rather than a hard disk image",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "label",
|
||||||
|
.type = QEMU_OPT_STRING,
|
||||||
|
.help = "Use a volume label other than QEMU VVFAT",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "rw",
|
.name = "rw",
|
||||||
.type = QEMU_OPT_BOOL,
|
.type = QEMU_OPT_BOOL,
|
||||||
@@ -1059,8 +1067,8 @@ static void vvfat_parse_filename(const char *filename, QDict *options,
|
|||||||
/* Fill in the options QDict */
|
/* Fill in the options QDict */
|
||||||
qdict_put(options, "dir", qstring_from_str(filename));
|
qdict_put(options, "dir", qstring_from_str(filename));
|
||||||
qdict_put(options, "fat-type", qint_from_int(fat_type));
|
qdict_put(options, "fat-type", qint_from_int(fat_type));
|
||||||
qdict_put(options, "floppy", qbool_from_int(floppy));
|
qdict_put(options, "floppy", qbool_from_bool(floppy));
|
||||||
qdict_put(options, "rw", qbool_from_int(rw));
|
qdict_put(options, "rw", qbool_from_bool(rw));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
|
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
@@ -1069,7 +1077,7 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
BDRVVVFATState *s = bs->opaque;
|
BDRVVVFATState *s = bs->opaque;
|
||||||
int cyls, heads, secs;
|
int cyls, heads, secs;
|
||||||
bool floppy;
|
bool floppy;
|
||||||
const char *dirname;
|
const char *dirname, *label;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -1096,6 +1104,18 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
s->fat_type = qemu_opt_get_number(opts, "fat-type", 0);
|
s->fat_type = qemu_opt_get_number(opts, "fat-type", 0);
|
||||||
floppy = qemu_opt_get_bool(opts, "floppy", false);
|
floppy = qemu_opt_get_bool(opts, "floppy", false);
|
||||||
|
|
||||||
|
memset(s->volume_label, ' ', sizeof(s->volume_label));
|
||||||
|
label = qemu_opt_get(opts, "label");
|
||||||
|
if (label) {
|
||||||
|
size_t label_length = strlen(label);
|
||||||
|
if (label_length > 11) {
|
||||||
|
error_setg(errp, "vvfat label cannot be longer than 11 bytes");
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
memcpy(s->volume_label, label, label_length);
|
||||||
|
}
|
||||||
|
|
||||||
if (floppy) {
|
if (floppy) {
|
||||||
/* 1.44MB or 2.88MB floppy. 2.88MB can be FAT12 (default) or FAT16. */
|
/* 1.44MB or 2.88MB floppy. 2.88MB can be FAT12 (default) or FAT16. */
|
||||||
if (!s->fat_type) {
|
if (!s->fat_type) {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
@@ -91,11 +90,12 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!blk_is_inserted(blk)) {
|
if (!blk_is_inserted(blk)) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
86
blockdev.c
86
blockdev.c
@@ -36,10 +36,12 @@
|
|||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
#include "block/throttle-groups.h"
|
#include "block/throttle-groups.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
#include "qapi/qmp/types.h"
|
#include "qapi/qmp/types.h"
|
||||||
#include "qapi-visit.h"
|
#include "qapi-visit.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/qmp-output-visitor.h"
|
#include "qapi/qmp-output-visitor.h"
|
||||||
#include "qapi/util.h"
|
#include "qapi/util.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
@@ -174,7 +176,7 @@ static int drive_index_to_unit_id(BlockInterfaceType type, int index)
|
|||||||
|
|
||||||
QemuOpts *drive_def(const char *optstr)
|
QemuOpts *drive_def(const char *optstr)
|
||||||
{
|
{
|
||||||
return qemu_opts_parse(qemu_find_opts("drive"), optstr, 0);
|
return qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
|
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
|
||||||
@@ -1111,7 +1113,8 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -1300,7 +1303,8 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
|
|||||||
/* 2. check for validation */
|
/* 2. check for validation */
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -1310,7 +1314,7 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
|
|||||||
aio_context_acquire(state->aio_context);
|
aio_context_acquire(state->aio_context);
|
||||||
|
|
||||||
if (!bdrv_is_inserted(bs)) {
|
if (!bdrv_is_inserted(bs)) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1451,7 +1455,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
|||||||
/* start processing */
|
/* start processing */
|
||||||
drv = bdrv_find_format(format);
|
drv = bdrv_find_format(format);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1478,7 +1482,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
|||||||
aio_context_acquire(state->aio_context);
|
aio_context_acquire(state->aio_context);
|
||||||
|
|
||||||
if (!bdrv_is_inserted(state->old_bs)) {
|
if (!bdrv_is_inserted(state->old_bs)) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1489,13 +1493,13 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
|||||||
|
|
||||||
if (!bdrv_is_read_only(state->old_bs)) {
|
if (!bdrv_is_read_only(state->old_bs)) {
|
||||||
if (bdrv_flush(state->old_bs)) {
|
if (bdrv_flush(state->old_bs)) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bdrv_is_first_non_filter(state->old_bs)) {
|
if (!bdrv_is_first_non_filter(state->old_bs)) {
|
||||||
error_set(errp, QERR_FEATURE_DISABLED, "snapshot");
|
error_setg(errp, QERR_FEATURE_DISABLED, "snapshot");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1580,7 +1584,8 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp)
|
|||||||
|
|
||||||
blk = blk_by_name(backup->device);
|
blk = blk_by_name(backup->device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, backup->device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", backup->device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -1850,7 +1855,8 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1910,7 +1916,8 @@ void qmp_change_blockdev(const char *device, const char *filename,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -1921,7 +1928,7 @@ void qmp_change_blockdev(const char *device, const char *filename,
|
|||||||
if (format) {
|
if (format) {
|
||||||
drv = bdrv_find_whitelisted_format(format, bs->read_only);
|
drv = bdrv_find_whitelisted_format(format, bs->read_only);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1971,7 +1978,8 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -2159,9 +2167,6 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* quiesce block driver; prevent further io */
|
|
||||||
bdrv_drain_all();
|
|
||||||
bdrv_flush(bs);
|
|
||||||
bdrv_close(bs);
|
bdrv_close(bs);
|
||||||
|
|
||||||
/* if we have a device attached to this BlockDriverState
|
/* if we have a device attached to this BlockDriverState
|
||||||
@@ -2202,17 +2207,17 @@ void qmp_block_resize(bool has_device, const char *device,
|
|||||||
aio_context_acquire(aio_context);
|
aio_context_acquire(aio_context);
|
||||||
|
|
||||||
if (!bdrv_is_first_non_filter(bs)) {
|
if (!bdrv_is_first_non_filter(bs)) {
|
||||||
error_set(errp, QERR_FEATURE_DISABLED, "resize");
|
error_setg(errp, QERR_FEATURE_DISABLED, "resize");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
|
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
|
||||||
error_set(errp, QERR_DEVICE_IN_USE, device);
|
error_setg(errp, QERR_DEVICE_IN_USE, device);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2224,16 +2229,16 @@ void qmp_block_resize(bool has_device, const char *device,
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case -ENOMEDIUM:
|
case -ENOMEDIUM:
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||||
break;
|
break;
|
||||||
case -ENOTSUP:
|
case -ENOTSUP:
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
break;
|
break;
|
||||||
case -EACCES:
|
case -EACCES:
|
||||||
error_setg(errp, "Device '%s' is read only", device);
|
error_setg(errp, "Device '%s' is read only", device);
|
||||||
break;
|
break;
|
||||||
case -EBUSY:
|
case -EBUSY:
|
||||||
error_set(errp, QERR_DEVICE_IN_USE, device);
|
error_setg(errp, QERR_DEVICE_IN_USE, device);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error_setg_errno(errp, -ret, "Could not resize");
|
error_setg_errno(errp, -ret, "Could not resize");
|
||||||
@@ -2291,7 +2296,8 @@ void qmp_block_stream(const char *device,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -2306,7 +2312,7 @@ void qmp_block_stream(const char *device,
|
|||||||
if (has_base) {
|
if (has_base) {
|
||||||
base_bs = bdrv_find_backing_image(bs, base);
|
base_bs = bdrv_find_backing_image(bs, base);
|
||||||
if (base_bs == NULL) {
|
if (base_bs == NULL) {
|
||||||
error_set(errp, QERR_BASE_NOT_FOUND, base);
|
error_setg(errp, QERR_BASE_NOT_FOUND, base);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
assert(bdrv_get_aio_context(base_bs) == aio_context);
|
assert(bdrv_get_aio_context(base_bs) == aio_context);
|
||||||
@@ -2365,7 +2371,8 @@ void qmp_block_commit(const char *device,
|
|||||||
* scenario in which all optional arguments are omitted. */
|
* scenario in which all optional arguments are omitted. */
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -2403,7 +2410,7 @@ void qmp_block_commit(const char *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (base_bs == NULL) {
|
if (base_bs == NULL) {
|
||||||
error_set(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
error_setg(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2477,7 +2484,8 @@ void qmp_drive_backup(const char *device, const char *target,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -2488,7 +2496,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
|||||||
/* Although backup_run has this check too, we need to use bs->drv below, so
|
/* Although backup_run has this check too, we need to use bs->drv below, so
|
||||||
* do an early check redundantly. */
|
* do an early check redundantly. */
|
||||||
if (!bdrv_is_inserted(bs)) {
|
if (!bdrv_is_inserted(bs)) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2498,7 +2506,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
|||||||
if (format) {
|
if (format) {
|
||||||
drv = bdrv_find_format(format);
|
drv = bdrv_find_format(format);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2647,6 +2655,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|||||||
bool has_buf_size, int64_t buf_size,
|
bool has_buf_size, int64_t buf_size,
|
||||||
bool has_on_source_error, BlockdevOnError on_source_error,
|
bool has_on_source_error, BlockdevOnError on_source_error,
|
||||||
bool has_on_target_error, BlockdevOnError on_target_error,
|
bool has_on_target_error, BlockdevOnError on_target_error,
|
||||||
|
bool has_unmap, bool unmap,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
@@ -2678,20 +2687,25 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|||||||
if (!has_buf_size) {
|
if (!has_buf_size) {
|
||||||
buf_size = DEFAULT_MIRROR_BUF_SIZE;
|
buf_size = DEFAULT_MIRROR_BUF_SIZE;
|
||||||
}
|
}
|
||||||
|
if (!has_unmap) {
|
||||||
|
unmap = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
|
if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||||
"a value in range [512B, 64MB]");
|
"a value in range [512B, 64MB]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (granularity & (granularity - 1)) {
|
if (granularity & (granularity - 1)) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2");
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||||
|
"power of 2");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
@@ -2700,7 +2714,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|||||||
aio_context_acquire(aio_context);
|
aio_context_acquire(aio_context);
|
||||||
|
|
||||||
if (!bdrv_is_inserted(bs)) {
|
if (!bdrv_is_inserted(bs)) {
|
||||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2710,7 +2724,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|||||||
if (format) {
|
if (format) {
|
||||||
drv = bdrv_find_format(format);
|
drv = bdrv_find_format(format);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2817,6 +2831,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|||||||
has_replaces ? replaces : NULL,
|
has_replaces ? replaces : NULL,
|
||||||
speed, granularity, buf_size, sync,
|
speed, granularity, buf_size, sync,
|
||||||
on_source_error, on_target_error,
|
on_source_error, on_target_error,
|
||||||
|
unmap,
|
||||||
block_job_cb, bs, &local_err);
|
block_job_cb, bs, &local_err);
|
||||||
if (local_err != NULL) {
|
if (local_err != NULL) {
|
||||||
bdrv_unref(target_bs);
|
bdrv_unref(target_bs);
|
||||||
@@ -2957,7 +2972,8 @@ void qmp_change_backing_file(const char *device,
|
|||||||
|
|
||||||
blk = blk_by_name(device);
|
blk = blk_by_name(device);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "block/block.h"
|
#include "block/block.h"
|
||||||
#include "block/blockjob.h"
|
#include "block/blockjob.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/qmp/qjson.h"
|
#include "qapi/qmp/qjson.h"
|
||||||
#include "block/coroutine.h"
|
#include "block/coroutine.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
@@ -42,7 +43,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
|
|||||||
BlockJob *job;
|
BlockJob *job;
|
||||||
|
|
||||||
if (bs->job) {
|
if (bs->job) {
|
||||||
error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
|
error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bdrv_ref(bs);
|
bdrv_ref(bs);
|
||||||
@@ -93,7 +94,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
|||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
if (!job->driver->set_speed) {
|
if (!job->driver->set_speed) {
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
job->driver->set_speed(job, speed, &local_err);
|
job->driver->set_speed(job, speed, &local_err);
|
||||||
@@ -108,7 +109,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
|||||||
void block_job_complete(BlockJob *job, Error **errp)
|
void block_job_complete(BlockJob *job, Error **errp)
|
||||||
{
|
{
|
||||||
if (job->pause_count || job->cancelled || !job->driver->complete) {
|
if (job->pause_count || job->cancelled || !job->driver->complete) {
|
||||||
error_set(errp, QERR_BLOCK_JOB_NOT_READY,
|
error_setg(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||||
bdrv_get_device_name(job->bs));
|
bdrv_get_device_name(job->bs));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
201
configure
vendored
201
configure
vendored
@@ -355,7 +355,7 @@ for opt do
|
|||||||
--extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
|
--extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
|
||||||
EXTRA_CFLAGS="$optarg"
|
EXTRA_CFLAGS="$optarg"
|
||||||
;;
|
;;
|
||||||
--extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
|
--extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
|
||||||
EXTRA_LDFLAGS="$optarg"
|
EXTRA_LDFLAGS="$optarg"
|
||||||
;;
|
;;
|
||||||
--enable-debug-info) debug_info="yes"
|
--enable-debug-info) debug_info="yes"
|
||||||
@@ -1282,29 +1282,10 @@ Advanced options (experts only):
|
|||||||
--sysconfdir=PATH install config in PATH$confsuffix
|
--sysconfdir=PATH install config in PATH$confsuffix
|
||||||
--localstatedir=PATH install local state in PATH (set at runtime on win32)
|
--localstatedir=PATH install local state in PATH (set at runtime on win32)
|
||||||
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
|
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
|
||||||
--enable-modules enable modules support
|
|
||||||
--enable-debug-tcg enable TCG debugging
|
|
||||||
--disable-debug-tcg disable TCG debugging (default)
|
|
||||||
--enable-debug-info enable debugging information (default)
|
|
||||||
--disable-debug-info disable debugging information
|
|
||||||
--enable-debug enable common debug build options
|
--enable-debug enable common debug build options
|
||||||
--enable-sparse enable sparse checker
|
|
||||||
--disable-sparse disable sparse checker (default)
|
|
||||||
--disable-strip disable stripping binaries
|
--disable-strip disable stripping binaries
|
||||||
--disable-werror disable compilation abort on warning
|
--disable-werror disable compilation abort on warning
|
||||||
--disable-stack-protector disable compiler-provided stack protection
|
--disable-stack-protector disable compiler-provided stack protection
|
||||||
--disable-sdl disable SDL
|
|
||||||
--enable-sdl enable SDL
|
|
||||||
--with-sdlabi select preferred SDL ABI 1.2 or 2.0
|
|
||||||
--disable-gtk disable gtk UI
|
|
||||||
--enable-gtk enable gtk UI
|
|
||||||
--with-gtkabi select preferred GTK ABI 2.0 or 3.0
|
|
||||||
--disable-virtfs disable VirtFS
|
|
||||||
--enable-virtfs enable VirtFS
|
|
||||||
--disable-vnc disable VNC
|
|
||||||
--enable-vnc enable VNC
|
|
||||||
--disable-cocoa disable Cocoa (Mac OS X only)
|
|
||||||
--enable-cocoa enable Cocoa (default on Mac OS X)
|
|
||||||
--audio-drv-list=LIST set audio drivers list:
|
--audio-drv-list=LIST set audio drivers list:
|
||||||
Available drivers: $audio_possible_drivers
|
Available drivers: $audio_possible_drivers
|
||||||
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
|
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
|
||||||
@@ -1314,119 +1295,89 @@ Advanced options (experts only):
|
|||||||
--block-drv-ro-whitelist=L
|
--block-drv-ro-whitelist=L
|
||||||
set block driver read-only whitelist
|
set block driver read-only whitelist
|
||||||
(affects only QEMU, not qemu-img)
|
(affects only QEMU, not qemu-img)
|
||||||
--disable-xen disable xen backend driver support
|
|
||||||
--enable-xen enable xen backend driver support
|
|
||||||
--disable-xen-pci-passthrough
|
|
||||||
--enable-xen-pci-passthrough
|
|
||||||
--disable-brlapi disable BrlAPI
|
|
||||||
--enable-brlapi enable BrlAPI
|
|
||||||
--disable-vnc-tls disable TLS encryption for VNC server
|
|
||||||
--enable-vnc-tls enable TLS encryption for VNC server
|
|
||||||
--disable-vnc-sasl disable SASL encryption for VNC server
|
|
||||||
--enable-vnc-sasl enable SASL encryption for VNC server
|
|
||||||
--disable-vnc-jpeg disable JPEG lossy compression for VNC server
|
|
||||||
--enable-vnc-jpeg enable JPEG lossy compression for VNC server
|
|
||||||
--disable-vnc-png disable PNG compression for VNC server (default)
|
|
||||||
--enable-vnc-png enable PNG compression for VNC server
|
|
||||||
--disable-vnc-ws disable Websockets support for VNC server
|
|
||||||
--enable-vnc-ws enable Websockets support for VNC server
|
|
||||||
--disable-curses disable curses output
|
|
||||||
--enable-curses enable curses output
|
|
||||||
--disable-curl disable curl connectivity
|
|
||||||
--enable-curl enable curl connectivity
|
|
||||||
--disable-fdt disable fdt device tree
|
|
||||||
--enable-fdt enable fdt device tree
|
|
||||||
--disable-bluez disable bluez stack connectivity
|
|
||||||
--enable-bluez enable bluez stack connectivity
|
|
||||||
--disable-slirp disable SLIRP userspace network connectivity
|
|
||||||
--disable-kvm disable KVM acceleration support
|
|
||||||
--enable-kvm enable KVM acceleration support
|
|
||||||
--disable-rdma disable RDMA-based migration support
|
|
||||||
--enable-rdma enable RDMA-based migration support
|
|
||||||
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
|
|
||||||
--enable-system enable all system emulation targets
|
|
||||||
--disable-system disable all system emulation targets
|
|
||||||
--enable-user enable supported user emulation targets
|
|
||||||
--disable-user disable all user emulation targets
|
|
||||||
--enable-linux-user enable all linux usermode emulation targets
|
|
||||||
--disable-linux-user disable all linux usermode emulation targets
|
|
||||||
--enable-bsd-user enable all BSD usermode emulation targets
|
|
||||||
--disable-bsd-user disable all BSD usermode emulation targets
|
|
||||||
--enable-guest-base enable GUEST_BASE support for usermode
|
|
||||||
emulation targets
|
|
||||||
--disable-guest-base disable GUEST_BASE support
|
|
||||||
--enable-pie build Position Independent Executables
|
|
||||||
--disable-pie do not build Position Independent Executables
|
|
||||||
--oss-lib path to OSS library
|
|
||||||
--cpu=CPU Build for host CPU [$cpu]
|
|
||||||
--disable-uuid disable uuid support
|
|
||||||
--enable-uuid enable uuid support
|
|
||||||
--disable-vde disable support for vde network
|
|
||||||
--enable-vde enable support for vde network
|
|
||||||
--disable-netmap disable support for netmap network
|
|
||||||
--enable-netmap enable support for netmap network
|
|
||||||
--disable-linux-aio disable Linux AIO support
|
|
||||||
--enable-linux-aio enable Linux AIO support
|
|
||||||
--disable-cap-ng disable libcap-ng support
|
|
||||||
--enable-cap-ng enable libcap-ng support
|
|
||||||
--disable-attr disable attr and xattr support
|
|
||||||
--enable-attr enable attr and xattr support
|
|
||||||
--disable-blobs disable installing provided firmware blobs
|
|
||||||
--enable-docs enable documentation build
|
|
||||||
--disable-docs disable documentation build
|
|
||||||
--disable-vhost-net disable vhost-net acceleration support
|
|
||||||
--enable-vhost-net enable vhost-net acceleration support
|
|
||||||
--enable-trace-backends=B Set trace backend
|
--enable-trace-backends=B Set trace backend
|
||||||
Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
|
Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
|
||||||
--with-trace-file=NAME Full PATH,NAME of file to store traces
|
--with-trace-file=NAME Full PATH,NAME of file to store traces
|
||||||
Default:trace-<pid>
|
Default:trace-<pid>
|
||||||
--disable-spice disable spice
|
--disable-slirp disable SLIRP userspace network connectivity
|
||||||
--enable-spice enable spice
|
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
|
||||||
--enable-rbd enable building the rados block device (rbd)
|
--oss-lib path to OSS library
|
||||||
--disable-libiscsi disable iscsi support
|
--cpu=CPU Build for host CPU [$cpu]
|
||||||
--enable-libiscsi enable iscsi support
|
|
||||||
--disable-libnfs disable nfs support
|
|
||||||
--enable-libnfs enable nfs support
|
|
||||||
--disable-smartcard-nss disable smartcard nss support
|
|
||||||
--enable-smartcard-nss enable smartcard nss support
|
|
||||||
--disable-libusb disable libusb (for usb passthrough)
|
|
||||||
--enable-libusb enable libusb (for usb passthrough)
|
|
||||||
--disable-usb-redir disable usb network redirection support
|
|
||||||
--enable-usb-redir enable usb network redirection support
|
|
||||||
--enable-lzo enable the support of lzo compression library
|
|
||||||
--enable-snappy enable the support of snappy compression library
|
|
||||||
--enable-bzip2 enable the support of bzip2 compression library (for
|
|
||||||
reading bzip2-compressed dmg images)
|
|
||||||
--disable-guest-agent disable building of the QEMU Guest Agent
|
|
||||||
--enable-guest-agent enable building of the QEMU Guest Agent
|
|
||||||
--enable-guest-agent-msi enable building guest agent Windows MSI installation package
|
|
||||||
--disable-guest-agent-msi disable building guest agent Windows MSI installation
|
|
||||||
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
|
|
||||||
--with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
|
|
||||||
--disable-seccomp disable seccomp support
|
|
||||||
--enable-seccomp enable seccomp support
|
|
||||||
--with-coroutine=BACKEND coroutine backend. Supported options:
|
--with-coroutine=BACKEND coroutine backend. Supported options:
|
||||||
gthread, ucontext, sigaltstack, windows
|
gthread, ucontext, sigaltstack, windows
|
||||||
--disable-coroutine-pool disable coroutine freelist (worse performance)
|
|
||||||
--enable-coroutine-pool enable coroutine freelist (better performance)
|
|
||||||
--enable-glusterfs enable GlusterFS backend
|
|
||||||
--disable-glusterfs disable GlusterFS backend
|
|
||||||
--enable-archipelago enable Archipelago backend
|
|
||||||
--disable-archipelago disable Archipelago backend
|
|
||||||
--enable-gcov enable test coverage analysis with gcov
|
--enable-gcov enable test coverage analysis with gcov
|
||||||
--gcov=GCOV use specified gcov [$gcov_tool]
|
--gcov=GCOV use specified gcov [$gcov_tool]
|
||||||
--disable-tpm disable TPM support
|
--disable-blobs disable installing provided firmware blobs
|
||||||
--enable-tpm enable TPM support
|
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
|
||||||
--disable-libssh2 disable ssh block device support
|
--with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
|
||||||
--enable-libssh2 enable ssh block device support
|
|
||||||
--disable-vhdx disable support for the Microsoft VHDX image format
|
Optional features, enabled with --enable-FEATURE and
|
||||||
--enable-vhdx enable support for the Microsoft VHDX image format
|
disabled with --disable-FEATURE, default is enabled if available:
|
||||||
--disable-quorum disable quorum block filter support
|
|
||||||
--enable-quorum enable quorum block filter support
|
system all system emulation targets
|
||||||
--disable-numa disable libnuma support
|
user supported user emulation targets
|
||||||
--enable-numa enable libnuma support
|
linux-user all linux usermode emulation targets
|
||||||
--disable-tcmalloc disable tcmalloc support
|
bsd-user all BSD usermode emulation targets
|
||||||
--enable-tcmalloc enable tcmalloc support
|
guest-base GUEST_BASE support for usermode emulation targets
|
||||||
|
docs build documentation
|
||||||
|
guest-agent build the QEMU Guest Agent
|
||||||
|
guest-agent-msi build guest agent Windows MSI installation package
|
||||||
|
pie Position Independent Executables
|
||||||
|
modules modules support
|
||||||
|
debug-tcg TCG debugging (default is disabled)
|
||||||
|
debug-info debugging information
|
||||||
|
sparse sparse checker
|
||||||
|
|
||||||
|
sdl SDL UI
|
||||||
|
--with-sdlabi select preferred SDL ABI 1.2 or 2.0
|
||||||
|
gtk gtk UI
|
||||||
|
--with-gtkabi select preferred GTK ABI 2.0 or 3.0
|
||||||
|
vte vte support for the gtk UI
|
||||||
|
curses curses UI
|
||||||
|
vnc VNC UI support
|
||||||
|
vnc-tls TLS encryption for VNC server
|
||||||
|
vnc-sasl SASL encryption for VNC server
|
||||||
|
vnc-jpeg JPEG lossy compression for VNC server
|
||||||
|
vnc-png PNG compression for VNC server
|
||||||
|
vnc-ws Websockets support for VNC server
|
||||||
|
cocoa Cocoa UI (Mac OS X only)
|
||||||
|
virtfs VirtFS
|
||||||
|
xen xen backend driver support
|
||||||
|
xen-pci-passthrough
|
||||||
|
brlapi BrlAPI (Braile)
|
||||||
|
curl curl connectivity
|
||||||
|
fdt fdt device tree
|
||||||
|
bluez bluez stack connectivity
|
||||||
|
kvm KVM acceleration support
|
||||||
|
rdma RDMA-based migration support
|
||||||
|
uuid uuid support
|
||||||
|
vde support for vde network
|
||||||
|
netmap support for netmap network
|
||||||
|
linux-aio Linux AIO support
|
||||||
|
cap-ng libcap-ng support
|
||||||
|
attr attr and xattr support
|
||||||
|
vhost-net vhost-net acceleration support
|
||||||
|
spice spice
|
||||||
|
rbd rados block device (rbd)
|
||||||
|
libiscsi iscsi support
|
||||||
|
libnfs nfs support
|
||||||
|
smartcard-nss smartcard nss support
|
||||||
|
libusb libusb (for usb passthrough)
|
||||||
|
usb-redir usb network redirection support
|
||||||
|
lzo support of lzo compression library
|
||||||
|
snappy support of snappy compression library
|
||||||
|
bzip2 support of bzip2 compression library
|
||||||
|
(for reading bzip2-compressed dmg images)
|
||||||
|
seccomp seccomp support
|
||||||
|
coroutine-pool coroutine freelist (better performance)
|
||||||
|
glusterfs GlusterFS backend
|
||||||
|
archipelago Archipelago backend
|
||||||
|
tpm TPM support
|
||||||
|
libssh2 ssh block device support
|
||||||
|
vhdx support for the Microsoft VHDX image format
|
||||||
|
quorum quorum block filter support
|
||||||
|
numa libnuma support
|
||||||
|
tcmalloc tcmalloc support
|
||||||
|
|
||||||
NOTE: The object files are built at the place where configure is launched
|
NOTE: The object files are built at the place where configure is launched
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
7
cpus.c
7
cpus.c
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "exec/gdbstub.h"
|
#include "exec/gdbstub.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
@@ -1512,7 +1513,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
|
|||||||
|
|
||||||
cpu = qemu_get_cpu(cpu_index);
|
cpu = qemu_get_cpu(cpu_index);
|
||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||||
"a CPU number");
|
"a CPU number");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1533,7 +1534,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (fwrite(buf, 1, l, f) != l) {
|
if (fwrite(buf, 1, l, f) != l) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
addr += l;
|
addr += l;
|
||||||
@@ -1563,7 +1564,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
|
|||||||
l = size;
|
l = size;
|
||||||
cpu_physical_memory_read(addr, buf, l);
|
cpu_physical_memory_read(addr, buf, l);
|
||||||
if (fwrite(buf, 1, l, f) != l) {
|
if (fwrite(buf, 1, l, f) != l) {
|
||||||
error_set(errp, QERR_IO_ERROR);
|
error_setg(errp, QERR_IO_ERROR);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
addr += l;
|
addr += l;
|
||||||
|
|||||||
14
disas.c
14
disas.c
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
typedef struct CPUDebug {
|
typedef struct CPUDebug {
|
||||||
struct disassemble_info info;
|
struct disassemble_info info;
|
||||||
CPUArchState *env;
|
CPUState *cpu;
|
||||||
} CPUDebug;
|
} CPUDebug;
|
||||||
|
|
||||||
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
||||||
@@ -39,7 +39,7 @@ target_read_memory (bfd_vma memaddr,
|
|||||||
{
|
{
|
||||||
CPUDebug *s = container_of(info, CPUDebug, info);
|
CPUDebug *s = container_of(info, CPUDebug, info);
|
||||||
|
|
||||||
cpu_memory_rw_debug(ENV_GET_CPU(s->env), memaddr, myaddr, length, 0);
|
cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
|
|||||||
bit 16 indicates little endian.
|
bit 16 indicates little endian.
|
||||||
other targets - unused
|
other targets - unused
|
||||||
*/
|
*/
|
||||||
void target_disas(FILE *out, CPUArchState *env, target_ulong code,
|
void target_disas(FILE *out, CPUState *cpu, target_ulong code,
|
||||||
target_ulong size, int flags)
|
target_ulong size, int flags)
|
||||||
{
|
{
|
||||||
target_ulong pc;
|
target_ulong pc;
|
||||||
@@ -205,7 +205,7 @@ void target_disas(FILE *out, CPUArchState *env, target_ulong code,
|
|||||||
|
|
||||||
INIT_DISASSEMBLE_INFO(s.info, out, fprintf);
|
INIT_DISASSEMBLE_INFO(s.info, out, fprintf);
|
||||||
|
|
||||||
s.env = env;
|
s.cpu = cpu;
|
||||||
s.info.read_memory_func = target_read_memory;
|
s.info.read_memory_func = target_read_memory;
|
||||||
s.info.buffer_vma = code;
|
s.info.buffer_vma = code;
|
||||||
s.info.buffer_length = size;
|
s.info.buffer_length = size;
|
||||||
@@ -430,7 +430,7 @@ monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
|
|||||||
if (monitor_disas_is_physical) {
|
if (monitor_disas_is_physical) {
|
||||||
cpu_physical_memory_read(memaddr, myaddr, length);
|
cpu_physical_memory_read(memaddr, myaddr, length);
|
||||||
} else {
|
} else {
|
||||||
cpu_memory_rw_debug(ENV_GET_CPU(s->env), memaddr, myaddr, length, 0);
|
cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ monitor_fprintf(FILE *stream, const char *fmt, ...)
|
|||||||
|
|
||||||
/* Disassembler for the monitor.
|
/* Disassembler for the monitor.
|
||||||
See target_disas for a description of flags. */
|
See target_disas for a description of flags. */
|
||||||
void monitor_disas(Monitor *mon, CPUArchState *env,
|
void monitor_disas(Monitor *mon, CPUState *cpu,
|
||||||
target_ulong pc, int nb_insn, int is_physical, int flags)
|
target_ulong pc, int nb_insn, int is_physical, int flags)
|
||||||
{
|
{
|
||||||
int count, i;
|
int count, i;
|
||||||
@@ -456,7 +456,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env,
|
|||||||
|
|
||||||
INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);
|
INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);
|
||||||
|
|
||||||
s.env = env;
|
s.cpu = cpu;
|
||||||
monitor_disas_is_physical = is_physical;
|
monitor_disas_is_physical = is_physical;
|
||||||
s.info.read_memory_func = monitor_read_memory;
|
s.info.read_memory_func = monitor_read_memory;
|
||||||
s.info.print_address_func = generic_print_target_address;
|
s.info.print_address_func = generic_print_target_address;
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ full backup as a backing image.
|
|||||||
"bitmap": "bitmap0",
|
"bitmap": "bitmap0",
|
||||||
"target": "incremental.0.img",
|
"target": "incremental.0.img",
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"sync": "dirty-bitmap",
|
"sync": "incremental",
|
||||||
"mode": "existing"
|
"mode": "existing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ full backup as a backing image.
|
|||||||
"bitmap": "bitmap0",
|
"bitmap": "bitmap0",
|
||||||
"target": "incremental.1.img",
|
"target": "incremental.1.img",
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"sync": "dirty-bitmap",
|
"sync": "incremental",
|
||||||
"mode": "existing"
|
"mode": "existing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ full backup as a backing image.
|
|||||||
"bitmap": "bitmap0",
|
"bitmap": "bitmap0",
|
||||||
"target": "incremental.0.img",
|
"target": "incremental.0.img",
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"sync": "dirty-bitmap",
|
"sync": "incremental",
|
||||||
"mode": "existing"
|
"mode": "existing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@ full backup as a backing image.
|
|||||||
"bitmap": "bitmap0",
|
"bitmap": "bitmap0",
|
||||||
"target": "incremental.0.img",
|
"target": "incremental.0.img",
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"sync": "dirty-bitmap",
|
"sync": "incremental",
|
||||||
"mode": "existing"
|
"mode": "existing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
multiseat howto (with some multihead coverage)
|
multiseat howto (with some multihead coverage)
|
||||||
==============================================
|
==============================================
|
||||||
|
|
||||||
host side
|
host devices
|
||||||
---------
|
------------
|
||||||
|
|
||||||
First you must compile qemu with a user interface supporting
|
First you must compile qemu with a user interface supporting
|
||||||
multihead/multiseat and input event routing. Right now this
|
multihead/multiseat and input event routing. Right now this
|
||||||
@@ -41,6 +41,19 @@ The "display=video2" sets up the input routing. Any input coming from
|
|||||||
the window which belongs to the video.2 display adapter will be routed
|
the window which belongs to the video.2 display adapter will be routed
|
||||||
to these input devices.
|
to these input devices.
|
||||||
|
|
||||||
|
Starting with qemu 2.4 and linux kernel 4.1 you can also use virtio
|
||||||
|
for the input devices, using this ...
|
||||||
|
|
||||||
|
-device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \
|
||||||
|
-device secondary-vga,bus=head.2,addr=02.0,id=video.2 \
|
||||||
|
-device virtio-keyboard-pci,bus=head.2,addr=03.0,display=video.2 \
|
||||||
|
-device virtio-tablet-pci,bus=head.2,addr=03.0,display=video.2
|
||||||
|
|
||||||
|
... instead of xhci and usb hid devices.
|
||||||
|
|
||||||
|
host ui
|
||||||
|
-------
|
||||||
|
|
||||||
The sdl2 ui will start up with two windows, one for each display
|
The sdl2 ui will start up with two windows, one for each display
|
||||||
device. The gtk ui will start with a single window and each display
|
device. The gtk ui will start with a single window and each display
|
||||||
in a separate tab. You can either simply switch tabs to switch heads,
|
in a separate tab. You can either simply switch tabs to switch heads,
|
||||||
@@ -110,7 +123,7 @@ Background info is here:
|
|||||||
guest side with pci-bridge-seat
|
guest side with pci-bridge-seat
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
Qemu version FIXME and newer has a new pci-bridge-seat device which
|
Qemu version 2.4 and newer has a new pci-bridge-seat device which
|
||||||
can be used instead of pci-bridge. Just swap the device name in the
|
can be used instead of pci-bridge. Just swap the device name in the
|
||||||
qemu command line above. The only difference between the two devices
|
qemu command line above. The only difference between the two devices
|
||||||
is the pci id. We can match the pci id instead of the device path
|
is the pci id. We can match the pci id instead of the device path
|
||||||
@@ -121,9 +134,10 @@ configuration:
|
|||||||
SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \
|
SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \
|
||||||
TAG+="seat", ENV{ID_AUTOSEAT}="1"
|
TAG+="seat", ENV{ID_AUTOSEAT}="1"
|
||||||
|
|
||||||
Patch with this rule will be submitted to upstream udev/systemd, so
|
Patch with this rule has been submitted to upstream udev/systemd, was
|
||||||
long-term, when systemd with this lands in distros, things will work
|
accepted and and should be included in the next systemd release (222).
|
||||||
just fine without any manual guest configuration.
|
So, if your guest has this or a newer version, multiseat will work just
|
||||||
|
fine without any manual guest configuration.
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
|
|||||||
13
dump.c
13
dump.c
@@ -23,6 +23,7 @@
|
|||||||
#include "sysemu/memory_mapping.h"
|
#include "sysemu/memory_mapping.h"
|
||||||
#include "sysemu/cpus.h"
|
#include "sysemu/cpus.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
@@ -1474,7 +1475,7 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
|||||||
|
|
||||||
s->start = get_start_block(s);
|
s->start = get_start_block(s);
|
||||||
if (s->start == -1) {
|
if (s->start == -1) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "begin");
|
error_setg(errp, QERR_INVALID_PARAMETER, "begin");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1484,14 +1485,14 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
|||||||
*/
|
*/
|
||||||
ret = cpu_get_dump_info(&s->dump_info, &s->guest_phys_blocks);
|
ret = cpu_get_dump_info(&s->dump_info, &s->guest_phys_blocks);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->note_size = cpu_get_note_size(s->dump_info.d_class,
|
s->note_size = cpu_get_note_size(s->dump_info.d_class,
|
||||||
s->dump_info.d_machine, nr_cpus);
|
s->dump_info.d_machine, nr_cpus);
|
||||||
if (s->note_size < 0) {
|
if (s->note_size < 0) {
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,11 +1616,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (has_begin && !has_length) {
|
if (has_begin && !has_length) {
|
||||||
error_set(errp, QERR_MISSING_PARAMETER, "length");
|
error_setg(errp, QERR_MISSING_PARAMETER, "length");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!has_begin && has_length) {
|
if (!has_begin && has_length) {
|
||||||
error_set(errp, QERR_MISSING_PARAMETER, "begin");
|
error_setg(errp, QERR_MISSING_PARAMETER, "begin");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1656,7 +1657,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
|
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
66
hmp.c
66
hmp.c
@@ -25,6 +25,7 @@
|
|||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "monitor/qdev.h"
|
#include "monitor/qdev.h"
|
||||||
#include "qapi/opts-visitor.h"
|
#include "qapi/opts-visitor.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/string-output-visitor.h"
|
#include "qapi/string-output-visitor.h"
|
||||||
#include "qapi-visit.h"
|
#include "qapi-visit.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
@@ -438,8 +439,8 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
|
|||||||
BlockInfoList *block_list, *info;
|
BlockInfoList *block_list, *info;
|
||||||
BlockDeviceInfoList *blockdev_list, *blockdev;
|
BlockDeviceInfoList *blockdev_list, *blockdev;
|
||||||
const char *device = qdict_get_try_str(qdict, "device");
|
const char *device = qdict_get_try_str(qdict, "device");
|
||||||
bool verbose = qdict_get_try_bool(qdict, "verbose", 0);
|
bool verbose = qdict_get_try_bool(qdict, "verbose", false);
|
||||||
bool nodes = qdict_get_try_bool(qdict, "nodes", 0);
|
bool nodes = qdict_get_try_bool(qdict, "nodes", false);
|
||||||
bool printed = false;
|
bool printed = false;
|
||||||
|
|
||||||
/* Print BlockBackend information */
|
/* Print BlockBackend information */
|
||||||
@@ -995,7 +996,7 @@ void hmp_nmi(Monitor *mon, const QDict *qdict)
|
|||||||
void hmp_set_link(Monitor *mon, const QDict *qdict)
|
void hmp_set_link(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
const char *name = qdict_get_str(qdict, "name");
|
const char *name = qdict_get_str(qdict, "name");
|
||||||
int up = qdict_get_bool(qdict, "up");
|
bool up = qdict_get_bool(qdict, "up");
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
qmp_set_link(name, up, &err);
|
qmp_set_link(name, up, &err);
|
||||||
@@ -1039,13 +1040,13 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
|
|||||||
const char *device = qdict_get_str(qdict, "device");
|
const char *device = qdict_get_str(qdict, "device");
|
||||||
const char *filename = qdict_get_str(qdict, "target");
|
const char *filename = qdict_get_str(qdict, "target");
|
||||||
const char *format = qdict_get_try_str(qdict, "format");
|
const char *format = qdict_get_try_str(qdict, "format");
|
||||||
int reuse = qdict_get_try_bool(qdict, "reuse", 0);
|
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
|
||||||
int full = qdict_get_try_bool(qdict, "full", 0);
|
bool full = qdict_get_try_bool(qdict, "full", false);
|
||||||
enum NewImageMode mode;
|
enum NewImageMode mode;
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
error_set(&err, QERR_MISSING_PARAMETER, "target");
|
error_setg(&err, QERR_MISSING_PARAMETER, "target");
|
||||||
hmp_handle_error(mon, &err);
|
hmp_handle_error(mon, &err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1060,7 +1061,7 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
|
|||||||
false, NULL, false, NULL,
|
false, NULL, false, NULL,
|
||||||
full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
|
full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
|
||||||
true, mode, false, 0, false, 0, false, 0,
|
true, mode, false, 0, false, 0, false, 0,
|
||||||
false, 0, false, 0, &err);
|
false, 0, false, 0, false, true, &err);
|
||||||
hmp_handle_error(mon, &err);
|
hmp_handle_error(mon, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,13 +1070,13 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)
|
|||||||
const char *device = qdict_get_str(qdict, "device");
|
const char *device = qdict_get_str(qdict, "device");
|
||||||
const char *filename = qdict_get_str(qdict, "target");
|
const char *filename = qdict_get_str(qdict, "target");
|
||||||
const char *format = qdict_get_try_str(qdict, "format");
|
const char *format = qdict_get_try_str(qdict, "format");
|
||||||
int reuse = qdict_get_try_bool(qdict, "reuse", 0);
|
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
|
||||||
int full = qdict_get_try_bool(qdict, "full", 0);
|
bool full = qdict_get_try_bool(qdict, "full", false);
|
||||||
enum NewImageMode mode;
|
enum NewImageMode mode;
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
error_set(&err, QERR_MISSING_PARAMETER, "target");
|
error_setg(&err, QERR_MISSING_PARAMETER, "target");
|
||||||
hmp_handle_error(mon, &err);
|
hmp_handle_error(mon, &err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1098,14 +1099,14 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
|
|||||||
const char *device = qdict_get_str(qdict, "device");
|
const char *device = qdict_get_str(qdict, "device");
|
||||||
const char *filename = qdict_get_try_str(qdict, "snapshot-file");
|
const char *filename = qdict_get_try_str(qdict, "snapshot-file");
|
||||||
const char *format = qdict_get_try_str(qdict, "format");
|
const char *format = qdict_get_try_str(qdict, "format");
|
||||||
int reuse = qdict_get_try_bool(qdict, "reuse", 0);
|
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
|
||||||
enum NewImageMode mode;
|
enum NewImageMode mode;
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
/* In the future, if 'snapshot-file' is not specified, the snapshot
|
/* In the future, if 'snapshot-file' is not specified, the snapshot
|
||||||
will be taken internally. Today it's actually required. */
|
will be taken internally. Today it's actually required. */
|
||||||
error_set(&err, QERR_MISSING_PARAMETER, "snapshot-file");
|
error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file");
|
||||||
hmp_handle_error(mon, &err);
|
hmp_handle_error(mon, &err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1200,7 +1201,7 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == MIGRATION_CAPABILITY_MAX) {
|
if (i == MIGRATION_CAPABILITY_MAX) {
|
||||||
error_set(&err, QERR_INVALID_PARAMETER, cap);
|
error_setg(&err, QERR_INVALID_PARAMETER, cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
qapi_free_MigrationCapabilityStatusList(caps);
|
qapi_free_MigrationCapabilityStatusList(caps);
|
||||||
@@ -1244,7 +1245,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == MIGRATION_PARAMETER_MAX) {
|
if (i == MIGRATION_PARAMETER_MAX) {
|
||||||
error_set(&err, QERR_INVALID_PARAMETER, param);
|
error_setg(&err, QERR_INVALID_PARAMETER, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -1294,7 +1295,7 @@ void hmp_expire_password(Monitor *mon, const QDict *qdict)
|
|||||||
|
|
||||||
void hmp_eject(Monitor *mon, const QDict *qdict)
|
void hmp_eject(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
int force = qdict_get_try_bool(qdict, "force", 0);
|
bool force = qdict_get_try_bool(qdict, "force", false);
|
||||||
const char *device = qdict_get_str(qdict, "device");
|
const char *device = qdict_get_str(qdict, "device");
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
@@ -1394,7 +1395,7 @@ void hmp_block_job_cancel(Monitor *mon, const QDict *qdict)
|
|||||||
{
|
{
|
||||||
Error *error = NULL;
|
Error *error = NULL;
|
||||||
const char *device = qdict_get_str(qdict, "device");
|
const char *device = qdict_get_str(qdict, "device");
|
||||||
bool force = qdict_get_try_bool(qdict, "force", 0);
|
bool force = qdict_get_try_bool(qdict, "force", false);
|
||||||
|
|
||||||
qmp_block_job_cancel(device, true, force, &error);
|
qmp_block_job_cancel(device, true, force, &error);
|
||||||
|
|
||||||
@@ -1474,9 +1475,9 @@ static void hmp_migrate_status_cb(void *opaque)
|
|||||||
|
|
||||||
void hmp_migrate(Monitor *mon, const QDict *qdict)
|
void hmp_migrate(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
int detach = qdict_get_try_bool(qdict, "detach", 0);
|
bool detach = qdict_get_try_bool(qdict, "detach", false);
|
||||||
int blk = qdict_get_try_bool(qdict, "blk", 0);
|
bool blk = qdict_get_try_bool(qdict, "blk", false);
|
||||||
int inc = qdict_get_try_bool(qdict, "inc", 0);
|
bool inc = qdict_get_try_bool(qdict, "inc", false);
|
||||||
const char *uri = qdict_get_str(qdict, "uri");
|
const char *uri = qdict_get_str(qdict, "uri");
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
@@ -1507,7 +1508,10 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
|
|||||||
|
|
||||||
void hmp_device_add(Monitor *mon, const QDict *qdict)
|
void hmp_device_add(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
do_device_add(mon, qdict, NULL);
|
Error *err = NULL;
|
||||||
|
|
||||||
|
qmp_device_add((QDict *)qdict, NULL, &err);
|
||||||
|
hmp_handle_error(mon, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hmp_device_del(Monitor *mon, const QDict *qdict)
|
void hmp_device_del(Monitor *mon, const QDict *qdict)
|
||||||
@@ -1522,10 +1526,10 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
|
|||||||
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
|
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
int paging = qdict_get_try_bool(qdict, "paging", 0);
|
bool paging = qdict_get_try_bool(qdict, "paging", false);
|
||||||
int zlib = qdict_get_try_bool(qdict, "zlib", 0);
|
bool zlib = qdict_get_try_bool(qdict, "zlib", false);
|
||||||
int lzo = qdict_get_try_bool(qdict, "lzo", 0);
|
bool lzo = qdict_get_try_bool(qdict, "lzo", false);
|
||||||
int snappy = qdict_get_try_bool(qdict, "snappy", 0);
|
bool snappy = qdict_get_try_bool(qdict, "snappy", false);
|
||||||
const char *file = qdict_get_str(qdict, "filename");
|
const char *file = qdict_get_str(qdict, "filename");
|
||||||
bool has_begin = qdict_haskey(qdict, "begin");
|
bool has_begin = qdict_haskey(qdict, "begin");
|
||||||
bool has_length = qdict_haskey(qdict, "length");
|
bool has_length = qdict_haskey(qdict, "length");
|
||||||
@@ -1751,8 +1755,8 @@ void hmp_screendump(Monitor *mon, const QDict *qdict)
|
|||||||
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
|
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
const char *uri = qdict_get_str(qdict, "uri");
|
const char *uri = qdict_get_str(qdict, "uri");
|
||||||
int writable = qdict_get_try_bool(qdict, "writable", 0);
|
bool writable = qdict_get_try_bool(qdict, "writable", false);
|
||||||
int all = qdict_get_try_bool(qdict, "all", 0);
|
bool all = qdict_get_try_bool(qdict, "all", false);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
BlockInfoList *block_list, *info;
|
BlockInfoList *block_list, *info;
|
||||||
SocketAddress *addr;
|
SocketAddress *addr;
|
||||||
@@ -1805,7 +1809,7 @@ exit:
|
|||||||
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict)
|
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
const char *device = qdict_get_str(qdict, "device");
|
const char *device = qdict_get_str(qdict, "device");
|
||||||
int writable = qdict_get_try_bool(qdict, "writable", 0);
|
bool writable = qdict_get_try_bool(qdict, "writable", false);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
qmp_nbd_server_add(device, true, writable, &local_err);
|
qmp_nbd_server_add(device, true, writable, &local_err);
|
||||||
@@ -1839,7 +1843,7 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict)
|
|||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
|
||||||
opts = qemu_opts_parse(qemu_find_opts("chardev"), args, 1);
|
opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args, true);
|
||||||
if (opts == NULL) {
|
if (opts == NULL) {
|
||||||
error_setg(&err, "Parsing chardev args failed");
|
error_setg(&err, "Parsing chardev args failed");
|
||||||
} else {
|
} else {
|
||||||
@@ -1867,7 +1871,8 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
|
|||||||
if (blk) {
|
if (blk) {
|
||||||
qemuio_command(blk, command);
|
qemuio_command(blk, command);
|
||||||
} else {
|
} else {
|
||||||
error_set(&err, QERR_DEVICE_NOT_FOUND, device);
|
error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", device);
|
||||||
}
|
}
|
||||||
|
|
||||||
hmp_handle_error(mon, &err);
|
hmp_handle_error(mon, &err);
|
||||||
@@ -1995,7 +2000,8 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict)
|
|||||||
|
|
||||||
obj = object_resolve_path(path, &ambiguous);
|
obj = object_resolve_path(path, &ambiguous);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
error_set(&err, QERR_DEVICE_NOT_FOUND, path);
|
error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||||
|
"Device '%s' not found", path);
|
||||||
} else {
|
} else {
|
||||||
if (ambiguous) {
|
if (ambiguous) {
|
||||||
monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
|
monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "hw/virtio/virtio.h"
|
#include "hw/virtio/virtio.h"
|
||||||
#include "hw/i386/pc.h"
|
#include "hw/i386/pc.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
#include "virtio-9p.h"
|
#include "virtio-9p.h"
|
||||||
#include "fsdev/qemu-fsdev.h"
|
#include "fsdev/qemu-fsdev.h"
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
|
|||||||
mcfg->allocation[0].end_bus_number = (memmap[VIRT_PCIE_ECAM].size
|
mcfg->allocation[0].end_bus_number = (memmap[VIRT_PCIE_ECAM].size
|
||||||
/ PCIE_MMCFG_SIZE_MIN) - 1;
|
/ PCIE_MMCFG_SIZE_MIN) - 1;
|
||||||
|
|
||||||
build_header(linker, table_data, (void *)mcfg, "MCFG", len, 5);
|
build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GTDT */
|
/* GTDT */
|
||||||
@@ -413,7 +413,7 @@ build_gtdt(GArray *table_data, GArray *linker)
|
|||||||
|
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + gtdt_start), "GTDT",
|
(void *)(table_data->data + gtdt_start), "GTDT",
|
||||||
table_data->len - gtdt_start, 5);
|
table_data->len - gtdt_start, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MADT */
|
/* MADT */
|
||||||
@@ -423,8 +423,10 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info,
|
|||||||
{
|
{
|
||||||
int madt_start = table_data->len;
|
int madt_start = table_data->len;
|
||||||
const MemMapEntry *memmap = guest_info->memmap;
|
const MemMapEntry *memmap = guest_info->memmap;
|
||||||
|
const int *irqmap = guest_info->irqmap;
|
||||||
AcpiMultipleApicTable *madt;
|
AcpiMultipleApicTable *madt;
|
||||||
AcpiMadtGenericDistributor *gicd;
|
AcpiMadtGenericDistributor *gicd;
|
||||||
|
AcpiMadtGenericMsiFrame *gic_msi;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
madt = acpi_data_push(table_data, sizeof *madt);
|
madt = acpi_data_push(table_data, sizeof *madt);
|
||||||
@@ -448,9 +450,18 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info,
|
|||||||
gicd->length = sizeof(*gicd);
|
gicd->length = sizeof(*gicd);
|
||||||
gicd->base_address = memmap[VIRT_GIC_DIST].base;
|
gicd->base_address = memmap[VIRT_GIC_DIST].base;
|
||||||
|
|
||||||
|
gic_msi = acpi_data_push(table_data, sizeof *gic_msi);
|
||||||
|
gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME;
|
||||||
|
gic_msi->length = sizeof(*gic_msi);
|
||||||
|
gic_msi->gic_msi_frame_id = 0;
|
||||||
|
gic_msi->base_address = cpu_to_le64(memmap[VIRT_GIC_V2M].base);
|
||||||
|
gic_msi->flags = cpu_to_le32(1);
|
||||||
|
gic_msi->spi_count = cpu_to_le16(NUM_GICV2M_SPIS);
|
||||||
|
gic_msi->spi_base = cpu_to_le16(irqmap[VIRT_GIC_V2M] + ARM_SPI_BASE);
|
||||||
|
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + madt_start), "APIC",
|
(void *)(table_data->data + madt_start), "APIC",
|
||||||
table_data->len - madt_start, 5);
|
table_data->len - madt_start, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FADT */
|
/* FADT */
|
||||||
@@ -507,7 +518,7 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
|
|||||||
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + table_data->len - dsdt->buf->len),
|
(void *)(table_data->data + table_data->len - dsdt->buf->len),
|
||||||
"DSDT", dsdt->buf->len, 5);
|
"DSDT", dsdt->buf->len, 2);
|
||||||
free_aml_allocator();
|
free_aml_allocator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,6 +556,7 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
|
|||||||
* FADT
|
* FADT
|
||||||
* GTDT
|
* GTDT
|
||||||
* MADT
|
* MADT
|
||||||
|
* MCFG
|
||||||
* DSDT
|
* DSDT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -552,7 +564,7 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
|
|||||||
dsdt = tables_blob->len;
|
dsdt = tables_blob->len;
|
||||||
build_dsdt(tables_blob, tables->linker, guest_info);
|
build_dsdt(tables_blob, tables->linker, guest_info);
|
||||||
|
|
||||||
/* FADT MADT GTDT SPCR pointed to by RSDT */
|
/* FADT MADT GTDT MCFG SPCR pointed to by RSDT */
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_fadt(tables_blob, tables->linker, dsdt);
|
build_fadt(tables_blob, tables->linker, dsdt);
|
||||||
|
|
||||||
|
|||||||
@@ -956,6 +956,8 @@ static void virt_class_init(ObjectClass *oc, void *data)
|
|||||||
mc->init = machvirt_init;
|
mc->init = machvirt_init;
|
||||||
mc->max_cpus = 8;
|
mc->max_cpus = 8;
|
||||||
mc->has_dynamic_sysbus = true;
|
mc->has_dynamic_sysbus = true;
|
||||||
|
mc->block_default_type = IF_VIRTIO;
|
||||||
|
mc->no_cdrom = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo machvirt_info = {
|
static const TypeInfo machvirt_info = {
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ static uint16_t nvme_dma_read_prp(NvmeCtrl *n, uint8_t *ptr, uint32_t len,
|
|||||||
qemu_sglist_destroy(&qsg);
|
qemu_sglist_destroy(&qsg);
|
||||||
return NVME_INVALID_FIELD | NVME_DNR;
|
return NVME_INVALID_FIELD | NVME_DNR;
|
||||||
}
|
}
|
||||||
|
qemu_sglist_destroy(&qsg);
|
||||||
return NVME_SUCCESS;
|
return NVME_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -499,8 +499,7 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
|
|||||||
|
|
||||||
iov_discard_front(&iov, &out_num, sizeof(req->out));
|
iov_discard_front(&iov, &out_num, sizeof(req->out));
|
||||||
|
|
||||||
if (in_num < 1 ||
|
if (in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) {
|
||||||
in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) {
|
|
||||||
error_report("virtio-blk request inhdr too short");
|
error_report("virtio-blk request inhdr too short");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -651,16 +650,21 @@ static void virtio_blk_dma_restart_cb(void *opaque, int running,
|
|||||||
static void virtio_blk_reset(VirtIODevice *vdev)
|
static void virtio_blk_reset(VirtIODevice *vdev)
|
||||||
{
|
{
|
||||||
VirtIOBlock *s = VIRTIO_BLK(vdev);
|
VirtIOBlock *s = VIRTIO_BLK(vdev);
|
||||||
|
AioContext *ctx;
|
||||||
if (s->dataplane) {
|
|
||||||
virtio_blk_data_plane_stop(s->dataplane);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This should cancel pending requests, but can't do nicely until there
|
* This should cancel pending requests, but can't do nicely until there
|
||||||
* are per-device request lists.
|
* are per-device request lists.
|
||||||
*/
|
*/
|
||||||
blk_drain_all();
|
ctx = blk_get_aio_context(s->blk);
|
||||||
|
aio_context_acquire(ctx);
|
||||||
|
blk_drain(s->blk);
|
||||||
|
|
||||||
|
if (s->dataplane) {
|
||||||
|
virtio_blk_data_plane_stop(s->dataplane);
|
||||||
|
}
|
||||||
|
aio_context_release(ctx);
|
||||||
|
|
||||||
blk_set_enable_write_cache(s->blk, s->original_wce);
|
blk_set_enable_write_cache(s->blk, s->original_wce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "hw/char/serial.h"
|
#include "hw/char/serial.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
|
|
||||||
#define PCI_SERIAL_MAX_PORTS 4
|
#define PCI_SERIAL_MAX_PORTS 4
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "qemu/iov.h"
|
#include "qemu/iov.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void nmi_monitor_handle(int cpu_index, Error **errp)
|
|||||||
if (ns.handled) {
|
if (ns.handled) {
|
||||||
error_propagate(errp, ns.errp);
|
error_propagate(errp, ns.errp);
|
||||||
} else {
|
} else {
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw/platform-bus.h"
|
#include "hw/platform-bus.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ static void get_pointer(Object *obj, Visitor *v, Property *prop,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void set_pointer(Object *obj, Visitor *v, Property *prop,
|
static void set_pointer(Object *obj, Visitor *v, Property *prop,
|
||||||
int (*parse)(DeviceState *dev, const char *str,
|
void (*parse)(DeviceState *dev, const char *str,
|
||||||
void **ptr),
|
void **ptr, const char *propname,
|
||||||
|
Error **errp),
|
||||||
const char *name, Error **errp)
|
const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
void **ptr = qdev_get_prop_ptr(dev, prop);
|
void **ptr = qdev_get_prop_ptr(dev, prop);
|
||||||
char *str;
|
char *str;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (dev->realized) {
|
if (dev->realized) {
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
qdev_prop_set_after_realize(dev, name, errp);
|
||||||
@@ -60,26 +60,38 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop,
|
|||||||
*ptr = NULL;
|
*ptr = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ret = parse(dev, str, ptr);
|
parse(dev, str, ptr, prop->name, errp);
|
||||||
error_set_from_qdev_prop_error(errp, ret, dev, prop, str);
|
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- drive --- */
|
/* --- drive --- */
|
||||||
|
|
||||||
static int parse_drive(DeviceState *dev, const char *str, void **ptr)
|
static void parse_drive(DeviceState *dev, const char *str, void **ptr,
|
||||||
|
const char *propname, Error **errp)
|
||||||
{
|
{
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
|
|
||||||
blk = blk_by_name(str);
|
blk = blk_by_name(str);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
return -ENOENT;
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||||
|
object_get_typename(OBJECT(dev)), propname, str);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (blk_attach_dev(blk, dev) < 0) {
|
if (blk_attach_dev(blk, dev) < 0) {
|
||||||
return -EEXIST;
|
DriveInfo *dinfo = blk_legacy_dinfo(blk);
|
||||||
|
|
||||||
|
if (dinfo->type != IF_NONE) {
|
||||||
|
error_setg(errp, "Drive '%s' is already in use because "
|
||||||
|
"it has been automatically connected to another "
|
||||||
|
"device (did you need 'if=none' in the drive options?)",
|
||||||
|
str);
|
||||||
|
} else {
|
||||||
|
error_setg(errp, "Drive '%s' is already in use by another device",
|
||||||
|
str);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
*ptr = blk;
|
*ptr = blk;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_drive(Object *obj, const char *name, void *opaque)
|
static void release_drive(Object *obj, const char *name, void *opaque)
|
||||||
@@ -121,17 +133,21 @@ PropertyInfo qdev_prop_drive = {
|
|||||||
|
|
||||||
/* --- character device --- */
|
/* --- character device --- */
|
||||||
|
|
||||||
static int parse_chr(DeviceState *dev, const char *str, void **ptr)
|
static void parse_chr(DeviceState *dev, const char *str, void **ptr,
|
||||||
|
const char *propname, Error **errp)
|
||||||
{
|
{
|
||||||
CharDriverState *chr = qemu_chr_find(str);
|
CharDriverState *chr = qemu_chr_find(str);
|
||||||
if (chr == NULL) {
|
if (chr == NULL) {
|
||||||
return -ENOENT;
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||||
|
object_get_typename(OBJECT(dev)), propname, str);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (qemu_chr_fe_claim(chr) != 0) {
|
if (qemu_chr_fe_claim(chr) != 0) {
|
||||||
return -EEXIST;
|
error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use",
|
||||||
|
object_get_typename(OBJECT(dev)), propname, str);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
*ptr = chr;
|
*ptr = chr;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_chr(Object *obj, const char *name, void *opaque)
|
static void release_chr(Object *obj, const char *name, void *opaque)
|
||||||
@@ -326,7 +342,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
|
|||||||
|
|
||||||
hubport = net_hub_port_find(id);
|
hubport = net_hub_port_find(id);
|
||||||
if (!hubport) {
|
if (!hubport) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||||
name, prop->info->name);
|
name, prop->info->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "hw/qdev.h"
|
#include "hw/qdev.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
#include "net/hub.h"
|
#include "net/hub.h"
|
||||||
@@ -570,8 +571,8 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
|
|||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
} else if (value < -1 || value > 255) {
|
} else if (value < -1 || value > 255) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||||
"pci_devfn");
|
name ? name : "null", "pci_devfn");
|
||||||
} else {
|
} else {
|
||||||
*ptr = value;
|
*ptr = value;
|
||||||
}
|
}
|
||||||
@@ -640,7 +641,7 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
|
|||||||
}
|
}
|
||||||
/* value of 0 means "unset" */
|
/* value of 0 means "unset" */
|
||||||
if (value && (value < min || value > max)) {
|
if (value && (value < min || value > max)) {
|
||||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||||
dev->id ? : "", name, (int64_t)value, min, max);
|
dev->id ? : "", name, (int64_t)value, min, max);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -923,7 +924,7 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
error_set(errp, QERR_PROPERTY_VALUE_BAD,
|
error_setg(errp, QERR_PROPERTY_VALUE_BAD,
|
||||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||||
break;
|
break;
|
||||||
case -ENOENT:
|
case -ENOENT:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "qapi/qmp/qjson.h"
|
#include "qapi/qmp/qjson.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "hw/hotplug.h"
|
#include "hw/hotplug.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "qapi-event.h"
|
#include "qapi-event.h"
|
||||||
@@ -276,12 +277,12 @@ void qdev_unplug(DeviceState *dev, Error **errp)
|
|||||||
HotplugHandlerClass *hdc;
|
HotplugHandlerClass *hdc;
|
||||||
|
|
||||||
if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
|
if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
|
||||||
error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dc->hotpluggable) {
|
if (!dc->hotpluggable) {
|
||||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG,
|
error_setg(errp, QERR_DEVICE_NO_HOTPLUG,
|
||||||
object_get_typename(OBJECT(dev)));
|
object_get_typename(OBJECT(dev)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1026,7 +1027,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
|||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
if (dev->hotplugged && !dc->hotpluggable) {
|
if (dev->hotplugged && !dc->hotpluggable) {
|
||||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
|
|||||||
if (fcode_filename) {
|
if (fcode_filename) {
|
||||||
ret = load_image_targphys(fcode_filename, s->prom_addr,
|
ret = load_image_targphys(fcode_filename, s->prom_addr,
|
||||||
FCODE_MAX_ROM_SIZE);
|
FCODE_MAX_ROM_SIZE);
|
||||||
|
g_free(fcode_filename);
|
||||||
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
|
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
|
||||||
error_report("cg3: could not load prom '%s'", CG3_ROM_FILE);
|
error_report("cg3: could not load prom '%s'", CG3_ROM_FILE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
#include "ui/pixel_ops.h"
|
#include "ui/pixel_ops.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qxl.h"
|
#include "qxl.h"
|
||||||
|
|
||||||
static const char *qxl_type[] = {
|
static const char *const qxl_type[] = {
|
||||||
[ QXL_CMD_NOP ] = "nop",
|
[ QXL_CMD_NOP ] = "nop",
|
||||||
[ QXL_CMD_DRAW ] = "draw",
|
[ QXL_CMD_DRAW ] = "draw",
|
||||||
[ QXL_CMD_UPDATE ] = "update",
|
[ QXL_CMD_UPDATE ] = "update",
|
||||||
@@ -31,7 +31,7 @@ static const char *qxl_type[] = {
|
|||||||
[ QXL_CMD_SURFACE ] = "surface",
|
[ QXL_CMD_SURFACE ] = "surface",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *qxl_draw_type[] = {
|
static const char *const qxl_draw_type[] = {
|
||||||
[ QXL_DRAW_NOP ] = "nop",
|
[ QXL_DRAW_NOP ] = "nop",
|
||||||
[ QXL_DRAW_FILL ] = "fill",
|
[ QXL_DRAW_FILL ] = "fill",
|
||||||
[ QXL_DRAW_OPAQUE ] = "opaque",
|
[ QXL_DRAW_OPAQUE ] = "opaque",
|
||||||
@@ -48,7 +48,7 @@ static const char *qxl_draw_type[] = {
|
|||||||
[ QXL_DRAW_ALPHA_BLEND ] = "alpha-blend",
|
[ QXL_DRAW_ALPHA_BLEND ] = "alpha-blend",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *qxl_draw_effect[] = {
|
static const char *const qxl_draw_effect[] = {
|
||||||
[ QXL_EFFECT_BLEND ] = "blend",
|
[ QXL_EFFECT_BLEND ] = "blend",
|
||||||
[ QXL_EFFECT_OPAQUE ] = "opaque",
|
[ QXL_EFFECT_OPAQUE ] = "opaque",
|
||||||
[ QXL_EFFECT_REVERT_ON_DUP ] = "revert-on-dup",
|
[ QXL_EFFECT_REVERT_ON_DUP ] = "revert-on-dup",
|
||||||
@@ -59,12 +59,12 @@ static const char *qxl_draw_effect[] = {
|
|||||||
[ QXL_EFFECT_OPAQUE_BRUSH ] = "opaque-brush",
|
[ QXL_EFFECT_OPAQUE_BRUSH ] = "opaque-brush",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *qxl_surface_cmd[] = {
|
static const char *const qxl_surface_cmd[] = {
|
||||||
[ QXL_SURFACE_CMD_CREATE ] = "create",
|
[ QXL_SURFACE_CMD_CREATE ] = "create",
|
||||||
[ QXL_SURFACE_CMD_DESTROY ] = "destroy",
|
[ QXL_SURFACE_CMD_DESTROY ] = "destroy",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *spice_surface_fmt[] = {
|
static const char *const spice_surface_fmt[] = {
|
||||||
[ SPICE_SURFACE_FMT_INVALID ] = "invalid",
|
[ SPICE_SURFACE_FMT_INVALID ] = "invalid",
|
||||||
[ SPICE_SURFACE_FMT_1_A ] = "alpha/1",
|
[ SPICE_SURFACE_FMT_1_A ] = "alpha/1",
|
||||||
[ SPICE_SURFACE_FMT_8_A ] = "alpha/8",
|
[ SPICE_SURFACE_FMT_8_A ] = "alpha/8",
|
||||||
@@ -74,14 +74,14 @@ static const char *spice_surface_fmt[] = {
|
|||||||
[ SPICE_SURFACE_FMT_32_ARGB ] = "ARGB/32",
|
[ SPICE_SURFACE_FMT_32_ARGB ] = "ARGB/32",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *qxl_cursor_cmd[] = {
|
static const char *const qxl_cursor_cmd[] = {
|
||||||
[ QXL_CURSOR_SET ] = "set",
|
[ QXL_CURSOR_SET ] = "set",
|
||||||
[ QXL_CURSOR_MOVE ] = "move",
|
[ QXL_CURSOR_MOVE ] = "move",
|
||||||
[ QXL_CURSOR_HIDE ] = "hide",
|
[ QXL_CURSOR_HIDE ] = "hide",
|
||||||
[ QXL_CURSOR_TRAIL ] = "trail",
|
[ QXL_CURSOR_TRAIL ] = "trail",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *spice_cursor_type[] = {
|
static const char *const spice_cursor_type[] = {
|
||||||
[ SPICE_CURSOR_TYPE_ALPHA ] = "alpha",
|
[ SPICE_CURSOR_TYPE_ALPHA ] = "alpha",
|
||||||
[ SPICE_CURSOR_TYPE_MONO ] = "mono",
|
[ SPICE_CURSOR_TYPE_MONO ] = "mono",
|
||||||
[ SPICE_CURSOR_TYPE_COLOR4 ] = "color4",
|
[ SPICE_CURSOR_TYPE_COLOR4 ] = "color4",
|
||||||
@@ -91,7 +91,7 @@ static const char *spice_cursor_type[] = {
|
|||||||
[ SPICE_CURSOR_TYPE_COLOR32 ] = "color32",
|
[ SPICE_CURSOR_TYPE_COLOR32 ] = "color32",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *qxl_v2n(const char *n[], size_t l, int v)
|
static const char *qxl_v2n(const char *const n[], size_t l, int v)
|
||||||
{
|
{
|
||||||
if (v >= l || !n[v]) {
|
if (v >= l || !n[v]) {
|
||||||
return "???";
|
return "???";
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/atomic.h"
|
#include "qemu/atomic.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "ui/pixel_ops.h"
|
#include "ui/pixel_ops.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
|
|
||||||
#define TCX_ROM_FILE "QEMU,tcx.bin"
|
#define TCX_ROM_FILE "QEMU,tcx.bin"
|
||||||
#define FCODE_MAX_ROM_SIZE 0x10000
|
#define FCODE_MAX_ROM_SIZE 0x10000
|
||||||
@@ -1017,6 +1018,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)
|
|||||||
if (fcode_filename) {
|
if (fcode_filename) {
|
||||||
ret = load_image_targphys(fcode_filename, s->prom_addr,
|
ret = load_image_targphys(fcode_filename, s->prom_addr,
|
||||||
FCODE_MAX_ROM_SIZE);
|
FCODE_MAX_ROM_SIZE);
|
||||||
|
g_free(fcode_filename);
|
||||||
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
|
if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
|
||||||
error_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
|
error_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "hw/ptimer.h"
|
#include "hw/ptimer.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
|
|
||||||
#include "hw/stream.h"
|
#include "hw/stream.h"
|
||||||
|
|||||||
@@ -141,6 +141,9 @@ typedef struct AssignedDevice {
|
|||||||
int32_t bootindex;
|
int32_t bootindex;
|
||||||
} AssignedDevice;
|
} AssignedDevice;
|
||||||
|
|
||||||
|
#define TYPE_PCI_ASSIGN "kvm-pci-assign"
|
||||||
|
#define PCI_ASSIGN(obj) OBJECT_CHECK(AssignedDevice, (obj), TYPE_PCI_ASSIGN)
|
||||||
|
|
||||||
static void assigned_dev_update_irq_routing(PCIDevice *dev);
|
static void assigned_dev_update_irq_routing(PCIDevice *dev);
|
||||||
|
|
||||||
static void assigned_dev_load_option_rom(AssignedDevice *dev);
|
static void assigned_dev_load_option_rom(AssignedDevice *dev);
|
||||||
@@ -257,7 +260,7 @@ static const MemoryRegionOps slow_bar_ops = {
|
|||||||
static void assigned_dev_iomem_setup(PCIDevice *pci_dev, int region_num,
|
static void assigned_dev_iomem_setup(PCIDevice *pci_dev, int region_num,
|
||||||
pcibus_t e_size)
|
pcibus_t e_size)
|
||||||
{
|
{
|
||||||
AssignedDevice *r_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *r_dev = PCI_ASSIGN(pci_dev);
|
||||||
AssignedDevRegion *region = &r_dev->v_addrs[region_num];
|
AssignedDevRegion *region = &r_dev->v_addrs[region_num];
|
||||||
PCIRegion *real_region = &r_dev->real_device.regions[region_num];
|
PCIRegion *real_region = &r_dev->real_device.regions[region_num];
|
||||||
|
|
||||||
@@ -289,7 +292,7 @@ static const MemoryRegionOps assigned_dev_ioport_ops = {
|
|||||||
static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num,
|
static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num,
|
||||||
pcibus_t size)
|
pcibus_t size)
|
||||||
{
|
{
|
||||||
AssignedDevice *r_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *r_dev = PCI_ASSIGN(pci_dev);
|
||||||
AssignedDevRegion *region = &r_dev->v_addrs[region_num];
|
AssignedDevRegion *region = &r_dev->v_addrs[region_num];
|
||||||
|
|
||||||
region->e_size = size;
|
region->e_size = size;
|
||||||
@@ -303,7 +306,7 @@ static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num,
|
|||||||
|
|
||||||
static uint32_t assigned_dev_pci_read(PCIDevice *d, int pos, int len)
|
static uint32_t assigned_dev_pci_read(PCIDevice *d, int pos, int len)
|
||||||
{
|
{
|
||||||
AssignedDevice *pci_dev = DO_UPCAST(AssignedDevice, dev, d);
|
AssignedDevice *pci_dev = PCI_ASSIGN(d);
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
int fd = pci_dev->real_device.config_fd;
|
int fd = pci_dev->real_device.config_fd;
|
||||||
@@ -328,7 +331,7 @@ static uint8_t assigned_dev_pci_read_byte(PCIDevice *d, int pos)
|
|||||||
|
|
||||||
static void assigned_dev_pci_write(PCIDevice *d, int pos, uint32_t val, int len)
|
static void assigned_dev_pci_write(PCIDevice *d, int pos, uint32_t val, int len)
|
||||||
{
|
{
|
||||||
AssignedDevice *pci_dev = DO_UPCAST(AssignedDevice, dev, d);
|
AssignedDevice *pci_dev = PCI_ASSIGN(d);
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
int fd = pci_dev->real_device.config_fd;
|
int fd = pci_dev->real_device.config_fd;
|
||||||
|
|
||||||
@@ -946,7 +949,7 @@ static void deassign_device(AssignedDevice *dev)
|
|||||||
*/
|
*/
|
||||||
static void assigned_dev_update_irq_routing(PCIDevice *dev)
|
static void assigned_dev_update_irq_routing(PCIDevice *dev)
|
||||||
{
|
{
|
||||||
AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, dev);
|
AssignedDevice *assigned_dev = PCI_ASSIGN(dev);
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -961,7 +964,7 @@ static void assigned_dev_update_irq_routing(PCIDevice *dev)
|
|||||||
|
|
||||||
static void assigned_dev_update_msi(PCIDevice *pci_dev)
|
static void assigned_dev_update_msi(PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev);
|
||||||
uint8_t ctrl_byte = pci_get_byte(pci_dev->config + pci_dev->msi_cap +
|
uint8_t ctrl_byte = pci_get_byte(pci_dev->config + pci_dev->msi_cap +
|
||||||
PCI_MSI_FLAGS);
|
PCI_MSI_FLAGS);
|
||||||
int r;
|
int r;
|
||||||
@@ -1015,7 +1018,7 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev)
|
|||||||
|
|
||||||
static void assigned_dev_update_msi_msg(PCIDevice *pci_dev)
|
static void assigned_dev_update_msi_msg(PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev);
|
||||||
uint8_t ctrl_byte = pci_get_byte(pci_dev->config + pci_dev->msi_cap +
|
uint8_t ctrl_byte = pci_get_byte(pci_dev->config + pci_dev->msi_cap +
|
||||||
PCI_MSI_FLAGS);
|
PCI_MSI_FLAGS);
|
||||||
|
|
||||||
@@ -1048,7 +1051,7 @@ static bool assigned_dev_msix_skipped(MSIXTableEntry *entry)
|
|||||||
|
|
||||||
static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
|
static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *adev = PCI_ASSIGN(pci_dev);
|
||||||
uint16_t entries_nr = 0;
|
uint16_t entries_nr = 0;
|
||||||
int i, r = 0;
|
int i, r = 0;
|
||||||
MSIXTableEntry *entry = adev->msix_table;
|
MSIXTableEntry *entry = adev->msix_table;
|
||||||
@@ -1113,7 +1116,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
|
|||||||
|
|
||||||
static void assigned_dev_update_msix(PCIDevice *pci_dev)
|
static void assigned_dev_update_msix(PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev);
|
||||||
uint16_t ctrl_word = pci_get_word(pci_dev->config + pci_dev->msix_cap +
|
uint16_t ctrl_word = pci_get_word(pci_dev->config + pci_dev->msix_cap +
|
||||||
PCI_MSIX_FLAGS);
|
PCI_MSIX_FLAGS);
|
||||||
int r;
|
int r;
|
||||||
@@ -1163,7 +1166,7 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev)
|
|||||||
static uint32_t assigned_dev_pci_read_config(PCIDevice *pci_dev,
|
static uint32_t assigned_dev_pci_read_config(PCIDevice *pci_dev,
|
||||||
uint32_t address, int len)
|
uint32_t address, int len)
|
||||||
{
|
{
|
||||||
AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev);
|
||||||
uint32_t virt_val = pci_default_read_config(pci_dev, address, len);
|
uint32_t virt_val = pci_default_read_config(pci_dev, address, len);
|
||||||
uint32_t real_val, emulate_mask, full_emulation_mask;
|
uint32_t real_val, emulate_mask, full_emulation_mask;
|
||||||
|
|
||||||
@@ -1184,7 +1187,7 @@ static uint32_t assigned_dev_pci_read_config(PCIDevice *pci_dev,
|
|||||||
static void assigned_dev_pci_write_config(PCIDevice *pci_dev, uint32_t address,
|
static void assigned_dev_pci_write_config(PCIDevice *pci_dev, uint32_t address,
|
||||||
uint32_t val, int len)
|
uint32_t val, int len)
|
||||||
{
|
{
|
||||||
AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *assigned_dev = PCI_ASSIGN(pci_dev);
|
||||||
uint16_t old_cmd = pci_get_word(pci_dev->config + PCI_COMMAND);
|
uint16_t old_cmd = pci_get_word(pci_dev->config + PCI_COMMAND);
|
||||||
uint32_t emulate_mask, full_emulation_mask;
|
uint32_t emulate_mask, full_emulation_mask;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -1244,7 +1247,7 @@ static void assigned_dev_setup_cap_read(AssignedDevice *dev, uint32_t offset,
|
|||||||
|
|
||||||
static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
|
static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
|
||||||
{
|
{
|
||||||
AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *dev = PCI_ASSIGN(pci_dev);
|
||||||
PCIRegion *pci_region = dev->real_device.regions;
|
PCIRegion *pci_region = dev->real_device.regions;
|
||||||
int ret, pos;
|
int ret, pos;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
@@ -1684,8 +1687,8 @@ static const VMStateDescription vmstate_assigned_device = {
|
|||||||
|
|
||||||
static void reset_assigned_device(DeviceState *dev)
|
static void reset_assigned_device(DeviceState *dev)
|
||||||
{
|
{
|
||||||
PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
|
PCIDevice *pci_dev = PCI_DEVICE(dev);
|
||||||
AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *adev = PCI_ASSIGN(pci_dev);
|
||||||
char reset_file[64];
|
char reset_file[64];
|
||||||
const char reset[] = "1";
|
const char reset[] = "1";
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
@@ -1740,7 +1743,7 @@ static void reset_assigned_device(DeviceState *dev)
|
|||||||
|
|
||||||
static void assigned_realize(struct PCIDevice *pci_dev, Error **errp)
|
static void assigned_realize(struct PCIDevice *pci_dev, Error **errp)
|
||||||
{
|
{
|
||||||
AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *dev = PCI_ASSIGN(pci_dev);
|
||||||
uint8_t e_intx;
|
uint8_t e_intx;
|
||||||
int r;
|
int r;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
@@ -1836,7 +1839,7 @@ exit_with_error:
|
|||||||
|
|
||||||
static void assigned_exitfn(struct PCIDevice *pci_dev)
|
static void assigned_exitfn(struct PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
|
AssignedDevice *dev = PCI_ASSIGN(pci_dev);
|
||||||
|
|
||||||
deassign_device(dev);
|
deassign_device(dev);
|
||||||
free_assigned_device(dev);
|
free_assigned_device(dev);
|
||||||
@@ -1845,7 +1848,7 @@ static void assigned_exitfn(struct PCIDevice *pci_dev)
|
|||||||
static void assigned_dev_instance_init(Object *obj)
|
static void assigned_dev_instance_init(Object *obj)
|
||||||
{
|
{
|
||||||
PCIDevice *pci_dev = PCI_DEVICE(obj);
|
PCIDevice *pci_dev = PCI_DEVICE(obj);
|
||||||
AssignedDevice *d = DO_UPCAST(AssignedDevice, dev, PCI_DEVICE(obj));
|
AssignedDevice *d = PCI_ASSIGN(pci_dev);
|
||||||
|
|
||||||
device_add_bootindex_property(obj, &d->bootindex,
|
device_add_bootindex_property(obj, &d->bootindex,
|
||||||
"bootindex", NULL,
|
"bootindex", NULL,
|
||||||
@@ -1879,7 +1882,7 @@ static void assign_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo assign_info = {
|
static const TypeInfo assign_info = {
|
||||||
.name = "kvm-pci-assign",
|
.name = TYPE_PCI_ASSIGN,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(AssignedDevice),
|
.instance_size = sizeof(AssignedDevice),
|
||||||
.class_init = assign_class_init,
|
.class_init = assign_class_init,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include "hw/ide.h"
|
#include "hw/ide.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "hw/nvram/fw_cfg.h"
|
#include "hw/nvram/fw_cfg.h"
|
||||||
#include "hw/timer/hpet.h"
|
#include "hw/timer/hpet.h"
|
||||||
#include "hw/i386/smbios.h"
|
#include "hw/i386/smbios.h"
|
||||||
@@ -57,6 +56,7 @@
|
|||||||
#include "sysemu/arch_init.h"
|
#include "sysemu/arch_init.h"
|
||||||
#include "qemu/bitmap.h"
|
#include "qemu/bitmap.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "hw/acpi/acpi.h"
|
#include "hw/acpi/acpi.h"
|
||||||
#include "hw/acpi/cpu_hotplug.h"
|
#include "hw/acpi/cpu_hotplug.h"
|
||||||
#include "hw/cpu/icc_bus.h"
|
#include "hw/cpu/icc_bus.h"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <hw/pci/pci.h>
|
#include <hw/pci/pci.h>
|
||||||
#include <hw/sysbus.h>
|
#include <hw/sysbus.h>
|
||||||
|
|
||||||
#include "monitor/monitor.h"
|
#include "qemu/error-report.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ common-obj-$(CONFIG_VMMOUSE) += vmmouse.o
|
|||||||
ifeq ($(CONFIG_LINUX),y)
|
ifeq ($(CONFIG_LINUX),y)
|
||||||
common-obj-$(CONFIG_VIRTIO) += virtio-input.o
|
common-obj-$(CONFIG_VIRTIO) += virtio-input.o
|
||||||
common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
|
common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
|
||||||
|
common-obj-$(CONFIG_VIRTIO) += virtio-input-host.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
|
obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
|
||||||
|
|||||||
@@ -252,7 +252,11 @@ static void virtio_input_handle_sync(DeviceState *dev)
|
|||||||
static void virtio_input_hid_realize(DeviceState *dev, Error **errp)
|
static void virtio_input_hid_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev);
|
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev);
|
||||||
|
|
||||||
vhid->hs = qemu_input_handler_register(dev, vhid->handler);
|
vhid->hs = qemu_input_handler_register(dev, vhid->handler);
|
||||||
|
if (vhid->display && vhid->hs) {
|
||||||
|
qemu_input_handler_bind(vhid->hs, vhid->display, vhid->head, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_input_hid_unrealize(DeviceState *dev, Error **errp)
|
static void virtio_input_hid_unrealize(DeviceState *dev, Error **errp)
|
||||||
@@ -301,10 +305,17 @@ static void virtio_input_hid_handle_status(VirtIOInput *vinput,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Property virtio_input_hid_properties[] = {
|
||||||
|
DEFINE_PROP_STRING("display", VirtIOInputHID, display),
|
||||||
|
DEFINE_PROP_UINT32("head", VirtIOInputHID, head, 0),
|
||||||
|
};
|
||||||
|
|
||||||
static void virtio_input_hid_class_init(ObjectClass *klass, void *data)
|
static void virtio_input_hid_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass);
|
VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass);
|
||||||
|
|
||||||
|
dc->props = virtio_input_hid_properties;
|
||||||
vic->realize = virtio_input_hid_realize;
|
vic->realize = virtio_input_hid_realize;
|
||||||
vic->unrealize = virtio_input_hid_unrealize;
|
vic->unrealize = virtio_input_hid_unrealize;
|
||||||
vic->change_active = virtio_input_hid_change_active;
|
vic->change_active = virtio_input_hid_change_active;
|
||||||
|
|||||||
188
hw/input/virtio-input-host.c
Normal file
188
hw/input/virtio-input-host.c
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
/*
|
||||||
|
* This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
|
* (at your option) any later version. See the COPYING file in the
|
||||||
|
* top-level directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/sockets.h"
|
||||||
|
|
||||||
|
#include "hw/qdev.h"
|
||||||
|
#include "hw/virtio/virtio.h"
|
||||||
|
#include "hw/virtio/virtio-input.h"
|
||||||
|
|
||||||
|
#include "standard-headers/linux/input.h"
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static struct virtio_input_config virtio_input_host_config[] = {
|
||||||
|
{ /* empty list */ },
|
||||||
|
};
|
||||||
|
|
||||||
|
static void virtio_input_host_event(void *opaque)
|
||||||
|
{
|
||||||
|
VirtIOInputHost *vih = opaque;
|
||||||
|
VirtIOInput *vinput = VIRTIO_INPUT(vih);
|
||||||
|
struct virtio_input_event virtio;
|
||||||
|
struct input_event evdev;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
rc = read(vih->fd, &evdev, sizeof(evdev));
|
||||||
|
if (rc != sizeof(evdev)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtio.type = cpu_to_le16(evdev.type);
|
||||||
|
virtio.code = cpu_to_le16(evdev.code);
|
||||||
|
virtio.value = cpu_to_le32(evdev.value);
|
||||||
|
virtio_input_send(vinput, &virtio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void virtio_input_bits_config(VirtIOInputHost *vih,
|
||||||
|
int type, int count)
|
||||||
|
{
|
||||||
|
virtio_input_config bits;
|
||||||
|
int rc, i, size = 0;
|
||||||
|
|
||||||
|
memset(&bits, 0, sizeof(bits));
|
||||||
|
rc = ioctl(vih->fd, EVIOCGBIT(type, count/8), bits.u.bitmap);
|
||||||
|
if (rc < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < count/8; i++) {
|
||||||
|
if (bits.u.bitmap[i]) {
|
||||||
|
size = i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (size == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bits.select = VIRTIO_INPUT_CFG_EV_BITS;
|
||||||
|
bits.subsel = type;
|
||||||
|
bits.size = size;
|
||||||
|
virtio_input_add_config(VIRTIO_INPUT(vih), &bits);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void virtio_input_host_realize(DeviceState *dev, Error **errp)
|
||||||
|
{
|
||||||
|
VirtIOInputHost *vih = VIRTIO_INPUT_HOST(dev);
|
||||||
|
VirtIOInput *vinput = VIRTIO_INPUT(dev);
|
||||||
|
virtio_input_config id;
|
||||||
|
struct input_id ids;
|
||||||
|
int rc, ver;
|
||||||
|
|
||||||
|
if (!vih->evdev) {
|
||||||
|
error_setg(errp, "evdev property is required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vih->fd = open(vih->evdev, O_RDWR);
|
||||||
|
if (vih->fd < 0) {
|
||||||
|
error_setg_file_open(errp, errno, vih->evdev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qemu_set_nonblock(vih->fd);
|
||||||
|
|
||||||
|
rc = ioctl(vih->fd, EVIOCGVERSION, &ver);
|
||||||
|
if (rc < 0) {
|
||||||
|
error_setg(errp, "%s: is not an evdev device", vih->evdev);
|
||||||
|
goto err_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = ioctl(vih->fd, EVIOCGRAB, 1);
|
||||||
|
if (rc < 0) {
|
||||||
|
error_setg_errno(errp, errno, "%s: failed to get exclusive access",
|
||||||
|
vih->evdev);
|
||||||
|
goto err_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&id, 0, sizeof(id));
|
||||||
|
ioctl(vih->fd, EVIOCGNAME(sizeof(id.u.string)-1), id.u.string);
|
||||||
|
id.select = VIRTIO_INPUT_CFG_ID_NAME;
|
||||||
|
id.size = strlen(id.u.string);
|
||||||
|
virtio_input_add_config(vinput, &id);
|
||||||
|
|
||||||
|
if (ioctl(vih->fd, EVIOCGID, &ids) == 0) {
|
||||||
|
memset(&id, 0, sizeof(id));
|
||||||
|
id.select = VIRTIO_INPUT_CFG_ID_DEVIDS;
|
||||||
|
id.size = sizeof(struct virtio_input_devids);
|
||||||
|
id.u.ids.bustype = cpu_to_le16(ids.bustype);
|
||||||
|
id.u.ids.vendor = cpu_to_le16(ids.vendor);
|
||||||
|
id.u.ids.product = cpu_to_le16(ids.product);
|
||||||
|
id.u.ids.version = cpu_to_le16(ids.version);
|
||||||
|
virtio_input_add_config(vinput, &id);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtio_input_bits_config(vih, EV_KEY, KEY_CNT);
|
||||||
|
virtio_input_bits_config(vih, EV_REL, REL_CNT);
|
||||||
|
virtio_input_bits_config(vih, EV_ABS, ABS_CNT);
|
||||||
|
virtio_input_bits_config(vih, EV_MSC, MSC_CNT);
|
||||||
|
virtio_input_bits_config(vih, EV_SW, SW_CNT);
|
||||||
|
|
||||||
|
qemu_set_fd_handler(vih->fd, virtio_input_host_event, NULL, vih);
|
||||||
|
return;
|
||||||
|
|
||||||
|
err_close:
|
||||||
|
close(vih->fd);
|
||||||
|
vih->fd = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void virtio_input_host_unrealize(DeviceState *dev, Error **errp)
|
||||||
|
{
|
||||||
|
VirtIOInputHost *vih = VIRTIO_INPUT_HOST(dev);
|
||||||
|
|
||||||
|
if (vih->fd > 0) {
|
||||||
|
qemu_set_fd_handler(vih->fd, NULL, NULL, NULL);
|
||||||
|
close(vih->fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const VMStateDescription vmstate_virtio_input_host = {
|
||||||
|
.name = "virtio-input-host",
|
||||||
|
.unmigratable = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static Property virtio_input_host_properties[] = {
|
||||||
|
DEFINE_PROP_STRING("evdev", VirtIOInputHost, evdev),
|
||||||
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
|
static void virtio_input_host_class_init(ObjectClass *klass, void *data)
|
||||||
|
{
|
||||||
|
VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass);
|
||||||
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
dc->vmsd = &vmstate_virtio_input_host;
|
||||||
|
dc->props = virtio_input_host_properties;
|
||||||
|
vic->realize = virtio_input_host_realize;
|
||||||
|
vic->unrealize = virtio_input_host_unrealize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void virtio_input_host_init(Object *obj)
|
||||||
|
{
|
||||||
|
VirtIOInput *vinput = VIRTIO_INPUT(obj);
|
||||||
|
|
||||||
|
virtio_input_init_config(vinput, virtio_input_host_config);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo virtio_input_host_info = {
|
||||||
|
.name = TYPE_VIRTIO_INPUT_HOST,
|
||||||
|
.parent = TYPE_VIRTIO_INPUT,
|
||||||
|
.instance_size = sizeof(VirtIOInputHost),
|
||||||
|
.instance_init = virtio_input_host_init,
|
||||||
|
.class_init = virtio_input_host_class_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static void virtio_register_types(void)
|
||||||
|
{
|
||||||
|
type_register_static(&virtio_input_host_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
type_init(virtio_register_types)
|
||||||
@@ -216,7 +216,7 @@ static void virtio_input_device_realize(DeviceState *dev, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtio_input_idstr_config(vinput, VIRTIO_INPUT_CFG_ID_SERIAL,
|
virtio_input_idstr_config(vinput, VIRTIO_INPUT_CFG_ID_SERIAL,
|
||||||
vinput->input.serial);
|
vinput->serial);
|
||||||
|
|
||||||
QTAILQ_FOREACH(cfg, &vinput->cfg_list, node) {
|
QTAILQ_FOREACH(cfg, &vinput->cfg_list, node) {
|
||||||
if (vinput->cfg_size < cfg->config.size) {
|
if (vinput->cfg_size < cfg->config.size) {
|
||||||
@@ -248,11 +248,17 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
|
|||||||
virtio_cleanup(vdev);
|
virtio_cleanup(vdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Property virtio_input_properties[] = {
|
||||||
|
DEFINE_PROP_STRING("serial", VirtIOInput, serial),
|
||||||
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
static void virtio_input_class_init(ObjectClass *klass, void *data)
|
static void virtio_input_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
dc->props = virtio_input_properties;
|
||||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||||
vdc->realize = virtio_input_device_realize;
|
vdc->realize = virtio_input_device_realize;
|
||||||
vdc->unrealize = virtio_input_device_unrealize;
|
vdc->unrealize = virtio_input_device_unrealize;
|
||||||
|
|||||||
@@ -1556,7 +1556,7 @@ static void openpic_realize(DeviceState *dev, Error **errp)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (opp->nb_cpus > MAX_CPU) {
|
if (opp->nb_cpus > MAX_CPU) {
|
||||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||||
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
||||||
(uint64_t)0, (uint64_t)MAX_CPU);
|
(uint64_t)0, (uint64_t)MAX_CPU);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ typedef struct PIIX4State {
|
|||||||
PCIDevice dev;
|
PCIDevice dev;
|
||||||
} PIIX4State;
|
} PIIX4State;
|
||||||
|
|
||||||
|
#define TYPE_PIIX4_PCI_DEVICE "PIIX4"
|
||||||
|
#define PIIX4_PCI_DEVICE(obj) \
|
||||||
|
OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE)
|
||||||
|
|
||||||
static void piix4_reset(void *opaque)
|
static void piix4_reset(void *opaque)
|
||||||
{
|
{
|
||||||
PIIX4State *d = opaque;
|
PIIX4State *d = opaque;
|
||||||
@@ -84,7 +88,7 @@ static const VMStateDescription vmstate_piix4 = {
|
|||||||
|
|
||||||
static void piix4_realize(PCIDevice *dev, Error **errp)
|
static void piix4_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev);
|
PIIX4State *d = PIIX4_PCI_DEVICE(dev);
|
||||||
|
|
||||||
isa_bus_new(DEVICE(d), pci_address_space(dev),
|
isa_bus_new(DEVICE(d), pci_address_space(dev),
|
||||||
pci_address_space_io(dev));
|
pci_address_space_io(dev));
|
||||||
@@ -121,7 +125,7 @@ static void piix4_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo piix4_info = {
|
static const TypeInfo piix4_info = {
|
||||||
.name = "PIIX4",
|
.name = TYPE_PIIX4_PCI_DEVICE,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(PIIX4State),
|
.instance_size = sizeof(PIIX4State),
|
||||||
.class_init = piix4_class_init,
|
.class_init = piix4_class_init,
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ typedef struct VT82C686BState {
|
|||||||
SuperIOConfig superio_conf;
|
SuperIOConfig superio_conf;
|
||||||
} VT82C686BState;
|
} VT82C686BState;
|
||||||
|
|
||||||
|
#define TYPE_VT82C686B_DEVICE "VT82C686B"
|
||||||
|
#define VT82C686B_DEVICE(obj) \
|
||||||
|
OBJECT_CHECK(VT82C686BState, (obj), TYPE_VT82C686B_DEVICE)
|
||||||
|
|
||||||
static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
|
static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
|
||||||
unsigned size)
|
unsigned size)
|
||||||
{
|
{
|
||||||
@@ -114,7 +118,7 @@ static void vt82c686b_reset(void * opaque)
|
|||||||
{
|
{
|
||||||
PCIDevice *d = opaque;
|
PCIDevice *d = opaque;
|
||||||
uint8_t *pci_conf = d->config;
|
uint8_t *pci_conf = d->config;
|
||||||
VT82C686BState *vt82c = DO_UPCAST(VT82C686BState, dev, d);
|
VT82C686BState *vt82c = VT82C686B_DEVICE(d);
|
||||||
|
|
||||||
pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
|
pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);
|
||||||
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
|
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
|
||||||
@@ -142,7 +146,7 @@ static void vt82c686b_reset(void * opaque)
|
|||||||
static void vt82c686b_write_config(PCIDevice * d, uint32_t address,
|
static void vt82c686b_write_config(PCIDevice * d, uint32_t address,
|
||||||
uint32_t val, int len)
|
uint32_t val, int len)
|
||||||
{
|
{
|
||||||
VT82C686BState *vt686 = DO_UPCAST(VT82C686BState, dev, d);
|
VT82C686BState *vt686 = VT82C686B_DEVICE(d);
|
||||||
|
|
||||||
DPRINTF("vt82c686b_write_config address 0x%x val 0x%x len 0x%x\n",
|
DPRINTF("vt82c686b_write_config address 0x%x val 0x%x len 0x%x\n",
|
||||||
address, val, len);
|
address, val, len);
|
||||||
@@ -172,6 +176,18 @@ typedef struct VT686MC97State {
|
|||||||
PCIDevice dev;
|
PCIDevice dev;
|
||||||
} VT686MC97State;
|
} VT686MC97State;
|
||||||
|
|
||||||
|
#define TYPE_VT82C686B_PM_DEVICE "VT82C686B_PM"
|
||||||
|
#define VT82C686B_PM_DEVICE(obj) \
|
||||||
|
OBJECT_CHECK(VT686PMState, (obj), TYPE_VT82C686B_PM_DEVICE)
|
||||||
|
|
||||||
|
#define TYPE_VT82C686B_MC97_DEVICE "VT82C686B_MC97"
|
||||||
|
#define VT82C686B_MC97_DEVICE(obj) \
|
||||||
|
OBJECT_CHECK(VT686MC97State, (obj), TYPE_VT82C686B_MC97_DEVICE)
|
||||||
|
|
||||||
|
#define TYPE_VT82C686B_AC97_DEVICE "VT82C686B_AC97"
|
||||||
|
#define VT82C686B_AC97_DEVICE(obj) \
|
||||||
|
OBJECT_CHECK(VT686AC97State, (obj), TYPE_VT82C686B_AC97_DEVICE)
|
||||||
|
|
||||||
static void pm_update_sci(VT686PMState *s)
|
static void pm_update_sci(VT686PMState *s)
|
||||||
{
|
{
|
||||||
int sci_level, pmsts;
|
int sci_level, pmsts;
|
||||||
@@ -247,7 +263,7 @@ static const VMStateDescription vmstate_acpi = {
|
|||||||
|
|
||||||
static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp)
|
static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VT686AC97State *s = DO_UPCAST(VT686AC97State, dev, dev);
|
VT686AC97State *s = VT82C686B_AC97_DEVICE(dev);
|
||||||
uint8_t *pci_conf = s->dev.config;
|
uint8_t *pci_conf = s->dev.config;
|
||||||
|
|
||||||
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE |
|
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE |
|
||||||
@@ -261,7 +277,7 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn)
|
|||||||
{
|
{
|
||||||
PCIDevice *dev;
|
PCIDevice *dev;
|
||||||
|
|
||||||
dev = pci_create(bus, devfn, "VT82C686B_AC97");
|
dev = pci_create(bus, devfn, TYPE_VT82C686B_AC97_DEVICE);
|
||||||
qdev_init_nofail(&dev->qdev);
|
qdev_init_nofail(&dev->qdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +296,7 @@ static void via_ac97_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo via_ac97_info = {
|
static const TypeInfo via_ac97_info = {
|
||||||
.name = "VT82C686B_AC97",
|
.name = TYPE_VT82C686B_AC97_DEVICE,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(VT686AC97State),
|
.instance_size = sizeof(VT686AC97State),
|
||||||
.class_init = via_ac97_class_init,
|
.class_init = via_ac97_class_init,
|
||||||
@@ -288,7 +304,7 @@ static const TypeInfo via_ac97_info = {
|
|||||||
|
|
||||||
static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp)
|
static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VT686MC97State *s = DO_UPCAST(VT686MC97State, dev, dev);
|
VT686MC97State *s = VT82C686B_MC97_DEVICE(dev);
|
||||||
uint8_t *pci_conf = s->dev.config;
|
uint8_t *pci_conf = s->dev.config;
|
||||||
|
|
||||||
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE |
|
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE |
|
||||||
@@ -301,7 +317,7 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn)
|
|||||||
{
|
{
|
||||||
PCIDevice *dev;
|
PCIDevice *dev;
|
||||||
|
|
||||||
dev = pci_create(bus, devfn, "VT82C686B_MC97");
|
dev = pci_create(bus, devfn, TYPE_VT82C686B_MC97_DEVICE);
|
||||||
qdev_init_nofail(&dev->qdev);
|
qdev_init_nofail(&dev->qdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +336,7 @@ static void via_mc97_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo via_mc97_info = {
|
static const TypeInfo via_mc97_info = {
|
||||||
.name = "VT82C686B_MC97",
|
.name = TYPE_VT82C686B_MC97_DEVICE,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(VT686MC97State),
|
.instance_size = sizeof(VT686MC97State),
|
||||||
.class_init = via_mc97_class_init,
|
.class_init = via_mc97_class_init,
|
||||||
@@ -329,7 +345,7 @@ static const TypeInfo via_mc97_info = {
|
|||||||
/* vt82c686 pm init */
|
/* vt82c686 pm init */
|
||||||
static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp)
|
static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VT686PMState *s = DO_UPCAST(VT686PMState, dev, dev);
|
VT686PMState *s = VT82C686B_PM_DEVICE(dev);
|
||||||
uint8_t *pci_conf;
|
uint8_t *pci_conf;
|
||||||
|
|
||||||
pci_conf = s->dev.config;
|
pci_conf = s->dev.config;
|
||||||
@@ -365,10 +381,10 @@ I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
|||||||
PCIDevice *dev;
|
PCIDevice *dev;
|
||||||
VT686PMState *s;
|
VT686PMState *s;
|
||||||
|
|
||||||
dev = pci_create(bus, devfn, "VT82C686B_PM");
|
dev = pci_create(bus, devfn, TYPE_VT82C686B_PM_DEVICE);
|
||||||
qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base);
|
qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base);
|
||||||
|
|
||||||
s = DO_UPCAST(VT686PMState, dev, dev);
|
s = VT82C686B_PM_DEVICE(dev);
|
||||||
|
|
||||||
qdev_init_nofail(&dev->qdev);
|
qdev_init_nofail(&dev->qdev);
|
||||||
|
|
||||||
@@ -398,7 +414,7 @@ static void via_pm_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo via_pm_info = {
|
static const TypeInfo via_pm_info = {
|
||||||
.name = "VT82C686B_PM",
|
.name = TYPE_VT82C686B_PM_DEVICE,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(VT686PMState),
|
.instance_size = sizeof(VT686PMState),
|
||||||
.class_init = via_pm_class_init,
|
.class_init = via_pm_class_init,
|
||||||
@@ -417,7 +433,7 @@ static const VMStateDescription vmstate_via = {
|
|||||||
/* init the PCI-to-ISA bridge */
|
/* init the PCI-to-ISA bridge */
|
||||||
static void vt82c686b_realize(PCIDevice *d, Error **errp)
|
static void vt82c686b_realize(PCIDevice *d, Error **errp)
|
||||||
{
|
{
|
||||||
VT82C686BState *vt82c = DO_UPCAST(VT82C686BState, dev, d);
|
VT82C686BState *vt82c = VT82C686B_DEVICE(d);
|
||||||
uint8_t *pci_conf;
|
uint8_t *pci_conf;
|
||||||
ISABus *isa_bus;
|
ISABus *isa_bus;
|
||||||
uint8_t *wmask;
|
uint8_t *wmask;
|
||||||
@@ -451,7 +467,8 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn)
|
|||||||
{
|
{
|
||||||
PCIDevice *d;
|
PCIDevice *d;
|
||||||
|
|
||||||
d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B");
|
d = pci_create_simple_multifunction(bus, devfn, true,
|
||||||
|
TYPE_VT82C686B_DEVICE);
|
||||||
|
|
||||||
return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0"));
|
return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0"));
|
||||||
}
|
}
|
||||||
@@ -477,7 +494,7 @@ static void via_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo via_info = {
|
static const TypeInfo via_info = {
|
||||||
.name = "VT82C686B",
|
.name = TYPE_VT82C686B_DEVICE,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(VT82C686BState),
|
.instance_size = sizeof(VT82C686BState),
|
||||||
.class_init = via_class_init,
|
.class_init = via_class_init,
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "hw/empty_slot.h"
|
#include "hw/empty_slot.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
|
#include "exec/semihost.h"
|
||||||
|
|
||||||
//#define DEBUG_BOARD_INIT
|
//#define DEBUG_BOARD_INIT
|
||||||
|
|
||||||
@@ -634,7 +635,13 @@ static void write_bootloader (CPUMIPSState *env, uint8_t *base,
|
|||||||
|
|
||||||
/* Second part of the bootloader */
|
/* Second part of the bootloader */
|
||||||
p = (uint32_t *) (base + 0x580);
|
p = (uint32_t *) (base + 0x580);
|
||||||
|
|
||||||
|
if (semihosting_get_argc()) {
|
||||||
|
/* Preserve a0 content as arguments have been passed */
|
||||||
|
stl_p(p++, 0x00000000); /* nop */
|
||||||
|
} else {
|
||||||
stl_p(p++, 0x24040002); /* addiu a0, zero, 2 */
|
stl_p(p++, 0x24040002); /* addiu a0, zero, 2 */
|
||||||
|
}
|
||||||
stl_p(p++, 0x3c1d0000 | (((ENVP_ADDR - 64) >> 16) & 0xffff)); /* lui sp, high(ENVP_ADDR) */
|
stl_p(p++, 0x3c1d0000 | (((ENVP_ADDR - 64) >> 16) & 0xffff)); /* lui sp, high(ENVP_ADDR) */
|
||||||
stl_p(p++, 0x37bd0000 | ((ENVP_ADDR - 64) & 0xffff)); /* ori sp, sp, low(ENVP_ADDR) */
|
stl_p(p++, 0x37bd0000 | ((ENVP_ADDR - 64) & 0xffff)); /* ori sp, sp, low(ENVP_ADDR) */
|
||||||
stl_p(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */
|
stl_p(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */
|
||||||
@@ -887,7 +894,7 @@ static void main_cpu_reset(void *opaque)
|
|||||||
read only location. The kernel location and the arguments table
|
read only location. The kernel location and the arguments table
|
||||||
location does not change. */
|
location does not change. */
|
||||||
if (loaderparams.kernel_filename) {
|
if (loaderparams.kernel_filename) {
|
||||||
env->CP0_Status &= ~((1 << CP0St_BEV) | (1 << CP0St_ERL));
|
env->CP0_Status &= ~(1 << CP0St_ERL);
|
||||||
}
|
}
|
||||||
|
|
||||||
malta_mips_config(cpu);
|
malta_mips_config(cpu);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
#include "migration/migration.h"
|
#include "migration/migration.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/event_notifier.h"
|
#include "qemu/event_notifier.h"
|
||||||
#include "qemu/fifo8.h"
|
#include "qemu/fifo8.h"
|
||||||
#include "sysemu/char.h"
|
#include "sysemu/char.h"
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
|
RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
RockerPortList *qmp_query_rocker_ports(const char *name, Error **errp)
|
RockerPortList *qmp_query_rocker_ports(const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ RockerOfDpaFlowList *qmp_query_rocker_of_dpa_flows(const char *name,
|
|||||||
uint32_t tbl_id,
|
uint32_t tbl_id,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,6 +45,6 @@ RockerOfDpaGroupList *qmp_query_rocker_of_dpa_groups(const char *name,
|
|||||||
uint8_t type,
|
uint8_t type,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "net/checksum.h"
|
#include "net/checksum.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
|
|
||||||
#include "hw/stream.h"
|
#include "hw/stream.h"
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,10 @@ typedef struct PIIX3State {
|
|||||||
MemoryRegion rcr_mem;
|
MemoryRegion rcr_mem;
|
||||||
} PIIX3State;
|
} PIIX3State;
|
||||||
|
|
||||||
|
#define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
|
||||||
|
#define PIIX3_PCI_DEVICE(obj) \
|
||||||
|
OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
|
||||||
|
|
||||||
#define TYPE_I440FX_PCI_DEVICE "i440FX"
|
#define TYPE_I440FX_PCI_DEVICE "i440FX"
|
||||||
#define I440FX_PCI_DEVICE(obj) \
|
#define I440FX_PCI_DEVICE(obj) \
|
||||||
OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
|
OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
|
||||||
@@ -368,13 +372,15 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
|
|||||||
* connected to the IOAPIC directly.
|
* connected to the IOAPIC directly.
|
||||||
* These additional routes can be discovered through ACPI. */
|
* These additional routes can be discovered through ACPI. */
|
||||||
if (xen_enabled()) {
|
if (xen_enabled()) {
|
||||||
piix3 = DO_UPCAST(PIIX3State, dev,
|
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
|
||||||
pci_create_simple_multifunction(b, -1, true, "PIIX3-xen"));
|
-1, true, "PIIX3-xen");
|
||||||
|
piix3 = PIIX3_PCI_DEVICE(pci_dev);
|
||||||
pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
|
pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
|
||||||
piix3, XEN_PIIX_NUM_PIRQS);
|
piix3, XEN_PIIX_NUM_PIRQS);
|
||||||
} else {
|
} else {
|
||||||
piix3 = DO_UPCAST(PIIX3State, dev,
|
PCIDevice *pci_dev = pci_create_simple_multifunction(b,
|
||||||
pci_create_simple_multifunction(b, -1, true, "PIIX3"));
|
-1, true, "PIIX3");
|
||||||
|
piix3 = PIIX3_PCI_DEVICE(pci_dev);
|
||||||
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
|
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
|
||||||
PIIX_NUM_PIRQS);
|
PIIX_NUM_PIRQS);
|
||||||
pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
|
pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
|
||||||
@@ -480,7 +486,7 @@ static void piix3_write_config(PCIDevice *dev,
|
|||||||
{
|
{
|
||||||
pci_default_write_config(dev, address, val, len);
|
pci_default_write_config(dev, address, val, len);
|
||||||
if (ranges_overlap(address, len, PIIX_PIRQC, 4)) {
|
if (ranges_overlap(address, len, PIIX_PIRQC, 4)) {
|
||||||
PIIX3State *piix3 = DO_UPCAST(PIIX3State, dev, dev);
|
PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev);
|
||||||
int pic_irq;
|
int pic_irq;
|
||||||
|
|
||||||
pci_bus_fire_intx_routing_notifier(piix3->dev.bus);
|
pci_bus_fire_intx_routing_notifier(piix3->dev.bus);
|
||||||
@@ -634,7 +640,7 @@ static const MemoryRegionOps rcr_ops = {
|
|||||||
|
|
||||||
static void piix3_realize(PCIDevice *dev, Error **errp)
|
static void piix3_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
|
PIIX3State *d = PIIX3_PCI_DEVICE(dev);
|
||||||
|
|
||||||
isa_bus_new(DEVICE(d), get_system_memory(),
|
isa_bus_new(DEVICE(d), get_system_memory(),
|
||||||
pci_address_space_io(dev));
|
pci_address_space_io(dev));
|
||||||
@@ -647,7 +653,7 @@ static void piix3_realize(PCIDevice *dev, Error **errp)
|
|||||||
qemu_register_reset(piix3_reset, d);
|
qemu_register_reset(piix3_reset, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void piix3_class_init(ObjectClass *klass, void *data)
|
static void pci_piix3_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||||
@@ -656,7 +662,6 @@ static void piix3_class_init(ObjectClass *klass, void *data)
|
|||||||
dc->vmsd = &vmstate_piix3;
|
dc->vmsd = &vmstate_piix3;
|
||||||
dc->hotpluggable = false;
|
dc->hotpluggable = false;
|
||||||
k->realize = piix3_realize;
|
k->realize = piix3_realize;
|
||||||
k->config_write = piix3_write_config;
|
|
||||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
||||||
/* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
|
/* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
|
||||||
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0;
|
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0;
|
||||||
@@ -668,38 +673,37 @@ static void piix3_class_init(ObjectClass *klass, void *data)
|
|||||||
dc->cannot_instantiate_with_device_add_yet = true;
|
dc->cannot_instantiate_with_device_add_yet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo piix3_info = {
|
static const TypeInfo piix3_pci_type_info = {
|
||||||
.name = "PIIX3",
|
.name = TYPE_PIIX3_PCI_DEVICE,
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PCI_DEVICE,
|
||||||
.instance_size = sizeof(PIIX3State),
|
.instance_size = sizeof(PIIX3State),
|
||||||
|
.abstract = true,
|
||||||
|
.class_init = pci_piix3_class_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void piix3_class_init(ObjectClass *klass, void *data)
|
||||||
|
{
|
||||||
|
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
k->config_write = piix3_write_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo piix3_info = {
|
||||||
|
.name = "PIIX3",
|
||||||
|
.parent = TYPE_PIIX3_PCI_DEVICE,
|
||||||
.class_init = piix3_class_init,
|
.class_init = piix3_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void piix3_xen_class_init(ObjectClass *klass, void *data)
|
static void piix3_xen_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
||||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->desc = "ISA bridge";
|
|
||||||
dc->vmsd = &vmstate_piix3;
|
|
||||||
dc->hotpluggable = false;
|
|
||||||
k->realize = piix3_realize;
|
|
||||||
k->config_write = piix3_write_config_xen;
|
k->config_write = piix3_write_config_xen;
|
||||||
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
|
||||||
/* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
|
|
||||||
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0;
|
|
||||||
k->class_id = PCI_CLASS_BRIDGE_ISA;
|
|
||||||
/*
|
|
||||||
* Reason: part of PIIX3 southbridge, needs to be wired up by
|
|
||||||
* pc_piix.c's pc_init1()
|
|
||||||
*/
|
|
||||||
dc->cannot_instantiate_with_device_add_yet = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TypeInfo piix3_xen_info = {
|
static const TypeInfo piix3_xen_info = {
|
||||||
.name = "PIIX3-xen",
|
.name = "PIIX3-xen",
|
||||||
.parent = TYPE_PCI_DEVICE,
|
.parent = TYPE_PIIX3_PCI_DEVICE,
|
||||||
.instance_size = sizeof(PIIX3State),
|
|
||||||
.class_init = piix3_xen_class_init,
|
.class_init = piix3_xen_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -772,6 +776,7 @@ static const TypeInfo i440fx_pcihost_info = {
|
|||||||
static void i440fx_register_types(void)
|
static void i440fx_register_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&i440fx_info);
|
type_register_static(&i440fx_info);
|
||||||
|
type_register_static(&piix3_pci_type_info);
|
||||||
type_register_static(&piix3_info);
|
type_register_static(&piix3_info);
|
||||||
type_register_static(&piix3_xen_info);
|
type_register_static(&piix3_xen_info);
|
||||||
type_register_static(&i440fx_pcihost_info);
|
type_register_static(&i440fx_pcihost_info);
|
||||||
|
|||||||
@@ -20,12 +20,13 @@
|
|||||||
|
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
|
|
||||||
PciInfoList *qmp_query_pci(Error **errp)
|
PciInfoList *qmp_query_pci(Error **errp)
|
||||||
{
|
{
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/range.h"
|
#include "qemu/range.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
@@ -427,6 +428,10 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
|
|||||||
for (i = 0; i < size; ++i) {
|
for (i = 0; i < size; ++i) {
|
||||||
if ((config[i] ^ s->config[i]) &
|
if ((config[i] ^ s->config[i]) &
|
||||||
s->cmask[i] & ~s->wmask[i] & ~s->w1cmask[i]) {
|
s->cmask[i] & ~s->wmask[i] & ~s->w1cmask[i]) {
|
||||||
|
error_report("%s: Bad config data: i=0x%x read: %x device: %x "
|
||||||
|
"cmask: %x wmask: %x w1cmask:%x", __func__,
|
||||||
|
i, config[i], s->config[i],
|
||||||
|
s->cmask[i], s->wmask[i], s->w1cmask[i]);
|
||||||
g_free(config);
|
g_free(config);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
#include "hw/pci/pcie_regs.h"
|
#include "hw/pci/pcie_regs.h"
|
||||||
#include "qemu/range.h"
|
#include "qemu/range.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
|
|
||||||
//#define DEBUG_PCIE
|
//#define DEBUG_PCIE
|
||||||
#ifdef DEBUG_PCIE
|
#ifdef DEBUG_PCIE
|
||||||
|
|||||||
@@ -975,7 +975,7 @@ static int do_pcie_aer_inject_error(Monitor *mon,
|
|||||||
if (pcie_aer_parse_error_string(error_name, &error_status, &correctable)) {
|
if (pcie_aer_parse_error_string(error_name, &error_status, &correctable)) {
|
||||||
char *e = NULL;
|
char *e = NULL;
|
||||||
error_status = strtoul(error_name, &e, 0);
|
error_status = strtoul(error_name, &e, 0);
|
||||||
correctable = qdict_get_try_bool(qdict, "correctable", 0);
|
correctable = qdict_get_try_bool(qdict, "correctable", false);
|
||||||
if (!e || *e != '\0') {
|
if (!e || *e != '\0') {
|
||||||
monitor_printf(mon, "invalid error status value. \"%s\"",
|
monitor_printf(mon, "invalid error status value. \"%s\"",
|
||||||
error_name);
|
error_name);
|
||||||
@@ -989,7 +989,7 @@ static int do_pcie_aer_inject_error(Monitor *mon,
|
|||||||
if (correctable) {
|
if (correctable) {
|
||||||
err.flags |= PCIE_AER_ERR_IS_CORRECTABLE;
|
err.flags |= PCIE_AER_ERR_IS_CORRECTABLE;
|
||||||
}
|
}
|
||||||
if (qdict_get_try_bool(qdict, "advisory_non_fatal", 0)) {
|
if (qdict_get_try_bool(qdict, "advisory_non_fatal", false)) {
|
||||||
err.flags |= PCIE_AER_ERR_MAYBE_ADVISORY;
|
err.flags |= PCIE_AER_ERR_MAYBE_ADVISORY;
|
||||||
}
|
}
|
||||||
if (qdict_haskey(qdict, "header0")) {
|
if (qdict_haskey(qdict, "header0")) {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
#include "hw/pci/msi.h"
|
#include "hw/pci/msi.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
|
|
||||||
/* TODO: model power only and disabled slot states. */
|
/* TODO: model power only and disabled slot states. */
|
||||||
/* TODO: handle SERR and wakeups */
|
/* TODO: handle SERR and wakeups */
|
||||||
|
|||||||
@@ -51,8 +51,6 @@
|
|||||||
# define LOG_TB(...) do { } while (0)
|
# define LOG_TB(...) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000LL
|
|
||||||
|
|
||||||
static void cpu_ppc_tb_stop (CPUPPCState *env);
|
static void cpu_ppc_tb_stop (CPUPPCState *env);
|
||||||
static void cpu_ppc_tb_start (CPUPPCState *env);
|
static void cpu_ppc_tb_start (CPUPPCState *env);
|
||||||
|
|
||||||
|
|||||||
@@ -1062,7 +1062,7 @@ static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler,
|
|||||||
* we need to let them know it's not enabled
|
* we need to let them know it's not enabled
|
||||||
*/
|
*/
|
||||||
if (plugged_dev->hotplugged) {
|
if (plugged_dev->hotplugged) {
|
||||||
error_set(errp, QERR_BUS_NO_HOTPLUG,
|
error_setg(errp, QERR_BUS_NO_HOTPLUG,
|
||||||
object_get_typename(OBJECT(phb)));
|
object_get_typename(OBJECT(phb)));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -1090,7 +1090,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
|
|||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
if (!phb->dr_enabled) {
|
if (!phb->dr_enabled) {
|
||||||
error_set(errp, QERR_BUS_NO_HOTPLUG,
|
error_setg(errp, QERR_BUS_NO_HOTPLUG,
|
||||||
object_get_typename(OBJECT(phb)));
|
object_get_typename(OBJECT(phb)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "qemu/timer.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/ppc/spapr.h"
|
#include "hw/ppc/spapr.h"
|
||||||
#include "qapi-event.h"
|
#include "qapi-event.h"
|
||||||
@@ -40,8 +41,6 @@ struct sPAPRRTCState {
|
|||||||
int64_t ns_offset;
|
int64_t ns_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000LL
|
|
||||||
|
|
||||||
void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns)
|
void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns)
|
||||||
{
|
{
|
||||||
sPAPRRTCState *rtc = SPAPR_RTC(dev);
|
sPAPRRTCState *rtc = SPAPR_RTC(dev);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "sysemu/device_tree.h"
|
#include "sysemu/device_tree.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
|
|
||||||
@@ -40,7 +41,6 @@
|
|||||||
#include "ppc405.h"
|
#include "ppc405.h"
|
||||||
|
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
|
||||||
|
|
||||||
#define EPAPR_MAGIC (0x45504150)
|
#define EPAPR_MAGIC (0x45504150)
|
||||||
#define FLASH_SIZE (16 * 1024 * 1024)
|
#define FLASH_SIZE (16 * 1024 * 1024)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
|
||||||
#include "hw/s390x/sclp.h"
|
#include "hw/s390x/sclp.h"
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "hw/virtio/virtio.h"
|
#include "hw/virtio/virtio.h"
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/virtio/virtio.h"
|
#include "hw/virtio/virtio.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
@@ -324,7 +324,7 @@ void s390_nmi(NMIState *n, int cpu_index, Error **errp)
|
|||||||
CPUState *cs = qemu_get_cpu(cpu_index);
|
CPUState *cs = qemu_get_cpu(cpu_index);
|
||||||
|
|
||||||
if (s390_cpu_restart(S390_CPU(cs))) {
|
if (s390_cpu_restart(S390_CPU(cs))) {
|
||||||
error_set(errp, QERR_UNSUPPORTED);
|
error_setg(errp, QERR_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "hw/virtio/virtio.h"
|
#include "hw/virtio/virtio.h"
|
||||||
#include "hw/virtio/virtio-serial.h"
|
#include "hw/virtio/virtio-serial.h"
|
||||||
#include "hw/virtio/virtio-net.h"
|
#include "hw/virtio/virtio-net.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/bitops.h"
|
#include "qemu/bitops.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "hw/virtio/virtio-bus.h"
|
#include "hw/virtio/virtio-bus.h"
|
||||||
#include "hw/s390x/adapter.h"
|
#include "hw/s390x/adapter.h"
|
||||||
#include "hw/s390x/s390_flic.h"
|
#include "hw/s390x/s390_flic.h"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "migration/migration.h"
|
#include "migration/migration.h"
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/i386/pc.h"
|
#include "hw/i386/pc.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "hw/timer/hpet.h"
|
#include "hw/timer/hpet.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
# define DPRINTF_C(format, ...) do { } while (0)
|
# define DPRINTF_C(format, ...) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000LL
|
|
||||||
#define SEC_PER_MIN 60
|
#define SEC_PER_MIN 60
|
||||||
#define MIN_PER_HOUR 60
|
#define MIN_PER_HOUR 60
|
||||||
#define SEC_PER_HOUR 3600
|
#define SEC_PER_HOUR 3600
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
#include "sysemu/tpm_backend.h"
|
#include "sysemu/tpm_backend.h"
|
||||||
#include "tpm_int.h"
|
#include "tpm_int.h"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/usb.h"
|
#include "hw/usb.h"
|
||||||
#include "hw/qdev.h"
|
#include "hw/qdev.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "qemu/thread.h"
|
#include "qemu/thread.h"
|
||||||
#include "sysemu/char.h"
|
#include "sysemu/char.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "ccid.h"
|
#include "ccid.h"
|
||||||
|
|
||||||
#define DPRINTF(card, lvl, fmt, ...) \
|
#define DPRINTF(card, lvl, fmt, ...) \
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sysemu/char.h"
|
#include "sysemu/char.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
#include "monitor/monitor.h"
|
|
||||||
#include "ccid.h"
|
#include "ccid.h"
|
||||||
#include "libcacard/vscard_common.h"
|
#include "libcacard/vscard_common.h"
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user