Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1160349rdb; Fri, 1 Dec 2023 08:27:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaG7WsvBkiOSBkUYshdxpN6UKbmqRAppIcaGkMJh4kaoFcpuwnz+llpmdFEg1Wj6jhvad9 X-Received: by 2002:a17:90b:4d8b:b0:280:65ed:dfe with SMTP id oj11-20020a17090b4d8b00b0028065ed0dfemr25091942pjb.23.1701448033255; Fri, 01 Dec 2023 08:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701448033; cv=none; d=google.com; s=arc-20160816; b=h4kIcFt51klXN3ozRof69sSYC5ENZGNIpu1/Q3jQ6u/WVJhgM4S5Jyvze3N2wqpIvQ xzashM6H3mjkjvmtsB3YCvzXZJJp6l2ggF99f16c/VBCxvtg4j2QVpo7e6qs8w2qb8tk uxw3KuKVINWOq2U+rqmPT0vJsOMXSijjUMpbAlNal7DB+G3pJt6SIEqIrE7Orht7zXP3 2dxS0/FgLLqu72Www5oPQEeaS3LsN8A838naoZF4DeSOOJYzSyRJATM0IZBzHKjHDqBH IRKjEoVr+roH9THGRg9PNgzj1dyhevezPLJpy+EmeLD4w/bXTud2PqtMMPGhqMxSdqsv c3tA== 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=BJTjA9ldEMVywe44jzZ3UhLgAWghBAA6kzNwHTq1Fo4=; fh=V6DOtxc8rakhCkJNSb54kJIhYbv1zBBh8KfhmLnAB+o=; b=LKYeRLoCSsQHjNhtQIEu1wu9HM2QnMiH2B9/j+LYidKtz0s4HwIfUDO7zI7q3Dx08l YZE/+XzVtuAnAGROIA6aFrAhkmRlk6+3dBFz7vyO8GhsKwt8MEszZlpyEankMk7h62pt 0FsD7NEC3Mi7PR0dDALGbbKmwRs8DuLeBa76w4v9iPS7Q1qbXn6sNJ83Z9QAMLSUy07F 1Q3IMxDbxskLClU72756oYlQfaAVo4iF88sQw+ltb61fwiORBH8j/bp1z6l02SE8JXOx ZU/79QKeWj6P8WmJUzcVHEV24caDs+SRitl0TYaDEr+Rcet82ffgWzjEE8o8tKPNotGK xZqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id lt20-20020a17090b355400b00285e15f9ee5si3466075pjb.52.2023.12.01.08.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0934E819CC18; Fri, 1 Dec 2023 08:27:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbjLAQ04 (ORCPT + 99 others); Fri, 1 Dec 2023 11:26:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbjLAQ04 (ORCPT ); Fri, 1 Dec 2023 11:26:56 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0F56A83 for ; Fri, 1 Dec 2023 08:27:02 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201153145.emneavw53en4hsju@bogus> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:27:10 -0800 (PST) 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