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

Re: [PATCH 08/12] xen/arm: ffa: Fix FFA_FEATURES validation


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 11 Feb 2026 14:31:35 +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=linaro.org 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=m+Gm0E3xfIwuIDuCNEAkeNWHgxwHcDpYnywo0MUdgyw=; b=K73O+IMy4xQ2lyFvQAVbRsje3++2ry+ClPHXjU0ifOHEsb3tl891Ffjlvx0twqTYzgJee8pc833ZfRkw2cAh6cC9pvkhQ4vuIzZ6l8MSIvZyfuDEeBTYjjGOgk80W8lHLFb4nyMQGdiVEZ79mSV7z4FyNBNDcLdQF3BV9WmBG9rFZ0eRT/5fTp2y19nnX83aRGJKPSI7phtHvL7g6+dSGKNORJWlXpJDev5HWgIdE51ew4owuVzxB8FaDfSD+vrlwNT4N728sU5v5rpONa0ifIm79DgWAx4lyG8pGB/sfb+l3v52JLCN2+BZiqkRoHffIqtQlZQPM7Pv0x6zh9yy7Q==
  • 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=m+Gm0E3xfIwuIDuCNEAkeNWHgxwHcDpYnywo0MUdgyw=; b=uCxUXZ6Zw1OSyRsyTuLJzTkKk3Q5L63h36Ouf3r9tJ7ob4Iv7j/mMgd4cBShrxEt132h/zw4BKNYXXxaYeuI5xJH9wdm9QrYp3rHLygF/KRVu8shrQQE/W/1IwMoztvmfoEKdtpc8TZkZRy1sFUYzUdA4gUD+SWYkuEKlHnAkOiB6MJL6u6xCNnqT3TUH3J5x0HS3RL/UloKnkQYAWO0UVtG2sIs9z0v0TemII7Nez6sNVl0WixLAnwerHk4O7O+bPDJw59U5B6GFKHIF9DCXdBrZSIId0ppZSbNOFXNnC6vPgDRYdJCpWhoq85W9Bkt3UrrYaBuKhI7ppRDQnRN5A==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=yC269XZvyLirI2rn9kptghdSRClK8XjNA8Q2yKuBPKOJXMAxQ6lbQUg5zZ9fj1pJLiXRbbeaC3AXvYSCcW8OlcqydxC+Wk/HX2OWRA6XyEOCtxNOwuwSrx5U3aGjoHWRmePNCJvLj6qx4H3b3SLxOORwLp2RSJzP1y5i9dmiOCxm4muRBzgg2qKejH0xhnwsmNPQGPEZy9OqiNamg1YK++4dMBM+bfO6iXnfH4WS+YbZgCK68n66mG853bW7M6pYzv0877MUV8hObnnciLq9hVOXh2Yflxc2S8nwVPBz/H7BzYe4j6N+cg73sZAPa6svpN5zN9DkzRvLRGWw0sDcOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PFSklOX9jxXz0mI5e1LrhsePg6bsVrJ3YA7Un3NYVNf4bULZ4MuXucliFkiVPO2CwFy0Us58trDGAYdnLZbTvoOoZ8soHaLQ9vcOKGPgwlEjbviVm7sKuM0MW6GiKji1v0/V3BDqOjRDdYxEiZ2Vg2J/LR/vvHw0lHPHjO41yqUDiF2umWBso4LqhQbyqJsGnl0ZSWKlq8LAkYhkLcOTVOev8/j2suVqQYPRZitmv+KOJCmA7Trus1bO5DCt7b8tvFbSHBycwNM4t1m5P3Ifh+I+LdTaRS76uDExmI718TE6NZBlQCcpVaUCaZ/E21d547IAYMFmivGbwRQPhQ38eQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 11 Feb 2026 14:32:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHclTQCVYzQoM1PdEyfckgwmOVEyLV9M2UAgAA0pYCAACPHAIAAD/qA
  • Thread-topic: [PATCH 08/12] xen/arm: ffa: Fix FFA_FEATURES validation

Hi Jens,

