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

Re: [PATCH] xen/arm: smccc: Preserve argument types in v1.1 SMC


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 24 Feb 2026 10:10:32 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=aIwRK5E90pY6ZFVP6iSXQ1JpCUqaEvUscBz2B+kHKNQ=; b=n4sqQkVMyNwzhkZ2eFUcMZREBUUm/xJAnid67GBS3G5de2oUuyPo9y80pRADxTwAtbkxv0UcP1LKBZQU+02dvjf34Pi6Sh1CyB/+VG4QpCJeYOlctx5DEMPjBrDVNTbUMhLh/RyZZ1yn9YZ8hKaFm/egspdyHvqIEPjOQk2ApfRNrYQ9jXiQFVGjIDNd8oXbv4bTQ+G4EpirZMeIcJf+OY1i5seUnIGR6TOhcd2bJkmDQR/kBltyFF9jZFCbeUBoZoJy0Ga37pYLzVZfUUCLTaLklUh3DSorl84rjFU3H0/VjKE4ryK/5P+20he0RJ3Y1xDb2SMmMbEWfQbLk/s3eA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eYp7OPJ7IAgZZLABcYKpguXUZvkbn6bsu6WLPxbaNP8sM8asy9ZI5RltTMUFQIUdwI1MGAiw/0MIZZ2cTY11feI0I84KRXeq9Igu0U6rA/To8L6tA4r8uCA35tEScUUHlNGaoLoqs6NsZfCJzEfl3HXocEngjKl0Mypn5npRUNP5J7/WoDgcVkyDY8OsdEEITgQ8BXXYun++Vb/a8bVT8xM1m9aQjpO5bV4noli1/APVQuIohYpcMmWdlS0+RbaJhFyKptfzXSxqjpPSVCM3vdmGfjLItc3vHhxqsPymTjZs5Qo7ERefjMgfkIsXieQntXthiEuFPH8U8wUB/JyAlw==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 24 Feb 2026 09:10:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16/02/2026 08:47, Bertrand Marquis wrote:
> The SMCCC v1.1 inline helper currently forces a1-a4 into
> unsigned long and uses in/out constraints for r0-r3. In
> contrast, a5-a7 are passed with their original types via
> read-only constraints. On arm64 this means a 32-bit signed
> value in a1-a4 is converted to a 64-bit unsigned value, while
> the same value in a5-a7 keeps its signed 32-bit form. For
> example, a negative int in a2 is widened to unsigned long, but
> a negative int in a5 is passed as a 32-bit signed value, so the
> SMC sees different encodings depending on argument position.
> 
> Switch the helper to use typed input registers arg0-arg7
> derived from the call arguments (keeping a0 cast to u32) and
> separate output registers r0-r3. This preserves argument types
> consistently across all positions. Argument evaluation order
> is unchanged, so we do not reintroduce the issue fixed in
> "e00dc325bd9e" ("xen/arm: smccc-1.1: Handle function result as
> parameters").
> 
> This also aligns Xen's SMCCC parameter handling with Linux's type-
> preserving behavior (same externally visible argument handling,
> independent implementation) to avoid surprising differences
> between a1-a4 and a5-a7.
> 
> Current callers (PSCI, SCMI, platform SMC pass-through, OP-TEE,
> and exynos5) pass unsigned values; exynos5 passes an int CPU id
> which should always be > 0.
> 
> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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