public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Evan Lloyd <Evan.Lloyd@arm.com>,
	 "Matteo.Carlini@arm.com@arm.com"
	<"Matteo.Carlini@arm.com"@arm.com>,
	 "leif.lindholm@linaro.org@arm.com"
	<"leif.lindholm@linaro.org"@arm.com>,
	 "nd@arm.com@arm.com" <"nd@arm.com"@arm.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	 Arvind Chauhan <Arvind.Chauhan@arm.com>,
	 "ard.biesheuvel@linaro.org@arm.com"
	<"ard.biesheuvel@linaro.org"@arm.com>,
	 Thomas Abraham <thomas.abraham@arm.com>,
	Sami Mujawar <Sami.Mujawar@arm.com>,
	 Mitch Ishihara <Mitch.Ishihara@arm.com>
Subject: Re: [PATCH edk2-platforms v2 15/18] ARM/VExpressPkg: New DP500/DP550/DP650 platform library.
Date: Wed, 24 Jan 2018 11:34:59 +0000	[thread overview]
Message-ID: <CAKv+Gu9O=1kSQVo1ko=cdNDHEHjGzVa1tKXJ=5Jjo8_k54tYEQ@mail.gmail.com> (raw)
In-Reply-To: <DB5PR08MB101446AEF20977FD8D56779A9AE20@DB5PR08MB1014.eurprd08.prod.outlook.com>

