Skip to content

Commit 7cc670e

Browse files
mwilckgregkh
authored andcommitted
scsi: smartpqi: Use is_kdump_kernel() to check for kdump
[ Upstream commit a2d5a00 ] The smartpqi driver checks the reset_devices variable to determine whether special adjustments need to be made for kdump. This has the effect that after a regular kexec reboot, some driver parameters such as max_transfer_size are much lower than usual. More importantly, kexec reboot tests have revealed memory corruption caused by the driver log being written to system memory after a kexec. Fix this by testing is_kdump_kernel() rather than reset_devices where appropriate. Fixes: 058311b ("scsi: smartpqi: Add fw log to kdump") Signed-off-by: Martin Wilck <mwilck@suse.com> Link: https://lore.kernel.org/r/20250321223319.109250-1-mwilck@suse.com Cc: Randy Wright <rwright@hpe.com> Acked-by: Don Brace <don.brace@microchip.com> Tested-by: Don Brace <don.brace@microchip.com> Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5e8438f commit 7cc670e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/scsi/smartpqi/smartpqi_init.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/bcd.h>
2020
#include <linux/reboot.h>
2121
#include <linux/cciss_ioctl.h>
22+
#include <linux/crash_dump.h>
2223
#include <scsi/scsi_host.h>
2324
#include <scsi/scsi_cmnd.h>
2425
#include <scsi/scsi_device.h>
@@ -5246,7 +5247,7 @@ static void pqi_calculate_io_resources(struct pqi_ctrl_info *ctrl_info)
52465247
ctrl_info->error_buffer_length =
52475248
ctrl_info->max_io_slots * PQI_ERROR_BUFFER_ELEMENT_LENGTH;
52485249

5249-
if (reset_devices)
5250+
if (is_kdump_kernel())
52505251
max_transfer_size = min(ctrl_info->max_transfer_size,
52515252
PQI_MAX_TRANSFER_SIZE_KDUMP);
52525253
else
@@ -5275,7 +5276,7 @@ static void pqi_calculate_queue_resources(struct pqi_ctrl_info *ctrl_info)
52755276
u16 num_elements_per_iq;
52765277
u16 num_elements_per_oq;
52775278

5278-
if (reset_devices) {
5279+
if (is_kdump_kernel()) {
52795280
num_queue_groups = 1;
52805281
} else {
52815282
int num_cpus;
@@ -8287,12 +8288,12 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)
82878288
u32 product_id;
82888289

82898290
if (reset_devices) {
8290-
if (pqi_is_fw_triage_supported(ctrl_info)) {
8291+
if (is_kdump_kernel() && pqi_is_fw_triage_supported(ctrl_info)) {
82918292
rc = sis_wait_for_fw_triage_completion(ctrl_info);
82928293
if (rc)
82938294
return rc;
82948295
}
8295-
if (sis_is_ctrl_logging_supported(ctrl_info)) {
8296+
if (is_kdump_kernel() && sis_is_ctrl_logging_supported(ctrl_info)) {
82968297
sis_notify_kdump(ctrl_info);
82978298
rc = sis_wait_for_ctrl_logging_completion(ctrl_info);
82988299
if (rc)
@@ -8343,7 +8344,7 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)
83438344
ctrl_info->product_id = (u8)product_id;
83448345
ctrl_info->product_revision = (u8)(product_id >> 8);
83458346

8346-
if (reset_devices) {
8347+
if (is_kdump_kernel()) {
83478348
if (ctrl_info->max_outstanding_requests >
83488349
PQI_MAX_OUTSTANDING_REQUESTS_KDUMP)
83498350
ctrl_info->max_outstanding_requests =
@@ -8479,7 +8480,7 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)
84798480
if (rc)
84808481
return rc;
84818482

8482-
if (ctrl_info->ctrl_logging_supported && !reset_devices) {
8483+
if (ctrl_info->ctrl_logging_supported && !is_kdump_kernel()) {
84838484
pqi_host_setup_buffer(ctrl_info, &ctrl_info->ctrl_log_memory, PQI_CTRL_LOG_TOTAL_SIZE, PQI_CTRL_LOG_MIN_SIZE);
84848485
pqi_host_memory_update(ctrl_info, &ctrl_info->ctrl_log_memory, PQI_VENDOR_GENERAL_CTRL_LOG_MEMORY_UPDATE);
84858486
}

0 commit comments

Comments
 (0)