From patchwork Tue May 11 00:20:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 12250369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A6EEC433B4 for ; Tue, 11 May 2021 10:00:06 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 96B0D61363 for ; Tue, 11 May 2021 10:00:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96B0D61363 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=opensynergy.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Kv0xTyKVVGfeaiH72FK+KCutQ+oATdrMFzD88E15VE=; b=CzQ6kMamzjAFiespVjXQaJu/K OBG2TCLfEysKxRkF2ZxPd/azEKca6b06ZzRd8Nt+tecyJha+26jfgylK9u6GIajurcFFVnySDmETJ 4PU1WfvYu4cZM/+xXlOnCAjJxC28Pi1S3TYYI6tDeqZ6DTaKMP1o/VZnnYtFag2seK9fjxHPiLCQ1 n43/mT8uxAPzADw6skHZtDLnl7TMChp/OiDyxTOGC/C4lAwiozISlgygoLYZCuLPsc1mZQU0lV9Jp 9RKWXUOgH09Y3qGvbr82sj7rbN+dpVFyw/MMzTj/ppG1p+EzDTX0TtE/D/Z0YjDLoGGhH9vezqkCx q2UcnRA1g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgPA6-00GnWo-CR; Tue, 11 May 2021 09:58:46 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGoH-00G0nV-Em for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 01:03:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=6+VlSkKWGdjkDM6nZTn7Ha5NxKkKwBbIL6DCLdewkbA=; b=db74ybAu+kb8esNlF/I0CQmO5x +OmDh/NVf7Duj7zAcgEEba0XR0R/cLb+wcOJ5S23L1SEWQeL0Yx/eCdMo2BKqAYTuYbDnhsNdf8Ba FNtcXtjBvxJ0jQC2buV/A4nlKytLb/WSAxPpXHjRp7I+SEwC8I4zXgAs4yOnjRafqZG/5sdA9MbIU 6F7FNfRXqMk5neuOaDv5DeDCG7L6x2ElS+wrINOs7Gk6gMrcVQsUVBIEA1nvSbXJ1L6WegBHYch83 Z/yl1ilQdhD6yvWzSTcxoRri7GMyOlKvrLXJNgnQbtEiMl/s8A60ORkQ97pwbAsv1Vw14801uBc4N mRoJ4z3A==; Received: from mx1.opensynergy.com ([217.66.60.4]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGGQ-009DPu-IO for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 00:28:45 +0000 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id 7D13CA1A2E; Tue, 11 May 2021 02:22:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=srmailgate02; bh=6+VlSkKWGdjk DM6nZTn7Ha5NxKkKwBbIL6DCLdewkbA=; b=CGnQklXHC54GKgHiTz1MnYznchZN K0SvNZczQ/nM6pQopfMiFXgQ1Y5Bz0F1Piarn8SQ6qSXSHWJmqATT06yIQSNRLC3 Mlc8FLjDLl4uToDbeqbSQ3fIF/2RE8zT93ferkKSKP3awqndteNHn+UFhwjhoTJX 73x+yhxH6cgqmgusSRcdlaJL+SdKItlvIMmT54dtJedOH/zwenv8eZnjAESqXSlL FVsCR4Kh4hF8OtbqXUYIVm0+PCrYcyZx0ka8A7wxFGNsYVadRiObSsYAPJEzc3aV 81lzp8hXK0xYmnRCEDkg6ktg0+mcbIJIbnv+jUPn0y5CEyhCq/aBmVlLig== From: Peter Hilber To: , CC: Peter Hilber , Rob Herring , , , , , , , , , Vasyl Vavrychuk , Andriy Tryshnivskyy , Cristian Marussi Subject: [RFC PATCH v3 05/12] firmware: arm_scmi: Add per-device transport private info Date: Tue, 11 May 2021 02:20:33 +0200 Message-ID: <20210511002040.802226-6-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210511002040.802226-1-peter.hilber@opensynergy.com> References: <20210511002040.802226-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-02.open-synergy.com (10.26.10.22) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_172842_824504_9EB0FD2C X-CRM114-Status: GOOD ( 10.79 ) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_172842_824504_9EB0FD2C X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The scmi-virtio transport will link a supplier device to the arm-scmi device in the link_supplier() op. The transport should then save a pointer to the linked device. To enable this, add a transport private info to the scmi_info. (The scmi_info is already reachable through the arm-scmi device driver_data.) Signed-off-by: Peter Hilber --- drivers/firmware/arm_scmi/common.h | 2 ++ drivers/firmware/arm_scmi/driver.c | 35 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index d60e3c26821d..61b22cdeaeeb 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -346,6 +346,8 @@ extern const struct scmi_desc scmi_mailbox_desc; extern const struct scmi_desc scmi_smc_desc; #endif +int scmi_set_transport_info(struct device *dev, void *transport_info); +void *scmi_get_transport_info(struct device *dev); void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr); void scmi_free_channel(struct scmi_chan_info *cinfo, struct idr *idr, int id); diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index df526ff37c6d..581b6c9b3781 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -127,6 +127,7 @@ struct scmi_protocol_instance { * @active_protocols: IDR storing device_nodes for protocols actually defined * in the DT and confirmed as implemented by fw. * @notify_priv: Pointer to private data structure specific to notifications. + * @transport_info: Transport private info * @node: List head * @users: Number of users of this instance */ @@ -145,6 +146,7 @@ struct scmi_info { u8 *protocols_imp; struct idr active_protocols; void *notify_priv; + void *transport_info; struct list_head node; int users; }; @@ -382,6 +384,39 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr) } } +/** + * scmi_set_transport_info() - Set transport private info + * + * @dev: SCMI instance device + * @transport_info: transport private info + * + * Return: 0 on success, otherwise error. + */ +int scmi_set_transport_info(struct device *dev, void *transport_info) +{ + struct scmi_info *info = dev_get_drvdata(dev); + + if (!info) + return -EBADR; + + info->transport_info = transport_info; + return 0; +} + +/** + * scmi_get_transport_info() - Get transport private info + * + * @dev: SCMI instance device + * + * Return: transport private info on success, otherwise NULL. + */ +void *scmi_get_transport_info(struct device *dev) +{ + struct scmi_info *info = dev_get_drvdata(dev); + + return info ? info->transport_info : NULL; +} + /** * xfer_put() - Release a transmit message *