All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Quinlan <jim2101024@gmail.com>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: linux-pci@vger.kernel.org,
	"Nicolas Saenz Julienne" <nsaenz@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Cyril Brulebois" <kibi@debian.org>,
	"Phil Elwell" <phil@raspberrypi.com>,
	bcm-kernel-feedback-list@broadcom.com,
	james.quinlan@broadcom.com,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 3/3] PCI: brcmstb: Allow setting the completion timeout
Date: Thu, 6 Apr 2023 13:15:10 -0400	[thread overview]
Message-ID: <CANCKTBspbkTXVBXTS+woymM+6kEgd+F5XH7ycPhaAgASEi7rhQ@mail.gmail.com> (raw)
In-Reply-To: <09926d3d-2f1f-d060-af0f-bbc5b02d3664@i2se.com>

On Thu, Apr 6, 2023 at 11:59 AM Stefan Wahren <stefan.wahren@i2se.com> wrote:
>
> Hi Jim,
>
> Am 06.04.23 um 14:46 schrieb Jim Quinlan:
> > Since the STB PCIe HW will cause a CPU abort on a completion timeout abort,
> > we might as well extend the timeout limit.  Further, different devices and
> > systems may requires a larger or smaller amount for L1SS exit.
> >
> > Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
> > ---
> >   drivers/pci/controller/pcie-brcmstb.c | 24 ++++++++++++++++++++++++
> >   1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> > index 129eee7bdbc1..92d78f4dfaae 100644
> > --- a/drivers/pci/controller/pcie-brcmstb.c
> > +++ b/drivers/pci/controller/pcie-brcmstb.c
> > @@ -1080,6 +1080,29 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie)
> >       writel(clkreq_set, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG);
> >   }
> >
> > +static void brcm_config_completion_timeout(struct brcm_pcie *pcie)
> > +{
> > +     /* TIMEOUT register is two registers before RGR1_SW_INIT_1 */
> > +     const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8;
> > +     u32 timeout, timeout_msec = 1000;
> > +     u64 tmp64;
> > +     int ret;
> > +
> > +     ret = of_property_read_u32(pcie->np, "brcm,completion-abort-msecs",
> > +                                &timeout_msec);
> > +
> > +     if (ret && ret != -EINVAL)
> > +             dev_err(pcie->dev, "bad 'brcm,completion-abort-msecs' prop\n");
>
> i'm not sure about the error behavior. If we want to proceed with
> defaults in such a case, i would make this a warning and mention the
> used defaults.
Will do.

>
> > +
> > +     /* Each unit in timeout register is 1/216,000,000 seconds */
> > +     tmp64 = (u64)216000 * timeout_msec;
> > +
> > +     /* Clamp the requested value before writing it */
> > +     timeout = tmp64 > 0xffffffff ? 0xffffffff : tmp64;
> > +     timeout = timeout < 0xffff ? 0xffff : timeout;
>
> Personally i'm not a huge fan of silently clamping wrong DT values.
I will add a warning with limit info  on clamp and have the YAML min+max.

Thanks
Jim Quinlan
Broadcom STB
>
> Best regards
>
> > +     writel(timeout, pcie->base + REG_OFFSET);
> > +}
> > +
> >   static int brcm_pcie_start_link(struct brcm_pcie *pcie)
> >   {
> >       struct device *dev = pcie->dev;
> > @@ -1110,6 +1133,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
> >               return -ENODEV;
> >       }
> >
> > +     brcm_config_completion_timeout(pcie);
> >       brcm_config_clkreq(pcie);
> >
> >       if (pcie->gen)

WARNING: multiple messages have this Message-ID (diff)
From: Jim Quinlan <jim2101024@gmail.com>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: linux-pci@vger.kernel.org,
	"Nicolas Saenz Julienne" <nsaenz@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Cyril Brulebois" <kibi@debian.org>,
	"Phil Elwell" <phil@raspberrypi.com>,
	bcm-kernel-feedback-list@broadcom.com,
	james.quinlan@broadcom.com,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 3/3] PCI: brcmstb: Allow setting the completion timeout
Date: Thu, 6 Apr 2023 13:15:10 -0400	[thread overview]
Message-ID: <CANCKTBspbkTXVBXTS+woymM+6kEgd+F5XH7ycPhaAgASEi7rhQ@mail.gmail.com> (raw)
In-Reply-To: <09926d3d-2f1f-d060-af0f-bbc5b02d3664@i2se.com>

