handle_pqap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… handle_pqap β€” the PQAP instruction callback πŸŽ€

okay so bestie, this is handle_pqap, straight out of the Kernel API Manual, and it's literally the function that catches a PQAP instruction and decides whether KVM is gonna deal with it or hand it off to QEMU. it's giving gatekeeper energy, and honestly? iconic. ✨


🌸 SYNOPSIS 🌸

int handle_pqap (struct kvm_vcpu *vcpu );

like, that's the whole signature. yes the space before the ) is real, don't come for me, I'm just the messenger 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • vcpu β€” the vcpu that we received the PQAP instruction on. that's the one, that's the main character πŸ‘‘

✨ DESCRIPTION ✨

first thing we do is grab the general register contents so we can initialize the internal variables. the registers are laid out like this, no cap:

  • REG[0]: APQN
  • REG[1]: IR and ISC
  • REG[2]: NIB

then, Response.status may be set to one of these Response Codes:

  • AP_RESPONSE_Q_NOT_AVAIL β€” if the queue is not available πŸ™ˆ
  • AP_RESPONSE_DECONFIGURED β€” if the queue is not configured 😭
  • AP_RESPONSE_NORMAL (0) β€” in case of success πŸ’–
heads up: check vfio_ap_setirq and vfio_ap_clrirq for other possible RC. and yeah, we take the matrix_dev lock to ensure serialization on queues and mediated device access β€” it's the vibe check that keeps everything from falling apart fr fr πŸ”₯

🌈 RETURN 🌈

  • 0 β€” if we could handle the request inside KVM. slay, done in-house πŸ’…
  • -EOPNOTSUPP β€” otherwise, returned so that QEMU can handle the fault. not our problem anymore, passed off with love 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file itself, for the brave: ./drivers/s390/crypto/vfio_ap_ops.c

and like, the entire extended universe of friends, in the order they appear:


and that's the page, bestie 🧚 this little gem lives in the ./drivers/s390/crypto section of the Kernel API Manual and it's dated October 2026 β€” mark your calendars, screenshot it, send it to the group chat πŸ’œ

πŸ“¦ where this page comes from