From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33EEEC3DA7F for ; Wed, 7 Aug 2024 15:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RIRNLkw9dTzgIpXpghTsmUqrsJ/SAPgpl7FytrsGTJU=; b=ZzzY/rKeNb4eJv3nDSneBuSDbq mZYMU95jjoXDtGJkO71EXwa+S0AJ3UMc74nAxDZyP+zMd+VJSRZgWz9sGtt7ZHXmiz7bxFthxN6Lw BAZSNYpW5ClOypn7bUA+quO+fQojTdShQrIWoGVDrw0OFuOshK7YGvzbaiF5TrqOpSRVqin5nxC3W KuA7OCqEsPJQbDC62toE3f1AfQONPH9+r8tqxja+hRxrkkbHSOJOaxqm6YXFY8MEr2fKibFK1vbl7 plDe7S+VU00bVXRxvadkANQ0w2fotgJWq11H1cLOphwBuvQzsq5RKaWvxx5XMNbsXECmUwy6mbEt/ Ar0WNpCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbiDb-00000005RlE-0n6L; Wed, 07 Aug 2024 15:04:51 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbiD2-00000005Rde-1EO0 for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2024 15:04:17 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-70d18112b60so763838b3a.1 for ; Wed, 07 Aug 2024 08:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723043055; x=1723647855; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=RIRNLkw9dTzgIpXpghTsmUqrsJ/SAPgpl7FytrsGTJU=; b=OtrqzfqZdeO3iJ0E7ni7qDxXrnnWbf3McX1RwiuJ0k93gPQglVYHlGTJzl575YIsOX Rgs4KyxsgXEh5DlKMK4QgxsxFCs7Uc0kdUiYiQt8FsmQrXmkQl1v+tPrv0AN0OJo6Ifj Od8ww1GVVtdmT2nXnO7j2ZANCTnrE7y3gAxxUeaEgQzijHLUyQxnXdZmlmcDRDCig7o9 mI4XwpzgD3Wytj6mfEltmCfpt/tvNxdbZh6f/T7GNXie0OrXOhkvs1h7flSxC8/i9ZCa RFggVQ77+s/Kvj5hbEaRYVP4zZoeuoNXA10AtpLPgOzkP/XQl9RJS2CN/rYPQ98cHs7l Ax4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723043055; x=1723647855; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RIRNLkw9dTzgIpXpghTsmUqrsJ/SAPgpl7FytrsGTJU=; b=NJjwuv70fbz0E1avtGPaF05VydVOpgzLRL9VwYN1+/+RaQVpkj3DXhDeNL+OCDEqgY dgkBgRWtWPVGPf0IZY+7NNNoaclfu4zsfZoKhQlXt98TUAzoF+ATfnslW7eOf2qkOhFX eQ/2JfxMZsu/62K6DD/4r4r4TtV1yvwKmEh6qhqB9r2i6uGHVb+jnnfvo7AmIWqqOdKQ cEUF/plySN9uCzZbIGQUyBn0t5MKptH4KuRXNlnWMJb1y0vGhO49XijdbdgWL0KDRmpU m7MAUYedPQxPfaKiPbmNs/VoMYo8eMBltvCAr2UYnP+f/OsLs1D97zYjV35y0pN04Tfb M2LQ== X-Forwarded-Encrypted: i=1; AJvYcCXRjPwmAtsrwXqwkFlg3tJJPJwFDoizG1t/v+BK6VgIUUZOiJc+joRWSykUPaUBa6do9tISzV8PfXjVKneLEMPBLFp8y5lX9D2dbx+hVTrRX/ic738= X-Gm-Message-State: AOJu0YwL4ncnmlRMo1X5oHpcHZN5tomD+1e38+NaiRyTPg85JOmeU60I KPXNTjxgeyj57USjlXPZx21PX88v2gyRuEhAsSzKRl5W5LFaugcxCL1c6DIQtw== X-Google-Smtp-Source: AGHT+IFUq3a888UA6wQ7lTpYeaEGuRpyGPntz4KOze7iKWL5Lbq2AqEWrIvFsDKl9yLEGbIl3Z7fZw== X-Received: by 2002:a05:6a00:9155:b0:70d:32bf:aa45 with SMTP id d2e1a72fcca58-710bc916b4fmr3349555b3a.14.1723043055153; Wed, 07 Aug 2024 08:04:15 -0700 (PDT) Received: from thinkpad ([120.60.60.211]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7106ecfd064sm8809352b3a.170.2024.08.07.08.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 08:04:14 -0700 (PDT) Date: Wed, 7 Aug 2024 20:33:57 +0530 From: Manivannan Sadhasivam To: Florian Fainelli Cc: Jim Quinlan , linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, Lorenzo Pieralisi , 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 v5 09/12] PCI: brcmstb: Refactor for chips with many regular inbound windows Message-ID: <20240807150357.GB5664@thinkpad> References: <20240731222831.14895-1-james.quinlan@broadcom.com> <20240731222831.14895-10-james.quinlan@broadcom.com> <20240807140401.GJ3412@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240807_080416_369448_49D3B0A6 X-CRM114-Status: GOOD ( 29.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 07, 2024 at 07:16:44AM -0700, Florian Fainelli wrote: > > > On 8/7/2024 7:04 AM, Manivannan Sadhasivam wrote: > > On Wed, Jul 31, 2024 at 06:28:23PM -0400, Jim Quinlan wrote: > > > Provide support for new chips with multiple inbound windows while > > > keeping the legacy support for the older chips. > > > > > > In existing chips there are three inbound windows with fixed purposes: the > > > first was for mapping SoC internal registers, the second was for memory, > > > and the third was for memory but with the endian swapped. Typically, only > > > one window was used. > > > > > > Complicating the inbound window usage was the fact that the PCIe HW would > > > do a baroque internal mapping of system memory, and concatenate the regions > > > of multiple memory controllers. > > > > > > Newer chips such as the 7712 and Cable Modem SOCs take a step forward and > > > drop the internal mapping while providing for multiple inbound windows. > > > This works in concert with the dma-ranges property, where each provided > > > range becomes an inbound window. > > > > > > Signed-off-by: Jim Quinlan > > > --- > > [snip] > > > > +static void set_inbound_win_registers(struct brcm_pcie *pcie, > > > + const struct inbound_win *inbound_wins, > > > + int num_inbound_wins) > > > +{ > > > + void __iomem *base = pcie->base; > > > + int i; > > > + > > > + for (i = 1; i <= num_inbound_wins; i++) { > > > + u64 pci_offset = inbound_wins[i].pci_offset; > > > + u64 cpu_addr = inbound_wins[i].cpu_addr; > > > + u64 size = inbound_wins[i].size; > > > + u32 reg_offset = brcm_bar_reg_offset(i); > > > + u32 tmp = lower_32_bits(pci_offset); > > > + > > > + u32p_replace_bits(&tmp, brcm_pcie_encode_ibar_size(size), > > > + PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK); > > > + > > > + /* Write low */ > > > + writel(tmp, base + reg_offset); > > > > Can you use writel_relaxed() instead? Here and below. I don't see a necessity to > > use the barrier that comes with non-relaxed version of writel. > > Out of curiosity what is the reasoning here for asking to use > writel_relaxed(), this is not a hot path, this is a configuration path > anyway. I am not certain clear on the implication of using writel_relaxed() > on systems like 7712/2712 where the busing is different from the other STB > chips. It is the general recommendation (although not documented). If the code path do not need ordering/barrier, then there is no need for non-relaxed variants. Btw, if the register accesses are to the same domain (like PCIe), then certainly you do not need barrier as writes to the same domain are ordered. Problem with readl/writel is that the drivers started using non-relaxed variants as if it is a norm and completely ignored the relaxed variants. - Mani -- மணிவண்ணன் சதாசிவம்