mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-03 17:43:32 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8ed81651e | ||
|
|
0103b23cb7 | ||
|
|
85af4e9370 | ||
|
|
3e7e7cf05a | ||
|
|
8b3b97dae5 | ||
|
|
477d1f3c59 | ||
|
|
f07f64c3d8 | ||
|
|
a69152d257 | ||
|
|
6f6bdf3763 | ||
|
|
2481744d96 | ||
|
|
ed18bbbc11 | ||
|
|
82d83d29bd | ||
|
|
d9dfd5f425 | ||
|
|
0c5199e52b | ||
|
|
a40b3f664c | ||
|
|
f9b1537744 | ||
|
|
8b851e5bb1 | ||
|
|
ca8b13eb04 | ||
|
|
43e60c88f1 | ||
|
|
61f14858c1 | ||
|
|
11589707ec | ||
|
|
86b5130fef | ||
|
|
52cb65f9a6 | ||
|
|
e944f36993 | ||
|
|
f8943633a9 | ||
|
|
68e031345a | ||
|
|
0deef85292 | ||
|
|
438b752c76 | ||
|
|
32c1fc948e | ||
|
|
17ec370a79 | ||
|
|
7426a375bc | ||
|
|
f577bc677f | ||
|
|
cdafefe5ae | ||
|
|
b0560afef6 | ||
|
|
7e64af6463 | ||
|
|
dc9f0565a2 | ||
|
|
2989865251 | ||
|
|
a730f98a7a | ||
|
|
d84fbf241d | ||
|
|
421123a691 | ||
|
|
f402cbe224 | ||
|
|
22687ae317 | ||
|
|
5fc003f542 | ||
|
|
aeaff51f58 | ||
|
|
aa9c49d19e | ||
|
|
188b8070ce | ||
|
|
0e311e683f | ||
|
|
713e807357 | ||
|
|
cb327d638f | ||
|
|
8532740333 | ||
|
|
2729113a79 | ||
|
|
6500ee3d5a | ||
|
|
641cb36c07 | ||
|
|
8d2f7ef7c0 | ||
|
|
24690bf836 | ||
|
|
2cfc92842a | ||
|
|
2d3df8abca | ||
|
|
63a76e0123 | ||
|
|
b5ce6809b4 | ||
|
|
1af5215667 | ||
|
|
ba31a6fca7 | ||
|
|
fd0abbb386 | ||
|
|
e5628119e1 | ||
|
|
cfc706b38e | ||
|
|
be88ad424c | ||
|
|
51514aa3c2 | ||
|
|
2ac11c1d93 | ||
|
|
080b623ed4 | ||
|
|
8c65f73b31 | ||
|
|
a440980876 | ||
|
|
ab67c542a9 | ||
|
|
ad2c2ef5e5 | ||
|
|
0b1ddf19d0 | ||
|
|
a66c02ea9d | ||
|
|
146214796c | ||
|
|
2f46d99451 | ||
|
|
d4c6c60993 | ||
|
|
8bf4744182 | ||
|
|
89f7d4fb13 | ||
|
|
a2fbfefbb7 | ||
|
|
0c2fd08dc8 | ||
|
|
ad5f6ffcd0 | ||
|
|
88ef8726ff | ||
|
|
cce96e6052 | ||
|
|
92e6f27829 | ||
|
|
49d3f1381d | ||
|
|
8aee37581e | ||
|
|
f48aaf926e | ||
|
|
d0be1b581c | ||
|
|
1e762859ce | ||
|
|
22a55fc7df | ||
|
|
c1fac5fbfe | ||
|
|
ce78d40265 | ||
|
|
06cfe78536 | ||
|
|
20b93df8d7 | ||
|
|
5380228f7f | ||
|
|
ba3581de79 | ||
|
|
9707eaa47b | ||
|
|
ff338c6f78 | ||
|
|
769d19221e | ||
|
|
6f54455c10 | ||
|
|
4131a1d83c | ||
|
|
6bcd958030 | ||
|
|
5ead00ce11 | ||
|
|
bcc7fc8f81 | ||
|
|
35abae4511 | ||
|
|
d9dd5dad31 | ||
|
|
1a1ebc90cd | ||
|
|
0b92a8a130 | ||
|
|
7d662d328d | ||
|
|
b8456254d0 | ||
|
|
21af0baf9a | ||
|
|
e12259821c | ||
|
|
058e1774d6 | ||
|
|
11e286fb93 | ||
|
|
6594e50e7e | ||
|
|
51bc24d427 | ||
|
|
359076c8a0 | ||
|
|
920634e411 | ||
|
|
639ffcbd64 | ||
|
|
4cc64bd6c4 | ||
|
|
860f8f3f53 | ||
|
|
5ac0811f40 | ||
|
|
a8adf882fd | ||
|
|
86ce6e0773 | ||
|
|
e71e02caa7 | ||
|
|
f34c0eb054 | ||
|
|
a53ba65fff | ||
|
|
b276b2ca22 | ||
|
|
682e043b17 | ||
|
|
d6b9de8f9e | ||
|
|
a7383751c2 | ||
|
|
2af81f1251 | ||
|
|
59c9137156 | ||
|
|
b33a563281 |
No files matched your search
@@ -21,6 +21,5 @@
|
||||
- docker logout
|
||||
rules:
|
||||
# because we want to enable this for scheduled runs we also have to replicate the normal rules
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
- if: '$QEMU_CI && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
|
||||
- !reference [.base_job_template, rules]
|
||||
@@ -751,7 +751,6 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
|
||||
|
||||
void tcg_kick_vcpu_thread(CPUState *cpu)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/*
|
||||
* Ensure cpu_exec will see the reason why the exit request was set.
|
||||
* FIXME: this is not always needed. Other accelerators instead
|
||||
@@ -759,7 +758,6 @@ void tcg_kick_vcpu_thread(CPUState *cpu)
|
||||
* CPU thread; see kvm_arch_pre_run() for example.
|
||||
*/
|
||||
qatomic_store_release(&cpu->exit_request, true);
|
||||
#endif
|
||||
|
||||
/* Ensure cpu_exec will see the exit request after TCG has exited. */
|
||||
qatomic_store_release(&cpu->neg.icount_decr.u16.high, -1);
|
||||
|
||||
@@ -53,6 +53,8 @@ typedef struct CryptoDevBackendBuiltinSession {
|
||||
|
||||
#define CRYPTODEV_BUITLIN_MAX_AUTH_KEY_LEN 512
|
||||
#define CRYPTODEV_BUITLIN_MAX_CIPHER_KEY_LEN 64
|
||||
/* demonstration purposes only, use a limited size to avoid QEMU OOM */
|
||||
#define CRYPTODEV_BUITLIN_MAX_REQUEST_SIZE (1024 * 1024)
|
||||
|
||||
struct CryptoDevBackendBuiltin {
|
||||
CryptoDevBackend parent_obj;
|
||||
@@ -98,12 +100,7 @@ static void cryptodev_builtin_init(
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_MAC;
|
||||
backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC;
|
||||
backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1;
|
||||
/*
|
||||
* Set the Maximum length of crypto request.
|
||||
* Why this value? Just avoid to overflow when
|
||||
* memory allocation for each crypto request.
|
||||
*/
|
||||
backend->conf.max_size = LONG_MAX - sizeof(CryptoDevBackendOpInfo);
|
||||
backend->conf.max_size = CRYPTODEV_BUITLIN_MAX_REQUEST_SIZE;
|
||||
backend->conf.max_cipher_key_len = CRYPTODEV_BUITLIN_MAX_CIPHER_KEY_LEN;
|
||||
backend->conf.max_auth_key_len = CRYPTODEV_BUITLIN_MAX_AUTH_KEY_LEN;
|
||||
cryptodev_builtin_init_akcipher(backend);
|
||||
|
||||
+2
-9
@@ -324,17 +324,11 @@ curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, CURLAIOCB *acb)
|
||||
static void curl_multi_check_completion(BDRVCURLState *s)
|
||||
{
|
||||
int msgs_in_queue;
|
||||
CURLMsg *msg;
|
||||
|
||||
/* Try to find done transfers, so we can free the easy
|
||||
* handle again. */
|
||||
for (;;) {
|
||||
CURLMsg *msg;
|
||||
msg = curl_multi_info_read(s->multi, &msgs_in_queue);
|
||||
|
||||
/* Quit when there are no more completions */
|
||||
if (!msg)
|
||||
break;
|
||||
|
||||
while ((msg = curl_multi_info_read(s->multi, &msgs_in_queue))) {
|
||||
if (msg->msg == CURLMSG_DONE) {
|
||||
int i;
|
||||
CURLState *state = NULL;
|
||||
@@ -397,7 +391,6 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
||||
}
|
||||
|
||||
curl_clean_state(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-1
@@ -301,6 +301,12 @@ static void read_from_fuse_export(void *opaque)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that aio_poll() in any request-processing function can lead to a
|
||||
* nested read_from_fuse_export() call, which will overwrite the contents of
|
||||
* exp->fuse_buf. Anything that takes a buffer needs to take care that the
|
||||
* content is copied before potentially polling via aio_poll().
|
||||
*/
|
||||
fuse_session_process_buf(exp->fuse_session, &exp->fuse_buf);
|
||||
|
||||
out:
|
||||
@@ -624,6 +630,7 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
size_t size, off_t offset, struct fuse_file_info *fi)
|
||||
{
|
||||
FuseExport *exp = fuse_req_userdata(req);
|
||||
QEMU_AUTO_VFREE void *copied = NULL;
|
||||
int64_t length;
|
||||
int ret;
|
||||
|
||||
@@ -638,6 +645,14 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Heed the note on read_from_fuse_export(): If we call aio_poll() (which
|
||||
* any blk_*() I/O function may do), read_from_fuse_export() may be nested,
|
||||
* overwriting the request buffer content. Therefore, we must copy it here.
|
||||
*/
|
||||
copied = blk_blockalign(exp->common.blk, size);
|
||||
memcpy(copied, buf, size);
|
||||
|
||||
/**
|
||||
* Clients will expect short writes at EOF, so we have to limit
|
||||
* offset+size to the image length.
|
||||
@@ -660,7 +675,7 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
}
|
||||
}
|
||||
|
||||
ret = blk_pwrite(exp->common.blk, offset, size, buf, 0);
|
||||
ret = blk_pwrite(exp->common.blk, offset, size, copied, 0);
|
||||
if (ret >= 0) {
|
||||
fuse_reply_write(req, size);
|
||||
} else {
|
||||
|
||||
+38
-23
@@ -99,6 +99,7 @@ typedef struct MirrorBlockJob {
|
||||
|
||||
typedef struct MirrorBDSOpaque {
|
||||
MirrorBlockJob *job;
|
||||
BdrvDirtyBitmap *dirty_bitmap;
|
||||
bool stop;
|
||||
bool is_commit;
|
||||
} MirrorBDSOpaque;
|
||||
@@ -1514,9 +1515,12 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
|
||||
assert(!qiov);
|
||||
ret = blk_co_pwrite_zeroes(job->target, offset, bytes, flags);
|
||||
if (job->zero_bitmap && ret >= 0) {
|
||||
bitmap_set(job->zero_bitmap, dirty_bitmap_offset / job->granularity,
|
||||
(dirty_bitmap_end - dirty_bitmap_offset) /
|
||||
job->granularity);
|
||||
if (dirty_bitmap_offset < dirty_bitmap_end) {
|
||||
bitmap_set(job->zero_bitmap,
|
||||
dirty_bitmap_offset / job->granularity,
|
||||
(dirty_bitmap_end - dirty_bitmap_offset) /
|
||||
job->granularity);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1672,9 +1676,11 @@ bdrv_mirror_top_do_write(BlockDriverState *bs, MirrorMethod method,
|
||||
abort();
|
||||
}
|
||||
|
||||
if (!copy_to_target && s->job && s->job->dirty_bitmap) {
|
||||
qatomic_set(&s->job->actively_synced, false);
|
||||
bdrv_set_dirty_bitmap(s->job->dirty_bitmap, offset, bytes);
|
||||
if (!copy_to_target) {
|
||||
if (s->job) {
|
||||
qatomic_set(&s->job->actively_synced, false);
|
||||
}
|
||||
bdrv_set_dirty_bitmap(s->dirty_bitmap, offset, bytes);
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -1901,13 +1907,35 @@ static BlockJob *mirror_start_job(
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
ret = bdrv_append(mirror_top_bs, bs, errp);
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
if (ret < 0) {
|
||||
bdrv_drained_end(bs);
|
||||
bdrv_unref(mirror_top_bs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bs_opaque->dirty_bitmap = bdrv_create_dirty_bitmap(mirror_top_bs,
|
||||
granularity,
|
||||
NULL, errp);
|
||||
if (!bs_opaque->dirty_bitmap) {
|
||||
bdrv_drained_end(bs);
|
||||
bdrv_unref(mirror_top_bs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The mirror job doesn't use the block layer's dirty tracking because it
|
||||
* needs to be able to switch seemlessly between background copy mode (which
|
||||
* does need dirty tracking) and write blocking mode (which doesn't) and
|
||||
* doing that would require draining the node. Instead, mirror_top_bs takes
|
||||
* care of updating the dirty bitmap as appropriate.
|
||||
*
|
||||
* Note that write blocking mode only becomes effective after mirror_run()
|
||||
* sets mirror_top_opaque->job (see should_copy_to_target()). Until then,
|
||||
* we're still in background copy mode irrespective of @copy_mode.
|
||||
*/
|
||||
bdrv_disable_dirty_bitmap(bs_opaque->dirty_bitmap);
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
/* Make sure that the source is not resized while the job is running */
|
||||
s = block_job_create(job_id, driver, NULL, mirror_top_bs,
|
||||
BLK_PERM_CONSISTENT_READ,
|
||||
@@ -2002,24 +2030,13 @@ static BlockJob *mirror_start_job(
|
||||
s->base_overlay = bdrv_find_overlay(bs, base);
|
||||
s->granularity = granularity;
|
||||
s->buf_size = ROUND_UP(buf_size, granularity);
|
||||
s->dirty_bitmap = bs_opaque->dirty_bitmap;
|
||||
s->unmap = unmap;
|
||||
if (auto_complete) {
|
||||
s->should_complete = true;
|
||||
}
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
s->dirty_bitmap = bdrv_create_dirty_bitmap(s->mirror_top_bs, granularity,
|
||||
NULL, errp);
|
||||
if (!s->dirty_bitmap) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* The dirty bitmap is set by bdrv_mirror_top_do_write() when not in active
|
||||
* mode.
|
||||
*/
|
||||
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
|
||||
|
||||
bdrv_graph_wrlock_drained();
|
||||
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
|
||||
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
|
||||
@@ -2099,9 +2116,6 @@ fail:
|
||||
g_free(s->replaces);
|
||||
blk_unref(s->target);
|
||||
bs_opaque->job = NULL;
|
||||
if (s->dirty_bitmap) {
|
||||
bdrv_release_dirty_bitmap(s->dirty_bitmap);
|
||||
}
|
||||
job_early_fail(&s->common.job);
|
||||
}
|
||||
|
||||
@@ -2115,6 +2129,7 @@ fail:
|
||||
bdrv_graph_wrunlock();
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
bdrv_release_dirty_bitmap(bs_opaque->dirty_bitmap);
|
||||
bdrv_unref(mirror_top_bs);
|
||||
|
||||
return NULL;
|
||||
|
||||
+10
-9
@@ -249,14 +249,15 @@ nfs_co_generic_cb(int ret, struct nfs_context *nfs, void *data,
|
||||
}
|
||||
|
||||
/*
|
||||
* Safe to call: nfs_service(), which called us, is only run from the FD
|
||||
* handlers, never from the request coroutine. The request coroutine in
|
||||
* turn will yield unconditionally.
|
||||
* No need to release the lock, even if we directly enter the coroutine, as
|
||||
* the lock is never re-taken after yielding. (Note: If we do enter the
|
||||
* coroutine, @task will probably be dangling once aio_co_wake() returns.)
|
||||
* Using aio_co_wake() here could re-enter the coroutine directly, while we
|
||||
* still hold the mutex. The current request will not attempt to re-take
|
||||
* the mutex, so that is fine; but if the same coroutine then goes on to
|
||||
* submit another request, that new request will try to re-take the mutex,
|
||||
* resulting in a deadlock.
|
||||
* To prevent that, only schedule the coroutine so it will be entered later,
|
||||
* with the mutex released.
|
||||
*/
|
||||
aio_co_wake(task->co);
|
||||
aio_co_schedule(qemu_coroutine_get_aio_context(task->co), task->co);
|
||||
}
|
||||
|
||||
static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, int64_t offset,
|
||||
@@ -716,8 +717,8 @@ nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
|
||||
if (task->ret < 0) {
|
||||
error_report("NFS Error: %s", nfs_get_error(nfs));
|
||||
}
|
||||
/* Safe to call, see nfs_co_generic_cb() */
|
||||
aio_co_wake(task->co);
|
||||
/* Must not use aio_co_wake(), see nfs_co_generic_cb() */
|
||||
aio_co_schedule(qemu_coroutine_get_aio_context(task->co), task->co);
|
||||
}
|
||||
|
||||
static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
|
||||
|
||||
+6
-15
@@ -295,19 +295,15 @@ static bool throttle_group_schedule_timer(ThrottleGroupMember *tgm,
|
||||
/* Start the next pending I/O request for a ThrottleGroupMember. Return whether
|
||||
* any request was actually pending.
|
||||
*
|
||||
* This assumes that tg->lock is held.
|
||||
*
|
||||
* @tgm: the current ThrottleGroupMember
|
||||
* @direction: the ThrottleDirection
|
||||
*/
|
||||
static bool coroutine_fn throttle_group_co_restart_queue(ThrottleGroupMember *tgm,
|
||||
ThrottleDirection direction)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
qemu_co_mutex_lock(&tgm->throttled_reqs_lock);
|
||||
ret = qemu_co_queue_next(&tgm->throttled_reqs[direction]);
|
||||
qemu_co_mutex_unlock(&tgm->throttled_reqs_lock);
|
||||
|
||||
return ret;
|
||||
return qemu_co_queue_next(&tgm->throttled_reqs[direction]);
|
||||
}
|
||||
|
||||
/* Look for the next pending I/O request and schedule it.
|
||||
@@ -378,12 +374,8 @@ void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm
|
||||
/* Wait if there's a timer set or queued requests of this type */
|
||||
if (must_wait || tgm->pending_reqs[direction]) {
|
||||
tgm->pending_reqs[direction]++;
|
||||
qemu_mutex_unlock(&tg->lock);
|
||||
qemu_co_mutex_lock(&tgm->throttled_reqs_lock);
|
||||
qemu_co_queue_wait(&tgm->throttled_reqs[direction],
|
||||
&tgm->throttled_reqs_lock);
|
||||
qemu_co_mutex_unlock(&tgm->throttled_reqs_lock);
|
||||
qemu_mutex_lock(&tg->lock);
|
||||
&tg->lock);
|
||||
tgm->pending_reqs[direction]--;
|
||||
}
|
||||
|
||||
@@ -410,15 +402,15 @@ static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)
|
||||
ThrottleDirection direction = data->direction;
|
||||
bool empty_queue;
|
||||
|
||||
qemu_mutex_lock(&tg->lock);
|
||||
empty_queue = !throttle_group_co_restart_queue(tgm, direction);
|
||||
|
||||
/* If the request queue was empty then we have to take care of
|
||||
* scheduling the next one */
|
||||
if (empty_queue) {
|
||||
qemu_mutex_lock(&tg->lock);
|
||||
schedule_next_request(tgm, direction);
|
||||
qemu_mutex_unlock(&tg->lock);
|
||||
}
|
||||
qemu_mutex_unlock(&tg->lock);
|
||||
|
||||
g_free(data);
|
||||
|
||||
@@ -569,7 +561,6 @@ void throttle_group_register_tgm(ThrottleGroupMember *tgm,
|
||||
read_timer_cb,
|
||||
write_timer_cb,
|
||||
tgm);
|
||||
qemu_co_mutex_init(&tgm->throttled_reqs_lock);
|
||||
}
|
||||
|
||||
/* Unregister a ThrottleGroupMember from its group, removing it from the list,
|
||||
|
||||
+4
-4
@@ -1951,10 +1951,10 @@ vmdk_read_extent(VmdkExtent *extent, int64_t cluster_offset,
|
||||
marker = (VmdkGrainMarker *)cluster_buf;
|
||||
compressed_data = marker->data;
|
||||
data_len = le32_to_cpu(marker->size);
|
||||
}
|
||||
if (!data_len || data_len > buf_bytes) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
if (!data_len || data_len > buf_bytes - sizeof(VmdkGrainMarker)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
ret = uncompress(uncomp_buf, &buf_len, compressed_data, data_len);
|
||||
if (ret != Z_OK) {
|
||||
|
||||
+5
-3
@@ -258,12 +258,14 @@ abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
|
||||
static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size,
|
||||
abi_ulong alignment)
|
||||
{
|
||||
abi_ulong ret;
|
||||
abi_ulong ret = -1;
|
||||
|
||||
ret = page_find_range_empty(start, reserved_va, size, alignment);
|
||||
if (start <= reserved_va) {
|
||||
ret = page_find_range_empty(start, reserved_va, size, alignment);
|
||||
}
|
||||
if (ret == -1 && start > TARGET_PAGE_SIZE) {
|
||||
/* Restart at the beginning of the address space. */
|
||||
ret = page_find_range_empty(TARGET_PAGE_SIZE, start - 1,
|
||||
ret = page_find_range_empty(TARGET_PAGE_SIZE, MIN(start - 1, reserved_va),
|
||||
size, alignment);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ struct target_freebsd11_stat {
|
||||
unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec));
|
||||
} __packed;
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(TARGET_I386) && !defined(TARGET_X86_64)
|
||||
#define TARGET_HAS_STAT_TIME_T_EXT 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -182,3 +182,11 @@ int io_channel_send(QIOChannel *ioc, const void *buf, size_t len)
|
||||
{
|
||||
return io_channel_send_full(ioc, buf, len, NULL, 0);
|
||||
}
|
||||
|
||||
void remove_listener_fd_in_watch(Chardev *chr)
|
||||
{
|
||||
ChardevClass *cc = CHARDEV_GET_CLASS(chr);
|
||||
if (cc->chr_listener_cleanup) {
|
||||
cc->chr_listener_cleanup(chr);
|
||||
}
|
||||
}
|
||||
@@ -1570,6 +1570,15 @@ char_socket_get_connected(Object *obj, Error **errp)
|
||||
return s->state == TCP_CHARDEV_STATE_CONNECTED;
|
||||
}
|
||||
|
||||
static void tcp_chr_listener_cleanup(Chardev *chr)
|
||||
{
|
||||
SocketChardev *s = SOCKET_CHARDEV(chr);
|
||||
if (s->listener) {
|
||||
qio_net_listener_set_client_func_full(s->listener, NULL, NULL,
|
||||
NULL, chr->gcontext);
|
||||
}
|
||||
}
|
||||
|
||||
static void char_socket_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
ChardevClass *cc = CHARDEV_CLASS(oc);
|
||||
@@ -1587,6 +1596,7 @@ static void char_socket_class_init(ObjectClass *oc, const void *data)
|
||||
cc->chr_add_client = tcp_chr_add_client;
|
||||
cc->chr_add_watch = tcp_chr_add_watch;
|
||||
cc->chr_update_read_handler = tcp_chr_update_read_handler;
|
||||
cc->chr_listener_cleanup = tcp_chr_listener_cleanup;
|
||||
|
||||
object_class_property_add(oc, "addr", "SocketAddress",
|
||||
char_socket_get_addr, NULL,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
[built-in options]
|
||||
bindir = ''
|
||||
prefix = '/qemu'
|
||||
|
||||
[project options]
|
||||
qemu_suffix = ''
|
||||
@@ -73,28 +73,28 @@ static void exec_count_free(gpointer key, gpointer value, gpointer user_data)
|
||||
static void plugin_exit(qemu_plugin_id_t id, void *p)
|
||||
{
|
||||
g_autoptr(GString) report = g_string_new("collected ");
|
||||
GList *counts, *it;
|
||||
GList *counts, *sorted_counts, *it;
|
||||
int i;
|
||||
|
||||
g_string_append_printf(report, "%d entries in the hash table\n",
|
||||
g_hash_table_size(hotblocks));
|
||||
counts = g_hash_table_get_values(hotblocks);
|
||||
it = g_list_sort_with_data(counts, cmp_exec_count, NULL);
|
||||
sorted_counts = g_list_sort_with_data(counts, cmp_exec_count, NULL);
|
||||
|
||||
if (it) {
|
||||
if (sorted_counts) {
|
||||
g_string_append_printf(report, "pc, tcount, icount, ecount\n");
|
||||
|
||||
for (i = 0; i < limit && it->next; i++, it = it->next) {
|
||||
for (i = 0, it = sorted_counts; i < limit && it; i++, it = it->next) {
|
||||
ExecCount *rec = (ExecCount *) it->data;
|
||||
g_string_append_printf(
|
||||
report, "0x%016"PRIx64", %d, %ld, %"PRId64"\n",
|
||||
report, "0x%016"PRIx64", %d, %ld, %"PRIu64"\n",
|
||||
rec->start_addr, rec->trans_count,
|
||||
rec->insns,
|
||||
qemu_plugin_u64_sum(
|
||||
qemu_plugin_scoreboard_u64(rec->exec_count)));
|
||||
}
|
||||
|
||||
g_list_free(it);
|
||||
g_list_free(sorted_counts);
|
||||
}
|
||||
|
||||
qemu_plugin_outs(report->str);
|
||||
|
||||
@@ -463,6 +463,16 @@ Example::
|
||||
0x000000004002b0, 1, 4, 66087
|
||||
...
|
||||
|
||||
Behaviour can be tweaked with the following arguments:
|
||||
|
||||
.. list-table:: Hot Blocks plugin arguments
|
||||
:widths: 20 80
|
||||
:header-rows: 1
|
||||
|
||||
* - Option
|
||||
- Description
|
||||
* - inline=true|false
|
||||
- Use faster inline addition of a single counter.
|
||||
|
||||
Hot Pages
|
||||
.........
|
||||
|
||||
@@ -318,6 +318,11 @@ SVE CPU Property Parsing Semantics
|
||||
provided an error will be generated. To avoid this error, one must
|
||||
enable at least one vector length prior to enabling SVE.
|
||||
|
||||
10) Enabling SVE (with ``sve=on`` or by default) enables all the SVE
|
||||
sub-features that the CPU supports (for example, it may also
|
||||
enable SVE2). There are not generally any lower-level controls
|
||||
for disabling specific SVE sub-features.
|
||||
|
||||
SVE CPU Property Examples
|
||||
-------------------------
|
||||
|
||||
@@ -430,6 +435,11 @@ and all vector lengths must be powers of 2. The maximum vector
|
||||
length supported by qemu is 2048 bits. Otherwise, there are no
|
||||
additional constraints on the set of vector lengths supported by SME.
|
||||
|
||||
As with SVE, ``sme=on`` enables all the SME sub-features the CPU
|
||||
supports (for example, it may also enable SME2), and there are
|
||||
no lower-level controls for fine-grained disabling of specific
|
||||
SME sub-features.
|
||||
|
||||
SME User-mode Default Vector Length Property
|
||||
--------------------------------------------
|
||||
|
||||
|
||||
@@ -560,6 +560,7 @@ static int coroutine_fn v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path)
|
||||
sizeof(V9fsFidState *), 1);
|
||||
gint i;
|
||||
|
||||
v9fs_path_read_lock(s);
|
||||
g_hash_table_iter_init(&iter, s->fids);
|
||||
|
||||
/*
|
||||
@@ -580,6 +581,7 @@ static int coroutine_fn v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path)
|
||||
g_array_append_val(to_reopen, fidp);
|
||||
}
|
||||
}
|
||||
v9fs_path_unlock(s);
|
||||
|
||||
for (i = 0; i < to_reopen->len; i++) {
|
||||
fidp = g_array_index(to_reopen, V9fsFidState*, i);
|
||||
@@ -3514,6 +3516,12 @@ static void coroutine_fn v9fs_renameat(void *opaque)
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
/* if fs driver is not path based, return EOPNOTSUPP */
|
||||
if (!(s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
v9fs_path_write_lock(s);
|
||||
err = v9fs_complete_renameat(pdu, olddirfid,
|
||||
&old_name, newdirfid, &new_name);
|
||||
@@ -3604,6 +3612,11 @@ static void coroutine_fn v9fs_wstat(void *opaque)
|
||||
}
|
||||
}
|
||||
if (v9stat.name.size != 0) {
|
||||
/* if fs driver is not path based, return EOPNOTSUPP */
|
||||
if (!(s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
v9fs_path_write_lock(s);
|
||||
err = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name);
|
||||
v9fs_path_unlock(s);
|
||||
|
||||
+2
-1
@@ -228,7 +228,8 @@ static void aspeed_adc_engine_write(void *opaque, hwaddr addr, uint64_t value,
|
||||
qemu_log_mask(LOG_UNIMP, "%s: engine[%u]: "
|
||||
"0x%" HWADDR_PRIx " 0x%" PRIx64 "\n",
|
||||
__func__, s->engine_id, addr, value);
|
||||
break;
|
||||
/* Do not update the regs[] array */
|
||||
return;
|
||||
}
|
||||
|
||||
s->regs[reg] = value;
|
||||
|
||||
@@ -193,6 +193,8 @@ static const int aspeed_soc_ast2700a1_irqmap[] = {
|
||||
[ASPEED_DEV_ETH1] = 196,
|
||||
[ASPEED_DEV_ETH2] = 196,
|
||||
[ASPEED_DEV_ETH3] = 196,
|
||||
[ASPEED_DEV_EHCI3] = 196,
|
||||
[ASPEED_DEV_EHCI4] = 196,
|
||||
[ASPEED_DEV_PECI] = 197,
|
||||
[ASPEED_DEV_SDHCI] = 197,
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/qdev-clock.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/arm/machines-qom.h"
|
||||
#include "hw/arm/max78000_soc.h"
|
||||
#include "hw/arm/boot.h"
|
||||
|
||||
@@ -47,4 +48,4 @@ static void max78000_machine_init(MachineClass *mc)
|
||||
mc->valid_cpu_types = valid_cpu_types;
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("max78000fthr", max78000_machine_init)
|
||||
DEFINE_MACHINE_ARM("max78000fthr", max78000_machine_init)
|
||||
+39
-29
@@ -156,7 +156,7 @@ static virtio_snd_pcm_set_params *virtio_snd_pcm_get_params(VirtIOSound *s,
|
||||
static void virtio_snd_handle_pcm_info(VirtIOSound *s,
|
||||
virtio_snd_ctrl_command *cmd)
|
||||
{
|
||||
uint32_t stream_id, start_id, count, size;
|
||||
uint32_t stream_id, start_id, count, size, tmp;
|
||||
virtio_snd_pcm_info val;
|
||||
virtio_snd_query_info req;
|
||||
VirtIOSoundPCMStream *stream = NULL;
|
||||
@@ -168,9 +168,6 @@ static void virtio_snd_handle_pcm_info(VirtIOSound *s,
|
||||
sizeof(virtio_snd_query_info));
|
||||
|
||||
if (msg_sz != sizeof(virtio_snd_query_info)) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: virtio-snd command size incorrect %zu vs \
|
||||
%zu\n", __func__, msg_sz, sizeof(virtio_snd_query_info));
|
||||
@@ -182,14 +179,34 @@ static void virtio_snd_handle_pcm_info(VirtIOSound *s,
|
||||
count = le32_to_cpu(req.count);
|
||||
size = le32_to_cpu(req.size);
|
||||
|
||||
if (iov_size(cmd->elem->in_sg, cmd->elem->in_num) <
|
||||
sizeof(virtio_snd_hdr) + size * count) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
/*
|
||||
* 5.14.6.2 Driver Requirements: Item Information Request
|
||||
* "The driver MUST NOT set start_id and count such that start_id + count
|
||||
* is greater than the total number of particular items that is indicated
|
||||
* in the device configuration space."
|
||||
*/
|
||||
if (start_id > s->snd_conf.streams
|
||||
|| !g_uint_checked_add(&tmp, start_id, count)
|
||||
|| start_id + count > s->snd_conf.streams) {
|
||||
error_report("pcm info: start_id + count is greater than the total "
|
||||
"number of streams, got: start_id = %u, count = %u",
|
||||
start_id, count);
|
||||
cmd->resp.code = cpu_to_le32(VIRTIO_SND_S_BAD_MSG);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* 5.14.6.2 Driver Requirements: Item Information Request
|
||||
* "The driver MUST provide a buffer of sizeof(struct virtio_snd_hdr) +
|
||||
* count * size bytes for the response."
|
||||
*/
|
||||
if (!g_uint_checked_mul(&tmp, size, count)
|
||||
|| !g_uint_checked_add(&tmp, tmp, sizeof(virtio_snd_hdr))
|
||||
|| iov_size(cmd->elem->in_sg, cmd->elem->in_num) <
|
||||
sizeof(virtio_snd_hdr) + size * count) {
|
||||
error_report("pcm info: buffer too small, got: %zu, needed: %zu",
|
||||
iov_size(cmd->elem->in_sg, cmd->elem->in_num),
|
||||
sizeof(virtio_snd_pcm_info));
|
||||
sizeof(virtio_snd_pcm_info) * count);
|
||||
cmd->resp.code = cpu_to_le32(VIRTIO_SND_S_BAD_MSG);
|
||||
return;
|
||||
}
|
||||
@@ -244,9 +261,6 @@ uint32_t virtio_snd_set_pcm_params(VirtIOSound *s,
|
||||
virtio_snd_pcm_set_params *st_params;
|
||||
|
||||
if (stream_id >= s->snd_conf.streams || s->pcm->pcm_params == NULL) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
virtio_error(VIRTIO_DEVICE(s), "Streams have not been initialized.\n");
|
||||
return cpu_to_le32(VIRTIO_SND_S_BAD_MSG);
|
||||
}
|
||||
@@ -297,9 +311,6 @@ static void virtio_snd_handle_pcm_set_params(VirtIOSound *s,
|
||||
sizeof(virtio_snd_pcm_set_params));
|
||||
|
||||
if (msg_sz != sizeof(virtio_snd_pcm_set_params)) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: virtio-snd command size incorrect %zu vs \
|
||||
%zu\n", __func__, msg_sz, sizeof(virtio_snd_pcm_set_params));
|
||||
@@ -609,9 +620,6 @@ static void virtio_snd_handle_pcm_release(VirtIOSound *s,
|
||||
sizeof(stream_id));
|
||||
|
||||
if (msg_sz != sizeof(stream_id)) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: virtio-snd command size incorrect %zu vs \
|
||||
%zu\n", __func__, msg_sz, sizeof(stream_id));
|
||||
@@ -623,9 +631,6 @@ static void virtio_snd_handle_pcm_release(VirtIOSound *s,
|
||||
trace_virtio_snd_handle_pcm_release(stream_id);
|
||||
stream = virtio_snd_pcm_get_stream(s, stream_id);
|
||||
if (stream == NULL) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
error_report("already released stream %"PRIu32, stream_id);
|
||||
virtio_error(VIRTIO_DEVICE(s),
|
||||
"already released stream %"PRIu32,
|
||||
@@ -668,9 +673,6 @@ process_cmd(VirtIOSound *s, virtio_snd_ctrl_command *cmd)
|
||||
sizeof(virtio_snd_hdr));
|
||||
|
||||
if (msg_sz != sizeof(virtio_snd_hdr)) {
|
||||
/*
|
||||
* TODO: do we need to set DEVICE_NEEDS_RESET?
|
||||
*/
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: virtio-snd command size incorrect %zu vs \
|
||||
%zu\n", __func__, msg_sz, sizeof(virtio_snd_hdr));
|
||||
@@ -1238,7 +1240,7 @@ static void virtio_snd_pcm_in_cb(void *data, int available)
|
||||
{
|
||||
VirtIOSoundPCMStream *stream = data;
|
||||
VirtIOSoundPCMBuffer *buffer;
|
||||
size_t size, max_size;
|
||||
size_t size, max_size, to_read;
|
||||
|
||||
WITH_QEMU_LOCK_GUARD(&stream->queue_mutex) {
|
||||
while (!QSIMPLEQ_EMPTY(&stream->queue)) {
|
||||
@@ -1253,15 +1255,23 @@ static void virtio_snd_pcm_in_cb(void *data, int available)
|
||||
}
|
||||
|
||||
max_size = iov_size(buffer->elem->in_sg, buffer->elem->in_num);
|
||||
if (max_size <= sizeof(virtio_snd_pcm_status)) {
|
||||
return_rx_buffer(stream, buffer);
|
||||
continue;
|
||||
}
|
||||
max_size -= sizeof(virtio_snd_pcm_status);
|
||||
|
||||
for (;;) {
|
||||
if (buffer->size >= max_size) {
|
||||
return_rx_buffer(stream, buffer);
|
||||
break;
|
||||
}
|
||||
to_read = stream->params.period_bytes - buffer->size;
|
||||
to_read = MIN(to_read, available);
|
||||
to_read = MIN(to_read, max_size - buffer->size);
|
||||
size = AUD_read(stream->voice.in,
|
||||
buffer->data + buffer->size,
|
||||
MIN(available, (stream->params.period_bytes -
|
||||
buffer->size)));
|
||||
buffer->data + buffer->size,
|
||||
to_read);
|
||||
if (!size) {
|
||||
available = 0;
|
||||
break;
|
||||
|
||||
+2
-2
@@ -420,7 +420,7 @@ const char *qdev_get_printable_name(DeviceState *vdev)
|
||||
* names.
|
||||
*/
|
||||
if (vdev->id) {
|
||||
return vdev->id;
|
||||
return g_strdup(vdev->id);
|
||||
}
|
||||
/*
|
||||
* Fall back to the canonical QOM device path (eg. ID for PCI
|
||||
@@ -437,7 +437,7 @@ const char *qdev_get_printable_name(DeviceState *vdev)
|
||||
* Final fallback: if all else fails, return a placeholder string.
|
||||
* This ensures the error message always contains a valid string.
|
||||
*/
|
||||
return "<unknown device>";
|
||||
return g_strdup("<unknown device>");
|
||||
}
|
||||
|
||||
void qdev_add_unplug_blocker(DeviceState *dev, Error *reason)
|
||||
|
||||
@@ -1875,7 +1875,7 @@ static uint64_t get_dc_size(CXLType3Dev *ct3d, MemoryRegion **dc_mr)
|
||||
static int validate_dpa_addr(CXLType3Dev *ct3d, uint64_t dpa_addr,
|
||||
size_t length)
|
||||
{
|
||||
uint64_t vmr_size, pmr_size, dc_size;
|
||||
uint64_t vmr_size, pmr_size, dc_size, dpa_end;
|
||||
|
||||
if ((dpa_addr % CXL_CACHE_LINE_SIZE) ||
|
||||
(length % CXL_CACHE_LINE_SIZE) ||
|
||||
@@ -1887,7 +1887,12 @@ static int validate_dpa_addr(CXLType3Dev *ct3d, uint64_t dpa_addr,
|
||||
pmr_size = get_pmr_size(ct3d, NULL);
|
||||
dc_size = get_dc_size(ct3d, NULL);
|
||||
|
||||
if (dpa_addr + length > vmr_size + pmr_size + dc_size) {
|
||||
/* sanitize 64 bit values coming from guest */
|
||||
if (uadd64_overflow(dpa_addr, length, &dpa_end)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (dpa_end > vmr_size + pmr_size + dc_size) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -2006,7 +2011,7 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
|
||||
* sub class command.
|
||||
*/
|
||||
if (media_op_in_disc_pl->dpa_range_count ||
|
||||
start_index > ARRAY_SIZE(media_op_matrix)) {
|
||||
start_index + num_ops > ARRAY_SIZE(media_op_matrix)) {
|
||||
return CXL_MBOX_INVALID_INPUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,13 @@ static bool virtio_add_resource(QemuUUID *uuid, VirtioSharedObject *value)
|
||||
if (resource_uuids == NULL) {
|
||||
resource_uuids = g_hash_table_new_full(qemu_uuid_hash,
|
||||
uuid_equal_func,
|
||||
NULL,
|
||||
g_free,
|
||||
g_free);
|
||||
}
|
||||
if (g_hash_table_lookup(resource_uuids, uuid) == NULL) {
|
||||
g_hash_table_insert(resource_uuids, uuid, value);
|
||||
g_hash_table_insert(resource_uuids,
|
||||
g_memdup2(uuid, sizeof(*uuid)),
|
||||
value);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
@@ -52,11 +52,17 @@ virgl_get_egl_display(G_GNUC_UNUSED void *cookie)
|
||||
|
||||
#if VIRGL_VERSION_MAJOR >= 1
|
||||
struct virtio_gpu_virgl_hostmem_region {
|
||||
Object parent_obj;
|
||||
MemoryRegion mr;
|
||||
struct VirtIOGPU *g;
|
||||
bool finish_unmapping;
|
||||
};
|
||||
|
||||
#define TYPE_VIRTIO_GPU_VIRGL_HOSTMEM_REGION "virtio-gpu-virgl-hostmem-region"
|
||||
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(virtio_gpu_virgl_hostmem_region,
|
||||
VIRTIO_GPU_VIRGL_HOSTMEM_REGION)
|
||||
|
||||
static struct virtio_gpu_virgl_hostmem_region *
|
||||
to_hostmem_region(MemoryRegion *mr)
|
||||
{
|
||||
@@ -70,14 +76,22 @@ static void virtio_gpu_virgl_resume_cmdq_bh(void *opaque)
|
||||
virtio_gpu_process_cmdq(g);
|
||||
}
|
||||
|
||||
static void virtio_gpu_virgl_hostmem_region_free(void *obj)
|
||||
/*
|
||||
* MR could outlive the resource if MR's reference is held outside of
|
||||
* virtio-gpu. In order to prevent unmapping resource while MR is alive,
|
||||
* and thus, making the data pointer invalid, we will block virtio-gpu
|
||||
* command processing until MR is fully unreferenced and freed.
|
||||
*/
|
||||
static void virtio_gpu_virgl_hostmem_region_finalize(Object *obj)
|
||||
{
|
||||
MemoryRegion *mr = MEMORY_REGION(obj);
|
||||
struct virtio_gpu_virgl_hostmem_region *vmr;
|
||||
struct virtio_gpu_virgl_hostmem_region *vmr = VIRTIO_GPU_VIRGL_HOSTMEM_REGION(obj);
|
||||
VirtIOGPUBase *b;
|
||||
VirtIOGPUGL *gl;
|
||||
|
||||
vmr = to_hostmem_region(mr);
|
||||
if (!vmr->g) {
|
||||
return;
|
||||
}
|
||||
|
||||
vmr->finish_unmapping = true;
|
||||
|
||||
b = VIRTIO_GPU_BASE(vmr->g);
|
||||
@@ -92,11 +106,26 @@ static void virtio_gpu_virgl_hostmem_region_free(void *obj)
|
||||
qemu_bh_schedule(gl->cmdq_resume_bh);
|
||||
}
|
||||
|
||||
static const TypeInfo virtio_gpu_virgl_hostmem_region_info = {
|
||||
.parent = TYPE_OBJECT,
|
||||
.name = TYPE_VIRTIO_GPU_VIRGL_HOSTMEM_REGION,
|
||||
.instance_size = sizeof(struct virtio_gpu_virgl_hostmem_region),
|
||||
.instance_finalize = virtio_gpu_virgl_hostmem_region_finalize
|
||||
};
|
||||
|
||||
static void virtio_gpu_virgl_types(void)
|
||||
{
|
||||
type_register_static(&virtio_gpu_virgl_hostmem_region_info);
|
||||
}
|
||||
|
||||
type_init(virtio_gpu_virgl_types)
|
||||
|
||||
static int
|
||||
virtio_gpu_virgl_map_resource_blob(VirtIOGPU *g,
|
||||
struct virtio_gpu_virgl_resource *res,
|
||||
uint64_t offset)
|
||||
{
|
||||
g_autofree char *name = NULL;
|
||||
struct virtio_gpu_virgl_hostmem_region *vmr;
|
||||
VirtIOGPUBase *b = VIRTIO_GPU_BASE(g);
|
||||
MemoryRegion *mr;
|
||||
@@ -117,21 +146,16 @@ virtio_gpu_virgl_map_resource_blob(VirtIOGPU *g,
|
||||
}
|
||||
|
||||
vmr = g_new0(struct virtio_gpu_virgl_hostmem_region, 1);
|
||||
name = g_strdup_printf("blob[%" PRIu32 "]", res->base.resource_id);
|
||||
object_initialize_child(OBJECT(g), name, vmr,
|
||||
TYPE_VIRTIO_GPU_VIRGL_HOSTMEM_REGION);
|
||||
vmr->g = g;
|
||||
|
||||
mr = &vmr->mr;
|
||||
memory_region_init_ram_ptr(mr, OBJECT(mr), "blob", size, data);
|
||||
memory_region_init_ram_ptr(mr, OBJECT(vmr), "mr", size, data);
|
||||
memory_region_add_subregion(&b->hostmem, offset, mr);
|
||||
memory_region_set_enabled(mr, true);
|
||||
|
||||
/*
|
||||
* MR could outlive the resource if MR's reference is held outside of
|
||||
* virtio-gpu. In order to prevent unmapping resource while MR is alive,
|
||||
* and thus, making the data pointer invalid, we will block virtio-gpu
|
||||
* command processing until MR is fully unreferenced and freed.
|
||||
*/
|
||||
OBJECT(mr)->free = virtio_gpu_virgl_hostmem_region_free;
|
||||
|
||||
res->mr = mr;
|
||||
|
||||
trace_virtio_gpu_cmd_res_map_blob(res->base.resource_id, vmr, mr);
|
||||
@@ -163,7 +187,7 @@ virtio_gpu_virgl_unmap_resource_blob(VirtIOGPU *g,
|
||||
* 1. Begin async unmapping with memory_region_del_subregion()
|
||||
* and suspend/block cmd processing.
|
||||
* 2. Wait for res->mr to be freed and cmd processing resumed
|
||||
* asynchronously by virtio_gpu_virgl_hostmem_region_free().
|
||||
* asynchronously by virtio_gpu_virgl_hostmem_region_finalize().
|
||||
* 3. Finish the unmapping with final virgl_renderer_resource_unmap().
|
||||
*/
|
||||
if (vmr->finish_unmapping) {
|
||||
@@ -186,7 +210,7 @@ virtio_gpu_virgl_unmap_resource_blob(VirtIOGPU *g,
|
||||
/* memory region owns self res->mr object and frees it by itself */
|
||||
memory_region_set_enabled(mr, false);
|
||||
memory_region_del_subregion(&b->hostmem, mr);
|
||||
object_unparent(OBJECT(mr));
|
||||
object_unparent(OBJECT(vmr));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -705,7 +729,7 @@ static void virgl_cmd_resource_create_blob(VirtIOGPU *g,
|
||||
ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob),
|
||||
cmd, &res->base.addrs,
|
||||
&res->base.iov, &res->base.iov_cnt);
|
||||
if (!ret) {
|
||||
if (ret != 0) {
|
||||
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
|
||||
return;
|
||||
}
|
||||
@@ -1179,9 +1203,9 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
|
||||
}
|
||||
|
||||
#if VIRGL_VERSION_MAJOR >= 1
|
||||
gl->cmdq_resume_bh = aio_bh_new(qemu_get_aio_context(),
|
||||
virtio_gpu_virgl_resume_cmdq_bh,
|
||||
g);
|
||||
gl->cmdq_resume_bh = virtio_bh_io_new_guarded(DEVICE(g),
|
||||
virtio_gpu_virgl_resume_cmdq_bh,
|
||||
g);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1526,9 +1526,9 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
|
||||
|
||||
g->ctrl_vq = virtio_get_queue(vdev, 0);
|
||||
g->cursor_vq = virtio_get_queue(vdev, 1);
|
||||
g->ctrl_bh = virtio_bh_new_guarded(qdev, virtio_gpu_ctrl_bh, g);
|
||||
g->cursor_bh = virtio_bh_new_guarded(qdev, virtio_gpu_cursor_bh, g);
|
||||
g->reset_bh = qemu_bh_new(virtio_gpu_reset_bh, g);
|
||||
g->ctrl_bh = virtio_bh_io_new_guarded(qdev, virtio_gpu_ctrl_bh, g);
|
||||
g->cursor_bh = virtio_bh_io_new_guarded(qdev, virtio_gpu_cursor_bh, g);
|
||||
g->reset_bh = virtio_bh_io_new_guarded(qdev, virtio_gpu_reset_bh, g);
|
||||
qemu_cond_init(&g->reset_cond);
|
||||
QTAILQ_INIT(&g->reslist);
|
||||
QTAILQ_INIT(&g->cmdq);
|
||||
|
||||
@@ -376,7 +376,9 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
|
||||
|
||||
if (pci_bus) {
|
||||
pci_init_nic_devices(pci_bus, mc->default_nic);
|
||||
}
|
||||
|
||||
if (pci_bus && hppa_is_pa20(&cpu[0]->env)) {
|
||||
/* BMC board: HP Diva GSP PCI card */
|
||||
dev = qdev_new("diva-gsp");
|
||||
if (dev && !object_property_get_bool(OBJECT(dev), "disable", NULL)) {
|
||||
|
||||
+11
-12
@@ -193,7 +193,7 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa,
|
||||
uint16_t ret;
|
||||
g_assert(MSG_BUFSZ >= qemu_target_page_size());
|
||||
QEMU_UNINITIALIZED uint8_t data_buf[MSG_BUFSZ];
|
||||
hwaddr out_len;
|
||||
hwaddr out_len, out_requested_len;
|
||||
void *out_data;
|
||||
ssize_t recv_byte_count;
|
||||
|
||||
@@ -222,29 +222,28 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa,
|
||||
if (is_raw) {
|
||||
out_len += UDP_PKT_HEADER_SIZE;
|
||||
}
|
||||
out_requested_len = out_len;
|
||||
out_data = cpu_physical_memory_map(outgpa, &out_len, 1);
|
||||
if (!out_data) {
|
||||
return HV_STATUS_INSUFFICIENT_MEMORY;
|
||||
ret = HV_STATUS_INSUFFICIENT_MEMORY;
|
||||
if (!out_data || out_len < out_requested_len) {
|
||||
goto cleanup_out_data;
|
||||
}
|
||||
|
||||
if (is_raw &&
|
||||
!create_udp_pkt(syndbg, out_data,
|
||||
recv_byte_count + UDP_PKT_HEADER_SIZE,
|
||||
!create_udp_pkt(syndbg, out_data, out_len,
|
||||
data_buf, recv_byte_count)) {
|
||||
ret = HV_STATUS_INSUFFICIENT_MEMORY;
|
||||
goto cleanup_out_data;
|
||||
} else if (!is_raw) {
|
||||
memcpy(out_data, data_buf, recv_byte_count);
|
||||
memcpy(out_data, data_buf, out_len);
|
||||
}
|
||||
|
||||
*retrieved_count = recv_byte_count;
|
||||
if (is_raw) {
|
||||
*retrieved_count += UDP_PKT_HEADER_SIZE;
|
||||
}
|
||||
*retrieved_count = out_len;
|
||||
ret = HV_STATUS_SUCCESS;
|
||||
|
||||
cleanup_out_data:
|
||||
cpu_physical_memory_unmap(out_data, out_len, 1, out_len);
|
||||
if (out_data) {
|
||||
cpu_physical_memory_unmap(out_data, out_len, 1, out_len);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+82
-43
@@ -94,7 +94,7 @@ static uint64_t aspeed_i2c_bus_old_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
unsigned size)
|
||||
{
|
||||
AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
|
||||
uint64_t value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
uint64_t value = -1;
|
||||
|
||||
switch (offset) {
|
||||
case A_I2CD_FUN_CTRL:
|
||||
@@ -105,7 +105,7 @@ static uint64_t aspeed_i2c_bus_old_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
case A_I2CD_DEV_ADDR:
|
||||
case A_I2CD_POOL_CTRL:
|
||||
case A_I2CD_BYTE_BUF:
|
||||
/* Value is already set, don't do anything. */
|
||||
value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
break;
|
||||
case A_I2CD_CMD:
|
||||
value = SHARED_FIELD_DP32(value, BUS_BUSY_STS, i2c_bus_busy(bus->bus));
|
||||
@@ -113,23 +113,20 @@ static uint64_t aspeed_i2c_bus_old_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
case A_I2CD_DMA_ADDR:
|
||||
if (!aic->has_dma) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA support\n", __func__);
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
value = extract64(bus->dma_dram_offset, 0, 32);
|
||||
value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
break;
|
||||
case A_I2CD_DMA_LEN:
|
||||
if (!aic->has_dma) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA support\n", __func__);
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
break;
|
||||
|
||||
default:
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, offset);
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -141,7 +138,7 @@ static uint64_t aspeed_i2c_bus_new_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
unsigned size)
|
||||
{
|
||||
AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
|
||||
uint64_t value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
uint64_t value = -1;
|
||||
|
||||
switch (offset) {
|
||||
case A_I2CC_FUN_CTRL:
|
||||
@@ -161,13 +158,12 @@ static uint64_t aspeed_i2c_bus_new_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
case A_I2CS_CMD:
|
||||
case A_I2CS_INTR_CTRL:
|
||||
case A_I2CS_DMA_LEN_STS:
|
||||
/* Value is already set, don't do anything. */
|
||||
case A_I2CS_INTR_STS:
|
||||
value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
break;
|
||||
case A_I2CC_DMA_ADDR:
|
||||
value = extract64(bus->dma_dram_offset, 0, 32);
|
||||
break;
|
||||
case A_I2CS_INTR_STS:
|
||||
break;
|
||||
case A_I2CM_CMD:
|
||||
value = SHARED_FIELD_DP32(value, BUS_BUSY_STS, i2c_bus_busy(bus->bus));
|
||||
break;
|
||||
@@ -178,13 +174,13 @@ static uint64_t aspeed_i2c_bus_new_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
if (!aic->has_dma64) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA 64 bits support\n",
|
||||
__func__);
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
value = bus->regs[offset / sizeof(*bus->regs)];
|
||||
break;
|
||||
default:
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, offset);
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -221,6 +217,64 @@ static uint8_t aspeed_i2c_get_state(AspeedI2CBus *bus)
|
||||
return SHARED_ARRAY_FIELD_EX32(bus->regs, R_I2CD_CMD, TX_STATE);
|
||||
}
|
||||
|
||||
/*
|
||||
* The AST2700 support the maximum DRAM size is 8 GB.
|
||||
* The DRAM offset range is from 0x0_0000_0000 to
|
||||
* 0x1_FFFF_FFFF and it is enough to use bits [33:0]
|
||||
* saving the dram offset.
|
||||
* Therefore, save the high part physical address bit[1:0]
|
||||
* of Tx/Rx buffer address as dma_dram_offset bit[33:32].
|
||||
*/
|
||||
static void aspeed_i2c_set_tx_dma_dram_offset(AspeedI2CBus *bus)
|
||||
{
|
||||
AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
|
||||
uint32_t value;
|
||||
|
||||
assert(aic->has_dma);
|
||||
|
||||
if (aspeed_i2c_is_new_mode(bus->controller)) {
|
||||
value = bus->regs[R_I2CM_DMA_TX_ADDR];
|
||||
bus->dma_dram_offset =
|
||||
deposit64(bus->dma_dram_offset, 0, 32,
|
||||
FIELD_EX32(value, I2CM_DMA_TX_ADDR, ADDR));
|
||||
if (!aic->has_dma64) {
|
||||
value = bus->regs[R_I2CM_DMA_TX_ADDR_HI];
|
||||
bus->dma_dram_offset =
|
||||
deposit64(bus->dma_dram_offset, 32, 32,
|
||||
extract32(value, 0, 2));
|
||||
}
|
||||
} else {
|
||||
value = bus->regs[R_I2CD_DMA_ADDR];
|
||||
bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 0, 32,
|
||||
value & 0x3ffffffc);
|
||||
}
|
||||
}
|
||||
|
||||
static void aspeed_i2c_set_rx_dma_dram_offset(AspeedI2CBus *bus)
|
||||
{
|
||||
AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
|
||||
uint32_t value;
|
||||
|
||||
assert(aic->has_dma);
|
||||
|
||||
if (aspeed_i2c_is_new_mode(bus->controller)) {
|
||||
value = bus->regs[R_I2CM_DMA_RX_ADDR];
|
||||
bus->dma_dram_offset =
|
||||
deposit64(bus->dma_dram_offset, 0, 32,
|
||||
FIELD_EX32(value, I2CM_DMA_RX_ADDR, ADDR));
|
||||
if (!aic->has_dma64) {
|
||||
value = bus->regs[R_I2CM_DMA_RX_ADDR_HI];
|
||||
bus->dma_dram_offset =
|
||||
deposit64(bus->dma_dram_offset, 32, 32,
|
||||
extract32(value, 0, 2));
|
||||
}
|
||||
} else {
|
||||
value = bus->regs[R_I2CD_DMA_ADDR];
|
||||
bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 0, 32,
|
||||
value & 0x3ffffffc);
|
||||
}
|
||||
}
|
||||
|
||||
static int aspeed_i2c_dma_read(AspeedI2CBus *bus, uint8_t *data)
|
||||
{
|
||||
MemTxResult result;
|
||||
@@ -270,9 +324,14 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus)
|
||||
if (aspeed_i2c_is_new_mode(bus->controller)) {
|
||||
ARRAY_FIELD_DP32(bus->regs, I2CM_DMA_LEN_STS, TX_LEN, 0);
|
||||
}
|
||||
aspeed_i2c_set_tx_dma_dram_offset(bus);
|
||||
while (bus->regs[reg_dma_len]) {
|
||||
uint8_t data;
|
||||
aspeed_i2c_dma_read(bus, &data);
|
||||
ret = aspeed_i2c_dma_read(bus, &data);
|
||||
/* Check that we were able to read the DMA */
|
||||
if (ret) {
|
||||
break;
|
||||
}
|
||||
trace_aspeed_i2c_bus_send("DMA", bus->regs[reg_dma_len],
|
||||
bus->regs[reg_dma_len], data);
|
||||
ret = i2c_send(bus->bus, data);
|
||||
@@ -331,6 +390,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)
|
||||
ARRAY_FIELD_DP32(bus->regs, I2CM_DMA_LEN_STS, RX_LEN, 0);
|
||||
}
|
||||
|
||||
aspeed_i2c_set_rx_dma_dram_offset(bus);
|
||||
while (bus->regs[reg_dma_len]) {
|
||||
MemTxResult result;
|
||||
|
||||
@@ -397,6 +457,7 @@ static uint8_t aspeed_i2c_get_addr(AspeedI2CBus *bus)
|
||||
} else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
|
||||
uint8_t data;
|
||||
|
||||
aspeed_i2c_set_tx_dma_dram_offset(bus);
|
||||
aspeed_i2c_dma_read(bus, &data);
|
||||
return data;
|
||||
} else {
|
||||
@@ -653,20 +714,10 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
case A_I2CM_DMA_TX_ADDR:
|
||||
bus->regs[R_I2CM_DMA_TX_ADDR] = FIELD_EX32(value, I2CM_DMA_TX_ADDR,
|
||||
ADDR);
|
||||
bus->dma_dram_offset =
|
||||
deposit64(bus->dma_dram_offset, 0, 32,
|
||||
FIELD_EX32(value, I2CM_DMA_TX_ADDR, ADDR));
|
||||
bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs, I2CM_DMA_LEN,
|
||||
TX_BUF_LEN) + 1;
|
||||
break;
|
||||
case A_I2CM_DMA_RX_ADDR:
|
||||
bus->regs[R_I2CM_DMA_RX_ADDR] = FIELD_EX32(value, I2CM_DMA_RX_ADDR,
|
||||
ADDR);
|
||||
bus->dma_dram_offset =
|
||||
deposit64(bus->dma_dram_offset, 0, 32,
|
||||
FIELD_EX32(value, I2CM_DMA_RX_ADDR, ADDR));
|
||||
bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs, I2CM_DMA_LEN,
|
||||
RX_BUF_LEN) + 1;
|
||||
break;
|
||||
case A_I2CM_DMA_LEN:
|
||||
w1t = FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN_W1T) ||
|
||||
@@ -679,10 +730,16 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
if (FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN_W1T)) {
|
||||
ARRAY_FIELD_DP32(bus->regs, I2CM_DMA_LEN, RX_BUF_LEN,
|
||||
FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN));
|
||||
bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
|
||||
I2CM_DMA_LEN,
|
||||
RX_BUF_LEN) + 1;
|
||||
}
|
||||
if (FIELD_EX32(value, I2CM_DMA_LEN, TX_BUF_LEN_W1T)) {
|
||||
ARRAY_FIELD_DP32(bus->regs, I2CM_DMA_LEN, TX_BUF_LEN,
|
||||
FIELD_EX32(value, I2CM_DMA_LEN, TX_BUF_LEN));
|
||||
bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
|
||||
I2CM_DMA_LEN,
|
||||
TX_BUF_LEN) + 1;
|
||||
}
|
||||
break;
|
||||
case A_I2CM_DMA_LEN_STS:
|
||||
@@ -742,15 +799,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Slave mode DMA TX is not implemented\n",
|
||||
__func__);
|
||||
break;
|
||||
|
||||
/*
|
||||
* The AST2700 support the maximum DRAM size is 8 GB.
|
||||
* The DRAM offset range is from 0x0_0000_0000 to
|
||||
* 0x1_FFFF_FFFF and it is enough to use bits [33:0]
|
||||
* saving the dram offset.
|
||||
* Therefore, save the high part physical address bit[1:0]
|
||||
* of Tx/Rx buffer address as dma_dram_offset bit[33:32].
|
||||
*/
|
||||
case A_I2CM_DMA_TX_ADDR_HI:
|
||||
if (!aic->has_dma64) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA 64 bits support\n",
|
||||
@@ -760,8 +808,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
bus->regs[R_I2CM_DMA_TX_ADDR_HI] = FIELD_EX32(value,
|
||||
I2CM_DMA_TX_ADDR_HI,
|
||||
ADDR_HI);
|
||||
bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 32, 32,
|
||||
extract32(value, 0, 2));
|
||||
break;
|
||||
case A_I2CM_DMA_RX_ADDR_HI:
|
||||
if (!aic->has_dma64) {
|
||||
@@ -772,8 +818,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
bus->regs[R_I2CM_DMA_RX_ADDR_HI] = FIELD_EX32(value,
|
||||
I2CM_DMA_RX_ADDR_HI,
|
||||
ADDR_HI);
|
||||
bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 32, 32,
|
||||
extract32(value, 0, 2));
|
||||
break;
|
||||
case A_I2CS_DMA_TX_ADDR_HI:
|
||||
qemu_log_mask(LOG_UNIMP,
|
||||
@@ -789,8 +833,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
bus->regs[R_I2CS_DMA_RX_ADDR_HI] = FIELD_EX32(value,
|
||||
I2CS_DMA_RX_ADDR_HI,
|
||||
ADDR_HI);
|
||||
bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 32, 32,
|
||||
extract32(value, 0, 2));
|
||||
break;
|
||||
default:
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIx "\n",
|
||||
@@ -881,9 +923,6 @@ static void aspeed_i2c_bus_old_write(AspeedI2CBus *bus, hwaddr offset,
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA support\n", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 0, 32,
|
||||
value & 0x3ffffffc);
|
||||
break;
|
||||
|
||||
case A_I2CD_DMA_LEN:
|
||||
|
||||
+2
-2
@@ -151,8 +151,8 @@ static void imx_i2c_write(void *opaque, hwaddr offset,
|
||||
{
|
||||
IMXI2CState *s = IMX_I2C(opaque);
|
||||
|
||||
trace_imx_i2c_read(DEVICE(s)->canonical_path, imx_i2c_get_regname(offset),
|
||||
offset, value);
|
||||
trace_imx_i2c_write(DEVICE(s)->canonical_path, imx_i2c_get_regname(offset),
|
||||
offset, value);
|
||||
|
||||
value &= 0xff;
|
||||
|
||||
|
||||
@@ -1877,7 +1877,7 @@ int xen_physdev_map_pirq(struct physdev_map_pirq *map)
|
||||
return pirq;
|
||||
}
|
||||
map->pirq = pirq;
|
||||
} else if (pirq > s->nr_pirqs) {
|
||||
} else if (pirq >= s->nr_pirqs) {
|
||||
return -EINVAL;
|
||||
} else {
|
||||
/*
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
|
||||
GlobalProperty pc_compat_10_1[] = {
|
||||
{ "mch", "extended-tseg-mbytes", "16" },
|
||||
{ TYPE_X86_CPU, "x-migrate-error-code", "false" },
|
||||
};
|
||||
const size_t pc_compat_10_1_len = G_N_ELEMENTS(pc_compat_10_1);
|
||||
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ struct VMMouseState {
|
||||
ISAKBDState *i8042;
|
||||
};
|
||||
|
||||
static void vmmouse_get_data(uint32_t *data)
|
||||
static void vmmouse_get_data(uint64_t *data)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(current_cpu);
|
||||
CPUX86State *env = &cpu->env;
|
||||
@@ -82,7 +82,7 @@ static void vmmouse_get_data(uint32_t *data)
|
||||
data[4] = env->regs[R_ESI]; data[5] = env->regs[R_EDI];
|
||||
}
|
||||
|
||||
static void vmmouse_set_data(const uint32_t *data)
|
||||
static void vmmouse_set_data(const uint64_t *data)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(current_cpu);
|
||||
CPUX86State *env = &cpu->env;
|
||||
@@ -197,7 +197,7 @@ static void vmmouse_disable(VMMouseState *s)
|
||||
vmmouse_remove_handler(s);
|
||||
}
|
||||
|
||||
static void vmmouse_data(VMMouseState *s, uint32_t *data, uint32_t size)
|
||||
static void vmmouse_data(VMMouseState *s, uint64_t *data, uint32_t size)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -221,7 +221,7 @@ static void vmmouse_data(VMMouseState *s, uint32_t *data, uint32_t size)
|
||||
static uint32_t vmmouse_ioport_read(void *opaque, uint32_t addr)
|
||||
{
|
||||
VMMouseState *s = opaque;
|
||||
uint32_t data[6];
|
||||
uint64_t data[6];
|
||||
uint16_t command;
|
||||
|
||||
vmmouse_get_data(data);
|
||||
@@ -247,7 +247,7 @@ static uint32_t vmmouse_ioport_read(void *opaque, uint32_t addr)
|
||||
vmmouse_request_absolute(s);
|
||||
break;
|
||||
default:
|
||||
printf("vmmouse: unknown command %x\n", data[1]);
|
||||
printf("vmmouse: unknown command %" PRIx64 "\n", data[1]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -81,7 +81,7 @@ static MemTxResult gicv3_its_trans_write(void *opaque, hwaddr offset,
|
||||
if (offset == 0x0040 && ((size == 2) || (size == 4))) {
|
||||
GICv3ITSState *s = ARM_GICV3_ITS_COMMON(opaque);
|
||||
GICv3ITSCommonClass *c = ARM_GICV3_ITS_COMMON_GET_CLASS(s);
|
||||
int ret = c->send_msi(s, le64_to_cpu(value), attrs.requester_id);
|
||||
int ret = c->send_msi(s, value, attrs.requester_id);
|
||||
|
||||
if (ret <= 0) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
|
||||
@@ -58,7 +58,7 @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid)
|
||||
|
||||
msi.address_lo = extract64(s->gits_translater_gpa, 0, 32);
|
||||
msi.address_hi = extract64(s->gits_translater_gpa, 32, 32);
|
||||
msi.data = le32_to_cpu(value);
|
||||
msi.data = value;
|
||||
msi.flags = KVM_MSI_VALID_DEVID;
|
||||
msi.devid = devid;
|
||||
memset(msi.pad, 0, sizeof(msi.pad));
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
#include "system/reset.h"
|
||||
#include "target/loongarch/cpu.h"
|
||||
|
||||
#define FDT_IRQ_TYPE_EDGE_RISING 1
|
||||
#define FDT_IRQ_TYPE_EDGE_FALLING 2
|
||||
#define FDT_IRQ_TYPE_LEVEL_HIGH 4
|
||||
#define FDT_IRQ_TYPE_LEVEL_LOW 8
|
||||
|
||||
static void create_fdt(LoongArchVirtMachineState *lvms)
|
||||
{
|
||||
MachineState *ms = MACHINE(lvms);
|
||||
@@ -316,6 +321,8 @@ static void fdt_add_pcie_irq_map_node(const LoongArchVirtMachineState *lvms,
|
||||
uint32_t full_irq_map[PCI_NUM_PINS * PCI_NUM_PINS * 10] = {};
|
||||
uint32_t *irq_map = full_irq_map;
|
||||
const MachineState *ms = MACHINE(lvms);
|
||||
uint32_t pin_mask;
|
||||
uint32_t devfn_mask;
|
||||
|
||||
/*
|
||||
* This code creates a standard swizzle of interrupts such that
|
||||
@@ -328,37 +335,45 @@ static void fdt_add_pcie_irq_map_node(const LoongArchVirtMachineState *lvms,
|
||||
*/
|
||||
|
||||
for (dev = 0; dev < PCI_NUM_PINS; dev++) {
|
||||
int devfn = dev * 0x8;
|
||||
int devfn = PCI_DEVFN(dev, 0);
|
||||
|
||||
for (pin = 0; pin < PCI_NUM_PINS; pin++) {
|
||||
int irq_nr = 16 + ((pin + PCI_SLOT(devfn)) % PCI_NUM_PINS);
|
||||
int irq_nr = VIRT_DEVICE_IRQS + \
|
||||
((pin + PCI_SLOT(devfn)) % PCI_NUM_PINS);
|
||||
int i = 0;
|
||||
|
||||
/* Fill PCI address cells */
|
||||
irq_map[i] = cpu_to_be32(devfn << 8);
|
||||
i += 3;
|
||||
|
||||
/* Fill PCI Interrupt cells */
|
||||
irq_map[i] = cpu_to_be32(pin + 1);
|
||||
i += 1;
|
||||
|
||||
/* Fill interrupt controller phandle and cells */
|
||||
irq_map[i++] = cpu_to_be32(*pch_pic_phandle);
|
||||
irq_map[i++] = cpu_to_be32(irq_nr);
|
||||
uint32_t map[] = {
|
||||
devfn << 8, 0, 0, /* devfn */
|
||||
pin + 1, /* PCI pin */
|
||||
*pch_pic_phandle, /* interrupt controller handle */
|
||||
irq_nr, /* irq number */
|
||||
FDT_IRQ_TYPE_LEVEL_HIGH }; /* irq trigger level */
|
||||
|
||||
if (!irq_map_stride) {
|
||||
irq_map_stride = i;
|
||||
irq_map_stride = sizeof(map) / sizeof(uint32_t);
|
||||
}
|
||||
|
||||
/* Convert map to big endian */
|
||||
for (i = 0; i < irq_map_stride; i++) {
|
||||
irq_map[i] = cpu_to_be32(map[i]);
|
||||
}
|
||||
|
||||
irq_map += irq_map_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qemu_fdt_setprop(ms->fdt, nodename, "interrupt-map", full_irq_map,
|
||||
PCI_NUM_PINS * PCI_NUM_PINS *
|
||||
irq_map_stride * sizeof(uint32_t));
|
||||
|
||||
/* Only need to match the pci slot bit */
|
||||
devfn_mask = PCI_DEVFN((PCI_NUM_PINS - 1), 0) << 8;
|
||||
/* The pci interrupt only needs to match the specified low bit */
|
||||
pin_mask = (1 << ((PCI_NUM_PINS - 1))) - 1;
|
||||
|
||||
qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupt-map-mask",
|
||||
0x1800, 0, 0, 0x7);
|
||||
devfn_mask, 0, 0, /* address cells */
|
||||
pin_mask);
|
||||
}
|
||||
|
||||
static void fdt_add_pcie_node(const LoongArchVirtMachineState *lvms,
|
||||
@@ -395,6 +410,8 @@ static void fdt_add_pcie_node(const LoongArchVirtMachineState *lvms,
|
||||
2, base_mmio, 2, size_mmio);
|
||||
qemu_fdt_setprop_cells(ms->fdt, nodename, "msi-map",
|
||||
0, *pch_msi_phandle, 0, 0x10000);
|
||||
|
||||
qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 1);
|
||||
fdt_add_pcie_irq_map_node(lvms, nodename, pch_pic_phandle);
|
||||
g_free(nodename);
|
||||
}
|
||||
@@ -415,7 +432,8 @@ static void fdt_add_uart_node(LoongArchVirtMachineState *lvms,
|
||||
if (chosen) {
|
||||
qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename);
|
||||
}
|
||||
qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", irq, 0x4);
|
||||
qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", irq,
|
||||
FDT_IRQ_TYPE_LEVEL_HIGH);
|
||||
qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent",
|
||||
*pch_pic_phandle);
|
||||
g_free(nodename);
|
||||
@@ -435,7 +453,8 @@ static void fdt_add_rtc_node(LoongArchVirtMachineState *lvms,
|
||||
"loongson,ls7a-rtc");
|
||||
qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 2, base, 2, size);
|
||||
qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
|
||||
VIRT_RTC_IRQ - VIRT_GSI_BASE , 0x4);
|
||||
VIRT_RTC_IRQ - VIRT_GSI_BASE ,
|
||||
FDT_IRQ_TYPE_LEVEL_HIGH);
|
||||
qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent",
|
||||
*pch_pic_phandle);
|
||||
g_free(nodename);
|
||||
|
||||
+12
-2
@@ -46,6 +46,7 @@
|
||||
#include "hw/block/flash.h"
|
||||
#include "hw/virtio/virtio-iommu.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/log.h"
|
||||
#include "kvm/kvm_loongarch.h"
|
||||
|
||||
static void virt_get_dmsi(Object *obj, Visitor *v, const char *name,
|
||||
@@ -621,8 +622,15 @@ static MemTxResult virt_iocsr_misc_write(void *opaque, hwaddr addr,
|
||||
EXTIOI_VIRT_BASE + EXTIOI_VIRT_CONFIG,
|
||||
features, attrs, NULL);
|
||||
break;
|
||||
case VERSION_REG:
|
||||
case FEATURE_REG:
|
||||
case VENDOR_REG:
|
||||
case CPUNAME_REG:
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Unimplemented IOCSR 0x%" HWADDR_PRIx "\n",
|
||||
__func__, addr);
|
||||
break;
|
||||
}
|
||||
|
||||
return MEMTX_OK;
|
||||
@@ -680,7 +688,9 @@ static MemTxResult virt_iocsr_misc_read(void *opaque, hwaddr addr,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Unimplemented IOCSR 0x%" HWADDR_PRIx "\n",
|
||||
__func__, addr);
|
||||
break;
|
||||
}
|
||||
|
||||
*data = ret;
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ static uint64_t virt_ctrl_read(void *opaque, hwaddr addr, unsigned size)
|
||||
break;
|
||||
}
|
||||
|
||||
trace_virt_ctrl_write(s, addr, size, value);
|
||||
trace_virt_ctrl_read(s, addr, size, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -700,6 +700,13 @@ static uint64_t npcm_gmac_read(void *opaque, hwaddr offset, unsigned size)
|
||||
NPCMGMACState *gmac = opaque;
|
||||
uint32_t v = 0;
|
||||
|
||||
if (offset >= NPCM_GMAC_REG_SIZE) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: invalid register offset: 0x%04" HWADDR_PRIx"\n",
|
||||
DEVICE(gmac)->canonical_path, offset);
|
||||
return v;
|
||||
}
|
||||
|
||||
switch (offset) {
|
||||
/* Write only registers */
|
||||
case A_NPCM_DMA_XMT_POLL_DEMAND:
|
||||
@@ -724,6 +731,13 @@ static void npcm_gmac_write(void *opaque, hwaddr offset,
|
||||
|
||||
trace_npcm_gmac_reg_write(DEVICE(gmac)->canonical_path, offset, v);
|
||||
|
||||
if (offset >= NPCM_GMAC_REG_SIZE) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: invalid register offset: 0x%04" HWADDR_PRIx"\n",
|
||||
DEVICE(gmac)->canonical_path, offset);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (offset) {
|
||||
/* Read only registers */
|
||||
case A_NPCM_GMAC_VERSION:
|
||||
|
||||
+14
-2
@@ -30,6 +30,12 @@
|
||||
* LAN91C111 datasheet).
|
||||
*/
|
||||
#define MAX_PACKET_SIZE 2048
|
||||
/*
|
||||
* Size of the non-data fields in a data frame: status word,
|
||||
* byte count, control byte, and last data byte; this defines
|
||||
* the smallest value the byte count in the frame can validly be.
|
||||
*/
|
||||
#define MIN_PACKET_SIZE 6
|
||||
|
||||
#define TYPE_SMC91C111 "smc91c111"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(smc91c111_state, SMC91C111)
|
||||
@@ -289,7 +295,7 @@ static void smc91c111_do_tx(smc91c111_state *s)
|
||||
*(p++) = 0x40;
|
||||
len = *(p++);
|
||||
len |= ((int)*(p++)) << 8;
|
||||
if (len > MAX_PACKET_SIZE) {
|
||||
if (len < MIN_PACKET_SIZE || len > MAX_PACKET_SIZE) {
|
||||
/*
|
||||
* Datasheet doesn't say what to do here, and there is no
|
||||
* relevant tx error condition listed. Log, and drop the packet.
|
||||
@@ -300,7 +306,13 @@ static void smc91c111_do_tx(smc91c111_state *s)
|
||||
smc91c111_complete_tx_packet(s, packetnum);
|
||||
continue;
|
||||
}
|
||||
len -= 6;
|
||||
/*
|
||||
* Convert from size of the data frame to number of bytes of
|
||||
* actual packet data. Whether the "last data byte" field is
|
||||
* included in the packet depends on the ODD bit in the control
|
||||
* byte at the end of the frame.
|
||||
*/
|
||||
len -= MIN_PACKET_SIZE;
|
||||
control = p[len + 1];
|
||||
if (control & 0x20)
|
||||
len++;
|
||||
|
||||
@@ -527,3 +527,4 @@ xen_netdev_rx(int dev, int idx, int status, int flags) "vif%u idx %d status %d f
|
||||
# xilinx_ethlite.c
|
||||
ethlite_pkt_lost(uint32_t rx_ctrl) "rx_ctrl:0x%" PRIx32
|
||||
ethlite_pkt_size_too_big(uint64_t size) "size:0x%" PRIx64
|
||||
ethlite_pkt_tx_size_too_big(uint64_t size) "size:0x%" PRIx64
|
||||
@@ -162,9 +162,15 @@ static void port_tx_write(void *opaque, hwaddr addr, uint64_t value,
|
||||
break;
|
||||
case TX_CTRL:
|
||||
if ((value & (CTRL_P | CTRL_S)) == CTRL_S) {
|
||||
qemu_send_packet(qemu_get_queue(s->nic),
|
||||
txbuf_ptr(s, port_index),
|
||||
s->port[port_index].reg.tx_len);
|
||||
uint32_t tx_size = s->port[port_index].reg.tx_len;
|
||||
|
||||
if (tx_size >= BUFSZ_MAX) {
|
||||
trace_ethlite_pkt_tx_size_too_big(tx_size);
|
||||
} else {
|
||||
qemu_send_packet(qemu_get_queue(s->nic),
|
||||
txbuf_ptr(s, port_index),
|
||||
tx_size);
|
||||
}
|
||||
if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
|
||||
eth_pulse_irq(s);
|
||||
}
|
||||
|
||||
+3
-4
@@ -944,12 +944,11 @@ static void nvme_ns_class_init(ObjectClass *oc, const void *data)
|
||||
static void nvme_ns_instance_init(Object *obj)
|
||||
{
|
||||
NvmeNamespace *ns = NVME_NS(obj);
|
||||
char *bootindex = g_strdup_printf("/namespace@%d,0", ns->params.nsid);
|
||||
|
||||
sprintf(ns->bootindex_suffix, "/namespace@%" PRIu32 ",0", ns->params.nsid);
|
||||
|
||||
device_add_bootindex_property(obj, &ns->bootindex, "bootindex",
|
||||
bootindex, DEVICE(obj));
|
||||
|
||||
g_free(bootindex);
|
||||
ns->bootindex_suffix, DEVICE(obj));
|
||||
}
|
||||
|
||||
static const TypeInfo nvme_ns_info = {
|
||||
|
||||
@@ -239,6 +239,7 @@ typedef struct NvmeNamespace {
|
||||
DeviceState parent_obj;
|
||||
BlockConf blkconf;
|
||||
int32_t bootindex;
|
||||
char bootindex_suffix[24];
|
||||
int64_t size;
|
||||
int64_t moff;
|
||||
NvmeIdNs id_ns;
|
||||
|
||||
+12
-15
@@ -432,30 +432,27 @@ static void mch_update_smbase_smram(MCHPCIState *mch)
|
||||
}
|
||||
|
||||
if (*reg == MCH_HOST_BRIDGE_F_SMBASE_QUERY) {
|
||||
pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] =
|
||||
MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] = MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
*reg = MCH_HOST_BRIDGE_F_SMBASE_IN_RAM;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* default/reset state, discard written value
|
||||
* which will disable SMRAM balackhole at SMBASE
|
||||
* reg value can come from register write/reset/migration source,
|
||||
* update wmask to be in sync with it regardless of source
|
||||
*/
|
||||
if (pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] == 0xff) {
|
||||
*reg = 0x00;
|
||||
if (*reg == MCH_HOST_BRIDGE_F_SMBASE_IN_RAM) {
|
||||
pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] = MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
return;
|
||||
}
|
||||
if (*reg & MCH_HOST_BRIDGE_F_SMBASE_LCK) {
|
||||
/* lock register at 0x2 and disable all writes */
|
||||
pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] = 0;
|
||||
*reg = MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
}
|
||||
|
||||
lck = *reg & MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
memory_region_transaction_begin();
|
||||
if (*reg & MCH_HOST_BRIDGE_F_SMBASE_LCK) {
|
||||
/* disable all writes */
|
||||
pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] &=
|
||||
~MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
*reg = MCH_HOST_BRIDGE_F_SMBASE_LCK;
|
||||
lck = true;
|
||||
} else {
|
||||
lck = false;
|
||||
}
|
||||
memory_region_set_enabled(&mch->smbase_blackhole, lck);
|
||||
memory_region_set_enabled(&mch->smbase_window, lck);
|
||||
memory_region_transaction_commit();
|
||||
|
||||
+5
-4
@@ -195,14 +195,17 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset,
|
||||
|
||||
void pcie_sriov_pf_exit(PCIDevice *dev)
|
||||
{
|
||||
uint8_t *cfg;
|
||||
|
||||
if (dev->exp.sriov_cap == 0) {
|
||||
return;
|
||||
}
|
||||
cfg = dev->config + dev->exp.sriov_cap;
|
||||
|
||||
if (dev->exp.sriov_pf.vf_user_created) {
|
||||
uint16_t ven_id = pci_get_word(dev->config + PCI_VENDOR_ID);
|
||||
uint16_t total_vfs = pci_get_word(dev->config + PCI_SRIOV_TOTAL_VF);
|
||||
uint16_t vf_dev_id = pci_get_word(dev->config + PCI_SRIOV_VF_DID);
|
||||
uint16_t total_vfs = pci_get_word(cfg + PCI_SRIOV_TOTAL_VF);
|
||||
uint16_t vf_dev_id = pci_get_word(cfg + PCI_SRIOV_VF_DID);
|
||||
|
||||
unregister_vfs(dev);
|
||||
|
||||
@@ -213,8 +216,6 @@ void pcie_sriov_pf_exit(PCIDevice *dev)
|
||||
pci_config_set_device_id(dev->exp.sriov_pf.vf[i]->config, vf_dev_id);
|
||||
}
|
||||
} else {
|
||||
uint8_t *cfg = dev->config + dev->exp.sriov_cap;
|
||||
|
||||
unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4776,8 +4776,14 @@ DEFINE_SPAPR_MACHINE(10, 1);
|
||||
*/
|
||||
static void spapr_machine_10_0_class_options(MachineClass *mc)
|
||||
{
|
||||
static GlobalProperty spapr_compat_10_0[] = {
|
||||
{ TYPE_POWERPC_CPU, "rtas-stopped-state", "false" },
|
||||
};
|
||||
|
||||
spapr_machine_10_1_class_options(mc);
|
||||
compat_props_add(mc->compat_props, hw_compat_10_0, hw_compat_10_0_len);
|
||||
compat_props_add(mc->compat_props, spapr_compat_10_0,
|
||||
G_N_ELEMENTS(spapr_compat_10_0));
|
||||
}
|
||||
|
||||
DEFINE_SPAPR_MACHINE(10, 0);
|
||||
|
||||
@@ -307,7 +307,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
|
||||
uint32_t data = pci_get_long(pbdev->pdev->config +
|
||||
PCI_BASE_ADDRESS_0 + (i * 4));
|
||||
|
||||
stl_be_p(&resquery->bar[i], data);
|
||||
stl_le_p(&resquery->bar[i], data);
|
||||
resquery->bar_size[i] = pbdev->pdev->io_regions[i].size ?
|
||||
ctz64(pbdev->pdev->io_regions[i].size) : 0;
|
||||
trace_s390_pci_bar(i,
|
||||
|
||||
@@ -1884,9 +1884,11 @@ static const MemoryRegionOps usdhc_mmio_ops = {
|
||||
static void imx_usdhc_init(Object *obj)
|
||||
{
|
||||
SDHCIState *s = SYSBUS_SDHCI(obj);
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
|
||||
s->io_ops = &usdhc_mmio_ops;
|
||||
s->quirks = SDHCI_QUIRK_NO_BUSY_IRQ;
|
||||
qdev_prop_set_uint8(dev, "sd-spec-version", 3);
|
||||
}
|
||||
|
||||
/* --- qdev Samsung s3c --- */
|
||||
|
||||
@@ -369,7 +369,7 @@ static void xilinx_spips_reset(DeviceState *d)
|
||||
memset(s->regs, 0, sizeof(s->regs));
|
||||
|
||||
fifo8_reset(&s->rx_fifo);
|
||||
fifo8_reset(&s->rx_fifo);
|
||||
fifo8_reset(&s->tx_fifo);
|
||||
/* non zero resets */
|
||||
s->regs[R_CONFIG] |= MODEFAIL_GEN_EN;
|
||||
s->regs[R_SLAVE_IDLE_COUNT] = 0xFF;
|
||||
@@ -397,7 +397,7 @@ static void xlnx_zynqmp_qspips_reset(DeviceState *d)
|
||||
memset(s->regs, 0, sizeof(s->regs));
|
||||
|
||||
fifo8_reset(&s->rx_fifo_g);
|
||||
fifo8_reset(&s->rx_fifo_g);
|
||||
fifo8_reset(&s->tx_fifo_g);
|
||||
fifo32_reset(&s->fifo_g);
|
||||
s->regs[R_INTR_STATUS] = R_INTR_STATUS_RESET;
|
||||
s->regs[R_GPIO] = 1;
|
||||
|
||||
@@ -592,7 +592,7 @@ uefi_vars_mm_get_payload_size(uefi_vars_state *uv, mm_header *mhdr,
|
||||
return uefi_vars_mm_error(mhdr, mvar, EFI_BAD_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
ps->payload_size = uv->buf_size;
|
||||
ps->payload_size = uv->buf_size - sizeof(*mhdr) - sizeof(*mvar);
|
||||
mvar->status = EFI_SUCCESS;
|
||||
return length;
|
||||
}
|
||||
|
||||
+1
-2
@@ -53,8 +53,7 @@ static void ufs_build_scsi_response_upiu(UfsRequest *req, uint8_t *sense,
|
||||
response = UFS_COMMAND_RESULT_FAIL;
|
||||
}
|
||||
|
||||
data_segment_length =
|
||||
cpu_to_be16(sense_len + sizeof(req->rsp_upiu.sr.sense_data_len));
|
||||
data_segment_length = sense_len + sizeof(req->rsp_upiu.sr.sense_data_len);
|
||||
ufs_build_upiu_header(req, UFS_UPIU_TRANSACTION_RESPONSE, flags, response,
|
||||
status, data_segment_length);
|
||||
}
|
||||
|
||||
+39
-11
@@ -224,7 +224,8 @@ static MemTxResult ufs_dma_read_prdt(UfsRequest *req)
|
||||
|
||||
for (uint16_t i = 0; i < prdt_len; ++i) {
|
||||
hwaddr data_dma_addr = le64_to_cpu(prd_entries[i].addr);
|
||||
uint32_t data_byte_count = le32_to_cpu(prd_entries[i].size) + 1;
|
||||
uint32_t data_byte_count =
|
||||
(le32_to_cpu(prd_entries[i].size) & 0x3ffff) + 1;
|
||||
qemu_sglist_add(req->sg, data_dma_addr, data_byte_count);
|
||||
req->data_len += data_byte_count;
|
||||
}
|
||||
@@ -446,17 +447,30 @@ static void ufs_mcq_process_cq(void *opaque)
|
||||
|
||||
QTAILQ_FOREACH_SAFE(req, &cq->req_list, entry, next)
|
||||
{
|
||||
if (ufs_mcq_cq_full(u, cq->cqid)) {
|
||||
break;
|
||||
}
|
||||
|
||||
ufs_dma_write_rsp_upiu(req);
|
||||
|
||||
req->cqe.utp_addr =
|
||||
((uint64_t)req->utrd.command_desc_base_addr_hi << 32ULL) |
|
||||
req->utrd.command_desc_base_addr_lo;
|
||||
req->cqe.utp_addr |= req->sq->sqid;
|
||||
req->cqe.resp_len = req->utrd.response_upiu_length;
|
||||
req->cqe.resp_off = req->utrd.response_upiu_offset;
|
||||
req->cqe.prdt_len = req->utrd.prd_table_length;
|
||||
req->cqe.prdt_off = req->utrd.prd_table_offset;
|
||||
req->cqe.status = req->utrd.header.dword_2 & 0xf;
|
||||
/* UTRD/CQE are LE; round-trip through host to keep BE correct. */
|
||||
uint64_t ucdba =
|
||||
((uint64_t)le32_to_cpu(req->utrd.command_desc_base_addr_hi)
|
||||
<< 32ULL) |
|
||||
le32_to_cpu(req->utrd.command_desc_base_addr_lo);
|
||||
uint16_t resp_len = le16_to_cpu(req->utrd.response_upiu_length);
|
||||
uint16_t resp_off = le16_to_cpu(req->utrd.response_upiu_offset);
|
||||
uint16_t prdt_len = le16_to_cpu(req->utrd.prd_table_length);
|
||||
uint16_t prdt_off = le16_to_cpu(req->utrd.prd_table_offset);
|
||||
uint8_t status = le32_to_cpu(req->utrd.header.dword_2) & UFS_MASK_OCS;
|
||||
|
||||
ucdba |= req->sq->sqid;
|
||||
req->cqe.utp_addr = cpu_to_le64(ucdba);
|
||||
req->cqe.resp_len = cpu_to_le16(resp_len);
|
||||
req->cqe.resp_off = cpu_to_le16(resp_off);
|
||||
req->cqe.prdt_len = cpu_to_le16(prdt_len);
|
||||
req->cqe.prdt_off = cpu_to_le16(prdt_off);
|
||||
req->cqe.status = status;
|
||||
req->cqe.error = 0;
|
||||
|
||||
ret = ufs_addr_write(u, cq->addr + tail, &req->cqe, sizeof(req->cqe));
|
||||
@@ -468,6 +482,12 @@ static void ufs_mcq_process_cq(void *opaque)
|
||||
tail = (tail + sizeof(req->cqe)) % (cq->size * sizeof(req->cqe));
|
||||
ufs_mcq_update_cq_tail(u, cq->cqid, tail);
|
||||
|
||||
if (QTAILQ_EMPTY(&req->sq->req_list) &&
|
||||
!ufs_mcq_sq_empty(u, req->sq->sqid)) {
|
||||
/* Dequeueing from SQ was blocked due to lack of free requests */
|
||||
qemu_bh_schedule(req->sq->bh);
|
||||
}
|
||||
|
||||
ufs_clear_req(req);
|
||||
QTAILQ_INSERT_TAIL(&req->sq->req_list, req, entry);
|
||||
}
|
||||
@@ -777,10 +797,18 @@ static void ufs_write_mcq_op_reg(UfsHc *u, hwaddr offset, uint32_t data,
|
||||
}
|
||||
opr->sq.tp = data;
|
||||
break;
|
||||
case offsetof(UfsMcqOpReg, cq.hp):
|
||||
case offsetof(UfsMcqOpReg, cq.hp): {
|
||||
UfsCq *cq = u->cq[qid];
|
||||
|
||||
if (ufs_mcq_cq_full(u, qid) && !QTAILQ_EMPTY(&cq->req_list)) {
|
||||
/* Enqueueing to CQ was blocked because it was full */
|
||||
qemu_bh_schedule(cq->bh);
|
||||
}
|
||||
|
||||
opr->cq.hp = data;
|
||||
ufs_mcq_update_cq_head(u, qid, data);
|
||||
break;
|
||||
}
|
||||
case offsetof(UfsMcqOpReg, cq_int.is):
|
||||
opr->cq_int.is &= ~data;
|
||||
break;
|
||||
|
||||
@@ -200,6 +200,15 @@ static inline bool ufs_mcq_cq_empty(UfsHc *u, uint32_t qid)
|
||||
return ufs_mcq_cq_tail(u, qid) == ufs_mcq_cq_head(u, qid);
|
||||
}
|
||||
|
||||
static inline bool ufs_mcq_cq_full(UfsHc *u, uint32_t qid)
|
||||
{
|
||||
uint32_t tail = ufs_mcq_cq_tail(u, qid);
|
||||
uint16_t cq_size = u->cq[qid]->size;
|
||||
|
||||
tail = (tail + sizeof(UfsCqEntry)) % (sizeof(UfsCqEntry) * cq_size);
|
||||
return tail == ufs_mcq_cq_head(u, qid);
|
||||
}
|
||||
|
||||
#define TYPE_UFS "ufs"
|
||||
#define UFS(obj) OBJECT_CHECK(UfsHc, (obj), TYPE_UFS)
|
||||
|
||||
|
||||
@@ -905,7 +905,7 @@ static int vhost_vdpa_reset_device(struct vhost_dev *dev)
|
||||
|
||||
memory_listener_unregister(&v->shared->listener);
|
||||
v->shared->listener_registered = false;
|
||||
v->suspended = false;
|
||||
v->shared->suspended = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1354,7 +1354,7 @@ static void vhost_vdpa_suspend(struct vhost_dev *dev)
|
||||
if (unlikely(r)) {
|
||||
error_report("Cannot suspend: %s(%d)", g_strerror(errno), errno);
|
||||
} else {
|
||||
v->suspended = true;
|
||||
v->shared->suspended = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!v->suspended) {
|
||||
if (!v->shared->suspended) {
|
||||
/*
|
||||
* Cannot trust in value returned by device, let vhost recover used
|
||||
* idx from guest.
|
||||
|
||||
@@ -767,11 +767,18 @@ virtio_crypto_handle_asym_req(VirtIOCrypto *vcrypto,
|
||||
uint32_t len;
|
||||
uint8_t *src = NULL;
|
||||
uint8_t *dst = NULL;
|
||||
uint64_t max_len;
|
||||
|
||||
asym_op_info = g_new0(CryptoDevBackendAsymOpInfo, 1);
|
||||
src_len = ldl_le_p(&req->para.src_data_len);
|
||||
dst_len = ldl_le_p(&req->para.dst_data_len);
|
||||
|
||||
max_len = (uint64_t)src_len + dst_len;
|
||||
if (unlikely(max_len > vcrypto->conf.max_size)) {
|
||||
virtio_error(vdev, "virtio-crypto asym request is too large");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (src_len > 0) {
|
||||
src = g_malloc0(src_len);
|
||||
len = iov_to_buf(iov, out_num, 0, src, src_len);
|
||||
|
||||
+11
-9
@@ -2183,15 +2183,17 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
|
||||
PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar);
|
||||
}
|
||||
|
||||
if (pci_is_vf(&proxy->pci_dev)) {
|
||||
pcie_ari_init(&proxy->pci_dev, proxy->last_pcie_cap_offset);
|
||||
proxy->last_pcie_cap_offset += PCI_ARI_SIZEOF;
|
||||
} else {
|
||||
res = pcie_sriov_pf_init_from_user_created_vfs(
|
||||
&proxy->pci_dev, proxy->last_pcie_cap_offset, errp);
|
||||
if (res > 0) {
|
||||
proxy->last_pcie_cap_offset += res;
|
||||
virtio_add_feature(&vdev->host_features, VIRTIO_F_SR_IOV);
|
||||
if (pci_is_express(&proxy->pci_dev)) {
|
||||
if (pci_is_vf(&proxy->pci_dev)) {
|
||||
pcie_ari_init(&proxy->pci_dev, proxy->last_pcie_cap_offset);
|
||||
proxy->last_pcie_cap_offset += PCI_ARI_SIZEOF;
|
||||
} else {
|
||||
res = pcie_sriov_pf_init_from_user_created_vfs(
|
||||
&proxy->pci_dev, proxy->last_pcie_cap_offset, errp);
|
||||
if (res > 0) {
|
||||
proxy->last_pcie_cap_offset += res;
|
||||
virtio_add_feature(&vdev->host_features, VIRTIO_F_SR_IOV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
|
||||
trace_virtio_pmem_flush_request();
|
||||
req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
|
||||
if (!req_data) {
|
||||
virtio_error(vdev, "virtio-pmem missing request data");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+19
-3
@@ -258,10 +258,12 @@ void virtio_init_region_cache(VirtIODevice *vdev, int n)
|
||||
len = address_space_cache_init(&new->desc, vdev->dma_as,
|
||||
addr, size, packed);
|
||||
if (len < size) {
|
||||
g_autofree const char *devname = qdev_get_printable_name(DEVICE(vdev));
|
||||
|
||||
virtio_error(vdev,
|
||||
"Failed to map descriptor ring for device %s: "
|
||||
"invalid guest physical address or corrupted queue setup",
|
||||
qdev_get_printable_name(DEVICE(vdev)));
|
||||
devname);
|
||||
goto err_desc;
|
||||
}
|
||||
|
||||
@@ -269,10 +271,12 @@ void virtio_init_region_cache(VirtIODevice *vdev, int n)
|
||||
len = address_space_cache_init(&new->used, vdev->dma_as,
|
||||
vq->vring.used, size, true);
|
||||
if (len < size) {
|
||||
g_autofree const char *devname = qdev_get_printable_name(DEVICE(vdev));
|
||||
|
||||
virtio_error(vdev,
|
||||
"Failed to map used ring for device %s: "
|
||||
"possible guest misconfiguration or insufficient memory",
|
||||
qdev_get_printable_name(DEVICE(vdev)));
|
||||
devname);
|
||||
goto err_used;
|
||||
}
|
||||
|
||||
@@ -280,10 +284,12 @@ void virtio_init_region_cache(VirtIODevice *vdev, int n)
|
||||
len = address_space_cache_init(&new->avail, vdev->dma_as,
|
||||
vq->vring.avail, size, false);
|
||||
if (len < size) {
|
||||
g_autofree const char *devname = qdev_get_printable_name(DEVICE(vdev));
|
||||
|
||||
virtio_error(vdev,
|
||||
"Failed to map avalaible ring for device %s: "
|
||||
"possible queue misconfiguration or overlapping memory region",
|
||||
qdev_get_printable_name(DEVICE(vdev)));
|
||||
devname);
|
||||
goto err_avail;
|
||||
}
|
||||
|
||||
@@ -4475,3 +4481,13 @@ QEMUBH *virtio_bh_new_guarded_full(DeviceState *dev,
|
||||
return qemu_bh_new_full(cb, opaque, name,
|
||||
&transport->mem_reentrancy_guard);
|
||||
}
|
||||
|
||||
QEMUBH *virtio_bh_io_new_guarded_full(DeviceState *dev,
|
||||
QEMUBHFunc *cb, void *opaque,
|
||||
const char *name)
|
||||
{
|
||||
DeviceState *transport = qdev_get_parent_bus(dev)->parent;
|
||||
|
||||
return aio_bh_new_full(iohandler_get_aio_context(), cb, opaque, name,
|
||||
&transport->mem_reentrancy_guard);
|
||||
}
|
||||
@@ -35,8 +35,7 @@
|
||||
|
||||
typedef struct ThrottleGroupMember {
|
||||
AioContext *aio_context;
|
||||
/* throttled_reqs_lock protects the CoQueues for throttled requests. */
|
||||
CoMutex throttled_reqs_lock;
|
||||
/* Protected by ThrottleGroup.lock */
|
||||
CoQueue throttled_reqs[THROTTLE_MAX];
|
||||
|
||||
/* Nonzero if the I/O limits are currently being ignored; generally
|
||||
|
||||
+1
-1
@@ -645,7 +645,7 @@ enum UtpOcsCodes {
|
||||
};
|
||||
|
||||
enum {
|
||||
UFS_MASK_OCS = 0x0F,
|
||||
UFS_MASK_OCS = 0xFF,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -43,4 +43,6 @@ int io_channel_send(QIOChannel *ioc, const void *buf, size_t len);
|
||||
int io_channel_send_full(QIOChannel *ioc, const void *buf, size_t len,
|
||||
int *fds, size_t nfds);
|
||||
|
||||
void remove_listener_fd_in_watch(Chardev *chr);
|
||||
|
||||
#endif /* CHAR_IO_H */
|
||||
@@ -307,6 +307,8 @@ struct ChardevClass {
|
||||
|
||||
/* handle various events */
|
||||
void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
|
||||
|
||||
void (*chr_listener_cleanup)(Chardev *chr);
|
||||
};
|
||||
|
||||
Chardev *qemu_chardev_new(const char *id, const char *typename,
|
||||
|
||||
@@ -36,8 +36,7 @@ OBJECT_DECLARE_TYPE(AspeedI2CState, AspeedI2CClass, ASPEED_I2C)
|
||||
#define ASPEED_I2C_NR_BUSSES 16
|
||||
#define ASPEED_I2C_SHARE_POOL_SIZE 0x800
|
||||
#define ASPEED_I2C_BUS_POOL_SIZE 0x20
|
||||
#define ASPEED_I2C_OLD_NUM_REG 11
|
||||
#define ASPEED_I2C_NEW_NUM_REG 28
|
||||
#define ASPEED_I2C_NEW_NUM_REG (0x80 >> 2)
|
||||
|
||||
#define A_I2CD_M_STOP_CMD BIT(5)
|
||||
#define A_I2CD_M_RX_CMD BIT(3)
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "net/net.h"
|
||||
|
||||
#define NPCM_GMAC_NR_REGS (0x1060 / sizeof(uint32_t))
|
||||
#define NPCM_GMAC_REG_SIZE 0x1060
|
||||
#define NPCM_GMAC_NR_REGS (NPCM_GMAC_REG_SIZE / sizeof(uint32_t))
|
||||
|
||||
#define NPCM_GMAC_MAX_PHYS 32
|
||||
#define NPCM_GMAC_MAX_PHY_REGS 32
|
||||
|
||||
@@ -1065,6 +1065,22 @@ bool qdev_set_parent_bus(DeviceState *dev, BusState *bus, Error **errp);
|
||||
extern bool qdev_hot_removed;
|
||||
|
||||
char *qdev_get_dev_path(DeviceState *dev);
|
||||
|
||||
/**
|
||||
* qdev_get_printable_name: Return human readable name for device
|
||||
* @dev: Device to get name of
|
||||
*
|
||||
* Returns: A newly allocated string containing some human
|
||||
* readable name for the device, suitable for printing in
|
||||
* user-facing error messages. The function will never return NULL,
|
||||
* so the name can be used without further checking or fallbacks.
|
||||
*
|
||||
* If the device has an explicitly set ID (e.g. by the user on the
|
||||
* command line via "-device thisdev,id=myid") this is preferred.
|
||||
* Otherwise we try the canonical QOM device path (which will be
|
||||
* the PCI ID for PCI devices, for example). If all else fails
|
||||
* we will return the placeholder "<unknown device">.
|
||||
*/
|
||||
const char *qdev_get_printable_name(DeviceState *dev);
|
||||
|
||||
void qbus_set_hotplug_handler(BusState *bus, Object *handler);
|
||||
|
||||
@@ -76,6 +76,12 @@ typedef struct vhost_vdpa_shared {
|
||||
|
||||
/* SVQ switching is in progress, or already completed? */
|
||||
SVQTransitionState svq_switching;
|
||||
|
||||
/*
|
||||
* Device suspended successfully.
|
||||
* The vhost_vdpa devices cannot have different suspended states.
|
||||
*/
|
||||
bool suspended;
|
||||
} VhostVDPAShared;
|
||||
|
||||
typedef struct vhost_vdpa {
|
||||
@@ -83,8 +89,6 @@ typedef struct vhost_vdpa {
|
||||
uint32_t address_space_id;
|
||||
uint64_t acked_features;
|
||||
bool shadow_vqs_enabled;
|
||||
/* Device suspended successfully */
|
||||
bool suspended;
|
||||
VhostVDPAShared *shared;
|
||||
GPtrArray *shadow_vqs;
|
||||
const VhostShadowVirtqueueOps *shadow_vq_ops;
|
||||
|
||||
@@ -547,4 +547,14 @@ QEMUBH *virtio_bh_new_guarded_full(DeviceState *dev,
|
||||
#define virtio_bh_new_guarded(dev, cb, opaque) \
|
||||
virtio_bh_new_guarded_full((dev), (cb), (opaque), (stringify(cb)))
|
||||
|
||||
/*
|
||||
* The "_io" variant runs BH only on a main-loop thread, while generic BH
|
||||
* may run on a vCPU thread.
|
||||
*/
|
||||
QEMUBH *virtio_bh_io_new_guarded_full(DeviceState *dev,
|
||||
QEMUBHFunc *cb, void *opaque,
|
||||
const char *name);
|
||||
#define virtio_bh_io_new_guarded(dev, cb, opaque) \
|
||||
virtio_bh_io_new_guarded_full((dev), (cb), (opaque), (stringify(cb)))
|
||||
|
||||
#endif
|
||||
+21
-8
@@ -96,7 +96,7 @@ typedef void (*QIOTaskWorker)(QIOTask *task,
|
||||
* 1000,
|
||||
* myobject_operation_timer,
|
||||
* task,
|
||||
* NULL);
|
||||
* qio_task_free);
|
||||
* }
|
||||
* </programlisting>
|
||||
* </example>
|
||||
@@ -138,9 +138,8 @@ typedef void (*QIOTaskWorker)(QIOTask *task,
|
||||
* the callback func 'myobject_operation_notify' shown
|
||||
* earlier to deal with the results.
|
||||
*
|
||||
* Once this function returns false, object_unref will be called
|
||||
* automatically on the task causing it to be released and the
|
||||
* ref on QMyObject dropped too.
|
||||
* Once this function returns FALSE, the task will be freed,
|
||||
* causing it release the ref on QMyObject too.
|
||||
*
|
||||
* The QIOTask module can also be used to perform operations
|
||||
* in a background thread context, while still reporting the
|
||||
@@ -208,8 +207,8 @@ typedef void (*QIOTaskWorker)(QIOTask *task,
|
||||
* 'err' attribute in the task object to determine if
|
||||
* the operation was successful or not.
|
||||
*
|
||||
* The returned task will be released when qio_task_complete()
|
||||
* is invoked.
|
||||
* The returned task must be released by calling
|
||||
* qio_task_free() when no longer required.
|
||||
*
|
||||
* Returns: the task struct
|
||||
*/
|
||||
@@ -218,6 +217,19 @@ QIOTask *qio_task_new(Object *source,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy);
|
||||
|
||||
/**
|
||||
* qio_task_free:
|
||||
* task: the task object to free
|
||||
*
|
||||
* Free the resources associated with the task. Typically
|
||||
* the qio_task_complete() method will be called immediately
|
||||
* before this to trigger the task callback, however, it is
|
||||
* permissible to free the task in the case of cancellation.
|
||||
* The destroy callback will be used to release the opaque
|
||||
* data provided to qio_task_new().
|
||||
*/
|
||||
void qio_task_free(QIOTask *task);
|
||||
|
||||
/**
|
||||
* qio_task_run_in_thread:
|
||||
* @task: the task struct
|
||||
@@ -268,8 +280,9 @@ void qio_task_wait_thread(QIOTask *task);
|
||||
* qio_task_complete:
|
||||
* @task: the task struct
|
||||
*
|
||||
* Invoke the completion callback for @task and
|
||||
* then free its memory.
|
||||
* Invoke the completion callback for @task. This should typically
|
||||
* only be invoked once on a task, and then qio_task_free() used
|
||||
* to free it.
|
||||
*/
|
||||
void qio_task_complete(QIOTask *task);
|
||||
|
||||
|
||||
+43
-21
@@ -153,13 +153,32 @@ struct QIOChannelTLSData {
|
||||
};
|
||||
typedef struct QIOChannelTLSData QIOChannelTLSData;
|
||||
|
||||
static void qio_channel_tls_io_data_free(gpointer user_data)
|
||||
{
|
||||
QIOChannelTLSData *data = user_data;
|
||||
/*
|
||||
* Usually 'task' will be NULL since the GSource
|
||||
* callback will either complete the task or pass
|
||||
* it on to a new GSource. We'll see a non-NULL
|
||||
* task here only if the GSource was released before
|
||||
* its callback triggers
|
||||
*/
|
||||
if (data->task) {
|
||||
qio_task_free(data->task);
|
||||
}
|
||||
if (data->context) {
|
||||
g_main_context_unref(data->context);
|
||||
}
|
||||
g_free(data);
|
||||
}
|
||||
|
||||
static gboolean qio_channel_tls_handshake_io(QIOChannel *ioc,
|
||||
GIOCondition condition,
|
||||
gpointer user_data);
|
||||
|
||||
static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,
|
||||
QIOTask *task,
|
||||
GMainContext *context)
|
||||
static gboolean qio_channel_tls_handshake_task(QIOChannelTLS *ioc,
|
||||
QIOTask *task,
|
||||
GMainContext *context)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int status;
|
||||
@@ -170,7 +189,7 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,
|
||||
trace_qio_channel_tls_handshake_fail(ioc);
|
||||
qio_task_set_error(task, err);
|
||||
qio_task_complete(task);
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (status == QCRYPTO_TLS_HANDSHAKE_COMPLETE) {
|
||||
@@ -183,6 +202,7 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,
|
||||
trace_qio_channel_tls_credentials_allow(ioc);
|
||||
}
|
||||
qio_task_complete(task);
|
||||
return TRUE;
|
||||
} else {
|
||||
GIOCondition condition;
|
||||
QIOChannelTLSData *data = g_new0(typeof(*data), 1);
|
||||
@@ -206,8 +226,9 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,
|
||||
condition,
|
||||
qio_channel_tls_handshake_io,
|
||||
data,
|
||||
NULL,
|
||||
qio_channel_tls_io_data_free,
|
||||
context);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,11 +244,9 @@ static gboolean qio_channel_tls_handshake_io(QIOChannel *ioc,
|
||||
qio_task_get_source(task));
|
||||
|
||||
tioc->hs_ioc_tag = 0;
|
||||
g_free(data);
|
||||
qio_channel_tls_handshake_task(tioc, task, context);
|
||||
|
||||
if (context) {
|
||||
g_main_context_unref(context);
|
||||
if (!qio_channel_tls_handshake_task(tioc, task, context)) {
|
||||
/* task is kept by new GSource so must not be released yet */
|
||||
data->task = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -250,14 +269,16 @@ void qio_channel_tls_handshake(QIOChannelTLS *ioc,
|
||||
func, opaque, destroy);
|
||||
|
||||
trace_qio_channel_tls_handshake_start(ioc);
|
||||
qio_channel_tls_handshake_task(ioc, task, context);
|
||||
if (qio_channel_tls_handshake_task(ioc, task, context)) {
|
||||
qio_task_free(task);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean qio_channel_tls_bye_io(QIOChannel *ioc, GIOCondition condition,
|
||||
gpointer user_data);
|
||||
|
||||
static void qio_channel_tls_bye_task(QIOChannelTLS *ioc, QIOTask *task,
|
||||
GMainContext *context)
|
||||
static gboolean qio_channel_tls_bye_task(QIOChannelTLS *ioc, QIOTask *task,
|
||||
GMainContext *context)
|
||||
{
|
||||
GIOCondition condition;
|
||||
QIOChannelTLSData *data;
|
||||
@@ -270,12 +291,12 @@ static void qio_channel_tls_bye_task(QIOChannelTLS *ioc, QIOTask *task,
|
||||
trace_qio_channel_tls_bye_fail(ioc);
|
||||
qio_task_set_error(task, err);
|
||||
qio_task_complete(task);
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (status == QCRYPTO_TLS_BYE_COMPLETE) {
|
||||
qio_task_complete(task);
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data = g_new0(typeof(*data), 1);
|
||||
@@ -295,7 +316,10 @@ static void qio_channel_tls_bye_task(QIOChannelTLS *ioc, QIOTask *task,
|
||||
trace_qio_channel_tls_bye_pending(ioc, status);
|
||||
ioc->bye_ioc_tag = qio_channel_add_watch_full(ioc->master, condition,
|
||||
qio_channel_tls_bye_io,
|
||||
data, NULL, context);
|
||||
data,
|
||||
qio_channel_tls_io_data_free,
|
||||
context);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -308,11 +332,9 @@ static gboolean qio_channel_tls_bye_io(QIOChannel *ioc, GIOCondition condition,
|
||||
QIOChannelTLS *tioc = QIO_CHANNEL_TLS(qio_task_get_source(task));
|
||||
|
||||
tioc->bye_ioc_tag = 0;
|
||||
g_free(data);
|
||||
qio_channel_tls_bye_task(tioc, task, context);
|
||||
|
||||
if (context) {
|
||||
g_main_context_unref(context);
|
||||
if (!qio_channel_tls_bye_task(tioc, task, context)) {
|
||||
/* task is kept by new GSource so must not be released yet */
|
||||
data->task = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
+35
-11
@@ -526,11 +526,32 @@ static int qio_channel_websock_handshake_read(QIOChannelWebsock *ioc,
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef struct QIOChannelWebsockData {
|
||||
QIOTask *task;
|
||||
} QIOChannelWebsockData;
|
||||
|
||||
static void qio_channel_websock_data_free(gpointer user_data)
|
||||
{
|
||||
QIOChannelWebsockData *data = user_data;
|
||||
/*
|
||||
* Usually 'task' will be NULL since the GSource
|
||||
* callback will either complete the task or pass
|
||||
* it on to a new GSource. We'll see a non-NULL
|
||||
* task here only if the GSource was released before
|
||||
* its callback triggers
|
||||
*/
|
||||
if (data->task) {
|
||||
qio_task_free(data->task);
|
||||
}
|
||||
g_free(data);
|
||||
}
|
||||
|
||||
static gboolean qio_channel_websock_handshake_send(QIOChannel *ioc,
|
||||
GIOCondition condition,
|
||||
gpointer user_data)
|
||||
{
|
||||
QIOTask *task = user_data;
|
||||
QIOChannelWebsockData *data = user_data;
|
||||
QIOTask *task = data->task;
|
||||
QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(
|
||||
qio_task_get_source(task));
|
||||
Error *err = NULL;
|
||||
@@ -572,7 +593,8 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
|
||||
GIOCondition condition,
|
||||
gpointer user_data)
|
||||
{
|
||||
QIOTask *task = user_data;
|
||||
QIOChannelWebsockData *data = user_data, *newdata = NULL;
|
||||
QIOTask *task = data->task;
|
||||
QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(
|
||||
qio_task_get_source(task));
|
||||
Error *err = NULL;
|
||||
@@ -600,12 +622,14 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
|
||||
error_propagate(&wioc->io_err, err);
|
||||
|
||||
trace_qio_channel_websock_handshake_reply(ioc);
|
||||
newdata = g_new0(QIOChannelWebsockData, 1);
|
||||
newdata->task = g_steal_pointer(&data->task);
|
||||
wioc->hs_io_tag = qio_channel_add_watch(
|
||||
wioc->master,
|
||||
G_IO_OUT,
|
||||
qio_channel_websock_handshake_send,
|
||||
task,
|
||||
NULL);
|
||||
newdata,
|
||||
qio_channel_websock_data_free);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -901,12 +925,12 @@ void qio_channel_websock_handshake(QIOChannelWebsock *ioc,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy)
|
||||
{
|
||||
QIOTask *task;
|
||||
QIOChannelWebsockData *data = g_new0(QIOChannelWebsockData, 1);
|
||||
|
||||
task = qio_task_new(OBJECT(ioc),
|
||||
func,
|
||||
opaque,
|
||||
destroy);
|
||||
data->task = qio_task_new(OBJECT(ioc),
|
||||
func,
|
||||
opaque,
|
||||
destroy);
|
||||
|
||||
trace_qio_channel_websock_handshake_start(ioc);
|
||||
trace_qio_channel_websock_handshake_pending(ioc, G_IO_IN);
|
||||
@@ -914,8 +938,8 @@ void qio_channel_websock_handshake(QIOChannelWebsock *ioc,
|
||||
ioc->master,
|
||||
G_IO_IN,
|
||||
qio_channel_websock_handshake_io,
|
||||
task,
|
||||
NULL);
|
||||
data,
|
||||
qio_channel_websock_data_free);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,8 +70,12 @@ QIOTask *qio_task_new(Object *source,
|
||||
return task;
|
||||
}
|
||||
|
||||
static void qio_task_free(QIOTask *task)
|
||||
void qio_task_free(QIOTask *task)
|
||||
{
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_mutex_lock(&task->thread_lock);
|
||||
if (task->thread) {
|
||||
if (task->thread->destroy) {
|
||||
@@ -110,6 +114,7 @@ static gboolean qio_task_thread_result(gpointer opaque)
|
||||
|
||||
trace_qio_task_thread_result(task);
|
||||
qio_task_complete(task);
|
||||
qio_task_free(task);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -196,7 +201,6 @@ void qio_task_complete(QIOTask *task)
|
||||
{
|
||||
task->func(task, task->opaque);
|
||||
trace_qio_task_complete(task);
|
||||
qio_task_free(task);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
|
||||
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
|
||||
#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
|
||||
#define TARGET_O_LARGEFILE 0400000
|
||||
|
||||
#include "../generic/fcntl.h"
|
||||
#endif
|
||||
@@ -17,6 +17,29 @@ struct target_termios {
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
struct target_termios2 {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_cc_t c_line; /* line discipline (== c_cc[19]) */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
struct target_ktermios {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_cc_t c_line; /* line discipline (== c_cc[19]) */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
|
||||
/* c_cc characters */
|
||||
#define TARGET_VEOF 0
|
||||
#define TARGET_VEOL 1
|
||||
@@ -126,6 +149,7 @@ struct target_termios {
|
||||
#define TARGET_B3000000 00034
|
||||
#define TARGET_B3500000 00035
|
||||
#define TARGET_B4000000 00036
|
||||
#define TARGET_BOTHER 00037
|
||||
|
||||
#define TARGET_CSIZE 00001400
|
||||
#define TARGET_CS5 00000000
|
||||
@@ -247,6 +271,12 @@ struct target_termios {
|
||||
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
|
||||
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
|
||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||
#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2)
|
||||
#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2)
|
||||
#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2)
|
||||
#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2)
|
||||
#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485)
|
||||
#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||
|
||||
@@ -708,7 +708,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
||||
NEW_AUX_ENT(AT_EXECFN, info->file_string);
|
||||
|
||||
if (HAVE_ELF_HWCAP2) {
|
||||
NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap(thread_cpu));
|
||||
NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap2(thread_cpu));
|
||||
}
|
||||
if (u_base_platform) {
|
||||
NEW_AUX_ENT(AT_BASE_PLATFORM, u_base_platform);
|
||||
|
||||
@@ -157,7 +157,7 @@ struct target_ktermios {
|
||||
#define TARGET_B3000000 0010015
|
||||
#define TARGET_B3500000 0010016
|
||||
#define TARGET_B4000000 0010017
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate */
|
||||
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 020000000000 /* flow control */
|
||||
|
||||
|
||||
@@ -18,6 +18,29 @@ struct target_termios {
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
};
|
||||
|
||||
struct target_termios2 {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
struct target_ktermios {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
|
||||
/* c_iflag bits */
|
||||
#define TARGET_IGNBRK 0000001
|
||||
#define TARGET_BRKINT 0000002
|
||||
@@ -100,14 +123,28 @@ struct target_termios {
|
||||
#define TARGET_HUPCL 0002000
|
||||
#define TARGET_CLOCAL 0004000
|
||||
#define TARGET_CBAUDEX 0010000
|
||||
#define TARGET_BOTHER 0010000
|
||||
#define TARGET_B57600 0010001
|
||||
#define TARGET_B115200 0010002
|
||||
#define TARGET_B230400 0010003
|
||||
#define TARGET_B460800 0010004
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
#define TARGET_B500000 0010005
|
||||
#define TARGET_B576000 0010006
|
||||
#define TARGET_B921600 0010007
|
||||
#define TARGET_B1000000 0010010
|
||||
#define TARGET_B1152000 0010011
|
||||
#define TARGET_B1500000 0010012
|
||||
#define TARGET_B2000000 0010013
|
||||
#define TARGET_B2500000 0010014
|
||||
#define TARGET_B3000000 0010015
|
||||
#define TARGET_B3500000 0010016
|
||||
#define TARGET_B4000000 0010017
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate */
|
||||
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 020000000000 /* flow control */
|
||||
|
||||
#define TARGET_IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
|
||||
|
||||
/* c_lflag bits */
|
||||
#define TARGET_ISIG 0000001
|
||||
#define TARGET_ICANON 0000002
|
||||
@@ -190,6 +227,12 @@ struct target_termios {
|
||||
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
|
||||
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
|
||||
#define TARGET_TIOCGSID TARGET_IOR('T', 20, int)
|
||||
#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2)
|
||||
#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2)
|
||||
#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2)
|
||||
#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2)
|
||||
#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485)
|
||||
#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('T', 0x30, unsigned int)
|
||||
/* Get Pty Number (of pty-mux device) */
|
||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
||||
|
||||
+7
-1
@@ -1,5 +1,11 @@
|
||||
/* emulated ioctl list */
|
||||
|
||||
#ifdef TARGET_TCGETS2
|
||||
IOCTL(TCGETS2, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios2)))
|
||||
IOCTL(TCSETS2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2)))
|
||||
IOCTL(TCSETSW2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2)))
|
||||
IOCTL(TCSETSF2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2)))
|
||||
#endif
|
||||
IOCTL(TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL(TCSETS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL(TCSETSF, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
@@ -20,7 +26,7 @@
|
||||
IOCTL(TIOCSCTTY, 0, TYPE_INT)
|
||||
IOCTL(TIOCGPGRP, IOC_R, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCSPGRP, IOC_W, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCGSID, IOC_W, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCGSID, IOC_R, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCOUTQ, IOC_R, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCSTI, IOC_W, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCMGET, IOC_R, MK_PTR(TYPE_INT))
|
||||
|
||||
@@ -145,6 +145,7 @@ unsigned long guest_stack_size = TARGET_DEFAULT_STACK_SIZE;
|
||||
void fork_start(void)
|
||||
{
|
||||
start_exclusive();
|
||||
clone_fork_start();
|
||||
mmap_fork_start();
|
||||
cpu_list_lock();
|
||||
qemu_plugin_user_prefork_lock();
|
||||
@@ -174,6 +175,7 @@ void fork_end(pid_t pid)
|
||||
cpu_list_unlock();
|
||||
}
|
||||
gdbserver_fork_end(thread_cpu, pid);
|
||||
clone_fork_end(child);
|
||||
/*
|
||||
* qemu_init_cpu_list() reinitialized the child exclusive state, but we
|
||||
* also need to keep current_cpu consistent, so call end_exclusive() for
|
||||
|
||||
@@ -18,6 +18,29 @@ struct target_termios {
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
};
|
||||
|
||||
struct target_termios2 {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
struct target_ktermios {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
|
||||
/* c_iflag bits */
|
||||
#define TARGET_IGNBRK 0000001
|
||||
#define TARGET_BRKINT 0000002
|
||||
@@ -116,10 +139,12 @@ struct target_termios {
|
||||
#define TARGET_B3000000 0010015
|
||||
#define TARGET_B3500000 0010016
|
||||
#define TARGET_B4000000 0010017
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate */
|
||||
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 020000000000 /* flow control */
|
||||
|
||||
#define TARGET_IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
|
||||
|
||||
/* c_lflag bits */
|
||||
#define TARGET_ISIG 0000001
|
||||
#define TARGET_ICANON 0000002
|
||||
@@ -227,10 +252,10 @@ struct target_termios {
|
||||
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
|
||||
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
|
||||
#define TARGET_TIOCGSID 0x7416 /* Return the session ID of FD */
|
||||
#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct termios2)
|
||||
#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct termios2)
|
||||
#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct termios2)
|
||||
#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct termios2)
|
||||
#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2)
|
||||
#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2)
|
||||
#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2)
|
||||
#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2)
|
||||
#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485)
|
||||
#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||
|
||||
+16
-9
@@ -423,12 +423,15 @@ abi_ulong mmap_next_start;
|
||||
static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size,
|
||||
abi_ulong align)
|
||||
{
|
||||
target_ulong ret;
|
||||
target_ulong ret = -1;
|
||||
|
||||
ret = page_find_range_empty(start, reserved_va, size, align);
|
||||
if (start <= reserved_va) {
|
||||
ret = page_find_range_empty(start, reserved_va, size, align);
|
||||
}
|
||||
if (ret == -1 && start > mmap_min_addr) {
|
||||
/* Restart at the beginning of the address space. */
|
||||
ret = page_find_range_empty(mmap_min_addr, start - 1, size, align);
|
||||
ret = page_find_range_empty(mmap_min_addr, MIN(start - 1, reserved_va),
|
||||
size, align);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1029,9 +1032,9 @@ static int mmap_reserve_or_unmap(abi_ulong start, abi_ulong len)
|
||||
void *host_start;
|
||||
int prot;
|
||||
|
||||
last = start + len - 1;
|
||||
last = ROUND_UP(start + len, TARGET_PAGE_SIZE) - 1;
|
||||
real_start = start & -host_page_size;
|
||||
real_last = ROUND_UP(last, host_page_size) - 1;
|
||||
real_last = ROUND_UP(last + 1, host_page_size) - 1;
|
||||
|
||||
/*
|
||||
* If guest pages remain on the first or last host pages,
|
||||
@@ -1110,12 +1113,15 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
|
||||
int prot;
|
||||
void *host_addr;
|
||||
|
||||
if (!guest_range_valid_untagged(old_addr, old_size) ||
|
||||
((flags & MREMAP_FIXED) &&
|
||||
if (((flags & MREMAP_FIXED) &&
|
||||
!guest_range_valid_untagged(new_addr, new_size)) ||
|
||||
((flags & MREMAP_MAYMOVE) == 0 &&
|
||||
!guest_range_valid_untagged(old_addr, new_size))) {
|
||||
errno = ENOMEM;
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!guest_range_valid_untagged(old_addr, old_size)) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1177,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
|
||||
errno = ENOMEM;
|
||||
host_addr = MAP_FAILED;
|
||||
} else if (reserved_va && old_size > new_size) {
|
||||
mmap_reserve_or_unmap(old_addr + old_size,
|
||||
/* Re-reserve pages we just shrunk out of the mapping */
|
||||
mmap_reserve_or_unmap(old_addr + new_size,
|
||||
old_size - new_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ struct target_termios {
|
||||
#define TARGET_B3000000 00034
|
||||
#define TARGET_B3500000 00035
|
||||
#define TARGET_B4000000 00036
|
||||
#define TARGET_BOTHER 00037
|
||||
|
||||
#define TARGET_CSIZE 00001400
|
||||
#define TARGET_CS5 00000000
|
||||
|
||||
+38
-13
@@ -18,6 +18,28 @@ struct target_termios {
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
};
|
||||
|
||||
struct target_termios2 {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
struct target_ktermios {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
|
||||
/* c_cc characters */
|
||||
#define TARGET_VINTR 0
|
||||
@@ -120,6 +142,7 @@ struct target_termios {
|
||||
#define TARGET_HUPCL 0002000
|
||||
#define TARGET_CLOCAL 0004000
|
||||
#define TARGET_CBAUDEX 0010000
|
||||
#define TARGET_BOTHER 0010000
|
||||
#define TARGET_B57600 0010001
|
||||
#define TARGET_B115200 0010002
|
||||
#define TARGET_B230400 0010003
|
||||
@@ -135,10 +158,12 @@ struct target_termios {
|
||||
#define TARGET_B3000000 0010015
|
||||
#define TARGET_B3500000 0010016
|
||||
#define TARGET_B4000000 0010017
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate */
|
||||
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 020000000000 /* flow control */
|
||||
|
||||
#define TARGET_IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
|
||||
|
||||
/* c_lflag bits */
|
||||
#define TARGET_ISIG 0000001
|
||||
#define TARGET_ICANON 0000002
|
||||
@@ -251,14 +276,17 @@ struct target_termios {
|
||||
#define TARGET_TIOCNOTTY TARGET_IO('T', 34) /* 0x5422 */
|
||||
#define TARGET_TIOCSETD TARGET_IOW('T', 35, int) /* 0x5423 */
|
||||
#define TARGET_TIOCGETD TARGET_IOR('T', 36, int) /* 0x5424 */
|
||||
#define TARGET_TCSBRKP TARGET_IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcse
|
||||
ndbreak() */
|
||||
#define TARGET_TCSBRKP TARGET_IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcsendbreak() */
|
||||
#define TARGET_TIOCSBRK TARGET_IO('T', 39) /* 0x5427 */ /* BSD compatibility */
|
||||
#define TARGET_TIOCCBRK TARGET_IO('T', 40) /* 0x5428 */ /* BSD compatibility */
|
||||
#define TARGET_TIOCGSID TARGET_IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session
|
||||
ID of FD */
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-m
|
||||
ux device) */
|
||||
#define TARGET_TIOCGSID TARGET_IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */
|
||||
#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2)
|
||||
#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2)
|
||||
#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2)
|
||||
#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2)
|
||||
#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485)
|
||||
#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||
|
||||
@@ -270,8 +298,7 @@ ux device) */
|
||||
#define TARGET_TIOCSLCKTRMIOS 0x5457
|
||||
#define TARGET_TIOCSERGSTRUCT TARGET_IOR('T', 88, int) /* 0x5458 */ /* For d
|
||||
ebugging only */
|
||||
#define TARGET_TIOCSERGETLSR TARGET_IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line sta
|
||||
tus register */
|
||||
#define TARGET_TIOCSERGETLSR TARGET_IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
|
||||
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
|
||||
# define TARGET_TIOCSER_TEMT 0x01 /* Transmitter physically empty */
|
||||
#define TARGET_TIOCSERGETMULTI TARGET_IOR('T', 90, int) /* 0x545A
|
||||
@@ -279,9 +306,7 @@ tus register */
|
||||
#define TARGET_TIOCSERSETMULTI TARGET_IOW('T', 91, int) /* 0x545B
|
||||
*/ /* Set multiport config */
|
||||
|
||||
#define TARGET_TIOCMIWAIT TARGET_IO('T', 92) /* 0x545C */ /* wait for a change on
|
||||
serial input line(s) */
|
||||
#define TARGET_TIOCGICOUNT TARGET_IOR('T', 93, int) /* 0x545D */ /* read
|
||||
serial port inline interrupt counts */
|
||||
#define TARGET_TIOCMIWAIT TARGET_IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */
|
||||
#define TARGET_TIOCGICOUNT TARGET_IOR('T', 93, int) /* 0x545D */ /* read serial port inline interrupt counts */
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,28 @@ struct target_termios {
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
};
|
||||
|
||||
struct target_termios2 {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
struct target_ktermios {
|
||||
target_tcflag_t c_iflag; /* input mode flags */
|
||||
target_tcflag_t c_oflag; /* output mode flags */
|
||||
target_tcflag_t c_cflag; /* control mode flags */
|
||||
target_tcflag_t c_lflag; /* local mode flags */
|
||||
target_cc_t c_line; /* line discipline */
|
||||
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
|
||||
target_speed_t c_ispeed; /* input speed */
|
||||
target_speed_t c_ospeed; /* output speed */
|
||||
};
|
||||
|
||||
|
||||
/* c_cc characters */
|
||||
#define TARGET_VINTR 0
|
||||
@@ -128,6 +150,7 @@ struct target_termios {
|
||||
#define TARGET_HUPCL 0x00000400
|
||||
#define TARGET_CLOCAL 0x00000800
|
||||
#define TARGET_CBAUDEX 0x00001000
|
||||
#define TARGET_BOTHER 0x00001000
|
||||
/* We'll never see these speeds with the Zilogs, but for completeness... */
|
||||
#define TARGET_B57600 0x00001001
|
||||
#define TARGET_B115200 0x00001002
|
||||
@@ -154,10 +177,12 @@ struct target_termios {
|
||||
#define B3000000 0x00001011
|
||||
#define B3500000 0x00001012
|
||||
#define B4000000 0x00001013 */
|
||||
#define TARGET_CIBAUD 0x100f0000 /* input baud rate (not used) */
|
||||
#define TARGET_CIBAUD 0x100f0000 /* input baud rate */
|
||||
#define TARGET_CMSPAR 0x40000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 0x80000000 /* flow control */
|
||||
|
||||
#define TARGET_IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
|
||||
|
||||
/* c_lflag bits */
|
||||
#define TARGET_ISIG 0x00000001
|
||||
#define TARGET_ICANON 0x00000002
|
||||
@@ -251,6 +276,12 @@ struct target_termios {
|
||||
#define TARGET_TIOCGPGRP TARGET_IOR('t', 131, int)
|
||||
#define TARGET_TIOCSCTTY TARGET_IO('t', 132)
|
||||
#define TARGET_TIOCGSID TARGET_IOR('t', 133, int)
|
||||
#define TARGET_TCGETS2 TARGET_IOR('T', 12, struct target_termios2)
|
||||
#define TARGET_TCSETS2 TARGET_IOW('T', 13, struct target_termios2)
|
||||
#define TARGET_TCSETSW2 TARGET_IOW('T', 14, struct target_termios2)
|
||||
#define TARGET_TCSETSF2 TARGET_IOW('T', 15, struct target_termios2)
|
||||
#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x41, struct serial_rs485)
|
||||
#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x42, struct serial_rs485)
|
||||
/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */
|
||||
#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */
|
||||
|
||||
@@ -1935,6 +1935,75 @@ print_termios(void *arg)
|
||||
qemu_log("}");
|
||||
}
|
||||
|
||||
#ifdef TARGET_TCGETS2
|
||||
void
|
||||
print_termios2(void *arg)
|
||||
{
|
||||
const struct target_termios2 *target = arg;
|
||||
|
||||
target_tcflag_t iflags = tswap32(target->c_iflag);
|
||||
target_tcflag_t oflags = tswap32(target->c_oflag);
|
||||
target_tcflag_t cflags = tswap32(target->c_cflag);
|
||||
target_tcflag_t lflags = tswap32(target->c_lflag);
|
||||
|
||||
qemu_log("{");
|
||||
|
||||
qemu_log("c_iflag = ");
|
||||
print_flags(termios_iflags, iflags, 0);
|
||||
|
||||
qemu_log("c_oflag = ");
|
||||
target_tcflag_t oflags_clean = oflags & ~(TARGET_NLDLY | TARGET_CRDLY |
|
||||
TARGET_TABDLY | TARGET_BSDLY |
|
||||
TARGET_VTDLY | TARGET_FFDLY);
|
||||
print_flags(termios_oflags, oflags_clean, 0);
|
||||
if (oflags & TARGET_NLDLY) {
|
||||
print_enums(termios_oflags_NLDLY, oflags & TARGET_NLDLY, 0);
|
||||
}
|
||||
if (oflags & TARGET_CRDLY) {
|
||||
print_enums(termios_oflags_CRDLY, oflags & TARGET_CRDLY, 0);
|
||||
}
|
||||
if (oflags & TARGET_TABDLY) {
|
||||
print_enums(termios_oflags_TABDLY, oflags & TARGET_TABDLY, 0);
|
||||
}
|
||||
if (oflags & TARGET_BSDLY) {
|
||||
print_enums(termios_oflags_BSDLY, oflags & TARGET_BSDLY, 0);
|
||||
}
|
||||
if (oflags & TARGET_VTDLY) {
|
||||
print_enums(termios_oflags_VTDLY, oflags & TARGET_VTDLY, 0);
|
||||
}
|
||||
if (oflags & TARGET_FFDLY) {
|
||||
print_enums(termios_oflags_FFDLY, oflags & TARGET_FFDLY, 0);
|
||||
}
|
||||
|
||||
qemu_log("c_cflag = ");
|
||||
if (cflags & TARGET_CBAUD) {
|
||||
print_enums(termios_cflags_CBAUD, cflags & TARGET_CBAUD, 0);
|
||||
}
|
||||
if (cflags & TARGET_CSIZE) {
|
||||
print_enums(termios_cflags_CSIZE, cflags & TARGET_CSIZE, 0);
|
||||
}
|
||||
target_tcflag_t cflags_clean = cflags & ~(TARGET_CBAUD | TARGET_CSIZE);
|
||||
print_flags(termios_cflags, cflags_clean, 0);
|
||||
|
||||
qemu_log("c_lflag = ");
|
||||
print_flags(termios_lflags, lflags, 0);
|
||||
|
||||
qemu_log("c_ispeed = ");
|
||||
print_raw_param("%u", tswap32(target->c_ispeed), 0);
|
||||
|
||||
qemu_log("c_ospeed = ");
|
||||
print_raw_param("%u", tswap32(target->c_ospeed), 0);
|
||||
|
||||
qemu_log("c_cc = ");
|
||||
qemu_log("\"%s\",", target->c_cc);
|
||||
|
||||
qemu_log("c_line = ");
|
||||
print_raw_param("\'%c\'", target->c_line, 1);
|
||||
|
||||
qemu_log("}");
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef UNUSED
|
||||
|
||||
#ifdef TARGET_NR_accept
|
||||
|
||||
+183
-23
@@ -86,6 +86,7 @@
|
||||
#endif
|
||||
|
||||
#define termios host_termios
|
||||
#define termios2 host_termios2
|
||||
#define winsize host_winsize
|
||||
#define termio host_termio
|
||||
#define sgttyb host_sgttyb /* same as target */
|
||||
@@ -147,6 +148,21 @@
|
||||
#include "fd-trans.h"
|
||||
#include "user/cpu_loop.h"
|
||||
|
||||
#if defined(__powerpc__)
|
||||
/*
|
||||
* On PowerPC termios2 is lacking and termios along with ioctls w/o 2
|
||||
* behaves like termios2 and things with 2 on other architectures.
|
||||
*
|
||||
* Just define termios2-related things to be the same with termios-related
|
||||
* ones to support PowerPC.
|
||||
*/
|
||||
#define host_termios2 host_termios
|
||||
#define TCGETS2 TCGETS
|
||||
#define TCSETS2 TCSETS
|
||||
#define TCSETSW2 TCSETSW
|
||||
#define TCSETSF2 TCSETSF
|
||||
#endif
|
||||
|
||||
#ifndef CLONE_IO
|
||||
#define CLONE_IO 0x80000000 /* Clone io context */
|
||||
#endif
|
||||
@@ -5758,27 +5774,70 @@ static const bitmask_transtbl oflag_tbl[] = {
|
||||
{ TARGET_FFDLY, TARGET_FF1, FFDLY, FF1 },
|
||||
};
|
||||
|
||||
#if defined(TARGET_CIBAUD) && defined(CIBAUD)
|
||||
|
||||
# define BAUD_TRANSTBL(baud) \
|
||||
{ TARGET_CBAUD, TARGET_##baud, CBAUD, baud }, \
|
||||
{ TARGET_CIBAUD, TARGET_##baud << TARGET_IBSHIFT, CIBAUD, baud << IBSHIFT },
|
||||
|
||||
#else
|
||||
|
||||
/* Alpha in particular does not have CIBAUD/IBSHIFT */
|
||||
|
||||
# define BAUD_TRANSTBL(baud) \
|
||||
{ TARGET_CBAUD, TARGET_##baud, CBAUD, baud },
|
||||
|
||||
#endif
|
||||
|
||||
static const bitmask_transtbl cflag_tbl[] = {
|
||||
{ TARGET_CBAUD, TARGET_B0, CBAUD, B0 },
|
||||
{ TARGET_CBAUD, TARGET_B50, CBAUD, B50 },
|
||||
{ TARGET_CBAUD, TARGET_B75, CBAUD, B75 },
|
||||
{ TARGET_CBAUD, TARGET_B110, CBAUD, B110 },
|
||||
{ TARGET_CBAUD, TARGET_B134, CBAUD, B134 },
|
||||
{ TARGET_CBAUD, TARGET_B150, CBAUD, B150 },
|
||||
{ TARGET_CBAUD, TARGET_B200, CBAUD, B200 },
|
||||
{ TARGET_CBAUD, TARGET_B300, CBAUD, B300 },
|
||||
{ TARGET_CBAUD, TARGET_B600, CBAUD, B600 },
|
||||
{ TARGET_CBAUD, TARGET_B1200, CBAUD, B1200 },
|
||||
{ TARGET_CBAUD, TARGET_B1800, CBAUD, B1800 },
|
||||
{ TARGET_CBAUD, TARGET_B2400, CBAUD, B2400 },
|
||||
{ TARGET_CBAUD, TARGET_B4800, CBAUD, B4800 },
|
||||
{ TARGET_CBAUD, TARGET_B9600, CBAUD, B9600 },
|
||||
{ TARGET_CBAUD, TARGET_B19200, CBAUD, B19200 },
|
||||
{ TARGET_CBAUD, TARGET_B38400, CBAUD, B38400 },
|
||||
{ TARGET_CBAUD, TARGET_B57600, CBAUD, B57600 },
|
||||
{ TARGET_CBAUD, TARGET_B115200, CBAUD, B115200 },
|
||||
{ TARGET_CBAUD, TARGET_B230400, CBAUD, B230400 },
|
||||
{ TARGET_CBAUD, TARGET_B460800, CBAUD, B460800 },
|
||||
BAUD_TRANSTBL(B0)
|
||||
BAUD_TRANSTBL(B50)
|
||||
BAUD_TRANSTBL(B75)
|
||||
BAUD_TRANSTBL(B110)
|
||||
BAUD_TRANSTBL(B134)
|
||||
BAUD_TRANSTBL(B150)
|
||||
BAUD_TRANSTBL(B200)
|
||||
BAUD_TRANSTBL(B300)
|
||||
BAUD_TRANSTBL(B600)
|
||||
BAUD_TRANSTBL(B1200)
|
||||
BAUD_TRANSTBL(B1800)
|
||||
BAUD_TRANSTBL(B2400)
|
||||
BAUD_TRANSTBL(B4800)
|
||||
BAUD_TRANSTBL(B9600)
|
||||
BAUD_TRANSTBL(B19200)
|
||||
BAUD_TRANSTBL(B38400)
|
||||
BAUD_TRANSTBL(B57600)
|
||||
BAUD_TRANSTBL(B115200)
|
||||
BAUD_TRANSTBL(B230400)
|
||||
BAUD_TRANSTBL(B460800)
|
||||
BAUD_TRANSTBL(B500000)
|
||||
BAUD_TRANSTBL(B576000)
|
||||
BAUD_TRANSTBL(B921600)
|
||||
BAUD_TRANSTBL(B1000000)
|
||||
BAUD_TRANSTBL(B1152000)
|
||||
BAUD_TRANSTBL(B1500000)
|
||||
BAUD_TRANSTBL(B2000000)
|
||||
|
||||
BAUD_TRANSTBL(BOTHER)
|
||||
|
||||
/* SPARC in particular is missing these higher baud rates */
|
||||
|
||||
#if defined(TARGET_B2500000) && defined(B2500000)
|
||||
BAUD_TRANSTBL(B2500000)
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_B3000000) && defined(B3000000)
|
||||
BAUD_TRANSTBL(B3000000)
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_B3500000) && defined(B3500000)
|
||||
BAUD_TRANSTBL(B3500000)
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_B4000000) && defined(B4000000)
|
||||
BAUD_TRANSTBL(B4000000)
|
||||
#endif
|
||||
|
||||
{ TARGET_CSIZE, TARGET_CS5, CSIZE, CS5 },
|
||||
{ TARGET_CSIZE, TARGET_CS6, CSIZE, CS6 },
|
||||
{ TARGET_CSIZE, TARGET_CS7, CSIZE, CS7 },
|
||||
@@ -5888,6 +5947,89 @@ static const StructEntry struct_termios_def = {
|
||||
.print = print_termios,
|
||||
};
|
||||
|
||||
#ifdef TARGET_TCGETS2
|
||||
static void target_to_host_termios2 (void *dst, const void *src)
|
||||
{
|
||||
struct host_termios2 *host = dst;
|
||||
const struct target_termios2 *target = src;
|
||||
|
||||
host->c_iflag =
|
||||
target_to_host_bitmask(tswap32(target->c_iflag), iflag_tbl);
|
||||
host->c_oflag =
|
||||
target_to_host_bitmask(tswap32(target->c_oflag), oflag_tbl);
|
||||
host->c_cflag =
|
||||
target_to_host_bitmask(tswap32(target->c_cflag), cflag_tbl);
|
||||
host->c_lflag =
|
||||
target_to_host_bitmask(tswap32(target->c_lflag), lflag_tbl);
|
||||
host->c_line = target->c_line;
|
||||
host->c_ispeed = tswap32(target->c_ispeed);
|
||||
host->c_ospeed = tswap32(target->c_ospeed);
|
||||
|
||||
memset(host->c_cc, 0, sizeof(host->c_cc));
|
||||
host->c_cc[VINTR] = target->c_cc[TARGET_VINTR];
|
||||
host->c_cc[VQUIT] = target->c_cc[TARGET_VQUIT];
|
||||
host->c_cc[VERASE] = target->c_cc[TARGET_VERASE];
|
||||
host->c_cc[VKILL] = target->c_cc[TARGET_VKILL];
|
||||
host->c_cc[VEOF] = target->c_cc[TARGET_VEOF];
|
||||
host->c_cc[VTIME] = target->c_cc[TARGET_VTIME];
|
||||
host->c_cc[VMIN] = target->c_cc[TARGET_VMIN];
|
||||
host->c_cc[VSWTC] = target->c_cc[TARGET_VSWTC];
|
||||
host->c_cc[VSTART] = target->c_cc[TARGET_VSTART];
|
||||
host->c_cc[VSTOP] = target->c_cc[TARGET_VSTOP];
|
||||
host->c_cc[VSUSP] = target->c_cc[TARGET_VSUSP];
|
||||
host->c_cc[VEOL] = target->c_cc[TARGET_VEOL];
|
||||
host->c_cc[VREPRINT] = target->c_cc[TARGET_VREPRINT];
|
||||
host->c_cc[VDISCARD] = target->c_cc[TARGET_VDISCARD];
|
||||
host->c_cc[VWERASE] = target->c_cc[TARGET_VWERASE];
|
||||
host->c_cc[VLNEXT] = target->c_cc[TARGET_VLNEXT];
|
||||
host->c_cc[VEOL2] = target->c_cc[TARGET_VEOL2];
|
||||
}
|
||||
|
||||
static void host_to_target_termios2 (void *dst, const void *src)
|
||||
{
|
||||
struct target_termios2 *target = dst;
|
||||
const struct host_termios2 *host = src;
|
||||
|
||||
target->c_iflag =
|
||||
tswap32(host_to_target_bitmask(host->c_iflag, iflag_tbl));
|
||||
target->c_oflag =
|
||||
tswap32(host_to_target_bitmask(host->c_oflag, oflag_tbl));
|
||||
target->c_cflag =
|
||||
tswap32(host_to_target_bitmask(host->c_cflag, cflag_tbl));
|
||||
target->c_lflag =
|
||||
tswap32(host_to_target_bitmask(host->c_lflag, lflag_tbl));
|
||||
target->c_line = host->c_line;
|
||||
target->c_ispeed = tswap32(host->c_ispeed);
|
||||
target->c_ospeed = tswap32(host->c_ospeed);
|
||||
|
||||
memset(target->c_cc, 0, sizeof(target->c_cc));
|
||||
target->c_cc[TARGET_VINTR] = host->c_cc[VINTR];
|
||||
target->c_cc[TARGET_VQUIT] = host->c_cc[VQUIT];
|
||||
target->c_cc[TARGET_VERASE] = host->c_cc[VERASE];
|
||||
target->c_cc[TARGET_VKILL] = host->c_cc[VKILL];
|
||||
target->c_cc[TARGET_VEOF] = host->c_cc[VEOF];
|
||||
target->c_cc[TARGET_VTIME] = host->c_cc[VTIME];
|
||||
target->c_cc[TARGET_VMIN] = host->c_cc[VMIN];
|
||||
target->c_cc[TARGET_VSWTC] = host->c_cc[VSWTC];
|
||||
target->c_cc[TARGET_VSTART] = host->c_cc[VSTART];
|
||||
target->c_cc[TARGET_VSTOP] = host->c_cc[VSTOP];
|
||||
target->c_cc[TARGET_VSUSP] = host->c_cc[VSUSP];
|
||||
target->c_cc[TARGET_VEOL] = host->c_cc[VEOL];
|
||||
target->c_cc[TARGET_VREPRINT] = host->c_cc[VREPRINT];
|
||||
target->c_cc[TARGET_VDISCARD] = host->c_cc[VDISCARD];
|
||||
target->c_cc[TARGET_VWERASE] = host->c_cc[VWERASE];
|
||||
target->c_cc[TARGET_VLNEXT] = host->c_cc[VLNEXT];
|
||||
target->c_cc[TARGET_VEOL2] = host->c_cc[VEOL2];
|
||||
}
|
||||
|
||||
static const StructEntry struct_termios2_def = {
|
||||
.convert = { host_to_target_termios2, target_to_host_termios2 },
|
||||
.size = { sizeof(struct target_termios2), sizeof(struct host_termios2) },
|
||||
.align = { __alignof__(struct target_termios2), __alignof__(struct host_termios2) },
|
||||
.print = print_termios2,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* If the host does not provide these bits, they may be safely discarded. */
|
||||
#ifndef MAP_SYNC
|
||||
#define MAP_SYNC 0
|
||||
@@ -6711,6 +6853,20 @@ static void *clone_func(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void clone_fork_start(void)
|
||||
{
|
||||
pthread_mutex_lock(&clone_lock);
|
||||
}
|
||||
|
||||
void clone_fork_end(bool child)
|
||||
{
|
||||
if (child) {
|
||||
pthread_mutex_init(&clone_lock, NULL);
|
||||
} else {
|
||||
pthread_mutex_unlock(&clone_lock);
|
||||
}
|
||||
}
|
||||
|
||||
/* do_fork() Must return host values and target errnos (unlike most
|
||||
do_*() functions). */
|
||||
static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
|
||||
@@ -12141,9 +12297,13 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
||||
int dirfd = arg1;
|
||||
int flags = arg3;
|
||||
|
||||
p = lock_user_string(arg2);
|
||||
if (p == NULL) {
|
||||
return -TARGET_EFAULT;
|
||||
p = NULL;
|
||||
/* Since Linux 6.11, the path argument may be NULL */
|
||||
if (arg2 != 0) {
|
||||
p = lock_user_string(arg2);
|
||||
if (p == NULL) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
}
|
||||
#if defined(__NR_statx)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
STRUCT_SPECIAL(termios)
|
||||
#ifdef TARGET_TCGETS2
|
||||
STRUCT_SPECIAL(termios2)
|
||||
#endif
|
||||
|
||||
STRUCT(winsize,
|
||||
TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT)
|
||||
|
||||
@@ -69,6 +69,8 @@ abi_long get_errno(abi_long ret);
|
||||
const char *target_strerror(int err);
|
||||
int get_osversion(void);
|
||||
void init_qemu_uname_release(void);
|
||||
void clone_fork_start(void);
|
||||
void clone_fork_end(bool child);
|
||||
void fork_start(void);
|
||||
void fork_end(pid_t pid);
|
||||
|
||||
@@ -129,6 +131,9 @@ static inline uint64_t target_offset64(uint64_t word0, uint64_t word1)
|
||||
#endif /* TARGET_ABI_BITS != 32 */
|
||||
|
||||
void print_termios(void *arg);
|
||||
#ifdef TARGET_TCGETS2
|
||||
void print_termios2(void *arg);
|
||||
#endif
|
||||
|
||||
/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */
|
||||
#ifdef TARGET_ARM
|
||||
|
||||
+20
-1
@@ -363,14 +363,33 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict)
|
||||
{
|
||||
MonitorQAPIEventConf *evconf;
|
||||
MonitorQAPIEventState *evstate;
|
||||
bool throttled;
|
||||
|
||||
assert(event < QAPI_EVENT__MAX);
|
||||
evconf = &monitor_qapi_event_conf[event];
|
||||
trace_monitor_protocol_event_queue(event, qdict, evconf->rate);
|
||||
throttled = evconf->rate;
|
||||
|
||||
/*
|
||||
* Rate limit BLOCK_IO_ERROR only for action != "stop".
|
||||
*
|
||||
* If the VM is stopped after an I/O error, this is important information
|
||||
* for the management tool to keep track of the state of QEMU and we can't
|
||||
* merge any events. At the same time, stopping the VM means that the guest
|
||||
* can't send additional requests and the number of events is already
|
||||
* limited, so we can do without rate limiting.
|
||||
*/
|
||||
if (event == QAPI_EVENT_BLOCK_IO_ERROR) {
|
||||
QDict *data = qobject_to(QDict, qdict_get(qdict, "data"));
|
||||
const char *action = qdict_get_str(data, "action");
|
||||
if (!strcmp(action, "stop")) {
|
||||
throttled = false;
|
||||
}
|
||||
}
|
||||
|
||||
QEMU_LOCK_GUARD(&monitor_lock);
|
||||
|
||||
if (!evconf->rate) {
|
||||
if (!throttled) {
|
||||
/* Unthrottled event */
|
||||
monitor_qapi_event_emit(event, qdict);
|
||||
} else {
|
||||
|
||||
@@ -537,6 +537,11 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
|
||||
* e.g. the chardev is in client mode, with wait=on.
|
||||
*/
|
||||
remove_fd_in_watch(chr);
|
||||
/*
|
||||
* Clean up listener IO sources early to prevent racy fd
|
||||
* handling between the main thread and the I/O thread.
|
||||
*/
|
||||
remove_listener_fd_in_watch(chr);
|
||||
/*
|
||||
* We can't call qemu_chr_fe_set_handlers() directly here
|
||||
* since chardev might be running in the monitor I/O
|
||||
|
||||
@@ -36,7 +36,7 @@ config-cc.mak: Makefile
|
||||
$(call cc-option,-Wno-array-bounds)) 3> config-cc.mak
|
||||
-include config-cc.mak
|
||||
|
||||
override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds
|
||||
override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds,-m,elf_i386
|
||||
|
||||
pvh.img: pvh.o pvh_main.o
|
||||
|
||||
|
||||
+8
-1
@@ -41,9 +41,16 @@ if host_os == 'windows'
|
||||
# to find missing symbols in current program.
|
||||
win32_qemu_plugin_api_link_flags = ['-Lplugins', '-lqemu_plugin_api']
|
||||
if meson.get_compiler('c').get_id() == 'clang'
|
||||
if host_machine.cpu() == 'x86_64'
|
||||
dlltool_target = 'i386:x86-64'
|
||||
elif host_machine.cpu() == 'aarch64'
|
||||
dlltool_target = 'arm64'
|
||||
else
|
||||
error('Unknown machine')
|
||||
endif
|
||||
# With LLVM/lld, delaylib is specified at link time (-delayload)
|
||||
dlltool = find_program('llvm-dlltool', required: true)
|
||||
dlltool_cmd = [dlltool, '-d', '@INPUT@', '-l', '@OUTPUT@', '-D', 'qemu.exe']
|
||||
dlltool_cmd = [dlltool, '-m', dlltool_target,'-d', '@INPUT@', '-l', '@OUTPUT@', '-D', 'qemu.exe']
|
||||
win32_qemu_plugin_api_link_flags += ['-Wl,-delayload=qemu.exe']
|
||||
else
|
||||
# With gcc/ld, delay lib is built with a specific delay parameter.
|
||||
|
||||
@@ -683,7 +683,7 @@ def pip_install(
|
||||
if not online:
|
||||
full_args += ["--no-index"]
|
||||
if wheels_dir:
|
||||
full_args += ["--find-links", f"file://{str(wheels_dir)}"]
|
||||
full_args += ["--find-links", str(wheels_dir)]
|
||||
full_args += list(args)
|
||||
subprocess.run(
|
||||
full_args,
|
||||
|
||||
@@ -7,7 +7,6 @@ Copyright (c) 2020-2021 John Snow for Red Hat, Inc.
|
||||
import setuptools
|
||||
from setuptools.command import bdist_egg
|
||||
import sys
|
||||
import pkg_resources
|
||||
|
||||
|
||||
class bdist_egg_guard(bdist_egg.bdist_egg):
|
||||
@@ -30,9 +29,6 @@ def main():
|
||||
QEMU tooling installer
|
||||
"""
|
||||
|
||||
# https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108
|
||||
pkg_resources.require('setuptools>=39.2')
|
||||
|
||||
setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})
|
||||
|
||||
|
||||
|
||||
@@ -5789,7 +5789,7 @@
|
||||
# .. note:: If action is "stop", a `STOP` event will eventually follow
|
||||
# the `BLOCK_IO_ERROR` event.
|
||||
#
|
||||
# .. note:: This event is rate-limited.
|
||||
# .. note:: This event is rate-limited, except if action is "stop".
|
||||
#
|
||||
# Since: 0.13
|
||||
#
|
||||
|
||||
@@ -36,10 +36,9 @@ class TimersCommand(gdb.Command):
|
||||
|
||||
def process_timerlist(self, tlist, ttype):
|
||||
gdb.write("Processing %s timers\n" % (ttype))
|
||||
gdb.write(" clock %s is enabled:%s, last:%s\n" % (
|
||||
gdb.write(" clock %s is enabled:%s\n" % (
|
||||
tlist['clock']['type'],
|
||||
tlist['clock']['enabled'],
|
||||
tlist['clock']['last']))
|
||||
tlist['clock']['enabled']))
|
||||
if int(tlist['active_timers']) > 0:
|
||||
self.dump_timers(tlist['active_timers'])
|
||||
|
||||
|
||||
@@ -363,6 +363,16 @@ void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp)
|
||||
|
||||
cpu->sme_vq.map = vq_map;
|
||||
cpu->sme_max_vq = 32 - clz32(vq_map);
|
||||
|
||||
/*
|
||||
* The "sme" property setter writes a bool value into ID_AA64PFR1_EL1.SME
|
||||
* (and at this point we know it's not 0). Correct that value to report
|
||||
* the same SME version as ID_AA64SMFR0_EL1.SMEver.
|
||||
*/
|
||||
if (FIELD_EX64_IDREG(&cpu->isar, ID_AA64SMFR0, SMEVER) != 0) {
|
||||
/* SME2 or better */
|
||||
FIELD_DP64_IDREG(&cpu->isar, ID_AA64PFR1, SME, 2);
|
||||
}
|
||||
}
|
||||
|
||||
static bool cpu_arm_get_sme(Object *obj, Error **errp)
|
||||
@@ -375,6 +385,11 @@ static void cpu_arm_set_sme(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(obj);
|
||||
|
||||
/*
|
||||
* For now, write 0 for "off" and 1 for "on" into the PFR1 field.
|
||||
* We will correct this value to report the right SME
|
||||
* level (SME vs SME2) in arm_cpu_sme_finalize() later.
|
||||
*/
|
||||
FIELD_DP64_IDREG(&cpu->isar, ID_AA64PFR1, SME, value);
|
||||
}
|
||||
|
||||
|
||||
+89
-84
@@ -924,8 +924,8 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static CPAccessResult access_aa64_tid1(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
static CPAccessResult access_tid1(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
if (arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_TID1)) {
|
||||
return CP_ACCESS_TRAP_EL2;
|
||||
@@ -934,16 +934,6 @@ static CPAccessResult access_aa64_tid1(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static CPAccessResult access_aa32_tid1(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
if (arm_feature(env, ARM_FEATURE_V8)) {
|
||||
return access_aa64_tid1(env, ri, isread);
|
||||
}
|
||||
|
||||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static const ARMCPRegInfo v7_cp_reginfo[] = {
|
||||
/* the old v6 WFI, UNPREDICTABLE in v7 but we choose to NOP */
|
||||
{ .name = "NOP", .cp = 15, .crn = 7, .crm = 0, .opc1 = 0, .opc2 = 4,
|
||||
@@ -969,7 +959,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
|
||||
{ .name = "AIDR", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid1,
|
||||
.accessfn = access_tid1,
|
||||
.fgt = FGT_AIDR_EL1,
|
||||
.resetvalue = 0 },
|
||||
/*
|
||||
@@ -4997,7 +4987,7 @@ static const ARMCPRegInfo sme_reginfo[] = {
|
||||
.writefn = smcr_write, .raw_writefn = raw_write },
|
||||
{ .name = "SMIDR_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 6,
|
||||
.access = PL1_R, .accessfn = access_aa64_tid1,
|
||||
.access = PL1_R, .accessfn = access_tid1,
|
||||
/*
|
||||
* IMPLEMENTOR = 0 (software)
|
||||
* REVISION = 0 (implementation defined)
|
||||
@@ -5835,9 +5825,18 @@ static const ARMCPRegInfo ccsidr2_reginfo[] = {
|
||||
.readfn = ccsidr2_read, .type = ARM_CP_NO_RAW },
|
||||
};
|
||||
|
||||
static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
static CPAccessResult access_v7a_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
/*
|
||||
* Trap on TID3 always. This should be used only for the fixed set of
|
||||
* registers which are defined to trap on HCR.TID3 in v7A, which is:
|
||||
* ID_PFR{0,1}, ID_DFR0, ID_AFR0, ID_MMFR{0,1,2,3}, ID_ISAR{0,1,2,3,4,5}
|
||||
* (MVFR0 and MVFR1 also trap in v7A, but this is not handled via
|
||||
* this accessfn but in check_hcr_el2_trap.)
|
||||
* Any other registers in the TID3 trap space should use access_tid3(),
|
||||
* so that they trap on v8 and above, but not on v7.
|
||||
*/
|
||||
if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) {
|
||||
return CP_ACCESS_TRAP_EL2;
|
||||
}
|
||||
@@ -5845,11 +5844,18 @@ static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static CPAccessResult access_aa32_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
static CPAccessResult access_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
/*
|
||||
* Trap on TID3, if we implement at least v8. For v8 and above
|
||||
* the ID register space is at least IMPDEF permitted to trap,
|
||||
* and must trap if FEAT_FGT is implemented. We choose to trap
|
||||
* always. Use this function for any new registers that should
|
||||
* trap on TID3.
|
||||
*/
|
||||
if (arm_feature(env, ARM_FEATURE_V8)) {
|
||||
return access_aa64_tid3(env, ri, isread);
|
||||
return access_v7a_tid3(env, ri, isread);
|
||||
}
|
||||
|
||||
return CP_ACCESS_OK;
|
||||
@@ -6287,7 +6293,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "ID_PFR0", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_PFR0)},
|
||||
/*
|
||||
* ID_PFR1 is not a plain ARM_CP_CONST because we don't know
|
||||
@@ -6296,13 +6302,12 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_NO_RAW,
|
||||
.accessfn = access_aa32_tid3,
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
.type = ARM_CP_CONST,
|
||||
.resetvalue = GET_IDREG(isar, ID_PFR1),
|
||||
#else
|
||||
.type = ARM_CP_NO_RAW,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.readfn = id_pfr1_read,
|
||||
.writefn = arm_cp_write_ignore
|
||||
#endif
|
||||
@@ -6310,72 +6315,72 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_DFR0)},
|
||||
{ .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AFR0)},
|
||||
{ .name = "ID_MMFR0", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_MMFR0)},
|
||||
{ .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_MMFR1)},
|
||||
{ .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_MMFR2)},
|
||||
{ .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_MMFR3)},
|
||||
{ .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR0)},
|
||||
{ .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR1)},
|
||||
{ .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR2)},
|
||||
{ .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR3) },
|
||||
{ .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR4) },
|
||||
{ .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_v7a_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR5) },
|
||||
{ .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_MMFR4)},
|
||||
{ .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa32_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_ISAR6) },
|
||||
};
|
||||
define_arm_cp_regs(cpu, v6_idregs);
|
||||
@@ -6426,7 +6431,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64PFR0)
|
||||
#else
|
||||
.type = ARM_CP_NO_RAW,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.readfn = id_aa64pfr0_read,
|
||||
.writefn = arm_cp_write_ignore
|
||||
#endif
|
||||
@@ -6434,172 +6439,172 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64PFR1)},
|
||||
{ .name = "ID_AA64PFR2_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64PFR2)},
|
||||
{ .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64ZFR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64ZFR0)},
|
||||
{ .name = "ID_AA64SMFR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64SMFR0)},
|
||||
{ .name = "ID_AA64PFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64PFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64DFR0) },
|
||||
{ .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64DFR1) },
|
||||
{ .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64DFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64AFR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64AFR0) },
|
||||
{ .name = "ID_AA64AFR1_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64AFR1) },
|
||||
{ .name = "ID_AA64AFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64AFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64ISAR0)},
|
||||
{ .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64ISAR1)},
|
||||
{ .name = "ID_AA64ISAR2_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64ISAR2)},
|
||||
{ .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64ISAR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64ISAR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64ISAR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64ISAR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64MMFR0)},
|
||||
{ .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64MMFR1) },
|
||||
{ .name = "ID_AA64MMFR2_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64MMFR2) },
|
||||
{ .name = "ID_AA64MMFR3_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_AA64MMFR3) },
|
||||
{ .name = "ID_AA64MMFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64MMFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64MMFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_AA64MMFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = cpu->isar.mvfr0 },
|
||||
{ .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = cpu->isar.mvfr1 },
|
||||
{ .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = cpu->isar.mvfr2 },
|
||||
/*
|
||||
* "0, c0, c3, {0,1,2}" are the encodings corresponding to
|
||||
@@ -6610,17 +6615,17 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "RES_0_C0_C3_0", .state = ARM_CP_STATE_AA32,
|
||||
.cp = 15, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "RES_0_C0_C3_1", .state = ARM_CP_STATE_AA32,
|
||||
.cp = 15, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "RES_0_C0_C3_2", .state = ARM_CP_STATE_AA32,
|
||||
.cp = 15, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
/*
|
||||
* Other encodings in "0, c0, c3, ..." are STATE_BOTH because
|
||||
@@ -6631,27 +6636,27 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "RES_0_C0_C3_3", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
{ .name = "ID_PFR2", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_PFR2)},
|
||||
{ .name = "ID_DFR1", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_DFR1)},
|
||||
{ .name = "ID_MMFR5", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = GET_IDREG(isar, ID_MMFR5)},
|
||||
{ .name = "RES_0_C0_C3_7", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 7,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 },
|
||||
};
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
@@ -6801,7 +6806,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
.state = ARM_CP_STATE_AA32,
|
||||
.cp = 15, .opc1 = 0, .crn = 0, .crm = i, .opc2 = CP_ANY,
|
||||
.access = PL1_R, .type = ARM_CP_CONST,
|
||||
.accessfn = access_aa64_tid3,
|
||||
.accessfn = access_tid3,
|
||||
.resetvalue = 0 };
|
||||
define_one_arm_cp_reg(cpu, &v8_aa32_raz_idregs);
|
||||
}
|
||||
@@ -7079,7 +7084,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "REVIDR_EL1", .state = ARM_CP_STATE_BOTH,
|
||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 6,
|
||||
.access = PL1_R,
|
||||
.accessfn = access_aa64_tid1,
|
||||
.accessfn = access_tid1,
|
||||
.fgt = FGT_REVIDR_EL1,
|
||||
.type = ARM_CP_CONST, .resetvalue = cpu->revidr },
|
||||
};
|
||||
@@ -7103,7 +7108,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
{ .name = "TCMTR",
|
||||
.cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 2,
|
||||
.access = PL1_R,
|
||||
.accessfn = access_aa32_tid1,
|
||||
.accessfn = access_tid1,
|
||||
.type = ARM_CP_CONST, .resetvalue = 0 },
|
||||
};
|
||||
/* TLBTR is specific to VMSA */
|
||||
@@ -7111,7 +7116,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||
.name = "TLBTR",
|
||||
.cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 3,
|
||||
.access = PL1_R,
|
||||
.accessfn = access_aa32_tid1,
|
||||
.accessfn = access_tid1,
|
||||
.type = ARM_CP_CONST, .resetvalue = 0,
|
||||
};
|
||||
/* MPUIR is specific to PMSA V6+ */
|
||||
@@ -10053,7 +10058,7 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq)
|
||||
uint64_t pmask;
|
||||
|
||||
assert(vq >= 1 && vq <= ARM_MAX_VQ);
|
||||
assert(vq <= env_archcpu(env)->sve_max_vq);
|
||||
assert(vq <= arm_max_vq(env_archcpu(env)));
|
||||
|
||||
/* Zap the high bits of the zregs. */
|
||||
for (i = 0; i < 32; i++) {
|
||||
|
||||
Loaded 100 of 137 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user