linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Bjorn Helgaas <helgaas@kernel.org>,
	Wesley Sheng <wesley.sheng@microchip.com>
Cc: kurt.schwemmer@microsemi.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, wesleyshenggit@sina.com
Subject: Re: [PATCH 5/5] switchtec: MRPC DMA mode implementation
Date: Wed, 12 Dec 2018 15:58:22 -0700	[thread overview]
Message-ID: <b96a3667-de25-9e51-bbdb-406cc4b879f3@deltatee.com> (raw)
In-Reply-To: <20181212225201.GL99796@google.com>



On 2018-12-12 3:52 p.m., Bjorn Helgaas wrote:
> On Mon, Dec 10, 2018 at 05:12:24PM +0800, Wesley Sheng wrote:
>> MRPC normal mode requires the host to read the MRPC command status and
>> output data from BAR. This results in high latency responses from the
>> Memory Read TLP and potential Completion Timeout (CTO).
>>
>> MRPC DMA mode implementation includes:
>> Macro definitions for registers and data structures corresponding to
>> MRPC DMA mode.
>>
>> Add module parameter use_dma_mrpc to select between MRPC DMA mode and
>> MRPC normal mode.
>>
>> Add MRPC mode functionality to:
>> * Retrieve MRPC DMA mode version
>> * Allocate DMA buffer, ISR registration, and enable DMA function during
>>   initialization
>> * Check MRPC execution status and collect execution results from DMA buffer
>> * Release DMA buffer and disable DMA function when unloading module
>>
>> MRPC DMA mode is a new feature of firmware and the driver will fall back
>> to MRPC normal mode if there is no support in the legacy firmware.
>>
>> Include <linux/io-64-nonatomic-lo-hi.h> so that readq/writeq is replaced
>> by two readl/writel on systems that do not support it.
>>
>> Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com>
>> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
>> ---
>>  drivers/pci/switch/switchtec.c | 108 +++++++++++++++++++++++++++++++++++++----
>>  include/linux/switchtec.h      |  16 ++++++
>>  2 files changed, 114 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
>> index 0b8862b..6b726cb 100644
>> --- a/drivers/pci/switch/switchtec.c
>> +++ b/drivers/pci/switch/switchtec.c
>> @@ -13,7 +13,7 @@
>>  #include <linux/uaccess.h>
>>  #include <linux/poll.h>
>>  #include <linux/wait.h>
>> -
>> +#include <linux/io-64-nonatomic-lo-hi.h>
>>  #include <linux/nospec.h>
>>  
>>  MODULE_DESCRIPTION("Microsemi Switchtec(tm) PCIe Management Driver");
>> @@ -25,6 +25,11 @@ static int max_devices = 16;
>>  module_param(max_devices, int, 0644);
>>  MODULE_PARM_DESC(max_devices, "max number of switchtec device instances");
>>  
>> +static bool use_dma_mrpc = 1;
>> +module_param(use_dma_mrpc, bool, 0644);
>> +MODULE_PARM_DESC(use_dma_mrpc,
>> +		 "Enable the use of the DMA MRPC feature");
> 
> What's the purpose of the module parameter?  Can't you automatically
> figure out whether the firmware supports DMA mode?
> 
> Module parameters make life difficult for users and lead to code
> that's rarely used and poorly tested, so I think we should avoid them
> whenever we can.
> 
> If you *can't* automatically figure out when to use DMA, please make
> it clear in the changelog that the "use_dma_mrpc" parameter is
> required with legacy firmware.  And in that case, it seems like it
> should be named "disable_dma" or similar, since it defaults to being
> enabled.

The code should already automatically determine whether the firmware
supports DMA or not. This parameter is just to aid debugging/testing so
we can run the module without DMA even if the firmware indicates it has
support.

It's not that critical so I'm sure we can remove it at this point if you
don't think that's a good enough justification.

Logan

  reply	other threads:[~2018-12-12 22:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10  9:12 [PATCH 0/5] Switchtec MRPC DMA mode support Wesley Sheng
2018-12-10  9:12 ` [PATCH 1/5] switchtec: Remove immediate status check after submit a MRPC command Wesley Sheng
2018-12-10  9:12 ` [PATCH 2/5] switchtec: Set DMA coherent mask in Switchtec driver Wesley Sheng
2018-12-10  9:12 ` [PATCH 3/5] switchtec: A temporary variable should be used for the flags of switchtec_ioctl_event_ctl Wesley Sheng
2018-12-12 22:43   ` Bjorn Helgaas
2018-12-12 22:52     ` Logan Gunthorpe
2018-12-10  9:12 ` [PATCH 4/5] switchtec: Improve MRPC efficiency by leveraging write combining Wesley Sheng
2018-12-10  9:12 ` [PATCH 5/5] switchtec: MRPC DMA mode implementation Wesley Sheng
2018-12-12 22:52   ` Bjorn Helgaas
2018-12-12 22:58     ` Logan Gunthorpe [this message]
2018-12-13 15:16       ` Bjorn Helgaas
2018-12-13 15:17   ` Bjorn Helgaas
2018-12-13 16:46     ` Logan Gunthorpe
2018-12-13 15:20 ` [PATCH 0/5] Switchtec MRPC DMA mode support Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2018-11-15  9:43 Wesley Sheng
2018-11-15  9:44 ` [PATCH 5/5] switchtec: MRPC DMA mode implementation Wesley Sheng

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=b96a3667-de25-9e51-bbdb-406cc4b879f3@deltatee.com \
    --to=logang@deltatee.com \
    --cc=helgaas@kernel.org \
    --cc=kurt.schwemmer@microsemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=wesley.sheng@microchip.com \
    --cc=wesleyshenggit@sina.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).