From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.8 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 BD53EC433DB for ; Thu, 7 Jan 2021 14:31:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 53500233CE for ; Thu, 7 Jan 2021 14:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53500233CE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9ay7NA4TId/wW9rT49pJ6HtdWUm9JcBwpdwD/fd4SKQ=; b=ISm+U+pG/vQH1xlrlAiy/LabF lWUWn/4C0LnyTZ8JdEBRSgBLrNmi+maScit2BeN5lPfUYVh/Nt+tYd2ch4W+Ir5LV3Gg7Z8C/3JAd NBcfKkw/Ewwm0E0vkUkeJc04m/htCj4+VhxF2avO6CzjVU+4hwt5diDqCEOL6r5qlxl1s0ad18a1H mcUBnu1hdr4KtXw1POuVuEIdTs94kYPrIpZrATEfN/H8BRZK+x+h+wSq3fARzxnqLEWuwpIDmpQtr oRoDbqDsjr+qez4C2dzyrBvD/E/QwHKiz6ASI/N7i3dhVIrdwiS8exlPrBoeOPFCshjnwkY6iBfvq vsfpYYqkQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxWI0-0001zQ-DF; Thu, 07 Jan 2021 14:29:24 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxWHx-0001yR-LA for linux-arm-kernel@lists.infradead.org; Thu, 07 Jan 2021 14:29:22 +0000 Received: by mail-io1-xd2d.google.com with SMTP id e22so5760585iom.5 for ; Thu, 07 Jan 2021 06:29:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dh6XC7U+zjWbk3Fom9ifE298WJtCaF5athPrOwXpfuA=; b=m0kLNGqgL76RGdbTenkvHSskS+cxFzZ9sS/gfnJcyrNApixnReCUg6zYGwfPofNFWA UsQRSYPj4EJCNy/0pBn8a34hKB+Xghk0NTyMHUjfOixZFGD4CfFVwrIwTt4oNeEdUCYe XcW4en/R+6RQcNQj8PPJwz1YuYIYap2D6fbsEXVeiF6w/AGuBzNsvlb4IDZxqsx6qovV o9a8j1Vg9Eb+zfWC/kAOgFZUbzm7KZqt8sfZAsftYaAZepYTfXDpVB0xxDORBJqlBxwL M7JvogpYmvYAMnJjk+JVJTqQOJCZ8c+AcdOAg9w1OBGjEYJCglqAn0ST0rZTyO6kia5Q nshA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dh6XC7U+zjWbk3Fom9ifE298WJtCaF5athPrOwXpfuA=; b=ZAQeYaxDY7b+AHeq+5KW34Tr2VKGn32At/v69Cos+eANV7Fmt1x/odZlhLwRa8556a uAsBHhdc5pfPcwQ5rwcRHahKc2lCrnVoOFgK24Ew7ERgQ58WrIoRFwFMThFUeWh7DFVX dSVJZhrnD/nfl6xOUpMwgic16HBZZiWFatOGu6mB7cP6uIl45Kg9v5aDcPYUPZKOyxAl OwQgFmWBQz1FuuJAQeaH2nozPveF71RmhG6/JFiGpWuq8JtxxUCtkaKXixUtMIIg9D9g lPl2ZFMrNKa4QToOV0rYh/9xvcwdOWtTLzGnYmXXscAHKwaAru5nDZ4XKJoaUkXJeky2 nK5w== X-Gm-Message-State: AOAM532RlZqmOSkJWTSEt9GWJOCYBiDM0rZ/LUNdIcoz7uXaqkiGXb/R 8z1ZDw23calhe8oOqI27coadbg== X-Google-Smtp-Source: ABdhPJwV3sVAP4CHc+ge/KPWtZKvx7xe9DUUXEZ5m1vUcF32gQt4Ir6N4i//fAhubW38+bnuzlb9wg== X-Received: by 2002:a05:6602:93:: with SMTP id h19mr1486360iob.59.1610029759589; Thu, 07 Jan 2021 06:29:19 -0800 (PST) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id 143sm5117710ila.4.2021.01.07.06.29.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 06:29:19 -0800 (PST) Subject: Re: [PATCH v4 02/37] firmware: arm_scmi: introduce protocol handle definitions To: Cristian Marussi , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20210106201610.26538-1-cristian.marussi@arm.com> <20210106201610.26538-3-cristian.marussi@arm.com> From: Thara Gopinath Message-ID: <19054e89-c117-ef85-444e-8e126a8a9efb@linaro.org> Date: Thu, 7 Jan 2021 09:29:17 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210106201610.26538-3-cristian.marussi@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210107_092921_796331_8AB71861 X-CRM114-Status: GOOD ( 28.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, vincent.guittot@linaro.org, sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, souvik.chakravarty@arm.com, etienne.carriere@linaro.org, lukasz.luba@arm.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/6/21 3:15 PM, Cristian Marussi wrote: > Add basic protocol handles definitions and private data helpers support. > > A protocol handle identifies a protocol instance initialized against a > specific handle; it embeds all the references to the core SCMI xfer methods > that will be needed by a protocol implementation to build and send its own > protocol specific messages using common core methods. > > As such, in the interface, a protocol handle will be passed down from the > core to the protocol specific initialization callback at init time. > > Anyway at this point only definitions are introduced, all protocols > initialization code and SCMI drivers probing is still based on the old > interface, so no functional change. > > Signed-off-by: Cristian Marussi > --- > drivers/firmware/arm_scmi/common.h | 59 ++++++++++++++++++++++++++++++ > drivers/firmware/arm_scmi/driver.c | 45 +++++++++++++++++++++++ > 2 files changed, 104 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h > index e052507dc918..977e31224efe 100644 > --- a/drivers/firmware/arm_scmi/common.h > +++ b/drivers/firmware/arm_scmi/common.h > @@ -149,6 +149,65 @@ int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id, > size_t tx_size, size_t rx_size, struct scmi_xfer **p); > void scmi_reset_rx_to_maxsz(const struct scmi_handle *handle, > struct scmi_xfer *xfer); > + > +struct scmi_xfer_ops; > + > +/** > + * struct scmi_protocol_handle - Reference to an initialized protocol instance > + * > + * @dev: A reference to the associated SCMI instance device (handle->dev). > + * @xops: A reference to a struct holding refs to the core xfer operations that > + * can be used by the protocol implementation to generate SCMI messages. > + * @set_priv: A method to set protocol private data for this instance. > + * @get_priv: A method to get protocol private data previously set. > + * > + * This structure represents a protocol initialized against specific SCMI > + * instance and it will be used as follows: > + * - as a parameter fed from the core to the protocol initialization code so > + * that it can access the core xfer operations to build and generate SCMI > + * messages exclusively for the specific underlying protocol instance. > + * - as an opaque handle fed by an SCMI driver user when it tries to access > + * this protocol through its own protocol operations. > + * In this case this handle will be returned as an opaque object together > + * with the related protocol operations when the SCMI driver tries to access > + * the protocol. > + */ > +struct scmi_protocol_handle { > + struct device *dev; > + const struct scmi_xfer_ops *xops; > + int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv); > + void *(*get_priv)(const struct scmi_protocol_handle *ph); > +}; > + > +/** > + * struct scmi_xfer_ops - References to the core SCMI xfer operations. > + * @version_get: Get this version protocol. > + * @xfer_get_init: Initialize one struct xfer if any xfer slot is free. > + * @reset_rx_to_maxsz: Reset rx size to max transport size. > + * @do_xfer: Do the SCMI transfer. > + * @do_xfer_with_response: Do the SCMI transfer waiting for a response. > + * @xfer_put: Free the xfer slot. > + * > + * Note that all this operations expect a protocol handle as first parameter; > + * they then internally use it to infer the underlying protocol number: this > + * way is not possible for a protocol implementation to forge messages for > + * another protocol. > + */ > +struct scmi_xfer_ops { Maybe move the definition above struct scmi_protocol_handle to avoid a declaration ? -- Warm Regards Thara _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel