diff mbox

[qemu,v13,14/16] spapr_pci: Add and export DMA resetting helper

Message ID 1456823441-46757-15-git-send-email-aik@ozlabs.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexey Kardashevskiy March 1, 2016, 9:10 a.m. UTC
This will be later used by the "ibm,reset-pe-dma-window" RTAS handler
which resets the DMA configuration to the defaults.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_pci.c          | 11 ++++++++---
 include/hw/pci-host/spapr.h |  2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

David Gibson March 3, 2016, 6:39 a.m. UTC | #1
On Tue, Mar 01, 2016 at 08:10:39PM +1100, Alexey Kardashevskiy wrote:
> This will be later used by the "ibm,reset-pe-dma-window" RTAS handler
> which resets the DMA configuration to the defaults.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

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

> ---
>  hw/ppc/spapr_pci.c          | 11 ++++++++---
>  include/hw/pci-host/spapr.h |  2 ++
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index b0cd148..4c6e687 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -1441,10 +1441,8 @@ static int spapr_phb_children_reset(Object *child, void *opaque)
>      return 0;
>  }
>  
> -static void spapr_phb_reset(DeviceState *qdev)
> +void spapr_phb_dma_reset(sPAPRPHBState *sphb)
>  {
> -    sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(qdev);
> -
>      spapr_phb_dma_window_disable(sphb, sphb->dma_liobn);
>  
>      /* Register default 32bit DMA window */
> @@ -1452,6 +1450,13 @@ static void spapr_phb_reset(DeviceState *qdev)
>                                  SPAPR_TCE_PAGE_SHIFT,
>                                  sphb->dma_win_addr,
>                                  sphb->dma_win_size);
> +}
> +
> +static void spapr_phb_reset(DeviceState *qdev)
> +{
> +    sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(qdev);
> +
> +    spapr_phb_dma_reset(sphb);
>  
>      /* Reset the IOMMU state */
>      object_child_foreach(OBJECT(qdev), spapr_phb_children_reset, NULL);
> diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
> index 03ee006..7848366 100644
> --- a/include/hw/pci-host/spapr.h
> +++ b/include/hw/pci-host/spapr.h
> @@ -147,4 +147,6 @@ static inline void spapr_phb_vfio_reset(DeviceState *qdev)
>  }
>  #endif
>  
> +void spapr_phb_dma_reset(sPAPRPHBState *sphb);
> +
>  #endif /* __HW_SPAPR_PCI_H__ */
diff mbox

Patch

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index b0cd148..4c6e687 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1441,10 +1441,8 @@  static int spapr_phb_children_reset(Object *child, void *opaque)
     return 0;
 }
 
-static void spapr_phb_reset(DeviceState *qdev)
+void spapr_phb_dma_reset(sPAPRPHBState *sphb)
 {
-    sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(qdev);
-
     spapr_phb_dma_window_disable(sphb, sphb->dma_liobn);
 
     /* Register default 32bit DMA window */
@@ -1452,6 +1450,13 @@  static void spapr_phb_reset(DeviceState *qdev)
                                 SPAPR_TCE_PAGE_SHIFT,
                                 sphb->dma_win_addr,
                                 sphb->dma_win_size);
+}
+
+static void spapr_phb_reset(DeviceState *qdev)
+{
+    sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(qdev);
+
+    spapr_phb_dma_reset(sphb);
 
     /* Reset the IOMMU state */
     object_child_foreach(OBJECT(qdev), spapr_phb_children_reset, NULL);
diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
index 03ee006..7848366 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -147,4 +147,6 @@  static inline void spapr_phb_vfio_reset(DeviceState *qdev)
 }
 #endif
 
+void spapr_phb_dma_reset(sPAPRPHBState *sphb);
+
 #endif /* __HW_SPAPR_PCI_H__ */