From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id DBD467803DB for ; Fri, 5 Jan 2024 16:47:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MB0noAjTd6Hk8xIv7TPqmPDPUsHilcgesSbvdkF18SU=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1704473225; v=1; b=TNRxVCruP3ZHm65ezguwOvEpetTVx7uY4L/VcF7NXSEdYGoDBNb5qZbf6qMjRfIuBHOCrL/7 n9Ix10h+lN8/rZSNB6k2v0+K3N+pigOv/eH5YmjfuvLDr+2kiyXGi5iItBwde/q8uL96w30t4KG iWgCiYp+QLQmL7GxUFVw0P7c= X-Received: by 127.0.0.2 with SMTP id 36sWYY7687511xJQoi4SiL2M; Fri, 05 Jan 2024 08:47:05 -0800 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.28222.1704473224908859786 for ; Fri, 05 Jan 2024 08:47:05 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2E3C06090B for ; Fri, 5 Jan 2024 16:47:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD90FC433CD for ; Fri, 5 Jan 2024 16:47:03 +0000 (UTC) X-Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-50e7d6565b5so1985373e87.0 for ; Fri, 05 Jan 2024 08:47:03 -0800 (PST) X-Gm-Message-State: MpkB4WSQMsvY4Kd8rMhkmx8hx7686176AA= X-Google-Smtp-Source: AGHT+IF79TOHVq9drkP2wzuuEowYeQPPSQmTm5ArdB7h9qpX0cjRcZlcINM/io5GNIPmhFFAIjPecvxsHNdY1nNGG48= X-Received: by 2002:ac2:5ec1:0:b0:50e:4e6c:ea8f with SMTP id d1-20020ac25ec1000000b0050e4e6cea8fmr1146789lfq.41.1704473221961; Fri, 05 Jan 2024 08:47:01 -0800 (PST) MIME-Version: 1.0 References: <20240105114931.844886-1-yeoreum.yun@arm.com> In-Reply-To: <20240105114931.844886-1-yeoreum.yun@arm.com> From: "Ard Biesheuvel" Date: Fri, 5 Jan 2024 17:46:50 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v1 1/1] StandaloneMmPkg: Initialise serial port early in StandaloneMmEntryPoint To: devel@edk2.groups.io, yeoreum.yun@arm.com Cc: sami.mujawar@arm.com, ray.ni@intel.com, pierre.gondois@arm.com, nd@arm.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=TNRxVCru; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Fri, 5 Jan 2024 at 12:49, levi.yun wrote: > > Serial port used by the DEBUG macro is initialised in StandaloneMmMain > by the DebugLib constructor. > > When we use a serial port initialised by TF-A it is not a problem. > However, if we use a serial port that is not initialised by TF-A, > the debug log prints hangs. > > Therefore, initialise the serial port early on in the entry point. > > Signed-off-by: levi.yun > --- > These changes can be seen at > https://github.com/LeviYeoReum/edk2/tree/levi/2956_init_serial too. > So now we will always initialize the serial port in the entrypoint only because DebugLib might use it later with doing the initialization. That doesn't sound quite correct to me. Could you explain why we cannot rely on DebugLib to call the initializer / constructor at the right time? > StandaloneMmPkg/StandaloneMmPkg.dsc = | 1 + > StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntry= Point.inf | 1 + > StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreE= ntryPoint.c | 3 +++ > 3 files changed, 5 insertions(+) > > diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/Standa= loneMmPkg.dsc > index 8012f93b7dcc38ea8fdd2de98912bbc09157ec53..040a4aa5b3d268fdfaaec9a97= 5cfc6ff31aa37b4 100644 > --- a/StandaloneMmPkg/StandaloneMmPkg.dsc > +++ b/StandaloneMmPkg/StandaloneMmPkg.dsc > @@ -66,6 +66,7 @@ [LibraryClasses.AARCH64, LibraryClasses.ARM] > ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf > CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMain= tenanceLib.inf > PeCoffExtraActionLib|StandaloneMmPkg/Library/StandaloneMmPeCoffExtraAc= tionLib/StandaloneMmPeCoffExtraActionLib.inf > + SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNu= ll.inf > > NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf > NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf > diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Standalon= eMmCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/= StandaloneMmCoreEntryPoint.inf > index 75cfb98c0e75cd7cee2a59723035679612da4528..086639ecfbc983627aed73817= 815e2485104375e 100644 > --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCore= EntryPoint.inf > +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCore= EntryPoint.inf > @@ -42,6 +42,7 @@ [LibraryClasses] > DebugLib > > [LibraryClasses.ARM, LibraryClasses.AARCH64] > + SerialPortLib > StandaloneMmMmuLib > ArmSvcLib > > diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/Stand= aloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoin= t/Arm/StandaloneMmCoreEntryPoint.c > index 96de10405af829c66e3f43ed4692f785d8df113e..66b56bdfe4959d5ab6152ff02= 4caa6e900e7a948 100644 > --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMm= CoreEntryPoint.c > +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMm= CoreEntryPoint.c > @@ -335,6 +335,9 @@ _ModuleEntryPoint ( > UINTN TeDataSize; > EFI_PHYSICAL_ADDRESS ImageBase; > > + // Initialize the Serial Port early to print debug log before Standalo= neMmMain. > + SerialPortInitialize (); > + > // Get Secure Partition Manager Version Information > Status =3D GetSpmVersion (); > if (EFI_ERROR (Status)) { > -- > Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") > > IMPORTANT NOTICE: The contents of this email and any attachments are conf= idential and may also be privileged. If you are not the intended recipient,= please notify the sender immediately and do not disclose the contents to a= ny other person, use it for any purpose, or store or copy the information i= n any medium. Thank you. > > >=20 > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113299): https://edk2.groups.io/g/devel/message/113299 Mute This Topic: https://groups.io/mt/103540969/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-