Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
46 lines
898 B
C
46 lines
898 B
C
// 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);
|