From patchwork Mon Apr 22 23:12:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 238696 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 580AB2C014B for ; Tue, 23 Apr 2013 09:12:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754069Ab3DVXMo (ORCPT ); Mon, 22 Apr 2013 19:12:44 -0400 Received: from mail-ia0-f169.google.com ([209.85.210.169]:55335 "EHLO mail-ia0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752874Ab3DVXMo (ORCPT ); Mon, 22 Apr 2013 19:12:44 -0400 Received: by mail-ia0-f169.google.com with SMTP id l29so13079iag.0 for ; Mon, 22 Apr 2013 16:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=94sHPU51Y73dNNDSUCfx4m5H3k+kOjureUMAaIJCwMw=; b=CAFzb4FCpL4Qo5jpVpxHi2HUIRsoPS7wMA6QRtJQzmOdLTi0LDD3pOLLzOk1uoe949 MF+nBHT5+PxaT0B8QfctBlojL/mlDSeiTO0F2hzRVVuKrnWJHXXGV04JmsYwxPvyaTaB zuklHJvaipCWc3QrhCTnpmLn4kFS3NMSHTgH4L2K8eno3XPM7eLgJLTTOGjF7pyMi1sP +d+8IZYHmkEJdiAZ7OR1aAqECI2bjeAB1ctf5CgX+3PdrzY+tOFU8a7DNbt5oqTpBdPN EBPYjzgi0BeWf8mh510iSW9fzugo5aA0gh+c3df8nX/48BvUbxVNnm61e63PLwJJftyW Cvzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=94sHPU51Y73dNNDSUCfx4m5H3k+kOjureUMAaIJCwMw=; b=lxEM34ipVKbt/JolCBQ9Yd9fsRJ+v+31dS/OLgVF0sd4gRyKVHWlR6i5ClqEcpl8xN yycXCQJ62R5Bb0wJzfYD7/dY5QUikN1k7W4B9FyyjbqxEstsl887UOl837P8ZNBrCa1H 5YKvzL7QDNO0l2HrrTEbPOIBWvw65KqSVpvQJtv/9CzlkndWqB3BNIO3Hgv6mmr3dafq h5X0IFEuuqWA4magFTXEbbTH1oahfq2xVbqL9QYjYbmEtCLXOTnHn9OUv6BAfYebkjmo d9/jAy5q6BkGhVimWqy1MddQSo/+pMPliXkxWmluDDphllk+K+H8dkxlcQ0irUHbrVKY Fwcg== X-Received: by 10.50.78.232 with SMTP id e8mr7884353igx.72.1366672363910; Mon, 22 Apr 2013 16:12:43 -0700 (PDT) Received: from localhost ([172.29.120.215]) by mx.google.com with ESMTPSA id xc3sm17855493igb.10.2013.04.22.16.12.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 22 Apr 2013 16:12:43 -0700 (PDT) Subject: [PATCH v4 22/22] vfio-pci: Use cached MSI/MSI-X capabilities To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: Alex Williamson , Gavin Shan Date: Mon, 22 Apr 2013 17:12:42 -0600 Message-ID: <20130422231242.32621.38158.stgit@bhelgaas-glaptop> In-Reply-To: <20130422230012.32621.15224.stgit@bhelgaas-glaptop> References: <20130422230012.32621.15224.stgit@bhelgaas-glaptop> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlUPEBpRDokak8JLnTCO5taJ54kfNk0c/nvew8BunfxF9U25rUUKIIc86XOkPyJhQJqc3iiUAMWickyO+5l2/BM0rCZY04VEzMdAEI/O9L4h0isq9PfbPdYEpT4dVnBKL7cLO8jiOhoMNBzHxZ6FL/+inMYMe58UbGr7YuRNVqRzW/djz75jFsuLOZZ8ntcnCHE15pbEE0/DnhiKwm20TeXZTcM+J0VU6/AuoZhY68Rw3N4eo0= Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org We now cache the MSI/MSI-X capability offsets in the struct pci_dev, so no need to find the capabilities again. Signed-off-by: Bjorn Helgaas CC: Alex Williamson Acked-by: Alex Williamson --- drivers/vfio/pci/vfio_pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" 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/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 10626e8..05afe88 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -70,7 +70,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) pci_write_config_word(pdev, PCI_COMMAND, cmd); } - msix_pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); + msix_pos = pdev->msix_cap; if (msix_pos) { u16 flags; u32 table; @@ -183,7 +183,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) u8 pos; u16 flags; - pos = pci_find_capability(vdev->pdev, PCI_CAP_ID_MSI); + pos = vdev->pdev->msi_cap; if (pos) { pci_read_config_word(vdev->pdev, pos + PCI_MSI_FLAGS, &flags); @@ -194,7 +194,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) u8 pos; u16 flags; - pos = pci_find_capability(vdev->pdev, PCI_CAP_ID_MSIX); + pos = vdev->pdev->msix_cap; if (pos) { pci_read_config_word(vdev->pdev, pos + PCI_MSIX_FLAGS, &flags);