Received: by 10.223.176.5 with SMTP id f5csp2696750wra; Thu, 1 Feb 2018 04:45:58 -0800 (PST) X-Google-Smtp-Source: AH8x227FjNLL8oYnlo11Vv0clJk+KYRqCn/J6nbCgWNt9n5eOdCnX9e7ZegMae7XIlh2eaEcKjHB X-Received: by 2002:a17:902:7247:: with SMTP id c7-v6mr1018104pll.340.1517489158034; Thu, 01 Feb 2018 04:45:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489157; cv=none; d=google.com; s=arc-20160816; b=pyPSvY7hQCd2b4tZbbaL6O74ya2/uf0TkYs5Ly0hdDEUe/9fvHu/uIjKzuGABtNMIN QjVsHosCWtZGezsYNaFQ42g0xciJ1g70K5LoV7vRO998RFe8Aj0zsayv7gqfxBLCjAXp EV9D+7Rx4mCGluilrBmwbZujFSLzqOnR7my5zMSZC2yBHlA04WJ12EHjUlwMySJ0fc+R aWKhuMMApvbo1en50s5sTk8uH7OIM/t33kgqQHWaxjCgnja0grQo1MDU3bOMIUoGNrHJ 1l2qOQUpjWUIMiUDcyWwBpCh9gNzV1vcQUBz6GXEftRZ667rqWxnrwK/pzAPzOktUVfD IO3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=4EkMxWlCKxFhYJl6XRmhkmBwKBkL3VwYlnPTBQUMYQg=; b=1LIJNGgdDkXziJeKlpY5I9QU+Of40/UvThAAIPJkeJeAYk8dvmTaXZ5/13ySBPNHYo MO8Fu4CBi9nD64vYPYBLPclrF0dVPEkgY+zCTocmUujLL16v4w6canDr91DZEZpSgSPH 9aOPVL7IHni4EQlOh5ijWsr7aArzdxZ36rTlpQcelPNZgwy3W96Jc3Sz1X32Gir9e6bh TauK9rcu/UdUx5s7nMFiRYQOMVivBpKaAh+t601UuPZ+NMp+joCbhEmwJuY4O3MhP32L rS/pmW0FQQiqog80/sz+OjN8JXn/hxomir0Smz/W48Rhc/mUL3BzJp8FwaReCntwk3hh 0T5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWlItHRr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si806411pfh.0.2018.02.01.04.45.43; Thu, 01 Feb 2018 04:45:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWlItHRr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbeBAMoH (ORCPT + 99 others); Thu, 1 Feb 2018 07:44:07 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:33587 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752380AbeBAMoE (ORCPT ); Thu, 1 Feb 2018 07:44:04 -0500 Received: by mail-io0-f193.google.com with SMTP id n7so19037094iob.0 for ; Thu, 01 Feb 2018 04:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4EkMxWlCKxFhYJl6XRmhkmBwKBkL3VwYlnPTBQUMYQg=; b=TWlItHRrhnU4AGiX65t/hbdxmhq0b5KIXnbFaqbjKftSnLZXaOCPJWyzcVAmjf6gsb /tJ4uja1XagceJLW+w2Hd6BKciotpr2QClbHyBDP6IjlclRkDDsL4Gmuay2vxR1gkwVt Zb8FDsUXpLJA/ISN9Os3Pa9652JqEucK5A2OA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4EkMxWlCKxFhYJl6XRmhkmBwKBkL3VwYlnPTBQUMYQg=; b=gE6guL6qoxj91QdAXKBQO5qx8sx34VVnNiL7j0YC7xC7r764ljk6YHtm3LXdgZTuyL yHcDFhbNwnyHu7L2/8+cMI5lMXCJd2VzdEYVqtCs6hf3EY0DklYjfp3hmZGhcATFw/T2 zjdvV3ZY1zBu8ACQtO+j2Qd4+n9X2H5JP5bbSAGb8EzIkUVJgr2fWgKDas3pVUbkqxT9 Y7bCQ/ubGp2zevgMfSMfQZrch41yen1ejepfcSfqHg78SACvt9Egb2coVMy8ekKRt/v3 QOSc3tz2IuKdIJq4JFsBPreYR4O/eh4gxqaTkVubLenBaz5EZ/tYXmQCgnCztBFwS6NG pUjQ== X-Gm-Message-State: AKwxyteXBs2pLWkgVvqr3WqlkEuNjtcGp9wsjjmsI+JNAvDdUH/8rqNM zVSSh/8FBs4F5uXG1a+IGrsc3EGpxFuze6Q91vigTQ== X-Received: by 10.107.33.65 with SMTP id h62mr37076580ioh.104.1517489044063; Thu, 01 Feb 2018 04:44:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.112.13 with HTTP; Thu, 1 Feb 2018 04:44:03 -0800 (PST) In-Reply-To: <1c07ecaa-0a60-284d-1b85-0b4ea4522c48@arm.com> References: <20180201114657.7323-1-marc.zyngier@arm.com> <20180201114657.7323-16-marc.zyngier@arm.com> <1c07ecaa-0a60-284d-1b85-0b4ea4522c48@arm.com> From: Ard Biesheuvel Date: Thu, 1 Feb 2018 12:44:03 +0000 Message-ID: Subject: Re: [PATCH v3 15/18] arm/arm64: smccc: Make function identifiers an unsigned quantity To: Robin Murphy Cc: Marc Zyngier , Linux Kernel Mailing List , linux-arm-kernel , kvmarm , Catalin Marinas , Will Deacon , Peter Maydell , Christoffer Dall , Lorenzo Pieralisi , Mark Rutland , Andrew Jones , Hanjun Guo , Jayachandran C , Jon Masters , Russell King - ARM Linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1 February 2018 at 12:40, Robin Murphy wrote: > On 01/02/18 11:46, Marc Zyngier wrote: >> >> Function identifiers are a 32bit, unsigned quantity. But we never >> tell so to the compiler, resulting in the following: >> >> 4ac: b26187e0 mov x0, #0xffffffff80000001 >> >> We thus rely on the firmware narrowing it for us, which is not >> always a reasonable expectation. > > > I think technically it might be OK, since SMCCC states "A Function > Identifier is passed in register W0.", which implies that a conforming > implementation should also read w0, not x0, but it's certainly far easier to > be completely right than to justify being possibly wrong. > > Reviewed-by: Robin Murphy > In my case, the function identifier wasn't the issue, but the argument, which, for SMCCC_ARCH_FEATURES is also defined as uint32_t, but did end up being interpreted incorrectly by the SMCCCv1.1 implementation that is now upstream in ARM-TF > >> Cc: stable@vger.kernel.org >> Reported-by: Ard Biesheuvel >> Acked-by: Ard Biesheuvel >> Tested-by: Ard Biesheuvel >> Signed-off-by: Marc Zyngier >> --- >> include/linux/arm-smccc.h | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h >> index e1ef944ef1da..dd44d8458c04 100644 >> --- a/include/linux/arm-smccc.h >> +++ b/include/linux/arm-smccc.h >> @@ -14,14 +14,16 @@ >> #ifndef __LINUX_ARM_SMCCC_H >> #define __LINUX_ARM_SMCCC_H >> +#include >> + >> /* >> * This file provides common defines for ARM SMC Calling Convention as >> * specified in >> * http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html >> */ >> -#define ARM_SMCCC_STD_CALL 0 >> -#define ARM_SMCCC_FAST_CALL 1 >> +#define ARM_SMCCC_STD_CALL _AC(0,U) >> +#define ARM_SMCCC_FAST_CALL _AC(1,U) >> #define ARM_SMCCC_TYPE_SHIFT 31 >> #define ARM_SMCCC_SMC_32 0 >> >