Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp982960rwb; Fri, 28 Jul 2023 03:00:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFthfnezaOSq+D0AKt06ASTza6YHlHtT4Max3/FBC7sNjMgeHaJ0345vrqHPiFeE85fC92V X-Received: by 2002:a05:6a00:2d0f:b0:668:8ad5:778f with SMTP id fa15-20020a056a002d0f00b006688ad5778fmr1900079pfb.17.1690538436167; Fri, 28 Jul 2023 03:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690538436; cv=none; d=google.com; s=arc-20160816; b=Am0A7EkuaDn63lAxh06WVfO/53EjY7IykzJbXktt2vwGyCQyVY2nLavqJ2Hehn3psk iTlc8DLtjmvNnnDNoa4UOx6U1ghI5prUGV/lbQiJjcuHEPPWysZ9bHzkmmZu5/FWBpQg 6zc7aFS/DayQrK00NeLRHIbbYkKsWDWM3dtXJdL3qhuRhZjdpwCYh0r7jHD9G8rRm2Wu iuAX5biCDh3Ged89pJ6wPf8mDz0OG0KrC/28Xp4VsXrFgoDlQd4jKPZaoQZ6cNz4efNT m+jSud9s2J8+zMEw8D8jqWtUXynMZtRmzUoxtmIvq8fBHNxxntAicjapzTKgrVwPacgI T/RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eeA7l0OOFO5a3cqpOSyHHQCHbNxPrAvHPC0t3YQ4rrA=; fh=wyIWmnmslPavv7Auh9cWf/lu+E+gJItFIbyXY2L6GeU=; b=cxjMV3GfzPc9ictwsrcaAbA+ExPd4T8JnJ7ypYCcOsbI2MVQc2lZd/La1MTl3FzKxy kIFgG09qK2wmkG2Fn+ah+q5w/+r7qXULARxegSTwGF3R4fjcVhDIW9Pp+xq62MEWXPzS iiEJpa+CidFyZ0o7dUV8bSwc9HBtYy00tFOlgQKVBAZbFFqEO3zR+LQiT/Ff7BHyU3k1 7Hg2M6ULf4Baza1Taylx8Upm4ciHTQDeRtURYxysOhip6RmqtSuyDrk1gTaRVnH1eMla UHsvRfhx++cqFaY9eIZRHYy35Sk752AKYpqrx3/u1RvJKxdLNoiaZfQ58Nr8Ltnwyr4K LOhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QIxRIOr5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a72-20020a63904b000000b00563fbc00007si445513pge.262.2023.07.28.03.00.23; Fri, 28 Jul 2023 03:00:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QIxRIOr5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234252AbjG1IoT (ORCPT + 99 others); Fri, 28 Jul 2023 04:44:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234705AbjG1IoA (ORCPT ); Fri, 28 Jul 2023 04:44:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F8B426A0; Fri, 28 Jul 2023 01:44:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7B6862059; Fri, 28 Jul 2023 08:43:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD4DC433C7; Fri, 28 Jul 2023 08:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690533839; bh=DYMtYTNvDKC5KRhCogEBmpaDtd8JRR359LeDXZ9iM48=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QIxRIOr5Z1UDrUiRM512S6uSDlpPhpjbhKOmPnbce0sdsm9kFJEzI/DJCW4YFT/TP Wfvo04EQDbW0W7EbK5+OzGv2eccd1yUKsDH4+IWnYZ7j5s+nGMGJKfjE9ym4MVH0wl demDedVaiHAVja/xRgwSwJiA5h9tbaokbs2HnmRJMyQfeohFEvgUgT0MAD2lLmG+np 1XEwCR/eCe9cZk7vLcCUB9LvYJwEy8+um+MLECJ40RnVB3NmFezDrBN8RAY5KD4+Nw mwFbVgFlmYb5AE5/G3DBts+hIm/3zl3yjSAAzD2Uzn3V2tEEtj1OROat/hLsKKhrLl F4kILnY234dfA== Date: Fri, 28 Jul 2023 10:43:51 +0200 From: Lorenzo Pieralisi To: Jim Quinlan Cc: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, Florian Fainelli , Jim Quinlan , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , open list Subject: Re: [PATCH v6 3/5] PCI: brcmstb: Set higher value for internal bus timeout Message-ID: References: <20230623144100.34196-1-james.quinlan@broadcom.com> <20230623144100.34196-4-james.quinlan@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230623144100.34196-4-james.quinlan@broadcom.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 23, 2023 at 10:40:56AM -0400, Jim Quinlan wrote: > During long periods of the PCIe RC HW being in an L1SS sleep state, there > may be a timeout on an internal bus access, even though there may not be > any PCIe access involved. Such a timeout will cause a subsequent CPU > abort. > > So, when "brcm,enable-l1ss" is observed, we increase the timeout value to > four seconds instead of using its HW default. > > Signed-off-by: Jim Quinlan > Tested-by: Florian Fainelli > --- > drivers/pci/controller/pcie-brcmstb.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c > index d30636a725d7..fe0415a98c63 100644 > --- a/drivers/pci/controller/pcie-brcmstb.c > +++ b/drivers/pci/controller/pcie-brcmstb.c > @@ -1034,6 +1034,21 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) > return 0; > } > > +/* > + * This extends the timeout period for an access to an internal bus. This > + * access timeout may occur during L1SS sleep periods even without the > + * presence of a PCIe access. > + */ > +static void brcm_extend_rbus_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; Nit: you could define an offset for the TIMEOUT register, if that makes it any cleaner, up to you. > + u32 timeout_us = 4000000; /* 4 seconds, our setting for L1SS */ It would be useful to describe why this has to be 4 seconds in case someone in the future will have to change it. Thanks, Lorenzo > + /* Each unit in timeout register is 1/216,000,000 seconds */ > + writel(216 * timeout_us, pcie->base + REG_OFFSET); > +} > + > static void brcm_config_clkreq(struct brcm_pcie *pcie) > { > bool l1ss = of_property_read_bool(pcie->np, "brcm,enable-l1ss"); > @@ -1059,6 +1074,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) > * of 400ns, as specified in 3.2.5.2.2 of the PCI Express > * Mini CEM 2.0 specification. > */ > + brcm_extend_rbus_timeout(pcie); > clkreq_set |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK; > dev_info(pcie->dev, "bi-dir CLKREQ# for L1SS power savings"); > } else { > -- > 2.17.1 >