Skip to content

Commit

Permalink
Merge tag 'for-5.14/drivers-2021-06-29' of git://git.kernel.dk/linux-…
Browse files Browse the repository at this point in the history
…block

Pull block driver updates from Jens Axboe:
 "Pretty calm round, mostly just NVMe and a bit of MD:

   - NVMe updates (via Christoph)
        - improve the APST configuration algorithm (Alexey Bogoslavsky)
        - look for StorageD3Enable on companion ACPI device
          (Mario Limonciello)
        - allow selecting the network interface for TCP connections
          (Martin Belanger)
        - misc cleanups (Amit Engel, Chaitanya Kulkarni, Colin Ian King,
          Christoph)
        - move the ACPI StorageD3 code to drivers/acpi/ and add quirks
          for certain AMD CPUs (Mario Limonciello)
        - zoned device support for nvmet (Chaitanya Kulkarni)
        - fix the rules for changing the serial number in nvmet
          (Noam Gottlieb)
        - various small fixes and cleanups (Dan Carpenter, JK Kim,
          Chaitanya Kulkarni, Hannes Reinecke, Wesley Sheng, Geert
          Uytterhoeven, Daniel Wagner)

   - MD updates (Via Song)
        - iostats rewrite (Guoqing Jiang)
        - raid5 lock contention optimization (Gal Ofri)

   - Fall through warning fix (Gustavo)

   - Misc fixes (Gustavo, Jiapeng)"

* tag 'for-5.14/drivers-2021-06-29' of git://git.kernel.dk/linux-block: (78 commits)
  nvmet: use NVMET_MAX_NAMESPACES to set nn value
  loop: Fix missing discard support when using LOOP_CONFIGURE
  nvme.h: add missing nvme_lba_range_type endianness annotations
  nvme: remove zeroout memset call for struct
  nvme-pci: remove zeroout memset call for struct
  nvmet: remove zeroout memset call for struct
  nvmet: add ZBD over ZNS backend support
  nvmet: add Command Set Identifier support
  nvmet: add nvmet_req_bio put helper for backends
  nvmet: add req cns error complete helper
  block: export blk_next_bio()
  nvmet: remove local variable
  nvmet: use nvme status value directly
  nvmet: use u32 type for the local variable nsid
  nvmet: use u32 for nvmet_subsys max_nsid
  nvmet: use req->cmd directly in file-ns fast path
  nvmet: use req->cmd directly in bdev-ns fast path
  nvmet: make ver stable once connection established
  nvmet: allow mn change if subsys not discovered
  nvmet: make sn stable once connection was established
  ...
  • Loading branch information
torvalds committed Jun 30, 2021
2 parents df668a5 + 5ed9b35 commit 4404621
Show file tree
Hide file tree
Showing 54 changed files with 1,467 additions and 519 deletions.
1 change: 1 addition & 0 deletions block/blk-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp)

return new;
}
EXPORT_SYMBOL_GPL(blk_next_bio);

int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask, int flags,
Expand Down
32 changes: 32 additions & 0 deletions drivers/acpi/device_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,4 +1368,36 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)
return 1;
}
EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);

/**
* acpi_storage_d3 - Check if D3 should be used in the suspend path
* @dev: Device to check
*
* Return %true if the platform firmware wants @dev to be programmed
* into D3hot or D3cold (if supported) in the suspend path, or %false
* when there is no specific preference. On some platforms, if this
* hint is ignored, @dev may remain unresponsive after suspending the
* platform as a whole.
*
* Although the property has storage in the name it actually is
* applied to the PCIe slot and plugging in a non-storage device the
* same platform restrictions will likely apply.
*/
bool acpi_storage_d3(struct device *dev)
{
struct acpi_device *adev = ACPI_COMPANION(dev);
u8 val;

if (force_storage_d3())
return true;

if (!adev)
return false;
if (fwnode_property_read_u8(acpi_fwnode_handle(adev), "StorageD3Enable",
&val))
return false;
return val == 1;
}
EXPORT_SYMBOL_GPL(acpi_storage_d3);

#endif /* CONFIG_PM */
9 changes: 9 additions & 0 deletions drivers/acpi/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ static inline int suspend_nvs_save(void) { return 0; }
static inline void suspend_nvs_restore(void) {}
#endif

