kvm_s390_pv_set_aside(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kvm_s390_pv_set_aside β€” bestie's guide to parking a protected VM

okay so this is kvm_s390_pv_set_aside(9) from the Kernel API Manual, and honestly it's one of those little functions that does so much heavy lifting. Let's get into it 🫢


🌸 NAME 🌸

kvm_s390_pv_set_aside β€” literally just sets aside a protected VM so you can tear it down later. That's the whole vibe check. ✨


πŸŽ€ SYNOPSIS πŸŽ€

int kvm_s390_pv_set_aside (struct kvm *kvm , u16 *rc , u16 *rrc );

like, copy that exactly, don't @ me πŸ™ˆ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • kvm β€” the VM. the main character, if you will πŸ‘‘
  • rc β€” the return value for the RC field of the UVCB. very demure, very mindful, just holding that value for you πŸ’…
  • rrc β€” the return value for the RRC field of the UVCB. same energy, different field πŸ“

πŸ’– DESCRIPTION πŸ’–

so what this does is set aside the protected VM for a subsequent teardown β€” like putting it on hold, no cap. Best part? The VM is able to continue immediately as a non-secure VM. iconic behaviour honestly 😭 And the info you need to properly tear down the protected VM? all set aside, neatly, for later. so organized.

but here's the catch bestie: if another protected VM was already set aside and nobody started its teardown yet, this function will fail. it's giving one-at-a-time, no shortcuts. ⚠️

also, real talk β€” the CPUs of the protected VM need to be destroyed beforehand. like, before you call this. don't skip that step, fr fr πŸ’€


πŸ”₯ CONTEXT πŸ”₯

kvm->lock needs to be held. yes, you actually have to hold the lock. this is not a drill 🫠


⭐ RETURN ⭐

  • 0 β€” slay, it worked. success πŸŽ‰
  • -EINVAL β€” nope, another protected VM was already set aside πŸ™ˆ
  • -ENOMEM β€” the system ran out of memory. budget said no 😭

🌈 SEE ALSO 🌈

the whole friend group, honestly 🧚 go read them too, iykyk πŸ¦‹


tl;dr: hold kvm->lock, destroy the CPUs first, and remember only one protected VM can be set aside at a time. the way that this function has RULES. πŸ’…

and that's the page bestie! πŸŽ€ this one comes from ./arch/s390/kvm/s390, dated October 2026 β€” go off, s390 kernel devs, you absolute legends πŸ‘‘βœ¨

πŸ“¦ where this page comes from