Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.35 Remove upstreamed patches: bcm27xx/patches-6.12/950-0961-media-imx335-Use-correct-register-width-for-HNUM.patch [1] bcm27xx/patches-6.12/950-1003-drivers-media-i2c-imx335-Fix-frame-size-enumeration.patch [2] gemini/patches-6.12/0001-net-ethernet-cortina-Use-TOE-TSO-on-all-TCP.patch [3] generic/backport-6.12/300-v6.16-mips-Add-std-flag-specified.patch [4] mvebu/patches-6.12/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch [5] mvebu/patches-6.12/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch [6] mvebu/patches-6.12/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch [7] mvebu/patches-6.12/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch [8] Manually rebased patches: bcm27xx/patches-6.12/950-0392-fbdev-Allow-client-to-request-a-particular-dev-fbN-n.patch [9] All other patches are automatically refreshed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=b93864e0865f235a791e69dc9ef4f896e559ef77 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=1f78790d988c9d55cf8d4b4d511d4b3e38ecb81d [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=2bd434bb0eeb680c2b3dd6c68ca319b30cb8d47f [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=6dbda47fe8bd6aa978c150bc9d321a286d2cc3f4 [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=2cd2022c38fa26257cc6eec100ae122de9c1541c [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=133f17922b3dbae44fe583fb898b92b03558a657 [7] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=aefe45843ea667366e35df4fcfef5ff9051a86c9 [8] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=461d5a73ae45fbe6c300a6e64600f9792684eb52 [9] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.35&id=3f2098f4fba7718eb2501207ca6e99d22427f25a Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Link: https://github.com/openwrt/openwrt/pull/19249 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
155 lines
4.1 KiB
Diff
155 lines
4.1 KiB
Diff
From 142ae0f3cfc5185ccd7aaff6ffe4336b47572235 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Bell <jonathan@raspberrypi.com>
|
|
Date: Wed, 20 Mar 2024 13:00:30 +0000
|
|
Subject: [PATCH] drivers: mmc: preallocate a block for SD extension register
|
|
accesses
|
|
|
|
The Performance Extension register is regularly accessed in a hot path
|
|
to do write cache flushes. Don't invoke kmalloc/kfree for every access,
|
|
preallocate a 512B buffer for this purpose.
|
|
|
|
Also remove an unused alloc in sd_enable_cache().
|
|
|
|
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
|
|
---
|
|
drivers/mmc/core/bus.c | 2 ++
|
|
drivers/mmc/core/sd.c | 34 +++++++++++-----------------------
|
|
include/linux/mmc/card.h | 1 +
|
|
3 files changed, 14 insertions(+), 23 deletions(-)
|
|
|
|
--- a/drivers/mmc/core/bus.c
|
|
+++ b/drivers/mmc/core/bus.c
|
|
@@ -266,6 +266,8 @@ static void mmc_release_card(struct devi
|
|
|
|
sdio_free_common_cis(card);
|
|
|
|
+ kfree(card->ext_reg_buf);
|
|
+
|
|
kfree(card->info);
|
|
|
|
kfree(card);
|
|
--- a/drivers/mmc/core/sd.c
|
|
+++ b/drivers/mmc/core/sd.c
|
|
@@ -1037,9 +1037,8 @@ int sd_write_ext_reg(struct mmc_card *ca
|
|
struct scatterlist sg;
|
|
u8 *reg_buf;
|
|
|
|
- reg_buf = kzalloc(512, GFP_KERNEL);
|
|
- if (!reg_buf)
|
|
- return -ENOMEM;
|
|
+ reg_buf = card->ext_reg_buf;
|
|
+ memset(reg_buf, 0, 512);
|
|
|
|
mrq.cmd = &cmd;
|
|
mrq.data = &data;
|
|
@@ -1071,8 +1070,6 @@ int sd_write_ext_reg(struct mmc_card *ca
|
|
mmc_set_data_timeout(&data, card);
|
|
mmc_wait_for_req(host, &mrq);
|
|
|
|
- kfree(reg_buf);
|
|
-
|
|
/*
|
|
* Note that, the SD card is allowed to signal busy on DAT0 up to 1s
|
|
* after the CMD49. Although, let's leave this to be managed by the
|
|
@@ -1113,9 +1110,7 @@ static int sd_parse_ext_reg_power(struct
|
|
int err;
|
|
u8 *reg_buf;
|
|
|
|
- reg_buf = kzalloc(512, GFP_KERNEL);
|
|
- if (!reg_buf)
|
|
- return -ENOMEM;
|
|
+ reg_buf = card->ext_reg_buf;
|
|
|
|
/* Read the extension register for power management function. */
|
|
err = sd_read_ext_reg(card, fno, page, offset, 512, reg_buf);
|
|
@@ -1145,7 +1140,6 @@ static int sd_parse_ext_reg_power(struct
|
|
card->ext_power.offset = offset;
|
|
|
|
out:
|
|
- kfree(reg_buf);
|
|
return err;
|
|
}
|
|
|
|
@@ -1155,9 +1149,7 @@ static int sd_parse_ext_reg_perf(struct
|
|
int err;
|
|
u8 *reg_buf;
|
|
|
|
- reg_buf = kzalloc(512, GFP_KERNEL);
|
|
- if (!reg_buf)
|
|
- return -ENOMEM;
|
|
+ reg_buf = card->ext_reg_buf;
|
|
|
|
err = sd_read_ext_reg(card, fno, page, offset, 512, reg_buf);
|
|
if (err) {
|
|
@@ -1200,7 +1192,6 @@ static int sd_parse_ext_reg_perf(struct
|
|
card->ext_perf.offset = offset;
|
|
|
|
out:
|
|
- kfree(reg_buf);
|
|
return err;
|
|
}
|
|
|
|
@@ -1271,6 +1262,12 @@ static int sd_read_ext_regs(struct mmc_c
|
|
if (!gen_info_buf)
|
|
return -ENOMEM;
|
|
|
|
+ card->ext_reg_buf = kzalloc(512, GFP_KERNEL);
|
|
+ if (!card->ext_reg_buf) {
|
|
+ err = -ENOMEM;
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
/*
|
|
* Read 512 bytes of general info, which is found at function number 0,
|
|
* at page 0 and with no offset.
|
|
@@ -1337,9 +1334,7 @@ static int sd_flush_cache(struct mmc_hos
|
|
if (!sd_cache_enabled(host))
|
|
return 0;
|
|
|
|
- reg_buf = kzalloc(512, GFP_KERNEL);
|
|
- if (!reg_buf)
|
|
- return -ENOMEM;
|
|
+ reg_buf = card->ext_reg_buf;
|
|
|
|
/*
|
|
* Set Flush Cache at bit 0 in the performance enhancement register at
|
|
@@ -1375,21 +1370,15 @@ static int sd_flush_cache(struct mmc_hos
|
|
if (reg_buf[0] & BIT(0))
|
|
err = -ETIMEDOUT;
|
|
out:
|
|
- kfree(reg_buf);
|
|
return err;
|
|
}
|
|
|
|
static int sd_enable_cache(struct mmc_card *card)
|
|
{
|
|
- u8 *reg_buf;
|
|
int err;
|
|
|
|
card->ext_perf.feature_enabled &= ~SD_EXT_PERF_CACHE;
|
|
|
|
- reg_buf = kzalloc(512, GFP_KERNEL);
|
|
- if (!reg_buf)
|
|
- return -ENOMEM;
|
|
-
|
|
/*
|
|
* Set Cache Enable at bit 0 in the performance enhancement register at
|
|
* 260 bytes offset.
|
|
@@ -1408,7 +1397,6 @@ static int sd_enable_cache(struct mmc_ca
|
|
card->ext_perf.feature_enabled |= SD_EXT_PERF_CACHE;
|
|
|
|
out:
|
|
- kfree(reg_buf);
|
|
return err;
|
|
}
|
|
|
|
--- a/include/linux/mmc/card.h
|
|
+++ b/include/linux/mmc/card.h
|
|
@@ -321,6 +321,7 @@ struct mmc_card {
|
|
struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
|
|
struct sd_ext_reg ext_power; /* SD extension reg for PM */
|
|
struct sd_ext_reg ext_perf; /* SD extension reg for PERF */
|
|
+ u8 *ext_reg_buf; /* 512 byte block for extension register R/W */
|
|
|
|
unsigned int sdio_funcs; /* number of SDIO functions */
|
|
atomic_t sdio_funcs_probed; /* number of probed SDIO funcs */
|