On 30.05.2025 15:18, Sergii Dmytruk wrote:
> --- a/xen/arch/x86/cpu/amd.c
> +++ b/xen/arch/x86/cpu/amd.c
> @@ -688,6 +688,21 @@ void amd_log_freq(const struct cpuinfo_x86 *c)
> #undef FREQ
> }
>
> +void amd_log_skinit(const struct cpuinfo_x86 *c)
> +{
> + /*
> + * Run only on BSP and not during resume to report the capability only
> once.
> + */
> + if ( system_state != SYS_STATE_resume && smp_processor_id() )
> + return;
Comment and code look to not fit together. DYM
if ( system_state == SYS_STATE_resume || smp_processor_id() )
return;
?
> @@ -633,6 +634,49 @@ static void init_intel_perf(struct cpuinfo_x86 *c)
> }
> }
>
> +/*
> + * Print out the SMX and TXT capabilties, so that dom0 can determine if the
> + * system is DRTM-capable.
> + */
> +static void intel_log_smx_txt(void)
> +{
> + unsigned long cr4_val, getsec_caps;
> +
> + /*
> + * Run only on BSP and not during resume to report the capability only
> once.
> + */
> + if ( system_state != SYS_STATE_resume && smp_processor_id() )
> + return;
Same here?
> + printk("CPU: SMX capability ");
> + if ( !test_bit(X86_FEATURE_SMX, &boot_cpu_data.x86_capability) )
> + {
> + printk("not supported\n");
> + return;
> + }
> + printk("supported\n");
> +
> + /* Can't run GETSEC without VMX and SMX */
> + if ( !test_bit(X86_FEATURE_VMX, &boot_cpu_data.x86_capability) )
> + return;
> +
> + cr4_val = read_cr4();
> + if ( !(cr4_val & X86_CR4_SMXE) )
> + write_cr4(cr4_val | X86_CR4_SMXE);
> +
> + asm volatile ("getsec\n"
> + : "=a" (getsec_caps)
> + : "a" (GETSEC_CAPABILITIES), "b" (0) :);
> +
> + if ( getsec_caps & GETSEC_CAP_TXT_CHIPSET )
> + printk("Chipset supports TXT\n");
> + else
> + printk("Chipset does not support TXT\n");
> +
> + if ( !(cr4_val & X86_CR4_SMXE) )
> + write_cr4(cr4_val & ~X86_CR4_SMXE);
Move this ahead of the printk()s?
Jan