mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-05 22:12:18 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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);
|
||||
|
||||
@@ -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 = ''
|
||||
+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)
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ virtio_gpu_virgl_map_resource_blob(VirtIOGPU *g,
|
||||
vmr->g = g;
|
||||
|
||||
mr = &vmr->mr;
|
||||
memory_region_init_ram_ptr(mr, OBJECT(mr), "blob", size, data);
|
||||
memory_region_init_ram_ptr(mr, OBJECT(mr), NULL, size, data);
|
||||
memory_region_add_subregion(&b->hostmem, offset, mr);
|
||||
memory_region_set_enabled(mr, true);
|
||||
|
||||
@@ -186,7 +186,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_unref(OBJECT(mr));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -705,7 +705,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;
|
||||
}
|
||||
|
||||
+72
-31
@@ -116,8 +116,6 @@ static uint64_t aspeed_i2c_bus_old_read(AspeedI2CBus *bus, hwaddr offset,
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
value = extract64(bus->dma_dram_offset, 0, 32);
|
||||
break;
|
||||
case A_I2CD_DMA_LEN:
|
||||
if (!aic->has_dma) {
|
||||
@@ -221,6 +219,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 +326,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 +392,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 +459,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 +716,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 +732,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 +801,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 +810,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 +820,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 +835,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 +925,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 {
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
+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);
|
||||
|
||||
@@ -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 --- */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -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) */
|
||||
|
||||
+10
-6
@@ -1029,9 +1029,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 +1110,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 +1174,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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'])
|
||||
|
||||
|
||||
+88
-83
@@ -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+ */
|
||||
|
||||
@@ -985,7 +985,7 @@ nvmm_init_vcpu(CPUState *cpu)
|
||||
}
|
||||
}
|
||||
|
||||
qcpu->vcpu_dirty = true;
|
||||
cpu->vcpu_dirty = true;
|
||||
cpu->accel = qcpu;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2362,42 +2362,42 @@ void glue(helper_vpmaskmovq, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)
|
||||
}
|
||||
|
||||
void glue(helper_vpgatherdd, SUFFIX)(CPUX86State *env,
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale)
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale, target_ulong amask)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (2 << SHIFT); i++) {
|
||||
if (v->L(i) >> 31) {
|
||||
target_ulong addr = a0
|
||||
+ ((target_ulong)(int32_t)s->L(i) << scale);
|
||||
d->L(i) = cpu_ldl_data_ra(env, addr, GETPC());
|
||||
d->L(i) = cpu_ldl_data_ra(env, addr & amask, GETPC());
|
||||
}
|
||||
v->L(i) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void glue(helper_vpgatherdq, SUFFIX)(CPUX86State *env,
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale)
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale, target_ulong amask)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (1 << SHIFT); i++) {
|
||||
if (v->Q(i) >> 63) {
|
||||
target_ulong addr = a0
|
||||
+ ((target_ulong)(int32_t)s->L(i) << scale);
|
||||
d->Q(i) = cpu_ldq_data_ra(env, addr, GETPC());
|
||||
d->Q(i) = cpu_ldq_data_ra(env, addr & amask, GETPC());
|
||||
}
|
||||
v->Q(i) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void glue(helper_vpgatherqd, SUFFIX)(CPUX86State *env,
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale)
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale, target_ulong amask)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (1 << SHIFT); i++) {
|
||||
if (v->L(i) >> 31) {
|
||||
target_ulong addr = a0
|
||||
+ ((target_ulong)(int64_t)s->Q(i) << scale);
|
||||
d->L(i) = cpu_ldl_data_ra(env, addr, GETPC());
|
||||
d->L(i) = cpu_ldl_data_ra(env, addr & amask, GETPC());
|
||||
}
|
||||
v->L(i) = 0;
|
||||
}
|
||||
@@ -2408,14 +2408,14 @@ void glue(helper_vpgatherqd, SUFFIX)(CPUX86State *env,
|
||||
}
|
||||
|
||||
void glue(helper_vpgatherqq, SUFFIX)(CPUX86State *env,
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale)
|
||||
Reg *d, Reg *v, Reg *s, target_ulong a0, unsigned scale, target_ulong amask)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (1 << SHIFT); i++) {
|
||||
if (v->Q(i) >> 63) {
|
||||
target_ulong addr = a0
|
||||
+ ((target_ulong)(int64_t)s->Q(i) << scale);
|
||||
d->Q(i) = cpu_ldq_data_ra(env, addr, GETPC());
|
||||
d->Q(i) = cpu_ldq_data_ra(env, addr & amask, GETPC());
|
||||
}
|
||||
v->Q(i) = 0;
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ static void decode_0F7E(DisasContext *s, CPUX86State *env, X86OpEntry *entry, ui
|
||||
static const X86OpEntry opcodes_0F7E[4] = {
|
||||
X86_OP_ENTRY3(MOVD_from, E,y, None,None, P,y, vex5 mmx),
|
||||
X86_OP_ENTRY3(MOVD_from, E,y, None,None, V,y, vex5),
|
||||
X86_OP_ENTRY3(MOVQ, V,x, None,None, W,q, vex5), /* wrong dest Vy on SDM! */
|
||||
X86_OP_ENTRY3(MOVQ, V,dq,None,None, W,q, vex5), /* wrong dest Vq on SDM! */
|
||||
{},
|
||||
};
|
||||
*entry = *decode_by_prefix(s, opcodes_0F7E);
|
||||
@@ -569,7 +569,7 @@ static void decode_0FD6(DisasContext *s, CPUX86State *env, X86OpEntry *entry, ui
|
||||
{
|
||||
static const X86OpEntry movq[4] = {
|
||||
{},
|
||||
X86_OP_ENTRY3(MOVQ, W,x, None, None, V,q, vex5),
|
||||
X86_OP_ENTRY3(MOVQ, W,dq, None, None, V,q, vex5),
|
||||
X86_OP_ENTRY3(MOVq_dq, V,dq, None, None, N,q),
|
||||
X86_OP_ENTRY3(MOVq_dq, P,q, None, None, U,q),
|
||||
};
|
||||
@@ -944,15 +944,15 @@ static void decode_0F10(DisasContext *s, CPUX86State *env, X86OpEntry *entry, ui
|
||||
static void decode_0F11(DisasContext *s, CPUX86State *env, X86OpEntry *entry, uint8_t *b)
|
||||
{
|
||||
static const X86OpEntry opcodes_0F11_reg[4] = {
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4), /* MOVUPS */
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4), /* MOVUPD */
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4_unal), /* MOVUPS */
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4_unal), /* MOVUPD */
|
||||
X86_OP_ENTRY3(VMOVSS, W,x, H,x, V,x, vex5),
|
||||
X86_OP_ENTRY3(VMOVLPx, W,x, H,x, V,q, vex5), /* MOVSD */
|
||||
};
|
||||
|
||||
static const X86OpEntry opcodes_0F11_mem[4] = {
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4), /* MOVUPS */
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4), /* MOVUPD */
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4_unal), /* MOVUPS */
|
||||
X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex4_unal), /* MOVUPD */
|
||||
X86_OP_ENTRY3(VMOVSS_st, M,ss, None,None, V,x, vex5),
|
||||
X86_OP_ENTRY3(VMOVLPx_st, M,sd, None,None, V,x, vex5), /* MOVSD */
|
||||
};
|
||||
@@ -978,7 +978,7 @@ static void decode_0F12(DisasContext *s, CPUX86State *env, X86OpEntry *entry, ui
|
||||
};
|
||||
static const X86OpEntry opcodes_0F12_reg[4] = {
|
||||
X86_OP_ENTRY3(VMOVHLPS, V,dq, H,dq, U,dq, vex7),
|
||||
X86_OP_ENTRY3(VMOVLPx, W,x, H,x, U,q, vex5), /* MOVLPD */
|
||||
X86_OP_ENTRY3(VMOVLPx, W,dq, H,dq, U,q, vex5), /* MOVLPD */
|
||||
X86_OP_ENTRY3(VMOVSLDUP, V,x, None,None, U,x, vex4 cpuid(SSE3)),
|
||||
X86_OP_ENTRY3(VMOVDDUP, V,x, None,None, U,x, vex5 cpuid(SSE3)),
|
||||
};
|
||||
@@ -1341,7 +1341,7 @@ static const X86OpEntry opcodes_0F[256] = {
|
||||
[0x6b] = X86_OP_ENTRY3(PACKSSDW, V,x, H,x, W,x, vex4 mmx avx2_256 p_00_66),
|
||||
[0x6c] = X86_OP_ENTRY3(PUNPCKLQDQ, V,x, H,x, W,x, vex4 p_66 avx2_256),
|
||||
[0x6d] = X86_OP_ENTRY3(PUNPCKHQDQ, V,x, H,x, W,x, vex4 p_66 avx2_256),
|
||||
[0x6e] = X86_OP_ENTRY3(MOVD_to, V,x, None,None, E,y, vex5 mmx p_00_66), /* wrong dest Vy on SDM! */
|
||||
[0x6e] = X86_OP_ENTRY3(MOVD_to, V,dq,None,None, E,y, vex5 mmx p_00_66), /* wrong dest Vy on SDM! */
|
||||
[0x6f] = X86_OP_GROUP0(0F6F),
|
||||
|
||||
[0x78] = X86_OP_GROUP0(0F78),
|
||||
@@ -2382,6 +2382,9 @@ static bool validate_vex(DisasContext *s, X86DecodedInsn *decode)
|
||||
X86OpEntry *e = &decode->e;
|
||||
|
||||
switch (e->vex_special) {
|
||||
case X86_VEX_None:
|
||||
break;
|
||||
|
||||
case X86_VEX_REPScalar:
|
||||
/*
|
||||
* Instructions which differ between 00/66 and F2/F3 in the
|
||||
@@ -2610,20 +2613,16 @@ static void disas_insn(DisasContext *s, CPUState *cpu)
|
||||
case 0xc5: /* 2-byte VEX */
|
||||
case 0xc4: /* 3-byte VEX */
|
||||
/*
|
||||
* VEX prefixes cannot be used except in 32-bit mode.
|
||||
* Otherwise the instruction is LES or LDS.
|
||||
* Bits 6-7 of the first byte must be set except in 64-bit mode.
|
||||
* Otherwise the instruction is LES or LDS. Not allowed in real mode.
|
||||
*/
|
||||
if (CODE32(s) && !VM86(s)) {
|
||||
if (PE(s) && !VM86(s)) {
|
||||
static const int pp_prefix[4] = {
|
||||
0, PREFIX_DATA, PREFIX_REPZ, PREFIX_REPNZ
|
||||
};
|
||||
int vex3, vex2 = x86_ldub_code(env, s);
|
||||
|
||||
if (!CODE64(s) && (vex2 & 0xc0) != 0xc0) {
|
||||
/*
|
||||
* 4.1.4.6: In 32-bit mode, bits [7:6] must be 11b,
|
||||
* otherwise the instruction is LES or LDS.
|
||||
*/
|
||||
s->pc--; /* rewind the advance_pc() x86_ldub_code() did */
|
||||
break;
|
||||
}
|
||||
@@ -2665,7 +2664,7 @@ static void disas_insn(DisasContext *s, CPUState *cpu)
|
||||
goto unknown_op;
|
||||
}
|
||||
}
|
||||
s->vex_v = (~vex3 >> 3) & 0xf;
|
||||
s->vex_v = (~vex3 >> 3) & (CODE64(s) ? 15 : 7);
|
||||
s->vex_l = (vex3 >> 2) & 1;
|
||||
s->prefix |= pp_prefix[vex3 & 3] | PREFIX_VEX;
|
||||
}
|
||||
|
||||
@@ -242,6 +242,8 @@ typedef enum X86InsnSpecial {
|
||||
* section of the manual.
|
||||
*/
|
||||
typedef enum X86VEXSpecial {
|
||||
X86_VEX_None,
|
||||
|
||||
/* Legacy SSE instructions that allow unaligned operands */
|
||||
X86_VEX_SSEUnaligned,
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ typedef void (*SSEFunc_0_pppi)(TCGv_ptr reg_a, TCGv_ptr reg_b, TCGv_ptr reg_c,
|
||||
TCGv_i32 val);
|
||||
typedef void (*SSEFunc_0_eppt)(TCGv_ptr env, TCGv_ptr reg_a, TCGv_ptr reg_b,
|
||||
TCGv val);
|
||||
typedef void (*SSEFunc_0_epppti)(TCGv_ptr env, TCGv_ptr reg_a, TCGv_ptr reg_b,
|
||||
TCGv_ptr reg_c, TCGv a0, TCGv_i32 scale);
|
||||
typedef void (*SSEFunc_0_eppptit)(TCGv_ptr env, TCGv_ptr reg_a, TCGv_ptr reg_b,
|
||||
TCGv_ptr reg_c, TCGv a0, TCGv_i32 scale, TCGv amask);
|
||||
typedef void (*SSEFunc_0_eppppi)(TCGv_ptr env, TCGv_ptr reg_a, TCGv_ptr reg_b,
|
||||
TCGv_ptr reg_c, TCGv_ptr reg_d, TCGv_i32 flags);
|
||||
typedef void (*SSEFunc_0_eppppii)(TCGv_ptr env, TCGv_ptr reg_a, TCGv_ptr reg_b,
|
||||
@@ -1098,18 +1098,19 @@ VEXW_AVX(VPMASKMOV, vpmaskmov)
|
||||
|
||||
/* Same as above, but with extra arguments to the helper. */
|
||||
static inline void gen_vsib_avx(DisasContext *s, X86DecodedInsn *decode,
|
||||
SSEFunc_0_epppti d_xmm, SSEFunc_0_epppti q_xmm,
|
||||
SSEFunc_0_epppti d_ymm, SSEFunc_0_epppti q_ymm)
|
||||
SSEFunc_0_eppptit d_xmm, SSEFunc_0_eppptit q_xmm,
|
||||
SSEFunc_0_eppptit d_ymm, SSEFunc_0_eppptit q_ymm)
|
||||
{
|
||||
SSEFunc_0_epppti d = s->vex_l ? d_ymm : d_xmm;
|
||||
SSEFunc_0_epppti q = s->vex_l ? q_ymm : q_xmm;
|
||||
SSEFunc_0_epppti fn = s->vex_w ? q : d;
|
||||
SSEFunc_0_eppptit d = s->vex_l ? d_ymm : d_xmm;
|
||||
SSEFunc_0_eppptit q = s->vex_l ? q_ymm : q_xmm;
|
||||
SSEFunc_0_eppptit fn = s->vex_w ? q : d;
|
||||
TCGv_i32 scale = tcg_constant_i32(decode->mem.scale);
|
||||
TCGv_ptr index = tcg_temp_new_ptr();
|
||||
TCGv mask = tcg_constant_tl(MAKE_64BIT_MASK(0, 8 << s->aflag));
|
||||
|
||||
/* Pass third input as (index, base, scale) */
|
||||
tcg_gen_addi_ptr(index, tcg_env, ZMM_OFFSET(decode->mem.index));
|
||||
fn(tcg_env, OP_PTR0, OP_PTR1, index, s->A0, scale);
|
||||
fn(tcg_env, OP_PTR0, OP_PTR1, index, s->A0, scale, mask);
|
||||
|
||||
/*
|
||||
* There are two output operands, so zero OP1's high 128 bits
|
||||
|
||||
@@ -388,10 +388,10 @@ DEF_HELPER_4(glue(vpmaskmovd_st, SUFFIX), void, env, Reg, Reg, tl)
|
||||
DEF_HELPER_4(glue(vpmaskmovq_st, SUFFIX), void, env, Reg, Reg, tl)
|
||||
DEF_HELPER_4(glue(vpmaskmovd, SUFFIX), void, env, Reg, Reg, Reg)
|
||||
DEF_HELPER_4(glue(vpmaskmovq, SUFFIX), void, env, Reg, Reg, Reg)
|
||||
DEF_HELPER_6(glue(vpgatherdd, SUFFIX), void, env, Reg, Reg, Reg, tl, i32)
|
||||
DEF_HELPER_6(glue(vpgatherdq, SUFFIX), void, env, Reg, Reg, Reg, tl, i32)
|
||||
DEF_HELPER_6(glue(vpgatherqd, SUFFIX), void, env, Reg, Reg, Reg, tl, i32)
|
||||
DEF_HELPER_6(glue(vpgatherqq, SUFFIX), void, env, Reg, Reg, Reg, tl, i32)
|
||||
DEF_HELPER_7(glue(vpgatherdd, SUFFIX), void, env, Reg, Reg, Reg, tl, i32, tl)
|
||||
DEF_HELPER_7(glue(vpgatherdq, SUFFIX), void, env, Reg, Reg, Reg, tl, i32, tl)
|
||||
DEF_HELPER_7(glue(vpgatherqd, SUFFIX), void, env, Reg, Reg, Reg, tl, i32, tl)
|
||||
DEF_HELPER_7(glue(vpgatherqq, SUFFIX), void, env, Reg, Reg, Reg, tl, i32, tl)
|
||||
#if SHIFT == 2
|
||||
DEF_HELPER_3(vpermd_ymm, void, Reg, Reg, Reg)
|
||||
DEF_HELPER_4(vpermdq_ymm, void, Reg, Reg, Reg, i32)
|
||||
|
||||
@@ -63,7 +63,7 @@ static void do_interrupt_user(CPUX86State *env, int intno, int is_int,
|
||||
cpl = env->hflags & HF_CPL_MASK;
|
||||
/* check privilege if software int */
|
||||
if (dpl < cpl) {
|
||||
raise_exception_err(env, EXCP0D_GPF, (intno << shift) + 2);
|
||||
raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
|
||||
cause = cs->exception_index;
|
||||
update_badinstr = 0;
|
||||
break;
|
||||
case EXCCODE_BCE:
|
||||
env->CSR_BADV = env->pc;
|
||||
QEMU_FALLTHROUGH;
|
||||
case EXCCODE_SYS:
|
||||
case EXCCODE_BRK:
|
||||
case EXCCODE_INE:
|
||||
@@ -121,9 +124,6 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
|
||||
case EXCCODE_FPE:
|
||||
case EXCCODE_SXD:
|
||||
case EXCCODE_ASXD:
|
||||
env->CSR_BADV = env->pc;
|
||||
QEMU_FALLTHROUGH;
|
||||
case EXCCODE_BCE:
|
||||
case EXCCODE_ADEM:
|
||||
case EXCCODE_PIL:
|
||||
case EXCCODE_PIS:
|
||||
@@ -225,6 +225,7 @@ static void loongarch_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
||||
{
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
env->CSR_BADV = addr;
|
||||
if (access_type == MMU_INST_FETCH) {
|
||||
do_raise_exception(env, EXCCODE_ADEF, retaddr);
|
||||
} else {
|
||||
|
||||
@@ -799,8 +799,8 @@ void HELPER(cas2w)(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t a2)
|
||||
env->cc_v = c2;
|
||||
}
|
||||
env->cc_op = CC_OP_CMPW;
|
||||
env->dregs[Dc1] = deposit32(env->dregs[Dc1], 0, 16, l1);
|
||||
env->dregs[Dc2] = deposit32(env->dregs[Dc2], 0, 16, l2);
|
||||
env->dregs[Dc1] = deposit32(env->dregs[Dc1], 0, 16, l1);
|
||||
}
|
||||
|
||||
static void do_cas2l(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t a2,
|
||||
@@ -861,8 +861,8 @@ static void do_cas2l(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t a2,
|
||||
env->cc_v = c2;
|
||||
}
|
||||
env->cc_op = CC_OP_CMPL;
|
||||
env->dregs[Dc1] = l1;
|
||||
env->dregs[Dc2] = l2;
|
||||
env->dregs[Dc1] = l1;
|
||||
}
|
||||
|
||||
void HELPER(cas2l)(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t a2)
|
||||
|
||||
@@ -1529,6 +1529,7 @@ struct ArchCPU {
|
||||
void *machine_data;
|
||||
int32_t node_id; /* NUMA node this CPU belongs to */
|
||||
PPCHash64Options *hash64_opts;
|
||||
bool rtas_stopped_state;
|
||||
|
||||
/* Those resources are used only during code translation */
|
||||
/* opcode handlers */
|
||||
|
||||
@@ -55,6 +55,11 @@
|
||||
/* #define PPC_DEBUG_SPR */
|
||||
/* #define USE_APPLE_GDB */
|
||||
|
||||
static const Property powerpc_cpu_properties[] = {
|
||||
DEFINE_PROP_BOOL("rtas-stopped-state", PowerPCCPU,
|
||||
rtas_stopped_state, true),
|
||||
};
|
||||
|
||||
static inline void vscr_init(CPUPPCState *env, uint32_t val)
|
||||
{
|
||||
/* Altivec always uses round-to-nearest */
|
||||
@@ -7529,6 +7534,8 @@ static void ppc_cpu_class_init(ObjectClass *oc, const void *data)
|
||||
&pcc->parent_unrealize);
|
||||
pcc->pvr_match = ppc_pvr_match_default;
|
||||
|
||||
device_class_set_props(dc, powerpc_cpu_properties);
|
||||
|
||||
resettable_class_set_parent_phases(rc, NULL, ppc_cpu_reset_hold, NULL,
|
||||
&pcc->parent_phases);
|
||||
|
||||
|
||||
@@ -257,6 +257,45 @@ static int cpu_post_load(void *opaque, int version_id)
|
||||
ppc_store_sdr1(env, env->spr[SPR_SDR1]);
|
||||
}
|
||||
|
||||
if (!cpu->rtas_stopped_state) {
|
||||
/*
|
||||
* The source QEMU doesn't have fb802acdc8 and still uses halt +
|
||||
* PM bits in LPCR to implement RTAS stopped state. The new (this)
|
||||
* QEMU will have put the secondary vcpus in stopped state,
|
||||
* waiting for the start-cpu RTAS call. That call will never come
|
||||
* if the source cpus were already running. Try to infer the cpus
|
||||
* state and set env->quiesced accordingly.
|
||||
*
|
||||
* env->quiesced = true ==> the cpu is waiting to start
|
||||
* env->quiesced = false ==> the cpu is running (unless halted)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Halted _could_ mean quiesced, but it could also be cede,
|
||||
* confer_self, power management, etc.
|
||||
*/
|
||||
if (CPU(cpu)->halted) {
|
||||
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
|
||||
/*
|
||||
* Both the PSSCR_EC bit and LPCR PM bits set at cpu reset
|
||||
* and rtas_stop and cleared at rtas_start, it's a good
|
||||
* heuristic.
|
||||
*/
|
||||
if ((env->spr[SPR_PSSCR] & PSSCR_EC) &&
|
||||
(env->spr[SPR_LPCR] & pcc->lpcr_pm)) {
|
||||
env->quiesced = true;
|
||||
} else {
|
||||
env->quiesced = false;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Old QEMU sets halted during rtas_stop_self. Not halted,
|
||||
* therefore definitely not quiesced.
|
||||
*/
|
||||
env->quiesced = false;
|
||||
}
|
||||
}
|
||||
|
||||
post_load_update_msr(env);
|
||||
|
||||
if (tcg_enabled()) {
|
||||
@@ -649,6 +688,28 @@ static const VMStateDescription vmstate_reservation = {
|
||||
}
|
||||
};
|
||||
|
||||
static bool rtas_stopped_needed(void *opaque)
|
||||
{
|
||||
PowerPCCPU *cpu = opaque;
|
||||
|
||||
return cpu->rtas_stopped_state;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_rtas_stopped = {
|
||||
.name = "cpu/rtas_stopped",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = rtas_stopped_needed,
|
||||
.fields = (const VMStateField[]) {
|
||||
/*
|
||||
* "RTAS stopped" state, independent of halted state. For QEMU
|
||||
* < 10.0, this is taken from cpu->halted at cpu_post_load()
|
||||
*/
|
||||
VMSTATE_BOOL(env.quiesced, PowerPCCPU),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef TARGET_PPC64
|
||||
static bool bhrb_needed(void *opaque)
|
||||
{
|
||||
@@ -715,6 +776,7 @@ const VMStateDescription vmstate_ppc_cpu = {
|
||||
&vmstate_tlbmas,
|
||||
&vmstate_compat,
|
||||
&vmstate_reservation,
|
||||
&vmstate_rtas_stopped,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
+4
-3
@@ -1088,8 +1088,9 @@ static bool fold_masks_zosa_int(OptContext *ctx, TCGOp *op,
|
||||
|
||||
ti = ts_info(ts);
|
||||
ti->z_mask = z_mask;
|
||||
ti->o_mask = o_mask;
|
||||
|
||||
/* Canonicalize s_mask and incorporate data from z_mask. */
|
||||
/* Canonicalize s_mask and incorporate data from [zo]_mask. */
|
||||
rep = clz64(~s_mask);
|
||||
rep = MAX(rep, clz64(z_mask));
|
||||
rep = MAX(rep, clz64(~o_mask));
|
||||
@@ -1102,7 +1103,7 @@ static bool fold_masks_zosa_int(OptContext *ctx, TCGOp *op,
|
||||
static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
|
||||
uint64_t o_mask, int64_t s_mask, uint64_t a_mask)
|
||||
{
|
||||
fold_masks_zosa_int(ctx, op, z_mask, o_mask, s_mask, -1);
|
||||
fold_masks_zosa_int(ctx, op, z_mask, o_mask, s_mask, a_mask);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2359,7 +2360,7 @@ static bool fold_orc(OptContext *ctx, TCGOp *op)
|
||||
s_mask = t1->s_mask & t2->s_mask;
|
||||
|
||||
/* Affected bits are those not known one, masked by those known one. */
|
||||
a_mask = ~t1->o_mask & t2->o_mask;
|
||||
a_mask = ~t1->o_mask & ~t2->o_mask;
|
||||
|
||||
return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
|
||||
}
|
||||
|
||||
+17
-12
@@ -1074,7 +1074,7 @@ static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val,
|
||||
}
|
||||
|
||||
static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece,
|
||||
TCGReg dst, TCGReg src)
|
||||
TCGReg dst, TCGReg src)
|
||||
{
|
||||
set_vtype_len_sew(s, type, vece);
|
||||
tcg_out_opc_vx(s, OPC_VMV_V_X, dst, 0, src);
|
||||
@@ -1082,29 +1082,34 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece,
|
||||
}
|
||||
|
||||
static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece,
|
||||
TCGReg dst, TCGReg base, intptr_t offset)
|
||||
TCGReg dst, TCGReg base, intptr_t offset)
|
||||
{
|
||||
/* Note set_vtype* may clobber TMP0, so do that first. */
|
||||
set_vtype_len_sew(s, type, vece);
|
||||
tcg_out_ld(s, TCG_TYPE_REG, TCG_REG_TMP0, base, offset);
|
||||
return tcg_out_dup_vec(s, type, vece, dst, TCG_REG_TMP0);
|
||||
tcg_out_opc_vx(s, OPC_VMV_V_X, dst, 0, TCG_REG_TMP0);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece,
|
||||
TCGReg dst, int64_t arg)
|
||||
TCGReg dst, int64_t arg)
|
||||
{
|
||||
/* Arg is replicated by VECE; extract the highest element. */
|
||||
arg >>= (-8 << vece) & 63;
|
||||
|
||||
/* Note set_vtype* may clobber TMP0, so do that first. */
|
||||
if (arg == 0 || arg == -1) {
|
||||
set_vtype_len(s, type);
|
||||
} else {
|
||||
set_vtype_len_sew(s, type, vece);
|
||||
}
|
||||
|
||||
if (arg >= -16 && arg < 16) {
|
||||
if (arg == 0 || arg == -1) {
|
||||
set_vtype_len(s, type);
|
||||
} else {
|
||||
set_vtype_len_sew(s, type, vece);
|
||||
}
|
||||
tcg_out_opc_vi(s, OPC_VMV_V_I, dst, 0, arg);
|
||||
return;
|
||||
} else {
|
||||
tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP0, arg);
|
||||
tcg_out_opc_vx(s, OPC_VMV_V_X, dst, 0, TCG_REG_TMP0);
|
||||
}
|
||||
tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP0, arg);
|
||||
tcg_out_dup_vec(s, type, vece, dst, TCG_REG_TMP0);
|
||||
}
|
||||
|
||||
static void tcg_out_br(TCGContext *s, TCGLabel *l)
|
||||
|
||||
@@ -31,10 +31,10 @@ def fetch_firmware(test):
|
||||
"""
|
||||
|
||||
# Secure BootRom (TF-A code)
|
||||
fs0_path = test.uncompress(Aarch64SbsarefMachine.ASSET_FLASH0)
|
||||
fs0_path = test.uncompress(Aarch64SbsarefMachine.ASSET_FLASH0, format="xz")
|
||||
|
||||
# Non-secure rom (UEFI and EFI variables)
|
||||
fs1_path = test.uncompress(Aarch64SbsarefMachine.ASSET_FLASH1)
|
||||
fs1_path = test.uncompress(Aarch64SbsarefMachine.ASSET_FLASH1, format="xz")
|
||||
|
||||
for path in [fs0_path, fs1_path]:
|
||||
with open(path, "ab+") as fd:
|
||||
@@ -54,15 +54,13 @@ class Aarch64SbsarefMachine(QemuSystemTest):
|
||||
|
||||
timeout = 180
|
||||
|
||||
ASSET_FLASH0 = Asset(
|
||||
('https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref/'
|
||||
'20241122-189881/edk2/SBSA_FLASH0.fd.xz'),
|
||||
'76eb89d42eebe324e4395329f47447cda9ac920aabcf99aca85424609c3384a5')
|
||||
# SBSA_FLASH0.fd.xz
|
||||
ASSET_FLASH0 = Asset('https://share.linaro.org/downloadFile?id=kyoMLGC9zXa4oA7',
|
||||
'76eb89d42eebe324e4395329f47447cda9ac920aabcf99aca85424609c3384a5')
|
||||
|
||||
ASSET_FLASH1 = Asset(
|
||||
('https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref/'
|
||||
'20241122-189881/edk2/SBSA_FLASH1.fd.xz'),
|
||||
'f850f243bd8dbd49c51e061e0f79f1697546938f454aeb59ab7d93e5f0d412fc')
|
||||
# SBSA_FLASH1.fd.xz
|
||||
ASSET_FLASH1 = Asset('https://share.linaro.org/downloadFile?id=Dj1HRXnDnKtU6Nj',
|
||||
'f850f243bd8dbd49c51e061e0f79f1697546938f454aeb59ab7d93e5f0d412fc')
|
||||
|
||||
def test_sbsaref_edk2_firmware(self):
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from aspeed import AspeedTest
|
||||
class GB200Machine(AspeedTest):
|
||||
|
||||
ASSET_GB200_FLASH = Asset(
|
||||
'https://github.com/legoater/qemu-aspeed-boot/raw/refs/heads/master/images/gb200nvl-obmc/obmc-phosphor-image-gb200nvl-obmc-20250702182348.static.mtd.xz',
|
||||
'https://github.com/legoater/qemu-aspeed-boot/raw/refs/heads/master/images/gb200nvl-bmc/openbmc-20250702182348/obmc-phosphor-image-gb200nvl-obmc-20250702182348.static.mtd.xz',
|
||||
'b84819317cb3dc762895ad507705978ef000bfc77c50c33a63bdd37921db0dbc')
|
||||
|
||||
def test_arm_aspeed_gb200_openbmc(self):
|
||||
|
||||
@@ -9,10 +9,8 @@ from aspeed import AspeedTest
|
||||
|
||||
class RainierMachine(AspeedTest):
|
||||
|
||||
ASSET_RAINIER_EMMC = Asset(
|
||||
('https://fileserver.linaro.org/s/B6pJTwWEkzSDi36/download/'
|
||||
'mmc-p10bmc-20240617.qcow2'),
|
||||
'd523fb478d2b84d5adc5658d08502bc64b1486955683814f89c6137518acd90b')
|
||||
ASSET_RAINIER_EMMC = Asset('https://kaod.org/qemu/aspeed/rainier/mmc-p10bmc-20240617.qcow2',
|
||||
'd523fb478d2b84d5adc5658d08502bc64b1486955683814f89c6137518acd90b')
|
||||
|
||||
def test_arm_aspeed_emmc_boot(self):
|
||||
self.set_machine('rainier-bmc')
|
||||
|
||||
@@ -206,12 +206,6 @@ static void test_smram_smbase_lock(void)
|
||||
qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN);
|
||||
g_assert_cmpint(qtest_readb(qts, SMBASE), ==, SMRAM_TEST_PATTERN);
|
||||
|
||||
/* check that writing junk to 0x9c before before negotiating is ignored */
|
||||
for (i = 0; i < 0xff; i++) {
|
||||
qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, i);
|
||||
g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) == 0);
|
||||
}
|
||||
|
||||
/* enable SMRAM at SMBASE */
|
||||
qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, 0xff);
|
||||
g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) == 0x01);
|
||||
|
||||
@@ -166,6 +166,7 @@ __ufs_send_transfer_request_mcq(QUfs *ufs, uint8_t lun,
|
||||
cqhp = ufs_rreg(ufs, ufs->cqdao[TEST_QID]);
|
||||
cqentry_addr = ufs->cqlba[TEST_QID] + cqhp;
|
||||
qtest_memread(ufs->dev.bus->qts, cqentry_addr, &cqentry, sizeof(cqentry));
|
||||
cqhp = (cqhp + sizeof(UfsCqEntry)) % (QUEUE_SIZE * sizeof(UfsCqEntry));
|
||||
ufs_wreg(ufs, ufs->cqdao[TEST_QID], cqhp);
|
||||
|
||||
return cqentry.status;
|
||||
@@ -208,6 +209,81 @@ static enum UtpOcsCodes ufs_send_nop_out(QUfs *ufs, UtpUpiuRsp *rsp_out)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool ufs_mcq_sq_has_space(QUfs *ufs)
|
||||
{
|
||||
uint32_t sqhp = ufs_rreg(ufs, ufs->sqdao[TEST_QID]);
|
||||
uint32_t sqtp = ufs_rreg(ufs, ufs->sqdao[TEST_QID] + 0x4);
|
||||
uint32_t next_sqtp =
|
||||
(sqtp + sizeof(UfsSqEntry)) % (QUEUE_SIZE * sizeof(UfsSqEntry));
|
||||
return next_sqtp != sqhp;
|
||||
}
|
||||
|
||||
static void
|
||||
__ufs_send_transfer_request_mcq_async(QUfs *ufs, uint8_t lun,
|
||||
const UtpTransferReqDesc *utrd)
|
||||
{
|
||||
uint32_t sqtp;
|
||||
uint64_t utrd_addr;
|
||||
|
||||
/* Wait for SQ space */
|
||||
while (!ufs_mcq_sq_has_space(ufs)) {
|
||||
qtest_clock_step(ufs->dev.bus->qts, 100);
|
||||
}
|
||||
|
||||
sqtp = ufs_rreg(ufs, ufs->sqdao[TEST_QID] + 0x4);
|
||||
utrd_addr = ufs->sqlba[TEST_QID] + sqtp;
|
||||
qtest_memwrite(ufs->dev.bus->qts, utrd_addr, utrd, sizeof(*utrd));
|
||||
sqtp = (sqtp + sizeof(UfsSqEntry)) % (QUEUE_SIZE * sizeof(UfsSqEntry));
|
||||
ufs_wreg(ufs, ufs->sqdao[TEST_QID] + 0x4, sqtp);
|
||||
}
|
||||
|
||||
static int ufs_mcq_send_nop_out_async(QUfs *ufs)
|
||||
{
|
||||
int cmd_desc_slot = alloc_cmd_desc_slot(ufs);
|
||||
uint64_t req_upiu_addr =
|
||||
ufs->cmd_desc_addr + cmd_desc_slot * UTP_COMMAND_DESCRIPTOR_SIZE;
|
||||
|
||||
/* Build up request upiu */
|
||||
UtpUpiuReq req_upiu = { 0 };
|
||||
req_upiu.header.trans_type = UFS_UPIU_TRANSACTION_NOP_OUT;
|
||||
req_upiu.header.task_tag = cmd_desc_slot;
|
||||
qtest_memwrite(ufs->dev.bus->qts, req_upiu_addr, &req_upiu,
|
||||
sizeof(req_upiu));
|
||||
|
||||
/* Build up utp transfer request descriptor */
|
||||
UtpTransferReqDesc utrd =
|
||||
ufs_build_req_utrd(req_upiu_addr, UFS_UTP_NO_DATA_TRANSFER, 0);
|
||||
|
||||
/* Send Transfer Request */
|
||||
__ufs_send_transfer_request_mcq_async(ufs, 0, &utrd);
|
||||
|
||||
return cmd_desc_slot;
|
||||
}
|
||||
|
||||
static int ufs_mcq_poll_cq(QUfs *ufs, UfsCqEntry *cqe, uint16_t n_cqe)
|
||||
{
|
||||
uint32_t cqhp, cqtp;
|
||||
uint64_t cqe_addr;
|
||||
int ix = 0;
|
||||
|
||||
cqhp = ufs_rreg(ufs, ufs->cqdao[TEST_QID]);
|
||||
cqtp = ufs_rreg(ufs, ufs->cqdao[TEST_QID] + 0x4);
|
||||
|
||||
while (cqhp != cqtp && ix < n_cqe) {
|
||||
/* read completion entry */
|
||||
cqe_addr = ufs->cqlba[TEST_QID] + cqhp;
|
||||
qtest_memread(ufs->dev.bus->qts, cqe_addr, &cqe[ix], sizeof(cqe[ix]));
|
||||
|
||||
/* advance completion queue head pointer */
|
||||
cqhp = (cqhp + sizeof(UfsCqEntry)) % (QUEUE_SIZE * sizeof(UfsCqEntry));
|
||||
ix++;
|
||||
}
|
||||
|
||||
ufs_wreg(ufs, ufs->cqdao[TEST_QID], cqhp);
|
||||
|
||||
return ix;
|
||||
}
|
||||
|
||||
static enum UtpOcsCodes ufs_send_query(QUfs *ufs, uint8_t query_function,
|
||||
uint8_t query_opcode, uint8_t idn,
|
||||
uint8_t index, uint8_t selector,
|
||||
@@ -416,6 +492,7 @@ static void ufs_init(QUfs *ufs, QGuestAllocator *alloc)
|
||||
ufs_wreg(ufs, A_UTRIACR, 0);
|
||||
|
||||
/* Enable transfer request */
|
||||
bitmap_zero(ufs->cmd_desc_bitmap, UFS_MAX_CMD_DESC);
|
||||
ufs->cmd_desc_addr =
|
||||
guest_alloc(alloc, UFS_MAX_CMD_DESC * UTP_COMMAND_DESCRIPTOR_SIZE);
|
||||
ufs->data_buffer_addr =
|
||||
@@ -679,6 +756,53 @@ static void ufstest_read_write(void *obj, void *data, QGuestAllocator *alloc)
|
||||
ufs_exit(ufs, alloc);
|
||||
}
|
||||
|
||||
static void ufstest_mcq_cq_wraparound(void *obj, void *data,
|
||||
QGuestAllocator *alloc)
|
||||
{
|
||||
QUfs *ufs = obj;
|
||||
UfsCqEntry cqe[QUEUE_SIZE];
|
||||
const int num_requests = QUEUE_SIZE;
|
||||
int i, completed = 0;
|
||||
|
||||
ufs_init(ufs, alloc);
|
||||
|
||||
/* Ensure MCQ is supported */
|
||||
g_assert_true(ufs->support_mcq);
|
||||
|
||||
for (i = 0; i < num_requests; ++i) {
|
||||
ufs_mcq_send_nop_out_async(ufs);
|
||||
}
|
||||
|
||||
while (completed != num_requests) {
|
||||
int n_cqe = ufs_mcq_poll_cq(ufs, cqe, ARRAY_SIZE(cqe));
|
||||
if (!n_cqe) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_cqe; ++i) {
|
||||
uint64_t ucdba;
|
||||
uint64_t rsp_upiu_addr;
|
||||
UtpUpiuRsp rsp_upiu;
|
||||
uint8_t tag;
|
||||
|
||||
g_assert_cmpuint(cqe[i].status, ==, UFS_OCS_SUCCESS);
|
||||
|
||||
ucdba = le64_to_cpu(cqe[i].utp_addr) & MAKE_64BIT_MASK(7, 57);
|
||||
rsp_upiu_addr = ucdba + UTP_RESPONSE_UPIU_OFFSET;
|
||||
qtest_memread(ufs->dev.bus->qts, rsp_upiu_addr, &rsp_upiu,
|
||||
sizeof(rsp_upiu));
|
||||
|
||||
tag = rsp_upiu.header.task_tag;
|
||||
release_cmd_desc_slot(ufs, tag);
|
||||
}
|
||||
|
||||
completed += n_cqe;
|
||||
}
|
||||
|
||||
g_assert_cmpint(completed, ==, num_requests);
|
||||
ufs_exit(ufs, alloc);
|
||||
}
|
||||
|
||||
static void ufstest_query_flag_request(void *obj, void *data,
|
||||
QGuestAllocator *alloc)
|
||||
{
|
||||
@@ -1129,6 +1253,8 @@ static void ufs_register_nodes(void)
|
||||
qos_add_test("init", "ufs", ufstest_init, NULL);
|
||||
qos_add_test("legacy-read-write", "ufs", ufstest_read_write, &io_test_opts);
|
||||
qos_add_test("mcq-read-write", "ufs", ufstest_read_write, &mcq_test_opts);
|
||||
qos_add_test("mcq-cq-wraparound", "ufs", ufstest_mcq_cq_wraparound,
|
||||
&mcq_test_opts);
|
||||
qos_add_test("query-flag", "ufs", ufstest_query_flag_request,
|
||||
&io_test_opts);
|
||||
qos_add_test("query-attribute", "ufs", ufstest_query_attr_request,
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
@@ -41,7 +42,7 @@ do \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
unsigned char *dummybuf;
|
||||
unsigned char *dummybuf; /* length is 2*pagesize */
|
||||
static unsigned int pagesize;
|
||||
static unsigned int pagemask;
|
||||
int test_fd;
|
||||
@@ -451,9 +452,45 @@ void check_invalid_mmaps(void)
|
||||
fail_unless(addr == MAP_FAILED);
|
||||
fail_unless(errno == ENOMEM);
|
||||
|
||||
/* Attempt to remap a region which exceeds the bounds of memory. */
|
||||
addr = mremap((void *)((uintptr_t)pagesize * 10), SIZE_MAX & ~(size_t)pagemask, pagesize, 0);
|
||||
fprintf(stdout, "%s mremap addr=%p", __func__, (void *)addr);
|
||||
fail_unless(addr == MAP_FAILED);
|
||||
fail_unless(errno == EFAULT);
|
||||
|
||||
fprintf(stdout, " passed\n");
|
||||
}
|
||||
|
||||
void check_shrink_mmaps(void)
|
||||
{
|
||||
unsigned char *a, *b, *c;
|
||||
a = mmap(NULL, pagesize * 2, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
b = mmap(NULL, pagesize * 2, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
c = mmap(NULL, pagesize * 2, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
|
||||
fail_unless(a != MAP_FAILED);
|
||||
fail_unless(b != MAP_FAILED);
|
||||
fail_unless(c != MAP_FAILED);
|
||||
|
||||
/* Ensure we can read the full mappings */
|
||||
memcpy(dummybuf, a, 2 * pagesize);
|
||||
memcpy(dummybuf, b, 2 * pagesize);
|
||||
memcpy(dummybuf, c, 2 * pagesize);
|
||||
|
||||
/* Shrink the middle mapping in-place; the others should be unaffected */
|
||||
b = mremap(b, pagesize * 2, pagesize, 0);
|
||||
fail_unless(b != MAP_FAILED);
|
||||
|
||||
/* Ensure we can still access all valid mappings */
|
||||
memcpy(dummybuf, a, 2 * pagesize);
|
||||
memcpy(dummybuf, b, pagesize);
|
||||
memcpy(dummybuf, c, 2 * pagesize);
|
||||
|
||||
munmap(a, 2 * pagesize);
|
||||
munmap(b, pagesize);
|
||||
munmap(c, 2 * pagesize);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char tempname[] = "/tmp/.cmmapXXXXXX";
|
||||
@@ -468,7 +505,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Assume pagesize is a power of two. */
|
||||
pagemask = pagesize - 1;
|
||||
dummybuf = malloc (pagesize);
|
||||
dummybuf = malloc (pagesize * 2);
|
||||
printf ("pagesize=%u pagemask=%x\n", pagesize, pagemask);
|
||||
|
||||
test_fd = mkstemp(tempname);
|
||||
@@ -496,6 +533,7 @@ int main(int argc, char **argv)
|
||||
check_file_fixed_eof_mmaps();
|
||||
check_file_unfixed_eof_mmaps();
|
||||
check_invalid_mmaps();
|
||||
check_shrink_mmaps();
|
||||
|
||||
/* Fails at the moment. */
|
||||
/* check_aligned_anonymous_fixed_mmaps_collide_with_host(); */
|
||||
|
||||
Reference in new issue
Block a user