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-next>] [day] [month] [year] [list]
Date:	Fri, 18 Nov 2011 00:30:59 +0100
From:	Alessandro Rubini <ru@...dd.com>
To:	akpm@...ux-foundation.org, fujita.tomonori@....ntt.co.jp,
	tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
	x86@...nel.org, linux-kernel@...r.kernel.org
Cc:	giancarlo.asnaghi@...com, maddalena.brattoli@...com,
	alan@...ux.intel.com
Subject: a question on DMA and remapping

Hello.
This goes to the maintainers of x86::asm/dma-mapping.h and lib/swiotlb.c,
with Cc: to involved people.

I have an Intel evaluation board with the ST IO-Hub called STA2X11 and
I'm working to port the STA2X11 drivers to mainstream.  The code is
currently on sourceforge.  Since the device is based on a PCI-Amba
bridge, all DMA addresses are different from CPU addresses, even for
normal PCI devices, like EHCI.

Unfortunately, the current patch is changing 3 inlines to external
functions. They are dma_capable, phys_to_dma, dma_to_phys -- which
actually are only used in swiotlb.c .

I thought about the following two approaches towards a clean port:

  - using dma_supported(), which relies on dev->dma_ops->dma_supported
    and adding phys_to_dma and dma_to_phys to the dma operations. In
    the new fields, the default NULL may be used to select the current
    behaviour in an inline function.

  - copying lib/swiotlb.c to my own file, which will be almost
    identical to the existing one but for a few lines.

The former approach will have some tiny overhead on all users, besides
messing with dma_capable and dma_allowed, possibly introducing bugs in
some corner cases (but the current situation is quite messy, may I
say...)

The latter approach means code duplication, which is bad. Although
maybe over time I may be able to shrink the current swiotlb.c to a
much smaller snippet. I tend to prefer this one, but I'm not sure if
it's acceptable.

Any feedback is welcome. Thanks in advance.

/alessandro
--
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