mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 01:11:14 +00:00
51db334005
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.54 Removed upstreamed: generic/backport-6.6/780-24-v6.12-r8169-disable-ALDPS-per-default-for-RTL8125.patch[1] generic/pending-6.6/360-selftests-bpf-portability-of-unprivileged-tests.patch[2] Manually rebased: bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch bmips/patches-6.6/200-mips-bmips-automatically-detect-CPU-frequency.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.54&id=50d062b6cc90c45a0de54e9bd9903c82777d66bf 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.54&id=103c0431c7fb4790affea121126840dbfb146341 Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/16602 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
107 lines
3.4 KiB
Diff
107 lines
3.4 KiB
Diff
From a170cb9936bb0b00d58aaea40984dbce1169fe42 Mon Sep 17 00:00:00 2001
|
|
From: Minda Chen <minda.chen@starfivetech.com>
|
|
Date: Mon, 3 Jul 2023 16:14:20 +0800
|
|
Subject: [PATCH 110/116] usb: xhci: using dma_alloc_noncoherent to alloc low
|
|
memory pool
|
|
|
|
For RISCV_NONCACHEHERENT is set, using dma_alloc_noncoherent
|
|
to alloc cached large block low memory buffer. And set default
|
|
size to 4M. (largest size of continuous memory can be supported)
|
|
|
|
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
|
|
---
|
|
drivers/usb/host/xhci-mem.c | 29 ++++++++++++++++-------------
|
|
drivers/usb/host/xhci-plat.c | 9 +++++----
|
|
2 files changed, 21 insertions(+), 17 deletions(-)
|
|
|
|
--- a/drivers/usb/host/xhci-mem.c
|
|
+++ b/drivers/usb/host/xhci-mem.c
|
|
@@ -1891,7 +1891,8 @@ void xhci_mem_cleanup(struct xhci_hcd *x
|
|
|
|
if (xhci->lowmem_pool.pool) {
|
|
pool = &xhci->lowmem_pool;
|
|
- dma_free_coherent(dev, pool->size, (void *)pool->cached_base, pool->dma_addr);
|
|
+ dma_free_noncoherent(dev, pool->size, (void *)pool->cached_base,
|
|
+ pool->dma_addr, DMA_BIDIRECTIONAL);
|
|
gen_pool_destroy(pool->pool);
|
|
pool->pool = NULL;
|
|
}
|
|
@@ -2320,15 +2321,15 @@ int xhci_setup_local_lowmem(struct xhci_
|
|
if (!pool->pool) {
|
|
/* minimal alloc one page */
|
|
pool->pool = gen_pool_create(PAGE_SHIFT, dev_to_node(hcd->self.sysdev));
|
|
- if (IS_ERR(pool->pool))
|
|
- return PTR_ERR(pool->pool);
|
|
+ if (!pool->pool)
|
|
+ return -ENOMEM;
|
|
}
|
|
|
|
- buffer = dma_alloc_coherent(hcd->self.sysdev, size, &dma_addr,
|
|
- GFP_KERNEL | GFP_DMA32);
|
|
+ buffer = dma_alloc_noncoherent(hcd->self.sysdev, size, &dma_addr,
|
|
+ DMA_BIDIRECTIONAL, GFP_ATOMIC);
|
|
|
|
- if (IS_ERR(buffer)) {
|
|
- err = PTR_ERR(buffer);
|
|
+ if (!buffer) {
|
|
+ err = -ENOMEM;
|
|
goto destroy_pool;
|
|
}
|
|
|
|
@@ -2338,11 +2339,11 @@ int xhci_setup_local_lowmem(struct xhci_
|
|
* for it.
|
|
*/
|
|
err = gen_pool_add_virt(pool->pool, (unsigned long)buffer,
|
|
- dma_addr, size, dev_to_node(hcd->self.sysdev));
|
|
+ dma_addr, size, dev_to_node(hcd->self.sysdev));
|
|
if (err < 0) {
|
|
dev_err(hcd->self.sysdev, "gen_pool_add_virt failed with %d\n",
|
|
err);
|
|
- dma_free_coherent(hcd->self.sysdev, size, buffer, dma_addr);
|
|
+ dma_free_noncoherent(hcd->self.sysdev, size, buffer, dma_addr, DMA_BIDIRECTIONAL);
|
|
goto destroy_pool;
|
|
}
|
|
|
|
@@ -2365,7 +2366,7 @@ int xhci_mem_init(struct xhci_hcd *xhci,
|
|
unsigned int val, val2;
|
|
u64 val_64;
|
|
u32 page_size, temp;
|
|
- int i;
|
|
+ int i, ret;
|
|
|
|
INIT_LIST_HEAD(&xhci->cmd_list);
|
|
|
|
@@ -2495,9 +2496,11 @@ int xhci_mem_init(struct xhci_hcd *xhci,
|
|
xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX;
|
|
|
|
if (xhci->quirks & XHCI_LOCAL_BUFFER) {
|
|
- if (xhci_setup_local_lowmem(xhci,
|
|
- xhci->lowmem_pool.size))
|
|
- goto fail;
|
|
+ ret = xhci_setup_local_lowmem(xhci, xhci->lowmem_pool.size);
|
|
+ if (ret) {
|
|
+ xhci->quirks &= ~XHCI_LOCAL_BUFFER;
|
|
+ xhci_warn(xhci, "WARN: Can't alloc lowmem pool\n");
|
|
+ }
|
|
}
|
|
|
|
/*
|
|
--- a/drivers/usb/host/xhci-plat.c
|
|
+++ b/drivers/usb/host/xhci-plat.c
|
|
@@ -255,10 +255,11 @@ int xhci_plat_probe(struct platform_devi
|
|
|
|
if (device_property_read_bool(tmpdev, "xhci-lowmem-pool")) {
|
|
xhci->quirks |= XHCI_LOCAL_BUFFER;
|
|
- if (device_property_read_u32(tmpdev, "lowmem-pool-size",
|
|
- &xhci->lowmem_pool.size)) {
|
|
- xhci->lowmem_pool.size = 8 << 20;
|
|
- } else
|
|
+ ret = device_property_read_u32(tmpdev, "lowmem-pool-size",
|
|
+ &xhci->lowmem_pool.size);
|
|
+ if (ret || xhci->lowmem_pool.size >= 4)
|
|
+ xhci->lowmem_pool.size = 4 << 20;
|
|
+ else
|
|
xhci->lowmem_pool.size <<= 20;
|
|
}
|
|
device_property_read_u32(tmpdev, "imod-interval-ns",
|