From: Antti Laakso <antti.laakso@linux.intel.com>
To: linux-media@vger.kernel.org, mchehab@kernel.org,
sakari.ailus@linux.intel.com, sarang.sapre@intel.com
Cc: daxing.li@intel.com, ong.hock.yu@intel.com, antti.laakso@linux.intel.com
Subject: [PATCH v3 23/44] media: ipu6: Add ipu7 fw com methods
Date: Thu, 27 Aug 2026 15:33:15 +0300 [thread overview]
Message-ID: <20260827123336.2219048-24-antti.laakso@linux.intel.com> (raw)
In-Reply-To: <20260827123336.2219048-1-antti.laakso@linux.intel.com>
The get/put token methods read/write to ipu7 firmware message queues.
Signed-off-by: Antti Laakso <antti.laakso@linux.intel.com>
---
drivers/media/pci/intel/ipu6/Makefile | 4 +-
drivers/media/pci/intel/ipu6/ipu7-fw-com.c | 74 ++++++++++++++++++++++
drivers/media/pci/intel/ipu6/ipu7-fw-com.h | 51 +++++++++++++++
3 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-com.c
create mode 100644 drivers/media/pci/intel/ipu6/ipu7-fw-com.h
diff --git a/drivers/media/pci/intel/ipu6/Makefile b/drivers/media/pci/intel/ipu6/Makefile
index c0daf0995b22..406e2e19df17 100644
--- a/drivers/media/pci/intel/ipu6/Makefile
+++ b/drivers/media/pci/intel/ipu6/Makefile
@@ -8,7 +8,9 @@ intel-ipu6-y := ipu6.o \
ipu7-mmu-hw.o \
ipu6-buttress.o \
ipu6-cpd.o \
- ipu6-fw-com.o
+ ipu6-fw-com.o \
+ ipu7-fw-com.o \
+ ipu7-boot.o
obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6.o
diff --git a/drivers/media/pci/intel/ipu6/ipu7-fw-com.c b/drivers/media/pci/intel/ipu6/ipu7-fw-com.c
new file mode 100644
index 000000000000..7dd1e683aa92
--- /dev/null
+++ b/drivers/media/pci/intel/ipu6/ipu7-fw-com.c
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2026 Intel Corporation
+ */
+
+#include <linux/io.h>
+
+#include "ipu7-fw-com.h"
+
+static void __iomem *ipu7_fw_com_get_indices(struct ipu7_fw_com_context *ctx,
+ u32 q)
+{
+ return ctx->queue_indices + (q * sizeof(struct ipu7_fw_com_queue_indices));
+}
+
+void *ipu7_fw_com_get_token(struct ipu7_fw_com_context *ctx, int q)
+{
+ struct ipu7_fw_com_queue_config *queue_params = &ctx->queue_configs[q];
+ void __iomem *queue_indices = ipu7_fw_com_get_indices(ctx, q);
+ u32 write_index = readl(queue_indices +
+ offsetof(struct ipu7_fw_com_queue_indices,
+ write_index));
+ u32 read_index = readl(queue_indices +
+ offsetof(struct ipu7_fw_com_queue_indices,
+ read_index));
+ void *token = NULL;
+
+ if (q < ctx->num_output_queues) {
+ /* Output queue */
+ bool empty = (write_index == read_index);
+
+ if (!empty)
+ token = queue_params->token_array_mem +
+ read_index *
+ queue_params->token_size_in_bytes;
+ } else {
+ /* Input queue */
+ bool full = (read_index == ((write_index + 1U) %
+ (u32)queue_params->max_capacity));
+
+ if (!full)
+ token = queue_params->token_array_mem +
+ write_index * queue_params->token_size_in_bytes;
+ }
+ return token;
+}
+EXPORT_SYMBOL_NS_GPL(ipu7_fw_com_get_token, "INTEL_IPU6");
+
+void ipu7_fw_com_put_token(struct ipu7_fw_com_context *ctx, int q)
+{
+ struct ipu7_fw_com_queue_config *queue_params = &ctx->queue_configs[q];
+ void __iomem *queue_indices = ipu7_fw_com_get_indices(ctx, q);
+ u32 offset, index;
+
+ if (q < ctx->num_output_queues)
+ /* Output queue */
+ offset = offsetof(struct ipu7_fw_com_queue_indices, read_index);
+
+ else
+ /* Input queue */
+ offset = offsetof(struct ipu7_fw_com_queue_indices, write_index);
+
+ index = readl(queue_indices + offset);
+ writel((index + 1U) % queue_params->max_capacity,
+ queue_indices + offset);
+}
+EXPORT_SYMBOL_NS_GPL(ipu7_fw_com_put_token, "INTEL_IPU6");
+
+struct ipu7_fw_com_queue_params_config *
+ipu7_fw_com_get_queue_config(struct ipu7_fw_com_config *config)
+{
+ return (struct ipu7_fw_com_queue_params_config *)(&config[1]);
+}
+EXPORT_SYMBOL_NS_GPL(ipu7_fw_com_get_queue_config, "INTEL_IPU6");
diff --git a/drivers/media/pci/intel/ipu6/ipu7-fw-com.h b/drivers/media/pci/intel/ipu6/ipu7-fw-com.h
new file mode 100644
index 000000000000..10c09e759bed
--- /dev/null
+++ b/drivers/media/pci/intel/ipu6/ipu7-fw-com.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Copyright (C) 2026 Intel Corporation */
+
+#ifndef IPU7_FW_COM_H
+#define IPU7_FW_COM_H
+
+#include <linux/types.h>
+
+struct ipu7_fw_com_queue_config {
+ void *token_array_mem;
+ u32 queue_size;
+ u16 token_size_in_bytes;
+ u16 max_capacity;
+};
+
+struct ipu7_fw_com_context {
+ u16 num_input_queues;
+ u16 num_output_queues;
+ struct ipu7_fw_com_queue_config *queue_configs;
+ void __iomem *queue_indices;
+ dma_addr_t queue_mem_dma_addr;
+ void *queue_mem;
+ u32 queue_mem_size;
+ struct ipu7_boot_abi_cfg *boot_config;
+ dma_addr_t boot_config_dma_addr;
+ u32 boot_config_size;
+ u32 fw_entry;
+};
+
+struct ipu7_fw_com_queue_params_config {
+ u32 token_array_mem;
+ u16 token_size_in_bytes;
+ u16 max_capacity;
+};
+
+struct ipu7_fw_com_config {
+ u16 max_output_queues;
+ u16 max_input_queues;
+};
+
+struct ipu7_fw_com_queue_indices {
+ u32 read_index;
+ u32 write_index;
+};
+
+void ipu7_fw_com_put_token(struct ipu7_fw_com_context *ctx, int q);
+void *ipu7_fw_com_get_token(struct ipu7_fw_com_context *ctx, int q);
+struct ipu7_fw_com_queue_params_config *
+ipu7_fw_com_get_queue_config(struct ipu7_fw_com_config *config);
+
+#endif /* IPU7_FW_COM_H */
--
2.55.0
next prev parent reply other threads:[~2026-08-27 12:34 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 12:32 [PATCH v3 00/44] media: ipu6: Add support for ipu7 hardware Antti Laakso
2026-08-27 12:32 ` [PATCH v3 01/44] media: ipu6: Add helpers for IPU runtime variation Antti Laakso
2026-08-27 12:32 ` [PATCH v3 02/44] media: ipu6: Rename pointer to firmware context Antti Laakso
2026-08-27 12:32 ` [PATCH v3 03/44] media: ipu6: Rename buttress_ipc pointer Antti Laakso
2026-08-27 12:32 ` [PATCH v3 04/44] media: ipu6: Remove duplicate warnings in cpd validation Antti Laakso
2026-08-27 12:32 ` [PATCH v3 05/44] media: ipu6: Remove unused ipu6 firmware struct Antti Laakso
2026-08-27 12:32 ` [PATCH v3 06/44] media: ipu6: Cleanup ipu6_mmu_init() Antti Laakso
2026-08-27 12:32 ` [PATCH v3 07/44] media: ipu6: Simplify firmware com arguments Antti Laakso
2026-08-27 12:33 ` [PATCH v3 08/44] media: ipu6: Add helper to identify ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 09/44] media: ipu6: Prepare buttress for ipu7 support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 10/44] media: ipu6: Use single struct for registers Antti Laakso
2026-08-27 12:33 ` [PATCH v3 11/44] media: ipu6: Rename IPU subsys ID Antti Laakso
2026-08-27 12:33 ` [PATCH v3 12/44] media: ipu6: Add ipu7 buttress support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 13/44] media: ipu6: Prepare mmu driver for hw variation Antti Laakso
2026-08-27 12:33 ` [PATCH v3 14/44] media: ipu6: Add ipu7 mmu support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 15/44] media: ipu6: Add ipu7 cpd handling Antti Laakso
2026-08-27 12:33 ` [PATCH v3 16/44] media: ipu6: Add check for pkg_dir before freeing Antti Laakso
2026-08-27 12:33 ` [PATCH v3 17/44] media: ipu6: Rename isys fw msg union Antti Laakso
2026-08-27 12:33 ` [PATCH v3 18/44] media: ipu6: Move isys isr handlers to fw file Antti Laakso
2026-08-27 12:33 ` [PATCH v3 19/44] media: ipu6: Move hw specific buffer handling down Antti Laakso
2026-08-27 12:33 ` [PATCH v3 20/44] media: ipu6: Isolate hw specific buffer handling Antti Laakso
2026-08-27 12:33 ` [PATCH v3 21/44] media: ipu6: Add isys firmware ops Antti Laakso
2026-08-27 12:33 ` [PATCH v3 22/44] media: ipu6: Add ipu7 fw start/stop functionality Antti Laakso
2026-08-27 12:33 ` Antti Laakso [this message]
2026-08-27 12:33 ` [PATCH v3 24/44] media: ipu6: Add ipu7 fw isys ops Antti Laakso
2026-08-27 12:33 ` [PATCH v3 25/44] media: ipu6: Add ipu7 csi2 register definitions Antti Laakso
2026-08-27 12:33 ` [PATCH v3 26/44] media: ipu6: Add ipu7 isr handler Antti Laakso
2026-08-27 12:33 ` [PATCH v3 27/44] media: ipu6: Add ipu7 csi phy driver Antti Laakso
2026-08-27 12:33 ` [PATCH v3 28/44] media: ipu6: Split ipu6 csi2 stream enable/disable Antti Laakso
2026-08-27 12:33 ` [PATCH v3 29/44] media: ipu6: Add support for ipu7 csi2 receiver Antti Laakso
2026-08-27 12:33 ` [PATCH v3 30/44] media: ipu6: Parse bus type for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 31/44] media: ipu6: Enable ipu7 isys interrupts Antti Laakso
2026-08-27 12:33 ` [PATCH v3 32/44] media: ipu6: Skip watermark configuration for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 33/44] media: ipu6: The SPC init is valid only for ipu6 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 34/44] media: ipu6: The VC arbitration mechanism is ipu6 only Antti Laakso
2026-08-27 12:33 ` [PATCH v3 35/44] media: ipu6: Move buttress mem alloc out from probe Antti Laakso
2026-08-27 12:33 ` [PATCH v3 36/44] media: ipu6: Read correct SKU ID for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 37/44] media: ipu6: Add support for fixed iova region Antti Laakso
2026-08-27 12:33 ` [PATCH v3 38/44] media: ipu6: Make fw mapping function reusable Antti Laakso
2026-08-27 12:33 ` [PATCH v3 39/44] media: ipu6: Move isys fw mapping to pci_probe Antti Laakso
2026-08-27 12:33 ` [PATCH v3 40/44] media: ipu6: Map ipu7 firmware Antti Laakso
2026-08-27 12:33 ` [PATCH v3 41/44] media: ipu6: Set model name for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 42/44] media: ipu6: Add ipu7.5 buttress support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 43/44] media: ipu6: Add ipu7.5 mmu initialization data Antti Laakso
2026-08-27 12:33 ` [PATCH v3 44/44] media: ipu6: Enable ipu7 and ipu7.5 Antti Laakso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827123336.2219048-24-antti.laakso@linux.intel.com \
--to=antti.laakso@linux.intel.com \
--cc=daxing.li@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ong.hock.yu@intel.com \
--cc=sakari.ailus@linux.intel.com \
--cc=sarang.sapre@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox