[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] xen/arm: vpsci: ignore upper 32 bits for SMC32 PSCI arguments


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 15 Apr 2026 12:29:51 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=suse.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a0acH5JpKmQYar14t/VnmlFLxigNyXg6z3yS5uUK+ws=; b=uFJT0LkW5Y8VCa/wj7zrNCicjEs6BP1gwWiPhQTj8FA39KIsuGQRjbqM1wg+Qy6yAanpTr8QfQxtmNK7qCWQrCdq2aO8osa21MHVOiTkO3+0ohuN6XB1R0/6nHlW3KtEPhmUucY65O1zLfqSw9PE6rpX/6C0B+ZXGZzyUQIA14LphBkYlOVjChq5sOFH58mFCd+OtmJv6rBgdfRVoBti4wSy5ECUVdpoRpQ0D6P8UWSGrSXlAhc633FQK0SPTJX5hvI1VV4gXkf82/Y2I0lQ42SZ21QZfQBN1nx7CAmvSMKPNkvlJjdzz1UHoUQsKDWUYVNb57b2bk4iGz8X6eIQ8A==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a0acH5JpKmQYar14t/VnmlFLxigNyXg6z3yS5uUK+ws=; b=IO1VJCsrjqgS/zUv9D5S8+nyYo7dzuNj0zXE9pGO4J7ltKbKPBwvI/ooAaYCl7gmE9R3DweAIn60PZVYps7UWGyyHKI0t/o7R/h5ceLylg7OKOJ307cWqlCHtPHjXK8l0amkfDmEEkGiBf0fiqvi/HjbR6BSu7MCNgwkKlYkY12eAsAD6vMczEYCMDrZp9WcFA5GYgTfz8yk/mACPNYV6uHuj/mqPjrcZr5vh767488NDWGRvkNJS+dygksefvSViPanSn71KdeaOXbui2G1d7xhYL7pb3C6oqNnuofHX2g7HSdVU7/hlQsw1GhU7x4QjNCJv9RWv3yi2SJ2std2xA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=pwnI9bgmt7ilD7OtBw6I3bNxeMW0iJNQjyZcwtqCRq10Hom8SskCAoDGPoKcYdgwnxlfrsiXEO/eog8EOrZeZ9034dbuPyLr9/YqwQLGn9rRuInIQUl+exyO+qytatkMKQxD67VTntjcT4cimWfEpPSfI5UOC6a9Qe/jvJsVv7tPFvlU6lYWfmKsJFtLhgL/N46QDt0AvUJs+mYwE1pvrwldpP36tWLylBtzQjPYmRJV7y4HSwOwVfsRMOCAY91hDPY1UFNdedTEAkXzE22F1pCEC/XAfgaStr/JdGGEUFAUViuY6uKJ7NiuMYguUTOKJKtbBTdf1bPI3rrUfiLpUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BmJoT1hU4CMKp9OX8OTtjm9YNGIveOwjuxWiBz6f+zkWc5TGVnZoHGCzgfZ5xuC4onPqyajwXntdg5aKHbbrZT3PdE10T2JJXXldqcYpyE9WaL9ntG1WyUyeu2VuA/5GpAcJAIvNaEDEZ9U0yTKwkolBwG6g1amN0pbVFkOoHP2RgsxIziTDfAXRnrwYzg8VqWZt8Pn4TwzJE7MHpbGnTKeUQ0YWNYrJrlYChCjdHa9bhZIpE8bp/CdILwA+5WnkoSNiFGSXOKnop4Dnr2ARHx+Z3ezL5iOX0pJhbb4KJBicRTnpLOGX1RhkOavuhAbOV7oJx+iwOoEeLVlwGrkyTg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Mykola Kvach <xakep.amatop@xxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 15 Apr 2026 12:31:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHcwTztA0BB9cGvO0qBEZxru/k/mbXJvzqAgAAMSgCAABEHgIAACdaAgAAJKoCAAAgSAIAAKwOAgBYB9QA=
  • Thread-topic: [PATCH v3] xen/arm: vpsci: ignore upper 32 bits for SMC32 PSCI arguments

