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.133.124]) by mx.groups.io with SMTP id smtpd.web12.6035.1646217418031322047 for ; Wed, 02 Mar 2022 02:36:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g9oXjXcZ; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646217417; 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=189Cza5zRzPtxrpdpCvZ2SlhZSs5GYwJW1gGTPXSekI=; b=g9oXjXcZib/NM8CIAYkKoeSclwt7J9rLPb6AUZScnM6MRwcVxQqblTMCLbP0phJHSI8Bt4 UuJLVoSTwuSDtYlRotcjeQPUNH7iGIf+czjXJcS8jjTqewbP2o7FDu09Qst4wqDADqLuur 8Ws2RXgUwc/FNR03tIXJ7cDedZjTmeE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-492-oe7vgwPjMSyzpFayIq2ckA-1; Wed, 02 Mar 2022 05:36:53 -0500 X-MC-Unique: oe7vgwPjMSyzpFayIq2ckA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 551A01006AA5; Wed, 2 Mar 2022 10:36:52 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFC1783087; Wed, 2 Mar 2022 10:36:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7497918000B4; Wed, 2 Mar 2022 07:56:51 +0100 (CET) Date: Wed, 2 Mar 2022 07:56:51 +0100 From: "Gerd Hoffmann" To: devel@edk2.groups.io, min.m.xu@intel.com Cc: Ard Biesheuvel , "Justen, Jordan L" , Brijesh Singh , "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V7 19/37] OvmfPkg/PlatformInitLib: Add memory functions Message-ID: <20220302065651.4ahbxeitxozrd5k7@sirius.home.kraxel.org> References: <46e0f662050779ec3ce3caf17196403266e73269.1646031164.git.min.m.xu@intel.com> <20220301130941.dw6cdc5nvh7c63u2@sirius.home.kraxel.org> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, > > Hmm. Unlike patches 17+18 which are pure code motion (except the > > function renaming but that doesn't change the workflow) this patch mixes > > code changes and code moving which makes it hard to review. > > > > It should be splitted into one (or more) patches changing the functions as > > needed (and keeping the code in PlatformPei), and one patch moving things > > over to PlatformInitLib without functional changes. > Ok. Looks like #21 & #22 in tdvf_wave2.v6? > https://github.com/mxu9/edk2/commit/ef0615ca5665b2058e4352a322dfa74d258f9f31 > https://github.com/mxu9/edk2/commit/25f356a0bf7ee347be30e270aeffe6cbd8e0b464 No. The idea is to changes to the code in PlatformPei with small & one-patch-per-update patches, which allow easy review. Also helps debugging in case something go wrong, when bisecting found the broken patch it's *much* easier to find the actual bug when the patch is small. Rough plan: (1) a patch allocating PLATFORM_INFO struct in PlatformPei. (2) one or more patches moving global variables into PLATFORM_INFO struct. (3) one or more patches restructing functions. Stuff like like splitting functions which set PCDs into two, one for PlatformInitLib and one for PlatformPei. Final step is a pure move from PlatformPei to PlatformInitLib without changing code. > > > + // Fetch the lower memory size (Below 4G) // mLowerMemorySize = > > > + PlatformGetSystemMemorySizeBelow4gb (); > This is in function InitializePlatform(). > > > > Can't you just use TopOfLowRam here? > TopOfLowRam is a local variable in function MemMapInitialization(). It cannot be used in function InitialziePlatform(). Ah, didn't notice it is another function. High time to introduce PLATFORM_INFO->TopOfLowRam ;) take care, Gerd