From c17491b63e198ac48d533f8a9d301d11c5880a36 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 12 Apr 2012 12:44:15 +1000 Subject: pseries: Fix reset of VIO network device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the PAPR VIO network device does not have a reset handler. This means that after a hard reset, H_REGISTER_LOGICAL_LAN will return an error when the new guest boot attempts to initialize the device. This patch corrects this, adding a suitable reset hook. Signed-off-by: David Gibson Signed-off-by: Andreas Färber --- hw/spapr_llan.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/spapr_llan.c b/hw/spapr_llan.c index 32dce17872..e18d2eb901 100644 --- a/hw/spapr_llan.c +++ b/hw/spapr_llan.c @@ -182,6 +182,15 @@ static NetClientInfo net_spapr_vlan_info = { .receive = spapr_vlan_receive, }; +static void spapr_vlan_reset(VIOsPAPRDevice *sdev) +{ + VIOsPAPRVLANDevice *dev = DO_UPCAST(VIOsPAPRVLANDevice, sdev, sdev); + + dev->buf_list = 0; + dev->rx_bufs = 0; + dev->isopen = 0; +} + static int spapr_vlan_init(VIOsPAPRDevice *sdev) { VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev; @@ -335,9 +344,7 @@ static target_ulong h_free_logical_lan(CPUPPCState *env, sPAPREnvironment *spapr return H_RESOURCE; } - dev->buf_list = 0; - dev->rx_bufs = 0; - dev->isopen = 0; + spapr_vlan_reset(sdev); return H_SUCCESS; } @@ -484,6 +491,7 @@ static void spapr_vlan_class_init(ObjectClass *klass, void *data) VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass); k->init = spapr_vlan_init; + k->reset = spapr_vlan_reset; k->devnode = spapr_vlan_devnode; k->dt_name = "l-lan"; k->dt_type = "network"; -- cgit v1.2.3