diff mbox

[qemu,v5,11/12] spapr_pci: Disable all DMA windows on reset

Message ID 1427779727-13353-12-git-send-email-aik@ozlabs.ru
State New
Headers show

Commit Message

Alexey Kardashevskiy March 31, 2015, 5:28 a.m. UTC
This disables all DMA windows on a PHB reset. It does not make any
difference now as there is just one DMA window but it will later with DDW
patches.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_pci.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

David Gibson April 8, 2015, 5:09 a.m. UTC | #1
On Tue, Mar 31, 2015 at 04:28:46PM +1100, Alexey Kardashevskiy wrote:
> This disables all DMA windows on a PHB reset. It does not make any
> difference now as there is just one DMA window but it will later with DDW
> patches.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Although I think I'd prefer to see this folded in with the earlier
reset rework patch.  I don't think there's enough here that splitting
it out makes anything clearer.
diff mbox

Patch

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index b8c2488..a85289e 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -724,13 +724,24 @@  static const MemoryRegionOps spapr_msi_ops = {
 /*
  * DMA windows
  */
+static int spapr_phb_disable_dma_windows(Object *child, void *opaque)
+{
+    sPAPRTCETable *tcet = (sPAPRTCETable *)
+        object_dynamic_cast(child, TYPE_SPAPR_TCE_TABLE);
+
+    if (tcet) {
+        spapr_tce_table_disable(tcet);
+    }
+
+    return 0;
+}
+
 int spapr_phb_dma_reset(sPAPRPHBState *sphb)
 {
     const uint32_t liobn = SPAPR_PCI_LIOBN(sphb->index, 0);
-    sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
     sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb);
 
-    spapr_tce_table_disable(tcet);
+    object_child_foreach(OBJECT(sphb), spapr_phb_disable_dma_windows, NULL);
     spc->dma_init_window(sphb, liobn, SPAPR_TCE_PAGE_SHIFT, 0);
 
     return 0;