[PATCH v3 3/3] arm64: realm: Use aliased addresses for device DMA to shared buffers

Suzuki K Poulose suzuki.poulose at arm.com
Thu Feb 27 09:03:54 PST 2025


On 27/02/2025 16:05, Catalin Marinas wrote:
> On Thu, Feb 27, 2025 at 02:41:50PM +0000, Suzuki K Poulose wrote:
>> When a device performs DMA to a shared buffer using physical addresses,
>> (without Stage1 translation), the device must use the "{I}PA address" with the
>> top bit set in Realm. This is to make sure that a trusted device will be able
>> to write to shared buffers as well as the protected buffers. Thus, a Realm must
>> always program the full address including the "protection" bit, like AMD SME
>> encryption bits.
>>
>> Enable this by providing arm64 specific dma_addr_{encrypted, canonical}
>> helpers for Realms. Please note that the VMM needs to similarly make sure that
>> the SMMU Stage2 in the Non-secure world is setup accordingly to map IPA at the
>> unprotected alias.
>>
>> Cc: Will Deacon <will at kernel.org>
>> Cc: Jean-Philippe Brucker <jean-philippe at linaro.org>
>> Cc: Catalin Marinas <catalin.marinas at arm.com>
>> Cc: Robin Murphy <robin.murphy at arm.com>
>> Cc: Steven Price <steven.price at arm.com>
>> Cc: Christoph Hellwig <hch at lst.de>
>> Cc: Marek Szyprowski <m.szyprowski at samsung.com>
>> Cc: Tom Lendacky <thomas.lendacky at amd.com>
>> Cc: Aneesh Kumar K.V <aneesh.kumar at kernel.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
> 
> In case this goes in via the DMA API tree:
> 
> Acked-by: Catalin Marinas <catalin.marinas at arm.com>

Thanks Catalin.

> 
> (we could bikeshed on the names like unencrypted vs decrypted but I'm
> not fussed about)

It was initially decrypted, but Robin suggested that the DMA layer 
already uses "encrypted" and "unencrypted" (e.g., 
force_dma_unencrypted(), phys_to_dma_unencrypted() etc)

Cheers
Suzuki






More information about the linux-arm-kernel mailing list