Received: by 10.223.176.5 with SMTP id f5csp2692114wra; Thu, 1 Feb 2018 04:40:59 -0800 (PST) X-Google-Smtp-Source: AH8x225yfzs2k7BktIWwbHgs20LVeu7N78ojjInxn30r+UbEVLVPGU8XeEVd2Iru0XrHJMVhxAvR X-Received: by 10.99.95.193 with SMTP id t184mr28985520pgb.189.1517488859203; Thu, 01 Feb 2018 04:40:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517488859; cv=none; d=google.com; s=arc-20160816; b=MCx//fSJNF7adcz00hHi11VY1EryPai0cDA4HSTsLpcCYvC8rvQOP9KC5u8QXnL4Zr CNsrpJJuH188u9udqJLTUOclxRcefxznbh7BmjTirBbb9MHJE/fJrdvKf4ssfygCnqFy EocROC7GplELmfkPmar587KMoBB5x1txjYsr8UASRG7JAVYlI3zBf7VrroDYHY0m4K8b SYl7HoWyOlSuMhy/zydhysV2ItDXVTW2nA5UCs91WTAoRze48uiOE40NYof351mmEkim 0HhzE9ZrMg1WB7TL7yCBboPhT2bE62U+9YkPuAtujDIhfbWGHIk2WXRmqOfAwFL7QuKR RxBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=ErDc/h1irvKbHuCTUKhpznSN4cUXyb/eZSGcD8P/nkc=; b=yBA+swcpKYsJEe1Auqfsa3nbSXbgJAO0QuLmQGhjdKYIXYOXczvEbC9RlUO2tUwBrT eRvOLMSE+JGpUGxZT6EqGaM+ew5eWLI8h0sNYDHgGrdIn7hH77aoMMLDfirVOUCuuE7z Fa4fJUGQN3CxxQAE0Z2pwvPyCthRHWPuHKuR7SuTPtY8AcuzwYhvVDPfzVnraW0vb+wV h8RAKIuHHDpHHzxHHvJOnMOn14/iZXxVX592ZdjXSIDisCtMI5qSt3I4Tfb3T7CN1VB8 +79qDzCGedL5HK+rk1hWgoRZape4F4RytHVXMt0qPDwlvCzaqHzi1OINpNAGSUmvCIW0 A/MQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t22-v6si4260411plo.256.2018.02.01.04.40.43; Thu, 01 Feb 2018 04:40:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752497AbeBAMkT (ORCPT + 99 others); Thu, 1 Feb 2018 07:40:19 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49556 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbeBAMkS (ORCPT ); Thu, 1 Feb 2018 07:40:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 618A180D; Thu, 1 Feb 2018 04:40:18 -0800 (PST) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B01963F25C; Thu, 1 Feb 2018 04:40:15 -0800 (PST) Subject: Re: [PATCH v3 15/18] arm/arm64: smccc: Make function identifiers an unsigned quantity To: Marc Zyngier , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Catalin Marinas , Will Deacon , Peter Maydell , Christoffer Dall , Lorenzo Pieralisi , Mark Rutland , Ard Biesheuvel , Andrew Jones , Hanjun Guo , Jayachandran C , Jon Masters , Russell King - ARM Linux References: <20180201114657.7323-1-marc.zyngier@arm.com> <20180201114657.7323-16-marc.zyngier@arm.com> From: Robin Murphy Message-ID: <1c07ecaa-0a60-284d-1b85-0b4ea4522c48@arm.com> Date: Thu, 1 Feb 2018 12:40:14 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180201114657.7323-16-marc.zyngier@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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 >