Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp965948imu; Thu, 13 Dec 2018 07:20:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/WyTKDauEw1w2BEHqKWRHofWZOxlA1EYUAwEV1MaL/FODhbXuEqwOfILgRDL/73gdVV3xkw X-Received: by 2002:a17:902:3f81:: with SMTP id a1mr23626205pld.258.1544714406992; Thu, 13 Dec 2018 07:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544714406; cv=none; d=google.com; s=arc-20160816; b=uAhq4cZYBtAEeX95RItoMDoIX5fYCl+kYHiiEe8PEpMEWYSaG268noGnaZMWVuhTos 40IgnuUBKhK+H4cQPmW0guocZ3pqqCDv5fV79yY1H4GPGs5uRUilQsoSOkXRnw/4EqF1 y7fvDkFKH6PLvblNF90v13SyAbZyRNk9gIr8UghaMkgfEnUDbJerbuGCHSBCyuRpDWFO W5Aj8DSc14g+u8cDObCjr7Ff44ZzupAabEOYESCTBqsQa3lAzEh4DC2diwSSu3Dm6l+z m3r/jn35jE2Vnc/wGchLmi7+FERkzn0r1OXcawhymBpSNIWn/82zZgtHifOlhCAtqniX FG+g== 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=uECZ4BXk4mjofgEJD0BkvGSVRw8viYqzCPOUN/rwbYU=; b=I7VOuxnyRX7IUkAQkFnTKW9JlCAgqZaKcFu9d/lBAEt6AQPsboVpMJm540t6P6dCD2 gFfa0Q/MlI6oAckqfrrsyrOlnYcCcrEzYSpuT2p6l2cLfv8em+lKL4NnJ+66QYA2OdIt qJfbWop9lH7A+S9w0Qx7Au36UQ4hiwfLxJYF4mGPGzmqUrQRdxseL81peYGuk1v7ZcAW QWhPrGE1M8V/Jgx2WX+hOZ2kh0q8sLYKwjYbqmjmK4XCBvkUKbsaZDgYCD+qtilpS2P9 EyGNpuTyEAHfbqDvuwm6+QrvBVHbzU8kjjZX+EWhyCH8xDYCi3r+V1YzLBGSgT5fyD0d jQ3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xGMWHtSc; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z186si1747799pgd.90.2018.12.13.07.19.40; Thu, 13 Dec 2018 07:20:06 -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=@kernel.org header.s=default header.b=xGMWHtSc; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729551AbeLMPR7 (ORCPT + 99 others); Thu, 13 Dec 2018 10:17:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:52340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729322AbeLMPR6 (ORCPT ); Thu, 13 Dec 2018 10:17:58 -0500 Received: from localhost (173-25-171-118.client.mchsi.com [173.25.171.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 828CD20851; Thu, 13 Dec 2018 15:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544714277; bh=WgWmozlRCMUjMdZXfuezx91DaoKxzC3HrnEGX8IAsl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xGMWHtScntu6bqUoExiiBr6ucHlrMaJfC50tGTyrBqh25LbahibznQFsB2Gozfvrd ugg8pKh8SrvtpcMYhnY47xadNuicp74q08Os7oNuNGUM9dfIUcec2xp/nmCZ3Qbd/C m+V2udK4wyD+Hui29eLQtCnf6qlxI0TqTDzHinBw= Date: Thu, 13 Dec 2018 09:17:56 -0600 From: Bjorn Helgaas To: Wesley Sheng Cc: kurt.schwemmer@microsemi.com, logang@deltatee.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, wesleyshenggit@sina.com Subject: Re: [PATCH 5/5] switchtec: MRPC DMA mode implementation Message-ID: <20181213151756.GD4701@google.com> References: <1544433144-7563-1-git-send-email-wesley.sheng@microchip.com> <1544433144-7563-6-git-send-email-wesley.sheng@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1544433144-7563-6-git-send-email-wesley.sheng@microchip.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 so that readq/writeq is replaced > by two readl/writel on systems that do not support it. > > Signed-off-by: Wesley Sheng > Reviewed-by: Logan Gunthorpe > static void init_pff(struct switchtec_dev *stdev) > @@ -1294,6 +1367,19 @@ static int switchtec_init_pci(struct switchtec_dev *stdev, > > pci_set_drvdata(pdev, stdev); > > + if (!use_dma_mrpc) > + return 0; > + > + if (!(ioread32(&stdev->mmio_mrpc->dma_ver) ? true : false)) > + return 0; This is ... harder to decode than necessary. It's obvious that the intent is to return if the adapter firmware doesn't support DMA, but I lost interest before I could verify that it works as intended. Bjorn