File: cmdline.c

package info (click to toggle)
linux 6.18.14-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,742,508 kB
  • sloc: ansic: 26,787,389; asm: 272,134; sh: 148,804; python: 79,243; makefile: 57,755; perl: 36,527; xml: 19,542; cpp: 5,913; yacc: 4,939; lex: 2,950; awk: 1,607; sed: 30; ruby: 25
file content (45 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: GPL-2.0-only
/*
 * AMD SVM-SEV command line parsing support
 *
 * Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc.
 *
 * Author: Michael Roth <michael.roth@amd.com>
 */

#include <linux/string.h>
#include <linux/printk.h>
#include <linux/cache.h>
#include <linux/cpufeature.h>

#include <asm/sev-common.h>

struct sev_config sev_cfg __read_mostly;

static int __init init_sev_config(char *str)
{
	char *s;

	while ((s = strsep(&str, ","))) {
		if (!strcmp(s, "debug")) {
			sev_cfg.debug = true;
			continue;
		}

		if (!strcmp(s, "nosnp")) {
			if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) {
				setup_clear_cpu_cap(X86_FEATURE_SEV_SNP);
				cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
				continue;
			} else {
				goto warn;
			}
		}

warn:
		pr_info("SEV command-line option '%s' was not recognized\n", s);
	}

	return 1;
}
__setup("sev=", init_sev_config);