aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorGui Jianfeng <guijianfeng@cn.fujitsu.com>2010-03-15 05:29:09 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:15:51 -0400
commit31299944584fd62df8b0cfa30ad2c56f445b8cf2 (patch)
treef8808372d76a8398610f5d419233c84b9f7df887 /arch/x86/kvm/vmx.c
parent49c6799a2ce3a6a4dd66021dabeb468901c7a700 (diff)
KVM: VMX: change to use bool return values
Make use of bool as return values, and remove some useless bool value converting. Thanks Avi to point this out. Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 33d88e0a0601..87b3c6843aac 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -234,56 +234,56 @@ static const u32 vmx_msr_index[] = {
234}; 234};
235#define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index) 235#define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index)
236 236
237static inline int is_page_fault(u32 intr_info) 237static inline bool is_page_fault(u32 intr_info)
238{ 238{
239 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK | 239 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
240 INTR_INFO_VALID_MASK)) == 240 INTR_INFO_VALID_MASK)) ==
241 (INTR_TYPE_HARD_EXCEPTION | PF_VECTOR | INTR_INFO_VALID_MASK); 241 (INTR_TYPE_HARD_EXCEPTION | PF_VECTOR | INTR_INFO_VALID_MASK);
242} 242}
243 243
244static inline int is_no_device(u32 intr_info) 244static inline bool is_no_device(u32 intr_info)
245{ 245{
246 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK | 246 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
247 INTR_INFO_VALID_MASK)) == 247 INTR_INFO_VALID_MASK)) ==
248 (INTR_TYPE_HARD_EXCEPTION | NM_VECTOR | INTR_INFO_VALID_MASK); 248 (INTR_TYPE_HARD_EXCEPTION | NM_VECTOR | INTR_INFO_VALID_MASK);
249} 249}
250 250
251static inline int is_invalid_opcode(u32 intr_info) 251static inline bool is_invalid_opcode(u32 intr_info)
252{ 252{
253 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK | 253 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
254 INTR_INFO_VALID_MASK)) == 254 INTR_INFO_VALID_MASK)) ==
255 (INTR_TYPE_HARD_EXCEPTION | UD_VECTOR | INTR_INFO_VALID_MASK); 255 (INTR_TYPE_HARD_EXCEPTION | UD_VECTOR | INTR_INFO_VALID_MASK);
256} 256}
257 257
258static inline int is_external_interrupt(u32 intr_info) 258static inline bool is_external_interrupt(u32 intr_info)
259{ 259{
260 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK)) 260 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK))
261 == (INTR_TYPE_EXT_INTR | INTR_INFO_VALID_MASK); 261 == (INTR_TYPE_EXT_INTR | INTR_INFO_VALID_MASK);
262} 262}
263 263
264static inline int is_machine_check(u32 intr_info) 264static inline bool is_machine_check(u32 intr_info)
265{ 265{
266 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK | 266 return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
267 INTR_INFO_VALID_MASK)) == 267 INTR_INFO_VALID_MASK)) ==
268 (INTR_TYPE_HARD_EXCEPTION | MC_VECTOR | INTR_INFO_VALID_MASK); 268 (INTR_TYPE_HARD_EXCEPTION | MC_VECTOR | INTR_INFO_VALID_MASK);
269} 269}
270 270
271static inline int cpu_has_vmx_msr_bitmap(void) 271static inline bool cpu_has_vmx_msr_bitmap(void)
272{ 272{
273 return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_USE_MSR_BITMAPS; 273 return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_USE_MSR_BITMAPS;
274} 274}
275 275
276static inline int cpu_has_vmx_tpr_shadow(void) 276static inline bool cpu_has_vmx_tpr_shadow(void)
277{ 277{
278 return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_TPR_SHADOW; 278 return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_TPR_SHADOW;
279} 279}
280 280
281static inline int vm_need_tpr_shadow(struct kvm *kvm) 281static inline bool vm_need_tpr_shadow(struct kvm *kvm)
282{ 282{
283 return (cpu_has_vmx_tpr_shadow()) && (irqchip_in_kernel(kvm)); 283 return (cpu_has_vmx_tpr_shadow()) && (irqchip_in_kernel(kvm));
284} 284}
285 285
286static inline int cpu_has_secondary_exec_ctrls(void) 286static inline bool cpu_has_secondary_exec_ctrls(void)
287{ 287{
288 return vmcs_config.cpu_based_exec_ctrl & 288 return vmcs_config.cpu_based_exec_ctrl &
289 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; 289 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
@@ -303,80 +303,80 @@ static inline bool cpu_has_vmx_flexpriority(void)
303 303
304static inline bool cpu_has_vmx_ept_execute_only(void) 304static inline bool cpu_has_vmx_ept_execute_only(void)
305{ 305{
306 return !!(vmx_capability.ept & VMX_EPT_EXECUTE_ONLY_BIT); 306 return vmx_capability.ept & VMX_EPT_EXECUTE_ONLY_BIT;
307} 307}
308 308
309static inline bool cpu_has_vmx_eptp_uncacheable(void) 309static inline bool cpu_has_vmx_eptp_uncacheable(void)
310{ 310{
311 return !!(vmx_capability.ept & VMX_EPTP_UC_BIT); 311 return vmx_capability.ept & VMX_EPTP_UC_BIT;
312} 312}
313 313
314static inline bool cpu_has_vmx_eptp_writeback(void) 314static inline bool cpu_has_vmx_eptp_writeback(void)
315{ 315{
316 return !!(vmx_capability.ept & VMX_EPTP_WB_BIT); 316 return vmx_capability.ept & VMX_EPTP_WB_BIT;
317} 317}
318 318
319static inline bool cpu_has_vmx_ept_2m_page(void) 319static inline bool cpu_has_vmx_ept_2m_page(void)
320{ 320{
321 return !!(vmx_capability.ept & VMX_EPT_2MB_PAGE_BIT); 321 return vmx_capability.ept & VMX_EPT_2MB_PAGE_BIT;
322} 322}
323 323
324static inline bool cpu_has_vmx_ept_1g_page(void) 324static inline bool cpu_has_vmx_ept_1g_page(void)
325{ 325{
326 return !!(vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT); 326 return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT;
327} 327}
328 328
329static inline int cpu_has_vmx_invept_individual_addr(void) 329static inline bool cpu_has_vmx_invept_individual_addr(void)
330{ 330{
331 return !!(vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT); 331 return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT;
332} 332}
333 333
334static inline int cpu_has_vmx_invept_context(void) 334static inline bool cpu_has_vmx_invept_context(void)
335{ 335{
336 return !!(vmx_capability.ept & VMX_EPT_EXTENT_CONTEXT_BIT); 336 return vmx_capability.ept & VMX_EPT_EXTENT_CONTEXT_BIT;
337} 337}
338 338
339static inline int cpu_has_vmx_invept_global(void) 339static inline bool cpu_has_vmx_invept_global(void)
340{ 340{
341 return !!(vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT); 341 return vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT;
342} 342}
343 343
344static inline int cpu_has_vmx_ept(void) 344static inline bool cpu_has_vmx_ept(void)
345{ 345{
346 return vmcs_config.cpu_based_2nd_exec_ctrl & 346 return vmcs_config.cpu_based_2nd_exec_ctrl &
347 SECONDARY_EXEC_ENABLE_EPT; 347 SECONDARY_EXEC_ENABLE_EPT;
348} 348}
349 349
350static inline int cpu_has_vmx_unrestricted_guest(void) 350static inline bool cpu_has_vmx_unrestricted_guest(void)
351{ 351{
352 return vmcs_config.cpu_based_2nd_exec_ctrl & 352 return vmcs_config.cpu_based_2nd_exec_ctrl &
353 SECONDARY_EXEC_UNRESTRICTED_GUEST; 353 SECONDARY_EXEC_UNRESTRICTED_GUEST;
354} 354}
355 355
356static inline int cpu_has_vmx_ple(void) 356static inline bool cpu_has_vmx_ple(void)
357{ 357{
358 return vmcs_config.cpu_based_2nd_exec_ctrl & 358 return vmcs_config.cpu_based_2nd_exec_ctrl &
359 SECONDARY_EXEC_PAUSE_LOOP_EXITING; 359 SECONDARY_EXEC_PAUSE_LOOP_EXITING;
360} 360}
361 361
362static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm) 362static inline bool vm_need_virtualize_apic_accesses(struct kvm *kvm)
363{ 363{
364 return flexpriority_enabled && irqchip_in_kernel(kvm); 364 return flexpriority_enabled && irqchip_in_kernel(kvm);
365} 365}
366 366
367static inline int cpu_has_vmx_vpid(void) 367static inline bool cpu_has_vmx_vpid(void)
368{ 368{
369 return vmcs_config.cpu_based_2nd_exec_ctrl & 369 return vmcs_config.cpu_based_2nd_exec_ctrl &
370 SECONDARY_EXEC_ENABLE_VPID; 370 SECONDARY_EXEC_ENABLE_VPID;
371} 371}
372 372
373static inline int cpu_has_vmx_rdtscp(void) 373static inline bool cpu_has_vmx_rdtscp(void)
374{ 374{
375 return vmcs_config.cpu_based_2nd_exec_ctrl & 375 return vmcs_config.cpu_based_2nd_exec_ctrl &
376 SECONDARY_EXEC_RDTSCP; 376 SECONDARY_EXEC_RDTSCP;
377} 377}
378 378
379static inline int cpu_has_virtual_nmis(void) 379static inline bool cpu_has_virtual_nmis(void)
380{ 380{
381 return vmcs_config.pin_based_exec_ctrl & PIN_BASED_VIRTUAL_NMIS; 381 return vmcs_config.pin_based_exec_ctrl & PIN_BASED_VIRTUAL_NMIS;
382} 382}