Re: [RFC] block layer support for DMA IOMMU bypass mode

From: Andi Kleen (
Date: Tue Jul 01 2003 - 12:09:38 EST

On 01 Jul 2003 11:46:12 -0500
James Bottomley <> wrote:

> Some IOMMUs come with a "bypass" mode, where the IOMMU won't try to
> translate the physical address coming from the device but will instead
> place it directly on the memory bus. For some machines (ia-64, and
> possibly x86_64) any address not programmed into the IOMMU for

That's the case on x86_64 yes.

> The Problem:
> At the moment, the block layer assumes segments may be virtually
> mergeable (i.e. two phsically discondiguous pages may be treated as a
> single SG entity for DMA because the IOMMU will patch up the
> discontinuity) if an IOMMU is present in the system. This effectively
> stymies using bypass mode, because segments may not be virtually merged
> in a bypass operation.

I assume on 2.5 has this problem, not 2.4, right?

> The Solution:
> Is to teach the block layer not to virtually merge segments if either
> segment may be bypassed. To that end, the block layer has to know what
> the physical dma mask is (not the bounce limit, which is different) and
> it must also know the address bits that must be asserted in bypass
> mode. To that end, I've introduced a new #define for asm/io.h

But a mask is not good for AMD64 because there is no guarantee
that the bypass/iommu address is checkable using a mask
(K8 uses an memory hole for IOMMU purposes and for various
reasons the hole can be anywhere in the address space)

This means x86_64 needs an function. Also the name is quite weird and
the issue is not really BIO specific. How about just calling it
iommu_address() ?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jul 07 2003 - 22:00:13 EST