[PATCH 0/8] firewire: core/ohci: code refactoring for pages dedicated to DMA

Takashi Sakamoto posted 8 patches 1 month ago
drivers/firewire/core-cdev.c |  41 ++++++------
drivers/firewire/core-iso.c  |  86 +++++++++++++-----------
drivers/firewire/core.h      |   1 +
drivers/firewire/ohci.c      | 124 ++++++++++++++++++++---------------
include/linux/firewire.h     |   3 +-
5 files changed, 141 insertions(+), 114 deletions(-)
[PATCH 0/8] firewire: core/ohci: code refactoring for pages dedicated to DMA
Posted by Takashi Sakamoto 1 month ago
Hi,

This patchset is to refactor current codes handling pages dedicated to
DMA.

There are two cases to acquires pages dedicated to DMA; isochronous
contexts and AR contexts. The reason of page acquisition is the need to map
them into VMA. In the former case, they are mapped into userspace VMA. In
the latter case, they are mapped into kernel VMA with continuous address
to access to packet content across the page boundaries, especially between
the end and the beginning of pages. The allocated pages are
discontiguous, and their cache coherency is managed by DMA streaming
APIs.

1394 OHCI has no restriction about the size and alignment of memory
registered for DMA, while the registered DMA address should be within
32 bit. The DMA mapped addresses can be discontiguous between descriptor,
thus the above subsystem design is due to the convenience of system side.

I think the recent convention of driver programming relies on DMA-coherent
buffers, while this code refactoring keeps the uses of DMA streaming
APIs as is. Also, the acquisition per page is kept as is, even if there
are some ways to allocate memories wider than the page size. They would be
future works since it requires to change how to handle the packet content
across the pages.


Takashi Sakamoto (8):
  firewire: core: move private function declaration from public header
    to internal header
  firewire: core: use mutex instead of spinlock for client isochronous
    context
  firewire: core: code refactoring with cleanup function for isoc pages
  firewire: core: use common kernel API to allocate and release a batch
    of pages
  firewire: core: stop using page private to store DMA mapping address
  firewire: ohci: use MAX macro to guarantee minimum count of pages for
    AR contexts
  firewire: ohci: split page allocation from dma mapping
  firewire: ohci: stop using page private to store DMA mapping address

 drivers/firewire/core-cdev.c |  41 ++++++------
 drivers/firewire/core-iso.c  |  86 +++++++++++++-----------
 drivers/firewire/core.h      |   1 +
 drivers/firewire/ohci.c      | 124 ++++++++++++++++++++---------------
 include/linux/firewire.h     |   3 +-
 5 files changed, 141 insertions(+), 114 deletions(-)


base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
-- 
2.51.0
Re: [PATCH 0/8] firewire: core/ohci: code refactoring for pages dedicated to DMA
Posted by Takashi Sakamoto 4 weeks ago
On Sat, Jan 10, 2026 at 10:39:03AM +0900, Takashi Sakamoto wrote:
> Hi,
> 
> This patchset is to refactor current codes handling pages dedicated to
> DMA.
> 
> There are two cases to acquires pages dedicated to DMA; isochronous
> contexts and AR contexts. The reason of page acquisition is the need to map
> them into VMA. In the former case, they are mapped into userspace VMA. In
> the latter case, they are mapped into kernel VMA with continuous address
> to access to packet content across the page boundaries, especially between
> the end and the beginning of pages. The allocated pages are
> discontiguous, and their cache coherency is managed by DMA streaming
> APIs.
> 
> 1394 OHCI has no restriction about the size and alignment of memory
> registered for DMA, while the registered DMA address should be within
> 32 bit. The DMA mapped addresses can be discontiguous between descriptor,
> thus the above subsystem design is due to the convenience of system side.
> 
> I think the recent convention of driver programming relies on DMA-coherent
> buffers, while this code refactoring keeps the uses of DMA streaming
> APIs as is. Also, the acquisition per page is kept as is, even if there
> are some ways to allocate memories wider than the page size. They would be
> future works since it requires to change how to handle the packet content
> across the pages.
> 
> 
> Takashi Sakamoto (8):
>   firewire: core: move private function declaration from public header
>     to internal header
>   firewire: core: use mutex instead of spinlock for client isochronous
>     context
>   firewire: core: code refactoring with cleanup function for isoc pages
>   firewire: core: use common kernel API to allocate and release a batch
>     of pages
>   firewire: core: stop using page private to store DMA mapping address
>   firewire: ohci: use MAX macro to guarantee minimum count of pages for
>     AR contexts
>   firewire: ohci: split page allocation from dma mapping
>   firewire: ohci: stop using page private to store DMA mapping address
> 
>  drivers/firewire/core-cdev.c |  41 ++++++------
>  drivers/firewire/core-iso.c  |  86 +++++++++++++-----------
>  drivers/firewire/core.h      |   1 +
>  drivers/firewire/ohci.c      | 124 ++++++++++++++++++++---------------
>  include/linux/firewire.h     |   3 +-
>  5 files changed, 141 insertions(+), 114 deletions(-)

Applied to for-next branch.


Regards

Takashi Sakamoto