Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3516765pxf; Mon, 22 Mar 2021 08:13:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbUKxdk06Q4NeIiic8f+Fl9v4UX1GVaGPoaZi92D6B/L3IM+PPUAECgI5PYqfkqWJdfA2+ X-Received: by 2002:a17:906:1985:: with SMTP id g5mr208416ejd.285.1616425980442; Mon, 22 Mar 2021 08:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616425980; cv=none; d=google.com; s=arc-20160816; b=Dq0eTm4KGDR5Xj+37FZSjM05LIhqmy1B7DRhkB0DNG7+6D6TwGzGxlJeHeuzTVBpUx 7yEu5ZIVXR27CPcOWeZnUB5SgfBWilTMZ242F08N2kbJsQED0V8VE+mUtyth02+lBuGT 8vNVrXAAgKbJTfq3ZuDnP23kKumnWJQ8I3qKwfQjh+k8QI+mgw6LuK5YDyEVb07DrBLl xXjEu3D65aF+1KZVHA1qovW6uyp/TUNCbHm8CCVjdOcFYP+HogoiY4aFoSDtOQ1+4Cg6 7XbU6b0PV1cr/crZ2oBQAaIz+qFR1i8NHjf6V0eVk5A6uElYimlrY7NlSTdk3BGvTYI7 JEgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=h/uoCqhGVL5QARJnjmNKlGVYtjM+B0OBl9S5XPjQ/G0=; b=tT8XVyDWur/mpHzWLHfvnfWS/zX8ATglwlZn0bZ1hPzTcnp9zz5x9w//XIA+CG3Hza RDJSI+X3xAJZhdw33Xg8YJjrfy4OD3XlKPvTP2h12g3MoeawObMQ0UqJce3v5+P6X9Cc nODZ16p9CS22hHPr4TdtD8ND09W6zPEPGahH1o0wnWEBdGgCbigR93Hsnub0zRXWwuvE qMhVZx635GuzFfO6IQAwjDQ7cnLNKjbKXplHwlFwZHpQAQcGP6yrkC+d/VyXTsQMsrKw F94WeI6tAWLL2p8i8aDZQ7Ishc36aAlm51lwzTTNPZBIRc73ZdJ2HWFDX9ucFBGQbzxE 0m7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si11874473eju.430.2021.03.22.08.12.37; Mon, 22 Mar 2021 08:13:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231458AbhCVPJa (ORCPT + 99 others); Mon, 22 Mar 2021 11:09:30 -0400 Received: from mga07.intel.com ([134.134.136.100]:15234 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230056AbhCVPJW (ORCPT ); Mon, 22 Mar 2021 11:09:22 -0400 IronPort-SDR: RmCQUz1UvwoWLXOBe/pIk3i/gjpB/+T/Ru9+9kTeMFU8+m2R/nDT4P4E5d5eeU8n5J1wV4yRpk xgofuBB0yM9g== X-IronPort-AV: E=McAfee;i="6000,8403,9931"; a="254288287" X-IronPort-AV: E=Sophos;i="5.81,269,1610438400"; d="scan'208";a="254288287" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2021 08:09:21 -0700 IronPort-SDR: rYPX1yAniq4hVTdHu57nyKOja/Sm9o+/0Q5YMXq1wJrsKkf6tfa1OfsPVQHtMxLkbv0MJaoCC/ +PC7DUAcHxGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,269,1610438400"; d="scan'208";a="441213761" Received: from marshy.an.intel.com (HELO [10.122.105.143]) ([10.122.105.143]) by fmsmga002.fm.intel.com with ESMTP; 22 Mar 2021 08:09:20 -0700 Subject: Re: [PATCH] firmware: stratix10-svc: build only on 64-bit ARM To: Krzysztof Kozlowski , Arnd Bergmann Cc: Linux Kernel Mailing List , Dinh Nguyen , kbuild-all@lists.01.org, Linux ARM , kernel test robot , Lorenzo Pieralisi , Jens Wiklander References: <20210321184650.10926-1-krzysztof.kozlowski@canonical.com> <2ae8379f-c79f-3257-e54c-fa17c576e929@canonical.com> <26fe4358-4ebd-7346-8944-13b13da75c6f@linux.intel.com> <5c4ede72-b937-586b-78d7-1f6770c23b09@canonical.com> From: Richard Gong Message-ID: Date: Mon, 22 Mar 2021 10:29:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5c4ede72-b937-586b-78d7-1f6770c23b09@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/22/21 7:41 AM, Krzysztof Kozlowski wrote: > On 22/03/2021 13:58, Richard Gong wrote: >> >> >> On 3/22/21 3:26 AM, Krzysztof Kozlowski wrote: >>> >>> On 21/03/2021 22:09, Arnd Bergmann wrote: >>>> On Sun, Mar 21, 2021 at 7:46 PM Krzysztof Kozlowski >>>> wrote: >>>>> >>>>> The Stratix10 service layer and RCU drivers are useful only on >>>>> Stratix10, so on ARMv8. Compile testing the RCU driver on 32-bit ARM >>>>> fails: >>>>> >>>>> drivers/firmware/stratix10-rsu.c: In function 'rsu_status_callback': >>>>> include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_179' >>>>> declared with attribute error: FIELD_GET: type of reg too small for mask >>>>> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) >>>>> ... >>>>> drivers/firmware/stratix10-rsu.c:96:26: note: in expansion of macro 'FIELD_GET' >>>>> priv->status.version = FIELD_GET(RSU_VERSION_MASK, >>>>> >>>>> Signed-off-by: Krzysztof Kozlowski >>>>> Reported-by: kernel test robot >>>> >>>> While I agree that one shouldn't run 32-bit kernels on this, we should also try >>>> to write drivers portably, and in theory any SoC that can run a 64-bit >>>> Arm kernel >>>> should also be able to run a 32-bit kernel if you include the same drivers. >>>> >>>> It seems that the problem here is in the smccc definition >>>> >>>> struct arm_smccc_res { >>>> unsigned long a0; >>>> unsigned long a1; >>>> unsigned long a2; >>>> unsigned long a3; >>>> }; >>>> >>>> so the result of >>>> >>>> #define RSU_VERSION_MASK GENMASK_ULL(63, 32) >>>> priv->status.version = FIELD_GET(RSU_VERSION_MASK, res->a2); >>>> >>>> tries to access bits that are just not returned by the firmware here, >>>> which indicates that it probably won't work in this case. >>>> >>>> What I'm not entirely sure about is whether this is a problem in >>>> the Intel firmware implementation requiring the smccc caller to >>>> run in a 64-bit context, or if it's a mistake in the way the driver >>>> extracts the information if the firmware can actually pass it down >>>> correctly. >>> >>> The SMC has two calling conventions - SMC32/HVC32 and SMC64/HVC64. The >>> Stratix 10 driver uses the 64-bit calling convention (see >>> INTEL_SIP_SMC_FAST_CALL_VAL in >>> include/linux/firmware/intel/stratix10-smc.h), so it should not run in >>> aarch32 (regardless of type of hardware). >>> >>> I think that my patch limiting the support to 64-bit makes sense. >>> >> >> The stratix10 service layer and RSU driver are only used in Intel 64-bit >> SoCFPGA platforms. > > This we know, however the questions were: > 1. Why the driver cannot be made portable? Why it cannot be developed in > a way it allows building on different platforms? The drivers was originally developed for Intel Stratix10 SoCFPGA platform, which is ARM 64-bit architecture. The same drivers can be used for other Intel ARM 64-bit SoCFPGA platforms (Agilex, eASIC N5X as example), which have the same SDM architecture as Stratix10 has. SDM = Secure Device Manager So far Intel 32-bit SoCFPGA platform doesn't support SDM architecture. > 2. Does the actual firmware support 32-bit SMC convention call? No. > > Best regards, > Krzysztof > Regards, Richard