Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: selftests: Use u16 instead of uint16_t

Use u16 instead of uint16_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint16_t/u16/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Link: https://patch.msgid.link/20260420212004.3938325-9-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

authored by

David Matlack and committed by
Sean Christopherson
19d09149 7b609187

+42 -42
+1 -1
tools/testing/selftests/kvm/arm64/page_fault_test.c
··· 148 148 */ 149 149 static void guest_dc_zva(void) 150 150 { 151 - uint16_t val; 151 + u16 val; 152 152 153 153 asm volatile("dc zva, %0" :: "r" (guest_test_memory)); 154 154 dsb(ish);
+1 -1
tools/testing/selftests/kvm/include/kvm_util.h
··· 216 216 u32 type; 217 217 uint8_t mode; 218 218 uint8_t pad0; 219 - uint16_t pad1; 219 + u16 pad1; 220 220 }; 221 221 222 222 kvm_static_assert(sizeof(struct vm_shape) == sizeof(u64));
+1 -1
tools/testing/selftests/kvm/include/x86/evmcs.h
··· 10 10 #include "hyperv.h" 11 11 #include "vmx.h" 12 12 13 - #define u16 uint16_t 13 + #define u16 u16 14 14 #define u32 u32 15 15 #define u64 u64 16 16
+29 -29
tools/testing/selftests/kvm/include/x86/processor.h
··· 399 399 }; 400 400 401 401 struct desc64 { 402 - uint16_t limit0; 403 - uint16_t base0; 402 + u16 limit0; 403 + u16 base0; 404 404 unsigned base1:8, type:4, s:1, dpl:2, p:1; 405 405 unsigned limit1:4, avl:1, l:1, db:1, g:1, base2:8; 406 406 u32 base3; ··· 408 408 } __attribute__((packed)); 409 409 410 410 struct desc_ptr { 411 - uint16_t size; 411 + u16 size; 412 412 u64 address; 413 413 } __attribute__((packed)); 414 414 ··· 476 476 } 477 477 478 478 479 - static inline uint16_t inw(uint16_t port) 479 + static inline u16 inw(u16 port) 480 480 { 481 - uint16_t tmp; 481 + u16 tmp; 482 482 483 483 __asm__ __volatile__("in %%dx, %%ax" 484 484 : /* output */ "=a" (tmp) ··· 487 487 return tmp; 488 488 } 489 489 490 - static inline uint16_t get_es(void) 490 + static inline u16 get_es(void) 491 491 { 492 - uint16_t es; 492 + u16 es; 493 493 494 494 __asm__ __volatile__("mov %%es, %[es]" 495 495 : /* output */ [es]"=rm"(es)); 496 496 return es; 497 497 } 498 498 499 - static inline uint16_t get_cs(void) 499 + static inline u16 get_cs(void) 500 500 { 501 - uint16_t cs; 501 + u16 cs; 502 502 503 503 __asm__ __volatile__("mov %%cs, %[cs]" 504 504 : /* output */ [cs]"=rm"(cs)); 505 505 return cs; 506 506 } 507 507 508 - static inline uint16_t get_ss(void) 508 + static inline u16 get_ss(void) 509 509 { 510 - uint16_t ss; 510 + u16 ss; 511 511 512 512 __asm__ __volatile__("mov %%ss, %[ss]" 513 513 : /* output */ [ss]"=rm"(ss)); 514 514 return ss; 515 515 } 516 516 517 - static inline uint16_t get_ds(void) 517 + static inline u16 get_ds(void) 518 518 { 519 - uint16_t ds; 519 + u16 ds; 520 520 521 521 __asm__ __volatile__("mov %%ds, %[ds]" 522 522 : /* output */ [ds]"=rm"(ds)); 523 523 return ds; 524 524 } 525 525 526 - static inline uint16_t get_fs(void) 526 + static inline u16 get_fs(void) 527 527 { 528 - uint16_t fs; 528 + u16 fs; 529 529 530 530 __asm__ __volatile__("mov %%fs, %[fs]" 531 531 : /* output */ [fs]"=rm"(fs)); 532 532 return fs; 533 533 } 534 534 535 - static inline uint16_t get_gs(void) 535 + static inline u16 get_gs(void) 536 536 { 537 - uint16_t gs; 537 + u16 gs; 538 538 539 539 __asm__ __volatile__("mov %%gs, %[gs]" 540 540 : /* output */ [gs]"=rm"(gs)); 541 541 return gs; 542 542 } 543 543 544 - static inline uint16_t get_tr(void) 544 + static inline u16 get_tr(void) 545 545 { 546 - uint16_t tr; 546 + u16 tr; 547 547 548 548 __asm__ __volatile__("str %[tr]" 549 549 : /* output */ [tr]"=rm"(tr)); ··· 651 651 return idt; 652 652 } 653 653 654 - static inline void outl(uint16_t port, u32 value) 654 + static inline void outl(u16 port, u32 value) 655 655 { 656 656 __asm__ __volatile__("outl %%eax, %%dx" : : "d"(port), "a"(value)); 657 657 } ··· 1194 1194 }; 1195 1195 1196 1196 struct idt_entry { 1197 - uint16_t offset0; 1198 - uint16_t selector; 1199 - uint16_t ist : 3; 1200 - uint16_t : 5; 1201 - uint16_t type : 4; 1202 - uint16_t : 1; 1203 - uint16_t dpl : 2; 1204 - uint16_t p : 1; 1205 - uint16_t offset1; 1197 + u16 offset0; 1198 + u16 selector; 1199 + u16 ist : 3; 1200 + u16 : 5; 1201 + u16 type : 4; 1202 + u16 : 1; 1203 + u16 dpl : 2; 1204 + u16 p : 1; 1205 + u16 offset1; 1206 1206 u32 offset2; u32 reserved; 1207 1207 }; 1208 1208
+1 -1
tools/testing/selftests/kvm/lib/guest_sprintf.c
··· 286 286 if (qualifier == 'l') 287 287 num = va_arg(args, u64); 288 288 else if (qualifier == 'h') { 289 - num = (uint16_t)va_arg(args, int); 289 + num = (u16)va_arg(args, int); 290 290 if (flags & SIGN) 291 291 num = (int16_t)num; 292 292 } else if (flags & SIGN)
+4 -4
tools/testing/selftests/kvm/lib/x86/processor.c
··· 424 424 "addr w exec dirty\n", 425 425 indent, ""); 426 426 pml4e_start = (u64 *)addr_gpa2hva(vm, mmu->pgd); 427 - for (uint16_t n1 = 0; n1 <= 0x1ffu; n1++) { 427 + for (u16 n1 = 0; n1 <= 0x1ffu; n1++) { 428 428 pml4e = &pml4e_start[n1]; 429 429 if (!is_present_pte(mmu, pml4e)) 430 430 continue; ··· 436 436 is_writable_pte(mmu, pml4e), is_nx_pte(mmu, pml4e)); 437 437 438 438 pdpe_start = addr_gpa2hva(vm, *pml4e & PHYSICAL_PAGE_MASK); 439 - for (uint16_t n2 = 0; n2 <= 0x1ffu; n2++) { 439 + for (u16 n2 = 0; n2 <= 0x1ffu; n2++) { 440 440 pdpe = &pdpe_start[n2]; 441 441 if (!is_present_pte(mmu, pdpe)) 442 442 continue; ··· 449 449 is_nx_pte(mmu, pdpe)); 450 450 451 451 pde_start = addr_gpa2hva(vm, *pdpe & PHYSICAL_PAGE_MASK); 452 - for (uint16_t n3 = 0; n3 <= 0x1ffu; n3++) { 452 + for (u16 n3 = 0; n3 <= 0x1ffu; n3++) { 453 453 pde = &pde_start[n3]; 454 454 if (!is_present_pte(mmu, pde)) 455 455 continue; ··· 461 461 is_nx_pte(mmu, pde)); 462 462 463 463 pte_start = addr_gpa2hva(vm, *pde & PHYSICAL_PAGE_MASK); 464 - for (uint16_t n4 = 0; n4 <= 0x1ffu; n4++) { 464 + for (u16 n4 = 0; n4 <= 0x1ffu; n4++) { 465 465 pte = &pte_start[n4]; 466 466 if (!is_present_pte(mmu, pte)) 467 467 continue;
+1 -1
tools/testing/selftests/kvm/lib/x86/ucall.c
··· 6 6 */ 7 7 #include "kvm_util.h" 8 8 9 - #define UCALL_PIO_PORT ((uint16_t)0x1000) 9 + #define UCALL_PIO_PORT ((u16)0x1000) 10 10 11 11 void ucall_arch_do_ucall(gva_t uc) 12 12 {
+1 -1
tools/testing/selftests/kvm/lib/x86/vmx.c
··· 27 27 28 28 int vcpu_enable_evmcs(struct kvm_vcpu *vcpu) 29 29 { 30 - uint16_t evmcs_ver; 30 + u16 evmcs_ver; 31 31 32 32 vcpu_enable_cap(vcpu, KVM_CAP_HYPERV_ENLIGHTENED_VMCS, 33 33 (unsigned long)&evmcs_ver);
+1 -1
tools/testing/selftests/kvm/s390/memop.c
··· 485 485 case 1: 486 486 return (uint8_t)val; 487 487 case 2: 488 - return (uint16_t)val; 488 + return (u16)val; 489 489 case 4: 490 490 return (u32)val; 491 491 case 8:
+1 -1
tools/testing/selftests/kvm/x86/fastops_test.c
··· 186 186 static void guest_code(void) 187 187 { 188 188 guest_test_fastops(uint8_t, "b"); 189 - guest_test_fastops(uint16_t, "w"); 189 + guest_test_fastops(u16, "w"); 190 190 guest_test_fastops(u32, "l"); 191 191 guest_test_fastops(u64, "q"); 192 192
+1 -1
tools/testing/selftests/kvm/x86/sync_regs_test.c
··· 20 20 #include "kvm_util.h" 21 21 #include "processor.h" 22 22 23 - #define UCALL_PIO_PORT ((uint16_t)0x1000) 23 + #define UCALL_PIO_PORT ((u16)0x1000) 24 24 25 25 struct ucall uc_none = { 26 26 .cmd = UCALL_NONE,