Compare commits
119 Commits
master
...
stable-2.0
Author | SHA1 | Date |
---|---|---|
Michael Roth | f053f6b83d | |
Luiz Capitulino | 3d79eb5b30 | |
Luiz Capitulino | 6ec48b09b7 | |
Michael Roth | 543347215c | |
Kevin Wolf | 3c548f6700 | |
Fam Zheng | d0d83e8fe7 | |
Jeff Cody | 98103fa736 | |
Fam Zheng | e5f0eb06a8 | |
Fam Zheng | 43ac708d4c | |
Fam Zheng | 8e09e2013d | |
Fam Zheng | 520b341264 | |
Peter Maydell | e0efb023c0 | |
Peter Maydell | d56b0b85c8 | |
Laszlo Ersek | 750f169519 | |
Chen Gang | 046e357379 | |
KONRAD Frederic | b1251db258 | |
Jason J. Herne | 29cffd368a | |
Stefano Stabellini | 5a782bbcae | |
Paolo Bonzini | ad0d183175 | |
Le Tan | 210ec8f757 | |
Dr. David Alan Gilbert | 55103ab3b4 | |
Michael S. Tsirkin | 3bb84a6c98 | |
Michael S. Tsirkin | 48935f029f | |
Andreas Färber | 3477445077 | |
Andreas Färber | 7be09afb61 | |
Don Slutz | cab7dfcb06 | |
Gabriel L. Somlo | b5706a74b1 | |
Hani Benhabiles | 41971817a6 | |
Hani Benhabiles | 3f977a5be8 | |
Hani Benhabiles | 80cfe4a43f | |
Hani Benhabiles | 01083f16de | |
Alexander Graf | 9221efd775 | |
Cédric Le Goater | 4ce91be0c3 | |
Eduardo Habkost | b2f0e9240b | |
Eduardo Habkost | f9ac1dc507 | |
Max Filippov | a1d82075ab | |
Peter Maydell | e4b3a2b349 | |
Eduardo Habkost | 84461c74b7 | |
Alexander Graf | 552e70d844 | |
Hani Benhabiles | 6ef0b7a992 | |
Ming Lei | aa69eda237 | |
Michael S. Tsirkin | 8dedaf0f70 | |
Ulrich Obergfell | eb3eb3dd36 | |
Paolo Bonzini | 88efef64db | |
Paolo Bonzini | ab139bf9d2 | |
Markus Armbruster | d728dafe5a | |
Michael R. Hines | 0f00455b4c | |
Peter Lieven | 6ea6bd5d75 | |
Chen Gang | 86cfc10440 | |
ChenLiang | fe7e98c46e | |
Gonglei | ba980a52d6 | |
Stefan Hajnoczi | df54f5efed | |
Cornelia Huck | 0d38666664 | |
Peter Maydell | 27fb65dd1b | |
Richard Henderson | 6ea80edc01 | |
Peter Maydell | f99329cd82 | |
Markus Armbruster | 207f61dc28 | |
Markus Armbruster | d1567e2980 | |
Markus Armbruster | 5e3322eec3 | |
Markus Armbruster | 5a0913f782 | |
Markus Armbruster | 40a3fb54b2 | |
Markus Armbruster | 98646a11d0 | |
Markus Armbruster | 53bdfb5b62 | |
Markus Armbruster | a3e3f0964d | |
Markus Armbruster | 7812cbe580 | |
Markus Armbruster | 12d5fc6ab4 | |
Andrew Oates | b203bba0ce | |
Stefan Weil | 91148decd2 | |
Max Filippov | ae2e18e0ca | |
Markus Armbruster | 2dbd09ff5c | |
Kevin Wolf | 3d5acbeb71 | |
Kevin Wolf | a4b73ed3f3 | |
Kevin Wolf | a3967c74de | |
Kevin Wolf | 5c85998739 | |
Kevin Wolf | d234c8f1f6 | |
Michael S. Tsirkin | 3ba1e617e7 | |
Michael S. Tsirkin | 96e7f7a911 | |
Peter Lieven | c230ab2ba2 | |
Michael Tokarev | 274c96e4e1 | |
Alexey Kardashevskiy | 32c113c182 | |
Peter Maydell | 912d9cc089 | |
Peter Maydell | 074f673a9a | |
Peter Maydell | 83b1dc162c | |
Edgar E. Iglesias | c2d37222ae | |
Edgar E. Iglesias | e40585f8f1 | |
Amos Kong | 837e02ef07 | |
Paolo Bonzini | 46a1b0e489 | |
Christian Borntraeger | a14d42919f | |
Michael S. Tsirkin | 2ac9549453 | |
Michael S. Tsirkin | 2f18e44b0c | |
Michael Tokarev | 4c1e06408d | |
David Hildenbrand | 4a7a497509 | |
Benoît Canet | 7dfa87e9cb | |
Peter Crosthwaite | 7b0387ad90 | |
Hannes Reinecke | 1624861997 | |
Alex Bennée | fb039011ff | |
Michael S. Tsirkin | 5ad12b3235 | |
Michael S. Tsirkin | 15c35dfd92 | |
Michael S. Tsirkin | e7ff13929f | |
Michael S. Tsirkin | 894f179e8d | |
Michael S. Tsirkin | 2265c71b35 | |
Michael S. Tsirkin | 95d9149ed3 | |
Michael S. Tsirkin | eb55958e18 | |
Michael Roth | 1124696193 | |
Michael S. Tsirkin | 4e48018ae9 | |
Michael Roth | 7297dba271 | |
Michael S. Tsirkin | 9c01a91c7b | |
Michael S. Tsirkin | 7cf5f5d087 | |
Michael S. Tsirkin | f7ef3baa49 | |
Michael S. Tsirkin | 3c6066172f | |
Michael S. Tsirkin | d4c9095900 | |
Michael S. Tsirkin | 331c549b2d | |
Michael S. Tsirkin | b24cfb0f1e | |
Michael S. Tsirkin | 7872f3e77e | |
Michael S. Tsirkin | 390252193c | |
Michael S. Tsirkin | 49e8918a4d | |
Michael S. Tsirkin | 6067df7a5d | |
Peter Maydell | 9ee8ab5503 | |
Peter Maydell | c8723d46c1 |
106
arch_init.c
106
arch_init.c
|
@ -992,70 +992,68 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|||
{
|
||||
ram_addr_t addr;
|
||||
int flags, ret = 0;
|
||||
int error;
|
||||
static uint64_t seq_iter;
|
||||
|
||||
seq_iter++;
|
||||
|
||||
if (version_id < 4 || version_id > 4) {
|
||||
return -EINVAL;
|
||||
if (version_id != 4) {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
do {
|
||||
while (!ret) {
|
||||
addr = qemu_get_be64(f);
|
||||
|
||||
flags = addr & ~TARGET_PAGE_MASK;
|
||||
addr &= TARGET_PAGE_MASK;
|
||||
|
||||
if (flags & RAM_SAVE_FLAG_MEM_SIZE) {
|
||||
if (version_id == 4) {
|
||||
/* Synchronize RAM block list */
|
||||
char id[256];
|
||||
ram_addr_t length;
|
||||
ram_addr_t total_ram_bytes = addr;
|
||||
/* Synchronize RAM block list */
|
||||
char id[256];
|
||||
ram_addr_t length;
|
||||
ram_addr_t total_ram_bytes = addr;
|
||||
|
||||
while (total_ram_bytes) {
|
||||
RAMBlock *block;
|
||||
uint8_t len;
|
||||
while (total_ram_bytes) {
|
||||
RAMBlock *block;
|
||||
uint8_t len;
|
||||
|
||||
len = qemu_get_byte(f);
|
||||
qemu_get_buffer(f, (uint8_t *)id, len);
|
||||
id[len] = 0;
|
||||
length = qemu_get_be64(f);
|
||||
len = qemu_get_byte(f);
|
||||
qemu_get_buffer(f, (uint8_t *)id, len);
|
||||
id[len] = 0;
|
||||
length = qemu_get_be64(f);
|
||||
|
||||
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
|
||||
if (!strncmp(id, block->idstr, sizeof(id))) {
|
||||
if (block->length != length) {
|
||||
fprintf(stderr,
|
||||
"Length mismatch: %s: " RAM_ADDR_FMT
|
||||
" in != " RAM_ADDR_FMT "\n", id, length,
|
||||
block->length);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
|
||||
if (!strncmp(id, block->idstr, sizeof(id))) {
|
||||
if (block->length != length) {
|
||||
fprintf(stderr,
|
||||
"Length mismatch: %s: " RAM_ADDR_FMT
|
||||
" in != " RAM_ADDR_FMT "\n", id, length,
|
||||
block->length);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!block) {
|
||||
fprintf(stderr, "Unknown ramblock \"%s\", cannot "
|
||||
"accept migration\n", id);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
total_ram_bytes -= length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & RAM_SAVE_FLAG_COMPRESS) {
|
||||
if (!block) {
|
||||
fprintf(stderr, "Unknown ramblock \"%s\", cannot "
|
||||
"accept migration\n", id);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
if (ret) {
|
||||
break;
|
||||
}
|
||||
|
||||
total_ram_bytes -= length;
|
||||
}
|
||||
} else if (flags & RAM_SAVE_FLAG_COMPRESS) {
|
||||
void *host;
|
||||
uint8_t ch;
|
||||
|
||||
host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
return -EINVAL;
|
||||
error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
ch = qemu_get_byte(f);
|
||||
|
@ -1065,31 +1063,39 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|||
|
||||
host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
return -EINVAL;
|
||||
error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
|
||||
} else if (flags & RAM_SAVE_FLAG_XBZRLE) {
|
||||
void *host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
return -EINVAL;
|
||||
error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (load_xbzrle(f, addr, host) < 0) {
|
||||
error_report("Failed to decompress XBZRLE page at "
|
||||
RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
} else if (flags & RAM_SAVE_FLAG_HOOK) {
|
||||
ram_control_load_hook(f, flags);
|
||||
} else if (flags & RAM_SAVE_FLAG_EOS) {
|
||||
/* normal exit */
|
||||
break;
|
||||
} else {
|
||||
error_report("Unknown migration flags: %#x", flags);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
error = qemu_file_get_error(f);
|
||||
if (error) {
|
||||
ret = error;
|
||||
goto done;
|
||||
}
|
||||
} while (!(flags & RAM_SAVE_FLAG_EOS));
|
||||
ret = qemu_file_get_error(f);
|
||||
}
|
||||
|
||||
done:
|
||||
DPRINTF("Completed load of VM with exit code %d seq iteration "
|
||||
"%" PRIu64 "\n", ret, seq_iter);
|
||||
return ret;
|
||||
|
|
14
async.c
14
async.c
|
@ -117,15 +117,21 @@ void qemu_bh_schedule_idle(QEMUBH *bh)
|
|||
|
||||
void qemu_bh_schedule(QEMUBH *bh)
|
||||
{
|
||||
AioContext *ctx;
|
||||
|
||||
if (bh->scheduled)
|
||||
return;
|
||||
ctx = bh->ctx;
|
||||
bh->idle = 0;
|
||||
/* Make sure that idle & any writes needed by the callback are done
|
||||
* before the locations are read in the aio_bh_poll.
|
||||
/* Make sure that:
|
||||
* 1. idle & any writes needed by the callback are done before the
|
||||
* locations are read in the aio_bh_poll.
|
||||
* 2. ctx is loaded before scheduled is set and the callback has a chance
|
||||
* to execute.
|
||||
*/
|
||||
smp_wmb();
|
||||
smp_mb();
|
||||
bh->scheduled = 1;
|
||||
aio_notify(bh->ctx);
|
||||
aio_notify(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
|
34
block.c
34
block.c
|
@ -1058,14 +1058,14 @@ fail:
|
|||
*/
|
||||
int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
||||
{
|
||||
char backing_filename[PATH_MAX];
|
||||
int back_flags, ret;
|
||||
char *backing_filename = g_malloc0(PATH_MAX);
|
||||
int back_flags, ret = 0;
|
||||
BlockDriver *back_drv = NULL;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (bs->backing_hd != NULL) {
|
||||
QDECREF(options);
|
||||
return 0;
|
||||
goto free_exit;
|
||||
}
|
||||
|
||||
/* NULL means an empty set of options */
|
||||
|
@ -1078,10 +1078,9 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
|||
backing_filename[0] = '\0';
|
||||
} else if (bs->backing_file[0] == '\0' && qdict_size(options) == 0) {
|
||||
QDECREF(options);
|
||||
return 0;
|
||||
goto free_exit;
|
||||
} else {
|
||||
bdrv_get_full_backing_filename(bs, backing_filename,
|
||||
sizeof(backing_filename));
|
||||
bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX);
|
||||
}
|
||||
|
||||
if (bs->backing_format[0] != '\0') {
|
||||
|
@ -1102,7 +1101,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
|||
error_setg(errp, "Could not open backing file: %s",
|
||||
error_get_pretty(local_err));
|
||||
error_free(local_err);
|
||||
return ret;
|
||||
goto free_exit;
|
||||
}
|
||||
|
||||
if (bs->backing_hd->file) {
|
||||
|
@ -1113,7 +1112,9 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
|||
/* Recalculate the BlockLimits with the backing file */
|
||||
bdrv_refresh_limits(bs);
|
||||
|
||||
return 0;
|
||||
free_exit:
|
||||
g_free(backing_filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1157,6 +1158,7 @@ int bdrv_open_image(BlockDriverState **pbs, const char *filename,
|
|||
bdref_key);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
QDECREF(image_options);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -1170,8 +1172,7 @@ done:
|
|||
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
/* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
|
||||
char tmp_filename[PATH_MAX + 1];
|
||||
|
||||
char *tmp_filename = g_malloc0(PATH_MAX + 1);
|
||||
int64_t total_size;
|
||||
BlockDriver *bdrv_qcow2;
|
||||
QEMUOptionParameter *create_options;
|
||||
|
@ -1187,15 +1188,15 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
|||
total_size = bdrv_getlength(bs);
|
||||
if (total_size < 0) {
|
||||
error_setg_errno(errp, -total_size, "Could not get image size");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
total_size &= BDRV_SECTOR_MASK;
|
||||
|
||||
/* Create the temporary image */
|
||||
ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
|
||||
ret = get_tmp_filename(tmp_filename, PATH_MAX + 1);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not get temporary filename");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
bdrv_qcow2 = bdrv_find_format("qcow2");
|
||||
|
@ -1211,7 +1212,7 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
|||
"'%s': %s", tmp_filename,
|
||||
error_get_pretty(local_err));
|
||||
error_free(local_err);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Prepare a new options QDict for the temporary file */
|
||||
|
@ -1228,10 +1229,13 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
|||
bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err);
|
||||
if (ret < 0) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
bdrv_append(bs_snapshot, bs);
|
||||
|
||||
out:
|
||||
g_free(tmp_filename);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -259,9 +259,11 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
|
|||
next_sector = sector_num;
|
||||
while (nb_chunks-- > 0) {
|
||||
MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free);
|
||||
size_t remaining = (nb_sectors * BDRV_SECTOR_SIZE) - op->qiov.size;
|
||||
|
||||
QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next);
|
||||
s->buf_free_count--;
|
||||
qemu_iovec_add(&op->qiov, buf, s->granularity);
|
||||
qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining));
|
||||
|
||||
/* Advance the HBitmapIter in parallel, so that we do not examine
|
||||
* the same sector twice.
|
||||
|
@ -324,9 +326,18 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
}
|
||||
|
||||
s->common.len = bdrv_getlength(bs);
|
||||
if (s->common.len <= 0) {
|
||||
block_job_completed(&s->common, s->common.len);
|
||||
return;
|
||||
if (s->common.len < 0) {
|
||||
ret = s->common.len;
|
||||
goto immediate_exit;
|
||||
} else if (s->common.len == 0) {
|
||||
/* Report BLOCK_JOB_READY and wait for complete. */
|
||||
block_job_ready(&s->common);
|
||||
s->synced = true;
|
||||
while (!block_job_is_cancelled(&s->common) && !s->should_complete) {
|
||||
block_job_yield(&s->common);
|
||||
}
|
||||
s->common.cancelled = false;
|
||||
goto immediate_exit;
|
||||
}
|
||||
|
||||
length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
|
||||
|
|
|
@ -474,6 +474,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
|
|||
case QTYPE_QERROR: {
|
||||
QString *value = qerror_human((QError *)obj);
|
||||
func_fprintf(f, "%s", qstring_get_str(value));
|
||||
QDECREF(value);
|
||||
break;
|
||||
}
|
||||
case QTYPE_NONE:
|
||||
|
|
44
block/qcow.c
44
block/qcow.c
|
@ -48,9 +48,10 @@ typedef struct QCowHeader {
|
|||
uint64_t size; /* in bytes */
|
||||
uint8_t cluster_bits;
|
||||
uint8_t l2_bits;
|
||||
uint16_t padding;
|
||||
uint32_t crypt_method;
|
||||
uint64_t l1_table_offset;
|
||||
} QCowHeader;
|
||||
} QEMU_PACKED QCowHeader;
|
||||
|
||||
#define L2_CACHE_SIZE 16
|
||||
|
||||
|
@ -60,7 +61,7 @@ typedef struct BDRVQcowState {
|
|||
int cluster_sectors;
|
||||
int l2_bits;
|
||||
int l2_size;
|
||||
int l1_size;
|
||||
unsigned int l1_size;
|
||||
uint64_t cluster_offset_mask;
|
||||
uint64_t l1_table_offset;
|
||||
uint64_t *l1_table;
|
||||
|
@ -96,7 +97,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|||
Error **errp)
|
||||
{
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
int len, i, shift, ret;
|
||||
unsigned int len, i, shift;
|
||||
int ret;
|
||||
QCowHeader header;
|
||||
|
||||
ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
|
||||
|
@ -126,11 +128,25 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (header.size <= 1 || header.cluster_bits < 9) {
|
||||
error_setg(errp, "invalid value in qcow header");
|
||||
if (header.size <= 1) {
|
||||
error_setg(errp, "Image size is too small (must be at least 2 bytes)");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
if (header.cluster_bits < 9 || header.cluster_bits > 16) {
|
||||
error_setg(errp, "Cluster size must be between 512 and 64k");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* l2_bits specifies number of entries; storing a uint64_t in each entry,
|
||||
* so bytes = num_entries << 3. */
|
||||
if (header.l2_bits < 9 - 3 || header.l2_bits > 16 - 3) {
|
||||
error_setg(errp, "L2 table size must be between 512 and 64k");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (header.crypt_method > QCOW_CRYPT_AES) {
|
||||
error_setg(errp, "invalid encryption method in qcow header");
|
||||
ret = -EINVAL;
|
||||
|
@ -150,7 +166,19 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|||
|
||||
/* read the level 1 table */
|
||||
shift = s->cluster_bits + s->l2_bits;
|
||||
s->l1_size = (header.size + (1LL << shift) - 1) >> shift;
|
||||
if (header.size > UINT64_MAX - (1LL << shift)) {
|
||||
error_setg(errp, "Image too large");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
} else {
|
||||
uint64_t l1_size = (header.size + (1LL << shift) - 1) >> shift;
|
||||
if (l1_size > INT_MAX / sizeof(uint64_t)) {
|
||||
error_setg(errp, "Image too large");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
s->l1_size = l1_size;
|
||||
}
|
||||
|
||||
s->l1_table_offset = header.l1_table_offset;
|
||||
s->l1_table = g_malloc(s->l1_size * sizeof(uint64_t));
|
||||
|
@ -174,7 +202,9 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|||
if (header.backing_file_offset != 0) {
|
||||
len = header.backing_file_size;
|
||||
if (len > 1023) {
|
||||
len = 1023;
|
||||
error_setg(errp, "Backing file name too long");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
ret = bdrv_pread(bs->file, header.backing_file_offset,
|
||||
bs->backing_file, len);
|
||||
|
|
|
@ -1306,6 +1306,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
|
|||
options = qdict_clone_shallow(bs->options);
|
||||
|
||||
ret = qcow2_open(bs, options, flags, &local_err);
|
||||
QDECREF(options);
|
||||
if (local_err) {
|
||||
error_setg(errp, "Could not reopen qcow2 layer: %s",
|
||||
error_get_pretty(local_err));
|
||||
|
@ -1316,8 +1317,6 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
|
|||
return;
|
||||
}
|
||||
|
||||
QDECREF(options);
|
||||
|
||||
if (crypt_method) {
|
||||
s->crypt_method = crypt_method;
|
||||
memcpy(&s->aes_encrypt_key, &aes_encrypt_key, sizeof(aes_encrypt_key));
|
||||
|
|
|
@ -2149,6 +2149,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
|||
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
|
||||
/* we don't need to update entire object */
|
||||
datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
|
||||
inode = g_malloc(datalen);
|
||||
|
||||
/* refresh inode. */
|
||||
fd = connect_to_sdog(s);
|
||||
|
@ -2171,8 +2172,6 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
inode = (SheepdogInode *)g_malloc(datalen);
|
||||
|
||||
ret = read_object(fd, (char *)inode, vid_to_vdi_oid(new_vid),
|
||||
s->inode.nr_copies, datalen, 0, s->cache_flags);
|
||||
|
||||
|
@ -2186,6 +2185,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
|||
s->inode.name, s->inode.snap_id, s->inode.vdi_id);
|
||||
|
||||
cleanup:
|
||||
g_free(inode);
|
||||
closesocket(fd);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -787,7 +787,9 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
|
|||
s->current_mapping->path=buffer;
|
||||
s->current_mapping->read_only =
|
||||
(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) == 0;
|
||||
}
|
||||
} else {
|
||||
g_free(buffer);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
|
@ -1864,7 +1866,7 @@ static int check_directory_consistency(BDRVVVFATState *s,
|
|||
|
||||
if (s->used_clusters[cluster_num] & USED_ANY) {
|
||||
fprintf(stderr, "cluster %d used more than once\n", (int)cluster_num);
|
||||
return 0;
|
||||
goto fail;
|
||||
}
|
||||
s->used_clusters[cluster_num] = USED_DIRECTORY;
|
||||
|
||||
|
|
|
@ -27,8 +27,9 @@ static void nbd_accept(void *opaque)
|
|||
socklen_t addr_len = sizeof(addr);
|
||||
|
||||
int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);
|
||||
if (fd >= 0) {
|
||||
nbd_client_new(NULL, fd, nbd_client_put);
|
||||
if (fd >= 0 && !nbd_client_new(NULL, fd, nbd_client_put)) {
|
||||
shutdown(fd, 2);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,6 +92,10 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
|
|||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
return;
|
||||
}
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!has_writable) {
|
||||
writable = false;
|
||||
|
|
23
blockdev.c
23
blockdev.c
|
@ -332,7 +332,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
|||
opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error);
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
return NULL;
|
||||
goto err_no_opts;
|
||||
}
|
||||
|
||||
qemu_opts_absorb_qdict(opts, bs_opts, &error);
|
||||
|
@ -527,8 +527,9 @@ err:
|
|||
QTAILQ_REMOVE(&drives, dinfo, next);
|
||||
g_free(dinfo);
|
||||
early_err:
|
||||
QDECREF(bs_opts);
|
||||
qemu_opts_del(opts);
|
||||
err_no_opts:
|
||||
QDECREF(bs_opts);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -902,6 +903,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|||
|
||||
/* Actual block device init: Functionality shared with blockdev-add */
|
||||
dinfo = blockdev_init(filename, bs_opts, &local_err);
|
||||
bs_opts = NULL;
|
||||
if (dinfo == NULL) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
|
@ -939,6 +941,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|||
|
||||
fail:
|
||||
qemu_opts_del(legacy_opts);
|
||||
QDECREF(bs_opts);
|
||||
return dinfo;
|
||||
}
|
||||
|
||||
|
@ -1864,7 +1867,8 @@ void qmp_block_stream(const char *device, bool has_base,
|
|||
}
|
||||
|
||||
void qmp_block_commit(const char *device,
|
||||
bool has_base, const char *base, const char *top,
|
||||
bool has_base, const char *base,
|
||||
bool has_top, const char *top,
|
||||
bool has_speed, int64_t speed,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -1883,6 +1887,11 @@ void qmp_block_commit(const char *device,
|
|||
/* drain all i/o before commits */
|
||||
bdrv_drain_all();
|
||||
|
||||
/* Important Note:
|
||||
* libvirt relies on the DeviceNotFound error class in order to probe for
|
||||
* live commit feature versions; for this to work, we must make sure to
|
||||
* perform the device lookup before any generic errors that may occur in a
|
||||
* scenario in which all optional arguments are omitted. */
|
||||
bs = bdrv_find(device);
|
||||
if (!bs) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
|
@ -1892,7 +1901,7 @@ void qmp_block_commit(const char *device,
|
|||
/* default top_bs is the active layer */
|
||||
top_bs = bs;
|
||||
|
||||
if (top) {
|
||||
if (has_top && top) {
|
||||
if (strcmp(bs->filename, top) != 0) {
|
||||
top_bs = bdrv_find_backing_image(bs, top);
|
||||
}
|
||||
|
@ -1914,6 +1923,12 @@ void qmp_block_commit(const char *device,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Do not allow attempts to commit an image into itself */
|
||||
if (top_bs == base_bs) {
|
||||
error_setg(errp, "cannot commit an image into itself");
|
||||
return;
|
||||
}
|
||||
|
||||
if (top_bs == bs) {
|
||||
commit_active_start(bs, base_bs, speed, on_error, block_job_cb,
|
||||
bs, &local_err);
|
||||
|
|
14
blockjob.c
14
blockjob.c
|
@ -206,6 +206,20 @@ void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns)
|
|||
job->busy = true;
|
||||
}
|
||||
|
||||
void block_job_yield(BlockJob *job)
|
||||
{
|
||||
assert(job->busy);
|
||||
|
||||
/* Check cancellation *before* setting busy = false, too! */
|
||||
if (block_job_is_cancelled(job)) {
|
||||
return;
|
||||
}
|
||||
|
||||
job->busy = false;
|
||||
qemu_coroutine_yield();
|
||||
job->busy = true;
|
||||
}
|
||||
|
||||
BlockJobInfo *block_job_query(BlockJob *job)
|
||||
{
|
||||
BlockJobInfo *info = g_new0(BlockJobInfo, 1);
|
||||
|
|
|
@ -2624,7 +2624,7 @@ done
|
|||
if test "$modules" = yes; then
|
||||
shacmd_probe="sha1sum sha1 shasum"
|
||||
for c in $shacmd_probe; do
|
||||
if which $c &>/dev/null; then
|
||||
if which $c >/dev/null 2>&1; then
|
||||
shacmd="$c"
|
||||
break
|
||||
fi
|
||||
|
|
|
@ -36,8 +36,17 @@ typedef struct
|
|||
static __thread CoroutineWin32 leader;
|
||||
static __thread Coroutine *current;
|
||||
|
||||
CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
|
||||
CoroutineAction action)
|
||||
/* This function is marked noinline to prevent GCC from inlining it
|
||||
* into coroutine_trampoline(). If we allow it to do that then it
|
||||
* hoists the code to get the address of the TLS variable "current"
|
||||
* out of the while() loop. This is an invalid transformation because
|
||||
* the SwitchToFiber() call may be called when running thread A but
|
||||
* return in thread B, and so we might be in a different thread
|
||||
* context each time round the loop.
|
||||
*/
|
||||
CoroutineAction __attribute__((noinline))
|
||||
qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
|
||||
CoroutineAction action)
|
||||
{
|
||||
CoroutineWin32 *from = DO_UPCAST(CoroutineWin32, base, from_);
|
||||
CoroutineWin32 *to = DO_UPCAST(CoroutineWin32, base, to_);
|
||||
|
|
6
cputlb.c
6
cputlb.c
|
@ -331,8 +331,10 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
|
|||
}
|
||||
|
||||
#define MMUSUFFIX _cmmu
|
||||
#undef GETPC
|
||||
#define GETPC() ((uintptr_t)0)
|
||||
#undef GETPC_ADJ
|
||||
#define GETPC_ADJ 0
|
||||
#undef GETRA
|
||||
#define GETRA() ((uintptr_t)0)
|
||||
#define SOFTMMU_CODE_ACCESS
|
||||
|
||||
#define SHIFT 0
|
||||
|
|
|
@ -4,7 +4,7 @@ common-obj-$(CONFIG_ARM_DIS) += arm.o
|
|||
common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o
|
||||
common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/
|
||||
libvixldir = $(SRC_PATH)/disas/libvixl
|
||||
$(obj)/arm-a64.o: QEMU_CFLAGS += -I$(libvixldir)
|
||||
$(obj)/arm-a64.o: QEMU_CFLAGS := -I$(libvixldir) $(QEMU_CFLAGS)
|
||||
common-obj-$(CONFIG_CRIS_DIS) += cris.o
|
||||
common-obj-$(CONFIG_HPPA_DIS) += hppa.o
|
||||
common-obj-$(CONFIG_I386_DIS) += i386.o
|
||||
|
|
|
@ -3,6 +3,6 @@ libvixl_OBJS = utils.o \
|
|||
a64/decoder-a64.o \
|
||||
a64/disasm-a64.o
|
||||
|
||||
$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS += -I$(SRC_PATH)/disas/libvixl
|
||||
$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS)
|
||||
|
||||
common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
|
||||
|
|
|
@ -55,7 +55,7 @@ these four paragraphs for those parts of this code that are retained.
|
|||
| The result is stored in the location pointed to by `zPtr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
|
||||
static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
|
||||
{
|
||||
uint32_t z;
|
||||
|
||||
|
@ -81,7 +81,7 @@ INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
|
|||
| The result is stored in the location pointed to by `zPtr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
|
||||
static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
|
||||
{
|
||||
uint64_t z;
|
||||
|
||||
|
@ -115,7 +115,7 @@ INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
|
|||
| described above, and is returned at the location pointed to by `z1Ptr'.)
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
shift64ExtraRightJamming(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ INLINE void
|
|||
| which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
shift128Right(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ INLINE void
|
|||
| the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
shift128RightJamming(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ INLINE void
|
|||
| `z2Ptr'.)
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
shift128ExtraRightJamming(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
|
@ -296,7 +296,7 @@ INLINE void
|
|||
| pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
shortShift128Left(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ INLINE void
|
|||
| `z1Ptr', and `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
shortShift192Left(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
|
@ -350,7 +350,7 @@ INLINE void
|
|||
| are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
add128(
|
||||
uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ INLINE void
|
|||
| `z1Ptr', and `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
add192(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
|
@ -408,7 +408,7 @@ INLINE void
|
|||
| `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
sub128(
|
||||
uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
{
|
||||
|
@ -426,7 +426,7 @@ INLINE void
|
|||
| pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
sub192(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
|
@ -462,7 +462,7 @@ INLINE void
|
|||
| `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
static inline void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
{
|
||||
uint32_t aHigh, aLow, bHigh, bLow;
|
||||
uint64_t z0, zMiddleA, zMiddleB, z1;
|
||||
|
@ -492,7 +492,7 @@ INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr
|
|||
| `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
mul128By64To192(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
|
@ -520,7 +520,7 @@ INLINE void
|
|||
| the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE void
|
||||
static inline void
|
||||
mul128To256(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
|
@ -702,7 +702,7 @@ static int8 countLeadingZeros64( uint64_t a )
|
|||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 == b0 ) && ( a1 == b1 );
|
||||
|
@ -715,7 +715,7 @@ INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
|||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
|
||||
|
@ -728,7 +728,7 @@ INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
|||
| returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
|
||||
|
@ -741,7 +741,7 @@ INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
|||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 != b0 ) || ( a1 != b1 );
|
||||
|
|
|
@ -66,7 +66,7 @@ these four paragraphs for those parts of this code that are retained.
|
|||
| Returns the fraction bits of the half-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE uint32_t extractFloat16Frac(float16 a)
|
||||
static inline uint32_t extractFloat16Frac(float16 a)
|
||||
{
|
||||
return float16_val(a) & 0x3ff;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ INLINE uint32_t extractFloat16Frac(float16 a)
|
|||
| Returns the exponent bits of the half-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE int_fast16_t extractFloat16Exp(float16 a)
|
||||
static inline int_fast16_t extractFloat16Exp(float16 a)
|
||||
{
|
||||
return (float16_val(a) >> 10) & 0x1f;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ INLINE int_fast16_t extractFloat16Exp(float16 a)
|
|||
| Returns the sign bit of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag extractFloat16Sign(float16 a)
|
||||
static inline flag extractFloat16Sign(float16 a)
|
||||
{
|
||||
return float16_val(a)>>15;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ static int64 roundAndPackUint64(flag zSign, uint64_t absZ0,
|
|||
| Returns the fraction bits of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE uint32_t extractFloat32Frac( float32 a )
|
||||
static inline uint32_t extractFloat32Frac( float32 a )
|
||||
{
|
||||
|
||||
return float32_val(a) & 0x007FFFFF;
|
||||
|
@ -266,7 +266,7 @@ INLINE uint32_t extractFloat32Frac( float32 a )
|
|||
| Returns the exponent bits of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE int_fast16_t extractFloat32Exp(float32 a)
|
||||
static inline int_fast16_t extractFloat32Exp(float32 a)
|
||||
{
|
||||
|
||||
return ( float32_val(a)>>23 ) & 0xFF;
|
||||
|
@ -277,7 +277,7 @@ INLINE int_fast16_t extractFloat32Exp(float32 a)
|
|||
| Returns the sign bit of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag extractFloat32Sign( float32 a )
|
||||
static inline flag extractFloat32Sign( float32 a )
|
||||
{
|
||||
|
||||
return float32_val(a)>>31;
|
||||
|
@ -328,7 +328,7 @@ static void
|
|||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
|
||||
static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
|
||||
{
|
||||
|
||||
return make_float32(
|
||||
|
@ -440,7 +440,7 @@ static float32
|
|||
| Returns the fraction bits of the double-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE uint64_t extractFloat64Frac( float64 a )
|
||||
static inline uint64_t extractFloat64Frac( float64 a )
|
||||
{
|
||||
|
||||
return float64_val(a) & LIT64( 0x000FFFFFFFFFFFFF );
|
||||
|
@ -451,7 +451,7 @@ INLINE uint64_t extractFloat64Frac( float64 a )
|
|||
| Returns the exponent bits of the double-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE int_fast16_t extractFloat64Exp(float64 a)
|
||||
static inline int_fast16_t extractFloat64Exp(float64 a)
|
||||
{
|
||||
|
||||
return ( float64_val(a)>>52 ) & 0x7FF;
|
||||
|
@ -462,7 +462,7 @@ INLINE int_fast16_t extractFloat64Exp(float64 a)
|
|||
| Returns the sign bit of the double-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag extractFloat64Sign( float64 a )
|
||||
static inline flag extractFloat64Sign( float64 a )
|
||||
{
|
||||
|
||||
return float64_val(a)>>63;
|
||||
|
@ -513,7 +513,7 @@ static void
|
|||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
|
||||
static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
|
||||
{
|
||||
|
||||
return make_float64(
|
||||
|
@ -625,7 +625,7 @@ static float64
|
|||
| value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE uint64_t extractFloatx80Frac( floatx80 a )
|
||||
static inline uint64_t extractFloatx80Frac( floatx80 a )
|
||||
{
|
||||
|
||||
return a.low;
|
||||
|
@ -637,7 +637,7 @@ INLINE uint64_t extractFloatx80Frac( floatx80 a )
|
|||
| value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE int32 extractFloatx80Exp( floatx80 a )
|
||||
static inline int32 extractFloatx80Exp( floatx80 a )
|
||||
{
|
||||
|
||||
return a.high & 0x7FFF;
|
||||
|
@ -649,7 +649,7 @@ INLINE int32 extractFloatx80Exp( floatx80 a )
|
|||
| `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag extractFloatx80Sign( floatx80 a )
|
||||
static inline flag extractFloatx80Sign( floatx80 a )
|
||||
{
|
||||
|
||||
return a.high>>15;
|
||||
|
@ -679,7 +679,7 @@ static void
|
|||
| extended double-precision floating-point value, returning the result.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
|
||||
static inline floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
|
||||
{
|
||||
floatx80 z;
|
||||
|
||||
|
@ -921,7 +921,7 @@ static floatx80
|
|||
| floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE uint64_t extractFloat128Frac1( float128 a )
|
||||
static inline uint64_t extractFloat128Frac1( float128 a )
|
||||
{
|
||||
|
||||
return a.low;
|
||||
|
@ -933,7 +933,7 @@ INLINE uint64_t extractFloat128Frac1( float128 a )
|
|||
| floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE uint64_t extractFloat128Frac0( float128 a )
|
||||
static inline uint64_t extractFloat128Frac0( float128 a )
|
||||
{
|
||||
|
||||
return a.high & LIT64( 0x0000FFFFFFFFFFFF );
|
||||
|
@ -945,7 +945,7 @@ INLINE uint64_t extractFloat128Frac0( float128 a )
|
|||
| `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE int32 extractFloat128Exp( float128 a )
|
||||
static inline int32 extractFloat128Exp( float128 a )
|
||||
{
|
||||
|
||||
return ( a.high>>48 ) & 0x7FFF;
|
||||
|
@ -956,7 +956,7 @@ INLINE int32 extractFloat128Exp( float128 a )
|
|||
| Returns the sign bit of the quadruple-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE flag extractFloat128Sign( float128 a )
|
||||
static inline flag extractFloat128Sign( float128 a )
|
||||
{
|
||||
|
||||
return a.high>>63;
|
||||
|
@ -1017,7 +1017,7 @@ static void
|
|||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
INLINE float128
|
||||
static inline float128
|
||||
packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 )
|
||||
{
|
||||
float128 z;
|
||||
|
@ -7088,7 +7088,7 @@ uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
|
|||
}
|
||||
|
||||
#define COMPARE(s, nan_exp) \
|
||||
INLINE int float ## s ## _compare_internal( float ## s a, float ## s b, \
|
||||
static inline int float ## s ## _compare_internal( float ## s a, float ## s b, \
|
||||
int is_quiet STATUS_PARAM ) \
|
||||
{ \
|
||||
flag aSign, bSign; \
|
||||
|
@ -7140,7 +7140,7 @@ int float ## s ## _compare_quiet( float ## s a, float ## s b STATUS_PARAM ) \
|
|||
COMPARE(32, 0xff)
|
||||
COMPARE(64, 0x7ff)
|
||||
|
||||
INLINE int floatx80_compare_internal( floatx80 a, floatx80 b,
|
||||
static inline int floatx80_compare_internal( floatx80 a, floatx80 b,
|
||||
int is_quiet STATUS_PARAM )
|
||||
{
|
||||
flag aSign, bSign;
|
||||
|
@ -7186,7 +7186,7 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM )
|
|||
return floatx80_compare_internal(a, b, 1 STATUS_VAR);
|
||||
}
|
||||
|
||||
INLINE int float128_compare_internal( float128 a, float128 b,
|
||||
static inline int float128_compare_internal( float128 a, float128 b,
|
||||
int is_quiet STATUS_PARAM )
|
||||
{
|
||||
flag aSign, bSign;
|
||||
|
@ -7242,7 +7242,7 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )
|
|||
* semantics provided by many CPUs which predate that specification.
|
||||
*/
|
||||
#define MINMAX(s) \
|
||||
INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \
|
||||
static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \
|
||||
int ismin, int isieee STATUS_PARAM) \
|
||||
{ \
|
||||
flag aSign, bSign; \
|
||||
|
|
|
@ -417,8 +417,12 @@ static void do_cpu_reset(void *opaque)
|
|||
if (info) {
|
||||
if (!info->is_linux) {
|
||||
/* Jump to the entry point. */
|
||||
env->regs[15] = info->entry & 0xfffffffe;
|
||||
env->thumb = info->entry & 1;
|
||||
if (env->aarch64) {
|
||||
env->pc = info->entry;
|
||||
} else {
|
||||
env->regs[15] = info->entry & 0xfffffffe;
|
||||
env->thumb = info->entry & 1;
|
||||
}
|
||||
} else {
|
||||
if (CPU(cpu) == first_cpu) {
|
||||
if (env->aarch64) {
|
||||
|
|
|
@ -172,7 +172,7 @@ static void omap_timer_clk_update(void *opaque, int line, int on)
|
|||
static void omap_timer_clk_setup(struct omap_mpu_timer_s *timer)
|
||||
{
|
||||
omap_clk_adduser(timer->clk,
|
||||
qemu_allocate_irqs(omap_timer_clk_update, timer, 1)[0]);
|
||||
qemu_allocate_irq(omap_timer_clk_update, timer, 0));
|
||||
timer->rate = omap_clk_getrate(timer->clk);
|
||||
}
|
||||
|
||||
|
@ -2098,7 +2098,7 @@ static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
|
|||
"omap-mpuio", 0x800);
|
||||
memory_region_add_subregion(memory, base, &s->iomem);
|
||||
|
||||
omap_clk_adduser(clk, qemu_allocate_irqs(omap_mpuio_onoff, s, 1)[0]);
|
||||
omap_clk_adduser(clk, qemu_allocate_irq(omap_mpuio_onoff, s, 0));
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -2401,7 +2401,7 @@ static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory,
|
|||
"omap-pwl", 0x800);
|
||||
memory_region_add_subregion(system_memory, base, &s->iomem);
|
||||
|
||||
omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]);
|
||||
omap_clk_adduser(clk, qemu_allocate_irq(omap_pwl_clk_update, s, 0));
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -3485,8 +3485,8 @@ static void omap_mcbsp_i2s_start(void *opaque, int line, int level)
|
|||
void omap_mcbsp_i2s_attach(struct omap_mcbsp_s *s, I2SCodec *slave)
|
||||
{
|
||||
s->codec = slave;
|
||||
slave->rx_swallow = qemu_allocate_irqs(omap_mcbsp_i2s_swallow, s, 1)[0];
|
||||
slave->tx_start = qemu_allocate_irqs(omap_mcbsp_i2s_start, s, 1)[0];
|
||||
slave->rx_swallow = qemu_allocate_irq(omap_mcbsp_i2s_swallow, s, 0);
|
||||
slave->tx_start = qemu_allocate_irq(omap_mcbsp_i2s_start, s, 0);
|
||||
}
|
||||
|
||||
/* LED Pulse Generators */
|
||||
|
@ -3634,7 +3634,7 @@ static struct omap_lpg_s *omap_lpg_init(MemoryRegion *system_memory,
|
|||
memory_region_init_io(&s->iomem, NULL, &omap_lpg_ops, s, "omap-lpg", 0x800);
|
||||
memory_region_add_subregion(system_memory, base, &s->iomem);
|
||||
|
||||
omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]);
|
||||
omap_clk_adduser(clk, qemu_allocate_irq(omap_lpg_clk_update, s, 0));
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -3848,7 +3848,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
|
|||
s->sdram_size = sdram_size;
|
||||
s->sram_size = OMAP15XX_SRAM_SIZE;
|
||||
|
||||
s->wakeup = qemu_allocate_irqs(omap_mpu_wakeup, s, 1)[0];
|
||||
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
|
||||
|
||||
/* Clocks */
|
||||
omap_clk_init(s);
|
||||
|
|
|
@ -2260,7 +2260,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
|
|||
s->sdram_size = sdram_size;
|
||||
s->sram_size = OMAP242X_SRAM_SIZE;
|
||||
|
||||
s->wakeup = qemu_allocate_irqs(omap_mpu_wakeup, s, 1)[0];
|
||||
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
|
||||
|
||||
/* Clocks */
|
||||
omap_clk_init(s);
|
||||
|
|
|
@ -732,7 +732,7 @@ static void pxa2xx_ssp_save(QEMUFile *f, void *opaque)
|
|||
static int pxa2xx_ssp_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;
|
||||
int i;
|
||||
int i, v;
|
||||
|
||||
s->enable = qemu_get_be32(f);
|
||||
|
||||
|
@ -746,7 +746,11 @@ static int pxa2xx_ssp_load(QEMUFile *f, void *opaque, int version_id)
|
|||
qemu_get_8s(f, &s->ssrsa);
|
||||
qemu_get_8s(f, &s->ssacd);
|
||||
|
||||
s->rx_level = qemu_get_byte(f);
|
||||
v = qemu_get_byte(f);
|
||||
if (v < 0 || v > ARRAY_SIZE(s->rx_fifo)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->rx_level = v;
|
||||
s->rx_start = 0;
|
||||
for (i = 0; i < s->rx_level; i ++)
|
||||
s->rx_fifo[i] = qemu_get_byte(f);
|
||||
|
@ -2055,7 +2059,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
|
|||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0];
|
||||
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
|
||||
|
||||
/* SDRAM & Internal Memory Storage */
|
||||
memory_region_init_ram(&s->sdram, NULL, "pxa270.sdram", sdram_size);
|
||||
|
@ -2186,7 +2190,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
|
|||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0];
|
||||
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
|
||||
|
||||
/* SDRAM & Internal Memory Storage */
|
||||
memory_region_init_ram(&s->sdram, NULL, "pxa255.sdram", sdram_size);
|
||||
|
|
|
@ -744,7 +744,7 @@ static void spitz_i2c_setup(PXA2xxState *cpu)
|
|||
|
||||
spitz_wm8750_addr(wm, 0, 0);
|
||||
qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_WM,
|
||||
qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]);
|
||||
qemu_allocate_irq(spitz_wm8750_addr, wm, 0));
|
||||
/* .. and to the sound interface. */
|
||||
cpu->i2s->opaque = wm;
|
||||
cpu->i2s->codec_out = wm8750_dac_dat;
|
||||
|
@ -850,7 +850,7 @@ static void spitz_gpio_setup(PXA2xxState *cpu, int slots)
|
|||
* wouldn't guarantee that a guest ever exits the loop.
|
||||
*/
|
||||
spitz_hsync = 0;
|
||||
lcd_hsync = qemu_allocate_irqs(spitz_lcd_hsync_handler, cpu, 1)[0];
|
||||
lcd_hsync = qemu_allocate_irq(spitz_lcd_hsync_handler, cpu, 0);
|
||||
pxa2xx_gpio_read_notifier(cpu->gpio, lcd_hsync);
|
||||
pxa2xx_lcd_vsync_notifier(cpu->lcd, lcd_hsync);
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ static void z2_init(QEMUMachineInitArgs *args)
|
|||
wm8750_data_req_set(wm, mpu->i2s->data_req, mpu->i2s);
|
||||
|
||||
qdev_connect_gpio_out(mpu->gpio, Z2_GPIO_LCD_CS,
|
||||
qemu_allocate_irqs(z2_lcd_cs, z2_lcd, 1)[0]);
|
||||
qemu_allocate_irq(z2_lcd_cs, z2_lcd, 0));
|
||||
|
||||
z2_binfo.kernel_filename = kernel_filename;
|
||||
z2_binfo.kernel_cmdline = kernel_cmdline;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define INLINE static inline
|
||||
#define HAS_YM3812 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -247,7 +246,7 @@ static INT32 feedback2; /* connect for SLOT 2 */
|
|||
|
||||
/* --------------------- subroutines --------------------- */
|
||||
|
||||
INLINE int Limit( int val, int max, int min ) {
|
||||
static inline int Limit( int val, int max, int min ) {
|
||||
if ( val > max )
|
||||
val = max;
|
||||
else if ( val < min )
|
||||
|
@ -257,7 +256,7 @@ INLINE int Limit( int val, int max, int min ) {
|
|||
}
|
||||
|
||||
/* status set and IRQ handling */
|
||||
INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag)
|
||||
static inline void OPL_STATUS_SET(FM_OPL *OPL,int flag)
|
||||
{
|
||||
/* set status flag */
|
||||
OPL->status |= flag;
|
||||
|
@ -273,7 +272,7 @@ INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag)
|
|||
}
|
||||
|
||||
/* status reset and IRQ handling */
|
||||
INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
|
||||
static inline void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
|
||||
{
|
||||
/* reset status flag */
|
||||
OPL->status &=~flag;
|
||||
|
@ -289,7 +288,7 @@ INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
|
|||
}
|
||||
|
||||
/* IRQ mask set */
|
||||
INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
|
||||
static inline void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
|
||||
{
|
||||
OPL->statusmask = flag;
|
||||
/* IRQ handling check */
|
||||
|
@ -298,7 +297,7 @@ INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
|
|||
}
|
||||
|
||||
/* ----- key on ----- */
|
||||
INLINE void OPL_KEYON(OPL_SLOT *SLOT)
|
||||
static inline void OPL_KEYON(OPL_SLOT *SLOT)
|
||||
{
|
||||
/* sin wave restart */
|
||||
SLOT->Cnt = 0;
|
||||
|
@ -309,7 +308,7 @@ INLINE void OPL_KEYON(OPL_SLOT *SLOT)
|
|||
SLOT->eve = EG_AED;
|
||||
}
|
||||
/* ----- key off ----- */
|
||||
INLINE void OPL_KEYOFF(OPL_SLOT *SLOT)
|
||||
static inline void OPL_KEYOFF(OPL_SLOT *SLOT)
|
||||
{
|
||||
if( SLOT->evm > ENV_MOD_RR)
|
||||
{
|
||||
|
@ -325,7 +324,7 @@ INLINE void OPL_KEYOFF(OPL_SLOT *SLOT)
|
|||
|
||||
/* ---------- calcrate Envelope Generator & Phase Generator ---------- */
|
||||
/* return : envelope output */
|
||||
INLINE UINT32 OPL_CALC_SLOT( OPL_SLOT *SLOT )
|
||||
static inline UINT32 OPL_CALC_SLOT( OPL_SLOT *SLOT )
|
||||
{
|
||||
/* calcrate envelope generator */
|
||||
if( (SLOT->evc+=SLOT->evs) >= SLOT->eve )
|
||||
|
@ -371,7 +370,7 @@ static void set_algorithm( OPL_CH *CH)
|
|||
}
|
||||
|
||||
/* ---------- frequency counter for operater update ---------- */
|
||||
INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
|
||||
static inline void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
|
||||
{
|
||||
int ksr;
|
||||
|
||||
|
@ -391,7 +390,7 @@ INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
|
|||
}
|
||||
|
||||
/* set multi,am,vib,EG-TYP,KSR,mul */
|
||||
INLINE void set_mul(FM_OPL *OPL,int slot,int v)
|
||||
static inline void set_mul(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
|
@ -405,7 +404,7 @@ INLINE void set_mul(FM_OPL *OPL,int slot,int v)
|
|||
}
|
||||
|
||||
/* set ksl & tl */
|
||||
INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
||||
static inline void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
|
@ -421,7 +420,7 @@ INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
|||
}
|
||||
|
||||
/* set attack rate & decay rate */
|
||||
INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v)
|
||||
static inline void set_ar_dr(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
|
@ -438,7 +437,7 @@ INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v)
|
|||
}
|
||||
|
||||
/* set sustain level & release rate */
|
||||
INLINE void set_sl_rr(FM_OPL *OPL,int slot,int v)
|
||||
static inline void set_sl_rr(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
|
@ -455,7 +454,7 @@ INLINE void set_sl_rr(FM_OPL *OPL,int slot,int v)
|
|||
/* operator output calcrator */
|
||||
#define OP_OUT(slot,env,con) slot->wavetable[((slot->Cnt+con)/(0x1000000/SIN_ENT))&(SIN_ENT-1)][env]
|
||||
/* ---------- calcrate one of channel ---------- */
|
||||
INLINE void OPL_CALC_CH( OPL_CH *CH )
|
||||
static inline void OPL_CALC_CH( OPL_CH *CH )
|
||||
{
|
||||
UINT32 env_out;
|
||||
OPL_SLOT *SLOT;
|
||||
|
@ -500,7 +499,7 @@ INLINE void OPL_CALC_CH( OPL_CH *CH )
|
|||
|
||||
/* ---------- calcrate rhythm block ---------- */
|
||||
#define WHITE_NOISE_db 6.0
|
||||
INLINE void OPL_CALC_RH( OPL_CH *CH )
|
||||
static inline void OPL_CALC_RH( OPL_CH *CH )
|
||||
{
|
||||
UINT32 env_tam,env_sd,env_top,env_hh;
|
||||
int whitenoise = (rand()&1)*(WHITE_NOISE_db/EG_STEP);
|
||||
|
@ -716,7 +715,7 @@ static void OPLCloseTable( void )
|
|||
}
|
||||
|
||||
/* CSM Key Control */
|
||||
INLINE void CSMKeyControll(OPL_CH *CH)
|
||||
static inline void CSMKeyControll(OPL_CH *CH)
|
||||
{
|
||||
OPL_SLOT *slot1 = &CH->SLOT[SLOT1];
|
||||
OPL_SLOT *slot2 = &CH->SLOT[SLOT2];
|
||||
|
|
|
@ -175,8 +175,10 @@ static void uart_send_breaks(UartState *s)
|
|||
{
|
||||
int break_enabled = 1;
|
||||
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
|
||||
&break_enabled);
|
||||
if (s->chr) {
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
|
||||
&break_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
static void uart_parameters_setup(UartState *s)
|
||||
|
@ -227,7 +229,9 @@ static void uart_parameters_setup(UartState *s)
|
|||
|
||||
packet_size += ssp.data_bits + ssp.stop_bits;
|
||||
s->char_tx_time = (get_ticks_per_sec() / ssp.speed) * packet_size;
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
|
||||
if (s->chr) {
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
|
||||
}
|
||||
}
|
||||
|
||||
static int uart_can_receive(void *opaque)
|
||||
|
@ -295,6 +299,7 @@ static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond,
|
|||
/* instant drain the fifo when there's no back-end */
|
||||
if (!s->chr) {
|
||||
s->tx_count = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!s->tx_count) {
|
||||
|
@ -374,7 +379,9 @@ static void uart_read_rx_fifo(UartState *s, uint32_t *c)
|
|||
*c = s->rx_fifo[rx_rpos];
|
||||
s->rx_count--;
|
||||
|
||||
qemu_chr_accept_input(s->chr);
|
||||
if (s->chr) {
|
||||
qemu_chr_accept_input(s->chr);
|
||||
}
|
||||
} else {
|
||||
*c = 0;
|
||||
}
|
||||
|
|
|
@ -670,6 +670,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
|
|||
uint32_t max_nr_ports, nr_active_ports, ports_map;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
uint32_t tmp;
|
||||
|
||||
if (version_id > 3) {
|
||||
return -EINVAL;
|
||||
|
@ -685,17 +686,12 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* The config space */
|
||||
qemu_get_be16s(f, &s->config.cols);
|
||||
qemu_get_be16s(f, &s->config.rows);
|
||||
|
||||
qemu_get_be32s(f, &max_nr_ports);
|
||||
tswap32s(&max_nr_ports);
|
||||
if (max_nr_ports > tswap32(s->config.max_nr_ports)) {
|
||||
/* Source could have had more ports than us. Fail migration. */
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Unused */
|
||||
qemu_get_be16s(f, (uint16_t *) &tmp);
|
||||
qemu_get_be16s(f, (uint16_t *) &tmp);
|
||||
qemu_get_be32s(f, &tmp);
|
||||
|
||||
max_nr_ports = tswap32(s->config.max_nr_ports);
|
||||
for (i = 0; i < (max_nr_ports + 31) / 32; i++) {
|
||||
qemu_get_be32s(f, &ports_map);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ qemu_irq qemu_irq_invert(qemu_irq irq)
|
|||
{
|
||||
/* The default state for IRQs is low, so raise the output now. */
|
||||
qemu_irq_raise(irq);
|
||||
return qemu_allocate_irqs(qemu_notirq, irq, 1)[0];
|
||||
return qemu_allocate_irq(qemu_notirq, irq, 0);
|
||||
}
|
||||
|
||||
static void qemu_splitirq(void *opaque, int line, int level)
|
||||
|
@ -117,7 +117,7 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
|
|||
qemu_irq *s = g_malloc0(2 * sizeof(qemu_irq));
|
||||
s[0] = irq1;
|
||||
s[1] = irq2;
|
||||
return qemu_allocate_irqs(qemu_splitirq, s, 1)[0];
|
||||
return qemu_allocate_irq(qemu_splitirq, s, 0);
|
||||
}
|
||||
|
||||
static void proxy_irq_handler(void *opaque, int n, int level)
|
||||
|
|
|
@ -174,14 +174,14 @@ int qdev_init(DeviceState *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void device_realize(DeviceState *dev, Error **err)
|
||||
static void device_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||
|
||||
if (dc->init) {
|
||||
int rc = dc->init(dev);
|
||||
if (rc < 0) {
|
||||
error_setg(err, "Device initialization failed.");
|
||||
error_setg(errp, "Device initialization failed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -504,43 +504,46 @@ static void bus_unparent(Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static bool bus_get_realized(Object *obj, Error **err)
|
||||
static bool bus_get_realized(Object *obj, Error **errp)
|
||||
{
|
||||
BusState *bus = BUS(obj);
|
||||
|
||||
return bus->realized;
|
||||
}
|
||||
|
||||
static void bus_set_realized(Object *obj, bool value, Error **err)
|
||||
static void bus_set_realized(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
BusState *bus = BUS(obj);
|
||||
BusClass *bc = BUS_GET_CLASS(bus);
|
||||
BusChild *kid;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (value && !bus->realized) {
|
||||
if (bc->realize) {
|
||||
bc->realize(bus, &local_err);
|
||||
|
||||
if (local_err != NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
}
|
||||
} else if (!value && bus->realized) {
|
||||
if (bc->unrealize) {
|
||||
bc->unrealize(bus, &local_err);
|
||||
|
||||
/* TODO: recursive realization */
|
||||
} else if (!value && bus->realized) {
|
||||
QTAILQ_FOREACH(kid, &bus->children, sibling) {
|
||||
DeviceState *dev = kid->child;
|
||||
object_property_set_bool(OBJECT(dev), false, "realized",
|
||||
&local_err);
|
||||
if (local_err != NULL) {
|
||||
goto error;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bc->unrealize && local_err == NULL) {
|
||||
bc->unrealize(bus, &local_err);
|
||||
}
|
||||
}
|
||||
|
||||
bus->realized = value;
|
||||
return;
|
||||
if (local_err != NULL) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
error:
|
||||
error_propagate(err, local_err);
|
||||
bus->realized = value;
|
||||
}
|
||||
|
||||
void qbus_create_inplace(void *bus, size_t size, const char *typename,
|
||||
|
@ -724,13 +727,13 @@ void qdev_property_add_static(DeviceState *dev, Property *prop,
|
|||
}
|
||||
}
|
||||
|
||||
static bool device_get_realized(Object *obj, Error **err)
|
||||
static bool device_get_realized(Object *obj, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
return dev->realized;
|
||||
}
|
||||
|
||||
static void device_set_realized(Object *obj, bool value, Error **err)
|
||||
static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||
|
@ -738,7 +741,7 @@ static void device_set_realized(Object *obj, bool value, Error **err)
|
|||
Error *local_err = NULL;
|
||||
|
||||
if (dev->hotplugged && !dc->hotpluggable) {
|
||||
error_set(err, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -797,14 +800,14 @@ static void device_set_realized(Object *obj, bool value, Error **err)
|
|||
}
|
||||
|
||||
if (local_err != NULL) {
|
||||
error_propagate(err, local_err);
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
dev->realized = value;
|
||||
}
|
||||
|
||||
static bool device_get_hotpluggable(Object *obj, Error **err)
|
||||
static bool device_get_hotpluggable(Object *obj, Error **errp)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
|
|
|
@ -312,18 +312,42 @@ static int ssd0323_load(QEMUFile *f, void *opaque, int version_id)
|
|||
return -EINVAL;
|
||||
|
||||
s->cmd_len = qemu_get_be32(f);
|
||||
if (s->cmd_len < 0 || s->cmd_len > ARRAY_SIZE(s->cmd_data)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->cmd = qemu_get_be32(f);
|
||||
for (i = 0; i < 8; i++)
|
||||
s->cmd_data[i] = qemu_get_be32(f);
|
||||
s->row = qemu_get_be32(f);
|
||||
if (s->row < 0 || s->row >= 80) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->row_start = qemu_get_be32(f);
|
||||
if (s->row_start < 0 || s->row_start >= 80) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->row_end = qemu_get_be32(f);
|
||||
if (s->row_end < 0 || s->row_end >= 80) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->col = qemu_get_be32(f);
|
||||
if (s->col < 0 || s->col >= 64) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->col_start = qemu_get_be32(f);
|
||||
if (s->col_start < 0 || s->col_start >= 64) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->col_end = qemu_get_be32(f);
|
||||
if (s->col_end < 0 || s->col_end >= 64) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->redraw = qemu_get_be32(f);
|
||||
s->remap = qemu_get_be32(f);
|
||||
s->mode = qemu_get_be32(f);
|
||||
if (s->mode != SSD0323_CMD && s->mode != SSD0323_DATA) {
|
||||
return -EINVAL;
|
||||
}
|
||||
qemu_get_buffer(f, s->framebuffer, sizeof(s->framebuffer));
|
||||
|
||||
ss->cs = qemu_get_be32(f);
|
||||
|
|
|
@ -1660,7 +1660,7 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
|
|||
}
|
||||
|
||||
omap_dma_setcaps(s);
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]);
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irq(omap_dma_clk_update, s, 0));
|
||||
omap_dma_reset(s->dma);
|
||||
omap_dma_clk_update(s, 0, 1);
|
||||
|
||||
|
@ -2082,7 +2082,7 @@ struct soc_dma_s *omap_dma4_init(hwaddr base, qemu_irq *irqs,
|
|||
s->intr_update = omap_dma_interrupts_4_update;
|
||||
|
||||
omap_dma_setcaps(s);
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]);
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irq(omap_dma_clk_update, s, 0));
|
||||
omap_dma_reset(s->dma);
|
||||
omap_dma_clk_update(s, 0, !!s->dma->freq);
|
||||
|
||||
|
|
|
@ -203,6 +203,15 @@ static bool is_version_0 (void *opaque, int version_id)
|
|||
return version_id == 0;
|
||||
}
|
||||
|
||||
static bool vmstate_scoop_validate(void *opaque, int version_id)
|
||||
{
|
||||
ScoopInfo *s = opaque;
|
||||
|
||||
return !(s->prev_level & 0xffff0000) &&
|
||||
!(s->gpio_level & 0xffff0000) &&
|
||||
!(s->gpio_dir & 0xffff0000);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_scoop_regs = {
|
||||
.name = "scoop",
|
||||
.version_id = 1,
|
||||
|
@ -215,6 +224,7 @@ static const VMStateDescription vmstate_scoop_regs = {
|
|||
VMSTATE_UINT32(gpio_level, ScoopInfo),
|
||||
VMSTATE_UINT32(gpio_dir, ScoopInfo),
|
||||
VMSTATE_UINT32(prev_level, ScoopInfo),
|
||||
VMSTATE_VALIDATE("irq levels are 16 bit", vmstate_scoop_validate),
|
||||
VMSTATE_UINT16(mcr, ScoopInfo),
|
||||
VMSTATE_UINT16(cdr, ScoopInfo),
|
||||
VMSTATE_UINT16(ccr, ScoopInfo),
|
||||
|
|
|
@ -1410,15 +1410,16 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
|
|||
/* ACPI tables pointed to by RSDT */
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt);
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
|
||||
guest_info);
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
|
||||
build_madt(tables->table_data, tables->linker, &cpu, guest_info);
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_madt(tables->table_data, tables->linker, &cpu, guest_info);
|
||||
|
||||
if (misc.has_hpet) {
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_hpet(tables->table_data, tables->linker);
|
||||
}
|
||||
if (guest_info->numa_nodes) {
|
||||
|
|
|
@ -1258,6 +1258,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
|
|||
if (pos != 0 && kvm_device_msix_supported(kvm_state)) {
|
||||
int bar_nr;
|
||||
uint32_t msix_table_entry;
|
||||
uint16_t msix_max;
|
||||
|
||||
if (!check_irqchip_in_kernel()) {
|
||||
return -ENOTSUP;
|
||||
|
@ -1269,9 +1270,10 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
|
|||
}
|
||||
pci_dev->msix_cap = pos;
|
||||
|
||||
pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS,
|
||||
pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) &
|
||||
PCI_MSIX_FLAGS_QSIZE);
|
||||
msix_max = (pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) &
|
||||
PCI_MSIX_FLAGS_QSIZE) + 1;
|
||||
msix_max = MIN(msix_max, KVM_MAX_MSIX_PER_DEV);
|
||||
pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS, msix_max - 1);
|
||||
|
||||
/* Only enable and function mask bits are writable */
|
||||
pci_set_word(pci_dev->wmask + pos + PCI_MSIX_FLAGS,
|
||||
|
@ -1281,9 +1283,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
|
|||
bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK;
|
||||
msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK;
|
||||
dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry;
|
||||
dev->msix_max = pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS);
|
||||
dev->msix_max &= PCI_MSIX_FLAGS_QSIZE;
|
||||
dev->msix_max += 1;
|
||||
dev->msix_max = msix_max;
|
||||
}
|
||||
|
||||
/* Minimal PM support, nothing writable, device appears to NAK changes */
|
||||
|
|
|
@ -655,7 +655,7 @@ static FWCfgState *bochs_bios_init(void)
|
|||
acpi_tables, acpi_tables_len);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
|
||||
|
||||
smbios_table = smbios_get_table(&smbios_len);
|
||||
smbios_table = smbios_get_table_legacy(&smbios_len);
|
||||
if (smbios_table)
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
|
||||
smbios_table, smbios_len);
|
||||
|
|
|
@ -60,7 +60,7 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
|
|||
|
||||
static bool has_pci_info;
|
||||
static bool has_acpi_build = true;
|
||||
static bool smbios_type1_defaults = true;
|
||||
static bool smbios_defaults = true;
|
||||
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
|
||||
* host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
|
||||
* pages in the host.
|
||||
|
@ -143,10 +143,10 @@ static void pc_init1(QEMUMachineInitArgs *args,
|
|||
guest_info->has_pci_info = has_pci_info;
|
||||
guest_info->isapc_ram_fw = !pci_enabled;
|
||||
|
||||
if (smbios_type1_defaults) {
|
||||
if (smbios_defaults) {
|
||||
/* These values are guest ABI, do not change */
|
||||
smbios_set_type1_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
|
||||
args->machine->name);
|
||||
smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
|
||||
args->machine->name);
|
||||
}
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
|
@ -264,7 +264,7 @@ static void pc_init_pci(QEMUMachineInitArgs *args)
|
|||
|
||||
static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
||||
{
|
||||
smbios_type1_defaults = false;
|
||||
smbios_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
|
||||
|
@ -345,7 +345,10 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
|
|||
{
|
||||
has_pci_info = false;
|
||||
has_acpi_build = false;
|
||||
smbios_type1_defaults = false;
|
||||
smbios_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
rom_file_has_mr = false;
|
||||
x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||
enable_compat_apic_id_mode();
|
||||
pc_init1(args, 1, 0);
|
||||
|
@ -355,7 +358,10 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
|
|||
{
|
||||
has_pci_info = false;
|
||||
has_acpi_build = false;
|
||||
smbios_type1_defaults = false;
|
||||
smbios_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
rom_file_has_mr = false;
|
||||
if (!args->cpu_model) {
|
||||
args->cpu_model = "486";
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
static bool has_pci_info;
|
||||
static bool has_acpi_build = true;
|
||||
static bool smbios_type1_defaults = true;
|
||||
static bool smbios_defaults = true;
|
||||
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
|
||||
* host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
|
||||
* pages in the host.
|
||||
|
@ -130,10 +130,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
|||
guest_info->isapc_ram_fw = false;
|
||||
guest_info->has_acpi_build = has_acpi_build;
|
||||
|
||||
if (smbios_type1_defaults) {
|
||||
if (smbios_defaults) {
|
||||
/* These values are guest ABI, do not change */
|
||||
smbios_set_type1_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
|
||||
args->machine->name);
|
||||
smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
|
||||
args->machine->name);
|
||||
}
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
|
@ -242,7 +242,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
|||
|
||||
static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
||||
{
|
||||
smbios_type1_defaults = false;
|
||||
smbios_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
|
||||
|
@ -351,7 +351,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
|
|||
.name = "pc-q35-1.4",
|
||||
.init = pc_q35_init_1_4,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_4,
|
||||
PC_Q35_COMPAT_1_4,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
};
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
#include "hw/i386/smbios.h"
|
||||
#include "hw/loader.h"
|
||||
|
||||
/*
|
||||
* Structures shared with the BIOS
|
||||
*/
|
||||
|
||||
/* legacy structures and constants for <= 2.0 machines */
|
||||
struct smbios_header {
|
||||
uint16_t length;
|
||||
uint8_t type;
|
||||
|
@ -46,6 +45,9 @@ struct smbios_table {
|
|||
|
||||
static uint8_t *smbios_entries;
|
||||
static size_t smbios_entries_len;
|
||||
/* end: legacy structures & constants for <= 2.0 machines */
|
||||
|
||||
|
||||
static int smbios_type4_count = 0;
|
||||
static bool smbios_immutable;
|
||||
|
||||
|
@ -187,6 +189,8 @@ static void smbios_check_collision(int type, int entry)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* legacy setup functions for <= 2.0 machines */
|
||||
static void smbios_add_field(int type, int offset, const void *data, size_t len)
|
||||
{
|
||||
struct smbios_field *field;
|
||||
|
@ -256,8 +260,8 @@ static void smbios_build_type_1_fields(void)
|
|||
}
|
||||
}
|
||||
|
||||
void smbios_set_type1_defaults(const char *manufacturer,
|
||||
const char *product, const char *version)
|
||||
void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
const char *version)
|
||||
{
|
||||
if (!type1.manufacturer) {
|
||||
type1.manufacturer = manufacturer;
|
||||
|
@ -270,7 +274,7 @@ void smbios_set_type1_defaults(const char *manufacturer,
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t *smbios_get_table(size_t *length)
|
||||
uint8_t *smbios_get_table_legacy(size_t *length)
|
||||
{
|
||||
if (!smbios_immutable) {
|
||||
smbios_build_type_0_fields();
|
||||
|
@ -281,6 +285,8 @@ uint8_t *smbios_get_table(size_t *length)
|
|||
*length = smbios_entries_len;
|
||||
return smbios_entries;
|
||||
}
|
||||
/* end: legacy setup functions for <= 2.0 machines */
|
||||
|
||||
|
||||
static void save_opt(const char **dest, QemuOpts *opts, const char *name)
|
||||
{
|
||||
|
|
|
@ -1293,7 +1293,7 @@ const VMStateDescription vmstate_ahci = {
|
|||
VMSTATE_UINT32(control_regs.impl, AHCIState),
|
||||
VMSTATE_UINT32(control_regs.version, AHCIState),
|
||||
VMSTATE_UINT32(idp_index, AHCIState),
|
||||
VMSTATE_INT32(ports, AHCIState),
|
||||
VMSTATE_INT32_EQUAL(ports, AHCIState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
||||
|
|
|
@ -594,7 +594,7 @@ static void microdrive_realize(DeviceState *dev, Error **errp)
|
|||
{
|
||||
MicroDriveState *md = MICRODRIVE(dev);
|
||||
|
||||
ide_init2(&md->bus, qemu_allocate_irqs(md_set_irq, md, 1)[0]);
|
||||
ide_init2(&md->bus, qemu_allocate_irq(md_set_irq, md, 0));
|
||||
}
|
||||
|
||||
static void microdrive_init(Object *obj)
|
||||
|
|
|
@ -1070,9 +1070,21 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
|
|||
s->enabled = qemu_get_byte(f);
|
||||
s->host_mode = qemu_get_byte(f);
|
||||
s->function = qemu_get_byte(f);
|
||||
if (s->function < 0 || s->function >= ARRAY_SIZE(mode_regs)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->nextfunction = qemu_get_byte(f);
|
||||
if (s->nextfunction < 0 || s->nextfunction >= ARRAY_SIZE(mode_regs)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->precision = qemu_get_byte(f);
|
||||
if (s->precision < 0 || s->precision >= ARRAY_SIZE(resolution)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->nextprecision = qemu_get_byte(f);
|
||||
if (s->nextprecision < 0 || s->nextprecision >= ARRAY_SIZE(resolution)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->filter = qemu_get_byte(f);
|
||||
s->pin_func = qemu_get_byte(f);
|
||||
s->ref = qemu_get_byte(f);
|
||||
|
|
|
@ -412,7 +412,7 @@ static const MemoryRegionOps pic_elcr_ioport_ops = {
|
|||
},
|
||||
};
|
||||
|
||||
static void pic_realize(DeviceState *dev, Error **err)
|
||||
static void pic_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
PICCommonState *s = PIC_COMMON(dev);
|
||||
PICClass *pc = PIC_GET_CLASS(dev);
|
||||
|
@ -425,7 +425,7 @@ static void pic_realize(DeviceState *dev, Error **err)
|
|||
qdev_init_gpio_out(dev, s->int_out, ARRAY_SIZE(s->int_out));
|
||||
qdev_init_gpio_in(dev, pic_set_irq, 8);
|
||||
|
||||
pc->parent_realize(dev, err);
|
||||
pc->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
void pic_info(Monitor *mon, const QDict *qdict)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "hw/sysbus.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
//#define DEBUG_OPENPIC
|
||||
|
||||
|
@ -1416,7 +1417,7 @@ static void openpic_load_IRQ_queue(QEMUFile* f, IRQQueue *q)
|
|||
static int openpic_load(QEMUFile* f, void *opaque, int version_id)
|
||||
{
|
||||
OpenPICState *opp = (OpenPICState *)opaque;
|
||||
unsigned int i;
|
||||
unsigned int i, nb_cpus;
|
||||
|
||||
if (version_id != 1) {
|
||||
return -EINVAL;
|
||||
|
@ -1428,7 +1429,11 @@ static int openpic_load(QEMUFile* f, void *opaque, int version_id)
|
|||
qemu_get_be32s(f, &opp->spve);
|
||||
qemu_get_be32s(f, &opp->tfrr);
|
||||
|
||||
qemu_get_be32s(f, &opp->nb_cpus);
|
||||
qemu_get_be32s(f, &nb_cpus);
|
||||
if (opp->nb_cpus != nb_cpus) {
|
||||
return -EINVAL;
|
||||
}
|
||||
assert(nb_cpus > 0 && nb_cpus <= MAX_CPU);
|
||||
|
||||
for (i = 0; i < opp->nb_cpus; i++) {
|
||||
qemu_get_sbe32s(f, &opp->dst[i].ctpr);
|
||||
|
@ -1567,6 +1572,13 @@ static void openpic_realize(DeviceState *dev, Error **errp)
|
|||
{NULL}
|
||||
};
|
||||
|
||||
if (opp->nb_cpus > MAX_CPU) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
||||
(uint64_t)0, (uint64_t)MAX_CPU);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (opp->model) {
|
||||
case OPENPIC_MODEL_FSL_MPIC_20:
|
||||
default:
|
||||
|
|
|
@ -135,9 +135,9 @@ CBus *cbus_init(qemu_irq dat)
|
|||
CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s));
|
||||
|
||||
s->dat_out = dat;
|
||||
s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0];
|
||||
s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0];
|
||||
s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0];
|
||||
s->cbus.clk = qemu_allocate_irq(cbus_clk, s, 0);
|
||||
s->cbus.dat = qemu_allocate_irq(cbus_dat, s, 0);
|
||||
s->cbus.sel = qemu_allocate_irq(cbus_sel, s, 0);
|
||||
|
||||
s->sel = 1;
|
||||
s->clk = 0;
|
||||
|
|
|
@ -68,6 +68,7 @@ static const VMStateDescription vmstate_imx_ccm = {
|
|||
VMSTATE_UINT32(pmcr0, IMXCCMState),
|
||||
VMSTATE_UINT32(pmcr1, IMXCCMState),
|
||||
VMSTATE_UINT32(pll_refclk_freq, IMXCCMState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
.post_load = imx_ccm_post_load,
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
#include "hw/sysbus.h"
|
||||
#include "net/net.h"
|
||||
#include "migration/migration.h"
|
||||
#include <zlib.h>
|
||||
|
||||
//#define DEBUG_STELLARIS_ENET 1
|
||||
|
@ -75,6 +76,7 @@ typedef struct {
|
|||
NICConf conf;
|
||||
qemu_irq irq;
|
||||
MemoryRegion mmio;
|
||||
Error *migration_blocker;
|
||||
} stellaris_enet_state;
|
||||
|
||||
static void stellaris_enet_update(stellaris_enet_state *s)
|
||||
|
@ -253,17 +255,19 @@ static void stellaris_enet_write(void *opaque, hwaddr offset,
|
|||
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
|
||||
}
|
||||
} else {
|
||||
s->tx_fifo[s->tx_fifo_len++] = value;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 8;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 16;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
|
||||
if (s->tx_fifo_len + 4 <= ARRAY_SIZE(s->tx_fifo)) {
|
||||
s->tx_fifo[s->tx_fifo_len++] = value;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 8;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 16;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
|
||||
}
|
||||
if (s->tx_fifo_len >= s->tx_frame_len) {
|
||||
/* We don't implement explicit CRC, so just chop it off. */
|
||||
if ((s->tctl & SE_TCTL_CRC) == 0)
|
||||
s->tx_frame_len -= 4;
|
||||
if ((s->tctl & SE_TCTL_PADEN) && s->tx_frame_len < 60) {
|
||||
memset(&s->tx_fifo[s->tx_frame_len], 0, 60 - s->tx_frame_len);
|
||||
s->tx_fifo_len = 60;
|
||||
s->tx_frame_len = 60;
|
||||
}
|
||||
qemu_send_packet(qemu_get_queue(s->nic), s->tx_fifo,
|
||||
s->tx_frame_len);
|
||||
|
@ -360,7 +364,7 @@ static int stellaris_enet_load(QEMUFile *f, void *opaque, int version_id)
|
|||
stellaris_enet_state *s = (stellaris_enet_state *)opaque;
|
||||
int i;
|
||||
|
||||
if (version_id != 1)
|
||||
if (1)
|
||||
return -EINVAL;
|
||||
|
||||
s->ris = qemu_get_be32(f);
|
||||
|
@ -421,6 +425,10 @@ static int stellaris_enet_init(SysBusDevice *sbd)
|
|||
stellaris_enet_reset(s);
|
||||
register_savevm(dev, "stellaris_enet", -1, 1,
|
||||
stellaris_enet_save, stellaris_enet_load, s);
|
||||
|
||||
error_setg(&s->migration_blocker,
|
||||
"stellaris_enet does not support migration");
|
||||
migrate_add_blocker(s->migration_blocker);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -428,6 +436,9 @@ static void stellaris_enet_unrealize(DeviceState *dev, Error **errp)
|
|||
{
|
||||
stellaris_enet_state *s = STELLARIS_ENET(dev);
|
||||
|
||||
migrate_del_blocker(s->migration_blocker);
|
||||
error_free(s->migration_blocker);
|
||||
|
||||
unregister_savevm(DEVICE(s), "stellaris_enet", s);
|
||||
|
||||
memory_region_destroy(&s->mmio);
|
||||
|
|
|
@ -863,6 +863,14 @@ static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void virtio_net_hdr_swap(struct virtio_net_hdr *hdr)
|
||||
{
|
||||
tswap16s(&hdr->hdr_len);
|
||||
tswap16s(&hdr->gso_size);
|
||||
tswap16s(&hdr->csum_start);
|
||||
tswap16s(&hdr->csum_offset);
|
||||
}
|
||||
|
||||
/* dhclient uses AF_PACKET but doesn't pass auxdata to the kernel so
|
||||
* it never finds out that the packets don't have valid checksums. This
|
||||
* causes dhclient to get upset. Fedora's carried a patch for ages to
|
||||
|
@ -898,6 +906,7 @@ static void receive_header(VirtIONet *n, const struct iovec *iov, int iov_cnt,
|
|||
void *wbuf = (void *)buf;
|
||||
work_around_broken_dhclient(wbuf, wbuf + n->host_hdr_len,
|
||||
size - n->host_hdr_len);
|
||||
virtio_net_hdr_swap(wbuf);
|
||||
iov_from_buf(iov, iov_cnt, 0, buf, sizeof(struct virtio_net_hdr));
|
||||
} else {
|
||||
struct virtio_net_hdr hdr = {
|
||||
|
@ -1106,6 +1115,14 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (n->has_vnet_hdr) {
|
||||
if (out_sg[0].iov_len < n->guest_hdr_len) {
|
||||
error_report("virtio-net header incorrect");
|
||||
exit(1);
|
||||
}
|
||||
virtio_net_hdr_swap((void *) out_sg[0].iov_base);
|
||||
}
|
||||
|
||||
/*
|
||||
* If host wants to see the guest header as is, we can
|
||||
* pass it on unchanged. Otherwise, copy just the parts
|
||||
|
@ -1362,10 +1379,17 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
|||
if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {
|
||||
qemu_get_buffer(f, n->mac_table.macs,
|
||||
n->mac_table.in_use * ETH_ALEN);
|
||||
} else if (n->mac_table.in_use) {
|
||||
uint8_t *buf = g_malloc0(n->mac_table.in_use);
|
||||
qemu_get_buffer(f, buf, n->mac_table.in_use * ETH_ALEN);
|
||||
g_free(buf);
|
||||
} else {
|
||||
int64_t i;
|
||||
|
||||
/* Overflow detected - can happen if source has a larger MAC table.
|
||||
* We simply set overflow flag so there's no need to maintain the
|
||||
* table of addresses, discard them all.
|
||||
* Note: 64 bit math to avoid integer overflow.
|
||||
*/
|
||||
for (i = 0; i < (int64_t)n->mac_table.in_use * ETH_ALEN; ++i) {
|
||||
qemu_get_byte(f);
|
||||
}
|
||||
n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
|
||||
n->mac_table.in_use = 0;
|
||||
}
|
||||
|
@ -1407,6 +1431,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
|||
}
|
||||
|
||||
n->curr_queues = qemu_get_be16(f);
|
||||
if (n->curr_queues > n->max_queues) {
|
||||
error_report("virtio-net: curr_queues %x > max_queues %x",
|
||||
n->curr_queues, n->max_queues);
|
||||
return -1;
|
||||
}
|
||||
for (i = 1; i < n->curr_queues; i++) {
|
||||
n->vqs[i].tx_waiting = qemu_get_be32(f);
|
||||
}
|
||||
|
|
|
@ -830,6 +830,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||
}
|
||||
|
||||
pci_dev->bus = bus;
|
||||
pci_dev->devfn = devfn;
|
||||
dma_as = pci_device_iommu_address_space(pci_dev);
|
||||
|
||||
memory_region_init_alias(&pci_dev->bus_master_enable_region,
|
||||
|
@ -839,7 +840,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||
address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_enable_region,
|
||||
name);
|
||||
|
||||
pci_dev->devfn = devfn;
|
||||
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
|
||||
pci_dev->irq_state = 0;
|
||||
pci_config_alloc(pci_dev);
|
||||
|
|
|
@ -795,6 +795,13 @@ static const VMStateDescription vmstate_pcie_aer_err = {
|
|||
}
|
||||
};
|
||||
|
||||
static bool pcie_aer_state_log_num_valid(void *opaque, int version_id)
|
||||
{
|
||||
PCIEAERLog *s = opaque;
|
||||
|
||||
return s->log_num <= s->log_max;
|
||||
}
|
||||
|
||||
const VMStateDescription vmstate_pcie_aer_log = {
|
||||
.name = "PCIE_AER_ERROR_LOG",
|
||||
.version_id = 1,
|
||||
|
@ -802,7 +809,8 @@ const VMStateDescription vmstate_pcie_aer_log = {
|
|||
.minimum_version_id_old = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT16(log_num, PCIEAERLog),
|
||||
VMSTATE_UINT16(log_max, PCIEAERLog),
|
||||
VMSTATE_UINT16_EQUAL(log_max, PCIEAERLog),
|
||||
VMSTATE_VALIDATE("log_num <= log_max", pcie_aer_state_log_num_valid),
|
||||
VMSTATE_STRUCT_VARRAY_POINTER_UINT16(log, PCIEAERLog, log_num,
|
||||
vmstate_pcie_aer_err, PCIEAERErr),
|
||||
VMSTATE_END_OF_LIST()
|
||||
|
|
|
@ -195,7 +195,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)
|
|||
memory_region_add_subregion(&s->container_mem, 0x0c000000,
|
||||
&s->common_iomem);
|
||||
|
||||
s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0];
|
||||
s->slot.irq = qemu_allocate_irq(pxa2xx_pcmcia_set_irq, s, 0);
|
||||
|
||||
object_property_add_link(obj, "card", TYPE_PCMCIA_CARD,
|
||||
(Object **)&s->card,
|
||||
|
|
|
@ -343,6 +343,21 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||
|
||||
/* There is no cached config, allocate MSIs */
|
||||
if (!phb->msi_table[ndev].nvec) {
|
||||
int max_irqs = 0;
|
||||
if (ret_intr_type == RTAS_TYPE_MSI) {
|
||||
max_irqs = msi_nr_vectors_allocated(pdev);
|
||||
} else if (ret_intr_type == RTAS_TYPE_MSIX) {
|
||||
max_irqs = pdev->msix_entries_nr;
|
||||
}
|
||||
if (!max_irqs) {
|
||||
error_report("Requested interrupt type %d is not enabled for device#%d",
|
||||
ret_intr_type, ndev);
|
||||
rtas_st(rets, 0, -1); /* Hardware error */
|
||||
return;
|
||||
}
|
||||
if (req_num > max_irqs) {
|
||||
req_num = max_irqs;
|
||||
}
|
||||
irq = spapr_allocate_irq_block(req_num, false,
|
||||
ret_intr_type == RTAS_TYPE_MSI);
|
||||
if (irq < 0) {
|
||||
|
|
|
@ -734,9 +734,11 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void copy_irb_to_guest(IRB *dest, const IRB *src)
|
||||
static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw)
|
||||
{
|
||||
int i;
|
||||
uint16_t stctl = src->scsw.ctrl & SCSW_CTRL_MASK_STCTL;
|
||||
uint16_t actl = src->scsw.ctrl & SCSW_CTRL_MASK_ACTL;
|
||||
|
||||
copy_scsw_to_guest(&dest->scsw, &src->scsw);
|
||||
|
||||
|
@ -746,8 +748,22 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src)
|
|||
for (i = 0; i < ARRAY_SIZE(dest->ecw); i++) {
|
||||
dest->ecw[i] = cpu_to_be32(src->ecw[i]);
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(dest->emw); i++) {
|
||||
dest->emw[i] = cpu_to_be32(src->emw[i]);
|
||||
/* extended measurements enabled? */
|
||||
if ((src->scsw.flags & SCSW_FLAGS_MASK_ESWF) ||
|
||||
!(pmcw->flags & PMCW_FLAGS_MASK_TF) ||
|
||||
!(pmcw->chars & PMCW_CHARS_MASK_XMWME)) {
|
||||
return;
|
||||
}
|
||||
/* extended measurements pending? */
|
||||
if (!(stctl & SCSW_STCTL_STATUS_PEND)) {
|
||||
return;
|
||||
}
|
||||
if ((stctl & SCSW_STCTL_PRIMARY) ||
|
||||
(stctl == SCSW_STCTL_SECONDARY) ||
|
||||
((stctl & SCSW_STCTL_INTERMEDIATE) && (actl & SCSW_ACTL_SUSP))) {
|
||||
for (i = 0; i < ARRAY_SIZE(dest->emw); i++) {
|
||||
dest->emw[i] = cpu_to_be32(src->emw[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -793,7 +809,7 @@ int css_do_tsch(SubchDev *sch, IRB *target_irb)
|
|||
}
|
||||
}
|
||||
/* Store the irb to the guest. */
|
||||
copy_irb_to_guest(target_irb, &irb);
|
||||
copy_irb_to_guest(target_irb, &irb, p);
|
||||
|
||||
/* Clear conditions on subchannel, if applicable. */
|
||||
if (stctl & SCSW_STCTL_STATUS_PEND) {
|
||||
|
|
|
@ -1106,6 +1106,21 @@ static int megasas_dcmd_ld_get_list(MegasasState *s, MegasasCmd *cmd)
|
|||
return MFI_STAT_OK;
|
||||
}
|
||||
|
||||
static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
|
||||
{
|
||||
uint16_t flags;
|
||||
|
||||
/* mbox0 contains flags */
|
||||
flags = le16_to_cpu(cmd->frame->dcmd.mbox[0]);
|
||||
trace_megasas_dcmd_ld_list_query(cmd->index, flags);
|
||||
if (flags == MR_LD_QUERY_TYPE_ALL ||
|
||||
flags == MR_LD_QUERY_TYPE_EXPOSED_TO_HOST) {
|
||||
return megasas_dcmd_ld_get_list(s, cmd);
|
||||
}
|
||||
|
||||
return MFI_STAT_OK;
|
||||
}
|
||||
|
||||
static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun,
|
||||
MegasasCmd *cmd)
|
||||
{
|
||||
|
@ -1409,6 +1424,8 @@ static const struct dcmd_cmd_tbl_t {
|
|||
megasas_dcmd_dummy },
|
||||
{ MFI_DCMD_LD_GET_LIST, "LD_GET_LIST",
|
||||
megasas_dcmd_ld_get_list},
|
||||
{ MFI_DCMD_LD_LIST_QUERY, "LD_LIST_QUERY",
|
||||
megasas_dcmd_ld_list_query },
|
||||
{ MFI_DCMD_LD_GET_INFO, "LD_GET_INFO",
|
||||
megasas_dcmd_ld_get_info },
|
||||
{ MFI_DCMD_LD_GET_PROP, "LD_GET_PROP",
|
||||
|
|
|
@ -164,6 +164,7 @@ typedef enum {
|
|||
MFI_DCMD_PD_BLINK = 0x02070100,
|
||||
MFI_DCMD_PD_UNBLINK = 0x02070200,
|
||||
MFI_DCMD_LD_GET_LIST = 0x03010000,
|
||||
MFI_DCMD_LD_LIST_QUERY = 0x03010100,
|
||||
MFI_DCMD_LD_GET_INFO = 0x03020000,
|
||||
MFI_DCMD_LD_GET_PROP = 0x03030000,
|
||||
MFI_DCMD_LD_SET_PROP = 0x03040000,
|
||||
|
@ -411,6 +412,14 @@ typedef enum {
|
|||
MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5, /*query for system drives */
|
||||
} mfi_pd_query_type;
|
||||
|
||||
typedef enum {
|
||||
MR_LD_QUERY_TYPE_ALL = 0,
|
||||
MR_LD_QUERY_TYPE_EXPOSED_TO_HOST = 1,
|
||||
MR_LD_QUERY_TYPE_USED_TGT_IDS = 2,
|
||||
MR_LD_QUERY_TYPE_CLUSTER_ACCESS = 3,
|
||||
MR_LD_QUERY_TYPE_CLUSTER_LOCALE = 4,
|
||||
} mfi_ld_query_type;
|
||||
|
||||
/*
|
||||
* Other propertities and definitions
|
||||
*/
|
||||
|
|
|
@ -2520,7 +2520,7 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag,
|
|||
* ones (such as WRITE SAME or EXTENDED COPY, etc.). So, without
|
||||
* O_DIRECT everything must go through SG_IO.
|
||||
*/
|
||||
if (bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE) {
|
||||
if (!(bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,10 @@ static void vhost_scsi_set_status(VirtIODevice *vdev, uint8_t val)
|
|||
}
|
||||
}
|
||||
|
||||
static void vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq)
|
||||
{
|
||||
}
|
||||
|
||||
static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
|
||||
|
@ -217,7 +221,9 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
virtio_scsi_common_realize(dev, &err);
|
||||
virtio_scsi_common_realize(dev, &err, vhost_dummy_handle_output,
|
||||
vhost_dummy_handle_output,
|
||||
vhost_dummy_handle_output);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
|
|
@ -147,6 +147,15 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq)
|
|||
qemu_get_be32s(f, &n);
|
||||
assert(n < vs->conf.num_queues);
|
||||
qemu_get_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem));
|
||||
/* TODO: add a way for SCSIBusInfo's load_request to fail,
|
||||
* and fail migration instead of asserting here.
|
||||
* When we do, we might be able to re-enable NDEBUG below.
|
||||
*/
|
||||
#ifdef NDEBUG
|
||||
#error building with NDEBUG is not supported
|
||||
#endif
|
||||
assert(req->elem.in_num <= ARRAY_SIZE(req->elem.in_sg));
|
||||
assert(req->elem.out_num <= ARRAY_SIZE(req->elem.out_sg));
|
||||
virtio_scsi_parse_req(s, vs->cmd_vqs[n], req);
|
||||
|
||||
scsi_req_ref(sreq);
|
||||
|
@ -489,7 +498,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
|
|||
uint32_t event, uint32_t reason)
|
||||
{
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
||||
VirtIOSCSIReq *req = virtio_scsi_pop_req(s, vs->event_vq);
|
||||
VirtIOSCSIReq *req;
|
||||
VirtIOSCSIEvent *evt;
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(s);
|
||||
int in_size;
|
||||
|
@ -498,6 +507,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
|
|||
return;
|
||||
}
|
||||
|
||||
req = virtio_scsi_pop_req(s, vs->event_vq);
|
||||
if (!req) {
|
||||
s->events_dropped = true;
|
||||
return;
|
||||
|
@ -595,7 +605,9 @@ static struct SCSIBusInfo virtio_scsi_scsi_info = {
|
|||
.load_request = virtio_scsi_load_request,
|
||||
};
|
||||
|
||||
void virtio_scsi_common_realize(DeviceState *dev, Error **errp)
|
||||
void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
|
||||
HandleOutput ctrl, HandleOutput evt,
|
||||
HandleOutput cmd)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev);
|
||||
|
@ -609,12 +621,12 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp)
|
|||
s->cdb_size = VIRTIO_SCSI_CDB_SIZE;
|
||||
|
||||
s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,
|
||||
virtio_scsi_handle_ctrl);
|
||||
ctrl);
|
||||
s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,
|
||||
virtio_scsi_handle_event);
|
||||
evt);
|
||||
for (i = 0; i < s->conf.num_queues; i++) {
|
||||
s->cmd_vqs[i] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,
|
||||
virtio_scsi_handle_cmd);
|
||||
cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,7 +637,9 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
|
|||
static int virtio_scsi_id;
|
||||
Error *err = NULL;
|
||||
|
||||
virtio_scsi_common_realize(dev, &err);
|
||||
virtio_scsi_common_realize(dev, &err, virtio_scsi_handle_ctrl,
|
||||
virtio_scsi_handle_event,
|
||||
virtio_scsi_handle_cmd);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
|
|
@ -625,7 +625,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
|
|||
exit(1);
|
||||
}
|
||||
|
||||
s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
|
||||
s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0);
|
||||
sd_set_cb(s->card, NULL, s->cdet);
|
||||
|
||||
return s;
|
||||
|
|
|
@ -1168,8 +1168,8 @@ static void sdhci_initfn(Object *obj)
|
|||
if (s->card == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0];
|
||||
s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0];
|
||||
s->eject_cb = qemu_allocate_irq(sdhci_insert_eject_cb, s, 0);
|
||||
s->ro_cb = qemu_allocate_irq(sdhci_card_readonly_cb, s, 0);
|
||||
sd_set_cb(s->card, s->ro_cb, s->eject_cb);
|
||||
|
||||
s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
|
||||
|
@ -1184,8 +1184,8 @@ static void sdhci_uninitfn(Object *obj)
|
|||
timer_free(s->insert_timer);
|
||||
timer_del(s->transfer_timer);
|
||||
timer_free(s->transfer_timer);
|
||||
qemu_free_irqs(&s->eject_cb);
|
||||
qemu_free_irqs(&s->ro_cb);
|
||||
qemu_free_irq(s->eject_cb);
|
||||
qemu_free_irq(s->ro_cb);
|
||||
|
||||
if (s->fifo_buffer) {
|
||||
g_free(s->fifo_buffer);
|
||||
|
|
|
@ -230,8 +230,17 @@ static int ssi_sd_load(QEMUFile *f, void *opaque, int version_id)
|
|||
for (i = 0; i < 5; i++)
|
||||
s->response[i] = qemu_get_be32(f);
|
||||
s->arglen = qemu_get_be32(f);
|
||||
if (s->mode == SSI_SD_CMDARG &&
|
||||
(s->arglen < 0 || s->arglen >= ARRAY_SIZE(s->cmdarg))) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->response_pos = qemu_get_be32(f);
|
||||
s->stopping = qemu_get_be32(f);
|
||||
if (s->mode == SSI_SD_RESPONSE &&
|
||||
(s->response_pos < 0 || s->response_pos >= ARRAY_SIZE(s->response) ||
|
||||
(!s->stopping && s->arglen > ARRAY_SIZE(s->response)))) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ss->cs = qemu_get_be32(f);
|
||||
|
||||
|
|
|
@ -838,6 +838,5 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *sysmem)
|
|||
qemu_irq sh7750_irl(SH7750State *s)
|
||||
{
|
||||
sh_intc_toggle_source(sh_intc_source(&s->intc, IRL), 1, 0); /* enable */
|
||||
return qemu_allocate_irqs(sh_intc_set_irl, sh_intc_source(&s->intc, IRL),
|
||||
1)[0];
|
||||
return qemu_allocate_irq(sh_intc_set_irl, sh_intc_source(&s->intc, IRL), 0);
|
||||
}
|
||||
|
|
|
@ -240,11 +240,25 @@ static const MemoryRegionOps pl022_ops = {
|
|||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static int pl022_post_load(void *opaque, int version_id)
|
||||
{
|
||||
PL022State *s = opaque;
|
||||
|
||||
if (s->tx_fifo_head < 0 ||
|
||||
s->tx_fifo_head >= ARRAY_SIZE(s->tx_fifo) ||
|
||||
s->rx_fifo_head < 0 ||
|
||||
s->rx_fifo_head >= ARRAY_SIZE(s->rx_fifo)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_pl022 = {
|
||||
.name = "pl022_ssp",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.post_load = pl022_post_load,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(cr0, PL022State),
|
||||
VMSTATE_UINT32(cr1, PL022State),
|
||||
|
|
|
@ -239,6 +239,18 @@ static int hpet_pre_load(void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool hpet_validate_num_timers(void *opaque, int version_id)
|
||||
{
|
||||
HPETState *s = opaque;
|
||||
|
||||
if (s->num_timers < HPET_MIN_TIMERS) {
|
||||
return false;
|
||||
} else if (s->num_timers > HPET_MAX_TIMERS) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int hpet_post_load(void *opaque, int version_id)
|
||||
{
|
||||
HPETState *s = opaque;
|
||||
|
@ -307,6 +319,7 @@ static const VMStateDescription vmstate_hpet = {
|
|||
VMSTATE_UINT64(isr, HPETState),
|
||||
VMSTATE_UINT64(hpet_counter, HPETState),
|
||||
VMSTATE_UINT8_V(num_timers, HPETState, 2),
|
||||
VMSTATE_VALIDATE("num_timers in range", hpet_validate_num_timers),
|
||||
VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers, 0,
|
||||
vmstate_hpet_timer, HPETTimer),
|
||||
VMSTATE_END_OF_LIST()
|
||||
|
|
|
@ -322,7 +322,7 @@ static void pit_post_load(PITCommonState *s)
|
|||
}
|
||||
}
|
||||
|
||||
static void pit_realizefn(DeviceState *dev, Error **err)
|
||||
static void pit_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
PITCommonState *pit = PIT_COMMON(dev);
|
||||
PITClass *pc = PIT_GET_CLASS(dev);
|
||||
|
@ -338,7 +338,7 @@ static void pit_realizefn(DeviceState *dev, Error **err)
|
|||
|
||||
qdev_init_gpio_in(dev, pit_irq_control, 1);
|
||||
|
||||
pc->parent_realize(dev, err);
|
||||
pc->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
static Property pit_properties[] = {
|
||||
|
|
|
@ -852,7 +852,7 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
|
|||
check_update_timer(s);
|
||||
|
||||
s->clock_reset_notifier.notify = rtc_notify_clock_reset;
|
||||
qemu_clock_register_reset_notifier(QEMU_CLOCK_REALTIME,
|
||||
qemu_clock_register_reset_notifier(rtc_clock,
|
||||
&s->clock_reset_notifier);
|
||||
|
||||
s->suspend_notifier.notify = rtc_notify_suspend;
|
||||
|
|
|
@ -227,7 +227,7 @@ static void omap_gp_timer_clk_update(void *opaque, int line, int on)
|
|||
static void omap_gp_timer_clk_setup(struct omap_gp_timer_s *timer)
|
||||
{
|
||||
omap_clk_adduser(timer->clk,
|
||||
qemu_allocate_irqs(omap_gp_timer_clk_update, timer, 1)[0]);
|
||||
qemu_allocate_irq(omap_gp_timer_clk_update, timer, 0));
|
||||
timer->rate = omap_clk_getrate(timer->clk);
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
|
|||
s->clk = fclk;
|
||||
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_gp_timer_tick, s);
|
||||
s->match = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_gp_timer_match, s);
|
||||
s->in = qemu_allocate_irqs(omap_gp_timer_input, s, 1)[0];
|
||||
s->in = qemu_allocate_irq(omap_gp_timer_input, s, 0);
|
||||
omap_gp_timer_reset(s);
|
||||
omap_gp_timer_clk_setup(s);
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@ static int usb_device_post_load(void *opaque, int version_id)
|
|||
} else {
|
||||
dev->attached = 1;
|
||||
}
|
||||
if (dev->setup_index >= sizeof(dev->data_buf) ||
|
||||
if (dev->setup_index < 0 ||
|
||||
dev->setup_len < 0 ||
|
||||
dev->setup_index >= sizeof(dev->data_buf) ||
|
||||
dev->setup_len >= sizeof(dev->data_buf)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/desc.h"
|
||||
#include "sysemu/bt.h"
|
||||
|
@ -506,6 +507,14 @@ static int usb_bt_initfn(USBDevice *dev)
|
|||
|
||||
usb_desc_create_serial(dev);
|
||||
usb_desc_init(dev);
|
||||
s->dev.opaque = s;
|
||||
if (!s->hci) {
|
||||
s->hci = bt_new_hci(qemu_find_bt_vlan(0));
|
||||
}
|
||||
s->hci->opaque = s;
|
||||
s->hci->evt_recv = usb_bt_out_hci_packet_event;
|
||||
s->hci->acl_recv = usb_bt_out_hci_packet_acl;
|
||||
usb_bt_handle_reset(&s->dev);
|
||||
s->intr = usb_ep_get(dev, USB_TOKEN_IN, USB_EVT_EP);
|
||||
|
||||
return 0;
|
||||
|
@ -516,6 +525,7 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
|
|||
USBDevice *dev;
|
||||
struct USBBtState *s;
|
||||
HCIInfo *hci;
|
||||
const char *name = "usb-bt-dongle";
|
||||
|
||||
if (*cmdline) {
|
||||
hci = hci_init(cmdline);
|
||||
|
@ -525,19 +535,17 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
|
|||
|
||||
if (!hci)
|
||||
return NULL;
|
||||
dev = usb_create_simple(bus, "usb-bt-dongle");
|
||||
dev = usb_create(bus, name);
|
||||
if (!dev) {
|
||||
error_report("Failed to create USB device '%s'", name);
|
||||
return NULL;
|
||||
}
|
||||
s = DO_UPCAST(struct USBBtState, dev, dev);
|
||||
s->dev.opaque = s;
|
||||
|
||||
s->hci = hci;
|
||||
s->hci->opaque = s;
|
||||
s->hci->evt_recv = usb_bt_out_hci_packet_event;
|
||||
s->hci->acl_recv = usb_bt_out_hci_packet_acl;
|
||||
|
||||
usb_bt_handle_reset(&s->dev);
|
||||
if (qdev_init(&dev->qdev) < 0) {
|
||||
error_report("Failed to initialize USB device '%s'", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
|
|
@ -3703,6 +3703,7 @@ static const VMStateDescription vmstate_xhci_event = {
|
|||
VMSTATE_UINT32(flags, XHCIEvent),
|
||||
VMSTATE_UINT8(slotid, XHCIEvent),
|
||||
VMSTATE_UINT8(epid, XHCIEvent),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -309,7 +309,9 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
|
|||
uint64_t size)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < dev->nvqs; ++i) {
|
||||
int r = 0;
|
||||
|
||||
for (i = 0; !r && i < dev->nvqs; ++i) {
|
||||
struct vhost_virtqueue *vq = dev->vqs + i;
|
||||
hwaddr l;
|
||||
void *p;
|
||||
|
@ -321,15 +323,15 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
|
|||
p = cpu_physical_memory_map(vq->ring_phys, &l, 1);
|
||||
if (!p || l != vq->ring_size) {
|
||||
fprintf(stderr, "Unable to map ring buffer for ring %d\n", i);
|
||||
return -ENOMEM;
|
||||
r = -ENOMEM;
|
||||
}
|
||||
if (p != vq->ring) {
|
||||
fprintf(stderr, "Ring buffer relocated for ring %d\n", i);
|
||||
return -EBUSY;
|
||||
r = -EBUSY;
|
||||
}
|
||||
cpu_physical_memory_unmap(p, l, 0, 0);
|
||||
}
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
static struct vhost_memory_region *vhost_dev_find_reg(struct vhost_dev *dev,
|
||||
|
|
|
@ -430,6 +430,12 @@ void virtqueue_map_sg(struct iovec *sg, hwaddr *addr,
|
|||
unsigned int i;
|
||||
hwaddr len;
|
||||
|
||||
if (num_sg > VIRTQUEUE_MAX_SIZE) {
|
||||
error_report("virtio: map attempt out of bounds: %zd > %d",
|
||||
num_sg, VIRTQUEUE_MAX_SIZE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_sg; i++) {
|
||||
len = sg[i].iov_len;
|
||||
sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write);
|
||||
|
@ -891,7 +897,9 @@ int virtio_set_features(VirtIODevice *vdev, uint32_t val)
|
|||
|
||||
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
||||
{
|
||||
int num, i, ret;
|
||||
int i, ret;
|
||||
int32_t config_len;
|
||||
uint32_t num;
|
||||
uint32_t features;
|
||||
uint32_t supported_features;
|
||||
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
|
||||
|
@ -906,6 +914,9 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
|||
qemu_get_8s(f, &vdev->status);
|
||||
qemu_get_8s(f, &vdev->isr);
|
||||
qemu_get_be16s(f, &vdev->queue_sel);
|
||||
if (vdev->queue_sel >= VIRTIO_PCI_QUEUE_MAX) {
|
||||
return -1;
|
||||
}
|
||||
qemu_get_be32s(f, &features);
|
||||
|
||||
if (virtio_set_features(vdev, features) < 0) {
|
||||
|
@ -914,11 +925,27 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
|||
features, supported_features);
|
||||
return -1;
|
||||
}
|
||||
vdev->config_len = qemu_get_be32(f);
|
||||
qemu_get_buffer(f, vdev->config, vdev->config_len);
|
||||
config_len = qemu_get_be32(f);
|
||||
|
||||
/*
|
||||
* There are cases where the incoming config can be bigger or smaller
|
||||
* than what we have; so load what we have space for, and skip
|
||||
* any excess that's in the stream.
|
||||
*/
|
||||
qemu_get_buffer(f, vdev->config, MIN(config_len, vdev->config_len));
|
||||
|
||||
while (config_len > vdev->config_len) {
|
||||
qemu_get_byte(f);
|
||||
config_len--;
|
||||
}
|
||||
|
||||
num = qemu_get_be32(f);
|
||||
|
||||
if (num > VIRTIO_PCI_QUEUE_MAX) {
|
||||
error_report("Invalid number of PCI queues: 0x%x", num);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
vdev->vq[i].vring.num = qemu_get_be32(f);
|
||||
if (k->has_variable_vring_alignment) {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
typedef struct LxBoardDesc {
|
||||
hwaddr flash_base;
|
||||
size_t flash_size;
|
||||
size_t flash_boot_base;
|
||||
size_t flash_sector_size;
|
||||
size_t sram_size;
|
||||
} LxBoardDesc;
|
||||
|
@ -266,9 +267,9 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
|
|||
MemoryRegion *flash_io = g_malloc(sizeof(*flash_io));
|
||||
|
||||
memory_region_init_alias(flash_io, NULL, "lx60.flash",
|
||||
flash_mr, 0,
|
||||
board->flash_size < 0x02000000 ?
|
||||
board->flash_size : 0x02000000);
|
||||
flash_mr, board->flash_boot_base,
|
||||
board->flash_size - board->flash_boot_base < 0x02000000 ?
|
||||
board->flash_size - board->flash_boot_base : 0x02000000);
|
||||
memory_region_add_subregion(system_memory, 0xfe000000,
|
||||
flash_io);
|
||||
}
|
||||
|
@ -313,6 +314,7 @@ static void xtensa_kc705_init(QEMUMachineInitArgs *args)
|
|||
static const LxBoardDesc kc705_board = {
|
||||
.flash_base = 0xf0000000,
|
||||
.flash_size = 0x08000000,
|
||||
.flash_boot_base = 0x06000000,
|
||||
.flash_sector_size = 0x20000,
|
||||
.sram_size = 0x2000000,
|
||||
};
|
||||
|
|
|
@ -143,6 +143,14 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
|
|||
*/
|
||||
void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns);
|
||||
|
||||
/**
|
||||
* block_job_yield:
|
||||
* @job: The job that calls the function.
|
||||
*
|
||||
* Yield the block job coroutine.
|
||||
*/
|
||||
void block_job_yield(BlockJob *job);
|
||||
|
||||
/**
|
||||
* block_job_completed:
|
||||
* @job: The job being completed.
|
||||
|
|
|
@ -63,7 +63,6 @@ typedef uint64_t uint64;
|
|||
typedef int64_t int64;
|
||||
|
||||
#define LIT64( a ) a##LL
|
||||
#define INLINE static inline
|
||||
|
||||
#define STATUS_PARAM , float_status *status
|
||||
#define STATUS(field) status->field
|
||||
|
@ -181,59 +180,59 @@ typedef struct float_status {
|
|||
flag default_nan_mode;
|
||||
} float_status;
|
||||
|
||||
INLINE void set_float_detect_tininess(int val STATUS_PARAM)
|
||||
static inline void set_float_detect_tininess(int val STATUS_PARAM)
|
||||
{
|
||||
STATUS(float_detect_tininess) = val;
|
||||
}
|
||||
INLINE void set_float_rounding_mode(int val STATUS_PARAM)
|
||||
static inline void set_float_rounding_mode(int val STATUS_PARAM)
|
||||
{
|
||||
STATUS(float_rounding_mode) = val;
|
||||
}
|
||||
INLINE void set_float_exception_flags(int val STATUS_PARAM)
|
||||
static inline void set_float_exception_flags(int val STATUS_PARAM)
|
||||
{
|
||||
STATUS(float_exception_flags) = val;
|
||||
}
|
||||
INLINE void set_floatx80_rounding_precision(int val STATUS_PARAM)
|
||||
static inline void set_floatx80_rounding_precision(int val STATUS_PARAM)
|
||||
{
|
||||
STATUS(floatx80_rounding_precision) = val;
|
||||
}
|
||||
INLINE void set_flush_to_zero(flag val STATUS_PARAM)
|
||||
static inline void set_flush_to_zero(flag val STATUS_PARAM)
|
||||
{
|
||||
STATUS(flush_to_zero) = val;
|
||||
}
|
||||
INLINE void set_flush_inputs_to_zero(flag val STATUS_PARAM)
|
||||
static inline void set_flush_inputs_to_zero(flag val STATUS_PARAM)
|
||||
{
|
||||
STATUS(flush_inputs_to_zero) = val;
|
||||
}
|
||||
INLINE void set_default_nan_mode(flag val STATUS_PARAM)
|
||||
static inline void set_default_nan_mode(flag val STATUS_PARAM)
|
||||
{
|
||||
STATUS(default_nan_mode) = val;
|
||||
}
|
||||
INLINE int get_float_detect_tininess(float_status *status)
|
||||
static inline int get_float_detect_tininess(float_status *status)
|
||||
{
|
||||
return STATUS(float_detect_tininess);
|
||||
}
|
||||
INLINE int get_float_rounding_mode(float_status *status)
|
||||
static inline int get_float_rounding_mode(float_status *status)
|
||||
{
|
||||
return STATUS(float_rounding_mode);
|
||||
}
|
||||
INLINE int get_float_exception_flags(float_status *status)
|
||||
static inline int get_float_exception_flags(float_status *status)
|
||||
{
|
||||
return STATUS(float_exception_flags);
|
||||
}
|
||||
INLINE int get_floatx80_rounding_precision(float_status *status)
|
||||
static inline int get_floatx80_rounding_precision(float_status *status)
|
||||
{
|
||||
return STATUS(floatx80_rounding_precision);
|
||||
}
|
||||
INLINE flag get_flush_to_zero(float_status *status)
|
||||
static inline flag get_flush_to_zero(float_status *status)
|
||||
{
|
||||
return STATUS(flush_to_zero);
|
||||
}
|
||||
INLINE flag get_flush_inputs_to_zero(float_status *status)
|
||||
static inline flag get_flush_inputs_to_zero(float_status *status)
|
||||
{
|
||||
return STATUS(flush_inputs_to_zero);
|
||||
}
|
||||
INLINE flag get_default_nan_mode(float_status *status)
|
||||
static inline flag get_default_nan_mode(float_status *status)
|
||||
{
|
||||
return STATUS(default_nan_mode);
|
||||
}
|
||||
|
@ -284,22 +283,22 @@ float128 int64_to_float128(int64_t STATUS_PARAM);
|
|||
float128 uint64_to_float128(uint64_t STATUS_PARAM);
|
||||
|
||||
/* We provide the int16 versions for symmetry of API with float-to-int */
|
||||
INLINE float32 int16_to_float32(int16_t v STATUS_PARAM)
|
||||
static inline float32 int16_to_float32(int16_t v STATUS_PARAM)
|
||||
{
|
||||
return int32_to_float32(v STATUS_VAR);
|
||||
}
|
||||
|
||||
INLINE float32 uint16_to_float32(uint16_t v STATUS_PARAM)
|
||||
static inline float32 uint16_to_float32(uint16_t v STATUS_PARAM)
|
||||
{
|
||||
return uint32_to_float32(v STATUS_VAR);
|
||||
}
|
||||
|
||||
INLINE float64 int16_to_float64(int16_t v STATUS_PARAM)
|
||||
static inline float64 int16_to_float64(int16_t v STATUS_PARAM)
|
||||
{
|
||||
return int32_to_float64(v STATUS_VAR);
|
||||
}
|
||||
|
||||
INLINE float64 uint16_to_float64(uint16_t v STATUS_PARAM)
|
||||
static inline float64 uint16_to_float64(uint16_t v STATUS_PARAM)
|
||||
{
|
||||
return uint32_to_float64(v STATUS_VAR);
|
||||
}
|
||||
|
@ -319,7 +318,7 @@ int float16_is_quiet_nan( float16 );
|
|||
int float16_is_signaling_nan( float16 );
|
||||
float16 float16_maybe_silence_nan( float16 );
|
||||
|
||||
INLINE int float16_is_any_nan(float16 a)
|
||||
static inline int float16_is_any_nan(float16 a)
|
||||
{
|
||||
return ((float16_val(a) & ~0x8000) > 0x7c00);
|
||||
}
|
||||
|
@ -380,7 +379,7 @@ int float32_is_signaling_nan( float32 );
|
|||
float32 float32_maybe_silence_nan( float32 );
|
||||
float32 float32_scalbn( float32, int STATUS_PARAM );
|
||||
|
||||
INLINE float32 float32_abs(float32 a)
|
||||
static inline float32 float32_abs(float32 a)
|
||||
{
|
||||
/* Note that abs does *not* handle NaN specially, nor does
|
||||
* it flush denormal inputs to zero.
|
||||
|
@ -388,7 +387,7 @@ INLINE float32 float32_abs(float32 a)
|
|||
return make_float32(float32_val(a) & 0x7fffffff);
|
||||
}
|
||||
|
||||
INLINE float32 float32_chs(float32 a)
|
||||
static inline float32 float32_chs(float32 a)
|
||||
{
|
||||
/* Note that chs does *not* handle NaN specially, nor does
|
||||
* it flush denormal inputs to zero.
|
||||
|
@ -396,32 +395,32 @@ INLINE float32 float32_chs(float32 a)
|
|||
return make_float32(float32_val(a) ^ 0x80000000);
|
||||
}
|
||||
|
||||
INLINE int float32_is_infinity(float32 a)
|
||||
static inline int float32_is_infinity(float32 a)
|
||||
{
|
||||
return (float32_val(a) & 0x7fffffff) == 0x7f800000;
|
||||
}
|
||||
|
||||
INLINE int float32_is_neg(float32 a)
|
||||
static inline int float32_is_neg(float32 a)
|
||||
{
|
||||
return float32_val(a) >> 31;
|
||||
}
|
||||
|
||||
INLINE int float32_is_zero(float32 a)
|
||||
static inline int float32_is_zero(float32 a)
|
||||
{
|
||||
return (float32_val(a) & 0x7fffffff) == 0;
|
||||
}
|
||||
|
||||
INLINE int float32_is_any_nan(float32 a)
|
||||
static inline int float32_is_any_nan(float32 a)
|
||||
{
|
||||
return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL);
|
||||
}
|
||||
|
||||
INLINE int float32_is_zero_or_denormal(float32 a)
|
||||
static inline int float32_is_zero_or_denormal(float32 a)
|
||||
{
|
||||
return (float32_val(a) & 0x7f800000) == 0;
|
||||
}
|
||||
|
||||
INLINE float32 float32_set_sign(float32 a, int sign)
|
||||
static inline float32 float32_set_sign(float32 a, int sign)
|
||||
{
|
||||
return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31));
|
||||
}
|
||||
|
@ -490,7 +489,7 @@ int float64_is_signaling_nan( float64 );
|
|||
float64 float64_maybe_silence_nan( float64 );
|
||||
float64 float64_scalbn( float64, int STATUS_PARAM );
|
||||
|
||||
INLINE float64 float64_abs(float64 a)
|
||||
static inline float64 float64_abs(float64 a)
|
||||
{
|
||||
/* Note that abs does *not* handle NaN specially, nor does
|
||||
* it flush denormal inputs to zero.
|
||||
|
@ -498,7 +497,7 @@ INLINE float64 float64_abs(float64 a)
|
|||
return make_float64(float64_val(a) & 0x7fffffffffffffffLL);
|
||||
}
|
||||
|
||||
INLINE float64 float64_chs(float64 a)
|
||||
static inline float64 float64_chs(float64 a)
|
||||
{
|
||||
/* Note that chs does *not* handle NaN specially, nor does
|
||||
* it flush denormal inputs to zero.
|
||||
|
@ -506,32 +505,32 @@ INLINE float64 float64_chs(float64 a)
|
|||
return make_float64(float64_val(a) ^ 0x8000000000000000LL);
|
||||
}
|
||||
|
||||
INLINE int float64_is_infinity(float64 a)
|
||||
static inline int float64_is_infinity(float64 a)
|
||||
{
|
||||
return (float64_val(a) & 0x7fffffffffffffffLL ) == 0x7ff0000000000000LL;
|
||||
}
|
||||
|
||||
INLINE int float64_is_neg(float64 a)
|
||||
static inline int float64_is_neg(float64 a)
|
||||
{
|
||||
return float64_val(a) >> 63;
|
||||
}
|
||||
|
||||
INLINE int float64_is_zero(float64 a)
|
||||
static inline int float64_is_zero(float64 a)
|
||||
{
|
||||
return (float64_val(a) & 0x7fffffffffffffffLL) == 0;
|
||||
}
|
||||
|
||||
INLINE int float64_is_any_nan(float64 a)
|
||||
static inline int float64_is_any_nan(float64 a)
|
||||
{
|
||||
return ((float64_val(a) & ~(1ULL << 63)) > 0x7ff0000000000000ULL);
|
||||
}
|
||||
|
||||
INLINE int float64_is_zero_or_denormal(float64 a)
|
||||
static inline int float64_is_zero_or_denormal(float64 a)
|
||||
{
|
||||
return (float64_val(a) & 0x7ff0000000000000LL) == 0;
|
||||
}
|
||||
|
||||
INLINE float64 float64_set_sign(float64 a, int sign)
|
||||
static inline float64 float64_set_sign(float64 a, int sign)
|
||||
{
|
||||
return make_float64((float64_val(a) & 0x7fffffffffffffffULL)
|
||||
| ((int64_t)sign << 63));
|
||||
|
@ -585,39 +584,39 @@ int floatx80_is_signaling_nan( floatx80 );
|
|||
floatx80 floatx80_maybe_silence_nan( floatx80 );
|
||||
floatx80 floatx80_scalbn( floatx80, int STATUS_PARAM );
|
||||
|
||||
INLINE floatx80 floatx80_abs(floatx80 a)
|
||||
static inline floatx80 floatx80_abs(floatx80 a)
|
||||
{
|
||||
a.high &= 0x7fff;
|
||||
return a;
|
||||
}
|
||||
|
||||
INLINE floatx80 floatx80_chs(floatx80 a)
|
||||
static inline floatx80 floatx80_chs(floatx80 a)
|
||||
{
|
||||
a.high ^= 0x8000;
|
||||
return a;
|
||||
}
|
||||
|
||||
INLINE int floatx80_is_infinity(floatx80 a)
|
||||
static inline int floatx80_is_infinity(floatx80 a)
|
||||
{
|
||||
return (a.high & 0x7fff) == 0x7fff && a.low == 0x8000000000000000LL;
|
||||
}
|
||||
|
||||
INLINE int floatx80_is_neg(floatx80 a)
|
||||
static inline int floatx80_is_neg(floatx80 a)
|
||||
{
|
||||
return a.high >> 15;
|
||||
}
|
||||
|
||||
INLINE int floatx80_is_zero(floatx80 a)
|
||||
static inline int floatx80_is_zero(floatx80 a)
|
||||
{
|
||||
return (a.high & 0x7fff) == 0 && a.low == 0;
|
||||
}
|
||||
|
||||
INLINE int floatx80_is_zero_or_denormal(floatx80 a)
|
||||
static inline int floatx80_is_zero_or_denormal(floatx80 a)
|
||||
{
|
||||
return (a.high & 0x7fff) == 0;
|
||||
}
|
||||
|
||||
INLINE int floatx80_is_any_nan(floatx80 a)
|
||||
static inline int floatx80_is_any_nan(floatx80 a)
|
||||
{
|
||||
return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1);
|
||||
}
|
||||
|
@ -670,39 +669,39 @@ int float128_is_signaling_nan( float128 );
|
|||
float128 float128_maybe_silence_nan( float128 );
|
||||
float128 float128_scalbn( float128, int STATUS_PARAM );
|
||||
|
||||
INLINE float128 float128_abs(float128 a)
|
||||
static inline float128 float128_abs(float128 a)
|
||||
{
|
||||
a.high &= 0x7fffffffffffffffLL;
|
||||
return a;
|
||||
}
|
||||
|
||||
INLINE float128 float128_chs(float128 a)
|
||||
static inline float128 float128_chs(float128 a)
|
||||
{
|
||||
a.high ^= 0x8000000000000000LL;
|
||||
return a;
|
||||
}
|
||||
|
||||
INLINE int float128_is_infinity(float128 a)
|
||||
static inline int float128_is_infinity(float128 a)
|
||||
{
|
||||
return (a.high & 0x7fffffffffffffffLL) == 0x7fff000000000000LL && a.low == 0;
|
||||
}
|
||||
|
||||
INLINE int float128_is_neg(float128 a)
|
||||
static inline int float128_is_neg(float128 a)
|
||||
{
|
||||
return a.high >> 63;
|
||||
}
|
||||
|
||||
INLINE int float128_is_zero(float128 a)
|
||||
static inline int float128_is_zero(float128 a)
|
||||
{
|
||||
return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0;
|
||||
}
|
||||
|
||||
INLINE int float128_is_zero_or_denormal(float128 a)
|
||||
static inline int float128_is_zero_or_denormal(float128 a)
|
||||
{
|
||||
return (a.high & 0x7fff000000000000LL) == 0;
|
||||
}
|
||||
|
||||
INLINE int float128_is_any_nan(float128 a)
|
||||
static inline int float128_is_any_nan(float128 a)
|
||||
{
|
||||
return ((a.high >> 48) & 0x7fff) == 0x7fff &&
|
||||
((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0));
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
#include "qemu/option.h"
|
||||
|
||||
void smbios_entry_add(QemuOpts *opts);
|
||||
void smbios_set_type1_defaults(const char *manufacturer,
|
||||
const char *product, const char *version);
|
||||
uint8_t *smbios_get_table(size_t *length);
|
||||
void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
const char *version);
|
||||
uint8_t *smbios_get_table_legacy(size_t *length);
|
||||
|
||||
/*
|
||||
* SMBIOS spec defined tables
|
||||
|
|
|
@ -176,8 +176,8 @@ typedef struct VirtIONet {
|
|||
uint8_t nobcast;
|
||||
uint8_t vhost_started;
|
||||
struct {
|
||||
int in_use;
|
||||
int first_multi;
|
||||
uint32_t in_use;
|
||||
uint32_t first_multi;
|
||||
uint8_t multi_overflow;
|
||||
uint8_t uni_overflow;
|
||||
uint8_t *macs;
|
||||
|
|
|
@ -186,7 +186,12 @@ typedef struct {
|
|||
DEFINE_PROP_BIT("param_change", _state, _feature_field, \
|
||||
VIRTIO_SCSI_F_CHANGE, true)
|
||||
|
||||
void virtio_scsi_common_realize(DeviceState *dev, Error **errp);
|
||||
typedef void (*HandleOutput)(VirtIODevice *, VirtQueue *);
|
||||
|
||||
void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
|
||||
HandleOutput ctrl, HandleOutput evt,
|
||||
HandleOutput cmd);
|
||||
|
||||
void virtio_scsi_common_unrealize(DeviceState *dev, Error **errp);
|
||||
|
||||
#endif /* _QEMU_VIRTIO_SCSI_H */
|
||||
|
|
|
@ -100,6 +100,7 @@ enum VMStateFlags {
|
|||
VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
|
||||
VMS_VARRAY_UINT8 = 0x400, /* Array with size in uint8_t field*/
|
||||
VMS_VARRAY_UINT32 = 0x800, /* Array with size in uint32_t field*/
|
||||
VMS_MUST_EXIST = 0x1000, /* Field must exist in input */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -203,6 +204,14 @@ extern const VMStateInfo vmstate_info_bitmap;
|
|||
.offset = vmstate_offset_value(_state, _field, _type), \
|
||||
}
|
||||
|
||||
/* Validate state using a boolean predicate. */
|
||||
#define VMSTATE_VALIDATE(_name, _test) { \
|
||||
.name = (_name), \
|
||||
.field_exists = (_test), \
|
||||
.flags = VMS_ARRAY | VMS_MUST_EXIST, \
|
||||
.num = 0, /* 0 elements: no data, only run _test */ \
|
||||
}
|
||||
|
||||
#define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
|
||||
.name = (stringify(_field)), \
|
||||
.version_id = (_version), \
|
||||
|
|
|
@ -948,7 +948,7 @@ void kvm_init_irq_routing(KVMState *s)
|
|||
{
|
||||
int gsi_count, i;
|
||||
|
||||
gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING);
|
||||
gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING) - 1;
|
||||
if (gsi_count > 0) {
|
||||
unsigned int gsi_bits, i;
|
||||
|
||||
|
@ -2022,12 +2022,13 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
|
|||
{
|
||||
struct kvm_sw_breakpoint *bp, *next;
|
||||
KVMState *s = cpu->kvm_state;
|
||||
CPUState *tmpcpu;
|
||||
|
||||
QTAILQ_FOREACH_SAFE(bp, &s->kvm_sw_breakpoints, entry, next) {
|
||||
if (kvm_arch_remove_sw_breakpoint(cpu, bp) != 0) {
|
||||
/* Try harder to find a CPU that currently sees the breakpoint. */
|
||||
CPU_FOREACH(cpu) {
|
||||
if (kvm_arch_remove_sw_breakpoint(cpu, bp) == 0) {
|
||||
CPU_FOREACH(tmpcpu) {
|
||||
if (kvm_arch_remove_sw_breakpoint(tmpcpu, bp) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,17 +267,15 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUX86State *en
|
|||
|
||||
#ifdef TARGET_ARM
|
||||
|
||||
#ifndef TARGET_AARCH64
|
||||
/* 32 bit ARM definitions */
|
||||
|
||||
#define ELF_START_MMAP 0x80000000
|
||||
|
||||
#define elf_check_arch(x) ((x) == ELF_MACHINE)
|
||||
|
||||
#define ELF_ARCH ELF_MACHINE
|
||||
|
||||
#ifdef TARGET_AARCH64
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#else
|
||||
#define ELF_CLASS ELFCLASS32
|
||||
#endif
|
||||
|
||||
static inline void init_thread(struct target_pt_regs *regs,
|
||||
struct image_info *infop)
|
||||
|
@ -285,10 +283,6 @@ static inline void init_thread(struct target_pt_regs *regs,
|
|||
abi_long stack = infop->start_stack;
|
||||
memset(regs, 0, sizeof(*regs));
|
||||
|
||||
#ifdef TARGET_AARCH64
|
||||
regs->pc = infop->entry & ~0x3ULL;
|
||||
regs->sp = stack;
|
||||
#else
|
||||
regs->ARM_cpsr = 0x10;
|
||||
if (infop->entry & 1)
|
||||
regs->ARM_cpsr |= CPSR_T;
|
||||
|
@ -302,7 +296,6 @@ static inline void init_thread(struct target_pt_regs *regs,
|
|||
/* For uClinux PIC binaries. */
|
||||
/* XXX: Linux does this only on ARM with no MMU (do we care ?) */
|
||||
regs->ARM_r10 = infop->start_data;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define ELF_NREG 18
|
||||
|
@ -346,13 +339,20 @@ enum
|
|||
ARM_HWCAP_ARM_EDSP = 1 << 7,
|
||||
ARM_HWCAP_ARM_JAVA = 1 << 8,
|
||||
ARM_HWCAP_ARM_IWMMXT = 1 << 9,
|
||||
ARM_HWCAP_ARM_THUMBEE = 1 << 10,
|
||||
ARM_HWCAP_ARM_NEON = 1 << 11,
|
||||
ARM_HWCAP_ARM_VFPv3 = 1 << 12,
|
||||
ARM_HWCAP_ARM_VFPv3D16 = 1 << 13,
|
||||
ARM_HWCAP_ARM_CRUNCH = 1 << 10,
|
||||
ARM_HWCAP_ARM_THUMBEE = 1 << 11,
|
||||
ARM_HWCAP_ARM_NEON = 1 << 12,
|
||||
ARM_HWCAP_ARM_VFPv3 = 1 << 13,
|
||||
ARM_HWCAP_ARM_VFPv3D16 = 1 << 14,
|
||||
ARM_HWCAP_ARM_TLS = 1 << 15,
|
||||
ARM_HWCAP_ARM_VFPv4 = 1 << 16,
|
||||
ARM_HWCAP_ARM_IDIVA = 1 << 17,
|
||||
ARM_HWCAP_ARM_IDIVT = 1 << 18,
|
||||
ARM_HWCAP_ARM_VFPD32 = 1 << 19,
|
||||
ARM_HWCAP_ARM_LPAE = 1 << 20,
|
||||
ARM_HWCAP_ARM_EVTSTRM = 1 << 21,
|
||||
};
|
||||
|
||||
#ifndef TARGET_AARCH64
|
||||
/* The commpage only exists for 32 bit kernels */
|
||||
|
||||
#define TARGET_HAS_VALIDATE_GUEST_SPACE
|
||||
|
@ -414,7 +414,6 @@ static int validate_guest_space(unsigned long guest_base,
|
|||
|
||||
return 1; /* All good */
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ELF_HWCAP get_elf_hwcap()
|
||||
|
||||
|
@ -427,23 +426,103 @@ static uint32_t get_elf_hwcap(void)
|
|||
hwcaps |= ARM_HWCAP_ARM_HALF;
|
||||
hwcaps |= ARM_HWCAP_ARM_THUMB;
|
||||
hwcaps |= ARM_HWCAP_ARM_FAST_MULT;
|
||||
hwcaps |= ARM_HWCAP_ARM_FPA;
|
||||
|
||||
/* probe for the extra features */
|
||||
#define GET_FEATURE(feat, hwcap) \
|
||||
do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)
|
||||
/* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */
|
||||
GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP);
|
||||
GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP);
|
||||
GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT);
|
||||
GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE);
|
||||
GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON);
|
||||
GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3);
|
||||
GET_FEATURE(ARM_FEATURE_VFP_FP16, ARM_HWCAP_ARM_VFPv3D16);
|
||||
GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS);
|
||||
GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4);
|
||||
GET_FEATURE(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA);
|
||||
GET_FEATURE(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT);
|
||||
/* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c.
|
||||
* Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of
|
||||
* ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated
|
||||
* to our VFP_FP16 feature bit.
|
||||
*/
|
||||
GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32);
|
||||
GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE);
|
||||
#undef GET_FEATURE
|
||||
|
||||
return hwcaps;
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
/* 64 bit ARM definitions */
|
||||
#define ELF_START_MMAP 0x80000000
|
||||
|
||||
#define elf_check_arch(x) ((x) == ELF_MACHINE)
|
||||
|
||||
#define ELF_ARCH ELF_MACHINE
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#define ELF_PLATFORM "aarch64"
|
||||
|
||||
static inline void init_thread(struct target_pt_regs *regs,
|
||||
struct image_info *infop)
|
||||
{
|
||||
abi_long stack = infop->start_stack;
|
||||
memset(regs, 0, sizeof(*regs));
|
||||
|
||||
regs->pc = infop->entry & ~0x3ULL;
|
||||
regs->sp = stack;
|
||||
}
|
||||
|
||||
#define ELF_NREG 34
|
||||
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
|
||||
|
||||
static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
||||
const CPUARMState *env)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
(*regs)[i] = tswapreg(env->xregs[i]);
|
||||
}
|
||||
(*regs)[32] = tswapreg(env->pc);
|
||||
(*regs)[33] = tswapreg(pstate_read((CPUARMState *)env));
|
||||
}
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
#define ELF_EXEC_PAGESIZE 4096
|
||||
|
||||
enum {
|
||||
ARM_HWCAP_A64_FP = 1 << 0,
|
||||
ARM_HWCAP_A64_ASIMD = 1 << 1,
|
||||
ARM_HWCAP_A64_EVTSTRM = 1 << 2,
|
||||
ARM_HWCAP_A64_AES = 1 << 3,
|
||||
ARM_HWCAP_A64_PMULL = 1 << 4,
|
||||
ARM_HWCAP_A64_SHA1 = 1 << 5,
|
||||
ARM_HWCAP_A64_SHA2 = 1 << 6,
|
||||
ARM_HWCAP_A64_CRC32 = 1 << 7,
|
||||
};
|
||||
|
||||
#define ELF_HWCAP get_elf_hwcap()
|
||||
|
||||
static uint32_t get_elf_hwcap(void)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(thread_cpu);
|
||||
uint32_t hwcaps = 0;
|
||||
|
||||
hwcaps |= ARM_HWCAP_A64_FP;
|
||||
hwcaps |= ARM_HWCAP_A64_ASIMD;
|
||||
|
||||
/* probe for the extra features */
|
||||
#define GET_FEATURE(feat, hwcap) \
|
||||
do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)
|
||||
GET_FEATURE(ARM_FEATURE_V8_AES, ARM_HWCAP_A64_PMULL);
|
||||
#undef GET_FEATURE
|
||||
|
||||
return hwcaps;
|
||||
}
|
||||
|
||||
#endif /* not TARGET_AARCH64 */
|
||||
#endif /* TARGET_ARM */
|
||||
|
||||
#ifdef TARGET_UNICORE32
|
||||
|
||||
|
|
|
@ -7499,6 +7499,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
|||
ret = get_errno(sys_sched_getaffinity(arg1, mask_size, mask));
|
||||
|
||||
if (!is_error(ret)) {
|
||||
if (ret > arg2) {
|
||||
/* More data returned than the caller's buffer will fit.
|
||||
* This only happens if sizeof(abi_long) < sizeof(long)
|
||||
* and the caller passed us a buffer holding an odd number
|
||||
* of abi_longs. If the host kernel is actually using the
|
||||
* extra 4 bytes then fail EINVAL; otherwise we can just
|
||||
* ignore them and only copy the interesting part.
|
||||
*/
|
||||
int numcpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||
if (numcpus > arg2 * 8) {
|
||||
ret = -TARGET_EINVAL;
|
||||
break;
|
||||
}
|
||||
ret = arg2;
|
||||
}
|
||||
|
||||
if (copy_to_user(arg3, mask, ret)) {
|
||||
goto efault;
|
||||
}
|
||||
|
|
|
@ -1589,13 +1589,11 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf,
|
|||
}
|
||||
|
||||
|
||||
if (ibv_post_send(rdma->qp, &send_wr, &bad_wr)) {
|
||||
return -1;
|
||||
}
|
||||
ret = ibv_post_send(rdma->qp, &send_wr, &bad_wr);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret > 0) {
|
||||
fprintf(stderr, "Failed to use post IB SEND for control!\n");
|
||||
return ret;
|
||||
return -ret;
|
||||
}
|
||||
|
||||
ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_SEND_CONTROL, NULL);
|
||||
|
@ -2237,10 +2235,6 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
|
|||
}
|
||||
}
|
||||
|
||||
if (rdma->qp) {
|
||||
rdma_destroy_qp(rdma->cm_id);
|
||||
rdma->qp = NULL;
|
||||
}
|
||||
if (rdma->cq) {
|
||||
ibv_destroy_cq(rdma->cq);
|
||||
rdma->cq = NULL;
|
||||
|
@ -2258,6 +2252,10 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
|
|||
rdma->listen_id = NULL;
|
||||
}
|
||||
if (rdma->cm_id) {
|
||||
if (rdma->qp) {
|
||||
rdma_destroy_qp(rdma->cm_id);
|
||||
rdma->qp = NULL;
|
||||
}
|
||||
rdma_destroy_id(rdma->cm_id);
|
||||
rdma->cm_id = NULL;
|
||||
}
|
||||
|
@ -2512,8 +2510,10 @@ static void *qemu_rdma_data_init(const char *host_port, Error **errp)
|
|||
} else {
|
||||
ERROR(errp, "bad RDMA migration address '%s'", host_port);
|
||||
g_free(rdma);
|
||||
return NULL;
|
||||
rdma = NULL;
|
||||
}
|
||||
|
||||
qapi_free_InetSocketAddress(addr);
|
||||
}
|
||||
|
||||
return rdma;
|
||||
|
|
|
@ -98,7 +98,7 @@ static void process_incoming_migration_co(void *opaque)
|
|||
qemu_fclose(f);
|
||||
free_xbzrle_decoded_buf();
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "load of migration failed\n");
|
||||
error_report("load of migration failed: %s", strerror(-ret));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
qemu_announce_self();
|
||||
|
|
7
nbd.c
7
nbd.c
|
@ -1001,6 +1001,7 @@ static void nbd_trip(void *opaque)
|
|||
struct nbd_request request;
|
||||
struct nbd_reply reply;
|
||||
ssize_t ret;
|
||||
uint32_t command;
|
||||
|
||||
TRACE("Reading request.");
|
||||
if (client->closing) {
|
||||
|
@ -1023,8 +1024,8 @@ static void nbd_trip(void *opaque)
|
|||
reply.error = -ret;
|
||||
goto error_reply;
|
||||
}
|
||||
|
||||
if ((request.from + request.len) > exp->size) {
|
||||
command = request.type & NBD_CMD_MASK_COMMAND;
|
||||
if (command != NBD_CMD_DISC && (request.from + request.len) > exp->size) {
|
||||
LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
|
||||
", Offset: %" PRIu64 "\n",
|
||||
request.from, request.len,
|
||||
|
@ -1033,7 +1034,7 @@ static void nbd_trip(void *opaque)
|
|||
goto invalid_request;
|
||||
}
|
||||
|
||||
switch (request.type & NBD_CMD_MASK_COMMAND) {
|
||||
switch (command) {
|
||||
case NBD_CMD_READ:
|
||||
TRACE("Request type is READ");
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ install: $(OBJS)
|
|||
$(call quiet-command, msgfmt -o $@ $<, " GEN $@")
|
||||
|
||||
$(PO_PATH)/messages.po: $(SRC_PATH)/ui/gtk.c
|
||||
$(call quiet-command, cd $(SRC_PATH) && \
|
||||
(xgettext -o - --from-code=UTF-8 --foreign-user \
|
||||
$(call quiet-command, ( cd $(SRC_PATH) && \
|
||||
xgettext -o - --from-code=UTF-8 --foreign-user \
|
||||
--package-name=QEMU --package-version=$(VERSION) \
|
||||
--msgid-bugs-address=qemu-devel@nongnu.org -k_ -C ui/gtk.c | \
|
||||
sed -e s/CHARSET/UTF-8/) >$@, " GEN $@")
|
||||
|
|
|
@ -2094,8 +2094,9 @@
|
|||
# @base: #optional The file name of the backing image to write data into.
|
||||
# If not specified, this is the deepest backing image
|
||||
#
|
||||
# @top: The file name of the backing image within the image chain,
|
||||
# which contains the topmost data to be committed down.
|
||||
# @top: #optional The file name of the backing image within the image chain,
|
||||
# which contains the topmost data to be committed down. If
|
||||
# not specified, this is the active layer.
|
||||
#
|
||||
# If top == base, that is an error.
|
||||
# If top == active, the job will not be completed by itself,
|
||||
|
@ -2123,7 +2124,7 @@
|
|||
#
|
||||
##
|
||||
{ 'command': 'block-commit',
|
||||
'data': { 'device': 'str', '*base': 'str', 'top': 'str',
|
||||
'data': { 'device': 'str', '*base': 'str', '*top': 'str',
|
||||
'*speed': 'int' } }
|
||||
|
||||
##
|
||||
|
|
|
@ -131,7 +131,9 @@ static void qapi_dealloc_end_list(Visitor *v, Error **errp)
|
|||
static void qapi_dealloc_type_str(Visitor *v, char **obj, const char *name,
|
||||
Error **errp)
|
||||
{
|
||||
g_free(*obj);
|
||||
if (obj) {
|
||||
g_free(*obj);
|
||||
}
|
||||
}
|
||||
|
||||
static void qapi_dealloc_type_int(Visitor *v, int64_t *obj, const char *name,
|
||||
|
|
|
@ -206,7 +206,7 @@ int qdev_device_help(QemuOpts *opts)
|
|||
}
|
||||
}
|
||||
|
||||
if (!klass) {
|
||||
if (!object_class_dynamic_cast(klass, TYPE_DEVICE)) {
|
||||
return 0;
|
||||
}
|
||||
do {
|
||||
|
|
|
@ -1413,7 +1413,7 @@ static int img_convert(int argc, char **argv)
|
|||
ret = bdrv_parse_cache_flags(cache, &flags);
|
||||
if (ret < 0) {
|
||||
error_report("Invalid cache option: %s", cache);
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out_bs = bdrv_new_open(out_filename, out_fmt, flags, true, quiet);
|
||||
|
|
|
@ -54,6 +54,7 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
|
|||
|
||||
if (qemuio_bs) {
|
||||
fprintf(stderr, "file open already, try 'help close'\n");
|
||||
QDECREF(opts);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -171,6 +172,7 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
|
|||
} else if (optind == argc) {
|
||||
return openfile(NULL, flags, growable, opts);
|
||||
} else {
|
||||
QDECREF(opts);
|
||||
return qemuio_command_usage(&open_cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -369,8 +369,11 @@ static void nbd_accept(void *opaque)
|
|||
return;
|
||||
}
|
||||
|
||||
if (fd >= 0 && nbd_client_new(exp, fd, nbd_client_closed)) {
|
||||
if (nbd_client_new(exp, fd, nbd_client_closed)) {
|
||||
nb_fds++;
|
||||
} else {
|
||||
shutdown(fd, 2);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
static void acquire_privilege(const char *name, Error **err)
|
||||
{
|
||||
HANDLE token;
|
||||
HANDLE token = NULL;
|
||||
TOKEN_PRIVILEGES priv;
|
||||
Error *local_err = NULL;
|
||||
|
||||
|
@ -57,13 +57,15 @@ static void acquire_privilege(const char *name, Error **err)
|
|||
goto out;
|
||||
}
|
||||
|
||||
CloseHandle(token);
|
||||
} else {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to open privilege token");
|
||||
}
|
||||
|
||||
out:
|
||||
if (token) {
|
||||
CloseHandle(token);
|
||||
}
|
||||
if (local_err) {
|
||||
error_propagate(err, local_err);
|
||||
}
|
||||
|
|
|
@ -985,7 +985,7 @@ EQMP
|
|||
|
||||
{
|
||||
.name = "block-commit",
|
||||
.args_type = "device:B,base:s?,top:s,speed:o?",
|
||||
.args_type = "device:B,base:s?,top:s?,speed:o?",
|
||||
.mhandler.cmd_new = qmp_marshal_input_block_commit,
|
||||
},
|
||||
|
||||
|
@ -1003,7 +1003,8 @@ Arguments:
|
|||
If not specified, this is the deepest backing image
|
||||
(json-string, optional)
|
||||
- "top": The file name of the backing image within the image chain,
|
||||
which contains the topmost data to be committed down.
|
||||
which contains the topmost data to be committed down. If
|
||||
not specified, this is the active layer. (json-string, optional)
|
||||
|
||||
If top == base, that is an error.
|
||||
If top == active, the job will not be completed by itself,
|
||||
|
|
|
@ -632,7 +632,7 @@ static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|||
* contexts. (ARMv8 would permit us to do no masking at all, but ARMv7
|
||||
* requires the bottom five bits to be RAZ/WI because they're UNK/SBZP.)
|
||||
*/
|
||||
env->cp15.c12_vbar = value & ~0x1Ful;
|
||||
env->cp15.c12_vbar = value & ~0x1FULL;
|
||||
}
|
||||
|
||||
static uint64_t ccsidr_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
|
@ -963,16 +963,16 @@ static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|||
int timeridx = ri->crm & 1;
|
||||
uint32_t oldval = env->cp15.c14_timer[timeridx].ctl;
|
||||
|
||||
env->cp15.c14_timer[timeridx].ctl = value & 3;
|
||||
env->cp15.c14_timer[timeridx].ctl = deposit64(oldval, 0, 2, value);
|
||||
if ((oldval ^ value) & 1) {
|
||||
/* Enable toggled */
|
||||
gt_recalc_timer(cpu, timeridx);
|
||||
} else if ((oldval & value) & 2) {
|
||||
} else if ((oldval ^ value) & 2) {
|
||||
/* IMASK toggled: don't need to recalculate,
|
||||
* just set the interrupt line based on ISTATUS
|
||||
*/
|
||||
qemu_set_irq(cpu->gt_timer_outputs[timeridx],
|
||||
(oldval & 4) && (value & 2));
|
||||
(oldval & 4) && !(value & 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1432,8 +1432,10 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
|
|||
switch (opc) {
|
||||
case 0: /* BR */
|
||||
case 2: /* RET */
|
||||
tcg_gen_mov_i64(cpu_pc, cpu_reg(s, rn));
|
||||
break;
|
||||
case 1: /* BLR */
|
||||
tcg_gen_mov_i64(cpu_pc, cpu_reg(s, rn));
|
||||
tcg_gen_movi_i64(cpu_reg(s, 30), s->pc);
|
||||
break;
|
||||
case 4: /* ERET */
|
||||
|
@ -1449,7 +1451,6 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
|
|||
return;
|
||||
}
|
||||
|
||||
tcg_gen_mov_i64(cpu_pc, cpu_reg(s, rn));
|
||||
s->is_jmp = DISAS_JUMP;
|
||||
}
|
||||
|
||||
|
@ -7455,7 +7456,7 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn)
|
|||
}
|
||||
break;
|
||||
case 0x12: /* SQXTUN */
|
||||
if (u) {
|
||||
if (!u) {
|
||||
unallocated_encoding(s);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8328,27 +8328,39 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)
|
|||
if (insn & (1 << 5))
|
||||
gen_swap_half(tmp2);
|
||||
gen_smul_dual(tmp, tmp2);
|
||||
if (insn & (1 << 6)) {
|
||||
/* This subtraction cannot overflow. */
|
||||
tcg_gen_sub_i32(tmp, tmp, tmp2);
|
||||
} else {
|
||||
/* This addition cannot overflow 32 bits;
|
||||
* however it may overflow considered as a signed
|
||||
* operation, in which case we must set the Q flag.
|
||||
*/
|
||||
gen_helper_add_setq(tmp, cpu_env, tmp, tmp2);
|
||||
}
|
||||
tcg_temp_free_i32(tmp2);
|
||||
if (insn & (1 << 22)) {
|
||||
/* smlald, smlsld */
|
||||
TCGv_i64 tmp64_2;
|
||||
|
||||
tmp64 = tcg_temp_new_i64();
|
||||
tmp64_2 = tcg_temp_new_i64();
|
||||
tcg_gen_ext_i32_i64(tmp64, tmp);
|
||||
tcg_gen_ext_i32_i64(tmp64_2, tmp2);
|
||||
tcg_temp_free_i32(tmp);
|
||||
tcg_temp_free_i32(tmp2);
|
||||
if (insn & (1 << 6)) {
|
||||
tcg_gen_sub_i64(tmp64, tmp64, tmp64_2);
|
||||
} else {
|
||||
tcg_gen_add_i64(tmp64, tmp64, tmp64_2);
|
||||
}
|
||||
tcg_temp_free_i64(tmp64_2);
|
||||
gen_addq(s, tmp64, rd, rn);
|
||||
gen_storeq_reg(s, rd, rn, tmp64);
|
||||
tcg_temp_free_i64(tmp64);
|
||||
} else {
|
||||
/* smuad, smusd, smlad, smlsd */
|
||||
if (insn & (1 << 6)) {
|
||||
/* This subtraction cannot overflow. */
|
||||
tcg_gen_sub_i32(tmp, tmp, tmp2);
|
||||
} else {
|
||||
/* This addition cannot overflow 32 bits;
|
||||
* however it may overflow considered as a
|
||||
* signed operation, in which case we must set
|
||||
* the Q flag.
|
||||
*/
|
||||
gen_helper_add_setq(tmp, cpu_env, tmp, tmp2);
|
||||
}
|
||||
tcg_temp_free_i32(tmp2);
|
||||
if (rd != 15)
|
||||
{
|
||||
tmp2 = load_reg(s, rd);
|
||||
|
|
|
@ -566,15 +566,23 @@ struct X86CPUDefinition {
|
|||
CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER, CPUID_EXT_XSAVE,
|
||||
CPUID_EXT_OSXSAVE, CPUID_EXT_AVX, CPUID_EXT_F16C,
|
||||
CPUID_EXT_RDRAND */
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
#define TCG_EXT2_X86_64_FEATURES (CPUID_EXT2_SYSCALL | CPUID_EXT2_LM)
|
||||
#else
|
||||
#define TCG_EXT2_X86_64_FEATURES 0
|
||||
#endif
|
||||
|
||||
#define TCG_EXT2_FEATURES ((TCG_FEATURES & CPUID_EXT2_AMD_ALIASES) | \
|
||||
CPUID_EXT2_NX | CPUID_EXT2_MMXEXT | CPUID_EXT2_RDTSCP | \
|
||||
CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT)
|
||||
CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | \
|
||||
TCG_EXT2_X86_64_FEATURES)
|
||||
/* missing:
|
||||
CPUID_EXT2_PDPE1GB */
|
||||
#define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \
|
||||
CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A)
|
||||
#define TCG_SVM_FEATURES 0
|
||||
#define TCG_7_0_EBX_FEATURES (CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_SMAP \
|
||||
#define TCG_7_0_EBX_FEATURES (CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_SMAP | \
|
||||
CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX)
|
||||
/* missing:
|
||||
CPUID_7_0_EBX_FSGSBASE, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2,
|
||||
|
@ -2476,8 +2484,7 @@ static void x86_cpu_reset(CPUState *s)
|
|||
cpu_breakpoint_remove_all(s, BP_CPU);
|
||||
cpu_watchpoint_remove_all(s, BP_CPU);
|
||||
|
||||
env->tsc_adjust = 0;
|
||||
env->tsc = 0;
|
||||
env->xcr0 = 1;
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
/* We hard-wire the BSP to the first CPU. */
|
||||
|
@ -2591,11 +2598,8 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
|
|||
if (!kvm_enabled()) {
|
||||
env->features[FEAT_1_EDX] &= TCG_FEATURES;
|
||||
env->features[FEAT_1_ECX] &= TCG_EXT_FEATURES;
|
||||
env->features[FEAT_8000_0001_EDX] &= (TCG_EXT2_FEATURES
|
||||
#ifdef TARGET_X86_64
|
||||
| CPUID_EXT2_SYSCALL | CPUID_EXT2_LM
|
||||
#endif
|
||||
);
|
||||
env->features[FEAT_7_0_EBX] &= TCG_7_0_EBX_FEATURES;
|
||||
env->features[FEAT_8000_0001_EDX] &= TCG_EXT2_FEATURES;
|
||||
env->features[FEAT_8000_0001_ECX] &= TCG_EXT3_FEATURES;
|
||||
env->features[FEAT_SVM] &= TCG_SVM_FEATURES;
|
||||
} else {
|
||||
|
|
|
@ -797,6 +797,10 @@ typedef struct CPUX86State {
|
|||
target_ulong cr[5]; /* NOTE: cr1 is unused */
|
||||
int32_t a20_mask;
|
||||
|
||||
BNDReg bnd_regs[4];
|
||||
BNDCSReg bndcs_regs;
|
||||
uint64_t msr_bndcfgs;
|
||||
|
||||
/* FPU state */
|
||||
unsigned int fpstt; /* top of stack index */
|
||||
uint16_t fpus;
|
||||
|
@ -819,6 +823,8 @@ typedef struct CPUX86State {
|
|||
XMMReg xmm_t0;
|
||||
MMXReg mmx_t0;
|
||||
|
||||
XMMReg ymmh_regs[CPU_NB_REGS];
|
||||
|
||||
/* sysenter registers */
|
||||
uint32_t sysenter_cs;
|
||||
target_ulong sysenter_esp;
|
||||
|
@ -928,12 +934,7 @@ typedef struct CPUX86State {
|
|||
uint16_t fpus_vmstate;
|
||||
uint16_t fptag_vmstate;
|
||||
uint16_t fpregs_format_vmstate;
|
||||
|
||||
uint64_t xstate_bv;
|
||||
XMMReg ymmh_regs[CPU_NB_REGS];
|
||||
BNDReg bnd_regs[4];
|
||||
BNDCSReg bndcs_regs;
|
||||
uint64_t msr_bndcfgs;
|
||||
|
||||
uint64_t xcr0;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue