From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by mx.groups.io with SMTP id smtpd.web12.4214.1593163407720550282 for ; Fri, 26 Jun 2020 02:23:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@xen.org header.s=20200302mail header.b=3k9K3LzH; spf=pass (domain: xen.org, ip: 104.130.215.37, mailfrom: julien@xen.org) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AjsPIh+mEIrKAG+ICWVZ9Nd5K+eKBgMPRhAykphlCnw=; b=3k9K3LzHe/usVzwNeinUVilUOD Y9glNZDMAhsVIf7TH+IBI5dskEaENDW3/OpVKEH0Mo5CPRlwO26Y9Galnou7xGYDiXc1eMst+WYAM j2xaGcXH3U9vJYIhpJy2aRFuUsVkr8qaUYlr2OLHQxROxmlKhA2XS/6xgNp67ohi1Oeg=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jokZy-0008GF-90; Fri, 26 Jun 2020 09:23:26 +0000 Received: from [54.239.6.186] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jokZy-0004Rd-2Q; Fri, 26 Jun 2020 09:23:26 +0000 Subject: Re: [PATCH v3 07/15] ArmVirtPkg: Early serial port initialisation To: Ard Biesheuvel , Sami Mujawar , devel@edk2.groups.io Cc: leif@nuviainc.com, lersek@redhat.com, Alexandru.Elisei@arm.com, Andre.Przywara@arm.com, Matteo.Carlini@arm.com, Laura.Moretta@arm.com, nd@arm.com References: <20200624133458.61920-1-sami.mujawar@arm.com> <20200624133458.61920-8-sami.mujawar@arm.com> <2b729fe3-83f3-52f0-9124-f908cbaf61cd@arm.com> From: Julien Grall Message-ID: <2b167b65-8460-c85d-a08b-d654d694e38a@xen.org> Date: Fri, 26 Jun 2020 10:23:23 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <2b729fe3-83f3-52f0-9124-f908cbaf61cd@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Hi, On 25/06/2020 12:42, Ard Biesheuvel wrote: > (+ Julien) Thank you for the CC! > On 6/24/20 3:34 PM, Sami Mujawar wrote: >> Initialise serial port early so that the platform >> memory map can be logged. >> >> Signed-off-by: Sami Mujawar >> --- >>   ArmVirtPkg/PrePi/PrePi.c | 10 +++++----- >>   1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c >> index >> 4f0c3f98bad63d0682cccd76a0a062d1fd4f46ab..5e144f4bdefb810708238097a3373f11d150bfe5 >> 100755 >> --- a/ArmVirtPkg/PrePi/PrePi.c >> +++ b/ArmVirtPkg/PrePi/PrePi.c >> @@ -1,6 +1,6 @@ >>   /** @file >>   * >> -*  Copyright (c) 2011-2014, ARM Limited. All rights reserved. >> +*  Copyright (c) 2011-2020, ARM Limited. All rights reserved. >>   * >>   *  SPDX-License-Identifier: BSD-2-Clause-Patent >>   * >> @@ -60,16 +60,16 @@ PrePiMain ( >>     // >>     InvalidateDataCacheRange((VOID *)(UINTN)PcdGet64 >> (PcdFdBaseAddress), PcdGet32 (PcdFdSize)); >> -  // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) >> -  Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 >> (PcdSystemMemoryUefiRegionSize)); >> -  ASSERT_EFI_ERROR (Status); >> - >>     // Initialize the Serial Port >>     SerialPortInitialize (); >>     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware >> (version %s built at %a on %a)\n\r", >>       (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); >>     SerialPortWrite ((UINT8 *) Buffer, CharCount); >> +  // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) >> +  Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 >> (PcdSystemMemoryUefiRegionSize)); >> +  ASSERT_EFI_ERROR (Status); >> + >>     // Create the Stacks HOB (reserve the memory for all stacks) >>     StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize); >>     BuildStackHob (StacksBase, StacksSize); >> > > We need to check whether this works on Xen - I don't remember whether we > use some kind of cache coherent shared memory ring there for the serial > console that only works if the MMU and caches are enabled. Julien? Xen Console is using a shared memory ring that requires to be cache coherent. So you wouldn't be able to use the current driver before the MMU and caches are enabled. It might be possible to make it work by issuing cache maintenance when sending the characters. Cheers, -- Julien Grall