All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] [PATCH v3 2/2] xen/efi: optionally call SetVirtualAddressMap()
Date: Wed, 23 Oct 2019 18:13:35 +0200	[thread overview]
Message-ID: <4e7f7c95-252b-697a-0585-4aad63671949@suse.com> (raw)
In-Reply-To: <20191023160705.GJ1410@mail-itl>

On 23.10.2019 18:07, Marek Marczykowski-Górecki wrote:
> On Wed, Oct 23, 2019 at 05:37:33PM +0200, Jan Beulich wrote:
>> On 13.10.2019 00:11, Marek Marczykowski-Górecki  wrote:
>>> @@ -1094,6 +1100,26 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste
>>>      if ( EFI_ERROR(status) )
>>>          PrintErrMesg(L"Cannot exit boot services", status);
>>>  
>>> +#ifdef CONFIG_SET_VIRTUAL_ADDRESS_MAP
>>> +    for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
>>> +    {
>>> +        EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i;
>>> +
>>> +        if ( desc->Attribute & EFI_MEMORY_RUNTIME )
>>> +            desc->VirtualStart = desc->PhysicalStart;
>>> +        else
>>> +            desc->VirtualStart = INVALID_VIRTUAL_ADDRESS;
>>> +    }
>>> +    status = efi_rs->SetVirtualAddressMap(efi_memmap_size, efi_mdesc_size,
>>> +                                          mdesc_ver, efi_memmap);
>>> +    if ( status != EFI_SUCCESS )
>>> +    {
>>> +        printk(XENLOG_ERR "EFI: SetVirtualAddressMap() failed (%#lx), disabling runtime services\n",
>>> +               status);
>>> +        __clear_bit(EFI_RS, &efi_flags);
>>> +    }
>>> +#endif
>>
>> This new placement undermines (or at least complicates afaict) the
>> original intention to allow picking virtual addresses which don't
>> match the directmap.
> 
> If I read it right, the original intention was to specifically use
> directmap, not some other virtual addresses. Which is flawed, because
> directmap is mapped with NX, so at least EfiRuntimeServicesCode will
> break. This means, even when using directmap, Xen would need to switch
> page tables for the runtime call time to allow executing that code.

Just FYI: The NX-ifying post-dates the EFI work by several years.

> There is of course an option to rewrite it completely differently,
> mapping EFI runtime regions somewhere else (not 1:1 and not re-use
> directmap). But I don't think it worth the effort, and also is definitely
> too complex this far in 4.13 release cycle.

Especially on this last point - fully agree.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-10-23 16:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-12 22:11 [Xen-devel] [PATCH v3 0/2] Optionally call EFI SetVirtualAddressMap() Marek Marczykowski-Górecki
2019-10-12 22:11 ` [Xen-devel] [PATCH v3 1/2] efi: remove old SetVirtualAddressMap() arrangement Marek Marczykowski-Górecki
2019-10-23 15:15   ` Jan Beulich
2019-10-23 15:36     ` Marek Marczykowski-Górecki
2019-10-23 16:10       ` Jan Beulich
2019-10-23 16:38         ` Marek Marczykowski-Górecki
2019-10-23 15:26   ` Jan Beulich
2019-10-12 22:11 ` [Xen-devel] [PATCH v3 2/2] xen/efi: optionally call SetVirtualAddressMap() Marek Marczykowski-Górecki
2019-10-15 23:40   ` Andrew Cooper
2019-10-23 15:37   ` Jan Beulich
2019-10-23 16:07     ` Marek Marczykowski-Górecki
2019-10-23 16:13       ` Jan Beulich [this message]
2019-10-15 12:25 ` [Xen-devel] [PATCH v3 0/2] Optionally call EFI SetVirtualAddressMap() Jason Andryuk

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-all 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=4e7f7c95-252b-697a-0585-4aad63671949@suse.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.