From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3A44D80364 for ; Tue, 21 Mar 2017 00:11:40 -0700 (PDT) Received: by mail-it0-x235.google.com with SMTP id w124so4310136itb.1 for ; Tue, 21 Mar 2017 00:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=d5EISPK97K1VWxfaM8TqlAoVOQsnSwYQ9I0e0RC5l/8=; b=JekAxNqLFzwHyJiQfMIla8hPuMKRp9ygWlbpug75G9O9XEr6cCGNphh9yZ4OipsYOt c7h0ljrL/qsYUxS0enc67xavmARyYV7QnZIqVtuiEjD4EMTMcXrrojLMPWTQuYxEjVoy WZgc+ww7XuuCi+BW9SDfJe2LYwvlusM+3BTqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=d5EISPK97K1VWxfaM8TqlAoVOQsnSwYQ9I0e0RC5l/8=; b=AHy9+1lIJ39DXz3V+PhN7V7ttvh3TfQGrAGKeY+1YuepfvHzVZuPE/uNwBuy4iv3kM 2mTW6JbSi4EHtMgpn2slzTNp+ADMPBPMhIuApBmIDTGBkmmlK6uxTd3W+dWh4DmNKb39 N5UOmsleTFKKcj56zMRu/u4D/HQMmGh7lJUlXV1Mn1mLxHTnQs5qZS69XYhymNUN2FB6 rIq4UvJxRazlfanWflkBPOUhO4IoZE8o6I/RO/iqt4COrd+O2TnK0CbgAlqTNbppIaR8 lX9RA2n+fYlHOhD4YClhfElpjFBMxsiaAIxdMNGD83ESmPWXddRtnfGaUzxBMDAxvLF3 ZZeA== X-Gm-Message-State: AFeK/H1XI6XOR+YH2HtAliJ6lT8J5iDH30hPPZDFr4YU3TonUFwiqvb66Gmu5//pufxFhaEKpz9uQe+Jjx0ehVo4 X-Received: by 10.36.23.74 with SMTP id 71mr1217491ith.37.1490080299538; Tue, 21 Mar 2017 00:11:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.10.27 with HTTP; Tue, 21 Mar 2017 00:11:39 -0700 (PDT) In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6F2F32@shsmsx102.ccr.corp.intel.com> References: <1489943988-15378-1-git-send-email-ard.biesheuvel@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103B835A6F@shsmsx102.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14D6F2F32@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Tue, 21 Mar 2017 07:11:39 +0000 Message-ID: To: "Gao, Liming" Cc: "Zeng, Star" , "edk2-devel@lists.01.org" , "Tian, Feng" , "Yao, Jiewen" Subject: Re: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't allocate below 4 GB X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 07:11:40 -0000 Content-Type: text/plain; charset=UTF-8 On 21 March 2017 at 02:37, Gao, Liming wrote: > Yes. Spec has no such limitation. I agree this change. > > Reviewed-by: Liming Gao > Pushed as 09da11081915, thanks. > Thanks > Liming >>-----Original Message----- >>From: Zeng, Star >>Sent: Monday, March 20, 2017 9:10 AM >>To: Ard Biesheuvel ; edk2-devel@lists.01.org; >>Tian, Feng >>Cc: Yao, Jiewen ; Gao, Liming >>; Zeng, Star >>Subject: RE: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't >>allocate below 4 GB >> >>I am ok with this patch. >> >>Jiewen and Liming, do you have any comments? >> >>Thanks, >>Star >>-----Original Message----- >>From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >>Sent: Monday, March 20, 2017 1:20 AM >>To: edk2-devel@lists.01.org; Zeng, Star ; Tian, Feng >> >>Cc: Ard Biesheuvel >>Subject: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't >>allocate below 4 GB >> >>The BGRT table has an 8 byte field for the memory address of the image data, >>and yet the driver explicitly allocates below 4 GB. This results in an ASSERT() >>on systems that do not have any memory below 4 GB to begin with. >> >>Since neither the PI, the UEFI or the ACPI spec contain any mention of why >>this data should reside below 4 GB, replace the allocation call with an ordinary >>AllocatePages() call. >> >>Contributed-under: TianoCore Contribution Agreement 1.0 >>Signed-off-by: Ard Biesheuvel >>--- >> >>MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphi >>csResourceTableDxe.c | 41 ++------------------ >> 1 file changed, 3 insertions(+), 38 deletions(-) >> >>diff --git >>a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >>hicsResourceTableDxe.c >>b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >>hicsResourceTableDxe.c >>index 804ffa5a6bb6..6a7165a95489 100644 >>--- >>a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >>hicsResourceTableDxe.c >>+++ >>b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >>h >>+++ icsResourceTableDxe.c >>@@ -227,43 +227,6 @@ BgrtAcpiTableChecksum ( } >> >> /** >>- Allocate EfiBootServicesData below 4G memory address. >>- >>- This function allocates EfiBootServicesData below 4G memory address. >>- >>- @param[in] Size Size of memory to allocate. >>- >>- @return Allocated address for output. >>- >>-**/ >>-VOID * >>-BgrtAllocateBsDataMemoryBelow4G ( >>- IN UINTN Size >>- ) >>-{ >>- UINTN Pages; >>- EFI_PHYSICAL_ADDRESS Address; >>- EFI_STATUS Status; >>- VOID *Buffer; >>- >>- Pages = EFI_SIZE_TO_PAGES (Size); >>- Address = 0xffffffff; >>- >>- Status = gBS->AllocatePages ( >>- AllocateMaxAddress, >>- EfiBootServicesData, >>- Pages, >>- &Address >>- ); >>- ASSERT_EFI_ERROR (Status); >>- >>- Buffer = (VOID *) (UINTN) Address; >>- ZeroMem (Buffer, Size); >>- >>- return Buffer; >>-} >>- >>-/** >> Install Boot Graphics Resource Table to ACPI table. >> >> @return Status code. >>@@ -358,11 +321,13 @@ InstallBootGraphicsResourceTable ( >> // The image should be stored in EfiBootServicesData, allowing the system >>to reclaim the memory >> // >> BmpSize = (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof >>(BMP_IMAGE_HEADER); >>- ImageBuffer = BgrtAllocateBsDataMemoryBelow4G (BmpSize); >>+ ImageBuffer = AllocatePages (EFI_SIZE_TO_PAGES (BmpSize)); >> if (ImageBuffer == NULL) { >> return EFI_OUT_OF_RESOURCES; >> } >> >>+ ZeroMem (ImageBuffer, BmpSize); >>+ >> mBmpImageHeaderTemplate.Size = (UINT32) BmpSize; >> mBmpImageHeaderTemplate.ImageSize = (UINT32) BmpSize - sizeof >>(BMP_IMAGE_HEADER); >> mBmpImageHeaderTemplate.PixelWidth = (UINT32) mLogoWidth; >>-- >>2.7.4 >