> On 11 Feb 2026, at 14:34, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Hi Bertrand,
> 
> On Wed, Feb 11, 2026 at 12:27 PM Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx> wrote:
>> 
>> Hi Jens,
>> 
>>> On 11 Feb 2026, at 09:17, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
>>> 
>>> Hi Bertrand,
>>> 
>>> On Tue, Feb 3, 2026 at 6:38 PM Bertrand Marquis
>>> <bertrand.marquis@xxxxxxx> wrote:
>>>> 
>>>> FFA_FEATURES currently accepts non-zero input properties (w2-w7) from
>>>> guests and advertises several ABIs unconditionally, even when firmware
>>>> support is missing or when the ABI is physical-instance-only. This can
>>>> mislead guests about what Xen can actually provide and violates FF-A
>>>> calling conventions. Some SPMCs (Hafnium v2.14 or earlier) also fail to
>>>> report FFA_RX_ACQUIRE despite supporting it.
>>>> 
>>>> Update FFA_FEATURES validation to match spec and firmware support:
>>>> - reject non-zero w2-w7 input properties with INVALID_PARAMETERS
>>>> - reject 64-bit calling conventions from 32-bit guests with NOT_SUPPORTED
>>>> - return NOT_SUPPORTED for physical-instance-only ABIs
>>>> (FFA_NOTIFICATION_BITMAP_{CREATE,DESTROY}, FFA_RX_ACQUIRE)
>>>> - advertise FFA_INTERRUPT as supported
>>>> - gate message ABIs on firmware support:
>>>> - FFA_MSG_SEND_DIRECT_REQ_{32,64}
>>>> - FFA_MSG_SEND_DIRECT_REQ2 (also requires FF-A 1.2 negotiation)
>>>> - FFA_MSG_SEND2 (or VM-to-VM enabled)
>>>> - report MEM_SHARE_{32,64} only when FFA_MEM_SHARE_64 is supported
>>>> - stop advertising FFA_MSG_YIELD (not implemented)
>>>> 
>>>> Update firmware probing: drop FFA_MEM_SHARE_32 checks (deprecated) and
>>>> add FFA_RX_ACQUIRE to the probed set. If FFA_MSG_SEND2 is reported but
>>>> FFA_RX_ACQUIRE is not, assume RX_ACQUIRE support and warn to work
>>>> around the Hafnium bug.
>>>> 
>>>> Functional impact: guests now see ABI support that reflects firmware
>>>> capabilities and Xen implementation status. When SEND2 is present but
>>>> RX_ACQUIRE is not reported, Xen assumes RX_ACQUIRE support.
>>>> 
>>>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>>>> ---
>>>> xen/arch/arm/tee/ffa.c | 62 +++++++++++++++++++++++++++++++++++++-----
>>>> 1 file changed, 55 insertions(+), 7 deletions(-)
>>>> 
>>>> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
>>>> index 6de2b9f8ac8e..e9e020bb0cb3 100644
>>>> --- a/xen/arch/arm/tee/ffa.c
>>>> +++ b/xen/arch/arm/tee/ffa.c
>>>> @@ -91,10 +91,10 @@ static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
>>>>    FW_ABI(FFA_PARTITION_INFO_GET),
>>>>    FW_ABI(FFA_NOTIFICATION_INFO_GET_64),
>>>>    FW_ABI(FFA_NOTIFICATION_GET),
>>>> +    FW_ABI(FFA_RX_ACQUIRE),
>>>>    FW_ABI(FFA_RX_RELEASE),
>>>>    FW_ABI(FFA_RXTX_MAP_64),
>>>>    FW_ABI(FFA_RXTX_UNMAP),
>>>> -    FW_ABI(FFA_MEM_SHARE_32),
>>>>    FW_ABI(FFA_MEM_SHARE_64),
>>>>    FW_ABI(FFA_MEM_RECLAIM),
>>>>    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
>>>> @@ -240,19 +240,39 @@ static void handle_features(struct cpu_user_regs 
>>>> *regs)
>>>>    struct ffa_ctx *ctx = d->arch.tee;
>>>>    unsigned int n;
>>>> 
>>>> +    /*
>>>> +     * Xen does not accept any non-zero FFA_FEATURES input properties from
>>>> +     * VMs. The spec only defines w2 input properties for 
>>>> FFA_MEM_RETRIEVE_REQ
>>>> +     * (NS-bit negotiation for SP/SPMC) and FFA_RXTX_MAP (buffer size and
>>>> +     * alignment), so w2 must be MBZ for our callers.
>>>> +     */
>>> 
>>> The spec (version 1.2) lists them as SBZ, except for w2, which is MBZ,
>>> for Feature IDs.
>> 
>> Very true, this should only check w2 which is anyway defined as MBZ when
>> not used.
>> w3-w7 were MBZ in previous versions of FF-A but are in fact SBZ in 1.2 so
>> we should ignore them
>> 
>>> However, if we're to return an error, invalid parameters is a better choice.
>> 
>> In fact the spec is actually saying the following:
>> If the FF-A interface or feature that was queried is not implemented or 
>> invalid,
>> the callee completes this call with an invocation of the FFA_ERROR interface
>> with the NOT_SUPPORTED error code.
>> 
>> So there is no case for INVALID_PARAMETER.
> 
> You're right.
> 
>> 
>> So in fact i should:
>> - return NOT_SUPPORTED if w2 is not 0
>> - ignore w3-w7
>> 
>> Can you confirm that you have the same reading of the spec than me ?
> 
> The 1.2 spec only says this w2 is MBZ for Feature IDs, and that w2 is
> SBZ for FFA_RXTX_MAP. The 1.3 spec says the same, except that in Table
> 13.14: Feature IDs and properties table, it lists w2 as SBZ.
> 
> Note that FFA_MEM_RETRIEVE_REQ has bits defined in w2, and the unknown
> bits are SBZ.
> 
> Based on that, I'm inclined to keep it simple and ignore w2-w7.

That would make sense, I agree.
I will check why FF-A ACS was failing when i did not have this and if it still 
the case
and come back to you if ignoring is not acceptable (with a reason).

Cheers
Bertrand


 


Rackspace

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