From 82af62063be9fe92f8b4f7e1901cede38fe51834 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Nov 2022 13:41:52 +0100 Subject: [PATCH] 5.15-stable patches added patches: nvme-ensure-subsystem-reset-is-single-threaded.patch nvme-restrict-management-ioctls-to-admin.patch serial-8250_lpss-use-16b-dma-burst-with-elkhart-lake.patch --- ...e-subsystem-reset-is-single-threaded.patch | 67 +++++++++++++++++++ ...-restrict-management-ioctls-to-admin.patch | 41 ++++++++++++ ...-use-16b-dma-burst-with-elkhart-lake.patch | 43 ++++++++++++ queue-5.15/series | 3 + 4 files changed, 154 insertions(+) create mode 100644 queue-5.15/nvme-ensure-subsystem-reset-is-single-threaded.patch create mode 100644 queue-5.15/nvme-restrict-management-ioctls-to-admin.patch create mode 100644 queue-5.15/serial-8250_lpss-use-16b-dma-burst-with-elkhart-lake.patch diff --git a/queue-5.15/nvme-ensure-subsystem-reset-is-single-threaded.patch b/queue-5.15/nvme-ensure-subsystem-reset-is-single-threaded.patch new file mode 100644 index 00000000000..091221f5608 --- /dev/null +++ b/queue-5.15/nvme-ensure-subsystem-reset-is-single-threaded.patch @@ -0,0 +1,67 @@ +From 1e866afd4bcdd01a70a5eddb4371158d3035ce03 Mon Sep 17 00:00:00 2001 +From: Keith Busch +Date: Thu, 22 Sep 2022 08:13:47 -0700 +Subject: nvme: ensure subsystem reset is single threaded + +From: Keith Busch + +commit 1e866afd4bcdd01a70a5eddb4371158d3035ce03 upstream. + +The subsystem reset writes to a register, so we have to ensure the +device state is capable of handling that otherwise the driver may access +unmapped registers. Use the state machine to ensure the subsystem reset +doesn't try to write registers on a device already undergoing this type +of reset. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=214771 +Signed-off-by: Keith Busch +Signed-off-by: Christoph Hellwig +Signed-off-by: Ovidiu Panait +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvme/host/nvme.h | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +--- a/drivers/nvme/host/nvme.h ++++ b/drivers/nvme/host/nvme.h +@@ -558,11 +558,23 @@ static inline void nvme_fault_inject_fin + static inline void nvme_should_fail(struct request *req) {} + #endif + ++bool nvme_wait_reset(struct nvme_ctrl *ctrl); ++int nvme_try_sched_reset(struct nvme_ctrl *ctrl); ++ + static inline int nvme_reset_subsystem(struct nvme_ctrl *ctrl) + { ++ int ret; ++ + if (!ctrl->subsystem) + return -ENOTTY; +- return ctrl->ops->reg_write32(ctrl, NVME_REG_NSSR, 0x4E564D65); ++ if (!nvme_wait_reset(ctrl)) ++ return -EBUSY; ++ ++ ret = ctrl->ops->reg_write32(ctrl, NVME_REG_NSSR, 0x4E564D65); ++ if (ret) ++ return ret; ++ ++ return nvme_try_sched_reset(ctrl); + } + + /* +@@ -650,7 +662,6 @@ void nvme_cancel_tagset(struct nvme_ctrl + void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl); + bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, + enum nvme_ctrl_state new_state); +-bool nvme_wait_reset(struct nvme_ctrl *ctrl); + int nvme_disable_ctrl(struct nvme_ctrl *ctrl); + int nvme_enable_ctrl(struct nvme_ctrl *ctrl); + int nvme_shutdown_ctrl(struct nvme_ctrl *ctrl); +@@ -734,7 +745,6 @@ int nvme_set_queue_count(struct nvme_ctr + void nvme_stop_keep_alive(struct nvme_ctrl *ctrl); + int nvme_reset_ctrl(struct nvme_ctrl *ctrl); + int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl); +-int nvme_try_sched_reset(struct nvme_ctrl *ctrl); + int nvme_delete_ctrl(struct nvme_ctrl *ctrl); + void nvme_queue_scan(struct nvme_ctrl *ctrl); + int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi, diff --git a/queue-5.15/nvme-restrict-management-ioctls-to-admin.patch b/queue-5.15/nvme-restrict-management-ioctls-to-admin.patch new file mode 100644 index 00000000000..2e229824daf --- /dev/null +++ b/queue-5.15/nvme-restrict-management-ioctls-to-admin.patch @@ -0,0 +1,41 @@ +From 23e085b2dead13b51fe86d27069895b740f749c0 Mon Sep 17 00:00:00 2001 +From: Keith Busch +Date: Thu, 22 Sep 2022 07:54:06 -0700 +Subject: nvme: restrict management ioctls to admin + +From: Keith Busch + +commit 23e085b2dead13b51fe86d27069895b740f749c0 upstream. + +The passthrough commands already have this restriction, but the other +operations do not. Require the same capabilities for all users as all of +these operations, which include resets and rescans, can be disruptive. + +Signed-off-by: Keith Busch +Signed-off-by: Christoph Hellwig +Signed-off-by: Ovidiu Panait +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvme/host/ioctl.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvme/host/ioctl.c ++++ b/drivers/nvme/host/ioctl.c +@@ -484,11 +484,17 @@ long nvme_dev_ioctl(struct file *file, u + case NVME_IOCTL_IO_CMD: + return nvme_dev_user_cmd(ctrl, argp); + case NVME_IOCTL_RESET: ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EACCES; + dev_warn(ctrl->device, "resetting controller\n"); + return nvme_reset_ctrl_sync(ctrl); + case NVME_IOCTL_SUBSYS_RESET: ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EACCES; + return nvme_reset_subsystem(ctrl); + case NVME_IOCTL_RESCAN: ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EACCES; + nvme_queue_scan(ctrl); + return 0; + default: diff --git a/queue-5.15/serial-8250_lpss-use-16b-dma-burst-with-elkhart-lake.patch b/queue-5.15/serial-8250_lpss-use-16b-dma-burst-with-elkhart-lake.patch new file mode 100644 index 00000000000..597582ba753 --- /dev/null +++ b/queue-5.15/serial-8250_lpss-use-16b-dma-burst-with-elkhart-lake.patch @@ -0,0 +1,43 @@ +From 7090abd6ad0610a144523ce4ffcb8560909bf2a8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= +Date: Tue, 8 Nov 2022 14:19:51 +0200 +Subject: serial: 8250_lpss: Use 16B DMA burst with Elkhart Lake +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +commit 7090abd6ad0610a144523ce4ffcb8560909bf2a8 upstream. + +Configure DMA to use 16B burst size with Elkhart Lake. This makes the +bus use more efficient and works around an issue which occurs with the +previously used 1B. + +The fix was initially developed by Srikanth Thokala and Aman Kumar. +This together with the previous config change is the cleaned up version +of the original fix. + +Fixes: 0a9410b981e9 ("serial: 8250_lpss: Enable DMA on Intel Elkhart Lake") +Cc: # serial: 8250_lpss: Configure DMA also w/o DMA filter +Reported-by: Wentong Wu +Signed-off-by: Ilpo Järvinen +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20221108121952.5497-4-ilpo.jarvinen@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_lpss.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/tty/serial/8250/8250_lpss.c ++++ b/drivers/tty/serial/8250/8250_lpss.c +@@ -177,6 +177,9 @@ static int ehl_serial_setup(struct lpss8 + * matching with the registered General Purpose DMA controllers. + */ + up->dma = dma; ++ ++ lpss->dma_maxburst = 16; ++ + return 0; + } + diff --git a/queue-5.15/series b/queue-5.15/series index 16eb511f73d..3d38e097009 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -154,3 +154,6 @@ mmc-sdhci-pci-fix-possible-memory-leak-caused-by-missing-pci_dev_put.patch docs-update-mediator-contact-information-in-coc-doc.patch misc-vmw_vmci-fix-an-infoleak-in-vmci_host_do_receive_datagram.patch perf-x86-intel-pt-fix-sampling-using-single-range-output.patch +nvme-restrict-management-ioctls-to-admin.patch +nvme-ensure-subsystem-reset-is-single-threaded.patch +serial-8250_lpss-use-16b-dma-burst-with-elkhart-lake.patch -- 2.47.3