Skip to content

Commit

Permalink
sev-guest: configfs-tsm: Allow the privlevel_floor attribute to be up…
Browse files Browse the repository at this point in the history
…dated

With the introduction of an SVSM, Linux will be running at a non-zero
VMPL. Any request for an attestation report at a higher privilege VMPL
than what Linux is currently running will result in an error. Allow for
the privlevel_floor attribute to be updated dynamically.

  [ bp: Trim commit message. ]

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/5a736be9384aebd98a0b7c929660f8a97cbdc366.1717600736.git.thomas.lendacky@amd.com
  • Loading branch information
tlendacky authored and bp3tk0v committed Jun 17, 2024
1 parent eb65f96 commit 614dc0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion drivers/virt/coco/sev-guest/sev-guest.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static int sev_report_new(struct tsm_report *report, void *data)
return 0;
}

static const struct tsm_ops sev_tsm_ops = {
static struct tsm_ops sev_tsm_ops = {
.name = KBUILD_MODNAME,
.report_new = sev_report_new,
};
Expand Down Expand Up @@ -979,6 +979,9 @@ static int __init sev_guest_probe(struct platform_device *pdev)
snp_dev->input.resp_gpa = __pa(snp_dev->response);
snp_dev->input.data_gpa = __pa(snp_dev->certs_data);

/* Set the privlevel_floor attribute based on the vmpck_id */
sev_tsm_ops.privlevel_floor = vmpck_id;

ret = tsm_register(&sev_tsm_ops, snp_dev, &tsm_report_extra_type);
if (ret)
goto e_free_cert_data;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/tsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct tsm_report {
*/
struct tsm_ops {
const char *name;
const unsigned int privlevel_floor;
unsigned int privlevel_floor;
int (*report_new)(struct tsm_report *report, void *data);
};

Expand Down

0 comments on commit 614dc0f

Please sign in to comment.