All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: arnd@arndb.de, smohanad@codeaurora.org, jhugo@codeaurora.org,
	kvalo@codeaurora.org, bjorn.andersson@linaro.org,
	hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 02/16] bus: mhi: core: Add support for registering MHI controllers
Date: Mon, 17 Feb 2020 12:59:30 +0100	[thread overview]
Message-ID: <20200217115930.GA218071@kroah.com> (raw)
In-Reply-To: <20200217052743.GA4809@Mani-XPS-13-9360>

On Mon, Feb 17, 2020 at 10:57:43AM +0530, Manivannan Sadhasivam wrote:
> Hi Greg,
> 
> On Thu, Feb 13, 2020 at 07:53:02AM -0800, Greg KH wrote:
> > On Thu, Feb 13, 2020 at 09:18:09PM +0530, Manivannan Sadhasivam wrote:
> > > Hi Greg,
> > > 
> > > On Thu, Feb 13, 2020 at 07:34:18AM -0800, Greg KH wrote:
> > > > On Thu, Feb 13, 2020 at 08:50:13PM +0530, Manivannan Sadhasivam wrote:
> > > > > On Tue, Feb 11, 2020 at 11:20:55AM -0800, Greg KH wrote:
> > > > > > On Wed, Feb 12, 2020 at 12:11:30AM +0530, Manivannan Sadhasivam wrote:
> > > > > > > Hi Greg,
> > > > > > > 
> > > > > > > On Thu, Feb 06, 2020 at 05:57:55PM +0100, Greg KH wrote:
> > > > > > > > On Fri, Jan 31, 2020 at 07:19:55PM +0530, Manivannan Sadhasivam wrote:
> > > > > > > > > --- /dev/null
> > > > > > > > > +++ b/drivers/bus/mhi/core/init.c
> > > > > > > > > @@ -0,0 +1,407 @@
> > > > > > > > > +// SPDX-License-Identifier: GPL-2.0
> > > > > > > > > +/*
> > > > > > > > > + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
> > > > > > > > > + *
> > > > > > > > > + */
> > > > > > > > > +
> > > > > > > > > +#define dev_fmt(fmt) "MHI: " fmt
> > > > > > > > 
> > > > > > > > This should not be needed, right?  The bus/device name should give you
> > > > > > > > all you need here from what I can tell.  So why is this needed?
> > > > > > > > 
> > > > > > > 
> > > > > > > The log will have only the device name as like PCI-E. But that won't specify
> > > > > > > where the error is coming from. Having "MHI" prefix helps the users to
> > > > > > > quickly identify that the error is coming from MHI stack.
> > > > > > 
> > > > > > If the driver binds properly to the device, the name of the driver will
> > > > > > be there in the message, so I suggest using that please.
> > > > > > 
> > > > > > No need for this prefix...
> > > > > > 
> > > > > 
> > > > > So the driver name will be in the log but that won't help identifying where
> > > > > the log is coming from. This is more important for MHI since it reuses the
> > > > > `struct device` of the transport device like PCI-E. For instance, below is
> > > > > the log without MHI prefix:
> > > > > 
> > > > > [   47.355582] ath11k_pci 0000:01:00.0: Requested to power on
> > > > > [   47.355724] ath11k_pci 0000:01:00.0: Power on setup success
> > > > > 
> > > > > As you can see, this gives the assumption that the log is coming from the
> > > > > ath11k_pci driver. But the reality is, it is coming from MHI bus.
> > > > 
> > > > Then you should NOT be trying to "reuse" a struct device.
> > > > 
> > > > > With the prefix added, we will get below:
> > > > > 
> > > > > [   47.355582] ath11k_pci 0000:01:00.0: MHI: Requested to power on
> > > > > [   47.355724] ath11k_pci 0000:01:00.0: MHI: Power on setup success
> > > > > 
> > > > > IMO, the prefix will give users a clear idea of logs and that will be very
> > > > > useful for debugging.
> > > > > 
> > > > > Hope this clarifies.
> > > > 
> > > > Don't try to reuse struct devices, if you are a bus, have your own
> > > > devices as that's the correct way to do things.
> > > > 
> > > 
> > > I assumed that the buses relying on a different physical interface for the
> > > actual communication can reuse the `struct device`. I can see that the MOXTET
> > > bus driver already doing it. It reuses the `struct device` of SPI.
> > 
> > How can you reuse anything?
> > 
> > > And this assumption has deep rooted in MHI bus design.
> > 
> > Maybe I do not understand what this is at all, but a device can only be
> > on one "bus" at a time.  How is that being broken here?
> > 
> 
> Let me share some insight on how it is being used:
> 
> The MHI bus sits on top of the actual physical bus like PCI-E and requires
> the physical bus for doing activities like allocating I/O virtual address,
> runtime PM etc... The part which gets tied to the PCI-E from MHI is called MHI
> controller driver. This MHI controller driver is also the actual PCI-E driver
> managing the device.
> 
> For instance, we have QCA6390 PCI-E WLAN device. For this device, there is a
> ath11k PCI-E driver and the same driver also registers as a MHI controller and
> acts as a MHI controller driver. This is where I referred to reusing the PCI-E
> struct device. It's not that MHI bus itself is reusing the PCI-E struct device
> but we need the PCI-E device pointer to do above mentioned IOVA, PM operations
> in some places. One of the usage is below:
> 
> ```
> void *buf = dma_alloc_coherent(mhi_cntrl->dev, size, dma_handle, gfp);
> ```

