[0/2] KVM: SVM: small tweaks for sev_hardware_setup

Message ID 20230404122652.275005-1-aleksandr.mikhalitsyn@canonical.com
Headers
Series KVM: SVM: small tweaks for sev_hardware_setup |

Message

Aleksandr Mikhalitsyn April 4, 2023, 12:26 p.m. UTC
  KVM: SVM: add some info prints to SEV init
    
Let's add a few pr_info's to sev_hardware_setup to make SEV/SEV-ES
enabling a little bit handier for users. Right now it's too hard
to guess why SEV/SEV-ES are failing to enable.

There are a few reasons.
SEV:
- npt is disabled (module parameter)
- CPU lacks some features (sev, decodeassists)
- Maximum SEV ASID is 0

SEV-ES:
- mmio_caching is disabled (module parameter)
- CPU lacks sev_es feature
- Minimum SEV ASID value is 1 (can be adjusted in BIOS/UEFI)

==
   
KVM: SVM: free sev_*asid_bitmap init if SEV init fails

If misc_cg_set_capacity() fails for some reason then we have
a memleak for sev_reclaim_asid_bitmap/sev_asid_bitmap. It's
not a case right now, because misc_cg_set_capacity() just can't
fail and check inside it is always successful.

But let's fix that for code consistency.

Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stéphane Graber <stgraber@ubuntu.com>
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>

Alexander Mikhalitsyn (2):
  KVM: SVM: free sev_*asid_bitmap init if SEV init fails
  KVM: SVM: add some info prints to SEV init

 arch/x86/kvm/svm/sev.c | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)
  

Comments

Sean Christopherson April 6, 2023, 3:32 a.m. UTC | #1
Please tag patches with RESEND when re-sending the exact patches with different
To/Cc fields.  Not a big deal, but I blinked a few times trying to figure out
if I really had two copies, or if it's just time for me to log off for the night :-)
  
Aleksandr Mikhalitsyn April 6, 2023, 7:07 a.m. UTC | #2
On Thu, Apr 6, 2023 at 5:32 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Please tag patches with RESEND when re-sending the exact patches with different
> To/Cc fields.  Not a big deal, but I blinked a few times trying to figure out
> if I really had two copies, or if it's just time for me to log off for the night :-)

Hi Sean,

yep, I'm sorry about that. First time I've sent patches without proper
CC's by mistake.

Kind regards,
Alex