From patchwork Mon Jan 9 20:37:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9505897 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EF6660757 for ; Mon, 9 Jan 2017 20:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76EB9272F9 for ; Mon, 9 Jan 2017 20:38:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B19128518; Mon, 9 Jan 2017 20:38:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10DA2272F9 for ; Mon, 9 Jan 2017 20:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755283AbdAIUiK (ORCPT ); Mon, 9 Jan 2017 15:38:10 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:38134 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935945AbdAIUhz (ORCPT ); Mon, 9 Jan 2017 15:37:55 -0500 Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cQghR-0002Qp-83; Mon, 09 Jan 2017 20:37:49 +0000 From: Christoph Hellwig To: linux-pci@vger.kernel.org Cc: Mauro Carvalho Chehab , netdev@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 2/3] xgbe: switch to pci_irq_alloc_vectors Date: Mon, 9 Jan 2017 21:37:39 +0100 Message-Id: <1483994260-19797-3-git-send-email-hch@lst.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1483994260-19797-1-git-send-email-hch@lst.de> References: <1483994260-19797-1-git-send-email-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The newly added xgbe drivers uses the deprecated pci_enable_msi_exact and pci_enable_msix_range interfaces. Switch it to use pci_irq_alloc_vectors instead. Signed-off-by: Christoph Hellwig Acked-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 47 +++++++++++++------------------- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 - 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c index e76b7f6..be2690e 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c @@ -133,12 +133,13 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata) pdata->tx_ring_count); msi_count = roundup_pow_of_two(msi_count); - ret = pci_enable_msi_exact(pdata->pcidev, msi_count); + ret = pci_alloc_irq_vectors(pdata->pcidev, msi_count, msi_count, + PCI_IRQ_MSI); if (ret < 0) { dev_info(pdata->dev, "MSI request for %u interrupts failed\n", msi_count); - ret = pci_enable_msi(pdata->pcidev); + ret = pci_alloc_irq_vectors(pdata->pcidev, 1, 1, PCI_IRQ_MSI); if (ret < 0) { dev_info(pdata->dev, "MSI enablement failed\n"); return ret; @@ -149,25 +150,26 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata) pdata->irq_count = msi_count; - pdata->dev_irq = pdata->pcidev->irq; + pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0); if (msi_count > 1) { - pdata->ecc_irq = pdata->pcidev->irq + 1; - pdata->i2c_irq = pdata->pcidev->irq + 2; - pdata->an_irq = pdata->pcidev->irq + 3; + pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 1); + pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 2); + pdata->an_irq = pci_irq_vector(pdata->pcidev, 3); for (i = XGBE_MSIX_BASE_COUNT, j = 0; (i < msi_count) && (j < XGBE_MAX_DMA_CHANNELS); i++, j++) - pdata->channel_irq[j] = pdata->pcidev->irq + i; + pdata->channel_irq[j] = + pci_irq_vector(pdata->pcidev, i); pdata->channel_irq_count = j; pdata->per_channel_irq = 1; pdata->channel_irq_mode = XGBE_IRQ_MODE_LEVEL; } else { - pdata->ecc_irq = pdata->pcidev->irq; - pdata->i2c_irq = pdata->pcidev->irq; - pdata->an_irq = pdata->pcidev->irq; + pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 0); + pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 0); + pdata->an_irq = pci_irq_vector(pdata->pcidev, 0); } if (netif_msg_probe(pdata)) @@ -186,33 +188,22 @@ static int xgbe_config_msix(struct xgbe_prv_data *pdata) msix_count += max(pdata->rx_ring_count, pdata->tx_ring_count); - pdata->msix_entries = devm_kcalloc(pdata->dev, msix_count, - sizeof(struct msix_entry), - GFP_KERNEL); - if (!pdata->msix_entries) - return -ENOMEM; - - for (i = 0; i < msix_count; i++) - pdata->msix_entries[i].entry = i; - - ret = pci_enable_msix_range(pdata->pcidev, pdata->msix_entries, - XGBE_MSIX_MIN_COUNT, msix_count); + ret = pci_alloc_irq_vectors(pdata->pcidev, XGBE_MSIX_MIN_COUNT, + msix_count, PCI_IRQ_MSIX); if (ret < 0) { dev_info(pdata->dev, "MSI-X enablement failed\n"); - devm_kfree(pdata->dev, pdata->msix_entries); - pdata->msix_entries = NULL; return ret; } pdata->irq_count = ret; - pdata->dev_irq = pdata->msix_entries[0].vector; - pdata->ecc_irq = pdata->msix_entries[1].vector; - pdata->i2c_irq = pdata->msix_entries[2].vector; - pdata->an_irq = pdata->msix_entries[3].vector; + pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0); + pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 1); + pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 2); + pdata->an_irq = pci_irq_vector(pdata->pcidev, 3); for (i = XGBE_MSIX_BASE_COUNT, j = 0; i < ret; i++, j++) - pdata->channel_irq[j] = pdata->msix_entries[i].vector; + pdata->channel_irq[j] = pci_irq_vector(pdata->pcidev, i); pdata->channel_irq_count = j; pdata->per_channel_irq = 1; diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index f52a9bd..3bcb6f5 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -980,7 +980,6 @@ struct xgbe_prv_data { unsigned int desc_ded_count; unsigned int desc_sec_count; - struct msix_entry *msix_entries; int dev_irq; int ecc_irq; int i2c_irq;