Switch the order of the parameters in report() and report_xfail()
Subsystems (3)
PATCH v2 1/1 Switch the order of the parameters in report() and report_xfail()
Commit c09c54c66b1df ("lib: use an argument which doesn't require default argument promotion") fixed a warning that occurs with Clang, but introduced a regression: If the "pass" parameter is a value which has only set the condition bits in the upper 32 bits of a 64 bit value, the condition is now false since the value is truncated to "unsigned int" so that the upper bits are simply discarded.
We fixed it by reverting the commit, but that of course also means trouble with Clang again. We can not use "bool" if it is the last parameter before the variable argument list. The proper fix is to swap the parameters around and make the format string the last parameter.
This patch (except the changes in lib/libcflat.h and lib/report.c and some rebase conflicts along the way) has basically been created with following coccinelle script (with some additional manual tweaking of long and disabled lines afterwards):
@@
expression fmt;
expression pass;
expression list args;
@@
report(
-fmt, pass
+pass, fmt
, args);
@@
expression fmt;
expression pass;
expression list args;
@@
report_xfail(
-fmt, xfail, pass
+xfail, pass, fmt
, args);
---
v2: Rebase the patch to the current master branch
arm/cache.c | 2 +- arm/gic.c | 52 ++-- arm/pci-test.c | 4 +- arm/pl031.c | 24 +- arm/pmu.c | 9 +- arm/psci.c | 10 +- arm/selftest.c | 16 +- arm/spinlock-test.c | 2 +- arm/timer.c | 16 +- lib/libcflat.h | 8 +- lib/report.c | 8 +- lib/s390x/interrupt.c | 5 +- lib/x86/fault_test.c | 2 +- powerpc/emulator.c | 44 +-- powerpc/rtas.c | 32 +- powerpc/selftest.c | 4 +- powerpc/spapr_hcall.c | 30 +- powerpc/sprs.c | 5 +- powerpc/tm.c | 6 +- s390x/cpumodel.c | 2 +- s390x/diag288.c | 2 +- s390x/diag308.c | 4 +- s390x/emulator.c | 18 +- s390x/gs.c | 2 +- s390x/intercept.c | 16 +- s390x/pfmf.c | 9 +- s390x/selftest.c | 23 +- s390x/skey.c | 11 +- s390x/skrf.c | 10 +- s390x/smp.c | 37 +-- s390x/sthyi.c | 41 +-- s390x/stsi.c | 8 +- s390x/vector.c | 6 +- x86/apic.c | 148 ++++----- x86/asyncpf.c | 11 +- x86/cmpxchg8b.c | 2 +- x86/debug.c | 69 +++-- x86/emulator.c | 290 +++++++++--------- x86/eventinj.c | 30 +- x86/hypercall.c | 6 +- x86/hyperv_clock.c | 9 +- x86/hyperv_connections.c | 28 +- x86/hyperv_stimer.c | 28 +- x86/hyperv_synic.c | 4 +- x86/idt_test.c | 8 +- x86/intel-iommu.c | 25 +- x86/ioapic.c | 61 ++-- x86/memory.c | 17 +- x86/msr.c | 2 +- x86/pcid.c | 10 +- x86/pku.c | 20 +- x86/pmu.c | 25 +- x86/rdpru.c | 2 +- x86/smap.c | 28 +- x86/smptest.c | 2 +- x86/svm.c | 24 +- x86/syscall.c | 4 +- x86/taskswitch2.c | 26 +- x86/tsc.c | 4 +- x86/tsc_adjust.c | 22 +- x86/tscdeadline_latency.c | 2 +- x86/tsx-ctrl.c | 14 +- x86/umip.c | 24 +- x86/vmx.c | 167 +++++----- x86/vmx.h | 9 +- x86/vmx_tests.c | 626 ++++++++++++++++++++------------------ x86/xsave.c | 80 ++--- 67 files changed, 1186 insertions(+), 1109 deletions(-)
arm/cache.c +1 -1
@@ -88,7 +88,7 @@ static void check_code_generation(bool dcache_clean, bool icache_inval) success &= (ret ==0x66 ); } -report ("code generation" , success); +report (success,"code generation" ); }int main (int argc,char **argv)
arm/gic.c +26 -26
128 lines not on this page · raw message
arm/pci-test.c +2 -2
@@ -27,8 +27,8 @@ int main(void)if (ret ==-1 )report_skip ("No PCI test device" );else -report ("PCI test device passed %d/%d tests" , - ret >=NR_TESTS , ret >0 ? ret :0 ,NR_TESTS ); +report (ret >=NR_TESTS ,"PCI test device passed %d/%d tests" , + ret >0 ? ret :0 ,NR_TESTS );return report_summary (); }
arm/pl031.c +12 -12
@@ -140,14 +140,14 @@ static void irq_handler(struct pt_regs *regs)gic_write_eoir (irqstat);if (irqnr == pl031_irq) { -report (" RTC RIS == 1" ,readl (&pl031->ris) ==1 ); -report (" RTC MIS == 1" ,readl (&pl031->mis) ==1 ); +report (readl (&pl031->ris) ==1 ," RTC RIS == 1" ); +report (readl (&pl031->mis) ==1 ," RTC MIS == 1" );/* Writing any value should clear IRQ status */ writel (0x80000000ULL , &pl031->icr); -report (" RTC RIS == 0" ,readl (&pl031->ris) ==0 ); -report (" RTC MIS == 0" ,readl (&pl031->mis) ==0 ); +report (readl (&pl031->ris) ==0 ," RTC RIS == 0" ); +report (readl (&pl031->mis) ==0 ," RTC MIS == 0" ); irq_triggered = true; }else {report_info ("Unexpected interrupt: %d\n" , irqnr);
@@ -178,18 +178,18 @@ static int check_rtc_irq(void)/* Wait until 2 seconds are over */ while (get_cntvct () < target_tick) ; -report (" RTC IRQ not delivered without mask" , !gic_irq_pending ()); +report (!gic_irq_pending ()," RTC IRQ not delivered without mask" );/* Mask the IRQ so that it gets delivered */ writel (1 , &pl031->imsc); -report (" RTC IRQ pending now" ,gic_irq_pending ()); +report (gic_irq_pending ()," RTC IRQ pending now" );/* Enable retrieval of IRQ */ gic_irq_unmask ();local_irq_enable (); -report (" IRQ triggered" , irq_triggered); -report (" RTC IRQ not pending anymore" , !gic_irq_pending ()); +report (irq_triggered," IRQ triggered" ); +report (!gic_irq_pending ()," RTC IRQ not pending anymore" );if (!irq_triggered) {report_info (" RTC RIS: %x" ,readl (&pl031->ris));report_info (" RTC MIS: %x" ,readl (&pl031->mis));
@@ -252,10 +252,10 @@ int main(int argc, char **argv)return 0 ; } -report ("Periph/PCell IDs match" , !check_id ()); -report ("R/O fields are R/O" , !check_ro ()); -report ("RTC ticks at 1HZ" , !check_rtc_freq ()); -report ("RTC IRQ not pending yet" , !gic_irq_pending ()); +report (!check_id (),"Periph/PCell IDs match" ); +report (!check_ro (),"R/O fields are R/O" ); +report (!check_rtc_freq (),"RTC ticks at 1HZ" ); +report (!gic_irq_pending (),"RTC IRQ not pending yet" );check_rtc_irq ();return report_summary ();
arm/pmu.c +5 -4
@@ -268,7 +268,7 @@ static void pmccntr64_test(void)if (pmu_version ==0x3 ) {if (ERRATA (9e3f7a296940 )) {write_sysreg (0xdead ,PMCCNTR64 ); -report ("pmccntr64" ,read_sysreg (PMCCNTR64 ) ==0xdead ); +report (read_sysreg (PMCCNTR64 ) ==0xdead ,"pmccntr64" ); }else report_skip ("Skipping unsafe pmccntr64 test. Set ERRATA_9e3f7a296940=y to enable." ); }
@@ -297,9 +297,10 @@ int main(int argc, char *argv[])report_prefix_push ("pmu" ); -report ("Control register" ,check_pmcr ()); -report ("Monotonically increasing cycle count" ,check_cycles_increase ()); -report ("Cycle/instruction ratio" ,check_cpi (cpi)); +report (check_pmcr (),"Control register" ); +report (check_cycles_increase (), +"Monotonically increasing cycle count" ); +report (check_cpi (cpi),"Cycle/instruction ratio" );pmccntr64_test ();
arm/psci.c +5 -5
@@ -135,12 +135,12 @@ int main(void)report_info ("PSCI version %d.%d" ,PSCI_VERSION_MAJOR (ver),PSCI_VERSION_MINOR (ver)); -report ("invalid-function" ,psci_invalid_function ()); -report ("affinity-info-on" ,psci_affinity_info_on ()); -report ("affinity-info-off" ,psci_affinity_info_off ()); +report (psci_invalid_function (),"invalid-function" ); +report (psci_affinity_info_on (),"affinity-info-on" ); +report (psci_affinity_info_off (),"affinity-info-off" ); if (ERRATA(6c7a5dce22b3)) -report ("cpu-on" ,psci_cpu_on_test ()); +report (psci_cpu_on_test (),"cpu-on" );else report_skip ("Skipping unsafe cpu-on test. Set ERRATA_6c7a5dce22b3=y to enable." );
@@ -148,7 +148,7 @@ done:#if 0 report_summary ();psci_invoke (PSCI_0_2_FN_SYSTEM_OFF ,0 ,0 ,0 ); -report ("system-off" , false); +report (false,"system-off" );return 1 ;/* only reaches here if system-off fails */ #else return report_summary ();
arm/selftest.c +8 -8
@@ -45,15 +45,15 @@ static void check_setup(int argc, char **argv)phys_addr_t memsize =PHYS_END -PHYS_OFFSET ;phys_addr_t expected = ((phys_addr_t )val)*1024 *1024 ; -report ("memory size matches expectation" , - memsize == expected); +report (memsize == expected, +"memory size matches expectation" );report_info ("found %" PRIu64" MB" , memsize/1024 /1024 ); ++nr_tests; }else if (strcmp (argv[i],"smp" ) ==0 ) { -report ("number of CPUs matches expectation" , - nr_cpus == (int )val); +report (nr_cpus == (int )val, +"number of CPUs matches expectation" );report_info ("found %d CPUs" , nr_cpus); ++nr_tests; }
@@ -296,8 +296,8 @@ static void user_psci_system_off(struct pt_regs *regs, unsigned int esr) static void check_vectors(void *arg __unused) { -report ("und" ,check_und ()); -report ("svc" ,check_svc ()); +report (check_und (),"und" ); +report (check_svc (),"svc" );if (is_user ()) {#ifdef __arm__install_exception_handler (EXCPTN_UND , user_psci_system_off);
@@ -374,12 +374,12 @@ int main(int argc, char **argv) }else if (strcmp (argv[1 ],"smp" ) ==0 ) { -report ("PSCI version" ,psci_check ()); +report (psci_check (),"PSCI version" );on_cpus (cpu_report,NULL );while (!cpumask_full (&ready))cpu_relax ();smp_rmb ();/* Paired with wmb in cpu_report(). */ -report ("MPIDR test on all CPUs" ,cpumask_full (&valid)); +report (cpumask_full (&valid),"MPIDR test on all CPUs" );report_info ("%d CPUs reported back" , nr_cpus); }else {
arm/spinlock-test.c +1 -1
@@ -67,7 +67,7 @@ static void test_spinlock(void *data __unused) lock_ops.unlock (&global_lock); } -report ("CPU%d: Done - Errors: %d" , errors ==0 , cpu, errors); +report (errors ==0 ,"CPU%d: Done - Errors: %d" , cpu, errors); }int main (int argc,char **argv)
arm/timer.c +8 -8
@@ -222,19 +222,19 @@ static void test_timer(struct timer_info *info) info->write_cval (later); info->write_ctl (ARCH_TIMER_CTL_ENABLE );isb (); -report ("not pending before" , !gic_timer_pending (info)); +report (!gic_timer_pending (info),"not pending before" ); info->write_cval (now -1 );isb (); -report ("interrupt signal pending" ,gic_timer_pending (info)); +report (gic_timer_pending (info),"interrupt signal pending" );/* Disable the timer again and prepare to take interrupts */ info->write_ctl (0 );set_timer_irq_enabled (info, true); -report ("interrupt signal no longer pending" , !gic_timer_pending (info)); +report (!gic_timer_pending (info),"interrupt signal no longer pending" ); -report ("latency within 10 ms" ,test_cval_10msec (info)); -report ("interrupt received" , info->irq_received); +report (test_cval_10msec (info),"latency within 10 ms" ); +report (info->irq_received,"interrupt received" );/* Disable the timer again */ info->write_ctl (0 );
@@ -248,8 +248,8 @@ static void test_timer(struct timer_info *info)wfi ();local_irq_enable (); left = info->read_tval (); -report ("interrupt received after TVAL/WFI" , info->irq_received); -report ("timer has expired" , left <0 ); +report (info->irq_received,"interrupt received after TVAL/WFI" ); +report (left <0 ,"timer has expired" );report_info ("TVAL is %d ticks" , left); }
@@ -297,7 +297,7 @@ static void test_init(void) if (ptimer_unsupported && !ERRATA(7b6b46311a85)) {report_skip ("Skipping ptimer tests. Set ERRATA_7b6b46311a85=y to enable." ); }else if (ptimer_unsupported) { -report ("ptimer: read CNTP_CTL_EL0" , false); +report (false,"ptimer: read CNTP_CTL_EL0" );report_info ("ptimer: skipping remaining tests" ); }
lib/libcflat.h +4 -4
@@ -99,10 +99,10 @@ void report_prefix_pushf(const char *prefix_fmt, ...) __attribute__((format(printf, 1, 2)));extern void report_prefix_push (const char *prefix);extern void report_prefix_pop (void ); -extern void report (const char *msg_fmt,bool pass, ...) - __attribute__((format (printf,1 ,3 ))); -extern void report_xfail (const char *msg_fmt,bool xfail,bool pass, ...) - __attribute__((format (printf,1 ,4 ))); +extern void report (bool pass,const char *msg_fmt, ...) + __attribute__((format (printf,2 ,3 ),nonnull (2 ))); +extern void report_xfail (bool xfail,bool pass,const char *msg_fmt, ...) + __attribute__((format (printf,3 ,4 ),nonnull (3 )));extern void report_abort (const char *msg_fmt, ...) __attribute__((format (printf,1 ,2 ))) __attribute__((noreturn));
lib/report.c +4 -4
@@ -104,18 +104,18 @@ static void va_report(const char *msg_fmt,spin_unlock (&lock); } -void report (const char *msg_fmt,bool pass, ...) +void report (bool pass,const char *msg_fmt, ...) {va_list va; -va_start (va, pass); +va_start (va, msg_fmt);va_report (msg_fmt, pass, false, false, va);va_end (va); } -void report_xfail (const char *msg_fmt,bool xfail,bool pass, ...) +void report_xfail (bool xfail,bool pass,const char *msg_fmt, ...) {va_list va; -va_start (va, pass); +va_start (va, msg_fmt);va_report (msg_fmt, pass, xfail, false, va);va_end (va); }
lib/s390x/interrupt.c +3 -2
@@ -46,8 +46,9 @@ uint16_t clear_pgm_int(void)void check_pgm_int_code (uint16_t code) {mb (); -report ("Program interrupt: expected(%d) == received(%d)" , - code == lc->pgm_int_code, code, lc->pgm_int_code); +report (code == lc->pgm_int_code, +"Program interrupt: expected(%d) == received(%d)" , code, + lc->pgm_int_code); }static void fixup_pgm_int (void )
lib/x86/fault_test.c +1 -1
@@ -47,6 +47,6 @@ void test_run(struct fault_test *test) {bool passed =fault_test (&(test->arg)); -report ("%s" , passed, test->name); +report (passed,"%s" , test->name); }
powerpc/emulator.c +22 -22
114 lines not on this page · raw message
powerpc/rtas.c +16 -16
@@ -45,21 +45,21 @@ static void check_get_time_of_day(unsigned long start)unsigned long t1, t2, count; ret =rtas_token ("get-time-of-day" , &token); -report ("token available" , ret ==0 ); +report (ret ==0 ,"token available" );if (ret)return ; ret =rtas_call (token,0 ,8 , now); -report ("execution" , ret ==0 ); +report (ret ==0 ,"execution" ); -report ("second" , now[5 ] >=0 && now[5 ] <=59 ); -report ("minute" , now[4 ] >=0 && now[4 ] <=59 ); -report ("hour" , now[3 ] >=0 && now[3 ] <=23 ); -report ("day" , now[2 ] >=1 && now[2 ] <=31 ); -report ("month" , now[1 ] >=1 && now[1 ] <=12 ); -report ("year" , now[0 ] >=1970 ); -report ("accuracy (< 3s)" ,mktime (now[0 ], now[1 ], now[2 ], - now[3 ], now[4 ], now[5 ]) - start <3 ); +report (now[5 ] >=0 && now[5 ] <=59 ,"second" ); +report (now[4 ] >=0 && now[4 ] <=59 ,"minute" ); +report (now[3 ] >=0 && now[3 ] <=23 ,"hour" ); +report (now[2 ] >=1 && now[2 ] <=31 ,"day" ); +report (now[1 ] >=1 && now[1 ] <=12 ,"month" ); +report (now[0 ] >=1970 ,"year" ); +report (mktime (now[0 ], now[1 ], now[2 ], now[3 ], now[4 ], now[5 ]) - start <3 , +"accuracy (< 3s)" ); ret =rtas_call (token,0 ,8 , now); t1 =mktime (now[0 ], now[1 ], now[2 ], now[3 ], now[4 ], now[5 ]);
@@ -69,7 +69,7 @@ static void check_get_time_of_day(unsigned long start) t2 =mktime (now[0 ], now[1 ], now[2 ], now[3 ], now[4 ], now[5 ]); count++; }while (t1 +DELAY > t2 && count <MAX_LOOP ); -report ("running" , t1 +DELAY <= t2); +report (t1 +DELAY <= t2,"running" ); }static void check_set_time_of_day (void )
@@ -80,24 +80,24 @@ static void check_set_time_of_day(void)unsigned long t1, t2, count; ret =rtas_token ("set-time-of-day" , &stod_token); -report ("token available" , ret ==0 ); +report (ret ==0 ,"token available" );if (ret)return ;/* 23:59:59 28/2/2000 */ ret =rtas_call (stod_token,7 ,1 ,NULL ,2000 ,2 ,28 ,23 ,59 ,59 ); -report ("execution" , ret ==0 ); +report (ret ==0 ,"execution" );/* check it has worked */ ret =rtas_token ("get-time-of-day" , >od_token);assert (ret ==0 ); ret =rtas_call (gtod_token,0 ,8 , date); -report ("re-read" , ret ==0 ); +report (ret ==0 ,"re-read" ); t1 =mktime (2000 ,2 ,28 ,23 ,59 ,59 ); t2 =mktime (date[0 ], date[1 ], date[2 ], date[3 ], date[4 ], date[5 ]); -report ("result" , t2 - t1 <2 ); +report (t2 - t1 <2 ,"result" );/* check it is running */ count =0 ;
@@ -107,7 +107,7 @@ static void check_set_time_of_day(void) date[3], date[4], date[5]); count++; }while (t1 +DELAY > t2 && count <MAX_LOOP ); -report ("running" , t1 +DELAY <= t2); +report (t1 +DELAY <= t2,"running" ); }int main (int argc,char **argv)
powerpc/selftest.c +2 -2
@@ -28,13 +28,13 @@ static void check_setup(int argc, char **argv)phys_addr_t memsize =PHYSICAL_END -PHYSICAL_START ;phys_addr_t expected = ((phys_addr_t )val)*1024 *1024 ; -report ("size = %" PRIu64" MB" , memsize == expected, +report (memsize == expected,"size = %" PRIu64" MB" , memsize/1024 /1024 ); ++nr_tests; }else if (strcmp (argv[i],"smp" ) ==0 ) { -report ("nr_cpus = %d" , nr_cpus == (int )val, nr_cpus); +report (nr_cpus == (int )val,"nr_cpus = %d" , nr_cpus); ++nr_tests; }
powerpc/spapr_hcall.c +15 -15
@@ -39,18 +39,18 @@ static void test_h_set_sprg0(int argc, char **argv) rc =hcall (H_SET_SPRG0 ,0xcafebabedeadbeefULL ); sprg0 =mfspr (SPR_SPRG0 ); -report ("sprg0 = 0xcafebabedeadbeef" , - rc ==H_SUCCESS && sprg0 ==0xcafebabedeadbeefULL ); +report (rc ==H_SUCCESS && sprg0 ==0xcafebabedeadbeefULL , +"sprg0 = 0xcafebabedeadbeef" ); rc =hcall (H_SET_SPRG0 ,0xaaaaaaaa55555555ULL ); sprg0 =mfspr (SPR_SPRG0 ); -report ("sprg0 = 0xaaaaaaaa55555555" , - rc ==H_SUCCESS && sprg0 ==0xaaaaaaaa55555555ULL ); +report (rc ==H_SUCCESS && sprg0 ==0xaaaaaaaa55555555ULL , +"sprg0 = 0xaaaaaaaa55555555" ); rc =hcall (H_SET_SPRG0 , sprg0_orig); sprg0 =mfspr (SPR_SPRG0 ); -report ("sprg0 = %#" PRIx64, - rc ==H_SUCCESS && sprg0 == sprg0_orig, sprg0_orig); +report (rc ==H_SUCCESS && sprg0 == sprg0_orig,"sprg0 = %#" PRIx64, + sprg0_orig); }/**
@@ -72,23 +72,23 @@ static void test_h_page_init(int argc, char **argv)memset (dst,0xaa ,PAGE_SIZE ); rc =hcall (H_PAGE_INIT ,H_ZERO_PAGE , dst, src); -report ("h_zero_page" , rc ==H_SUCCESS && *(uint64_t *)dst ==0 ); +report (rc ==H_SUCCESS && *(uint64_t *)dst ==0 ,"h_zero_page" ); *(uint64_t *)src =0xbeefc0dedeadcafeULL ; rc =hcall (H_PAGE_INIT ,H_COPY_PAGE , dst, src); -report ("h_copy_page" , - rc ==H_SUCCESS && *(uint64_t *)dst ==0xbeefc0dedeadcafeULL ); +report (rc ==H_SUCCESS && *(uint64_t *)dst ==0xbeefc0dedeadcafeULL , +"h_copy_page" ); *(uint64_t *)src =0x9abcdef012345678ULL ; rc =hcall (H_PAGE_INIT ,H_COPY_PAGE |H_ZERO_PAGE , dst, src); -report ("h_copy_page+h_zero_page" , - rc ==H_SUCCESS && *(uint64_t *)dst ==0x9abcdef012345678ULL ); +report (rc ==H_SUCCESS && *(uint64_t *)dst ==0x9abcdef012345678ULL , +"h_copy_page+h_zero_page" ); rc =hcall (H_PAGE_INIT ,H_ZERO_PAGE , dst +0x123 , src); -report ("h_zero_page unaligned dst" , rc ==H_PARAMETER ); +report (rc ==H_PARAMETER ,"h_zero_page unaligned dst" ); rc =hcall (H_PAGE_INIT ,H_COPY_PAGE , dst, src +0x123 ); -report ("h_copy_page unaligned src" , rc ==H_PARAMETER ); +report (rc ==H_PARAMETER ,"h_copy_page unaligned src" ); }static int h_random (uint64_t *val)
@@ -122,7 +122,7 @@ static void test_h_random(int argc, char **argv)report_skip ("h-call is not available" );return ; } -report ("h-call can be used successfully" , rc ==H_SUCCESS ); +report (rc ==H_SUCCESS ,"h-call can be used successfully" ); val0 =0ULL ; val1 = ~0ULL ;
@@ -136,7 +136,7 @@ static void test_h_random(int argc, char **argv) val1 &= rval; }while (i-- >0 && (val0 != ~0ULL || val1 !=0ULL )); -report ("no stuck bits" , rc ==H_SUCCESS && val0 == ~0ULL && val1 ==0 ); +report (rc ==H_SUCCESS && val0 == ~0ULL && val1 ==0 ,"no stuck bits" ); }struct {
powerpc/sprs.c +3 -2
@@ -299,8 +299,9 @@ int main(int argc, char **argv)puts ("Checking SPRs...\n" );for (i =0 ; i <1024 ; i++) {if (before[i] !=0 || after[i] !=0 ) -report ("SPR %d:\t%#018lx <==> %#018lx" , - before[i] == after[i], i, before[i], after[i]); +report (before[i] == after[i], +"SPR %d:\t%#018lx <==> %#018lx" , i, before[i], + after[i]); }return report_summary ();
powerpc/tm.c +3 -3
@@ -127,7 +127,7 @@ static void test_h_cede_tm(int argc, char **argv)mdelay (5 ); } -report ("H_CEDE TM" , i ==500 ); +report (i ==500 ,"H_CEDE TM" ); }struct {
@@ -150,8 +150,8 @@ int main(int argc, char **argv)report_skip ("TM is not available" ); goto done; } -report ("TM available in all 'ibm,pa-features' properties" , - cpus_with_tm == nr_cpus); +report (cpus_with_tm == nr_cpus, +"TM available in all 'ibm,pa-features' properties" ); all = argc ==1 || !strcmp (argv[1 ],"all" );
s390x/cpumodel.c +1 -1
@@ -47,7 +47,7 @@ int main(void)report_prefix_push ("dependency" );for (i =0 ; i <ARRAY_SIZE (dep); i++) {if (test_facility (dep[i][0 ])) { -report ("%d implies %d" ,test_facility (dep[i][1 ]), +report (test_facility (dep[i][1 ]),"%d implies %d" , dep[i][0 ], dep[i][1 ]); }else {report_skip ("facility %d not present" , dep[i][0 ]);
s390x/diag288.c +1 -1
@@ -101,7 +101,7 @@ static void test_bite(void)"0: nop\n" " j 0b\n" "1:"); -report ("restart" , true); +report (true,"restart" ); }int main (void )
s390x/diag308.c +2 -2
@@ -29,12 +29,12 @@ static void test_priv(void)extern int diag308_load_reset (u64 );static void test_subcode0 (void ) { -report ("load modified clear done" ,diag308_load_reset (0 )); +report (diag308_load_reset (0 ),"load modified clear done" ); }static void test_subcode1 (void ) { -report ("load normal reset done" ,diag308_load_reset (1 )); +report (diag308_load_reset (1 ),"load normal reset done" ); }/* Expect a specification exception when using an uneven register */
s390x/emulator.c +9 -9
@@ -28,10 +28,10 @@ static inline void __test_spm_ipm(uint8_t cc, uint8_t key)"ipm %0\n" : "+r"(out) : "r"(in) : "cc"); - report("bit 32 and 33 set to zero" , !(out &0xc0000000UL )); -report ("bit 0-31, 40-63 unchanged" , - (out & ~0xff000000ULL ) == ~0xff000000ULL ); -report ("cc and key applied" , !((in ^ out) &0x3f000000UL )); + report(!(out &0xc0000000UL ),"bit 32 and 33 set to zero" ); +report ((out & ~0xff000000ULL ) == ~0xff000000ULL , +"bit 0-31, 40-63 unchanged" ); +report (!((in ^ out) &0x3f000000UL ),"cc and key applied" );report_prefix_pop (); }
@@ -165,7 +165,7 @@ static inline void __test_basic_cpacf_opcode(unsigned int opcode)report_skip ("not available" );return ; } -report ("query indicated in query" ,cpacf_query_func (opcode,0 )); +report (cpacf_query_func (opcode,0 ),"query indicated in query" );switch (opcode) {case CPACF_KMCTR :
@@ -272,8 +272,8 @@ static void test_dxc(void) : : "r"(0) : "memory");check_pgm_int_code (PGM_INT_CODE_DATA ); -report ("dxc in LC" , lc->dxc_vxc ==0xff ); -report ("dxc in FPC" ,get_fpc_dxc () ==0xff ); +report (lc->dxc_vxc ==0xff ,"dxc in LC" ); +report (get_fpc_dxc () ==0xff ,"dxc in FPC" );report_prefix_pop ();/* DXC (0xff) is to be stored in LC only on a trap (CRT) without AFP */
@@ -289,8 +289,8 @@ static void test_dxc(void)afp_enable ();check_pgm_int_code (PGM_INT_CODE_DATA ); -report ("dxc in LC" , lc->dxc_vxc ==0xff ); -report ("dxc not in FPC" ,get_fpc_dxc () ==0 ); +report (lc->dxc_vxc ==0xff ,"dxc in LC" ); +report (get_fpc_dxc () ==0 ,"dxc not in FPC" );report_prefix_pop (); }
s390x/gs.c +1 -1
@@ -121,7 +121,7 @@ static void test_load(void) guarded =0 ; v =load_guarded (&gs_area); -report ("load guarded %ld" , guarded, v); +report (guarded,"load guarded %ld" , v); guarded =0 ; }
s390x/intercept.c +8 -8
@@ -33,7 +33,7 @@ static void test_stpx(void)" spx %0\n" : "+Q"(old_prefix), "+Q"(tst_prefix) : "Q"(new_prefix)); - report("store prefix" , old_prefix ==0 && tst_prefix == new_prefix); + report(old_prefix ==0 && tst_prefix == new_prefix,"store prefix" );expect_pgm_int ();low_prot_enable ();
@@ -71,7 +71,7 @@ static void test_spx(void) : "+Q"(old_prefix) : "Q"(new_prefix) : "memory"); -report ("stfl to new prefix" , pagebuf[GEN_LC_STFL ] !=0 ); +report (pagebuf[GEN_LC_STFL ] !=0 ,"stfl to new prefix" );expect_pgm_int (); asmvolatile (" spx 0(%0) " : :"r" (1 ));
@@ -88,7 +88,7 @@ static void test_stap(void)uint16_t cpuid =0xffff ; asmvolatile ("stap %0\n" :"+Q" (cpuid)); -report ("get cpu address" , cpuid !=0xffff ); +report (cpuid !=0xffff ,"get cpu address" );expect_pgm_int ();low_prot_enable ();
@@ -111,9 +111,9 @@ static void test_stidp(void)struct cpuid id = {}; asmvolatile ("stidp %0\n" :"+Q" (id)); -report ("type set" , id.type); -report ("version valid" , !id.version || id.version ==0xff ); -report ("reserved bits not set" , !id.reserved); +report (id.type,"type set" ); +report (!id.version || id.version ==0xff ,"version valid" ); +report (!id.reserved,"reserved bits not set" );expect_pgm_int ();low_prot_enable ();
@@ -145,8 +145,8 @@ static void test_testblock(void) : "=d" (cc) : "a"(pagebuf + 0x123) : "memory", "0", "cc"); -report ("page cleared" , - cc ==0 && pagebuf[0 ] ==0 && pagebuf[PAGE_SIZE -1 ] ==0 ); +report (cc ==0 && pagebuf[0 ] ==0 && pagebuf[PAGE_SIZE -1 ] ==0 , +"page cleared" );expect_pgm_int ();low_prot_enable ();
s390x/pfmf.c +5 -4
@@ -45,7 +45,7 @@ static void test_4k_key(void)pfmf (r1.val, pagebuf); skey.val =get_storage_key (pagebuf); skey.val &=SKEY_ACC |SKEY_FP ; -report ("set storage keys" , skey.val ==0x30 ); +report (skey.val ==0x30 ,"set storage keys" ); out:report_prefix_pop (); }
@@ -75,7 +75,7 @@ static void test_1m_key(void)break ; } } -report ("set storage keys" , rp); +report (rp,"set storage keys" ); out:report_prefix_pop (); }
@@ -91,7 +91,8 @@ static void test_4k_clear(void)report_prefix_push ("4K" );memset (pagebuf,42 ,PAGE_SIZE );pfmf (r1.val, pagebuf); -report ("clear memory" , !memcmp (pagebuf, pagebuf +PAGE_SIZE ,PAGE_SIZE )); +report (!memcmp (pagebuf, pagebuf +PAGE_SIZE ,PAGE_SIZE ), +"clear memory" );report_prefix_pop (); }
@@ -110,7 +111,7 @@ static void test_1m_clear(void)pfmf (r1.val, pagebuf);for (i =0 ; i <PAGE_SIZE *256 ; i++) sum |= pagebuf[i]; -report ("clear memory" , !sum); +report (!sum,"clear memory" );report_prefix_pop (); }
s390x/selftest.c +12 -11
@@ -26,7 +26,7 @@ static void test_fp(void) " std %1, %0\n" : "=m" (c) : "f" (a), "m" (b)); - report("3.0/2.0 == 1.5" , c ==1.5 ); + report(c ==1.5 ,"3.0/2.0 == 1.5" ); }static void test_pgm_int (void )
@@ -49,11 +49,12 @@ static void test_malloc(void) *tmp2 =123456789 ;mb (); -report ("malloc: got vaddr" , (uintptr_t )tmp &0xf000000000000000ul ); -report ("malloc: access works" , *tmp ==123456789 ); -report ("malloc: got 2nd vaddr" , (uintptr_t )tmp2 &0xf000000000000000ul ); -report ("malloc: access works" , (*tmp2 ==123456789 )); -report ("malloc: addresses differ" , tmp != tmp2); +report ((uintptr_t )tmp &0xf000000000000000ul ,"malloc: got vaddr" ); +report (*tmp ==123456789 ,"malloc: access works" ); +report ((uintptr_t )tmp2 &0xf000000000000000ul , +"malloc: got 2nd vaddr" ); +report ((*tmp2 ==123456789 ),"malloc: access works" ); +report (tmp != tmp2,"malloc: addresses differ" );expect_pgm_int ();configure_dat (0 );
@@ -69,11 +70,11 @@ int main(int argc, char**argv) {report_prefix_push ("selftest" ); -report ("true" , true); -report ("argc == 3" , argc ==3 ); -report ("argv[0] == PROGNAME" , !strcmp (argv[0 ],"s390x/selftest.elf" )); -report ("argv[1] == test" , !strcmp (argv[1 ],"test" )); -report ("argv[2] == 123" , !strcmp (argv[2 ],"123" )); +report (true,"true" ); +report (argc ==3 ,"argc == 3" ); +report (!strcmp (argv[0 ],"s390x/selftest.elf" ),"argv[0] == PROGNAME" ); +report (!strcmp (argv[1 ],"test" ),"argv[1] == test" ); +report (!strcmp (argv[2 ],"123" ),"argv[2] == 123" );setup_vm ();
s390x/skey.c +5 -6
@@ -35,8 +35,7 @@ static void test_set_mb(void) ret1.val =get_storage_key (end -PAGE_SIZE ) & (SKEY_ACC |SKEY_FP ); ret2.val =get_storage_key (end -PAGE_SIZE *2 ) & (SKEY_ACC |SKEY_FP ); -report ("multi block" , - ret1.val == ret2.val && ret1.val == skey.val); +report (ret1.val == ret2.val && ret1.val == skey.val,"multi block" ); }static void test_chg (void )
@@ -48,7 +47,7 @@ static void test_chg(void) skey1.val =get_storage_key (pagebuf); pagebuf[0 ] =3 ; skey2.val =get_storage_key (pagebuf); -report ("chg bit test" , !skey1.str.ch && skey2.str.ch); +report (!skey1.str.ch && skey2.str.ch,"chg bit test" ); }static void test_set (void )
@@ -64,8 +63,8 @@ static void test_set(void)* CH are set by the machine for memory references and changes * and hence might change between a set and a get. */ -report ("set key test" , - skey.str.acc == ret.str.acc && skey.str.fp == ret.str.fp); +report (skey.str.acc == ret.str.acc && skey.str.fp == ret.str.fp, +"set key test" ); }/* Returns true if we are running under z/VM 6.x */
@@ -106,7 +105,7 @@ static void test_priv(void)report_prefix_pop (); skey.val =get_storage_key (pagebuf); -report ("skey did not change on exception" , skey.str.acc !=3 ); +report (skey.str.acc !=3 ,"skey did not change on exception" );report_prefix_push ("iske" );if (is_zvm6) {
s390x/skrf.c +5 -5
@@ -21,11 +21,11 @@ static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2)));static void test_facilities (void ) {report_prefix_push ("facilities" ); -report ("!10" , !test_facility (10 )); -report ("!14" , !test_facility (14 )); -report ("!66" , !test_facility (66 )); -report ("!145" , !test_facility (145 )); -report ("!149" , !test_facility (140 )); +report (!test_facility (10 ),"!10" ); +report (!test_facility (14 ),"!14" ); +report (!test_facility (66 ),"!66" ); +report (!test_facility (145 ),"!145" ); +report (!test_facility (140 ),"!149" );report_prefix_pop (); }
s390x/smp.c +19 -18
@@ -44,7 +44,7 @@ static void test_start(void)while (!testflag) {mb (); } -report ("start" ,1 ); +report (1 ,"start" ); }static void test_stop (void )
@@ -56,7 +56,7 @@ static void test_stop(void)* implementation */ while (!smp_cpu_stopped (1 )) {} -report ("stop" ,1 ); +report (1 ,"stop" ); }static void test_stop_store_status (void )
@@ -69,8 +69,8 @@ static void test_stop_store_status(void) lc->grs_sa[15 ] =0 ;smp_cpu_stop_store_status (1 );mb (); -report ("prefix" , lc->prefix_sa == (uint32_t )(uintptr_t )cpu->lowcore); -report ("stack" , lc->grs_sa[15 ]); +report (lc->prefix_sa == (uint32_t )(uintptr_t )cpu->lowcore,"prefix" ); +report (lc->grs_sa[15 ],"stack" );report_prefix_pop (); }
@@ -85,8 +85,9 @@ static void test_store_status(void)report_prefix_push ("running" );smp_cpu_restart (1 );sigp (1 ,SIGP_STORE_STATUS_AT_ADDRESS , (uintptr_t )status, &r); -report ("incorrect state" , r ==SIGP_STATUS_INCORRECT_STATE ); -report ("status not written" , !memcmp (status, (void *)status +PAGE_SIZE ,PAGE_SIZE )); +report (r ==SIGP_STATUS_INCORRECT_STATE ,"incorrect state" ); +report (!memcmp (status, (void *)status +PAGE_SIZE ,PAGE_SIZE ), +"status not written" );report_prefix_pop ();memset (status,0 ,PAGE_SIZE );
@@ -94,7 +95,7 @@ static void test_store_status(void)smp_cpu_stop (1 );sigp (1 ,SIGP_STORE_STATUS_AT_ADDRESS , (uintptr_t )status,NULL );while (!status->prefix) {mb (); } -report ("status written" ,1 ); +report (1 ,"status written" );free_pages (status,PAGE_SIZE *2 );report_prefix_pop ();
@@ -113,7 +114,7 @@ static void ecall(void)load_psw_mask (mask); testflag =1 ;while (lc->ext_int_code !=0x1202 ) {mb (); } -report ("ecall" ,1 ); +report (1 ,"ecall" ); testflag=1 ; }
@@ -148,7 +149,7 @@ static void emcall(void)load_psw_mask (mask); testflag=1 ;while (lc->ext_int_code !=0x1201 ) {mb (); } -report ("ecall" ,1 ); +report (1 ,"ecall" ); testflag =1 ; }
@@ -186,19 +187,19 @@ static void test_reset_initial(void)sigp (1 ,SIGP_STORE_STATUS_AT_ADDRESS , (uintptr_t )status,NULL );report_prefix_push ("clear" ); -report ("psw" , !status->psw.mask && !status->psw.addr); -report ("prefix" , !status->prefix); -report ("fpc" , !status->fpc); -report ("cpu timer" , !status->cputm); -report ("todpr" , !status->todpr); +report (!status->psw.mask && !status->psw.addr,"psw" ); +report (!status->prefix,"prefix" ); +report (!status->fpc,"fpc" ); +report (!status->cputm,"cpu timer" ); +report (!status->todpr,"todpr" );report_prefix_pop ();report_prefix_push ("initialized" ); -report ("cr0 == 0xE0" , status->crs[0 ] ==0xE0UL ); -report ("cr14 == 0xC2000000" , status->crs[14 ] ==0xC2000000UL ); +report (status->crs[0 ] ==0xE0UL ,"cr0 == 0xE0" ); +report (status->crs[14 ] ==0xC2000000UL ,"cr14 == 0xC2000000" );report_prefix_pop (); -report ("cpu stopped" ,smp_cpu_stopped (1 )); +report (smp_cpu_stopped (1 ),"cpu stopped" );free_pages (status,PAGE_SIZE );report_prefix_pop (); }
@@ -214,7 +215,7 @@ static void test_reset(void)smp_cpu_setup (1 , psw);sigp_retry (1 ,SIGP_CPU_RESET ,0 ,NULL ); -report ("cpu stopped" ,smp_cpu_stopped (1 )); +report (smp_cpu_stopped (1 ),"cpu stopped" );report_prefix_pop (); }
s390x/sthyi.c +23 -18
73 lines not on this page · raw message
s390x/stsi.c +4 -4
@@ -70,10 +70,10 @@ static inline unsigned long stsi_get_fc(void *addr)static void test_fc (void ) { -report ("invalid fc" ,stsi (pagebuf,7 ,0 ,0 ) ==3 ); -report ("invalid selector 1" ,stsi (pagebuf,1 ,0 ,1 ) ==3 ); -report ("invalid selector 2" ,stsi (pagebuf,1 ,1 ,0 ) ==3 ); -report ("query fc >= 2" ,stsi_get_fc (pagebuf) >=2 ); +report (stsi (pagebuf,7 ,0 ,0 ) ==3 ,"invalid fc" ); +report (stsi (pagebuf,1 ,0 ,1 ) ==3 ,"invalid selector 1" ); +report (stsi (pagebuf,1 ,1 ,0 ) ==3 ,"invalid selector 2" ); +report (stsi_get_fc (pagebuf) >=2 ,"query fc >= 2" ); }int main (void )
s390x/vector.c +3 -3
@@ -49,7 +49,7 @@ static void test_add(void) : [v3] "=Q" (prm.c) : [v1] "Q" (prm.a), [v2] "Q" (prm.b) : "v0", "v1", "v2", "memory"); - report("adding 21" , prm.c ==42 ); + report(prm.c ==42 ,"adding 21" ); }/* z14 vector extension test */
@@ -75,7 +75,7 @@ static void test_ext1_nand(void) : [v3] "=Q" (prm.c) : [v1] "Q" (prm.a), [v2] "Q" (prm.b) : "v0", "v1", "v2", "memory"); - report("nand ff" , !prm.c); + report(!prm.c,"nand ff" ); }/* z14 bcd extension test */
@@ -102,7 +102,7 @@ static void test_bcd_add(void) : [v3] "=Q" (prm.c) : [v1] "Q" (prm.a), [v2] "Q" (prm.b) : "v0", "v1", "v2", "memory"); - report("bcd add 21" , prm.c ==0x42c ); + report(prm.c ==0x42c ,"bcd add 21" ); }static void init (void )
x86/apic.c +76 -72
305 lines not on this page · raw message
x86/asyncpf.c +6 -5
@@ -55,21 +55,22 @@ static void pf_isr(struct ex_regs *r)switch (reason) {case 0 : -report ("unexpected #PF at %#lx" , false,read_cr2 ()); +report (false,"unexpected #PF at %#lx" ,read_cr2 ());break ;case KVM_PV_REASON_PAGE_NOT_PRESENT : phys =virt_to_pte_phys (phys_to_virt (read_cr3 ()), virt);install_pte (phys_to_virt (read_cr3 ()),1 , virt, phys,0 );write_cr3 (read_cr3 ()); -report ("Got not present #PF token %lx virt addr %p phys addr %#" PRIx64, - true,read_cr2 (), virt, phys); +report (true, +"Got not present #PF token %lx virt addr %p phys addr %#" PRIx64, +read_cr2 (), virt, phys);while (phys) {safe_halt ();/* enables irq */ irq_disable (); }break ;case KVM_PV_REASON_PAGE_READY : -report ("Got present #PF token %lx" , true,read_cr2 ()); +report (true,"Got present #PF token %lx" ,read_cr2 ());if ((uint32_t )read_cr2 () == ~0 )break ;install_pte (phys_to_virt (read_cr3 ()),1 , virt, phys |PT_PRESENT_MASK |PT_WRITABLE_MASK ,0 );
@@ -77,7 +78,7 @@ static void pf_isr(struct ex_regs *r) phys =0 ;break ;default : -report ("unexpected async pf reason %d" , false, reason); +report (false,"unexpected async pf reason %d" , reason);break ; } }
x86/cmpxchg8b.c +1 -1
@@ -14,7 +14,7 @@ static void test_cmpxchg8b(u32 *mem) "lock cmpxchg8b (%0)\n" "pop %%ebx" : : "D" (mem), "d" (2), "a" (1), "c" (4), [ebx_val] "i" (3) : "memory"); - report("cmpxchg8b" , mem[0 ] ==3 && mem[1 ] ==4 ); + report(mem[0 ] ==3 && mem[1 ] ==4 ,"cmpxchg8b" ); }int main (void )
x86/debug.c +34 -35
133 lines not on this page · raw message
x86/emulator.c +147 -143
797 lines not on this page · raw message
x86/eventinj.c +15 -15
@@ -226,7 +226,7 @@ int main(void) asmvolatile ("divl %3" :"=a" (res) :"d" (0 ),"a" (1500 ),"m" (test_divider));printf ("Result is %d\n" , res); -report ("DE exception" , res ==150 ); +report (res ==150 ,"DE exception" );/* generate soft exception (BP) that will fault on IDT and stack */ test_count =0 ;
@@ -236,7 +236,7 @@ int main(void)flush_stack (); asmvolatile ("int $3" );printf ("After int 3\n" ); -report ("BP exception" , test_count ==1 ); +report (test_count ==1 ,"BP exception" );#ifndef __x86_64__/* generate soft exception (OF) that will fault on IDT */
@@ -246,7 +246,7 @@ int main(void)printf ("Try into\n" ); asmvolatile ("addb $127, %b0\ninto" ::"a" (127 ));printf ("After into\n" ); -report ("OF exception" , test_count ==1 ); +report (test_count ==1 ,"OF exception" );/* generate soft exception (OF) using two bit instruction that will fault on IDT */
@@ -256,7 +256,7 @@ int main(void)printf ("Try into\n" ); asmvolatile ("addb $127, %b0\naddr16 into" ::"a" (127 ));printf ("After into\n" ); -report ("2 byte OF exception" , test_count ==1 ); +report (test_count ==1 ,"2 byte OF exception" );#endif /* generate HW interrupt that will fault on IDT */
@@ -268,7 +268,7 @@ int main(void)io_delay ();irq_disable ();printf ("After vec 33 to self\n" ); -report ("vec 33" , test_count ==1 ); +report (test_count ==1 ,"vec 33" );/* generate soft interrupt that will fault on IDT and stack */ test_count =0 ;
@@ -277,7 +277,7 @@ int main(void)flush_stack (); asmvolatile ("int $33" );printf ("After int $33\n" ); -report ("int $33" , test_count ==1 ); +report (test_count ==1 ,"int $33" );/* Inject two HW interrupt than open iterrupt windows. Both interrupt will fault on IDT access */
@@ -291,7 +291,7 @@ int main(void) asmvolatile ("nop" );irq_disable ();printf ("After vec 32 and 33 to self\n" ); -report ("vec 32/33" , test_count ==2 ); +report (test_count ==2 ,"vec 32/33" );/* Inject HW interrupt, do sti and than (while in irq shadow) inject
@@ -306,7 +306,7 @@ int main(void) asmvolatile ("sti; int $33" );irq_disable ();printf ("After vec 32 and int $33\n" ); -report ("vec 32/int $33" , test_count ==2 ); +report (test_count ==2 ,"vec 32/int $33" );/* test that TPR is honored */ test_count =0 ;
@@ -320,7 +320,7 @@ int main(void)io_delay ();apic_write (APIC_TASKPRI ,0x2 <<4 );printf ("After 33/62 TPR test\n" ); -report ("TPR" , test_count ==1 ); +report (test_count ==1 ,"TPR" );apic_write (APIC_TASKPRI ,0x0 );while (test_count !=2 );/* wait for second irq */ irq_disable ();
@@ -334,7 +334,7 @@ int main(void)flush_stack (); asmvolatile ("int $33" );printf ("After int33\n" ); -report ("NP exception" , test_count ==2 ); +report (test_count ==2 ,"NP exception" );/* generate NMI that will fault on IDT */ test_count =0 ;
@@ -349,7 +349,7 @@ int main(void)irq_enable (); asmvolatile ("nop" );irq_disable (); -report ("NMI" , test_count ==2 ); +report (test_count ==2 ,"NMI" );/* generate NMI that will fault on IRET */ printf ("Before NMI IRET test\n" );
@@ -364,7 +364,7 @@ int main(void) asmvolatile ("nop" );irq_disable ();printf ("After NMI to self\n" ); -report ("NMI" , test_count ==2 ); +report (test_count ==2 ,"NMI" ); stack_phys = (ulong )virt_to_phys (alloc_page ()); stack_va =alloc_vpage ();
@@ -384,7 +384,7 @@ int main(void) : "d"(0), "a"(1500), "m"(test_divider));restore_stack ();printf ("Result is %d\n" , res); -report ("DE PF exceptions" , res ==150 ); +report (res ==150 ,"DE PF exceptions" );/* Generate NP and PF exceptions serially */ printf ("Before NP test\n" );
@@ -402,7 +402,7 @@ int main(void) asmvolatile ("int $33" );restore_stack ();printf ("After int33\n" ); -report ("NP PF exceptions" , test_count ==2 ); +report (test_count ==2 ,"NP PF exceptions" ); pt =alloc_page (); cr3 = (void *)read_cr3 ();
@@ -426,7 +426,7 @@ int main(void) asmvolatile ("int $33" );restore_stack ();printf ("After int 33 with shadowed stack\n" ); -report ("int 33 with shadowed stack" , test_count ==1 ); +report (test_count ==1 ,"int 33 with shadowed stack" );return report_summary (); }
x86/hypercall.c +4 -2
@@ -71,10 +71,12 @@ int main(int ac, char **av) topmost[4093 ] =0x0f ; topmost[4094 ] =0x01 ; topmost[4095 ] =0xc1 ; -report ("VMCALL on edge of canonical address space (intel)" ,test_edge ()); +report (test_edge (), +"VMCALL on edge of canonical address space (intel)" ); topmost[4095 ] =0xd9 ; -report ("VMMCALL on edge of canonical address space (AMD)" ,test_edge ()); +report (test_edge (), +"VMMCALL on edge of canonical address space (AMD)" );#endif return report_summary ();
x86/hyperv_clock.c +5 -4
@@ -112,7 +112,7 @@ static void check_test(int ncpus)for (i = ncpus -1 ; i >=0 ; i--) pass &= ok[i]; -report ("TSC reference precision test" , pass); +report (pass,"TSC reference precision test" ); }static void hv_perf_test (void *data)
@@ -159,8 +159,8 @@ int main(int ac, char **av) hv_clock =alloc_page ();wrmsr (HV_X64_MSR_REFERENCE_TSC , (u64 )(uintptr_t )hv_clock |1 ); -report ("MSR value after enabling" , -rdmsr (HV_X64_MSR_REFERENCE_TSC ) == ((u64 )(uintptr_t )hv_clock |1 )); +report (rdmsr (HV_X64_MSR_REFERENCE_TSC ) == ((u64 )(uintptr_t )hv_clock |1 ), +"MSR value after enabling" );hvclock_get_time_values (&shadow, hv_clock);if (shadow.tsc_sequence ==0 || shadow.tsc_sequence ==0xFFFFFFFF ) {
@@ -189,7 +189,8 @@ int main(int ac, char **av)perf_test (ncpus);wrmsr (HV_X64_MSR_REFERENCE_TSC ,0LL ); -report ("MSR value after disabling" ,rdmsr (HV_X64_MSR_REFERENCE_TSC ) ==0 ); +report (rdmsr (HV_X64_MSR_REFERENCE_TSC ) ==0 , +"MSR value after disabling" );return nerr >0 ?1 :0 ; }
x86/hyperv_connections.c +14 -14
@@ -292,36 +292,36 @@ int main(int ac, char **av)on_cpu (i, setup_cpu, (void *)read_cr3 ()); ncpus_ok =run_test (ncpus,0 ,WAIT_CYCLES , do_msg, msg_ok); -report ("send message to self: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"send message to self: %d/%d" , ncpus_ok, + ncpus);run_test (ncpus,0 ,0 , clear_msg,NULL ); ncpus_ok =run_test (ncpus,1 ,WAIT_CYCLES , do_msg, msg_ok); -report ("send message to another cpu: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"send message to another cpu: %d/%d" , + ncpus_ok, ncpus); ncpus_ok =run_test (ncpus,1 ,WAIT_CYCLES , do_msg, msg_busy); -report ("send message to busy slot: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"send message to busy slot: %d/%d" , + ncpus_ok, ncpus); ncpus_ok =run_test (ncpus,0 ,WAIT_CYCLES , clear_msg, msg_ok); -report ("receive pending message: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"receive pending message: %d/%d" , ncpus_ok, + ncpus); ncpus_ok =run_test (ncpus,0 ,WAIT_CYCLES , do_evt, evt_ok); -report ("signal event on self: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"signal event on self: %d/%d" , ncpus_ok, + ncpus);run_test (ncpus,0 ,0 , clear_evt,NULL ); ncpus_ok =run_test (ncpus,1 ,WAIT_CYCLES , do_evt, evt_ok); -report ("signal event on another cpu: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"signal event on another cpu: %d/%d" , + ncpus_ok, ncpus); ncpus_ok =run_test (ncpus,1 ,WAIT_CYCLES , do_evt, evt_busy); -report ("signal event already set: %d/%d" , - ncpus_ok == ncpus, ncpus_ok, ncpus); +report (ncpus_ok == ncpus,"signal event already set: %d/%d" , ncpus_ok, + ncpus);for (i =0 ; i < ncpus; i++)on_cpu (i, teardown_cpu,NULL );
x86/hyperv_stimer.c +15 -13
@@ -96,7 +96,7 @@ static void process_stimer_msg(struct svcpu *svcpu,if (msg->header.message_type !=HVMSG_TIMER_EXPIRED && msg->header.message_type !=HVMSG_NONE ) { -report ("invalid Hyper-V SynIC msg type" , false); +report (false,"invalid Hyper-V SynIC msg type" );report_summary ();abort (); }
@@ -106,7 +106,7 @@ static void process_stimer_msg(struct svcpu *svcpu, }if (msg->header.payload_size <sizeof (*payload)) { -report ("invalid Hyper-V SynIC msg payload size" , false); +report (false,"invalid Hyper-V SynIC msg payload size" );report_summary ();abort (); }
@@ -114,7 +114,7 @@ static void process_stimer_msg(struct svcpu *svcpu,/* Now process timer expiration message */ if (payload->timer_index >=ARRAY_SIZE (svcpu->timer)) { -report ("invalid Hyper-V SynIC timer index" , false); +report (false,"invalid Hyper-V SynIC timer index" );report_summary ();abort (); }
@@ -234,7 +234,7 @@ static void stimer_test_periodic(int vcpu, struct stimer *timer1, (atomic_read(&timer2->fire_count) < 1000)) {pause (); } -report ("Hyper-V SynIC periodic timers test vcpu %d" , true, vcpu); +report (true,"Hyper-V SynIC periodic timers test vcpu %d" , vcpu);stimer_shutdown (timer1);stimer_shutdown (timer2); }
@@ -246,7 +246,7 @@ static void stimer_test_one_shot(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1 ) {pause (); } -report ("Hyper-V SynIC one-shot test vcpu %d" , true, vcpu); +report (true,"Hyper-V SynIC one-shot test vcpu %d" , vcpu);stimer_shutdown (timer); }
@@ -257,7 +257,8 @@ static void stimer_test_auto_enable_one_shot(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1 ) {pause (); } -report ("Hyper-V SynIC auto-enable one-shot timer test vcpu %d" , true, vcpu); +report (true,"Hyper-V SynIC auto-enable one-shot timer test vcpu %d" , + vcpu);stimer_shutdown (timer); }
@@ -268,7 +269,8 @@ static void stimer_test_auto_enable_periodic(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1000 ) {pause (); } -report ("Hyper-V SynIC auto-enable periodic timer test vcpu %d" , true, vcpu); +report (true,"Hyper-V SynIC auto-enable periodic timer test vcpu %d" , + vcpu);stimer_shutdown (timer); }
@@ -286,8 +288,8 @@ static void stimer_test_one_shot_busy(int vcpu, struct stimer *timer)rmb ();while (!msg->header.message_flags.msg_pending); -report ("no timer fired while msg slot busy: vcpu %d" , - !atomic_read (&timer->fire_count), vcpu); +report (!atomic_read (&timer->fire_count), +"no timer fired while msg slot busy: vcpu %d" , vcpu); msg->header.message_type =HVMSG_NONE ;wmb ();
@@ -296,7 +298,7 @@ static void stimer_test_one_shot_busy(int vcpu, struct stimer *timer)while (atomic_read (&timer->fire_count) <1 ) {pause (); } -report ("timer resumed when msg slot released: vcpu %d" , true, vcpu); +report (true,"timer resumed when msg slot released: vcpu %d" , vcpu);stimer_shutdown (timer); }
@@ -354,17 +356,17 @@ int main(int ac, char **av) {if (!synic_supported ()) { -report ("Hyper-V SynIC is not supported" , true); +report (true,"Hyper-V SynIC is not supported" ); goto done; }if (!stimer_supported ()) { -report ("Hyper-V SynIC timers are not supported" , true); +report (true,"Hyper-V SynIC timers are not supported" ); goto done; }if (!hv_time_ref_counter_supported ()) { -report ("Hyper-V time reference counter is not supported" , true); +report (true,"Hyper-V time reference counter is not supported" ); goto done; }
x86/hyperv_synic.c +2 -2
@@ -90,7 +90,7 @@ static void synic_test_prepare(void *ctx) } r =rdmsr (HV_X64_MSR_EOM );if (r !=0 ) { -report ("Hyper-V SynIC test, EOM read %#" PRIx64, false, r); +report (false,"Hyper-V SynIC test, EOM read %#" PRIx64, r);return ; }
@@ -177,7 +177,7 @@ int main(int ac, char **av) ok &=atomic_read (&isr_enter_count[i]) ==16 ; } -report ("Hyper-V SynIC test" , ok); +report (ok,"Hyper-V SynIC test" ); }else {printf ("Hyper-V SynIC is not supported" ); }
x86/idt_test.c +4 -4
@@ -31,11 +31,11 @@ int main(void)printf ("Starting IDT test\n" );setup_idt (); r =test_gp (&rflags_rf); -report ("Testing #GP" , r ==GP_VECTOR ); -report ("Testing #GP rflags.rf" , rflags_rf); +report (r ==GP_VECTOR ,"Testing #GP" ); +report (rflags_rf,"Testing #GP rflags.rf" ); r =test_ud2 (&rflags_rf); -report ("Testing #UD" , r ==UD_VECTOR ); -report ("Testing #UD rflags.rf" , rflags_rf); +report (r ==UD_VECTOR ,"Testing #UD" ); +report (rflags_rf,"Testing #UD rflags.rf" );return report_summary (); }
x86/intel-iommu.c +13 -12
@@ -56,7 +56,7 @@ static void vtd_test_dmar(void)* Check data match between 0-3 bytes and 4-7 bytes of the * page. */ -report (VTD_TEST_DMAR_4B , *((uint32_t *)page +1 ) ==DMA_TEST_WORD ); +report (*((uint32_t *)page +1 ) ==DMA_TEST_WORD ,VTD_TEST_DMAR_4B );free_page (page);
@@ -102,7 +102,7 @@ static void vtd_test_ir(void)edu_reg_writel (dev,EDU_REG_INTR_RAISE ,0 );/* We are good as long as we reach here */ -report (VTD_TEST_IR_IOAPIC , edu_intr_recved == true); +report (edu_intr_recved == true,VTD_TEST_IR_IOAPIC );/* * Setup EDU PCI device MSI, using interrupt remapping. By
@@ -125,7 +125,7 @@ static void vtd_test_ir(void)cpu_relax ();/* We are good as long as we reach here */ -report (VTD_TEST_IR_MSI , edu_intr_recved == true); +report (edu_intr_recved == true,VTD_TEST_IR_MSI );report_prefix_pop (); }
@@ -139,15 +139,16 @@ int main(int argc, char *argv[])report_prefix_push ("vtd_init" ); -report ("fault status check" ,vtd_readl (DMAR_FSTS_REG ) ==0 ); -report ("QI enablement" ,vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_QI ); -report ("DMAR table setup" ,vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_ROOT ); -report ("IR table setup" ,vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_IR_TABLE ); -report ("DMAR enablement" ,vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_DMAR ); -report ("IR enablement" ,vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_IR ); -report ("DMAR support 39 bits address width" , -vtd_readq (DMAR_CAP_REG ) &VTD_CAP_SAGAW ); -report ("DMAR support huge pages" ,vtd_readq (DMAR_CAP_REG ) &VTD_CAP_SLLPS ); +report (vtd_readl (DMAR_FSTS_REG ) ==0 ,"fault status check" ); +report (vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_QI ,"QI enablement" ); +report (vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_ROOT ,"DMAR table setup" ); +report (vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_IR_TABLE ,"IR table setup" ); +report (vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_DMAR ,"DMAR enablement" ); +report (vtd_readl (DMAR_GSTS_REG ) &VTD_GCMD_IR ,"IR enablement" ); +report (vtd_readq (DMAR_CAP_REG ) &VTD_CAP_SAGAW , +"DMAR support 39 bits address width" ); +report (vtd_readq (DMAR_CAP_REG ) &VTD_CAP_SLLPS , +"DMAR support huge pages" );report_prefix_pop ();
x86/ioapic.c +30 -31
183 lines not on this page · raw message
x86/vmx.c +85 -82
167 lines not on this page · raw message
x86/vmx_tests.c +330 -296
626 lines not on this page · raw message
x86/xsave.c +40 -40
80 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.18.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Part of the diff is not shown here. View the raw message.
Quoted 38 lines · Thomas Huth
Commit
c09c54c66b1df("lib: use an argument which doesn't require default argument promotion") fixed a warning that occurs with Clang, but introduced a regression: If the "pass" parameter is a value which has only set the condition bits in the upper 32 bits of a 64 bit value, the condition is now false since the value is truncated to "unsigned int" so that the upper bits are simply discarded.We fixed it by reverting the commit, but that of course also means trouble with Clang again. We can not use "bool" if it is the last parameter before the variable argument list. The proper fix is to swap the parameters around and make the format string the last parameter.
This patch (except the changes in
lib/libcflat.handlib/report.cand some rebase conflicts along the way) has basically been created with following coccinelle script (with some additional manual tweaking of long and disabled lines afterwards):@@
expression fmt;
expression pass;
expression list args;
@@
report((quoted diff) +1
-1-fmt, pass +pass, fmt , args);@@
expression fmt;
expression pass;
expression list args;
@@
report_xfail((quoted diff) +1
-1-fmt, xfail, pass +xfail, pass, fmt , args);
Quoted 4 lines
Signed-off-by Thomas Huth <[email protected]>---
v2: Rebase the patch to the current master branch
Tested on arm and arm64.
Thanks,
drew