Skip to content

Commit

Permalink
virt/coco/sev-guest: Check SEV_SNP attribute at probe time
Browse files Browse the repository at this point in the history
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) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20230307192449.24732-3-bp@alien8.de
  • Loading branch information
Borislav Petkov (AMD) committed Mar 13, 2023
1 parent eeac8ed commit d6fd48e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions arch/x86/kernel/sev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2183,9 +2183,6 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned
struct ghcb *ghcb;
int ret;

if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
return -ENODEV;

if (!fw_err)
return -EINVAL;

Expand Down
3 changes: 3 additions & 0 deletions drivers/virt/coco/sev-guest/sev-guest.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@ static int __init sev_guest_probe(struct platform_device *pdev)
void __iomem *mapping;
int ret;

if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
return -ENODEV;

if (!dev->platform_data)
return -ENODEV;

Expand Down

0 comments on commit d6fd48e

Please sign in to comment.