Hi Jan and Mykola,

> On 1 Apr 2026, at 14:24, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 01.04.2026 11:51, Mykola Kvach wrote:
>> On Wed, Apr 1, 2026 at 12:22 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> On 01.04.2026 10:49, Mykola Kvach wrote:
>>>> On Wed, Apr 1, 2026 at 11:14 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>>> On 01.04.2026 09:13, Mykola Kvach wrote:
>>>>>> On Wed, Apr 1, 2026 at 9:29 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>>>>> On 31.03.2026 20:31, Mykola Kvach wrote:
>>>>>>>> From: Mykola Kvach <mykola_kvach@xxxxxxxx>
>>>>>>>> 
>>>>>>>> SMCCC DEN0028G, section 3.1, states that for AArch64 SMC/HVC calls
>>>>>>>> using Wn, only the least significant 32 bits are significant and the
>>>>>>>> upper 32 bits must be ignored by the implementation.
>>>>>>>> 
>>>>>>>> So for SMC32 PSCI calls, Xen must not treat non-zero upper bits in the
>>>>>>>> argument registers as an error. Instead, they should be discarded when
>>>>>>>> decoding the arguments.
>>>>>>>> 
>>>>>>>> Arm ARM DDI 0487J.a (D1-5406) also notes that the upper 32 bits may be
>>>>>>>> implementation defined when entering from AArch32. Xen zeros them on
>>>>>>>> entry, but that guarantee is only relevant for 32-bit domains.
>>>>>>>> 
>>>>>>>> Update PSCI v0.2+ CPU_ON, CPU_SUSPEND, AFFINITY_INFO and SYSTEM_SUSPEND
>>>>>>>> to read SMC32 arguments via PSCI_ARG32(), while keeping the SMC64
>>>>>>>> handling unchanged.
>>>>>>>> 
>>>>>>>> No functional change is intended for PSCI 0.1.
>>>>>>>> 
>>>>>>>> Suggested-by: Julien Grall <julien@xxxxxxx>
>>>>>>>> Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
>>>>>>>> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>>>>>>> 
>>>>>>> I thought I might as well include this in my next commit sweep, but 
>>>>>>> isn't
>>>>>>> this R-b being invalidated by ...
>>>>>>> 
>>>>>>>> ---
>>>>>>>> v3:
>>>>>>>> - use PSCI_ARG_CONV for SYSTEM_SUSPEND
>>>>>>> 
>>>>>>> ... this change. That's ...
>>>>>>> 
>>>>>>>> @@ -422,14 +427,8 @@ bool do_vpsci_0_2_call(struct cpu_user_regs 
>>>>>>>> *regs, uint32_t fid)
>>>>>>>>     case PSCI_1_0_FN32_SYSTEM_SUSPEND:
>>>>>>>>     case PSCI_1_0_FN64_SYSTEM_SUSPEND:
>>>>>>>>     {
>>>>>>>> -        register_t epoint = PSCI_ARG(regs, 1);
>>>>>>>> -        register_t cid = PSCI_ARG(regs, 2);
>>>>>>>> -
>>>>>>>> -        if ( fid == PSCI_1_0_FN32_SYSTEM_SUSPEND )
>>>>>>>> -        {
>>>>>>>> -            epoint &= GENMASK(31, 0);
>>>>>>>> -            cid &= GENMASK(31, 0);
>>>>>>>> -        }
>>>>>>>> +        register_t epoint = PSCI_ARG_CONV(regs, 1, is_conv_64);
>>>>>>>> +        register_t cid = PSCI_ARG_CONV(regs, 2, is_conv_64);
>>>>>>>> 
>>>>>>>>         perfc_incr(vpsci_system_suspend);
>>>>>>>>         PSCI_SET_RESULT(regs, do_psci_1_0_system_suspend(epoint, cid));
>>>>>>> 
>>>>>>> ... this hunk aiui, which is far from merely cosmetic imo. While
>>>>>> 
>>>>>> Nobody said that the change had to be purely cosmetic in order to keep
>>>>>> the tag. I understood it differently from the official Xen
>>>>>> documentation pages.
>>>>>> 
>>>>>>> behavior looks to remain the same for PSCI_1_0_FN32_SYSTEM_SUSPEND, it
>>>>>> 
>>>>>> Exactly. If the changes are not substantial, I do not see a reason to
>>>>>> drop the tag ...
>>>>>> 
>>>>>>> clearly changes for PSCI_1_0_FN64_SYSTEM_SUSPEND. That may be intended
>>>>>>> and for the better, but the change clearly wasn't reviewed by Bertrand,
>>>>>>> nor - when offering the R-b - did he ask for this extra change.
>>>>>> 
>>>>>> ... and this is also how I understood the Xen patch submission
>>>>>> guidelines [1], which say:
>>>>>> 
>>>>>> "Note that if there are several revisions of a patch, you ought to
>>>>>> copy tags that have accumulated during the review. For example, if
>>>>>> person A and person B added a Reviewed-by: tag to v1 of your patch,
>>>>>> include it into v2 of your patch. If you make substantial changes
>>>>>> after certain tags were already applied, you will want to consider
>>>>>> which ones are no longer applicable (and may require re-providing)."
>>>>>> 
>>>>>> So my understanding was that tags should normally be kept across
>>>>>> revisions, unless the changes are substantial enough to make them no
>>>>>> longer applicable.
>>>>> 
>>>>> Maybe our understanding of "substantial" differs. To me that's anything
>>>>> changing functionality. Style adjustments, typo corrections, and alike
>>>>> generally aren't substantial (albeit even then there may be exceptions).
>>>> 
>>>> Thanks for clarifying what you consider substantial.
>>>> 
>>>> Even under that interpretation, I do not see a functionality change
>>>> here. "Refactoring" seems like the more accurate term in this case:
>>>> the internal form changes, but the intended external behavior does
>>>> not.
>>>> 
>>>> It may be that we are using "functional change" in slightly different
>>>> senses here.
>>>> 
>>>> For v3, the switch to PSCI_ARG_CONV() in SYSTEM_SUSPEND was meant to
>>>> make this case consistent with the helper-based argument decoding used
>>>> elsewhere, not to change behavior.
>>>> 
>>>> In particular, I do not see a functional change for
>>>> PSCI_1_0_FN64_SYSTEM_SUSPEND: v2 used PSCI_ARG(regs, 1/2), and in v3
>>>> PSCI_ARG_CONV(regs, 1/2, is_conv_64) should resolve to the same thing
>>>> when is_conv_64 is true.
>>> 
>>> Isn't the whole point of the patch to alter behavior when is_conv_64 is
>>> false? For that case PSCI_1_0_FN64_SYSTEM_SUSPEND behavior looks to
>>> change in v3, when it didn't in v2. Whereas for
>>> PSCI_1_0_FN32_SYSTEM_SUSPEND the v3 change indeed only eliminates open-
>>> coding, which one may or may not regard as "substantial".
>> 
>> I think the point I was trying to make is slightly narrower: in this
>> code path, is_conv_64 is derived directly from fid via
>> smccc_is_conv_64(fid) before the switch (fid).
>> 
>> So for PSCI_1_0_FN64_SYSTEM_SUSPEND, I do not see how
>> is_conv_64 == false could arise here: if we are in the FN64 case,
>> the function ID already encodes the 64-bit convention.
>> 
>> Conversely, if is_conv_64 is false here, then this cannot be the
>> FN64 case.
> 
> Ah, I see. To figure that out, I would have had to do a proper review. I
> was after committing only, which ought to be an entirely mechanical step.
> 
>> On that basis, I do not see a behavioral change for the FN64
>> SYSTEM_SUSPEND case in v3.
> 
> I agree (now). I'm still not going to pick up that patch, but rather
> leave it to the Arm maintainers. While not as clear cut as it first
> seemed to me, I still consider it within the grey area.

Sorry for the delay, this felt through in my filters as it was reviewed-by 
already.

I am ok with the changes done which make sense (mask is now done
directly).

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> 
> Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.