mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
igb: Add Function Level Reset to PF and VF
The Intel 82576EB GbE Controller say that the Physical and Virtual
Functions support Function Level Reset. Add the capability to the PF
device model using device property "x-pcie-flr-init" which is "on" by
default and "off" for machines <= 8.1 to preserve compatibility.
The FLR capability of the VF model is defined according to the FLR
property of the PF, this to avoid adding an extra compatibility
property.
Cc: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
Fixes: 3a977deebe
("Intrdocue igb device emulation")
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
fe73674af1
commit
d90014fc33
3 changed files with 20 additions and 1 deletions
|
@ -78,6 +78,7 @@ struct IGBState {
|
|||
uint32_t ioaddr;
|
||||
|
||||
IGBCore core;
|
||||
bool has_flr;
|
||||
};
|
||||
|
||||
#define IGB_CAP_SRIOV_OFFSET (0x160)
|
||||
|
@ -101,6 +102,9 @@ static void igb_write_config(PCIDevice *dev, uint32_t addr,
|
|||
|
||||
trace_igb_write_config(addr, val, len);
|
||||
pci_default_write_config(dev, addr, val, len);
|
||||
if (s->has_flr) {
|
||||
pcie_cap_flr_write_config(dev, addr, val, len);
|
||||
}
|
||||
|
||||
if (range_covers_byte(addr, len, PCI_COMMAND) &&
|
||||
(dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
|
||||
|
@ -433,6 +437,10 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error **errp)
|
|||
}
|
||||
|
||||
/* PCIe extended capabilities (in order) */
|
||||
if (s->has_flr) {
|
||||
pcie_cap_flr_init(pci_dev);
|
||||
}
|
||||
|
||||
if (pcie_aer_init(pci_dev, 1, 0x100, 0x40, errp) < 0) {
|
||||
hw_error("Failed to initialize AER capability");
|
||||
}
|
||||
|
@ -588,6 +596,7 @@ static const VMStateDescription igb_vmstate = {
|
|||
|
||||
static Property igb_properties[] = {
|
||||
DEFINE_NIC_PROPERTIES(IGBState, conf),
|
||||
DEFINE_PROP_BOOL("x-pcie-flr-init", IGBState, has_flr, true),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue