WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Make MSI-X work with 64-bit BARs

To: "Neil Turton" <nturton@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Make MSI-X work with 64-bit BARs
From: "Haitao Shan" <maillists.shan@xxxxxxxxx>
Date: Wed, 14 May 2008 23:51:06 +0800
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 14 May 2008 08:51:28 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=mJbF33Bfm4u/dhSXzaU+j7/zQNMH9lYf33o+/c5zbhI=; b=nPsCaX+3WBXoR4SjyQbxPu2WCi+JgvzDQx8blrwPrQK8w38aA8seV32k1SqqxfR+s5c0kno7wDH1YX7CWTC4+Bf1Dg84RTHmYTm+EtFACWhgKS8h+ArJqezYPfEP1+UzNtr4OULAWWAhMVxhgvsx7N1Xro7U8o3ILiG3qaQ823g=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CSG0pn9e0lkIS865AT5g/H0BUZ+cUchVcbMUmGP5DL4Y09hZrll/u4cqmbZcSJ+52DUsardOmbQ2WrTTECZLGlkbAH3U4Kk1RlGFmSeP4rhGHXkGXH/w5pG9DgVjRuXu0c+CApZ3Ht906Fr4DMGzIH3Q3bfydRpGX4IG+FlZo+I=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <482AE48D.4040402@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <482AE48D.4040402@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thanks!
It is so silly of me to make such a mistake in my patch.

2008/5/14 Neil Turton <nturton@xxxxxxxxxxxxxx>:
> The code for working out the base address of a 64-bit BAR currently puts
> the two halves together in the wrong order and leaves the type bits in
> the resulting value.   It also treats PCI_BASE_ADDRESS_MEM_TYPE_64 as an
> flag rather than an enumeration value.  This patch fixes these issues.
>
> Signed-off-by: Neil Turton <nturton@xxxxxxxxxxxxxx>
>
>
> diff -r 810d8c3ac992 xen/arch/x86/msi.c
> --- a/xen/arch/x86/msi.c        Thu May 08 16:58:33 2008 +0100
> +++ b/xen/arch/x86/msi.c        Wed May 14 13:44:34 2008 +0100
> @@ -521,17 +521,20 @@ static u64 pci_resource_start(struct pci
>  static u64 pci_resource_start(struct pci_dev *dev, u8 bar_index)
>  {
>     u64 bar_base;
> +    u32 reg_val;
>     u8 bus = dev->bus;
>     u8 slot = PCI_SLOT(dev->devfn);
>     u8 func = PCI_FUNC(dev->devfn);
>
> -    bar_base = pci_conf_read32(bus, slot, func,
> -                               PCI_BASE_ADDRESS_0 + 4 * bar_index);
> -    if ( bar_base & PCI_BASE_ADDRESS_MEM_TYPE_64 )
> -    {
> -        bar_base <<= 32;
> -        bar_base += pci_conf_read32(bus, slot, func,
> -                               PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1));
> +    reg_val = pci_conf_read32(bus, slot, func,
> +                              PCI_BASE_ADDRESS_0 + 4 * bar_index);
> +    bar_base = reg_val & PCI_BASE_ADDRESS_MEM_MASK;
> +    if ( ( reg_val & PCI_BASE_ADDRESS_MEM_TYPE_MASK ) ==
> +         PCI_BASE_ADDRESS_MEM_TYPE_64 )
> +    {
> +        reg_val = pci_conf_read32(bus, slot, func,
> +                                  PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1));
> +        bar_base |= ((u64)reg_val) << 32;
>     }
>
>     return bar_base;
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>