On Fri, Apr 25, 2025, Ashish Kalra wrote: > On 4/23/2025 4:15 PM, Sean Christopherson wrote: > > > > > if (boot_cpu_has(X86_FEATURE_SEV_ES)) { > > if (snp_max_snp_asid >= (min_sev_asid - 1)) > > sev_es_supported = false; > > SEV-ES is disabled if SNP is using all ASIDs upto min_sev_asid - 1. > > > pr_info("SEV-ES %s (ASIDs %u - %u)\n", > > str_enabled_disabled(sev_es_supported), > > min_sev_asid > 1 ? snp_max_snp_asid ? snp_max_snp_asid + 1 : 1 : > > 0, min_sev_asid - 1); > > } > > > > A non-zero snp_max_snp_asid shouldn't break SEV-ES if CipherTextHiding isn't supported. > > I don't see above where SEV-ES is broken if snp_max_snp_asid is non-zero and > CTH is enabled ? Please read what I wrote. I did not say it's broken if CTH is enabled. I said it's broken if CTH isn't supported, i.e. is disabled. snp_max_snp_asid isn't sanitized if CTH is unsupported or disabled by userspace, and so KVM will compute the wrong min_sev_asid if snp_max_snp_asid is non-zero, even though snp_max_snp_asid has no bearing on reality. > >> + */ > >> + if (snp_cipher_text_hiding && sev->es_active) { > >> + if (vm_type == KVM_X86_SNP_VM) > >> + max_asid = snp_max_snp_asid; > >> + else > >> + min_asid = snp_max_snp_asid + 1; > >> + } > > > > Irrespective of the module params, I would much prefer to have a max_snp_asid > > param that is kept up-to-date regardless of whether or not CipherTextHiding is > > enabled. > > param ? Sorry, s/param/variable. Doesn't need to be user visible.