Skip to content

Commit

Permalink
Implement virtio reset
Browse files Browse the repository at this point in the history
The guest may issue a RESET command for virtio. So far we didn't bother
to implement it, but with my new bootloader we actually need it for Linux
to get back to a safe state.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
  • Loading branch information
agraf authored and aurel32 committed Apr 9, 2010
1 parent 73cdf3f commit baf0b55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions hw/s390-virtio-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ typedef struct {
static const VirtIOBindings virtio_s390_bindings;

static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev);
static void s390_virtio_device_sync(VirtIOS390Device *dev);

VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)
{
Expand Down Expand Up @@ -185,7 +184,7 @@ static ram_addr_t s390_virtio_next_ring(VirtIOS390Bus *bus)
return r;
}

static void s390_virtio_device_sync(VirtIOS390Device *dev)
void s390_virtio_device_sync(VirtIOS390Device *dev)
{
VirtIOS390Bus *bus = DO_UPCAST(VirtIOS390Bus, bus, dev->qdev.parent_bus);
ram_addr_t cur_offs;
Expand Down
1 change: 1 addition & 0 deletions hw/s390-virtio-bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ extern VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
int *vq_num);
extern VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus,
ram_addr_t mem);
extern void s390_virtio_device_sync(VirtIOS390Device *dev);
9 changes: 5 additions & 4 deletions hw/s390-virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ int s390_virtio_hypercall(CPUState *env)
break;
case KVM_S390_VIRTIO_RESET:
{
/* Virtio_reset resets the internal addresses, so we'd have to sync
them up again. We don't want to reallocate a vring though, so let's
just not reset. */
/* virtio_reset(dev->vdev); */
VirtIOS390Device *dev;

dev = s390_virtio_bus_find_mem(s390_bus, mem);
virtio_reset(dev->vdev);
s390_virtio_device_sync(dev);
break;
}
case KVM_S390_VIRTIO_SET_STATUS:
Expand Down

0 comments on commit baf0b55

Please sign in to comment.