From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-fw-9103.amazon.com (smtp-fw-9103.amazon.com [207.171.188.200]) by mx.groups.io with SMTP id smtpd.web11.31955.1644834504057100073 for ; Mon, 14 Feb 2022 02:28:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=VEQMY2gx; spf=pass (domain: amazon.de, ip: 207.171.188.200, mailfrom: prvs=0376cb095=ncoleon@amazon.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1644834504; x=1676370504; h=from:to:cc:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding:subject; bh=5aFbqG17U/q9Ig8l6kpENaSTQkP+p6vdrdeOunnPyhY=; b=VEQMY2gxZiKtUymU/wNt6JckDk2FYEIOQuHuOnuGu8GVzQ1e5C21qI6t B/fd6d4u5QnlmAw8W24PwyfTIZm8AohWvxG4CL8Lmi7sqCo5krYo9EdjN jfzd+jTJPhvYyQykcG3hIQKO9zkhGW4I5sSog7aFj4zXPhAF1PEXlKUY8 c=; X-IronPort-AV: E=Sophos;i="5.88,367,1635206400"; d="scan'208";a="991796385" Subject: Re: [edk2-devel] [PATCH v4 7/8] PciHostBridgeDxe: Extend service to get base addresses before allocation Thread-Topic: [edk2-devel] [PATCH v4 7/8] PciHostBridgeDxe: Extend service to get base addresses before allocation Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-iad-1e-0168675e.us-east-1.amazon.com) ([10.25.36.210]) by smtp-border-fw-9103.sea19.amazon.com with ESMTP; 14 Feb 2022 10:28:08 +0000 Received: from EX13D37EUA003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1e-0168675e.us-east-1.amazon.com (Postfix) with ESMTPS id BC9D2A297A; Mon, 14 Feb 2022 10:28:07 +0000 (UTC) Received: from EX13D49EUC003.ant.amazon.com (10.43.164.91) by EX13D37EUA003.ant.amazon.com (10.43.165.7) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Mon, 14 Feb 2022 10:28:06 +0000 Received: from EX13D49EUC003.ant.amazon.com ([10.43.164.91]) by EX13D49EUC003.ant.amazon.com ([10.43.164.91]) with mapi id 15.00.1497.028; Mon, 14 Feb 2022 10:28:06 +0000 From: "Ojeda Leon, Nicolas" To: "devel@edk2.groups.io" , "kraxel@redhat.com" CC: "Gupta, Atul" , "Graf (AWS), Alexander" Thread-Index: AQHYIYxMKrkAt3/+GkixmIjLARi/jKyS1fFQ Date: Mon, 14 Feb 2022 10:28:06 +0000 Message-ID: <211194415e9047938f7d5177fada4d76@EX13D49EUC003.ant.amazon.com> References: <68baf235a1b6fe824424f874c6d6f5a015676717.1643919691.git.ncoleon@amazon.com> <20220204083602.w2r7c6hwj423a6bm@sirius.home.kraxel.org> <51b4eb6b2c1049f29e21dd6a208e6965@EX13D49EUC003.ant.amazon.com> <20220214101810.xiievg2xi5ttgcam@sirius.home.kraxel.org> In-Reply-To: <20220214101810.xiievg2xi5ttgcam@sirius.home.kraxel.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.43.166.93] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable >> > Hmm, so you are hiding the #define here to avoid updating Protocol/Pci= HostBridgeResourceAllocation.h ... >> > >> > I suspect if this can't be implemented in the pci enumerator alone the= re is just no way around actually extending uefi protocols. But it's also = not fully clear to me why you need this new "partial" state. >> > Wouldn't you know either nothing or both base + size for a resource? >> > >> >> Yes you are right, the current status is we have nothing and after the = >> resources are allocated we have base and size. However, the allocation = >> happens after CreateResourceMap is called, this function is the one = >> that iterates over all resources of all devices under a root bridges = >> and places them in a root bridge relative offset to then calculate the = >> length of the resources required for that specific root bridge. For = >> the pre-populated BARs I retrieve the Base Address of the Root Bridge = >> before placing the resources at the root bridge relative offset so = >> that I can translate the BAR address (set by the host) into an offset. >> That's why I created this patch to retrieve only the base address = >> before the root bridge resource map is created, submitted and = >> allocated. > >Hmm, nasty init order issue. No good idea offhand. > >Have you tried to exclude the pre-populated BARs from the host bridge wind= ows communicated to the edk2 pci core? The pci enumerator should not creat= e overlapping pci bar assignment then. But it might very well be that this= only shifts the problem to another place ... > >take care, > Gerd Haven't tried that but we are working on a new approach that do not touches= the protocol at all but instead profits from the retry loop already in pla= ce and, after an allocation round, verifies if the pre-populated BARs are i= n the correct place, otherwise tries again. Similar to what is currently do= ne when the allocation fails due to not enough space. Also we are creating = a routine that "adjusts" the resources by analyzing pre-populated BAR situa= tion to decide which device to reject before trying again. Expect a new revision soon. Best regards, Nicolas Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879