From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C4B4C4167B for ; Fri, 1 Dec 2023 16:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hrxpBuwjPU38Bcgtz6aiz2FyzlauoI5Vjd4OOe7LHeI=; b=F9SdKnqOMDfpgs 6k40enk3GBm3JD7X2yk+ZHTs+d7CksBuBfWUvv3VLmC17PlK9wEitAFyaHQnbNUV6+5Oj6pXiP/nb yHIi9AHqH7e51UgWqLuBKWz/6jv9oTi1y1YO4Qw6VENGtGYhzZexu9d0d21FmLFLMcUe83UnMd8tn aHUi4w61Hvi7QyYvl57vcgW+oeS1DoqfOg3Uoaejj/dDzEl2yzUhkgips7bIGTpZXUERA/+aeYftb 6r613xwAl1wmBetXE2ZXVji9o2G+nYruVD8BfiRPqQ2hMKBAxRFxafnvYa4nU2QNzBP2uReRhGw/c lYSV6iIjSBKhOQNgJKNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r96M6-00EBcD-2C; Fri, 01 Dec 2023 16:27:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r96M3-00EBbc-2h for linux-arm-kernel@lists.infradead.org; Fri, 01 Dec 2023 16:27:05 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2FA451007; Fri, 1 Dec 2023 08:27:48 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD9503F6C4; Fri, 1 Dec 2023 08:27:00 -0800 (PST) Date: Fri, 1 Dec 2023 16:26:58 +0000 From: Cristian Marussi To: Sudeep Holla Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, nicola.mazzucato@arm.com Subject: Re: [PATCH] firmware: arm_scmi: Add protocol versioning checks Message-ID: References: <20231201135858.2367651-1-cristian.marussi@arm.com> <20231201153145.emneavw53en4hsju@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231201153145.emneavw53en4hsju@bogus> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_082703_974939_73EE492F X-CRM114-Status: GOOD ( 25.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 01, 2023 at 03:31:45PM +0000, Sudeep Holla wrote: > On Fri, Dec 01, 2023 at 01:58:58PM +0000, Cristian Marussi wrote: > > Platform and agent supported protocols versions do not necessarily match. > > > > When talking to an older platform SCMI server, supporting only older > > protocol versions, the kernel SCMI agent will downgrade the version of > > the used protocol to match the platform one and avoid compatibility issues. > > > > In the case, instead, in which the agent happens to communicate with a > > newer platform server which can support newer protocol versions unknown to > > the agent, and potentially backward incompatible, the agent currently > > carries on, silently, in a best-effort approach. > > > > Note that the SCMI server, by the specification, has no means to explicitly > > detect the protocol versions used by the agents, neither it is required to > > support multiple, older, protocol versions. > > > > Add an explicit protocol version check to let the agent detect when this > > version mismatch happens and warn the user about this condition. > > > > Signed-off-by: Cristian Marussi > > --- > > Any suggestion for a more meaningful warn message is very much welcome. > > Looks good to me. I will apply soon with couple of changes as mentioned > below. Let me know if you agree/disagree. > > > Based on sudeep/for-next/scmi/updates > > --- > > drivers/firmware/arm_scmi/base.c | 6 +++++- > > drivers/firmware/arm_scmi/clock.c | 6 +++++- > > drivers/firmware/arm_scmi/driver.c | 11 ++++++++++- > > drivers/firmware/arm_scmi/perf.c | 6 +++++- > > drivers/firmware/arm_scmi/power.c | 6 +++++- > > drivers/firmware/arm_scmi/powercap.c | 6 +++++- > > drivers/firmware/arm_scmi/protocols.h | 8 +++++++- > > drivers/firmware/arm_scmi/reset.c | 6 +++++- > > drivers/firmware/arm_scmi/sensors.c | 6 +++++- > > drivers/firmware/arm_scmi/system.c | 6 +++++- > > drivers/firmware/arm_scmi/voltage.c | 6 +++++- > > 11 files changed, 62 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c > > index a52f084a6a87..3f5c89ae5af2 100644 > > --- a/drivers/firmware/arm_scmi/base.c > > +++ b/drivers/firmware/arm_scmi/base.c > > @@ -13,6 +13,9 @@ > > #include "common.h" > > #include "notify.h" > > > > +/* Must be updated only after ALL new features for that version are merged */ > > s/new/mandatory/ > > > +#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20000 > > + > > #define SCMI_BASE_NUM_SOURCES 1 > > #define SCMI_BASE_MAX_CMD_ERR_COUNT 1024 > > > > index 3eb19ed6f148..46320f627066 100644 > > --- a/drivers/firmware/arm_scmi/driver.c > > +++ b/drivers/firmware/arm_scmi/driver.c > > @@ -1849,6 +1853,11 @@ scmi_alloc_init_protocol_instance(struct scmi_info *info, > > devres_close_group(handle->dev, pi->gid); > > dev_dbg(handle->dev, "Initialized protocol: 0x%X\n", pi->proto->id); > > > > + if (pi->version > proto->supported_version) > > + dev_warn(handle->dev, > > + "Detected UNSUPPORTED version 0x%X for protocol 0x%X. Backward compatibility is NOT assured.\n", > > s/UNSUPPORTED version/UNSUPPORTED newer version/ or higher instead of newer > Much better ... I'm fine with these changes ... I was tempted to use 'higher' too, but not sure what was more effective at communicating the issue...a panic usually does it better :P (joking ah,...) Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel