Message ID | 1702899149-21321-10-git-send-email-quic_dikshita@quicinc.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | Qualcomm video encoder and decoder driver | expand |
On 18/12/2023 13:32, Dikshita Agarwal wrote: > Shared queues are used for communication between driver and firmware. > There are 3 types of queues: > Command queue - driver to write any command to firmware. > Message queue - firmware to send any response to driver. > Debug queue - firmware to write debug message. > > Above queues are initialized and configured to firmware during probe. > > Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> > --- > drivers/media/platform/qcom/vcodec/iris/Makefile | 2 ++ > .../media/platform/qcom/vcodec/iris/iris_core.h | 11 ++++++++ > .../media/platform/qcom/vcodec/iris/iris_probe.c | 31 ++++++++++++++++++++++ > 3 files changed, 44 insertions(+) > > diff --git a/drivers/media/platform/qcom/vcodec/iris/Makefile b/drivers/media/platform/qcom/vcodec/iris/Makefile > index 12a74de..59798e5d 100644 > --- a/drivers/media/platform/qcom/vcodec/iris/Makefile > +++ b/drivers/media/platform/qcom/vcodec/iris/Makefile > @@ -1,3 +1,5 @@ > +iris-objs += ../hfi_queue.o > + > iris-objs += iris_probe.o \ > resources.o \ > iris_state.o > diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_core.h b/drivers/media/platform/qcom/vcodec/iris/iris_core.h > index 56a5b7d..77124f9 100644 > --- a/drivers/media/platform/qcom/vcodec/iris/iris_core.h > +++ b/drivers/media/platform/qcom/vcodec/iris/iris_core.h > @@ -9,6 +9,7 @@ > #include <linux/types.h> > #include <media/v4l2-device.h> > > +#include "../hfi_queue.h" > #include "iris_state.h" > > /** > @@ -30,6 +31,11 @@ > * @reset_tbl: table of iris reset clocks > * @reset_count: count of iris reset clocks > * @state: current state of core > + * @iface_q_table: Interface queue table memory > + * @command_queue: shared interface queue to send commands to firmware > + * @message_queue: shared interface queue to receive responses from firmware > + * @debug_queue: shared interface queue to receive debug info from firmware > + * @sfr: SFR register memory > */ > > struct iris_core { > @@ -49,6 +55,11 @@ struct iris_core { > struct reset_info *reset_tbl; > u32 reset_count; > enum iris_core_state state; > + struct mem_desc iface_q_table; > + struct iface_q_info command_queue; > + struct iface_q_info message_queue; > + struct iface_q_info debug_queue; > + struct mem_desc sfr; > }; > > #endif > diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c > index 7bb9c92..fd349a3 100644 > --- a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c > +++ b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c > @@ -7,6 +7,7 @@ > #include <linux/of_device.h> > #include <linux/platform_device.h> > > +#include "../hfi_queue.h" > #include "iris_core.h" > #include "resources.h" > > @@ -50,6 +51,10 @@ static void iris_remove(struct platform_device *pdev) > if (!core) > return; > > + hfi_queue_deinit(core->dev, &core->iface_q_table, &core->sfr, > + &core->command_queue, &core->message_queue, > + &core->debug_queue); > + > video_unregister_device(core->vdev_dec); > > v4l2_device_unregister(&core->v4l2_dev); > @@ -59,6 +64,7 @@ static int iris_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct iris_core *core; > + u64 dma_mask; > int ret; > > core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL); > @@ -91,8 +97,33 @@ static int iris_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, core); > > + /* > + * Specify the max value of address space, which can be used > + * for buffer transactions. > + */ > + dma_mask = DMA_BIT_MASK(32); > + dma_mask &= ~BIT(29); > + > + ret = dma_set_mask_and_coherent(dev, dma_mask); > + if (ret) > + goto err_vdev_unreg; > + > + dma_set_max_seg_size(&pdev->dev, (unsigned int)DMA_BIT_MASK(32)); > + dma_set_seg_boundary(&pdev->dev, (unsigned long)DMA_BIT_MASK(64)); This isn't related to queues. > + > + ret = hfi_queue_init(core->dev, &core->iface_q_table, &core->sfr, > + &core->command_queue, &core->message_queue, > + &core->debug_queue, core); > + if (ret) { > + dev_err_probe(core->dev, ret, > + "%s: interface queues init failed\n", __func__); > + goto err_vdev_unreg; > + } > + > return ret; > > +err_vdev_unreg: > + iris_unregister_video_device(core); > err_v4l2_unreg: > v4l2_device_unregister(&core->v4l2_dev); >
On 12/18/23 12:32, Dikshita Agarwal wrote: > Shared queues are used for communication between driver and firmware. > There are 3 types of queues: > Command queue - driver to write any command to firmware. > Message queue - firmware to send any response to driver. > Debug queue - firmware to write debug message. > > Above queues are initialized and configured to firmware during probe. > > Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> > --- [...] > + ret = hfi_queue_init(core->dev, &core->iface_q_table, &core->sfr, > + &core->command_queue, &core->message_queue, > + &core->debug_queue, core); > + if (ret) { > + dev_err_probe(core->dev, ret, > + "%s: interface queues init failed\n", __func__); > + goto err_vdev_unreg; > + } > + > return ret; Like before, you're suppose to return dev_err_probe Konrad
On 12/19/2023 12:16 AM, Dmitry Baryshkov wrote: > On 18/12/2023 13:32, Dikshita Agarwal wrote: >> Shared queues are used for communication between driver and firmware. >> There are 3 types of queues: >> Command queue - driver to write any command to firmware. >> Message queue - firmware to send any response to driver. >> Debug queue - firmware to write debug message. >> >> Above queues are initialized and configured to firmware during probe. >> >> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> >> --- >> drivers/media/platform/qcom/vcodec/iris/Makefile | 2 ++ >> .../media/platform/qcom/vcodec/iris/iris_core.h | 11 ++++++++ >> .../media/platform/qcom/vcodec/iris/iris_probe.c | 31 >> ++++++++++++++++++++++ >> 3 files changed, 44 insertions(+) >> >> diff --git a/drivers/media/platform/qcom/vcodec/iris/Makefile >> b/drivers/media/platform/qcom/vcodec/iris/Makefile >> index 12a74de..59798e5d 100644 >> --- a/drivers/media/platform/qcom/vcodec/iris/Makefile >> +++ b/drivers/media/platform/qcom/vcodec/iris/Makefile >> @@ -1,3 +1,5 @@ >> +iris-objs += ../hfi_queue.o >> + >> iris-objs += iris_probe.o \ >> resources.o \ >> iris_state.o >> diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_core.h >> b/drivers/media/platform/qcom/vcodec/iris/iris_core.h >> index 56a5b7d..77124f9 100644 >> --- a/drivers/media/platform/qcom/vcodec/iris/iris_core.h >> +++ b/drivers/media/platform/qcom/vcodec/iris/iris_core.h >> @@ -9,6 +9,7 @@ >> #include <linux/types.h> >> #include <media/v4l2-device.h> >> +#include "../hfi_queue.h" >> #include "iris_state.h" >> /** >> @@ -30,6 +31,11 @@ >> * @reset_tbl: table of iris reset clocks >> * @reset_count: count of iris reset clocks >> * @state: current state of core >> + * @iface_q_table: Interface queue table memory >> + * @command_queue: shared interface queue to send commands to firmware >> + * @message_queue: shared interface queue to receive responses from >> firmware >> + * @debug_queue: shared interface queue to receive debug info from firmware >> + * @sfr: SFR register memory >> */ >> struct iris_core { >> @@ -49,6 +55,11 @@ struct iris_core { >> struct reset_info *reset_tbl; >> u32 reset_count; >> enum iris_core_state state; >> + struct mem_desc iface_q_table; >> + struct iface_q_info command_queue; >> + struct iface_q_info message_queue; >> + struct iface_q_info debug_queue; >> + struct mem_desc sfr; >> }; >> #endif >> diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c >> b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c >> index 7bb9c92..fd349a3 100644 >> --- a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c >> +++ b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c >> @@ -7,6 +7,7 @@ >> #include <linux/of_device.h> >> #include <linux/platform_device.h> >> +#include "../hfi_queue.h" >> #include "iris_core.h" >> #include "resources.h" >> @@ -50,6 +51,10 @@ static void iris_remove(struct platform_device *pdev) >> if (!core) >> return; >> + hfi_queue_deinit(core->dev, &core->iface_q_table, &core->sfr, >> + &core->command_queue, &core->message_queue, >> + &core->debug_queue); >> + >> video_unregister_device(core->vdev_dec); >> v4l2_device_unregister(&core->v4l2_dev); >> @@ -59,6 +64,7 @@ static int iris_probe(struct platform_device *pdev) >> { >> struct device *dev = &pdev->dev; >> struct iris_core *core; >> + u64 dma_mask; >> int ret; >> core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL); >> @@ -91,8 +97,33 @@ static int iris_probe(struct platform_device *pdev) >> platform_set_drvdata(pdev, core); >> + /* >> + * Specify the max value of address space, which can be used >> + * for buffer transactions. >> + */ >> + dma_mask = DMA_BIT_MASK(32); >> + dma_mask &= ~BIT(29); >> + >> + ret = dma_set_mask_and_coherent(dev, dma_mask); >> + if (ret) >> + goto err_vdev_unreg; >> + >> + dma_set_max_seg_size(&pdev->dev, (unsigned int)DMA_BIT_MASK(32)); >> + dma_set_seg_boundary(&pdev->dev, (unsigned long)DMA_BIT_MASK(64)); > > This isn't related to queues. > Using this DMA mask, we define the upper limit of memory to be used to allocate the queues, hence this is added with this patch. >> + >> + ret = hfi_queue_init(core->dev, &core->iface_q_table, &core->sfr, >> + &core->command_queue, &core->message_queue, >> + &core->debug_queue, core); >> + if (ret) { >> + dev_err_probe(core->dev, ret, >> + "%s: interface queues init failed\n", __func__); >> + goto err_vdev_unreg; >> + } >> + >> return ret; >> +err_vdev_unreg: >> + iris_unregister_video_device(core); >> err_v4l2_unreg: >> v4l2_device_unregister(&core->v4l2_dev); >> >
On 12/19/2023 3:03 AM, Konrad Dybcio wrote: > > > On 12/18/23 12:32, Dikshita Agarwal wrote: >> Shared queues are used for communication between driver and firmware. >> There are 3 types of queues: >> Command queue - driver to write any command to firmware. >> Message queue - firmware to send any response to driver. >> Debug queue - firmware to write debug message. >> >> Above queues are initialized and configured to firmware during probe. >> >> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> >> --- > [...] > >> + ret = hfi_queue_init(core->dev, &core->iface_q_table, &core->sfr, >> + &core->command_queue, &core->message_queue, >> + &core->debug_queue, core); >> + if (ret) { >> + dev_err_probe(core->dev, ret, >> + "%s: interface queues init failed\n", __func__); >> + goto err_vdev_unreg; >> + } >> + >> return ret; > Like before, you're suppose to return dev_err_probe Sure, will fix all such instances. > > Konrad
diff --git a/drivers/media/platform/qcom/vcodec/iris/Makefile b/drivers/media/platform/qcom/vcodec/iris/Makefile index 12a74de..59798e5d 100644 --- a/drivers/media/platform/qcom/vcodec/iris/Makefile +++ b/drivers/media/platform/qcom/vcodec/iris/Makefile @@ -1,3 +1,5 @@ +iris-objs += ../hfi_queue.o + iris-objs += iris_probe.o \ resources.o \ iris_state.o diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_core.h b/drivers/media/platform/qcom/vcodec/iris/iris_core.h index 56a5b7d..77124f9 100644 --- a/drivers/media/platform/qcom/vcodec/iris/iris_core.h +++ b/drivers/media/platform/qcom/vcodec/iris/iris_core.h @@ -9,6 +9,7 @@ #include <linux/types.h> #include <media/v4l2-device.h> +#include "../hfi_queue.h" #include "iris_state.h" /** @@ -30,6 +31,11 @@ * @reset_tbl: table of iris reset clocks * @reset_count: count of iris reset clocks * @state: current state of core + * @iface_q_table: Interface queue table memory + * @command_queue: shared interface queue to send commands to firmware + * @message_queue: shared interface queue to receive responses from firmware + * @debug_queue: shared interface queue to receive debug info from firmware + * @sfr: SFR register memory */ struct iris_core { @@ -49,6 +55,11 @@ struct iris_core { struct reset_info *reset_tbl; u32 reset_count; enum iris_core_state state; + struct mem_desc iface_q_table; + struct iface_q_info command_queue; + struct iface_q_info message_queue; + struct iface_q_info debug_queue; + struct mem_desc sfr; }; #endif diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c index 7bb9c92..fd349a3 100644 --- a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c +++ b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c @@ -7,6 +7,7 @@ #include <linux/of_device.h> #include <linux/platform_device.h> +#include "../hfi_queue.h" #include "iris_core.h" #include "resources.h" @@ -50,6 +51,10 @@ static void iris_remove(struct platform_device *pdev) if (!core) return; + hfi_queue_deinit(core->dev, &core->iface_q_table, &core->sfr, + &core->command_queue, &core->message_queue, + &core->debug_queue); + video_unregister_device(core->vdev_dec); v4l2_device_unregister(&core->v4l2_dev); @@ -59,6 +64,7 @@ static int iris_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct iris_core *core; + u64 dma_mask; int ret; core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL); @@ -91,8 +97,33 @@ static int iris_probe(struct platform_device *pdev) platform_set_drvdata(pdev, core); + /* + * Specify the max value of address space, which can be used + * for buffer transactions. + */ + dma_mask = DMA_BIT_MASK(32); + dma_mask &= ~BIT(29); + + ret = dma_set_mask_and_coherent(dev, dma_mask); + if (ret) + goto err_vdev_unreg; + + dma_set_max_seg_size(&pdev->dev, (unsigned int)DMA_BIT_MASK(32)); + dma_set_seg_boundary(&pdev->dev, (unsigned long)DMA_BIT_MASK(64)); + + ret = hfi_queue_init(core->dev, &core->iface_q_table, &core->sfr, + &core->command_queue, &core->message_queue, + &core->debug_queue, core); + if (ret) { + dev_err_probe(core->dev, ret, + "%s: interface queues init failed\n", __func__); + goto err_vdev_unreg; + } + return ret; +err_vdev_unreg: + iris_unregister_video_device(core); err_v4l2_unreg: v4l2_device_unregister(&core->v4l2_dev);
Shared queues are used for communication between driver and firmware. There are 3 types of queues: Command queue - driver to write any command to firmware. Message queue - firmware to send any response to driver. Debug queue - firmware to write debug message. Above queues are initialized and configured to firmware during probe. Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> --- drivers/media/platform/qcom/vcodec/iris/Makefile | 2 ++ .../media/platform/qcom/vcodec/iris/iris_core.h | 11 ++++++++ .../media/platform/qcom/vcodec/iris/iris_probe.c | 31 ++++++++++++++++++++++ 3 files changed, 44 insertions(+)