From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Richard Gong <richard.gong@linux.intel.com>,
Arnd Bergmann <arnd@arndb.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dinh Nguyen <dinguyen@kernel.org>,
kbuild-all@lists.01.org,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
kernel test robot <lkp@intel.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Jens Wiklander <jens.wiklander@linaro.org>
Subject: Re: [PATCH] firmware: stratix10-svc: build only on 64-bit ARM
Date: Mon, 22 Mar 2021 13:41:18 +0100 [thread overview]
Message-ID: <5c4ede72-b937-586b-78d7-1f6770c23b09@canonical.com> (raw)
In-Reply-To: <26fe4358-4ebd-7346-8944-13b13da75c6f@linux.intel.com>
On 22/03/2021 13:58, Richard Gong wrote:
>
>
> On 3/22/21 3:26 AM, Krzysztof Kozlowski wrote:
>>
>> On 21/03/2021 22:09, Arnd Bergmann wrote:
>>> On Sun, Mar 21, 2021 at 7:46 PM Krzysztof Kozlowski
>>> <krzysztof.kozlowski@canonical.com> wrote:
>>>>
>>>> The Stratix10 service layer and RCU drivers are useful only on
>>>> Stratix10, so on ARMv8. Compile testing the RCU driver on 32-bit ARM
>>>> fails:
>>>>
>>>> drivers/firmware/stratix10-rsu.c: In function 'rsu_status_callback':
>>>> include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_179'
>>>> declared with attribute error: FIELD_GET: type of reg too small for mask
>>>> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>>> ...
>>>> drivers/firmware/stratix10-rsu.c:96:26: note: in expansion of macro 'FIELD_GET'
>>>> priv->status.version = FIELD_GET(RSU_VERSION_MASK,
>>>>
>>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>
>>> While I agree that one shouldn't run 32-bit kernels on this, we should also try
>>> to write drivers portably, and in theory any SoC that can run a 64-bit
>>> Arm kernel
>>> should also be able to run a 32-bit kernel if you include the same drivers.
>>>
>>> It seems that the problem here is in the smccc definition
>>>
>>> struct arm_smccc_res {
>>> unsigned long a0;
>>> unsigned long a1;
>>> unsigned long a2;
>>> unsigned long a3;
>>> };
>>>
>>> so the result of
>>>
>>> #define RSU_VERSION_MASK GENMASK_ULL(63, 32)
>>> priv->status.version = FIELD_GET(RSU_VERSION_MASK, res->a2);
>>>
>>> tries to access bits that are just not returned by the firmware here,
>>> which indicates that it probably won't work in this case.
>>>
>>> What I'm not entirely sure about is whether this is a problem in
>>> the Intel firmware implementation requiring the smccc caller to
>>> run in a 64-bit context, or if it's a mistake in the way the driver
>>> extracts the information if the firmware can actually pass it down
>>> correctly.
>>
>> The SMC has two calling conventions - SMC32/HVC32 and SMC64/HVC64. The
>> Stratix 10 driver uses the 64-bit calling convention (see
>> INTEL_SIP_SMC_FAST_CALL_VAL in
>> include/linux/firmware/intel/stratix10-smc.h), so it should not run in
>> aarch32 (regardless of type of hardware).
>>
>> I think that my patch limiting the support to 64-bit makes sense.
>>
>
> The stratix10 service layer and RSU driver are only used in Intel 64-bit
> SoCFPGA platforms.
This we know, however the questions were:
1. Why the driver cannot be made portable? Why it cannot be developed in
a way it allows building on different platforms?
2. Does the actual firmware support 32-bit SMC convention call?
Best regards,
Krzysztof
next prev parent reply other threads:[~2021-03-22 12:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-21 18:46 [PATCH] firmware: stratix10-svc: build only on 64-bit ARM Krzysztof Kozlowski
2021-03-21 21:09 ` Arnd Bergmann
2021-03-22 8:26 ` Krzysztof Kozlowski
2021-03-22 9:28 ` Arnd Bergmann
2021-03-22 12:58 ` Richard Gong
2021-03-22 12:41 ` Krzysztof Kozlowski [this message]
2021-03-22 15:29 ` Richard Gong
2021-03-24 20:33 ` Richard Gong
2021-04-01 15:13 Dinh Nguyen
2021-04-02 14:30 ` Greg KH
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=5c4ede72-b937-586b-78d7-1f6770c23b09@canonical.com \
--to=krzysztof.kozlowski@canonical.com \
--cc=arnd@arndb.de \
--cc=dinguyen@kernel.org \
--cc=jens.wiklander@linaro.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=richard.gong@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).