#ifdef CONFIG_X86
bool force_storage_d3(void);
#else
static inline bool force_storage_d3(void)
{
return false;
}
#endif

/*--------------------------------------------------------------------------
Device properties
-------------------------------------------------------------------------- */
Expand Down
25 changes: 25 additions & 0 deletions drivers/acpi/x86/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,28 @@ bool acpi_device_always_present(struct acpi_device *adev)

return ret;
}

/*
* AMD systems from Renoir and Lucienne *require* that the NVME controller
* is put into D3 over a Modern Standby / suspend-to-idle cycle.
*
* This is "typically" accomplished using the `StorageD3Enable`
* property in the _DSD that is checked via the `acpi_storage_d3` function
* but this property was introduced after many of these systems launched
* and most OEM systems don't have it in their BIOS.
*
* The Microsoft documentation for StorageD3Enable mentioned that Windows has
* a hardcoded allowlist for D3 support, which was used for these platforms.
*
* This allows quirking on Linux in a similar fashion.
*/
static const struct x86_cpu_id storage_d3_cpu_ids[] = {
X86_MATCH_VENDOR_FAM_MODEL(AMD, 23, 96, NULL), /* Renoir */
X86_MATCH_VENDOR_FAM_MODEL(AMD, 23, 104, NULL), /* Lucienne */
{}
};

bool force_storage_d3(void)
{
return x86_match_cpu(storage_d3_cpu_ids);
}
4 changes: 1 addition & 3 deletions drivers/block/aoe/aoechr.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
}

mp = kmemdup(msg, n, GFP_ATOMIC);
if (mp == NULL) {
printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
if (!mp)
goto bail;
}

em->msg = mp;
em->flags |= EMFL_VALID;
Expand Down
22 changes: 6 additions & 16 deletions drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3770,10 +3770,8 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
}

new_net_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
if (!new_net_conf) {
drbd_err(connection, "Allocation of new net_conf failed\n");
if (!new_net_conf)
goto disconnect;
}

mutex_lock(&connection->data.mutex);
mutex_lock(&connection->resource->conf_update);
Expand Down Expand Up @@ -4020,10 +4018,8 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i

if (verify_tfm || csums_tfm) {
new_net_conf = kzalloc(sizeof(struct net_conf), GFP_KERNEL);
if (!new_net_conf) {
drbd_err(device, "Allocation of new net_conf failed\n");
if (!new_net_conf)
goto disconnect;
}

*new_net_conf = *old_net_conf;

Expand Down Expand Up @@ -4161,7 +4157,6 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info

new_disk_conf = kzalloc(sizeof(struct disk_conf), GFP_KERNEL);
if (!new_disk_conf) {
drbd_err(device, "Allocation of new disk_conf failed\n");
put_ldev(device);
return -ENOMEM;
}
Expand Down Expand Up @@ -4288,10 +4283,8 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
device = peer_device->device;

p_uuid = kmalloc_array(UI_EXTENDED_SIZE, sizeof(*p_uuid), GFP_NOIO);
if (!p_uuid) {
drbd_err(device, "kmalloc of p_uuid failed\n");
if (!p_uuid)
return false;
}

for (i = UI_CURRENT; i < UI_EXTENDED_SIZE; i++)
p_uuid[i] = be64_to_cpu(p->uuid[i]);
Expand Down Expand Up @@ -5484,8 +5477,7 @@ static int drbd_do_auth(struct drbd_connection *connection)
}

