From: Sean Christopherson <seanjc@google.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>,
Maxim Levitsky <mlevitsk@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] KVM: nVMX: Rename vmcs_to_field_offset{,_table} to vmcs12_field_offset{,_table}
Date: Thu, 6 Jan 2022 23:36:43 +0000 [thread overview]
Message-ID: <Ydd9C7A56JtpSWnu@google.com> (raw)
In-Reply-To: <20211214143859.111602-4-vkuznets@redhat.com>
On Tue, Dec 14, 2021, Vitaly Kuznetsov wrote:
> vmcs_to_field_offset{,_table} may sound misleading as VMCS is an opaque
> blob which is not supposed to be accessed directly. In fact,
> vmcs_to_field_offset{,_table} are related to KVM defined VMCS12 structure.
>
> No functional change intended.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> diff --git a/arch/x86/kvm/vmx/vmcs12.h b/arch/x86/kvm/vmx/vmcs12.h
> index 2a45f026ee11..13e2bd017538 100644
> --- a/arch/x86/kvm/vmx/vmcs12.h
> +++ b/arch/x86/kvm/vmx/vmcs12.h
> @@ -361,10 +361,10 @@ static inline void vmx_check_vmcs12_offsets(void)
> CHECK_OFFSET(guest_pml_index, 996);
> }
>
> -extern const unsigned short vmcs_field_to_offset_table[];
> +extern const unsigned short vmcs12_field_offset_table[];
While we're tweaking names, what about dropping "table" and calling this
vmcs12_field_offsets?
> extern const unsigned int nr_vmcs12_fields;
>
> -static inline short vmcs_field_to_offset(unsigned long field)
> +static inline short vmcs12_field_offset(unsigned long field)
And get_vmcs12_field_offset() here to make it more obvious that it's translating
something to an offset, which is communicated by the "to" in the current name.
> {
> unsigned short offset;
> unsigned int index;
> @@ -377,7 +377,7 @@ static inline short vmcs_field_to_offset(unsigned long field)
> return -ENOENT;
>
> index = array_index_nospec(index, nr_vmcs12_fields);
> - offset = vmcs_field_to_offset_table[index];
> + offset = vmcs12_field_offset_table[index];
> if (offset == 0)
> return -ENOENT;
> return offset;
> --
> 2.33.1
>
next prev parent reply other threads:[~2022-01-06 23:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 14:38 [PATCH 0/5] KVM: nVMX: Fix Windows 11 + WSL2 + Enlightened VMCS Vitaly Kuznetsov
2021-12-14 14:38 ` [PATCH 1/5] KVM: nVMX: Also filter MSR_IA32_VMX_TRUE_PINBASED_CTLS when eVMCS Vitaly Kuznetsov
2021-12-14 14:38 ` [PATCH 2/5] KVM: nVMX: eVMCS: Filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER Vitaly Kuznetsov
2021-12-14 14:38 ` [PATCH 3/5] KVM: nVMX: Rename vmcs_to_field_offset{,_table} to vmcs12_field_offset{,_table} Vitaly Kuznetsov
2022-01-06 23:36 ` Sean Christopherson [this message]
2022-01-07 8:45 ` Vitaly Kuznetsov
2021-12-14 14:38 ` [PATCH 4/5] KVM: nVMX: Implement evmcs_field_offset() suitable for handle_vmread() Vitaly Kuznetsov
2021-12-14 14:38 ` [PATCH 5/5] KVM: nVMX: Allow VMREAD when Enlightened VMCS is in use Vitaly Kuznetsov
2022-01-07 0:03 ` Sean Christopherson
2022-01-07 8:49 ` Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ydd9C7A56JtpSWnu@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.