[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/6] pcie: fix pcie_cap_slot_write_config().
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 1/6] pcie: fix pcie_cap_slot_write_config(). |
Date: |
Wed, 27 Oct 2010 19:21:16 +0900 |
This patch fixes pcie_cap_slot_write_config() which is broken by
5704608988972359473ce609f9e4884808115b58
The command completion event should generated only when the command
is issued (and the command is completed).
>From 6.7.3.2
> Software issues a command to a hot-plug capable Downstream Port by
> issuing a write transaction that targets any portion of the
> Port's Slot Control register. A single write to the Slot Control
> register is considered to be a single command
...
> The Port must process the command normally even if the status field is
> already set when the command is issued.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pcie.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/hw/pcie.c b/hw/pcie.c
index 0385f53..64cc003 100644
--- a/hw/pcie.c
+++ b/hw/pcie.c
@@ -19,6 +19,7 @@
*/
#include "sysemu.h"
+#include "range.h"
#include "pci_bridge.h"
#include "pcie.h"
#include "msix.h"
@@ -323,17 +324,19 @@ void pcie_cap_slot_write_config(PCIDevice *dev,
hotplug_event_notify(dev);
- /* command completion.
- * Real hardware might take a while to complete
- * requested command because physical movement would be involved
- * like locking the electromechanical lock.
- * However in our case, command is completed instantaneously above,
- * so send a command completion event right now.
- *
- * 6.7.3.2 Command Completed Events
- */
- /* set command completed bit */
- pcie_cap_slot_event(dev, PCI_EXP_HP_EV_CCI);
+ if (ranges_overlap(addr, len, pos + PCI_EXP_SLTCTL, 2)) {
+ /* command completion.
+ * Real hardware might take a while to complete
+ * requested command because physical movement would be involved
+ * like locking the electromechanical lock.
+ * However in our case, command is completed instantaneously above,
+ * so send a command completion event right now.
+ *
+ * 6.7.3.2 Command Completed Events
+ */
+ /* set command completed bit */
+ pcie_cap_slot_event(dev, PCI_EXP_HP_EV_CCI);
+ }
}
void pcie_cap_slot_push_attention_button(PCIDevice *dev)
--
1.7.1.1
- [Qemu-devel] [PATCH 0/6] pcie: fixes for pci branch, Isaku Yamahata, 2010/10/27
- [Qemu-devel] [PATCH 1/6] pcie: fix pcie_cap_slot_write_config().,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 5/6] pcie/slot: fix save/load, Isaku Yamahata, 2010/10/27
- [Qemu-devel] [PATCH 2/6] pcie/slot: fix hotplug_event_notify()., Isaku Yamahata, 2010/10/27
- [Qemu-devel] [PATCH 6/6] msix: remove range checks., Isaku Yamahata, 2010/10/27
- [Qemu-devel] [PATCH 3/6] pcie/slot: clean up of hotplug_event_notify()., Isaku Yamahata, 2010/10/27
- [Qemu-devel] [PATCH 4/6] pcie/slot: factor out the logic to update hotplug event status., Isaku Yamahata, 2010/10/27
- [Qemu-devel] Re: [PATCH 0/6] pcie: fixes for pci branch, Michael S. Tsirkin, 2010/10/27