All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] arm64: add implementation for arm-smccc
Date: Mon, 23 Nov 2015 13:28:56 +0000	[thread overview]
Message-ID: <20151123132856.GE2755@arm.com> (raw)
In-Reply-To: <1447236266-7491-4-git-send-email-jens.wiklander@linaro.org>

On Wed, Nov 11, 2015 at 11:04:25AM +0100, Jens Wiklander wrote:
> Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC.
> 
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
> ---
>  arch/arm64/Kconfig              |  1 +
>  arch/arm64/kernel/Makefile      |  1 +
>  arch/arm64/kernel/asm-offsets.c |  3 +++
>  arch/arm64/kernel/smccc-call.S  | 43 +++++++++++++++++++++++++++++++++++++++++
>  arch/arm64/kernel/smccc.c       | 18 +++++++++++++++++
>  5 files changed, 66 insertions(+)
>  create mode 100644 arch/arm64/kernel/smccc-call.S
>  create mode 100644 arch/arm64/kernel/smccc.c
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 07d1811..a7332ca 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -89,6 +89,7 @@ config ARM64
>  	select SPARSE_IRQ
>  	select SYSCTL_EXCEPTION_TRACE
>  	select HAVE_CONTEXT_TRACKING
> +	select HAVE_ARM_SMCCC
>  	help
>  	  ARM 64-bit (AArch64) Linux support.
>  
> diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
> index 22dc9bc..c61d758 100644
> --- a/arch/arm64/kernel/Makefile
> +++ b/arch/arm64/kernel/Makefile
> @@ -36,6 +36,7 @@ arm64-obj-$(CONFIG_EFI)			+= efi.o efi-stub.o efi-entry.o
>  arm64-obj-$(CONFIG_PCI)			+= pci.o
>  arm64-obj-$(CONFIG_ARMV8_DEPRECATED)	+= armv8_deprecated.o
>  arm64-obj-$(CONFIG_ACPI)		+= acpi.o
> +arm64-obj-$(CONFIG_HAVE_ARM_SMCCC)	+= smccc-call.o smccc.o

I think you can just stick these in arm64-obj-y, since that option will
never be turned off.

>  obj-y					+= $(arm64-obj-y) vdso/
>  obj-m					+= $(arm64-obj-m)
> diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> index 8d89cf8..cfa0885 100644
> --- a/arch/arm64/kernel/asm-offsets.c
> +++ b/arch/arm64/kernel/asm-offsets.c
> @@ -28,6 +28,7 @@
>  #include <asm/suspend.h>
>  #include <asm/vdso_datapage.h>
>  #include <linux/kbuild.h>
> +#include <linux/arm-smccc.h>
>  
>  int main(void)
>  {
> @@ -161,5 +162,7 @@ int main(void)
>    DEFINE(SLEEP_SAVE_SP_PHYS,	offsetof(struct sleep_save_sp, save_ptr_stash_phys));
>    DEFINE(SLEEP_SAVE_SP_VIRT,	offsetof(struct sleep_save_sp, save_ptr_stash));
>  #endif
> +  DEFINE(ARM_SMCCC_RES_X0_OFFS,	offsetof(struct arm_smccc_res, a0));
> +  DEFINE(ARM_SMCCC_RES_X2_OFFS,	offsetof(struct arm_smccc_res, a2));
>    return 0;
>  }
> diff --git a/arch/arm64/kernel/smccc-call.S b/arch/arm64/kernel/smccc-call.S
> new file mode 100644
> index 0000000..ae0496f
> --- /dev/null
> +++ b/arch/arm64/kernel/smccc-call.S
> @@ -0,0 +1,43 @@
> +/*
> + * Copyright (c) 2015, Linaro Limited
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License Version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +#include <linux/linkage.h>
> +#include <asm/asm-offsets.h>
> +
> +	.macro SMCCC instr
> +	.cfi_startproc
> +	\instr	#0
> +	ldr	x4, [sp]
> +	stp	x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
> +	stp	x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
> +	ret
> +	.cfi_endproc
> +	.endm
> +
> +/*
> + * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
> + *		  unsigned long a3, unsigned long a4, unsigned long a5,
> + *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res)
> + */
> +ENTRY(arm_smccc_smc)
> +	SMCCC	smc
> +ENDPROC(arm_smccc_smc)
> +
> +/*
> + * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
> + *		  unsigned long a3, unsigned long a4, unsigned long a5,
> + *		  unsigned long a6, unsigned long a7, struct arm_smccc_res *res)
> + */
> +ENTRY(arm_smccc_hvc)
> +	SMCCC	hvc
> +ENDPROC(arm_smccc_hvc)
> diff --git a/arch/arm64/kernel/smccc.c b/arch/arm64/kernel/smccc.c
> new file mode 100644
> index 0000000..7941210
> --- /dev/null
> +++ b/arch/arm64/kernel/smccc.c
> @@ -0,0 +1,18 @@
> +/*
> + * Copyright (c) 2015, Linaro Limited
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +#include <linux/export.h>
> +#include <linux/arm-smccc.h>
> +
> +EXPORT_SYMBOL_GPL(arm_smccc_smc);
> +EXPORT_SYMBOL_GPL(arm_smccc_hvc);

You can just put these in arch/arm64/kernel/arm64ksyms.c, which is where
the rest of the EXPORTs for asm symbols live.

With those changes:

  Acked-by: Will Deacon <will.deacon@arm.com>

Will

  reply	other threads:[~2015-11-23 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 10:04 [PATCH v2 0/4] ARM SMC Calling Convention interface Jens Wiklander
2015-11-11 10:04 ` [PATCH v2 1/4] arm/arm64: add arm-smccc Jens Wiklander
2015-11-11 10:04 ` [PATCH v2 2/4] arm: add implementation for arm-smccc Jens Wiklander
2015-11-12 11:10   ` Lars Persson
2015-11-11 10:04 ` [PATCH v2 3/4] arm64: " Jens Wiklander
2015-11-23 13:28   ` Will Deacon [this message]
2015-11-11 10:04 ` [PATCH v2 4/4] drivers: psci: replace psci firmware calls Jens Wiklander
2015-11-23 13:29   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151123132856.GE2755@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.