Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2814326pxj; Sun, 6 Jun 2021 15:16:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1NILcjmLUS3X0IH0L6LH45kGw0A9n20V7UbDaQrgDmkzxVi4pH1EjFPxcC8KQ1qDmEBnE X-Received: by 2002:a17:906:e104:: with SMTP id gj4mr15494300ejb.350.1623017800847; Sun, 06 Jun 2021 15:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623017800; cv=none; d=google.com; s=arc-20160816; b=HrFL0HchqPKNR+wzPfeJPGWTGeFS0Y/nhrKIWtGwHqFIr+VOO7oVAFY8kdPw9KWliT ZQP/wKvvmQ/kLxvvXG3S7qdhHFK4ESt1439X7zp1PfRZNg9sKJe1MsTj5wZVNg7n9C0T wFfSew73VLekh5gppQzaGDG4mcYR8LYX3QptXbnRSfkdZr95eY240oMAxC76S7koMHwf gV7Go1/2+swLAMLvClqZO965oif9DHJTimEVEnG4Awnwx+r2DclTks1q9CZC1BTZuFA6 VzJwYgCazgjiW/sK26ImIDs2lLwX7O52RzUrDP571uvzRtEwrgBwQTmOsS6tV0GRPsTF xtPQ== 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=6FDiQ4k88vdG4O6vSopbJ9tBJh2BIVGmGLyXtuTuelg=; b=SeNW3GBfZhWEti7G9+OigE5NoRO9t9dEpzWGO6Y0X4wJRtSjxEo4AzL4pPTFuvCyYA Jmy13QjK+66P+Ac1uPkdABv/fSVeZHraTqZnu/hh2pEaaa+tGiERrCOg6ZODtaZ4HnIr fm9gjyTaRKAPtzUYxaQbR1FkD2oGtKMuWl4YedpzFYfWKo+RuQ51rG2K9Y1P6COheiPe 7GXesTbK/+2kS/v5t4hoBvoLGvTEPgovD4ThT30lQm0KY8UCUwnSf+Z6WIxeCMTteF/w t08r0CR0PZC8mIrd1A46syZxZLM1irWxFWTUEhH3tfpFgWoIgoszoEmy5U9KDf5EIpe9 MnXQ== 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 j19si5473171edj.401.2021.06.06.15.16.17; Sun, 06 Jun 2021 15:16:40 -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 S231163AbhFFWPQ (ORCPT + 99 others); Sun, 6 Jun 2021 18:15:16 -0400 Received: from foss.arm.com ([217.140.110.172]:46392 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbhFFWPO (ORCPT ); Sun, 6 Jun 2021 18:15:14 -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 0505F31B; Sun, 6 Jun 2021 15:13:24 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB9A93F719; Sun, 6 Jun 2021 15:13:21 -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: [RFC PATCH 07/10] firmware: arm_scmi: Add is_transport_atomic() handle method Date: Sun, 6 Jun 2021 23:12:29 +0100 Message-Id: <20210606221232.33768-8-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210606221232.33768-1-cristian.marussi@arm.com> References: <20210606221232.33768-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 11bea548947f..c1bf4c4f60d1 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -1062,6 +1062,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) { @@ -1535,6 +1550,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; ret = scmi_txrx_setup(info, dev, SCMI_PROTOCOL_BASE); if (ret) 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