All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xensource.com>
To: "Stephen C. Tweedie" <sct@redhat.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [Patch] Constrain DMADOM/swiotlb allocations to 1G phys to fix b44 NIC driver
Date: Tue, 28 Nov 2006 15:54:10 +0000	[thread overview]
Message-ID: <C1920C22.52BC%keir@xensource.com> (raw)
In-Reply-To: <1164728771.10380.15.camel@sisko.scot.redhat.com>

How much should we care about Broadcom 4400? Wasn't it mainly used in old
notebooks?

 -- Keir

On 28/11/06 15:46, "Stephen C. Tweedie" <sct@redhat.com> wrote:

> Hi all,
> 
> The b44 driver currently won't load on Xen kernels with 1G memory or
> more.  It tries to set a pci dma mask of 0x3ffffff (ie. it can only
> address 1G physical memory), but the swiotlb cannot deal with this ---
> swiotlb memory is allocated from the hypervisor's DMADOM heap, which is
> restricted to the bottom 2GB of physical memory.  So the pci dma mask
> cannot be set and the driver load fails with
> 
>         b44 0000:03:00.0: No usable DMA configuration, aborting.
> 
> It turns out that this 2GB / 31-bit constraint is magically hardcoded in
> a couple of places rather than being read correctly from config.h.  So
> this patch fixes that; changes config.h to specify a 1GB / 30-bit
> constraint for the DMADOM heap; and changes the x86/x86_64 swiotlb to
> request a 30-bit constraint for allocations of the swiotlb memory.
> 
> With this in place, b44 works.  (Red Hat bugzilla #208242).
> 
> --Stephen
> 
> # HG changeset patch
> # User Stephen Tweedie <sct@redhat.com>
> # Date 1164722972 0
> # Node ID 6cbddc31f52d0bad2aa4b13452a4092dfeada47f
> # Parent  0af1ba62a14b4eaf1c0687d855edc7307edb21ba
> Clean up the DMADOM physical upper limit handling to properly honour
> settings in config.h.
> 
> Set the upper limit for DMADOM and swiotlb allocations to be 30 bits
> (1G) instead of 31 bits, to allow the b44 NIC driver to work.
> 
> Signed-off-by: Stephen Tweedie <sct@redhat.com>
> 
> diff -r 0af1ba62a14b -r 6cbddc31f52d
> linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
> --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c Tue Nov 28 11:47:28 2006
> +0000
> +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c Tue Nov 28 14:09:32 2006
> +0000
> @@ -47,8 +47,8 @@ EXPORT_SYMBOL(swiotlb);
>   */
>  #define IO_TLB_SHIFT 11
>  
> -/* Width of DMA addresses in the IO TLB. 31 bits is an aacraid limitation. */
> -#define IO_TLB_DMA_BITS 31
> +/* Width of DMA addresses in the IO TLB. 30 bits is a b44 limitation. */
> +#define IO_TLB_DMA_BITS 30
>  
>  static int swiotlb_force;
>  static char *iotlb_virt_start;
> diff -r 0af1ba62a14b -r 6cbddc31f52d xen/common/memory.c
> --- a/xen/common/memory.c Tue Nov 28 11:47:28 2006 +0000
> +++ b/xen/common/memory.c Tue Nov 28 14:09:32 2006 +0000
> @@ -328,7 +328,7 @@ static long memory_exchange(XEN_GUEST_HA
>           (exch.out.address_bits <
>            (get_order_from_pages(max_page) + PAGE_SHIFT)) )
>      {
> -        if ( exch.out.address_bits < 31 )
> +        if ( exch.out.address_bits < MAX_DMADOM_BITS )
>          {
>              rc = -ENOMEM;
>              goto fail_early;
> @@ -541,7 +541,7 @@ long do_memory_op(unsigned long cmd, XEN
>               (reservation.address_bits <
>                (get_order_from_pages(max_page) + PAGE_SHIFT)) )
>          {
> -            if ( reservation.address_bits < 31 )
> +            if ( reservation.address_bits < MAX_DMADOM_BITS )
>                  return start_extent;
>              args.memflags = MEMF_dma;
>          }
> diff -r 0af1ba62a14b -r 6cbddc31f52d xen/include/asm-ia64/config.h
> --- a/xen/include/asm-ia64/config.h Tue Nov 28 11:47:28 2006 +0000
> +++ b/xen/include/asm-ia64/config.h Tue Nov 28 14:09:32 2006 +0000
> @@ -41,7 +41,9 @@
>  #define CONFIG_IOSAPIC
>  #define supervisor_mode_kernel (0)
>  
> -#define MAX_DMADOM_PFN (0x7FFFFFFFUL >> PAGE_SHIFT) /* 31 addressable bits */
> +#define MAX_DMADOM_BITS 30
> +#define MAX_DMADOM_MASK ((1UL << MAX_DMADOM_BITS) - 1)
> +#define MAX_DMADOM_PFN  (MAX_DMADOM_MASK >> PAGE_SHIFT)
>  
>  /* If PERFC is used, include privop maps.  */
>  #ifdef PERF_COUNTERS
> diff -r 0af1ba62a14b -r 6cbddc31f52d xen/include/asm-x86/config.h
> --- a/xen/include/asm-x86/config.h Tue Nov 28 11:47:28 2006 +0000
> +++ b/xen/include/asm-x86/config.h Tue Nov 28 14:09:32 2006 +0000
> @@ -82,7 +82,9 @@
>  /* Debug stack is restricted to 8kB by guard pages. */
>  #define DEBUG_STACK_SIZE 8192
>  
> -#define MAX_DMADOM_PFN 0x7FFFFUL /* 31 addressable bits */
> +#define MAX_DMADOM_BITS 30
> +#define MAX_DMADOM_MASK ((1UL << MAX_DMADOM_BITS) - 1)
> +#define MAX_DMADOM_PFN  (MAX_DMADOM_MASK >> PAGE_SHIFT)
>  
>  #ifndef __ASSEMBLY__
>  extern unsigned long _end; /* standard ELF symbol */
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2006-11-28 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-28 15:46 [Patch] Constrain DMADOM/swiotlb allocations to 1G phys to fix b44 NIC driver Stephen C. Tweedie
2006-11-28 15:49 ` Stephen C. Tweedie
2006-11-28 16:01   ` Keir Fraser
2006-11-28 16:31   ` Alan
2006-11-28 16:29     ` Muli Ben-Yehuda
2006-11-29  0:26       ` Re: [Patch] Constrain DMADOM/swiotlb allocations to1G " Ian Pratt
2006-11-28 16:33     ` Re: [Patch] Constrain DMADOM/swiotlb allocations to 1G " Keir Fraser
2006-11-28 15:54 ` Keir Fraser [this message]
2006-11-28 16:28   ` Alan

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=C1920C22.52BC%keir@xensource.com \
    --to=keir@xensource.com \
    --cc=sct@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.