xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 3/4] x86/vMSI-X: drop pci_msix_get_table_len()
Date: Wed, 08 Jun 2016 06:54:05 -0600	[thread overview]
Message-ID: <5758318D02000078000F30AA@prv-mh.provo.novell.com> (raw)
In-Reply-To: <5758302D02000078000F3087@prv-mh.provo.novell.com>

[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]

We can calculate the needed value at the single use site more easily.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -411,7 +411,7 @@ static void add_msixtbl_entry(struct dom
     INIT_RCU_HEAD(&entry->rcu);
     atomic_set(&entry->refcnt, 0);
 
-    entry->table_len = pci_msix_get_table_len(pdev);
+    entry->table_len = pdev->msix->nr_entries * PCI_MSIX_ENTRY_SIZE;
     entry->pdev = pdev;
     entry->gtable = (unsigned long) gtable;
 
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1463,27 +1463,6 @@ int pci_restore_msi_state(struct pci_dev
     return 0;
 }
 
-unsigned int pci_msix_get_table_len(struct pci_dev *pdev)
-{
-    int pos;
-    u16 control, seg = pdev->seg;
-    u8 bus, slot, func;
-    unsigned int len;
-
-    bus = pdev->bus;
-    slot = PCI_SLOT(pdev->devfn);
-    func = PCI_FUNC(pdev->devfn);
-
-    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
-    if ( !pos || !use_msi )
-        return 0;
-
-    control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));
-    len = msix_table_size(control) * PCI_MSIX_ENTRY_SIZE;
-
-    return len;
-}
-
 static int msi_cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -91,8 +91,6 @@ extern void teardown_msi_irq(int irq);
 extern int msi_free_vector(struct msi_desc *entry);
 extern int pci_restore_msi_state(struct pci_dev *pdev);
 
-extern unsigned int pci_msix_get_table_len(struct pci_dev *pdev);
-
 struct msi_desc {
 	struct msi_attrib {
 		__u8	type;		/* {0: unused, 5h:MSI, 11h:MSI-X} */




[-- Attachment #2: x86-vMSI-X-table-len.patch --]
[-- Type: text/plain, Size: 1773 bytes --]

x86/vMSI-X: drop pci_msix_get_table_len()

We can calculate the needed value at the single use site more easily.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -411,7 +411,7 @@ static void add_msixtbl_entry(struct dom
     INIT_RCU_HEAD(&entry->rcu);
     atomic_set(&entry->refcnt, 0);
 
-    entry->table_len = pci_msix_get_table_len(pdev);
+    entry->table_len = pdev->msix->nr_entries * PCI_MSIX_ENTRY_SIZE;
     entry->pdev = pdev;
     entry->gtable = (unsigned long) gtable;
 
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1463,27 +1463,6 @@ int pci_restore_msi_state(struct pci_dev
     return 0;
 }
 
-unsigned int pci_msix_get_table_len(struct pci_dev *pdev)
-{
-    int pos;
-    u16 control, seg = pdev->seg;
-    u8 bus, slot, func;
-    unsigned int len;
-
-    bus = pdev->bus;
-    slot = PCI_SLOT(pdev->devfn);
-    func = PCI_FUNC(pdev->devfn);
-
-    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
-    if ( !pos || !use_msi )
-        return 0;
-
-    control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));
-    len = msix_table_size(control) * PCI_MSIX_ENTRY_SIZE;
-
-    return len;
-}
-
 static int msi_cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -91,8 +91,6 @@ extern void teardown_msi_irq(int irq);
 extern int msi_free_vector(struct msi_desc *entry);
 extern int pci_restore_msi_state(struct pci_dev *pdev);
 
-extern unsigned int pci_msix_get_table_len(struct pci_dev *pdev);
-
 struct msi_desc {
 	struct msi_attrib {
 		__u8	type;		/* {0: unused, 5h:MSI, 11h:MSI-X} */

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-06-08 12:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 12:48 [PATCH 0/4] x86/vMSI-X: misc improvements Jan Beulich
2016-06-08 12:52 ` [PATCH 1/4] x86/vMSI-X: defer intercept handler registration Jan Beulich
2016-06-17 16:13   ` Konrad Rzeszutek Wilk
2016-06-17 16:38     ` Jan Beulich
2016-06-21 17:11   ` Andrew Cooper
2016-06-08 12:53 ` [PATCH 2/4] x86/vMSI-X: drop list lock Jan Beulich
2016-06-21 17:26   ` Andrew Cooper
2016-06-08 12:54 ` Jan Beulich [this message]
2016-06-21 17:27   ` [PATCH 3/4] x86/vMSI-X: drop pci_msix_get_table_len() Andrew Cooper
2016-06-08 12:54 ` [PATCH 4/4] x86/vMSI-X: use generic intercept handler in place of MMIO one Jan Beulich
2016-06-13  8:36   ` Paul Durrant
2016-06-21 17:33   ` Andrew Cooper
2016-06-17  8:20 ` Ping: [PATCH 0/4] x86/vMSI-X: misc improvements Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5758318D02000078000F30AA@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).