virtio.c (afd76ffba966a072a7bbd0048bdf3b2ab69d3d4a) virtio.c (db812c4073c77c8a64db8d6663b3416a587c7b4a)
1/*
2 * Virtio Support
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 1992 unchanged lines hidden (view full) ---

2001 k->set_features(vdev, val);
2002 }
2003 vdev->guest_features = val;
2004 return bad ? -1 : 0;
2005}
2006
2007int virtio_set_features(VirtIODevice *vdev, uint64_t val)
2008{
1/*
2 * Virtio Support
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 1992 unchanged lines hidden (view full) ---

2001 k->set_features(vdev, val);
2002 }
2003 vdev->guest_features = val;
2004 return bad ? -1 : 0;
2005}
2006
2007int virtio_set_features(VirtIODevice *vdev, uint64_t val)
2008{
2009 /*
2009 int ret;
2010 /*
2010 * The driver must not attempt to set features after feature negotiation
2011 * has finished.
2012 */
2013 if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) {
2014 return -EINVAL;
2015 }
2011 * The driver must not attempt to set features after feature negotiation
2012 * has finished.
2013 */
2014 if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) {
2015 return -EINVAL;
2016 }
2016 return virtio_set_features_nocheck(vdev, val);
2017 ret = virtio_set_features_nocheck(vdev, val);
2018 if (!ret && virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
2019 /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches. */
2020 int i;
2021 for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
2022 if (vdev->vq[i].vring.num != 0) {
2023 virtio_init_region_cache(vdev, i);
2024 }
2025 }
2026 }
2027 return ret;
2017}
2018
2019int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
2020{
2021 int i, ret;
2022 int32_t config_len;
2023 uint32_t num;
2024 uint32_t features;

--- 715 unchanged lines hidden ---
2028}
2029
2030int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
2031{
2032 int i, ret;
2033 int32_t config_len;
2034 uint32_t num;
2035 uint32_t features;

--- 715 unchanged lines hidden ---