Re: [PATCH v19 019/130] KVM: x86: Add is_vm_type_supported callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 14, 2024 at 04:32:20PM +0800,
Chao Gao <chao.gao@xxxxxxxxx> wrote:

> >-static bool kvm_is_vm_type_supported(unsigned long type)
> >+bool __kvm_is_vm_type_supported(unsigned long type)
> > {
> > 	return type == KVM_X86_DEFAULT_VM ||
> > 	       (type == KVM_X86_SW_PROTECTED_VM &&
> > 		IS_ENABLED(CONFIG_KVM_SW_PROTECTED_VM) && tdp_enabled);
> 
> maybe just do:
> 	switch (type) {
> 	case KVM_X86_DEFAULT_VM:
> 		return true;
> 	case KVM_X86_SW_PROTECTED_VM:
> 		return IS_ENABLED(CONFIG_KVM_SW_PROTECTED_VM) && tdp_enabled;
> 	default:
> 		return static_call(kvm_x86_is_vm_type_supported)(type);
> 	}
> 
> There are two benefits
> 1) switch/case improves readability a little.
> 2) no need to expose __kvm_is_vm_type_supported()

The following[1] patch will supersede this patch. Will drop this patch.

[1] https://lore.kernel.org/kvm/20240226190344.787149-12-pbonzini@xxxxxxxxxx/
-- 
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux