diff options
author | Gui Jianfeng <guijianfeng@cn.fujitsu.com> | 2010-03-15 05:29:09 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:15:51 -0400 |
commit | 31299944584fd62df8b0cfa30ad2c56f445b8cf2 (patch) | |
tree | f8808372d76a8398610f5d419233c84b9f7df887 /arch/x86/kvm/vmx.c | |
parent | 49c6799a2ce3a6a4dd66021dabeb468901c7a700 (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.c | 54 |
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 | ||
237 | static inline int is_page_fault(u32 intr_info) | 237 | static 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 | ||
244 | static inline int is_no_device(u32 intr_info) | 244 | static 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 | ||
251 | static inline int is_invalid_opcode(u32 intr_info) | 251 | static 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 | ||
258 | static inline int is_external_interrupt(u32 intr_info) | 258 | static 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 | ||
264 | static inline int is_machine_check(u32 intr_info) | 264 | static 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 | ||
271 | static inline int cpu_has_vmx_msr_bitmap(void) | 271 | static 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 | ||
276 | static inline int cpu_has_vmx_tpr_shadow(void) | 276 | static 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 | ||
281 | static inline int vm_need_tpr_shadow(struct kvm *kvm) | 281 | static 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 | ||
286 | static inline int cpu_has_secondary_exec_ctrls(void) | 286 | static 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 | ||
304 | static inline bool cpu_has_vmx_ept_execute_only(void) | 304 | static 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 | ||
309 | static inline bool cpu_has_vmx_eptp_uncacheable(void) | 309 | static 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 | ||
314 | static inline bool cpu_has_vmx_eptp_writeback(void) | 314 | static 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 | ||
319 | static inline bool cpu_has_vmx_ept_2m_page(void) | 319 | static 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 | ||
324 | static inline bool cpu_has_vmx_ept_1g_page(void) | 324 | static 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 | ||
329 | static inline int cpu_has_vmx_invept_individual_addr(void) | 329 | static 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 | ||
334 | static inline int cpu_has_vmx_invept_context(void) | 334 | static 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 | ||
339 | static inline int cpu_has_vmx_invept_global(void) | 339 | static 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 | ||
344 | static inline int cpu_has_vmx_ept(void) | 344 | static 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 | ||
350 | static inline int cpu_has_vmx_unrestricted_guest(void) | 350 | static 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 | ||
356 | static inline int cpu_has_vmx_ple(void) | 356 | static 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 | ||
362 | static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm) | 362 | static 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 | ||
367 | static inline int cpu_has_vmx_vpid(void) | 367 | static 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 | ||
373 | static inline int cpu_has_vmx_rdtscp(void) | 373 | static 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 | ||
379 | static inline int cpu_has_virtual_nmis(void) | 379 | static 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 | } |