* @dev: the struct device for the crashed device
* @data: vmalloc data containing the device coredump
* @datalen: length of the data
+ * @gfp: allocation flags
*
* This function takes ownership of the vmalloc'ed data and will free
* it when it is no longer used. See dev_coredumpm() for more information.
*/
-void dev_coredumpv(struct device *dev, void *data, size_t datalen)
+void dev_coredumpv(struct device *dev, void *data, size_t datalen,
+ gfp_t gfp)
{
- dev_coredumpm(dev, NULL, data, datalen, devcd_readv, devcd_freev);
+ dev_coredumpm(dev, NULL, data, datalen, gfp, devcd_readv, devcd_freev);
}
EXPORT_SYMBOL_GPL(dev_coredumpv);
* @owner: the module that contains the read/free functions, use %THIS_MODULE
* @data: data cookie for the @read/@free functions
* @datalen: length of the data
+ * @gfp: allocation flags
* @read: function to read from the given buffer
* @free: function to free the given buffer
*
* function will be called to free the data.
*/
void dev_coredumpm(struct device *dev, struct module *owner,
- void *data, size_t datalen,
+ void *data, size_t datalen, gfp_t gfp,
ssize_t (*read)(char *buffer, loff_t offset, size_t count,
void *data, size_t datalen),
void (*free)(void *data))
if (!try_module_get(owner))
goto free;
- devcd = kzalloc(sizeof(*devcd), GFP_KERNEL);
+ devcd = kzalloc(sizeof(*devcd), gfp);
if (!devcd)
goto put_module;
* @dev: the struct device for the crashed device
* @table: the dump data
* @datalen: length of the data
+ * @gfp: allocation flags
*
* Creates a new device coredump for the given device. If a previous one hasn't
* been read yet, the new coredump is discarded. The data lifetime is determined
* it will free the data.
*/
void dev_coredumpsg(struct device *dev, struct scatterlist *table,
- size_t datalen)
+ size_t datalen, gfp_t gfp)
{
- dev_coredumpm(dev, NULL, table, datalen, devcd_read_from_sgtable,
+ dev_coredumpm(dev, NULL, table, datalen, gfp, devcd_read_from_sgtable,
devcd_free_sgtable);
}
EXPORT_SYMBOL_GPL(dev_coredumpsg);
/* fw_dump_data will be free in device coredump release function
* after 5 min
*/
- dev_coredumpv(&card->func->dev, fw_dump_data, fw_dump_len);
+ dev_coredumpv(&card->func->dev, fw_dump_data, fw_dump_len, GFP_KERNEL);
BT_INFO("== btmrvl firmware dump to /sys/class/devcoredump end");
}
qca_memdump->ram_dump_size);
memdump_buf = qca_memdump->memdump_buf_head;
dev_coredumpv(&hu->serdev->dev, memdump_buf,
- qca_memdump->received_dump);
+ qca_memdump->received_dump, GFP_KERNEL);
cancel_delayed_work(&qca->ctrl_memdump_timeout);
kfree(qca->qca_memdump);
qca->qca_memdump = NULL;
etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
- dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start);
+ dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);
}
* If there is a codedump pending for the device, the dev_coredumpm()
* will also free new coredump state.
*/
- dev_coredumpm(disp_state->dev, THIS_MODULE, disp_state, 0,
- disp_devcoredump_read, msm_disp_state_free);
+ dev_coredumpm(disp_state->dev, THIS_MODULE, disp_state, 0, GFP_KERNEL,
+ disp_devcoredump_read, msm_disp_state_free);
}
void msm_disp_snapshot_state(struct drm_device *drm_dev)
gpu->crashstate = state;
/* FIXME: Release the crashstate if this errors out? */
- dev_coredumpm(gpu->dev->dev, THIS_MODULE, gpu, 0,
- msm_gpu_devcoredump_read, msm_gpu_devcoredump_free);
+ dev_coredumpm(gpu->dev->dev, THIS_MODULE, gpu, 0, GFP_KERNEL,
+ msm_gpu_devcoredump_read, msm_gpu_devcoredump_free);
}
#else
static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
memcpy(data, mem_va, mem_size);
memunmap(mem_va);
- dev_coredumpv(dev, data, mem_size);
+ dev_coredumpv(dev, data, mem_size, GFP_KERNEL);
}
static void venus_event_notify(struct venus_core *core, u32 event)
mcp251xfd_dump_end(priv, &iter);
dev_coredumpv(&priv->spi->dev, iter.start,
- iter.data - iter.start);
+ iter.data - iter.start, GFP_KERNEL);
}
return -ENODATA;
}
- dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len));
+ dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL);
return 0;
}
/* fw_dump_data will be free in device coredump release function
* after 5 min
*/
- dev_coredumpv(wil_to_dev(wil), fw_dump_data, fw_dump_size);
+ dev_coredumpv(wil_to_dev(wil), fw_dump_data, fw_dump_size, GFP_KERNEL);
wil_info(wil, "fw core dumped, size %d bytes\n", fw_dump_size);
}
return err;
}
- dev_coredumpv(bus->dev, dump, len + ramsize);
+ dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
return 0;
}
fw_error_dump.trans_ptr->data,
fw_error_dump.trans_ptr->len,
fw_error_dump.fwrt_len);
- dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len);
+ dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len,
+ GFP_KERNEL);
}
vfree(fw_error_dump.fwrt_ptr);
vfree(fw_error_dump.trans_ptr);
entry->data, entry->size, offs);
offs += entry->size;
}
- dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len);
+ dev_coredumpsg(fwrt->trans->dev, sg_dump_data, file_len,
+ GFP_KERNEL);
}
iwl_dump_ini_list_free(&dump_list);
}
*/
mwifiex_dbg(adapter, MSG,
"== mwifiex dump information to /sys/class/devcoredump start\n");
- dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len);
+ dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len,
+ GFP_KERNEL);
mwifiex_dbg(adapter, MSG,
"== mwifiex dump information to /sys/class/devcoredump end\n");
dev_kfree_skb(skb);
}
- dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ);
+ dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ,
+ GFP_KERNEL);
}
}
if (dump)
- dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ);
+ dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ,
+ GFP_KERNEL);
mt7921_reset(&dev->mt76);
}
* framework. Note that a new dump will be discarded if a previous one
* hasn't been released yet.
*/
- dev_coredumpv(rtwdev->dev, desc->data, desc->size);
+ dev_coredumpv(rtwdev->dev, desc->data, desc->size, GFP_KERNEL);
}
static void rtw_fwcd_free(struct rtw_dev *rtwdev, bool free_self)
* will be discarded if a previous one hasn't been released by
* framework yet.
*/
- dev_coredumpv(rtwdev->dev, buf, sizeof(*buf));
+ dev_coredumpv(rtwdev->dev, buf, sizeof(*buf), GFP_KERNEL);
}
static void rtw89_ser_cd_free(struct rtw89_dev *rtwdev,
data = vmalloc(MBA_LOG_SIZE);
if (data) {
memcpy(data, mba_region, MBA_LOG_SIZE);
- dev_coredumpv(&rproc->dev, data, MBA_LOG_SIZE);
+ dev_coredumpv(&rproc->dev, data, MBA_LOG_SIZE, GFP_KERNEL);
}
memunmap(mba_region);
}
phdr += elf_size_of_phdr(class);
}
if (dump_conf == RPROC_COREDUMP_ENABLED) {
- dev_coredumpv(&rproc->dev, data, data_size);
+ dev_coredumpv(&rproc->dev, data, data_size, GFP_KERNEL);
return;
}
dump_state.header = data;
init_completion(&dump_state.dump_done);
- dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size,
+ dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size, GFP_KERNEL,
rproc_coredump_read, rproc_coredump_free);
/*
}
if (dump_conf == RPROC_COREDUMP_ENABLED) {
- dev_coredumpv(&rproc->dev, data, data_size);
+ dev_coredumpv(&rproc->dev, data, data_size, GFP_KERNEL);
return;
}
dump_state.header = data;
init_completion(&dump_state.dump_done);
- dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size,
+ dev_coredumpm(&rproc->dev, NULL, &dump_state, data_size, GFP_KERNEL,
rproc_coredump_read, rproc_coredump_free);
/* Wait until the dump is read and free is called. Data is freed
* void makecoredump(...)
* {
* ...
- * dev_coredumpm(dev, THIS_MODULE, data, 0,
+ * dev_coredumpm(dev, THIS_MODULE, data, 0, GFP_KERNEL,
* coredump_read, ...)
* }
*
#ifdef CONFIG_DEV_COREDUMP
-void dev_coredumpv(struct device *dev, void *data, size_t datalen);
+void dev_coredumpv(struct device *dev, void *data, size_t datalen,
+ gfp_t gfp);
void dev_coredumpm(struct device *dev, struct module *owner,
- void *data, size_t datalen,
+ void *data, size_t datalen, gfp_t gfp,
ssize_t (*read)(char *buffer, loff_t offset, size_t count,
void *data, size_t datalen),
void (*free)(void *data));
void dev_coredumpsg(struct device *dev, struct scatterlist *table,
- size_t datalen);
+ size_t datalen, gfp_t gfp);
#else
static inline void dev_coredumpv(struct device *dev, void *data,
- size_t datalen)
+ size_t datalen, gfp_t gfp)
{
vfree(data);
}
static inline void
dev_coredumpm(struct device *dev, struct module *owner,
- void *data, size_t datalen,
+ void *data, size_t datalen, gfp_t gfp,
ssize_t (*read)(char *buffer, loff_t offset, size_t count,
void *data, size_t datalen),
void (*free)(void *data))
}
static inline void dev_coredumpsg(struct device *dev, struct scatterlist *table,
- size_t datalen)
+ size_t datalen, gfp_t gfp)
{
_devcd_free_sgtable(table);
}
} while (offset < msg->ext.coredump.stack_dump_size);
exit:
- dev_coredumpv(adev->dev, dump, dump_size);
+ dev_coredumpv(adev->dev, dump, dump_size, GFP_KERNEL);
return 0;
}
return -ENOMEM;
memcpy_fromio(dump, avs_sram_addr(adev, AVS_FW_REGS_WINDOW), AVS_FW_REGS_SIZE);
- dev_coredumpv(adev->dev, dump, AVS_FW_REGS_SIZE);
+ dev_coredumpv(adev->dev, dump, AVS_FW_REGS_SIZE, GFP_KERNEL);
return 0;
}
pos += CATPT_DMA_REGS_SIZE;
}
- dev_coredumpv(cdev->dev, dump, dump_size);
+ dev_coredumpv(cdev->dev, dump, dump_size, GFP_KERNEL);
return 0;
}