You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
crypto: ccp - Flush the SEV-ES TMR memory before giving it to firmware
[ Upstream commit 46a334a98f585ef78d51d8f5736596887bdd7f54 ]
Perform a cache flush on the SEV-ES TMR memory after allocation to prevent
any possibility of the firmware encountering an error should dirty cache
lines be present. Use clflush_cache_range() to flush the SEV-ES TMR memory.
Fixes: 97f9ac3db6 ("crypto: ccp - Add support for SEV-ES to the PSP driver")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
959bd9d42a
commit
627e140a5b
@@ -23,6 +23,7 @@
|
||||
#include <linux/gfp.h>
|
||||
|
||||
#include <asm/smp.h>
|
||||
#include <asm/cacheflush.h>
|
||||
|
||||
#include "psp-dev.h"
|
||||
#include "sev-dev.h"
|
||||
@@ -1067,7 +1068,10 @@ void sev_pci_init(void)
|
||||
|
||||
/* Obtain the TMR memory area for SEV-ES use */
|
||||
sev_es_tmr = sev_fw_alloc(SEV_ES_TMR_SIZE);
|
||||
if (!sev_es_tmr)
|
||||
if (sev_es_tmr)
|
||||
/* Must flush the cache before giving it to the firmware */
|
||||
clflush_cache_range(sev_es_tmr, SEV_ES_TMR_SIZE);
|
||||
else
|
||||
dev_warn(sev->dev,
|
||||
"SEV: TMR allocation failed, SEV-ES support unavailable\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user