[PATCH][MTHCA] fix sparc build WAS: Re: [openib-general] [PATCH][RFC][3/4] IB: userspace verbs mthca changes

Tom Duffy
2005-04-21T00:37:24Z

On Mon, 2005-04-04 at 15:09 -0700, Roland Dreier wrote:
> @@ -574,6 +836,22 @@
> return 0;
> }
>
> +static int mthca_mmap_uar(struct ib_ucontext *context,
> + struct vm_area_struct *vma)
> +{
> + if (vma->vm_end - vma->vm_start != PAGE_SIZE)
> + return -EINVAL;
> +
> + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> +
> + if (remap_pfn_range(vma, vma->vm_start,
> + to_mucontext(context)->uar.pfn,
> + PAGE_SIZE, vma->vm_page_prot))
> + return -EAGAIN;
> +
> + return 0;
> +}
> +

This breaks building on sparc64:

CC [M] drivers/infiniband/hw/mthca/mthca_provider.o
/build1/tduffy/openib-work/linux-2.6.11-openib/drivers/infiniband/hw/mthca/mthca_provider.c: In function `mthca_mmap_uar':
/build1/tduffy/openib-work/linux-2.6.11-openib/drivers/infiniband/hw/mthca/mthca_provider.c:352: warning: implicit declaration of function `pgprot_noncached'
/build1/tduffy/openib-work/linux-2.6.11-openib/drivers/infiniband/hw/mthca/mthca_provider.c:352: error: incompatible types in assignment
make[3]: *** [drivers/infiniband/hw/mthca/mthca_provider.o] Error 1
make[2]: *** [drivers/infiniband/hw/mthca] Error 2
make[1]: *** [_module_drivers/infiniband] Error 2
make: *** [_all] Error 2

This is ugly, but fixes the build. Perhaps sparc needs
pgprot_noncached() to be a noop?

Signed-off-by: Tom Duffy <tduffy@sun.com>

Index: linux-2.6.11-openib/drivers/infiniband/hw/mthca/mthca_provider.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/hw/mthca/mthca_provider.c (revision 2202)
+++ linux-2.6.11-openib/drivers/infiniband/hw/mthca/mthca_provider.c (working copy)
@@ -349,7 +349,9 @@ static int mthca_mmap_uar(struct ib_ucon
if (vma->vm_end - vma->vm_start != PAGE_SIZE)
return -EINVAL;

+#ifdef pgprot_noncached
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+#endif

if (remap_pfn_range(vma, vma->vm_start,
to_mucontext(context)->uar.pfn,