From patchwork Wed Jun 27 08:02:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10490769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9F6F60230 for ; Wed, 27 Jun 2018 08:02:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB5041FF29 for ; Wed, 27 Jun 2018 08:02:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF662283BF; Wed, 27 Jun 2018 08:02:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 219211FF29 for ; Wed, 27 Jun 2018 08:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933299AbeF0ICZ (ORCPT ); Wed, 27 Jun 2018 04:02:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48566 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933219AbeF0ICQ (ORCPT ); Wed, 27 Jun 2018 04:02:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9E90400B45D for ; Wed, 27 Jun 2018 08:02:15 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-127.ams2.redhat.com [10.36.116.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDAAE2156880; Wed, 27 Jun 2018 08:02:14 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Paolo Bonzini Subject: [kvm-unit-tests PATCH 3/4] Make remaining x86 code compilable with -Wstrict-prototypes Date: Wed, 27 Jun 2018 10:02:07 +0200 Message-Id: <1530086528-21665-4-git-send-email-thuth@redhat.com> In-Reply-To: <1530086528-21665-1-git-send-email-thuth@redhat.com> References: <1530086528-21665-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 08:02:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 08:02:15 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This way the functions can not be called anymore with arbitrary parameters by accident. Signed-off-by: Thomas Huth --- lib/x86/processor.h | 2 +- lib/x86/smp.c | 2 +- lib/x86/vm.h | 2 +- x86/access.c | 2 +- x86/apic.c | 4 ++-- x86/emulator.c | 4 ++-- x86/eventinj.c | 4 ++-- x86/kvmclock.c | 2 +- x86/kvmclock.h | 2 +- x86/pku.c | 2 +- x86/pmu.c | 2 +- x86/port80.c | 2 +- x86/setjmp.c | 2 +- x86/sieve.c | 2 +- x86/smptest.c | 2 +- x86/syscall.c | 6 +++--- x86/tsc.c | 2 +- x86/tsc_adjust.c | 2 +- x86/vmx.c | 8 ++++---- x86/vmx.h | 6 +++--- 20 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/x86/processor.h b/lib/x86/processor.h index e850029..945a94e 100644 --- a/lib/x86/processor.h +++ b/lib/x86/processor.h @@ -354,7 +354,7 @@ static inline void sti(void) asm volatile ("sti"); } -static inline unsigned long long rdtsc() +static inline unsigned long long rdtsc(void) { long long r; diff --git a/lib/x86/smp.c b/lib/x86/smp.c index bffb6de..2e98de8 100644 --- a/lib/x86/smp.c +++ b/lib/x86/smp.c @@ -19,7 +19,7 @@ static volatile bool ipi_wait; static int _cpu_count; static atomic_t active_cpus; -static __attribute__((used)) void ipi() +static __attribute__((used)) void ipi(void) { void (*function)(void *data) = ipi_function; void *data = ipi_data; diff --git a/lib/x86/vm.h b/lib/x86/vm.h index ae1b769..729f172 100644 --- a/lib/x86/vm.h +++ b/lib/x86/vm.h @@ -5,7 +5,7 @@ #include "asm/page.h" #include "asm/io.h" -void setup_5level_page_table(); +void setup_5level_page_table(void); struct pte_search { int level; diff --git a/x86/access.c b/x86/access.c index 11f561b..8f8c228 100644 --- a/x86/access.c +++ b/x86/access.c @@ -992,7 +992,7 @@ int ac_test_run(void) return successes == tests; } -int main() +int main(void) { int r; diff --git a/x86/apic.c b/x86/apic.c index 630fe86..013e296 100644 --- a/x86/apic.c +++ b/x86/apic.c @@ -518,7 +518,7 @@ static inline void apic_change_mode(unsigned long new_mode) apic_write(APIC_LVTT, (lvtt & ~APIC_LVT_TIMER_MASK) | new_mode); } -static void test_apic_change_mode() +static void test_apic_change_mode(void) { uint32_t tmict = 0x999999; @@ -570,7 +570,7 @@ static void test_apic_change_mode() report("TMCCT should stay at zero", !apic_read(APIC_TMCCT)); } -int main() +int main(void) { setup_vm(); smp_init(); diff --git a/x86/emulator.c b/x86/emulator.c index 38688dc..0d88409 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -33,7 +33,7 @@ struct insn_desc { static char st1[] = "abcdefghijklmnop"; -void test_stringio() +static void test_stringio(void) { unsigned char r = 0; asm volatile("cld \n\t" @@ -1015,7 +1015,7 @@ static void record_no_fep(struct ex_regs *regs) regs->rip += KVM_FEP_LENGTH; } -int main() +int main(void) { void *mem; void *insn_page; diff --git a/x86/eventinj.c b/x86/eventinj.c index 247604c..cbfc03f 100644 --- a/x86/eventinj.c +++ b/x86/eventinj.c @@ -37,7 +37,7 @@ void apic_self_nmi(void) extern char isr_iret_ip[]; -static void flush_idt_page() +static void flush_idt_page(void) { struct descriptor_table_ptr ptr; sidt(&ptr); @@ -196,7 +196,7 @@ ulong saved_stack; asm volatile ("mov %0, %%" R "sp"::"r"(saved_stack)); \ } while(0) -int main() +int main(void) { unsigned int res; ulong *pt, *cr3, i; diff --git a/x86/kvmclock.c b/x86/kvmclock.c index bad0784..e7b6054 100644 --- a/x86/kvmclock.c +++ b/x86/kvmclock.c @@ -160,7 +160,7 @@ bool pvclock_read_retry(const struct pvclock_vcpu_time_info *src, return version != src->version; } -static inline u64 rdtsc_ordered() +static inline u64 rdtsc_ordered(void) { /* * FIXME: on Intel CPUs rmb() aka lfence is sufficient which brings up diff --git a/x86/kvmclock.h b/x86/kvmclock.h index dff6802..f823c6d 100644 --- a/x86/kvmclock.h +++ b/x86/kvmclock.h @@ -36,7 +36,7 @@ struct timespec { }; void pvclock_set_flags(unsigned char flags); -cycle_t kvm_clock_read(); +cycle_t kvm_clock_read(void); void kvm_get_wallclock(struct timespec *ts); void kvm_clock_init(void *data); void kvm_clock_clear(void *data); diff --git a/x86/pku.c b/x86/pku.c index 0e7b03f..d51d26f 100644 --- a/x86/pku.c +++ b/x86/pku.c @@ -49,7 +49,7 @@ asm ("pf_tss: \n\t" "jmp pf_tss\n\t" ); -static void init_test() +static void init_test(void) { pf_count = 0; diff --git a/x86/pmu.c b/x86/pmu.c index 12a5880..f7b3010 100644 --- a/x86/pmu.c +++ b/x86/pmu.c @@ -95,7 +95,7 @@ static int num_counters; char *buf; -static inline void loop() +static inline void loop(void) { unsigned long tmp, tmp2, tmp3; diff --git a/x86/port80.c b/x86/port80.c index 522c1a4..791431c 100644 --- a/x86/port80.c +++ b/x86/port80.c @@ -1,6 +1,6 @@ #include "libcflat.h" -int main() +int main(void) { int i; diff --git a/x86/setjmp.c b/x86/setjmp.c index fa33179..976a632 100644 --- a/x86/setjmp.c +++ b/x86/setjmp.c @@ -1,7 +1,7 @@ #include "libcflat.h" #include "setjmp.h" -int main() +int main(void) { volatile int i; jmp_buf j; diff --git a/x86/sieve.c b/x86/sieve.c index 2ee2919..35da34f 100644 --- a/x86/sieve.c +++ b/x86/sieve.c @@ -32,7 +32,7 @@ void test_sieve(const char *msg, char *data, int size) #define VSIZE 100000000 char static_data[STATIC_SIZE]; -int main() +int main(void) { void *v; int i; diff --git a/x86/smptest.c b/x86/smptest.c index 68f35ee..2d271e7 100644 --- a/x86/smptest.c +++ b/x86/smptest.c @@ -14,7 +14,7 @@ static void ipi_test(void *data) nipis++; } -int main() +int main(void) { int ncpus; int i; diff --git a/x86/syscall.c b/x86/syscall.c index 8c3992d..e2d6514 100644 --- a/x86/syscall.c +++ b/x86/syscall.c @@ -7,7 +7,7 @@ static void test_syscall_lazy_load(void) { - extern void syscall_target(); + extern void syscall_target(void); u16 cs = read_cs(), ss = read_ss(); ulong tmp; @@ -57,8 +57,8 @@ asm(" .code32\n" static void test_syscall_tf(void) { - extern void syscall32_target(); - extern void syscall_tf_user32(); + extern void syscall32_target(void); + extern void syscall_tf_user32(void); ulong rcx; wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_SCE); diff --git a/x86/tsc.c b/x86/tsc.c index 6dc05af..2268682 100644 --- a/x86/tsc.c +++ b/x86/tsc.c @@ -26,7 +26,7 @@ void test_rdtscp(u64 aux) report("Test RDTSCP %" PRIu64, ecx == aux, aux); } -int main() +int main(void) { u64 t1, t2; diff --git a/x86/tsc_adjust.c b/x86/tsc_adjust.c index 20a9e89..0f32d8a 100644 --- a/x86/tsc_adjust.c +++ b/x86/tsc_adjust.c @@ -1,7 +1,7 @@ #include "libcflat.h" #include "processor.h" -int main() +int main(void) { u64 t1, t2, t3, t4, t5; u64 est_delta_time; diff --git a/x86/vmx.c b/x86/vmx.c index aa04ac6..e5a8fbd 100644 --- a/x86/vmx.c +++ b/x86/vmx.c @@ -1453,7 +1453,7 @@ static void __attribute__((__used__)) hypercall(u32 hypercall_no) asm volatile("vmcall\n\t"); } -static bool is_hypercall() +static bool is_hypercall(void) { ulong reason, hyper_bit; @@ -1464,7 +1464,7 @@ static bool is_hypercall() return false; } -static int handle_hypercall() +static int handle_hypercall(void) { ulong hypercall_no; @@ -1518,7 +1518,7 @@ void test_skip(const char *msg) abort(); } -static int exit_handler() +static int exit_handler(void) { int ret; @@ -1590,7 +1590,7 @@ static bool vmx_enter_guest(struct vmentry_failure *failure) return !failure->early && !(vmcs_read(EXI_REASON) & VMX_ENTRY_FAILURE); } -static int vmx_run() +static int vmx_run(void) { while (1) { u32 ret; diff --git a/x86/vmx.h b/x86/vmx.h index c035420..cb6739b 100644 --- a/x86/vmx.h +++ b/x86/vmx.h @@ -53,8 +53,8 @@ struct vmentry_failure { struct vmx_test { const char *name; int (*init)(struct vmcs *vmcs); - void (*guest_main)(); - int (*exit_handler)(); + void (*guest_main)(void); + int (*exit_handler)(void); void (*syscall_handler)(u64 syscall_no); struct regs guest_regs; int (*entry_failure_handler)(struct vmentry_failure *failure); @@ -721,7 +721,7 @@ static inline bool invvpid(unsigned long type, u64 vpid, u64 gla) } const char *exit_reason_description(u64 reason); -void print_vmexit_info(); +void print_vmexit_info(void); void print_vmentry_failure_info(struct vmentry_failure *failure); void ept_sync(int type, u64 eptp); void vpid_sync(int type, u16 vpid);