lkml.org 
[lkml]   [2026]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 04/16] KVM: VMX: Introduce unified instruction info structure
From
On 3/4/2026 8:21 PM, Sean Christopherson wrote:
>
> Absolutely not. I despise bit fields, as they're extremely difficult to review,
> don't help developers/debuggers understand the expected layout (finding flags and
> whatnot in .h files is almost always faster than searching the SDM), and they
> often generate suboptimal code.

Okay.

> I don't see any reason to do anything more complicated than:
>
> static inline u64 vmx_get_insn_info(void)
> {
> if (vmx_insn_info_extended())
> return vmcs_read64(EXTENDED_INSTRUCTION_INFO);
>
> return vmcs_read32(VMX_INSTRUCTION_INFO);
> }
>
> static inline int vmx_get_insn_info_reg(u64 insn_info)
> {
> return vmx_insn_info_extended() ? (insn_info >> ??) & 0x1f :
> (insn_info >> 3) & 0xf;
> }

There is

int get_vmx_mem_address(...)
{
...

/*
* According to Vol. 3B,...
*/
int scaling = vmx_instruction_info & 3;
int addr_size = (vmx_instruction_info >> 7) & 7;
bool is_reg = vmx_instruction_info & (1u << 10);
int seg_reg = (vmx_instruction_info >> 15) & 7;
int index_reg = (vmx_instruction_info >> 18) & 0xf;
bool index_is_valid = !(vmx_instruction_info & (1u << 22));
int base_reg = (vmx_instruction_info >> 23) & 0xf;
bool base_is_valid = !(vmx_instruction_info & (1u << 27));

I'd assume wrappers like above for each line there. But to confirm your
preference: would you rather keep this open-coded, or introduce another
wrappers for each?

\
 
 \ /
  Last update: 2026-03-07 02:36    [W:0.166 / U:0.115 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog