/kvm-unit-tests/lib/ |
H A D | on-cpus.c | 24 static void __deadlock_check(int cpu, const cpumask_t *waiters, bool *found) in __deadlock_check() argument 29 if (i == cpu) { in __deadlock_check() 30 printf("CPU%d", cpu); in __deadlock_check() 34 __deadlock_check(cpu, &on_cpu_info[i].waiters, found); in __deadlock_check() 36 printf(" <=> CPU%d", i); in __deadlock_check() 42 static void deadlock_check(int me, int cpu) in deadlock_check() argument 46 __deadlock_check(cpu, &on_cpu_info[me].waiters, &found); in deadlock_check() 48 printf(" <=> CPU%d deadlock detectd\n", me); in deadlock_check() 53 static void cpu_wait(int cpu) in cpu_wait() argument 57 if (cpu == me) in cpu_wait() [all …]
|
H A D | cpumask.h | 21 static inline void cpumask_set_cpu(int cpu, cpumask_t *mask) in cpumask_set_cpu() argument 23 assert(cpu >= 0 && cpu < nr_cpus); in cpumask_set_cpu() 24 set_bit(cpu, cpumask_bits(mask)); in cpumask_set_cpu() 27 static inline void cpumask_clear_cpu(int cpu, cpumask_t *mask) in cpumask_clear_cpu() argument 29 assert(cpu >= 0 && cpu < nr_cpus); in cpumask_clear_cpu() 30 clear_bit(cpu, cpumask_bits(mask)); in cpumask_clear_cpu() 33 static inline int cpumask_test_cpu(int cpu, const cpumask_t *mask) in cpumask_test_cpu() argument 35 assert(cpu >= 0 && cpu < nr_cpus); in cpumask_test_cpu() 36 return test_bit(cpu, cpumask_bits(mask)); in cpumask_test_cpu() 39 static inline int cpumask_test_and_set_cpu(int cpu, cpumask_t *mask) in cpumask_test_and_set_cpu() argument [all …]
|
/kvm-unit-tests/arm/ |
H A D | psci.c | 82 int cpu = smp_processor_id(); in cpu_on_do_wake_target() local 84 cpumask_set_cpu(cpu, &cpu_on_ready); in cpu_on_do_wake_target() 87 cpu_on_ret[cpu] = psci_cpu_on(cpus[1], __pa(secondary_entry)); in cpu_on_do_wake_target() 88 cpumask_set_cpu(cpu, &cpu_on_done); in cpu_on_do_wake_target() 93 int cpu = smp_processor_id(); in cpu_on_target() local 95 cpumask_set_cpu(cpu, &cpu_on_done); in cpu_on_target() 101 static void psci_cpu_on_prepare_secondary(int cpu, secondary_entry_fn entry) in psci_cpu_on_prepare_secondary() argument 105 mmu_mark_disabled(cpu); in psci_cpu_on_prepare_secondary() 112 int i, cpu; in psci_cpu_on_test() local 114 for_each_present_cpu(cpu) { in psci_cpu_on_test() [all …]
|
H A D | spinlock-test.c | 49 int cpu = smp_processor_id(); in test_spinlock() local 51 printf("CPU%d online\n", cpu); in test_spinlock() 57 if (global_a == (cpu + 1) % 2) { in test_spinlock() 70 report(errors == 0, "CPU%d: Done - Errors: %d", cpu, errors); in test_spinlock()
|
/kvm-unit-tests/s390x/ |
H A D | unittests.cfg | 126 [firq-linear-cpu-ids-kvm] 129 extra_params = -smp 1,maxcpus=3 -device host-s390x-cpu,core-id=1 -device host-s390x-cpu,core-id=2 132 [firq-nonlinear-cpu-ids-kvm] 135 extra_params = -smp 1,maxcpus=3 -device host-s390x-cpu,core-id=2 -device host-s390x-cpu,core-id=1 138 [firq-linear-cpu-ids-tcg] 141 extra_params = -smp 1,maxcpus=3 -cpu qemu -device qemu-s390x-cpu,core-id=1 -device qemu-s390x-cpu,c… 144 [firq-nonlinear-cpu-ids-tcg] 147 extra_params = -smp 1,maxcpus=3 -cpu qemu -device qemu-s390x-cpu,core-id=2 -device qemu-s390x-cpu,c… 164 extra_params = -cpu host,gs=on,vx=on 170 extra_params = -cpu host,gs=off,vx=off [all …]
|
H A D | smp.c | 30 { SIGP_STOP, "stop with invalid CPU address" }, 31 { SIGP_START, "start with invalid CPU address" }, 32 { SIGP_CPU_RESET, "reset with invalid CPU address" }, 33 { SIGP_COND_EMERGENCY_SIGNAL, "conditional emcall with invalid CPU address" }, 34 { SIGP_EMERGENCY_SIGNAL, "emcall with invalid CPU address" }, 35 { SIGP_EXTERNAL_CALL, "ecall with invalid CPU address" }, 36 { INVALID_ORDER_CODE, "invalid order code and CPU address" }, 37 { SIGP_SENSE, "sense with invalid CPU address" }, 38 { SIGP_STOP_AND_STORE_STATUS, "stop and store status with invalid CPU address" }, 112 struct cpu *cpu = smp_cpu_from_idx(1); in test_restart() local [all …]
|
H A D | firq.c | 22 /* Enable SCLP interrupts on this CPU only. */ in wait_for_sclp_int() 31 * accidentially detecting a stopped CPU as waiting and resulting in the actually 32 * waiting CPU not getting woken up for the interrupt. 46 /* Stop CPU #2. It must succeed because we have at least 3 CPUs */ in test_wait_state_delivery() 52 * interrupt on CPU #1 while it is in the wait state. in test_wait_state_delivery() 56 /* Start CPU #1 and let it wait for the interrupt. */ in test_wait_state_delivery() 63 * CONDITIONAL EMERGENCY SIGNAL if CPU #1 is already in the in test_wait_state_delivery() 83 * Wait until the interrupt gets delivered on CPU #1, marking the in test_wait_state_delivery()
|
H A D | pv-ipl.c | 66 /* Mark the CPU as stopped so we can unshare and reset */ in test_diag_308() 68 report(!cc, "Set cpu stopped"); in test_diag_308() 83 /* Prepare the CPU reset */ in test_diag_308() 93 * Do the reset on the initiating cpu in test_diag_308() 101 report(cc == 0 && rc == 1, "Clear reset cpu"); in test_diag_308() 105 report(cc == 0 && rc == 1, "Initial reset cpu"); in test_diag_308() 110 report(uv_validity_check(&vm), "validity, stopped, unshared, prep reset, cpu reset"); in test_diag_308() 114 report(!cc, "Set cpu load"); in test_diag_308()
|
/kvm-unit-tests/x86/ |
H A D | unittests.cfg | 13 extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine kernel_irqchip=split 19 extra_params = -cpu qemu64 -machine kernel_irqchip=split 26 extra_params = -cpu qemu64,+x2apic,+tsc-deadline 36 extra_params = -cpu qemu64,-x2apic,+tsc-deadline -machine pit=off 44 extra_params = -cpu qemu64,+x2apic 107 extra_params = -cpu qemu64,+x2apic,+tsc-deadline -append tscdeadline 112 extra_params = -cpu qemu64,+x2apic,+tsc-deadline -append tscdeadline_immed 129 extra_params = -cpu max,host-phys-bits 134 extra_params = -cpu max,host-phys-bits -append force_emulation 141 extra_params = -cpu IvyBridge,phys-bits=36,host-phys-bits=off [all …]
|
/kvm-unit-tests/lib/riscv/ |
H A D | smp.c | 30 set_cpu_online(info->cpu, true); in secondary_cinit() 36 static void __smp_boot_secondary(int cpu, secondary_func_t func) in __smp_boot_secondary() argument 38 void *sp_mem = __va(cpus[cpu].sp); in __smp_boot_secondary() 47 cpus[cpu].sp = __pa(sp_phys); in __smp_boot_secondary() 49 assert(__va(cpus[cpu].sp) == sp_mem); in __smp_boot_secondary() 58 ret = sbi_hart_start(cpus[cpu].hartid, __pa(secondary_entry), cpus[cpu].sp); in __smp_boot_secondary() 62 void smp_boot_secondary(int cpu, void (*func)(void)) in smp_boot_secondary() argument 67 ret = sbi_hart_get_status(cpus[cpu].hartid); in smp_boot_secondary() 71 assert_msg(ret.value == SBI_EXT_HSM_STOPPED, "CPU%d is not stopped", cpu); in smp_boot_secondary() 72 __smp_boot_secondary(cpu, func); in smp_boot_secondary() [all …]
|
H A D | sbi.c | 136 struct sbiret sbi_send_ipi_cpu(int cpu) in sbi_send_ipi_cpu() argument 138 return sbi_send_ipi(1UL, cpus[cpu].hartid); in sbi_send_ipi_cpu() 159 int cpu; in sbi_send_ipi_cpumask() local 161 for_each_cpu(cpu, &tmp) { in sbi_send_ipi_cpumask() 162 if (base > cpus[cpu].hartid) in sbi_send_ipi_cpumask() 163 base = cpus[cpu].hartid; in sbi_send_ipi_cpumask() 166 for_each_cpu(cpu, &tmp) { in sbi_send_ipi_cpumask() 167 if (cpus[cpu].hartid < base + BITS_PER_LONG) { in sbi_send_ipi_cpumask() 168 mask |= 1UL << (cpus[cpu].hartid - base); in sbi_send_ipi_cpumask() 169 cpumask_clear_cpu(cpu, &tmp); in sbi_send_ipi_cpumask()
|
/kvm-unit-tests/lib/arm/ |
H A D | smp.c | 2 * Secondary cpu support 36 mmu_mark_enabled(ti->cpu); in secondary_cinit() 44 set_cpu_online(ti->cpu, true); in secondary_cinit() 54 static void __smp_boot_secondary(int cpu, secondary_entry_fn entry) in __smp_boot_secondary() argument 60 mmu_mark_disabled(cpu); in __smp_boot_secondary() 61 ret = cpu_psci_cpu_boot(cpu); in __smp_boot_secondary() 64 while (!cpu_online(cpu)) in __smp_boot_secondary() 68 void smp_boot_secondary(int cpu, secondary_entry_fn entry) in smp_boot_secondary() argument 71 assert_msg(!cpu_online(cpu), "CPU%d already boot once", cpu); in smp_boot_secondary() 72 __smp_boot_secondary(cpu, entry); in smp_boot_secondary() [all …]
|
H A D | gic-v3.c | 76 int cpu; in gicv3_ipi_send_mask() local 87 * For each cpu in the mask collect its peers, which are also in in gicv3_ipi_send_mask() 90 for_each_cpu(cpu, dest) { in gicv3_ipi_send_mask() 91 u64 mpidr = cpus[cpu], sgi1r; in gicv3_ipi_send_mask() 108 while (cpu < nr_cpus) { in gicv3_ipi_send_mask() 110 printf("cpu%d MPIDR:aff0 is %d (>= 16)!\n", in gicv3_ipi_send_mask() 111 cpu, (int)(mpidr & 0xff)); in gicv3_ipi_send_mask() 117 cpu = cpumask_next(cpu, dest); in gicv3_ipi_send_mask() 118 if (cpu >= nr_cpus) in gicv3_ipi_send_mask() 121 mpidr = cpus[cpu]; in gicv3_ipi_send_mask() [all …]
|
H A D | mmu.c | 26 /* CPU 0 starts with disabled MMU */ 39 int cpu = current_thread_info()->cpu; in mmu_enabled() local 40 return cpumask_test_cpu(cpu, &mmu_enabled_cpumask); in mmu_enabled() 46 void mmu_mark_enabled(int cpu) in mmu_mark_enabled() argument 48 cpumask_set_cpu(cpu, &mmu_enabled_cpumask); in mmu_mark_enabled() 51 void mmu_mark_disabled(int cpu) in mmu_mark_disabled() argument 53 cpumask_clear_cpu(cpu, &mmu_enabled_cpumask); in mmu_mark_disabled() 64 mmu_mark_enabled(info->cpu); in mmu_enable() 71 int cpu = current_thread_info()->cpu; in mmu_disable() local 76 mmu_mark_disabled(cpu); in mmu_disable()
|
H A D | psci.c | 45 int cpu_psci_cpu_boot(unsigned int cpu) in cpu_psci_cpu_boot() argument 47 int err = psci_cpu_on(cpus[cpu], __pa(secondary_entry)); in cpu_psci_cpu_boot() 49 printf("failed to boot CPU%d (%d)\n", cpu, err); in cpu_psci_cpu_boot() 56 printf("CPU%d unable to power off (error = %d)\n", smp_processor_id(), err); in cpu_psci_cpu_die() 67 printf("CPU%d unable to do system off (error = %d)\n", smp_processor_id(), err); in psci_system_off()
|
/kvm-unit-tests/lib/powerpc/ |
H A D | smp.c | 2 * Secondary cpu support 37 printf("failed to stop cpu %d\n", cpu_id); in stop_self() 41 void main_secondary(struct cpu *cpu); 42 void main_secondary(struct cpu *cpu) in main_secondary() argument 44 mtspr(SPR_SPRG0, (unsigned long)cpu); in main_secondary() 45 __current_cpu = cpu; in main_secondary() 53 cpu->entry(cpu->server_no); in main_secondary() 58 stop_self(cpu->server_no); in main_secondary() 167 printf("OPAL_QUERY_CPU_STATUS failed for cpu %d\n", cpu_id); in cpu_is_running() 175 ret = rtas_token("query-cpu-stopped-state", &query_token); in cpu_is_running() [all …]
|
H A D | setup.c | 103 bool cpu_has_power_mce; /* POWER CPU machine checks */ 201 struct cpu cpus[NR_CPUS]; 203 void cpu_init(struct cpu *cpu, int cpu_id) in cpu_init() argument 205 cpu->server_no = cpu_id; in cpu_init() 207 cpu->stack = (unsigned long)memalign_pages(SZ_4K, SZ_64K); in cpu_init() 208 cpu->stack += SZ_64K - 64; in cpu_init() 209 cpu->exception_stack = (unsigned long)memalign_pages(SZ_4K, SZ_64K); in cpu_init() 210 cpu->exception_stack += SZ_64K - 64; in cpu_init() 211 cpu->pgtable = NULL; in cpu_init() 212 cpu->in_user = false; in cpu_init() [all …]
|
/kvm-unit-tests/riscv/ |
H A D | sbi.c | 90 assert_msg(0, "cpu%d (hartid = %lx) failed to stop with sbiret.error %ld", in stop_cpu() 96 int cpu, me = smp_processor_id(); in rand_online_cpu() local 99 cpu = prng32(ps) % nr_cpus; in rand_online_cpu() 100 cpu = cpumask_next(cpu - 1, &cpu_present_mask); in rand_online_cpu() 101 if (cpu != nr_cpus && cpu != me && cpu_present(cpu)) in rand_online_cpu() 105 return cpu; in rand_online_cpu() 399 int cpu; in ipi_hart_check() local 401 for_each_cpu(cpu, mask) { in ipi_hart_check() 402 if (ipi_timeout[cpu]) { in ipi_hart_check() 403 const char *rec = ipi_received[cpu] ? "but was still received" in ipi_hart_check() [all …]
|
H A D | selftest.c | 16 int cpu; in check_cpus() local 18 for_each_present_cpu(cpu) in check_cpus() 19 report_info("CPU%3d: hartid=%08lx", cpu, cpus[cpu].hartid); in check_cpus() 47 int cpu, me = smp_processor_id(); in check_smp() local 55 for_each_present_cpu(cpu) { in check_smp() 56 if (cpu == me) in check_smp() 58 if (!cpu_idle(cpu)) { in check_smp()
|
/kvm-unit-tests/lib/powerpc/asm/ |
H A D | smp.h | 10 struct cpu { struct 21 extern struct cpu cpus[]; argument 23 register struct cpu *__current_cpu asm("r13"); 24 static inline struct cpu *current_cpu(void) in current_cpu() 34 void cpu_init(struct cpu *cpu, int cpu_id);
|
/kvm-unit-tests/lib/s390x/ |
H A D | sclp.c | 71 * With multiple CPUs we might need to wait for another CPU's in sclp_mark_busy() 130 * Since we obviously have at least one CPU, just return one. in sclp_get_cpu_num() 151 CPUEntry *cpu; in sclp_facilities_setup() local 156 cpu = sclp_get_cpu_entries(); in sclp_facilities_setup() 169 for (i = 0; i < read_info->entries_cpu; i++, cpu++) { in sclp_facilities_setup() 172 * boot cpu comes from the kernel. I haven't yet found in sclp_facilities_setup() 177 if (cpu->address == cpu0_addr) { in sclp_facilities_setup() 178 sclp_facilities.has_sief2 = cpu->feat_sief2; in sclp_facilities_setup() 179 sclp_facilities.has_skeyi = cpu->feat_skeyi; in sclp_facilities_setup() 180 sclp_facilities.has_siif = cpu->feat_siif; in sclp_facilities_setup() [all …]
|
H A D | smp.c | 27 static struct cpu *cpus; 57 struct cpu *smp_cpu_from_addr(uint16_t addr) in smp_cpu_from_addr() 68 struct cpu *smp_cpu_from_idx(uint16_t idx) in smp_cpu_from_idx() 93 /* Status stored condition code is equivalent to cpu not running. */ in smp_sense_running_status() 101 /* refuse to work on the boot CPU */ in smp_cpu_stop_nolock() 134 /* refuse to work on the boot CPU */ in smp_cpu_stop_nowait() 172 * Stop the cpu, so we don't have a race between a running cpu in smp_cpu_restart_nolock() 173 * and the restart in the test that checks if the cpu is in smp_cpu_restart_nolock() 182 * have been performed yet, so wait until the cpu is running. in smp_cpu_restart_nolock() 281 /* Wait until the cpu has finished setup and started the provided psw */ in smp_cpu_setup_nolock() [all …]
|
H A D | interrupt.c | 22 * expect_pgm_int - Expect a program interrupt on the current CPU. 33 * expect_ext_int - Expect an external interrupt on the current CPU. 64 * check_pgm_int_code - Check the program interrupt code on the current CPU. 65 * @code: the expected program interrupt code on the current CPU 67 * Check and report if the program interrupt on the current CPU matches the 80 * interrupts for the current CPU. 81 * @f: the cleanup function to be registered on the current CPU 84 * interrupt handling for program interrupts for this CPU. 95 * interrupts for the current CPU. 96 * @f: the cleanup function to be registered on the current CPU [all …]
|
/kvm-unit-tests/lib/riscv/asm/ |
H A D | isa.h | 19 static inline bool cpu_has_extension(int cpu, int ext) in cpu_has_extension() argument 21 return test_bit(ext, cpus[cpu].isa); in cpu_has_extension() 24 bool cpu_has_extension_name(int cpu, const char *ext); 28 return cpu_has_extension_name(current_thread_info()->cpu, ext); in has_ext()
|
/kvm-unit-tests/lib/x86/ |
H A D | smp.c | 89 printf("setup: CPU %" PRId32 " online\n", apic_id()); in ap_online() 97 static void __on_cpu(int cpu, void (*function)(void *data), void *data, int wait) in __on_cpu() argument 100 unsigned int target = id_map[cpu]; in __on_cpu() 118 void on_cpu(int cpu, void (*function)(void *data), void *data) in on_cpu() argument 120 __on_cpu(cpu, function, data, 1); in on_cpu() 123 void on_cpu_async(int cpu, void (*function)(void *data), void *data) in on_cpu_async() argument 125 __on_cpu(cpu, function, data, 0); in on_cpu_async() 130 int cpu; in on_cpus() local 132 for (cpu = cpu_count() - 1; cpu >= 0; --cpu) in on_cpus() 133 on_cpu_async(cpu, function, data); in on_cpus()
|