x86/sev: Use __pa() in __sme_early_map_unmap_mem()
PATCH 1/1 x86/sev: Use __pa() in __sme_early_map_unmap_mem()
Replace the open-coded virtual to physical address conversion with the __pa() helper.
Signed-off-by Thorsten Blum <[email protected]>
--- arch/x86/mm/mem_encrypt_amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/mem_encrypt_amd.c +1 -1
@@ -156,7 +156,7 @@ void __init sme_early_decrypt(resource_size_t paddr, unsigned long size)static void __init __sme_early_map_unmap_mem (void *vaddr,unsigned long size,bool map) { -unsigned long paddr = (unsigned long )vaddr - __PAGE_OFFSET; +unsigned long paddr =__pa (vaddr);pmdval_t pmd_flags, pmd;/* Use early_pmd_flags but remove the encryption mask */
Quoted 4 lines · Thorsten Blum
Replace the open-coded virtual to physical address conversion with the
__pa()helper.Signed-off-by Thorsten Blum <[email protected]>
sashiko [1] found that when CONFIG_DEBUG_VIRTUAL is enabled, the validation in __phys_addr() can fail and trigger VIRTUAL_BUG_ON(). The concern seems valid, so let's drop this patch.
[1] https://sashiko.dev/#/patchset/20260617150302.98522-4-thorsten.blum%40linux.dev