--- /dev/null
+From edbad0f7c5f06349b249204d443505bec291d704 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Oct 2024 15:30:03 +0100
+Subject: cxl/events: Fix Trace DRAM Event Record
+
+From: Shiju Jose <shiju.jose@huawei.com>
+
+[ Upstream commit 53ab8678e7180834be29cf56cd52825fc3427c02 ]
+
+CXL spec rev 3.0 section 8.2.9.2.1.2 defines the DRAM Event Record.
+
+Fix decode memory event type field of DRAM Event Record.
+For e.g. if value is 0x1 it will be reported as an Invalid Address
+(General Media Event Record - Memory Event Type) instead of Scrub Media
+ECC Error (DRAM Event Record - Memory Event Type) and so on.
+
+Fixes: 2d6c1e6d60ba ("cxl/mem: Trace DRAM Event Record")
+Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
+Link: https://patch.msgid.link/20241014143003.1170-1-shiju.jose@huawei.com
+Signed-off-by: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/cxl/core/trace.h | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
+index 9167cfba7f592..cdffebcf20a4d 100644
+--- a/drivers/cxl/core/trace.h
++++ b/drivers/cxl/core/trace.h
+@@ -279,7 +279,7 @@ TRACE_EVENT(cxl_generic_event,
+ #define CXL_GMER_MEM_EVT_TYPE_ECC_ERROR 0x00
+ #define CXL_GMER_MEM_EVT_TYPE_INV_ADDR 0x01
+ #define CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR 0x02
+-#define show_mem_event_type(type) __print_symbolic(type, \
++#define show_gmer_mem_event_type(type) __print_symbolic(type, \
+ { CXL_GMER_MEM_EVT_TYPE_ECC_ERROR, "ECC Error" }, \
+ { CXL_GMER_MEM_EVT_TYPE_INV_ADDR, "Invalid Address" }, \
+ { CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR, "Data Path Error" } \
+@@ -373,7 +373,7 @@ TRACE_EVENT(cxl_general_media,
+ "hpa=%llx region=%s region_uuid=%pUb",
+ __entry->dpa, show_dpa_flags(__entry->dpa_flags),
+ show_event_desc_flags(__entry->descriptor),
+- show_mem_event_type(__entry->type),
++ show_gmer_mem_event_type(__entry->type),
+ show_trans_type(__entry->transaction_type),
+ __entry->channel, __entry->rank, __entry->device,
+ __print_hex(__entry->comp_id, CXL_EVENT_GEN_MED_COMP_ID_SIZE),
+@@ -391,6 +391,17 @@ TRACE_EVENT(cxl_general_media,
+ * DRAM Event Record defines many fields the same as the General Media Event
+ * Record. Reuse those definitions as appropriate.
+ */
++#define CXL_DER_MEM_EVT_TYPE_ECC_ERROR 0x00
++#define CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR 0x01
++#define CXL_DER_MEM_EVT_TYPE_INV_ADDR 0x02
++#define CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR 0x03
++#define show_dram_mem_event_type(type) __print_symbolic(type, \
++ { CXL_DER_MEM_EVT_TYPE_ECC_ERROR, "ECC Error" }, \
++ { CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR, "Scrub Media ECC Error" }, \
++ { CXL_DER_MEM_EVT_TYPE_INV_ADDR, "Invalid Address" }, \
++ { CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR, "Data Path Error" } \
++)
++
+ #define CXL_DER_VALID_CHANNEL BIT(0)
+ #define CXL_DER_VALID_RANK BIT(1)
+ #define CXL_DER_VALID_NIBBLE BIT(2)
+@@ -477,7 +488,7 @@ TRACE_EVENT(cxl_dram,
+ "hpa=%llx region=%s region_uuid=%pUb",
+ __entry->dpa, show_dpa_flags(__entry->dpa_flags),
+ show_event_desc_flags(__entry->descriptor),
+- show_mem_event_type(__entry->type),
++ show_dram_mem_event_type(__entry->type),
+ show_trans_type(__entry->transaction_type),
+ __entry->channel, __entry->rank, __entry->nibble_mask,
+ __entry->bank_group, __entry->bank,
+--
+2.43.0
+
--- /dev/null
+From a1bbb881a6975928c89c939efd1724adc8848e9a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 16 Oct 2024 14:17:14 +0000
+Subject: drm/mediatek: Fix color format MACROs in OVL
+
+From: Hsin-Te Yuan <yuanhsinte@chromium.org>
+
+[ Upstream commit 655c6c1b7afe6d29f386f415594ee643e5e3d755 ]
+
+In commit 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in
+OVL"), some new color formats are defined in the MACROs to make the
+switch statement more concise. That commit was intended to be a no-op
+cleanup. However, there are typos in these formats MACROs, which cause
+the return value to be incorrect. Fix the typos to ensure the return
+value remains unchanged.
+
+Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL")
+Reviewed-by: Douglas Anderson <dianders@chromium.org>
+Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
+Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: CK Hu <ck.hu@mediatek.com>
+Link: https://patchwork.kernel.org/project/dri-devel/patch/20241016-color-v3-1-e0f5f44a72d8@chromium.org/
+Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+index 4221206b994f1..064d03598ea2e 100644
+--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
++++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+@@ -61,8 +61,8 @@
+ #define OVL_CON_CLRFMT_RGB (1 << 12)
+ #define OVL_CON_CLRFMT_ARGB8888 (2 << 12)
+ #define OVL_CON_CLRFMT_RGBA8888 (3 << 12)
+-#define OVL_CON_CLRFMT_ABGR8888 (OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP)
+-#define OVL_CON_CLRFMT_BGRA8888 (OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP)
++#define OVL_CON_CLRFMT_ABGR8888 (OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP)
++#define OVL_CON_CLRFMT_BGRA8888 (OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP)
+ #define OVL_CON_CLRFMT_UYVY (4 << 12)
+ #define OVL_CON_CLRFMT_YUYV (5 << 12)
+ #define OVL_CON_CLRFMT_RGB565(ovl) ((ovl)->data->fmt_rgb565_is_0 ? \
+--
+2.43.0
+
--- /dev/null
+From 53948164325c7b3b4dacda61b614f41486d7af0a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2024 21:24:15 +0800
+Subject: drm/mediatek: Fix get efuse issue for MT8188 DPTX
+
+From: Liankun Yang <liankun.yang@mediatek.com>
+
+[ Upstream commit 3ded11b5c1b476f6d027d9017aa7deb8ab381ec1 ]
+
+Update efuse data for MT8188 displayport.
+
+The DP monitor can not display when DUT connected to USB-c to DP dongle.
+Analysis view is invalid DP efuse data.
+
+Fixes: 350c3fe907fb ("drm/mediatek: dp: Add support MT8188 dp/edp function")
+Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Signed-off-by: Liankun Yang <liankun.yang@mediatek.com>
+Reviewed-by: Fei Shao <fshao@chromium.org>
+Tested-by: Fei Shao <fshao@chromium.org>
+Reviewed-by: CK Hu <ck.hu@mediatek.com>
+Link: https://patchwork.kernel.org/project/dri-devel/patch/20240923132521.22785-1-liankun.yang@mediatek.com/
+Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_dp.c | 85 ++++++++++++++++++++++++++++++-
+ 1 file changed, 84 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
+index d8796a904eca4..f2bee617f063a 100644
+--- a/drivers/gpu/drm/mediatek/mtk_dp.c
++++ b/drivers/gpu/drm/mediatek/mtk_dp.c
+@@ -145,6 +145,89 @@ struct mtk_dp_data {
+ u16 audio_m_div2_bit;
+ };
+
++static const struct mtk_dp_efuse_fmt mt8188_dp_efuse_fmt[MTK_DP_CAL_MAX] = {
++ [MTK_DP_CAL_GLB_BIAS_TRIM] = {
++ .idx = 0,
++ .shift = 10,
++ .mask = 0x1f,
++ .min_val = 1,
++ .max_val = 0x1e,
++ .default_val = 0xf,
++ },
++ [MTK_DP_CAL_CLKTX_IMPSE] = {
++ .idx = 0,
++ .shift = 15,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_PMOS_0] = {
++ .idx = 1,
++ .shift = 0,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_PMOS_1] = {
++ .idx = 1,
++ .shift = 8,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_PMOS_2] = {
++ .idx = 1,
++ .shift = 16,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_PMOS_3] = {
++ .idx = 1,
++ .shift = 24,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_NMOS_0] = {
++ .idx = 1,
++ .shift = 4,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_NMOS_1] = {
++ .idx = 1,
++ .shift = 12,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_NMOS_2] = {
++ .idx = 1,
++ .shift = 20,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++ [MTK_DP_CAL_LN_TX_IMPSEL_NMOS_3] = {
++ .idx = 1,
++ .shift = 28,
++ .mask = 0xf,
++ .min_val = 1,
++ .max_val = 0xe,
++ .default_val = 0x8,
++ },
++};
++
+ static const struct mtk_dp_efuse_fmt mt8195_edp_efuse_fmt[MTK_DP_CAL_MAX] = {
+ [MTK_DP_CAL_GLB_BIAS_TRIM] = {
+ .idx = 3,
+@@ -2771,7 +2854,7 @@ static SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, mtk_dp_resume);
+ static const struct mtk_dp_data mt8188_dp_data = {
+ .bridge_type = DRM_MODE_CONNECTOR_DisplayPort,
+ .smc_cmd = MTK_DP_SIP_ATF_VIDEO_UNMUTE,
+- .efuse_fmt = mt8195_dp_efuse_fmt,
++ .efuse_fmt = mt8188_dp_efuse_fmt,
+ .audio_supported = true,
+ .audio_pkt_in_hblank_area = true,
+ .audio_m_div2_bit = MT8188_AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2,
+--
+2.43.0
+
--- /dev/null
+From ad86bde3b9ac7bce5416c573ba8f0bff633a4d84 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Sep 2024 11:44:59 +0300
+Subject: drm/mediatek: Fix potential NULL dereference in mtk_crtc_destroy()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit 4018651ba5c409034149f297d3dd3328b91561fd ]
+
+In mtk_crtc_create(), if the call to mbox_request_channel() fails then we
+set the "mtk_crtc->cmdq_client.chan" pointer to NULL. In that situation,
+we do not call cmdq_pkt_create().
+
+During the cleanup, we need to check if the "mtk_crtc->cmdq_client.chan"
+is NULL first before calling cmdq_pkt_destroy(). Calling
+cmdq_pkt_destroy() is unnecessary if we didn't call cmdq_pkt_create() and
+it will result in a NULL pointer dereference.
+
+Fixes: 7627122fd1c0 ("drm/mediatek: Add cmdq_handle in mtk_crtc")
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: CK Hu <ck.hu@mediatek.com>
+Link: https://patchwork.kernel.org/project/dri-devel/patch/cc537bd6-837f-4c85-a37b-1a007e268310@stanley.mountain/
+Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_crtc.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c
+index 4bee0328bdbee..e5d412b2d61b6 100644
+--- a/drivers/gpu/drm/mediatek/mtk_crtc.c
++++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
+@@ -127,9 +127,8 @@ static void mtk_crtc_destroy(struct drm_crtc *crtc)
+
+ mtk_mutex_put(mtk_crtc->mutex);
+ #if IS_REACHABLE(CONFIG_MTK_CMDQ)
+- cmdq_pkt_destroy(&mtk_crtc->cmdq_client, &mtk_crtc->cmdq_handle);
+-
+ if (mtk_crtc->cmdq_client.chan) {
++ cmdq_pkt_destroy(&mtk_crtc->cmdq_client, &mtk_crtc->cmdq_handle);
+ mbox_free_channel(mtk_crtc->cmdq_client.chan);
+ mtk_crtc->cmdq_client.chan = NULL;
+ }
+--
+2.43.0
+
--- /dev/null
+From fcd91fc9c9d83134a40e8c346132b74e58ddd44c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2024 11:46:44 +0800
+Subject: drm/mediatek: ovl: Remove the color format comment for
+ ovl_fmt_convert()
+
+From: Jason-JH.Lin <jason-jh.lin@mediatek.com>
+
+[ Upstream commit 41607c3ceb0e527e0985387bc41bbf291dc9a3d8 ]
+
+Since we changed MACROs to be consistent with DRM input color format
+naming, the comment for ovl_fmt_conver() is no longer needed.
+
+Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL")
+Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
+Reviewed-by: CK Hu <ck.hu@mediatek.com>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patchwork.kernel.org/project/dri-devel/patch/20241009034646.13143-4-jason-jh.lin@mediatek.com/
+Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+index 9d6d9fd8342e4..4221206b994f1 100644
+--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
++++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+@@ -379,11 +379,6 @@ void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
+
+ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt)
+ {
+- /* The return value in switch "MEM_MODE_INPUT_FORMAT_XXX"
+- * is defined in mediatek HW data sheet.
+- * The alphabet order in XXX is no relation to data
+- * arrangement in memory.
+- */
+ switch (fmt) {
+ default:
+ case DRM_FORMAT_RGB565:
+--
+2.43.0
+
--- /dev/null
+From ee994303f84bbac9b125d421b1384f1078defce4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 10 Aug 2024 09:09:15 +0000
+Subject: drm/mediatek: Use cmdq_pkt_create() and cmdq_pkt_destroy()
+
+From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+
+[ Upstream commit d7c66b5fbc70d09348f3e0414ebf360c3125f3fa ]
+
+Use cmdq_pkt_create() and cmdq_pkt_destroy() common function
+instead of implementing drm version.
+
+Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+Link: https://patchwork.kernel.org/project/dri-devel/patch/20240810090918.7457-3-chunkuang.hu@kernel.org/
+Stable-dep-of: 4018651ba5c4 ("drm/mediatek: Fix potential NULL dereference in mtk_crtc_destroy()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_crtc.c | 46 +++--------------------------
+ 1 file changed, 4 insertions(+), 42 deletions(-)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c
+index a90504359e8d2..4bee0328bdbee 100644
+--- a/drivers/gpu/drm/mediatek/mtk_crtc.c
++++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
+@@ -120,44 +120,6 @@ static void mtk_drm_finish_page_flip(struct mtk_crtc *mtk_crtc)
+ spin_unlock_irqrestore(&mtk_crtc->config_lock, flags);
+ }
+
+-#if IS_REACHABLE(CONFIG_MTK_CMDQ)
+-static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt,
+- size_t size)
+-{
+- struct device *dev;
+- dma_addr_t dma_addr;
+-
+- pkt->va_base = kzalloc(size, GFP_KERNEL);
+- if (!pkt->va_base)
+- return -ENOMEM;
+-
+- pkt->buf_size = size;
+- pkt->cl = (void *)client;
+-
+- dev = client->chan->mbox->dev;
+- dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size,
+- DMA_TO_DEVICE);
+- if (dma_mapping_error(dev, dma_addr)) {
+- dev_err(dev, "dma map failed, size=%u\n", (u32)(u64)size);
+- kfree(pkt->va_base);
+- return -ENOMEM;
+- }
+-
+- pkt->pa_base = dma_addr;
+-
+- return 0;
+-}
+-
+-static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
+-{
+- struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
+-
+- dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
+- DMA_TO_DEVICE);
+- kfree(pkt->va_base);
+-}
+-#endif
+-
+ static void mtk_crtc_destroy(struct drm_crtc *crtc)
+ {
+ struct mtk_crtc *mtk_crtc = to_mtk_crtc(crtc);
+@@ -165,7 +127,7 @@ static void mtk_crtc_destroy(struct drm_crtc *crtc)
+
+ mtk_mutex_put(mtk_crtc->mutex);
+ #if IS_REACHABLE(CONFIG_MTK_CMDQ)
+- mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
++ cmdq_pkt_destroy(&mtk_crtc->cmdq_client, &mtk_crtc->cmdq_handle);
+
+ if (mtk_crtc->cmdq_client.chan) {
+ mbox_free_channel(mtk_crtc->cmdq_client.chan);
+@@ -1122,9 +1084,9 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path,
+ mbox_free_channel(mtk_crtc->cmdq_client.chan);
+ mtk_crtc->cmdq_client.chan = NULL;
+ } else {
+- ret = mtk_drm_cmdq_pkt_create(&mtk_crtc->cmdq_client,
+- &mtk_crtc->cmdq_handle,
+- PAGE_SIZE);
++ ret = cmdq_pkt_create(&mtk_crtc->cmdq_client,
++ &mtk_crtc->cmdq_handle,
++ PAGE_SIZE);
+ if (ret) {
+ dev_dbg(dev, "mtk_crtc %d failed to create cmdq packet\n",
+ drm_crtc_index(&mtk_crtc->base));
+--
+2.43.0
+
--- /dev/null
+From 36924b41d24bc29fd29c391bdc8dd980ba2ace95 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 29 Oct 2024 16:29:10 +0100
+Subject: drm/panthor: Fail job creation when the group is dead
+
+From: Boris Brezillon <boris.brezillon@collabora.com>
+
+[ Upstream commit 412a2a8fdd4eb89b263623c7a59b77dbfcf8f215 ]
+
+Userspace can use GROUP_SUBMIT errors as a trigger to check the group
+state and recreate the group if it became unusable. Make sure we
+report an error when the group became unusable.
+
+Changes in v3:
+- None
+
+Changes in v2:
+- Add R-bs
+
+Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
+Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
+Reviewed-by: Steven Price <steven.price@arm.com>
+Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20241029152912.270346-2-boris.brezillon@collabora.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/panthor/panthor_sched.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
+index 4d1d5a342a4a6..9b64c61caab64 100644
+--- a/drivers/gpu/drm/panthor/panthor_sched.c
++++ b/drivers/gpu/drm/panthor/panthor_sched.c
+@@ -3409,6 +3409,11 @@ panthor_job_create(struct panthor_file *pfile,
+ goto err_put_job;
+ }
+
++ if (!group_can_run(job->group)) {
++ ret = -EINVAL;
++ goto err_put_job;
++ }
++
+ if (job->queue_idx >= job->group->queue_count ||
+ !job->group->queues[job->queue_idx]) {
+ ret = -EINVAL;
+--
+2.43.0
+
--- /dev/null
+From aafdfb64a66c7703d88daaf8e4c5c77c4555bae8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 30 Oct 2024 16:02:31 +0100
+Subject: drm/panthor: Fix firmware initialization on systems with a page size
+ > 4k
+
+From: Boris Brezillon <boris.brezillon@collabora.com>
+
+[ Upstream commit 5d01b56f0518d80211812420a8907ca0b6c6e4e3 ]
+
+The system and GPU MMU page size might differ, which becomes a
+problem for FW sections that need to be mapped at explicit addresses
+since our PAGE_SIZE alignment might cover a VA range that's
+expected to be used for another section.
+
+Make sure we never map more than we need.
+
+Changes in v3:
+- Add R-bs
+
+Changes in v2:
+- Plan for per-VM page sizes so the MCU VM and user VM can
+ have different pages sizes
+
+Fixes: 2718d91816ee ("drm/panthor: Add the FW logical block")
+Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
+Reviewed-by: Steven Price <steven.price@arm.com>
+Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20241030150231.768949-1-boris.brezillon@collabora.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/panthor/panthor_fw.c | 4 ++--
+ drivers/gpu/drm/panthor/panthor_gem.c | 11 ++++++++---
+ drivers/gpu/drm/panthor/panthor_mmu.c | 16 +++++++++++++---
+ drivers/gpu/drm/panthor/panthor_mmu.h | 1 +
+ 4 files changed, 24 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
+index ef232c0c20493..4e2d3a02ea068 100644
+--- a/drivers/gpu/drm/panthor/panthor_fw.c
++++ b/drivers/gpu/drm/panthor/panthor_fw.c
+@@ -487,6 +487,7 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
+ struct panthor_fw_binary_iter *iter,
+ u32 ehdr)
+ {
++ ssize_t vm_pgsz = panthor_vm_page_size(ptdev->fw->vm);
+ struct panthor_fw_binary_section_entry_hdr hdr;
+ struct panthor_fw_section *section;
+ u32 section_size;
+@@ -515,8 +516,7 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
+ return -EINVAL;
+ }
+
+- if ((hdr.va.start & ~PAGE_MASK) != 0 ||
+- (hdr.va.end & ~PAGE_MASK) != 0) {
++ if (!IS_ALIGNED(hdr.va.start, vm_pgsz) || !IS_ALIGNED(hdr.va.end, vm_pgsz)) {
+ drm_err(&ptdev->base, "Firmware corrupted, virtual addresses not page aligned: 0x%x-0x%x\n",
+ hdr.va.start, hdr.va.end);
+ return -EINVAL;
+diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
+index 38f560864879c..be97d56bc011d 100644
+--- a/drivers/gpu/drm/panthor/panthor_gem.c
++++ b/drivers/gpu/drm/panthor/panthor_gem.c
+@@ -44,8 +44,7 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo)
+ to_panthor_bo(bo->obj)->exclusive_vm_root_gem != panthor_vm_root_gem(vm)))
+ goto out_free_bo;
+
+- ret = panthor_vm_unmap_range(vm, bo->va_node.start,
+- panthor_kernel_bo_size(bo));
++ ret = panthor_vm_unmap_range(vm, bo->va_node.start, bo->va_node.size);
+ if (ret)
+ goto out_free_bo;
+
+@@ -95,10 +94,16 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
+ }
+
+ bo = to_panthor_bo(&obj->base);
+- size = obj->base.size;
+ kbo->obj = &obj->base;
+ bo->flags = bo_flags;
+
++ /* The system and GPU MMU page size might differ, which becomes a
++ * problem for FW sections that need to be mapped at explicit address
++ * since our PAGE_SIZE alignment might cover a VA range that's
++ * expected to be used for another section.
++ * Make sure we never map more than we need.
++ */
++ size = ALIGN(size, panthor_vm_page_size(vm));
+ ret = panthor_vm_alloc_va(vm, gpu_va, size, &kbo->va_node);
+ if (ret)
+ goto err_put_obj;
+diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
+index ce8e8a93d7076..837ba312f3a8b 100644
+--- a/drivers/gpu/drm/panthor/panthor_mmu.c
++++ b/drivers/gpu/drm/panthor/panthor_mmu.c
+@@ -826,6 +826,14 @@ void panthor_vm_idle(struct panthor_vm *vm)
+ mutex_unlock(&ptdev->mmu->as.slots_lock);
+ }
+
++u32 panthor_vm_page_size(struct panthor_vm *vm)
++{
++ const struct io_pgtable *pgt = io_pgtable_ops_to_pgtable(vm->pgtbl_ops);
++ u32 pg_shift = ffs(pgt->cfg.pgsize_bitmap) - 1;
++
++ return 1u << pg_shift;
++}
++
+ static void panthor_vm_stop(struct panthor_vm *vm)
+ {
+ drm_sched_stop(&vm->sched, NULL);
+@@ -1025,12 +1033,13 @@ int
+ panthor_vm_alloc_va(struct panthor_vm *vm, u64 va, u64 size,
+ struct drm_mm_node *va_node)
+ {
++ ssize_t vm_pgsz = panthor_vm_page_size(vm);
+ int ret;
+
+- if (!size || (size & ~PAGE_MASK))
++ if (!size || !IS_ALIGNED(size, vm_pgsz))
+ return -EINVAL;
+
+- if (va != PANTHOR_VM_KERNEL_AUTO_VA && (va & ~PAGE_MASK))
++ if (va != PANTHOR_VM_KERNEL_AUTO_VA && !IS_ALIGNED(va, vm_pgsz))
+ return -EINVAL;
+
+ mutex_lock(&vm->mm_lock);
+@@ -2366,11 +2375,12 @@ panthor_vm_bind_prepare_op_ctx(struct drm_file *file,
+ const struct drm_panthor_vm_bind_op *op,
+ struct panthor_vm_op_ctx *op_ctx)
+ {
++ ssize_t vm_pgsz = panthor_vm_page_size(vm);
+ struct drm_gem_object *gem;
+ int ret;
+
+ /* Aligned on page size. */
+- if ((op->va | op->size) & ~PAGE_MASK)
++ if (!IS_ALIGNED(op->va | op->size, vm_pgsz))
+ return -EINVAL;
+
+ switch (op->flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) {
+diff --git a/drivers/gpu/drm/panthor/panthor_mmu.h b/drivers/gpu/drm/panthor/panthor_mmu.h
+index 6788771071e35..8d21e83d8aba1 100644
+--- a/drivers/gpu/drm/panthor/panthor_mmu.h
++++ b/drivers/gpu/drm/panthor/panthor_mmu.h
+@@ -30,6 +30,7 @@ panthor_vm_get_bo_for_va(struct panthor_vm *vm, u64 va, u64 *bo_offset);
+
+ int panthor_vm_active(struct panthor_vm *vm);
+ void panthor_vm_idle(struct panthor_vm *vm);
++u32 panthor_vm_page_size(struct panthor_vm *vm);
+ int panthor_vm_as(struct panthor_vm *vm);
+ int panthor_vm_flush_all(struct panthor_vm *vm);
+
+--
+2.43.0
+
--- /dev/null
+From 12a2dd345de51de2a20a742c11c6f355e385ebc4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 29 Oct 2024 16:29:11 +0100
+Subject: drm/panthor: Report group as timedout when we fail to properly
+ suspend
+
+From: Boris Brezillon <boris.brezillon@collabora.com>
+
+[ Upstream commit 4700fd3e050da8302e60ebd4850d008250fa7204 ]
+
+If we don't do that, the group is considered usable by userspace, but
+all further GROUP_SUBMIT will fail with -EINVAL.
+
+Changes in v3:
+- Add R-bs
+
+Changes in v2:
+- New patch
+
+Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
+Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
+Reviewed-by: Steven Price <steven.price@arm.com>
+Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20241029152912.270346-3-boris.brezillon@collabora.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/panthor/panthor_sched.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
+index 9b64c61caab64..e9234488dc2b4 100644
+--- a/drivers/gpu/drm/panthor/panthor_sched.c
++++ b/drivers/gpu/drm/panthor/panthor_sched.c
+@@ -589,10 +589,11 @@ struct panthor_group {
+ * @timedout: True when a timeout occurred on any of the queues owned by
+ * this group.
+ *
+- * Timeouts can be reported by drm_sched or by the FW. In any case, any
+- * timeout situation is unrecoverable, and the group becomes useless.
+- * We simply wait for all references to be dropped so we can release the
+- * group object.
++ * Timeouts can be reported by drm_sched or by the FW. If a reset is required,
++ * and the group can't be suspended, this also leads to a timeout. In any case,
++ * any timeout situation is unrecoverable, and the group becomes useless. We
++ * simply wait for all references to be dropped so we can release the group
++ * object.
+ */
+ bool timedout;
+
+@@ -2640,6 +2641,12 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
+ csgs_upd_ctx_init(&upd_ctx);
+ while (slot_mask) {
+ u32 csg_id = ffs(slot_mask) - 1;
++ struct panthor_csg_slot *csg_slot = &sched->csg_slots[csg_id];
++
++ /* We consider group suspension failures as fatal and flag the
++ * group as unusable by setting timedout=true.
++ */
++ csg_slot->group->timedout = true;
+
+ csgs_upd_ctx_queue_reqs(ptdev, &upd_ctx, csg_id,
+ CSG_STATE_TERMINATE,
+--
+2.43.0
+
--- /dev/null
+From ffa9ebe01c1cf14a72f983dd7c0969989763e71f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 13 Sep 2024 17:34:54 +0300
+Subject: drm/tegra: Fix NULL vs IS_ERR() check in probe()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit a85df8c7b5ee2d3d4823befada42c5c41aff4cb0 ]
+
+The iommu_paging_domain_alloc() function doesn't return NULL pointers,
+it returns error pointers. Update the check to match.
+
+Fixes: 45c690aea8ee ("drm/tegra: Use iommu_paging_domain_alloc()")
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/ba31cf3a-af3d-4ff1-87a8-f05aaf8c780b@stanley.mountain
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/tegra/drm.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
+index d79c76a287f22..6a29ac1b2d219 100644
+--- a/drivers/gpu/drm/tegra/drm.c
++++ b/drivers/gpu/drm/tegra/drm.c
+@@ -1152,8 +1152,8 @@ static int host1x_drm_probe(struct host1x_device *dev)
+
+ if (host1x_drm_wants_iommu(dev) && device_iommu_mapped(dma_dev)) {
+ tegra->domain = iommu_paging_domain_alloc(dma_dev);
+- if (!tegra->domain) {
+- err = -ENOMEM;
++ if (IS_ERR(tegra->domain)) {
++ err = PTR_ERR(tegra->domain);
+ goto free;
+ }
+
+--
+2.43.0
+
--- /dev/null
+From 4af13b26f3d81a2924c9b167e5672bdc635e50c2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Oct 2024 08:40:26 -0700
+Subject: nvme: module parameter to disable pi with offsets
+
+From: Keith Busch <kbusch@kernel.org>
+
+[ Upstream commit 42ab37eaad17aee458489c553a367621ee04e0bc ]
+
+A recent commit enables integrity checks for formats the previous kernel
+versions registered with the "nop" integrity profile. This means
+namespaces using that format become unreadable when upgrading the kernel
+past that commit.
+
+Introduce a module parameter to restore the "nop" integrity profile so
+that storage can be readable once again. This could be a boot device, so
+the setting needs to happen at module load time.
+
+Fixes: 921e81db524d17 ("nvme: allow integrity when PI is not in first bytes")
+Reported-by: David Wei <dw@davidwei.uk>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
+Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/core.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index a6fb1359a7e14..89ad4217f8606 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -90,6 +90,17 @@ module_param(apst_secondary_latency_tol_us, ulong, 0644);
+ MODULE_PARM_DESC(apst_secondary_latency_tol_us,
+ "secondary APST latency tolerance in us");
+
++/*
++ * Older kernels didn't enable protection information if it was at an offset.
++ * Newer kernels do, so it breaks reads on the upgrade if such formats were
++ * used in prior kernels since the metadata written did not contain a valid
++ * checksum.
++ */
++static bool disable_pi_offsets = false;
++module_param(disable_pi_offsets, bool, 0444);
++MODULE_PARM_DESC(disable_pi_offsets,
++ "disable protection information if it has an offset");
++
+ /*
+ * nvme_wq - hosts nvme related works that are not reset or delete
+ * nvme_reset_wq - hosts nvme reset works
+@@ -1921,8 +1932,12 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
+
+ if (head->pi_size && head->ms >= head->pi_size)
+ head->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
+- if (!(id->dps & NVME_NS_DPS_PI_FIRST))
+- info->pi_offset = head->ms - head->pi_size;
++ if (!(id->dps & NVME_NS_DPS_PI_FIRST)) {
++ if (disable_pi_offsets)
++ head->pi_type = 0;
++ else
++ info->pi_offset = head->ms - head->pi_size;
++ }
+
+ if (ctrl->ops->flags & NVME_F_FABRICS) {
+ /*
+--
+2.43.0
+
--- /dev/null
+From d1b7c32585eeaa670c1eadb79f8c9284214f7cab Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 16 Oct 2024 20:52:33 -0300
+Subject: PCI: Fix pci_enable_acs() support for the ACS quirks
+
+From: Jason Gunthorpe <jgg@nvidia.com>
+
+[ Upstream commit f3c3ccc4fe49dbc560b01d16bebd1b116c46c2b4 ]
+
+There are ACS quirks that hijack the normal ACS processing and deliver to
+to special quirk code. The enable path needs to call
+pci_dev_specific_enable_acs() and then pci_dev_specific_acs_enabled() will
+report the hidden ACS state controlled by the quirk.
+
+The recent rework got this out of order and we should try to call
+pci_dev_specific_enable_acs() regardless of any actual ACS support in the
+device.
+
+As before command line parameters that effect standard PCI ACS don't
+interact with the quirk versions, including the new config_acs= option.
+
+Link: https://lore.kernel.org/r/0-v1-f96b686c625b+124-pci_acs_quirk_fix_jgg@nvidia.com
+Fixes: 47c8846a49ba ("PCI: Extend ACS configurability")
+Reported-by: Jiri Slaby <jirislaby@kernel.org>
+Closes: https://lore.kernel.org/all/e89107da-ac99-4d3a-9527-a4df9986e120@kernel.org
+Closes: https://bugzilla.suse.com/show_bug.cgi?id=1229019
+Tested-by: Steffen Dirkwinkel <me@steffen.cc>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/pci.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
+index 85ced6958d6d1..51407c376a222 100644
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -1067,8 +1067,15 @@ static void pci_std_enable_acs(struct pci_dev *dev, struct pci_acs *caps)
+ static void pci_enable_acs(struct pci_dev *dev)
+ {
+ struct pci_acs caps;
++ bool enable_acs = false;
+ int pos;
+
++ /* If an iommu is present we start with kernel default caps */
++ if (pci_acs_enable) {
++ if (pci_dev_specific_enable_acs(dev))
++ enable_acs = true;
++ }
++
+ pos = dev->acs_cap;
+ if (!pos)
+ return;
+@@ -1077,11 +1084,8 @@ static void pci_enable_acs(struct pci_dev *dev)
+ pci_read_config_word(dev, pos + PCI_ACS_CTRL, &caps.ctrl);
+ caps.fw_ctrl = caps.ctrl;
+
+- /* If an iommu is present we start with kernel default caps */
+- if (pci_acs_enable) {
+- if (pci_dev_specific_enable_acs(dev))
+- pci_std_enable_acs(dev, &caps);
+- }
++ if (enable_acs)
++ pci_std_enable_acs(dev, &caps);
+
+ /*
+ * Always apply caps from the command line, even if there is no iommu.
+--
+2.43.0
+
afs-fix-missing-subdir-edit-when-renamed-between-par.patch
acpi-cppc-make-rmw_lock-a-raw_spin_lock.patch
gpio-sloppy-logic-analyzer-check-for-error-code-from.patch
+smb-client-fix-parsing-of-device-numbers.patch
+smb-client-set-correct-device-number-on-nfs-reparse-.patch
+drm-mediatek-ovl-remove-the-color-format-comment-for.patch
+drm-mediatek-fix-color-format-macros-in-ovl.patch
+drm-mediatek-fix-get-efuse-issue-for-mt8188-dptx.patch
+drm-mediatek-use-cmdq_pkt_create-and-cmdq_pkt_destro.patch
+drm-mediatek-fix-potential-null-dereference-in-mtk_c.patch
+drm-tegra-fix-null-vs-is_err-check-in-probe.patch
+cxl-events-fix-trace-dram-event-record.patch
+pci-fix-pci_enable_acs-support-for-the-acs-quirks.patch
+nvme-module-parameter-to-disable-pi-with-offsets.patch
+drm-panthor-fix-firmware-initialization-on-systems-w.patch
+drm-panthor-fail-job-creation-when-the-group-is-dead.patch
+drm-panthor-report-group-as-timedout-when-we-fail-to.patch
--- /dev/null
+From 3069dc4a4efbeb86fa121f7f948fff972cead13a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Sep 2024 21:57:43 -0300
+Subject: smb: client: fix parsing of device numbers
+
+From: Paulo Alcantara <pc@manguebit.com>
+
+[ Upstream commit 663f295e35594f4c2584fc68c28546b747b637cd ]
+
+Report correct major and minor numbers from special files created with
+NFS reparse points.
+
+Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/reparse.c | 6 +++---
+ fs/smb/client/reparse.h | 9 +--------
+ 2 files changed, 4 insertions(+), 11 deletions(-)
+
+diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
+index 7429b96a6ae5e..a4e25b99411ec 100644
+--- a/fs/smb/client/reparse.c
++++ b/fs/smb/client/reparse.c
+@@ -497,7 +497,7 @@ static void wsl_to_fattr(struct cifs_open_info_data *data,
+ else if (!strncmp(name, SMB2_WSL_XATTR_MODE, nlen))
+ fattr->cf_mode = (umode_t)le32_to_cpu(*(__le32 *)v);
+ else if (!strncmp(name, SMB2_WSL_XATTR_DEV, nlen))
+- fattr->cf_rdev = wsl_mkdev(v);
++ fattr->cf_rdev = reparse_mkdev(v);
+ } while (next);
+ out:
+ fattr->cf_dtype = S_DT(fattr->cf_mode);
+@@ -518,13 +518,13 @@ bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb,
+ if (le16_to_cpu(buf->ReparseDataLength) != sizeof(buf->InodeType) + 8)
+ return false;
+ fattr->cf_mode |= S_IFCHR;
+- fattr->cf_rdev = reparse_nfs_mkdev(buf);
++ fattr->cf_rdev = reparse_mkdev(buf->DataBuffer);
+ break;
+ case NFS_SPECFILE_BLK:
+ if (le16_to_cpu(buf->ReparseDataLength) != sizeof(buf->InodeType) + 8)
+ return false;
+ fattr->cf_mode |= S_IFBLK;
+- fattr->cf_rdev = reparse_nfs_mkdev(buf);
++ fattr->cf_rdev = reparse_mkdev(buf->DataBuffer);
+ break;
+ case NFS_SPECFILE_FIFO:
+ fattr->cf_mode |= S_IFIFO;
+diff --git a/fs/smb/client/reparse.h b/fs/smb/client/reparse.h
+index 2c0644bc4e65a..158e7b7aae646 100644
+--- a/fs/smb/client/reparse.h
++++ b/fs/smb/client/reparse.h
+@@ -18,14 +18,7 @@
+ */
+ #define IO_REPARSE_TAG_INTERNAL ((__u32)~0U)
+
+-static inline dev_t reparse_nfs_mkdev(struct reparse_posix_data *buf)
+-{
+- u64 v = le64_to_cpu(*(__le64 *)buf->DataBuffer);
+-
+- return MKDEV(v >> 32, v & 0xffffffff);
+-}
+-
+-static inline dev_t wsl_mkdev(void *ptr)
++static inline dev_t reparse_mkdev(void *ptr)
+ {
+ u64 v = le64_to_cpu(*(__le64 *)ptr);
+
+--
+2.43.0
+
--- /dev/null
+From b79df712378091ed43ac1aeb4f764881eba0bcac Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Sep 2024 21:53:35 -0300
+Subject: smb: client: set correct device number on nfs reparse points
+
+From: Paulo Alcantara <pc@manguebit.com>
+
+[ Upstream commit a9de67336a4aa3ff2e706ba023fb5f7ff681a954 ]
+
+Fix major and minor numbers set on special files created with NFS
+reparse points.
+
+Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/reparse.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
+index a4e25b99411ec..c848b5e88d32f 100644
+--- a/fs/smb/client/reparse.c
++++ b/fs/smb/client/reparse.c
+@@ -108,8 +108,8 @@ static int nfs_set_reparse_buf(struct reparse_posix_data *buf,
+ buf->InodeType = cpu_to_le64(type);
+ buf->ReparseDataLength = cpu_to_le16(len + dlen -
+ sizeof(struct reparse_data_buffer));
+- *(__le64 *)buf->DataBuffer = cpu_to_le64(((u64)MAJOR(dev) << 32) |
+- MINOR(dev));
++ *(__le64 *)buf->DataBuffer = cpu_to_le64(((u64)MINOR(dev) << 32) |
++ MAJOR(dev));
+ iov->iov_base = buf;
+ iov->iov_len = len + dlen;
+ return 0;
+--
+2.43.0
+