From patchwork Tue Jul 21 00:15:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 6831521 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 40B6E9F380 for ; Tue, 21 Jul 2015 00:15:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48F0B2069F for ; Tue, 21 Jul 2015 00:15:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69F9E20632 for ; Tue, 21 Jul 2015 00:15:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757434AbbGUAPQ (ORCPT ); Mon, 20 Jul 2015 20:15:16 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:36172 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757286AbbGUAPP (ORCPT ); Mon, 20 Jul 2015 20:15:15 -0400 Received: by igbij6 with SMTP id ij6so95449502igb.1 for ; Mon, 20 Jul 2015 17:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=AvcFpLmfMhiVX0TghRaXXPKvYOc9ZRtuPOpOHVWpVXs=; b=bC2rBD2ph45XBUxC4ksVHU9i+dTlO/CAwmgbA2y0OYd5UoA9kB79F94PsDhP09NjuQ 9LfYj864YMnsbWboYWM9qNeDOI3wznARatmn6RTpc2rF5xhBFqzhQ2SdpcWlIvxBt1sm /fi+E6OWUpHJvTXhuaqOi9/w3mjHuuOjcoOCvKbkmO9pmprt58Pz2TFvESU/uk0ERXep jQynt1L8gaBSo9ryLIO8BcL5CK6qHgeajVdyMBKEEhUyPlQhbH41xzxd1cD8Fz1Xc41i QCNDMx3FsFpWqxms6WwUoituo1MfdsC5BVjC9yiiVHX5pol41MQOKHZNuvOYZXobGpZj cHOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=AvcFpLmfMhiVX0TghRaXXPKvYOc9ZRtuPOpOHVWpVXs=; b=gdh8K7VBk4fca+B6mchxpR9Q18sl7pyIioeQHedp+rwmWgRh5DsRMtDYhwtd1FG2A2 FolaKZQ5tSdjQuwH7qmc+AiPs6aLn44hHxeWhxxo6qyvIfMVBWEA9j4bfnl5ee73D/v0 szyBl67kuaU40ZGnTsVsdX2PWu6cL26lIZpqrrDv9mXvgLcAM7bTVpi6cLcENNZhxBk6 3f51N19TTegL+0uP/zKZ6iF6zCsdG4jLWWzKQVK7bGWx7Q2SphAaFwES6l32fCULcw3T SQD/oqd/QPuI6GXpPpuhDaUdQ3ZzuwWBuT0ZGTus2IFzH+vsmEslUx6j4E2ui96AYKF5 1KKQ== X-Gm-Message-State: ALoCoQlWd/ATicCsEb95vCpfRqNoTlUb7YHrq/dFsv37kEp2X0L4K0upnSdnEQOqmp3cAEvhoBpE X-Received: by 10.50.79.169 with SMTP id k9mr19378115igx.44.1437437714749; Mon, 20 Jul 2015 17:15:14 -0700 (PDT) Received: from localhost ([69.71.1.1]) by smtp.gmail.com with ESMTPSA id o140sm14740817ioe.27.2015.07.20.17.15.12 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 20 Jul 2015 17:15:13 -0700 (PDT) Subject: [PATCH v2 10/11] PCI: Stop caching ATS Invalidate Queue Depth To: linux-pci@vger.kernel.org, Joerg Roedel , David Woodhouse From: Bjorn Helgaas Cc: iommu@lists.linux-foundation.org, Gregor Dick Date: Mon, 20 Jul 2015 19:15:11 -0500 Message-ID: <20150721001511.28145.29144.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20150721001243.28145.81610.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20150721001243.28145.81610.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, 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 Stop caching the Invalidate Queue Depth in struct pci_dev. pci_ats_queue_depth() is typically called only once per device, and it returns a fixed value per-device, so callers who need the value frequently can cache it themselves. Signed-off-by: Bjorn Helgaas Reviewed-by: Joerg Roedel --- drivers/pci/ats.c | 9 ++++----- include/linux/pci.h | 1 - 2 files changed, 4 insertions(+), 6 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/pci/ats.c b/drivers/pci/ats.c index 67524a7..bdb1383 100644 --- a/drivers/pci/ats.c +++ b/drivers/pci/ats.c @@ -20,16 +20,12 @@ void pci_ats_init(struct pci_dev *dev) { int pos; - u16 cap; pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS); if (!pos) return; dev->ats_cap = pos; - pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap); - dev->ats_qdep = PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : - PCI_ATS_MAX_QDEP; } /** @@ -131,13 +127,16 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state); */ int pci_ats_queue_depth(struct pci_dev *dev) { + u16 cap; + if (!dev->ats_cap) return -EINVAL; if (dev->is_virtfn) return 0; - return dev->ats_qdep; + pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap); + return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP; } EXPORT_SYMBOL_GPL(pci_ats_queue_depth); diff --git a/include/linux/pci.h b/include/linux/pci.h index 307f96a..4b484fd 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -378,7 +378,6 @@ struct pci_dev { }; u16 ats_cap; /* ATS Capability offset */ u8 ats_stu; /* ATS Smallest Translation Unit */ - u8 ats_qdep; /* ATS Invalidate Queue Depth */ atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */ #endif phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */