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 2E808CF31BE for ; Thu, 3 Oct 2024 05:36:22 +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=HSml+1r4bZzAkwRWts40vTN9SrEXop2A63UnX854Gxc=; b=Mgl5WJoKuOagW+msuEcykz8tjU uyOzRpWuttdgeGS883gnACb1ZoKBEMGZktOWKbgA/KwR3ZKDcFErgOx2crD182Q3I5/YZcXhmWQel dvQryQ9sZHR5CkzSboKOZFTb0atXxtoqbvhL5mF7pfn3JAp4kovo/MhCIuwFgbish33o/JiexKI1o rxxqmFPVa63EaJfzYxrxDBkxjLtKiZgbaLzr8XfiuLH0GnGYbObLF9RqcekNkWi6QTf6jNCrj2IIv tscC3RkFkbwCrIcgnhi37KcchMY03GE6dEJQPk1O/LaSDpFnu11KZgHOFpw5GJxVSnCGa8na0mGdA p3jMZeoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swEVX-00000008DbB-1s9v; Thu, 03 Oct 2024 05:36:11 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swEUD-00000008DJt-3a75 for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2024 05:34:51 +0000 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-71b8d10e990so373765b3a.3 for ; Wed, 02 Oct 2024 22:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727933689; x=1728538489; 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=HSml+1r4bZzAkwRWts40vTN9SrEXop2A63UnX854Gxc=; b=OGJBPyrr6hTevRgqC1Kx/WgUeNztEIVu5KovAV3oltB6P29aiC30c0uYq0zC2bCi2A xgCnHXMu1U2toRZhUxwpyCctv4jzOp6zsrMKQGvZx4RXK9Z7ASgfmTR7HzwLKcWsXPoH oXAdMM2sO0uJ+Z1lJGo0IDv19lyEgeOTSnAlfDq1XFa/vzvfZgtvtvgqUgn8WsVumO67 Pl62dtfKjDRTIs7EivXYvkRYXBnwG0GKRI+08onsiaUGm2W3WkMnBe4m/hyijsgLNdxB Rz7Vde2i7jApC4HO6/Pec0PWE+LYXJTHRUdhyXKwwCq+BhDzhx9cIUxSJ6gWvwU35OYr 0egg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727933689; x=1728538489; 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=HSml+1r4bZzAkwRWts40vTN9SrEXop2A63UnX854Gxc=; b=Qb/AzTLCIxwQ1PPch3/0ZZKtVvFTfFRUg20+rv57mVwlQtqXR9znOrus8z6lZlm++Y 43DmfEn86SmKlyKehtUG68MQl7wGIlwsriW14vsCdoOpZJ70t7iyrPzBkocLDWXgNw00 gUjfsUpCWaWTYLyJPKYA6XUTQMPfBJOCj+1ARrFzPEQ/9/oPCtIwccBfA5VCOJYA8XBr 95XFQyYfturehFgvXENAa+gq60c1kPXK3Uhm//qWMd4eT1inTeXmcUBhXshncfvBMiaN X1W0oxb3fOSrfFJwcKTlowIB3R1YwYH8LIGNLoVTXkh5fZd5Q1CO1XVg4ylWZK/gomCO MCMQ== X-Forwarded-Encrypted: i=1; AJvYcCVNez1BkAXLIwUQlmiQN0MUMAVMvvhhpPZr0GYD4BKt3+MPJfp1F0WpUG9A1WcRshooxtCVh8e3d4HQOal11zak@lists.infradead.org X-Gm-Message-State: AOJu0YyQB5O1KdgK3tevD2tXFp0mJ4h4poFGoZSG6ROD8RKJfdwoffCS +r4j2bcwXfliBv0YtsUrFQ4zMBNA1QGFE6FH5GnzK+eklwg8cJo88HS7ehpVlw== X-Google-Smtp-Source: AGHT+IEhnqAJQDNpXwUuNi0Kwr7kqnn3sBdkE/2mLCX4Dd9WV3ch5BfYf8udYxNwIYPKwjCCMKEivQ== X-Received: by 2002:a05:6a00:acb:b0:71c:5b8a:ae0b with SMTP id d2e1a72fcca58-71dc5d71766mr9243388b3a.24.1727933688500; Wed, 02 Oct 2024 22:34:48 -0700 (PDT) Received: from thinkpad ([36.255.17.222]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9dee8b8sm480877b3a.145.2024.10.02.22.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 22:34:48 -0700 (PDT) Date: Thu, 3 Oct 2024 11:04:40 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: Rob Herring , Saravana Kannan , Jingoo Han , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev Subject: Re: [PATCH v3 0/3] PCI: dwc: opitimaze RC host pci_fixup_addr() Message-ID: <20241003053440.5mv6kv27rxttekaq@thinkpad> References: <20240930-pci_fixup_addr-v3-0-80ee70352fc7@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240930-pci_fixup_addr-v3-0-80ee70352fc7@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_223449_961801_2D170E5E X-CRM114-Status: GOOD ( 21.82 ) 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 Mon, Sep 30, 2024 at 02:44:52PM -0400, Frank Li wrote: > ┌─────────┐ ┌────────────┐ > ┌─────┐ │ │ IA: 0x8ff0_0000 │ │ > │ CPU ├───►│ ┌────►├─────────────────┐ │ PCI │ > └─────┘ │ │ │ IA: 0x8ff8_0000 │ │ │ > CPU Addr │ │ ┌─►├─────────────┐ │ │ Controller │ > 0x7ff0_0000─┼───┘ │ │ │ │ │ │ > │ │ │ │ │ │ │ PCI Addr > 0x7ff8_0000─┼──────┘ │ │ └──► CfgSpace ─┼────────────► > │ │ │ │ │ 0 > 0x7000_0000─┼────────►├─────────┐ │ │ │ > └─────────┘ │ └──────► IOSpace ─┼────────────► > BUS Fabric │ │ │ 0 > │ │ │ > └──────────► MemSpace ─┼────────────► > IA: 0x8000_0000 │ │ 0x8000_0000 > └────────────┘ > > Current dwc implimemnt, pci_fixup_addr() call back is needed when bus > fabric convert cpu address before send to PCIe controller. > > bus@5f000000 { > compatible = "simple-bus"; > #address-cells = <1>; > #size-cells = <1>; > ranges = <0x5f000000 0x0 0x5f000000 0x21000000>, > <0x80000000 0x0 0x70000000 0x10000000>; > > pcie@5f010000 { > compatible = "fsl,imx8q-pcie"; > reg = <0x5f010000 0x10000>, <0x8ff00000 0x80000>; > reg-names = "dbi", "config"; > #address-cells = <3>; > #size-cells = <2>; > device_type = "pci"; > bus-range = <0x00 0xff>; > ranges = <0x81000000 0 0x00000000 0x8ff80000 0 0x00010000>, > <0x82000000 0 0x80000000 0x80000000 0 0x0ff00000>; > ... > }; > }; > > Device tree already can descript all address translate. Some hardware > driver implement fixup function by mask some bits of cpu address. Last > pci-imx6.c are little bit better by fetch memory resource's offset to do > fixup. > > static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) > { > ... > entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); > return cpu_addr - entry->offset; > } > > But it is not good by using IORESOURCE_MEM to fix up io/cfg address map > although address translate is the same as IORESOURCE_MEM. > > This patches to fetch untranslate range information for PCIe controller > (pcie@5f010000: ranges). So current config ATU without cpu_fixup_addr(). > > EP side patch: > https://lore.kernel.org/linux-pci/20240923-pcie_ep_range-v2-0-78d2ea434d9f@nxp.com/T/#mfc73ca113a69ad2c0294a2e629ecee3105b72973 > > The both pave the road to eliminate ugle cpu_fixup_addr() callback function. > > Signed-off-by: Frank Li > --- > Changes in v3: > - see each patch You should make the life easier for the reviewer, not hard. Please summarise what has changed since the last version. - Mani > - Link to v2: https://lore.kernel.org/r/20240926-pci_fixup_addr-v2-0-e4524541edf4@nxp.com > > Changes in v2: > - see each patch > - Link to v1: https://lore.kernel.org/r/20240924-pci_fixup_addr-v1-0-57d14a91ec4f@nxp.com > > --- > Frank Li (3): > of: address: Add parent_bus_addr to struct of_pci_range > PCI: dwc: Using parent_bus_addr in of_range to eliminate cpu_addr_fixup() > PCI: imx6: Remove cpu_addr_fixup() > > drivers/of/address.c | 2 ++ > drivers/pci/controller/dwc/pci-imx6.c | 22 ++---------- > drivers/pci/controller/dwc/pcie-designware-host.c | 42 +++++++++++++++++++++++ > drivers/pci/controller/dwc/pcie-designware.h | 8 +++++ > include/linux/of_address.h | 1 + > 5 files changed, 55 insertions(+), 20 deletions(-) > --- > base-commit: 69940764dc1c429010d37cded159fadf1347d318 > change-id: 20240924-pci_fixup_addr-a8568f9bbb34 > > Best regards, > --- > Frank Li > -- மணிவண்ணன் சதாசிவம்