From: Greg Kroah-Hartman Date: Mon, 5 Jun 2023 15:38:24 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v4.14.317~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eddafcbdbbc00602cc082c8929e245df8a33b7e0;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: ata-libata-scsi-use-correct-device-no-in-ata_find_dev.patch drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-renoir.patch drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-vangogh.patch drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-yellow-carp.patch scsi-stex-fix-gcc-13-warnings.patch --- diff --git a/queue-5.15/ata-libata-scsi-use-correct-device-no-in-ata_find_dev.patch b/queue-5.15/ata-libata-scsi-use-correct-device-no-in-ata_find_dev.patch new file mode 100644 index 00000000000..7a84ecc27d9 --- /dev/null +++ b/queue-5.15/ata-libata-scsi-use-correct-device-no-in-ata_find_dev.patch @@ -0,0 +1,96 @@ +From 7f875850f20a42f488840c9df7af91ef7db2d576 Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +Date: Mon, 22 May 2023 20:09:57 +0900 +Subject: ata: libata-scsi: Use correct device no in ata_find_dev() + +From: Damien Le Moal + +commit 7f875850f20a42f488840c9df7af91ef7db2d576 upstream. + +For devices not attached to a port multiplier and managed directly by +libata, the device number passed to ata_find_dev() must always be lower +than the maximum number of devices returned by ata_link_max_devices(). +That is 1 for SATA devices or 2 for an IDE link with master+slave +devices. This device number is the SCSI device ID which matches these +constraints as the IDs are generated per port and so never exceed the +maximum number of devices for the link being used. + +However, for libsas managed devices, SCSI device IDs are assigned per +struct scsi_host, leading to device IDs for SATA devices that can be +well in excess of libata per-link maximum number of devices. This +results in ata_find_dev() to always return NULL for libsas managed +devices except for the first device of the target scsi_host with ID +(device number) equal to 0. This issue is visible by executing the +hdparm utility, which fails. E.g.: + +hdparm -i /dev/sdX +/dev/sdX: + HDIO_GET_IDENTITY failed: No message of desired type + +Fix this by rewriting ata_find_dev() to ignore the device number for +non-PMP attached devices with a link with at most 1 device, that is SATA +devices. For these, the device number 0 is always used to +return the correct pointer to the struct ata_device of the port link. +This change excludes IDE master/slave setups (maximum number of devices +per link is 2) and port-multiplier attached devices. Also, to be +consistant with the fact that SCSI device IDs and channel numbers used +as device numbers are both unsigned int, change the devno argument of +ata_find_dev() to unsigned int. + +Reported-by: Xingui Yang +Fixes: 41bda9c98035 ("libata-link: update hotplug to handle PMP links") +Cc: stable@vger.kernel.org +Signed-off-by: Damien Le Moal +Reviewed-by: Jason Yan +Signed-off-by: Greg Kroah-Hartman +--- + drivers/ata/libata-scsi.c | 34 ++++++++++++++++++++++++++-------- + 1 file changed, 26 insertions(+), 8 deletions(-) + +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -2698,18 +2698,36 @@ static unsigned int atapi_xlat(struct at + return 0; + } + +-static struct ata_device *ata_find_dev(struct ata_port *ap, int devno) ++static struct ata_device *ata_find_dev(struct ata_port *ap, unsigned int devno) + { +- if (!sata_pmp_attached(ap)) { +- if (likely(devno >= 0 && +- devno < ata_link_max_devices(&ap->link))) ++ /* ++ * For the non-PMP case, ata_link_max_devices() returns 1 (SATA case), ++ * or 2 (IDE master + slave case). However, the former case includes ++ * libsas hosted devices which are numbered per scsi host, leading ++ * to devno potentially being larger than 0 but with each struct ++ * ata_device having its own struct ata_port and struct ata_link. ++ * To accommodate these, ignore devno and always use device number 0. ++ */ ++ if (likely(!sata_pmp_attached(ap))) { ++ int link_max_devices = ata_link_max_devices(&ap->link); ++ ++ if (link_max_devices == 1) ++ return &ap->link.device[0]; ++ ++ if (devno < link_max_devices) + return &ap->link.device[devno]; +- } else { +- if (likely(devno >= 0 && +- devno < ap->nr_pmp_links)) +- return &ap->pmp_link[devno].device[0]; ++ ++ return NULL; + } + ++ /* ++ * For PMP-attached devices, the device number corresponds to C ++ * (channel) of SCSI [H:C:I:L], indicating the port pmp link ++ * for the device. ++ */ ++ if (devno < ap->nr_pmp_links) ++ return &ap->pmp_link[devno].device[0]; ++ + return NULL; + } + diff --git a/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-renoir.patch b/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-renoir.patch new file mode 100644 index 00000000000..c6b308b7218 --- /dev/null +++ b/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-renoir.patch @@ -0,0 +1,54 @@ +From 55e02c14f9b5fd973ba32a16a715baa42617f9c6 Mon Sep 17 00:00:00 2001 +From: Tim Huang +Date: Mon, 22 May 2023 23:17:28 +0800 +Subject: drm/amd/pm: reverse mclk and fclk clocks levels for renoir + +From: Tim Huang + +commit 55e02c14f9b5fd973ba32a16a715baa42617f9c6 upstream. + +This patch reverses the DPM clocks levels output of pp_dpm_mclk +and pp_dpm_fclk for renoir. + +On dGPUs and older APUs we expose the levels from lowest clocks +to highest clocks. But for some APUs, the clocks levels are +given the reversed orders by PMFW. Like the memory DPM clocks +that are exposed by pp_dpm_mclk. + +It's not intuitive that they are reversed on these APUs. All tools +and software that talks to the driver then has to know different ways +to interpret the data depending on the asic. + +So we need to reverse them to expose the clocks levels from the +driver consistently. + +Signed-off-by: Tim Huang +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +@@ -485,7 +485,7 @@ static int renoir_set_fine_grain_gfx_fre + static int renoir_print_clk_levels(struct smu_context *smu, + enum smu_clk_type clk_type, char *buf) + { +- int i, size = 0, ret = 0; ++ int i, idx, size = 0, ret = 0; + uint32_t cur_value = 0, value = 0, count = 0, min = 0, max = 0; + SmuMetrics_t metrics; + struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); +@@ -585,7 +585,8 @@ static int renoir_print_clk_levels(struc + case SMU_VCLK: + case SMU_DCLK: + for (i = 0; i < count; i++) { +- ret = renoir_get_dpm_clk_limited(smu, clk_type, i, &value); ++ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i; ++ ret = renoir_get_dpm_clk_limited(smu, clk_type, idx, &value); + if (ret) + return ret; + if (!value) diff --git a/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-vangogh.patch b/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-vangogh.patch new file mode 100644 index 00000000000..bfb2eecb0ea --- /dev/null +++ b/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-vangogh.patch @@ -0,0 +1,73 @@ +From bfc03568d9d81332382c73a1985a90c4506bd36c Mon Sep 17 00:00:00 2001 +From: Tim Huang +Date: Sun, 21 May 2023 11:10:19 +0800 +Subject: drm/amd/pm: reverse mclk and fclk clocks levels for vangogh + +From: Tim Huang + +commit bfc03568d9d81332382c73a1985a90c4506bd36c upstream. + +This patch reverses the DPM clocks levels output of pp_dpm_mclk +and pp_dpm_fclk. + +On dGPUs and older APUs we expose the levels from lowest clocks +to highest clocks. But for some APUs, the clocks levels that from +the DFPstateTable are given the reversed orders by PMFW. Like the +memory DPM clocks that are exposed by pp_dpm_mclk. + +It's not intuitive that they are reversed on these APUs. All tools +and software that talks to the driver then has to know different ways +to interpret the data depending on the asic. + +So we need to reverse them to expose the clocks levels from the +driver consistently. + +Signed-off-by: Tim Huang +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +@@ -579,7 +579,7 @@ static int vangogh_print_legacy_clk_leve + DpmClocks_t *clk_table = smu->smu_table.clocks_table; + SmuMetrics_legacy_t metrics; + struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); +- int i, size = 0, ret = 0; ++ int i, idx, size = 0, ret = 0; + uint32_t cur_value = 0, value = 0, count = 0; + bool cur_value_match_level = false; + +@@ -653,7 +653,8 @@ static int vangogh_print_legacy_clk_leve + case SMU_MCLK: + case SMU_FCLK: + for (i = 0; i < count; i++) { +- ret = vangogh_get_dpm_clk_limited(smu, clk_type, i, &value); ++ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i; ++ ret = vangogh_get_dpm_clk_limited(smu, clk_type, idx, &value); + if (ret) + return ret; + if (!value) +@@ -680,7 +681,7 @@ static int vangogh_print_clk_levels(stru + DpmClocks_t *clk_table = smu->smu_table.clocks_table; + SmuMetrics_t metrics; + struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); +- int i, size = 0, ret = 0; ++ int i, idx, size = 0, ret = 0; + uint32_t cur_value = 0, value = 0, count = 0; + bool cur_value_match_level = false; + +@@ -754,7 +755,8 @@ static int vangogh_print_clk_levels(stru + case SMU_MCLK: + case SMU_FCLK: + for (i = 0; i < count; i++) { +- ret = vangogh_get_dpm_clk_limited(smu, clk_type, i, &value); ++ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i; ++ ret = vangogh_get_dpm_clk_limited(smu, clk_type, idx, &value); + if (ret) + return ret; + if (!value) diff --git a/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-yellow-carp.patch b/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-yellow-carp.patch new file mode 100644 index 00000000000..f0c802750ca --- /dev/null +++ b/queue-5.15/drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-yellow-carp.patch @@ -0,0 +1,54 @@ +From f1373a97a41f429e0095d4be388092ffa3c1a157 Mon Sep 17 00:00:00 2001 +From: Tim Huang +Date: Sun, 21 May 2023 10:35:59 +0800 +Subject: drm/amd/pm: reverse mclk and fclk clocks levels for yellow carp + +From: Tim Huang + +commit f1373a97a41f429e0095d4be388092ffa3c1a157 upstream. + +This patch reverses the DPM clocks levels output of pp_dpm_mclk +and pp_dpm_fclk. + +On dGPUs and older APUs we expose the levels from lowest clocks +to highest clocks. But for some APUs, the clocks levels that from +the DFPstateTable are given the reversed orders by PMFW. Like the +memory DPM clocks that are exposed by pp_dpm_mclk. + +It's not intuitive that they are reversed on these APUs. All tools +and software that talks to the driver then has to know different ways +to interpret the data depending on the asic. + +So we need to reverse them to expose the clocks levels from the +driver consistently. + +Signed-off-by: Tim Huang +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +@@ -1074,7 +1074,7 @@ out: + static int yellow_carp_print_clk_levels(struct smu_context *smu, + enum smu_clk_type clk_type, char *buf) + { +- int i, size = 0, ret = 0; ++ int i, idx, size = 0, ret = 0; + uint32_t cur_value = 0, value = 0, count = 0; + + smu_cmn_get_sysfs_buf(&buf, &size); +@@ -1106,7 +1106,8 @@ static int yellow_carp_print_clk_levels( + goto print_clk_out; + + for (i = 0; i < count; i++) { +- ret = yellow_carp_get_dpm_freq_by_index(smu, clk_type, i, &value); ++ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i; ++ ret = yellow_carp_get_dpm_freq_by_index(smu, clk_type, idx, &value); + if (ret) + goto print_clk_out; + diff --git a/queue-5.15/scsi-stex-fix-gcc-13-warnings.patch b/queue-5.15/scsi-stex-fix-gcc-13-warnings.patch new file mode 100644 index 00000000000..c3f47c3d75d --- /dev/null +++ b/queue-5.15/scsi-stex-fix-gcc-13-warnings.patch @@ -0,0 +1,66 @@ +From 6d074ce231772c66e648a61f6bd2245e7129d1f5 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Mon, 29 May 2023 12:50:34 -0700 +Subject: scsi: stex: Fix gcc 13 warnings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Bart Van Assche + +commit 6d074ce231772c66e648a61f6bd2245e7129d1f5 upstream. + +gcc 13 may assign another type to enumeration constants than gcc 12. Split +the large enum at the top of source file stex.c such that the type of the +constants used in time expressions is changed back to the same type chosen +by gcc 12. This patch suppresses compiler warnings like this one: + +In file included from ./include/linux/bitops.h:7, + from ./include/linux/kernel.h:22, + from drivers/scsi/stex.c:13: +drivers/scsi/stex.c: In function ‘stex_common_handshake’: +./include/linux/typecheck.h:12:25: error: comparison of distinct pointer types lacks a cast [-Werror] + 12 | (void)(&__dummy == &__dummy2); \ + | ^~ +./include/linux/jiffies.h:106:10: note: in expansion of macro ‘typecheck’ + 106 | typecheck(unsigned long, b) && \ + | ^~~~~~~~~ +drivers/scsi/stex.c:1035:29: note: in expansion of macro ‘time_after’ + 1035 | if (time_after(jiffies, before + MU_MAX_DELAY * HZ)) { + | ^~~~~~~~~~ + +See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405. + +Cc: stable@vger.kernel.org +Acked-by: Randy Dunlap +Tested-by: Randy Dunlap # build-tested +Signed-off-by: Bart Van Assche +Link: https://lore.kernel.org/r/20230529195034.3077-1-bvanassche@acm.org +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/stex.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/scsi/stex.c ++++ b/drivers/scsi/stex.c +@@ -109,7 +109,9 @@ enum { + TASK_ATTRIBUTE_HEADOFQUEUE = 0x1, + TASK_ATTRIBUTE_ORDERED = 0x2, + TASK_ATTRIBUTE_ACA = 0x4, ++}; + ++enum { + SS_STS_NORMAL = 0x80000000, + SS_STS_DONE = 0x40000000, + SS_STS_HANDSHAKE = 0x20000000, +@@ -121,7 +123,9 @@ enum { + SS_I2H_REQUEST_RESET = 0x2000, + + SS_MU_OPERATIONAL = 0x80000000, ++}; + ++enum { + STEX_CDB_LENGTH = 16, + STATUS_VAR_LEN = 128, + diff --git a/queue-5.15/series b/queue-5.15/series index 22e597e9496..5421ba3668a 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -113,3 +113,8 @@ usb-gadget-f_fs-add-unbind-event-before-functionfs_unbind.patch md-raid5-fix-miscalculation-of-end_sector-in-raid5_read_one_chunk.patch misc-fastrpc-return-epipe-to-invocations-on-device-removal.patch misc-fastrpc-reject-new-invocations-during-device-removal.patch +scsi-stex-fix-gcc-13-warnings.patch +ata-libata-scsi-use-correct-device-no-in-ata_find_dev.patch +drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-vangogh.patch +drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-yellow-carp.patch +drm-amd-pm-reverse-mclk-and-fclk-clocks-levels-for-renoir.patch