]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.1
authorSasha Levin <sashal@kernel.org>
Fri, 3 May 2024 16:37:05 +0000 (12:37 -0400)
committerSasha Levin <sashal@kernel.org>
Fri, 3 May 2024 16:37:05 +0000 (12:37 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
42 files changed:
queue-6.1/bluetooth-qca-add-support-for-qca2066.patch [new file with mode: 0644]
queue-6.1/bluetooth-qca-fix-invalid-device-address-check.patch [new file with mode: 0644]
queue-6.1/cifs-use-the-least-loaded-channel-for-sending-reques.patch [new file with mode: 0644]
queue-6.1/dmaengine-pl330-issue_pending-waits-until-wfp-state.patch [new file with mode: 0644]
queue-6.1/dmaengine-revert-dmaengine-pl330-issue_pending-waits.patch [new file with mode: 0644]
queue-6.1/eeprom-at24-fix-memory-corruption-race-condition.patch [new file with mode: 0644]
queue-6.1/eeprom-at24-probe-for-ddr3-thermal-sensor-in-the-spd.patch [new file with mode: 0644]
queue-6.1/eeprom-at24-use-dev_err_probe-for-nvmem-register-fai.patch [new file with mode: 0644]
queue-6.1/kbuild-refactor-host-_flags.patch [new file with mode: 0644]
queue-6.1/kbuild-rust-force-alloc-extern-to-allow-empty-rust-f.patch [new file with mode: 0644]
queue-6.1/kbuild-specify-output-names-separately-for-each-emis.patch [new file with mode: 0644]
queue-6.1/mm-add-private-field-of-first-tail-to-struct-page-an.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb-add-folio-support-to-hugetlb-specific-fla.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb-add-folio_hstate.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb-add-hugetlb_folio_subpool-helpers.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb-convert-free_huge_page-to-folios.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb-fix-missing-hugetlb_lock-for-resv-uncharg.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb_cgroup-convert-__set_hugetlb_cgroup-to-fo.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb_cgroup-convert-hugetlb_cgroup_from_page-t.patch [new file with mode: 0644]
queue-6.1/mm-hugetlb_cgroup-convert-hugetlb_cgroup_uncharge_pa.patch [new file with mode: 0644]
queue-6.1/nfs-expose-proc-net-sunrpc-nfs-in-net-namespaces.patch [new file with mode: 0644]
queue-6.1/nfs-handle-error-of-rpc_proc_register-in-nfs_net_ini.patch [new file with mode: 0644]
queue-6.1/nfs-make-the-rpc_stat-per-net-namespace.patch [new file with mode: 0644]
queue-6.1/pinctrl-baytrail-fix-selecting-gpio-pinctrl-state.patch [new file with mode: 0644]
queue-6.1/pinctrl-core-delete-incorrect-free-in-pinctrl_enable.patch [new file with mode: 0644]
queue-6.1/pinctrl-devicetree-fix-refcount-leak-in-pinctrl_dt_t.patch [new file with mode: 0644]
queue-6.1/pinctrl-intel-make-use-of-struct-pinfunction-and-pin.patch [new file with mode: 0644]
queue-6.1/pinctrl-introduce-struct-pinfunction-and-pinctrl_pin.patch [new file with mode: 0644]
queue-6.1/pinctrl-mediatek-paris-fix-pin_config_input_schmitt_.patch [new file with mode: 0644]
queue-6.1/pinctrl-mediatek-paris-rework-support-for-pin_config.patch [new file with mode: 0644]
queue-6.1/pinctrl-meson-fix-typo-in-pdm-s-pin-name.patch [new file with mode: 0644]
queue-6.1/pinctrl-pinctrl-aspeed-g6-fix-register-offset-for-pi.patch [new file with mode: 0644]
queue-6.1/power-rt9455-hide-unused-rt9455_boost_voltage_values.patch [new file with mode: 0644]
queue-6.1/power-supply-mt6360_charger-fix-of_match-for-usb-otg.patch [new file with mode: 0644]
queue-6.1/regulator-change-devm_regulator_get_enable_optional-.patch [new file with mode: 0644]
queue-6.1/regulator-change-stubbed-devm_regulator_get_enable-t.patch [new file with mode: 0644]
queue-6.1/regulator-mt6360-de-capitalize-devicetree-regulator-.patch [new file with mode: 0644]
queue-6.1/rust-kernel-require-send-for-module-implementations.patch [new file with mode: 0644]
queue-6.1/series [new file with mode: 0644]
queue-6.1/smb3-missing-lock-when-picking-channel.patch [new file with mode: 0644]
queue-6.1/sunrpc-add-a-struct-rpc_stats-arg-to-rpc_create_args.patch [new file with mode: 0644]
queue-6.1/wifi-nl80211-don-t-free-null-coalescing-rule.patch [new file with mode: 0644]

diff --git a/queue-6.1/bluetooth-qca-add-support-for-qca2066.patch b/queue-6.1/bluetooth-qca-add-support-for-qca2066.patch
new file mode 100644 (file)
index 0000000..e0a9021
--- /dev/null
@@ -0,0 +1,224 @@
+From 2124a9564f0d77a115f8b3f2f885f04d218c3e8d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Sep 2023 17:39:57 +0800
+Subject: Bluetooth: qca: add support for QCA2066
+
+From: Tim Jiang <quic_tjiang@quicinc.com>
+
+[ Upstream commit a7f8dedb4be2cc930a29af24427b885405ecd15d ]
+
+This patch adds support for QCA2066 firmware patch and NVM downloading.
+as the RF performance of QCA2066 SOC chip from different foundries may
+vary. Therefore we use different NVM to configure them based on board ID.
+
+Changes in v2
+ - optimize the function qca_generate_hsp_nvm_name
+ - remove redundant debug code for function qca_read_fw_board_id
+
+Signed-off-by: Tim Jiang <quic_tjiang@quicinc.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Stable-dep-of: 32868e126c78 ("Bluetooth: qca: fix invalid device address check")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/bluetooth/btqca.c   | 68 +++++++++++++++++++++++++++++++++++++
+ drivers/bluetooth/btqca.h   |  5 ++-
+ drivers/bluetooth/hci_qca.c | 11 ++++++
+ 3 files changed, 83 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
+index 5277090c6d6d7..19cfc342fc7bb 100644
+--- a/drivers/bluetooth/btqca.c
++++ b/drivers/bluetooth/btqca.c
+@@ -205,6 +205,44 @@ static int qca_send_reset(struct hci_dev *hdev)
+       return 0;
+ }
++static int qca_read_fw_board_id(struct hci_dev *hdev, u16 *bid)
++{
++      u8 cmd;
++      struct sk_buff *skb;
++      struct edl_event_hdr *edl;
++      int err = 0;
++
++      cmd = EDL_GET_BID_REQ_CMD;
++      skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CMD_LEN,
++                              &cmd, 0, HCI_INIT_TIMEOUT);
++      if (IS_ERR(skb)) {
++              err = PTR_ERR(skb);
++              bt_dev_err(hdev, "Reading QCA board ID failed (%d)", err);
++              return err;
++      }
++
++      edl = skb_pull_data(skb, sizeof(*edl));
++      if (!edl) {
++              bt_dev_err(hdev, "QCA read board ID with no header");
++              err = -EILSEQ;
++              goto out;
++      }
++
++      if (edl->cresp != EDL_CMD_REQ_RES_EVT ||
++          edl->rtype != EDL_GET_BID_REQ_CMD) {
++              bt_dev_err(hdev, "QCA Wrong packet: %d %d", edl->cresp, edl->rtype);
++              err = -EIO;
++              goto out;
++      }
++
++      *bid = (edl->data[1] << 8) + edl->data[2];
++      bt_dev_dbg(hdev, "%s: bid = %x", __func__, *bid);
++
++out:
++      kfree_skb(skb);
++      return err;
++}
++
+ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
+ {
+       struct sk_buff *skb;
+@@ -574,6 +612,23 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
+ }
+ EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
++static void qca_generate_hsp_nvm_name(char *fwname, size_t max_size,
++              struct qca_btsoc_version ver, u8 rom_ver, u16 bid)
++{
++      const char *variant;
++
++      /* hsp gf chip */
++      if ((le32_to_cpu(ver.soc_id) & QCA_HSP_GF_SOC_MASK) == QCA_HSP_GF_SOC_ID)
++              variant = "g";
++      else
++              variant = "";
++
++      if (bid == 0x0)
++              snprintf(fwname, max_size, "qca/hpnv%02x%s.bin", rom_ver, variant);
++      else
++              snprintf(fwname, max_size, "qca/hpnv%02x%s.%x", rom_ver, variant, bid);
++}
++
+ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+                  enum qca_btsoc_type soc_type, struct qca_btsoc_version ver,
+                  const char *firmware_name)
+@@ -582,6 +637,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+       int err;
+       u8 rom_ver = 0;
+       u32 soc_ver;
++      u16 boardid = 0;
+       bt_dev_dbg(hdev, "QCA setup on UART");
+@@ -615,6 +671,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+               snprintf(config.fwname, sizeof(config.fwname),
+                        "qca/apbtfw%02x.tlv", rom_ver);
+               break;
++      case QCA_QCA2066:
++              snprintf(config.fwname, sizeof(config.fwname),
++                       "qca/hpbtfw%02x.tlv", rom_ver);
++              break;
+       case QCA_QCA6390:
+               snprintf(config.fwname, sizeof(config.fwname),
+                        "qca/htbtfw%02x.tlv", rom_ver);
+@@ -649,6 +709,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+       /* Give the controller some time to get ready to receive the NVM */
+       msleep(10);
++      if (soc_type == QCA_QCA2066)
++              qca_read_fw_board_id(hdev, &boardid);
++
+       /* Download NVM configuration */
+       config.type = TLV_TYPE_NVM;
+       if (firmware_name) {
+@@ -671,6 +734,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+                       snprintf(config.fwname, sizeof(config.fwname),
+                                "qca/apnv%02x.bin", rom_ver);
+                       break;
++              case QCA_QCA2066:
++                      qca_generate_hsp_nvm_name(config.fwname,
++                              sizeof(config.fwname), ver, rom_ver, boardid);
++                      break;
+               case QCA_QCA6390:
+                       snprintf(config.fwname, sizeof(config.fwname),
+                                "qca/htnv%02x.bin", rom_ver);
+@@ -702,6 +769,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+       switch (soc_type) {
+       case QCA_WCN3991:
++      case QCA_QCA2066:
+       case QCA_QCA6390:
+       case QCA_WCN6750:
+       case QCA_WCN6855:
+diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
+index 03bff5c0059de..dc31984f71dc1 100644
+--- a/drivers/bluetooth/btqca.h
++++ b/drivers/bluetooth/btqca.h
+@@ -12,6 +12,7 @@
+ #define EDL_PATCH_VER_REQ_CMD         (0x19)
+ #define EDL_PATCH_TLV_REQ_CMD         (0x1E)
+ #define EDL_GET_BUILD_INFO_CMD                (0x20)
++#define EDL_GET_BID_REQ_CMD                   (0x23)
+ #define EDL_NVM_ACCESS_SET_REQ_CMD    (0x01)
+ #define EDL_PATCH_CONFIG_CMD          (0x28)
+ #define MAX_SIZE_PER_TLV_SEGMENT      (243)
+@@ -47,7 +48,8 @@
+       ((le32_to_cpu(soc_id) << 16) | (le16_to_cpu(rom_ver)))
+ #define QCA_FW_BUILD_VER_LEN          255
+-
++#define QCA_HSP_GF_SOC_ID                     0x1200
++#define QCA_HSP_GF_SOC_MASK                   0x0000ff00
+ enum qca_baudrate {
+       QCA_BAUDRATE_115200     = 0,
+@@ -146,6 +148,7 @@ enum qca_btsoc_type {
+       QCA_WCN3990,
+       QCA_WCN3998,
+       QCA_WCN3991,
++      QCA_QCA2066,
+       QCA_QCA6390,
+       QCA_WCN6750,
+       QCA_WCN6855,
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
+index 179278b801eb3..a0e2b5d992695 100644
+--- a/drivers/bluetooth/hci_qca.c
++++ b/drivers/bluetooth/hci_qca.c
+@@ -1808,6 +1808,10 @@ static int qca_setup(struct hci_uart *hu)
+       set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
+       switch (soc_type) {
++      case QCA_QCA2066:
++              soc_name = "qca2066";
++              break;
++
+       case QCA_WCN3988:
+       case QCA_WCN3990:
+       case QCA_WCN3991:
+@@ -2000,6 +2004,11 @@ static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused = {
+       .num_vregs = 4,
+ };
++static const struct qca_device_data qca_soc_data_qca2066 __maybe_unused = {
++      .soc_type = QCA_QCA2066,
++      .num_vregs = 0,
++};
++
+ static const struct qca_device_data qca_soc_data_qca6390 __maybe_unused = {
+       .soc_type = QCA_QCA6390,
+       .num_vregs = 0,
+@@ -2539,6 +2548,7 @@ static SIMPLE_DEV_PM_OPS(qca_pm_ops, qca_suspend, qca_resume);
+ #ifdef CONFIG_OF
+ static const struct of_device_id qca_bluetooth_of_match[] = {
++      { .compatible = "qcom,qca2066-bt", .data = &qca_soc_data_qca2066},
+       { .compatible = "qcom,qca6174-bt" },
+       { .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390},
+       { .compatible = "qcom,qca9377-bt" },
+@@ -2556,6 +2566,7 @@ MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match);
+ #ifdef CONFIG_ACPI
+ static const struct acpi_device_id qca_bluetooth_acpi_match[] = {
++      { "QCOM2066", (kernel_ulong_t)&qca_soc_data_qca2066 },
+       { "QCOM6390", (kernel_ulong_t)&qca_soc_data_qca6390 },
+       { "DLA16390", (kernel_ulong_t)&qca_soc_data_qca6390 },
+       { "DLB16390", (kernel_ulong_t)&qca_soc_data_qca6390 },
+-- 
+2.43.0
+
diff --git a/queue-6.1/bluetooth-qca-fix-invalid-device-address-check.patch b/queue-6.1/bluetooth-qca-fix-invalid-device-address-check.patch
new file mode 100644 (file)
index 0000000..2fb8c03
--- /dev/null
@@ -0,0 +1,123 @@
+From f6507eb6a681f09e4397efade635ac270eabc260 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Apr 2024 11:15:09 +0200
+Subject: Bluetooth: qca: fix invalid device address check
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+[ Upstream commit 32868e126c78876a8a5ddfcb6ac8cb2fffcf4d27 ]
+
+Qualcomm Bluetooth controllers may not have been provisioned with a
+valid device address and instead end up using the default address
+00:00:00:00:5a:ad.
+
+This was previously believed to be due to lack of persistent storage for
+the address but it may also be due to integrators opting to not use the
+on-chip OTP memory and instead store the address elsewhere (e.g. in
+storage managed by secure world firmware).
+
+According to Qualcomm, at least WCN6750, WCN6855 and WCN7850 have
+on-chip OTP storage for the address.
+
+As the device type alone cannot be used to determine when the address is
+valid, instead read back the address during setup() and only set the
+HCI_QUIRK_USE_BDADDR_PROPERTY flag when needed.
+
+This specifically makes sure that controllers that have been provisioned
+with an address do not start as unconfigured.
+
+Reported-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
+Link: https://lore.kernel.org/r/124a7d54-5a18-4be7-9a76-a12017f6cce5@quicinc.com/
+Fixes: 5971752de44c ("Bluetooth: hci_qca: Set HCI_QUIRK_USE_BDADDR_PROPERTY for wcn3990")
+Fixes: e668eb1e1578 ("Bluetooth: hci_core: Don't stop BT if the BD address missing in dts")
+Fixes: 6945795bc81a ("Bluetooth: fix use-bdaddr-property quirk")
+Cc: stable@vger.kernel.org     # 6.5
+Cc: Matthias Kaehlcke <mka@chromium.org>
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Reported-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/bluetooth/btqca.c   | 38 +++++++++++++++++++++++++++++++++++++
+ drivers/bluetooth/hci_qca.c |  2 --
+ 2 files changed, 38 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
+index 19cfc342fc7bb..216826c31ee34 100644
+--- a/drivers/bluetooth/btqca.c
++++ b/drivers/bluetooth/btqca.c
+@@ -15,6 +15,8 @@
+ #define VERSION "0.1"
++#define QCA_BDADDR_DEFAULT (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00 }})
++
+ int qca_read_soc_version(struct hci_dev *hdev, struct qca_btsoc_version *ver,
+                        enum qca_btsoc_type soc_type)
+ {
+@@ -612,6 +614,38 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
+ }
+ EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
++static int qca_check_bdaddr(struct hci_dev *hdev)
++{
++      struct hci_rp_read_bd_addr *bda;
++      struct sk_buff *skb;
++      int err;
++
++      if (bacmp(&hdev->public_addr, BDADDR_ANY))
++              return 0;
++
++      skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL,
++                           HCI_INIT_TIMEOUT);
++      if (IS_ERR(skb)) {
++              err = PTR_ERR(skb);
++              bt_dev_err(hdev, "Failed to read device address (%d)", err);
++              return err;
++      }
++
++      if (skb->len != sizeof(*bda)) {
++              bt_dev_err(hdev, "Device address length mismatch");
++              kfree_skb(skb);
++              return -EIO;
++      }
++
++      bda = (struct hci_rp_read_bd_addr *)skb->data;
++      if (!bacmp(&bda->bdaddr, QCA_BDADDR_DEFAULT))
++              set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
++
++      kfree_skb(skb);
++
++      return 0;
++}
++
+ static void qca_generate_hsp_nvm_name(char *fwname, size_t max_size,
+               struct qca_btsoc_version ver, u8 rom_ver, u16 bid)
+ {
+@@ -818,6 +852,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
+               break;
+       }
++      err = qca_check_bdaddr(hdev);
++      if (err)
++              return err;
++
+       bt_dev_info(hdev, "QCA setup on UART is completed");
+       return 0;
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
+index a0e2b5d992695..070014d0fc994 100644
+--- a/drivers/bluetooth/hci_qca.c
++++ b/drivers/bluetooth/hci_qca.c
+@@ -1853,8 +1853,6 @@ static int qca_setup(struct hci_uart *hu)
+       case QCA_WCN6750:
+       case QCA_WCN6855:
+       case QCA_WCN7850:
+-              set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
+-
+               qcadev = serdev_device_get_drvdata(hu->serdev);
+               if (qcadev->bdaddr_property_broken)
+                       set_bit(HCI_QUIRK_BDADDR_PROPERTY_BROKEN, &hdev->quirks);
+-- 
+2.43.0
+
diff --git a/queue-6.1/cifs-use-the-least-loaded-channel-for-sending-reques.patch b/queue-6.1/cifs-use-the-least-loaded-channel-for-sending-reques.patch
new file mode 100644 (file)
index 0000000..35dee3d
--- /dev/null
@@ -0,0 +1,84 @@
+From 1ca440f0b69adedd5cb156439fe8c9b6c99fdcfd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 19 Dec 2022 05:40:44 +0000
+Subject: cifs: use the least loaded channel for sending requests
+
+From: Shyam Prasad N <sprasad@microsoft.com>
+
+[ Upstream commit ea90708d3cf3d0d92c02afe445ad463fb3c6bf10 ]
+
+Till now, we've used a simple round robin approach to
+distribute the requests between the channels. This does
+not work well if the channels consume the requests at
+different speeds, even if the advertised speeds are the
+same.
+
+This change will allow the client to pick the channel
+with least number of requests currently in-flight. This
+will disregard the link speed, and select a channel
+based on the current load of the channels.
+
+For cases when all the channels are equally loaded,
+fall back to the old round robin method.
+
+Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
+Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Stable-dep-of: 8094a600245e ("smb3: missing lock when picking channel")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/transport.c | 33 +++++++++++++++++++++++++++++----
+ 1 file changed, 29 insertions(+), 4 deletions(-)
+
+diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
+index 338b34c99b2de..da2bef3b7ac27 100644
+--- a/fs/smb/client/transport.c
++++ b/fs/smb/client/transport.c
+@@ -1045,15 +1045,40 @@ cifs_cancelled_callback(struct mid_q_entry *mid)
+ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
+ {
+       uint index = 0;
++      unsigned int min_in_flight = UINT_MAX, max_in_flight = 0;
++      struct TCP_Server_Info *server = NULL;
++      int i;
+       if (!ses)
+               return NULL;
+-      /* round robin */
+-      index = (uint)atomic_inc_return(&ses->chan_seq);
+-
+       spin_lock(&ses->chan_lock);
+-      index %= ses->chan_count;
++      for (i = 0; i < ses->chan_count; i++) {
++              server = ses->chans[i].server;
++              if (!server)
++                      continue;
++
++              /*
++               * strictly speaking, we should pick up req_lock to read
++               * server->in_flight. But it shouldn't matter much here if we
++               * race while reading this data. The worst that can happen is
++               * that we could use a channel that's not least loaded. Avoiding
++               * taking the lock could help reduce wait time, which is
++               * important for this function
++               */
++              if (server->in_flight < min_in_flight) {
++                      min_in_flight = server->in_flight;
++                      index = i;
++              }
++              if (server->in_flight > max_in_flight)
++                      max_in_flight = server->in_flight;
++      }
++
++      /* if all channels are equally loaded, fall back to round-robin */
++      if (min_in_flight == max_in_flight) {
++              index = (uint)atomic_inc_return(&ses->chan_seq);
++              index %= ses->chan_count;
++      }
+       spin_unlock(&ses->chan_lock);
+       return ses->chans[index].server;
+-- 
+2.43.0
+
diff --git a/queue-6.1/dmaengine-pl330-issue_pending-waits-until-wfp-state.patch b/queue-6.1/dmaengine-pl330-issue_pending-waits-until-wfp-state.patch
new file mode 100644 (file)
index 0000000..0329833
--- /dev/null
@@ -0,0 +1,46 @@
+From d31ae81f58915fea8371f1298c29a9702715abff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Dec 2023 14:50:26 +0900
+Subject: dmaengine: pl330: issue_pending waits until WFP state
+
+From: Bumyong Lee <bumyong.lee@samsung.com>
+
+[ Upstream commit 22a9d9585812440211b0b34a6bc02ade62314be4 ]
+
+According to DMA-330 errata notice[1] 71930, DMAKILL
+cannot clear internal signal, named pipeline_req_active.
+it makes that pl330 would wait forever in WFP state
+although dma already send dma request if pl330 gets
+dma request before entering WFP state.
+
+The errata suggests that polling until entering WFP state
+as workaround and then peripherals allows to issue dma request.
+
+[1]: https://developer.arm.com/documentation/genc008428/latest
+
+Signed-off-by: Bumyong Lee <bumyong.lee@samsung.com>
+Link: https://lore.kernel.org/r/20231219055026.118695-1-bumyong.lee@samsung.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Stable-dep-of: afc89870ea67 ("dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state"")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/pl330.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
+index 3cf0b38387ae5..c29744bfdf2c2 100644
+--- a/drivers/dma/pl330.c
++++ b/drivers/dma/pl330.c
+@@ -1053,6 +1053,9 @@ static bool _trigger(struct pl330_thread *thrd)
+       thrd->req_running = idx;
++      if (desc->rqtype == DMA_MEM_TO_DEV || desc->rqtype == DMA_DEV_TO_MEM)
++              UNTIL(thrd, PL330_STATE_WFP);
++
+       return true;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.1/dmaengine-revert-dmaengine-pl330-issue_pending-waits.patch b/queue-6.1/dmaengine-revert-dmaengine-pl330-issue_pending-waits.patch
new file mode 100644 (file)
index 0000000..7d466ac
--- /dev/null
@@ -0,0 +1,39 @@
+From c307a1e11e6659bb38e407b4c49466854db3aa28 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 12:21:51 +0530
+Subject: dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP
+ state"
+
+From: Vinod Koul <vkoul@kernel.org>
+
+[ Upstream commit afc89870ea677bd5a44516eb981f7a259b74280c ]
+
+This reverts commit 22a9d9585812 ("dmaengine: pl330: issue_pending waits
+until WFP state") as it seems to cause regression in pl330 driver.
+Note the issue now exists in mainline so a fix to be done.
+
+Cc: stable@vger.kernel.org
+Reported-by: karthikeyan <karthikeyan@linumiz.com>
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/pl330.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
+index c29744bfdf2c2..3cf0b38387ae5 100644
+--- a/drivers/dma/pl330.c
++++ b/drivers/dma/pl330.c
+@@ -1053,9 +1053,6 @@ static bool _trigger(struct pl330_thread *thrd)
+       thrd->req_running = idx;
+-      if (desc->rqtype == DMA_MEM_TO_DEV || desc->rqtype == DMA_DEV_TO_MEM)
+-              UNTIL(thrd, PL330_STATE_WFP);
+-
+       return true;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.1/eeprom-at24-fix-memory-corruption-race-condition.patch b/queue-6.1/eeprom-at24-fix-memory-corruption-race-condition.patch
new file mode 100644 (file)
index 0000000..4cb723c
--- /dev/null
@@ -0,0 +1,65 @@
+From 5f9b97135ca6879632ad25851b47d46f9b3eb743 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Apr 2024 17:43:36 +0000
+Subject: eeprom: at24: fix memory corruption race condition
+
+From: Daniel Okazaki <dtokazaki@google.com>
+
+[ Upstream commit f42c97027fb75776e2e9358d16bf4a99aeb04cf2 ]
+
+If the eeprom is not accessible, an nvmem device will be registered, the
+read will fail, and the device will be torn down. If another driver
+accesses the nvmem device after the teardown, it will reference
+invalid memory.
+
+Move the failure point before registering the nvmem device.
+
+Signed-off-by: Daniel Okazaki <dtokazaki@google.com>
+Fixes: b20eb4c1f026 ("eeprom: at24: drop unnecessary label")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240422174337.2487142-1-dtokazaki@google.com
+Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/eeprom/at24.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
+index dc30fe137b40f..e664c1c852503 100644
+--- a/drivers/misc/eeprom/at24.c
++++ b/drivers/misc/eeprom/at24.c
+@@ -781,15 +781,6 @@ static int at24_probe(struct i2c_client *client)
+       }
+       pm_runtime_enable(dev);
+-      at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
+-      if (IS_ERR(at24->nvmem)) {
+-              pm_runtime_disable(dev);
+-              if (!pm_runtime_status_suspended(dev))
+-                      regulator_disable(at24->vcc_reg);
+-              return dev_err_probe(dev, PTR_ERR(at24->nvmem),
+-                                   "failed to register nvmem\n");
+-      }
+-
+       /*
+        * Perform a one-byte test read to verify that the chip is functional,
+        * unless powering on the device is to be avoided during probe (i.e.
+@@ -805,6 +796,15 @@ static int at24_probe(struct i2c_client *client)
+               }
+       }
++      at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
++      if (IS_ERR(at24->nvmem)) {
++              pm_runtime_disable(dev);
++              if (!pm_runtime_status_suspended(dev))
++                      regulator_disable(at24->vcc_reg);
++              return dev_err_probe(dev, PTR_ERR(at24->nvmem),
++                                   "failed to register nvmem\n");
++      }
++
+       /* If this a SPD EEPROM, probe for DDR3 thermal sensor */
+       if (cdata == &at24_data_spd)
+               at24_probe_temp_sensor(client);
+-- 
+2.43.0
+
diff --git a/queue-6.1/eeprom-at24-probe-for-ddr3-thermal-sensor-in-the-spd.patch b/queue-6.1/eeprom-at24-probe-for-ddr3-thermal-sensor-in-the-spd.patch
new file mode 100644 (file)
index 0000000..79003a7
--- /dev/null
@@ -0,0 +1,82 @@
+From 2474f209fb6aaffc1412b09b4367a9f0db698c23 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Dec 2023 13:55:58 +0100
+Subject: eeprom: at24: Probe for DDR3 thermal sensor in the SPD case
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+[ Upstream commit caba40ec3531b0849f44502a03117796e8c9f4a1 ]
+
+The DDR3 SPD data structure advertises the presence of a thermal
+sensor on a DDR3 module in byte 32, bit 7. Let's use this information
+to explicitly instantiate the thermal sensor I2C client instead of
+having to rely on class-based I2C probing.
+
+The temp sensor i2c address can be derived from the SPD i2c address,
+so we can directly instantiate the device and don't have to probe
+for it. If the temp sensor has been instantiated already by other
+means (e.g. class-based auto-detection), then the busy-check in
+i2c_new_client_device will detect this.
+
+Note: Thermal sensors on DDR4 DIMM's are instantiated from the
+      ee1004 driver.
+
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Link: https://lore.kernel.org/r/68113672-3724-44d5-9ff8-313dd6628f8c@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Stable-dep-of: f42c97027fb7 ("eeprom: at24: fix memory corruption race condition")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/eeprom/at24.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
+index 5aae2f9bdd51c..dc30fe137b40f 100644
+--- a/drivers/misc/eeprom/at24.c
++++ b/drivers/misc/eeprom/at24.c
+@@ -581,6 +581,31 @@ static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len)
+       }
+ }
++static void at24_probe_temp_sensor(struct i2c_client *client)
++{
++      struct at24_data *at24 = i2c_get_clientdata(client);
++      struct i2c_board_info info = { .type = "jc42" };
++      int ret;
++      u8 val;
++
++      /*
++       * Byte 2 has value 11 for DDR3, earlier versions don't
++       * support the thermal sensor present flag
++       */
++      ret = at24_read(at24, 2, &val, 1);
++      if (ret || val != 11)
++              return;
++
++      /* Byte 32, bit 7 is set if temp sensor is present */
++      ret = at24_read(at24, 32, &val, 1);
++      if (ret || !(val & BIT(7)))
++              return;
++
++      info.addr = 0x18 | (client->addr & 7);
++
++      i2c_new_client_device(client->adapter, &info);
++}
++
+ static int at24_probe(struct i2c_client *client)
+ {
+       struct regmap_config regmap_config = { };
+@@ -780,6 +805,10 @@ static int at24_probe(struct i2c_client *client)
+               }
+       }
++      /* If this a SPD EEPROM, probe for DDR3 thermal sensor */
++      if (cdata == &at24_data_spd)
++              at24_probe_temp_sensor(client);
++
+       pm_runtime_idle(dev);
+       if (writable)
+-- 
+2.43.0
+
diff --git a/queue-6.1/eeprom-at24-use-dev_err_probe-for-nvmem-register-fai.patch b/queue-6.1/eeprom-at24-use-dev_err_probe-for-nvmem-register-fai.patch
new file mode 100644 (file)
index 0000000..382b770
--- /dev/null
@@ -0,0 +1,39 @@
+From 4d70e84521e48208b162bb66cf9ec5cdc19c3a50 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 May 2023 10:05:53 +0200
+Subject: eeprom: at24: Use dev_err_probe for nvmem register failure
+
+From: Alexander Stein <alexander.stein@ew.tq-group.com>
+
+[ Upstream commit a3c10035d12f5ec10915d5c00c2e8f7d7c066182 ]
+
+When using nvmem layouts it is possible devm_nvmem_register returns
+-EPROBE_DEFER, resulting in an 'empty' in
+/sys/kernel/debug/devices_deferred. Use dev_err_probe for providing
+additional information.
+
+Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
+Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+Stable-dep-of: f42c97027fb7 ("eeprom: at24: fix memory corruption race condition")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/eeprom/at24.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
+index 938c4f41b98c7..5aae2f9bdd51c 100644
+--- a/drivers/misc/eeprom/at24.c
++++ b/drivers/misc/eeprom/at24.c
+@@ -761,7 +761,8 @@ static int at24_probe(struct i2c_client *client)
+               pm_runtime_disable(dev);
+               if (!pm_runtime_status_suspended(dev))
+                       regulator_disable(at24->vcc_reg);
+-              return PTR_ERR(at24->nvmem);
++              return dev_err_probe(dev, PTR_ERR(at24->nvmem),
++                                   "failed to register nvmem\n");
+       }
+       /*
+-- 
+2.43.0
+
diff --git a/queue-6.1/kbuild-refactor-host-_flags.patch b/queue-6.1/kbuild-refactor-host-_flags.patch
new file mode 100644 (file)
index 0000000..b235222
--- /dev/null
@@ -0,0 +1,61 @@
+From c285eddb351d691c8f50518163c278be034d6a25 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 7 Jan 2023 18:18:14 +0900
+Subject: kbuild: refactor host*_flags
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 16169a47d5c36046041527faafb5a3f5c86701c6 ]
+
+Remove _host*_flags. No functional change is intended.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
+Tested-by: Miguel Ojeda <ojeda@kernel.org>
+Stable-dep-of: ded103c7eb23 ("kbuild: rust: force `alloc` extern to allow "empty" Rust files")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/Makefile.host | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/scripts/Makefile.host b/scripts/Makefile.host
+index da133780b7518..4a02b31cd1029 100644
+--- a/scripts/Makefile.host
++++ b/scripts/Makefile.host
+@@ -80,25 +80,23 @@ host-rust  := $(addprefix $(obj)/,$(host-rust))
+ #####
+ # Handle options to gcc. Support building with separate output directory
+-_hostc_flags   = $(KBUILD_HOSTCFLAGS)   $(HOST_EXTRACFLAGS)   \
++hostc_flags    = -Wp,-MMD,$(depfile) \
++                 $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
+                  $(HOSTCFLAGS_$(target-stem).o)
+-_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
++hostcxx_flags  = -Wp,-MMD,$(depfile) \
++                 $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
+                  $(HOSTCXXFLAGS_$(target-stem).o)
+-_hostrust_flags = $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
+-                  $(HOSTRUSTFLAGS_$(target-stem))
++hostrust_flags = $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
++                 $(HOSTRUSTFLAGS_$(target-stem))
+ # $(objtree)/$(obj) for including generated headers from checkin source files
+ ifeq ($(KBUILD_EXTMOD),)
+ ifdef building_out_of_srctree
+-_hostc_flags   += -I $(objtree)/$(obj)
+-_hostcxx_flags += -I $(objtree)/$(obj)
++hostc_flags   += -I $(objtree)/$(obj)
++hostcxx_flags += -I $(objtree)/$(obj)
+ endif
+ endif
+-hostc_flags    = -Wp,-MMD,$(depfile) $(_hostc_flags)
+-hostcxx_flags  = -Wp,-MMD,$(depfile) $(_hostcxx_flags)
+-hostrust_flags = $(_hostrust_flags)
+-
+ #####
+ # Compile programs on the host
+-- 
+2.43.0
+
diff --git a/queue-6.1/kbuild-rust-force-alloc-extern-to-allow-empty-rust-f.patch b/queue-6.1/kbuild-rust-force-alloc-extern-to-allow-empty-rust-f.patch
new file mode 100644 (file)
index 0000000..a5c2c4f
--- /dev/null
@@ -0,0 +1,72 @@
+From 6f98bb1610157b1e6d70bf2beff2f68dd428b3eb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Apr 2024 11:06:44 +0200
+Subject: kbuild: rust: force `alloc` extern to allow "empty" Rust files
+
+From: Miguel Ojeda <ojeda@kernel.org>
+
+[ Upstream commit ded103c7eb23753f22597afa500a7c1ad34116ba ]
+
+If one attempts to build an essentially empty file somewhere in the
+kernel tree, it leads to a build error because the compiler does not
+recognize the `new_uninit` unstable feature:
+
+    error[E0635]: unknown feature `new_uninit`
+     --> <crate attribute>:1:9
+      |
+    1 | feature(new_uninit)
+      |         ^^^^^^^^^^
+
+The reason is that we pass `-Zcrate-attr='feature(new_uninit)'` (together
+with `-Zallow-features=new_uninit`) to let non-`rust/` code use that
+unstable feature.
+
+However, the compiler only recognizes the feature if the `alloc` crate
+is resolved (the feature is an `alloc` one). `--extern alloc`, which we
+pass, is not enough to resolve the crate.
+
+Introducing a reference like `use alloc;` or `extern crate alloc;`
+solves the issue, thus this is not seen in normal files. For instance,
+`use`ing the `kernel` prelude introduces such a reference, since `alloc`
+is used inside.
+
+While normal use of the build system is not impacted by this, it can still
+be fairly confusing for kernel developers [1], thus use the unstable
+`force` option of `--extern` [2] (added in Rust 1.71 [3]) to force the
+compiler to resolve `alloc`.
+
+This new unstable feature is only needed meanwhile we use the other
+unstable feature, since then we will not need `-Zcrate-attr`.
+
+Cc: stable@vger.kernel.org # v6.6+
+Reported-by: Daniel Almeida <daniel.almeida@collabora.com>
+Reported-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
+Closes: https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/x/near/424096982 [1]
+Fixes: 2f7ab1267dc9 ("Kbuild: add Rust support")
+Link: https://github.com/rust-lang/rust/issues/111302 [2]
+Link: https://github.com/rust-lang/rust/pull/109421 [3]
+Reviewed-by: Alice Ryhl <aliceryhl@google.com>
+Reviewed-by: Gary Guo <gary@garyguo.net>
+Link: https://lore.kernel.org/r/20240422090644.525520-1-ojeda@kernel.org
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/Makefile.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/Makefile.build b/scripts/Makefile.build
+index 9ae02542b9389..6afc2af8f7e67 100644
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -282,7 +282,7 @@ rust_common_cmd = \
+       -Zallow-features=$(rust_allowed_features) \
+       -Zcrate-attr=no_std \
+       -Zcrate-attr='feature($(rust_allowed_features))' \
+-      --extern alloc --extern kernel \
++      -Zunstable-options --extern force:alloc --extern kernel \
+       --crate-type rlib -L $(objtree)/rust/ \
+       --crate-name $(basename $(notdir $@)) \
+       --emit=dep-info=$(depfile)
+-- 
+2.43.0
+
diff --git a/queue-6.1/kbuild-specify-output-names-separately-for-each-emis.patch b/queue-6.1/kbuild-specify-output-names-separately-for-each-emis.patch
new file mode 100644 (file)
index 0000000..8d877d8
--- /dev/null
@@ -0,0 +1,178 @@
+From 36aa3b661946be59277fb50fc85ce7a6c5a89ad3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 7 Jan 2023 18:18:15 +0900
+Subject: kbuild: specify output names separately for each emission type from
+ rustc
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 295d8398c67e314d99bb070f38883f83fe94a97a ]
+
+In Kbuild, two different rules must not write to the same file, but
+it happens when compiling rust source files.
+
+For example, set CONFIG_SAMPLE_RUST_MINIMAL=m and run the following:
+
+  $ make -j$(nproc) samples/rust/rust_minimal.o samples/rust/rust_minimal.rsi \
+                    samples/rust/rust_minimal.s samples/rust/rust_minimal.ll
+    [snip]
+    RUSTC [M] samples/rust/rust_minimal.o
+    RUSTC [M] samples/rust/rust_minimal.rsi
+    RUSTC [M] samples/rust/rust_minimal.s
+    RUSTC [M] samples/rust/rust_minimal.ll
+  mv: cannot stat 'samples/rust/rust_minimal.d': No such file or directory
+  make[3]: *** [scripts/Makefile.build:334: samples/rust/rust_minimal.ll] Error 1
+  make[3]: *** Waiting for unfinished jobs....
+  mv: cannot stat 'samples/rust/rust_minimal.d': No such file or directory
+  make[3]: *** [scripts/Makefile.build:309: samples/rust/rust_minimal.o] Error 1
+  mv: cannot stat 'samples/rust/rust_minimal.d': No such file or directory
+  make[3]: *** [scripts/Makefile.build:326: samples/rust/rust_minimal.s] Error 1
+  make[2]: *** [scripts/Makefile.build:504: samples/rust] Error 2
+  make[1]: *** [scripts/Makefile.build:504: samples] Error 2
+  make: *** [Makefile:2008: .] Error 2
+
+The reason for the error is that 4 threads running in parallel renames
+the same file, samples/rust/rust_minimal.d.
+
+This does not happen when compiling C or assembly files because
+-Wp,-MMD,$(depfile) explicitly specifies the dependency filepath.
+$(depfile) is a unique path for each target.
+
+Currently, rustc is only given --out-dir and --emit=<list-of-types>
+So, all the rust build rules output the dep-info into the default
+<CRATE_NAME>.d, which causes the path conflict.
+
+Fortunately, the --emit option is able to specify the output path
+individually, with the form --emit=<type>=<path>.
+
+Add --emit=dep-info=$(depfile) to the common part. Also, remove the
+redundant --out-dir because the output path is specified for each type.
+
+The code gets much cleaner because we do not need to rename *.d files.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
+Tested-by: Miguel Ojeda <ojeda@kernel.org>
+Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
+Stable-dep-of: ded103c7eb23 ("kbuild: rust: force `alloc` extern to allow "empty" Rust files")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ rust/Makefile          | 11 +++++------
+ scripts/Makefile.build | 14 +++++++-------
+ scripts/Makefile.host  |  7 +++----
+ 3 files changed, 15 insertions(+), 17 deletions(-)
+
+diff --git a/rust/Makefile b/rust/Makefile
+index 7700d3853404e..6d0c0e9757f21 100644
+--- a/rust/Makefile
++++ b/rust/Makefile
+@@ -322,10 +322,9 @@ $(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
+ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
+       cmd_rustc_procmacro = \
+       $(RUSTC_OR_CLIPPY) $(rust_common_flags) \
+-              --emit=dep-info,link --extern proc_macro \
+-              --crate-type proc-macro --out-dir $(objtree)/$(obj) \
++              --emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
++              --crate-type proc-macro \
+               --crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \
+-      mv $(objtree)/$(obj)/$(patsubst lib%.so,%,$(notdir $@)).d $(depfile); \
+       sed -i '/^\#/d' $(depfile)
+ # Procedural macros can only be used with the `rustc` that compiled it.
+@@ -339,10 +338,10 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
+       OBJTREE=$(abspath $(objtree)) \
+       $(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
+               $(filter-out $(skip_flags),$(rust_flags) $(rustc_target_flags)) \
+-              --emit=dep-info,obj,metadata --crate-type rlib \
+-              --out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
++              --emit=dep-info=$(depfile) --emit=obj=$@ \
++              --emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
++              --crate-type rlib -L$(objtree)/$(obj) \
+               --crate-name $(patsubst %.o,%,$(notdir $@)) $<; \
+-      mv $(objtree)/$(obj)/$(patsubst %.o,%,$(notdir $@)).d $(depfile); \
+       sed -i '/^\#/d' $(depfile) \
+       $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
+diff --git a/scripts/Makefile.build b/scripts/Makefile.build
+index 41f3602fc8de7..9ae02542b9389 100644
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -283,11 +283,11 @@ rust_common_cmd = \
+       -Zcrate-attr=no_std \
+       -Zcrate-attr='feature($(rust_allowed_features))' \
+       --extern alloc --extern kernel \
+-      --crate-type rlib --out-dir $(obj) -L $(objtree)/rust/ \
+-      --crate-name $(basename $(notdir $@))
++      --crate-type rlib -L $(objtree)/rust/ \
++      --crate-name $(basename $(notdir $@)) \
++      --emit=dep-info=$(depfile)
+ rust_handle_depfile = \
+-      mv $(obj)/$(basename $(notdir $@)).d $(depfile); \
+       sed -i '/^\#/d' $(depfile)
+ # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
+@@ -300,7 +300,7 @@ rust_handle_depfile = \
+ quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
+       cmd_rustc_o_rs = \
+-      $(rust_common_cmd) --emit=dep-info,obj $<; \
++      $(rust_common_cmd) --emit=obj=$@ $<; \
+       $(rust_handle_depfile)
+ $(obj)/%.o: $(src)/%.rs FORCE
+@@ -308,7 +308,7 @@ $(obj)/%.o: $(src)/%.rs FORCE
+ quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
+       cmd_rustc_rsi_rs = \
+-      $(rust_common_cmd) --emit=dep-info -Zunpretty=expanded $< >$@; \
++      $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
+       command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@; \
+       $(rust_handle_depfile)
+@@ -317,7 +317,7 @@ $(obj)/%.rsi: $(src)/%.rs FORCE
+ quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
+       cmd_rustc_s_rs = \
+-      $(rust_common_cmd) --emit=dep-info,asm $<; \
++      $(rust_common_cmd) --emit=asm=$@ $<; \
+       $(rust_handle_depfile)
+ $(obj)/%.s: $(src)/%.rs FORCE
+@@ -325,7 +325,7 @@ $(obj)/%.s: $(src)/%.rs FORCE
+ quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
+       cmd_rustc_ll_rs = \
+-      $(rust_common_cmd) --emit=dep-info,llvm-ir $<; \
++      $(rust_common_cmd) --emit=llvm-ir=$@ $<; \
+       $(rust_handle_depfile)
+ $(obj)/%.ll: $(src)/%.rs FORCE
+diff --git a/scripts/Makefile.host b/scripts/Makefile.host
+index 4a02b31cd1029..d812241144d44 100644
+--- a/scripts/Makefile.host
++++ b/scripts/Makefile.host
+@@ -86,7 +86,8 @@ hostc_flags    = -Wp,-MMD,$(depfile) \
+ hostcxx_flags  = -Wp,-MMD,$(depfile) \
+                  $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
+                  $(HOSTCXXFLAGS_$(target-stem).o)
+-hostrust_flags = $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
++hostrust_flags = --emit=dep-info=$(depfile) \
++                 $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
+                  $(HOSTRUSTFLAGS_$(target-stem))
+ # $(objtree)/$(obj) for including generated headers from checkin source files
+@@ -147,9 +148,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
+ # host-rust -> Executable
+ quiet_cmd_host-rust   = HOSTRUSTC $@
+       cmd_host-rust   = \
+-      $(HOSTRUSTC) $(hostrust_flags) --emit=dep-info,link \
+-              --out-dir=$(obj)/ $<; \
+-      mv $(obj)/$(target-stem).d $(depfile); \
++      $(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $<; \
+       sed -i '/^\#/d' $(depfile)
+ $(host-rust): $(obj)/%: $(src)/%.rs FORCE
+       $(call if_changed_dep,host-rust)
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-add-private-field-of-first-tail-to-struct-page-an.patch b/queue-6.1/mm-add-private-field-of-first-tail-to-struct-page-an.patch
new file mode 100644 (file)
index 0000000..49d36f5
--- /dev/null
@@ -0,0 +1,90 @@
+From 7ecde6b7accded68174f807406cd1043927150c6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Sep 2022 10:42:04 -0500
+Subject: mm: add private field of first tail to struct page and struct folio
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit d340625f4849ab5dbfebbc7d84709fbfcd39e52f ]
+
+Allow struct folio to store hugetlb metadata that is contained in the
+private field of the first tail page.  On 32-bit, _private_1 aligns with
+page[1].private.
+
+Link: https://lkml.kernel.org/r/20220922154207.1575343-3-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Colin Cross <ccross@google.com>
+Cc: David Howells <dhowells@redhat.com>
+Cc: "Eric W . Biederman" <ebiederm@xmission.com>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: kernel test robot <lkp@intel.com>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Muchun Song <songmuchun@bytedance.com>
+Cc: Peter Xu <peterx@redhat.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: William Kucharski <william.kucharski@oracle.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/mm_types.h | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
+index 247aedb18d5c3..a9c1d611029d1 100644
+--- a/include/linux/mm_types.h
++++ b/include/linux/mm_types.h
+@@ -144,6 +144,7 @@ struct page {
+                       atomic_t compound_pincount;
+ #ifdef CONFIG_64BIT
+                       unsigned int compound_nr; /* 1 << compound_order */
++                      unsigned long _private_1;
+ #endif
+               };
+               struct {        /* Second tail page of compound page */
+@@ -264,6 +265,7 @@ struct page {
+  * @_total_mapcount: Do not use directly, call folio_entire_mapcount().
+  * @_pincount: Do not use directly, call folio_maybe_dma_pinned().
+  * @_folio_nr_pages: Do not use directly, call folio_nr_pages().
++ * @_private_1: Do not use directly, call folio_get_private_1().
+  *
+  * A folio is a physically, virtually and logically contiguous set
+  * of bytes.  It is a power-of-two in size, and it is aligned to that
+@@ -311,6 +313,7 @@ struct folio {
+ #ifdef CONFIG_64BIT
+       unsigned int _folio_nr_pages;
+ #endif
++      unsigned long _private_1;
+ };
+ #define FOLIO_MATCH(pg, fl)                                           \
+@@ -338,6 +341,7 @@ FOLIO_MATCH(compound_mapcount, _total_mapcount);
+ FOLIO_MATCH(compound_pincount, _pincount);
+ #ifdef CONFIG_64BIT
+ FOLIO_MATCH(compound_nr, _folio_nr_pages);
++FOLIO_MATCH(_private_1, _private_1);
+ #endif
+ #undef FOLIO_MATCH
+@@ -383,6 +387,16 @@ static inline void *folio_get_private(struct folio *folio)
+       return folio->private;
+ }
++static inline void folio_set_private_1(struct folio *folio, unsigned long private)
++{
++      folio->_private_1 = private;
++}
++
++static inline unsigned long folio_get_private_1(struct folio *folio)
++{
++      return folio->_private_1;
++}
++
+ struct page_frag_cache {
+       void * va;
+ #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb-add-folio-support-to-hugetlb-specific-fla.patch b/queue-6.1/mm-hugetlb-add-folio-support-to-hugetlb-specific-fla.patch
new file mode 100644 (file)
index 0000000..9ebdcdc
--- /dev/null
@@ -0,0 +1,149 @@
+From 56e5cb5464d4dfaf34e622ca54e88f6382188b86 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Sep 2022 10:42:03 -0500
+Subject: mm/hugetlb: add folio support to hugetlb specific flag macros
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit d03c376d9066532551dc56837c7c5490e4fcbbfe ]
+
+Patch series "begin converting hugetlb code to folios", v4.
+
+This patch series starts the conversion of the hugetlb code to operate on
+struct folios rather than struct pages.  This removes the ambiguitiy of
+whether functions are operating on head pages, tail pages of compound
+pages, or base pages.
+
+This series passes the linux test project hugetlb test cases.
+
+Patch 1 adds hugeltb specific page macros that can operate on folios.
+
+Patch 2 adds the private field of the first tail page to struct page.  For
+32-bit, _private_1 alinging with page[1].private was confirmed by using
+pahole.
+
+Patch 3 introduces hugetlb subpool helper functions which operate on
+struct folios. These patches were tested using the hugepage-mmap.c
+selftest along with the migratepages command.
+
+Patch 4 converts hugetlb_delete_from_page_cache() to use folios.
+
+Patch 5 adds a folio_hstate() function to get hstate information from a
+folio and adds a user of folio_hstate().
+
+Bpftrace was used to track time spent in the free_huge_pages function
+during the ltp test cases as it is a caller of the hugetlb subpool
+functions. From the histogram, the performance is similar before and
+after the patch series.
+
+Time spent in 'free_huge_page'
+
+6.0.0-rc2.master.20220823
+@nsecs:
+[256, 512)         14770 |@@@@@@@@@@@@@@@@@@@@@@@@@@@
+                        |@@@@@@@@@@@@@@@@@@@@@@@@@                           |
+[512, 1K)            155 |                                                    |
+[1K, 2K)             169 |                                                    |
+[2K, 4K)              50 |                                                    |
+[4K, 8K)              14 |                                                    |
+[8K, 16K)              3 |                                                    |
+[16K, 32K)             3 |                                                    |
+
+6.0.0-rc2.master.20220823 + patch series
+@nsecs:
+[256, 512)         13678 |@@@@@@@@@@@@@@@@@@@@@@@@@@@                        |
+                        |@@@@@@@@@@@@@@@@@@@@@@@@@                           |
+[512, 1K)            142 |                                                    |
+[1K, 2K)             199 |                                                    |
+[2K, 4K)              44 |                                                    |
+[4K, 8K)              13 |                                                    |
+[8K, 16K)              4 |                                                    |
+[16K, 32K)             1 |                                                    |
+
+This patch (of 5):
+
+Allow the macros which test, set, and clear hugetlb specific page flags to
+take a hugetlb folio as an input.  The macrros are generated as
+folio_{test, set, clear}_hugetlb_{restore_reserve, migratable, temporary,
+freed, vmemmap_optimized, raw_hwp_unreliable}.
+
+Link: https://lkml.kernel.org/r/20220922154207.1575343-1-sidhartha.kumar@oracle.com
+Link: https://lkml.kernel.org/r/20220922154207.1575343-2-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Reviewed-by: Muchun Song <songmuchun@bytedance.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Colin Cross <ccross@google.com>
+Cc: David Howells <dhowells@redhat.com>
+Cc: "Eric W . Biederman" <ebiederm@xmission.com>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: kernel test robot <lkp@intel.com>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Peter Xu <peterx@redhat.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: William Kucharski <william.kucharski@oracle.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/hugetlb.h | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
+index 1c6f35ba1604f..0c5326fd3c47a 100644
+--- a/include/linux/hugetlb.h
++++ b/include/linux/hugetlb.h
+@@ -625,26 +625,50 @@ enum hugetlb_page_flags {
+  */
+ #ifdef CONFIG_HUGETLB_PAGE
+ #define TESTHPAGEFLAG(uname, flname)                          \
++static __always_inline                                                \
++bool folio_test_hugetlb_##flname(struct folio *folio)         \
++      {       void *private = &folio->private;                \
++              return test_bit(HPG_##flname, private);         \
++      }                                                       \
+ static inline int HPage##uname(struct page *page)             \
+       { return test_bit(HPG_##flname, &(page->private)); }
+ #define SETHPAGEFLAG(uname, flname)                           \
++static __always_inline                                                \
++void folio_set_hugetlb_##flname(struct folio *folio)          \
++      {       void *private = &folio->private;                \
++              set_bit(HPG_##flname, private);                 \
++      }                                                       \
+ static inline void SetHPage##uname(struct page *page)         \
+       { set_bit(HPG_##flname, &(page->private)); }
+ #define CLEARHPAGEFLAG(uname, flname)                         \
++static __always_inline                                                \
++void folio_clear_hugetlb_##flname(struct folio *folio)                \
++      {       void *private = &folio->private;                \
++              clear_bit(HPG_##flname, private);               \
++      }                                                       \
+ static inline void ClearHPage##uname(struct page *page)               \
+       { clear_bit(HPG_##flname, &(page->private)); }
+ #else
+ #define TESTHPAGEFLAG(uname, flname)                          \
++static inline bool                                            \
++folio_test_hugetlb_##flname(struct folio *folio)              \
++      { return 0; }                                           \
+ static inline int HPage##uname(struct page *page)             \
+       { return 0; }
+ #define SETHPAGEFLAG(uname, flname)                           \
++static inline void                                            \
++folio_set_hugetlb_##flname(struct folio *folio)               \
++      { }                                                     \
+ static inline void SetHPage##uname(struct page *page)         \
+       { }
+ #define CLEARHPAGEFLAG(uname, flname)                         \
++static inline void                                            \
++folio_clear_hugetlb_##flname(struct folio *folio)             \
++      { }                                                     \
+ static inline void ClearHPage##uname(struct page *page)               \
+       { }
+ #endif
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb-add-folio_hstate.patch b/queue-6.1/mm-hugetlb-add-folio_hstate.patch
new file mode 100644 (file)
index 0000000..526aee2
--- /dev/null
@@ -0,0 +1,83 @@
+From 6bb737d794c98a5fd27f8d2e9e1be7afc98d1565 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Sep 2022 10:42:07 -0500
+Subject: mm/hugetlb: add folio_hstate()
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit e51da3a9b6c2f67879880259a25c51dbda01c462 ]
+
+Helper function to retrieve hstate information from a hugetlb folio.
+
+Link: https://lkml.kernel.org/r/20220922154207.1575343-6-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Colin Cross <ccross@google.com>
+Cc: David Howells <dhowells@redhat.com>
+Cc: "Eric W . Biederman" <ebiederm@xmission.com>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Muchun Song <songmuchun@bytedance.com>
+Cc: Peter Xu <peterx@redhat.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: William Kucharski <william.kucharski@oracle.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/hugetlb.h | 14 ++++++++++++--
+ mm/migrate.c            |  2 +-
+ 2 files changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
+index 02d9a8af3704e..37eeef9841c4e 100644
+--- a/include/linux/hugetlb.h
++++ b/include/linux/hugetlb.h
+@@ -863,10 +863,15 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
+ }
+ #endif
++static inline struct hstate *folio_hstate(struct folio *folio)
++{
++      VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio);
++      return size_to_hstate(folio_size(folio));
++}
++
+ static inline struct hstate *page_hstate(struct page *page)
+ {
+-      VM_BUG_ON_PAGE(!PageHuge(page), page);
+-      return size_to_hstate(page_size(page));
++      return folio_hstate(page_folio(page));
+ }
+ static inline unsigned hstate_index_to_shift(unsigned index)
+@@ -1077,6 +1082,11 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
+       return NULL;
+ }
++static inline struct hstate *folio_hstate(struct folio *folio)
++{
++      return NULL;
++}
++
+ static inline struct hstate *page_hstate(struct page *page)
+ {
+       return NULL;
+diff --git a/mm/migrate.c b/mm/migrate.c
+index c5968021fde0a..0252aa4ff572e 100644
+--- a/mm/migrate.c
++++ b/mm/migrate.c
+@@ -1632,7 +1632,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private)
+               nid = folio_nid(folio);
+       if (folio_test_hugetlb(folio)) {
+-              struct hstate *h = page_hstate(&folio->page);
++              struct hstate *h = folio_hstate(folio);
+               gfp_mask = htlb_modify_alloc_mask(h, gfp_mask);
+               return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask);
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb-add-hugetlb_folio_subpool-helpers.patch b/queue-6.1/mm-hugetlb-add-hugetlb_folio_subpool-helpers.patch
new file mode 100644 (file)
index 0000000..85ffbd0
--- /dev/null
@@ -0,0 +1,92 @@
+From b63950dc421fb0ba0d198e754ded83610eb96da9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Sep 2022 10:42:05 -0500
+Subject: mm/hugetlb: add hugetlb_folio_subpool() helpers
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit 149562f7509404c382c32c3fa8a6ba356135e5cf ]
+
+Allow hugetlbfs_migrate_folio to check and read subpool information by
+passing in a folio.
+
+Link: https://lkml.kernel.org/r/20220922154207.1575343-4-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Colin Cross <ccross@google.com>
+Cc: David Howells <dhowells@redhat.com>
+Cc: "Eric W . Biederman" <ebiederm@xmission.com>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: kernel test robot <lkp@intel.com>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Muchun Song <songmuchun@bytedance.com>
+Cc: Peter Xu <peterx@redhat.com>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: William Kucharski <william.kucharski@oracle.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/hugetlbfs/inode.c    |  8 ++++----
+ include/linux/hugetlb.h | 15 +++++++++++++--
+ 2 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
+index 4fe4b3393e71c..330729445d8ab 100644
+--- a/fs/hugetlbfs/inode.c
++++ b/fs/hugetlbfs/inode.c
+@@ -1108,10 +1108,10 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping,
+       if (rc != MIGRATEPAGE_SUCCESS)
+               return rc;
+-      if (hugetlb_page_subpool(&src->page)) {
+-              hugetlb_set_page_subpool(&dst->page,
+-                                      hugetlb_page_subpool(&src->page));
+-              hugetlb_set_page_subpool(&src->page, NULL);
++      if (hugetlb_folio_subpool(src)) {
++              hugetlb_set_folio_subpool(dst,
++                                      hugetlb_folio_subpool(src));
++              hugetlb_set_folio_subpool(src, NULL);
+       }
+       if (mode != MIGRATE_SYNC_NO_COPY)
+diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
+index 0c5326fd3c47a..02d9a8af3704e 100644
+--- a/include/linux/hugetlb.h
++++ b/include/linux/hugetlb.h
+@@ -754,18 +754,29 @@ extern unsigned int default_hstate_idx;
+ #define default_hstate (hstates[default_hstate_idx])
++static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio)
++{
++      return (void *)folio_get_private_1(folio);
++}
++
+ /*
+  * hugetlb page subpool pointer located in hpage[1].private
+  */
+ static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
+ {
+-      return (void *)page_private(hpage + SUBPAGE_INDEX_SUBPOOL);
++      return hugetlb_folio_subpool(page_folio(hpage));
++}
++
++static inline void hugetlb_set_folio_subpool(struct folio *folio,
++                                      struct hugepage_subpool *subpool)
++{
++      folio_set_private_1(folio, (unsigned long)subpool);
+ }
+ static inline void hugetlb_set_page_subpool(struct page *hpage,
+                                       struct hugepage_subpool *subpool)
+ {
+-      set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool);
++      hugetlb_set_folio_subpool(page_folio(hpage), subpool);
+ }
+ static inline struct hstate *hstate_file(struct file *f)
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb-convert-free_huge_page-to-folios.patch b/queue-6.1/mm-hugetlb-convert-free_huge_page-to-folios.patch
new file mode 100644 (file)
index 0000000..c6be0bc
--- /dev/null
@@ -0,0 +1,87 @@
+From 9eb98ec27116a00ff3d94099d5ccb480cf5c6bd1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Nov 2022 15:30:56 -0700
+Subject: mm/hugetlb: convert free_huge_page to folios
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit 0356c4b96f6890dd61af4c902f681764f4bdba09 ]
+
+Use folios inside free_huge_page(), this is in preparation for converting
+hugetlb_cgroup_uncharge_page() to take in a folio.
+
+Link: https://lkml.kernel.org/r/20221101223059.460937-7-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Reviewed-by: Muchun Song <songmuchun@bytedance.com>
+Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
+Cc: Bui Quang Minh <minhquangbui99@gmail.com>
+Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
+Cc: Miaohe Lin <linmiaohe@huawei.com>
+Cc: Mina Almasry <almasrymina@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ mm/hugetlb.c | 27 ++++++++++++++-------------
+ 1 file changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index 9c1a30eb6c564..6cdbb06902df1 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -1918,21 +1918,22 @@ void free_huge_page(struct page *page)
+        * Can't pass hstate in here because it is called from the
+        * compound page destructor.
+        */
+-      struct hstate *h = page_hstate(page);
+-      int nid = page_to_nid(page);
+-      struct hugepage_subpool *spool = hugetlb_page_subpool(page);
++      struct folio *folio = page_folio(page);
++      struct hstate *h = folio_hstate(folio);
++      int nid = folio_nid(folio);
++      struct hugepage_subpool *spool = hugetlb_folio_subpool(folio);
+       bool restore_reserve;
+       unsigned long flags;
+-      VM_BUG_ON_PAGE(page_count(page), page);
+-      VM_BUG_ON_PAGE(page_mapcount(page), page);
++      VM_BUG_ON_FOLIO(folio_ref_count(folio), folio);
++      VM_BUG_ON_FOLIO(folio_mapcount(folio), folio);
+-      hugetlb_set_page_subpool(page, NULL);
+-      if (PageAnon(page))
+-              __ClearPageAnonExclusive(page);
+-      page->mapping = NULL;
+-      restore_reserve = HPageRestoreReserve(page);
+-      ClearHPageRestoreReserve(page);
++      hugetlb_set_folio_subpool(folio, NULL);
++      if (folio_test_anon(folio))
++              __ClearPageAnonExclusive(&folio->page);
++      folio->mapping = NULL;
++      restore_reserve = folio_test_hugetlb_restore_reserve(folio);
++      folio_clear_hugetlb_restore_reserve(folio);
+       /*
+        * If HPageRestoreReserve was set on page, page allocation consumed a
+@@ -1954,7 +1955,7 @@ void free_huge_page(struct page *page)
+       }
+       spin_lock_irqsave(&hugetlb_lock, flags);
+-      ClearHPageMigratable(page);
++      folio_clear_hugetlb_migratable(folio);
+       hugetlb_cgroup_uncharge_page(hstate_index(h),
+                                    pages_per_huge_page(h), page);
+       hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
+@@ -1962,7 +1963,7 @@ void free_huge_page(struct page *page)
+       if (restore_reserve)
+               h->resv_huge_pages++;
+-      if (HPageTemporary(page)) {
++      if (folio_test_hugetlb_temporary(folio)) {
+               remove_hugetlb_page(h, page, false);
+               spin_unlock_irqrestore(&hugetlb_lock, flags);
+               update_and_free_page(h, page, true);
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb-fix-missing-hugetlb_lock-for-resv-uncharg.patch b/queue-6.1/mm-hugetlb-fix-missing-hugetlb_lock-for-resv-uncharg.patch
new file mode 100644 (file)
index 0000000..3a94f01
--- /dev/null
@@ -0,0 +1,56 @@
+From 96a4292507e27a400170d094e88ec31997277544 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 17:18:35 -0400
+Subject: mm/hugetlb: fix missing hugetlb_lock for resv uncharge
+
+From: Peter Xu <peterx@redhat.com>
+
+[ Upstream commit b76b46902c2d0395488c8412e1116c2486cdfcb2 ]
+
+There is a recent report on UFFDIO_COPY over hugetlb:
+
+https://lore.kernel.org/all/000000000000ee06de0616177560@google.com/
+
+350:   lockdep_assert_held(&hugetlb_lock);
+
+Should be an issue in hugetlb but triggered in an userfault context, where
+it goes into the unlikely path where two threads modifying the resv map
+together.  Mike has a fix in that path for resv uncharge but it looks like
+the locking criteria was overlooked: hugetlb_cgroup_uncharge_folio_rsvd()
+will update the cgroup pointer, so it requires to be called with the lock
+held.
+
+Link: https://lkml.kernel.org/r/20240417211836.2742593-3-peterx@redhat.com
+Fixes: 79aa925bf239 ("hugetlb_cgroup: fix reservation accounting")
+Signed-off-by: Peter Xu <peterx@redhat.com>
+Reported-by: syzbot+4b8077a5fccc61c385a1@syzkaller.appspotmail.com
+Reviewed-by: Mina Almasry <almasrymina@google.com>
+Cc: David Hildenbrand <david@redhat.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ mm/hugetlb.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index e720b9ac28337..e9ae0fc81dfbe 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -3190,9 +3190,12 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
+               rsv_adjust = hugepage_subpool_put_pages(spool, 1);
+               hugetlb_acct_memory(h, -rsv_adjust);
+-              if (deferred_reserve)
++              if (deferred_reserve) {
++                      spin_lock_irq(&hugetlb_lock);
+                       hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h),
+                                       pages_per_huge_page(h), folio);
++                      spin_unlock_irq(&hugetlb_lock);
++              }
+       }
+       return page;
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb_cgroup-convert-__set_hugetlb_cgroup-to-fo.patch b/queue-6.1/mm-hugetlb_cgroup-convert-__set_hugetlb_cgroup-to-fo.patch
new file mode 100644 (file)
index 0000000..4ebc2cc
--- /dev/null
@@ -0,0 +1,107 @@
+From b1d4ed0d3b4dd8f80f83089504b348f4d996caba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Nov 2022 15:30:51 -0700
+Subject: mm/hugetlb_cgroup: convert __set_hugetlb_cgroup() to folios
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit a098c977722ca27d3b4bfeb966767af3cce45f85 ]
+
+Patch series "convert hugetlb_cgroup helper functions to folios", v2.
+
+This patch series continues the conversion of hugetlb code from being
+managed in pages to folios by converting many of the hugetlb_cgroup helper
+functions to use folios.  This allows the core hugetlb functions to pass
+in a folio to these helper functions.
+
+This patch (of 9);
+
+Change __set_hugetlb_cgroup() to use folios so it is explicit that the
+function operates on a head page.
+
+Link: https://lkml.kernel.org/r/20221101223059.460937-1-sidhartha.kumar@oracle.com
+Link: https://lkml.kernel.org/r/20221101223059.460937-2-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Reviewed-by: Muchun Song <songmuchun@bytedance.com>
+Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
+Cc: Bui Quang Minh <minhquangbui99@gmail.com>
+Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
+Cc: Miaohe Lin <linmiaohe@huawei.com>
+Cc: Mina Almasry <almasrymina@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/hugetlb_cgroup.h | 14 +++++++-------
+ mm/hugetlb_cgroup.c            |  4 ++--
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
+index 630cd255d0cfd..7576e9ed8afe7 100644
+--- a/include/linux/hugetlb_cgroup.h
++++ b/include/linux/hugetlb_cgroup.h
+@@ -90,31 +90,31 @@ hugetlb_cgroup_from_page_rsvd(struct page *page)
+       return __hugetlb_cgroup_from_page(page, true);
+ }
+-static inline void __set_hugetlb_cgroup(struct page *page,
++static inline void __set_hugetlb_cgroup(struct folio *folio,
+                                      struct hugetlb_cgroup *h_cg, bool rsvd)
+ {
+-      VM_BUG_ON_PAGE(!PageHuge(page), page);
++      VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio);
+-      if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
++      if (folio_order(folio) < HUGETLB_CGROUP_MIN_ORDER)
+               return;
+       if (rsvd)
+-              set_page_private(page + SUBPAGE_INDEX_CGROUP_RSVD,
++              set_page_private(folio_page(folio, SUBPAGE_INDEX_CGROUP_RSVD),
+                                (unsigned long)h_cg);
+       else
+-              set_page_private(page + SUBPAGE_INDEX_CGROUP,
++              set_page_private(folio_page(folio, SUBPAGE_INDEX_CGROUP),
+                                (unsigned long)h_cg);
+ }
+ static inline void set_hugetlb_cgroup(struct page *page,
+                                    struct hugetlb_cgroup *h_cg)
+ {
+-      __set_hugetlb_cgroup(page, h_cg, false);
++      __set_hugetlb_cgroup(page_folio(page), h_cg, false);
+ }
+ static inline void set_hugetlb_cgroup_rsvd(struct page *page,
+                                         struct hugetlb_cgroup *h_cg)
+ {
+-      __set_hugetlb_cgroup(page, h_cg, true);
++      __set_hugetlb_cgroup(page_folio(page), h_cg, true);
+ }
+ static inline bool hugetlb_cgroup_disabled(void)
+diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
+index f61d132df52b3..b2316bcbf634a 100644
+--- a/mm/hugetlb_cgroup.c
++++ b/mm/hugetlb_cgroup.c
+@@ -314,7 +314,7 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
+       if (hugetlb_cgroup_disabled() || !h_cg)
+               return;
+-      __set_hugetlb_cgroup(page, h_cg, rsvd);
++      __set_hugetlb_cgroup(page_folio(page), h_cg, rsvd);
+       if (!rsvd) {
+               unsigned long usage =
+                       h_cg->nodeinfo[page_to_nid(page)]->usage[idx];
+@@ -356,7 +356,7 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+       h_cg = __hugetlb_cgroup_from_page(page, rsvd);
+       if (unlikely(!h_cg))
+               return;
+-      __set_hugetlb_cgroup(page, NULL, rsvd);
++      __set_hugetlb_cgroup(page_folio(page), NULL, rsvd);
+       page_counter_uncharge(__hugetlb_cgroup_counter_from_cgroup(h_cg, idx,
+                                                                  rsvd),
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb_cgroup-convert-hugetlb_cgroup_from_page-t.patch b/queue-6.1/mm-hugetlb_cgroup-convert-hugetlb_cgroup_from_page-t.patch
new file mode 100644 (file)
index 0000000..428a2bd
--- /dev/null
@@ -0,0 +1,174 @@
+From 99a4181242754755413ecac846adb90ccc33a16b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Nov 2022 15:30:52 -0700
+Subject: mm/hugetlb_cgroup: convert hugetlb_cgroup_from_page() to folios
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit f074732d599e19a2a5b12e54743ad5eaccbe6550 ]
+
+Introduce folios in __remove_hugetlb_page() by converting
+hugetlb_cgroup_from_page() to use folios.
+
+Also gets rid of unsed hugetlb_cgroup_from_page_resv() function.
+
+Link: https://lkml.kernel.org/r/20221101223059.460937-3-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reviewed-by: Muchun Song <songmuchun@bytedance.com>
+Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
+Cc: Bui Quang Minh <minhquangbui99@gmail.com>
+Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
+Cc: Miaohe Lin <linmiaohe@huawei.com>
+Cc: Mike Kravetz <mike.kravetz@oracle.com>
+Cc: Mina Almasry <almasrymina@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/hugetlb_cgroup.h | 39 +++++++++++++++++-----------------
+ mm/hugetlb.c                   |  5 +++--
+ mm/hugetlb_cgroup.c            | 13 +++++++-----
+ 3 files changed, 31 insertions(+), 26 deletions(-)
+
+diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
+index 7576e9ed8afe7..feb2edafc8b68 100644
+--- a/include/linux/hugetlb_cgroup.h
++++ b/include/linux/hugetlb_cgroup.h
+@@ -67,27 +67,34 @@ struct hugetlb_cgroup {
+ };
+ static inline struct hugetlb_cgroup *
+-__hugetlb_cgroup_from_page(struct page *page, bool rsvd)
++__hugetlb_cgroup_from_folio(struct folio *folio, bool rsvd)
+ {
+-      VM_BUG_ON_PAGE(!PageHuge(page), page);
++      struct page *tail;
+-      if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
++      VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio);
++      if (folio_order(folio) < HUGETLB_CGROUP_MIN_ORDER)
+               return NULL;
+-      if (rsvd)
+-              return (void *)page_private(page + SUBPAGE_INDEX_CGROUP_RSVD);
+-      else
+-              return (void *)page_private(page + SUBPAGE_INDEX_CGROUP);
++
++      if (rsvd) {
++              tail = folio_page(folio, SUBPAGE_INDEX_CGROUP_RSVD);
++              return (void *)page_private(tail);
++      }
++
++      else {
++              tail = folio_page(folio, SUBPAGE_INDEX_CGROUP);
++              return (void *)page_private(tail);
++      }
+ }
+-static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
++static inline struct hugetlb_cgroup *hugetlb_cgroup_from_folio(struct folio *folio)
+ {
+-      return __hugetlb_cgroup_from_page(page, false);
++      return __hugetlb_cgroup_from_folio(folio, false);
+ }
+ static inline struct hugetlb_cgroup *
+-hugetlb_cgroup_from_page_rsvd(struct page *page)
++hugetlb_cgroup_from_folio_rsvd(struct folio *folio)
+ {
+-      return __hugetlb_cgroup_from_page(page, true);
++      return __hugetlb_cgroup_from_folio(folio, true);
+ }
+ static inline void __set_hugetlb_cgroup(struct folio *folio,
+@@ -181,19 +188,13 @@ static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
+ {
+ }
+-static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
+-{
+-      return NULL;
+-}
+-
+-static inline struct hugetlb_cgroup *
+-hugetlb_cgroup_from_page_resv(struct page *page)
++static inline struct hugetlb_cgroup *hugetlb_cgroup_from_folio(struct folio *folio)
+ {
+       return NULL;
+ }
+ static inline struct hugetlb_cgroup *
+-hugetlb_cgroup_from_page_rsvd(struct page *page)
++hugetlb_cgroup_from_folio_rsvd(struct folio *folio)
+ {
+       return NULL;
+ }
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index 37288a7f0fa65..9c1a30eb6c564 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -1661,9 +1661,10 @@ static void __remove_hugetlb_page(struct hstate *h, struct page *page,
+                                                       bool demote)
+ {
+       int nid = page_to_nid(page);
++      struct folio *folio = page_folio(page);
+-      VM_BUG_ON_PAGE(hugetlb_cgroup_from_page(page), page);
+-      VM_BUG_ON_PAGE(hugetlb_cgroup_from_page_rsvd(page), page);
++      VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio(folio), folio);
++      VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio_rsvd(folio), folio);
+       lockdep_assert_held(&hugetlb_lock);
+       if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported())
+diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
+index b2316bcbf634a..8b95c1560f9c3 100644
+--- a/mm/hugetlb_cgroup.c
++++ b/mm/hugetlb_cgroup.c
+@@ -191,8 +191,9 @@ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg,
+       struct page_counter *counter;
+       struct hugetlb_cgroup *page_hcg;
+       struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(h_cg);
++      struct folio *folio = page_folio(page);
+-      page_hcg = hugetlb_cgroup_from_page(page);
++      page_hcg = hugetlb_cgroup_from_folio(folio);
+       /*
+        * We can have pages in active list without any cgroup
+        * ie, hugepage with less than 3 pages. We can safely
+@@ -349,14 +350,15 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+                                          struct page *page, bool rsvd)
+ {
+       struct hugetlb_cgroup *h_cg;
++      struct folio *folio = page_folio(page);
+       if (hugetlb_cgroup_disabled())
+               return;
+       lockdep_assert_held(&hugetlb_lock);
+-      h_cg = __hugetlb_cgroup_from_page(page, rsvd);
++      h_cg = __hugetlb_cgroup_from_folio(folio, rsvd);
+       if (unlikely(!h_cg))
+               return;
+-      __set_hugetlb_cgroup(page_folio(page), NULL, rsvd);
++      __set_hugetlb_cgroup(folio, NULL, rsvd);
+       page_counter_uncharge(__hugetlb_cgroup_counter_from_cgroup(h_cg, idx,
+                                                                  rsvd),
+@@ -888,13 +890,14 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage)
+       struct hugetlb_cgroup *h_cg;
+       struct hugetlb_cgroup *h_cg_rsvd;
+       struct hstate *h = page_hstate(oldhpage);
++      struct folio *old_folio = page_folio(oldhpage);
+       if (hugetlb_cgroup_disabled())
+               return;
+       spin_lock_irq(&hugetlb_lock);
+-      h_cg = hugetlb_cgroup_from_page(oldhpage);
+-      h_cg_rsvd = hugetlb_cgroup_from_page_rsvd(oldhpage);
++      h_cg = hugetlb_cgroup_from_folio(old_folio);
++      h_cg_rsvd = hugetlb_cgroup_from_folio_rsvd(old_folio);
+       set_hugetlb_cgroup(oldhpage, NULL);
+       set_hugetlb_cgroup_rsvd(oldhpage, NULL);
+-- 
+2.43.0
+
diff --git a/queue-6.1/mm-hugetlb_cgroup-convert-hugetlb_cgroup_uncharge_pa.patch b/queue-6.1/mm-hugetlb_cgroup-convert-hugetlb_cgroup_uncharge_pa.patch
new file mode 100644 (file)
index 0000000..ad20495
--- /dev/null
@@ -0,0 +1,179 @@
+From d522a55f936f7b1f3268c0a0aa97e96da96457f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Nov 2022 15:30:57 -0700
+Subject: mm/hugetlb_cgroup: convert hugetlb_cgroup_uncharge_page() to folios
+
+From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+
+[ Upstream commit d4ab0316cc33aeedf6dcb1c2c25e097a25766132 ]
+
+Continue to use a folio inside free_huge_page() by converting
+hugetlb_cgroup_uncharge_page*() to folios.
+
+Link: https://lkml.kernel.org/r/20221101223059.460937-8-sidhartha.kumar@oracle.com
+Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Reviewed-by: Muchun Song <songmuchun@bytedance.com>
+Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
+Cc: Bui Quang Minh <minhquangbui99@gmail.com>
+Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
+Cc: Miaohe Lin <linmiaohe@huawei.com>
+Cc: Mina Almasry <almasrymina@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: b76b46902c2d ("mm/hugetlb: fix missing hugetlb_lock for resv uncharge")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/hugetlb_cgroup.h | 16 ++++++++--------
+ mm/hugetlb.c                   | 15 +++++++++------
+ mm/hugetlb_cgroup.c            | 21 ++++++++++-----------
+ 3 files changed, 27 insertions(+), 25 deletions(-)
+
+diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
+index feb2edafc8b68..241bf4fe701ae 100644
+--- a/include/linux/hugetlb_cgroup.h
++++ b/include/linux/hugetlb_cgroup.h
+@@ -158,10 +158,10 @@ extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
+ extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
+                                             struct hugetlb_cgroup *h_cg,
+                                             struct page *page);
+-extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+-                                       struct page *page);
+-extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages,
+-                                            struct page *page);
++extern void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
++                                       struct folio *folio);
++extern void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages,
++                                            struct folio *folio);
+ extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
+                                          struct hugetlb_cgroup *h_cg);
+@@ -254,14 +254,14 @@ hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
+ {
+ }
+-static inline void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+-                                              struct page *page)
++static inline void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
++                                              struct folio *folio)
+ {
+ }
+-static inline void hugetlb_cgroup_uncharge_page_rsvd(int idx,
++static inline void hugetlb_cgroup_uncharge_folio_rsvd(int idx,
+                                                    unsigned long nr_pages,
+-                                                   struct page *page)
++                                                   struct folio *folio)
+ {
+ }
+ static inline void hugetlb_cgroup_uncharge_cgroup(int idx,
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index 6cdbb06902df1..e720b9ac28337 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -1956,10 +1956,10 @@ void free_huge_page(struct page *page)
+       spin_lock_irqsave(&hugetlb_lock, flags);
+       folio_clear_hugetlb_migratable(folio);
+-      hugetlb_cgroup_uncharge_page(hstate_index(h),
+-                                   pages_per_huge_page(h), page);
+-      hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
+-                                        pages_per_huge_page(h), page);
++      hugetlb_cgroup_uncharge_folio(hstate_index(h),
++                                   pages_per_huge_page(h), folio);
++      hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h),
++                                        pages_per_huge_page(h), folio);
+       if (restore_reserve)
+               h->resv_huge_pages++;
+@@ -3082,6 +3082,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
+       struct hugepage_subpool *spool = subpool_vma(vma);
+       struct hstate *h = hstate_vma(vma);
+       struct page *page;
++      struct folio *folio;
+       long map_chg, map_commit;
+       long gbl_chg;
+       int ret, idx;
+@@ -3145,6 +3146,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
+        * a reservation exists for the allocation.
+        */
+       page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg);
++
+       if (!page) {
+               spin_unlock_irq(&hugetlb_lock);
+               page = alloc_buddy_huge_page_with_mpol(h, vma, addr);
+@@ -3159,6 +3161,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
+               set_page_refcounted(page);
+               /* Fall through */
+       }
++      folio = page_folio(page);
+       hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page);
+       /* If allocation is not consuming a reservation, also store the
+        * hugetlb_cgroup pointer on the page.
+@@ -3188,8 +3191,8 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
+               rsv_adjust = hugepage_subpool_put_pages(spool, 1);
+               hugetlb_acct_memory(h, -rsv_adjust);
+               if (deferred_reserve)
+-                      hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
+-                                      pages_per_huge_page(h), page);
++                      hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h),
++                                      pages_per_huge_page(h), folio);
+       }
+       return page;
+diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
+index 8b95c1560f9c3..32f4408eda240 100644
+--- a/mm/hugetlb_cgroup.c
++++ b/mm/hugetlb_cgroup.c
+@@ -346,11 +346,10 @@ void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
+ /*
+  * Should be called with hugetlb_lock held
+  */
+-static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+-                                         struct page *page, bool rsvd)
++static void __hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
++                                         struct folio *folio, bool rsvd)
+ {
+       struct hugetlb_cgroup *h_cg;
+-      struct folio *folio = page_folio(page);
+       if (hugetlb_cgroup_disabled())
+               return;
+@@ -368,27 +367,27 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+               css_put(&h_cg->css);
+       else {
+               unsigned long usage =
+-                      h_cg->nodeinfo[page_to_nid(page)]->usage[idx];
++                      h_cg->nodeinfo[folio_nid(folio)]->usage[idx];
+               /*
+                * This write is not atomic due to fetching usage and writing
+                * to it, but that's fine because we call this with
+                * hugetlb_lock held anyway.
+                */
+-              WRITE_ONCE(h_cg->nodeinfo[page_to_nid(page)]->usage[idx],
++              WRITE_ONCE(h_cg->nodeinfo[folio_nid(folio)]->usage[idx],
+                          usage - nr_pages);
+       }
+ }
+-void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
+-                                struct page *page)
++void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
++                                struct folio *folio)
+ {
+-      __hugetlb_cgroup_uncharge_page(idx, nr_pages, page, false);
++      __hugetlb_cgroup_uncharge_folio(idx, nr_pages, folio, false);
+ }
+-void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages,
+-                                     struct page *page)
++void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages,
++                                     struct folio *folio)
+ {
+-      __hugetlb_cgroup_uncharge_page(idx, nr_pages, page, true);
++      __hugetlb_cgroup_uncharge_folio(idx, nr_pages, folio, true);
+ }
+ static void __hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
+-- 
+2.43.0
+
diff --git a/queue-6.1/nfs-expose-proc-net-sunrpc-nfs-in-net-namespaces.patch b/queue-6.1/nfs-expose-proc-net-sunrpc-nfs-in-net-namespaces.patch
new file mode 100644 (file)
index 0000000..48bb28f
--- /dev/null
@@ -0,0 +1,71 @@
+From f8b4f272237cf1d89244d2632561ed32129f3629 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Feb 2024 14:57:31 -0500
+Subject: nfs: expose /proc/net/sunrpc/nfs in net namespaces
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit d47151b79e3220e72ae323b8b8e9d6da20dc884e ]
+
+We're using nfs mounts inside of containers in production and noticed
+that the nfs stats are not exposed in /proc.  This is a problem for us
+as we use these stats for monitoring, and have to do this awkward bind
+mount from the main host into the container in order to get to these
+states.
+
+Add the rpc_proc_register call to the pernet operations entry and exit
+points so these stats can be exposed inside of network namespaces.
+
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Stable-dep-of: 24457f1be29f ("nfs: Handle error of rpc_proc_register() in nfs_net_init().")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/inode.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
+index e0c1fb98f907a..3cdb8daa6d6a9 100644
+--- a/fs/nfs/inode.c
++++ b/fs/nfs/inode.c
+@@ -2334,11 +2334,13 @@ EXPORT_SYMBOL_GPL(nfs_net_id);
+ static int nfs_net_init(struct net *net)
+ {
+       nfs_clients_init(net);
++      rpc_proc_register(net, &nfs_rpcstat);
+       return nfs_fs_proc_net_init(net);
+ }
+ static void nfs_net_exit(struct net *net)
+ {
++      rpc_proc_unregister(net, "nfs");
+       nfs_fs_proc_net_exit(net);
+       nfs_clients_exit(net);
+ }
+@@ -2393,15 +2395,12 @@ static int __init init_nfs_fs(void)
+       if (err)
+               goto out1;
+-      rpc_proc_register(&init_net, &nfs_rpcstat);
+-
+       err = register_nfs_fs();
+       if (err)
+               goto out0;
+       return 0;
+ out0:
+-      rpc_proc_unregister(&init_net, "nfs");
+       nfs_destroy_directcache();
+ out1:
+       nfs_destroy_writepagecache();
+@@ -2431,7 +2430,6 @@ static void __exit exit_nfs_fs(void)
+       nfs_destroy_inodecache();
+       nfs_destroy_nfspagecache();
+       unregister_pernet_subsys(&nfs_net_ops);
+-      rpc_proc_unregister(&init_net, "nfs");
+       unregister_nfs_fs();
+       nfs_fs_proc_exit();
+       nfsiod_stop();
+-- 
+2.43.0
+
diff --git a/queue-6.1/nfs-handle-error-of-rpc_proc_register-in-nfs_net_ini.patch b/queue-6.1/nfs-handle-error-of-rpc_proc_register-in-nfs_net_ini.patch
new file mode 100644 (file)
index 0000000..e1c2337
--- /dev/null
@@ -0,0 +1,104 @@
+From e35afe09ba52226e46ed1cfd32ab53616ab378ff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Apr 2024 15:12:00 -0700
+Subject: nfs: Handle error of rpc_proc_register() in nfs_net_init().
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit 24457f1be29f1e7042e50a7749f5c2dde8c433c8 ]
+
+syzkaller reported a warning [0] triggered while destroying immature
+netns.
+
+rpc_proc_register() was called in init_nfs_fs(), but its error
+has been ignored since at least the initial commit 1da177e4c3f4
+("Linux-2.6.12-rc2").
+
+Recently, commit d47151b79e32 ("nfs: expose /proc/net/sunrpc/nfs
+in net namespaces") converted the procfs to per-netns and made
+the problem more visible.
+
+Even when rpc_proc_register() fails, nfs_net_init() could succeed,
+and thus nfs_net_exit() will be called while destroying the netns.
+
+Then, remove_proc_entry() will be called for non-existing proc
+directory and trigger the warning below.
+
+Let's handle the error of rpc_proc_register() properly in nfs_net_init().
+
+[0]:
+name 'nfs'
+WARNING: CPU: 1 PID: 1710 at fs/proc/generic.c:711 remove_proc_entry+0x1bb/0x2d0 fs/proc/generic.c:711
+Modules linked in:
+CPU: 1 PID: 1710 Comm: syz-executor.2 Not tainted 6.8.0-12822-gcd51db110a7e #12
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
+RIP: 0010:remove_proc_entry+0x1bb/0x2d0 fs/proc/generic.c:711
+Code: 41 5d 41 5e c3 e8 85 09 b5 ff 48 c7 c7 88 58 64 86 e8 09 0e 71 02 e8 74 09 b5 ff 4c 89 e6 48 c7 c7 de 1b 80 84 e8 c5 ad 97 ff <0f> 0b eb b1 e8 5c 09 b5 ff 48 c7 c7 88 58 64 86 e8 e0 0d 71 02 eb
+RSP: 0018:ffffc9000c6d7ce0 EFLAGS: 00010286
+RAX: 0000000000000000 RBX: ffff8880422b8b00 RCX: ffffffff8110503c
+RDX: ffff888030652f00 RSI: ffffffff81105045 RDI: 0000000000000001
+RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
+R10: 0000000000000001 R11: ffffffff81bb62cb R12: ffffffff84807ffc
+R13: ffff88804ad6fcc0 R14: ffffffff84807ffc R15: ffffffff85741ff8
+FS:  00007f30cfba8640(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 00007ff51afe8000 CR3: 000000005a60a005 CR4: 0000000000770ef0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+PKRU: 55555554
+Call Trace:
+ <TASK>
+ rpc_proc_unregister+0x64/0x70 net/sunrpc/stats.c:310
+ nfs_net_exit+0x1c/0x30 fs/nfs/inode.c:2438
+ ops_exit_list+0x62/0xb0 net/core/net_namespace.c:170
+ setup_net+0x46c/0x660 net/core/net_namespace.c:372
+ copy_net_ns+0x244/0x590 net/core/net_namespace.c:505
+ create_new_namespaces+0x2ed/0x770 kernel/nsproxy.c:110
+ unshare_nsproxy_namespaces+0xae/0x160 kernel/nsproxy.c:228
+ ksys_unshare+0x342/0x760 kernel/fork.c:3322
+ __do_sys_unshare kernel/fork.c:3393 [inline]
+ __se_sys_unshare kernel/fork.c:3391 [inline]
+ __x64_sys_unshare+0x1f/0x30 kernel/fork.c:3391
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x46/0x4e
+RIP: 0033:0x7f30d0febe5d
+Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 9f 1b 00 f7 d8 64 89 01 48
+RSP: 002b:00007f30cfba7cc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000110
+RAX: ffffffffffffffda RBX: 00000000004bbf80 RCX: 00007f30d0febe5d
+RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000006c020600
+RBP: 00000000004bbf80 R08: 0000000000000000 R09: 0000000000000000
+R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
+R13: 000000000000000b R14: 00007f30d104c530 R15: 0000000000000000
+ </TASK>
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reported-by: syzkaller <syzkaller@googlegroups.com>
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/inode.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
+index fae1e009cd6cf..cf8c3771e4bfb 100644
+--- a/fs/nfs/inode.c
++++ b/fs/nfs/inode.c
+@@ -2336,7 +2336,12 @@ static int nfs_net_init(struct net *net)
+       struct nfs_net *nn = net_generic(net, nfs_net_id);
+       nfs_clients_init(net);
+-      rpc_proc_register(net, &nn->rpcstats);
++
++      if (!rpc_proc_register(net, &nn->rpcstats)) {
++              nfs_clients_exit(net);
++              return -ENOMEM;
++      }
++
+       return nfs_fs_proc_net_init(net);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.1/nfs-make-the-rpc_stat-per-net-namespace.patch b/queue-6.1/nfs-make-the-rpc_stat-per-net-namespace.patch
new file mode 100644 (file)
index 0000000..f13568f
--- /dev/null
@@ -0,0 +1,113 @@
+From bb1cd9a48bca9ad914d9afb116e8ac689118e2a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Feb 2024 14:57:32 -0500
+Subject: nfs: make the rpc_stat per net namespace
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit 1548036ef1204df65ca5a16e8b199c858cb80075 ]
+
+Now that we're exposing the rpc stats on a per-network namespace basis,
+move this struct into struct nfs_net and use that to make sure only the
+per-network namespace stats are exposed.
+
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Stable-dep-of: 24457f1be29f ("nfs: Handle error of rpc_proc_register() in nfs_net_init().")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/client.c   | 5 ++++-
+ fs/nfs/inode.c    | 4 +++-
+ fs/nfs/internal.h | 2 --
+ fs/nfs/netns.h    | 2 ++
+ 4 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/fs/nfs/client.c b/fs/nfs/client.c
+index f50e025ae4064..755256875052f 100644
+--- a/fs/nfs/client.c
++++ b/fs/nfs/client.c
+@@ -73,7 +73,6 @@ const struct rpc_program nfs_program = {
+       .number                 = NFS_PROGRAM,
+       .nrvers                 = ARRAY_SIZE(nfs_version),
+       .version                = nfs_version,
+-      .stats                  = &nfs_rpcstat,
+       .pipe_dir_name          = NFS_PIPE_DIRNAME,
+ };
+@@ -496,6 +495,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
+                         const struct nfs_client_initdata *cl_init,
+                         rpc_authflavor_t flavor)
+ {
++      struct nfs_net          *nn = net_generic(clp->cl_net, nfs_net_id);
+       struct rpc_clnt         *clnt = NULL;
+       struct rpc_create_args args = {
+               .net            = clp->cl_net,
+@@ -507,6 +507,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
+               .servername     = clp->cl_hostname,
+               .nodename       = cl_init->nodename,
+               .program        = &nfs_program,
++              .stats          = &nn->rpcstats,
+               .version        = clp->rpc_ops->version,
+               .authflavor     = flavor,
+               .cred           = cl_init->cred,
+@@ -1142,6 +1143,8 @@ void nfs_clients_init(struct net *net)
+ #endif
+       spin_lock_init(&nn->nfs_client_lock);
+       nn->boot_time = ktime_get_real();
++      memset(&nn->rpcstats, 0, sizeof(nn->rpcstats));
++      nn->rpcstats.program = &nfs_program;
+       nfs_netns_sysfs_setup(nn, net);
+ }
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
+index 3cdb8daa6d6a9..fae1e009cd6cf 100644
+--- a/fs/nfs/inode.c
++++ b/fs/nfs/inode.c
+@@ -2333,8 +2333,10 @@ EXPORT_SYMBOL_GPL(nfs_net_id);
+ static int nfs_net_init(struct net *net)
+ {
++      struct nfs_net *nn = net_generic(net, nfs_net_id);
++
+       nfs_clients_init(net);
+-      rpc_proc_register(net, &nfs_rpcstat);
++      rpc_proc_register(net, &nn->rpcstats);
+       return nfs_fs_proc_net_init(net);
+ }
+diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
+index 35a8ae46b6c34..b3b801e7c4bc5 100644
+--- a/fs/nfs/internal.h
++++ b/fs/nfs/internal.h
+@@ -443,8 +443,6 @@ int nfs_try_get_tree(struct fs_context *);
+ int nfs_get_tree_common(struct fs_context *);
+ void nfs_kill_super(struct super_block *);
+-extern struct rpc_stat nfs_rpcstat;
+-
+ extern int __init register_nfs_fs(void);
+ extern void __exit unregister_nfs_fs(void);
+ extern bool nfs_sb_active(struct super_block *sb);
+diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h
+index c8374f74dce11..a68b21603ea9a 100644
+--- a/fs/nfs/netns.h
++++ b/fs/nfs/netns.h
+@@ -9,6 +9,7 @@
+ #include <linux/nfs4.h>
+ #include <net/net_namespace.h>
+ #include <net/netns/generic.h>
++#include <linux/sunrpc/stats.h>
+ struct bl_dev_msg {
+       int32_t status;
+@@ -34,6 +35,7 @@ struct nfs_net {
+       struct nfs_netns_client *nfs_client;
+       spinlock_t nfs_client_lock;
+       ktime_t boot_time;
++      struct rpc_stat rpcstats;
+ #ifdef CONFIG_PROC_FS
+       struct proc_dir_entry *proc_nfsfs;
+ #endif
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-baytrail-fix-selecting-gpio-pinctrl-state.patch b/queue-6.1/pinctrl-baytrail-fix-selecting-gpio-pinctrl-state.patch
new file mode 100644 (file)
index 0000000..f5ddff8
--- /dev/null
@@ -0,0 +1,164 @@
+From 7fa15f3b1b972240905fd16734823124b8f64822 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 7 Apr 2024 19:50:48 +0200
+Subject: pinctrl: baytrail: Fix selecting gpio pinctrl state
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit fed6d9a8e6a60ecf6506d0ea004040fbaa109927 ]
+
+For all the "score" pin-groups all the intel_pingroup-s to select
+the non GPIO function are re-used for byt_score_gpio_groups[].
+
+But this is incorrect since a pin-group includes the mode setting,
+which for the non GPIO functions generally is 1, where as to select
+the GPIO function mode must be set to 0.
+
+So the GPIO function needs separate intel_pingroup-s with their own mode
+value of 0.
+
+Add a new PIN_GROUP_GPIO macro which adds a foo_gpio entry to each
+pin-group defined this way and update byt_score_gpio_groups[] to point
+to the new foo_gpio entries.
+
+The "sus" usb_oc_grp usb_ulpi_grp and pcu_spi_grp pin-groups are special
+because these have a non 0 mode value to select the GPIO functions and
+these already have matching foo_gpio pin-groups, leave these are unchanged.
+
+The pmu_clk "sus" groups added in commit 2f46d7f7e959 ("pinctrl: baytrail:
+Add pinconf group + function for the pmu_clk") do need to use the new
+PIN_GROUP_GPIO macro.
+
+Fixes: 2f46d7f7e959 ("pinctrl: baytrail: Add pinconf group + function for the pmu_clk")
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/intel/pinctrl-baytrail.c | 74 ++++++++++++------------
+ drivers/pinctrl/intel/pinctrl-intel.h    |  4 ++
+ 2 files changed, 42 insertions(+), 36 deletions(-)
+
+diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
+index 67db79f380510..a0b7b16cb4de3 100644
+--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
+@@ -276,33 +276,33 @@ static const unsigned int byt_score_plt_clk5_pins[] = { 101 };
+ static const unsigned int byt_score_smbus_pins[] = { 51, 52, 53 };
+ static const struct intel_pingroup byt_score_groups[] = {
+-      PIN_GROUP("uart1_grp", byt_score_uart1_pins, 1),
+-      PIN_GROUP("uart2_grp", byt_score_uart2_pins, 1),
+-      PIN_GROUP("pwm0_grp", byt_score_pwm0_pins, 1),
+-      PIN_GROUP("pwm1_grp", byt_score_pwm1_pins, 1),
+-      PIN_GROUP("ssp2_grp", byt_score_ssp2_pins, 1),
+-      PIN_GROUP("sio_spi_grp", byt_score_sio_spi_pins, 1),
+-      PIN_GROUP("i2c5_grp", byt_score_i2c5_pins, 1),
+-      PIN_GROUP("i2c6_grp", byt_score_i2c6_pins, 1),
+-      PIN_GROUP("i2c4_grp", byt_score_i2c4_pins, 1),
+-      PIN_GROUP("i2c3_grp", byt_score_i2c3_pins, 1),
+-      PIN_GROUP("i2c2_grp", byt_score_i2c2_pins, 1),
+-      PIN_GROUP("i2c1_grp", byt_score_i2c1_pins, 1),
+-      PIN_GROUP("i2c0_grp", byt_score_i2c0_pins, 1),
+-      PIN_GROUP("ssp0_grp", byt_score_ssp0_pins, 1),
+-      PIN_GROUP("ssp1_grp", byt_score_ssp1_pins, 1),
+-      PIN_GROUP("sdcard_grp", byt_score_sdcard_pins, byt_score_sdcard_mux_values),
+-      PIN_GROUP("sdio_grp", byt_score_sdio_pins, 1),
+-      PIN_GROUP("emmc_grp", byt_score_emmc_pins, 1),
+-      PIN_GROUP("lpc_grp", byt_score_ilb_lpc_pins, 1),
+-      PIN_GROUP("sata_grp", byt_score_sata_pins, 1),
+-      PIN_GROUP("plt_clk0_grp", byt_score_plt_clk0_pins, 1),
+-      PIN_GROUP("plt_clk1_grp", byt_score_plt_clk1_pins, 1),
+-      PIN_GROUP("plt_clk2_grp", byt_score_plt_clk2_pins, 1),
+-      PIN_GROUP("plt_clk3_grp", byt_score_plt_clk3_pins, 1),
+-      PIN_GROUP("plt_clk4_grp", byt_score_plt_clk4_pins, 1),
+-      PIN_GROUP("plt_clk5_grp", byt_score_plt_clk5_pins, 1),
+-      PIN_GROUP("smbus_grp", byt_score_smbus_pins, 1),
++      PIN_GROUP_GPIO("uart1_grp", byt_score_uart1_pins, 1),
++      PIN_GROUP_GPIO("uart2_grp", byt_score_uart2_pins, 1),
++      PIN_GROUP_GPIO("pwm0_grp", byt_score_pwm0_pins, 1),
++      PIN_GROUP_GPIO("pwm1_grp", byt_score_pwm1_pins, 1),
++      PIN_GROUP_GPIO("ssp2_grp", byt_score_ssp2_pins, 1),
++      PIN_GROUP_GPIO("sio_spi_grp", byt_score_sio_spi_pins, 1),
++      PIN_GROUP_GPIO("i2c5_grp", byt_score_i2c5_pins, 1),
++      PIN_GROUP_GPIO("i2c6_grp", byt_score_i2c6_pins, 1),
++      PIN_GROUP_GPIO("i2c4_grp", byt_score_i2c4_pins, 1),
++      PIN_GROUP_GPIO("i2c3_grp", byt_score_i2c3_pins, 1),
++      PIN_GROUP_GPIO("i2c2_grp", byt_score_i2c2_pins, 1),
++      PIN_GROUP_GPIO("i2c1_grp", byt_score_i2c1_pins, 1),
++      PIN_GROUP_GPIO("i2c0_grp", byt_score_i2c0_pins, 1),
++      PIN_GROUP_GPIO("ssp0_grp", byt_score_ssp0_pins, 1),
++      PIN_GROUP_GPIO("ssp1_grp", byt_score_ssp1_pins, 1),
++      PIN_GROUP_GPIO("sdcard_grp", byt_score_sdcard_pins, byt_score_sdcard_mux_values),
++      PIN_GROUP_GPIO("sdio_grp", byt_score_sdio_pins, 1),
++      PIN_GROUP_GPIO("emmc_grp", byt_score_emmc_pins, 1),
++      PIN_GROUP_GPIO("lpc_grp", byt_score_ilb_lpc_pins, 1),
++      PIN_GROUP_GPIO("sata_grp", byt_score_sata_pins, 1),
++      PIN_GROUP_GPIO("plt_clk0_grp", byt_score_plt_clk0_pins, 1),
++      PIN_GROUP_GPIO("plt_clk1_grp", byt_score_plt_clk1_pins, 1),
++      PIN_GROUP_GPIO("plt_clk2_grp", byt_score_plt_clk2_pins, 1),
++      PIN_GROUP_GPIO("plt_clk3_grp", byt_score_plt_clk3_pins, 1),
++      PIN_GROUP_GPIO("plt_clk4_grp", byt_score_plt_clk4_pins, 1),
++      PIN_GROUP_GPIO("plt_clk5_grp", byt_score_plt_clk5_pins, 1),
++      PIN_GROUP_GPIO("smbus_grp", byt_score_smbus_pins, 1),
+ };
+ static const char * const byt_score_uart_groups[] = {
+@@ -330,12 +330,14 @@ static const char * const byt_score_plt_clk_groups[] = {
+ };
+ static const char * const byt_score_smbus_groups[] = { "smbus_grp" };
+ static const char * const byt_score_gpio_groups[] = {
+-      "uart1_grp", "uart2_grp", "pwm0_grp", "pwm1_grp", "ssp0_grp",
+-      "ssp1_grp", "ssp2_grp", "sio_spi_grp", "i2c0_grp", "i2c1_grp",
+-      "i2c2_grp", "i2c3_grp", "i2c4_grp", "i2c5_grp", "i2c6_grp",
+-      "sdcard_grp", "sdio_grp", "emmc_grp", "lpc_grp", "sata_grp",
+-      "plt_clk0_grp", "plt_clk1_grp", "plt_clk2_grp", "plt_clk3_grp",
+-      "plt_clk4_grp", "plt_clk5_grp", "smbus_grp",
++      "uart1_grp_gpio", "uart2_grp_gpio", "pwm0_grp_gpio",
++      "pwm1_grp_gpio", "ssp0_grp_gpio", "ssp1_grp_gpio", "ssp2_grp_gpio",
++      "sio_spi_grp_gpio", "i2c0_grp_gpio", "i2c1_grp_gpio", "i2c2_grp_gpio",
++      "i2c3_grp_gpio", "i2c4_grp_gpio", "i2c5_grp_gpio", "i2c6_grp_gpio",
++      "sdcard_grp_gpio", "sdio_grp_gpio", "emmc_grp_gpio", "lpc_grp_gpio",
++      "sata_grp_gpio", "plt_clk0_grp_gpio", "plt_clk1_grp_gpio",
++      "plt_clk2_grp_gpio", "plt_clk3_grp_gpio", "plt_clk4_grp_gpio",
++      "plt_clk5_grp_gpio", "smbus_grp_gpio",
+ };
+ static const struct intel_function byt_score_functions[] = {
+@@ -454,8 +456,8 @@ static const struct intel_pingroup byt_sus_groups[] = {
+       PIN_GROUP("usb_oc_grp_gpio", byt_sus_usb_over_current_pins, byt_sus_usb_over_current_gpio_mode_values),
+       PIN_GROUP("usb_ulpi_grp_gpio", byt_sus_usb_ulpi_pins, byt_sus_usb_ulpi_gpio_mode_values),
+       PIN_GROUP("pcu_spi_grp_gpio", byt_sus_pcu_spi_pins, byt_sus_pcu_spi_gpio_mode_values),
+-      PIN_GROUP("pmu_clk1_grp", byt_sus_pmu_clk1_pins, 1),
+-      PIN_GROUP("pmu_clk2_grp", byt_sus_pmu_clk2_pins, 1),
++      PIN_GROUP_GPIO("pmu_clk1_grp", byt_sus_pmu_clk1_pins, 1),
++      PIN_GROUP_GPIO("pmu_clk2_grp", byt_sus_pmu_clk2_pins, 1),
+ };
+ static const char * const byt_sus_usb_groups[] = {
+@@ -467,7 +469,7 @@ static const char * const byt_sus_pmu_clk_groups[] = {
+ };
+ static const char * const byt_sus_gpio_groups[] = {
+       "usb_oc_grp_gpio", "usb_ulpi_grp_gpio", "pcu_spi_grp_gpio",
+-      "pmu_clk1_grp", "pmu_clk2_grp",
++      "pmu_clk1_grp_gpio", "pmu_clk2_grp_gpio",
+ };
+ static const struct intel_function byt_sus_functions[] = {
+diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h
+index 46f5f7d1565fe..0d45063435ebc 100644
+--- a/drivers/pinctrl/intel/pinctrl-intel.h
++++ b/drivers/pinctrl/intel/pinctrl-intel.h
+@@ -160,6 +160,10 @@ struct intel_community {
+               .modes = __builtin_choose_expr(__builtin_constant_p((m)), NULL, (m)),   \
+       }
++#define PIN_GROUP_GPIO(n, p, m)                                               \
++       PIN_GROUP(n, p, m),                                            \
++       PIN_GROUP(n "_gpio", p, 0)
++
+ #define FUNCTION(n, g)                                                        \
+       {                                                               \
+               .func = PINCTRL_PINFUNCTION((n), (g), ARRAY_SIZE(g)),   \
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-core-delete-incorrect-free-in-pinctrl_enable.patch b/queue-6.1/pinctrl-core-delete-incorrect-free-in-pinctrl_enable.patch
new file mode 100644 (file)
index 0000000..9cd2dd9
--- /dev/null
@@ -0,0 +1,47 @@
+From 22ede83cc44847d18bab5940f32d0040de2514b6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Mar 2024 09:38:39 +0300
+Subject: pinctrl: core: delete incorrect free in pinctrl_enable()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit 5038a66dad0199de60e5671603ea6623eb9e5c79 ]
+
+The "pctldev" struct is allocated in devm_pinctrl_register_and_init().
+It's a devm_ managed pointer that is freed by devm_pinctrl_dev_release(),
+so freeing it in pinctrl_enable() will lead to a double free.
+
+The devm_pinctrl_dev_release() function frees the pindescs and destroys
+the mutex as well.
+
+Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()")
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Message-ID: <578fbe56-44e9-487c-ae95-29b695650f7c@moroto.mountain>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/core.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
+index f1962866bb814..1ef36a0a7dd20 100644
+--- a/drivers/pinctrl/core.c
++++ b/drivers/pinctrl/core.c
+@@ -2098,13 +2098,7 @@ int pinctrl_enable(struct pinctrl_dev *pctldev)
+       error = pinctrl_claim_hogs(pctldev);
+       if (error) {
+-              dev_err(pctldev->dev, "could not claim hogs: %i\n",
+-                      error);
+-              pinctrl_free_pindescs(pctldev, pctldev->desc->pins,
+-                                    pctldev->desc->npins);
+-              mutex_destroy(&pctldev->mutex);
+-              kfree(pctldev);
+-
++              dev_err(pctldev->dev, "could not claim hogs: %i\n", error);
+               return error;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-devicetree-fix-refcount-leak-in-pinctrl_dt_t.patch b/queue-6.1/pinctrl-devicetree-fix-refcount-leak-in-pinctrl_dt_t.patch
new file mode 100644 (file)
index 0000000..7213c2d
--- /dev/null
@@ -0,0 +1,52 @@
+From de32907cebc567387f0cbc2218eaac6181d3c9cb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Apr 2024 18:53:28 +0800
+Subject: pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()
+
+From: Zeng Heng <zengheng4@huawei.com>
+
+[ Upstream commit a0cedbcc8852d6c77b00634b81e41f17f29d9404 ]
+
+If we fail to allocate propname buffer, we need to drop the reference
+count we just took. Because the pinctrl_dt_free_maps() includes the
+droping operation, here we call it directly.
+
+Fixes: 91d5c5060ee2 ("pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map")
+Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
+Signed-off-by: Zeng Heng <zengheng4@huawei.com>
+Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
+Message-ID: <20240415105328.3651441-1-zengheng4@huawei.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/devicetree.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
+index 6e0a40962f384..5ee746cb81f59 100644
+--- a/drivers/pinctrl/devicetree.c
++++ b/drivers/pinctrl/devicetree.c
+@@ -220,14 +220,16 @@ int pinctrl_dt_to_map(struct pinctrl *p, struct pinctrl_dev *pctldev)
+       for (state = 0; ; state++) {
+               /* Retrieve the pinctrl-* property */
+               propname = kasprintf(GFP_KERNEL, "pinctrl-%d", state);
+-              if (!propname)
+-                      return -ENOMEM;
++              if (!propname) {
++                      ret = -ENOMEM;
++                      goto err;
++              }
+               prop = of_find_property(np, propname, &size);
+               kfree(propname);
+               if (!prop) {
+                       if (state == 0) {
+-                              of_node_put(np);
+-                              return -ENODEV;
++                              ret = -ENODEV;
++                              goto err;
+                       }
+                       break;
+               }
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-intel-make-use-of-struct-pinfunction-and-pin.patch b/queue-6.1/pinctrl-intel-make-use-of-struct-pinfunction-and-pin.patch
new file mode 100644 (file)
index 0000000..3b416cf
--- /dev/null
@@ -0,0 +1,85 @@
+From 69f973f4ac12057ac9555fe5f88fcd95702c1c4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 19 Dec 2022 14:42:34 +0200
+Subject: pinctrl: intel: Make use of struct pinfunction and
+ PINCTRL_PINFUNCTION()
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit 999b85bfd765f273208cd7348b2977d3c5ae0753 ]
+
+Since pin control provides a generic data type and a macro for
+the pin function definition, use them in the Intel driver.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: fed6d9a8e6a6 ("pinctrl: baytrail: Fix selecting gpio pinctrl state")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/intel/pinctrl-intel.c |  6 +++---
+ drivers/pinctrl/intel/pinctrl-intel.h | 13 ++++++++-----
+ 2 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
+index 954a412267402..8542053d4d6d0 100644
+--- a/drivers/pinctrl/intel/pinctrl-intel.c
++++ b/drivers/pinctrl/intel/pinctrl-intel.c
+@@ -362,7 +362,7 @@ static const char *intel_get_function_name(struct pinctrl_dev *pctldev,
+ {
+       struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
+-      return pctrl->soc->functions[function].name;
++      return pctrl->soc->functions[function].func.name;
+ }
+ static int intel_get_function_groups(struct pinctrl_dev *pctldev,
+@@ -372,8 +372,8 @@ static int intel_get_function_groups(struct pinctrl_dev *pctldev,
+ {
+       struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
+-      *groups = pctrl->soc->functions[function].groups;
+-      *ngroups = pctrl->soc->functions[function].ngroups;
++      *groups = pctrl->soc->functions[function].func.groups;
++      *ngroups = pctrl->soc->functions[function].func.ngroups;
+       return 0;
+ }
+diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h
+index 65628423bf639..46f5f7d1565fe 100644
+--- a/drivers/pinctrl/intel/pinctrl-intel.h
++++ b/drivers/pinctrl/intel/pinctrl-intel.h
+@@ -36,11 +36,13 @@ struct intel_pingroup {
+ /**
+  * struct intel_function - Description about a function
++ * @func: Generic data of the pin function (name and groups of pins)
+  * @name: Name of the function
+  * @groups: An array of groups for this function
+  * @ngroups: Number of groups in @groups
+  */
+ struct intel_function {
++      struct pinfunction func;
+       const char *name;
+       const char * const *groups;
+       size_t ngroups;
+@@ -158,11 +160,12 @@ struct intel_community {
+               .modes = __builtin_choose_expr(__builtin_constant_p((m)), NULL, (m)),   \
+       }
+-#define FUNCTION(n, g)                                \
+-      {                                       \
+-              .name = (n),                    \
+-              .groups = (g),                  \
+-              .ngroups = ARRAY_SIZE((g)),     \
++#define FUNCTION(n, g)                                                        \
++      {                                                               \
++              .func = PINCTRL_PINFUNCTION((n), (g), ARRAY_SIZE(g)),   \
++              .name = (n),                                            \
++              .groups = (g),                                          \
++              .ngroups = ARRAY_SIZE((g)),                             \
+       }
+ /**
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-introduce-struct-pinfunction-and-pinctrl_pin.patch b/queue-6.1/pinctrl-introduce-struct-pinfunction-and-pinctrl_pin.patch
new file mode 100644 (file)
index 0000000..c3b1219
--- /dev/null
@@ -0,0 +1,57 @@
+From 39612392efe92f22459c1f7ce07106c95a0b1aa7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 19 Dec 2022 14:42:33 +0200
+Subject: pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit 443a0a0f0cf4f432c7af6654b7f2f920d411d379 ]
+
+There are many pin control drivers define their own data type for
+pin function representation which is the same or embed the same data
+as newly introduced one. Provide the data type and convenient macro
+for all pin control drivers.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: fed6d9a8e6a6 ("pinctrl: baytrail: Fix selecting gpio pinctrl state")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/pinctrl/pinctrl.h | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
+index 487117ccb1bc2..fb25085d09224 100644
+--- a/include/linux/pinctrl/pinctrl.h
++++ b/include/linux/pinctrl/pinctrl.h
+@@ -206,6 +206,26 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
+                               const char *pin_group, const unsigned **pins,
+                               unsigned *num_pins);
++/**
++ * struct pinfunction - Description about a function
++ * @name: Name of the function
++ * @groups: An array of groups for this function
++ * @ngroups: Number of groups in @groups
++ */
++struct pinfunction {
++      const char *name;
++      const char * const *groups;
++      size_t ngroups;
++};
++
++/* Convenience macro to define a single named pinfunction */
++#define PINCTRL_PINFUNCTION(_name, _groups, _ngroups) \
++(struct pinfunction) {                                        \
++              .name = (_name),                        \
++              .groups = (_groups),                    \
++              .ngroups = (_ngroups),                  \
++      }
++
+ #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL)
+ extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
+ #else
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-mediatek-paris-fix-pin_config_input_schmitt_.patch b/queue-6.1/pinctrl-mediatek-paris-fix-pin_config_input_schmitt_.patch
new file mode 100644 (file)
index 0000000..bbe04c7
--- /dev/null
@@ -0,0 +1,46 @@
+From c009047e59cf35cd4ecae5dbd79e253c386e0674 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Mar 2024 17:13:33 +0800
+Subject: pinctrl: mediatek: paris: Fix PIN_CONFIG_INPUT_SCHMITT_ENABLE
+ readback
+
+From: Chen-Yu Tsai <wenst@chromium.org>
+
+[ Upstream commit 08f66a8edd08f6f7cfa769c81634b29a2b123908 ]
+
+In the generic pin config library, readback of some options are handled
+differently compared to the setting of those options: the argument value
+is used to convey enable/disable of an option in the set path, but
+success or -EINVAL is used to convey if an option is enabled or disabled
+in the debugfs readback path.
+
+PIN_CONFIG_INPUT_SCHMITT_ENABLE is one such option. Fix the readback of
+the option in the mediatek-paris library, so that the debugfs dump is
+not showing "input schmitt enabled" for pins that don't have it enabled.
+
+Fixes: 1bea6afbc842 ("pinctrl: mediatek: Refine mtk_pinconf_get()")
+Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Message-ID: <20240327091336.3434141-2-wenst@chromium.org>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/mediatek/pinctrl-paris.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
+index ad873bd051b68..3f2297ee2b765 100644
+--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
+@@ -188,6 +188,8 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev,
+               }
+               err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SMT, &ret);
++              if (!ret)
++                      err = -EINVAL;
+               break;
+       case PIN_CONFIG_DRIVE_STRENGTH:
+               if (!hw->soc->drive_get)
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-mediatek-paris-rework-support-for-pin_config.patch b/queue-6.1/pinctrl-mediatek-paris-rework-support-for-pin_config.patch
new file mode 100644 (file)
index 0000000..948a7e3
--- /dev/null
@@ -0,0 +1,107 @@
+From 0eba00fbf8ec3e10b77d82bb93e4d6ba50514ab2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Mar 2024 17:13:34 +0800
+Subject: pinctrl: mediatek: paris: Rework support for
+ PIN_CONFIG_{INPUT,OUTPUT}_ENABLE
+
+From: Chen-Yu Tsai <wenst@chromium.org>
+
+[ Upstream commit c5d3b64c568a344e998830e0e94a7c04e372f89b ]
+
+There is a misinterpretation of some of the PIN_CONFIG_* options in this
+driver library. PIN_CONFIG_OUTPUT_ENABLE should refer to a buffer or
+switch in the output direction of the electrical path. The MediaTek
+hardware does not have such a thing. The driver incorrectly maps this
+option to the GPIO function's direction.
+
+Likewise, PIN_CONFIG_INPUT_ENABLE should refer to a buffer or switch in
+the input direction. The hardware does have such a mechanism, and is
+mapped to the IES bit. The driver however sets the direction in addition
+to the IES bit, which is incorrect. On readback, the IES bit isn't even
+considered.
+
+Ironically, the driver does not support readback for PIN_CONFIG_OUTPUT,
+while its readback of PIN_CONFIG_{INPUT,OUTPUT}_ENABLE is what it should
+be doing for PIN_CONFIG_OUTPUT.
+
+Rework support for these three options, so that PIN_CONFIG_OUTPUT_ENABLE
+is completely removed, PIN_CONFIG_INPUT_ENABLE is only linked to the IES
+bit, and PIN_CONFIG_OUTPUT is linked to the GPIO function's direction
+and output level.
+
+Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
+Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Message-ID: <20240327091336.3434141-3-wenst@chromium.org>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/mediatek/pinctrl-paris.c | 38 +++++++-----------------
+ 1 file changed, 11 insertions(+), 27 deletions(-)
+
+diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
+index 3f2297ee2b765..ee72c6894a5d7 100644
+--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
+@@ -160,20 +160,21 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev,
+               err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SR, &ret);
+               break;
+       case PIN_CONFIG_INPUT_ENABLE:
+-      case PIN_CONFIG_OUTPUT_ENABLE:
++              err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_IES, &ret);
++              if (!ret)
++                      err = -EINVAL;
++              break;
++      case PIN_CONFIG_OUTPUT:
+               err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret);
+               if (err)
+                       break;
+-              /*     CONFIG     Current direction return value
+-               * -------------  ----------------- ----------------------
+-               * OUTPUT_ENABLE       output       1 (= HW value)
+-               *                     input        0 (= HW value)
+-               * INPUT_ENABLE        output       0 (= reverse HW value)
+-               *                     input        1 (= reverse HW value)
+-               */
+-              if (param == PIN_CONFIG_INPUT_ENABLE)
+-                      ret = !ret;
++              if (!ret) {
++                      err = -EINVAL;
++                      break;
++              }
++
++              err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DO, &ret);
+               break;
+       case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
+               err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret);
+@@ -278,26 +279,9 @@ static int mtk_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
+                       break;
+               err = hw->soc->bias_set_combo(hw, desc, 0, arg);
+               break;
+-      case PIN_CONFIG_OUTPUT_ENABLE:
+-              err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT,
+-                                     MTK_DISABLE);
+-              /* Keep set direction to consider the case that a GPIO pin
+-               *  does not have SMT control
+-               */
+-              if (err != -ENOTSUPP)
+-                      break;
+-
+-              err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR,
+-                                     MTK_OUTPUT);
+-              break;
+       case PIN_CONFIG_INPUT_ENABLE:
+               /* regard all non-zero value as enable */
+               err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_IES, !!arg);
+-              if (err)
+-                      break;
+-
+-              err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR,
+-                                     MTK_INPUT);
+               break;
+       case PIN_CONFIG_SLEW_RATE:
+               /* regard all non-zero value as enable */
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-meson-fix-typo-in-pdm-s-pin-name.patch b/queue-6.1/pinctrl-meson-fix-typo-in-pdm-s-pin-name.patch
new file mode 100644 (file)
index 0000000..4ae1901
--- /dev/null
@@ -0,0 +1,56 @@
+From 3d2fbb3bbde372d55b64ea7d5bb21cf162adc2a2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 14:30:58 +0300
+Subject: pinctrl/meson: fix typo in PDM's pin name
+
+From: Jan Dakinevich <jan.dakinevich@salutedevices.com>
+
+[ Upstream commit 368a90e651faeeb7049a876599cf2b0d74954796 ]
+
+Other pins have _a or _x suffix, but this one doesn't have any. Most
+likely this is a typo.
+
+Fixes: dabad1ff8561 ("pinctrl: meson: add pinctrl driver support for Meson-A1 SoC")
+Signed-off-by: Jan Dakinevich <jan.dakinevich@salutedevices.com>
+Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
+Message-ID: <20240325113058.248022-1-jan.dakinevich@salutedevices.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/meson/pinctrl-meson-a1.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/pinctrl/meson/pinctrl-meson-a1.c b/drivers/pinctrl/meson/pinctrl-meson-a1.c
+index 79f5d753d7e1a..50a87d9618a8e 100644
+--- a/drivers/pinctrl/meson/pinctrl-meson-a1.c
++++ b/drivers/pinctrl/meson/pinctrl-meson-a1.c
+@@ -250,7 +250,7 @@ static const unsigned int pdm_dclk_x_pins[]                = { GPIOX_10 };
+ static const unsigned int pdm_din2_a_pins[]           = { GPIOA_6 };
+ static const unsigned int pdm_din1_a_pins[]           = { GPIOA_7 };
+ static const unsigned int pdm_din0_a_pins[]           = { GPIOA_8 };
+-static const unsigned int pdm_dclk_pins[]             = { GPIOA_9 };
++static const unsigned int pdm_dclk_a_pins[]           = { GPIOA_9 };
+ /* gen_clk */
+ static const unsigned int gen_clk_x_pins[]            = { GPIOX_7 };
+@@ -591,7 +591,7 @@ static struct meson_pmx_group meson_a1_periphs_groups[] = {
+       GROUP(pdm_din2_a,               3),
+       GROUP(pdm_din1_a,               3),
+       GROUP(pdm_din0_a,               3),
+-      GROUP(pdm_dclk,                 3),
++      GROUP(pdm_dclk_a,               3),
+       GROUP(pwm_c_a,                  3),
+       GROUP(pwm_b_a,                  3),
+@@ -755,7 +755,7 @@ static const char * const spi_a_groups[] = {
+ static const char * const pdm_groups[] = {
+       "pdm_din0_x", "pdm_din1_x", "pdm_din2_x", "pdm_dclk_x", "pdm_din2_a",
+-      "pdm_din1_a", "pdm_din0_a", "pdm_dclk",
++      "pdm_din1_a", "pdm_din0_a", "pdm_dclk_a",
+ };
+ static const char * const gen_clk_groups[] = {
+-- 
+2.43.0
+
diff --git a/queue-6.1/pinctrl-pinctrl-aspeed-g6-fix-register-offset-for-pi.patch b/queue-6.1/pinctrl-pinctrl-aspeed-g6-fix-register-offset-for-pi.patch
new file mode 100644 (file)
index 0000000..9e3c96f
--- /dev/null
@@ -0,0 +1,97 @@
+From a3c3beaaa466e586190372118117b8fa72ad5e62 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Mar 2024 17:28:09 +0800
+Subject: pinctrl: pinctrl-aspeed-g6: Fix register offset for pinconf of
+ GPIOR-T
+
+From: Billy Tsai <billy_tsai@aspeedtech.com>
+
+[ Upstream commit c10cd03d69403fa0f00be8631bd4cb4690440ebd ]
+
+The register offset to disable the internal pull-down of GPIOR~T is 0x630
+instead of 0x620, as specified in the Ast2600 datasheet v15
+The datasheet can download from the official Aspeed website.
+
+Fixes: 15711ba6ff19 ("pinctrl: aspeed-g6: Add AST2600 pinconf support")
+Reported-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
+Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
+Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
+Message-ID: <20240313092809.2596644-1-billy_tsai@aspeedtech.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c | 34 +++++++++++-----------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c
+index 80838dc54b3ab..7938741136a2c 100644
+--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c
++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c
+@@ -43,7 +43,7 @@
+ #define SCU614                0x614 /* Disable GPIO Internal Pull-Down #1 */
+ #define SCU618                0x618 /* Disable GPIO Internal Pull-Down #2 */
+ #define SCU61C                0x61c /* Disable GPIO Internal Pull-Down #3 */
+-#define SCU620                0x620 /* Disable GPIO Internal Pull-Down #4 */
++#define SCU630                0x630 /* Disable GPIO Internal Pull-Down #4 */
+ #define SCU634                0x634 /* Disable GPIO Internal Pull-Down #5 */
+ #define SCU638                0x638 /* Disable GPIO Internal Pull-Down #6 */
+ #define SCU690                0x690 /* Multi-function Pin Control #24 */
+@@ -2494,38 +2494,38 @@ static struct aspeed_pin_config aspeed_g6_configs[] = {
+       ASPEED_PULL_DOWN_PINCONF(D14, SCU61C, 0),
+       /* GPIOS7 */
+-      ASPEED_PULL_DOWN_PINCONF(T24, SCU620, 23),
++      ASPEED_PULL_DOWN_PINCONF(T24, SCU630, 23),
+       /* GPIOS6 */
+-      ASPEED_PULL_DOWN_PINCONF(P23, SCU620, 22),
++      ASPEED_PULL_DOWN_PINCONF(P23, SCU630, 22),
+       /* GPIOS5 */
+-      ASPEED_PULL_DOWN_PINCONF(P24, SCU620, 21),
++      ASPEED_PULL_DOWN_PINCONF(P24, SCU630, 21),
+       /* GPIOS4 */
+-      ASPEED_PULL_DOWN_PINCONF(R26, SCU620, 20),
++      ASPEED_PULL_DOWN_PINCONF(R26, SCU630, 20),
+       /* GPIOS3*/
+-      ASPEED_PULL_DOWN_PINCONF(R24, SCU620, 19),
++      ASPEED_PULL_DOWN_PINCONF(R24, SCU630, 19),
+       /* GPIOS2 */
+-      ASPEED_PULL_DOWN_PINCONF(T26, SCU620, 18),
++      ASPEED_PULL_DOWN_PINCONF(T26, SCU630, 18),
+       /* GPIOS1 */
+-      ASPEED_PULL_DOWN_PINCONF(T25, SCU620, 17),
++      ASPEED_PULL_DOWN_PINCONF(T25, SCU630, 17),
+       /* GPIOS0 */
+-      ASPEED_PULL_DOWN_PINCONF(R23, SCU620, 16),
++      ASPEED_PULL_DOWN_PINCONF(R23, SCU630, 16),
+       /* GPIOR7 */
+-      ASPEED_PULL_DOWN_PINCONF(U26, SCU620, 15),
++      ASPEED_PULL_DOWN_PINCONF(U26, SCU630, 15),
+       /* GPIOR6 */
+-      ASPEED_PULL_DOWN_PINCONF(W26, SCU620, 14),
++      ASPEED_PULL_DOWN_PINCONF(W26, SCU630, 14),
+       /* GPIOR5 */
+-      ASPEED_PULL_DOWN_PINCONF(T23, SCU620, 13),
++      ASPEED_PULL_DOWN_PINCONF(T23, SCU630, 13),
+       /* GPIOR4 */
+-      ASPEED_PULL_DOWN_PINCONF(U25, SCU620, 12),
++      ASPEED_PULL_DOWN_PINCONF(U25, SCU630, 12),
+       /* GPIOR3*/
+-      ASPEED_PULL_DOWN_PINCONF(V26, SCU620, 11),
++      ASPEED_PULL_DOWN_PINCONF(V26, SCU630, 11),
+       /* GPIOR2 */
+-      ASPEED_PULL_DOWN_PINCONF(V24, SCU620, 10),
++      ASPEED_PULL_DOWN_PINCONF(V24, SCU630, 10),
+       /* GPIOR1 */
+-      ASPEED_PULL_DOWN_PINCONF(U24, SCU620, 9),
++      ASPEED_PULL_DOWN_PINCONF(U24, SCU630, 9),
+       /* GPIOR0 */
+-      ASPEED_PULL_DOWN_PINCONF(V25, SCU620, 8),
++      ASPEED_PULL_DOWN_PINCONF(V25, SCU630, 8),
+       /* GPIOX7 */
+       ASPEED_PULL_DOWN_PINCONF(AB10, SCU634, 31),
+-- 
+2.43.0
+
diff --git a/queue-6.1/power-rt9455-hide-unused-rt9455_boost_voltage_values.patch b/queue-6.1/power-rt9455-hide-unused-rt9455_boost_voltage_values.patch
new file mode 100644 (file)
index 0000000..6baf766
--- /dev/null
@@ -0,0 +1,48 @@
+From 43332604fbef547039ef169127f457519f25907b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 10:06:27 +0200
+Subject: power: rt9455: hide unused rt9455_boost_voltage_values
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 452d8950db3e839aba1bb13bc5378f4bac11fa04 ]
+
+The rt9455_boost_voltage_values[] array is only used when USB PHY
+support is enabled, causing a W=1 warning otherwise:
+
+drivers/power/supply/rt9455_charger.c:200:18: error: 'rt9455_boost_voltage_values' defined but not used [-Werror=unused-const-variable=]
+
+Enclose the definition in the same #ifdef as the references to it.
+
+Fixes: e86d69dd786e ("power_supply: Add support for Richtek RT9455 battery charger")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20240403080702.3509288-10-arnd@kernel.org
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/power/supply/rt9455_charger.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/power/supply/rt9455_charger.c b/drivers/power/supply/rt9455_charger.c
+index 72962286d7045..c5597967a0699 100644
+--- a/drivers/power/supply/rt9455_charger.c
++++ b/drivers/power/supply/rt9455_charger.c
+@@ -193,6 +193,7 @@ static const int rt9455_voreg_values[] = {
+       4450000, 4450000, 4450000, 4450000, 4450000, 4450000, 4450000, 4450000
+ };
++#if IS_ENABLED(CONFIG_USB_PHY)
+ /*
+  * When the charger is in boost mode, REG02[7:2] represent boost output
+  * voltage.
+@@ -208,6 +209,7 @@ static const int rt9455_boost_voltage_values[] = {
+       5600000, 5600000, 5600000, 5600000, 5600000, 5600000, 5600000, 5600000,
+       5600000, 5600000, 5600000, 5600000, 5600000, 5600000, 5600000, 5600000,
+ };
++#endif
+ /* REG07[3:0] (VMREG) in uV */
+ static const int rt9455_vmreg_values[] = {
+-- 
+2.43.0
+
diff --git a/queue-6.1/power-supply-mt6360_charger-fix-of_match-for-usb-otg.patch b/queue-6.1/power-supply-mt6360_charger-fix-of_match-for-usb-otg.patch
new file mode 100644 (file)
index 0000000..3d24f4b
--- /dev/null
@@ -0,0 +1,46 @@
+From 0e9a12dd4eb10d7a473bec5bd3527566c3af8b12 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Apr 2024 10:44:05 +0200
+Subject: power: supply: mt6360_charger: Fix of_match for usb-otg-vbus
+ regulator
+
+From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+
+[ Upstream commit 1e0fb113646182e073539db96016b00cfeb18ecc ]
+
+The of_match shall correspond to the name of the regulator subnode,
+or the deprecated `regulator-compatible` property must be used:
+failing to do so, the regulator won't probe (and the driver will
+as well not probe).
+
+Since the devicetree binding for this driver is actually correct
+and wants DTs to use the "usb-otg-vbus-regulator" subnode name,
+fix this driver by aligning the `of_match` string to what the DT
+binding wants.
+
+Fixes: 0402e8ebb8b8 ("power: supply: mt6360_charger: add MT6360 charger support")
+Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
+Link: https://lore.kernel.org/r/20240410084405.1389378-1-angelogioacchino.delregno@collabora.com
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/power/supply/mt6360_charger.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c
+index f1248faf59058..383bf19819dfb 100644
+--- a/drivers/power/supply/mt6360_charger.c
++++ b/drivers/power/supply/mt6360_charger.c
+@@ -591,7 +591,7 @@ static const struct regulator_ops mt6360_chg_otg_ops = {
+ };
+ static const struct regulator_desc mt6360_otg_rdesc = {
+-      .of_match = "usb-otg-vbus",
++      .of_match = "usb-otg-vbus-regulator",
+       .name = "usb-otg-vbus",
+       .ops = &mt6360_chg_otg_ops,
+       .owner = THIS_MODULE,
+-- 
+2.43.0
+
diff --git a/queue-6.1/regulator-change-devm_regulator_get_enable_optional-.patch b/queue-6.1/regulator-change-devm_regulator_get_enable_optional-.patch
new file mode 100644 (file)
index 0000000..78794b6
--- /dev/null
@@ -0,0 +1,52 @@
+From fd60fdd4d4eb2ec29365e10ce515b399313a8737 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Apr 2024 14:38:28 +0300
+Subject: regulator: change devm_regulator_get_enable_optional() stub to return
+ Ok
+
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+
+[ Upstream commit ff33132605c1a0acea59e4c523cb7c6fabe856b2 ]
+
+The devm_regulator_get_enable_optional() should be a 'call and forget'
+API, meaning, when it is used to enable the regulators, the API does not
+provide a handle to do any further control of the regulators. It gives
+no real benefit to return an error from the stub if CONFIG_REGULATOR is
+not set.
+
+On the contrary, returning an error is causing problems to drivers when
+hardware is such it works out just fine with no regulator control.
+Returning an error forces drivers to specifically handle the case where
+CONFIG_REGULATOR is not set, making the mere existence of the stub
+questionalble.
+
+Change the stub implementation for the
+devm_regulator_get_enable_optional() to return Ok so drivers do not
+separately handle the case where the CONFIG_REGULATOR is not set.
+
+Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Fixes: da279e6965b3 ("regulator: Add devm helpers for get and enable")
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/ZiedtOE00Zozd3XO@fedora
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/regulator/consumer.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
+index eea165685588a..a9ca87a8f4e61 100644
+--- a/include/linux/regulator/consumer.h
++++ b/include/linux/regulator/consumer.h
+@@ -367,7 +367,7 @@ static inline int devm_regulator_get_enable(struct device *dev, const char *id)
+ static inline int devm_regulator_get_enable_optional(struct device *dev,
+                                                    const char *id)
+ {
+-      return -ENODEV;
++      return 0;
+ }
+ static inline struct regulator *__must_check
+-- 
+2.43.0
+
diff --git a/queue-6.1/regulator-change-stubbed-devm_regulator_get_enable-t.patch b/queue-6.1/regulator-change-stubbed-devm_regulator_get_enable-t.patch
new file mode 100644 (file)
index 0000000..0c38a18
--- /dev/null
@@ -0,0 +1,54 @@
+From 4e3d255f6b10dba8bcff1909bb15e9e48d28ffaf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Apr 2024 09:38:33 +0300
+Subject: regulator: change stubbed devm_regulator_get_enable to return Ok
+
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+
+[ Upstream commit 96e20adc43c4f81e9163a5188cee75a6dd393e09 ]
+
+The devm_regulator_get_enable() should be a 'call and forget' API,
+meaning, when it is used to enable the regulators, the API does not
+provide a handle to do any further control of the regulators. It gives
+no real benefit to return an error from the stub if CONFIG_REGULATOR is
+not set.
+
+On the contrary, returning and error is causing problems to drivers when
+hardware is such it works out just fine with no regulator control.
+Returning an error forces drivers to specifically handle the case where
+CONFIG_REGULATOR is not set, making the mere existence of the stub
+questionalble. Furthermore, the stub of the regulator_enable() seems to
+be returning Ok.
+
+Change the stub implementation for the devm_regulator_get_enable() to
+return Ok so drivers do not separately handle the case where the
+CONFIG_REGULATOR is not set.
+
+Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Reported-by: Aleksander Mazur <deweloper@wp.pl>
+Suggested-by: Guenter Roeck <linux@roeck-us.net>
+Fixes: da279e6965b3 ("regulator: Add devm helpers for get and enable")
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/ZiYF6d1V1vSPcsJS@drtxq0yyyyyyyyyyyyyby-3.rev.dnainternet.fi
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/regulator/consumer.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
+index ee3b4a0146119..eea165685588a 100644
+--- a/include/linux/regulator/consumer.h
++++ b/include/linux/regulator/consumer.h
+@@ -361,7 +361,7 @@ devm_regulator_get_exclusive(struct device *dev, const char *id)
+ static inline int devm_regulator_get_enable(struct device *dev, const char *id)
+ {
+-      return -ENODEV;
++      return 0;
+ }
+ static inline int devm_regulator_get_enable_optional(struct device *dev,
+-- 
+2.43.0
+
diff --git a/queue-6.1/regulator-mt6360-de-capitalize-devicetree-regulator-.patch b/queue-6.1/regulator-mt6360-de-capitalize-devicetree-regulator-.patch
new file mode 100644 (file)
index 0000000..b40fdfe
--- /dev/null
@@ -0,0 +1,93 @@
+From e2fcf2b143cb1d338177b6e7c829aab511b75188 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 9 Apr 2024 16:44:38 +0200
+Subject: regulator: mt6360: De-capitalize devicetree regulator subnodes
+
+From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+
+[ Upstream commit d3cf8a17498dd9104c04ad28eeac3ef3339f9f9f ]
+
+The MT6360 regulator binding, the example in the MT6360 mfd binding, and
+the devicetree users of those bindings are rightfully declaring MT6360
+regulator subnodes with non-capital names, and luckily without using the
+deprecated regulator-compatible property.
+
+With this driver declaring capitalized BUCKx/LDOx as of_match string for
+the node names, obviously no regulator gets probed: fix that by changing
+the MT6360_REGULATOR_DESC macro to add a "match" parameter which gets
+assigned to the of_match.
+
+Fixes: d321571d5e4c ("regulator: mt6360: Add support for MT6360 regulator")
+Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://msgid.link/r/20240409144438.410060-1-angelogioacchino.delregno@collabora.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/mt6360-regulator.c | 32 +++++++++++++++++-----------
+ 1 file changed, 20 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/regulator/mt6360-regulator.c b/drivers/regulator/mt6360-regulator.c
+index 4d34be94d1663..fc464a4450dc5 100644
+--- a/drivers/regulator/mt6360-regulator.c
++++ b/drivers/regulator/mt6360-regulator.c
+@@ -319,15 +319,15 @@ static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
+       }
+ }
+-#define MT6360_REGULATOR_DESC(_name, _sname, ereg, emask, vreg,       vmask,  \
+-                            mreg, mmask, streg, stmask, vranges,      \
+-                            vcnts, offon_delay, irq_tbls)             \
++#define MT6360_REGULATOR_DESC(match, _name, _sname, ereg, emask, vreg,        \
++                            vmask, mreg, mmask, streg, stmask,        \
++                            vranges, vcnts, offon_delay, irq_tbls)    \
+ {                                                                     \
+       .desc = {                                                       \
+               .name = #_name,                                         \
+               .supply_name = #_sname,                                 \
+               .id =  MT6360_REGULATOR_##_name,                        \
+-              .of_match = of_match_ptr(#_name),                       \
++              .of_match = of_match_ptr(match),                        \
+               .regulators_node = of_match_ptr("regulator"),           \
+               .of_map_mode = mt6360_regulator_of_map_mode,            \
+               .owner = THIS_MODULE,                                   \
+@@ -351,21 +351,29 @@ static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
+ }
+ static const struct mt6360_regulator_desc mt6360_regulator_descs[] =  {
+-      MT6360_REGULATOR_DESC(BUCK1, BUCK1_VIN, 0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
++      MT6360_REGULATOR_DESC("buck1", BUCK1, BUCK1_VIN,
++                            0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
+                             buck_vout_ranges, 256, 0, buck1_irq_tbls),
+-      MT6360_REGULATOR_DESC(BUCK2, BUCK2_VIN, 0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
++      MT6360_REGULATOR_DESC("buck2", BUCK2, BUCK2_VIN,
++                            0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
+                             buck_vout_ranges, 256, 0, buck2_irq_tbls),
+-      MT6360_REGULATOR_DESC(LDO6, LDO_VIN3, 0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
++      MT6360_REGULATOR_DESC("ldo6", LDO6, LDO_VIN3,
++                            0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
+                             ldo_vout_ranges1, 256, 0, ldo6_irq_tbls),
+-      MT6360_REGULATOR_DESC(LDO7, LDO_VIN3, 0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
++      MT6360_REGULATOR_DESC("ldo7", LDO7, LDO_VIN3,
++                            0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
+                             ldo_vout_ranges1, 256, 0, ldo7_irq_tbls),
+-      MT6360_REGULATOR_DESC(LDO1, LDO_VIN1, 0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
++      MT6360_REGULATOR_DESC("ldo1", LDO1, LDO_VIN1,
++                            0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
+                             ldo_vout_ranges2, 256, 0, ldo1_irq_tbls),
+-      MT6360_REGULATOR_DESC(LDO2, LDO_VIN1, 0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
++      MT6360_REGULATOR_DESC("ldo2", LDO2, LDO_VIN1,
++                            0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
+                             ldo_vout_ranges2, 256, 0, ldo2_irq_tbls),
+-      MT6360_REGULATOR_DESC(LDO3, LDO_VIN1, 0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
++      MT6360_REGULATOR_DESC("ldo3", LDO3, LDO_VIN1,
++                            0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
+                             ldo_vout_ranges2, 256, 100, ldo3_irq_tbls),
+-      MT6360_REGULATOR_DESC(LDO5, LDO_VIN2, 0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
++      MT6360_REGULATOR_DESC("ldo5", LDO5, LDO_VIN2,
++                            0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
+                             ldo_vout_ranges3, 128, 100, ldo5_irq_tbls),
+ };
+-- 
+2.43.0
+
diff --git a/queue-6.1/rust-kernel-require-send-for-module-implementations.patch b/queue-6.1/rust-kernel-require-send-for-module-implementations.patch
new file mode 100644 (file)
index 0000000..e14e661
--- /dev/null
@@ -0,0 +1,44 @@
+From 2f470e9fd77e885ee2d0201a91b9f926c72f743e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 16:54:54 -0300
+Subject: rust: kernel: require `Send` for `Module` implementations
+
+From: Wedson Almeida Filho <walmeida@microsoft.com>
+
+[ Upstream commit 323617f649c0966ad5e741e47e27e06d3a680d8f ]
+
+The thread that calls the module initialisation code when a module is
+loaded is not guaranteed [in fact, it is unlikely] to be the same one
+that calls the module cleanup code on module unload, therefore, `Module`
+implementations must be `Send` to account for them moving from one
+thread to another implicitly.
+
+Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
+Reviewed-by: Alice Ryhl <aliceryhl@google.com>
+Reviewed-by: Benno Lossin <benno.lossin@proton.me>
+Cc: stable@vger.kernel.org # 6.8.x: df70d04d5697: rust: phy: implement `Send` for `Registration`
+Cc: stable@vger.kernel.org
+Fixes: 247b365dc8dc ("rust: add `kernel` crate")
+Link: https://lore.kernel.org/r/20240328195457.225001-3-wedsonaf@gmail.com
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ rust/kernel/lib.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
+index abd46261d3855..43cf5f6bde9c2 100644
+--- a/rust/kernel/lib.rs
++++ b/rust/kernel/lib.rs
+@@ -37,7 +37,7 @@
+ /// The top level entrypoint to implementing a kernel module.
+ ///
+ /// For any teardown or cleanup operations, your type may implement [`Drop`].
+-pub trait Module: Sized + Sync {
++pub trait Module: Sized + Sync + Send {
+     /// Called at module initialization time.
+     ///
+     /// Use this method to perform whatever setup or registration your module
+-- 
+2.43.0
+
diff --git a/queue-6.1/series b/queue-6.1/series
new file mode 100644 (file)
index 0000000..a3b2bf4
--- /dev/null
@@ -0,0 +1,41 @@
+dmaengine-pl330-issue_pending-waits-until-wfp-state.patch
+dmaengine-revert-dmaengine-pl330-issue_pending-waits.patch
+wifi-nl80211-don-t-free-null-coalescing-rule.patch
+rust-kernel-require-send-for-module-implementations.patch
+eeprom-at24-use-dev_err_probe-for-nvmem-register-fai.patch
+eeprom-at24-probe-for-ddr3-thermal-sensor-in-the-spd.patch
+eeprom-at24-fix-memory-corruption-race-condition.patch
+bluetooth-qca-add-support-for-qca2066.patch
+bluetooth-qca-fix-invalid-device-address-check.patch
+mm-hugetlb-add-folio-support-to-hugetlb-specific-fla.patch
+mm-add-private-field-of-first-tail-to-struct-page-an.patch
+mm-hugetlb-add-hugetlb_folio_subpool-helpers.patch
+mm-hugetlb-add-folio_hstate.patch
+mm-hugetlb_cgroup-convert-__set_hugetlb_cgroup-to-fo.patch
+mm-hugetlb_cgroup-convert-hugetlb_cgroup_from_page-t.patch
+mm-hugetlb-convert-free_huge_page-to-folios.patch
+mm-hugetlb_cgroup-convert-hugetlb_cgroup_uncharge_pa.patch
+mm-hugetlb-fix-missing-hugetlb_lock-for-resv-uncharg.patch
+kbuild-refactor-host-_flags.patch
+kbuild-specify-output-names-separately-for-each-emis.patch
+kbuild-rust-force-alloc-extern-to-allow-empty-rust-f.patch
+cifs-use-the-least-loaded-channel-for-sending-reques.patch
+smb3-missing-lock-when-picking-channel.patch
+pinctrl-pinctrl-aspeed-g6-fix-register-offset-for-pi.patch
+pinctrl-meson-fix-typo-in-pdm-s-pin-name.patch
+pinctrl-core-delete-incorrect-free-in-pinctrl_enable.patch
+pinctrl-mediatek-paris-fix-pin_config_input_schmitt_.patch
+pinctrl-mediatek-paris-rework-support-for-pin_config.patch
+sunrpc-add-a-struct-rpc_stats-arg-to-rpc_create_args.patch
+nfs-expose-proc-net-sunrpc-nfs-in-net-namespaces.patch
+nfs-make-the-rpc_stat-per-net-namespace.patch
+nfs-handle-error-of-rpc_proc_register-in-nfs_net_ini.patch
+pinctrl-introduce-struct-pinfunction-and-pinctrl_pin.patch
+pinctrl-intel-make-use-of-struct-pinfunction-and-pin.patch
+pinctrl-baytrail-fix-selecting-gpio-pinctrl-state.patch
+power-rt9455-hide-unused-rt9455_boost_voltage_values.patch
+power-supply-mt6360_charger-fix-of_match-for-usb-otg.patch
+pinctrl-devicetree-fix-refcount-leak-in-pinctrl_dt_t.patch
+regulator-mt6360-de-capitalize-devicetree-regulator-.patch
+regulator-change-stubbed-devm_regulator_get_enable-t.patch
+regulator-change-devm_regulator_get_enable_optional-.patch
diff --git a/queue-6.1/smb3-missing-lock-when-picking-channel.patch b/queue-6.1/smb3-missing-lock-when-picking-channel.patch
new file mode 100644 (file)
index 0000000..4dc4873
--- /dev/null
@@ -0,0 +1,41 @@
+From 48319c77f85c88042d8d22396f93ac58956be208 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Apr 2024 11:30:16 -0500
+Subject: smb3: missing lock when picking channel
+
+From: Steve French <stfrench@microsoft.com>
+
+[ Upstream commit 8094a600245e9b28eb36a13036f202ad67c1f887 ]
+
+Coverity spotted a place where we should have been holding the
+channel lock when accessing the ses channel index.
+
+Addresses-Coverity: 1582039 ("Data race condition (MISSING_LOCK)")
+Cc: stable@vger.kernel.org
+Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/transport.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
+index da2bef3b7ac27..3fdafb9297f13 100644
+--- a/fs/smb/client/transport.c
++++ b/fs/smb/client/transport.c
+@@ -1079,9 +1079,11 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
+               index = (uint)atomic_inc_return(&ses->chan_seq);
+               index %= ses->chan_count;
+       }
++
++      server = ses->chans[index].server;
+       spin_unlock(&ses->chan_lock);
+-      return ses->chans[index].server;
++      return server;
+ }
+ int
+-- 
+2.43.0
+
diff --git a/queue-6.1/sunrpc-add-a-struct-rpc_stats-arg-to-rpc_create_args.patch b/queue-6.1/sunrpc-add-a-struct-rpc_stats-arg-to-rpc_create_args.patch
new file mode 100644 (file)
index 0000000..6f88410
--- /dev/null
@@ -0,0 +1,74 @@
+From c29a08f0a62f58e57684c810a03db6ec9dc5138d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Feb 2024 14:57:30 -0500
+Subject: sunrpc: add a struct rpc_stats arg to rpc_create_args
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit 2057a48d0dd00c6a2a94ded7df2bf1d3f2a4a0da ]
+
+We want to be able to have our rpc stats handled in a per network
+namespace manner, so add an option to rpc_create_args to specify a
+different rpc_stats struct instead of using the one on the rpc_program.
+
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Stable-dep-of: 24457f1be29f ("nfs: Handle error of rpc_proc_register() in nfs_net_init().")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/sunrpc/clnt.h | 1 +
+ net/sunrpc/clnt.c           | 5 ++++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
+index c794b0ce4e782..809c23120d548 100644
+--- a/include/linux/sunrpc/clnt.h
++++ b/include/linux/sunrpc/clnt.h
+@@ -131,6 +131,7 @@ struct rpc_create_args {
+       const char              *servername;
+       const char              *nodename;
+       const struct rpc_program *program;
++      struct rpc_stat         *stats;
+       u32                     prognumber;     /* overrides program->number */
+       u32                     version;
+       rpc_authflavor_t        authflavor;
+diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
+index 61e5c77462e94..b774028e4aa8f 100644
+--- a/net/sunrpc/clnt.c
++++ b/net/sunrpc/clnt.c
+@@ -398,7 +398,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
+       clnt->cl_maxproc  = version->nrprocs;
+       clnt->cl_prog     = args->prognumber ? : program->number;
+       clnt->cl_vers     = version->number;
+-      clnt->cl_stats    = program->stats;
++      clnt->cl_stats    = args->stats ? : program->stats;
+       clnt->cl_metrics  = rpc_alloc_iostats(clnt);
+       rpc_init_pipe_dir_head(&clnt->cl_pipedir_objects);
+       err = -ENOMEM;
+@@ -677,6 +677,7 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *clnt)
+               .version        = clnt->cl_vers,
+               .authflavor     = clnt->cl_auth->au_flavor,
+               .cred           = clnt->cl_cred,
++              .stats          = clnt->cl_stats,
+       };
+       return __rpc_clone_client(&args, clnt);
+ }
+@@ -699,6 +700,7 @@ rpc_clone_client_set_auth(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
+               .version        = clnt->cl_vers,
+               .authflavor     = flavor,
+               .cred           = clnt->cl_cred,
++              .stats          = clnt->cl_stats,
+       };
+       return __rpc_clone_client(&args, clnt);
+ }
+@@ -1044,6 +1046,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
+               .version        = vers,
+               .authflavor     = old->cl_auth->au_flavor,
+               .cred           = old->cl_cred,
++              .stats          = old->cl_stats,
+       };
+       struct rpc_clnt *clnt;
+       int err;
+-- 
+2.43.0
+
diff --git a/queue-6.1/wifi-nl80211-don-t-free-null-coalescing-rule.patch b/queue-6.1/wifi-nl80211-don-t-free-null-coalescing-rule.patch
new file mode 100644 (file)
index 0000000..d7553c9
--- /dev/null
@@ -0,0 +1,37 @@
+From 94b6507798c6cd641b1df3ec0de58ce21a466195 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 18 Apr 2024 10:52:23 +0200
+Subject: wifi: nl80211: don't free NULL coalescing rule
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit 801ea33ae82d6a9d954074fbcf8ea9d18f1543a7 ]
+
+If the parsing fails, we can dereference a NULL pointer here.
+
+Cc: stable@vger.kernel.org
+Fixes: be29b99a9b51 ("cfg80211/nl80211: Add packet coalesce support")
+Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240418105220.b328f80406e7.Id75d961050deb05b3e4e354e024866f350c68103@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/wireless/nl80211.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index 1a3bd554e2586..a00df7b89ca86 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -13802,6 +13802,8 @@ static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info)
+ error:
+       for (i = 0; i < new_coalesce.n_rules; i++) {
+               tmp_rule = &new_coalesce.rules[i];
++              if (!tmp_rule)
++                      continue;
+               for (j = 0; j < tmp_rule->n_patterns; j++)
+                       kfree(tmp_rule->patterns[j].mask);
+               kfree(tmp_rule->patterns);
+-- 
+2.43.0
+