Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5501046ybv; Mon, 17 Feb 2020 21:52:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyMVNnXnUI3yAcVE0Sns9hRNRvDggv7kk2dx/oFPc1vwdNEXsf4jDWhB13WuWjC3tTIJ+6p X-Received: by 2002:a54:4085:: with SMTP id i5mr264400oii.17.1582005137433; Mon, 17 Feb 2020 21:52:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582005137; cv=none; d=google.com; s=arc-20160816; b=06hBLl7CZNJPjS5W5Jj3oOuUOgtJrIl9UHCkClLiItS+eLOnXjY/QORJgG/vzLBV2/ spCJJ8Vswpl6UqSME3v/sENEGbkecdiMTJHGdCFhD9PxQe/0aRlKxmnRJWnlOy/of7Yb D4RgIY8ScquXQHd3oyieoEnXTmFQMjLcVHnnJQsl4Fk2YK7EvOVjq94Hm+5t336WEJxP NCUbTJrdaEX/7gxkkB85TRO7lHEpYEgQ0SHfHegirRu4Zr1mJM8hQ+4SGoihlJwraL/7 N6G7aZg84LTBmhqQ2uGCOj6cCJSjbfnwIlVgK4jUv74DnMEEiUb4U3yZ5V3+7d2A2nRT hjWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ce8OOkWfjw5jVWk59ugGKRVgBYm6HB1xi8c9ebl4I5g=; b=DSA5fC5sqLcQi/jFFctfoNB4c78QwrFDunywgBdWSBpXnb0/O48nRbGNVI86H09jE7 mntfIZNkeuBJyk2KpGVsmci4QaQaT/WvjMZEA1vL59CV3AMKIcGutFE8YIv6FIc2CNS6 uH0IJDZsp57H7AONCiwQgVhibFshjNuS1WAtGRJbSzOlxl3INhctp9evEhDwrqPmA+PI PKyogf4HqNFV/8ctBYNiyEGaxsY69YXksN/DFzqF6Y+LQNKA1sWW0PzRaWeZWSN12rfR MCJFHG/qeBImS3bfTHEEoX+Rx+rqObDa0e10OZNnp+RL4UBdk8Ps6XSjcrMOIEM1HnPA +hKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p6vDnXRx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a92si1249448otc.294.2020.02.17.21.52.02; Mon, 17 Feb 2020 21:52:17 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=p6vDnXRx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbgBRFvw (ORCPT + 99 others); Tue, 18 Feb 2020 00:51:52 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35857 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgBRFvw (ORCPT ); Tue, 18 Feb 2020 00:51:52 -0500 Received: by mail-pg1-f193.google.com with SMTP id d9so10400866pgu.3 for ; Mon, 17 Feb 2020 21:51:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ce8OOkWfjw5jVWk59ugGKRVgBYm6HB1xi8c9ebl4I5g=; b=p6vDnXRx8Lt2QQo5iqGpTCkRuqfGnM9Rzn4zwWMk7BAnTDsm2IuHaKSL+naL4/1bWQ UgCdjP0L3Sx5n7jcE6joCY05E56kEA4db4MeGbgQKlZVvY6bY5mp8BrsWvQr91/J/bXO e6vZ1jKdUPOeNcGUUa2lFF3PlWw9z5rSHfv9uhTF5Z1n4/YuLqmNK9iYaCs/7JN3Bhwt hUpaQ4z7bhBFfF1cV46ZbGoL2Pon2s2SKtpRLShSoT0kSlMYPAydUkyFvtavUjiwvyeI ja/KrwKZds8ZNePpKfIC69786U+lrT52WmnnOBfNX2pgUIyEsPv5Uu/G1ieaWVjLt3Jl uouw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ce8OOkWfjw5jVWk59ugGKRVgBYm6HB1xi8c9ebl4I5g=; b=q08ePG3wJWbCua5yyi+bdk6SXVwx/tX2YfXXhRSfZt7eGX6VhMPddjRsNvRzHJtC4b l0h+Y/u5l3OydoFd2yOBpYBibwsG5FdkKn10iTKFpDlKHGlAYXcSgx+lBtEtgd198JCg 2GuxE85bBcbHEuLhdd6TJbyU5Cnxi0PQbQa8usb8ao6NaJBhr6oUivvUbC2vDLdR2YKK 1i1gM/Y60BCVKFT0mLQNsPUuJsKPtw4inqRdaQFAq6onqzebMM6GVRedLuSZs3J1zgfT ZNGX8q7D9yV49g9Ot5GJDeNx6++gtviojvjiJ9F/XlFUm71AgXY4Rj3qXakycKnAJy2R cg4A== X-Gm-Message-State: APjAAAXP4XPcMfyaKJ9i+nrLMIu0cU/Xi8UnT+TRPjA3nQY201MGkdeg euG7JyEAirvu3N7d55M1vIsFXhJD0w== X-Received: by 2002:a63:7ce:: with SMTP id 197mr10404414pgh.429.1582005111632; Mon, 17 Feb 2020 21:51:51 -0800 (PST) Received: from Mani-XPS-13-9360 ([2409:4072:604:4c69:39d7:c38:1134:8ea0]) by smtp.gmail.com with ESMTPSA id b4sm2431774pfd.18.2020.02.17.21.51.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Feb 2020 21:51:50 -0800 (PST) Date: Tue, 18 Feb 2020 11:21:42 +0530 From: Manivannan Sadhasivam To: Arnd Bergmann Cc: gregkh , smohanad@codeaurora.org, Jeffrey Hugo , Kalle Valo , Bjorn Andersson , hemantk@codeaurora.org, linux-arm-msm , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 11/16] bus: mhi: core: Add support for data transfer Message-ID: <20200218055142.GA29573@Mani-XPS-13-9360> References: <20200131135009.31477-1-manivannan.sadhasivam@linaro.org> <20200131135009.31477-12-manivannan.sadhasivam@linaro.org> <20200217164751.GA7305@Mani-XPS-13-9360> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200217164751.GA7305@Mani-XPS-13-9360> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On Mon, Feb 17, 2020 at 10:17:51PM +0530, Manivannan Sadhasivam wrote: > Hi Arnd, > > On Mon, Feb 17, 2020 at 05:13:37PM +0100, Arnd Bergmann wrote: > > On Fri, Jan 31, 2020 at 2:51 PM Manivannan Sadhasivam > > wrote: > > > > > @@ -648,6 +715,31 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, > > > mhi_chan->db_cfg.pollcfg = ch_cfg->pollcfg; > > > mhi_chan->xfer_type = ch_cfg->data_type; > > > > > > + switch (mhi_chan->xfer_type) { > > > + case MHI_BUF_RAW: > > > + mhi_chan->gen_tre = mhi_gen_tre; > > > + mhi_chan->queue_xfer = mhi_queue_buf; > > > + break; > > > + case MHI_BUF_SKB: > > > + mhi_chan->queue_xfer = mhi_queue_skb; > > > + break; > > > + case MHI_BUF_SCLIST: > > > + mhi_chan->gen_tre = mhi_gen_tre; > > > + mhi_chan->queue_xfer = mhi_queue_sclist; > > > + break; > > > + case MHI_BUF_NOP: > > > + mhi_chan->queue_xfer = mhi_queue_nop; > > > + break; > > > + case MHI_BUF_DMA: > > > + case MHI_BUF_RSC_DMA: > > > + mhi_chan->queue_xfer = mhi_queue_dma; > > > + break; > > > + default: > > > + dev_err(mhi_cntrl->dev, > > > + "Channel datatype not supported\n"); > > > + goto error_chan_cfg; > > > + } > > > + > > > > While looking through the driver to see how the DMA gets handled, I came > > across the multitude of mhi_queue_* functions, which seems like a > > layering violation to me, given that they are all implemented by the > > core code as well, and the client driver needs to be aware of > > which one to call. Are you able to lift these out of the common interface > > and make the client driver call these directly, or maybe provide a direct > > interface based on mhi_buf_info to replace these? > > > > It sounds reasonable to me. Let me discuss this internally with Qcom guys to > see if they have any objections. > I looked into this in detail and found that the queue_xfer callbacks are tied to the MHI channels. For instance, the callback gets attached to ul_chan (uplink channel) and dl_chan (downlink channel) during controller registration. And when the device driver calls the callback, the MHI stack calls respective queue function for the relevant channel. For instance, ``` int mhi_queue_transfer(struct mhi_device *mhi_dev, enum dma_data_direction dir, void *buf, size_t len, enum mhi_flags mflags) { if (dir == DMA_TO_DEVICE) return mhi_dev->ul_chan->queue_xfer(mhi_dev, mhi_dev->ul_chan, buf, len, mflags); else return mhi_dev->dl_chan->queue_xfer(mhi_dev, mhi_dev->dl_chan, buf, len, mflags); } ``` If we use the direct queue API's this will become hard to handle. So, I'll keep it as it is. Thanks, Mani > Thanks, > Mani > > > Arnd