Wait, why do you need to call this with the parent dev?  Why not with
your struct device?  What does the parent pointer have that yours does
not?  Is it not correctly having whatever dma attributes the parent has
set properly for your device as well?  If not, why not just fix that and
then _your_ device can be doing the allocation?

thanks,

greg k-h

  parent reply	other threads:[~2020-02-17 11:59 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 13:49 [PATCH v2 00/16] Add MHI bus support Manivannan Sadhasivam
2020-01-31 13:49 ` [PATCH v2 01/16] docs: Add documentation for MHI bus Manivannan Sadhasivam
2020-01-31 22:57   ` Jeffrey Hugo
2020-01-31 13:49 ` [PATCH v2 02/16] bus: mhi: core: Add support for registering MHI controllers Manivannan Sadhasivam
2020-02-06 16:56   ` Greg KH
2020-02-11 19:11     ` Manivannan Sadhasivam
2020-02-11 19:22       ` Greg KH
2020-02-13 15:22         ` Manivannan Sadhasivam
2020-02-06 16:57   ` Greg KH
2020-02-11 18:41     ` Manivannan Sadhasivam
2020-02-11 19:20       ` Greg KH
2020-02-13 15:20         ` Manivannan Sadhasivam
2020-02-13 15:34           ` Greg KH
2020-02-13 15:48             ` Manivannan Sadhasivam
2020-02-13 15:53               ` Greg KH
2020-02-14 16:41                 ` Jeffrey Hugo
2020-02-17  5:27                 ` Manivannan Sadhasivam
2020-02-17 11:45                   ` Greg KH
2020-02-17 11:53                     ` Manivannan Sadhasivam
2020-02-17 11:59                   ` Greg KH [this message]
2020-02-17 13:04                     ` Manivannan Sadhasivam
2020-02-17 14:15                       ` Greg KH
2020-02-17 16:04                         ` Arnd Bergmann
2020-02-17 16:32                           ` Greg KH
2020-02-17 17:50                             ` Manivannan Sadhasivam
2020-02-06 17:08   ` Jeffrey Hugo
2020-01-31 13:49 ` [PATCH v2 03/16] bus: mhi: core: Add support for registering MHI client drivers Manivannan Sadhasivam
2020-01-31 23:00   ` Jeffrey Hugo
2020-01-31 13:49 ` [PATCH v2 04/16] bus: mhi: core: Add support for creating and destroying MHI devices Manivannan Sadhasivam
2020-02-06 16:16   ` Jeffrey Hugo
2020-01-31 13:49 ` [PATCH v2 05/16] bus: mhi: core: Add support for ringing channel/event ring doorbells Manivannan Sadhasivam
2020-02-06 20:14   ` Jeffrey Hugo
2020-01-31 13:49 ` [PATCH v2 06/16] bus: mhi: core: Add support for PM state transitions Manivannan Sadhasivam
2020-02-06 20:15   ` Jeffrey Hugo
2020-01-31 13:50 ` [PATCH v2 07/16] bus: mhi: core: Add support for basic PM operations Manivannan Sadhasivam
2020-02-06 20:15   ` Jeffrey Hugo
2020-01-31 13:50 ` [PATCH v2 08/16] bus: mhi: core: Add support for downloading firmware over BHIe Manivannan Sadhasivam
2020-02-06 20:15   ` Jeffrey Hugo
2020-01-31 13:50 ` [PATCH v2 09/16] bus: mhi: core: Add support for downloading RDDM image during panic Manivannan Sadhasivam
2020-02-06 16:41   ` Jeffrey Hugo
2020-02-06 20:17     ` Jeffrey Hugo
2020-01-31 13:50 ` [PATCH v2 10/16] bus: mhi: core: Add support for processing events from client device Manivannan Sadhasivam
2020-02-06 20:16   ` Jeffrey Hugo
2020-01-31 13:50 ` [PATCH v2 11/16] bus: mhi: core: Add support for data transfer Manivannan Sadhasivam
2020-02-06 20:16   ` Jeffrey Hugo
2020-02-17 16:13   ` Arnd Bergmann
2020-02-17 16:47     ` Manivannan Sadhasivam
2020-02-18  5:51       ` Manivannan Sadhasivam
2020-02-18 14:34         ` Arnd Bergmann
2020-01-31 13:50 ` [PATCH v2 12/16] bus: mhi: core: Add uevent support for module autoloading Manivannan Sadhasivam
2020-02-06 20:16   ` Jeffrey Hugo
2020-01-31 13:50 ` [PATCH v2 13/16] MAINTAINERS: Add entry for MHI bus Manivannan Sadhasivam
2020-02-03 10:16   ` Andy Shevchenko
2020-02-04  7:05     ` Manivannan Sadhasivam
2020-01-31 13:50 ` [PATCH v2 14/16] net: qrtr: Add MHI transport layer Manivannan Sadhasivam
2020-02-03 18:12   ` Jakub Kicinski
2020-02-04  8:19     ` Manivannan Sadhasivam
2020-02-07  0:14       ` Chris Lew
2020-02-11  3:50         ` Manivannan Sadhasivam
2020-02-12  1:01           ` Chris Lew
2020-01-31 13:50 ` [PATCH v2 15/16] net: qrtr: Do not depend on ARCH_QCOM Manivannan Sadhasivam
2020-01-31 13:50 ` [PATCH v2 16/16] soc: qcom: Do not depend on ARCH_QCOM for QMI helpers Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200217115930.GA218071@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=hemantk@codeaurora.org \
    --cc=jhugo@codeaurora.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=smohanad@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.