Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3108891pxv; Mon, 12 Jul 2021 09:28:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAkQm6V9NwdQgH7+Xo9Ru9o30+OkJgd9aaZ0aLuPr1vmsiCxmzWQJd0VVHBMdFznLn1R8x X-Received: by 2002:a6b:6209:: with SMTP id f9mr37816529iog.147.1626107329891; Mon, 12 Jul 2021 09:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626107329; cv=none; d=google.com; s=arc-20160816; b=pmFCikmcw0qfmxdlkLW9Wh2PMaeQgfeGb8ezejcoGjITs1l+8Cq0l+XU8b/Wj8GgEu OZIMO6CMDvJUbM5bEyDqeOrKScbV+F1TzGFIyXTzLwKXfdJowEQyDkJpAeweKwGV2QDp K9pA0QQNVtbc6CDgwz8n5aFIU8ZCwRnqatZj1KkEjPKJxbrnsPvJd0HYZeGeUqzSVZVn tOmDyNP7zQnR/SWVj9plauAInTNG4Zt1qYMrjCbnXCFlqRBC1hxaH4F+b6yYmPmmd34/ NVyiWVCAl9pahsxz9ww//Lzr8z6aX2sy0cI4tPPmUMwhvGKu5VMq3bYyJ+0Vgv/JsYR2 Ri3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=M22b0zLCzCCpvrGTspPpjrghyv3IHI3s1t9OGnhkwrM=; b=Llyo0uQOE3oBxfXMvVfkGLjDTF1IfGSj5Qt8ool6Ormcifxer25M0ambL76jeEgcJ/ wjMJ/blH0wWSe8Wol7VYuVbNaKx2GBJF1JkL8sVhQc17/0A8Q+mk1bi7OzDpvUqUwgIe 4cQu03l8OdbuJMP2dkl/hNoil3K7Z2yfBzCk7jbMU4w5LecKGF7Ld0ZFnshQqwIiO5eA S+h/B0RS4hFrJrZYOBOvRpQ0qTvLUioPvsv4+TvSGO7e7mtkqqPg0oyLZ16EzUM94WOL kBnavlnuSDbRsZgTa1221s9Fa2eqdxM+xGYtG29yedHeyso45Y1faVgb+f4y3L73snba eVHQ== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si16699329ilj.0.2021.07.12.09.28.38; Mon, 12 Jul 2021 09:28:49 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234097AbhGLQ3u (ORCPT + 99 others); Mon, 12 Jul 2021 12:29:50 -0400 Received: from foss.arm.com ([217.140.110.172]:58002 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233814AbhGLQ3p (ORCPT ); Mon, 12 Jul 2021 12:29:45 -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 54C6A1FB; Mon, 12 Jul 2021 09:26:56 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8751C3F774; Mon, 12 Jul 2021 09:26:54 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, cristian.marussi@arm.com Subject: [PATCH v3 5/8] firmware: arm_scmi: Add is_transport_atomic() handle method Date: Mon, 12 Jul 2021 17:26:22 +0100 Message-Id: <20210712162626.34705-6-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210712162626.34705-1-cristian.marussi@arm.com> References: <20210712162626.34705-1-cristian.marussi@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a method to check if the underlying transport configured for an SCMI instance is configured to support atomic transaction of SCMI commands. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 16 ++++++++++++++++ include/linux/scmi_protocol.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index fa9fea9cb3e6..43797b4f56e7 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -1404,6 +1404,21 @@ static void scmi_devm_protocol_put(struct scmi_device *sdev, u8 protocol_id) WARN_ON(ret); } +/** + * scmi_is_transport_atomic - Method to check if underlying transport for an + * SCMI instance is configured as atomic. + * + * @handle: A reference to the SCMI platform instance. + * + * Return: True if transport is configured as atomic + */ +static bool scmi_is_transport_atomic(const struct scmi_handle *handle) +{ + struct scmi_info *info = handle_to_scmi_info(handle); + + return info->desc->atomic_capable; +} + static inline struct scmi_handle *scmi_handle_get_from_info_unlocked(struct scmi_info *info) { @@ -1920,6 +1935,7 @@ static int scmi_probe(struct platform_device *pdev) handle->version = &info->version; handle->devm_protocol_get = scmi_devm_protocol_get; handle->devm_protocol_put = scmi_devm_protocol_put; + handle->is_transport_atomic = scmi_is_transport_atomic; if (desc->ops->link_supplier) { ret = desc->ops->link_supplier(dev); diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 79d0a1237e6c..b28eb7c104e7 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -608,6 +608,13 @@ struct scmi_notify_ops { * @devm_protocol_get: devres managed method to acquire a protocol and get specific * operations and a dedicated protocol handler * @devm_protocol_put: devres managed method to release a protocol + * @is_transport_atomic: method to check if the underlying transport for this + * instance handle is configured to support atomic + * transactions for commands. + * Some users of the SCMI stack in the upper layers could + * be interested to know if they can assume SCMI + * command transactions associated to this handle will + * never sleep and act accordingly. * @notify_ops: pointer to set of notifications related operations */ struct scmi_handle { @@ -618,6 +625,7 @@ struct scmi_handle { (*devm_protocol_get)(struct scmi_device *sdev, u8 proto, struct scmi_protocol_handle **ph); void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto); + bool (*is_transport_atomic)(const struct scmi_handle *handle); const struct scmi_notify_ops *notify_ops; }; -- 2.17.1