Exemplo n.º 1
0
Arquivo: vhost.c Projeto: iggy/qemu
void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
{
    int i;
    for (i = 0; i < hdev->nvqs; ++i) {
        vhost_virtqueue_cleanup(hdev,
                                vdev,
                                hdev->vqs + i,
                                i);
    }
    vhost_client_sync_dirty_bitmap(&hdev->client, 0,
                                   (target_phys_addr_t)~0x0ull);
    hdev->started = false;
    qemu_free(hdev->log);
    hdev->log_size = 0;
}
Exemplo n.º 2
0
static inline void vhost_dev_log_resize(struct vhost_dev* dev, uint64_t size)
{
    vhost_log_chunk_t *log;
    uint64_t log_base;
    int r;
    if (size) {
        log = qemu_mallocz(size * sizeof *log);
    } else {
        log = NULL;
    }
    log_base = (uint64_t)(unsigned long)log;
    r = ioctl(dev->control, VHOST_SET_LOG_BASE, &log_base);
    assert(r >= 0);
    vhost_client_sync_dirty_bitmap(&dev->client, 0,
                                   (target_phys_addr_t)~0x0ull);
    if (dev->log) {
        qemu_free(dev->log);
    }
    dev->log = log;
    dev->log_size = size;
}
Exemplo n.º 3
0
static inline void vhost_dev_log_resize(struct vhost_dev* dev, uint64_t size)
{
    vhost_log_chunk_t *log;
    uint64_t log_base;
    int r;
    if (size) {
        log = qemu_mallocz(size * sizeof *log);
    } else {
        log = NULL;
    }
    log_base = (uint64_t)(unsigned long)log;
    r = ioctl(dev->control, VHOST_SET_LOG_BASE, &log_base);
    assert(r >= 0);
    /* Sync only the range covered by the old log */
    vhost_client_sync_dirty_bitmap(&dev->client, 0,
                                   dev->log_size * VHOST_LOG_CHUNK - 1);
    if (dev->log) {
        qemu_free(dev->log);
    }
    dev->log = log;
    dev->log_size = size;
}
Exemplo n.º 4
0
void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
{
    int i, r;

    for (i = 0; i < hdev->nvqs; ++i) {
        vhost_virtqueue_cleanup(hdev,
                                vdev,
                                hdev->vqs + i,
                                i);
    }
    vhost_client_sync_dirty_bitmap(&hdev->client, 0,
                                   (target_phys_addr_t)~0x0ull);
    r = vdev->binding->set_guest_notifiers(vdev->binding_opaque, false);
    if (r < 0) {
        fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", r);
        fflush(stderr);
    }
    assert (r >= 0);

    hdev->started = false;
    qemu_free(hdev->log);
    hdev->log_size = 0;
}