File Index
Files and directories
Sign in
FILE

cmdline.c

File preview with syntax highlighting.

linux-6.19.14/arch/x86/virt/svm/cmdline.c C
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * AMD SVM-SEV command line parsing support
 4 *
 5 * Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc.
 6 *
 7 * Author: Michael Roth <michael.roth@amd.com>
 8 */
 9
10#include <linux/string.h>
11#include <linux/printk.h>
12#include <linux/cache.h>
13#include <linux/cpufeature.h>
14
15#include <asm/sev-common.h>
16
17struct sev_config sev_cfg __read_mostly;
18
19static int __init init_sev_config(char *str)
20{
21	char *s;
22
23	while ((s = strsep(&str, ","))) {
24		if (!strcmp(s, "debug")) {
25			sev_cfg.debug = true;
26			continue;
27		}
28
29		if (!strcmp(s, "nosnp")) {
30			if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) {
31				setup_clear_cpu_cap(X86_FEATURE_SEV_SNP);
32				cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
33				continue;
34			} else {
35				goto warn;
36			}
37		}
38
39warn:
40		pr_info("SEV command-line option '%s' was not recognized\n", s);
41	}
42
43	return 1;
44}
45__setup("sev=", init_sev_config);
~/ Read-only file preview.