From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH kvm-unit-tests 2/6] lib/arm/psci: make psci less ugly Date: Thu, 25 May 2017 12:28:45 +0200 Message-ID: <20170525102849.22754-3-drjones@redhat.com> References: <20170525102849.22754-1-drjones@redhat.com> Cc: pbonzini@redhat.com, rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37844 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032208AbdEYK3K (ORCPT ); Thu, 25 May 2017 06:29:10 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F0EF7D514 for ; Thu, 25 May 2017 10:29:10 +0000 (UTC) In-Reply-To: <20170525102849.22754-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Andrew Jones --- lib/arm/asm/psci.h | 6 ++---- lib/arm/psci.c | 10 +++++++--- lib/arm64/asm/psci.h | 16 +--------------- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/lib/arm/asm/psci.h b/lib/arm/asm/psci.h index 11ac45028d78..eeb55cf299d1 100644 --- a/lib/arm/asm/psci.h +++ b/lib/arm/asm/psci.h @@ -3,10 +3,8 @@ #include #include -#define PSCI_INVOKE_ARG_TYPE u32 -#define PSCI_FN_CPU_ON PSCI_0_2_FN_CPU_ON - -extern int psci_invoke(u32 function_id, u32 arg0, u32 arg1, u32 arg2); +extern int psci_invoke(unsigned long function_id, unsigned long arg0, + unsigned long arg1, unsigned long arg2); extern int psci_cpu_on(unsigned long cpuid, unsigned long entry_point); extern void psci_sys_reset(void); extern int cpu_psci_cpu_boot(unsigned int cpu); diff --git a/lib/arm/psci.c b/lib/arm/psci.c index aca88851171f..a14acddeefd3 100644 --- a/lib/arm/psci.c +++ b/lib/arm/psci.c @@ -10,9 +10,9 @@ #include #include -#define T PSCI_INVOKE_ARG_TYPE __attribute__((noinline)) -int psci_invoke(T function_id, T arg0, T arg1, T arg2) +int psci_invoke(unsigned long function_id, unsigned long arg0, + unsigned long arg1, unsigned long arg2) { asm volatile( "hvc #0" @@ -23,7 +23,11 @@ int psci_invoke(T function_id, T arg0, T arg1, T arg2) int psci_cpu_on(unsigned long cpuid, unsigned long entry_point) { - return psci_invoke(PSCI_FN_CPU_ON, cpuid, entry_point, 0); +#ifdef __arm__ + return psci_invoke(PSCI_0_2_FN_CPU_ON, cpuid, entry_point, 0); +#else + return psci_invoke(PSCI_0_2_FN64_CPU_ON, cpuid, entry_point, 0); +#endif } extern void secondary_entry(void); diff --git a/lib/arm64/asm/psci.h b/lib/arm64/asm/psci.h index 0a7d7c854e2b..783b36ef579e 100644 --- a/lib/arm64/asm/psci.h +++ b/lib/arm64/asm/psci.h @@ -1,15 +1 @@ -#ifndef _ASMARM64_PSCI_H_ -#define _ASMARM64_PSCI_H_ -#include -#include - -#define PSCI_INVOKE_ARG_TYPE u64 -#define PSCI_FN_CPU_ON PSCI_0_2_FN64_CPU_ON - -extern int psci_invoke(u64 function_id, u64 arg0, u64 arg1, u64 arg2); -extern int psci_cpu_on(unsigned long cpuid, unsigned long entry_point); -extern void psci_sys_reset(void); -extern int cpu_psci_cpu_boot(unsigned int cpu); -extern void cpu_psci_cpu_die(unsigned int cpu); - -#endif /* _ASMARM64_PSCI_H_ */ +#include "../../arm/asm/psci.h" -- 2.9.4