On Thu, Apr 6, 2023 at 11:59 AM Stefan Wahren <stefan.wahren@i2se.com> wrote:
>
> Hi Jim,
>
> Am 06.04.23 um 14:46 schrieb Jim Quinlan:
> > Since the STB PCIe HW will cause a CPU abort on a completion timeout abort,
> > we might as well extend the timeout limit.  Further, different devices and
> > systems may requires a larger or smaller amount for L1SS exit.
> >
> > Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
> > ---
> >   drivers/pci/controller/pcie-brcmstb.c | 24 ++++++++++++++++++++++++
> >   1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> > index 129eee7bdbc1..92d78f4dfaae 100644
> > --- a/drivers/pci/controller/pcie-brcmstb.c
> > +++ b/drivers/pci/controller/pcie-brcmstb.c
> > @@ -1080,6 +1080,29 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie)
> >       writel(clkreq_set, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG);
> >   }
> >
> > +static void brcm_config_completion_timeout(struct brcm_pcie *pcie)
> > +{
> > +     /* TIMEOUT register is two registers before RGR1_SW_INIT_1 */
> > +     const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8;
> > +     u32 timeout, timeout_msec = 1000;
> > +     u64 tmp64;
> > +     int ret;
> > +
> > +     ret = of_property_read_u32(pcie->np, "brcm,completion-abort-msecs",
> > +                                &timeout_msec);
> > +
> > +     if (ret && ret != -EINVAL)
> > +             dev_err(pcie->dev, "bad 'brcm,completion-abort-msecs' prop\n");
>
> i'm not sure about the error behavior. If we want to proceed with
> defaults in such a case, i would make this a warning and mention the
> used defaults.
Will do.

>
> > +
> > +     /* Each unit in timeout register is 1/216,000,000 seconds */
> > +     tmp64 = (u64)216000 * timeout_msec;
> > +
> > +     /* Clamp the requested value before writing it */
> > +     timeout = tmp64 > 0xffffffff ? 0xffffffff : tmp64;
> > +     timeout = timeout < 0xffff ? 0xffff : timeout;
>
> Personally i'm not a huge fan of silently clamping wrong DT values.
I will add a warning with limit info  on clamp and have the YAML min+max.

Thanks
Jim Quinlan
Broadcom STB
>
> Best regards
>
> > +     writel(timeout, pcie->base + REG_OFFSET);
> > +}
> > +
> >   static int brcm_pcie_start_link(struct brcm_pcie *pcie)
> >   {
> >       struct device *dev = pcie->dev;
> > @@ -1110,6 +1133,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
> >               return -ENODEV;
> >       }
> >
> > +     brcm_config_completion_timeout(pcie);
> >       brcm_config_clkreq(pcie);
> >
> >       if (pcie->gen)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-04-06 17:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 12:46 [PATCH v1 0/3] PCI: brcmstb: Clkreq# accomodations of downstream device Jim Quinlan
2023-04-06 12:46 ` Jim Quinlan
2023-04-06 12:46 ` [PATCH v1 1/3] dt-bindings: PCI: brcmstb: Add two optional props Jim Quinlan
2023-04-06 12:46   ` Jim Quinlan
2023-04-06 15:39   ` Stefan Wahren
2023-04-06 15:39     ` Stefan Wahren
2023-04-06 16:58     ` Jim Quinlan
2023-04-06 16:58       ` Jim Quinlan
2023-04-06 18:35       ` Krzysztof Kozlowski
2023-04-06 18:35         ` Krzysztof Kozlowski
2023-04-06 18:47         ` Florian Fainelli
2023-04-06 18:47           ` Florian Fainelli
2023-04-06 18:53           ` Krzysztof Kozlowski
2023-04-06 18:53             ` Krzysztof Kozlowski
2023-04-06 18:34   ` Krzysztof Kozlowski
2023-04-06 18:34     ` Krzysztof Kozlowski
2023-04-06 18:53     ` Florian Fainelli
2023-04-06 18:53       ` Florian Fainelli
2023-04-06 18:54       ` Krzysztof Kozlowski
2023-04-06 18:54         ` Krzysztof Kozlowski
2023-04-06 12:46 ` [PATCH v1 2/3] PCI: brcmstb: Clkreq# accomodations of downstream device Jim Quinlan
2023-04-06 12:46   ` Jim Quinlan
2023-04-06 19:09   ` Bjorn Helgaas
2023-04-06 19:09     ` Bjorn Helgaas
2023-04-06 20:03     ` Jim Quinlan
2023-04-06 20:03       ` Jim Quinlan
2023-04-06 12:46 ` [PATCH v1 3/3] PCI: brcmstb: Allow setting the completion timeout Jim Quinlan
2023-04-06 12:46   ` Jim Quinlan
2023-04-06 15:59   ` Stefan Wahren
2023-04-06 15:59     ` Stefan Wahren
2023-04-06 17:15     ` Jim Quinlan [this message]
2023-04-06 17:15       ` Jim Quinlan
2023-04-06 21:31 ` [PATCH v1 0/3] PCI: brcmstb: Clkreq# accomodations of downstream device Cyril Brulebois
2023-04-06 21:31   ` Cyril Brulebois
2023-04-07 15:06   ` Hank Barta
2023-04-07 15:06     ` Hank Barta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCKTBspbkTXVBXTS+woymM+6kEgd+F5XH7ycPhaAgASEi7rhQ@mail.gmail.com \
    --to=jim2101024@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=james.quinlan@broadcom.com \
    --cc=kibi@debian.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lpieralisi@kernel.org \
    --cc=nsaenz@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=robh@kernel.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.