From: Borislav Petkov <bp@alien8.de>
To: Tom Lendacky <thomas.lendacky@amd.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Bruce Rogers <brogers@suse.com>, Joerg Roedel <jroedel@suse.de>
Subject: Re: [PATCH] x86/ioremap: Map EFI runtime services data as encrypted for SEV
Date: Tue, 10 Mar 2020 13:40:03 +0100 [thread overview]
Message-ID: <20200310124003.GE29372@zn.tnic> (raw)
In-Reply-To: <2d9e16eb5b53dc82665c95c6764b7407719df7a0.1582645327.git.thomas.lendacky@amd.com>
On Tue, Feb 25, 2020 at 09:42:07AM -0600, Tom Lendacky wrote:
> The dmidecode program fails to properly decode the SMBIOS data supplied
> by OVMF/UEFI when running on an SEV guest. The SMBIOS area, under SEV, is
> encrypted and resides in reserved memory that is marked as EFI runtime
> services data. As a result, when memremap() is attempted for the SMBIOS
> data, it can't be mapped as regular RAM (through try_ram_remap()) and,
> since the address isn't part of the iomem resources list, it isn't mapped
> encrypted through the fallback ioremap().
>
> Update __ioremap_check_mem() to set the IORES_MAP_ENCRYPTED flag if SEV is
> active and the memory being mapped is part of EFI runtime services data.
> This allows any runtime services data, which has been created encrypted,
> to be mapped encrypted.
>
> Cc: Bruce Rogers <brogers@suse.com>
> Cc: Joerg Roedel <jroedel@suse.de>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> arch/x86/mm/ioremap.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index 44e4beb4239f..382b6ca66820 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -135,6 +135,13 @@ static void __ioremap_check_mem(resource_size_t addr, unsigned long size,
> memset(desc, 0, sizeof(struct ioremap_desc));
>
> walk_mem_res(start, end, desc, __ioremap_collect_map_flags);
> +
> + /*
> + * The EFI runtime services data area is not covered by walk_mem_res(),
> + * but must be mapped encrypted when SEV is active.
> + */
> + if (sev_active() && efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA)
> + desc->flags |= IORES_MAP_ENCRYPTED;
> }
Why isn't this done in __ioremap_check_encrypted() which is exactly for
SEV stuff like that?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2020-03-10 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 15:42 [PATCH] x86/ioremap: Map EFI runtime services data as encrypted for SEV Tom Lendacky
2020-03-10 10:25 ` Joerg Roedel
2020-03-10 12:40 ` Borislav Petkov [this message]
2020-03-10 13:03 ` Joerg Roedel
2020-03-10 16:37 ` Borislav Petkov
2020-03-10 17:47 ` Borislav Petkov
2020-03-11 9:04 ` Joerg Roedel
2020-03-11 14:56 ` Borislav Petkov
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=20200310124003.GE29372@zn.tnic \
--to=bp@alien8.de \
--cc=brogers@suse.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox