dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch
@ 2026-10-01 11:03 Dawid Osuchowski
  2026-10-01 11:03 ` [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks Dawid Osuchowski
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Dawid Osuchowski @ 2026-10-01 11:03 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski, Dawid Osuchowski

This series reworks how the driver determines the HW IP generation and
buttress version, and how it dispatches on them.

Today ivpu_hw_ip_gen() and ivpu_hw_btrs_gen() run a switch over the PCI
device ID on every call, and an unknown ID only triggers a WARN() while
probe continues with an undefined generation. Patch 1 resolves both
values once during device init and fails probe with -EINVAL on an
unrecognized device ID.

With that guarantee in place, patch 2 changes the stored values and their
accessors to the real enum types and drops the default: labels from the
switches that dispatch on them, so -Wswitch flags a generation that is
added later but not handled.

Patch 3 splits the remaining per-generation dispatch in
ivpu_hw_ip_soc_cpu_boot() and pwr_island_delay_set() into helpers that
return directly from each case, removing the locals that were left
uninitialized on the path past the last case.

No functional change is intended beyond failing probe on an unknown PCI
device ID and logging the SOC CPU boot mode even when the boot fails.

Andrzej Kacprowski (1):
  accel/ivpu: Improve HW IP gen and buttress version checks

Dawid Osuchowski (1):
  accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types

Karol Wachowski (1):
  accel/ivpu: Split HW IP generation dispatch into helpers

 drivers/accel/ivpu/ivpu_drv.c   | 69 +++++++++++++++++++-------
 drivers/accel/ivpu/ivpu_drv.h   | 65 +++++++++----------------
 drivers/accel/ivpu/ivpu_hw.h    |  1 -
 drivers/accel/ivpu/ivpu_hw_ip.c | 86 ++++++++++++++++-----------------
 4 files changed, 117 insertions(+), 104 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks
  2026-10-01 11:03 [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Dawid Osuchowski
@ 2026-10-01 11:03 ` Dawid Osuchowski
  2026-10-01 13:57   ` Wachowski, Karol
  2026-10-02 15:19   ` Jeff Hugo
  2026-10-01 11:04 ` [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types Dawid Osuchowski
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Dawid Osuchowski @ 2026-10-01 11:03 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski, Dawid Osuchowski

From: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>

Remove the per-call switch in ivpu_hw_ip_gen()/ivpu_hw_btrs_gen() and
instead initialize the HW IP generation and buttress version once during
device init.

Fail probe with -EINVAL when the PCI device ID does not match any known
generation, instead of warning and continuing with both fields left at 0,
so callers never proceed with an unrecognized generation.

Drop hw->dma_bits and compute it locally to remove the early dependency
on vdev->hw_ip_gen.

Make pwr_island_delay_set() use ivpu_hw_ip_gen() instead of the PCI
device ID directly.

Move MODULE_DEVICE_TABLE() to the top of the file to colocate it with
the HW IP and buttress detection logic.

Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
Co-developed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_drv.c   | 69 +++++++++++++++++++++++++--------
 drivers/accel/ivpu/ivpu_drv.h   | 41 +++++---------------
 drivers/accel/ivpu/ivpu_hw.h    |  1 -
 drivers/accel/ivpu/ivpu_hw_ip.c | 18 +++------
 4 files changed, 67 insertions(+), 62 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index 0f215392d42d..ab1a9448c2cc 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -67,6 +67,48 @@ bool ivpu_force_snoop;
 module_param_named(force_snoop, ivpu_force_snoop, bool, 0444);
 MODULE_PARM_DESC(force_snoop, "Force snooping for NPU host memory access");
 
+static struct pci_device_id ivpu_pci_ids[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PTL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_WCL) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_NVL) },
+	{}
+};
+MODULE_DEVICE_TABLE(pci, ivpu_pci_ids);
+
+static int ivpu_ip_gen_init(struct ivpu_device *vdev)
+{
+	vdev->platform = IVPU_PLATFORM_INVALID;
+
+	switch (ivpu_device_id(vdev)) {
+	case PCI_DEVICE_ID_MTL:
+	case PCI_DEVICE_ID_ARL:
+		vdev->hw_ip_gen = IVPU_HW_IP_37XX;
+		vdev->btrs_gen = IVPU_HW_BTRS_MTL;
+		break;
+	case PCI_DEVICE_ID_LNL:
+		vdev->hw_ip_gen = IVPU_HW_IP_40XX;
+		vdev->btrs_gen = IVPU_HW_BTRS_LNL;
+		break;
+	case PCI_DEVICE_ID_PTL:
+	case PCI_DEVICE_ID_WCL:
+		vdev->hw_ip_gen = IVPU_HW_IP_50XX;
+		vdev->btrs_gen = IVPU_HW_BTRS_LNL;
+		break;
+	case PCI_DEVICE_ID_NVL:
+		vdev->hw_ip_gen = IVPU_HW_IP_60XX;
+		vdev->btrs_gen = IVPU_HW_BTRS_LNL;
+		break;
+	default:
+		ivpu_err(vdev, "Unknown PCI device [%04x:%04x]\n", ivpu_vendor_id(vdev),
+			 ivpu_device_id(vdev));
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static struct ivpu_user_limits *ivpu_user_limits_alloc(struct ivpu_device *vdev, uid_t uid)
 {
 	struct ivpu_user_limits *limits;
@@ -649,6 +691,7 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
 	struct pci_dev *pdev = to_pci_dev(vdev->drm.dev);
 	struct resource *bar0 = &pdev->resource[0];
 	struct resource *bar4 = &pdev->resource[4];
+	int dma_bits;
 	int ret;
 
 	ivpu_dbg(vdev, MISC, "Mapping BAR0 (RegV) %pR\n", bar0);
@@ -665,7 +708,12 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
 		return PTR_ERR(vdev->regb);
 	}
 
-	ret = dma_set_mask_and_coherent(vdev->drm.dev, DMA_BIT_MASK(vdev->hw->dma_bits));
+	if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX)
+		dma_bits = 48;
+	else
+		dma_bits = 38;
+
+	ret = dma_set_mask_and_coherent(vdev->drm.dev, DMA_BIT_MASK(dma_bits));
 	if (ret) {
 		ivpu_err(vdev, "Failed to set DMA mask: %d\n", ret);
 		return ret;
@@ -713,12 +761,10 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
 	if (!vdev->pm)
 		return -ENOMEM;
 
-	if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX)
-		vdev->hw->dma_bits = 48;
-	else
-		vdev->hw->dma_bits = 38;
+	ret = ivpu_ip_gen_init(vdev);
+	if (ret)
+		return ret;
 
-	vdev->platform = IVPU_PLATFORM_INVALID;
 	vdev->context_xa_limit.min = IVPU_USER_CONTEXT_MIN_SSID;
 	vdev->context_xa_limit.max = IVPU_USER_CONTEXT_MAX_SSID;
 	atomic64_set(&vdev->unique_id_counter, 0);
@@ -851,17 +897,6 @@ static void ivpu_dev_fini(struct ivpu_device *vdev)
 	xa_destroy(&vdev->context_xa);
 }
 
-static struct pci_device_id ivpu_pci_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PTL_P) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_WCL) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_NVL) },
-	{}
-};
-MODULE_DEVICE_TABLE(pci, ivpu_pci_ids);
-
 static int ivpu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	struct ivpu_device *vdev;
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 3b26a64ed04f..87953d0474fb 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -27,7 +27,7 @@
 #define PCI_DEVICE_ID_MTL	0x7d1d
 #define PCI_DEVICE_ID_ARL	0xad1d
 #define PCI_DEVICE_ID_LNL	0x643e
-#define PCI_DEVICE_ID_PTL_P	0xb03e
+#define PCI_DEVICE_ID_PTL	0xb03e
 #define PCI_DEVICE_ID_WCL	0xfd3e
 #define PCI_DEVICE_ID_NVL	0xd71d
 
@@ -136,6 +136,8 @@ struct ivpu_device {
 	struct drm_device drm;
 	void __iomem *regb;
 	void __iomem *regv;
+	u32 hw_ip_gen;
+	u32 btrs_gen;
 	u32 platform;
 	u32 irq;
 
@@ -247,6 +249,11 @@ static inline u8 ivpu_revision(struct ivpu_device *vdev)
 	return to_pci_dev(vdev->drm.dev)->revision;
 }
 
+static inline u16 ivpu_vendor_id(struct ivpu_device *vdev)
+{
+	return to_pci_dev(vdev->drm.dev)->vendor;
+}
+
 static inline u16 ivpu_device_id(struct ivpu_device *vdev)
 {
 	return to_pci_dev(vdev->drm.dev)->device;
@@ -254,40 +261,12 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
 
 static inline int ivpu_hw_ip_gen(struct ivpu_device *vdev)
 {
-	switch (ivpu_device_id(vdev)) {
-	case PCI_DEVICE_ID_MTL:
-	case PCI_DEVICE_ID_ARL:
-		return IVPU_HW_IP_37XX;
-	case PCI_DEVICE_ID_LNL:
-		return IVPU_HW_IP_40XX;
-	case PCI_DEVICE_ID_PTL_P:
-	case PCI_DEVICE_ID_WCL:
-		return IVPU_HW_IP_50XX;
-	case PCI_DEVICE_ID_NVL:
-		return IVPU_HW_IP_60XX;
-	default:
-		dump_stack();
-		ivpu_err(vdev, "Unknown NPU IP generation\n");
-		return 0;
-	}
+	return vdev->hw_ip_gen;
 }
 
 static inline int ivpu_hw_btrs_gen(struct ivpu_device *vdev)
 {
-	switch (ivpu_device_id(vdev)) {
-	case PCI_DEVICE_ID_MTL:
-	case PCI_DEVICE_ID_ARL:
-		return IVPU_HW_BTRS_MTL;
-	case PCI_DEVICE_ID_LNL:
-	case PCI_DEVICE_ID_PTL_P:
-	case PCI_DEVICE_ID_WCL:
-	case PCI_DEVICE_ID_NVL:
-		return IVPU_HW_BTRS_LNL;
-	default:
-		dump_stack();
-		ivpu_err(vdev, "Unknown buttress generation\n");
-		return 0;
-	}
+	return vdev->btrs_gen;
 }
 
 static inline struct ivpu_device *to_ivpu_device(struct drm_device *dev)
diff --git a/drivers/accel/ivpu/ivpu_hw.h b/drivers/accel/ivpu/ivpu_hw.h
index 487a918e2fa9..11717ffe738c 100644
--- a/drivers/accel/ivpu/ivpu_hw.h
+++ b/drivers/accel/ivpu/ivpu_hw.h
@@ -49,7 +49,6 @@ struct ivpu_hw_info {
 	u32 tile_fuse;
 	u32 sku;
 	u16 config;
-	int dma_bits;
 	ktime_t d0i3_entry_host_ts;
 	u64 d0i3_entry_vpu_ts;
 	atomic_t firewall_irq_counter;
diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
index 46661fbf9d05..c604c1c37e99 100644
--- a/drivers/accel/ivpu/ivpu_hw_ip.c
+++ b/drivers/accel/ivpu/ivpu_hw_ip.c
@@ -678,29 +678,21 @@ static void pwr_island_delay_set(struct ivpu_device *vdev)
 	bool high = vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH;
 	u32 post, post1, post2, status;
 
-	if (ivpu_hw_ip_gen(vdev) < IVPU_HW_IP_50XX)
+	switch (ivpu_hw_ip_gen(vdev)) {
+	case IVPU_HW_IP_37XX:
+	case IVPU_HW_IP_40XX:
 		return;
-
-	switch (ivpu_device_id(vdev)) {
-	case PCI_DEVICE_ID_WCL:
-	case PCI_DEVICE_ID_PTL_P:
+	case IVPU_HW_IP_50XX:
 		post = high ? 18 : 0;
 		post1 = 0;
 		post2 = 0;
 		status = high ? 46 : 3;
 		break;
-
-	case PCI_DEVICE_ID_NVL:
+	default:
 		post = high ? 198 : 17;
 		post1 = 0;
 		post2 = high ? 198 : 17;
 		status = 0;
-		break;
-
-	default:
-		dump_stack();
-		ivpu_err(vdev, "Unknown device ID\n");
-		return;
 	}
 
 	pwr_island_delay_set_50xx(vdev, post, post1, post2, status);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types
  2026-10-01 11:03 [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Dawid Osuchowski
  2026-10-01 11:03 ` [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks Dawid Osuchowski
@ 2026-10-01 11:04 ` Dawid Osuchowski
  2026-10-01 13:58   ` Wachowski, Karol
                     ` (2 more replies)
  2026-10-01 11:04 ` [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers Dawid Osuchowski
  2026-10-05  7:08 ` [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Wachowski, Karol
  3 siblings, 3 replies; 12+ messages in thread
From: Dawid Osuchowski @ 2026-10-01 11:04 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski, Dawid Osuchowski

Change the hw_ip_gen and btrs_gen members of struct ivpu_device, and
their accessors, from u32/int to enum vpu_hw_ip/enum vpu_hw_btrs, and
drop the default: labels from the switch statements in ivpu_hw_ip.c
that dispatch on them. Switching on the real enum types lets the
compiler treat these switches as exhaustive at compile time, so a
missing case for a new generation now warns instead of silently
hitting default:.

This compile-time guarantee holds because ivpu_ip_gen_init() now fails
probe on an unrecognized PCI device ID instead of leaving these fields
at 0, so the switches never see an unhandled value.

Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_drv.h   | 28 ++++++++++++++++------------
 drivers/accel/ivpu/ivpu_hw_ip.c | 14 ++++++++++----
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 87953d0474fb..ce9cb118c0c4 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -31,17 +31,9 @@
 #define PCI_DEVICE_ID_WCL	0xfd3e
 #define PCI_DEVICE_ID_NVL	0xd71d
 
-#define IVPU_HW_IP_37XX 37
-#define IVPU_HW_IP_40XX 40
-#define IVPU_HW_IP_50XX 50
-#define IVPU_HW_IP_60XX 60
-
 #define IVPU_HW_IP_REV_LNL_B0 4
 #define IVPU_HW_IP_REV_NVL_A0 0
 
-#define IVPU_HW_BTRS_MTL 1
-#define IVPU_HW_BTRS_LNL 2
-
 #define IVPU_GLOBAL_CONTEXT_MMU_SSID   0
 /* SSID 1 is used by the VPU to represent reserved context */
 #define IVPU_RESERVED_CONTEXT_MMU_SSID 1
@@ -107,6 +99,18 @@
 		ivpu_dbg(vdev, MISC, "Using WA: " #wa_name "\n");	\
 } while (0)
 
+enum vpu_hw_ip {
+	IVPU_HW_IP_37XX = 37,
+	IVPU_HW_IP_40XX = 40,
+	IVPU_HW_IP_50XX = 50,
+	IVPU_HW_IP_60XX = 60,
+};
+
+enum vpu_hw_btrs {
+	IVPU_HW_BTRS_MTL = 1,
+	IVPU_HW_BTRS_LNL = 2,
+};
+
 struct ivpu_wa_table {
 	bool punit_disabled;
 	bool clear_runtime_mem;
@@ -136,8 +140,8 @@ struct ivpu_device {
 	struct drm_device drm;
 	void __iomem *regb;
 	void __iomem *regv;
-	u32 hw_ip_gen;
-	u32 btrs_gen;
+	enum vpu_hw_ip hw_ip_gen;
+	enum vpu_hw_btrs btrs_gen;
 	u32 platform;
 	u32 irq;
 
@@ -259,12 +263,12 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
 	return to_pci_dev(vdev->drm.dev)->device;
 }
 
-static inline int ivpu_hw_ip_gen(struct ivpu_device *vdev)
+static inline enum vpu_hw_ip ivpu_hw_ip_gen(struct ivpu_device *vdev)
 {
 	return vdev->hw_ip_gen;
 }
 
-static inline int ivpu_hw_btrs_gen(struct ivpu_device *vdev)
+static inline enum vpu_hw_btrs ivpu_hw_btrs_gen(struct ivpu_device *vdev)
 {
 	return vdev->btrs_gen;
 }
diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
index c604c1c37e99..bd6bb3fa49ff 100644
--- a/drivers/accel/ivpu/ivpu_hw_ip.c
+++ b/drivers/accel/ivpu/ivpu_hw_ip.c
@@ -688,7 +688,7 @@ static void pwr_island_delay_set(struct ivpu_device *vdev)
 		post2 = 0;
 		status = high ? 46 : 3;
 		break;
-	default:
+	case IVPU_HW_IP_60XX:
 		post = high ? 198 : 17;
 		post1 = 0;
 		post2 = high ? 198 : 17;
@@ -801,10 +801,15 @@ static void ivpu_hw_ip_tbu_mmu_enable_40xx(struct ivpu_device *vdev)
 
 void ivpu_hw_ip_tbu_mmu_enable(struct ivpu_device *vdev)
 {
-	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX)
+	switch (ivpu_hw_ip_gen(vdev)) {
+	case IVPU_HW_IP_37XX:
 		return ivpu_hw_ip_tbu_mmu_enable_37xx(vdev);
-	else
+
+	case IVPU_HW_IP_40XX:
+	case IVPU_HW_IP_50XX:
+	case IVPU_HW_IP_60XX:
 		return ivpu_hw_ip_tbu_mmu_enable_40xx(vdev);
+	}
 }
 
 static inline u64 get_entry_point_addr(struct ivpu_device *vdev)
@@ -940,8 +945,9 @@ int ivpu_hw_ip_soc_cpu_boot(struct ivpu_device *vdev)
 		ret = soc_cpu_boot_40xx(vdev);
 		break;
 
-	default:
+	case IVPU_HW_IP_60XX:
 		ret = soc_cpu_boot_60xx(vdev);
+		break;
 	}
 
 	if (ret)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers
  2026-10-01 11:03 [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Dawid Osuchowski
  2026-10-01 11:03 ` [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks Dawid Osuchowski
  2026-10-01 11:04 ` [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types Dawid Osuchowski
@ 2026-10-01 11:04 ` Dawid Osuchowski
  2026-10-01 14:34   ` Andrzej Kacprowski
  2026-10-02 15:21   ` Jeff Hugo
  2026-10-05  7:08 ` [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Wachowski, Karol
  3 siblings, 2 replies; 12+ messages in thread
From: Dawid Osuchowski @ 2026-10-01 11:04 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski, Dawid Osuchowski

From: Karol Wachowski <karol.wachowski@linux.intel.com>

ivpu_hw_ip_soc_cpu_boot() and pwr_island_delay_set() keep the result of
their per-generation switch in locals that are left uninitialized on the
path past the last case. Building with -Wmaybe-uninitialized reports ret,
post, post2 and status; Kbuild disables that warning for GCC, so it does
not show up in a normal build.

Let every case return directly instead, so no local is needed.
ivpu_hw_ip_soc_cpu_boot() now dispatches on its own, with the debug
message moved ahead of the switch so that the boot mode is logged before
the boot registers are written, and the power island delay values move
into per-generation helpers. Neither switch has a default: label, so
-Wswitch reports any enum vpu_hw_ip value added later that is not
handled, and the path past the switch returns -EINVAL.

Build the power island delay values from zero instead of reading the
registers first. POST_DLY, POST1_DLY and POST2_DLY together span every
writable bit of PWR_ISLAND_EN_POST_DLY, and STATUS_DLY spans every
writable bit of PWR_ISLAND_STATUS_DLY, so the read-modify-write only
fetched bits that are immediately overwritten.

The boot mode is now logged even when the boot fails; no other functional
changes.

Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_hw_ip.c | 64 ++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
index bd6bb3fa49ff..36730f4338f0 100644
--- a/drivers/accel/ivpu/ivpu_hw_ip.c
+++ b/drivers/accel/ivpu/ivpu_hw_ip.c
@@ -265,21 +265,35 @@ void ivpu_hw_ip_idle_gen_disable(struct ivpu_device *vdev)
 }
 
 static void
-pwr_island_delay_set_50xx(struct ivpu_device *vdev, u32 post, u32 post1, u32 post2, u32 status)
+pwr_island_delay_write(struct ivpu_device *vdev, u32 post, u32 post1, u32 post2, u32 status)
 {
 	u32 val;
 
-	val = REGV_RD32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY);
-	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST_DLY, post, val);
+	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST_DLY, post, 0);
 	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST1_DLY, post1, val);
 	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST2_DLY, post2, val);
 	REGV_WR32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, val);
 
-	val = REGV_RD32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY);
-	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY, STATUS_DLY, status, val);
+	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY, STATUS_DLY, status, 0);
 	REGV_WR32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY, val);
 }
 
+static void pwr_island_delay_set_50xx(struct ivpu_device *vdev)
+{
+	if (vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH)
+		pwr_island_delay_write(vdev, 18, 0, 0, 46);
+	else
+		pwr_island_delay_write(vdev, 0, 0, 0, 3);
+}
+
+static void pwr_island_delay_set_60xx(struct ivpu_device *vdev)
+{
+	if (vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH)
+		pwr_island_delay_write(vdev, 198, 0, 198, 0);
+	else
+		pwr_island_delay_write(vdev, 17, 0, 17, 0);
+}
+
 static void pwr_island_trickle_drive_37xx(struct ivpu_device *vdev, bool enable)
 {
 	u32 val = REGV_RD32(VPU_37XX_HOST_SS_AON_PWR_ISLAND_TRICKLE_EN0);
@@ -675,27 +689,19 @@ static void dpu_active_drive_37xx(struct ivpu_device *vdev, bool enable)
 
 static void pwr_island_delay_set(struct ivpu_device *vdev)
 {
-	bool high = vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH;
-	u32 post, post1, post2, status;
-
 	switch (ivpu_hw_ip_gen(vdev)) {
 	case IVPU_HW_IP_37XX:
 	case IVPU_HW_IP_40XX:
 		return;
+
 	case IVPU_HW_IP_50XX:
-		post = high ? 18 : 0;
-		post1 = 0;
-		post2 = 0;
-		status = high ? 46 : 3;
-		break;
+		pwr_island_delay_set_50xx(vdev);
+		return;
+
 	case IVPU_HW_IP_60XX:
-		post = high ? 198 : 17;
-		post1 = 0;
-		post2 = high ? 198 : 17;
-		status = 0;
+		pwr_island_delay_set_60xx(vdev);
+		return;
 	}
-
-	pwr_island_delay_set_50xx(vdev, post, post1, post2, status);
 }
 
 int ivpu_hw_ip_pwr_domain_enable(struct ivpu_device *vdev)
@@ -933,30 +939,22 @@ static int soc_cpu_boot_60xx(struct ivpu_device *vdev)
 
 int ivpu_hw_ip_soc_cpu_boot(struct ivpu_device *vdev)
 {
-	int ret;
+	ivpu_dbg(vdev, PM, "Booting firmware, mode: %s\n",
+		 ivpu_fw_is_warm_boot(vdev) ? "warm boot" : "cold boot");
 
 	switch (ivpu_hw_ip_gen(vdev)) {
 	case IVPU_HW_IP_37XX:
-		ret = soc_cpu_boot_37xx(vdev);
-		break;
+		return soc_cpu_boot_37xx(vdev);
 
 	case IVPU_HW_IP_40XX:
 	case IVPU_HW_IP_50XX:
-		ret = soc_cpu_boot_40xx(vdev);
-		break;
+		return soc_cpu_boot_40xx(vdev);
 
 	case IVPU_HW_IP_60XX:
-		ret = soc_cpu_boot_60xx(vdev);
-		break;
+		return soc_cpu_boot_60xx(vdev);
 	}
 
-	if (ret)
-		return ret;
-
-	ivpu_dbg(vdev, PM, "Booting firmware, mode: %s\n",
-		 ivpu_fw_is_warm_boot(vdev) ? "warm boot" : "cold boot");
-
-	return 0;
+	return -EINVAL;
 }
 
 static void wdt_disable_37xx(struct ivpu_device *vdev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks
  2026-10-01 11:03 ` [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks Dawid Osuchowski
@ 2026-10-01 13:57   ` Wachowski, Karol
  2026-10-02 15:19   ` Jeff Hugo
  1 sibling, 0 replies; 12+ messages in thread
From: Wachowski, Karol @ 2026-10-01 13:57 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski

On 01-Oct-26 13:03, Dawid Osuchowski wrote:
> From: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> 
> Remove the per-call switch in ivpu_hw_ip_gen()/ivpu_hw_btrs_gen() and
> instead initialize the HW IP generation and buttress version once during
> device init.
> 
> Fail probe with -EINVAL when the PCI device ID does not match any known
> generation, instead of warning and continuing with both fields left at 0,
> so callers never proceed with an unrecognized generation.
> 
> Drop hw->dma_bits and compute it locally to remove the early dependency
> on vdev->hw_ip_gen.
> 
> Make pwr_island_delay_set() use ivpu_hw_ip_gen() instead of the PCI
> device ID directly.
> 
> Move MODULE_DEVICE_TABLE() to the top of the file to colocate it with
> the HW IP and buttress detection logic.
> 
> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> Co-developed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_drv.c   | 69 +++++++++++++++++++++++++--------
>   drivers/accel/ivpu/ivpu_drv.h   | 41 +++++---------------
>   drivers/accel/ivpu/ivpu_hw.h    |  1 -
>   drivers/accel/ivpu/ivpu_hw_ip.c | 18 +++------
>   4 files changed, 67 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
> index 0f215392d42d..ab1a9448c2cc 100644
> --- a/drivers/accel/ivpu/ivpu_drv.c
> +++ b/drivers/accel/ivpu/ivpu_drv.c
> @@ -67,6 +67,48 @@ bool ivpu_force_snoop;
>   module_param_named(force_snoop, ivpu_force_snoop, bool, 0444);
>   MODULE_PARM_DESC(force_snoop, "Force snooping for NPU host memory access");
>   
> +static struct pci_device_id ivpu_pci_ids[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PTL) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_WCL) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_NVL) },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(pci, ivpu_pci_ids);
> +
> +static int ivpu_ip_gen_init(struct ivpu_device *vdev)
> +{
> +	vdev->platform = IVPU_PLATFORM_INVALID;
> +
> +	switch (ivpu_device_id(vdev)) {
> +	case PCI_DEVICE_ID_MTL:
> +	case PCI_DEVICE_ID_ARL:
> +		vdev->hw_ip_gen = IVPU_HW_IP_37XX;
> +		vdev->btrs_gen = IVPU_HW_BTRS_MTL;
> +		break;
> +	case PCI_DEVICE_ID_LNL:
> +		vdev->hw_ip_gen = IVPU_HW_IP_40XX;
> +		vdev->btrs_gen = IVPU_HW_BTRS_LNL;
> +		break;
> +	case PCI_DEVICE_ID_PTL:
> +	case PCI_DEVICE_ID_WCL:
> +		vdev->hw_ip_gen = IVPU_HW_IP_50XX;
> +		vdev->btrs_gen = IVPU_HW_BTRS_LNL;
> +		break;
> +	case PCI_DEVICE_ID_NVL:
> +		vdev->hw_ip_gen = IVPU_HW_IP_60XX;
> +		vdev->btrs_gen = IVPU_HW_BTRS_LNL;
> +		break;
> +	default:
> +		ivpu_err(vdev, "Unknown PCI device [%04x:%04x]\n", ivpu_vendor_id(vdev),
> +			 ivpu_device_id(vdev));
> +		return -EINVAL;
> +	}
> +	return 0;
> +}
> +
>   static struct ivpu_user_limits *ivpu_user_limits_alloc(struct ivpu_device *vdev, uid_t uid)
>   {
>   	struct ivpu_user_limits *limits;
> @@ -649,6 +691,7 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
>   	struct pci_dev *pdev = to_pci_dev(vdev->drm.dev);
>   	struct resource *bar0 = &pdev->resource[0];
>   	struct resource *bar4 = &pdev->resource[4];
> +	int dma_bits;
>   	int ret;
>   
>   	ivpu_dbg(vdev, MISC, "Mapping BAR0 (RegV) %pR\n", bar0);
> @@ -665,7 +708,12 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
>   		return PTR_ERR(vdev->regb);
>   	}
>   
> -	ret = dma_set_mask_and_coherent(vdev->drm.dev, DMA_BIT_MASK(vdev->hw->dma_bits));
> +	if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX)
> +		dma_bits = 48;
> +	else
> +		dma_bits = 38;
> +
> +	ret = dma_set_mask_and_coherent(vdev->drm.dev, DMA_BIT_MASK(dma_bits));
>   	if (ret) {
>   		ivpu_err(vdev, "Failed to set DMA mask: %d\n", ret);
>   		return ret;
> @@ -713,12 +761,10 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
>   	if (!vdev->pm)
>   		return -ENOMEM;
>   
> -	if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX)
> -		vdev->hw->dma_bits = 48;
> -	else
> -		vdev->hw->dma_bits = 38;
> +	ret = ivpu_ip_gen_init(vdev);
> +	if (ret)
> +		return ret;
>   
> -	vdev->platform = IVPU_PLATFORM_INVALID;
>   	vdev->context_xa_limit.min = IVPU_USER_CONTEXT_MIN_SSID;
>   	vdev->context_xa_limit.max = IVPU_USER_CONTEXT_MAX_SSID;
>   	atomic64_set(&vdev->unique_id_counter, 0);
> @@ -851,17 +897,6 @@ static void ivpu_dev_fini(struct ivpu_device *vdev)
>   	xa_destroy(&vdev->context_xa);
>   }
>   
> -static struct pci_device_id ivpu_pci_ids[] = {
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) },
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) },
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) },
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PTL_P) },
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_WCL) },
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_NVL) },
> -	{}
> -};
> -MODULE_DEVICE_TABLE(pci, ivpu_pci_ids);
> -
>   static int ivpu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   {
>   	struct ivpu_device *vdev;
> diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
> index 3b26a64ed04f..87953d0474fb 100644
> --- a/drivers/accel/ivpu/ivpu_drv.h
> +++ b/drivers/accel/ivpu/ivpu_drv.h
> @@ -27,7 +27,7 @@
>   #define PCI_DEVICE_ID_MTL	0x7d1d
>   #define PCI_DEVICE_ID_ARL	0xad1d
>   #define PCI_DEVICE_ID_LNL	0x643e
> -#define PCI_DEVICE_ID_PTL_P	0xb03e
> +#define PCI_DEVICE_ID_PTL	0xb03e
>   #define PCI_DEVICE_ID_WCL	0xfd3e
>   #define PCI_DEVICE_ID_NVL	0xd71d
>   
> @@ -136,6 +136,8 @@ struct ivpu_device {
>   	struct drm_device drm;
>   	void __iomem *regb;
>   	void __iomem *regv;
> +	u32 hw_ip_gen;
> +	u32 btrs_gen;
>   	u32 platform;
>   	u32 irq;
>   
> @@ -247,6 +249,11 @@ static inline u8 ivpu_revision(struct ivpu_device *vdev)
>   	return to_pci_dev(vdev->drm.dev)->revision;
>   }
>   
> +static inline u16 ivpu_vendor_id(struct ivpu_device *vdev)
> +{
> +	return to_pci_dev(vdev->drm.dev)->vendor;
> +}
> +
>   static inline u16 ivpu_device_id(struct ivpu_device *vdev)
>   {
>   	return to_pci_dev(vdev->drm.dev)->device;
> @@ -254,40 +261,12 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
>   
>   static inline int ivpu_hw_ip_gen(struct ivpu_device *vdev)
>   {
> -	switch (ivpu_device_id(vdev)) {
> -	case PCI_DEVICE_ID_MTL:
> -	case PCI_DEVICE_ID_ARL:
> -		return IVPU_HW_IP_37XX;
> -	case PCI_DEVICE_ID_LNL:
> -		return IVPU_HW_IP_40XX;
> -	case PCI_DEVICE_ID_PTL_P:
> -	case PCI_DEVICE_ID_WCL:
> -		return IVPU_HW_IP_50XX;
> -	case PCI_DEVICE_ID_NVL:
> -		return IVPU_HW_IP_60XX;
> -	default:
> -		dump_stack();
> -		ivpu_err(vdev, "Unknown NPU IP generation\n");
> -		return 0;
> -	}
> +	return vdev->hw_ip_gen;
>   }
>   
>   static inline int ivpu_hw_btrs_gen(struct ivpu_device *vdev)
>   {
> -	switch (ivpu_device_id(vdev)) {
> -	case PCI_DEVICE_ID_MTL:
> -	case PCI_DEVICE_ID_ARL:
> -		return IVPU_HW_BTRS_MTL;
> -	case PCI_DEVICE_ID_LNL:
> -	case PCI_DEVICE_ID_PTL_P:
> -	case PCI_DEVICE_ID_WCL:
> -	case PCI_DEVICE_ID_NVL:
> -		return IVPU_HW_BTRS_LNL;
> -	default:
> -		dump_stack();
> -		ivpu_err(vdev, "Unknown buttress generation\n");
> -		return 0;
> -	}
> +	return vdev->btrs_gen;
>   }
>   
>   static inline struct ivpu_device *to_ivpu_device(struct drm_device *dev)
> diff --git a/drivers/accel/ivpu/ivpu_hw.h b/drivers/accel/ivpu/ivpu_hw.h
> index 487a918e2fa9..11717ffe738c 100644
> --- a/drivers/accel/ivpu/ivpu_hw.h
> +++ b/drivers/accel/ivpu/ivpu_hw.h
> @@ -49,7 +49,6 @@ struct ivpu_hw_info {
>   	u32 tile_fuse;
>   	u32 sku;
>   	u16 config;
> -	int dma_bits;
>   	ktime_t d0i3_entry_host_ts;
>   	u64 d0i3_entry_vpu_ts;
>   	atomic_t firewall_irq_counter;
> diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
> index 46661fbf9d05..c604c1c37e99 100644
> --- a/drivers/accel/ivpu/ivpu_hw_ip.c
> +++ b/drivers/accel/ivpu/ivpu_hw_ip.c
> @@ -678,29 +678,21 @@ static void pwr_island_delay_set(struct ivpu_device *vdev)
>   	bool high = vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH;
>   	u32 post, post1, post2, status;
>   
> -	if (ivpu_hw_ip_gen(vdev) < IVPU_HW_IP_50XX)
> +	switch (ivpu_hw_ip_gen(vdev)) {
> +	case IVPU_HW_IP_37XX:
> +	case IVPU_HW_IP_40XX:
>   		return;
> -
> -	switch (ivpu_device_id(vdev)) {
> -	case PCI_DEVICE_ID_WCL:
> -	case PCI_DEVICE_ID_PTL_P:
> +	case IVPU_HW_IP_50XX:
>   		post = high ? 18 : 0;
>   		post1 = 0;
>   		post2 = 0;
>   		status = high ? 46 : 3;
>   		break;
> -
> -	case PCI_DEVICE_ID_NVL:
> +	default:
>   		post = high ? 198 : 17;
>   		post1 = 0;
>   		post2 = high ? 198 : 17;
>   		status = 0;
> -		break;
> -
> -	default:
> -		dump_stack();
> -		ivpu_err(vdev, "Unknown device ID\n");
> -		return;
>   	}
>   
>   	pwr_island_delay_set_50xx(vdev, post, post1, post2, status);

Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types
  2026-10-01 11:04 ` [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types Dawid Osuchowski
@ 2026-10-01 13:58   ` Wachowski, Karol
  2026-10-01 14:33   ` Andrzej Kacprowski
  2026-10-02 15:20   ` Jeff Hugo
  2 siblings, 0 replies; 12+ messages in thread
From: Wachowski, Karol @ 2026-10-01 13:58 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski

On 01-Oct-26 13:04, Dawid Osuchowski wrote:
> Change the hw_ip_gen and btrs_gen members of struct ivpu_device, and
> their accessors, from u32/int to enum vpu_hw_ip/enum vpu_hw_btrs, and
> drop the default: labels from the switch statements in ivpu_hw_ip.c
> that dispatch on them. Switching on the real enum types lets the
> compiler treat these switches as exhaustive at compile time, so a
> missing case for a new generation now warns instead of silently
> hitting default:.
> 
> This compile-time guarantee holds because ivpu_ip_gen_init() now fails
> probe on an unrecognized PCI device ID instead of leaving these fields
> at 0, so the switches never see an unhandled value.
> 
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_drv.h   | 28 ++++++++++++++++------------
>   drivers/accel/ivpu/ivpu_hw_ip.c | 14 ++++++++++----
>   2 files changed, 26 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
> index 87953d0474fb..ce9cb118c0c4 100644
> --- a/drivers/accel/ivpu/ivpu_drv.h
> +++ b/drivers/accel/ivpu/ivpu_drv.h
> @@ -31,17 +31,9 @@
>   #define PCI_DEVICE_ID_WCL	0xfd3e
>   #define PCI_DEVICE_ID_NVL	0xd71d
>   
> -#define IVPU_HW_IP_37XX 37
> -#define IVPU_HW_IP_40XX 40
> -#define IVPU_HW_IP_50XX 50
> -#define IVPU_HW_IP_60XX 60
> -
>   #define IVPU_HW_IP_REV_LNL_B0 4
>   #define IVPU_HW_IP_REV_NVL_A0 0
>   
> -#define IVPU_HW_BTRS_MTL 1
> -#define IVPU_HW_BTRS_LNL 2
> -
>   #define IVPU_GLOBAL_CONTEXT_MMU_SSID   0
>   /* SSID 1 is used by the VPU to represent reserved context */
>   #define IVPU_RESERVED_CONTEXT_MMU_SSID 1
> @@ -107,6 +99,18 @@
>   		ivpu_dbg(vdev, MISC, "Using WA: " #wa_name "\n");	\
>   } while (0)
>   
> +enum vpu_hw_ip {
> +	IVPU_HW_IP_37XX = 37,
> +	IVPU_HW_IP_40XX = 40,
> +	IVPU_HW_IP_50XX = 50,
> +	IVPU_HW_IP_60XX = 60,
> +};
> +
> +enum vpu_hw_btrs {
> +	IVPU_HW_BTRS_MTL = 1,
> +	IVPU_HW_BTRS_LNL = 2,
> +};
> +
>   struct ivpu_wa_table {
>   	bool punit_disabled;
>   	bool clear_runtime_mem;
> @@ -136,8 +140,8 @@ struct ivpu_device {
>   	struct drm_device drm;
>   	void __iomem *regb;
>   	void __iomem *regv;
> -	u32 hw_ip_gen;
> -	u32 btrs_gen;
> +	enum vpu_hw_ip hw_ip_gen;
> +	enum vpu_hw_btrs btrs_gen;
>   	u32 platform;
>   	u32 irq;
>   
> @@ -259,12 +263,12 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
>   	return to_pci_dev(vdev->drm.dev)->device;
>   }
>   
> -static inline int ivpu_hw_ip_gen(struct ivpu_device *vdev)
> +static inline enum vpu_hw_ip ivpu_hw_ip_gen(struct ivpu_device *vdev)
>   {
>   	return vdev->hw_ip_gen;
>   }
>   
> -static inline int ivpu_hw_btrs_gen(struct ivpu_device *vdev)
> +static inline enum vpu_hw_btrs ivpu_hw_btrs_gen(struct ivpu_device *vdev)
>   {
>   	return vdev->btrs_gen;
>   }
> diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
> index c604c1c37e99..bd6bb3fa49ff 100644
> --- a/drivers/accel/ivpu/ivpu_hw_ip.c
> +++ b/drivers/accel/ivpu/ivpu_hw_ip.c
> @@ -688,7 +688,7 @@ static void pwr_island_delay_set(struct ivpu_device *vdev)
>   		post2 = 0;
>   		status = high ? 46 : 3;
>   		break;
> -	default:
> +	case IVPU_HW_IP_60XX:
>   		post = high ? 198 : 17;
>   		post1 = 0;
>   		post2 = high ? 198 : 17;
> @@ -801,10 +801,15 @@ static void ivpu_hw_ip_tbu_mmu_enable_40xx(struct ivpu_device *vdev)
>   
>   void ivpu_hw_ip_tbu_mmu_enable(struct ivpu_device *vdev)
>   {
> -	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX)
> +	switch (ivpu_hw_ip_gen(vdev)) {
> +	case IVPU_HW_IP_37XX:
>   		return ivpu_hw_ip_tbu_mmu_enable_37xx(vdev);
> -	else
> +
> +	case IVPU_HW_IP_40XX:
> +	case IVPU_HW_IP_50XX:
> +	case IVPU_HW_IP_60XX:
>   		return ivpu_hw_ip_tbu_mmu_enable_40xx(vdev);
> +	}
>   }
>   
>   static inline u64 get_entry_point_addr(struct ivpu_device *vdev)
> @@ -940,8 +945,9 @@ int ivpu_hw_ip_soc_cpu_boot(struct ivpu_device *vdev)
>   		ret = soc_cpu_boot_40xx(vdev);
>   		break;
>   
> -	default:
> +	case IVPU_HW_IP_60XX:
>   		ret = soc_cpu_boot_60xx(vdev);
> +		break;
>   	}
>   
>   	if (ret)

Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types
  2026-10-01 11:04 ` [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types Dawid Osuchowski
  2026-10-01 13:58   ` Wachowski, Karol
@ 2026-10-01 14:33   ` Andrzej Kacprowski
  2026-10-02 15:20   ` Jeff Hugo
  2 siblings, 0 replies; 12+ messages in thread
From: Andrzej Kacprowski @ 2026-10-01 14:33 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel; +Cc: karol.wachowski

On 01-Oct-26 1:04 PM, Dawid Osuchowski wrote:
> Change the hw_ip_gen and btrs_gen members of struct ivpu_device, and
> their accessors, from u32/int to enum vpu_hw_ip/enum vpu_hw_btrs, and
> drop the default: labels from the switch statements in ivpu_hw_ip.c
> that dispatch on them. Switching on the real enum types lets the
> compiler treat these switches as exhaustive at compile time, so a
> missing case for a new generation now warns instead of silently
> hitting default:.
> 
> This compile-time guarantee holds because ivpu_ip_gen_init() now fails
> probe on an unrecognized PCI device ID instead of leaving these fields
> at 0, so the switches never see an unhandled value.
> 
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_drv.h   | 28 ++++++++++++++++------------
>   drivers/accel/ivpu/ivpu_hw_ip.c | 14 ++++++++++----
>   2 files changed, 26 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
> index 87953d0474fb..ce9cb118c0c4 100644
> --- a/drivers/accel/ivpu/ivpu_drv.h
> +++ b/drivers/accel/ivpu/ivpu_drv.h
> @@ -31,17 +31,9 @@
>   #define PCI_DEVICE_ID_WCL	0xfd3e
>   #define PCI_DEVICE_ID_NVL	0xd71d
>   
> -#define IVPU_HW_IP_37XX 37
> -#define IVPU_HW_IP_40XX 40
> -#define IVPU_HW_IP_50XX 50
> -#define IVPU_HW_IP_60XX 60
> -
>   #define IVPU_HW_IP_REV_LNL_B0 4
>   #define IVPU_HW_IP_REV_NVL_A0 0
>   
> -#define IVPU_HW_BTRS_MTL 1
> -#define IVPU_HW_BTRS_LNL 2
> -
>   #define IVPU_GLOBAL_CONTEXT_MMU_SSID   0
>   /* SSID 1 is used by the VPU to represent reserved context */
>   #define IVPU_RESERVED_CONTEXT_MMU_SSID 1
> @@ -107,6 +99,18 @@
>   		ivpu_dbg(vdev, MISC, "Using WA: " #wa_name "\n");	\
>   } while (0)
>   
> +enum vpu_hw_ip {
> +	IVPU_HW_IP_37XX = 37,
> +	IVPU_HW_IP_40XX = 40,
> +	IVPU_HW_IP_50XX = 50,
> +	IVPU_HW_IP_60XX = 60,
> +};
> +
> +enum vpu_hw_btrs {
> +	IVPU_HW_BTRS_MTL = 1,
> +	IVPU_HW_BTRS_LNL = 2,
> +};
> +
>   struct ivpu_wa_table {
>   	bool punit_disabled;
>   	bool clear_runtime_mem;
> @@ -136,8 +140,8 @@ struct ivpu_device {
>   	struct drm_device drm;
>   	void __iomem *regb;
>   	void __iomem *regv;
> -	u32 hw_ip_gen;
> -	u32 btrs_gen;
> +	enum vpu_hw_ip hw_ip_gen;
> +	enum vpu_hw_btrs btrs_gen;
>   	u32 platform;
>   	u32 irq;
>   
> @@ -259,12 +263,12 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
>   	return to_pci_dev(vdev->drm.dev)->device;
>   }
>   
> -static inline int ivpu_hw_ip_gen(struct ivpu_device *vdev)
> +static inline enum vpu_hw_ip ivpu_hw_ip_gen(struct ivpu_device *vdev)
>   {
>   	return vdev->hw_ip_gen;
>   }
>   
> -static inline int ivpu_hw_btrs_gen(struct ivpu_device *vdev)
> +static inline enum vpu_hw_btrs ivpu_hw_btrs_gen(struct ivpu_device *vdev)
>   {
>   	return vdev->btrs_gen;
>   }
> diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
> index c604c1c37e99..bd6bb3fa49ff 100644
> --- a/drivers/accel/ivpu/ivpu_hw_ip.c
> +++ b/drivers/accel/ivpu/ivpu_hw_ip.c
> @@ -688,7 +688,7 @@ static void pwr_island_delay_set(struct ivpu_device *vdev)
>   		post2 = 0;
>   		status = high ? 46 : 3;
>   		break;
> -	default:
> +	case IVPU_HW_IP_60XX:
>   		post = high ? 198 : 17;
>   		post1 = 0;
>   		post2 = high ? 198 : 17;
> @@ -801,10 +801,15 @@ static void ivpu_hw_ip_tbu_mmu_enable_40xx(struct ivpu_device *vdev)
>   
>   void ivpu_hw_ip_tbu_mmu_enable(struct ivpu_device *vdev)
>   {
> -	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX)
> +	switch (ivpu_hw_ip_gen(vdev)) {
> +	case IVPU_HW_IP_37XX:
>   		return ivpu_hw_ip_tbu_mmu_enable_37xx(vdev);
> -	else
> +
> +	case IVPU_HW_IP_40XX:
> +	case IVPU_HW_IP_50XX:
> +	case IVPU_HW_IP_60XX:
>   		return ivpu_hw_ip_tbu_mmu_enable_40xx(vdev);
> +	}
>   }
>   
>   static inline u64 get_entry_point_addr(struct ivpu_device *vdev)
> @@ -940,8 +945,9 @@ int ivpu_hw_ip_soc_cpu_boot(struct ivpu_device *vdev)
>   		ret = soc_cpu_boot_40xx(vdev);
>   		break;
>   
> -	default:
> +	case IVPU_HW_IP_60XX:
>   		ret = soc_cpu_boot_60xx(vdev);
> +		break;
>   	}
>   
>   	if (ret)
Reviewed-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers
  2026-10-01 11:04 ` [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers Dawid Osuchowski
@ 2026-10-01 14:34   ` Andrzej Kacprowski
  2026-10-02 15:21   ` Jeff Hugo
  1 sibling, 0 replies; 12+ messages in thread
From: Andrzej Kacprowski @ 2026-10-01 14:34 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel; +Cc: karol.wachowski

On 01-Oct-26 1:04 PM, Dawid Osuchowski wrote:
> From: Karol Wachowski <karol.wachowski@linux.intel.com>
> 
> ivpu_hw_ip_soc_cpu_boot() and pwr_island_delay_set() keep the result of
> their per-generation switch in locals that are left uninitialized on the
> path past the last case. Building with -Wmaybe-uninitialized reports ret,
> post, post2 and status; Kbuild disables that warning for GCC, so it does
> not show up in a normal build.
> 
> Let every case return directly instead, so no local is needed.
> ivpu_hw_ip_soc_cpu_boot() now dispatches on its own, with the debug
> message moved ahead of the switch so that the boot mode is logged before
> the boot registers are written, and the power island delay values move
> into per-generation helpers. Neither switch has a default: label, so
> -Wswitch reports any enum vpu_hw_ip value added later that is not
> handled, and the path past the switch returns -EINVAL.
> 
> Build the power island delay values from zero instead of reading the
> registers first. POST_DLY, POST1_DLY and POST2_DLY together span every
> writable bit of PWR_ISLAND_EN_POST_DLY, and STATUS_DLY spans every
> writable bit of PWR_ISLAND_STATUS_DLY, so the read-modify-write only
> fetched bits that are immediately overwritten.
> 
> The boot mode is now logged even when the boot fails; no other functional
> changes.
> 
> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
> ---
>   drivers/accel/ivpu/ivpu_hw_ip.c | 64 ++++++++++++++++-----------------
>   1 file changed, 31 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
> index bd6bb3fa49ff..36730f4338f0 100644
> --- a/drivers/accel/ivpu/ivpu_hw_ip.c
> +++ b/drivers/accel/ivpu/ivpu_hw_ip.c
> @@ -265,21 +265,35 @@ void ivpu_hw_ip_idle_gen_disable(struct ivpu_device *vdev)
>   }
>   
>   static void
> -pwr_island_delay_set_50xx(struct ivpu_device *vdev, u32 post, u32 post1, u32 post2, u32 status)
> +pwr_island_delay_write(struct ivpu_device *vdev, u32 post, u32 post1, u32 post2, u32 status)
>   {
>   	u32 val;
>   
> -	val = REGV_RD32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY);
> -	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST_DLY, post, val);
> +	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST_DLY, post, 0);
>   	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST1_DLY, post1, val);
>   	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, POST2_DLY, post2, val);
>   	REGV_WR32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_EN_POST_DLY, val);
>   
> -	val = REGV_RD32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY);
> -	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY, STATUS_DLY, status, val);
> +	val = REG_SET_FLD_NUM(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY, STATUS_DLY, status, 0);
>   	REGV_WR32(VPU_50XX_HOST_SS_AON_PWR_ISLAND_STATUS_DLY, val);
>   }
>   
> +static void pwr_island_delay_set_50xx(struct ivpu_device *vdev)
> +{
> +	if (vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH)
> +		pwr_island_delay_write(vdev, 18, 0, 0, 46);
> +	else
> +		pwr_island_delay_write(vdev, 0, 0, 0, 3);
> +}
> +
> +static void pwr_island_delay_set_60xx(struct ivpu_device *vdev)
> +{
> +	if (vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH)
> +		pwr_island_delay_write(vdev, 198, 0, 198, 0);
> +	else
> +		pwr_island_delay_write(vdev, 17, 0, 17, 0);
> +}
> +
>   static void pwr_island_trickle_drive_37xx(struct ivpu_device *vdev, bool enable)
>   {
>   	u32 val = REGV_RD32(VPU_37XX_HOST_SS_AON_PWR_ISLAND_TRICKLE_EN0);
> @@ -675,27 +689,19 @@ static void dpu_active_drive_37xx(struct ivpu_device *vdev, bool enable)
>   
>   static void pwr_island_delay_set(struct ivpu_device *vdev)
>   {
> -	bool high = vdev->hw->pll.profiling_freq == PLL_PROFILING_FREQ_HIGH;
> -	u32 post, post1, post2, status;
> -
>   	switch (ivpu_hw_ip_gen(vdev)) {
>   	case IVPU_HW_IP_37XX:
>   	case IVPU_HW_IP_40XX:
>   		return;
> +
>   	case IVPU_HW_IP_50XX:
> -		post = high ? 18 : 0;
> -		post1 = 0;
> -		post2 = 0;
> -		status = high ? 46 : 3;
> -		break;
> +		pwr_island_delay_set_50xx(vdev);
> +		return;
> +
>   	case IVPU_HW_IP_60XX:
> -		post = high ? 198 : 17;
> -		post1 = 0;
> -		post2 = high ? 198 : 17;
> -		status = 0;
> +		pwr_island_delay_set_60xx(vdev);
> +		return;
>   	}
> -
> -	pwr_island_delay_set_50xx(vdev, post, post1, post2, status);
>   }
>   
>   int ivpu_hw_ip_pwr_domain_enable(struct ivpu_device *vdev)
> @@ -933,30 +939,22 @@ static int soc_cpu_boot_60xx(struct ivpu_device *vdev)
>   
>   int ivpu_hw_ip_soc_cpu_boot(struct ivpu_device *vdev)
>   {
> -	int ret;
> +	ivpu_dbg(vdev, PM, "Booting firmware, mode: %s\n",
> +		 ivpu_fw_is_warm_boot(vdev) ? "warm boot" : "cold boot");
>   
>   	switch (ivpu_hw_ip_gen(vdev)) {
>   	case IVPU_HW_IP_37XX:
> -		ret = soc_cpu_boot_37xx(vdev);
> -		break;
> +		return soc_cpu_boot_37xx(vdev);
>   
>   	case IVPU_HW_IP_40XX:
>   	case IVPU_HW_IP_50XX:
> -		ret = soc_cpu_boot_40xx(vdev);
> -		break;
> +		return soc_cpu_boot_40xx(vdev);
>   
>   	case IVPU_HW_IP_60XX:
> -		ret = soc_cpu_boot_60xx(vdev);
> -		break;
> +		return soc_cpu_boot_60xx(vdev);
>   	}
>   
> -	if (ret)
> -		return ret;
> -
> -	ivpu_dbg(vdev, PM, "Booting firmware, mode: %s\n",
> -		 ivpu_fw_is_warm_boot(vdev) ? "warm boot" : "cold boot");
> -
> -	return 0;
> +	return -EINVAL;
>   }
>   
>   static void wdt_disable_37xx(struct ivpu_device *vdev)
Reviewed-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks
  2026-10-01 11:03 ` [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks Dawid Osuchowski
  2026-10-01 13:57   ` Wachowski, Karol
@ 2026-10-02 15:19   ` Jeff Hugo
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff Hugo @ 2026-10-02 15:19 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel
  Cc: oded.gabbay, karol.wachowski, lizhi.hou, andrzej.kacprowski

On 10/1/2026 5:03 AM, Dawid Osuchowski wrote:
> From: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> 
> Remove the per-call switch in ivpu_hw_ip_gen()/ivpu_hw_btrs_gen() and
> instead initialize the HW IP generation and buttress version once during
> device init.
> 
> Fail probe with -EINVAL when the PCI device ID does not match any known
> generation, instead of warning and continuing with both fields left at 0,
> so callers never proceed with an unrecognized generation.
> 
> Drop hw->dma_bits and compute it locally to remove the early dependency
> on vdev->hw_ip_gen.
> 
> Make pwr_island_delay_set() use ivpu_hw_ip_gen() instead of the PCI
> device ID directly.
> 
> Move MODULE_DEVICE_TABLE() to the top of the file to colocate it with
> the HW IP and buttress detection logic.
> 
> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> Co-developed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>

Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types
  2026-10-01 11:04 ` [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types Dawid Osuchowski
  2026-10-01 13:58   ` Wachowski, Karol
  2026-10-01 14:33   ` Andrzej Kacprowski
@ 2026-10-02 15:20   ` Jeff Hugo
  2 siblings, 0 replies; 12+ messages in thread
From: Jeff Hugo @ 2026-10-02 15:20 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel
  Cc: oded.gabbay, karol.wachowski, lizhi.hou, andrzej.kacprowski

On 10/1/2026 5:04 AM, Dawid Osuchowski wrote:
> Change the hw_ip_gen and btrs_gen members of struct ivpu_device, and
> their accessors, from u32/int to enum vpu_hw_ip/enum vpu_hw_btrs, and
> drop the default: labels from the switch statements in ivpu_hw_ip.c
> that dispatch on them. Switching on the real enum types lets the
> compiler treat these switches as exhaustive at compile time, so a
> missing case for a new generation now warns instead of silently
> hitting default:.
> 
> This compile-time guarantee holds because ivpu_ip_gen_init() now fails
> probe on an unrecognized PCI device ID instead of leaving these fields
> at 0, so the switches never see an unhandled value.
> 
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>

Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers
  2026-10-01 11:04 ` [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers Dawid Osuchowski
  2026-10-01 14:34   ` Andrzej Kacprowski
@ 2026-10-02 15:21   ` Jeff Hugo
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff Hugo @ 2026-10-02 15:21 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel
  Cc: oded.gabbay, karol.wachowski, lizhi.hou, andrzej.kacprowski

On 10/1/2026 5:04 AM, Dawid Osuchowski wrote:
> From: Karol Wachowski <karol.wachowski@linux.intel.com>
> 
> ivpu_hw_ip_soc_cpu_boot() and pwr_island_delay_set() keep the result of
> their per-generation switch in locals that are left uninitialized on the
> path past the last case. Building with -Wmaybe-uninitialized reports ret,
> post, post2 and status; Kbuild disables that warning for GCC, so it does
> not show up in a normal build.
> 
> Let every case return directly instead, so no local is needed.
> ivpu_hw_ip_soc_cpu_boot() now dispatches on its own, with the debug
> message moved ahead of the switch so that the boot mode is logged before
> the boot registers are written, and the power island delay values move
> into per-generation helpers. Neither switch has a default: label, so
> -Wswitch reports any enum vpu_hw_ip value added later that is not
> handled, and the path past the switch returns -EINVAL.
> 
> Build the power island delay values from zero instead of reading the
> registers first. POST_DLY, POST1_DLY and POST2_DLY together span every
> writable bit of PWR_ISLAND_EN_POST_DLY, and STATUS_DLY spans every
> writable bit of PWR_ISLAND_STATUS_DLY, so the read-modify-write only
> fetched bits that are immediately overwritten.
> 
> The boot mode is now logged even when the boot fails; no other functional
> changes.
> 
> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
> Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>

Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch
  2026-10-01 11:03 [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Dawid Osuchowski
                   ` (2 preceding siblings ...)
  2026-10-01 11:04 ` [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers Dawid Osuchowski
@ 2026-10-05  7:08 ` Wachowski, Karol
  3 siblings, 0 replies; 12+ messages in thread
From: Wachowski, Karol @ 2026-10-05  7:08 UTC (permalink / raw)
  To: Dawid Osuchowski, dri-devel
  Cc: oded.gabbay, jeff.hugo, karol.wachowski, lizhi.hou,
	andrzej.kacprowski

On 01-Oct-26 13:03, Dawid Osuchowski wrote:
> This series reworks how the driver determines the HW IP generation and
> buttress version, and how it dispatches on them.
> 
> Today ivpu_hw_ip_gen() and ivpu_hw_btrs_gen() run a switch over the PCI
> device ID on every call, and an unknown ID only triggers a WARN() while
> probe continues with an undefined generation. Patch 1 resolves both
> values once during device init and fails probe with -EINVAL on an
> unrecognized device ID.
> 
> With that guarantee in place, patch 2 changes the stored values and their
> accessors to the real enum types and drops the default: labels from the
> switches that dispatch on them, so -Wswitch flags a generation that is
> added later but not handled.
> 
> Patch 3 splits the remaining per-generation dispatch in
> ivpu_hw_ip_soc_cpu_boot() and pwr_island_delay_set() into helpers that
> return directly from each case, removing the locals that were left
> uninitialized on the path past the last case.
> 
> No functional change is intended beyond failing probe on an unknown PCI
> device ID and logging the SOC CPU boot mode even when the boot fails.
> 
> Andrzej Kacprowski (1):
>    accel/ivpu: Improve HW IP gen and buttress version checks
> 
> Dawid Osuchowski (1):
>    accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types
> 
> Karol Wachowski (1):
>    accel/ivpu: Split HW IP generation dispatch into helpers
> 
>   drivers/accel/ivpu/ivpu_drv.c   | 69 +++++++++++++++++++-------
>   drivers/accel/ivpu/ivpu_drv.h   | 65 +++++++++----------------
>   drivers/accel/ivpu/ivpu_hw.h    |  1 -
>   drivers/accel/ivpu/ivpu_hw_ip.c | 86 ++++++++++++++++-----------------
>   4 files changed, 117 insertions(+), 104 deletions(-)
> 

Applied to drm-misc-next.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-10-05  7:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01 11:03 [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Dawid Osuchowski
2026-10-01 11:03 ` [PATCH 1/3] accel/ivpu: Improve HW IP gen and buttress version checks Dawid Osuchowski
2026-10-01 13:57   ` Wachowski, Karol
2026-10-02 15:19   ` Jeff Hugo
2026-10-01 11:04 ` [PATCH 2/3] accel/ivpu: Convert hw_ip_gen/btrs_gen to enum types Dawid Osuchowski
2026-10-01 13:58   ` Wachowski, Karol
2026-10-01 14:33   ` Andrzej Kacprowski
2026-10-02 15:20   ` Jeff Hugo
2026-10-01 11:04 ` [PATCH 3/3] accel/ivpu: Split HW IP generation dispatch into helpers Dawid Osuchowski
2026-10-01 14:34   ` Andrzej Kacprowski
2026-10-02 15:21   ` Jeff Hugo
2026-10-05  7:08 ` [PATCH 0/3] accel/ivpu: Rework HW IP generation detection and dispatch Wachowski, Karol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox