Loading drivers/media/platform/msm/camera/cam_cdm/cam_cdm_hw_core.c +6 −5 Original line number Diff line number Diff line Loading @@ -624,7 +624,8 @@ static void cam_hw_cdm_work(struct work_struct *work) } static void cam_hw_cdm_iommu_fault_handler(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags, void *token) struct device *dev, unsigned long iova, int flags, void *token, uint32_t buf_info) { struct cam_hw_info *cdm_hw = NULL; struct cam_cdm *core = NULL; Loading Loading @@ -910,7 +911,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev) CAM_ERR(CAM_CDM, "cpas-cdm get iommu handle failed"); goto unlock_release_mem; } cam_smmu_reg_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, cam_smmu_set_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, cam_hw_cdm_iommu_fault_handler, cdm_hw); rc = cam_smmu_ops(cdm_core->iommu_hdl.non_secure, CAM_SMMU_ATTACH); Loading Loading @@ -1034,7 +1035,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev) flush_workqueue(cdm_core->work_queue); destroy_workqueue(cdm_core->work_queue); destroy_non_secure_hdl: cam_smmu_reg_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, cam_smmu_set_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, NULL, cdm_hw); if (cam_smmu_destroy_handle(cdm_core->iommu_hdl.non_secure)) CAM_ERR(CAM_CDM, "Release iommu secure hdl failed"); Loading Loading @@ -1106,8 +1107,8 @@ int cam_hw_cdm_remove(struct platform_device *pdev) if (cam_smmu_destroy_handle(cdm_core->iommu_hdl.non_secure)) CAM_ERR(CAM_CDM, "Release iommu secure hdl failed"); cam_smmu_reg_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, NULL, cdm_hw); cam_smmu_unset_client_page_fault_handler( cdm_core->iommu_hdl.non_secure, cdm_hw); mutex_destroy(&cdm_hw->hw_mutex); kfree(cdm_hw->soc_info.soc_private); Loading drivers/media/platform/msm/camera/cam_core/cam_context.c +23 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ int cam_context_shutdown(struct cam_context *ctx) int rc = 0; int32_t ctx_hdl = ctx->dev_hdl; mutex_lock(&ctx->ctx_mutex); if (ctx->state_machine[ctx->state].ioctl_ops.stop_dev) { rc = ctx->state_machine[ctx->state].ioctl_ops.stop_dev( ctx, NULL); Loading @@ -54,6 +55,7 @@ int cam_context_shutdown(struct cam_context *ctx) if (rc < 0) CAM_ERR(CAM_CORE, "Error while dev release %d", rc); } mutex_unlock(&ctx->ctx_mutex); if (!rc) rc = cam_destroy_device_hdl(ctx_hdl); Loading Loading @@ -221,6 +223,27 @@ int cam_context_handle_crm_process_evt(struct cam_context *ctx, return rc; } int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova, uint32_t buf_info) { int rc = 0; if (!ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } if (ctx->state_machine[ctx->state].pagefault_ops) { rc = ctx->state_machine[ctx->state].pagefault_ops(ctx, iova, buf_info); } else { CAM_WARN(CAM_CORE, "No dump ctx in dev %d, state %d", ctx->dev_hdl, ctx->state); } return rc; } int cam_context_handle_acquire_dev(struct cam_context *ctx, struct cam_acquire_dev_cmd *cmd) { Loading drivers/media/platform/msm/camera/cam_core/cam_context.h +30 −13 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ enum cam_context_state { * @num_out_acked: Number of out fence acked * @flushed: Request is flushed * @ctx: The context to which this request belongs * @pf_data page fault debug data * */ struct cam_ctx_request { Loading @@ -74,6 +75,7 @@ struct cam_ctx_request { uint32_t num_out_acked; int flushed; struct cam_context *ctx; struct cam_hw_mgr_dump_pf_data pf_data; }; /** Loading Loading @@ -135,12 +137,14 @@ struct cam_ctx_crm_ops { * @ioctl_ops: Ioctl funciton table * @crm_ops: CRM to context interface function table * @irq_ops: Hardware event handle function * @pagefault_ops: Function to be called on page fault * */ struct cam_ctx_ops { struct cam_ctx_ioctl_ops ioctl_ops; struct cam_ctx_crm_ops crm_ops; cam_hw_event_cb_func irq_ops; cam_hw_pagefault_cb_func pagefault_ops; }; /** Loading Loading @@ -291,6 +295,19 @@ int cam_context_handle_crm_flush_req(struct cam_context *ctx, int cam_context_handle_crm_process_evt(struct cam_context *ctx, struct cam_req_mgr_link_evt_data *process_evt); /** * cam_context_dump_pf_info() * * @brief: Handle dump active request request command * * @ctx: Object pointer for cam_context * @iova: Page fault address * @buf_info: Information about closest memory handle * */ int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova, uint32_t buf_info); /** * cam_context_handle_acquire_dev() * Loading drivers/media/platform/msm/camera/cam_core/cam_context_utils.c +36 −0 Original line number Diff line number Diff line Loading @@ -337,6 +337,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, cfg.out_map_entries = req->out_map_entries; cfg.max_in_map_entries = CAM_CTX_CFG_MAX; cfg.in_map_entries = req->in_map_entries; cfg.pf_data = &(req->pf_data); rc = ctx->hw_mgr_intf->hw_prepare_update( ctx->hw_mgr_intf->hw_mgr_priv, &cfg); Loading Loading @@ -905,3 +906,38 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) end: return rc; } int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx, struct cam_packet *packet, unsigned long iova, uint32_t buf_info, bool *mem_found) { int rc = 0; struct cam_hw_cmd_args cmd_args; if (!ctx) { CAM_ERR(CAM_CTXT, "Invalid input params %pK ", ctx); rc = -EINVAL; goto end; } if (!ctx->hw_mgr_intf) { CAM_ERR(CAM_CTXT, "[%s][%d] HW interface is not ready", ctx->dev_name, ctx->ctx_id); rc = -EFAULT; goto end; } if (ctx->hw_mgr_intf->hw_cmd) { cmd_args.ctxt_to_hw_map = ctx->ctxt_to_hw_map; cmd_args.cmd_type = CAM_HW_MGR_CMD_DUMP_PF_INFO; cmd_args.u.pf_args.pf_data.packet = packet; cmd_args.u.pf_args.iova = iova; cmd_args.u.pf_args.buf_info = buf_info; cmd_args.u.pf_args.mem_found = mem_found; ctx->hw_mgr_intf->hw_cmd(ctx->hw_mgr_intf->hw_mgr_priv, &cmd_args); } end: return rc; } drivers/media/platform/msm/camera/cam_core/cam_context_utils.h +4 −1 Original line number Diff line number Diff line /* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -31,5 +31,8 @@ int32_t cam_context_flush_dev_to_hw(struct cam_context *ctx, int32_t cam_context_flush_ctx_to_hw(struct cam_context *ctx); int32_t cam_context_flush_req_to_hw(struct cam_context *ctx, struct cam_flush_dev_cmd *cmd); int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx, struct cam_packet *packet, unsigned long iova, uint32_t buf_info, bool *mem_found); #endif /* _CAM_CONTEXT_UTILS_H_ */ Loading
drivers/media/platform/msm/camera/cam_cdm/cam_cdm_hw_core.c +6 −5 Original line number Diff line number Diff line Loading @@ -624,7 +624,8 @@ static void cam_hw_cdm_work(struct work_struct *work) } static void cam_hw_cdm_iommu_fault_handler(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags, void *token) struct device *dev, unsigned long iova, int flags, void *token, uint32_t buf_info) { struct cam_hw_info *cdm_hw = NULL; struct cam_cdm *core = NULL; Loading Loading @@ -910,7 +911,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev) CAM_ERR(CAM_CDM, "cpas-cdm get iommu handle failed"); goto unlock_release_mem; } cam_smmu_reg_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, cam_smmu_set_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, cam_hw_cdm_iommu_fault_handler, cdm_hw); rc = cam_smmu_ops(cdm_core->iommu_hdl.non_secure, CAM_SMMU_ATTACH); Loading Loading @@ -1034,7 +1035,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev) flush_workqueue(cdm_core->work_queue); destroy_workqueue(cdm_core->work_queue); destroy_non_secure_hdl: cam_smmu_reg_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, cam_smmu_set_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, NULL, cdm_hw); if (cam_smmu_destroy_handle(cdm_core->iommu_hdl.non_secure)) CAM_ERR(CAM_CDM, "Release iommu secure hdl failed"); Loading Loading @@ -1106,8 +1107,8 @@ int cam_hw_cdm_remove(struct platform_device *pdev) if (cam_smmu_destroy_handle(cdm_core->iommu_hdl.non_secure)) CAM_ERR(CAM_CDM, "Release iommu secure hdl failed"); cam_smmu_reg_client_page_fault_handler(cdm_core->iommu_hdl.non_secure, NULL, cdm_hw); cam_smmu_unset_client_page_fault_handler( cdm_core->iommu_hdl.non_secure, cdm_hw); mutex_destroy(&cdm_hw->hw_mutex); kfree(cdm_hw->soc_info.soc_private); Loading
drivers/media/platform/msm/camera/cam_core/cam_context.c +23 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ int cam_context_shutdown(struct cam_context *ctx) int rc = 0; int32_t ctx_hdl = ctx->dev_hdl; mutex_lock(&ctx->ctx_mutex); if (ctx->state_machine[ctx->state].ioctl_ops.stop_dev) { rc = ctx->state_machine[ctx->state].ioctl_ops.stop_dev( ctx, NULL); Loading @@ -54,6 +55,7 @@ int cam_context_shutdown(struct cam_context *ctx) if (rc < 0) CAM_ERR(CAM_CORE, "Error while dev release %d", rc); } mutex_unlock(&ctx->ctx_mutex); if (!rc) rc = cam_destroy_device_hdl(ctx_hdl); Loading Loading @@ -221,6 +223,27 @@ int cam_context_handle_crm_process_evt(struct cam_context *ctx, return rc; } int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova, uint32_t buf_info) { int rc = 0; if (!ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } if (ctx->state_machine[ctx->state].pagefault_ops) { rc = ctx->state_machine[ctx->state].pagefault_ops(ctx, iova, buf_info); } else { CAM_WARN(CAM_CORE, "No dump ctx in dev %d, state %d", ctx->dev_hdl, ctx->state); } return rc; } int cam_context_handle_acquire_dev(struct cam_context *ctx, struct cam_acquire_dev_cmd *cmd) { Loading
drivers/media/platform/msm/camera/cam_core/cam_context.h +30 −13 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ enum cam_context_state { * @num_out_acked: Number of out fence acked * @flushed: Request is flushed * @ctx: The context to which this request belongs * @pf_data page fault debug data * */ struct cam_ctx_request { Loading @@ -74,6 +75,7 @@ struct cam_ctx_request { uint32_t num_out_acked; int flushed; struct cam_context *ctx; struct cam_hw_mgr_dump_pf_data pf_data; }; /** Loading Loading @@ -135,12 +137,14 @@ struct cam_ctx_crm_ops { * @ioctl_ops: Ioctl funciton table * @crm_ops: CRM to context interface function table * @irq_ops: Hardware event handle function * @pagefault_ops: Function to be called on page fault * */ struct cam_ctx_ops { struct cam_ctx_ioctl_ops ioctl_ops; struct cam_ctx_crm_ops crm_ops; cam_hw_event_cb_func irq_ops; cam_hw_pagefault_cb_func pagefault_ops; }; /** Loading Loading @@ -291,6 +295,19 @@ int cam_context_handle_crm_flush_req(struct cam_context *ctx, int cam_context_handle_crm_process_evt(struct cam_context *ctx, struct cam_req_mgr_link_evt_data *process_evt); /** * cam_context_dump_pf_info() * * @brief: Handle dump active request request command * * @ctx: Object pointer for cam_context * @iova: Page fault address * @buf_info: Information about closest memory handle * */ int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova, uint32_t buf_info); /** * cam_context_handle_acquire_dev() * Loading
drivers/media/platform/msm/camera/cam_core/cam_context_utils.c +36 −0 Original line number Diff line number Diff line Loading @@ -337,6 +337,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, cfg.out_map_entries = req->out_map_entries; cfg.max_in_map_entries = CAM_CTX_CFG_MAX; cfg.in_map_entries = req->in_map_entries; cfg.pf_data = &(req->pf_data); rc = ctx->hw_mgr_intf->hw_prepare_update( ctx->hw_mgr_intf->hw_mgr_priv, &cfg); Loading Loading @@ -905,3 +906,38 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx) end: return rc; } int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx, struct cam_packet *packet, unsigned long iova, uint32_t buf_info, bool *mem_found) { int rc = 0; struct cam_hw_cmd_args cmd_args; if (!ctx) { CAM_ERR(CAM_CTXT, "Invalid input params %pK ", ctx); rc = -EINVAL; goto end; } if (!ctx->hw_mgr_intf) { CAM_ERR(CAM_CTXT, "[%s][%d] HW interface is not ready", ctx->dev_name, ctx->ctx_id); rc = -EFAULT; goto end; } if (ctx->hw_mgr_intf->hw_cmd) { cmd_args.ctxt_to_hw_map = ctx->ctxt_to_hw_map; cmd_args.cmd_type = CAM_HW_MGR_CMD_DUMP_PF_INFO; cmd_args.u.pf_args.pf_data.packet = packet; cmd_args.u.pf_args.iova = iova; cmd_args.u.pf_args.buf_info = buf_info; cmd_args.u.pf_args.mem_found = mem_found; ctx->hw_mgr_intf->hw_cmd(ctx->hw_mgr_intf->hw_mgr_priv, &cmd_args); } end: return rc; }
drivers/media/platform/msm/camera/cam_core/cam_context_utils.h +4 −1 Original line number Diff line number Diff line /* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -31,5 +31,8 @@ int32_t cam_context_flush_dev_to_hw(struct cam_context *ctx, int32_t cam_context_flush_ctx_to_hw(struct cam_context *ctx); int32_t cam_context_flush_req_to_hw(struct cam_context *ctx, struct cam_flush_dev_cmd *cmd); int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx, struct cam_packet *packet, unsigned long iova, uint32_t buf_info, bool *mem_found); #endif /* _CAM_CONTEXT_UTILS_H_ */