From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98AB22FD695 for ; Thu, 12 Mar 2026 19:57:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773345460; cv=none; b=FgnIRX9Qq8RRzBiKp1biVXf9P78FoiXEKrMpD8E1ZCejsEH4ib46wOr1PYsi/ZHYUNmvW8aECQj44be/CzBq7yyO6UlnIgUZnfMUpTNremsee53nckqfd/x2qdd8TeavBRHzwK7IZQoUe17U8xlPBPUAkVSCAyDUy7cZciosDcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773345460; c=relaxed/simple; bh=Zjn60P3a0MCfpYmnVXPwkjc1nebYDYCx2P+hOpnFyjI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qD5AzoeMVt+EgJseuzQ4JaFmDDe2ZUTvX0oU83aQ7Uluu901tGVP9X9zf88x2HBUhVsLHnna5/ANQvhH6cHNtEy48OT01gAz3BMnuZHc16VbQNVOSpsmS9Iv8srZmYpqAHbF5XXQOQ0FvQqyck2qy06YKlTFeXAdd8KSVT9Ao00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=0Vdwkhvl; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0Vdwkhvl" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c7385a1476aso792311a12.2 for ; Thu, 12 Mar 2026 12:57:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1773345458; x=1773950258; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8vBcIi+K8mVx0/9gUKAput/MKyloCRnekYK1lqbAehg=; b=0Vdwkhvl7hDD8k8xnDdErblUj7xH5+sn+oS5Fpt5XHHa2/u3XzSykXSf360d0AtF42 ydih+VYcuimkUGIuvpM2rrbTyRTbfZ+q4D7lLYVKV0f3IJ9WgeA+JGjBCBE+CFu4vHEq siht/0ZFtMKFmARiC0mIH622HNIWWquIVQi1/OozhXFOMDODsdK17LKW9WYnNPzIpc1W hFWLtBJWRmOkohezLwCvTsb9jEmY0wkgHTAH1QJLJ/IoIkvqEvQ7PaKflzOjY9hzm7vZ ObNlS8sJOuskzxgOl0mKroW9apBPVUqC0Cxo+XPua76U4F3YYogXsATcZH4T/79FWR6G Q0vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773345458; x=1773950258; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8vBcIi+K8mVx0/9gUKAput/MKyloCRnekYK1lqbAehg=; b=KaeHlanpFDeUQN1Azwj6s07eRtue5f9MWSbgkKylFyKddgUWPLYtGB25AJIdjEoA4e AimWFQjSB0fj1crDEi6XYdlqt2YoSuTv8UTPK9W5U0v8i/40uBRQ+dyvNfzUZWxnv5tm X0sY/i69j4Oezommh7D7rikrHuWg7tZAH6Nwe1e1+wyJiSnQ65UWPXpubz/7HmxQkUoY GTNBtY1MmtYDjgOERDJIfB5JUR+ixDKMsi2SwIwjLsoqqaiG+Bt3rf7vmuCdSJk5HOsP EHGPPfQT1TdJSyRGcVTXRk9cR1fspVLdzcOWBmNDDlWjMloa3O+SFH1a45VMZPqUIe0n GoFg== X-Forwarded-Encrypted: i=1; AJvYcCXMrjSgO/bkGt1FzE27Ov6Q+o8F/Zvhy/SHDUi5wQqNQ1wbfOsbjE7+jiYTGDuOOR/0FOfETKogidDb/+g=@vger.kernel.org X-Gm-Message-State: AOJu0YzAxaQqxXSkiS0QwJE7Zyx3KuKpXQfg5GBsTD4VeDOAvhrM9X/D iXC8tsOqwTswMsEBay+6dYX/Zfd8XlSxAlRxGMuQNzt8hvQTgbYFaxaptdE7Qw4ts1wkhb6UwHG pj10EdQ== X-Received: from pfch18.prod.google.com ([2002:a05:6a00:1712:b0:829:9a65:4170]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:2e99:b0:827:2ee0:411f with SMTP id d2e1a72fcca58-82a196f6386mr650133b3a.4.1773345457771; Thu, 12 Mar 2026 12:57:37 -0700 (PDT) Date: Thu, 12 Mar 2026 12:57:36 -0700 In-Reply-To: <20260303191509.1565629-5-tycho@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260303191509.1565629-1-tycho@kernel.org> <20260303191509.1565629-5-tycho@kernel.org> Message-ID: Subject: Re: [PATCH 4/5] kvm/sev: mask off firmware unsupported vm types From: Sean Christopherson To: Tycho Andersen Cc: Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Ashish Kalra , Tom Lendacky , John Allen , Herbert Xu , "David S. Miller" , Shuah Khan , Kim Phillips , Alexey Kardashevskiy , Nikunj A Dadhania , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="us-ascii" KVM: SEV: On Tue, Mar 03, 2026, Tycho Andersen wrote: > From: "Tycho Andersen (AMD)" > > In some configurations not all VM types are supported by the firmware. > Reflect this information in the supported_vm_types that KVM exports. > > Link: https://lore.kernel.org/all/aZyLIWtffvEnmtYh@google.com/ > Suggested-by: Sean Christopherson > Signed-off-by: Tycho Andersen (AMD) > --- > arch/x86/kvm/svm/sev.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > index f941d48626d3..eeae39af63a9 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -2976,6 +2976,8 @@ void __init sev_set_cpu_caps(void) > supported_vm_types |= BIT(KVM_X86_SNP_VM); > } > > + supported_vm_types &= sev_firmware_supported_vm_types(); > + > kvm_caps.supported_vm_types |= supported_vm_types; To save one whole line (two, counting whitespace!), and to guard against future changes, I vote for: kvm_caps.supported_vm_types |= supported_vm_types & sev_firmware_supported_vm_types(); or if parentheses would make it clearer: kvm_caps.supported_vm_types |= (supported_vm_types & sev_firmware_supported_vm_types()); I spent a silly amount of time fiddling with the code to try and avoid the local variable, and failed.