From patchwork Fri Jul 26 13:45:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 169834 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp84022ilk; Fri, 26 Jul 2019 06:46:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4Td1bLW6AsNzL+DAvtRLkFSnLNknFJAOJjzlVnuH2wn/MrEMTzd3Zy8TybnidL1CigH6q X-Received: by 2002:a63:5860:: with SMTP id i32mr63329069pgm.124.1564148808685; Fri, 26 Jul 2019 06:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564148808; cv=none; d=google.com; s=arc-20160816; b=oO3luX9V1lVfm3pu+4w/3951UZWg9JqZUCTml1rdSZ+2uYtEU6hVclIY06aQ2B+Umn aOnweEf2WJqDVCLHVZ4I8SVt5tcHrzaEXpifmxzz/6xHk+B1IcImTemaNAEFbG2r29fv 2Aie/HLIVOGIQ7iKfFYiqUdd4XEihNmxu1DyhsTBXo+x8CRfYd8AXGAqFDFp4RC/G2Pe E1Jrb+VsHBu+gZFaFEgEGnFioKIM7pMoDd9h3GFAeWF4Jlctypy5TtSHduVdMjerRgyw zcYeyFWJAcuOKqgMvEBobLuMKaBgjuFEQ9j4QGpmRKjvTp0+2LcsOR+6D9qVYS/TTHeo eDgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=MS5qVLsBH/sFGrijcRnALSYUoyReKVMMbz93uJGdqU8=; b=0hydCPHOOhkH3wdkPCFY22al+x286IwIvkWFh8SEL9PdD2PdE7QgpAEUrUiURe4EgA hSTnaNlYtg7KzYSUC7LGoK0u6Xl83WxIEBiD7lxwduxhw0noB9S4dWtin629hBvAJbxu fDMA0+BWDpgff+9+YsfMSFFExLR+q9AgA9fd+TLMCMqufM3btCFrZLeUzIYmpf3XnC/u gLMXQcx4rrzBV+bR/fezk6OOZvQSQDiyaYUCmMcWnPMklS0d+xXJu+rTUZt1rYvdGDwT Dc53X5dOFSaYAEoRuUUWkGxAj8t2Q6A2KqzbDal/x84JC+bdD10CTDeBzy+Sh8FPHtU2 ghtw== 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 123si24000132pgb.374.2019.07.26.06.46.47; Fri, 26 Jul 2019 06:46:48 -0700 (PDT) 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 S2388674AbfGZNqQ (ORCPT + 29 others); Fri, 26 Jul 2019 09:46:16 -0400 Received: from foss.arm.com ([217.140.110.172]:44018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388641AbfGZNqG (ORCPT ); Fri, 26 Jul 2019 09:46:06 -0400 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 9CC2F15A2; Fri, 26 Jul 2019 06:46:05 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5ADEE3F694; Fri, 26 Jul 2019 06:46:04 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Volodymyr Babchuk , Gaku Inami , Etienne Carriere Subject: [PATCH v2 1/6] firmware: arm_scmi: Use the correct style for SPDX License Identifier Date: Fri, 26 Jul 2019 14:45:26 +0100 Message-Id: <20190726134531.8928-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726134531.8928-1-sudeep.holla@arm.com> References: <20190726134531.8928-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix to correct the SPDX License Identifier style in header file related to firmware frivers for ARM SCMI message protocol. For C header files Documentation/process/license-rules.rst mandates C-like comments(opposed to C source files where C++ style should be used). While at it, change GPL-2.0 to GPL-2.0-only similar to the ones in psci.h and scpi_protocol.h Signed-off-by: Sudeep Holla --- include/linux/scmi_protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 9ff2e9357e9a..aa1e791779b4 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0-only */ /* * SCMI Message Protocol driver header * From patchwork Fri Jul 26 13:45:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 169835 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp84206ilk; Fri, 26 Jul 2019 06:47:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGx7GVhE3HmyptUiYao2YmXOLmej+eo/+dy/IqN3ceECtJxmdTPqMjLR/p+DHaowL0w5Eu X-Received: by 2002:a63:5459:: with SMTP id e25mr26306400pgm.366.1564148820397; Fri, 26 Jul 2019 06:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564148820; cv=none; d=google.com; s=arc-20160816; b=CaextLUMwI16zLq1Mvje6WhTWZpFDtQm4mJUvkzkeH+g2YJoTjE0f4sohJuUsZRNM/ Ucsh9vOD4nkwqMdiksJVZIZCQrwJyYtN4EHor4BY0Pfi8evv9W2Nd9t1oboppYxMw8BJ quDH3iphjAbsFCcdkgdam5ZV48V3z3T3mqyfQ9eM43mda3yVnKXmQdia4Yu4pCUM0YLM 1m6k+2VAIz7lgkArYyZDfY8d//qNvyZCDqi4ROviYsy8SXUonDybTVrp2lJS1rNBfXq+ s0X+lVaZ/ShtTPyChZQyzk/KJmPfoxHxGA0L08XwzrO/YSnxLsI2kTJrZA0cdTJ9lW82 xcUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4KFjihzPmFYKJkYwjKv7zsinRefPW9Yy77VnMYaNzPI=; b=oeAdbnZIPkecoEcerctcWHKeoOoq3th1KmbY6u3QgAOjkdkjNSyirPZapx6lmSrkRH ljkfgS7FNGAXp7PCTGQpq4OFojj6n9Zn0zvz7HdxUqSC5u7Z9OGLmf+tHQAptOnZfpqa WU1eh5CXOfIp8QhwZUP/Zmp6JWir98ZyZbPEMtL0Y5i4IqGsBT+BsPBQaAHr9ORk5G1M vAkHRG0mx9Kmrrb/JTWh59USSI5GPopsjITAHCkXOsoJEDyVrwaOXelJAMlLqU8SYY4I zz4Aw2L7WVbeeqGqeHKWegOypoSd4u0iiMR9BWnvGdQzB7jZPJ4TQgSZRcm2jloxBrcg RkDA== 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 z4si17620748plo.297.2019.07.26.06.47.00; Fri, 26 Jul 2019 06:47:00 -0700 (PDT) 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 S2388627AbfGZNq6 (ORCPT + 29 others); Fri, 26 Jul 2019 09:46:58 -0400 Received: from foss.arm.com ([217.140.110.172]:44032 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387492AbfGZNqH (ORCPT ); Fri, 26 Jul 2019 09:46:07 -0400 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 1756015BF; Fri, 26 Jul 2019 06:46:07 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D1F893F694; Fri, 26 Jul 2019 06:46:05 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Volodymyr Babchuk , Gaku Inami , Etienne Carriere Subject: [PATCH v2 2/6] firmware: arm_scmi: Align few names in sensors protocol with SCMI specification Date: Fri, 26 Jul 2019 14:45:27 +0100 Message-Id: <20190726134531.8928-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726134531.8928-1-sudeep.holla@arm.com> References: <20190726134531.8928-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks like more code developed during the draft versions of the specification slipped through and they don't match the final released version. This seem to have happened only with sensor protocol. Renaming few command and function names here to match exactly with the released version of SCMI specification for ease of maintenance. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/sensors.c | 28 +++++++++++++++------------- include/linux/scmi_protocol.h | 12 ++++++------ 2 files changed, 21 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index 0e94ab56f679..17dbabd8a94a 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -9,8 +9,8 @@ enum scmi_sensor_protocol_cmd { SENSOR_DESCRIPTION_GET = 0x3, - SENSOR_CONFIG_SET = 0x4, - SENSOR_TRIP_POINT_SET = 0x5, + SENSOR_TRIP_POINT_NOTIFY = 0x4, + SENSOR_TRIP_POINT_CONFIG = 0x5, SENSOR_READING_GET = 0x6, }; @@ -42,9 +42,10 @@ struct scmi_msg_resp_sensor_description { } desc[0]; }; -struct scmi_msg_set_sensor_config { +struct scmi_msg_sensor_trip_point_notify { __le32 id; __le32 event_control; +#define SENSOR_TP_NOTIFY_ALL BIT(0) }; struct scmi_msg_set_sensor_trip_point { @@ -160,15 +161,15 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, return ret; } -static int -scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id) +static int scmi_sensor_trip_point_notify(const struct scmi_handle *handle, + u32 sensor_id, bool enable) { int ret; - u32 evt_cntl = BIT(0); + u32 evt_cntl = enable ? SENSOR_TP_NOTIFY_ALL : 0; struct scmi_xfer *t; - struct scmi_msg_set_sensor_config *cfg; + struct scmi_msg_sensor_trip_point_notify *cfg; - ret = scmi_xfer_get_init(handle, SENSOR_CONFIG_SET, + ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_NOTIFY, SCMI_PROTOCOL_SENSOR, sizeof(*cfg), 0, &t); if (ret) return ret; @@ -183,15 +184,16 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id) return ret; } -static int scmi_sensor_trip_point_set(const struct scmi_handle *handle, - u32 sensor_id, u8 trip_id, u64 trip_value) +static int +scmi_sensor_trip_point_config(const struct scmi_handle *handle, u32 sensor_id, + u8 trip_id, u64 trip_value) { int ret; u32 evt_cntl = SENSOR_TP_BOTH; struct scmi_xfer *t; struct scmi_msg_set_sensor_trip_point *trip; - ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_SET, + ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_CONFIG, SCMI_PROTOCOL_SENSOR, sizeof(*trip), 0, &t); if (ret) return ret; @@ -255,8 +257,8 @@ static int scmi_sensor_count_get(const struct scmi_handle *handle) static struct scmi_sensor_ops sensor_ops = { .count_get = scmi_sensor_count_get, .info_get = scmi_sensor_info_get, - .configuration_set = scmi_sensor_configuration_set, - .trip_point_set = scmi_sensor_trip_point_set, + .trip_point_notify = scmi_sensor_trip_point_notify, + .trip_point_config = scmi_sensor_trip_point_config, .reading_get = scmi_sensor_reading_get, }; diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index aa1e791779b4..1383d47e6435 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -167,9 +167,9 @@ enum scmi_sensor_class { * * @count_get: get the count of sensors provided by SCMI * @info_get: get the information of the specified sensor - * @configuration_set: control notifications on cross-over events for + * @trip_point_notify: control notifications on cross-over events for * the trip-points - * @trip_point_set: selects and configures a trip-point of interest + * @trip_point_config: selects and configures a trip-point of interest * @reading_get: gets the current value of the sensor */ struct scmi_sensor_ops { @@ -177,10 +177,10 @@ struct scmi_sensor_ops { const struct scmi_sensor_info *(*info_get) (const struct scmi_handle *handle, u32 sensor_id); - int (*configuration_set)(const struct scmi_handle *handle, - u32 sensor_id); - int (*trip_point_set)(const struct scmi_handle *handle, u32 sensor_id, - u8 trip_id, u64 trip_value); + int (*trip_point_notify)(const struct scmi_handle *handle, + u32 sensor_id, bool enable); + int (*trip_point_config)(const struct scmi_handle *handle, + u32 sensor_id, u8 trip_id, u64 trip_value); int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id, bool async, u64 *value); }; From patchwork Fri Jul 26 13:45:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 169830 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp83553ilk; Fri, 26 Jul 2019 06:46:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiMigd04Bl1r4dgSTJ2uxHZKgjUcXSwiLTKfwtKJxreEbDIQtwpxW9ruLNJA1K0Yef4Sq6 X-Received: by 2002:a63:6f41:: with SMTP id k62mr45591725pgc.32.1564148780721; Fri, 26 Jul 2019 06:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564148780; cv=none; d=google.com; s=arc-20160816; b=lCA7/mrPl3abn1BktHfBouUVcnC6sWt3PFnefEvqyowf+hlnnWfdWpvuk5JzdZuNLX +vL4FvkHQA2QSEntDPlEGBRA6lIJCOSjGbSIDIzvuUR64NqVmy3KgCrmsBR9rJzU2fi7 Ujib878tIThixd9yysTUu2FOu/tmcv+px6N5caTNqor84CV+not4eMoRV4caIHT6mdvW Vyogk8Wf4umENH+1Hkqzxm78470ORbI33eDjt97RyITOzcjOypSDrvwcKThHrUdWp6mu MdpGlXntTNrQHm4ZhaRrjnWISDSoVo3+WdYt3sSW8PD5BR9BMLYZmFemP9J9KphPkgTU N8gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=320TQZ5w2lNhAFIX1hOIch8yO3WN60yBrBwenhig/C4=; b=XJDLIGj+5WxvFHBcxn4m3YWDx9XnxXXzzCnHOaLFDnOr7Rr2mJjPaLYBqLLPu8nabQ 3Usss+d7iZQVMNuRjWfiK+avtqAItlhtLIqO8dgh5Bv82qt6GgMM4SxkQN+U8CRatFy1 pRmvDFqYJgCPU8Yvl4ABGbE1Kx2hyAacTYqxXv9MwC1AOyJutw2RLxVIm0zznRlTijv0 CfieBgUPdZ7eKKD6FEeuwlDDLnhuDorPl2prLkv5J/EK7R3jdINH603Hdj99tFTF6X1v tI+Iwbu0vQ5Ev8+L99Xry1GhoYyHAMQcEzArA7+9isOGDa9yws/Hl+NaJkUF/0mZrQL3 tvRw== 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 u3si19196169pgm.122.2019.07.26.06.46.20; Fri, 26 Jul 2019 06:46:20 -0700 (PDT) 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 S2388686AbfGZNqS (ORCPT + 29 others); Fri, 26 Jul 2019 09:46:18 -0400 Received: from foss.arm.com ([217.140.110.172]:44048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388648AbfGZNqI (ORCPT ); Fri, 26 Jul 2019 09:46:08 -0400 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 84532152D; Fri, 26 Jul 2019 06:46:08 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4C3E33F694; Fri, 26 Jul 2019 06:46:07 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Volodymyr Babchuk , Gaku Inami , Etienne Carriere Subject: [PATCH v2 3/6] firmware: arm_scmi: Remove extra check for invalid length message responses Date: Fri, 26 Jul 2019 14:45:28 +0100 Message-Id: <20190726134531.8928-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726134531.8928-1-sudeep.holla@arm.com> References: <20190726134531.8928-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org scmi_xfer_get_init ensures both transmit and receive buffer lengths are within the maximum limits. If receive buffer length is not supplied by the caller, it's set to the maximum limit value. Receive buffer length is never modified after that. So there's no need for the extra check when receive transmit completion for a command essage. Further, if the response header length is greater than the prescribed receive buffer length, the response buffer is truncated to the latter. Reported-by: Jim Quinlan Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index b5bc4c7a8fab..6ef652940099 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -230,12 +230,6 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m) xfer = &minfo->xfer_block[xfer_id]; scmi_dump_header_dbg(dev, &xfer->hdr); - /* Is the message of valid length? */ - if (xfer->rx.len > info->desc->max_msg_size) { - dev_err(dev, "unable to handle %zu xfer(max %d)\n", - xfer->rx.len, info->desc->max_msg_size); - return; - } scmi_fetch_response(xfer, mem); complete(&xfer->done); From patchwork Fri Jul 26 13:45:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 169833 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp83834ilk; Fri, 26 Jul 2019 06:46:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwumHqHCPMA5rh3nmyLrOVE1fG0nq7lX5bzG5RmGkBseqr7uCmS6UDCh39YSgKqWasOhFUG X-Received: by 2002:a17:902:8b82:: with SMTP id ay2mr54468176plb.164.1564148798053; Fri, 26 Jul 2019 06:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564148798; cv=none; d=google.com; s=arc-20160816; b=bmeSjscSLNRj+BUVfdqhHwRkRfGQl1nlIL6EOD0zGSkZG6YXH9BXe//uPleI9qzjoX +YvQ1sPAb12sHwFOAf3tzb6gRo2Ppyu9br++7nSFbE+RLSw/h7ysqmRUtBJ+SBS+LUYi nSKTn2CdrN98Cva7QyaoPrEaaT0/XVAbfGYgK5YUSOC9SAetxZyC/Bff+M8GVV72Xzwc rhM+/nZi+PBfoZ23WjMA8sMzMjjUGv0aOWeAXiEmAcVLzoMB7hjVxrwtrnF+4O5gqjQL 49UEaVdU0PY1mxTJWzbdc6jIL+tD3e0VuECV8OrnuncBIOxKmrZ2KzPvhomNgVX8WhC3 X1SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=LMRfo5J2HD+7hXucKs2m2w52v+uy/YNGRj9kWx0rlXI=; b=ObXi1q17zCWd841XgEoHWcLTeSG2q1qY5c268+IOKAT6vRdu7+Lm4pPzDenp5nBZ+U ADDD0AYk+Tl+GLLxfO75pPOEulRpClCZll9YpEKHOd0Y3KJuS9kWH7xp9AOBn/PjkqL6 Ypj/KhA52Sdd8Syy00GZ7j4bSMR5rQ6089VmKoHE16onVbV4CjrfYZj6k1ZjLNC3BQNM lXdxlo5AUXMG4fFsho76EU5PlA1Cw749+c0wBZ2lhRElBX4GsbjxtATMdt1BP/he763L nee5k5EAXJBStR3fFP0fxFB720pX0GW3Y/cV6WhGeqD0Y9u0HPsQr6jrYvVCEgyH3eMd Jdfw== 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 19si22118337pfc.239.2019.07.26.06.46.37; Fri, 26 Jul 2019 06:46:38 -0700 (PDT) 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 S2388702AbfGZNq0 (ORCPT + 29 others); Fri, 26 Jul 2019 09:46:26 -0400 Received: from foss.arm.com ([217.140.110.172]:44064 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388195AbfGZNqK (ORCPT ); Fri, 26 Jul 2019 09:46:10 -0400 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 0668915A2; Fri, 26 Jul 2019 06:46:10 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B971E3F694; Fri, 26 Jul 2019 06:46:08 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Volodymyr Babchuk , Gaku Inami , Etienne Carriere Subject: [PATCH v2 4/6] firmware: arm_scmi: Fix few trivial typos in comments Date: Fri, 26 Jul 2019 14:45:29 +0100 Message-Id: <20190726134531.8928-5-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726134531.8928-1-sudeep.holla@arm.com> References: <20190726134531.8928-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While adding new comments found couple of typos that are better fixed. s/informfation/information/ s/statues/status/ Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 6ef652940099..cac255c418b2 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -86,7 +86,7 @@ struct scmi_desc { }; /** - * struct scmi_chan_info - Structure representing a SCMI channel informfation + * struct scmi_chan_info - Structure representing a SCMI channel information * * @cl: Mailbox Client * @chan: Transmit/Receive mailbox channel @@ -190,7 +190,7 @@ static void scmi_fetch_response(struct scmi_xfer *xfer, struct scmi_shared_mem __iomem *mem) { xfer->hdr.status = ioread32(mem->msg_payload); - /* Skip the length of header and statues in payload area i.e 8 bytes*/ + /* Skip the length of header and status in payload area i.e 8 bytes */ xfer->rx.len = min_t(size_t, xfer->rx.len, ioread32(&mem->length) - 8); /* Take a copy to the rx buffer.. */ From patchwork Fri Jul 26 13:45:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 169832 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp83803ilk; Fri, 26 Jul 2019 06:46:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRuQGQHx8/k5eqnZNLGDHEVF440nPCZzEpLOZfqvfvwxUfpThiCFc6ra7VRpW0AxMyHLvk X-Received: by 2002:a17:902:8ec7:: with SMTP id x7mr95184443plo.224.1564148795235; Fri, 26 Jul 2019 06:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564148795; cv=none; d=google.com; s=arc-20160816; b=kiRPleh+HbgIlTjXQ5KQirG/CXmCQlOkD1muDhZQ00IvG8QgDk0D29ZfUOp++pYDNi r18DGoZHQSX9Q3wLw5aujmEm8yoeBcHrMJ64Nvdt+tSAIdtPQRU/qQGBrJ8gir6KF5Jm A6M2q3VzstNFp5SKmY58eUhkXrrxPpJgjPvnrnWCENFcVc3snC0eS7oEQTdCHOj1g4hB OHsdISM3EC4F3qYwxPlQpXfHtlEARNP2ttrh85JBOBro2IdhA/bnID2WKv1WuFNAtB9z Sfrt/OC+OdLTatyQU7+pMjtm92/r0Ldds3q9uWD3Wf3XEGHwm1C1V+X2F4wg0Er8vKJR tVVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=r4ql9z+8MulhD8zj66LLwe9NJ+/EKFUCirn7C87MRw8=; b=Tc2A482dsmOHmo9+sP5t8o0NYoEfy21VdNQxjCtjmpXX2+MIkZ0n4C/csQCM7WssuK F3E/86TqHC+zyXgD847Uqi/LeNUqlkfsf8OJycvtsdx+GzCRczJyv3eJ7uXAanlDhkJA xbYweYQz3SSnb9rmU4+UczDRzHyK5uqYRBeW6pOsC6UDq7GS/iNZGl+D8VlG3kEDZZNR TWRLQjH+hhkW7X4DWlQzPYvRZn4St/1xENk66WhWCYc8rDq+D4A2jqgwM+p4xyz82zPw NnSrnwyj1I9/OYv3T87yn2SMEKV8A+tMBvPlwflqgKzC6AZL9luZwtw8EEFxGPkJTbCR O2oA== 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 e62si22998711pfh.254.2019.07.26.06.46.34; Fri, 26 Jul 2019 06:46:35 -0700 (PDT) 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 S2388712AbfGZNq2 (ORCPT + 29 others); Fri, 26 Jul 2019 09:46:28 -0400 Received: from foss.arm.com ([217.140.110.172]:44078 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388656AbfGZNqM (ORCPT ); Fri, 26 Jul 2019 09:46:12 -0400 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 7671C15BF; Fri, 26 Jul 2019 06:46:11 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3B7613F694; Fri, 26 Jul 2019 06:46:10 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Volodymyr Babchuk , Gaku Inami , Etienne Carriere Subject: [PATCH v2 5/6] firmware: arm_scmi: Use the term 'message' instead of 'command' Date: Fri, 26 Jul 2019 14:45:30 +0100 Message-Id: <20190726134531.8928-6-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726134531.8928-1-sudeep.holla@arm.com> References: <20190726134531.8928-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to adding support for other two types of messages that SCMI specification mentions, let's replace the term 'command' with the correct term 'message'. As per the specification the messages are of 3 types: commands(synchronous or asynchronous), delayed responses and notifications. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/common.h | 10 +++++----- drivers/firmware/arm_scmi/driver.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 44fd4f9404a9..a9eee62c7142 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -48,11 +48,11 @@ struct scmi_msg_resp_prot_version { /** * struct scmi_msg_hdr - Message(Tx/Rx) header * - * @id: The identifier of the command being sent - * @protocol_id: The identifier of the protocol used to send @id command - * @seq: The token to identify the message. when a message/command returns, - * the platform returns the whole message header unmodified including - * the token + * @id: The identifier of the message being sent + * @protocol_id: The identifier of the protocol used to send @id message + * @seq: The token to identify the message. When a message returns, the + * platform returns the whole message header unmodified including the + * token * @status: Status of the transfer once it's complete * @poll_completion: Indicate if the transfer needs to be polled for * completion or interrupt mode is used diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index cac255c418b2..69bf85fea967 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -182,7 +182,7 @@ static inline int scmi_to_linux_errno(int errno) static inline void scmi_dump_header_dbg(struct device *dev, struct scmi_msg_hdr *hdr) { - dev_dbg(dev, "Command ID: %x Sequence ID: %x Protocol: %x\n", + dev_dbg(dev, "Message ID: %x Sequence ID: %x Protocol: %x\n", hdr->id, hdr->seq, hdr->protocol_id); } @@ -241,7 +241,7 @@ static void scmi_rx_callback(struct mbox_client *cl, void *m) * @hdr: pointer to header containing all the information on message id, * protocol id and sequence id. * - * Return: 32-bit packed command header to be sent to the platform. + * Return: 32-bit packed message header to be sent to the platform. */ static inline u32 pack_scmi_header(struct scmi_msg_hdr *hdr) { @@ -280,7 +280,7 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m) * * @handle: Pointer to SCMI entity handle * - * Helper function which is used by various command functions that are + * Helper function which is used by various message functions that are * exposed to clients of this driver for allocating a message traffic event. * * This function can sleep depending on pending requests already in the system From patchwork Fri Jul 26 13:45:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 169831 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp83764ilk; Fri, 26 Jul 2019 06:46:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOUxFTg1kwJnUtyFuJA7XYvNIVmMP7JYVSS2SL4U2Jj+NJLWVGHPO7LWZPIVhcCFHQapwZ X-Received: by 2002:aa7:8218:: with SMTP id k24mr21515079pfi.221.1564148792865; Fri, 26 Jul 2019 06:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564148792; cv=none; d=google.com; s=arc-20160816; b=IR+LX4TmvZIEd480clM6TBziZ8vyorGY58yH2JqMFSKP1pwvRTeCGJSNKbCAeIPE2e VGfl0CciUakuIqD7/sPPKrDK1rwzyKGkvdbTRtsdNmecyYloGEcSyv7UVK/Lr4+IUvSw dcs3H7xprH5czIFBPen7/5pTcRINMYlL4xa1mAxpcM8iLqrYQNSpyVaDD637ucmXVEb1 SURWGhwGjfCJTvyqWElmrsQnaWScrV/sygm//yecVS1enY8/T1wfWM+nnObS77Nx0zmY scwZzgaSljiarlLZkwLLv4hojwVU+E8/1K41TYy68uw0G3wnh7t+8qvuHCfBQsUxF0sS 0kTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=X1ffVu6Vb8FU1aen0pD8PW3t8MRrTZq2juCamyoHnXM=; b=TyM9KcoatlnWAokf11gehhu74xeTwdNakOESpWHK/Jjd21SgNBatgPSVFguhSDLqUk puyvZbKoKlVSPFiE8Nf0wTwvCyCgzdsFemKEQXYUNz2r+QR7XVtkdN0Q/9bJ8aNbYyoG PPxNtNCIxk/yJ8D2oqUYv/SZKfSuVAgiOTrmHFphWABOj5+NwFuMQAoY3s83Tsj+mkcH 0wiEftfhGAT1rpPNCGliVb7D4wr0pnXHsuLxmRw6tLqxvgTXVdUxNc8hacFPMl4eUL1Q ri9JyQrOLiOlqsUxSK/SxKtMv8FVcB3TbMfSM1EGGzoDtKP0SrGN44FVRdQyl9MNDdJa ojgQ== 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 e62si22998711pfh.254.2019.07.26.06.46.32; Fri, 26 Jul 2019 06:46:32 -0700 (PDT) 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 S2388719AbfGZNqb (ORCPT + 29 others); Fri, 26 Jul 2019 09:46:31 -0400 Received: from foss.arm.com ([217.140.110.172]:44088 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388664AbfGZNqN (ORCPT ); Fri, 26 Jul 2019 09:46:13 -0400 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 E3AE8152D; Fri, 26 Jul 2019 06:46:12 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id ABB1D3F694; Fri, 26 Jul 2019 06:46:11 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Volodymyr Babchuk , Gaku Inami , Etienne Carriere Subject: [PATCH v2 6/6] firmware: arm_scmi: Check if platform has released shmem before using Date: Fri, 26 Jul 2019 14:45:31 +0100 Message-Id: <20190726134531.8928-7-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726134531.8928-1-sudeep.holla@arm.com> References: <20190726134531.8928-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sometimes platfom may take too long to respond to the command and OS might timeout before platform transfer the ownership of the shared memory region to the OS with the response. Since the mailbox channel associated with the channel is freed and new commands are dispatch on the same channel, OS needs to wait until it gets back the ownership. If not, either OS may end up overwriting the platform response for the last command(which is fine as OS timed out that command) or platform might overwrite the payload for the next command with the response for the old. The latter is problematic as platform may end up interpretting the response as the payload. In order to avoid such race, let's wait until the OS gets back the ownership before we prepare the shared memory with the payload for the next command. Reported-by: Jim Quinlan Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 69bf85fea967..765573756987 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -265,6 +265,14 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m) struct scmi_chan_info *cinfo = client_to_scmi_chan_info(cl); struct scmi_shared_mem __iomem *mem = cinfo->payload; + /* + * Ideally channel must be free by now unless OS timeout last + * request and platform continued to process the same, wait + * until it releases the shared memory, otherwise we may endup + * overwriting it's response with new command payload or vice-versa + */ + spin_until_cond(ioread32(&mem->channel_status) & + SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE); /* Mark channel busy + clear error */ iowrite32(0x0, &mem->channel_status); iowrite32(t->hdr.poll_completion ? 0 : SCMI_SHMEM_FLAG_INTR_ENABLED,