Re: [patch 09/11] PAT x86: Add ioremap_wc support

From: Roland Dreier
Date: Fri Jan 11 2008 - 19:35:38 EST


> >I don't think that's a good idea. Drivers should be able to
> >detect this somehow.
> >Handling UC mappings as WC will probably give very poor results.

> It is the other way. ioremap_wc aliases to ioremap_nocache.
> This was based on earlier feedback from Roland.

> >From: Roland Dreier [mailto:rdreier@xxxxxxxxx]
> >I think ioremap_wc() needs to be available on all archs for this to be
> >really useful to drivers. It can be a fallback to ioremap_nocache()
> >everywhere except 64-bit x86, but it's not nice for every driver that
> >wants to use this to need an "#ifdef X86" or whatever.

Yes... my basic point is simply that the kernel interfaces to this WC
stuff must be available on all architectures, even if it's stubbed out
on architectures that don't support write-combining or where it hasn't
been implemented yet. I think the only sane way to stub it out is to
fall back to uncached...

It's not going to be useful if drivers need crazy #ifdefs to decide
whether to use ioremap_wc(), pgprot_writecombine() or whatever. Just
look at the mess in drm_io_prot() in drm_vm.c to see what I want to
avoid.

Just to be explicit, my interest in this is that I want to be able to
merge the patch below and have the mlx4 driver still build and work on
every arch that has PCI support:

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index d8287d9..5eac9c6 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -381,8 +381,7 @@ static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
PAGE_SIZE, vma->vm_page_prot))
return -EAGAIN;
} else if (vma->vm_pgoff == 1 && dev->dev->caps.bf_reg_size != 0) {
- /* FIXME want pgprot_writecombine() for BlueFlame pages */
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/