Compare commits
75 Commits
v1.6.1
...
baseline_f
Author | SHA1 | Date | |
---|---|---|---|
|
23fe2b3f9e | ||
|
a0dba644c1 | ||
|
c165473269 | ||
|
3bf4dfdd11 | ||
|
1466cef32d | ||
|
9eda7d373e | ||
|
1ae2757c6c | ||
|
1e09955619 | ||
|
396f79f45e | ||
|
89b439f313 | ||
|
43a52ce657 | ||
|
3b6fb9cab2 | ||
|
5650f5f48b | ||
|
9223836745 | ||
|
ee87e32f83 | ||
|
6b63ef4d0f | ||
|
4b38e989b4 | ||
|
04920fc0fa | ||
|
0851c9f75c | ||
|
c0b4cc1f9f | ||
|
ecfe10c9a6 | ||
|
9176e8fb8f | ||
|
72420ce9f0 | ||
|
237e4f92a8 | ||
|
230058106a | ||
|
66aae5e1ec | ||
|
6033e840c7 | ||
|
55d284af8e | ||
|
2452731c88 | ||
|
22d9e1a986 | ||
|
b643e4b90b | ||
|
e4a6540ded | ||
|
fe9120a5d1 | ||
|
bace999f8a | ||
|
4f071cf9b5 | ||
|
033ee5a5ac | ||
|
437f0f10a4 | ||
|
fcef61ec6b | ||
|
2f69ba1736 | ||
|
99d228d6e9 | ||
|
9188dbf71a | ||
|
ad666d91f4 | ||
|
de3a658f5b | ||
|
7c1840b686 | ||
|
3f1beaca88 | ||
|
f2e5dca46b | ||
|
1b9ecdb164 | ||
|
bb52b14be1 | ||
|
ce689368bb | ||
|
f0d3576599 | ||
|
d6d94c6785 | ||
|
5d289cc724 | ||
|
bed2e759eb | ||
|
94473d0c06 | ||
|
70ecdc6e4e | ||
|
372835fbc3 | ||
|
bc02fb304c | ||
|
0d1460226f | ||
|
164a101f28 | ||
|
35ecde2601 | ||
|
24d1a6d9d5 | ||
|
bf0da4df83 | ||
|
88266f5aa7 | ||
|
e1b5c52e04 | ||
|
b83c4db895 | ||
|
b114b68adf | ||
|
a9ead83261 | ||
|
ba96394e20 | ||
|
321bc0b2b2 | ||
|
92067bf4bf | ||
|
99a0b03650 | ||
|
8231c2dd22 | ||
|
747b0cb4b5 | ||
|
35143f0164 | ||
|
f202039811 |
2
.mailmap
2
.mailmap
@@ -2,7 +2,7 @@
|
||||
# into proper addresses so that they are counted properly in git shortlog output.
|
||||
#
|
||||
Andrzej Zaborowski <balrogg@gmail.com> balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Anthony Liguori <aliguori@us.ibm.com> aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Anthony Liguori <anthony@codemonkey.ws> aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Aurelien Jarno <aurelien@aurel32.net> aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Blue Swirl <blauwirbel@gmail.com> blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Edgar E. Iglesias <edgar.iglesias@gmail.com> edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
|
14
MAINTAINERS
14
MAINTAINERS
@@ -50,7 +50,7 @@ Descriptions of section entries:
|
||||
|
||||
General Project Administration
|
||||
------------------------------
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
M: Paul Brook <paul@codesourcery.com>
|
||||
|
||||
Guest CPU cores (TCG):
|
||||
@@ -509,7 +509,7 @@ F: hw/unicore32/
|
||||
X86 Machines
|
||||
------------
|
||||
PC
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
S: Supported
|
||||
F: hw/i386/pc.[ch]
|
||||
F: hw/i386/pc_piix.c
|
||||
@@ -593,7 +593,7 @@ S: Supported
|
||||
F: hw/*/*vhost*
|
||||
|
||||
virtio
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
S: Supported
|
||||
F: hw/*/virtio*
|
||||
|
||||
@@ -651,7 +651,7 @@ F: block/
|
||||
F: hw/block/
|
||||
|
||||
Character Devices
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
S: Maintained
|
||||
F: qemu-char.c
|
||||
|
||||
@@ -689,7 +689,7 @@ F: audio/spiceaudio.c
|
||||
F: hw/display/qxl*
|
||||
|
||||
Graphics
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
S: Maintained
|
||||
F: ui/
|
||||
|
||||
@@ -699,7 +699,7 @@ S: Odd Fixes
|
||||
F: ui/cocoa.m
|
||||
|
||||
Main loop
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
S: Supported
|
||||
F: vl.c
|
||||
|
||||
@@ -711,7 +711,7 @@ F: hmp.c
|
||||
F: hmp-commands.hx
|
||||
|
||||
Network device layer
|
||||
M: Anthony Liguori <aliguori@us.ibm.com>
|
||||
M: Anthony Liguori <anthony@codemonkey.ws>
|
||||
M: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
S: Maintained
|
||||
F: net/
|
||||
|
34
aio-posix.c
34
aio-posix.c
@@ -23,7 +23,6 @@ struct AioHandler
|
||||
GPollFD pfd;
|
||||
IOHandler *io_read;
|
||||
IOHandler *io_write;
|
||||
AioFlushHandler *io_flush;
|
||||
int deleted;
|
||||
int pollfds_idx;
|
||||
void *opaque;
|
||||
@@ -47,7 +46,6 @@ void aio_set_fd_handler(AioContext *ctx,
|
||||
int fd,
|
||||
IOHandler *io_read,
|
||||
IOHandler *io_write,
|
||||
AioFlushHandler *io_flush,
|
||||
void *opaque)
|
||||
{
|
||||
AioHandler *node;
|
||||
@@ -84,7 +82,6 @@ void aio_set_fd_handler(AioContext *ctx,
|
||||
/* Update handler with latest information */
|
||||
node->io_read = io_read;
|
||||
node->io_write = io_write;
|
||||
node->io_flush = io_flush;
|
||||
node->opaque = opaque;
|
||||
node->pollfds_idx = -1;
|
||||
|
||||
@@ -97,12 +94,10 @@ void aio_set_fd_handler(AioContext *ctx,
|
||||
|
||||
void aio_set_event_notifier(AioContext *ctx,
|
||||
EventNotifier *notifier,
|
||||
EventNotifierHandler *io_read,
|
||||
AioFlushEventNotifierHandler *io_flush)
|
||||
EventNotifierHandler *io_read)
|
||||
{
|
||||
aio_set_fd_handler(ctx, event_notifier_get_fd(notifier),
|
||||
(IOHandler *)io_read, NULL,
|
||||
(AioFlushHandler *)io_flush, notifier);
|
||||
(IOHandler *)io_read, NULL, notifier);
|
||||
}
|
||||
|
||||
bool aio_pending(AioContext *ctx)
|
||||
@@ -147,8 +142,12 @@ static bool aio_dispatch(AioContext *ctx)
|
||||
(revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) &&
|
||||
node->io_read) {
|
||||
node->io_read(node->opaque);
|
||||
|
||||
/* aio_notify() does not count as progress */
|
||||
if (node->opaque != &ctx->notifier) {
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
if (!node->deleted &&
|
||||
(revents & (G_IO_OUT | G_IO_ERR)) &&
|
||||
node->io_write) {
|
||||
@@ -173,7 +172,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
{
|
||||
AioHandler *node;
|
||||
int ret;
|
||||
bool busy, progress;
|
||||
bool progress;
|
||||
|
||||
progress = false;
|
||||
|
||||
@@ -200,20 +199,8 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
g_array_set_size(ctx->pollfds, 0);
|
||||
|
||||
/* fill pollfds */
|
||||
busy = false;
|
||||
QLIST_FOREACH(node, &ctx->aio_handlers, node) {
|
||||
node->pollfds_idx = -1;
|
||||
|
||||
/* If there aren't pending AIO operations, don't invoke callbacks.
|
||||
* Otherwise, if there are no AIO requests, qemu_aio_wait() would
|
||||
* wait indefinitely.
|
||||
*/
|
||||
if (!node->deleted && node->io_flush) {
|
||||
if (node->io_flush(node->opaque) == 0) {
|
||||
continue;
|
||||
}
|
||||
busy = true;
|
||||
}
|
||||
if (!node->deleted && node->pfd.events) {
|
||||
GPollFD pfd = {
|
||||
.fd = node->pfd.fd,
|
||||
@@ -226,8 +213,8 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
|
||||
ctx->walking_handlers--;
|
||||
|
||||
/* No AIO operations? Get us out of here */
|
||||
if (!busy) {
|
||||
/* early return if we only have the aio_notify() fd */
|
||||
if (ctx->pollfds->len == 1) {
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -250,6 +237,5 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
}
|
||||
}
|
||||
|
||||
assert(progress || busy);
|
||||
return true;
|
||||
return progress;
|
||||
}
|
||||
|
33
aio-win32.c
33
aio-win32.c
@@ -23,7 +23,6 @@
|
||||
struct AioHandler {
|
||||
EventNotifier *e;
|
||||
EventNotifierHandler *io_notify;
|
||||
AioFlushEventNotifierHandler *io_flush;
|
||||
GPollFD pfd;
|
||||
int deleted;
|
||||
QLIST_ENTRY(AioHandler) node;
|
||||
@@ -31,8 +30,7 @@ struct AioHandler {
|
||||
|
||||
void aio_set_event_notifier(AioContext *ctx,
|
||||
EventNotifier *e,
|
||||
EventNotifierHandler *io_notify,
|
||||
AioFlushEventNotifierHandler *io_flush)
|
||||
EventNotifierHandler *io_notify)
|
||||
{
|
||||
AioHandler *node;
|
||||
|
||||
@@ -73,7 +71,6 @@ void aio_set_event_notifier(AioContext *ctx,
|
||||
}
|
||||
/* Update handler with latest information */
|
||||
node->io_notify = io_notify;
|
||||
node->io_flush = io_flush;
|
||||
}
|
||||
|
||||
aio_notify(ctx);
|
||||
@@ -96,7 +93,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
{
|
||||
AioHandler *node;
|
||||
HANDLE events[MAXIMUM_WAIT_OBJECTS + 1];
|
||||
bool busy, progress;
|
||||
bool progress;
|
||||
int count;
|
||||
|
||||
progress = false;
|
||||
@@ -126,8 +123,12 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
if (node->pfd.revents && node->io_notify) {
|
||||
node->pfd.revents = 0;
|
||||
node->io_notify(node->e);
|
||||
|
||||
/* aio_notify() does not count as progress */
|
||||
if (node->opaque != &ctx->notifier) {
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
|
||||
tmp = node;
|
||||
node = QLIST_NEXT(node, node);
|
||||
@@ -147,19 +148,8 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
ctx->walking_handlers++;
|
||||
|
||||
/* fill fd sets */
|
||||
busy = false;
|
||||
count = 0;
|
||||
QLIST_FOREACH(node, &ctx->aio_handlers, node) {
|
||||
/* If there aren't pending AIO operations, don't invoke callbacks.
|
||||
* Otherwise, if there are no AIO requests, qemu_aio_wait() would
|
||||
* wait indefinitely.
|
||||
*/
|
||||
if (!node->deleted && node->io_flush) {
|
||||
if (node->io_flush(node->e) == 0) {
|
||||
continue;
|
||||
}
|
||||
busy = true;
|
||||
}
|
||||
if (!node->deleted && node->io_notify) {
|
||||
events[count++] = event_notifier_get_handle(node->e);
|
||||
}
|
||||
@@ -167,8 +157,8 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
|
||||
ctx->walking_handlers--;
|
||||
|
||||
/* No AIO operations? Get us out of here */
|
||||
if (!busy) {
|
||||
/* early return if we only have the aio_notify() fd */
|
||||
if (count == 1) {
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -196,8 +186,12 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
event_notifier_get_handle(node->e) == events[ret - WAIT_OBJECT_0] &&
|
||||
node->io_notify) {
|
||||
node->io_notify(node->e);
|
||||
|
||||
/* aio_notify() does not count as progress */
|
||||
if (node->opaque != &ctx->notifier) {
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
|
||||
tmp = node;
|
||||
node = QLIST_NEXT(node, node);
|
||||
@@ -214,6 +208,5 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
events[ret - WAIT_OBJECT_0] = events[--count];
|
||||
}
|
||||
|
||||
assert(progress || busy);
|
||||
return true;
|
||||
return progress;
|
||||
}
|
||||
|
@@ -342,7 +342,8 @@ ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr,
|
||||
{
|
||||
unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS;
|
||||
unsigned long nr = base + (start >> TARGET_PAGE_BITS);
|
||||
unsigned long size = base + (int128_get64(mr->size) >> TARGET_PAGE_BITS);
|
||||
uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr));
|
||||
unsigned long size = base + (mr_size >> TARGET_PAGE_BITS);
|
||||
|
||||
unsigned long next;
|
||||
|
||||
|
4
async.c
4
async.c
@@ -201,7 +201,7 @@ aio_ctx_finalize(GSource *source)
|
||||
AioContext *ctx = (AioContext *) source;
|
||||
|
||||
thread_pool_free(ctx->thread_pool);
|
||||
aio_set_event_notifier(ctx, &ctx->notifier, NULL, NULL);
|
||||
aio_set_event_notifier(ctx, &ctx->notifier, NULL);
|
||||
event_notifier_cleanup(&ctx->notifier);
|
||||
qemu_mutex_destroy(&ctx->bh_lock);
|
||||
g_array_free(ctx->pollfds, TRUE);
|
||||
@@ -243,7 +243,7 @@ AioContext *aio_context_new(void)
|
||||
event_notifier_init(&ctx->notifier, false);
|
||||
aio_set_event_notifier(ctx, &ctx->notifier,
|
||||
(EventNotifierHandler *)
|
||||
event_notifier_test_and_clear, NULL);
|
||||
event_notifier_test_and_clear);
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
52
block.c
52
block.c
@@ -148,7 +148,6 @@ static void bdrv_block_timer(void *opaque)
|
||||
|
||||
void bdrv_io_limits_enable(BlockDriverState *bs)
|
||||
{
|
||||
qemu_co_queue_init(&bs->throttled_reqs);
|
||||
bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs);
|
||||
bs->io_limits_enabled = true;
|
||||
}
|
||||
@@ -306,6 +305,7 @@ BlockDriverState *bdrv_new(const char *device_name)
|
||||
bdrv_iostatus_disable(bs);
|
||||
notifier_list_init(&bs->close_notifiers);
|
||||
notifier_with_return_list_init(&bs->before_write_notifiers);
|
||||
qemu_co_queue_init(&bs->throttled_reqs);
|
||||
|
||||
return bs;
|
||||
}
|
||||
@@ -1428,6 +1428,35 @@ void bdrv_close_all(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if any requests are in-flight (including throttled requests) */
|
||||
static bool bdrv_requests_pending(BlockDriverState *bs)
|
||||
{
|
||||
if (!QLIST_EMPTY(&bs->tracked_requests)) {
|
||||
return true;
|
||||
}
|
||||
if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
|
||||
return true;
|
||||
}
|
||||
if (bs->file && bdrv_requests_pending(bs->file)) {
|
||||
return true;
|
||||
}
|
||||
if (bs->backing_hd && bdrv_requests_pending(bs->backing_hd)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool bdrv_requests_pending_all(void)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
QTAILQ_FOREACH(bs, &bdrv_states, list) {
|
||||
if (bdrv_requests_pending(bs)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for pending requests to complete across all BlockDriverStates
|
||||
*
|
||||
@@ -1442,12 +1471,11 @@ void bdrv_close_all(void)
|
||||
*/
|
||||
void bdrv_drain_all(void)
|
||||
{
|
||||
/* Always run first iteration so any pending completion BHs run */
|
||||
bool busy = true;
|
||||
BlockDriverState *bs;
|
||||
bool busy;
|
||||
|
||||
do {
|
||||
busy = qemu_aio_wait();
|
||||
|
||||
while (busy) {
|
||||
/* FIXME: We do not have timer support here, so this is effectively
|
||||
* a busy wait.
|
||||
*/
|
||||
@@ -1456,12 +1484,9 @@ void bdrv_drain_all(void)
|
||||
busy = true;
|
||||
}
|
||||
}
|
||||
} while (busy);
|
||||
|
||||
/* If requests are still pending there is a bug somewhere */
|
||||
QTAILQ_FOREACH(bs, &bdrv_states, list) {
|
||||
assert(QLIST_EMPTY(&bs->tracked_requests));
|
||||
assert(qemu_co_queue_empty(&bs->throttled_reqs));
|
||||
busy = bdrv_requests_pending_all();
|
||||
busy |= aio_poll(qemu_get_aio_context(), busy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1803,11 +1828,8 @@ int bdrv_commit(BlockDriverState *bs)
|
||||
buf = g_malloc(COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE);
|
||||
|
||||
for (sector = 0; sector < total_sectors; sector += n) {
|
||||
ret = bdrv_is_allocated(bs, sector, COMMIT_BUF_SECTORS, &n);
|
||||
if (ret < 0) {
|
||||
goto ro_cleanup;
|
||||
}
|
||||
if (ret) {
|
||||
if (bdrv_is_allocated(bs, sector, COMMIT_BUF_SECTORS, &n)) {
|
||||
|
||||
if (bdrv_read(bs, sector, buf, n) != 0) {
|
||||
ret = -EIO;
|
||||
goto ro_cleanup;
|
||||
|
@@ -189,11 +189,7 @@ static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num,
|
||||
int ret, n;
|
||||
|
||||
while (nb_sectors > 0) {
|
||||
ret = bdrv_co_is_allocated(bs, sector_num, nb_sectors, &n);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
if (ret) {
|
||||
if (bdrv_co_is_allocated(bs, sector_num, nb_sectors, &n)) {
|
||||
ret = bdrv_pread(bs->file,
|
||||
s->cow_sectors_offset + sector_num * 512,
|
||||
buf, n * 512);
|
||||
|
25
block/curl.c
25
block/curl.c
@@ -86,7 +86,6 @@ typedef struct BDRVCURLState {
|
||||
|
||||
static void curl_clean_state(CURLState *s);
|
||||
static void curl_multi_do(void *arg);
|
||||
static int curl_aio_flush(void *opaque);
|
||||
|
||||
static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||
void *s, void *sp)
|
||||
@@ -94,17 +93,16 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||
DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
|
||||
switch (action) {
|
||||
case CURL_POLL_IN:
|
||||
qemu_aio_set_fd_handler(fd, curl_multi_do, NULL, curl_aio_flush, s);
|
||||
qemu_aio_set_fd_handler(fd, curl_multi_do, NULL, s);
|
||||
break;
|
||||
case CURL_POLL_OUT:
|
||||
qemu_aio_set_fd_handler(fd, NULL, curl_multi_do, curl_aio_flush, s);
|
||||
qemu_aio_set_fd_handler(fd, NULL, curl_multi_do, s);
|
||||
break;
|
||||
case CURL_POLL_INOUT:
|
||||
qemu_aio_set_fd_handler(fd, curl_multi_do, curl_multi_do,
|
||||
curl_aio_flush, s);
|
||||
qemu_aio_set_fd_handler(fd, curl_multi_do, curl_multi_do, s);
|
||||
break;
|
||||
case CURL_POLL_REMOVE:
|
||||
qemu_aio_set_fd_handler(fd, NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(fd, NULL, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -495,21 +493,6 @@ out_noclean:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int curl_aio_flush(void *opaque)
|
||||
{
|
||||
BDRVCURLState *s = opaque;
|
||||
int i, j;
|
||||
|
||||
for (i=0; i < CURL_NUM_STATES; i++) {
|
||||
for(j=0; j < CURL_NUM_ACB; j++) {
|
||||
if (s->states[i].acb[j]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void curl_aio_cancel(BlockDriverAIOCB *blockacb)
|
||||
{
|
||||
// Do we have to implement canceling? Seems to work without...
|
||||
|
@@ -32,7 +32,6 @@ typedef struct BDRVGlusterState {
|
||||
struct glfs *glfs;
|
||||
int fds[2];
|
||||
struct glfs_fd *fd;
|
||||
int qemu_aio_count;
|
||||
int event_reader_pos;
|
||||
GlusterAIOCB *event_acb;
|
||||
} BDRVGlusterState;
|
||||
@@ -247,7 +246,6 @@ static void qemu_gluster_complete_aio(GlusterAIOCB *acb, BDRVGlusterState *s)
|
||||
ret = -EIO; /* Partial read/write - fail it */
|
||||
}
|
||||
|
||||
s->qemu_aio_count--;
|
||||
qemu_aio_release(acb);
|
||||
cb(opaque, ret);
|
||||
if (finished) {
|
||||
@@ -275,13 +273,6 @@ static void qemu_gluster_aio_event_reader(void *opaque)
|
||||
} while (ret < 0 && errno == EINTR);
|
||||
}
|
||||
|
||||
static int qemu_gluster_aio_flush_cb(void *opaque)
|
||||
{
|
||||
BDRVGlusterState *s = opaque;
|
||||
|
||||
return (s->qemu_aio_count > 0);
|
||||
}
|
||||
|
||||
/* TODO Convert to fine grained options */
|
||||
static QemuOptsList runtime_opts = {
|
||||
.name = "gluster",
|
||||
@@ -348,7 +339,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
|
||||
}
|
||||
fcntl(s->fds[GLUSTER_FD_READ], F_SETFL, O_NONBLOCK);
|
||||
qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ],
|
||||
qemu_gluster_aio_event_reader, NULL, qemu_gluster_aio_flush_cb, s);
|
||||
qemu_gluster_aio_event_reader, NULL, s);
|
||||
|
||||
out:
|
||||
qemu_opts_del(opts);
|
||||
@@ -445,11 +436,9 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg)
|
||||
qemu_mutex_lock_iothread(); /* We are in gluster thread context */
|
||||
acb->common.cb(acb->common.opaque, -EIO);
|
||||
qemu_aio_release(acb);
|
||||
s->qemu_aio_count--;
|
||||
close(s->fds[GLUSTER_FD_READ]);
|
||||
close(s->fds[GLUSTER_FD_WRITE]);
|
||||
qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL,
|
||||
NULL);
|
||||
qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL);
|
||||
bs->drv = NULL; /* Make the disk inaccessible */
|
||||
qemu_mutex_unlock_iothread();
|
||||
}
|
||||
@@ -467,7 +456,6 @@ static BlockDriverAIOCB *qemu_gluster_aio_rw(BlockDriverState *bs,
|
||||
|
||||
offset = sector_num * BDRV_SECTOR_SIZE;
|
||||
size = nb_sectors * BDRV_SECTOR_SIZE;
|
||||
s->qemu_aio_count++;
|
||||
|
||||
acb = qemu_aio_get(&gluster_aiocb_info, bs, cb, opaque);
|
||||
acb->size = size;
|
||||
@@ -488,7 +476,6 @@ static BlockDriverAIOCB *qemu_gluster_aio_rw(BlockDriverState *bs,
|
||||
return &acb->common;
|
||||
|
||||
out:
|
||||
s->qemu_aio_count--;
|
||||
qemu_aio_release(acb);
|
||||
return NULL;
|
||||
}
|
||||
@@ -531,7 +518,6 @@ static BlockDriverAIOCB *qemu_gluster_aio_flush(BlockDriverState *bs,
|
||||
acb->size = 0;
|
||||
acb->ret = 0;
|
||||
acb->finished = NULL;
|
||||
s->qemu_aio_count++;
|
||||
|
||||
ret = glfs_fsync_async(s->fd, &gluster_finish_aiocb, acb);
|
||||
if (ret < 0) {
|
||||
@@ -540,7 +526,6 @@ static BlockDriverAIOCB *qemu_gluster_aio_flush(BlockDriverState *bs,
|
||||
return &acb->common;
|
||||
|
||||
out:
|
||||
s->qemu_aio_count--;
|
||||
qemu_aio_release(acb);
|
||||
return NULL;
|
||||
}
|
||||
@@ -563,7 +548,6 @@ static BlockDriverAIOCB *qemu_gluster_aio_discard(BlockDriverState *bs,
|
||||
acb->size = 0;
|
||||
acb->ret = 0;
|
||||
acb->finished = NULL;
|
||||
s->qemu_aio_count++;
|
||||
|
||||
ret = glfs_discard_async(s->fd, offset, size, &gluster_finish_aiocb, acb);
|
||||
if (ret < 0) {
|
||||
@@ -572,7 +556,6 @@ static BlockDriverAIOCB *qemu_gluster_aio_discard(BlockDriverState *bs,
|
||||
return &acb->common;
|
||||
|
||||
out:
|
||||
s->qemu_aio_count--;
|
||||
qemu_aio_release(acb);
|
||||
return NULL;
|
||||
}
|
||||
@@ -611,7 +594,7 @@ static void qemu_gluster_close(BlockDriverState *bs)
|
||||
|
||||
close(s->fds[GLUSTER_FD_READ]);
|
||||
close(s->fds[GLUSTER_FD_WRITE]);
|
||||
qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL);
|
||||
|
||||
if (s->fd) {
|
||||
glfs_close(s->fd);
|
||||
|
@@ -146,13 +146,6 @@ static const AIOCBInfo iscsi_aiocb_info = {
|
||||
static void iscsi_process_read(void *arg);
|
||||
static void iscsi_process_write(void *arg);
|
||||
|
||||
static int iscsi_process_flush(void *arg)
|
||||
{
|
||||
IscsiLun *iscsilun = arg;
|
||||
|
||||
return iscsi_queue_length(iscsilun->iscsi) > 0;
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_set_events(IscsiLun *iscsilun)
|
||||
{
|
||||
@@ -166,7 +159,6 @@ iscsi_set_events(IscsiLun *iscsilun)
|
||||
qemu_aio_set_fd_handler(iscsi_get_fd(iscsi),
|
||||
iscsi_process_read,
|
||||
(ev & POLLOUT) ? iscsi_process_write : NULL,
|
||||
iscsi_process_flush,
|
||||
iscsilun);
|
||||
|
||||
}
|
||||
@@ -1215,7 +1207,7 @@ static void iscsi_close(BlockDriverState *bs)
|
||||
qemu_del_timer(iscsilun->nop_timer);
|
||||
qemu_free_timer(iscsilun->nop_timer);
|
||||
}
|
||||
qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), NULL, NULL, NULL);
|
||||
iscsi_destroy_context(iscsi);
|
||||
memset(iscsilun, 0, sizeof(IscsiLun));
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ struct qemu_laiocb {
|
||||
struct qemu_laio_state {
|
||||
io_context_t ctx;
|
||||
EventNotifier e;
|
||||
int count;
|
||||
};
|
||||
|
||||
static inline ssize_t io_event_ret(struct io_event *ev)
|
||||
@@ -55,8 +54,6 @@ static void qemu_laio_process_completion(struct qemu_laio_state *s,
|
||||
{
|
||||
int ret;
|
||||
|
||||
s->count--;
|
||||
|
||||
ret = laiocb->ret;
|
||||
if (ret != -ECANCELED) {
|
||||
if (ret == laiocb->nbytes) {
|
||||
@@ -101,13 +98,6 @@ static void qemu_laio_completion_cb(EventNotifier *e)
|
||||
}
|
||||
}
|
||||
|
||||
static int qemu_laio_flush_cb(EventNotifier *e)
|
||||
{
|
||||
struct qemu_laio_state *s = container_of(e, struct qemu_laio_state, e);
|
||||
|
||||
return (s->count > 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void laio_cancel(BlockDriverAIOCB *blockacb)
|
||||
{
|
||||
struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;
|
||||
@@ -177,14 +167,11 @@ BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
|
||||
goto out_free_aiocb;
|
||||
}
|
||||
io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e));
|
||||
s->count++;
|
||||
|
||||
if (io_submit(s->ctx, 1, &iocbs) < 0)
|
||||
goto out_dec_count;
|
||||
goto out_free_aiocb;
|
||||
return &laiocb->common;
|
||||
|
||||
out_dec_count:
|
||||
s->count--;
|
||||
out_free_aiocb:
|
||||
qemu_aio_release(laiocb);
|
||||
return NULL;
|
||||
@@ -203,8 +190,7 @@ void *laio_init(void)
|
||||
goto out_close_efd;
|
||||
}
|
||||
|
||||
qemu_aio_set_event_notifier(&s->e, qemu_laio_completion_cb,
|
||||
qemu_laio_flush_cb);
|
||||
qemu_aio_set_event_notifier(&s->e, qemu_laio_completion_cb);
|
||||
|
||||
return s;
|
||||
|
||||
|
18
block/nbd.c
18
block/nbd.c
@@ -279,13 +279,6 @@ static void nbd_coroutine_start(BDRVNBDState *s, struct nbd_request *request)
|
||||
request->handle = INDEX_TO_HANDLE(s, i);
|
||||
}
|
||||
|
||||
static int nbd_have_request(void *opaque)
|
||||
{
|
||||
BDRVNBDState *s = opaque;
|
||||
|
||||
return s->in_flight > 0;
|
||||
}
|
||||
|
||||
static void nbd_reply_ready(void *opaque)
|
||||
{
|
||||
BDRVNBDState *s = opaque;
|
||||
@@ -341,8 +334,7 @@ static int nbd_co_send_request(BDRVNBDState *s, struct nbd_request *request,
|
||||
|
||||
qemu_co_mutex_lock(&s->send_mutex);
|
||||
s->send_coroutine = qemu_coroutine_self();
|
||||
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, nbd_restart_write,
|
||||
nbd_have_request, s);
|
||||
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, nbd_restart_write, s);
|
||||
if (qiov) {
|
||||
if (!s->is_unix) {
|
||||
socket_set_cork(s->sock, 1);
|
||||
@@ -361,8 +353,7 @@ static int nbd_co_send_request(BDRVNBDState *s, struct nbd_request *request,
|
||||
} else {
|
||||
rc = nbd_send_request(s->sock, request);
|
||||
}
|
||||
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL,
|
||||
nbd_have_request, s);
|
||||
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL, s);
|
||||
s->send_coroutine = NULL;
|
||||
qemu_co_mutex_unlock(&s->send_mutex);
|
||||
return rc;
|
||||
@@ -438,8 +429,7 @@ static int nbd_establish_connection(BlockDriverState *bs)
|
||||
/* Now that we're connected, set the socket to be non-blocking and
|
||||
* kick the reply mechanism. */
|
||||
qemu_set_nonblock(sock);
|
||||
qemu_aio_set_fd_handler(sock, nbd_reply_ready, NULL,
|
||||
nbd_have_request, s);
|
||||
qemu_aio_set_fd_handler(sock, nbd_reply_ready, NULL, s);
|
||||
|
||||
s->sock = sock;
|
||||
s->size = size;
|
||||
@@ -459,7 +449,7 @@ static void nbd_teardown_connection(BlockDriverState *bs)
|
||||
request.len = 0;
|
||||
nbd_send_request(s->sock, &request);
|
||||
|
||||
qemu_aio_set_fd_handler(s->sock, NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(s->sock, NULL, NULL, NULL);
|
||||
closesocket(s->sock);
|
||||
}
|
||||
|
||||
|
@@ -648,11 +648,13 @@ static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs,
|
||||
int ret;
|
||||
|
||||
*pnum = nb_sectors;
|
||||
/* FIXME We can get errors here, but the bdrv_co_is_allocated interface
|
||||
* can't pass them on today */
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);
|
||||
qemu_co_mutex_unlock(&s->lock);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
*pnum = 0;
|
||||
}
|
||||
|
||||
return (cluster_offset != 0) || (ret == QCOW2_CLUSTER_ZERO);
|
||||
|
@@ -535,29 +535,13 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
int access_flags, create_flags;
|
||||
int ret = 0;
|
||||
DWORD overlapped;
|
||||
char device_name[64];
|
||||
|
||||
Error *local_err = NULL;
|
||||
const char *filename;
|
||||
|
||||
QemuOpts *opts = qemu_opts_create_nofail(&raw_runtime_opts);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
filename = qemu_opt_get(opts, "filename");
|
||||
const char *filename = qdict_get_str(options, "filename");
|
||||
|
||||
if (strstart(filename, "/dev/cdrom", NULL)) {
|
||||
if (find_cdrom(device_name, sizeof(device_name)) < 0) {
|
||||
ret = -ENOENT;
|
||||
goto done;
|
||||
}
|
||||
if (find_cdrom(device_name, sizeof(device_name)) < 0)
|
||||
return -ENOENT;
|
||||
filename = device_name;
|
||||
} else {
|
||||
/* transform drive letters into device name */
|
||||
@@ -580,17 +564,11 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
|
||||
if (s->hfile == INVALID_HANDLE_VALUE) {
|
||||
int err = GetLastError();
|
||||
|
||||
if (err == ERROR_ACCESS_DENIED) {
|
||||
ret = -EACCES;
|
||||
} else {
|
||||
ret = -1;
|
||||
if (err == ERROR_ACCESS_DENIED)
|
||||
return -EACCES;
|
||||
return -1;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
qemu_opts_del(opts);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BlockDriver bdrv_host_device = {
|
||||
|
19
block/rbd.c
19
block/rbd.c
@@ -100,7 +100,6 @@ typedef struct BDRVRBDState {
|
||||
rados_ioctx_t io_ctx;
|
||||
rbd_image_t image;
|
||||
char name[RBD_MAX_IMAGE_NAME_SIZE];
|
||||
int qemu_aio_count;
|
||||
char *snap;
|
||||
int event_reader_pos;
|
||||
RADOSCB *event_rcb;
|
||||
@@ -428,19 +427,11 @@ static void qemu_rbd_aio_event_reader(void *opaque)
|
||||
if (s->event_reader_pos == sizeof(s->event_rcb)) {
|
||||
s->event_reader_pos = 0;
|
||||
qemu_rbd_complete_aio(s->event_rcb);
|
||||
s->qemu_aio_count--;
|
||||
}
|
||||
}
|
||||
} while (ret < 0 && errno == EINTR);
|
||||
}
|
||||
|
||||
static int qemu_rbd_aio_flush_cb(void *opaque)
|
||||
{
|
||||
BDRVRBDState *s = opaque;
|
||||
|
||||
return (s->qemu_aio_count > 0);
|
||||
}
|
||||
|
||||
/* TODO Convert to fine grained options */
|
||||
static QemuOptsList runtime_opts = {
|
||||
.name = "rbd",
|
||||
@@ -554,7 +545,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags)
|
||||
fcntl(s->fds[0], F_SETFL, O_NONBLOCK);
|
||||
fcntl(s->fds[1], F_SETFL, O_NONBLOCK);
|
||||
qemu_aio_set_fd_handler(s->fds[RBD_FD_READ], qemu_rbd_aio_event_reader,
|
||||
NULL, qemu_rbd_aio_flush_cb, s);
|
||||
NULL, s);
|
||||
|
||||
|
||||
qemu_opts_del(opts);
|
||||
@@ -578,7 +569,7 @@ static void qemu_rbd_close(BlockDriverState *bs)
|
||||
|
||||
close(s->fds[0]);
|
||||
close(s->fds[1]);
|
||||
qemu_aio_set_fd_handler(s->fds[RBD_FD_READ], NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(s->fds[RBD_FD_READ], NULL, NULL, NULL);
|
||||
|
||||
rbd_close(s->image);
|
||||
rados_ioctx_destroy(s->io_ctx);
|
||||
@@ -741,8 +732,6 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
|
||||
off = sector_num * BDRV_SECTOR_SIZE;
|
||||
size = nb_sectors * BDRV_SECTOR_SIZE;
|
||||
|
||||
s->qemu_aio_count++; /* All the RADOSCB */
|
||||
|
||||
rcb = g_malloc(sizeof(RADOSCB));
|
||||
rcb->done = 0;
|
||||
rcb->acb = acb;
|
||||
@@ -779,7 +768,6 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
|
||||
|
||||
failed:
|
||||
g_free(rcb);
|
||||
s->qemu_aio_count--;
|
||||
qemu_aio_release(acb);
|
||||
return NULL;
|
||||
}
|
||||
@@ -934,7 +922,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
|
||||
do {
|
||||
snaps = g_malloc(sizeof(*snaps) * max_snaps);
|
||||
snap_count = rbd_snap_list(s->image, snaps, &max_snaps);
|
||||
if (snap_count <= 0) {
|
||||
if (snap_count < 0) {
|
||||
g_free(snaps);
|
||||
}
|
||||
} while (snap_count == -ERANGE);
|
||||
@@ -958,7 +946,6 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
|
||||
sn_info->vm_clock_nsec = 0;
|
||||
}
|
||||
rbd_snap_list_end(snaps);
|
||||
g_free(snaps);
|
||||
|
||||
done:
|
||||
*psn_tab = sn_tab;
|
||||
|
@@ -509,13 +509,6 @@ static void restart_co_req(void *opaque)
|
||||
qemu_coroutine_enter(co, NULL);
|
||||
}
|
||||
|
||||
static int have_co_req(void *opaque)
|
||||
{
|
||||
/* this handler is set only when there is a pending request, so
|
||||
* always returns 1. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef struct SheepdogReqCo {
|
||||
int sockfd;
|
||||
SheepdogReq *hdr;
|
||||
@@ -538,14 +531,14 @@ static coroutine_fn void do_co_req(void *opaque)
|
||||
unsigned int *rlen = srco->rlen;
|
||||
|
||||
co = qemu_coroutine_self();
|
||||
qemu_aio_set_fd_handler(sockfd, NULL, restart_co_req, have_co_req, co);
|
||||
qemu_aio_set_fd_handler(sockfd, NULL, restart_co_req, co);
|
||||
|
||||
ret = send_co_req(sockfd, hdr, data, wlen);
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
qemu_aio_set_fd_handler(sockfd, restart_co_req, NULL, have_co_req, co);
|
||||
qemu_aio_set_fd_handler(sockfd, restart_co_req, NULL, co);
|
||||
|
||||
ret = qemu_co_recv(sockfd, hdr, sizeof(*hdr));
|
||||
if (ret < sizeof(*hdr)) {
|
||||
@@ -570,7 +563,7 @@ static coroutine_fn void do_co_req(void *opaque)
|
||||
out:
|
||||
/* there is at most one request for this sockfd, so it is safe to
|
||||
* set each handler to NULL. */
|
||||
qemu_aio_set_fd_handler(sockfd, NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(sockfd, NULL, NULL, NULL);
|
||||
|
||||
srco->ret = ret;
|
||||
srco->finished = true;
|
||||
@@ -796,14 +789,6 @@ static void co_write_request(void *opaque)
|
||||
qemu_coroutine_enter(s->co_send, NULL);
|
||||
}
|
||||
|
||||
static int aio_flush_request(void *opaque)
|
||||
{
|
||||
BDRVSheepdogState *s = opaque;
|
||||
|
||||
return !QLIST_EMPTY(&s->inflight_aio_head) ||
|
||||
!QLIST_EMPTY(&s->pending_aio_head);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a socket discriptor to read/write objects.
|
||||
*
|
||||
@@ -819,7 +804,7 @@ static int get_sheep_fd(BDRVSheepdogState *s)
|
||||
return fd;
|
||||
}
|
||||
|
||||
qemu_aio_set_fd_handler(fd, co_read_response, NULL, aio_flush_request, s);
|
||||
qemu_aio_set_fd_handler(fd, co_read_response, NULL, s);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -1069,8 +1054,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
|
||||
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
s->co_send = qemu_coroutine_self();
|
||||
qemu_aio_set_fd_handler(s->fd, co_read_response, co_write_request,
|
||||
aio_flush_request, s);
|
||||
qemu_aio_set_fd_handler(s->fd, co_read_response, co_write_request, s);
|
||||
socket_set_cork(s->fd, 1);
|
||||
|
||||
/* send a header */
|
||||
@@ -1091,8 +1075,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
|
||||
}
|
||||
|
||||
socket_set_cork(s->fd, 0);
|
||||
qemu_aio_set_fd_handler(s->fd, co_read_response, NULL,
|
||||
aio_flush_request, s);
|
||||
qemu_aio_set_fd_handler(s->fd, co_read_response, NULL, s);
|
||||
qemu_co_mutex_unlock(&s->lock);
|
||||
|
||||
return 0;
|
||||
@@ -1350,7 +1333,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags)
|
||||
g_free(buf);
|
||||
return 0;
|
||||
out:
|
||||
qemu_aio_set_fd_handler(s->fd, NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(s->fd, NULL, NULL, NULL);
|
||||
if (s->fd >= 0) {
|
||||
closesocket(s->fd);
|
||||
}
|
||||
@@ -1578,7 +1561,7 @@ static void sd_close(BlockDriverState *bs)
|
||||
error_report("%s, %s", sd_strerror(rsp->result), s->name);
|
||||
}
|
||||
|
||||
qemu_aio_set_fd_handler(s->fd, NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(s->fd, NULL, NULL, NULL);
|
||||
closesocket(s->fd);
|
||||
g_free(s->host_spec);
|
||||
}
|
||||
|
12
block/ssh.c
12
block/ssh.c
@@ -740,14 +740,6 @@ static void restart_coroutine(void *opaque)
|
||||
qemu_coroutine_enter(co, NULL);
|
||||
}
|
||||
|
||||
/* Always true because when we have called set_fd_handler there is
|
||||
* always a request being processed.
|
||||
*/
|
||||
static int return_true(void *opaque)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static coroutine_fn void set_fd_handler(BDRVSSHState *s)
|
||||
{
|
||||
int r;
|
||||
@@ -766,13 +758,13 @@ static coroutine_fn void set_fd_handler(BDRVSSHState *s)
|
||||
DPRINTF("s->sock=%d rd_handler=%p wr_handler=%p", s->sock,
|
||||
rd_handler, wr_handler);
|
||||
|
||||
qemu_aio_set_fd_handler(s->sock, rd_handler, wr_handler, return_true, co);
|
||||
qemu_aio_set_fd_handler(s->sock, rd_handler, wr_handler, co);
|
||||
}
|
||||
|
||||
static coroutine_fn void clear_fd_handler(BDRVSSHState *s)
|
||||
{
|
||||
DPRINTF("s->sock=%d", s->sock);
|
||||
qemu_aio_set_fd_handler(s->sock, NULL, NULL, NULL, NULL);
|
||||
qemu_aio_set_fd_handler(s->sock, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* A non-blocking call returned EAGAIN, so yield, ensuring the
|
||||
|
@@ -57,6 +57,11 @@ static void close_unused_images(BlockDriverState *top, BlockDriverState *base,
|
||||
BlockDriverState *intermediate;
|
||||
intermediate = top->backing_hd;
|
||||
|
||||
/* Must assign before bdrv_delete() to prevent traversing dangling pointer
|
||||
* while we delete backing image instances.
|
||||
*/
|
||||
top->backing_hd = base;
|
||||
|
||||
while (intermediate) {
|
||||
BlockDriverState *unused;
|
||||
|
||||
@@ -70,7 +75,6 @@ static void close_unused_images(BlockDriverState *top, BlockDriverState *base,
|
||||
unused->backing_hd = NULL;
|
||||
bdrv_delete(unused);
|
||||
}
|
||||
top->backing_hd = base;
|
||||
}
|
||||
|
||||
static void coroutine_fn stream_run(void *opaque)
|
||||
@@ -120,7 +124,7 @@ wait:
|
||||
if (ret == 1) {
|
||||
/* Allocated in the top, no need to copy. */
|
||||
copy = false;
|
||||
} else if (ret >= 0) {
|
||||
} else {
|
||||
/* Copy if allocated in the intermediate images. Limit to the
|
||||
* known-unallocated area [sector_num, sector_num+n). */
|
||||
ret = bdrv_co_is_allocated_above(bs->backing_hd, base,
|
||||
|
@@ -105,7 +105,7 @@ typedef struct VmdkExtent {
|
||||
uint32_t l2_cache_offsets[L2_CACHE_SIZE];
|
||||
uint32_t l2_cache_counts[L2_CACHE_SIZE];
|
||||
|
||||
int64_t cluster_sectors;
|
||||
unsigned int cluster_sectors;
|
||||
} VmdkExtent;
|
||||
|
||||
typedef struct BDRVVmdkState {
|
||||
@@ -416,7 +416,7 @@ static int vmdk_add_extent(BlockDriverState *bs,
|
||||
extent->l1_size = l1_size;
|
||||
extent->l1_entry_sectors = l2_size * cluster_sectors;
|
||||
extent->l2_size = l2_size;
|
||||
extent->cluster_sectors = flat ? sectors : cluster_sectors;
|
||||
extent->cluster_sectors = cluster_sectors;
|
||||
|
||||
if (s->num_extents > 1) {
|
||||
extent->end_sector = (*(extent - 1)).end_sector + extent->sectors;
|
||||
@@ -736,7 +736,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
|
||||
VmdkExtent *extent;
|
||||
|
||||
ret = vmdk_add_extent(bs, extent_file, true, sectors,
|
||||
0, 0, 0, 0, 0, &extent);
|
||||
0, 0, 0, 0, sectors, &extent);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
@@ -460,7 +460,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
|
||||
if (qemu_opt_get_bool(opts, "cache.direct", false)) {
|
||||
bdrv_flags |= BDRV_O_NOCACHE;
|
||||
}
|
||||
if (qemu_opt_get_bool(opts, "cache.no-flush", false)) {
|
||||
if (qemu_opt_get_bool(opts, "cache.no-flush", true)) {
|
||||
bdrv_flags |= BDRV_O_NO_FLUSH;
|
||||
}
|
||||
|
||||
|
24
configure
vendored
24
configure
vendored
@@ -235,7 +235,6 @@ guest_agent=""
|
||||
want_tools="yes"
|
||||
libiscsi=""
|
||||
coroutine=""
|
||||
coroutine_pool=""
|
||||
seccomp=""
|
||||
glusterfs=""
|
||||
glusterfs_discard="no"
|
||||
@@ -872,10 +871,6 @@ for opt do
|
||||
;;
|
||||
--with-coroutine=*) coroutine="$optarg"
|
||||
;;
|
||||
--disable-coroutine-pool) coroutine_pool="no"
|
||||
;;
|
||||
--enable-coroutine-pool) coroutine_pool="yes"
|
||||
;;
|
||||
--disable-docs) docs="no"
|
||||
;;
|
||||
--enable-docs) docs="yes"
|
||||
@@ -1157,8 +1152,6 @@ echo " --disable-seccomp disable seccomp support"
|
||||
echo " --enable-seccomp enables seccomp support"
|
||||
echo " --with-coroutine=BACKEND coroutine backend. Supported options:"
|
||||
echo " gthread, ucontext, sigaltstack, windows"
|
||||
echo " --disable-coroutine-pool disable coroutine freelist (worse performance)"
|
||||
echo " --enable-coroutine-pool enable coroutine freelist (better performance)"
|
||||
echo " --enable-glusterfs enable GlusterFS backend"
|
||||
echo " --disable-glusterfs disable GlusterFS backend"
|
||||
echo " --enable-gcov enable test coverage analysis with gcov"
|
||||
@@ -3247,17 +3240,6 @@ else
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$coroutine_pool" = ""; then
|
||||
if test "$coroutine" = "gthread"; then
|
||||
coroutine_pool=no
|
||||
else
|
||||
coroutine_pool=yes
|
||||
fi
|
||||
fi
|
||||
if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
|
||||
error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# check if we have open_by_handle_at
|
||||
|
||||
@@ -3623,7 +3605,6 @@ echo "libiscsi support $libiscsi"
|
||||
echo "build guest agent $guest_agent"
|
||||
echo "seccomp support $seccomp"
|
||||
echo "coroutine backend $coroutine"
|
||||
echo "coroutine pool $coroutine_pool"
|
||||
echo "GlusterFS support $glusterfs"
|
||||
echo "virtio-blk-data-plane $virtio_blk_data_plane"
|
||||
echo "gcov $gcov_tool"
|
||||
@@ -3973,11 +3954,6 @@ if test "$rbd" = "yes" ; then
|
||||
fi
|
||||
|
||||
echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
|
||||
if test "$coroutine_pool" = "yes" ; then
|
||||
echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
|
||||
else
|
||||
echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$open_by_handle_at" = "yes" ; then
|
||||
echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
|
||||
|
14
cpus.c
14
cpus.c
@@ -62,12 +62,17 @@
|
||||
|
||||
static CPUState *next_cpu;
|
||||
|
||||
bool cpu_is_stopped(CPUState *cpu)
|
||||
{
|
||||
return cpu->stopped || !runstate_is_running();
|
||||
}
|
||||
|
||||
static bool cpu_thread_is_idle(CPUState *cpu)
|
||||
{
|
||||
if (cpu->stop || cpu->queued_work_first) {
|
||||
return false;
|
||||
}
|
||||
if (cpu->stopped || !runstate_is_running()) {
|
||||
if (cpu_is_stopped(cpu)) {
|
||||
return true;
|
||||
}
|
||||
if (!cpu->halted || qemu_cpu_has_work(cpu) ||
|
||||
@@ -429,11 +434,6 @@ void cpu_synchronize_all_post_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool cpu_is_stopped(CPUState *cpu)
|
||||
{
|
||||
return !runstate_is_running() || cpu->stopped;
|
||||
}
|
||||
|
||||
static int do_vm_stop(RunState state)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -457,7 +457,7 @@ static bool cpu_can_run(CPUState *cpu)
|
||||
if (cpu->stop) {
|
||||
return false;
|
||||
}
|
||||
if (cpu->stopped || !runstate_is_running()) {
|
||||
if (cpu_is_stopped(cpu)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@@ -34,9 +34,9 @@ CONFIG_PFLASH_CFI02=y
|
||||
CONFIG_MICRODRIVE=y
|
||||
CONFIG_USB_MUSB=y
|
||||
|
||||
CONFIG_ARM9MPCORE=y
|
||||
CONFIG_ARM11MPCORE=y
|
||||
CONFIG_ARM15MPCORE=y
|
||||
CONFIG_A9MPCORE=y
|
||||
CONFIG_A15MPCORE=y
|
||||
|
||||
CONFIG_ARM_GIC=y
|
||||
CONFIG_ARM_GIC_KVM=$(CONFIG_KVM)
|
||||
|
@@ -91,6 +91,29 @@
|
||||
port = "4"
|
||||
chassis = "4"
|
||||
|
||||
##
|
||||
# Example PCIe switch with two downstream ports
|
||||
#
|
||||
#[device "pcie-switch-upstream-port-1"]
|
||||
# driver = "x3130-upstream"
|
||||
# bus = "ich9-pcie-port-4"
|
||||
# addr = "00.0"
|
||||
#
|
||||
#[device "pcie-switch-downstream-port-1-1"]
|
||||
# driver = "xio3130-downstream"
|
||||
# multifunction = "on"
|
||||
# bus = "pcie-switch-upstream-port-1"
|
||||
# addr = "00.0"
|
||||
# port = "1"
|
||||
# chassis = "5"
|
||||
#
|
||||
#[device "pcie-switch-downstream-port-1-2"]
|
||||
# driver = "xio3130-downstream"
|
||||
# multifunction = "on"
|
||||
# bus = "pcie-switch-upstream-port-1"
|
||||
# addr = "00.1"
|
||||
# port = "1"
|
||||
# chassis = "6"
|
||||
|
||||
[device "ich9-ehci-1"]
|
||||
driver = "ich9-usb-ehci1"
|
||||
|
9
exec.c
9
exec.c
@@ -869,7 +869,7 @@ static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
|
||||
now = remain;
|
||||
if (int128_lt(remain.size, page_size)) {
|
||||
register_subpage(d, &now);
|
||||
} else if (remain.offset_within_address_space & ~TARGET_PAGE_MASK) {
|
||||
} else if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
|
||||
now.size = page_size;
|
||||
register_subpage(d, &now);
|
||||
} else {
|
||||
@@ -1172,7 +1172,6 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
|
||||
|
||||
qemu_ram_setup_dump(new_block->host, size);
|
||||
qemu_madvise(new_block->host, size, QEMU_MADV_HUGEPAGE);
|
||||
qemu_madvise(new_block->host, size, QEMU_MADV_DONTFORK);
|
||||
|
||||
if (kvm_enabled())
|
||||
kvm_setup_guest_memory(new_block->host, size);
|
||||
@@ -1821,8 +1820,7 @@ static void memory_map_init(void)
|
||||
address_space_init(&address_space_memory, system_memory, "memory");
|
||||
|
||||
system_io = g_malloc(sizeof(*system_io));
|
||||
memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io",
|
||||
65536);
|
||||
memory_region_init(system_io, NULL, "io", 65536);
|
||||
address_space_init(&address_space_io, system_io, "I/O");
|
||||
|
||||
memory_listener_register(&core_memory_listener, &address_space_memory);
|
||||
@@ -1930,9 +1928,6 @@ static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
|
||||
if (l > access_size_max) {
|
||||
l = access_size_max;
|
||||
}
|
||||
if (l & (l - 1)) {
|
||||
l = 1 << (qemu_fls(l) - 1);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
@@ -324,13 +324,12 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data)
|
||||
(ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_TIMER_STATUS);
|
||||
break;
|
||||
case QEMU_WAKEUP_REASON_OTHER:
|
||||
default:
|
||||
/* ACPI_BITMASK_WAKE_STATUS should be set on resume.
|
||||
Pretend that resume was caused by power button */
|
||||
ar->pm1.evt.sts |=
|
||||
(ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -380,7 +380,6 @@ static void piix4_reset(void *opaque)
|
||||
/* Mark SMM as already inited (until KVM supports SMM). */
|
||||
pci_conf[0x5B] = 0x02;
|
||||
}
|
||||
pm_io_space_update(s);
|
||||
piix4_update_hotplug(s);
|
||||
}
|
||||
|
||||
|
@@ -173,7 +173,6 @@ static QEMUMachine clipper_machine = {
|
||||
.init = clipper_init,
|
||||
.max_cpus = 4,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void clipper_machine_init(void)
|
||||
|
@@ -26,9 +26,9 @@ typedef struct TyphoonCchip {
|
||||
} TyphoonCchip;
|
||||
|
||||
typedef struct TyphoonWindow {
|
||||
uint32_t base_addr;
|
||||
uint32_t mask;
|
||||
uint32_t translated_base_pfn;
|
||||
uint64_t wba;
|
||||
uint64_t wsm;
|
||||
uint64_t tba;
|
||||
} TyphoonWindow;
|
||||
|
||||
typedef struct TyphoonPchip {
|
||||
@@ -37,6 +37,10 @@ typedef struct TyphoonPchip {
|
||||
MemoryRegion reg_mem;
|
||||
MemoryRegion reg_io;
|
||||
MemoryRegion reg_conf;
|
||||
|
||||
AddressSpace iommu_as;
|
||||
MemoryRegion iommu;
|
||||
|
||||
uint64_t ctl;
|
||||
TyphoonWindow win[4];
|
||||
} TyphoonPchip;
|
||||
@@ -209,53 +213,53 @@ static uint64_t pchip_read(void *opaque, hwaddr addr, unsigned size)
|
||||
switch (addr) {
|
||||
case 0x0000:
|
||||
/* WSBA0: Window Space Base Address Register. */
|
||||
ret = s->pchip.win[0].base_addr;
|
||||
ret = s->pchip.win[0].wba;
|
||||
break;
|
||||
case 0x0040:
|
||||
/* WSBA1 */
|
||||
ret = s->pchip.win[1].base_addr;
|
||||
ret = s->pchip.win[1].wba;
|
||||
break;
|
||||
case 0x0080:
|
||||
/* WSBA2 */
|
||||
ret = s->pchip.win[2].base_addr;
|
||||
ret = s->pchip.win[2].wba;
|
||||
break;
|
||||
case 0x00c0:
|
||||
/* WSBA3 */
|
||||
ret = s->pchip.win[3].base_addr;
|
||||
ret = s->pchip.win[3].wba;
|
||||
break;
|
||||
|
||||
case 0x0100:
|
||||
/* WSM0: Window Space Mask Register. */
|
||||
ret = s->pchip.win[0].mask;
|
||||
ret = s->pchip.win[0].wsm;
|
||||
break;
|
||||
case 0x0140:
|
||||
/* WSM1 */
|
||||
ret = s->pchip.win[1].mask;
|
||||
ret = s->pchip.win[1].wsm;
|
||||
break;
|
||||
case 0x0180:
|
||||
/* WSM2 */
|
||||
ret = s->pchip.win[2].mask;
|
||||
ret = s->pchip.win[2].wsm;
|
||||
break;
|
||||
case 0x01c0:
|
||||
/* WSM3 */
|
||||
ret = s->pchip.win[3].mask;
|
||||
ret = s->pchip.win[3].wsm;
|
||||
break;
|
||||
|
||||
case 0x0200:
|
||||
/* TBA0: Translated Base Address Register. */
|
||||
ret = (uint64_t)s->pchip.win[0].translated_base_pfn << 10;
|
||||
ret = s->pchip.win[0].tba;
|
||||
break;
|
||||
case 0x0240:
|
||||
/* TBA1 */
|
||||
ret = (uint64_t)s->pchip.win[1].translated_base_pfn << 10;
|
||||
ret = s->pchip.win[1].tba;
|
||||
break;
|
||||
case 0x0280:
|
||||
/* TBA2 */
|
||||
ret = (uint64_t)s->pchip.win[2].translated_base_pfn << 10;
|
||||
ret = s->pchip.win[2].tba;
|
||||
break;
|
||||
case 0x02c0:
|
||||
/* TBA3 */
|
||||
ret = (uint64_t)s->pchip.win[3].translated_base_pfn << 10;
|
||||
ret = s->pchip.win[3].tba;
|
||||
break;
|
||||
|
||||
case 0x0300:
|
||||
@@ -458,53 +462,53 @@ static void pchip_write(void *opaque, hwaddr addr,
|
||||
switch (addr) {
|
||||
case 0x0000:
|
||||
/* WSBA0: Window Space Base Address Register. */
|
||||
s->pchip.win[0].base_addr = val;
|
||||
s->pchip.win[0].wba = val & 0xfff00003u;
|
||||
break;
|
||||
case 0x0040:
|
||||
/* WSBA1 */
|
||||
s->pchip.win[1].base_addr = val;
|
||||
s->pchip.win[1].wba = val & 0xfff00003u;
|
||||
break;
|
||||
case 0x0080:
|
||||
/* WSBA2 */
|
||||
s->pchip.win[2].base_addr = val;
|
||||
s->pchip.win[2].wba = val & 0xfff00003u;
|
||||
break;
|
||||
case 0x00c0:
|
||||
/* WSBA3 */
|
||||
s->pchip.win[3].base_addr = val;
|
||||
s->pchip.win[3].wba = (val & 0x80fff00001ull) | 2;
|
||||
break;
|
||||
|
||||
case 0x0100:
|
||||
/* WSM0: Window Space Mask Register. */
|
||||
s->pchip.win[0].mask = val;
|
||||
s->pchip.win[0].wsm = val & 0xfff00000u;
|
||||
break;
|
||||
case 0x0140:
|
||||
/* WSM1 */
|
||||
s->pchip.win[1].mask = val;
|
||||
s->pchip.win[1].wsm = val & 0xfff00000u;
|
||||
break;
|
||||
case 0x0180:
|
||||
/* WSM2 */
|
||||
s->pchip.win[2].mask = val;
|
||||
s->pchip.win[2].wsm = val & 0xfff00000u;
|
||||
break;
|
||||
case 0x01c0:
|
||||
/* WSM3 */
|
||||
s->pchip.win[3].mask = val;
|
||||
s->pchip.win[3].wsm = val & 0xfff00000u;
|
||||
break;
|
||||
|
||||
case 0x0200:
|
||||
/* TBA0: Translated Base Address Register. */
|
||||
s->pchip.win[0].translated_base_pfn = val >> 10;
|
||||
s->pchip.win[0].tba = val & 0x7fffffc00ull;
|
||||
break;
|
||||
case 0x0240:
|
||||
/* TBA1 */
|
||||
s->pchip.win[1].translated_base_pfn = val >> 10;
|
||||
s->pchip.win[1].tba = val & 0x7fffffc00ull;
|
||||
break;
|
||||
case 0x0280:
|
||||
/* TBA2 */
|
||||
s->pchip.win[2].translated_base_pfn = val >> 10;
|
||||
s->pchip.win[2].tba = val & 0x7fffffc00ull;
|
||||
break;
|
||||
case 0x02c0:
|
||||
/* TBA3 */
|
||||
s->pchip.win[3].translated_base_pfn = val >> 10;
|
||||
s->pchip.win[3].tba = val & 0x7fffffc00ull;
|
||||
break;
|
||||
|
||||
case 0x0300:
|
||||
@@ -512,7 +516,6 @@ static void pchip_write(void *opaque, hwaddr addr,
|
||||
oldval = s->pchip.ctl;
|
||||
oldval &= ~0x00001cff0fc7ffull; /* RW fields */
|
||||
oldval |= val & 0x00001cff0fc7ffull;
|
||||
|
||||
s->pchip.ctl = oldval;
|
||||
break;
|
||||
|
||||
@@ -593,6 +596,140 @@ static const MemoryRegionOps pchip_ops = {
|
||||
},
|
||||
};
|
||||
|
||||
/* A subroutine of typhoon_translate_iommu that builds an IOMMUTLBEntry
|
||||
using the given translated address and mask. */
|
||||
static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, IOMMUTLBEntry *ret)
|
||||
{
|
||||
*ret = (IOMMUTLBEntry) {
|
||||
.target_as = &address_space_memory,
|
||||
.translated_addr = taddr,
|
||||
.addr_mask = mask,
|
||||
.perm = IOMMU_RW,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
/* A subroutine of typhoon_translate_iommu that handles scatter-gather
|
||||
translation, given the address of the PTE. */
|
||||
static bool pte_translate(hwaddr pte_addr, IOMMUTLBEntry *ret)
|
||||
{
|
||||
uint64_t pte = ldq_phys(pte_addr);
|
||||
|
||||
/* Check valid bit. */
|
||||
if ((pte & 1) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return make_iommu_tlbe((pte & 0x3ffffe) << 12, 0x1fff, ret);
|
||||
}
|
||||
|
||||
/* A subroutine of typhoon_translate_iommu that handles one of the
|
||||
four single-address-cycle translation windows. */
|
||||
static bool window_translate(TyphoonWindow *win, hwaddr addr,
|
||||
IOMMUTLBEntry *ret)
|
||||
{
|
||||
uint32_t wba = win->wba;
|
||||
uint64_t wsm = win->wsm;
|
||||
uint64_t tba = win->tba;
|
||||
uint64_t wsm_ext = wsm | 0xfffff;
|
||||
|
||||
/* Check for window disabled. */
|
||||
if ((wba & 1) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check for window hit. */
|
||||
if ((addr & ~wsm_ext) != (wba & 0xfff00000u)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wba & 2) {
|
||||
/* Scatter-gather translation. */
|
||||
hwaddr pte_addr;
|
||||
|
||||
/* See table 10-6, Generating PTE address for PCI DMA Address. */
|
||||
pte_addr = tba & ~(wsm >> 10);
|
||||
pte_addr |= (addr & (wsm | 0xfe000)) >> 10;
|
||||
return pte_translate(pte_addr, ret);
|
||||
} else {
|
||||
/* Direct-mapped translation. */
|
||||
return make_iommu_tlbe(tba & ~wsm_ext, wsm_ext, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle PCI-to-system address translation. */
|
||||
/* TODO: A translation failure here ought to set PCI error codes on the
|
||||
Pchip and generate a machine check interrupt. */
|
||||
static IOMMUTLBEntry typhoon_translate_iommu(MemoryRegion *iommu, hwaddr addr)
|
||||
{
|
||||
TyphoonPchip *pchip = container_of(iommu, TyphoonPchip, iommu);
|
||||
IOMMUTLBEntry ret;
|
||||
int i;
|
||||
|
||||
if (addr <= 0xffffffffu) {
|
||||
/* Single-address cycle. */
|
||||
|
||||
/* Check for the Window Hole, inhibiting matching. */
|
||||
if ((pchip->ctl & 0x20)
|
||||
&& addr >= 0x80000
|
||||
&& addr <= 0xfffff) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/* Check the first three windows. */
|
||||
for (i = 0; i < 3; ++i) {
|
||||
if (window_translate(&pchip->win[i], addr, &ret)) {
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the fourth window for DAC disable. */
|
||||
if ((pchip->win[3].wba & 0x80000000000ull) == 0
|
||||
&& window_translate(&pchip->win[3], addr, &ret)) {
|
||||
goto success;
|
||||
}
|
||||
} else {
|
||||
/* Double-address cycle. */
|
||||
|
||||
if (addr >= 0x10000000000ull && addr < 0x20000000000ull) {
|
||||
/* Check for the DMA monster window. */
|
||||
if (pchip->ctl & 0x40) {
|
||||
/* See 10.1.4.4; in particular <39:35> is ignored. */
|
||||
make_iommu_tlbe(0, 0x007ffffffffull, &ret);
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
|
||||
if (addr >= 0x80000000000 && addr <= 0xfffffffffff) {
|
||||
/* Check the fourth window for DAC enable and window enable. */
|
||||
if ((pchip->win[3].wba & 0x80000000001ull) == 0x80000000001ull) {
|
||||
uint64_t pte_addr;
|
||||
|
||||
pte_addr = pchip->win[3].tba & 0x7ffc00000ull;
|
||||
pte_addr |= (addr & 0xffffe000u) >> 10;
|
||||
if (pte_translate(pte_addr, &ret)) {
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
failure:
|
||||
ret = (IOMMUTLBEntry) { .perm = IOMMU_NONE };
|
||||
success:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const MemoryRegionIOMMUOps typhoon_iommu_ops = {
|
||||
.translate = typhoon_translate_iommu,
|
||||
};
|
||||
|
||||
static AddressSpace *typhoon_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
{
|
||||
TyphoonState *s = opaque;
|
||||
return &s->pchip.iommu_as;
|
||||
}
|
||||
|
||||
static void typhoon_set_irq(void *opaque, int irq, int level)
|
||||
{
|
||||
TyphoonState *s = opaque;
|
||||
@@ -688,6 +825,9 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
|
||||
s = TYPHOON_PCI_HOST_BRIDGE(dev);
|
||||
phb = PCI_HOST_BRIDGE(dev);
|
||||
|
||||
s->cchip.misc = 0x800000000ull; /* Revision: Typhoon. */
|
||||
s->pchip.win[3].wba = 2; /* Window 3 SG always enabled. */
|
||||
|
||||
/* Remember the CPUs so that we can deliver interrupts to them. */
|
||||
for (i = 0; i < 4; i++) {
|
||||
AlphaCPU *cpu = cpus[i];
|
||||
@@ -746,6 +886,12 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
|
||||
0, 64, TYPE_PCI_BUS);
|
||||
phb->bus = b;
|
||||
|
||||
/* Host memory as seen from the PCI side, via the IOMMU. */
|
||||
memory_region_init_iommu(&s->pchip.iommu, OBJECT(s), &typhoon_iommu_ops,
|
||||
"iommu-typhoon", UINT64_MAX);
|
||||
address_space_init(&s->pchip.iommu_as, &s->pchip.iommu, "pchip0-pci");
|
||||
pci_setup_iommu(b, typhoon_pci_dma_iommu, s);
|
||||
|
||||
/* Pchip0 PCI special/interrupt acknowledge, 0x801.F800.0000, 64MB. */
|
||||
memory_region_init_io(&s->pchip.reg_iack, OBJECT(s), &alpha_pci_iack_ops,
|
||||
b, "pci0-iack", 64*MB);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
|
||||
obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
|
||||
obj-y += omap_sx1.o palm.o pic_cpu.o realview.o spitz.o stellaris.o
|
||||
obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
|
||||
obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
|
||||
|
||||
obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
|
||||
|
@@ -173,7 +173,6 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
|
||||
DeviceState *nvic;
|
||||
/* FIXME: make this local state. */
|
||||
static qemu_irq pic[64];
|
||||
qemu_irq *cpu_pic;
|
||||
int image_size;
|
||||
uint64_t entry;
|
||||
uint64_t lowaddr;
|
||||
@@ -221,8 +220,8 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
|
||||
nvic = qdev_create(NULL, "armv7m_nvic");
|
||||
env->nvic = nvic;
|
||||
qdev_init_nofail(nvic);
|
||||
cpu_pic = arm_pic_init_cpu(cpu);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(nvic), 0, cpu_pic[ARM_PIC_CPU_IRQ]);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(nvic), 0,
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
|
||||
for (i = 0; i < 64; i++) {
|
||||
pic[i] = qdev_get_gpio_in(nvic, i);
|
||||
}
|
||||
|
@@ -62,7 +62,6 @@ static QEMUMachine collie_machine = {
|
||||
.name = "collie",
|
||||
.desc = "Collie PDA (SA-1110)",
|
||||
.init = collie_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void collie_machine_init(void)
|
||||
|
@@ -137,10 +137,8 @@ void exynos4210_write_secondary(ARMCPU *cpu,
|
||||
Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
|
||||
unsigned long ram_size)
|
||||
{
|
||||
qemu_irq cpu_irq[EXYNOS4210_NCPUS];
|
||||
int i, n;
|
||||
Exynos4210State *s = g_new(Exynos4210State, 1);
|
||||
qemu_irq *irqp;
|
||||
qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS];
|
||||
unsigned long mem_size;
|
||||
DeviceState *dev;
|
||||
@@ -152,15 +150,6 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
|
||||
fprintf(stderr, "Unable to find CPU %d definition\n", n);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Create PIC controller for each processor instance */
|
||||
irqp = arm_pic_init_cpu(s->cpu[n]);
|
||||
|
||||
/*
|
||||
* Get GICs gpio_in cpu_irq to connect a combiner to them later.
|
||||
* Use only IRQ for a while.
|
||||
*/
|
||||
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
|
||||
}
|
||||
|
||||
/*** IRQs ***/
|
||||
@@ -178,8 +167,9 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
|
||||
}
|
||||
busdev = SYS_BUS_DEVICE(dev);
|
||||
|
||||
/* Connect IRQ Gate output to cpu_irq */
|
||||
sysbus_connect_irq(busdev, 0, cpu_irq[i]);
|
||||
/* Connect IRQ Gate output to CPU's IRQ line */
|
||||
sysbus_connect_irq(busdev, 0,
|
||||
qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ));
|
||||
}
|
||||
|
||||
/* Private memory region and Internal GIC */
|
||||
|
@@ -150,14 +150,12 @@ static QEMUMachine exynos4_machines[EXYNOS4_NUM_OF_BOARDS] = {
|
||||
.desc = "Samsung NURI board (Exynos4210)",
|
||||
.init = nuri_init,
|
||||
.max_cpus = EXYNOS4210_NCPUS,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
},
|
||||
[EXYNOS4_BOARD_SMDKC210] = {
|
||||
.name = "smdkc210",
|
||||
.desc = "Samsung SMDKC210 board (Exynos4210)",
|
||||
.init = smdkc210_init,
|
||||
.max_cpus = EXYNOS4210_NCPUS,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -122,14 +122,12 @@ static QEMUMachine connex_machine = {
|
||||
.name = "connex",
|
||||
.desc = "Gumstix Connex (PXA255)",
|
||||
.init = connex_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine verdex_machine = {
|
||||
.name = "verdex",
|
||||
.desc = "Gumstix Verdex (PXA270)",
|
||||
.init = verdex_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void gumstix_machine_init(void)
|
||||
|
@@ -209,7 +209,6 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
DeviceState *dev = NULL;
|
||||
SysBusDevice *busdev;
|
||||
qemu_irq *irqp;
|
||||
qemu_irq pic[128];
|
||||
int n;
|
||||
qemu_irq cpu_irq[4];
|
||||
@@ -239,8 +238,7 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
|
||||
|
||||
/* This will become a QOM property eventually */
|
||||
cpu->reset_cbar = GIC_BASE_ADDR;
|
||||
irqp = arm_pic_init_cpu(cpu);
|
||||
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
|
||||
cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ);
|
||||
}
|
||||
|
||||
sysmem = get_system_memory();
|
||||
@@ -365,7 +363,6 @@ static QEMUMachine highbank_machine = {
|
||||
.init = highbank_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 4,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine midway_machine = {
|
||||
@@ -374,7 +371,6 @@ static QEMUMachine midway_machine = {
|
||||
.init = midway_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 4,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void calxeda_machines_init(void)
|
||||
|
@@ -465,7 +465,6 @@ static void integratorcp_init(QEMUMachineInitArgs *args)
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
|
||||
qemu_irq pic[32];
|
||||
qemu_irq *cpu_pic;
|
||||
DeviceState *dev;
|
||||
int i;
|
||||
|
||||
@@ -493,10 +492,10 @@ static void integratorcp_init(QEMUMachineInitArgs *args)
|
||||
qdev_init_nofail(dev);
|
||||
sysbus_mmio_map((SysBusDevice *)dev, 0, 0x10000000);
|
||||
|
||||
cpu_pic = arm_pic_init_cpu(cpu);
|
||||
dev = sysbus_create_varargs(TYPE_INTEGRATOR_PIC, 0x14000000,
|
||||
cpu_pic[ARM_PIC_CPU_IRQ],
|
||||
cpu_pic[ARM_PIC_CPU_FIQ], NULL);
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ),
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ),
|
||||
NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
pic[i] = qdev_get_gpio_in(dev, i);
|
||||
}
|
||||
@@ -527,7 +526,6 @@ static QEMUMachine integratorcp_machine = {
|
||||
.desc = "ARM Integrator/CP (ARM926EJ-S)",
|
||||
.init = integratorcp_init,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void integratorcp_machine_init(void)
|
||||
|
@@ -82,7 +82,6 @@ static void kzm_init(QEMUMachineInitArgs *args)
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *sram = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
|
||||
qemu_irq *cpu_pic;
|
||||
DeviceState *dev;
|
||||
DeviceState *ccm;
|
||||
|
||||
@@ -108,11 +107,10 @@ static void kzm_init(QEMUMachineInitArgs *args)
|
||||
memory_region_init_ram(sram, NULL, "kzm.sram", 0x4000);
|
||||
memory_region_add_subregion(address_space_mem, 0x1FFFC000, sram);
|
||||
|
||||
cpu_pic = arm_pic_init_cpu(cpu);
|
||||
dev = sysbus_create_varargs("imx_avic", 0x68000000,
|
||||
cpu_pic[ARM_PIC_CPU_IRQ],
|
||||
cpu_pic[ARM_PIC_CPU_FIQ], NULL);
|
||||
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ),
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ),
|
||||
NULL);
|
||||
|
||||
imx_serial_create(0, 0x43f90000, qdev_get_gpio_in(dev, 45));
|
||||
imx_serial_create(1, 0x43f94000, qdev_get_gpio_in(dev, 32));
|
||||
@@ -146,7 +144,6 @@ static QEMUMachine kzm_machine = {
|
||||
.name = "kzm",
|
||||
.desc = "ARM KZM Emulation Baseboard (ARM1136)",
|
||||
.init = kzm_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void kzm_machine_init(void)
|
||||
|
@@ -179,7 +179,6 @@ static QEMUMachine mainstone2_machine = {
|
||||
.name = "mainstone",
|
||||
.desc = "Mainstone II (PXA27x)",
|
||||
.init = mainstone_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mainstone_machine_init(void)
|
||||
|
@@ -1586,7 +1586,6 @@ static void musicpal_init(QEMUMachineInitArgs *args)
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
ARMCPU *cpu;
|
||||
qemu_irq *cpu_pic;
|
||||
qemu_irq pic[32];
|
||||
DeviceState *dev;
|
||||
DeviceState *i2c_dev;
|
||||
@@ -1610,7 +1609,6 @@ static void musicpal_init(QEMUMachineInitArgs *args)
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
cpu_pic = arm_pic_init_cpu(cpu);
|
||||
|
||||
/* For now we use a fixed - the original - RAM size */
|
||||
memory_region_init_ram(ram, NULL, "musicpal.ram", MP_RAM_DEFAULT_SIZE);
|
||||
@@ -1622,7 +1620,7 @@ static void musicpal_init(QEMUMachineInitArgs *args)
|
||||
memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
|
||||
|
||||
dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
|
||||
cpu_pic[ARM_PIC_CPU_IRQ]);
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
|
||||
for (i = 0; i < 32; i++) {
|
||||
pic[i] = qdev_get_gpio_in(dev, i);
|
||||
}
|
||||
@@ -1731,7 +1729,6 @@ static QEMUMachine musicpal_machine = {
|
||||
.name = "musicpal",
|
||||
.desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)",
|
||||
.init = musicpal_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void musicpal_machine_init(void)
|
||||
|
@@ -1340,7 +1340,7 @@ static void n8x0_init(QEMUMachineInitArgs *args,
|
||||
}
|
||||
|
||||
if (option_rom[0].name &&
|
||||
(args->boot_device[0] == 'n' || !args->kernel_filename)) {
|
||||
(args->boot_order[0] == 'n' || !args->kernel_filename)) {
|
||||
uint8_t nolo_tags[0x10000];
|
||||
/* No, wait, better start at the ROM. */
|
||||
s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
|
||||
@@ -1396,14 +1396,14 @@ static QEMUMachine n800_machine = {
|
||||
.name = "n800",
|
||||
.desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
|
||||
.init = n800_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
.default_boot_order = "",
|
||||
};
|
||||
|
||||
static QEMUMachine n810_machine = {
|
||||
.name = "n810",
|
||||
.desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
|
||||
.init = n810_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
.default_boot_order = "",
|
||||
};
|
||||
|
||||
static void nseries_machine_init(void)
|
||||
|
@@ -3827,7 +3827,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
|
||||
int i;
|
||||
struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)
|
||||
g_malloc0(sizeof(struct omap_mpu_state_s));
|
||||
qemu_irq *cpu_irq;
|
||||
qemu_irq dma_irqs[6];
|
||||
DriveInfo *dinfo;
|
||||
SysBusDevice *busdev;
|
||||
@@ -3860,14 +3859,15 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
|
||||
|
||||
omap_clkm_init(system_memory, 0xfffece00, 0xe1008000, s);
|
||||
|
||||
cpu_irq = arm_pic_init_cpu(s->cpu);
|
||||
s->ih[0] = qdev_create(NULL, "omap-intc");
|
||||
qdev_prop_set_uint32(s->ih[0], "size", 0x100);
|
||||
qdev_prop_set_ptr(s->ih[0], "clk", omap_findclk(s, "arminth_ck"));
|
||||
qdev_init_nofail(s->ih[0]);
|
||||
busdev = SYS_BUS_DEVICE(s->ih[0]);
|
||||
sysbus_connect_irq(busdev, 0, cpu_irq[ARM_PIC_CPU_IRQ]);
|
||||
sysbus_connect_irq(busdev, 1, cpu_irq[ARM_PIC_CPU_FIQ]);
|
||||
sysbus_connect_irq(busdev, 0,
|
||||
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ));
|
||||
sysbus_connect_irq(busdev, 1,
|
||||
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ));
|
||||
sysbus_mmio_map(busdev, 0, 0xfffecb00);
|
||||
s->ih[1] = qdev_create(NULL, "omap-intc");
|
||||
qdev_prop_set_uint32(s->ih[1], "size", 0x800);
|
||||
|
@@ -2244,7 +2244,6 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
|
||||
{
|
||||
struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)
|
||||
g_malloc0(sizeof(struct omap_mpu_state_s));
|
||||
qemu_irq *cpu_irq;
|
||||
qemu_irq dma_irqs[4];
|
||||
DriveInfo *dinfo;
|
||||
int i;
|
||||
@@ -2277,15 +2276,16 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
|
||||
s->l4 = omap_l4_init(sysmem, OMAP2_L4_BASE, 54);
|
||||
|
||||
/* Actually mapped at any 2K boundary in the ARM11 private-peripheral if */
|
||||
cpu_irq = arm_pic_init_cpu(s->cpu);
|
||||
s->ih[0] = qdev_create(NULL, "omap2-intc");
|
||||
qdev_prop_set_uint8(s->ih[0], "revision", 0x21);
|
||||
qdev_prop_set_ptr(s->ih[0], "fclk", omap_findclk(s, "mpu_intc_fclk"));
|
||||
qdev_prop_set_ptr(s->ih[0], "iclk", omap_findclk(s, "mpu_intc_iclk"));
|
||||
qdev_init_nofail(s->ih[0]);
|
||||
busdev = SYS_BUS_DEVICE(s->ih[0]);
|
||||
sysbus_connect_irq(busdev, 0, cpu_irq[ARM_PIC_CPU_IRQ]);
|
||||
sysbus_connect_irq(busdev, 1, cpu_irq[ARM_PIC_CPU_FIQ]);
|
||||
sysbus_connect_irq(busdev, 0,
|
||||
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ));
|
||||
sysbus_connect_irq(busdev, 1,
|
||||
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ));
|
||||
sysbus_mmio_map(busdev, 0, 0x480fe000);
|
||||
s->prcm = omap_prcm_init(omap_l4tao(s->l4, 3),
|
||||
qdev_get_gpio_in(s->ih[0],
|
||||
|
@@ -219,14 +219,12 @@ static QEMUMachine sx1_machine_v2 = {
|
||||
.name = "sx1",
|
||||
.desc = "Siemens SX1 (OMAP310) V2",
|
||||
.init = sx1_init_v2,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine sx1_machine_v1 = {
|
||||
.name = "sx1-v1",
|
||||
.desc = "Siemens SX1 (OMAP310) V1",
|
||||
.init = sx1_init_v1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void sx1_machine_init(void)
|
||||
|
@@ -273,7 +273,6 @@ static QEMUMachine palmte_machine = {
|
||||
.name = "cheetah",
|
||||
.desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
|
||||
.init = palmte_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void palmte_machine_init(void)
|
||||
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Generic ARM Programmable Interrupt Controller support.
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery.
|
||||
* Written by Paul Brook
|
||||
*
|
||||
* This code is licensed under the LGPL
|
||||
*/
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "hw/arm/arm.h"
|
||||
#include "sysemu/kvm.h"
|
||||
|
||||
/* Input 0 is IRQ and input 1 is FIQ. */
|
||||
static void arm_pic_cpu_handler(void *opaque, int irq, int level)
|
||||
{
|
||||
ARMCPU *cpu = opaque;
|
||||
CPUState *cs = CPU(cpu);
|
||||
|
||||
switch (irq) {
|
||||
case ARM_PIC_CPU_IRQ:
|
||||
if (level) {
|
||||
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||
} else {
|
||||
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||
}
|
||||
break;
|
||||
case ARM_PIC_CPU_FIQ:
|
||||
if (level) {
|
||||
cpu_interrupt(cs, CPU_INTERRUPT_FIQ);
|
||||
} else {
|
||||
cpu_reset_interrupt(cs, CPU_INTERRUPT_FIQ);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
|
||||
}
|
||||
}
|
||||
|
||||
static void kvm_arm_pic_cpu_handler(void *opaque, int irq, int level)
|
||||
{
|
||||
#ifdef CONFIG_KVM
|
||||
ARMCPU *cpu = opaque;
|
||||
CPUState *cs = CPU(cpu);
|
||||
int kvm_irq = KVM_ARM_IRQ_TYPE_CPU << KVM_ARM_IRQ_TYPE_SHIFT;
|
||||
|
||||
switch (irq) {
|
||||
case ARM_PIC_CPU_IRQ:
|
||||
kvm_irq |= KVM_ARM_IRQ_CPU_IRQ;
|
||||
break;
|
||||
case ARM_PIC_CPU_FIQ:
|
||||
kvm_irq |= KVM_ARM_IRQ_CPU_FIQ;
|
||||
break;
|
||||
default:
|
||||
hw_error("kvm_arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
|
||||
}
|
||||
kvm_irq |= cs->cpu_index << KVM_ARM_IRQ_VCPU_SHIFT;
|
||||
kvm_set_irq(kvm_state, kvm_irq, level ? 1 : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
|
||||
{
|
||||
if (kvm_enabled()) {
|
||||
return qemu_allocate_irqs(kvm_arm_pic_cpu_handler, cpu, 2);
|
||||
}
|
||||
return qemu_allocate_irqs(arm_pic_cpu_handler, cpu, 2);
|
||||
}
|
@@ -56,7 +56,6 @@ static void realview_init(QEMUMachineInitArgs *args,
|
||||
MemoryRegion *ram_hack = g_new(MemoryRegion, 1);
|
||||
DeviceState *dev, *sysctl, *gpio2, *pl041;
|
||||
SysBusDevice *busdev;
|
||||
qemu_irq *irqp;
|
||||
qemu_irq pic[64];
|
||||
qemu_irq mmc_irq[2];
|
||||
PCIBus *pci_bus = NULL;
|
||||
@@ -92,8 +91,7 @@ static void realview_init(QEMUMachineInitArgs *args,
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
irqp = arm_pic_init_cpu(cpu);
|
||||
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
|
||||
cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ);
|
||||
}
|
||||
env = &cpu->env;
|
||||
if (arm_feature(env, ARM_FEATURE_V7)) {
|
||||
@@ -371,7 +369,6 @@ static QEMUMachine realview_eb_machine = {
|
||||
.desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)",
|
||||
.init = realview_eb_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine realview_eb_mpcore_machine = {
|
||||
@@ -380,14 +377,12 @@ static QEMUMachine realview_eb_mpcore_machine = {
|
||||
.init = realview_eb_mpcore_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 4,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine realview_pb_a8_machine = {
|
||||
.name = "realview-pb-a8",
|
||||
.desc = "ARM RealView Platform Baseboard for Cortex-A8",
|
||||
.init = realview_pb_a8_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine realview_pbx_a9_machine = {
|
||||
@@ -396,7 +391,6 @@ static QEMUMachine realview_pbx_a9_machine = {
|
||||
.init = realview_pbx_a9_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 4,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void realview_machine_init(void)
|
||||
|
@@ -966,28 +966,24 @@ static QEMUMachine akitapda_machine = {
|
||||
.name = "akita",
|
||||
.desc = "Akita PDA (PXA270)",
|
||||
.init = akita_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine spitzpda_machine = {
|
||||
.name = "spitz",
|
||||
.desc = "Spitz PDA (PXA270)",
|
||||
.init = spitz_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine borzoipda_machine = {
|
||||
.name = "borzoi",
|
||||
.desc = "Borzoi PDA (PXA270)",
|
||||
.init = borzoi_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine terrierpda_machine = {
|
||||
.name = "terrier",
|
||||
.desc = "Terrier PDA (PXA270)",
|
||||
.init = terrier_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void spitz_machine_init(void)
|
||||
|
@@ -1348,14 +1348,12 @@ static QEMUMachine lm3s811evb_machine = {
|
||||
.name = "lm3s811evb",
|
||||
.desc = "Stellaris LM3S811EVB",
|
||||
.init = lm3s811evb_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine lm3s6965evb_machine = {
|
||||
.name = "lm3s6965evb",
|
||||
.desc = "Stellaris LM3S6965EVB",
|
||||
.init = lm3s6965evb_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void stellaris_machine_init(void)
|
||||
|
@@ -1588,7 +1588,6 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,
|
||||
unsigned int sdram_size, const char *rev)
|
||||
{
|
||||
StrongARMState *s;
|
||||
qemu_irq *pic;
|
||||
int i;
|
||||
|
||||
s = g_malloc0(sizeof(StrongARMState));
|
||||
@@ -1613,9 +1612,10 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,
|
||||
vmstate_register_ram_global(&s->sdram);
|
||||
memory_region_add_subregion(sysmem, SA_SDCS0, &s->sdram);
|
||||
|
||||
pic = arm_pic_init_cpu(s->cpu);
|
||||
s->pic = sysbus_create_varargs("strongarm_pic", 0x90050000,
|
||||
pic[ARM_PIC_CPU_IRQ], pic[ARM_PIC_CPU_FIQ], NULL);
|
||||
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ),
|
||||
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ),
|
||||
NULL);
|
||||
|
||||
sysbus_create_varargs("pxa25x-timer", 0x90000000,
|
||||
qdev_get_gpio_in(s->pic, SA_PIC_OSTC0),
|
||||
|
@@ -251,7 +251,6 @@ static QEMUMachine tosapda_machine = {
|
||||
.name = "tosa",
|
||||
.desc = "Tosa PDA (PXA255)",
|
||||
.init = tosa_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void tosapda_machine_init(void)
|
||||
|
@@ -178,7 +178,6 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
|
||||
ARMCPU *cpu;
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
qemu_irq *cpu_pic;
|
||||
qemu_irq pic[32];
|
||||
qemu_irq sic[32];
|
||||
DeviceState *dev, *sysctl;
|
||||
@@ -211,10 +210,10 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
|
||||
qdev_init_nofail(sysctl);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, 0x10000000);
|
||||
|
||||
cpu_pic = arm_pic_init_cpu(cpu);
|
||||
dev = sysbus_create_varargs("pl190", 0x10140000,
|
||||
cpu_pic[ARM_PIC_CPU_IRQ],
|
||||
cpu_pic[ARM_PIC_CPU_FIQ], NULL);
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ),
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ),
|
||||
NULL);
|
||||
for (n = 0; n < 32; n++) {
|
||||
pic[n] = qdev_get_gpio_in(dev, n);
|
||||
}
|
||||
@@ -368,7 +367,6 @@ static QEMUMachine versatilepb_machine = {
|
||||
.desc = "ARM Versatile/PB (ARM926EJ-S)",
|
||||
.init = vpb_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine versatileab_machine = {
|
||||
@@ -376,7 +374,6 @@ static QEMUMachine versatileab_machine = {
|
||||
.desc = "ARM Versatile/AB (ARM926EJ-S)",
|
||||
.init = vab_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void versatile_machine_init(void)
|
||||
|
@@ -183,7 +183,6 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
|
||||
MemoryRegion *lowram = g_new(MemoryRegion, 1);
|
||||
DeviceState *dev;
|
||||
SysBusDevice *busdev;
|
||||
qemu_irq *irqp;
|
||||
int n;
|
||||
qemu_irq cpu_irq[4];
|
||||
ram_addr_t low_ram_size;
|
||||
@@ -198,8 +197,7 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
irqp = arm_pic_init_cpu(cpu);
|
||||
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
|
||||
cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ);
|
||||
}
|
||||
|
||||
if (ram_size > 0x40000000) {
|
||||
@@ -312,15 +310,13 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,
|
||||
|
||||
for (n = 0; n < smp_cpus; n++) {
|
||||
ARMCPU *cpu;
|
||||
qemu_irq *irqp;
|
||||
|
||||
cpu = cpu_arm_init(cpu_model);
|
||||
if (!cpu) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
irqp = arm_pic_init_cpu(cpu);
|
||||
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
|
||||
cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -651,7 +647,6 @@ static QEMUMachine vexpress_a9_machine = {
|
||||
.init = vexpress_a9_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 4,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine vexpress_a15_machine = {
|
||||
@@ -660,7 +655,6 @@ static QEMUMachine vexpress_a15_machine = {
|
||||
.init = vexpress_a15_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 4,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void vexpress_machine_init(void)
|
||||
|
@@ -108,11 +108,9 @@ static void zynq_init(QEMUMachineInitArgs *args)
|
||||
MemoryRegion *ocm_ram = g_new(MemoryRegion, 1);
|
||||
DeviceState *dev;
|
||||
SysBusDevice *busdev;
|
||||
qemu_irq *irqp;
|
||||
qemu_irq pic[64];
|
||||
NICInfo *nd;
|
||||
int n;
|
||||
qemu_irq cpu_irq;
|
||||
|
||||
if (!cpu_model) {
|
||||
cpu_model = "cortex-a9";
|
||||
@@ -123,8 +121,6 @@ static void zynq_init(QEMUMachineInitArgs *args)
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
irqp = arm_pic_init_cpu(cpu);
|
||||
cpu_irq = irqp[ARM_PIC_CPU_IRQ];
|
||||
|
||||
/* max 2GB ram */
|
||||
if (ram_size > 0x80000000) {
|
||||
@@ -159,7 +155,8 @@ static void zynq_init(QEMUMachineInitArgs *args)
|
||||
qdev_init_nofail(dev);
|
||||
busdev = SYS_BUS_DEVICE(dev);
|
||||
sysbus_mmio_map(busdev, 0, 0xF8F00000);
|
||||
sysbus_connect_irq(busdev, 0, cpu_irq);
|
||||
sysbus_connect_irq(busdev, 0,
|
||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
|
||||
|
||||
for (n = 0; n < 64; n++) {
|
||||
pic[n] = qdev_get_gpio_in(dev, n);
|
||||
@@ -236,7 +233,6 @@ static QEMUMachine zynq_machine = {
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = 1,
|
||||
.no_sdcard = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void zynq_machine_init(void)
|
||||
|
@@ -373,7 +373,6 @@ static QEMUMachine z2_machine = {
|
||||
.name = "z2",
|
||||
.desc = "Zipit Z2 (PXA27x)",
|
||||
.init = z2_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void z2_machine_init(void)
|
||||
|
@@ -284,9 +284,9 @@ static void Adlib_fini (AdlibState *s)
|
||||
}
|
||||
|
||||
static MemoryRegionPortio adlib_portio_list[] = {
|
||||
{ 0x388, 4, 1, .read = adlib_read, .write = adlib_write, },
|
||||
{ 0, 4, 1, .read = adlib_read, .write = adlib_write, },
|
||||
{ 0, 2, 1, .read = adlib_read, .write = adlib_write, },
|
||||
{ 0x388, 4, 1, .read = adlib_read, .write = adlib_write, },
|
||||
PORTIO_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
@@ -261,11 +261,6 @@ static int process_request(IOQueue *ioq, struct iovec iov[],
|
||||
}
|
||||
}
|
||||
|
||||
static int flush_true(EventNotifier *e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void handle_notify(EventNotifier *e)
|
||||
{
|
||||
VirtIOBlockDataPlane *s = container_of(e, VirtIOBlockDataPlane,
|
||||
@@ -345,14 +340,6 @@ static void handle_notify(EventNotifier *e)
|
||||
}
|
||||
}
|
||||
|
||||
static int flush_io(EventNotifier *e)
|
||||
{
|
||||
VirtIOBlockDataPlane *s = container_of(e, VirtIOBlockDataPlane,
|
||||
io_notifier);
|
||||
|
||||
return s->num_reqs > 0;
|
||||
}
|
||||
|
||||
static void handle_io(EventNotifier *e)
|
||||
{
|
||||
VirtIOBlockDataPlane *s = container_of(e, VirtIOBlockDataPlane,
|
||||
@@ -376,9 +363,9 @@ static void *data_plane_thread(void *opaque)
|
||||
{
|
||||
VirtIOBlockDataPlane *s = opaque;
|
||||
|
||||
do {
|
||||
while (!s->stopping || s->num_reqs > 0) {
|
||||
aio_poll(s->ctx, true);
|
||||
} while (!s->stopping || s->num_reqs > 0);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -485,7 +472,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
||||
exit(1);
|
||||
}
|
||||
s->host_notifier = *virtio_queue_get_host_notifier(vq);
|
||||
aio_set_event_notifier(s->ctx, &s->host_notifier, handle_notify, flush_true);
|
||||
aio_set_event_notifier(s->ctx, &s->host_notifier, handle_notify);
|
||||
|
||||
/* Set up ioqueue */
|
||||
ioq_init(&s->ioqueue, s->fd, REQ_MAX);
|
||||
@@ -493,7 +480,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
||||
ioq_put_iocb(&s->ioqueue, &s->requests[i].iocb);
|
||||
}
|
||||
s->io_notifier = *ioq_get_notifier(&s->ioqueue);
|
||||
aio_set_event_notifier(s->ctx, &s->io_notifier, handle_io, flush_io);
|
||||
aio_set_event_notifier(s->ctx, &s->io_notifier, handle_io);
|
||||
|
||||
s->started = true;
|
||||
trace_virtio_blk_data_plane_start(s);
|
||||
@@ -525,10 +512,10 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
|
||||
qemu_thread_join(&s->thread);
|
||||
}
|
||||
|
||||
aio_set_event_notifier(s->ctx, &s->io_notifier, NULL, NULL);
|
||||
aio_set_event_notifier(s->ctx, &s->io_notifier, NULL);
|
||||
ioq_cleanup(&s->ioqueue);
|
||||
|
||||
aio_set_event_notifier(s->ctx, &s->host_notifier, NULL, NULL);
|
||||
aio_set_event_notifier(s->ctx, &s->host_notifier, NULL);
|
||||
k->set_host_notifier(qbus->parent, 0, false);
|
||||
|
||||
aio_context_unref(s->ctx);
|
||||
|
@@ -460,9 +460,9 @@ static void virtio_blk_dma_restart_cb(void *opaque, int running,
|
||||
|
||||
static void virtio_blk_reset(VirtIODevice *vdev)
|
||||
{
|
||||
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
|
||||
VirtIOBlock *s = VIRTIO_BLK(vdev);
|
||||
|
||||
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
|
||||
if (s->dataplane) {
|
||||
virtio_blk_data_plane_stop(s->dataplane);
|
||||
}
|
||||
@@ -473,7 +473,6 @@ static void virtio_blk_reset(VirtIODevice *vdev)
|
||||
* are per-device request lists.
|
||||
*/
|
||||
bdrv_drain_all();
|
||||
bdrv_set_enable_write_cache(s->bs, s->original_wce);
|
||||
}
|
||||
|
||||
/* coalesce internal state, copy to pci i/o region 0
|
||||
@@ -565,26 +564,8 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
|
||||
}
|
||||
|
||||
features = vdev->guest_features;
|
||||
|
||||
/* A guest that supports VIRTIO_BLK_F_CONFIG_WCE must be able to send
|
||||
* cache flushes. Thus, the "auto writethrough" behavior is never
|
||||
* necessary for guests that support the VIRTIO_BLK_F_CONFIG_WCE feature.
|
||||
* Leaving it enabled would break the following sequence:
|
||||
*
|
||||
* Guest started with "-drive cache=writethrough"
|
||||
* Guest sets status to 0
|
||||
* Guest sets DRIVER bit in status field
|
||||
* Guest reads host features (WCE=0, CONFIG_WCE=1)
|
||||
* Guest writes guest features (WCE=0, CONFIG_WCE=1)
|
||||
* Guest writes 1 to the WCE configuration field (writeback mode)
|
||||
* Guest sets DRIVER_OK bit in status field
|
||||
*
|
||||
* s->bs would erroneously be placed in writethrough mode.
|
||||
*/
|
||||
if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) {
|
||||
bdrv_set_enable_write_cache(s->bs, !!(features & (1 << VIRTIO_BLK_F_WCE)));
|
||||
}
|
||||
}
|
||||
|
||||
static void virtio_blk_save(QEMUFile *f, void *opaque)
|
||||
{
|
||||
@@ -693,7 +674,6 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
|
||||
}
|
||||
|
||||
blkconf_serial(&blk->conf, &blk->serial);
|
||||
s->original_wce = bdrv_enable_write_cache(blk->conf.bs);
|
||||
if (blkconf_geometry(&blk->conf, NULL, 65535, 255, 255) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@@ -47,8 +47,6 @@ static int vty_getchars(VIOsPAPRDevice *sdev, uint8_t *buf, int max)
|
||||
buf[n++] = dev->buf[dev->out++ % VTERM_BUFSIZE];
|
||||
}
|
||||
|
||||
qemu_chr_accept_input(dev->chardev);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,8 @@
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
bool rom_file_in_ram = true;
|
||||
|
||||
static int roms_loaded;
|
||||
|
||||
/* return the size or -1 if error */
|
||||
@@ -576,6 +578,7 @@ struct Rom {
|
||||
size_t datasize;
|
||||
|
||||
uint8_t *data;
|
||||
MemoryRegion *mr;
|
||||
int isrom;
|
||||
char *fw_dir;
|
||||
char *fw_file;
|
||||
@@ -605,6 +608,21 @@ static void rom_insert(Rom *rom)
|
||||
QTAILQ_INSERT_TAIL(&roms, rom, next);
|
||||
}
|
||||
|
||||
static void *rom_set_mr(Rom *rom, Object *owner, const char *name)
|
||||
{
|
||||
void *data;
|
||||
|
||||
rom->mr = g_malloc(sizeof(*rom->mr));
|
||||
memory_region_init_ram(rom->mr, owner, name, rom->datasize);
|
||||
memory_region_set_readonly(rom->mr, true);
|
||||
vmstate_register_ram_global(rom->mr);
|
||||
|
||||
data = memory_region_get_ram_ptr(rom->mr);
|
||||
memcpy(data, rom->data, rom->datasize);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int rom_add_file(const char *file, const char *fw_dir,
|
||||
hwaddr addr, int32_t bootindex)
|
||||
{
|
||||
@@ -646,6 +664,7 @@ int rom_add_file(const char *file, const char *fw_dir,
|
||||
if (rom->fw_file && fw_cfg) {
|
||||
const char *basename;
|
||||
char fw_file_name[56];
|
||||
void *data;
|
||||
|
||||
basename = strrchr(rom->fw_file, '/');
|
||||
if (basename) {
|
||||
@@ -655,8 +674,15 @@ int rom_add_file(const char *file, const char *fw_dir,
|
||||
}
|
||||
snprintf(fw_file_name, sizeof(fw_file_name), "%s/%s", rom->fw_dir,
|
||||
basename);
|
||||
fw_cfg_add_file(fw_cfg, fw_file_name, rom->data, rom->romsize);
|
||||
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
|
||||
|
||||
if (rom_file_in_ram) {
|
||||
data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
|
||||
} else {
|
||||
data = rom->data;
|
||||
}
|
||||
|
||||
fw_cfg_add_file(fw_cfg, fw_file_name, data, rom->romsize);
|
||||
} else {
|
||||
snprintf(devpath, sizeof(devpath), "/rom@" TARGET_FMT_plx, addr);
|
||||
}
|
||||
@@ -731,7 +757,12 @@ static void rom_reset(void *unused)
|
||||
if (rom->data == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (rom->mr) {
|
||||
void *host = memory_region_get_ram_ptr(rom->mr);
|
||||
memcpy(host, rom->data, rom->datasize);
|
||||
} else {
|
||||
cpu_physical_memory_write_rom(rom->addr, rom->data, rom->datasize);
|
||||
}
|
||||
if (rom->isrom) {
|
||||
/* rom needs to be written only once */
|
||||
g_free(rom->data);
|
||||
@@ -781,6 +812,9 @@ static Rom *find_rom(hwaddr addr)
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
}
|
||||
if (rom->mr) {
|
||||
continue;
|
||||
}
|
||||
if (rom->addr > addr) {
|
||||
continue;
|
||||
}
|
||||
@@ -808,6 +842,9 @@ int rom_copy(uint8_t *dest, hwaddr addr, size_t size)
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
}
|
||||
if (rom->mr) {
|
||||
continue;
|
||||
}
|
||||
if (rom->addr + rom->romsize < addr) {
|
||||
continue;
|
||||
}
|
||||
@@ -866,7 +903,13 @@ void do_info_roms(Monitor *mon, const QDict *qdict)
|
||||
Rom *rom;
|
||||
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (!rom->fw_file) {
|
||||
if (rom->mr) {
|
||||
monitor_printf(mon, "%s"
|
||||
" size=0x%06zx name=\"%s\"\n",
|
||||
rom->mr->name,
|
||||
rom->romsize,
|
||||
rom->name);
|
||||
} else if (!rom->fw_file) {
|
||||
monitor_printf(mon, "addr=" TARGET_FMT_plx
|
||||
" size=0x%06zx mem=%s name=\"%s\"\n",
|
||||
rom->addr, rom->romsize,
|
||||
|
@@ -24,7 +24,6 @@ static QEMUMachine machine_none = {
|
||||
.desc = "empty machine",
|
||||
.init = machine_none_init,
|
||||
.max_cpus = 0,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void register_machines(void)
|
||||
|
@@ -752,7 +752,6 @@ static void device_initfn(Object *obj)
|
||||
}
|
||||
class = object_class_get_parent(class);
|
||||
} while (class != object_class_by_name(TYPE_DEVICE));
|
||||
qdev_prop_set_globals(dev, &err);
|
||||
if (err != NULL) {
|
||||
qerror_report_err(err);
|
||||
error_free(err);
|
||||
@@ -764,6 +763,15 @@ static void device_initfn(Object *obj)
|
||||
assert_no_error(err);
|
||||
}
|
||||
|
||||
static void device_post_init(Object *obj)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Error *err = NULL;
|
||||
|
||||
qdev_prop_set_globals(dev, &err);
|
||||
assert_no_error(err);
|
||||
}
|
||||
|
||||
/* Unlink device from bus and free the structure. */
|
||||
static void device_finalize(Object *obj)
|
||||
{
|
||||
@@ -853,6 +861,7 @@ static const TypeInfo device_type_info = {
|
||||
.parent = TYPE_OBJECT,
|
||||
.instance_size = sizeof(DeviceState),
|
||||
.instance_init = device_initfn,
|
||||
.instance_post_init = device_post_init,
|
||||
.instance_finalize = device_finalize,
|
||||
.class_base_init = device_class_base_init,
|
||||
.class_init = device_class_init,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
obj-$(CONFIG_ARM11MPCORE) += arm11mpcore.o
|
||||
obj-$(CONFIG_ARM9MPCORE) += a9mpcore.o
|
||||
obj-$(CONFIG_ARM15MPCORE) += a15mpcore.o
|
||||
obj-$(CONFIG_A9MPCORE) += a9mpcore.o
|
||||
obj-$(CONFIG_A15MPCORE) += a15mpcore.o
|
||||
obj-$(CONFIG_ICC_BUS) += icc_bus.o
|
||||
|
||||
|
@@ -49,6 +49,8 @@ static int a15mp_priv_init(SysBusDevice *dev)
|
||||
A15MPPrivState *s = A15MPCORE_PRIV(dev);
|
||||
SysBusDevice *busdev;
|
||||
const char *gictype = "arm_gic";
|
||||
int i;
|
||||
CPUState *cpu;
|
||||
|
||||
if (kvm_irqchip_in_kernel()) {
|
||||
gictype = "kvm-arm-gic";
|
||||
@@ -67,6 +69,22 @@ static int a15mp_priv_init(SysBusDevice *dev)
|
||||
/* Pass through inbound GPIO lines to the GIC */
|
||||
qdev_init_gpio_in(DEVICE(dev), a15mp_priv_set_irq, s->num_irq - 32);
|
||||
|
||||
/* Wire the outputs from each CPU's generic timer to the
|
||||
* appropriate GIC PPI inputs
|
||||
*/
|
||||
for (i = 0, cpu = first_cpu; i < s->num_cpu; i++, cpu = cpu->next_cpu) {
|
||||
DeviceState *cpudev = DEVICE(cpu);
|
||||
int ppibase = s->num_irq - 32 + i * 32;
|
||||
/* physical timer; we wire it up to the non-secure timer's ID,
|
||||
* since a real A15 always has TrustZone but QEMU doesn't.
|
||||
*/
|
||||
qdev_connect_gpio_out(cpudev, 0,
|
||||
qdev_get_gpio_in(s->gic, ppibase + 30));
|
||||
/* virtual timer */
|
||||
qdev_connect_gpio_out(cpudev, 1,
|
||||
qdev_get_gpio_in(s->gic, ppibase + 27));
|
||||
}
|
||||
|
||||
/* Memory map (addresses are offsets from PERIPHBASE):
|
||||
* 0x0000-0x0fff -- reserved
|
||||
* 0x1000-0x1fff -- GIC Distributor
|
||||
|
@@ -355,7 +355,6 @@ static QEMUMachine axisdev88_machine = {
|
||||
.desc = "AXIS devboard 88",
|
||||
.init = axisdev88_init,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void axisdev88_machine_init(void)
|
||||
|
@@ -31,6 +31,10 @@ static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
|
||||
if (is_buffer_shared(surface)) {
|
||||
return;
|
||||
}
|
||||
if (!qxl->guest_primary.data) {
|
||||
trace_qxl_render_blit_guest_primary_initialized();
|
||||
qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
|
||||
}
|
||||
trace_qxl_render_blit(qxl->guest_primary.qxl_stride,
|
||||
rect->left, rect->right, rect->top, rect->bottom);
|
||||
src = qxl->guest_primary.data;
|
||||
@@ -100,12 +104,7 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
|
||||
|
||||
if (qxl->guest_primary.resized) {
|
||||
qxl->guest_primary.resized = 0;
|
||||
qxl->guest_primary.data = qxl_phys2virt(qxl,
|
||||
qxl->guest_primary.surface.mem,
|
||||
MEMSLOT_GROUP_GUEST);
|
||||
if (!qxl->guest_primary.data) {
|
||||
return;
|
||||
}
|
||||
qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
|
||||
qxl_set_rect_to_surface(qxl, &qxl->dirty[0]);
|
||||
qxl->num_dirty_rects = 1;
|
||||
trace_qxl_render_guest_primary_resized(
|
||||
@@ -129,10 +128,6 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
|
||||
}
|
||||
dpy_gfx_replace_surface(vga->con, surface);
|
||||
}
|
||||
|
||||
if (!qxl->guest_primary.data) {
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < qxl->num_dirty_rects; i++) {
|
||||
if (qemu_spice_rect_is_empty(qxl->dirty+i)) {
|
||||
break;
|
||||
|
@@ -510,8 +510,9 @@ static void vapic_reset(DeviceState *dev)
|
||||
{
|
||||
VAPICROMState *s = VAPIC(dev);
|
||||
|
||||
s->state = VAPIC_INACTIVE;
|
||||
s->rom_state_paddr = 0;
|
||||
if (s->state == VAPIC_ACTIVE) {
|
||||
s->state = VAPIC_STANDBY;
|
||||
}
|
||||
vapic_enable_tpr_reporting(false);
|
||||
}
|
||||
|
||||
@@ -577,7 +578,7 @@ static int patch_hypercalls(VAPICROMState *s)
|
||||
* enable write access to the option ROM so that variables can be updated by
|
||||
* the guest.
|
||||
*/
|
||||
static int vapic_map_rom_writable(VAPICROMState *s)
|
||||
static void vapic_map_rom_writable(VAPICROMState *s)
|
||||
{
|
||||
hwaddr rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK;
|
||||
MemoryRegionSection section;
|
||||
@@ -598,9 +599,6 @@ static int vapic_map_rom_writable(VAPICROMState *s)
|
||||
/* read ROM size from RAM region */
|
||||
ram = memory_region_get_ram_ptr(section.mr);
|
||||
rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
|
||||
if (rom_size == 0) {
|
||||
return -1;
|
||||
}
|
||||
s->rom_size = rom_size;
|
||||
|
||||
/* We need to round to avoid creating subpages
|
||||
@@ -614,15 +612,11 @@ static int vapic_map_rom_writable(VAPICROMState *s)
|
||||
memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000);
|
||||
s->rom_mapped_writable = true;
|
||||
memory_region_unref(section.mr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vapic_prepare(VAPICROMState *s)
|
||||
{
|
||||
if (vapic_map_rom_writable(s) < 0) {
|
||||
return -1;
|
||||
}
|
||||
vapic_map_rom_writable(s);
|
||||
|
||||
if (patch_hypercalls(s) < 0) {
|
||||
return -1;
|
||||
@@ -665,7 +659,6 @@ static void vapic_write(void *opaque, hwaddr addr, uint64_t data,
|
||||
}
|
||||
if (vapic_prepare(s) < 0) {
|
||||
s->state = VAPIC_INACTIVE;
|
||||
s->rom_state_paddr = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/i386/apic.h"
|
||||
#include "hw/pci/pci.h"
|
||||
@@ -60,17 +61,12 @@ static bool has_pvpanic;
|
||||
static bool has_pci_info = true;
|
||||
|
||||
/* PC hardware initialisation */
|
||||
static void pc_init1(MemoryRegion *system_memory,
|
||||
MemoryRegion *system_io,
|
||||
ram_addr_t ram_size,
|
||||
const char *boot_device,
|
||||
const char *kernel_filename,
|
||||
const char *kernel_cmdline,
|
||||
const char *initrd_filename,
|
||||
const char *cpu_model,
|
||||
static void pc_init1(QEMUMachineInitArgs *args,
|
||||
int pci_enabled,
|
||||
int kvmclock_enabled)
|
||||
{
|
||||
MemoryRegion *system_memory = get_system_memory();
|
||||
MemoryRegion *system_io = get_system_io();
|
||||
int i;
|
||||
ram_addr_t below_4g_mem_size, above_4g_mem_size;
|
||||
PCIBus *pci_bus;
|
||||
@@ -93,7 +89,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||
FWCfgState *fw_cfg = NULL;
|
||||
PcGuestInfo *guest_info;
|
||||
|
||||
if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
|
||||
if (xen_enabled() && xen_hvm_init() != 0) {
|
||||
fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -102,18 +98,18 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||
object_property_add_child(qdev_get_machine(), "icc-bridge",
|
||||
OBJECT(icc_bridge), NULL);
|
||||
|
||||
pc_cpus_init(cpu_model, icc_bridge);
|
||||
pc_cpus_init(args->cpu_model, icc_bridge);
|
||||
|
||||
if (kvm_enabled() && kvmclock_enabled) {
|
||||
kvmclock_create();
|
||||
}
|
||||
|
||||
if (ram_size >= 0xe0000000 ) {
|
||||
above_4g_mem_size = ram_size - 0xe0000000;
|
||||
if (args->ram_size >= 0xe0000000) {
|
||||
above_4g_mem_size = args->ram_size - 0xe0000000;
|
||||
below_4g_mem_size = 0xe0000000;
|
||||
} else {
|
||||
above_4g_mem_size = 0;
|
||||
below_4g_mem_size = ram_size;
|
||||
below_4g_mem_size = args->ram_size;
|
||||
}
|
||||
|
||||
if (pci_enabled) {
|
||||
@@ -132,7 +128,8 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||
/* allocate ram and load rom/bios */
|
||||
if (!xen_enabled()) {
|
||||
fw_cfg = pc_memory_init(system_memory,
|
||||
kernel_filename, kernel_cmdline, initrd_filename,
|
||||
args->kernel_filename, args->kernel_cmdline,
|
||||
args->initrd_filename,
|
||||
below_4g_mem_size, above_4g_mem_size,
|
||||
rom_memory, &ram_memory, guest_info);
|
||||
}
|
||||
@@ -148,7 +145,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||
|
||||
if (pci_enabled) {
|
||||
pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
|
||||
system_memory, system_io, ram_size,
|
||||
system_memory, system_io, args->ram_size,
|
||||
below_4g_mem_size,
|
||||
0x100000000ULL - below_4g_mem_size,
|
||||
above_4g_mem_size,
|
||||
@@ -207,7 +204,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||
}
|
||||
}
|
||||
|
||||
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
|
||||
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
|
||||
floppy, idebus[0], idebus[1], rtc_state);
|
||||
|
||||
if (pci_enabled && usb_enabled(false)) {
|
||||
@@ -236,95 +233,91 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||
|
||||
static void pc_init_pci(QEMUMachineInitArgs *args)
|
||||
{
|
||||
ram_addr_t ram_size = args->ram_size;
|
||||
const char *cpu_model = args->cpu_model;
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
pc_init1(get_system_memory(),
|
||||
get_system_io(),
|
||||
ram_size, boot_device,
|
||||
kernel_filename, kernel_cmdline,
|
||||
initrd_filename, cpu_model, 1, 1);
|
||||
pc_init1(args, 1, 1);
|
||||
}
|
||||
|
||||
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pci_info = false;
|
||||
rom_file_in_ram = false;
|
||||
}
|
||||
|
||||
static void pc_compat_1_5(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_6(args);
|
||||
has_pvpanic = true;
|
||||
}
|
||||
|
||||
static void pc_compat_1_4(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_5(args);
|
||||
has_pvpanic = false;
|
||||
x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
|
||||
x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
|
||||
}
|
||||
|
||||
static void pc_compat_1_3(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_4(args);
|
||||
enable_compat_apic_id_mode();
|
||||
}
|
||||
|
||||
/* PC compat function for pc-0.14 to pc-1.2 */
|
||||
static void pc_compat_1_2(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_3(args);
|
||||
disable_kvm_pv_eoi();
|
||||
}
|
||||
|
||||
static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pci_info = false;
|
||||
pc_compat_1_6(args);
|
||||
pc_init_pci(args);
|
||||
}
|
||||
|
||||
static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pvpanic = true;
|
||||
pc_init_pci_1_6(args);
|
||||
pc_compat_1_5(args);
|
||||
pc_init_pci(args);
|
||||
}
|
||||
|
||||
static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
|
||||
{
|
||||
x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
|
||||
x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
|
||||
has_pci_info = false;
|
||||
pc_compat_1_4(args);
|
||||
pc_init_pci(args);
|
||||
}
|
||||
|
||||
static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
|
||||
{
|
||||
enable_compat_apic_id_mode();
|
||||
pc_init_pci_1_4(args);
|
||||
pc_compat_1_3(args);
|
||||
pc_init_pci(args);
|
||||
}
|
||||
|
||||
/* PC machine init function for pc-1.1 to pc-1.2 */
|
||||
/* PC machine init function for pc-0.14 to pc-1.2 */
|
||||
static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
|
||||
{
|
||||
disable_kvm_pv_eoi();
|
||||
pc_init_pci_1_3(args);
|
||||
}
|
||||
|
||||
/* PC machine init function for pc-0.14 to pc-1.0 */
|
||||
static void pc_init_pci_1_0(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_init_pci_1_2(args);
|
||||
pc_compat_1_2(args);
|
||||
pc_init_pci(args);
|
||||
}
|
||||
|
||||
/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
|
||||
static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
|
||||
{
|
||||
ram_addr_t ram_size = args->ram_size;
|
||||
const char *cpu_model = args->cpu_model;
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
has_pci_info = false;
|
||||
disable_kvm_pv_eoi();
|
||||
enable_compat_apic_id_mode();
|
||||
pc_init1(get_system_memory(),
|
||||
get_system_io(),
|
||||
ram_size, boot_device,
|
||||
kernel_filename, kernel_cmdline,
|
||||
initrd_filename, cpu_model, 1, 0);
|
||||
pc_init1(args, 1, 0);
|
||||
}
|
||||
|
||||
static void pc_init_isa(QEMUMachineInitArgs *args)
|
||||
{
|
||||
ram_addr_t ram_size = args->ram_size;
|
||||
const char *cpu_model = args->cpu_model;
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
has_pci_info = false;
|
||||
if (cpu_model == NULL)
|
||||
cpu_model = "486";
|
||||
if (!args->cpu_model) {
|
||||
args->cpu_model = "486";
|
||||
}
|
||||
disable_kvm_pv_eoi();
|
||||
enable_compat_apic_id_mode();
|
||||
pc_init1(get_system_memory(),
|
||||
get_system_io(),
|
||||
ram_size, boot_device,
|
||||
kernel_filename, kernel_cmdline,
|
||||
initrd_filename, cpu_model, 0, 1);
|
||||
pc_init1(args, 0, 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XEN
|
||||
@@ -341,40 +334,43 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PC_I440FX_MACHINE_OPTIONS \
|
||||
PC_DEFAULT_MACHINE_OPTIONS, \
|
||||
.desc = "Standard PC (i440FX + PIIX, 1996)", \
|
||||
.hot_add_cpu = pc_hot_add_cpu
|
||||
|
||||
#define PC_I440FX_1_6_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
|
||||
|
||||
static QEMUMachine pc_i440fx_machine_v1_6 = {
|
||||
PC_I440FX_1_6_MACHINE_OPTIONS,
|
||||
.name = "pc-i440fx-1.6",
|
||||
.alias = "pc",
|
||||
.desc = "Standard PC (i440FX + PIIX, 1996)",
|
||||
.init = pc_init_pci_1_6,
|
||||
.hot_add_cpu = pc_hot_add_cpu,
|
||||
.max_cpus = 255,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine pc_i440fx_machine_v1_5 = {
|
||||
PC_I440FX_1_6_MACHINE_OPTIONS,
|
||||
.name = "pc-i440fx-1.5",
|
||||
.desc = "Standard PC (i440FX + PIIX, 1996)",
|
||||
.init = pc_init_pci_1_5,
|
||||
.hot_add_cpu = pc_hot_add_cpu,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_5,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_I440FX_1_4_MACHINE_OPTIONS \
|
||||
PC_I440FX_1_6_MACHINE_OPTIONS, \
|
||||
.hot_add_cpu = NULL
|
||||
|
||||
static QEMUMachine pc_i440fx_machine_v1_4 = {
|
||||
PC_I440FX_1_4_MACHINE_OPTIONS,
|
||||
.name = "pc-i440fx-1.4",
|
||||
.desc = "Standard PC (i440FX + PIIX, 1996)",
|
||||
.init = pc_init_pci_1_4,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_4,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_1_3 \
|
||||
@@ -398,15 +394,13 @@ static QEMUMachine pc_i440fx_machine_v1_4 = {
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine_v1_3 = {
|
||||
PC_I440FX_1_4_MACHINE_OPTIONS,
|
||||
.name = "pc-1.3",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_1_3,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_3,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_1_2 \
|
||||
@@ -437,16 +431,17 @@ static QEMUMachine pc_machine_v1_3 = {
|
||||
.value = "off",\
|
||||
}
|
||||
|
||||
#define PC_I440FX_1_2_MACHINE_OPTIONS \
|
||||
PC_I440FX_1_4_MACHINE_OPTIONS, \
|
||||
.init = pc_init_pci_1_2
|
||||
|
||||
static QEMUMachine pc_machine_v1_2 = {
|
||||
PC_I440FX_1_2_MACHINE_OPTIONS,
|
||||
.name = "pc-1.2",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_1_2,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_2,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_1_1 \
|
||||
@@ -482,15 +477,12 @@ static QEMUMachine pc_machine_v1_2 = {
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine_v1_1 = {
|
||||
PC_I440FX_1_2_MACHINE_OPTIONS,
|
||||
.name = "pc-1.1",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_1_2,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_1,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_1_0 \
|
||||
@@ -514,32 +506,26 @@ static QEMUMachine pc_machine_v1_1 = {
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine_v1_0 = {
|
||||
PC_I440FX_1_2_MACHINE_OPTIONS,
|
||||
.name = "pc-1.0",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_1_0,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_0,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "1.0",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_0_15 \
|
||||
PC_COMPAT_1_0
|
||||
|
||||
static QEMUMachine pc_machine_v0_15 = {
|
||||
PC_I440FX_1_2_MACHINE_OPTIONS,
|
||||
.name = "pc-0.15",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_1_0,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_0_15,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "0.15",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_0_14 \
|
||||
@@ -563,10 +549,8 @@ static QEMUMachine pc_machine_v0_15 = {
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine_v0_14 = {
|
||||
PC_I440FX_1_2_MACHINE_OPTIONS,
|
||||
.name = "pc-0.14",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_1_0,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_0_14,
|
||||
{
|
||||
@@ -581,7 +565,6 @@ static QEMUMachine pc_machine_v0_14 = {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "0.14",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_0_13 \
|
||||
@@ -596,11 +579,13 @@ static QEMUMachine pc_machine_v0_14 = {
|
||||
.value = stringify(1),\
|
||||
}
|
||||
|
||||
#define PC_I440FX_0_13_MACHINE_OPTIONS \
|
||||
PC_I440FX_1_2_MACHINE_OPTIONS, \
|
||||
.init = pc_init_pci_no_kvmclock
|
||||
|
||||
static QEMUMachine pc_machine_v0_13 = {
|
||||
PC_I440FX_0_13_MACHINE_OPTIONS,
|
||||
.name = "pc-0.13",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_0_13,
|
||||
{
|
||||
@@ -619,7 +604,6 @@ static QEMUMachine pc_machine_v0_13 = {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "0.13",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_0_12 \
|
||||
@@ -647,10 +631,8 @@ static QEMUMachine pc_machine_v0_13 = {
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine_v0_12 = {
|
||||
PC_I440FX_0_13_MACHINE_OPTIONS,
|
||||
.name = "pc-0.12",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_0_12,
|
||||
{
|
||||
@@ -665,7 +647,6 @@ static QEMUMachine pc_machine_v0_12 = {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "0.12",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_COMPAT_0_11 \
|
||||
@@ -681,10 +662,8 @@ static QEMUMachine pc_machine_v0_12 = {
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine_v0_11 = {
|
||||
PC_I440FX_0_13_MACHINE_OPTIONS,
|
||||
.name = "pc-0.11",
|
||||
.desc = "Standard PC, qemu 0.11",
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_0_11,
|
||||
{
|
||||
@@ -699,14 +678,11 @@ static QEMUMachine pc_machine_v0_11 = {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "0.11",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine pc_machine_v0_10 = {
|
||||
PC_I440FX_0_13_MACHINE_OPTIONS,
|
||||
.name = "pc-0.10",
|
||||
.desc = "Standard PC, qemu 0.10",
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_0_11,
|
||||
{
|
||||
@@ -733,10 +709,10 @@ static QEMUMachine pc_machine_v0_10 = {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.hw_version = "0.10",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine isapc_machine = {
|
||||
PC_COMMON_MACHINE_OPTIONS,
|
||||
.name = "isapc",
|
||||
.desc = "ISA-only PC",
|
||||
.init = pc_init_isa,
|
||||
@@ -744,17 +720,16 @@ static QEMUMachine isapc_machine = {
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_XEN
|
||||
static QEMUMachine xenfv_machine = {
|
||||
PC_COMMON_MACHINE_OPTIONS,
|
||||
.name = "xenfv",
|
||||
.desc = "Xen Fully-virtualized PC",
|
||||
.init = pc_xen_hvm_init,
|
||||
.max_cpus = HVM_MAX_VCPUS,
|
||||
.default_machine_opts = "accel=xen",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -28,6 +28,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "hw/hw.h"
|
||||
#include "hw/loader.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "hw/i2c/smbus.h"
|
||||
#include "hw/boards.h"
|
||||
@@ -52,12 +53,6 @@ static bool has_pci_info = true;
|
||||
/* PC hardware initialisation */
|
||||
static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
{
|
||||
ram_addr_t ram_size = args->ram_size;
|
||||
const char *cpu_model = args->cpu_model;
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
ram_addr_t below_4g_mem_size, above_4g_mem_size;
|
||||
Q35PCIHost *q35_host;
|
||||
PCIHostState *phb;
|
||||
@@ -81,26 +76,21 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
DeviceState *icc_bridge;
|
||||
PcGuestInfo *guest_info;
|
||||
|
||||
if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
|
||||
fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
|
||||
object_property_add_child(qdev_get_machine(), "icc-bridge",
|
||||
OBJECT(icc_bridge), NULL);
|
||||
|
||||
pc_cpus_init(cpu_model, icc_bridge);
|
||||
pc_cpus_init(args->cpu_model, icc_bridge);
|
||||
pc_acpi_init("q35-acpi-dsdt.aml");
|
||||
|
||||
kvmclock_create();
|
||||
|
||||
if (ram_size >= 0xb0000000) {
|
||||
above_4g_mem_size = ram_size - 0xb0000000;
|
||||
if (args->ram_size >= 0xb0000000) {
|
||||
above_4g_mem_size = args->ram_size - 0xb0000000;
|
||||
below_4g_mem_size = 0xb0000000;
|
||||
} else {
|
||||
above_4g_mem_size = 0;
|
||||
below_4g_mem_size = ram_size;
|
||||
below_4g_mem_size = args->ram_size;
|
||||
}
|
||||
|
||||
/* pci enabled */
|
||||
@@ -119,8 +109,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
if (!xen_enabled()) {
|
||||
pc_memory_init(get_system_memory(), kernel_filename, kernel_cmdline,
|
||||
initrd_filename, below_4g_mem_size, above_4g_mem_size,
|
||||
pc_memory_init(get_system_memory(),
|
||||
args->kernel_filename, args->kernel_cmdline,
|
||||
args->initrd_filename,
|
||||
below_4g_mem_size, above_4g_mem_size,
|
||||
rom_memory, &ram_memory, guest_info);
|
||||
}
|
||||
|
||||
@@ -208,7 +200,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
0xb100),
|
||||
8, NULL, 0);
|
||||
|
||||
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
|
||||
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
|
||||
floppy, idebus[0], idebus[1], rtc_state);
|
||||
|
||||
/* the rest devices to which pci devfn is automatically assigned */
|
||||
@@ -223,59 +215,80 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
}
|
||||
}
|
||||
|
||||
static void pc_q35_init_1_6(QEMUMachineInitArgs *args)
|
||||
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pci_info = false;
|
||||
rom_file_in_ram = false;
|
||||
}
|
||||
|
||||
static void pc_compat_1_5(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_6(args);
|
||||
has_pvpanic = true;
|
||||
}
|
||||
|
||||
static void pc_compat_1_4(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_5(args);
|
||||
has_pvpanic = false;
|
||||
x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
|
||||
x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
|
||||
}
|
||||
|
||||
static void pc_q35_init_1_6(QEMUMachineInitArgs *args)
|
||||
{
|
||||
pc_compat_1_6(args);
|
||||
pc_q35_init(args);
|
||||
}
|
||||
|
||||
static void pc_q35_init_1_5(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pvpanic = true;
|
||||
pc_q35_init_1_6(args);
|
||||
pc_compat_1_5(args);
|
||||
pc_q35_init(args);
|
||||
}
|
||||
|
||||
static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
|
||||
{
|
||||
x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
|
||||
x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
|
||||
has_pci_info = false;
|
||||
pc_compat_1_4(args);
|
||||
pc_q35_init(args);
|
||||
}
|
||||
|
||||
#define PC_Q35_MACHINE_OPTIONS \
|
||||
PC_DEFAULT_MACHINE_OPTIONS, \
|
||||
.desc = "Standard PC (Q35 + ICH9, 2009)", \
|
||||
.hot_add_cpu = pc_hot_add_cpu
|
||||
|
||||
#define PC_Q35_1_6_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
|
||||
|
||||
static QEMUMachine pc_q35_machine_v1_6 = {
|
||||
PC_Q35_1_6_MACHINE_OPTIONS,
|
||||
.name = "pc-q35-1.6",
|
||||
.alias = "q35",
|
||||
.desc = "Standard PC (Q35 + ICH9, 2009)",
|
||||
.init = pc_q35_init_1_6,
|
||||
.hot_add_cpu = pc_hot_add_cpu,
|
||||
.max_cpus = 255,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine pc_q35_machine_v1_5 = {
|
||||
PC_Q35_1_6_MACHINE_OPTIONS,
|
||||
.name = "pc-q35-1.5",
|
||||
.desc = "Standard PC (Q35 + ICH9, 2009)",
|
||||
.init = pc_q35_init_1_5,
|
||||
.hot_add_cpu = pc_hot_add_cpu,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_5,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
#define PC_Q35_1_4_MACHINE_OPTIONS \
|
||||
PC_Q35_1_6_MACHINE_OPTIONS, \
|
||||
.hot_add_cpu = NULL
|
||||
|
||||
static QEMUMachine pc_q35_machine_v1_4 = {
|
||||
PC_Q35_1_4_MACHINE_OPTIONS,
|
||||
.name = "pc-q35-1.4",
|
||||
.desc = "Standard PC (Q35 + ICH9, 2009)",
|
||||
.init = pc_q35_init_1_4,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_COMPAT_1_4,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void pc_q35_machine_init(void)
|
||||
|
@@ -99,7 +99,6 @@ static QEMUMachine xenpv_machine = {
|
||||
.init = xen_init_pv,
|
||||
.max_cpus = 1,
|
||||
.default_machine_opts = "accel=xen",
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void xenpv_machine_init(void)
|
||||
|
@@ -289,7 +289,6 @@ static QEMUMachine lm32_evr_machine = {
|
||||
.desc = "LatticeMico32 EVR32 eval system",
|
||||
.init = lm32_evr_init,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine lm32_uclinux_machine = {
|
||||
@@ -297,7 +296,6 @@ static QEMUMachine lm32_uclinux_machine = {
|
||||
.desc = "lm32 platform for uClinux and u-boot by Theobroma Systems",
|
||||
.init = lm32_uclinux_init,
|
||||
.is_default = 0,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void lm32_machine_init(void)
|
||||
|
@@ -208,7 +208,6 @@ static QEMUMachine milkymist_machine = {
|
||||
.desc = "Milkymist One",
|
||||
.init = milkymist_init,
|
||||
.is_default = 0,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void milkymist_machine_init(void)
|
||||
|
@@ -89,7 +89,6 @@ static QEMUMachine an5206_machine = {
|
||||
.name = "an5206",
|
||||
.desc = "Arnewsh 5206",
|
||||
.init = an5206_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void an5206_machine_init(void)
|
||||
|
@@ -73,7 +73,6 @@ static QEMUMachine dummy_m68k_machine = {
|
||||
.name = "dummy",
|
||||
.desc = "Dummy board",
|
||||
.init = dummy_m68k_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void dummy_m68k_machine_init(void)
|
||||
|
@@ -295,7 +295,6 @@ static QEMUMachine mcf5208evb_machine = {
|
||||
.desc = "MCF5206EVB",
|
||||
.init = mcf5208evb_init,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mcf5208evb_machine_init(void)
|
||||
|
@@ -186,7 +186,6 @@ static QEMUMachine petalogix_ml605_machine = {
|
||||
.desc = "PetaLogix linux refdesign for xilinx ml605 little endian",
|
||||
.init = petalogix_ml605_init,
|
||||
.is_default = 0,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void petalogix_ml605_machine_init(void)
|
||||
|
@@ -116,7 +116,6 @@ static QEMUMachine petalogix_s3adsp1800_machine = {
|
||||
.desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800",
|
||||
.init = petalogix_s3adsp1800_init,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void petalogix_s3adsp1800_machine_init(void)
|
||||
|
@@ -403,7 +403,6 @@ static QEMUMachine mips_fulong2e_machine = {
|
||||
.name = "fulong2e",
|
||||
.desc = "Fulong 2e mini pc",
|
||||
.init = mips_fulong2e_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mips_fulong2e_machine_init(void)
|
||||
|
@@ -327,7 +327,6 @@ static QEMUMachine mips_magnum_machine = {
|
||||
.desc = "MIPS Magnum",
|
||||
.init = mips_magnum_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static QEMUMachine mips_pica61_machine = {
|
||||
@@ -335,7 +334,6 @@ static QEMUMachine mips_pica61_machine = {
|
||||
.desc = "Acer Pica 61",
|
||||
.init = mips_pica61_init,
|
||||
.block_default_type = IF_SCSI,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mips_jazz_machine_init(void)
|
||||
|
@@ -1136,7 +1136,6 @@ static QEMUMachine mips_malta_machine = {
|
||||
.init = mips_malta_init,
|
||||
.max_cpus = 16,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mips_malta_register_types(void)
|
||||
|
@@ -232,7 +232,6 @@ static QEMUMachine mips_mipssim_machine = {
|
||||
.name = "mipssim",
|
||||
.desc = "MIPS MIPSsim platform",
|
||||
.init = mips_mipssim_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mips_mipssim_machine_init(void)
|
||||
|
@@ -306,7 +306,6 @@ static QEMUMachine mips_machine = {
|
||||
.name = "mips",
|
||||
.desc = "mips r4k platform",
|
||||
.init = mips_r4k_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void mips_machine_init(void)
|
||||
|
@@ -693,7 +693,7 @@ static void ne2000_write(void *opaque, hwaddr addr,
|
||||
static const MemoryRegionOps ne2000_ops = {
|
||||
.read = ne2000_read,
|
||||
.write = ne2000_write,
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
/***********************************************************/
|
||||
|
@@ -134,7 +134,7 @@ static void pcnet_ioport_write(void *opaque, hwaddr addr,
|
||||
static const MemoryRegionOps pcnet_io_ops = {
|
||||
.read = pcnet_ioport_read,
|
||||
.write = pcnet_ioport_write,
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static void pcnet_mmio_writeb(void *opaque, hwaddr addr, uint32_t val)
|
||||
@@ -256,7 +256,7 @@ static const MemoryRegionOps pcnet_mmio_ops = {
|
||||
.read = { pcnet_mmio_readb, pcnet_mmio_readw, pcnet_mmio_readl },
|
||||
.write = { pcnet_mmio_writeb, pcnet_mmio_writew, pcnet_mmio_writel },
|
||||
},
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static void pci_physical_memory_write(void *dma_opaque, hwaddr addr,
|
||||
|
@@ -139,7 +139,6 @@ static QEMUMachine openrisc_sim_machine = {
|
||||
.init = openrisc_sim_init,
|
||||
.max_cpus = 1,
|
||||
.is_default = 1,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void openrisc_sim_machine_init(void)
|
||||
|
24
hw/pci/pci.c
24
hw/pci/pci.c
@@ -812,12 +812,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
||||
}
|
||||
|
||||
pci_dev->bus = bus;
|
||||
if (bus->iommu_fn) {
|
||||
dma_as = bus->iommu_fn(bus, bus->iommu_opaque, devfn);
|
||||
} else {
|
||||
/* FIXME: inherit memory region from bus creator */
|
||||
dma_as = &address_space_memory;
|
||||
}
|
||||
dma_as = pci_device_iommu_address_space(pci_dev);
|
||||
|
||||
memory_region_init_alias(&pci_dev->bus_master_enable_region,
|
||||
OBJECT(pci_dev), "bus master",
|
||||
@@ -2239,6 +2234,23 @@ static void pci_device_class_init(ObjectClass *klass, void *data)
|
||||
k->props = pci_props;
|
||||
}
|
||||
|
||||
AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
|
||||
{
|
||||
PCIBus *bus = PCI_BUS(dev->bus);
|
||||
|
||||
if (bus->iommu_fn) {
|
||||
return bus->iommu_fn(bus, bus->iommu_opaque, dev->devfn);
|
||||
}
|
||||
|
||||
if (bus->parent_dev) {
|
||||
/** We are ignoring the bus master DMA bit of the bridge
|
||||
* as it would complicate things such as VFIO for no good reason */
|
||||
return pci_device_iommu_address_space(bus->parent_dev);
|
||||
}
|
||||
|
||||
return &address_space_memory;
|
||||
}
|
||||
|
||||
void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque)
|
||||
{
|
||||
bus->iommu_fn = fn;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pci_host.h"
|
||||
#include "trace.h"
|
||||
|
||||
/* debug PCI */
|
||||
//#define DEBUG_PCI
|
||||
@@ -51,14 +52,22 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
|
||||
uint32_t limit, uint32_t val, uint32_t len)
|
||||
{
|
||||
assert(len <= 4);
|
||||
trace_pci_cfg_write(pci_dev->name, PCI_SLOT(pci_dev->devfn),
|
||||
PCI_FUNC(pci_dev->devfn), addr, val);
|
||||
pci_dev->config_write(pci_dev, addr, val, MIN(len, limit - addr));
|
||||
}
|
||||
|
||||
uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
|
||||
uint32_t limit, uint32_t len)
|
||||
{
|
||||
uint32_t ret;
|
||||
|
||||
assert(len <= 4);
|
||||
return pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
|
||||
ret = pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
|
||||
trace_pci_cfg_read(pci_dev->name, PCI_SLOT(pci_dev->devfn),
|
||||
PCI_FUNC(pci_dev->devfn), addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
|
||||
|
@@ -124,13 +124,14 @@ static void dt_serial_create(void *fdt, unsigned long long offset,
|
||||
}
|
||||
|
||||
static int ppce500_load_device_tree(CPUPPCState *env,
|
||||
QEMUMachineInitArgs *args,
|
||||
PPCE500Params *params,
|
||||
hwaddr addr,
|
||||
hwaddr initrd_base,
|
||||
hwaddr initrd_size)
|
||||
{
|
||||
int ret = -1;
|
||||
uint64_t mem_reg_property[] = { 0, cpu_to_be64(params->ram_size) };
|
||||
uint64_t mem_reg_property[] = { 0, cpu_to_be64(args->ram_size) };
|
||||
int fdt_size;
|
||||
void *fdt;
|
||||
uint8_t hypercall[16];
|
||||
@@ -205,7 +206,7 @@ static int ppce500_load_device_tree(CPUPPCState *env,
|
||||
}
|
||||
|
||||
ret = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs",
|
||||
params->kernel_cmdline);
|
||||
args->kernel_cmdline);
|
||||
if (ret < 0)
|
||||
fprintf(stderr, "couldn't set /chosen/bootargs\n");
|
||||
|
||||
@@ -559,7 +560,7 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,
|
||||
return mpic;
|
||||
}
|
||||
|
||||
void ppce500_init(PPCE500Params *params)
|
||||
void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
|
||||
{
|
||||
MemoryRegion *address_space_mem = get_system_memory();
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
@@ -584,8 +585,8 @@ void ppce500_init(PPCE500Params *params)
|
||||
PPCE500CCSRState *ccsr;
|
||||
|
||||
/* Setup CPUs */
|
||||
if (params->cpu_model == NULL) {
|
||||
params->cpu_model = "e500v2_v30";
|
||||
if (args->cpu_model == NULL) {
|
||||
args->cpu_model = "e500v2_v30";
|
||||
}
|
||||
|
||||
irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
|
||||
@@ -595,7 +596,7 @@ void ppce500_init(PPCE500Params *params)
|
||||
CPUState *cs;
|
||||
qemu_irq *input;
|
||||
|
||||
cpu = cpu_ppc_init(params->cpu_model);
|
||||
cpu = cpu_ppc_init(args->cpu_model);
|
||||
if (cpu == NULL) {
|
||||
fprintf(stderr, "Unable to initialize CPU!\n");
|
||||
exit(1);
|
||||
@@ -634,7 +635,7 @@ void ppce500_init(PPCE500Params *params)
|
||||
|
||||
/* Fixup Memory size on a alignment boundary */
|
||||
ram_size &= ~(RAM_SIZES_ALIGN - 1);
|
||||
params->ram_size = ram_size;
|
||||
args->ram_size = ram_size;
|
||||
|
||||
/* Register Memory */
|
||||
memory_region_init_ram(ram, NULL, "mpc8544ds.ram", ram_size);
|
||||
@@ -701,11 +702,11 @@ void ppce500_init(PPCE500Params *params)
|
||||
sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL);
|
||||
|
||||
/* Load kernel. */
|
||||
if (params->kernel_filename) {
|
||||
kernel_size = load_uimage(params->kernel_filename, &entry,
|
||||
if (args->kernel_filename) {
|
||||
kernel_size = load_uimage(args->kernel_filename, &entry,
|
||||
&loadaddr, NULL);
|
||||
if (kernel_size < 0) {
|
||||
kernel_size = load_elf(params->kernel_filename, NULL, NULL,
|
||||
kernel_size = load_elf(args->kernel_filename, NULL, NULL,
|
||||
&elf_entry, &elf_lowaddr, NULL, 1,
|
||||
ELF_MACHINE, 0);
|
||||
entry = elf_entry;
|
||||
@@ -714,7 +715,7 @@ void ppce500_init(PPCE500Params *params)
|
||||
/* XXX try again as binary */
|
||||
if (kernel_size < 0) {
|
||||
fprintf(stderr, "qemu: could not load kernel '%s'\n",
|
||||
params->kernel_filename);
|
||||
args->kernel_filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -726,14 +727,14 @@ void ppce500_init(PPCE500Params *params)
|
||||
}
|
||||
|
||||
/* Load initrd. */
|
||||
if (params->initrd_filename) {
|
||||
if (args->initrd_filename) {
|
||||
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
|
||||
initrd_size = load_image_targphys(params->initrd_filename, initrd_base,
|
||||
initrd_size = load_image_targphys(args->initrd_filename, initrd_base,
|
||||
ram_size - initrd_base);
|
||||
|
||||
if (initrd_size < 0) {
|
||||
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
|
||||
params->initrd_filename);
|
||||
args->initrd_filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -741,12 +742,12 @@ void ppce500_init(PPCE500Params *params)
|
||||
}
|
||||
|
||||
/* If we're loading a kernel directly, we must load the device tree too. */
|
||||
if (params->kernel_filename) {
|
||||
if (args->kernel_filename) {
|
||||
struct boot_info *boot_info;
|
||||
int dt_size;
|
||||
|
||||
dt_size = ppce500_load_device_tree(env, params, dt_base, initrd_base,
|
||||
initrd_size);
|
||||
dt_size = ppce500_load_device_tree(env, args, params, dt_base,
|
||||
initrd_base, initrd_size);
|
||||
if (dt_size < 0) {
|
||||
fprintf(stderr, "couldn't load device tree\n");
|
||||
exit(1);
|
||||
|
@@ -1,25 +1,18 @@
|
||||
#ifndef PPCE500_H
|
||||
#define PPCE500_H
|
||||
|
||||
#include "hw/boards.h"
|
||||
|
||||
typedef struct PPCE500Params {
|
||||
/* Standard QEMU machine init params */
|
||||
ram_addr_t ram_size;
|
||||
const char *boot_device;
|
||||
const char *kernel_filename;
|
||||
const char *kernel_cmdline;
|
||||
const char *initrd_filename;
|
||||
const char *cpu_model;
|
||||
int pci_first_slot;
|
||||
int pci_nr_slots;
|
||||
|
||||
/* e500-specific params */
|
||||
|
||||
/* required -- must at least add toplevel board compatible */
|
||||
void (*fixup_devtree)(struct PPCE500Params *params, void *fdt);
|
||||
|
||||
int mpic_version;
|
||||
} PPCE500Params;
|
||||
|
||||
void ppce500_init(PPCE500Params *params);
|
||||
void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params);
|
||||
|
||||
#endif
|
||||
|
@@ -30,19 +30,7 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
|
||||
|
||||
static void e500plat_init(QEMUMachineInitArgs *args)
|
||||
{
|
||||
ram_addr_t ram_size = args->ram_size;
|
||||
const char *boot_device = args->boot_device;
|
||||
const char *cpu_model = args->cpu_model;
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
PPCE500Params params = {
|
||||
.ram_size = ram_size,
|
||||
.boot_device = boot_device,
|
||||
.kernel_filename = kernel_filename,
|
||||
.kernel_cmdline = kernel_cmdline,
|
||||
.initrd_filename = initrd_filename,
|
||||
.cpu_model = cpu_model,
|
||||
.pci_first_slot = 0x1,
|
||||
.pci_nr_slots = PCI_SLOT_MAX - 1,
|
||||
.fixup_devtree = e500plat_fixup_devtree,
|
||||
@@ -55,7 +43,7 @@ static void e500plat_init(QEMUMachineInitArgs *args)
|
||||
params.mpic_version = OPENPIC_MODEL_FSL_MPIC_20;
|
||||
}
|
||||
|
||||
ppce500_init(¶ms);
|
||||
ppce500_init(args, ¶ms);
|
||||
}
|
||||
|
||||
static QEMUMachine e500plat_machine = {
|
||||
@@ -63,7 +51,6 @@ static QEMUMachine e500plat_machine = {
|
||||
.desc = "generic paravirt e500 platform",
|
||||
.init = e500plat_init,
|
||||
.max_cpus = 32,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void e500plat_machine_init(void)
|
||||
|
@@ -147,7 +147,7 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
const char *boot_device = args->boot_order;
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
char *filename;
|
||||
@@ -477,7 +477,7 @@ static QEMUMachine core99_machine = {
|
||||
.desc = "Mac99 based PowerMAC",
|
||||
.init = ppc_core99_init,
|
||||
.max_cpus = MAX_CPUS,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
.default_boot_order = "cd",
|
||||
};
|
||||
|
||||
static void core99_machine_init(void)
|
||||
|
@@ -78,7 +78,7 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
const char *boot_device = args->boot_order;
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
@@ -350,7 +350,7 @@ static QEMUMachine heathrow_machine = {
|
||||
#ifndef TARGET_PPC64
|
||||
.is_default = 1,
|
||||
#endif
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
.default_boot_order = "cd", /* TOFIX "cad" when Mac floppy is implemented */
|
||||
};
|
||||
|
||||
static void heathrow_machine_init(void)
|
||||
|
@@ -28,26 +28,14 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)
|
||||
|
||||
static void mpc8544ds_init(QEMUMachineInitArgs *args)
|
||||
{
|
||||
ram_addr_t ram_size = args->ram_size;
|
||||
const char *boot_device = args->boot_device;
|
||||
const char *cpu_model = args->cpu_model;
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
PPCE500Params params = {
|
||||
.ram_size = ram_size,
|
||||
.boot_device = boot_device,
|
||||
.kernel_filename = kernel_filename,
|
||||
.kernel_cmdline = kernel_cmdline,
|
||||
.initrd_filename = initrd_filename,
|
||||
.cpu_model = cpu_model,
|
||||
.pci_first_slot = 0x11,
|
||||
.pci_nr_slots = 2,
|
||||
.fixup_devtree = mpc8544ds_fixup_devtree,
|
||||
.mpic_version = OPENPIC_MODEL_FSL_MPIC_20,
|
||||
};
|
||||
|
||||
ppce500_init(¶ms);
|
||||
ppce500_init(args, ¶ms);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +44,6 @@ static QEMUMachine ppce500_machine = {
|
||||
.desc = "mpc8544ds",
|
||||
.init = mpc8544ds_init,
|
||||
.max_cpus = 15,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void ppce500_machine_init(void)
|
||||
|
@@ -362,7 +362,6 @@ static QEMUMachine ref405ep_machine = {
|
||||
.name = "ref405ep",
|
||||
.desc = "ref405ep",
|
||||
.init = ref405ep_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -650,7 +649,6 @@ static QEMUMachine taihu_machine = {
|
||||
.name = "taihu",
|
||||
.desc = "taihu",
|
||||
.init = taihu_405ep_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void ppc405_machine_init(void)
|
||||
|
@@ -296,7 +296,6 @@ static QEMUMachine bamboo_machine = {
|
||||
.name = "bamboo",
|
||||
.desc = "bamboo",
|
||||
.init = bamboo_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void bamboo_machine_init(void)
|
||||
|
@@ -452,7 +452,7 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
const char *boot_device = args->boot_order;
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
@@ -691,7 +691,7 @@ static QEMUMachine prep_machine = {
|
||||
.desc = "PowerPC PREP platform",
|
||||
.init = ppc_prep_init,
|
||||
.max_cpus = MAX_CPUS,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
.default_boot_order = "cad",
|
||||
};
|
||||
|
||||
static void prep_machine_init(void)
|
||||
|
@@ -1071,7 +1071,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
|
||||
const char *kernel_filename = args->kernel_filename;
|
||||
const char *kernel_cmdline = args->kernel_cmdline;
|
||||
const char *initrd_filename = args->initrd_filename;
|
||||
const char *boot_device = args->boot_device;
|
||||
const char *boot_device = args->boot_order;
|
||||
PowerPCCPU *cpu;
|
||||
CPUPPCState *env;
|
||||
PCIHostState *phb;
|
||||
@@ -1325,7 +1325,7 @@ static QEMUMachine spapr_machine = {
|
||||
.block_default_type = IF_SCSI,
|
||||
.max_cpus = MAX_CPUS,
|
||||
.no_parallel = 1,
|
||||
.boot_order = NULL,
|
||||
.default_boot_order = NULL,
|
||||
};
|
||||
|
||||
static void spapr_machine_init(void)
|
||||
|
@@ -245,7 +245,6 @@ static QEMUMachine virtex_machine = {
|
||||
.name = "virtex-ml507",
|
||||
.desc = "Xilinx Virtex ML507 reference design",
|
||||
.init = virtex_init,
|
||||
DEFAULT_MACHINE_OPTIONS,
|
||||
};
|
||||
|
||||
static void virtex_machine_init(void)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user