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 shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 BB913C05027 for ; Mon, 6 Feb 2023 14:50:39 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.96) (envelope-from ) id 1pP2p0-0006ii-0u; Mon, 06 Feb 2023 09:50:18 -0500 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.96) (envelope-from ) id 1pP0HN-0007dF-25 for kernelnewbies@kernelnewbies.org; Mon, 06 Feb 2023 07:07:26 -0500 Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 6 Feb 2023 21:07:00 +0900 X-Original-SENDERIP: 211.180.235.153 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send002-relay.gov-dooray.com with SMTP id fb828e0563e0ed64; Mon, 06 Feb 2023 21:07:00 +0900 DKIM-Signature: a=rsa-sha256; b=GrX1v4jFD32buUnJn4KGCvYZWwInpG39S/hDWLWj/p6vxBhYL3yAYB1TzzQplNcmOwMxQWotcK Fx6vBSBtVE3QYwn2pKDzhL8pMNZ0sJWRzWF+IEvntjyCwQQoGyW49l3kdoU3gNr1s1hPfv1vExCs 5iV9I/LhqjRC6ULIslC6EfvH8H+2VGI+plu2QXfvEWK3QUOw64LNPE3ZEAxJf6OptTkdaa/TUqXW tm4n5WrEUtpMrEx+ONswYlBLyADTVZLB//CpHVm4JNQKnD/4smCxeDAOSvu34E2Fxcg9BD+OPJdX uBO/EKnN5fg1r6piPjhVkQELjvV7lowZdyq+fFvg==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=K6I6vyJbyXZYEsybChr7OsUtAd1NAn9CNYSQp2hQhLY=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp001-imp.gov-dooray.com with SMTP id 4c4a006b63e0ed63; Mon, 06 Feb 2023 21:06:59 +0900 From: "Chan Kim" To: Subject: In device tree, can't understand 'ranges' property of PCIe root complex node Date: Mon, 6 Feb 2023 21:06:59 +0900 Message-ID: <03ab01d93a23$83ef3a60$8bcdaf20$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: Adk6IwXuS8kRUnGxSl+hu0kEx+V2ag== X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Hello all, For example in linux-5.15.68's arch/arm64/boot/dts/ti/k3-am64-main.dtsi, &cbass_main { ... skip ... pcie0_rc: pcie@f102000 { compatible = "ti,am64-pcie-host", "ti,j721e-pcie-host"; reg = <0x00 0x0f102000 0x00 0x1000>, <0x00 0x0f100000 0x00 0x400>, <0x00 0x0d000000 0x00 0x00800000>, <0x00 0x68000000 0x00 0x00001000>; reg-names = "intd_cfg", "user_cfg", "reg", "cfg"; ... skip ... #address-cells = <3>; #size-cells = <2>; ...skip ... msi-map = <0x0 &gic_its 0x0 0x10000>; ranges = <0x01000000 0x00 0x68001000 0x00 0x68001000 0x00 0x0010000>, <0x02000000 0x00 0x68011000 0x00 0x68011000 0x00 0x7fef000>; dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x00000010 0x0>; }; }; the 'ranges' property says - IO space starting at address 0x68001000 with size 64KiB is mapped to the parent bus address 0x68001000. - a 32 bit memory address space starting with address 0x68011000 and size 0x7fef000 is mapped to parent bus address 0x68011000. The device tree document says these addresses are all physical. What I can't understand is : I know the BIOS will set the BAR addresses during the enumeration process. This is allocating the endpoint's function to a certain PCIe bus address and I guess setting BAR can be done without this 'ranges' information(it will assign free address range for that device according to the device's need). By the time linux kernel later reads this 'ranges' property, the BIOS (or bootloader) has already assigned different PCIe address to that device. Then, how is this 'ranges' property used by the kernel? Thank you. Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies