diff mbox

[v4,18/22] xen/pci: Pay attention to PCI_MSIX_TABLE_OFFSET

Message ID 20130422231214.32621.37394.stgit@bhelgaas-glaptop
State Not Applicable
Headers show

Commit Message

Bjorn Helgaas April 22, 2013, 11:12 p.m. UTC
The MSI-X Table structure may be at a non-zero offset into the
device BAR, and we should account for that.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 arch/x86/pci/xen.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
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

Comments

Bjorn Helgaas April 24, 2013, 4:34 p.m. UTC | #1
[+cc Jeremy, xen-devel]

Full series at https://lkml.kernel.org/r/20130422230012.32621.15224.stgit@bhelgaas-glaptop
(email archive) or
http://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/log/?h=pci/gavin-msi-cleanup
(git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git branch
pci/gavin-msi-cleanup).

On Mon, Apr 22, 2013 at 5:12 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> The MSI-X Table structure may be at a non-zero offset into the
> device BAR, and we should account for that.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  arch/x86/pci/xen.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
> index 94e7662..0e8a196 100644
> --- a/arch/x86/pci/xen.c
> +++ b/arch/x86/pci/xen.c
> @@ -300,8 +300,10 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
>                         pci_read_config_dword(dev, pos + PCI_MSIX_TABLE,
>                                               &table_offset);
>                         bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
> +                       table_offset &= PCI_MSIX_TABLE_OFFSET;
>
> -                       map_irq.table_base = pci_resource_start(dev, bir);
> +                       map_irq.table_base = pci_resource_start(dev, bir) +
> +                               table_offset;
>                         map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
>                 }
>
>
--
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
Jan Beulich April 25, 2013, 9:40 a.m. UTC | #2
>>> On 24.04.13 at 18:34, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Mon, Apr 22, 2013 at 5:12 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> The MSI-X Table structure may be at a non-zero offset into the
>> device BAR, and we should account for that.

NAK: The base is just being use to pass to the hypervisor, which
then takes care to add the offset. Recent hypervisors will actually
only consume this to issue a warning if not matching what gets
read from the corresponding BAR. Earlier hypervisors used this
instead of reading the BAR.

Jan

>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> ---
>>  arch/x86/pci/xen.c |    4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
>> index 94e7662..0e8a196 100644
>> --- a/arch/x86/pci/xen.c
>> +++ b/arch/x86/pci/xen.c
>> @@ -300,8 +300,10 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
>>                         pci_read_config_dword(dev, pos + PCI_MSIX_TABLE,
>>                                               &table_offset);
>>                         bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
>> +                       table_offset &= PCI_MSIX_TABLE_OFFSET;
>>
>> -                       map_irq.table_base = pci_resource_start(dev, bir);
>> +                       map_irq.table_base = pci_resource_start(dev, bir) +
>> +                               table_offset;
>>                         map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
>>                 }
>>
>>


--
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 mbox

Patch

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 94e7662..0e8a196 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -300,8 +300,10 @@  static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 			pci_read_config_dword(dev, pos + PCI_MSIX_TABLE,
 					      &table_offset);
 			bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
+			table_offset &= PCI_MSIX_TABLE_OFFSET;
 
-			map_irq.table_base = pci_resource_start(dev, bir);
+			map_irq.table_base = pci_resource_start(dev, bir) +
+				table_offset;
 			map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
 		}