All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Cc: kernel test robot <lkp@intel.com>,
	oe-kbuild-all@lists.linux.dev,
	Catalin Marinas <catalin.marinas@arm.com>,
	Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
	Sudeep Holla <sudeep.holla@kernel.org>
Subject: Re: [linux-next:master 8264/14724] drivers/firmware/smccc/smccc.c:141:1: error: r7 cannot be used in asm here
Date: Fri, 9 Oct 2026 10:42:07 -0300	[thread overview]
Message-ID: <20261009134207.GC13920@nvidia.com> (raw)
In-Reply-To: <yq5a8q49522f.fsf@kernel.org>

On Wed, Oct 07, 2026 at 02:18:08PM +0530, Aneesh Kumar K.V wrote:
> @@ -640,6 +640,39 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
>  			*___res = (typeof(*___res)){r0, r1, r2, r3};	\
>  	} while (0)
>  
> +#if defined(CONFIG_ARM) && defined(CONFIG_THUMB2_KERNEL)
> +/*
> + * GCC may reserve r7 in Thumb-2 functions. Calls with eight inputs must
> + * therefore use the assembly helpers, which save and restore r7 themselves.
> + */
> +#define __arm_smccc_1_1_out_of_line(fn, inst, a0, a1, a2, a3, a4, a5, a6, a7, res) \
> +	do {\
> +		struct arm_smccc_res __res;\
> +		struct arm_smccc_res *__res_ptr = (res);\
> +\
> +		fn((u32)(a0), a1, a2, a3, a4, a5, a6, a7,\
> +		   __res_ptr ? __res_ptr : &__res);\
> +	} while (0)
> +
> +#define __arm_smccc_1_1_inline(fn, inst, ...) \
> +	__arm_smccc_1_1(inst, __VA_ARGS__)
> +
> +#define __arm_smccc_1_1_call_2 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_3 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_4 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_5 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_6 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_7 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_8 __arm_smccc_1_1_inline
> +#define __arm_smccc_1_1_call_9 __arm_smccc_1_1_out_of_line
> +
> +#define __arm_smccc_1_1_call(fn, inst, ...) \
> +	CONCATENATE(__arm_smccc_1_1_call_, COUNT_ARGS(__VA_ARGS__))(fn, inst, __VA_ARGS__)
> +#else
> +#define __arm_smccc_1_1_call(fn, inst, ...) \
> +	__arm_smccc_1_1(inst, __VA_ARGS__)
> +#endif

I wonder if this could just be something simpler like

#define __arm_smccc_1_1_call(fn, inst, ...)                       \
	({                                                        \
		if (COUNT_ARGS(__VA_ARGS__) >= 7 &&               \
		    IS_ENABLED(CONFIG_THUMB2_KERNEL))             \
			__arm_smccc_1_1_call_(inst, __VA_ARGS__); \
		else                                              \
			__arm_smccc_1_1(inst, __VA_ARGS__);       \
	})

? (still needs to take care of the NULL res)

Jason

  parent reply	other threads:[~2026-10-09 13:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 22:25 [linux-next:master 8264/14724] drivers/firmware/smccc/smccc.c:141:1: error: r7 cannot be used in asm here kernel test robot
2026-10-07  6:58 ` Aneesh Kumar K.V
2026-10-07  8:44   ` Sudeep Holla
2026-10-07  9:10     ` Catalin Marinas
2026-10-07  9:18       ` Sudeep Holla
2026-10-07 10:19         ` Catalin Marinas
2026-10-07 10:25           ` Sudeep Holla
2026-10-07  9:46       ` Aneesh Kumar K.V
2026-10-07  9:39     ` Aneesh Kumar K.V
2026-10-07  9:47       ` Sudeep Holla
2026-10-07  8:48   ` Aneesh Kumar K.V
2026-10-07  9:51     ` Aneesh Kumar K.V
2026-10-09 13:42     ` Jason Gunthorpe [this message]
2026-10-10  9:57       ` Aneesh Kumar K.V

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=20261009134207.GC13920@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sudeep.holla@kernel.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.