Patch "crypto: ccp - Flush the SEV-ES TMR memory before giving it to firmware" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    crypto: ccp - Flush the SEV-ES TMR memory before giving it to firmware

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-ccp-flush-the-sev-es-tmr-memory-before-giving.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a7d3173fe0ab77c97b23a8e10e4f222b5d346ead
Author: Tom Lendacky <thomas.lendacky@xxxxxxx>
Date:   Mon Jan 23 16:53:08 2023 -0600

    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: 97f9ac3db661 ("crypto: ccp - Add support for SEV-ES to the PSP driver")
    Signed-off-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 56998bc579d67..3e583f0324874 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -26,6 +26,7 @@
 #include <linux/fs_struct.h>
 
 #include <asm/smp.h>
+#include <asm/cacheflush.h>
 
 #include "psp-dev.h"
 #include "sev-dev.h"
@@ -1334,7 +1335,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");
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux