mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
vblk:mtd: Update the memory allocation
- The Linux BSP secutiry requirement "LINUXBSP70-REQ-223" mandates the memory to be initialized before use. So, updated the driver to use zero initialized memory allocation API's. - Removed the IVC reset done during resume. Jira SSV-12846 Change-Id: Iac9bd11edb520584206797446b8f3a59d20b2453 Signed-off-by: Sanjith T D <std@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3354502 Reviewed-by: Sreenivas Velpula <svelpula@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Vipin Kumar <vipink@nvidia.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nvidia/conftest.h>
|
#include <nvidia/conftest.h>
|
||||||
@@ -468,6 +468,7 @@ static void setup_device(struct vblk_dev *vblkdev)
|
|||||||
tegra_hv_mempool_unreserve(vblkdev->ivmk);
|
tegra_hv_mempool_unreserve(vblkdev->ivmk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
memset(vblkdev->shared_buffer, 0, ivmk->size);
|
||||||
|
|
||||||
max_requests = ((vblkdev->ivmk->size) / max_io_bytes);
|
max_requests = ((vblkdev->ivmk->size) / max_io_bytes);
|
||||||
|
|
||||||
@@ -669,6 +670,8 @@ static int vblk_oops_get_configinfo(struct vblk_dev *vblkdev)
|
|||||||
dev_err(vblkdev->device, "allocate buffer failed\n");
|
dev_err(vblkdev->device, "allocate buffer failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
memset(vblkdev->ufs_buf, 0,
|
||||||
|
PAGE_SIZE << (get_order(vblkdev_oops->pstore_kmsg_size)));
|
||||||
vblkdev->ufs_iova = dma_map_single(vblkdev->device, vblkdev->ufs_buf,
|
vblkdev->ufs_iova = dma_map_single(vblkdev->device, vblkdev->ufs_buf,
|
||||||
vblkdev_oops->pstore_kmsg_size, DMA_BIDIRECTIONAL);
|
vblkdev_oops->pstore_kmsg_size, DMA_BIDIRECTIONAL);
|
||||||
if (dma_mapping_error(vblkdev->device, vblkdev->ufs_iova)) {
|
if (dma_mapping_error(vblkdev->device, vblkdev->ufs_iova)) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
#include <linux/kernel.h> /* printk() */
|
#include <linux/kernel.h> /* printk() */
|
||||||
#include <linux/vmalloc.h> /* kmalloc() */
|
#include <linux/vmalloc.h> /* kmalloc() */
|
||||||
@@ -36,7 +36,7 @@ int vblk_prep_mmc_multi_ioc(struct vblk_dev *vblkdev,
|
|||||||
uint8_t *tmpaddr;
|
uint8_t *tmpaddr;
|
||||||
void *ioctl_buf;
|
void *ioctl_buf;
|
||||||
|
|
||||||
ioctl_buf = vmalloc(ioctl_bytes);
|
ioctl_buf = vzalloc(ioctl_bytes);
|
||||||
if (ioctl_buf == NULL)
|
if (ioctl_buf == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@@ -44,7 +44,7 @@ int vblk_prep_sg_io(struct vblk_dev *vblkdev,
|
|||||||
uint32_t alignment_add;
|
uint32_t alignment_add;
|
||||||
uint32_t temp_sum;
|
uint32_t temp_sum;
|
||||||
|
|
||||||
hp = kmalloc(header_len, GFP_KERNEL);
|
hp = kzalloc(header_len, GFP_KERNEL);
|
||||||
if (hp == NULL) {
|
if (hp == NULL) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ int vblk_prep_sg_io(struct vblk_dev *vblkdev,
|
|||||||
goto free_hp;
|
goto free_hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ioctl_buf = kmalloc(ioctl_len, GFP_KERNEL);
|
ioctl_buf = kzalloc(ioctl_len, GFP_KERNEL);
|
||||||
if (ioctl_buf == NULL) {
|
if (ioctl_buf == NULL) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto free_hp;
|
goto free_hp;
|
||||||
@@ -240,7 +240,7 @@ int vblk_complete_sg_io(struct vblk_dev *vblkdev,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
hp = kmalloc(header_len, GFP_KERNEL);
|
hp = kzalloc(header_len, GFP_KERNEL);
|
||||||
if (hp == NULL) {
|
if (hp == NULL) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
#include <linux/vmalloc.h> /* kmalloc() */
|
#include <linux/vmalloc.h> /* kmalloc() */
|
||||||
#include <linux/errno.h> /* error codes */
|
#include <linux/errno.h> /* error codes */
|
||||||
@@ -146,7 +146,7 @@ int vblk_prep_ufs_combo_ioc(struct vblk_dev *vblkdev,
|
|||||||
size_t data_len = 0;
|
size_t data_len = 0;
|
||||||
bool w_flag = false;
|
bool w_flag = false;
|
||||||
|
|
||||||
ioctl_buf = vmalloc(ioctl_bytes);
|
ioctl_buf = vzalloc(ioctl_bytes);
|
||||||
if (ioctl_buf == NULL)
|
if (ioctl_buf == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|||||||
@@ -793,7 +793,7 @@ static blk_status_t vblk_request(struct blk_mq_hw_ctx *hctx,
|
|||||||
blk_mq_start_request(req);
|
blk_mq_start_request(req);
|
||||||
|
|
||||||
/* malloc for req list entry */
|
/* malloc for req list entry */
|
||||||
entry = kmalloc(sizeof(struct req_entry), GFP_ATOMIC);
|
entry = kzalloc(sizeof(struct req_entry), GFP_ATOMIC);
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
dev_err(vblkdev->device, "Failed to allocate memory\n");
|
dev_err(vblkdev->device, "Failed to allocate memory\n");
|
||||||
return BLK_STS_IOERR;
|
return BLK_STS_IOERR;
|
||||||
@@ -1548,6 +1548,7 @@ static void setup_device(struct vblk_dev *vblkdev)
|
|||||||
tegra_hv_mempool_unreserve(vblkdev->ivmk);
|
tegra_hv_mempool_unreserve(vblkdev->ivmk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
memset(vblkdev->shared_buffer, 0, ivmk->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If IOVA feature is enabled for virt partition, then set max_requests
|
/* If IOVA feature is enabled for virt partition, then set max_requests
|
||||||
|
|||||||
@@ -375,8 +375,6 @@ static int tegra_virt_mtd_suspend(struct device *dev)
|
|||||||
if (vmtddev->is_setup) {
|
if (vmtddev->is_setup) {
|
||||||
mutex_lock(&vmtddev->lock);
|
mutex_lock(&vmtddev->lock);
|
||||||
disable_irq(vmtddev->ivck->irq);
|
disable_irq(vmtddev->ivck->irq);
|
||||||
/* Reset the channel */
|
|
||||||
tegra_hv_ivc_channel_reset(vmtddev->ivck);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -751,6 +749,7 @@ static int tegra_virt_mtd_probe(struct platform_device *pdev)
|
|||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto free_mempool;
|
goto free_mempool;
|
||||||
}
|
}
|
||||||
|
memset(vmtddev->shared_buffer, 0, ivmk->size);
|
||||||
|
|
||||||
if (vmtddev->ivck->frame_size < sizeof(struct vs_request)) {
|
if (vmtddev->ivck->frame_size < sizeof(struct vs_request)) {
|
||||||
dev_err(dev, "Frame size %d less than ivc_req %ld!\n",
|
dev_err(dev, "Frame size %d less than ivc_req %ld!\n",
|
||||||
@@ -760,7 +759,7 @@ static int tegra_virt_mtd_probe(struct platform_device *pdev)
|
|||||||
goto free_mempool;
|
goto free_mempool;
|
||||||
}
|
}
|
||||||
|
|
||||||
vmtddev->cmd_frame = devm_kmalloc(vmtddev->device,
|
vmtddev->cmd_frame = devm_kzalloc(vmtddev->device,
|
||||||
vmtddev->ivck->frame_size, GFP_KERNEL);
|
vmtddev->ivck->frame_size, GFP_KERNEL);
|
||||||
if (vmtddev->cmd_frame == NULL) {
|
if (vmtddev->cmd_frame == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
|||||||
Reference in New Issue
Block a user