mirror of https://gitee.com/openkylin/qemu.git
pci: make command SERR bit writable
pcie aer needs SERR bit to be writable, and the PCI spec requires this as well. For compatibility, introduce compat global property command_serr_enable and make this bit readonly for a pre 0.14 pc machine. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
783e770693
commit
b1aeb92666
20
hw/pc_piix.c
20
hw/pc_piix.c
|
@ -217,6 +217,14 @@ static QEMUMachine pc_machine = {
|
|||
.desc = "Standard PC",
|
||||
.init = pc_init_pci,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{
|
||||
.driver = "PCI",
|
||||
.property = "command_serr_enable",
|
||||
.value = "off",
|
||||
},
|
||||
{ /* end of list */ }
|
||||
},
|
||||
.is_default = 1,
|
||||
};
|
||||
|
||||
|
@ -265,6 +273,10 @@ static QEMUMachine pc_machine_v0_12 = {
|
|||
.driver = "vmware-svga",
|
||||
.property = "rombar",
|
||||
.value = stringify(0),
|
||||
},{
|
||||
.driver = "PCI",
|
||||
.property = "command_serr_enable",
|
||||
.value = "off",
|
||||
},
|
||||
{ /* end of list */ }
|
||||
}
|
||||
|
@ -300,6 +312,10 @@ static QEMUMachine pc_machine_v0_11 = {
|
|||
.driver = "PCI",
|
||||
.property = "rombar",
|
||||
.value = stringify(0),
|
||||
},{
|
||||
.driver = "PCI",
|
||||
.property = "command_serr_enable",
|
||||
.value = "off",
|
||||
},
|
||||
{ /* end of list */ }
|
||||
}
|
||||
|
@ -347,6 +363,10 @@ static QEMUMachine pc_machine_v0_10 = {
|
|||
.driver = "PCI",
|
||||
.property = "rombar",
|
||||
.value = stringify(0),
|
||||
},{
|
||||
.driver = "PCI",
|
||||
.property = "command_serr_enable",
|
||||
.value = "off",
|
||||
},
|
||||
{ /* end of list */ }
|
||||
},
|
||||
|
|
5
hw/pci.c
5
hw/pci.c
|
@ -57,6 +57,8 @@ struct BusInfo pci_bus_info = {
|
|||
DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1),
|
||||
DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present,
|
||||
QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
|
||||
DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present,
|
||||
QEMU_PCI_CAP_SERR_BITNR, true),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
@ -568,6 +570,9 @@ static void pci_init_wmask(PCIDevice *dev)
|
|||
pci_set_word(dev->wmask + PCI_COMMAND,
|
||||
PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
|
||||
PCI_COMMAND_INTX_DISABLE);
|
||||
if (dev->cap_present & QEMU_PCI_CAP_SERR) {
|
||||
pci_word_test_and_set_mask(dev->wmask + PCI_COMMAND, PCI_COMMAND_SERR);
|
||||
}
|
||||
|
||||
memset(dev->wmask + PCI_CONFIG_HEADER_SIZE, 0xff,
|
||||
config_size - PCI_CONFIG_HEADER_SIZE);
|
||||
|
|
4
hw/pci.h
4
hw/pci.h
|
@ -118,6 +118,10 @@ enum {
|
|||
/* multifunction capable device */
|
||||
#define QEMU_PCI_CAP_MULTIFUNCTION_BITNR 3
|
||||
QEMU_PCI_CAP_MULTIFUNCTION = (1 << QEMU_PCI_CAP_MULTIFUNCTION_BITNR),
|
||||
|
||||
/* command register SERR bit enabled */
|
||||
#define QEMU_PCI_CAP_SERR_BITNR 4
|
||||
QEMU_PCI_CAP_SERR = (1 << QEMU_PCI_CAP_SERR_BITNR),
|
||||
};
|
||||
|
||||
struct PCIDevice {
|
||||
|
|
Loading…
Reference in New Issue