linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] swiotlb v0.8: seperation of physical/virtual address translation
@ 2010-05-11 15:39 Konrad Rzeszutek Wilk
  2010-05-11 15:39 ` [PATCH 1/6] swiotlb: add swiotlb_tbl_map_single library function Konrad Rzeszutek Wilk
  2010-05-17  9:48 ` [PATCH] swiotlb v0.8: seperation of physical/virtual address translation FUJITA Tomonori
  0 siblings, 2 replies; 25+ messages in thread
From: Konrad Rzeszutek Wilk @ 2010-05-11 15:39 UTC (permalink / raw)
  To: fujita.tomonori, linux-kernel, iommu
  Cc: albert_herranz, chrisw, Ian.Campbell, jeremy, dwmw2

Fujita-san et al.

Thank you for your continued careful review of these patches! I've attached your
set of patches to this e-mail, I hope that is ok?

Since the last posting [v7] I've done:
 - Minimized the list of exported functions even further.
 - Integrated your set of patches and changed "swiotlb_tlb" to "swiotlb_tbl"
[v6-v7 changes:]
 - Minimized the list exported functions/variable with a prefix of: "swiotbl_tbl".
 - Made the usage of 'int dir' to be 'enum dma_data_direction'.
[v5-v6 changes:]
 - Made the exported functions/variables have the 'swiotlb_bk' prefix to be
   more uniform.
 - dropped the checkpatches/other reworks

.. and the writeup for this set set of patches:

The idea behind this set of patches is to make it possible to have separate
mechanisms for translating virtual to physical or virtual to DMA addresses
on platforms which need an SWIOTLB, and where physical != PCI bus address.

One customers of this is the pv-ops project, which can switch between
different modes of operation depending on the environment it is running in:
bare-metal or virtualized (Xen for now). Another is the Wii DMA implementation
so that the Wii USB controller can work.

On bare-metal SWIOTLB is used when there are no hardware IOMMU. In virtualized
environment it used when PCI pass-through is enabled for the guest. The problems
with PCI pass-through is that the guest's idea of PFN's is not the real thing.
To fix that, there is translation layer for PFN->machine frame number and vice-versa.
To bubble that up to the SWIOTLB layer there are two possible solutions.

One solution has been to wholesale copy the SWIOTLB, stick it in
arch/x86/xen/swiotlb.c and modify the virt_to_phys, phys_to_virt and others
to use the Xen address translation functions. Unfortunately, since the kernel can
run on bare-metal, there would be big code overlap with the real SWIOTLB.
(git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git xen/dom0/swiotlb-new)

Another approach, which this set of patches explores, is to abstract the
address translation and address determination functions away from the
SWIOTLB book-keeping functions. This way the core SWIOTLB library functions
are present in one place, while the address related functions are in
a separate library that can be loaded when running under non-bare-metal platform.

The set of patches is also accessible on:

git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb-2.6.git swiotlb-0.8

 include/linux/swiotlb.h |   27 ++++++++-
 lib/swiotlb.c           |  140 ++++++++++++++++++++++++++++-------------------
 2 files changed, 108 insertions(+), 59 deletions(-)



