summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-11 11:32:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-11 11:32:06 -0800
commit0d6dd4738dbcc32b60c0c0c1388d41e171b76845 (patch)
treea7b906b75970113aa33d2346e3dc0bf382f6b6b2 /include
parenta31980dba7b957df21fd99d158dd0be516825676 (diff)
parent6b617317e5bc95e9962a712314ae0c4b7a4d5cc3 (diff)
Merge tag 'firewire-updates-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Takashi Sakamoto: - Refactor page allocation dedicated to 1394 OHCI IR/IT/AR DMA contexts Although 1394 OHCI specification does not impose any restriction on the memory size dedicated to these DMA contexts, 1394 OHCI PCI driver allocates pages for convenience when mapping them into either kernel space or userspace VMA. The driver previously used dma_alloc_pages() for both page allocation and mapping creation, even though this kernel API is rarely used. Following discussions questioning the page-oriented kernel API in the DMA layer, the driver has been refactored to avoid using this API. In addition, the use of private members in the allocated pages has been removed following long-standing concern. - Allocate variable-sized buffer for isochronous context header 1394 OHCI PCI driver previously allocated a single page for isochronous context header. As a result, the buffer size for the header was fixed to PAGE_SIZE, which imposed a limitation on IEC 61883-1/6 packet streaming engine. Consequently, the ALSA PCM devices provided by drivers for audio and music units in IEEE 1394 bus were constrained in the maximum size of buffer period (64 ms in most cases). This limitation is resolved by dynamically allocating the header buffer with an arbitrary size. * tag 'firewire-updates-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: ALSA: firewire: remove PCM buffer size constraint from isoc context header firewire: core: add fw_iso_context_create() variant with header storage size firewire: core: provide isoc header buffer size outside card driver firewire: ohci: allocate isoc context header by kvmalloc() firewire: core: add flags member for isochronous context structure firewire: ohci: use cleanup helper for isoc context header allocation firewire: ohci: code refactoring to use union for isoc multiple channel state firewire: ohci: refactor isoc single-channel state using a union firewire: core: add function variants for isochronous context creation firewire: ohci: fix index of pages for dma address to 1394 OHCI IT context firewire: ohci: stop using page private to store DMA mapping address firewire: ohci: split page allocation from dma mapping firewire: ohci: use MAX macro to guarantee minimum count of pages for AR contexts firewire: core: stop using page private to store DMA mapping address firewire: core: use common kernel API to allocate and release a batch of pages firewire: core: code refactoring with cleanup function for isoc pages firewire: core: use mutex instead of spinlock for client isochronous context firewire: core: move private function declaration from public header to internal header
Diffstat (limited to 'include')
-rw-r--r--include/linux/firewire.h36
1 files changed, 30 insertions, 6 deletions
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 6143b7d28eac..986d712e4d94 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -526,14 +526,13 @@ struct fw_iso_packet {
struct fw_iso_buffer {
enum dma_data_direction direction;
struct page **pages;
+ dma_addr_t *dma_addrs;
int page_count;
- int page_count_mapped;
};
int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
int page_count, enum dma_data_direction direction);
void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
-size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed);
struct fw_iso_context;
typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
@@ -547,21 +546,26 @@ union fw_iso_callback {
fw_iso_mc_callback_t mc;
};
+enum fw_iso_context_flag {
+ FW_ISO_CONTEXT_FLAG_DROP_OVERFLOW_HEADERS = BIT(0),
+};
+
struct fw_iso_context {
struct fw_card *card;
struct work_struct work;
int type;
int channel;
int speed;
- bool drop_overflow_headers;
+ int flags;
size_t header_size;
+ size_t header_storage_size;
union fw_iso_callback callback;
void *callback_data;
};
-struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
- int type, int channel, int speed, size_t header_size,
- fw_iso_callback_t callback, void *callback_data);
+struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int type, int channel,
+ int speed, size_t header_size, size_t header_storage_size,
+ union fw_iso_callback callback, void *callback_data);
int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels);
int fw_iso_context_queue(struct fw_iso_context *ctx,
struct fw_iso_packet *packet,
@@ -570,6 +574,26 @@ int fw_iso_context_queue(struct fw_iso_context *ctx,
void fw_iso_context_queue_flush(struct fw_iso_context *ctx);
int fw_iso_context_flush_completions(struct fw_iso_context *ctx);
+static inline struct fw_iso_context *fw_iso_context_create(struct fw_card *card, int type,
+ int channel, int speed, size_t header_size, fw_iso_callback_t callback,
+ void *callback_data)
+{
+ union fw_iso_callback cb = { .sc = callback };
+
+ return __fw_iso_context_create(card, type, channel, speed, header_size, PAGE_SIZE, cb,
+ callback_data);
+}
+
+static inline struct fw_iso_context *fw_iso_context_create_with_header_storage_size(
+ struct fw_card *card, int type, int channel, int speed, size_t header_size,
+ size_t header_storage_size, fw_iso_callback_t callback, void *callback_data)
+{
+ union fw_iso_callback cb = { .sc = callback };
+
+ return __fw_iso_context_create(card, type, channel, speed, header_size, header_storage_size,
+ cb, callback_data);
+}
+
/**
* fw_iso_context_schedule_flush_completions() - schedule work item to process isochronous context.
* @ctx: the isochronous context