Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: ccp - allow callers to use HV-Fixed page API when SEV is disabled

When SEV is disabled, the HV-Fixed page allocation call fails, which in
turn causes SFS initialization to fail.

Fix the HV-Fixed API so callers (for example, SFS) can use it even when
SEV is disabled by performing normal page allocation and freeing.

Fixes: e09701dcdd9c ("crypto: ccp - Add new HV-Fixed page allocation/free API")
Cc: stable@vger.kernel.org
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ashish Kalra and committed by
Herbert Xu
8168a7b7 6de23f81

+4 -6
+4 -6
drivers/crypto/ccp/sev-dev.c
··· 1105 1105 { 1106 1106 struct psp_device *psp_master = psp_get_master_device(); 1107 1107 struct snp_hv_fixed_pages_entry *entry; 1108 - struct sev_device *sev; 1109 1108 unsigned int order; 1110 1109 struct page *page; 1111 1110 1112 - if (!psp_master || !psp_master->sev_data) 1111 + if (!psp_master) 1113 1112 return NULL; 1114 - 1115 - sev = psp_master->sev_data; 1116 1113 1117 1114 order = get_order(PMD_SIZE * num_2mb_pages); 1118 1115 ··· 1123 1126 * This API uses SNP_INIT_EX to transition allocated pages to HV_Fixed 1124 1127 * page state, fail if SNP is already initialized. 1125 1128 */ 1126 - if (sev->snp_initialized) 1129 + if (psp_master->sev_data && 1130 + ((struct sev_device *)psp_master->sev_data)->snp_initialized) 1127 1131 return NULL; 1128 1132 1129 1133 /* Re-use freed pages that match the request */ ··· 1160 1162 struct psp_device *psp_master = psp_get_master_device(); 1161 1163 struct snp_hv_fixed_pages_entry *entry, *nentry; 1162 1164 1163 - if (!psp_master || !psp_master->sev_data) 1165 + if (!psp_master) 1164 1166 return; 1165 1167 1166 1168 /*