guest_range_to_gpas(9)
π guest_range_to_gpas(9) β a Kernel API Manual moment
okay bestie, so we're in the guest_range_to_gpas(9) manpage, and honestly? this one's giving "s390 virtualization main character energy" and you're gonna slay it. β¨
πΈ NAME πΈ
guest_range_to_gpas β literally calculates the guest physical addresses of page fragments that cover a logical range. no cap, that's the whole gig. π
π¦ SYNOPSIS π¦
int guest_range_to_gpas (struct kvm_vcpu *vcpu , unsigned long ga , u8
ar , unsigned long *gpas , unsigned long len , const union asce asce ,
enum gacc_mode mode , u8 access_key );
like, yes, it's a long signature. it ate, honestly. π
β¨ ARGUMENTS β¨
vcpuβ the virtual cpu, our protagonist π«gaβ guest address, aka where the range startsarβ access register, periodtgpasβ output argument, and heads up: it may beNULLπlenβ length of the range, measured in bytesasceβ address-space-control element to use for translation (say that five times fast, i dare you)modeβ access mode, obviouslyaccess_keyβ access key to mach the range's storage keys against ποΈ (yes, "mach", that's what it says, i don't make the rules)
π₯ DESCRIPTION π₯
So basically: this bad boy translates a logical range into a series of guest absolute addresses, such that the concatenation of page fragments starting at each gpa make up the whole range. it's giving "assemble the range from page-fragment pieces" and honestly, iconic. π§©
The translation is performed as if done by the cpu for the given asce, ar, mode and state of the vcpu. so like, it's cosplaying the cpu's whole translation vibe. π
If the translation causes an exception, its program interruption code is returned and the struct kvm_s390_pgm_info pgm member of vcpu is modified such that a subsequent call to kvm_s390_inject_prog_vcpu will inject a correct exception into the guest. yes bestie, it sets up the exception for you. thoughtful. π«Ά
The resulting gpas are stored into gpas, unless it is NULL. simple as. π
π NOTE π
All fragments except the first one start at the beginning of a page. and when deriving the boundaries of a fragment from a gpa, all but the last fragment end at the end of the page. so like, first one's special, last one's special, the middle ones are just living their page-aligned truth. π
β RETURN β
0β success, we love to see it π<0β translation could not be performed, for example if guest memory could not be accessed π>0β an access exception occurred. in this case the returned value is the program interruption code and the contents ofpgmmay be used to inject an exception into the guest π
π SEE ALSO π
Kernel file ./arch/s390/kvm/s390/gaccess.c, plus these absolute legends:
guest_translate_gva(9)__cmpxchg_with_key(9)cmpxchg_guest_abs_with_key(9)guest_translate_address_with_key(9)check_gva_range(9)check_gpa_range(9)kvm_s390_check_low_addr_prot_real(9)walk_guest_tables(9)__gaccess_shadow_fault(9)
go read them, iykyk ππ
and that's the page, bestie!! π«Ά this little gem lives under ./arch/s390/kvm/s390 in the Kernel API Manual, and it's dated October 2026. so futuristic of it. π« now go forth and translate those ranges β you're gonna do amazing, fr fr. πΈππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms