On 16.08.2024 13:19, Sergiy Kibrik wrote:
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -919,7 +919,8 @@ static void cf_check svm_ctxt_switch_from(struct vcpu *v)
> * Possibly clear previous guest selection of SSBD if set. Note that
> * SPEC_CTRL.SSBD is already handled by svm_vmexit_spec_ctrl.
> */
> - if ( v->arch.msrs->virt_spec_ctrl.raw & SPEC_CTRL_SSBD )
> + if ( IS_ENABLED(CONFIG_AMD) &&
> + v->arch.msrs->virt_spec_ctrl.raw & SPEC_CTRL_SSBD )
> {
> ASSERT(v->domain->arch.cpuid->extd.virt_ssbd);
> amd_set_legacy_ssbd(false);
> @@ -953,7 +954,8 @@ static void cf_check svm_ctxt_switch_to(struct vcpu *v)
> wrmsr_tsc_aux(v->arch.msrs->tsc_aux);
>
> /* Load SSBD if set by the guest. */
> - if ( v->arch.msrs->virt_spec_ctrl.raw & SPEC_CTRL_SSBD )
> + if ( IS_ENABLED(CONFIG_AMD) &&
> + v->arch.msrs->virt_spec_ctrl.raw & SPEC_CTRL_SSBD )
> {
> ASSERT(v->domain->arch.cpuid->extd.virt_ssbd);
> amd_set_legacy_ssbd(true);
Instead of these changes, shouldn't AMD_SVM become dependent upon AMD in
Kconfig?
> +#ifdef CONFIG_AMD
> +extern bool amd_acpi_c1e_quirk;
> +extern bool amd_virt_spec_ctrl;
> +#else
> +
> +#define amd_acpi_c1e_quirk (false)
> +#define amd_virt_spec_ctrl (false)
As a remark, while there's nothing wrong with parenthesizing "false" here,
it also isn't really necessary. Omitting unnecessary parentheses generally
aids readability imo.
Jan