diff mbox series

[RFC,18/23] hw/phb4: Enable DLP Trace in phb4_init_hw()

Message ID 20190403090920.362-19-oohall@gmail.com
State RFC
Headers show
Series [RFC,01/23] platform/firenze-pci: Remove freset | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (050d8165ab05b6d9cdf4bfee42d9776969c77029)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Oliver O'Halloran April 3, 2019, 9:09 a.m. UTC
Move the link trace enable out of phb4_freset() and into phb4_init_hw().
No functional changes.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hw/phb4.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Frederic Barrat July 31, 2019, 7:30 p.m. UTC | #1
Le 03/04/2019 à 11:09, Oliver O'Halloran a écrit :
> Move the link trace enable out of phb4_freset() and into phb4_init_hw().
> No functional changes.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>   hw/phb4.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/phb4.c b/hw/phb4.c
> index 3a6b05b4a5a6..75a1eb45a3d4 100644
> --- a/hw/phb4.c
> +++ b/hw/phb4.c
> @@ -3013,7 +3013,6 @@ static int64_t phb4_hreset(struct pci_slot *slot)
>   static int64_t phb4_freset(struct pci_slot *slot)
>   {
>   	struct phb4 *p = phb_to_phb4(slot->phb);
> -	uint64_t reg;
>   
>   	switch(slot->state) {
>   	case PHB4_SLOT_NORMAL:
> @@ -3042,13 +3041,6 @@ static int64_t phb4_freset(struct pci_slot *slot)
>   		/* fall through */
>   	case PHB4_SLOT_FRESET_ASSERT_DELAY:
>   
> -		if (pci_tracing) {
> -			/* Enable tracing */
> -			reg = in_be64(p->regs + PHB_PCIE_DLP_TRWCTL);
> -			out_be64(p->regs + PHB_PCIE_DLP_TRWCTL,
> -				 reg | PHB_PCIE_DLP_TRWCTL_EN);
> -		}
> -
>   		PHBDBG(p, "FRESET: Deassert\n");
>   		phb4_assert_perst(slot, false);
>   
> @@ -5288,6 +5280,14 @@ static void phb4_init_hw(struct phb4 *p)
>   	/* Mark the PHB as functional which enables all the various sequences */
>   	p->broken = false;
>   
> +	/* Enable tracing if needed */
> +	if (pci_tracing) {
> +		val = in_be64(p->regs + PHB_PCIE_DLP_TRWCTL);
> +		out_be64(p->regs + PHB_PCIE_DLP_TRWCTL,
> +			 val | PHB_PCIE_DLP_TRWCTL_EN);
> +	}
> +
> +


Is this even needed? It seems to be done on the first call to 
phb4_link_tracing()

   Fred

>   	PHBDBG(p, "Initialization complete\n");
>   
>   	return;
>
Oliver O'Halloran Aug. 1, 2019, 6:21 a.m. UTC | #2
On Wed, 2019-07-31 at 21:30 +0200, Frederic Barrat wrote:
> 
> Le 03/04/2019 à 11:09, Oliver O'Halloran a écrit :
> > Move the link trace enable out of phb4_freset() and into phb4_init_hw().
> > No functional changes.
> > 
> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> > ---
> >   hw/phb4.c | 16 ++++++++--------
> >   1 file changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/hw/phb4.c b/hw/phb4.c
> > index 3a6b05b4a5a6..75a1eb45a3d4 100644
> > --- a/hw/phb4.c
> > +++ b/hw/phb4.c
> > @@ -3013,7 +3013,6 @@ static int64_t phb4_hreset(struct pci_slot *slot)
> >   static int64_t phb4_freset(struct pci_slot *slot)
> >   {
> >   	struct phb4 *p = phb_to_phb4(slot->phb);
> > -	uint64_t reg;
> >   
> >   	switch(slot->state) {
> >   	case PHB4_SLOT_NORMAL:
> > @@ -3042,13 +3041,6 @@ static int64_t phb4_freset(struct pci_slot *slot)
> >   		/* fall through */
> >   	case PHB4_SLOT_FRESET_ASSERT_DELAY:
> >   
> > -		if (pci_tracing) {
> > -			/* Enable tracing */
> > -			reg = in_be64(p->regs + PHB_PCIE_DLP_TRWCTL);
> > -			out_be64(p->regs + PHB_PCIE_DLP_TRWCTL,
> > -				 reg | PHB_PCIE_DLP_TRWCTL_EN);
> > -		}
> > -
> >   		PHBDBG(p, "FRESET: Deassert\n");
> >   		phb4_assert_perst(slot, false);
> >   
> > @@ -5288,6 +5280,14 @@ static void phb4_init_hw(struct phb4 *p)
> >   	/* Mark the PHB as functional which enables all the various sequences */
> >   	p->broken = false;
> >   
> > +	/* Enable tracing if needed */
> > +	if (pci_tracing) {
> > +		val = in_be64(p->regs + PHB_PCIE_DLP_TRWCTL);
> > +		out_be64(p->regs + PHB_PCIE_DLP_TRWCTL,
> > +			 val | PHB_PCIE_DLP_TRWCTL_EN);
> > +	}
> > +
> > +
> 
> Is this even needed? It seems to be done on the first call to 
> phb4_link_tracing()

It's done in phb4_link_tracing() now. When I wrote this series it was
done here in the freset handler with the idea being that we want to
enable tracing as early as possible so we don't miss any state
transitions. I did some testing when I moved the enable into
phb4_link_tracing() and didn't see any difference in the results so
this patch can probably be dropped.

> 
>    Fred
> 
> >   	PHBDBG(p, "Initialization complete\n");
> >   
> >   	return;
> >
diff mbox series

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index 3a6b05b4a5a6..75a1eb45a3d4 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -3013,7 +3013,6 @@  static int64_t phb4_hreset(struct pci_slot *slot)
 static int64_t phb4_freset(struct pci_slot *slot)
 {
 	struct phb4 *p = phb_to_phb4(slot->phb);
-	uint64_t reg;
 
 	switch(slot->state) {
 	case PHB4_SLOT_NORMAL:
@@ -3042,13 +3041,6 @@  static int64_t phb4_freset(struct pci_slot *slot)
 		/* fall through */
 	case PHB4_SLOT_FRESET_ASSERT_DELAY:
 
-		if (pci_tracing) {
-			/* Enable tracing */
-			reg = in_be64(p->regs + PHB_PCIE_DLP_TRWCTL);
-			out_be64(p->regs + PHB_PCIE_DLP_TRWCTL,
-				 reg | PHB_PCIE_DLP_TRWCTL_EN);
-		}
-
 		PHBDBG(p, "FRESET: Deassert\n");
 		phb4_assert_perst(slot, false);
 
@@ -5288,6 +5280,14 @@  static void phb4_init_hw(struct phb4 *p)
 	/* Mark the PHB as functional which enables all the various sequences */
 	p->broken = false;
 
+	/* Enable tracing if needed */
+	if (pci_tracing) {
+		val = in_be64(p->regs + PHB_PCIE_DLP_TRWCTL);
+		out_be64(p->regs + PHB_PCIE_DLP_TRWCTL,
+			 val | PHB_PCIE_DLP_TRWCTL_EN);
+	}
+
+
 	PHBDBG(p, "Initialization complete\n");
 
 	return;