Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4504844pxf; Tue, 30 Mar 2021 09:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiu2pJqUNByqcyhkxEryCiUD9vMhXxrhTffCKurk/mVg6TgaXx5ziNXTfNCHQa1S2CfJGh X-Received: by 2002:a05:6402:3593:: with SMTP id y19mr34525887edc.317.1617121183557; Tue, 30 Mar 2021 09:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617121183; cv=none; d=google.com; s=arc-20160816; b=SLr88Ehf+h5IDmzqA8RrBh4t8Tz5Bbl5lMSzIuep1JV/WI9I4k0Y1mMmAxDxul5tos jGP2BmHoHl8npFHtl70sa2jBUgcdZG0kROGS0W0totW4KjgIN9JNjOwzBH1CkLlodAvu 3luIAfMXwMUn+EV8Nb9lZiP1TbA/7qb+ndPpH5IbIVDLdsqhSsz/JlL6ibucpfh35MMt lAyt7f6sAhfndC859fKQ5WUS6SNR079wT3iCxRGj6MaYzSV4RJQRr8x4n1p4I0RjoBCM Ch3UjW0JClqtm1A89XtdW/hsUJfTIA2HzFWmlIrmKzI50mvkVKMvQwadR7E5xL/ubbWc nvTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2fI4VhHe8aki99no36i/27lg7qBg6asALWaTkAeQI+o=; b=UgoE4uBDZDzV/hcAUMllKTQaQhWxwtzjIDl94ZCH3Es8S7pa3f9sHnwij2iTU6WCHc tppeLz1ILMGSthNvJ7cRdE2npPHmZBYd0QS1r1pmVIcj0zmrMDoMXQ2u2keKpKsOhFK4 TSE9iTcijlDzv08GZtCZm1QoSbgyIwITJxoHokobEigupr0NeAI1J3SeGrmhnrfQEBdu 7etqLxzUtZ4hWXbjBTbcp6lUXaJ/YyRVrIcAIKWEnFiluOR0bLD5h6jjZqQYqEBRNs/k S69Lvb1S4wp3E2ZMXg55DH8iynXVdSci92P8JULS3HMPtf8/AefR/KUHvPrdByhyK57f Sk5w== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb10si15075259ejc.273.2021.03.30.09.19.19; Tue, 30 Mar 2021 09:19:43 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbhC3QP5 (ORCPT + 99 others); Tue, 30 Mar 2021 12:15:57 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:45851 "EHLO mail-pj1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbhC3QPo (ORCPT ); Tue, 30 Mar 2021 12:15:44 -0400 Received: by mail-pj1-f42.google.com with SMTP id kr3-20020a17090b4903b02900c096fc01deso7909856pjb.4 for ; Tue, 30 Mar 2021 09:15:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2fI4VhHe8aki99no36i/27lg7qBg6asALWaTkAeQI+o=; b=uV1tdn79yEPTx28E+UV/o024wXISvScqEYUzX0Cp244B5AW9yJ6D3rQs5by79KyDPG jURDhdSLMj4sozKu2fqidmy32mFcj1ge6BtiEqc1VArFTGBxXEI8eolQXiZDZTf/Hkbi +tUr3OX7FUATh+arrEzsIC1liFzB4brubvGJaR3nladnJse3aREPEG513xycDW3ZOb+s omCuXminPLDU07e5/+mloUVuGdn38FmMO7AVHM//hBiElyEAWK9NfTxcAK6rekHCrsQK WPqslq0vX+zB6s4fAU5nV57QRDWf+EqvfheXYwha/Q8dG3YTW8oA4pRdQLJDCGEzsqjK BBGg== X-Gm-Message-State: AOAM531ngJbKYEq9hwp8w/9Rbr5lvR7hqX6/8bIkM25OPslQQWWIk2cz jTVGLfYFpSuMEECTbMAARgU= X-Received: by 2002:a17:90b:4910:: with SMTP id kr16mr4970022pjb.26.1617120944403; Tue, 30 Mar 2021 09:15:44 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id v9sm22059294pfc.108.2021.03.30.09.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 09:15:43 -0700 (PDT) Date: Tue, 30 Mar 2021 09:15:42 -0700 From: Moritz Fischer To: richard.gong@linux.intel.com Cc: gregkh@linuxfoundation.org, mdf@kernel.org, linux-kernel@vger.kernel.org, Richard Gong Subject: Re: [PATCH] firmware: stratix10-svc: extend SVC driver to get the firmware version Message-ID: References: <1617114785-22211-1-git-send-email-richard.gong@linux.intel.com> <1617114785-22211-2-git-send-email-richard.gong@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1617114785-22211-2-git-send-email-richard.gong@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Richard, On Tue, Mar 30, 2021 at 09:33:05AM -0500, richard.gong@linux.intel.com wrote: > From: Richard Gong > > Extend Intel service layer driver to get the firmware version running at > FPGA device. Therefore FPGA manager driver, one of Intel service layer > driver's client, can decide whether to handle the newly added bitstream > authentication function based on the retrieved firmware version. > > Signed-off-by: Richard Gong > Acked-by: Moritz Fischr > --- > drivers/firmware/stratix10-svc.c | 12 ++++++++++-- > include/linux/firmware/intel/stratix10-smc.h | 21 +++++++++++++++++++-- > include/linux/firmware/intel/stratix10-svc-client.h | 4 ++++ > 3 files changed, 33 insertions(+), 4 deletions(-) > > diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c > index 3aa489d..1443bbd 100644 > --- a/drivers/firmware/stratix10-svc.c > +++ b/drivers/firmware/stratix10-svc.c > @@ -306,6 +306,7 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data, > break; > case COMMAND_RSU_RETRY: > case COMMAND_RSU_MAX_RETRY: > + case COMMAND_FIRMWARE_VERSION: > cb_data->status = BIT(SVC_STATUS_OK); > cb_data->kaddr1 = &res.a1; > break; > @@ -422,6 +423,11 @@ static int svc_normal_to_secure_thread(void *data) > a1 = 0; > a2 = 0; > break; > + case COMMAND_FIRMWARE_VERSION: > + a0 = INTEL_SIP_SMC_FIRMWARE_VERSION; > + a1 = 0; > + a2 = 0; > + break; > default: > pr_warn("it shouldn't happen\n"); > break; > @@ -487,11 +493,13 @@ static int svc_normal_to_secure_thread(void *data) > > /* > * be compatible with older version firmware which > - * doesn't support RSU notify or retry > + * doesn't support RSU notify, retry or bitstream > + * authentication. > */ > if ((pdata->command == COMMAND_RSU_RETRY) || > (pdata->command == COMMAND_RSU_MAX_RETRY) || > - (pdata->command == COMMAND_RSU_NOTIFY)) { > + (pdata->command == COMMAND_RSU_NOTIFY) || > + (pdata->command == COMMAND_FIRMWARE_VERSION)) { > cbdata->status = > BIT(SVC_STATUS_NO_SUPPORT); > cbdata->kaddr1 = NULL; > diff --git a/include/linux/firmware/intel/stratix10-smc.h b/include/linux/firmware/intel/stratix10-smc.h > index c3e5ab0..505fcca 100644 > --- a/include/linux/firmware/intel/stratix10-smc.h > +++ b/include/linux/firmware/intel/stratix10-smc.h > @@ -321,8 +321,6 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) > #define INTEL_SIP_SMC_ECC_DBE \ > INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_ECC_DBE) > > -#endif > - > /** > * Request INTEL_SIP_SMC_RSU_NOTIFY > * > @@ -404,3 +402,22 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) > #define INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY 18 > #define INTEL_SIP_SMC_RSU_MAX_RETRY \ > INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY) > + > +/** > + * Request INTEL_SIP_SMC_FIRMWARE_VERSION > + * > + * Sync call used to query the version of running firmware > + * > + * Call register usage: > + * a0 INTEL_SIP_SMC_FIRMWARE_VERSION > + * a1-a7 not used > + * > + * Return status: > + * a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_STATUS_ERROR > + * a1 running firmware version > + */ > +#define INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION 31 > +#define INTEL_SIP_SMC_FIRMWARE_VERSION \ > + INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION) > + > +#endif > diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h > index 19781b0f..18c1841 100644 > --- a/include/linux/firmware/intel/stratix10-svc-client.h > +++ b/include/linux/firmware/intel/stratix10-svc-client.h > @@ -104,6 +104,9 @@ struct stratix10_svc_chan; > * > * @COMMAND_RSU_DCMF_VERSION: query firmware for the DCMF version, return status > * is SVC_STATUS_OK or SVC_STATUS_ERROR > + * > + * @COMMAND_FIRMWARE_VERSION: query running firmware version, return status > + * is SVC_STATUS_OK or SVC_STATUS_ERROR > */ > enum stratix10_svc_command_code { > COMMAND_NOOP = 0, > @@ -117,6 +120,7 @@ enum stratix10_svc_command_code { > COMMAND_RSU_RETRY, > COMMAND_RSU_MAX_RETRY, > COMMAND_RSU_DCMF_VERSION, > + COMMAND_FIRMWARE_VERSION, > }; > > /** > -- > 2.7.4 > Let's hold off on this patch until we have sorted the rest of this patch series out. As it stands it doesn't have a in-tree user. Thanks, Moritz