lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 Aug 2010 19:08:51 +0900
From:	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To:	sa212+lkml@...onix.com
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Driver: PCIe: 'pci_map_sg' returning invalid bus address?

On Wed, 04 Aug 2010 10:26:29 +0100
Evan Lavelle <sa212+lkml@...onix.com> wrote:

> Made some progress here. The problem is that this is 32-bit PAE kernel, 
> so 'dma_addr_t' is 64-bit. However, I have a 32-bit PCIe card, so I need 
> a 32-bit dma_addr_t. How do I do this? In other words, how do I handle 
> 32-bit PCI cards on PAE or 64-bit systems? My code sets the DMA mask to 
> 32 bits but this is *not* sufficient:
> 
> pci_set_dma_mask(my_dev, DMA_32BIT_MASK)

It doesn't work on x86_32 kernel if your driver doesn't work with the
block layer or the network subsystem.

If your driver can't handle 64bit DMA, you need bounce buffer. I don't
know what your driver do, but a subsystem passes a buffer to your
driver. If a buffer is not below 32bit address, for example, if you
read data from hardware, you need to allocate a temporary buffer
(below 32bit), do DMA with the buffer, copy the data to the original
buffer, then free the temporary buffer.

The block layer and the network subsystem have the own bounce
mechanism. x86_64 kernel has swiotlb, which is the generic bounce
buffer mechanism. So if a driver sets the dma mask, they do bounce
buffer for the driver.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