Re: [PATCH 1/2] KVM: x86: introduce definitions to support static calls for kvm_x86_ops

Paolo Bonzini
2021-01-13T12:49:38Z

On 13/01/21 05:12, Jason Baron wrote:
>>
> Looking at the vmx definitions I see quite a few that don't
> match that naming. For example:
>
> hardware_unsetup,
> hardware_enable,
> hardware_disable,
> report_flexpriority,
> update_exception_bitmap,
> enable_nmi_window,
> enable_irq_window,
> update_cr8_intercept,
> pi_has_pending_interrupt,
> cpu_has_vmx_wbinvd_exit,
> pi_update_irte,
> kvm_complete_insn_gp,
>
> So I'm not sure if we want to extend these macros to
> vmx/svm.

Don't do it yourself, but once you introduce the new header it becomes a
no-brainer to switch the declarations to use it. So let's plan the new
header to make that switch easy.

Using trailing commas unconditionally would be okay, i.e.

#define X86_OP(func) .func = vmx_##func,
#include "kvm-x86-ops.h"

and leave out the terminator/delimiter in kvm-x86-ops.h. This is
similar to how we use vmx/vmcs_shadow_fields.h:

#define SHADOW_FIELD_RO(x, y) { x, offsetof(struct vmcs12, y) },
#include "vmcs_shadow_fields.h"

#define SHADOW_FIELD_RW(x, y) case x:
#include "vmcs_shadow_fields.h"

Thanks,

Paolo