pci: disable intx on flr/bus reset
cover pci: disable intx on flr/bus reset
So far pci_device_reset() is used for system reset.
In that case, interrupt controller is also reset so that
all irq is are deasserted.
But now pci bus reset/flr is supported, and in that case irq needs to be disabled explicitly.
Isaku Yamahata (3):
pci: deassert intx on reset.
msi: simply write config a bit.
msix: simply write config
hw/msi.c | 5 +---- hw/msix.c | 5 +---- hw/pci.c | 9 +++++++++ hw/pci.h | 2 ++ 4 files changed, 13 insertions(+), 8 deletions(-)
PATCH 1/3 pci: deassert intx on reset.
deassert intx on device reset.
So far pci_device_reset() is used for system reset.
In that case, interrupt controller is reset at the same time so that all irq is are deasserted.
But now pci bus reset/flr is supported, and in that case irq needs to be disabled explicitly.
--- hw/pci.c | 9 +++++++++ hw/pci.h | 2 ++ 2 files changed, 11 insertions(+), 0 deletions(-)
hw/pci.c +9 -0
@@ -137,6 +137,14 @@ static void pci_update_irq_status(PCIDevice *dev) } } +void pci_device_deassert_intx (PCIDevice *dev) +{ +int i; +for (i =0 ; i <PCI_NUM_PINS ; ++i) { +qemu_set_irq (dev->irq[i],0 ); + } +} +/* * This function is called on #RST and FLR. * FLR if PCI_EXP_DEVCTL_BCR_FLR is set
@@ -152,6 +160,7 @@ void pci_device_reset(PCIDevice *dev) dev->irq_state =0 ;pci_update_irq_status (dev); +pci_device_deassert_intx (dev);/* Clear all writeable bits */ pci_word_test_and_clear_mask(dev->config + PCI_COMMAND, pci_get_word(dev->wmask + PCI_COMMAND) |
hw/pci.h +2 -0
@@ -265,6 +265,8 @@ void do_pci_info_print(Monitor *mon, const QObject *data);void do_pci_info (Monitor *mon,QObject **ret_data);void pci_bridge_update_mappings (PCIBus *b); +void pci_device_deassert_intx (PCIDevice *dev); +static inline void pci_set_byte (uint8_t *config,uint8_t val) {
Signature · 1 line
1.7.1.1
PATCH 2/3 msi: simply write config a bit.
In reply to Isaku Yamahatause pci_device_deassert_intx().
--- hw/msi.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
hw/msi.c +1 -4
@@ -255,7 +255,6 @@ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)uint8_t log_max_vecs;unsigned int vector;uint32_t pending; -int i;if (!ranges_overlap (addr, len, dev->msi_cap,msi_cap_sizeof (flags))) {return ;
@@ -296,9 +295,7 @@ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)* from using its INTx# pin (if implemented) to request * service (MSI, MSI-X, and INTx# are mutually exclusive). */ -for (i =0 ; i <PCI_NUM_PINS ; ++i) { -qemu_set_irq (dev->irq[i],0 ); - } +pci_device_deassert_intx (dev);/* * nr_vectors might be set bigger than capable. So clamp it.
Signature · 1 line
1.7.1.1
PATCH 3/3 msix: simply write config
In reply to Isaku Yamahatause pci_device_deassert_intx().
--- hw/msix.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
hw/msix.c +1 -4
@@ -159,7 +159,6 @@ void msix_write_config(PCIDevice *dev, uint32_t addr, {unsigned enable_pos = dev->msix_cap +MSIX_CONTROL_OFFSET ;int vector; -int i;if (!range_covers_byte (addr, len, enable_pos)) {return ;
@@ -169,9 +168,7 @@ void msix_write_config(PCIDevice *dev, uint32_t addr,return ; } -for (i =0 ; i <PCI_NUM_PINS ; ++i) { -qemu_set_irq (dev->irq[i],0 ); - } +pci_device_deassert_intx (dev);if (msix_function_masked (dev)) {return ;
Signature · 1 line
1.7.1.1
Quoted 5 lines · Isaku Yamahata
So far
pci_device_reset()is used for system reset.
In that case, interrupt controller is also reset so that
all irq is are deasserted.
But now pci bus reset/flr is supported, and in that case irq needs to be disabled explicitly.
Simply->simplify
Otherwise looks good. Applied, thanks!
Quoted 10 lines
Isaku Yamahata (3):
pci: deassert intx on reset.
msi: simply write config a bit.
msix: simply write confighw/msi.c | 5 +---- hw/msix.c | 5 +---- hw/pci.c | 9 +++++++++ hw/pci.h | 2 ++ 4 files changed, 13 insertions(+), 8 deletions(-)