21 Aug, 2009
1 commit
-
swiotlb_full() in lib/swiotlb.c throws one of two panic messages
based on whether the direction of transfer is from the device
or to the device. The logic around this is somewhat weird in
the case of bidirectional transfers. It appears to want to
throw both in succession, but since its a panic only the first
makes it.This patch adds a third, separate error for DMA_BIDIRECTIONAL
to make things a bit clearer.Signed-off-by: Casey Dahlin
Cc: FUJITA Tomonori
Cc: Becky Bruce
[ further fixed the error message ]
Signed-off-by: Andrew Morton
LKML-Reference:
Signed-off-by: Ingo Molnar
28 Jul, 2009
6 commits
-
This converts swiotlb to use phys_to_dma and dma_to_phys instead of
swiotlb_phys_to_bus() and swiotlb_bus_to_phys().swiotlb_phys_to_bus() and swiotlb_bus_to_phys() are not necessary so
this patch also removes them.Signed-off-by: FUJITA Tomonori
Acked-by: Becky Bruce -
This converts swiotlb to use dma_capable() instead of
swiotlb_arch_address_needs_mapping() and is_buffer_dma_capable().Signed-off-by: FUJITA Tomonori
Acked-by: Becky Bruce -
swiotlb_bus_to_virt is unncessary; we can use swiotlb_bus_to_phys and
phys_to_virt instead.Signed-off-by: FUJITA Tomonori
Acked-by: Becky Bruce -
Nobody uses swiotlb_arch_range_needs_mapping().
Signed-off-by: FUJITA Tomonori
Acked-by: Becky Bruce -
Nobody uses swiotlb_alloc().
Signed-off-by: FUJITA Tomonori
Acked-by: Becky Bruce -
Nobody uses swiotlb_alloc_boot().
Signed-off-by: FUJITA Tomonori
Acked-by: Becky Bruce
08 Apr, 2009
7 commits
-
Add a hwdev argument that is needed on some architectures
in order to access a per-device offset that is taken into
account when producing a physical address (also needed to
get from bus address to virtual address because the physical
address is an intermediate step).Also make swiotlb_bus_to_virt weak so architectures can
override it.Signed-off-by: Becky Bruce
Acked-by: FUJITA Tomonori
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar -
Right now both swiotlb_sync_single_range and swiotlb_sync_sg
were duplicating the code in swiotlb_sync_single. Just call it
instead. Also rearrange the sync_single code for readability.Note that the swiotlb_sync_sg code was previously doing
a complicated comparison to determine if an addresses needed
to be unmapped where a simple is_swiotlb_buffer() call
would have sufficed.Signed-off-by: Becky Bruce
Acked-by: FUJITA Tomonori
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar -
Previously, swiotlb_unmap_page and swiotlb_unmap_sg were
duplicating very similar code. Refactor that code into a
new unmap_single and unmap_single use do_unmap_single.Note that the swiotlb_unmap_sg code was previously doing
a complicated comparison to determine if an addresses needed
to be unmapped where a simple is_swiotlb_buffer() call
would have sufficed.Signed-off-by: Becky Bruce
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar -
Some architectures require additional checking to determine
if a device can dma to an address and need to provide their
own address_needs_mapping..Signed-off-by: Becky Bruce
Acked-by: FUJITA Tomonori
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar -
The current code calls virt_to_phys() on address that might
be in highmem, which is bad. This wasn't needed, anyway, because
we already have the physical address we need.Get rid of the now-unused virtual address as well.
Signed-off-by: Becky Bruce
Acked-by: FUJITA Tomonori
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar -
Squash a build warning seen on 32-bit powerpc caused by
calling min() with 2 different types. Use min_t() instead.Signed-off-by: Becky Bruce
Acked-by: FUJITA Tomonori
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar -
Impact: cleanup
swiotlb_map/unmap_single are now swiotlb_map/unmap_page;
trivially change all the comments to reference new names.Also, there were some comments that should have been
referring to just plain old map_single, not swiotlb_map_single;
fix those as well.Also change a use of the word "pointer", when what is
referred to is actually a dma/physical address.Signed-off-by: Becky Bruce
Acked-by: FUJITA Tomonori
Signed-off-by: Kumar Gala
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference:
Signed-off-by: Ingo Molnar
07 Apr, 2009
1 commit
-
Replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32)
Signed-off-by: Yang Hongyang
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
11 Jan, 2009
3 commits
-
Scatterlists containing HighMem pages do not have a useful virtual
address. Use the physical address instead.Signed-off-by: Ian Campbell
Signed-off-by: Ingo Molnar -
The swiotlb_arch_range_needs_mapping() hook should take a physical
address rather than a virtual address in order to support highmem pages.Signed-off-by: Ian Campbell
Signed-off-by: Ingo Molnar
07 Jan, 2009
2 commits
-
…/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
rcu: fix rcutorture bug
rcu: eliminate synchronize_rcu_xxx macro
rcu: make treercu safe for suspend and resume
rcu: fix rcutree grace-period-latency bug on small systems
futex: catch certain assymetric (get|put)_futex_key calls
futex: make futex_(get|put)_key() calls symmetric
locking, percpu counters: introduce separate lock classes
swiotlb: clean up EXPORT_SYMBOL usage
swiotlb: remove unnecessary declaration
swiotlb: replace architecture-specific swiotlb.h with linux/swiotlb.h
swiotlb: add support for systems with highmem
swiotlb: store phys address in io_tlb_orig_addr array
swiotlb: add hwdev to swiotlb_phys_to_bus() / swiotlb_sg_to_bus() -
Signed-off-by: Kay Sievers
Signed-off-by: Greg Kroah-Hartman
06 Jan, 2009
2 commits
-
This adds swiotlb_map_page and swiotlb_unmap_page to lib/swiotlb.c and
remove IA64 and X86's swiotlb_map_page and swiotlb_unmap_page.This also removes unnecessary swiotlb_map_single, swiotlb_map_single_attrs,
swiotlb_unmap_single and swiotlb_unmap_single_attrs.Signed-off-by: FUJITA Tomonori
Acked-by: Tony Luck
Signed-off-by: Ingo Molnar -
This converts X86 and IA64 to use include/linux/dma-mapping.h.
It's a bit large but pretty boring. The major change for X86 is
converting 'int dir' to 'enum dma_data_direction dir' in DMA mapping
operations. The major changes for IA64 is using map_page and
unmap_page instead of map_single and unmap_single.Signed-off-by: FUJITA Tomonori
Acked-by: Tony Luck
Signed-off-by: Ingo Molnar
05 Jan, 2009
1 commit
-
Conflicts:
lib/swiotlb.c
04 Jan, 2009
1 commit
-
There's no point in including the linux/swiotlb.h header twice in
lib/swiotlb.c - this patch gets rid of the unneeded include.Signed-off-by: Jesper Juhl
Signed-off-by: Ingo Molnar
03 Jan, 2009
1 commit
-
Impact: cleanup, reduce kernel size a bit
The current kernel build warns:
WARNING: vmlinux.o(.text+0x11458): Section mismatch in reference from the function swiotlb_alloc_boot() to the function .init.text:__alloc_bootmem_low()
The function swiotlb_alloc_boot() references
the function __init __alloc_bootmem_low().
This is often because swiotlb_alloc_boot lacks a __init
annotation or the annotation of __alloc_bootmem_low is wrong.WARNING: vmlinux.o(.text+0x1011f2): Section mismatch in reference from the function swiotlb_late_init_with_default_size() to the function .init.text:__alloc_bootmem_low()
The function swiotlb_late_init_with_default_size() references
the function __init __alloc_bootmem_low().
This is often because swiotlb_late_init_with_default_size lacks a __init
annotation or the annotation of __alloc_bootmem_low is wrong.and indeed the functions calling __alloc_bootmem_low() can be marked
__init as well.Signed-off-by: Roland Dreier
Signed-off-by: Ingo Molnar
28 Dec, 2008
5 commits
-
Impact: cleanup
swiotlb uses EXPORT_SYMBOL in an inconsistent way. Some functions use
EXPORT_SYMBOL at the end of functions. Some use it at the end of
swiotlb.c.This cleans up swiotlb to use EXPORT_SYMBOL in a consistent way (at
the end of functions).Signed-off-by: FUJITA Tomonori
Signed-off-by: Ingo Molnar -
Impact: cleanup
Signed-off-by: FUJITA Tomonori
Signed-off-by: Ingo Molnar -
Impact: extend code for highmem - existing users unaffected
On highmem systems, the original dma buffer might not
have a virtual mapping - we need to kmap it in to perform
the bounce. Extract the code that does the actual
copy into a function that does the kmap if highmem
is enabled, and default to the normal swiotlb memcpy
if not.[ ported by Jeremy Fitzhardinge ]
Signed-off-by: Becky Bruce
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: refactor code, cleanup
When we enable swiotlb for platforms that support HIGHMEM, we
can no longer store the virtual address of the original dma
buffer, because that buffer might not have a permament mapping.Change the swiotlb code to instead store the physical address of
the original buffer.Signed-off-by: Becky Bruce
Signed-off-by: Ingo Molnar -
Impact: extend functions with a (yet unused) parameter, update callsites
Some architectures need it - in preparation for highmem swiotlb.
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar
18 Dec, 2008
6 commits
-
Impact: clean up swiotlb printks
Remove duplicated swiotlb info printing, and make it more detailed.
Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: prepare the swiotlb code for HighMem struct pages
This requires us to treat DMA regions in terms of page+offset rather
than virtual addressing since a HighMem page may not have a mapping.Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: generalize IO bounce memcpys
Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: generalize the sw-IOTLB range checks
Some architectures require special rules to determine whether a range
needs mapping or not. This adds a weak function for architectures to
override.Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: generalize physbusphys conversions in the swiotlb code
Architectures may need to override these conversions. Implement a
__weak hook point containing the default implementation.Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: cleanup
Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar
17 Dec, 2008
2 commits
-
Impact: cleanup
Signed-off-by: Ian Campbell
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
Impact: generalize swiotlb allocation code
Architectures may need to allocate memory specially for use with
the swiotlb. Create the weak function swiotlb_alloc_boot() and
swiotlb_alloc() defaulting to the current behaviour.Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ian Campbell
Signed-off-by: Ingo Molnar
17 Nov, 2008
1 commit
-
Impact: fix DMA buffer allocation coherency bug in certain configs
This patch fixes swiotlb to use dev->coherent_dma_mask in
swiotlb_alloc_coherent().coherent_dma_mask is a subset of dma_mask (equal to it most of
the time), enumerating the address range that a given device
is able to DMA to/from in a cache-coherent way.But currently, swiotlb uses dev->dma_mask in alloc_coherent()
implicitly via address_needs_mapping(), but alloc_coherent is really
supposed to use coherent_dma_mask.This bug could break drivers that uses smaller coherent_dma_mask than
dma_mask (though the current code works for the majority that use the
same mask for coherent_dma_mask and dma_mask).Signed-off-by: FUJITA Tomonori
Cc: tony.luck@intel.com
Signed-off-by: Ingo Molnar
24 Oct, 2008
1 commit
-
swiotlb_alloc_coherent calls panic() when allocated swiotlb pages is
not fit for a device's dma mask. However, alloc_coherent failure is
not a disaster at all. AFAIK, none of other x86 and IA64 IOMMU
implementations don't crash in case of alloc_coherent failure.There are some drivers that don't check alloc_coherent failure but not
many (about ten and I've already started to fix some of
them). alloc_coherent returns NULL in case of failure so it's likely
that these guilty drivers crash immediately. So swiotlb doesn't need
to call panic() just for them.Reported-by: Takashi Iwai
Signed-off-by: FUJITA Tomonori
Tested-by: Takashi Iwai
Signed-off-by: Ingo Molnar