peers_ch = kmalloc(pi.size, GFP_NOIO);
if (peers_ch == NULL) {
drbd_err(connection, "kmalloc of peers_ch failed\n");
if (!peers_ch) {
rv = -1;
goto fail;
}
Expand All @@ -5504,8 +5496,7 @@ static int drbd_do_auth(struct drbd_connection *connection)

resp_size = crypto_shash_digestsize(connection->cram_hmac_tfm);
response = kmalloc(resp_size, GFP_NOIO);
if (response == NULL) {
drbd_err(connection, "kmalloc of response failed\n");
if (!response) {
rv = -1;
goto fail;
}
Expand Down Expand Up @@ -5552,8 +5543,7 @@ static int drbd_do_auth(struct drbd_connection *connection)
}

right_response = kmalloc(resp_size, GFP_NOIO);
if (right_response == NULL) {
drbd_err(connection, "kmalloc of right_response failed\n");
if (!right_response) {
rv = -1;
goto fail;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,7 @@ static void format_interrupt(void)
switch (interpret_errors()) {
case 1:
cont->error();
break;
case 2:
break;
case 0:
Expand Down Expand Up @@ -2330,7 +2331,6 @@ static void rw_interrupt(void)
if (!drive_state[current_drive].first_read_date)
drive_state[current_drive].first_read_date = jiffies;

nr_sectors = 0;
ssize = DIV_ROUND_UP(1 << raw_cmd->cmd[SIZECODE], 4);

if (reply_buffer[ST1] & ST1_EOC)
Expand Down
1 change: 1 addition & 0 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
blk_queue_physical_block_size(lo->lo_queue, bsize);
blk_queue_io_min(lo->lo_queue, bsize);

loop_config_discard(lo);
loop_update_rotational(lo);
loop_update_dio(lo);
loop_sysfs_init(lo);
Expand Down
26 changes: 5 additions & 21 deletions drivers/block/mtip32xx/mtip32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,6 @@ static ssize_t show_device_status(struct device_driver *drv, char *buf)
static ssize_t mtip_hw_read_device_status(struct file *f, char __user *ubuf,
size_t len, loff_t *offset)
{
struct driver_data *dd = (struct driver_data *)f->private_data;
int size = *offset;
char *buf;
int rv = 0;
Expand All @@ -2247,11 +2246,8 @@ static ssize_t mtip_hw_read_device_status(struct file *f, char __user *ubuf,
return 0;

buf = kzalloc(MTIP_DFS_MAX_BUF_SIZE, GFP_KERNEL);
if (!buf) {
dev_err(&dd->pdev->dev,
"Memory allocation: status buffer\n");
if (!buf)
return -ENOMEM;
}

size += show_device_status(NULL, buf);

Expand All @@ -2277,11 +2273,8 @@ static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
return 0;

buf = kzalloc(MTIP_DFS_MAX_BUF_SIZE, GFP_KERNEL);
if (!buf) {
dev_err(&dd->pdev->dev,
"Memory allocation: register buffer\n");
if (!buf)
return -ENOMEM;
}

size += sprintf(&buf[size], "H/ S ACTive : [ 0x");

Expand Down Expand Up @@ -2343,11 +2336,8 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
return 0;

buf = kzalloc(MTIP_DFS_MAX_BUF_SIZE, GFP_KERNEL);
if (!buf) {
dev_err(&dd->pdev->dev,
"Memory allocation: flag buffer\n");
if (!buf)
return -ENOMEM;
}

size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n",
dd->port->flags);
Expand Down Expand Up @@ -2884,11 +2874,8 @@ static int mtip_hw_init(struct driver_data *dd)

dd->port = kzalloc_node(sizeof(struct mtip_port), GFP_KERNEL,
dd->numa_node);
if (!dd->port) {
dev_err(&dd->pdev->dev,
"Memory allocation: port structure\n");
if (!dd->port)
return -ENOMEM;
}

/* Continue workqueue setup */
for (i = 0; i < MTIP_MAX_SLOT_GROUPS; i++)
Expand Down Expand Up @@ -4002,11 +3989,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
cpu_to_node(raw_smp_processor_id()), raw_smp_processor_id());

dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node);
if (dd == NULL) {
dev_err(&pdev->dev,
"Unable to allocate memory for driver data\n");
if (!dd)
return -ENOMEM;
}

/* Attach the private data to this PCI device. */
pci_set_drvdata(pdev, dd);
Expand Down
6 changes: 2 additions & 4 deletions drivers/block/rsxx/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ struct dma_tracker {
struct rsxx_dma *dma;
};

#define DMA_TRACKER_LIST_SIZE8 (sizeof(struct dma_tracker_list) + \
(sizeof(struct dma_tracker) * RSXX_MAX_OUTSTANDING_CMDS))

struct dma_tracker_list {
spinlock_t lock;
int head;
Expand Down Expand Up @@ -808,7 +805,8 @@ static int rsxx_dma_ctrl_init(struct pci_dev *dev,

memset(&ctrl->stats, 0, sizeof(ctrl->stats));

ctrl->trackers = vmalloc(DMA_TRACKER_LIST_SIZE8);
ctrl->trackers = vmalloc(struct_size(ctrl->trackers, list,
RSXX_MAX_OUTSTANDING_CMDS));
if (!ctrl->trackers)
return -ENOMEM;

Expand Down
3 changes: 1 addition & 2 deletions drivers/block/sunvdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,8 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
}

port = kzalloc(sizeof(*port), GFP_KERNEL);
err = -ENOMEM;
if (!port) {
printk(KERN_ERR PFX "Cannot allocate vdc_port.\n");
err = -ENOMEM;
goto err_out_release_mdesc;
}

Expand Down
2 changes: 0 additions & 2 deletions drivers/block/sx8.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,8 +1420,6 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)

host = kzalloc(sizeof(*host), GFP_KERNEL);
if (!host) {
printk(KERN_ERR DRV_NAME "(%s): memory alloc failure\n",
pci_name(pdev));
rc = -ENOMEM;
goto err_out_regions;
}
Expand Down
10 changes: 2 additions & 8 deletions drivers/block/z2ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,8 @@ static int z2_open(struct block_device *bdev, fmode_t mode)

case Z2MINOR_Z2ONLY:
z2ram_map = kmalloc(max_z2_map, GFP_KERNEL);
if (z2ram_map == NULL) {
printk(KERN_ERR DEVICE_NAME
": cannot get mem for z2ram_map\n");
if (!z2ram_map)
goto err_out;
}

get_z2ram();

Expand All @@ -253,11 +250,8 @@ static int z2_open(struct block_device *bdev, fmode_t mode)

case Z2MINOR_CHIPONLY:
z2ram_map = kmalloc(max_chip_map, GFP_KERNEL);
if (z2ram_map == NULL) {
printk(KERN_ERR DEVICE_NAME
": cannot get mem for z2ram_map\n");
if (!z2ram_map)
goto err_out;
}

get_chipram();

Expand Down
6 changes: 3 additions & 3 deletions drivers/md/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ config MD_AUTODETECT
If unsure, say Y.

config MD_LINEAR
tristate "Linear (append) mode"
tristate "Linear (append) mode (deprecated)"
depends on BLK_DEV_MD
help
If you say Y here, then your multiple devices driver will be able to
Expand Down Expand Up @@ -158,7 +158,7 @@ config MD_RAID456
If unsure, say Y.

config MD_MULTIPATH
tristate "Multipath I/O support"
tristate "Multipath I/O support (deprecated)"
depends on BLK_DEV_MD
help
MD_MULTIPATH provides a simple multi-path personality for use
Expand All @@ -169,7 +169,7 @@ config MD_MULTIPATH
If unsure, say N.

config MD_FAULTY
tristate "Faulty test module for MD"
tristate "Faulty test module for MD (deprecated)"
depends on BLK_DEV_MD
help
The "faulty" module allows for a block device that occasionally returns
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/md-bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2616,7 +2616,7 @@ static struct attribute *md_bitmap_attrs[] = {
&max_backlog_used.attr,
NULL
};
struct attribute_group md_bitmap_group = {
const struct attribute_group md_bitmap_group = {
.name = "bitmap",
.attrs = md_bitmap_attrs,
};
2 changes: 1 addition & 1 deletion drivers/md/md-faulty.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static void raid_exit(void)
module_init(raid_init);
module_exit(raid_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Fault injection personality for MD");
MODULE_DESCRIPTION("Fault injection personality for MD (deprecated)");
MODULE_ALIAS("md-personality-10"); /* faulty */
MODULE_ALIAS("md-faulty");
MODULE_ALIAS("md-level--5");
2 changes: 1 addition & 1 deletion drivers/md/md-linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static void linear_exit (void)
module_init(linear_init);
module_exit(linear_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Linear device concatenation personality for MD");
MODULE_DESCRIPTION("Linear device concatenation personality for MD (deprecated)");
MODULE_ALIAS("md-personality-1"); /* LINEAR - deprecated*/
MODULE_ALIAS("md-linear");
MODULE_ALIAS("md-level--1");
Loading

0 comments on commit 4404621

Please sign in to comment.