kvm_s390_inject_prog_cond(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kvm_s390_inject_prog_cond(9) β€” the Kernel API Manual page your group chat needed

okay so bestie, welcome to the Kernel API Manual entry for kvm_s390_inject_prog_cond β€” a function name so long it's basically its own vibe πŸ’€ but don't run, it's actually lowkey adorable once you get what it does. It conditionally injects a program check, and "conditionally" is doing so much work in that sentence, iykyk.


✨ NAME ✨

kvm_s390_inject_prog_cond β€” conditionally inject a program check πŸŽ€

🌸 SYNOPSIS 🌸

int kvm_s390_inject_prog_cond (struct kvm_vcpu *vcpu , int rc );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • vcpu β€” the virtual cpu in question, the main character of this whole operation πŸ‘‘
  • rc β€” the original return/error code, i.e. the receipts from whatever just happened 🧾

πŸ’– DESCRIPTION πŸ’–

So here's the lore: this function is supposed to be used after regular guest access functions failed, and its whole job is to conditionally inject a program check to a vcpu. Not always β€” conditionally. That distinction is literally the entire point, bestie, don't skip it πŸ™ˆ

The typical pattern looks like this:

rc = write_guest(vcpu, addr, data, len); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc);

Now the part where you have to actually pay attention πŸ”₯ A negative return code from guest access functions implies an internal error, like e.g. out of memory. When that happens, no program check should be injected to the guest β€” hard no, do not pass go, do not inject. πŸ™…β€β™€οΈ

A positive value, on the other hand, implies that an exception happened while accessing a guest's memory. In that case, all the data belonging to the corresponding program check has already been stored in vcpu->arch.pgm, and it can be injected with kvm_s390_inject_prog_irq. See how it all connects? It's giving ecosystem 🫢

⭐ RETURN ⭐

  • the original rc value if rc was negative (internal error) 😭
  • zero if rc was already zero ✌️
  • zero or error code from injecting if rc was positive (program check injected to vcpu) πŸ’…

🌈 SEE ALSO 🌈

Kernel file ./arch/s390/kvm/s390/s390.h __kvm_s390_pv_destroy_page(9), kvm_s390_vcpu_crypto_reset_all(9), kvm_s390_vcpu_pci_enable_interp(9)

lowkey go read those too, they're in the same friend group fr fr πŸ“

and that's the whole page, bestie β€” no cap, you ate that 🧚 sign-off time: this lil masterpiece comes from the Kernel API Manual source at ./arch/s390/kvm/s390, dated October 2026. iconic. periodt. πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from