nvme fixes for Linux 6.1
- fix nvme-hwmon for DMA non-cohehrent architectures (Serge Semin) - add a nvme-hwmong maintainer (Christoph Hellwig) - fix error pointer dereference in error handling (Dan Carpenter) - fix invalid memory reference in nvmet_subsys_attr_qid_max_show (Daniel Wagner) - don't limit the DMA segment size in nvme-apple (Russell King) - fix workqueue MEM_RECLAIM flushing dependency (Sagi Grimberg) - disable write zeroes on various Kingston SSDs (Xander Li) -----BEGIN PGP SIGNATURE----- iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAmNRDSMLHGhjaEBsc3Qu ZGUACgkQD55TZVIEUYMTuQ//XdCeDlgwOk3DfeHOKuiGRD6JT6/h0UClw/lSaVXz GUOg/fg3TxI2O49pNWKuglxWaopRnJLB0OLYMFGkMw0ANsRKKnbWB30QBzNrdxE2 +GCG3a2aUYF68Z3aR/4pDZf6Ta5OPlQDw8Xw2YwhQHWmF+H8EkW3Rwa3YHtGNFDq tdjJDRUz8QqLpQuxVsr5MT5rYr7fJFwAh8Z7MU1Jv5VRkZRYbSrzS5qosOscZhm/ rvrGZij/ez1HDmXi0TONZnp1JmKwznkiVk8rsLiZ3XopZikoaNmxRzT5aLSGHOXt JeeYbWCTVz++E2JPOZKUgBdF6ZwXxSMz+nyLA9utZWJ7bBAA+7LSNBF/8iSwwgXm 7wCkhxHmn57XBaxupmX1bfW97wbh8KrYGu4c4Oka5W3ll9gRCeeBN3bGJoWQbUkm Nbr9+0+3fRWP4h3gIBxNJ/ZUiyR0s8CSwOqveVH63G18ZvhD0/uCtYIUt4iR4AfX U83qjdW+uEFfYE9nIOjJNhyHdJbLYum+TzcG6KEk5+QPr30cR3PJZaTLLmMHVqgS JiUFImMtVPJ65f60gfaZt+gqKFHHFjPzRNJbb7udeEOOBBrs01kjVhsweAryBp2s KmlH5rBWJLdS8CXIUOGDmV9289u1/sRPA4fR+6G3HHEtF2zFWWsgigbae2iwLxdv /8Q= =sbEQ -----END PGP SIGNATURE----- Merge tag 'nvme-6.1-2022-10-22' of git://git.infradead.org/nvme into block-6.1 Pull NVMe fixes from Christoph: "nvme fixes for Linux 6.1 - fix nvme-hwmon for DMA non-cohehrent architectures (Serge Semin) - add a nvme-hwmong maintainer (Christoph Hellwig) - fix error pointer dereference in error handling (Dan Carpenter) - fix invalid memory reference in nvmet_subsys_attr_qid_max_show (Daniel Wagner) - don't limit the DMA segment size in nvme-apple (Russell King) - fix workqueue MEM_RECLAIM flushing dependency (Sagi Grimberg) - disable write zeroes on various Kingston SSDs (Xander Li)" * tag 'nvme-6.1-2022-10-22' of git://git.infradead.org/nvme: nvmet: fix invalid memory reference in nvmet_subsys_attr_qid_max_show nvmet: fix workqueue MEM_RECLAIM flushing dependency nvme-hwmon: kmalloc the NVME SMART log buffer nvme-hwmon: consistently ignore errors from nvme_hwmon_init nvme: add Guenther as nvme-hwmon maintainer nvme-apple: don't limit DMA segement size nvme-pci: disable write zeroes on various Kingston SSD nvme: fix error pointer dereference in error handling
This commit is contained in:
commit
70ee4a4c97
@ -14640,6 +14640,12 @@ F: drivers/nvme/target/auth.c
|
||||
F: drivers/nvme/target/fabrics-cmd-auth.c
|
||||
F: include/linux/nvme-auth.h
|
||||
|
||||
NVM EXPRESS HARDWARE MONITORING SUPPORT
|
||||
M: Guenter Roeck <linux@roeck-us.net>
|
||||
L: linux-nvme@lists.infradead.org
|
||||
S: Supported
|
||||
F: drivers/nvme/host/hwmon.c
|
||||
|
||||
NVM EXPRESS FC TRANSPORT DRIVERS
|
||||
M: James Smart <james.smart@broadcom.com>
|
||||
L: linux-nvme@lists.infradead.org
|
||||
|
@ -1039,6 +1039,8 @@ static void apple_nvme_reset_work(struct work_struct *work)
|
||||
dma_max_mapping_size(anv->dev) >> 9);
|
||||
anv->ctrl.max_segments = NVME_MAX_SEGS;
|
||||
|
||||
dma_set_max_seg_size(anv->dev, 0xffffffff);
|
||||
|
||||
/*
|
||||
* Enable NVMMU and linear submission queues.
|
||||
* While we could keep those disabled and pretend this is slightly
|
||||
|
@ -3262,8 +3262,12 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl)
|
||||
return ret;
|
||||
|
||||
if (!ctrl->identified && !nvme_discovery_ctrl(ctrl)) {
|
||||
/*
|
||||
* Do not return errors unless we are in a controller reset,
|
||||
* the controller works perfectly fine without hwmon.
|
||||
*/
|
||||
ret = nvme_hwmon_init(ctrl);
|
||||
if (ret < 0)
|
||||
if (ret == -EINTR)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -4846,7 +4850,7 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
|
||||
return 0;
|
||||
|
||||
out_cleanup_admin_q:
|
||||
blk_mq_destroy_queue(ctrl->fabrics_q);
|
||||
blk_mq_destroy_queue(ctrl->admin_q);
|
||||
out_free_tagset:
|
||||
blk_mq_free_tag_set(ctrl->admin_tagset);
|
||||
return ret;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
struct nvme_hwmon_data {
|
||||
struct nvme_ctrl *ctrl;
|
||||
struct nvme_smart_log log;
|
||||
struct nvme_smart_log *log;
|
||||
struct mutex read_lock;
|
||||
};
|
||||
|
||||
@ -60,14 +60,14 @@ static int nvme_set_temp_thresh(struct nvme_ctrl *ctrl, int sensor, bool under,
|
||||
static int nvme_hwmon_get_smart_log(struct nvme_hwmon_data *data)
|
||||
{
|
||||
return nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
|
||||
NVME_CSI_NVM, &data->log, sizeof(data->log), 0);
|
||||
NVME_CSI_NVM, data->log, sizeof(*data->log), 0);
|
||||
}
|
||||
|
||||
static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
|
||||
u32 attr, int channel, long *val)
|
||||
{
|
||||
struct nvme_hwmon_data *data = dev_get_drvdata(dev);
|
||||
struct nvme_smart_log *log = &data->log;
|
||||
struct nvme_smart_log *log = data->log;
|
||||
int temp;
|
||||
int err;
|
||||
|
||||
@ -163,7 +163,7 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
|
||||
case hwmon_temp_max:
|
||||
case hwmon_temp_min:
|
||||
if ((!channel && data->ctrl->wctemp) ||
|
||||
(channel && data->log.temp_sensor[channel - 1])) {
|
||||
(channel && data->log->temp_sensor[channel - 1])) {
|
||||
if (data->ctrl->quirks &
|
||||
NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
|
||||
return 0444;
|
||||
@ -176,7 +176,7 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
|
||||
break;
|
||||
case hwmon_temp_input:
|
||||
case hwmon_temp_label:
|
||||
if (!channel || data->log.temp_sensor[channel - 1])
|
||||
if (!channel || data->log->temp_sensor[channel - 1])
|
||||
return 0444;
|
||||
break;
|
||||
default:
|
||||
@ -230,7 +230,13 @@ int nvme_hwmon_init(struct nvme_ctrl *ctrl)
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (!data)
|
||||
return 0;
|
||||
return -ENOMEM;
|
||||
|
||||
data->log = kzalloc(sizeof(*data->log), GFP_KERNEL);
|
||||
if (!data->log) {
|
||||
err = -ENOMEM;
|
||||
goto err_free_data;
|
||||
}
|
||||
|
||||
data->ctrl = ctrl;
|
||||
mutex_init(&data->read_lock);
|
||||
@ -238,8 +244,7 @@ int nvme_hwmon_init(struct nvme_ctrl *ctrl)
|
||||
err = nvme_hwmon_get_smart_log(data);
|
||||
if (err) {
|
||||
dev_warn(dev, "Failed to read smart log (error %d)\n", err);
|
||||
kfree(data);
|
||||
return err;
|
||||
goto err_free_log;
|
||||
}
|
||||
|
||||
hwmon = hwmon_device_register_with_info(dev, "nvme",
|
||||
@ -247,11 +252,17 @@ int nvme_hwmon_init(struct nvme_ctrl *ctrl)
|
||||
NULL);
|
||||
if (IS_ERR(hwmon)) {
|
||||
dev_warn(dev, "Failed to instantiate hwmon device\n");
|
||||
kfree(data);
|
||||
return PTR_ERR(hwmon);
|
||||
err = PTR_ERR(hwmon);
|
||||
goto err_free_log;
|
||||
}
|
||||
ctrl->hwmon_device = hwmon;
|
||||
return 0;
|
||||
|
||||
err_free_log:
|
||||
kfree(data->log);
|
||||
err_free_data:
|
||||
kfree(data);
|
||||
return err;
|
||||
}
|
||||
|
||||
void nvme_hwmon_exit(struct nvme_ctrl *ctrl)
|
||||
@ -262,6 +273,7 @@ void nvme_hwmon_exit(struct nvme_ctrl *ctrl)
|
||||
|
||||
hwmon_device_unregister(ctrl->hwmon_device);
|
||||
ctrl->hwmon_device = NULL;
|
||||
kfree(data->log);
|
||||
kfree(data);
|
||||
}
|
||||
}
|
||||
|
@ -3511,6 +3511,16 @@ static const struct pci_device_id nvme_id_table[] = {
|
||||
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
|
||||
{ PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */
|
||||
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
|
||||
{ PCI_DEVICE(0x2646, 0x5018), /* KINGSTON OM8SFP4xxxxP OS21012 NVMe SSD */
|
||||
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
|
||||
{ PCI_DEVICE(0x2646, 0x5016), /* KINGSTON OM3PGP4xxxxP OS21011 NVMe SSD */
|
||||
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
|
||||
{ PCI_DEVICE(0x2646, 0x501A), /* KINGSTON OM8PGP4xxxxP OS21005 NVMe SSD */
|
||||
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
|
||||
{ PCI_DEVICE(0x2646, 0x501B), /* KINGSTON OM8PGP4xxxxQ OS21005 NVMe SSD */
|
||||
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
|
||||
{ PCI_DEVICE(0x2646, 0x501E), /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */
|
||||
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
|
||||
{ PCI_DEVICE(0x1e4B, 0x1001), /* MAXIO MAP1001 */
|
||||
.driver_data = NVME_QUIRK_BOGUS_NID, },
|
||||
{ PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */
|
||||
|
@ -1290,12 +1290,8 @@ static ssize_t nvmet_subsys_attr_qid_max_show(struct config_item *item,
|
||||
static ssize_t nvmet_subsys_attr_qid_max_store(struct config_item *item,
|
||||
const char *page, size_t cnt)
|
||||
{
|
||||
struct nvmet_port *port = to_nvmet_port(item);
|
||||
u16 qid_max;
|
||||
|
||||
if (nvmet_is_port_enabled(port, __func__))
|
||||
return -EACCES;
|
||||
|
||||
if (sscanf(page, "%hu\n", &qid_max) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
|
||||
* reset the keep alive timer when the controller is enabled.
|
||||
*/
|
||||
if (ctrl->kato)
|
||||
mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
|
||||
mod_delayed_work(nvmet_wq, &ctrl->ka_work, ctrl->kato * HZ);
|
||||
}
|
||||
|
||||
static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user