Compare commits
21 Commits
v0.14.0
...
stable-0.1
Author | SHA1 | Date | |
---|---|---|---|
|
56a60dd6d6 | ||
|
76c9b330e3 | ||
|
9b33410d3b | ||
|
419f1c3503 | ||
|
fc5c4a7a63 | ||
|
22da30fc28 | ||
|
f8a4bf59fe | ||
|
b3d657bce4 | ||
|
a0af597d00 | ||
|
d4b4ba03e8 | ||
|
6f162b368f | ||
|
b25a1bbcda | ||
|
3d19c4e338 | ||
|
2288eb3af2 | ||
|
ecebecffe3 | ||
|
6f9cace17a | ||
|
57c864b1f3 | ||
|
4b35dfea68 | ||
|
cdd8152e56 | ||
|
74b121a007 | ||
|
8d610b6ba2 |
22
block.c
22
block.c
@@ -697,14 +697,22 @@ void bdrv_close_all(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* make a BlockDriverState anonymous by removing from bdrv_state list.
|
||||
Also, NULL terminate the device_name to prevent double remove */
|
||||
void bdrv_make_anon(BlockDriverState *bs)
|
||||
{
|
||||
if (bs->device_name[0] != '\0') {
|
||||
QTAILQ_REMOVE(&bdrv_states, bs, list);
|
||||
}
|
||||
bs->device_name[0] = '\0';
|
||||
}
|
||||
|
||||
void bdrv_delete(BlockDriverState *bs)
|
||||
{
|
||||
assert(!bs->peer);
|
||||
|
||||
/* remove from list, if necessary */
|
||||
if (bs->device_name[0] != '\0') {
|
||||
QTAILQ_REMOVE(&bdrv_states, bs, list);
|
||||
}
|
||||
bdrv_make_anon(bs);
|
||||
|
||||
bdrv_close(bs);
|
||||
if (bs->file != NULL) {
|
||||
@@ -2295,6 +2303,14 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
|
||||
MultiwriteCB *mcb;
|
||||
int i;
|
||||
|
||||
/* don't submit writes if we don't have a medium */
|
||||
if (bs->drv == NULL) {
|
||||
for (i = 0; i < num_reqs; i++) {
|
||||
reqs[i].error = -ENOMEDIUM;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (num_reqs == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
1
block.h
1
block.h
@@ -66,6 +66,7 @@ int bdrv_create(BlockDriver *drv, const char* filename,
|
||||
QEMUOptionParameter *options);
|
||||
int bdrv_create_file(const char* filename, QEMUOptionParameter *options);
|
||||
BlockDriverState *bdrv_new(const char *device_name);
|
||||
void bdrv_make_anon(BlockDriverState *bs);
|
||||
void bdrv_delete(BlockDriverState *bs);
|
||||
int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags);
|
||||
int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
|
||||
|
@@ -18,7 +18,7 @@ typedef struct {
|
||||
BdrvCheckResult *result;
|
||||
bool fix; /* whether to fix invalid offsets */
|
||||
|
||||
size_t nclusters;
|
||||
uint64_t nclusters;
|
||||
uint32_t *used_clusters; /* referenced cluster bitmap */
|
||||
|
||||
QEDRequest request;
|
||||
@@ -176,7 +176,7 @@ static int qed_check_l1_table(QEDCheck *check, QEDTable *table)
|
||||
static void qed_check_for_leaks(QEDCheck *check)
|
||||
{
|
||||
BDRVQEDState *s = check->s;
|
||||
size_t i;
|
||||
uint64_t i;
|
||||
|
||||
for (i = s->header.header_size; i < check->nclusters; i++) {
|
||||
if (!qed_test_bit(check->used_clusters, i)) {
|
||||
|
@@ -251,7 +251,7 @@ static inline uint64_t qed_offset_into_cluster(BDRVQEDState *s, uint64_t offset)
|
||||
return offset & (s->header.cluster_size - 1);
|
||||
}
|
||||
|
||||
static inline unsigned int qed_bytes_to_clusters(BDRVQEDState *s, size_t bytes)
|
||||
static inline uint64_t qed_bytes_to_clusters(BDRVQEDState *s, uint64_t bytes)
|
||||
{
|
||||
return qed_start_of_cluster(s, bytes + (s->header.cluster_size - 1)) /
|
||||
(s->header.cluster_size - 1);
|
||||
|
25
blockdev.c
25
blockdev.c
@@ -726,8 +726,6 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
{
|
||||
const char *id = qdict_get_str(qdict, "id");
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState **ptr;
|
||||
Property *prop;
|
||||
|
||||
bs = bdrv_find(id);
|
||||
if (!bs) {
|
||||
@@ -744,24 +742,17 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
bdrv_flush(bs);
|
||||
bdrv_close(bs);
|
||||
|
||||
/* clean up guest state from pointing to host resource by
|
||||
* finding and removing DeviceState "drive" property */
|
||||
/* if we have a device associated with this BlockDriverState (bs->peer)
|
||||
* then we need to make the drive anonymous until the device
|
||||
* can be removed. If this is a drive with no device backing
|
||||
* then we can just get rid of the block driver state right here.
|
||||
*/
|
||||
if (bs->peer) {
|
||||
for (prop = bs->peer->info->props; prop && prop->name; prop++) {
|
||||
if (prop->info->type == PROP_TYPE_DRIVE) {
|
||||
ptr = qdev_get_prop_ptr(bs->peer, prop);
|
||||
if (*ptr == bs) {
|
||||
bdrv_detach(bs, bs->peer);
|
||||
*ptr = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bdrv_make_anon(bs);
|
||||
} else {
|
||||
drive_uninit(drive_get_by_blockdev(bs));
|
||||
}
|
||||
|
||||
/* clean up host side */
|
||||
drive_uninit(drive_get_by_blockdev(bs));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
configure
vendored
2
configure
vendored
@@ -1795,7 +1795,7 @@ if test "$rbd" != "no" ; then
|
||||
#include <rados/librados.h>
|
||||
int main(void) { rados_initialize(0, NULL); return 0; }
|
||||
EOF
|
||||
rbd_libs="-lrados -lcrypto"
|
||||
rbd_libs="-lrados"
|
||||
if compile_prog "" "$rbd_libs" ; then
|
||||
librados_too_old=no
|
||||
cat > $TMPC <<EOF
|
||||
|
@@ -188,7 +188,7 @@ static void qdev_applesmc_isa_reset(DeviceState *dev)
|
||||
QLIST_REMOVE(d, node);
|
||||
}
|
||||
|
||||
applesmc_add_key(s, "REV ", 6, "\0x01\0x13\0x0f\0x00\0x00\0x03");
|
||||
applesmc_add_key(s, "REV ", 6, "\x01\x13\x0f\x00\x00\x03");
|
||||
applesmc_add_key(s, "OSK0", 32, s->osk);
|
||||
applesmc_add_key(s, "OSK1", 32, s->osk + 32);
|
||||
applesmc_add_key(s, "NATJ", 1, "\0");
|
||||
|
@@ -715,7 +715,6 @@ static int hpet_init(SysBusDevice *dev)
|
||||
s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
|
||||
s->capability |= ((HPET_CLK_PERIOD) << 32);
|
||||
|
||||
isa_reserve_irq(RTC_ISA_IRQ);
|
||||
qdev_init_gpio_in(&dev->qdev, hpet_handle_rtc_irq, 1);
|
||||
|
||||
/* HPET Area */
|
||||
|
@@ -122,7 +122,7 @@ static void pci_piix_init_ports(PCIIDEState *d) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
ide_bus_new(&d->bus[i], &d->dev.qdev, i);
|
||||
ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2);
|
||||
ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq));
|
||||
ide_init2(&d->bus[i], isa_get_irq(port_info[i].isairq));
|
||||
|
||||
bmdma_init(&d->bus[i], &d->bmdma[i]);
|
||||
d->bmdma[i].bus = &d->bus[i];
|
||||
|
@@ -145,7 +145,7 @@ static void vt82c686b_init_ports(PCIIDEState *d) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
ide_bus_new(&d->bus[i], &d->dev.qdev, i);
|
||||
ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2);
|
||||
ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq));
|
||||
ide_init2(&d->bus[i], isa_get_irq(port_info[i].isairq));
|
||||
|
||||
bmdma_init(&d->bus[i], &d->bmdma[i]);
|
||||
d->bmdma[i].bus = &d->bus[i];
|
||||
|
16
hw/isa-bus.c
16
hw/isa-bus.c
@@ -25,7 +25,6 @@
|
||||
struct ISABus {
|
||||
BusState qbus;
|
||||
qemu_irq *irqs;
|
||||
uint32_t assigned;
|
||||
};
|
||||
static ISABus *isabus;
|
||||
target_phys_addr_t isa_mem_base = 0;
|
||||
@@ -61,33 +60,24 @@ void isa_bus_irqs(qemu_irq *irqs)
|
||||
}
|
||||
|
||||
/*
|
||||
* isa_reserve_irq() reserves the ISA irq and returns the corresponding
|
||||
* qemu_irq entry for the i8259.
|
||||
* isa_get_irq() returns the corresponding qemu_irq entry for the i8259.
|
||||
*
|
||||
* This function is only for special cases such as the 'ferr', and
|
||||
* temporary use for normal devices until they are converted to qdev.
|
||||
*/
|
||||
qemu_irq isa_reserve_irq(int isairq)
|
||||
qemu_irq isa_get_irq(int isairq)
|
||||
{
|
||||
if (isairq < 0 || isairq > 15) {
|
||||
hw_error("isa irq %d invalid", isairq);
|
||||
}
|
||||
if (isabus->assigned & (1 << isairq)) {
|
||||
hw_error("isa irq %d already assigned", isairq);
|
||||
}
|
||||
isabus->assigned |= (1 << isairq);
|
||||
return isabus->irqs[isairq];
|
||||
}
|
||||
|
||||
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
|
||||
{
|
||||
assert(dev->nirqs < ARRAY_SIZE(dev->isairq));
|
||||
if (isabus->assigned & (1 << isairq)) {
|
||||
hw_error("isa irq %d already assigned", isairq);
|
||||
}
|
||||
isabus->assigned |= (1 << isairq);
|
||||
dev->isairq[dev->nirqs] = isairq;
|
||||
*p = isabus->irqs[isairq];
|
||||
*p = isa_get_irq(isairq);
|
||||
dev->nirqs++;
|
||||
}
|
||||
|
||||
|
2
hw/isa.h
2
hw/isa.h
@@ -26,7 +26,7 @@ struct ISADeviceInfo {
|
||||
|
||||
ISABus *isa_bus_new(DeviceState *dev);
|
||||
void isa_bus_irqs(qemu_irq *irqs);
|
||||
qemu_irq isa_reserve_irq(int isairq);
|
||||
qemu_irq isa_get_irq(int isairq);
|
||||
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
|
||||
void isa_init_ioport(ISADevice *dev, uint16_t ioport);
|
||||
void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length);
|
||||
|
@@ -785,6 +785,12 @@ static void do_mac_write(lan9118_state *s, int reg, uint32_t val)
|
||||
case MAC_FLOW:
|
||||
s->mac_flow = val & 0xffff0000;
|
||||
break;
|
||||
case MAC_VLAN1:
|
||||
/* Writing to this register changes a condition for
|
||||
* FrameTooLong bit in rx_status. Since we do not set
|
||||
* FrameTooLong anyway, just ignore write to this.
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
hw_error("lan9118: Unimplemented MAC register write: %d = 0x%x\n",
|
||||
s->mac_cmd & 0xf, val);
|
||||
|
@@ -842,10 +842,29 @@ static uint8_t lsi_get_msgbyte(LSIState *s)
|
||||
return data;
|
||||
}
|
||||
|
||||
/* Skip the next n bytes during a MSGOUT phase. */
|
||||
static void lsi_skip_msgbytes(LSIState *s, unsigned int n)
|
||||
{
|
||||
s->dnad += n;
|
||||
s->dbc -= n;
|
||||
}
|
||||
|
||||
static void lsi_do_msgout(LSIState *s)
|
||||
{
|
||||
uint8_t msg;
|
||||
int len;
|
||||
uint32_t current_tag;
|
||||
SCSIDevice *current_dev;
|
||||
lsi_request *p, *p_next;
|
||||
int id;
|
||||
|
||||
if (s->current) {
|
||||
current_tag = s->current->tag;
|
||||
} else {
|
||||
current_tag = s->select_tag;
|
||||
}
|
||||
id = (current_tag >> 8) & 0xf;
|
||||
current_dev = s->bus.devs[id];
|
||||
|
||||
DPRINTF("MSG out len=%d\n", s->dbc);
|
||||
while (s->dbc) {
|
||||
@@ -869,11 +888,11 @@ static void lsi_do_msgout(LSIState *s)
|
||||
switch (msg) {
|
||||
case 1:
|
||||
DPRINTF("SDTR (ignored)\n");
|
||||
s->dbc -= 2;
|
||||
lsi_skip_msgbytes(s, 2);
|
||||
break;
|
||||
case 3:
|
||||
DPRINTF("WDTR (ignored)\n");
|
||||
s->dbc -= 1;
|
||||
lsi_skip_msgbytes(s, 1);
|
||||
break;
|
||||
default:
|
||||
goto bad;
|
||||
@@ -891,6 +910,51 @@ static void lsi_do_msgout(LSIState *s)
|
||||
BADF("ORDERED queue not implemented\n");
|
||||
s->select_tag |= lsi_get_msgbyte(s) | LSI_TAG_VALID;
|
||||
break;
|
||||
case 0x0d:
|
||||
/* The ABORT TAG message clears the current I/O process only. */
|
||||
DPRINTF("MSG: ABORT TAG tag=0x%x\n", current_tag);
|
||||
current_dev->info->cancel_io(current_dev, current_tag);
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
case 0x06:
|
||||
case 0x0e:
|
||||
case 0x0c:
|
||||
/* The ABORT message clears all I/O processes for the selecting
|
||||
initiator on the specified logical unit of the target. */
|
||||
if (msg == 0x06) {
|
||||
DPRINTF("MSG: ABORT tag=0x%x\n", current_tag);
|
||||
}
|
||||
/* The CLEAR QUEUE message clears all I/O processes for all
|
||||
initiators on the specified logical unit of the target. */
|
||||
if (msg == 0x0e) {
|
||||
DPRINTF("MSG: CLEAR QUEUE tag=0x%x\n", current_tag);
|
||||
}
|
||||
/* The BUS DEVICE RESET message clears all I/O processes for all
|
||||
initiators on all logical units of the target. */
|
||||
if (msg == 0x0c) {
|
||||
DPRINTF("MSG: BUS DEVICE RESET tag=0x%x\n", current_tag);
|
||||
}
|
||||
|
||||
/* clear the current I/O process */
|
||||
current_dev->info->cancel_io(current_dev, current_tag);
|
||||
|
||||
/* As the current implemented devices scsi_disk and scsi_generic
|
||||
only support one LUN, we don't need to keep track of LUNs.
|
||||
Clearing I/O processes for other initiators could be possible
|
||||
for scsi_generic by sending a SG_SCSI_RESET to the /dev/sgX
|
||||
device, but this is currently not implemented (and seems not
|
||||
to be really necessary). So let's simply clear all queued
|
||||
commands for the current device: */
|
||||
id = current_tag & 0x0000ff00;
|
||||
QTAILQ_FOREACH_SAFE(p, &s->queue, next, p_next) {
|
||||
if ((p->tag & 0x0000ff00) == id) {
|
||||
current_dev->info->cancel_io(current_dev, p->tag);
|
||||
QTAILQ_REMOVE(&s->queue, p, next);
|
||||
}
|
||||
}
|
||||
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
default:
|
||||
if ((msg & 0x80) == 0) {
|
||||
goto bad;
|
||||
|
@@ -369,7 +369,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device,
|
||||
qdev_init_nofail(eeprom);
|
||||
|
||||
/* init other devices */
|
||||
pit = pit_init(0x40, isa_reserve_irq(0));
|
||||
pit = pit_init(0x40, isa_get_irq(0));
|
||||
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
|
||||
DMA_init(0, cpu_exit_irq);
|
||||
|
||||
|
@@ -919,7 +919,7 @@ void mips_malta_init (ram_addr_t ram_size,
|
||||
isa_bus_irqs(i8259);
|
||||
pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
|
||||
usb_uhci_piix4_init(pci_bus, piix4_devfn + 2);
|
||||
smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_reserve_irq(9),
|
||||
smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(9),
|
||||
NULL, NULL, 0);
|
||||
eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
|
||||
for (i = 0; i < 8; i++) {
|
||||
@@ -930,7 +930,7 @@ void mips_malta_init (ram_addr_t ram_size,
|
||||
qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
|
||||
qdev_init_nofail(eeprom);
|
||||
}
|
||||
pit = pit_init(0x40, isa_reserve_irq(0));
|
||||
pit = pit_init(0x40, isa_get_irq(0));
|
||||
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
|
||||
DMA_init(0, cpu_exit_irq);
|
||||
|
||||
|
2
hw/pc.c
2
hw/pc.c
@@ -1110,7 +1110,7 @@ void pc_basic_device_init(qemu_irq *isa_irq,
|
||||
|
||||
qemu_register_boot_set(pc_boot_set, *rtc_state);
|
||||
|
||||
pit = pit_init(0x40, isa_reserve_irq(0));
|
||||
pit = pit_init(0x40, isa_get_irq(0));
|
||||
pcspk_init(pit);
|
||||
|
||||
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
|
||||
|
@@ -110,7 +110,7 @@ static void pc_init1(ram_addr_t ram_size,
|
||||
}
|
||||
isa_bus_irqs(isa_irq);
|
||||
|
||||
pc_register_ferr_irq(isa_reserve_irq(13));
|
||||
pc_register_ferr_irq(isa_get_irq(13));
|
||||
|
||||
pc_vga_init(pci_enabled? pci_bus: NULL);
|
||||
|
||||
@@ -166,7 +166,7 @@ static void pc_init1(ram_addr_t ram_size,
|
||||
smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
|
||||
/* TODO: Populate SPD eeprom data. */
|
||||
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
|
||||
isa_reserve_irq(9), *cmos_s3, *smi_irq,
|
||||
isa_get_irq(9), *cmos_s3, *smi_irq,
|
||||
kvm_enabled());
|
||||
for (i = 0; i < 8; i++) {
|
||||
DeviceState *eeprom;
|
||||
|
@@ -690,7 +690,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
|
||||
hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
|
||||
}
|
||||
|
||||
for(i = 0; i < 1/*MAX_IDE_BUS*/; i++) {
|
||||
for(i = 0; i < MAX_IDE_BUS; i++) {
|
||||
isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
|
||||
hd[2 * i],
|
||||
hd[2 * i + 1]);
|
||||
|
2
hw/sd.c
2
hw/sd.c
@@ -1168,6 +1168,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
|
||||
case 13: /* ACMD13: SD_STATUS */
|
||||
switch (sd->state) {
|
||||
case sd_transfer_state:
|
||||
sd->state = sd_sendingdata_state;
|
||||
sd->data_start = 0;
|
||||
sd->data_offset = 0;
|
||||
return sd_r1;
|
||||
@@ -1182,6 +1183,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
|
||||
case sd_transfer_state:
|
||||
*(uint32_t *) sd->data = sd->blk_written;
|
||||
|
||||
sd->state = sd_sendingdata_state;
|
||||
sd->data_start = 0;
|
||||
sd->data_offset = 0;
|
||||
return sd_r1;
|
||||
|
@@ -47,8 +47,10 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
|
||||
log = __sync_fetch_and_and(from, 0);
|
||||
while ((bit = sizeof(log) > sizeof(int) ?
|
||||
ffsll(log) : ffs(log))) {
|
||||
ram_addr_t ram_addr;
|
||||
bit -= 1;
|
||||
cpu_physical_memory_set_dirty(addr + bit * VHOST_LOG_PAGE);
|
||||
ram_addr = cpu_get_physical_page_desc(addr + bit * VHOST_LOG_PAGE);
|
||||
cpu_physical_memory_set_dirty(ram_addr);
|
||||
log &= ~(0x1ull << bit);
|
||||
}
|
||||
addr += VHOST_LOG_CHUNK;
|
||||
|
@@ -290,6 +290,10 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)
|
||||
virtio_blk_rw_complete(req, -EIO);
|
||||
return;
|
||||
}
|
||||
if (req->qiov.size % req->dev->conf->logical_block_size) {
|
||||
virtio_blk_rw_complete(req, -EIO);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mrb->num_writes == 32) {
|
||||
virtio_submit_multiwrite(req->dev->bs, mrb);
|
||||
@@ -317,6 +321,10 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req)
|
||||
virtio_blk_rw_complete(req, -EIO);
|
||||
return;
|
||||
}
|
||||
if (req->qiov.size % req->dev->conf->logical_block_size) {
|
||||
virtio_blk_rw_complete(req, -EIO);
|
||||
return;
|
||||
}
|
||||
|
||||
acb = bdrv_aio_readv(req->dev->bs, sector, &req->qiov,
|
||||
req->qiov.size / BDRV_SECTOR_SIZE,
|
||||
|
@@ -79,7 +79,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
|
||||
VirtIONet *n = to_virtio_net(vdev);
|
||||
struct virtio_net_config netcfg;
|
||||
|
||||
netcfg.status = lduw_p(&n->status);
|
||||
stw_p(&netcfg.status, n->status);
|
||||
memcpy(netcfg.mac, n->mac, ETH_ALEN);
|
||||
memcpy(config, &netcfg, sizeof(netcfg));
|
||||
}
|
||||
@@ -678,7 +678,7 @@ static ssize_t virtio_net_receive(VLANClientState *nc, const uint8_t *buf, size_
|
||||
}
|
||||
|
||||
if (mhdr) {
|
||||
mhdr->num_buffers = lduw_p(&i);
|
||||
stw_p(&mhdr->num_buffers, i);
|
||||
}
|
||||
|
||||
virtqueue_flush(n->rx_vq, i);
|
||||
|
@@ -160,13 +160,6 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
|
||||
if (proxy->vdev->config_vector != VIRTIO_NO_VECTOR) {
|
||||
return msix_vector_use(&proxy->pci_dev, proxy->vdev->config_vector);
|
||||
}
|
||||
|
||||
/* Try to find out if the guest has bus master disabled, but is
|
||||
in ready state. Then we have a buggy guest OS. */
|
||||
if ((proxy->vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&
|
||||
!(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
|
||||
proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -651,6 +644,12 @@ static void virtio_pci_vmstate_change(void *opaque, bool running)
|
||||
VirtIOPCIProxy *proxy = opaque;
|
||||
|
||||
if (running) {
|
||||
/* Try to find out if the guest has bus master disabled, but is
|
||||
in ready state. Then we have a buggy guest OS. */
|
||||
if ((proxy->vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&
|
||||
!(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
|
||||
proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
|
||||
}
|
||||
virtio_pci_start_ioeventfd(proxy);
|
||||
} else {
|
||||
virtio_pci_stop_ioeventfd(proxy);
|
||||
|
@@ -92,6 +92,7 @@ typedef struct {
|
||||
void (*save_queue)(void * opaque, int n, QEMUFile *f);
|
||||
int (*load_config)(void * opaque, QEMUFile *f);
|
||||
int (*load_queue)(void * opaque, int n, QEMUFile *f);
|
||||
int (*load_done)(void * opaque, QEMUFile *f);
|
||||
unsigned (*get_features)(void * opaque);
|
||||
bool (*query_guest_notifiers)(void * opaque);
|
||||
int (*set_guest_notifiers)(void * opaque, bool assigned);
|
||||
|
6
net.c
6
net.c
@@ -1025,7 +1025,11 @@ static const struct {
|
||||
.name = "vhostfd",
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "file descriptor of an already opened vhost net device",
|
||||
},
|
||||
}, {
|
||||
.name = "vhostforce",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
.help = "force vhost on for non-MSIX virtio guests",
|
||||
},
|
||||
#endif /* _WIN32 */
|
||||
{ /* end of list */ }
|
||||
},
|
||||
|
@@ -2506,6 +2506,11 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (qemu_opt_get(opts, "backend") == NULL) {
|
||||
fprintf(stderr, "chardev: \"%s\" missing backend\n",
|
||||
qemu_opts_id(opts));
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(backend_table); i++) {
|
||||
if (strcmp(backend_table[i].name, qemu_opt_get(opts, "backend")) == 0)
|
||||
break;
|
||||
|
@@ -848,8 +848,8 @@ static int tight_compress_data(VncState *vs, int stream_id, size_t bytes,
|
||||
zstream->avail_in = vs->tight.tight.offset;
|
||||
zstream->next_out = vs->tight.zlib.buffer + vs->tight.zlib.offset;
|
||||
zstream->avail_out = vs->tight.zlib.capacity - vs->tight.zlib.offset;
|
||||
previous_out = zstream->avail_out;
|
||||
zstream->data_type = Z_BINARY;
|
||||
previous_out = zstream->total_out;
|
||||
|
||||
/* start encoding */
|
||||
if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) {
|
||||
@@ -858,7 +858,8 @@ static int tight_compress_data(VncState *vs, int stream_id, size_t bytes,
|
||||
}
|
||||
|
||||
vs->tight.zlib.offset = vs->tight.zlib.capacity - zstream->avail_out;
|
||||
bytes = zstream->total_out - previous_out;
|
||||
/* ...how much data has actually been produced by deflate() */
|
||||
bytes = previous_out - zstream->avail_out;
|
||||
|
||||
tight_send_compact_size(vs, bytes);
|
||||
vnc_write(vs, vs->tight.zlib.buffer, bytes);
|
||||
|
@@ -103,8 +103,8 @@ static int vnc_zlib_stop(VncState *vs)
|
||||
zstream->avail_in = vs->zlib.zlib.offset;
|
||||
zstream->next_out = vs->output.buffer + vs->output.offset;
|
||||
zstream->avail_out = vs->output.capacity - vs->output.offset;
|
||||
previous_out = zstream->avail_out;
|
||||
zstream->data_type = Z_BINARY;
|
||||
previous_out = zstream->total_out;
|
||||
|
||||
// start encoding
|
||||
if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) {
|
||||
@@ -113,7 +113,7 @@ static int vnc_zlib_stop(VncState *vs)
|
||||
}
|
||||
|
||||
vs->output.offset = vs->output.capacity - zstream->avail_out;
|
||||
return zstream->total_out - previous_out;
|
||||
return previous_out - zstream->avail_out;
|
||||
}
|
||||
|
||||
int vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
|
||||
|
1
ui/vnc.c
1
ui/vnc.c
@@ -2349,6 +2349,7 @@ static void vnc_init_timer(VncDisplay *vd)
|
||||
vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
|
||||
if (vd->timer == NULL && !QTAILQ_EMPTY(&vd->clients)) {
|
||||
vd->timer = qemu_new_timer(rt_clock, vnc_refresh, vd);
|
||||
vnc_dpy_resize(vd->ds);
|
||||
vnc_refresh(vd);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user