Skip to content

Commit d6fd48e

Browse files
committed
virt/coco/sev-guest: Check SEV_SNP attribute at probe time
No need to check it on every ioctl. And yes, this is a common SEV driver but it does only SNP-specific operations currently. This can be revisited later, when more use cases appear. No functional changes. Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent eeac8ed commit d6fd48e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/x86/kernel/sev.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,9 +2183,6 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned
21832183
struct ghcb *ghcb;
21842184
int ret;
21852185

2186-
if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
2187-
return -ENODEV;
2188-
21892186
if (!fw_err)
21902187
return -EINVAL;
21912188

drivers/virt/coco/sev-guest/sev-guest.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,9 @@ static int __init sev_guest_probe(struct platform_device *pdev)
703703
void __iomem *mapping;
704704
int ret;
705705

706+
if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
707+
return -ENODEV;
708+
706709
if (!dev->platform_data)
707710
return -ENODEV;
708711

0 commit comments

Comments
 (0)