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

Paolo Bonzini
2021-01-13T17:04:01Z

On 13/01/21 17:16, Jason Baron wrote:
>>> +#define DEFINE_KVM_OPS_STATIC_CALL(func)    \
>>> +    DEFINE_STATIC_CALL_NULL(kvm_x86_##func,    \
>>> +                *(((struct kvm_x86_ops *)0)->func))
>>> +#define DEFINE_KVM_OPS_STATIC_CALLS() \
>>> +    FOREACH_KVM_X86_OPS(DEFINE_KVM_OPS_STATIC_CALL)
>> Something wrong here?
> Hmmm...not sure what you are getting at here.

I just misread define vs. declare.

> Or we could just use the KVM_X86_OP_NULL() macro for anything
> that doesn't have a 'svm' or 'vmx' prefix as I think you were
> suggesting?
>
> Using the KVM_X86_OP_NULL() for
> all definitions that don't use 'svm' and 'vmx', would mean
> manually defining all 20 in vmx and svm

Yes, that's the simplest thing to do. Then we clean them up as we
rename the functions. If you want, go ahead and rename the five easy
ones yourself.

Paolo

> .update_exception_bitmap = update_exception_bitmap,
> .enable_nmi_window = enable_nmi_window,
> .enable_irq_window = enable_irq_window,
> .update_cr8_intercept = update_cr8_intercept,
> .enable_smi_window = enable_smi_window,