From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 3/4] x86/vMSI-X: drop pci_msix_get_table_len() Date: Wed, 08 Jun 2016 06:54:05 -0600 Message-ID: <5758318D02000078000F30AA@prv-mh.provo.novell.com> References: <5758302D02000078000F3087@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0F390D7D.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAczs-0007cV-OG for xen-devel@lists.xenproject.org; Wed, 08 Jun 2016 12:54:12 +0000 In-Reply-To: <5758302D02000078000F3087@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part0F390D7D.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We can calculate the needed value at the single use site more easily. Signed-off-by: Jan Beulich --- 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); =20 - entry->table_len =3D pci_msix_get_table_len(pdev); + entry->table_len =3D pdev->msix->nr_entries * PCI_MSIX_ENTRY_SIZE; entry->pdev =3D pdev; entry->gtable =3D (unsigned long) gtable; =20 --- 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; } =20 -unsigned int pci_msix_get_table_len(struct pci_dev *pdev) -{ - int pos; - u16 control, seg =3D pdev->seg; - u8 bus, slot, func; - unsigned int len; - - bus =3D pdev->bus; - slot =3D PCI_SLOT(pdev->devfn); - func =3D PCI_FUNC(pdev->devfn); - - pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX); - if ( !pos || !use_msi ) - return 0; - - control =3D pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos= )); - len =3D 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); =20 -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} = */ --=__Part0F390D7D.1__= Content-Type: text/plain; name="x86-vMSI-X-table-len.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-vMSI-X-table-len.patch" x86/vMSI-X: drop pci_msix_get_table_len()=0A=0AWe can calculate the needed = value at the single use site more easily.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/hvm/vmsi.c=0A+++ b/xen/arch/x86= /hvm/vmsi.c=0A@@ -411,7 +411,7 @@ static void add_msixtbl_entry(struct = dom=0A INIT_RCU_HEAD(&entry->rcu);=0A atomic_set(&entry->refcnt, = 0);=0A =0A- entry->table_len =3D pci_msix_get_table_len(pdev);=0A+ = entry->table_len =3D pdev->msix->nr_entries * PCI_MSIX_ENTRY_SIZE;=0A = entry->pdev =3D pdev;=0A entry->gtable =3D (unsigned long) gtable;=0A = =0A--- a/xen/arch/x86/msi.c=0A+++ b/xen/arch/x86/msi.c=0A@@ -1463,27 = +1463,6 @@ int pci_restore_msi_state(struct pci_dev=0A return 0;=0A = }=0A =0A-unsigned int pci_msix_get_table_len(struct pci_dev *pdev)=0A-{=0A-= int pos;=0A- u16 control, seg =3D pdev->seg;=0A- u8 bus, slot, = func;=0A- unsigned int len;=0A-=0A- bus =3D pdev->bus;=0A- slot = =3D PCI_SLOT(pdev->devfn);=0A- func =3D PCI_FUNC(pdev->devfn);=0A-=0A- = pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);=0A- = if ( !pos || !use_msi )=0A- return 0;=0A-=0A- control =3D = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));=0A- len = =3D msix_table_size(control) * PCI_MSIX_ENTRY_SIZE;=0A-=0A- return = len;=0A-}=0A-=0A static int msi_cpu_callback(=0A struct notifier_block = *nfb, unsigned long action, void *hcpu)=0A {=0A--- a/xen/include/asm-x86/ms= i.h=0A+++ b/xen/include/asm-x86/msi.h=0A@@ -91,8 +91,6 @@ extern void = teardown_msi_irq(int irq);=0A extern int msi_free_vector(struct msi_desc = *entry);=0A extern int pci_restore_msi_state(struct pci_dev *pdev);=0A = =0A-extern unsigned int pci_msix_get_table_len(struct pci_dev *pdev);=0A-= =0A struct msi_desc {=0A struct msi_attrib {=0A __u8 = type; /* {0: unused, 5h:MSI, 11h:MSI-X} */=0A --=__Part0F390D7D.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__Part0F390D7D.1__=--