From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.80250.1673591658766390112 for ; Thu, 12 Jan 2023 22:34:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ffR+Skyb; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673591594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+PfNMvYyuA7d+delMbT7FLohKafxg1M37iyFqXMc6r4=; b=ffR+Skyb4/zzu/SVUx7XenzqU5lQN27cv6haRnD83X2ozQ0EyK/iUyZdnpDBfwpsAZpu5G KSlwTizL6Cf+YDxXoPG8XeNBwOPbhB0H15Xa85zkebQoGGNNly3id6Y04+57aEB21oDoTh 1w4iJwAU4odzxxUSVnxjergKlsxkyhY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-93-oQWBfv4HPvOeVqlm_3Q1ig-1; Fri, 13 Jan 2023 01:33:11 -0500 X-MC-Unique: oQWBfv4HPvOeVqlm_3Q1ig-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01082858F09; Fri, 13 Jan 2023 06:33:11 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.238]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C559C2166B26; Fri, 13 Jan 2023 06:33:10 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E1BA9180060F; Fri, 13 Jan 2023 07:33:08 +0100 (CET) Date: Fri, 13 Jan 2023 07:33:08 +0100 From: "Gerd Hoffmann" To: Pedro Falcato Cc: devel@edk2.groups.io, Isaac Oram , Theo Jehl Subject: Re: [PATCH edk2-platforms 1/2] QemuOpenBoardPkg: Redo PCI bus initialization Message-ID: <20230113063308.rzaqgegewx3pp77i@sirius.home.kraxel.org> References: <20230112231359.452800-1-pedro.falcato@gmail.com> <20230112231359.452800-2-pedro.falcato@gmail.com> MIME-Version: 1.0 In-Reply-To: <20230112231359.452800-2-pedro.falcato@gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c > index 21705256191b..4f312c36016e 100644 > --- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c > +++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c There is OvmfPkg/Library/PlatformInitLib which you could use instead of reinventing the wheel ... If there are changes needed to make PlatformInitLib work for you feel free to propose patches (same goes for eventually moving code from OvmfPkg/PlatformPei to the Library). > + // It's worth noting that QEMU also grew an option to change lowmem based on the > + // user's preferences. Because of all of this, it's near impossible to hardcode > + // a range, so we grab TOLUD (not in a literal way, since QEMU does not implement > + // that register ;)) and calculate our PCI MMIO based on that. This also makes it so > + // the DSDT built by QEMU will have correct _CRS ranges. > + // hw/pci-host/q35.c explicitly says our PCI hole ranges from [TOLUD, IO APIC]. > + // As far as I can tell, we seem to be allowed to add a 64-bit resource range anywhere. There is a etc/reserved-memory-end fw_cfg FwCfg file. If present it the 64-bit resource range should be placed above the address specified there (qemu uses that to reserve address space if needed, happens for example when you enable memory hotplug). The patch should be splitted up into smaller pieces to make it easier to review the changes. take care, Gerd