From: "Jan Beulich" Subject: [PATCH v2 4/4] x86/MSI-X: cleanup Date: Wed, 25 Mar 2015 16:40:59 +0000 Message-ID: <5512F32B020000780006D94D@mail.emea.novell.com> References: <5512F1B3020000780006D924@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartC1F58B0B.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YaoMX-00077U-Ap for xen-devel@lists.xenproject.org; Wed, 25 Mar 2015 16:41:01 +0000 In-Reply-To: <5512F1B3020000780006D924@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser 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. --=__PartC1F58B0B.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline - __pci_enable_msix() now checks that an MSI-X capability was actually found - pass "pos" to msix_capability_init() as both callers already know it (and hence there's no need to re-obtain it) - call __pci_disable_msi{,x}() directly instead of via pci_disable_msi() from __pci_enable_msi{x,}() state validation paths - use msix_control_reg() instead of open coding it - log message adjustments - coding style corrections Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -35,6 +35,8 @@ static s8 __read_mostly use_msi =3D -1; boolean_param("msi", use_msi); =20 +static void __pci_disable_msix(struct msi_desc *); + /* bitmap indicate which fixed map is free */ static DEFINE_SPINLOCK(msix_fixmap_lock); static DECLARE_BITMAP(msix_fixmap_pages, FIX_MSIX_MAX_PAGES); @@ -167,12 +169,14 @@ void msi_compose_msg(unsigned vector, co unsigned dest; =20 memset(msg, 0, sizeof(*msg)); - if ( !cpumask_intersects(cpu_mask, &cpu_online_map) ) { + if ( !cpumask_intersects(cpu_mask, &cpu_online_map) ) + { dprintk(XENLOG_ERR,"%s, compose msi message error!!\n", __func__);= return; } =20 - if ( vector ) { + if ( vector ) + { cpumask_t *mask =3D this_cpu(scratch_mask); =20 cpumask_and(mask, cpu_mask, &cpu_online_map); @@ -233,8 +237,7 @@ static bool_t read_msi_msg(struct msi_de } case PCI_CAP_ID_MSIX: { - void __iomem *base; - base =3D entry->mask_base; + void __iomem *base =3D entry->mask_base; =20 if ( unlikely(!msix_memory_decoded(entry->dev, entry->msi_attrib.pos)) ) @@ -300,8 +303,7 @@ static int write_msi_msg(struct msi_desc } case PCI_CAP_ID_MSIX: { - void __iomem *base; - base =3D entry->mask_base; + void __iomem *base =3D entry->mask_base; =20 if ( unlikely(!msix_memory_decoded(entry->dev, entry->msi_attrib.pos)) ) @@ -327,7 +329,7 @@ void set_msi_affinity(struct irq_desc *d struct msi_desc *msi_desc =3D desc->msi_desc; =20 dest =3D set_desc_affinity(desc, mask); - if (dest =3D=3D BAD_APICID || !msi_desc) + if ( dest =3D=3D BAD_APICID || !msi_desc ) return; =20 ASSERT(spin_is_locked(&desc->lock)); @@ -379,11 +381,11 @@ static void msix_set_enable(struct pci_d pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX); if ( pos ) { - control =3D pci_conf_read16(seg, bus, slot, func, pos + PCI_MSIX_F= LAGS); + control =3D pci_conf_read16(seg, bus, slot, func, msix_control_reg= (pos)); control &=3D ~PCI_MSIX_FLAGS_ENABLE; if ( enable ) control |=3D PCI_MSIX_FLAGS_ENABLE; - pci_conf_write16(seg, bus, slot, func, pos + PCI_MSIX_FLAGS, = control); + pci_conf_write16(seg, bus, slot, func, msix_control_reg(pos), = control); } } =20 @@ -408,9 +410,11 @@ static bool_t msi_set_mask_bit(struct ir bus =3D pdev->bus; slot =3D PCI_SLOT(pdev->devfn); func =3D PCI_FUNC(pdev->devfn); - switch (entry->msi_attrib.type) { + switch ( entry->msi_attrib.type ) + { case PCI_CAP_ID_MSI: - if (entry->msi_attrib.maskbit) { + if ( entry->msi_attrib.maskbit ) + { u32 mask_bits; =20 mask_bits =3D pci_conf_read32(seg, bus, slot, func, entry->msi= .mpos); @@ -778,13 +782,14 @@ static u64 read_pci_mem_bar(u16 seg, u8=20 * requested MSI-X entries with allocated irqs or non-zero for otherwise. **/ static int msix_capability_init(struct pci_dev *dev, + unsigned int pos, struct msi_info *msi, struct msi_desc **desc, unsigned int nr_entries) { struct arch_msix *msix =3D dev->msix; struct msi_desc *entry =3D NULL; - int pos, vf; + int vf; u16 control; u64 table_paddr; u32 table_offset; @@ -796,7 +801,6 @@ static int msix_capability_init(struct p =20 ASSERT(spin_is_locked(&pcidevs_lock)); =20 - pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX); control =3D pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos= )); /* * Ensure MSI-X interrupts are masked during setup. Some devices = require @@ -984,10 +988,9 @@ static int __pci_enable_msi(struct msi_i old_desc =3D find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSI); if ( old_desc ) { - dprintk(XENLOG_WARNING, "irq %d has already mapped to MSI on " - "device %04x:%02x:%02x.%01x\n", - msi->irq, msi->seg, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + printk(XENLOG_WARNING "irq %d already mapped to MSI on %04x:%02x:%= 02x.%u\n", + msi->irq, msi->seg, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); *desc =3D old_desc; return 0; } @@ -995,10 +998,10 @@ static int __pci_enable_msi(struct msi_i old_desc =3D find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX); if ( old_desc ) { - dprintk(XENLOG_WARNING, "MSI-X is already in use on " - "device %04x:%02x:%02x.%01x\n", msi->seg, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); - pci_disable_msi(old_desc); + printk(XENLOG_WARNING "MSI-X already in use on %04x:%02x:%02x.%u\n= ", + msi->seg, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + __pci_disable_msix(old_desc); } =20 return msi_capability_init(pdev, msi->irq, desc, msi->entry_nr); @@ -1012,7 +1015,6 @@ static void __pci_disable_msi(struct msi msi_set_enable(dev, 0); =20 BUG_ON(list_empty(&dev->msi_list)); - } =20 /** @@ -1032,7 +1034,7 @@ static void __pci_disable_msi(struct msi **/ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc = **desc) { - int status, pos, nr_entries; + int pos, nr_entries; struct pci_dev *pdev; u16 control; u8 slot =3D PCI_SLOT(msi->devfn); @@ -1041,23 +1043,22 @@ static int __pci_enable_msix(struct msi_ =20 ASSERT(spin_is_locked(&pcidevs_lock)); pdev =3D pci_get_pdev(msi->seg, msi->bus, msi->devfn); - if ( !pdev ) + pos =3D pci_find_cap_offset(msi->seg, msi->bus, slot, func, PCI_CAP_ID= _MSIX); + if ( !pdev || !pos ) return -ENODEV; =20 - pos =3D pci_find_cap_offset(msi->seg, msi->bus, slot, func, PCI_CAP_ID= _MSIX); control =3D pci_conf_read16(msi->seg, msi->bus, slot, func, msix_control_reg(pos)); nr_entries =3D multi_msix_capable(control); - if (msi->entry_nr >=3D nr_entries) + if ( msi->entry_nr >=3D nr_entries ) return -EINVAL; =20 old_desc =3D find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSIX); if ( old_desc ) { - dprintk(XENLOG_WARNING, "irq %d has already mapped to MSIX on " - "device %04x:%02x:%02x.%01x\n", - msi->irq, msi->seg, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + printk(XENLOG_WARNING "irq %d already mapped to MSI-X on = %04x:%02x:%02x.%u\n", + msi->irq, msi->seg, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); *desc =3D old_desc; return 0; } @@ -1065,15 +1066,13 @@ static int __pci_enable_msix(struct msi_ old_desc =3D find_msi_entry(pdev, -1, PCI_CAP_ID_MSI); if ( old_desc ) { - dprintk(XENLOG_WARNING, "MSI is already in use on " - "device %04x:%02x:%02x.%01x\n", msi->seg, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); - pci_disable_msi(old_desc); - + printk(XENLOG_WARNING "MSI already in use on %04x:%02x:%02x.%u\n",= + msi->seg, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + __pci_disable_msi(old_desc); } =20 - status =3D msix_capability_init(pdev, msi, desc, nr_entries); - return status; + return msix_capability_init(pdev, pos, msi, desc, nr_entries); } =20 static void _pci_cleanup_msix(struct arch_msix *msix) @@ -1091,19 +1090,16 @@ static void _pci_cleanup_msix(struct arc =20 static void __pci_disable_msix(struct msi_desc *entry) { - struct pci_dev *dev; - int pos; - u16 control, seg; - u8 bus, slot, func; - - dev =3D entry->dev; - seg =3D dev->seg; - bus =3D dev->bus; - slot =3D PCI_SLOT(dev->devfn); - func =3D PCI_FUNC(dev->devfn); + struct pci_dev *dev =3D entry->dev; + u16 seg =3D dev->seg; + u8 bus =3D dev->bus; + u8 slot =3D PCI_SLOT(dev->devfn); + u8 func =3D PCI_FUNC(dev->devfn); + unsigned int pos =3D pci_find_cap_offset(seg, bus, slot, func, + PCI_CAP_ID_MSIX); + u16 control =3D pci_conf_read16(seg, bus, slot, func, + msix_control_reg(entry->msi_attrib.pos))= ; =20 - pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX); - control =3D pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos= )); if ( unlikely(!(control & PCI_MSIX_FLAGS_ENABLE)) ) pci_conf_write16(seg, bus, slot, func, msix_control_reg(pos), control | (PCI_MSIX_FLAGS_ENABLE | @@ -1156,7 +1152,7 @@ int pci_prepare_msix(u16 seg, u8 bus, u8 u16 control =3D pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos)); =20 - rc =3D msix_capability_init(pdev, NULL, NULL, + rc =3D msix_capability_init(pdev, pos, NULL, NULL, multi_msix_capable(control)); } spin_unlock(&pcidevs_lock); @@ -1175,8 +1171,8 @@ int pci_enable_msi(struct msi_info *msi, if ( !use_msi ) return -EPERM; =20 - return msi->table_base ? __pci_enable_msix(msi, desc) : - __pci_enable_msi(msi, desc); + return msi->table_base ? __pci_enable_msix(msi, desc) : + __pci_enable_msi(msi, desc); } =20 /* @@ -1229,7 +1225,9 @@ int pci_restore_msi_state(struct pci_dev if ( !pdev ) return -EINVAL; =20 - ret =3D xsm_resource_setup_pci(XSM_PRIV, (pdev->seg << 16) | = (pdev->bus << 8) | pdev->devfn); + ret =3D xsm_resource_setup_pci(XSM_PRIV, + (pdev->seg << 16) | (pdev->bus << 8) | + pdev->devfn); if ( ret ) return ret; =20 --=__PartC1F58B0B.1__= Content-Type: text/plain; name="x86-MSI-X-cleanup.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-MSI-X-cleanup.patch" x86/MSI-X: cleanup=0A=0A- __pci_enable_msix() now checks that an MSI-X = capability was actually=0A found=0A- pass "pos" to msix_capability_init() = as both callers already know it=0A (and hence there's no need to = re-obtain it)=0A- call __pci_disable_msi{,x}() directly instead of via=0A = pci_disable_msi() from __pci_enable_msi{x,}() state validation paths=0A- = use msix_control_reg() instead of open coding it=0A- log message adjustment= s=0A- coding style corrections=0A=0ASigned-off-by: Jan Beulich =0AReviewed-by: Andrew Cooper =0A=0A--- = a/xen/arch/x86/msi.c=0A+++ b/xen/arch/x86/msi.c=0A@@ -35,6 +35,8 @@=0A = static s8 __read_mostly use_msi =3D -1;=0A boolean_param("msi", = use_msi);=0A =0A+static void __pci_disable_msix(struct msi_desc *);=0A+=0A = /* bitmap indicate which fixed map is free */=0A static DEFINE_SPINLOCK(msi= x_fixmap_lock);=0A static DECLARE_BITMAP(msix_fixmap_pages, FIX_MSIX_MAX_PA= GES);=0A@@ -167,12 +169,14 @@ void msi_compose_msg(unsigned vector, co=0A = unsigned dest;=0A =0A memset(msg, 0, sizeof(*msg));=0A- if ( = !cpumask_intersects(cpu_mask, &cpu_online_map) ) {=0A+ if ( !cpumask_int= ersects(cpu_mask, &cpu_online_map) )=0A+ {=0A dprintk(XENLOG_ERR= ,"%s, compose msi message error!!\n", __func__);=0A return;=0A = }=0A =0A- if ( vector ) {=0A+ if ( vector )=0A+ {=0A = cpumask_t *mask =3D this_cpu(scratch_mask);=0A =0A cpumask_and(mask= , cpu_mask, &cpu_online_map);=0A@@ -233,8 +237,7 @@ static bool_t = read_msi_msg(struct msi_de=0A }=0A case PCI_CAP_ID_MSIX:=0A = {=0A- void __iomem *base;=0A- base =3D entry->mask_base;=0A+ = void __iomem *base =3D entry->mask_base;=0A =0A if ( = unlikely(!msix_memory_decoded(entry->dev,=0A = entry->msi_attrib.pos)) )=0A@@ -300,8 +303,7 @@ static int = write_msi_msg(struct msi_desc=0A }=0A case PCI_CAP_ID_MSIX:=0A = {=0A- void __iomem *base;=0A- base =3D entry->mask_base;=0A+ = void __iomem *base =3D entry->mask_base;=0A =0A if ( = unlikely(!msix_memory_decoded(entry->dev,=0A = entry->msi_attrib.pos)) )=0A@@ -327,7 +329,7 @@ void = set_msi_affinity(struct irq_desc *d=0A struct msi_desc *msi_desc =3D = desc->msi_desc;=0A =0A dest =3D set_desc_affinity(desc, mask);=0A- = if (dest =3D=3D BAD_APICID || !msi_desc)=0A+ if ( dest =3D=3D BAD_APICID= || !msi_desc )=0A return;=0A =0A ASSERT(spin_is_locked(&desc->= lock));=0A@@ -379,11 +381,11 @@ static void msix_set_enable(struct = pci_d=0A pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_M= SIX);=0A if ( pos )=0A {=0A- control =3D pci_conf_read16(seg= , bus, slot, func, pos + PCI_MSIX_FLAGS);=0A+ control =3D pci_conf_r= ead16(seg, bus, slot, func, msix_control_reg(pos));=0A control = &=3D ~PCI_MSIX_FLAGS_ENABLE;=0A if ( enable )=0A = control |=3D PCI_MSIX_FLAGS_ENABLE;=0A- pci_conf_write16(seg, bus, = slot, func, pos + PCI_MSIX_FLAGS, control);=0A+ pci_conf_write16(seg= , bus, slot, func, msix_control_reg(pos), control);=0A }=0A }=0A =0A@@ = -408,9 +410,11 @@ static bool_t msi_set_mask_bit(struct ir=0A bus =3D = pdev->bus;=0A slot =3D PCI_SLOT(pdev->devfn);=0A func =3D = PCI_FUNC(pdev->devfn);=0A- switch (entry->msi_attrib.type) {=0A+ = switch ( entry->msi_attrib.type )=0A+ {=0A case PCI_CAP_ID_MSI:=0A- = if (entry->msi_attrib.maskbit) {=0A+ if ( entry->msi_attrib.m= askbit )=0A+ {=0A u32 mask_bits;=0A =0A = mask_bits =3D pci_conf_read32(seg, bus, slot, func, entry->msi.mpos);=0A@@ = -778,13 +782,14 @@ static u64 read_pci_mem_bar(u16 seg, u8 =0A * = requested MSI-X entries with allocated irqs or non-zero for otherwise.=0A = **/=0A static int msix_capability_init(struct pci_dev *dev,=0A+ = unsigned int pos,=0A = struct msi_info *msi,=0A struct msi_desc = **desc,=0A unsigned int nr_entries)=0A = {=0A struct arch_msix *msix =3D dev->msix;=0A struct msi_desc = *entry =3D NULL;=0A- int pos, vf;=0A+ int vf;=0A u16 control;=0A = u64 table_paddr;=0A u32 table_offset;=0A@@ -796,7 +801,6 @@ static = int msix_capability_init(struct p=0A =0A ASSERT(spin_is_locked(&pcidevs= _lock));=0A =0A- pos =3D pci_find_cap_offset(seg, bus, slot, func, = PCI_CAP_ID_MSIX);=0A control =3D pci_conf_read16(seg, bus, slot, func, = msix_control_reg(pos));=0A /*=0A * Ensure MSI-X interrupts are = masked during setup. Some devices require=0A@@ -984,10 +988,9 @@ static = int __pci_enable_msi(struct msi_i=0A old_desc =3D find_msi_entry(pdev, = msi->irq, PCI_CAP_ID_MSI);=0A if ( old_desc )=0A {=0A- = dprintk(XENLOG_WARNING, "irq %d has already mapped to MSI on "=0A- = "device %04x:%02x:%02x.%01x\n",=0A- msi->irq, = msi->seg, msi->bus,=0A- PCI_SLOT(msi->devfn), PCI_FUNC(msi->= devfn));=0A+ printk(XENLOG_WARNING "irq %d already mapped to MSI on = %04x:%02x:%02x.%u\n",=0A+ msi->irq, msi->seg, msi->bus,=0A+ = PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));=0A *desc = =3D old_desc;=0A return 0;=0A }=0A@@ -995,10 +998,10 @@ static = int __pci_enable_msi(struct msi_i=0A old_desc =3D find_msi_entry(pdev, = -1, PCI_CAP_ID_MSIX);=0A if ( old_desc )=0A {=0A- dprintk(XE= NLOG_WARNING, "MSI-X is already in use on "=0A- "device = %04x:%02x:%02x.%01x\n", msi->seg, msi->bus,=0A- PCI_SLOT(msi= ->devfn), PCI_FUNC(msi->devfn));=0A- pci_disable_msi(old_desc);=0A+ = printk(XENLOG_WARNING "MSI-X already in use on %04x:%02x:%02x.%u\n",= =0A+ msi->seg, msi->bus,=0A+ PCI_SLOT(msi->devf= n), PCI_FUNC(msi->devfn));=0A+ __pci_disable_msix(old_desc);=0A = }=0A =0A return msi_capability_init(pdev, msi->irq, desc, msi->entry_nr= );=0A@@ -1012,7 +1015,6 @@ static void __pci_disable_msi(struct msi=0A = msi_set_enable(dev, 0);=0A =0A BUG_ON(list_empty(&dev->msi_list));=0A-= =0A }=0A =0A /**=0A@@ -1032,7 +1034,7 @@ static void __pci_disable_msi(stru= ct msi=0A **/=0A static int __pci_enable_msix(struct msi_info *msi, = struct msi_desc **desc)=0A {=0A- int status, pos, nr_entries;=0A+ = int pos, nr_entries;=0A struct pci_dev *pdev;=0A u16 control;=0A = u8 slot =3D PCI_SLOT(msi->devfn);=0A@@ -1041,23 +1043,22 @@ static int = __pci_enable_msix(struct msi_=0A =0A ASSERT(spin_is_locked(&pcidevs_loc= k));=0A pdev =3D pci_get_pdev(msi->seg, msi->bus, msi->devfn);=0A- = if ( !pdev )=0A+ pos =3D pci_find_cap_offset(msi->seg, msi->bus, slot, = func, PCI_CAP_ID_MSIX);=0A+ if ( !pdev || !pos )=0A return = -ENODEV;=0A =0A- pos =3D pci_find_cap_offset(msi->seg, msi->bus, slot, = func, PCI_CAP_ID_MSIX);=0A control =3D pci_conf_read16(msi->seg, = msi->bus, slot, func,=0A msix_control_reg(pos= ));=0A nr_entries =3D multi_msix_capable(control);=0A- if (msi->entr= y_nr >=3D nr_entries)=0A+ if ( msi->entry_nr >=3D nr_entries )=0A = return -EINVAL;=0A =0A old_desc =3D find_msi_entry(pdev, msi->irq, = PCI_CAP_ID_MSIX);=0A if ( old_desc )=0A {=0A- dprintk(XENLOG= _WARNING, "irq %d has already mapped to MSIX on "=0A- = "device %04x:%02x:%02x.%01x\n",=0A- msi->irq, msi->seg, = msi->bus,=0A- PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));= =0A+ printk(XENLOG_WARNING "irq %d already mapped to MSI-X on = %04x:%02x:%02x.%u\n",=0A+ msi->irq, msi->seg, msi->bus,=0A+ = PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));=0A *desc = =3D old_desc;=0A return 0;=0A }=0A@@ -1065,15 +1066,13 @@ = static int __pci_enable_msix(struct msi_=0A old_desc =3D find_msi_entry= (pdev, -1, PCI_CAP_ID_MSI);=0A if ( old_desc )=0A {=0A- = dprintk(XENLOG_WARNING, "MSI is already in use on "=0A- = "device %04x:%02x:%02x.%01x\n", msi->seg, msi->bus,=0A- = PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));=0A- pci_disable_msi(old= _desc);=0A-=0A+ printk(XENLOG_WARNING "MSI already in use on = %04x:%02x:%02x.%u\n",=0A+ msi->seg, msi->bus,=0A+ = PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));=0A+ __pci_disable_ms= i(old_desc);=0A }=0A =0A- status =3D msix_capability_init(pdev, = msi, desc, nr_entries);=0A- return status;=0A+ return msix_capability= _init(pdev, pos, msi, desc, nr_entries);=0A }=0A =0A static void _pci_clean= up_msix(struct arch_msix *msix)=0A@@ -1091,19 +1090,16 @@ static void = _pci_cleanup_msix(struct arc=0A =0A static void __pci_disable_msix(struct = msi_desc *entry)=0A {=0A- struct pci_dev *dev;=0A- int pos;=0A- = u16 control, seg;=0A- u8 bus, slot, func;=0A-=0A- dev =3D entry->dev;= =0A- seg =3D dev->seg;=0A- bus =3D dev->bus;=0A- slot =3D = PCI_SLOT(dev->devfn);=0A- func =3D PCI_FUNC(dev->devfn);=0A+ struct = pci_dev *dev =3D entry->dev;=0A+ u16 seg =3D dev->seg;=0A+ u8 bus = =3D dev->bus;=0A+ u8 slot =3D PCI_SLOT(dev->devfn);=0A+ u8 func =3D = PCI_FUNC(dev->devfn);=0A+ unsigned int pos =3D pci_find_cap_offset(seg, = bus, slot, func,=0A+ PCI_CAP_ID_M= SIX);=0A+ u16 control =3D pci_conf_read16(seg, bus, slot, func,=0A+ = msix_control_reg(entry->msi_attrib.pos));=0A = =0A- pos =3D pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);= =0A- control =3D pci_conf_read16(seg, bus, slot, func, msix_control_reg(= pos));=0A if ( unlikely(!(control & PCI_MSIX_FLAGS_ENABLE)) )=0A = pci_conf_write16(seg, bus, slot, func, msix_control_reg(pos),=0A = control | (PCI_MSIX_FLAGS_ENABLE |=0A@@ -1156,7 +1152,7 = @@ int pci_prepare_msix(u16 seg, u8 bus, u8=0A u16 control =3D = pci_conf_read16(seg, bus, slot, func,=0A = msix_control_reg(pos));=0A =0A- rc =3D msix_capability_init(pdev= , NULL, NULL,=0A+ rc =3D msix_capability_init(pdev, pos, NULL, = NULL,=0A multi_msix_capable(control));=0A= }=0A spin_unlock(&pcidevs_lock);=0A@@ -1175,8 +1171,8 @@ int = pci_enable_msi(struct msi_info *msi,=0A if ( !use_msi )=0A = return -EPERM;=0A =0A- return msi->table_base ? __pci_enable_msix(msi, = desc) :=0A- __pci_enable_msi(msi, desc);=0A+ return msi->table_ba= se ? __pci_enable_msix(msi, desc) :=0A+ = __pci_enable_msi(msi, desc);=0A }=0A =0A /*=0A@@ -1229,7 +1225,9 @@ int = pci_restore_msi_state(struct pci_dev=0A if ( !pdev )=0A return = -EINVAL;=0A =0A- ret =3D xsm_resource_setup_pci(XSM_PRIV, (pdev->seg << = 16) | (pdev->bus << 8) | pdev->devfn);=0A+ ret =3D xsm_resource_setup_pc= i(XSM_PRIV,=0A+ (pdev->seg << 16) | = (pdev->bus << 8) |=0A+ pdev->devfn);=0A = if ( ret )=0A return ret;=0A =0A --=__PartC1F58B0B.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartC1F58B0B.1__=--