Messages in this thread Patch in this message |  | | Date | Tue, 10 Mar 2026 15:05:20 -0700 | | Subject | Re: [PATCH v2 01/16] KVM: x86: Rename register accessors to be GPR-specific | | From | "Chang S. Bae" <> |
| |
On 3/9/2026 6:23 PM, Sean Christopherson wrote: > > Oh, yikes, I didn't even see that this series is playing games with the register > indices. > > Whatever we do, the changelog asbolutely needs to call out the real motiviation.
Given the discussion here, it looks so apparent the changelog is missing that detail. I'll ensure something like what you wrote here to the revision.
> I'll try to come back to this tomorrow with more complete thoughts and hopefully
Sure, you call it. I know you have a lot on your plate, so I hope you feel free to take your time. Thanks!
> E.g. passing in VCPU_REGS_RIP to kvm_gpr_read() will compile just fine, but will > read the wrong register on APX capable hardware.
Right, so new semantics likely need to be established. As responded before, one option would be separate them in structure:
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index ff07c45e3c73..ff8a317be5cf 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -795,10 +795,14 @@ enum kvm_only_cpuid_leafs {
struct kvm_vcpu_arch { /* - * rip and regs accesses must go through - * kvm_{register,rip}_{read,write} functions. + * regs accesses must go through kvm_register_{read,write} + * functions. */ unsigned long regs[NR_VCPU_REGS]; + + /* rip accesses must go through kvm_rip_{read,write} */ + unsigned long rip; + u32 regs_avail; u32 regs_dirty;
|  |