mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 12:40:16 +04:00
8f638f9366
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.91 Remove upstreamed patches: - airoha/patches-6.12/017-v6.13-net-airoha-Implement-BQL-support.patch[1] - airoha/patches-6.12/138-v7.1-net-airoha-Add-missing-RX_CPU_IDX-configuration-in-a.patch[2] - airoha/patches-6.12/149-v7.1-net-airoha-Move-ndesc-initialization-at-end-of-airoh.patch[3] - generic/backport-6.12/940-v7.1-net-dsa-realtek-rtl8365mb-fix-mode-mask-calculation.patch[5] Manually rebased patches: - airoha/patches-6.12/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch[1] - ath79/patches-6.12/800-leds-add-reset-controller-based-driver.patch[4] - bcm27xx/patches-6.12/950-0122-bcmgenet-Better-coalescing-parameter-defaults.patch[6] We also backported four patches to fix perf tool regression: - generic/backport-6.12/216-01-revert-perf-cgroup-update-metric-leader-in-evlist__e.patch - generic/backport-6.12/216-02-revert-perf-tool_pmu-fix-aggregation-on-duration_tim.patch - generic/backport-6.12/216-03-revert-perf-python-add-parse_events-function.patch - generic/backport-6.12/216-04-revert-perf-tool_pmu-factor-tool-events-into-their-o.patch All other patches are automatically refreshed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=ca24fcac1daaa5e8a667981d81986a3eb4b9fb04 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=f00037a99bc2332ef59dc85298b98b20af165904 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=d36be272adda7f313e39dd118086955d993bf6a7 [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=07d3611389ba7d78b80ea360a42ce32ab2521fbc [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=3354d6c62fd4baa7b32cbd80cc5a8aa3f2bd0656 [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=b84351dcc359667bc952131c1424b692ec83dce2 Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Link: https://github.com/openwrt/openwrt/pull/23444 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
125 lines
4.7 KiB
Diff
125 lines
4.7 KiB
Diff
From e5d4be923f4ab4d3bd6bb8ea85654df0be27301f Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Bell <jonathan@raspberrypi.com>
|
|
Date: Fri, 19 Jul 2024 15:55:56 +0100
|
|
Subject: [PATCH] drivers: dw-axi-dmac: make more sensible choices about memory
|
|
accesses
|
|
|
|
There's no real need to constrain MEM access widths to 32-bit (or
|
|
narrower), as the DMAC is intelligent enough to size memory accesses
|
|
appropriately. Wider accesses are more efficient.
|
|
|
|
Similarly, MEM burst lengths don't need to be a function of DEV burst
|
|
lengths - the DMAC packs/unpacks data into/from its internal channel
|
|
FIFOs appropriately. Longer accesses are more efficient.
|
|
|
|
However, the DMAC doesn't have complete support for unaligned accesses,
|
|
and blocks are always defined in integer multiples of SRC_WIDTH, so odd
|
|
source lengths or buffer alignments will prevent wide accesses being
|
|
used, as before.
|
|
|
|
There is an implicit requirement to limit requested DEV read burst
|
|
lengths to less than the hardware's maximum configured MSIZE - otherwise
|
|
RX data will be left over at the end of a block. There is no config
|
|
register that reports this value, so the AXI burst length parameter is
|
|
used to produce a facsimile of it. Warn if such a request arrives that
|
|
doesn't respect this.
|
|
|
|
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
|
|
---
|
|
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 38 ++++++++++++-------
|
|
1 file changed, 25 insertions(+), 13 deletions(-)
|
|
|
|
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
|
|
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
|
|
@@ -307,6 +307,15 @@ static u32 axi_chan_get_xfer_width(struc
|
|
return __ffs(src | dst | len | BIT(max_width));
|
|
}
|
|
|
|
+static u32 axi_dma_encode_msize(u32 max_burst)
|
|
+{
|
|
+ if (max_burst <= 1)
|
|
+ return DWAXIDMAC_BURST_TRANS_LEN_1;
|
|
+ if (max_burst > 1024)
|
|
+ return DWAXIDMAC_BURST_TRANS_LEN_1024;
|
|
+ return fls(max_burst) - 2;
|
|
+}
|
|
+
|
|
static inline const char *axi_chan_name(struct axi_dma_chan *chan)
|
|
{
|
|
return dma_chan_name(&chan->vc.chan);
|
|
@@ -730,41 +739,41 @@ static int dw_axi_dma_set_hw_desc(struct
|
|
size_t axi_block_ts;
|
|
size_t block_ts;
|
|
u32 ctllo, ctlhi;
|
|
- u32 burst_len;
|
|
+ u32 burst_len = 0, mem_burst_msize, reg_burst_msize;
|
|
|
|
axi_block_ts = chan->chip->dw->hdata->block_size[chan->id];
|
|
|
|
mem_width = __ffs(data_width | mem_addr | len);
|
|
- if (mem_width > DWAXIDMAC_TRANS_WIDTH_32)
|
|
- mem_width = DWAXIDMAC_TRANS_WIDTH_32;
|
|
|
|
if (!IS_ALIGNED(mem_addr, 4)) {
|
|
dev_err(chan->chip->dev, "invalid buffer alignment\n");
|
|
return -EINVAL;
|
|
}
|
|
|
|
+ /* Use a reasonable upper limit otherwise residue reporting granularity grows large */
|
|
+ mem_burst_msize = axi_dma_encode_msize(16);
|
|
+
|
|
switch (chan->direction) {
|
|
case DMA_MEM_TO_DEV:
|
|
+ reg_burst_msize = axi_dma_encode_msize(chan->config.dst_maxburst);
|
|
reg_width = __ffs(chan->config.dst_addr_width);
|
|
device_addr = phys_to_dma(chan->chip->dev, chan->config.dst_addr);
|
|
ctllo = reg_width << CH_CTL_L_DST_WIDTH_POS |
|
|
mem_width << CH_CTL_L_SRC_WIDTH_POS |
|
|
- DWAXIDMAC_BURST_TRANS_LEN_1 << CH_CTL_L_DST_MSIZE_POS |
|
|
- DWAXIDMAC_BURST_TRANS_LEN_4 << CH_CTL_L_SRC_MSIZE_POS |
|
|
+ reg_burst_msize << CH_CTL_L_DST_MSIZE_POS |
|
|
+ mem_burst_msize << CH_CTL_L_SRC_MSIZE_POS |
|
|
DWAXIDMAC_CH_CTL_L_NOINC << CH_CTL_L_DST_INC_POS |
|
|
DWAXIDMAC_CH_CTL_L_INC << CH_CTL_L_SRC_INC_POS;
|
|
block_ts = len >> mem_width;
|
|
break;
|
|
case DMA_DEV_TO_MEM:
|
|
+ reg_burst_msize = axi_dma_encode_msize(chan->config.src_maxburst);
|
|
reg_width = __ffs(chan->config.src_addr_width);
|
|
- /* Prevent partial access units getting lost */
|
|
- if (mem_width > reg_width)
|
|
- mem_width = reg_width;
|
|
device_addr = phys_to_dma(chan->chip->dev, chan->config.src_addr);
|
|
ctllo = reg_width << CH_CTL_L_SRC_WIDTH_POS |
|
|
mem_width << CH_CTL_L_DST_WIDTH_POS |
|
|
- DWAXIDMAC_BURST_TRANS_LEN_4 << CH_CTL_L_DST_MSIZE_POS |
|
|
- DWAXIDMAC_BURST_TRANS_LEN_1 << CH_CTL_L_SRC_MSIZE_POS |
|
|
+ mem_burst_msize << CH_CTL_L_DST_MSIZE_POS |
|
|
+ reg_burst_msize << CH_CTL_L_SRC_MSIZE_POS |
|
|
DWAXIDMAC_CH_CTL_L_INC << CH_CTL_L_DST_INC_POS |
|
|
DWAXIDMAC_CH_CTL_L_NOINC << CH_CTL_L_SRC_INC_POS;
|
|
block_ts = len >> reg_width;
|
|
@@ -805,6 +814,12 @@ static int dw_axi_dma_set_hw_desc(struct
|
|
set_desc_src_master(hw_desc);
|
|
|
|
hw_desc->len = len;
|
|
+
|
|
+ if (burst_len && (chan->config.src_maxburst > burst_len))
|
|
+ dev_warn_ratelimited(chan2dev(chan),
|
|
+ "%s: requested source burst length %u exceeds supported burst length %u - data may be lost\n",
|
|
+ axi_chan_name(chan), chan->config.src_maxburst, burst_len);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -821,9 +836,6 @@ static size_t calculate_block_len(struct
|
|
case DMA_MEM_TO_DEV:
|
|
data_width = BIT(chan->chip->dw->hdata->m_data_width);
|
|
mem_width = __ffs(data_width | dma_addr | buf_len);
|
|
- if (mem_width > DWAXIDMAC_TRANS_WIDTH_32)
|
|
- mem_width = DWAXIDMAC_TRANS_WIDTH_32;
|
|
-
|
|
block_len = axi_block_ts << mem_width;
|
|
break;
|
|
case DMA_DEV_TO_MEM:
|