^ permalink raw reply	[flat|nested] 25+ messages in thread
* [PATCH] swiotlb 0.7: separation of physical and virtual address translation.
@ 2010-04-07 20:29 Konrad Rzeszutek Wilk
  2010-04-07 20:29 ` [PATCH 1/6] swiotlb: Make internal bookkeeping functions have 'swiotlb_tbl' prefix Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 25+ messages in thread
From: Konrad Rzeszutek Wilk @ 2010-04-07 20:29 UTC (permalink / raw)
  To: FUJITA Tomonori, linux-kernel, iommu, albert_herranz
  Cc: linux, chrisw, Ian.Campbell, jeremy, dwmw2, alex.williamson

Fujita-san et al.

Attached is a set of patches that separate the address translation
(virt_to_phys, virt_to_bus, etc) from the SWIOTLB library.

Since the last posting [v6] I've done:
 - Minimized the list exported functions/variable with a prefix of: "swiotbl_tbl".
 - Made the usage of 'int dir' to be 'enum dma_data_direction'.
[v5-v6 changes:]
 - Made the exported functions/variables have the 'swiotlb_bk' prefix to be
   more uniform.
 - dropped the checkpatches/other reworks

.. and the writeup for this set set of patches:

The idea behind this set of patches is to make it possible to have separate
mechanisms for translating virtual to physical or virtual to DMA addresses
on platforms which need an SWIOTLB, and where physical != PCI bus address.

One customers of this is the pv-ops project, which can switch between
different modes of operation depending on the environment it is running in:
bare-metal or virtualized (Xen for now). Another is the Wii DMA implementation
so that the Wii USB controller can work.

On bare-metal SWIOTLB is used when there are no hardware IOMMU. In virtualized
environment it used when PCI pass-through is enabled for the guest. The problems
with PCI pass-through is that the guest's idea of PFN's is not the real thing.
To fix that, there is translation layer for PFN->machine frame number and vice-versa.
To bubble that up to the SWIOTLB layer there are two possible solutions.

One solution has been to wholesale copy the SWIOTLB, stick it in
arch/x86/xen/swiotlb.c and modify the virt_to_phys, phys_to_virt and others
to use the Xen address translation functions. Unfortunately, since the kernel can
run on bare-metal, there would be big code overlap with the real SWIOTLB.
(git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git xen/dom0/swiotlb-new)

Another approach, which this set of patches explores, is to abstract the
address translation and address determination functions away from the
SWIOTLB book-keeping functions. This way the core SWIOTLB library functions
are present in one place, while the address related functions are in
a separate library that can be loaded when running under non-bare-metal platform.

The set of patches is also accessible on

git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb-2.6.git swiotlb-0.7

 include/linux/swiotlb.h |   37 +++++++-
 lib/swiotlb.c           |  244 +++++++++++++++++++++++++---------------------
 2 files changed, 168 insertions(+), 113 deletions(-)

P.S.
There is also a branch utilizing the above mentioned patches: xen-swiotlb-0.7

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2010-05-28 16:25 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11 15:39 [PATCH] swiotlb v0.8: seperation of physical/virtual address translation Konrad Rzeszutek Wilk
2010-05-11 15:39 ` [PATCH 1/6] swiotlb: add swiotlb_tbl_map_single library function Konrad Rzeszutek Wilk
2010-05-11 15:39   ` [PATCH 2/6] swiotlb: add the swiotlb initialization function with iotlb memory Konrad Rzeszutek Wilk
2010-05-11 15:39     ` [PATCH 3/6] swiotlb: Make internal bookkeeping functions have 'swiotlb_tbl' prefix Konrad Rzeszutek Wilk
2010-05-11 15:39       ` [PATCH 4/6] swiotlb: search and replace "int dir" with "enum dma_data_direction dir" Konrad Rzeszutek Wilk
2010-05-11 15:39         ` [PATCH 5/6] swiotlb: Make swiotlb bookkeeping functions visible in the header file Konrad Rzeszutek Wilk
2010-05-11 15:39           ` [PATCH 6/6] swiotlb: EXPORT_SYMBOL_GPL functions + variables that are defined " Konrad Rzeszutek Wilk
2010-05-11 18:28           ` [PATCH 5/6] swiotlb: Make swiotlb bookkeeping functions visible " Albert Herranz
2010-05-11 18:36             ` Jeremy Fitzhardinge
2010-05-11 18:46             ` Konrad Rzeszutek Wilk
2010-05-11 19:01               ` Albert Herranz
2010-05-11 19:39                 ` Konrad Rzeszutek Wilk
2010-05-13  5:04                   ` Albert Herranz
2010-05-18  3:28                     ` FUJITA Tomonori
2010-05-18 16:52                       ` Albert Herranz
2010-05-19  3:34                         ` FUJITA Tomonori
2010-05-19  5:22                           ` Albert Herranz
2010-05-19  7:10                           ` Russell King - ARM Linux
2010-05-19 11:54                             ` FUJITA Tomonori
2010-05-17  9:48 ` [PATCH] swiotlb v0.8: seperation of physical/virtual address translation FUJITA Tomonori
2010-05-26 15:42   ` Konrad Rzeszutek Wilk
2010-05-28 16:23     ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2010-04-07 20:29 [PATCH] swiotlb 0.7: separation of physical and virtual " Konrad Rzeszutek Wilk
2010-04-07 20:29 ` [PATCH 1/6] swiotlb: Make internal bookkeeping functions have 'swiotlb_tbl' prefix Konrad Rzeszutek Wilk
2010-04-07 20:29   ` [PATCH 2/6] swiotlb: swiotlb_tbl_map_single: abstract out swiotlb_virt_to_bus calls out Konrad Rzeszutek Wilk
2010-04-07 20:29     ` [PATCH 3/6] swiotlb: Make exportable bookkeeping functions and variables have same prefix Konrad Rzeszutek Wilk
2010-04-07 20:29       ` [PATCH 4/6] swiotlb: search and replace "int dir" with "enum dma_data_direction dir" Konrad Rzeszutek Wilk
2010-04-07 20:29         ` [PATCH 5/6] swiotlb: Make swiotlb bookkeeping functions visible in the header file Konrad Rzeszutek Wilk
2010-05-09 13:41           ` FUJITA Tomonori
2010-05-10 19:35             ` Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).