aboutsummaryrefslogtreecommitdiff
path: root/hw/net/igbvf.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@redhat.com>2023-10-23 17:45:06 +0200
committerJason Wang <jasowang@redhat.com>2023-11-13 15:33:37 +0800
commitfe73674af1e80ad7375e627563042395a1a746b6 (patch)
tree990cef48cb12eb9cb63f047729a12f658600712a /hw/net/igbvf.c
parent69680740eafa1838527c90155a7432d51b8ff203 (diff)
downloadqemu-fe73674af1e80ad7375e627563042395a1a746b6.zip
qemu-fe73674af1e80ad7375e627563042395a1a746b6.tar.gz
qemu-fe73674af1e80ad7375e627563042395a1a746b6.tar.bz2
igb: Add a VF reset handler
Export the igb_vf_reset() helper routine from the PF model to let the IGBVF model implement its own device reset. Cc: Akihiko Odaki <akihiko.odaki@daynix.com> Suggested-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/igbvf.c')
-rw-r--r--hw/net/igbvf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/net/igbvf.c b/hw/net/igbvf.c
index d55e1e8..07343fa 100644
--- a/hw/net/igbvf.c
+++ b/hw/net/igbvf.c
@@ -273,6 +273,13 @@ static void igbvf_pci_realize(PCIDevice *dev, Error **errp)
pcie_ari_init(dev, 0x150);
}
+static void igbvf_qdev_reset_hold(Object *obj)
+{
+ PCIDevice *vf = PCI_DEVICE(obj);
+
+ igb_vf_reset(pcie_sriov_get_pf(vf), pcie_sriov_vf_number(vf));
+}
+
static void igbvf_pci_uninit(PCIDevice *dev)
{
IgbVfState *s = IGBVF(dev);
@@ -287,6 +294,7 @@ static void igbvf_class_init(ObjectClass *class, void *data)
{
DeviceClass *dc = DEVICE_CLASS(class);
PCIDeviceClass *c = PCI_DEVICE_CLASS(class);
+ ResettableClass *rc = RESETTABLE_CLASS(class);
c->realize = igbvf_pci_realize;
c->exit = igbvf_pci_uninit;
@@ -295,6 +303,8 @@ static void igbvf_class_init(ObjectClass *class, void *data)
c->revision = 1;
c->class_id = PCI_CLASS_NETWORK_ETHERNET;
+ rc->phases.hold = igbvf_qdev_reset_hold;
+
dc->desc = "Intel 82576 Virtual Function";
dc->user_creatable = false;