[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsxVMv2pA0bQzm3L@arm.com>
Date: Mon, 26 Aug 2024 13:13:06 +0300
From: Catalin Marinas <catalin.marinas@....com>
To: Steven Price <steven.price@....com>
Cc: kvm@...r.kernel.org, kvmarm@...ts.linux.dev,
Marc Zyngier <maz@...nel.org>, Will Deacon <will@...nel.org>,
James Morse <james.morse@....com>,
Oliver Upton <oliver.upton@...ux.dev>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Joey Gouly <joey.gouly@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Christoffer Dall <christoffer.dall@....com>,
Fuad Tabba <tabba@...gle.com>, linux-coco@...ts.linux.dev,
Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>,
Gavin Shan <gshan@...hat.com>,
Shanker Donthineni <sdonthineni@...dia.com>,
Alper Gun <alpergun@...gle.com>
Subject: Re: [PATCH v5 12/19] efi: arm64: Map Device with Prot Shared
On Mon, Aug 19, 2024 at 02:19:17PM +0100, Steven Price wrote:
> From: Suzuki K Poulose <suzuki.poulose@....com>
>
> Device mappings need to be emualted by the VMM so must be mapped shared
> with the host.
>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
> Signed-off-by: Steven Price <steven.price@....com>
> ---
> Changes since v4:
> * Reworked to use arm64_is_iomem_private() to decide whether the memory
> needs to be decrypted or not.
> ---
> arch/arm64/kernel/efi.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index 712718aed5dd..95f8e8bf07f8 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -34,8 +34,16 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
> u64 attr = md->attribute;
> u32 type = md->type;
>
> - if (type == EFI_MEMORY_MAPPED_IO)
> - return PROT_DEVICE_nGnRE;
> + if (type == EFI_MEMORY_MAPPED_IO) {
> + pgprot_t prot = __pgprot(PROT_DEVICE_nGnRE);
> +
> + if (arm64_is_iomem_private(md->phys_addr,
> + md->num_pages << EFI_PAGE_SHIFT))
> + prot = pgprot_encrypted(prot);
> + else
> + prot = pgprot_decrypted(prot);
> + return pgprot_val(prot);
Nit: This pattern appears in the previous patch as well. Maybe add a
pgprot_maybe_decrypted().
The patch looks fine other than the need for an early initialisation if
we find any workaround. In the pKVM case, IIUC this would need to call
into the hypervisor as well but that can be handled by the bootloader.
For CCA, our problem is setting the top bit of the IPA.
What's the x86 approach here? The EFI is a bigger problem than the
earlycon.
--
Catalin
Powered by blists - more mailing lists