From patchwork Mon Sep 2 09:00:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 2852750 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CE4F7C0AB5 for ; Mon, 2 Sep 2013 08:58:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B20302041C for ; Mon, 2 Sep 2013 08:58:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8917F20411 for ; Mon, 2 Sep 2013 08:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755850Ab3IBI6G (ORCPT ); Mon, 2 Sep 2013 04:58:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15118 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754876Ab3IBI6E (ORCPT ); Mon, 2 Sep 2013 04:58:04 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r828vwBG015265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 Sep 2013 04:57:58 -0400 Received: from dhcp-26-207.brq.redhat.com (dhcp-26-122.brq.redhat.com [10.34.26.122]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r828vrnf020469 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 2 Sep 2013 04:57:56 -0400 Date: Mon, 2 Sep 2013 11:00:01 +0200 From: Alexander Gordeev To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, linux-pci@vger.kernel.org, linux-ide@vger.kernel.org, Tejun Heo , Ingo Molnar , Joerg Roedel , Jan Beulich , Bjorn Helgaas Subject: [PATCH 2/4] MSI/x86: Support pci_enable_msi_block_part() interface Message-ID: <9a0ae6ff3d116109d9f61230936a5c6a057637e0.1378111919.git.agordeev@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This update is a prerequisite for the forthcoming update of the AHCI device driver to conserve 10/16 MSIs on Intel chipsets. The update makes use of 'nvec_mme' parameter for pci_enable_msi_block_part() interface. Signed-off-by: Alexander Gordeev --- drivers/iommu/irq_remapping.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c index 1a220a0..f443e23 100644 --- a/drivers/iommu/irq_remapping.c +++ b/drivers/iommu/irq_remapping.c @@ -49,9 +49,9 @@ static void irq_remapping_disable_io_apic(void) disconnect_bsp_APIC(0); } -static int do_setup_msi_irqs(struct pci_dev *dev, int nvec) +static int do_setup_msi_irqs(struct pci_dev *dev, int nvec, int nvec_mme) { - int node, ret, sub_handle, nvec_pow2, index = 0; + int node, ret, sub_handle, index = 0; unsigned int irq; struct msi_desc *msidesc; @@ -60,18 +60,18 @@ static int do_setup_msi_irqs(struct pci_dev *dev, int nvec) WARN_ON(msidesc->irq); WARN_ON(msidesc->msi_attrib.multiple); WARN_ON(msidesc->nvec_used); + BUG_ON(nvec_mme != __roundup_pow_of_two(nvec_mme)); node = dev_to_node(&dev->dev); irq = __create_irqs(get_nr_irqs_gsi(), nvec, node); if (irq == 0) return -ENOSPC; - nvec_pow2 = __roundup_pow_of_two(nvec); msidesc->nvec_used = nvec; - msidesc->msi_attrib.multiple = ilog2(nvec_pow2); + msidesc->msi_attrib.multiple = ilog2(nvec_mme); for (sub_handle = 0; sub_handle < nvec; sub_handle++) { if (!sub_handle) { - index = msi_alloc_remapped_irq(dev, irq, nvec_pow2); + index = msi_alloc_remapped_irq(dev, irq, nvec_mme); if (index < 0) { ret = index; goto error; @@ -145,7 +145,7 @@ static int irq_remapping_setup_msi_irqs(struct pci_dev *dev, int nvec, int nvec_mme, int type) { if (type == PCI_CAP_ID_MSI) - return do_setup_msi_irqs(dev, nvec); + return do_setup_msi_irqs(dev, nvec, nvec_mme); else return do_setup_msix_irqs(dev, nvec); }