From patchwork Wed Nov 13 13:40:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 3178151 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 29AB29F3A0 for ; Wed, 13 Nov 2013 13:40:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76B612061E for ; Wed, 13 Nov 2013 13:40:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA5B920611 for ; Wed, 13 Nov 2013 13:40:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757292Ab3KMNkY (ORCPT ); Wed, 13 Nov 2013 08:40:24 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:61306 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757263Ab3KMNkR (ORCPT ); Wed, 13 Nov 2013 08:40:17 -0500 Received: by mail-pa0-f50.google.com with SMTP id hz1so431881pad.23 for ; Wed, 13 Nov 2013 05:40:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=yBtpKJFXN+N2DzgIv+w1A4KTPHMvrTa7Jh5YE4U2syw=; b=oiHvoT6dVrYlUOBP/yn0wKXq0zeVHEzfsFBiDura6TpXJDfIhdUyzXY/kZAgrkLKPH U/6iyjXpSgN87S+6Xxowo/UixV6sqkwbrBmMSfJYkK2iWxPWYCJ8z7G1TCtwkyRWgUod eJU+EyMp9sMbJCPtLwUGCVsdxX/HMhRRBn7eHH4m/KjT16tfU7lsE90BAg51/Ky1yPB9 SjQpenYlmhkQ1s7IXQQec5vSq6bYFQmw+qnpW8gOFSGNy5sPToTaTLo26CUrrlnwdVyo xTsFcxpNUTHV301ARAW3Ou/ceBhGrRRsG1doN+c4XZrtiGz7XFLd6OXTWtuCMUBjYueC frdQ== X-Received: by 10.66.145.40 with SMTP id sr8mr42670003pab.60.1384350016738; Wed, 13 Nov 2013 05:40:16 -0800 (PST) Received: from [192.168.1.5] ([222.65.147.78]) by mx.google.com with ESMTPSA id ed3sm44568246pbc.6.2013.11.13.05.40.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 05:40:15 -0800 (PST) Message-ID: <52838136.1090509@intel.com> Date: Wed, 13 Nov 2013 21:40:06 +0800 From: Aaron Lu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Jackey Shen CC: alexander.stein@systec-electronic.com, manuel.lauss@googlemail.com, hanfi@spahan.ch, linux-mmc@vger.kernel.org, mcuos.com@gmail.com, Ray.Huang@amd.com Subject: Re: [PATCH V2] mmc: sdhci: supporting PCI MSI References: <1384239413-7027-1-git-send-email-Jackey.Shen@amd.com> <5281DC68.3080606@intel.com> <20131112092716.GA7285@ubuntu.amd.com> <5282CDE2.60500@intel.com> <20131113055508.GA3755@ubuntu.amd.com> <20131113060011.GB3755@ubuntu.amd.com> In-Reply-To: <20131113060011.GB3755@ubuntu.amd.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 11/13/2013 02:00 PM, Jackey Shen wrote: > On Wed, Nov 13, 2013 at 01:55:08PM +0800, Jackey Shen wrote: >>>>> What about we only call pci_enable_msi in sdhci-pci.c and then assign >>>>> host->irq appropriately before calling sdhci_add_host, will that work? >>>>> The only difference would be, request_irq will have SHARED flag, but I >>>>> suppose that's not a problem. >>>>> >>>> There are 2 points for this part: >>>> 1. fall back to legacy interrupt right after MSI request fails; >>> >>> If we call pci_enable_msi somewhere in sdhci_pci_probe_slot, then if it >>> failed, we can also fall back I suppose? >>> >> Yes, it is. >> But, sdhci_pci_disable_msi should be kept since pci_disable_msi is >> pci bus releted and better not used in sdhci.c. >> So, enable msi and disable msi are NOT symmetric in style. >> What's your opinion? > > Sorry for missing word. > So, enable msi and disable msi are NOT symmetric in style. > I meant something like this: We can do all these MSI stuffs in sdhci-pci.c, but I'm not sure if this is correct. Thanks, Aaron --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index d7d6bc8..96461a3 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c @@ -1339,12 +1339,17 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( host->quirks = chip->quirks; host->quirks2 = chip->quirks2; + ret = pci_enable_msi(pdev); + if (ret) { + dev_err(&pdev->dev, "cannot enable msi\n"); + goto cleanup; + } host->irq = pdev->irq; ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc)); if (ret) { dev_err(&pdev->dev, "cannot request region\n"); - goto cleanup; + goto disable_msi; } host->ioaddr = pci_ioremap_bar(pdev, bar); @@ -1396,6 +1401,9 @@ unmap: release: pci_release_region(pdev, bar); +disable_msi: + pci_disable_msi(pdev); + cleanup: if (slot->data && slot->data->cleanup) slot->data->cleanup(slot->data); @@ -1431,6 +1439,8 @@ static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot) pci_release_region(slot->chip->pdev, slot->pci_bar); + pci_disable_msi(slot->chip->pdev); + sdhci_free_host(slot->host); }