On 24 January 2018 at 11:27, Alexei Fedorov <Alexei.Fedorov@arm.com> wrote:
> Hi Ard,
>
>
> You wrote:
>
>
>> > +  Status = gDS->SetMemorySpaceAttributes (
>> > +                  *VramBaseAddress,
>> > +                  *VramSize,
>> > +                  EFI_MEMORY_WC
>>
>> Please add EFI_MEMORY_XP here
>>
>
>
> Setting EFI_MEMORY_XP causes assertion because
> gDS->SetMemorySpaceAttributes() returns Unsupported in
> edk2\MdeModulePkg\Core\Dxe\Gcd\Gcd.c  with Status set at line #834:
>
>
>       if ((Entry->Capabilities & Attributes) != Attributes) {
>
>         //***AF
>         DEBUG ((DEBUG_GCD, " @%d EFI_UNSUPPORTED: Capabilitie=0x%lX
> Attributes=0x%lX\n",
>                 __LINE__, Entry->Capabilities, Attributes));
>
>         Status = EFI_UNSUPPORTED;
>         goto Done;
>       }
>
> because Entry->Capabilities don't have EFI_MEMORY_XP set, see debug output
> below:
>

<snip>

> If  gDS->SetMemorySpaceAttributes() call is replaced with
> Cpu->SetMemoryAttributes(), attributes are set successfully with eXecute bit
> for frame buffer being cleared.
>

Ugh. The GCD map conflates capabilities of the region (i.e., this
region can be configured as read-only by the MMU) with permissions
(i.e., the contents of this region should not be modified by the
program), which is why nobody bothers to set these attributes for the
GCD region. If you do set those bits in the GCD map, all allocations
carved out of it will be read-only and non-executable (because, hey,
why would you allocate writable or executable memory from a region
that can be configured as read-only or non-executable?).

In any case, your solution is the correct one: use the arch CPU
protocol directly instead (although there is something  in the PI spec
that bans it). Having an executable frame buffer is a much bigger deal
IMHO, especially when all other allocations are being locked down, and
so my preference is to switch to the arch CPU protocol here.

Thanks,
Ard.


  reply	other threads:[~2018-01-24 11:29 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 19:08 [PATCH edk2-platforms v2 00/18] ARM: Update GOP evan.lloyd
2017-12-22 19:08 ` [PATCH edk2-platforms v2 01/18] ARM/VExpressPkg: Fix MODULE_TYPE of HDLCD/PL111 platform libraries evan.lloyd
2017-12-22 19:08 ` [PATCH edk2-platforms v2 02/18] ARM/VExpressPkg: Tidy HDLCD and PL11LCD platform Lib: Coding standard evan.lloyd
2017-12-23 14:07   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 03/18] ARM/VExpressPkg: Tidy HdLcd/PL111Lcd code: Updated comments evan.lloyd
2017-12-23 14:08   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 04/18] ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf evan.lloyd
2017-12-23 14:08   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 05/18] ARM/VExpressPkg: PL111 and HDLCD: add const qualifier evan.lloyd
2017-12-23 14:09   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 06/18] ARM/VExpressPkg: Add and update debug ASSERTS evan.lloyd
2017-12-23 14:12   ` Ard Biesheuvel
2018-01-04 18:55     ` Girish Pathak
2018-01-04 19:24       ` Ard Biesheuvel
2018-01-04 19:51         ` Evan Lloyd
2018-01-04 19:54           ` Ard Biesheuvel
2018-02-28 20:27             ` Evan Lloyd
2018-03-02 19:07               ` Ard Biesheuvel
2018-03-05 15:08                 ` Evan Lloyd
2018-03-06 11:16                   ` Ard Biesheuvel
2018-03-14 12:24         ` Leif Lindholm
2018-03-14 12:35           ` Ard Biesheuvel
2018-03-14 12:39             ` Leif Lindholm
2017-12-22 19:08 ` [PATCH edk2-platforms v2 07/18] ARM/VExpressPkg: PL111LcdArmVExpressLib: Minor code cleanup evan.lloyd
2017-12-23 14:13   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 08/18] ARM/VExpressPkg: PL111 and HDLCD: Use FixedPcdGet32 evan.lloyd
2017-12-23 14:14   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 09/18] ARM/VExpressPkg: PL11LcdArmVExpressLib: Improvement conditional evan.lloyd
2017-12-23 14:16   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 10/18] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove status check EFI_TIMEOUT evan.lloyd
2017-12-23 14:16   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 11/18] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove redundant Bpp evan.lloyd
2017-12-23 14:17   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 12/18] ARM/VExpressPkg: Redefine LcdPlatformGetTimings function evan.lloyd
2017-12-23 14:18   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 13/18] ARM/VExpressPkg: PL111 and HDLCD: Add PCD to select pixel format evan.lloyd
2017-12-23 16:00   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 14/18] ARM/VExpressPkg: Reserving framebuffer at build evan.lloyd
2017-12-23 16:02   ` Ard Biesheuvel
2018-01-03 11:04     ` Evan Lloyd
2017-12-22 19:08 ` [PATCH edk2-platforms v2 15/18] ARM/VExpressPkg: New DP500/DP550/DP650 platform library evan.lloyd
2017-12-23 16:07   ` Ard Biesheuvel
2018-01-08 18:51     ` Evan Lloyd
2018-01-24 11:27       ` Alexei Fedorov
2018-01-24 11:34         ` Ard Biesheuvel [this message]
2017-12-22 19:08 ` [PATCH edk2-platforms v2 16/18] ARM/JunoPkg: Mapping Non-Trused SRAM as device memory evan.lloyd
2017-12-23 16:08   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 17/18] ARM/JunoPkg: Adding SCMI MTL library evan.lloyd
2017-12-23 16:12   ` Ard Biesheuvel
2017-12-22 19:08 ` [PATCH edk2-platforms v2 18/18] ARM/JunoPkg: Add HDLCD platform library evan.lloyd
2017-12-23 16:22   ` Ard Biesheuvel
2018-01-09 18:21     ` Evan Lloyd
2018-01-09 18:26       ` Ard Biesheuvel
2018-01-10 11:45         ` Alexei Fedorov
2018-01-10 12:02           ` Ard Biesheuvel
2017-12-22 19:29 ` [PATCH edk2-platforms v2 00/18] ARM: Update GOP Ard Biesheuvel
2018-01-02 10:28   ` Evan Lloyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKv+Gu9O=1kSQVo1ko=cdNDHEHjGzVa1tKXJ=5Jjo8_k54tYEQ@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox