Skip to contentSkip to conversation

i915/gvt: Introduce the mmio table to support VFIO new mdev API

PATCH In review Zhi Wang 5 participants 18 messages Feb 8, 2022 – Mar 15, 2022

Subsystems (3)
lore
Share & tools
lore

Zhi Wang

author reviewer
#0 lore raw

PATCH v6 1/3 i915/gvt: Introduce the mmio table to support VFIO new mdev API

From: Zhi Wang <[email protected]>

To support the new mdev interfaces and the re-factor patches from Christoph, which moves the GVT-g code into a dedicated module, the GVT-g initialization path has to be separated into two phases:

a) Early initialization.

The early initialization of GVT requires to be done when loading i915. Mostly it's because the initial clean HW state needs to be saved before i915 touches the HW.

b) Late initalization.

This phases of initalization will setup the rest components of GVT-g, which can be done later when the dedicated module is being loaded.

v6:

- Move the mmio_table.c into i915. (Christoph)
- Keep init_device_info and related structures in GVT-g. (Christoph)
- Refine the callbacks of the iterator. (Christoph)
- Move the flags of MMIO register defination to GVT-g. (Chrsitoph)
- Move the mmio block handling to GVT-g.

v5:

- Re-design the mmio table framework. (Christoph)

v4:

- Fix the errors of patch checking scripts.

v3:

- Fix the errors when CONFIG_DRM_I915_WERROR is turned on. (Jani)

v2:

- Implement a mmio table instead of generating it by marco in i915. (Jani)

Cc Christoph Hellwig <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Vivi Rodrigo <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi Wang <[email protected]>
---
 drivers/gpu/drm/i915/Makefile               |    2 +-
 drivers/gpu/drm/i915/gvt/cmd_parser.c       |    2 +-
 drivers/gpu/drm/i915/gvt/gvt.h              |    3 +-
 drivers/gpu/drm/i915/gvt/handlers.c         | 1062 ++-------------
 drivers/gpu/drm/i915/gvt/mmio.h             |   17 -
 drivers/gpu/drm/i915/gvt/reg.h              |    9 +-
 drivers/gpu/drm/i915/intel_gvt.c            |   20 +-
 drivers/gpu/drm/i915/intel_gvt.h            |   37 +
 drivers/gpu/drm/i915/intel_gvt_mmio_table.c | 1308 +++++++++++++++++++
 9 files changed, 1501 insertions(+), 959 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_gvt_mmio_table.c
drivers/gpu/drm/i915/Makefile +1 -1
index a26e6736bebb..fc882e299d65 100644
@@ -318,7 +318,7 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 i915-y += i915_vgpu.o
 
 ifeq ($(CONFIG_DRM_I915_GVT),y)
-i915-y += intel_gvt.o
+i915-y += intel_gvt.o intel_gvt_mmio_table.o
 include $(src)/gvt/Makefile
 endif
 
drivers/gpu/drm/i915/gvt/cmd_parser.c +1 -1
index ec18122cc216..e9b5c70bb004 100644
@@ -3205,7 +3205,7 @@ int intel_gvt_scan_engine_context(struct intel_vgpu_workload *workload)
 
 static int init_cmd_table(struct intel_gvt *gvt)
 {
-	unsigned int gen_type = intel_gvt_get_device_type(gvt);
+	unsigned int gen_type = intel_gvt_get_device_type(gvt->gt->i915);
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(cmd_info); i++) {
drivers/gpu/drm/i915/gvt/gvt.h +2 -1
index 0ebffc327528..bfe07c69cfd2 100644
@@ -36,6 +36,7 @@
 #include <uapi/linux/pci_regs.h>
 
 #include "i915_drv.h"
+#include "intel_gvt.h"
 
 #include "debug.h"
 #include "hypercall.h"
@@ -272,7 +273,7 @@ struct intel_gvt_mmio {
 /* Value of command write of this reg needs to be patched */
 #define F_CMD_WRITE_PATCH	(1 << 8)
 
-	const struct gvt_mmio_block *mmio_block;
+	struct gvt_mmio_block *mmio_block;
 	unsigned int num_mmio_block;
 
 	DECLARE_HASHTABLE(mmio_info_table, INTEL_GVT_MMIO_HASH_BITS);
drivers/gpu/drm/i915/gvt/handlers.c +143 -919

1,412 lines not on this page · raw message

drivers/gpu/drm/i915/gvt/mmio.h +0 -17
index 7c26af39fbfc..5dc0e1d24515 100644
@@ -41,21 +41,6 @@
 struct intel_gvt;
 struct intel_vgpu;
 
-#define D_BDW   (1 << 0)
-#define D_SKL	(1 << 1)
-#define D_KBL	(1 << 2)
-#define D_BXT	(1 << 3)
-#define D_CFL	(1 << 4)
-
-#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
-#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
-
-#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
-#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
-
-#define D_PRE_SKL	(D_BDW)
-#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
-
 typedef int (*gvt_mmio_func)(struct intel_vgpu *, unsigned int, void *,
 			     unsigned int);
 
@@ -71,8 +56,6 @@ struct intel_gvt_mmio_info {
 
 const struct intel_engine_cs *
 intel_gvt_render_mmio_to_engine(struct intel_gvt *gvt, unsigned int reg);
-unsigned long intel_gvt_get_device_type(struct intel_gvt *gvt);
-bool intel_gvt_match_device(struct intel_gvt *gvt, unsigned long device);
 
 int intel_gvt_setup_mmio_info(struct intel_gvt *gvt);
 void intel_gvt_clean_mmio_info(struct intel_gvt *gvt);
drivers/gpu/drm/i915/gvt/reg.h +8 -1
index 7d666d34f9ff..d8216c63c39a 100644
@@ -132,6 +132,13 @@
 #define RING_GFX_MODE(base)	_MMIO((base) + 0x29c)
 #define VF_GUARDBAND		_MMIO(0x83a4)
 
-
 #define BCS_TILE_REGISTER_VAL_OFFSET (0x43*4)
+
+/* XXX FIXME i915 has changed PP_XXX definition */
+#define PCH_PP_STATUS  _MMIO(0xc7200)
+#define PCH_PP_CONTROL _MMIO(0xc7204)
+#define PCH_PP_ON_DELAYS _MMIO(0xc7208)
+#define PCH_PP_OFF_DELAYS _MMIO(0xc720c)
+#define PCH_PP_DIVISOR _MMIO(0xc7210)
+
 #endif
drivers/gpu/drm/i915/intel_gvt.c +1 -19
index cf6e98962d82..32aa6f111d6b 100644
@@ -41,24 +41,6 @@
  * doc is available on https://01.org/group/2230/documentation-list.
  */
 
-static bool is_supported_device(struct drm_i915_private *dev_priv)
-{
-	if (IS_BROADWELL(dev_priv))
-		return true;
-	if (IS_SKYLAKE(dev_priv))
-		return true;
-	if (IS_KABYLAKE(dev_priv))
-		return true;
-	if (IS_BROXTON(dev_priv))
-		return true;
-	if (IS_COFFEELAKE(dev_priv))
-		return true;
-	if (IS_COMETLAKE(dev_priv))
-		return true;
-
-	return false;
-}
-
 /**
  * intel_gvt_sanitize_options - sanitize GVT related options
  * @dev_priv: drm i915 private data
@@ -75,7 +57,7 @@ void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv)
 		goto bail;
 	}
 
-	if (!is_supported_device(dev_priv)) {
+	if (!intel_gvt_get_device_type(dev_priv)) {
 		drm_info(&dev_priv->drm,
 			 "Unsupported device. GVT-g is disabled\n");
 		goto bail;
drivers/gpu/drm/i915/intel_gvt.h +37 -0
index d7d3fb6186fd..6d3031f3ac25 100644
@@ -26,7 +26,32 @@
 
 struct drm_i915_private;
 
+#include <linux/kernel.h>
+
 #ifdef CONFIG_DRM_I915_GVT
+
+#define D_BDW   (1 << 0)
+#define D_SKL	(1 << 1)
+#define D_KBL	(1 << 2)
+#define D_BXT	(1 << 3)
+#define D_CFL	(1 << 4)
+
+#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_PRE_SKL	(D_BDW)
+#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+struct intel_gvt_mmio_table_iter {
+	struct drm_i915_private *i915;
+	void *data;
+	int (*handle_mmio_cb)(struct intel_gvt_mmio_table_iter *iter,
+			      u32 offset, u32 device, u32 size);
+};
+
 int intel_gvt_init(struct drm_i915_private *dev_priv);
 void intel_gvt_driver_remove(struct drm_i915_private *dev_priv);
 int intel_gvt_init_device(struct drm_i915_private *dev_priv);
@@ -34,6 +59,8 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv);
 int intel_gvt_init_host(void);
 void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv);
 void intel_gvt_resume(struct drm_i915_private *dev_priv);
+unsigned long intel_gvt_get_device_type(struct drm_i915_private *i915);
+int intel_gvt_iterate_mmio_table(struct intel_gvt_mmio_table_iter *iter);
 #else
 static inline int intel_gvt_init(struct drm_i915_private *dev_priv)
 {
@@ -51,6 +78,16 @@ static inline void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv)
 static inline void intel_gvt_resume(struct drm_i915_private *dev_priv)
 {
 }
+
+unsigned long intel_gvt_get_device_type(struct drm_i915_private *i915)
+{
+	return 0;
+}
+
+int intel_gvt_iterate_mmio_table(struct intel_gvt_mmio_table_iter *iter)
+{
+	return 0;
+}
 #endif
 
 #endif /* _INTEL_GVT_H_ */
drivers/gpu/drm/i915/intel_gvt_mmio_table.c new file +1308 -0

1,308 lines not on this page · raw message

Signature · 1 line
2.25.1
author reviewer
#1 lore raw

PATCH v6 2/3 i915/gvt: Save the initial HW state snapshot in i915

Save the initial HW state snapshot in i915 so that the rest code of GVT-g can be moved into a dedicated module while it can still get a clean initial HW state saved at the correct time during the initialization of i915. The futhrer vGPU created by GVT-g will use this HW state as the initial HW state.

v6:

- Remove the reference of intel_gvt_device_info.(Christoph)
- Refine the save_mmio() function. (Christoph)

Cc Christoph Hellwig <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Vivi Rodrigo <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi Wang <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h  |  2 +
 drivers/gpu/drm/i915/intel_gvt.c | 92 +++++++++++++++++++++++++++++++-
 2 files changed, 92 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 44c1f98144b4..2a230840cdfa 100644
@@ -606,6 +606,8 @@ struct i915_virtual_gpu {
 	struct mutex lock; /* serialises sending of g2v_notify command pkts */
 	bool active;
 	u32 caps;
+	u32 *initial_mmio;
+	u8 *initial_cfg_space;
 };
 
 struct i915_selftest_stash {
drivers/gpu/drm/i915/intel_gvt.c +90 -2

117 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v6 2/3] i915/gvt: Save the initial HW state snapshot in i915

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 91

Quoted 7 lines · Zhi Wang
drivers/gpu/drm/i915/intel_gvt.c +7 -0
+	struct drm_i915_private *dev_priv = iter->i915;
+	u32 *mmio, i;
+
+	for (i = offset; i < offset + size; i += 4) {
+		mmio = iter->data + i;
+		*mmio = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
+						  _MMIO(i));

This reads much stranger than:

	u32 *mmio = iter->data;

	for (i = offset; i < offset + size; i += 4) {
		mmio[i] = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
						    _MMIO(i));
	}

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 99

Quoted 5 lines
drivers/gpu/drm/i915/intel_gvt.c +5 -0
+static int handle_mmio(struct intel_gvt_mmio_table_iter *iter,
+		       u32 offset, u32 device, u32 size)
+{
+	if (WARN_ON(!IS_ALIGNED(offset, 4)))
+		return -EINVAL;

Shouldn't this be in the caller of the method?

Review

Quoted 2 lines
(quoted diff) +2 -0
+	save_mmio(iter, offset, size);
+	return 0;

Now that the block callback is gone save_mmio and handle_mmio can be merged.

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 122

Quoted 1 line
drivers/gpu/drm/i915/intel_gvt.c +1 -0
+	mem = vzalloc(2 * SZ_1M);

Don't we want a driver-wide constant for this instead of a magic number?

#3 lore raw

Re: [PATCH v6 2/3] i915/gvt: Save the initial HW state snapshot in i915

Quoted 11 lines · Christoph Hellwig

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 91

Quoted 7 lines · Zhi Wang
drivers/gpu/drm/i915/intel_gvt.c +7 -0
+	struct drm_i915_private *dev_priv = iter->i915;
+	u32 *mmio, i;
+
+	for (i = offset; i < offset + size; i += 4) {
+		mmio = iter->data + i;
+		*mmio = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
+						  _MMIO(i));

This reads much stranger than:

Quoted 7 lines
	u32 *mmio = iter->data;

	for (i = offset; i < offset + size; i += 4) {
		mmio[i] = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
						    _MMIO(i));
	}

I am not sure the suggestion is correct. That's the reason why I didn't take the comments in the previous review.

if mmio is u32 *, the step of mmio[0] -> mmio[1] will be 4, and i will be increased by 4 in each loop. I guess the correct one would be mmio[i/4] = xxxxx; would that looks better? if yes, I will do that in the next version.

Quoted 11 lines

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 99

Quoted 5 lines
drivers/gpu/drm/i915/intel_gvt.c +5 -0
+static int handle_mmio(struct intel_gvt_mmio_table_iter *iter,
+		       u32 offset, u32 device, u32 size)
+{
+	if (WARN_ON(!IS_ALIGNED(offset, 4)))
+		return -EINVAL;

Shouldn't this be in the caller of the method?

Review

Quoted 2 lines
(quoted diff) +2 -0
+	save_mmio(iter, offset, size);
+	return 0;

Yes. You are right. It's because I get rid of the mmio_block in intel_gvt.c

Quoted 7 lines

Now that the block callback is gone save_mmio and handle_mmio can be merged.

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 122

Quoted 1 line
drivers/gpu/drm/i915/intel_gvt.c +1 -0
+	mem = vzalloc(2 * SZ_1M);

Don't we want a driver-wide constant for this instead of a magic number?

We actually have one in i915, but it's not exported. Should we export that one?

Thanks,
Zhi.

author reviewer
#4 lore raw

PATCH v6 3/3 i915/gvt: Use the initial HW state snapshot saved in i915

In reply to Zhi Wang

The code of saving initial HW state snapshot has been moved into i915. Let the GVT-g core logic use that snapshot.

Cc Christoph Hellwig <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Vivi Rodrigo <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi Wang <[email protected]>
---
 drivers/gpu/drm/i915/gvt/firmware.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/gvt/firmware.c +9 -16
index 1a8274a3f4b1..54fe442238c6 100644
@@ -66,22 +66,16 @@ static struct bin_attribute firmware_attr = {
 	.mmap = NULL,
 };
 
-static int mmio_snapshot_handler(struct intel_gvt *gvt, u32 offset, void *data)
-{
-	*(u32 *)(data + offset) = intel_uncore_read_notrace(gvt->gt->uncore,
-							    _MMIO(offset));
-	return 0;
-}
-
 static int expose_firmware_sysfs(struct intel_gvt *gvt)
 {
 	struct intel_gvt_device_info *info = &gvt->device_info;
-	struct pci_dev *pdev = to_pci_dev(gvt->gt->i915->drm.dev);
+	struct drm_i915_private *i915 = gvt->gt->i915;
+	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 	struct gvt_firmware_header *h;
 	void *firmware;
 	void *p;
 	unsigned long size, crc32_start;
-	int i, ret;
+	int ret;
 
 	size = sizeof(*h) + info->mmio_size + info->cfg_space_size;
 	firmware = vzalloc(size);
@@ -99,17 +93,16 @@ static int expose_firmware_sysfs(struct intel_gvt *gvt)
 
 	p = firmware + h->cfg_space_offset;
 
-	for (i = 0; i < h->cfg_space_size; i += 4)
-		pci_read_config_dword(pdev, i, p + i);
-
-	memcpy(gvt->firmware.cfg_space, p, info->cfg_space_size);
+	memcpy(gvt->firmware.cfg_space, i915->vgpu.initial_cfg_space,
+	       info->cfg_space_size);
+	memcpy(p, gvt->firmware.cfg_space, info->cfg_space_size);
 
 	p = firmware + h->mmio_offset;
 
-	/* Take a snapshot of hw mmio registers. */
-	intel_gvt_for_each_tracked_mmio(gvt, mmio_snapshot_handler, p);
+	memcpy(gvt->firmware.mmio, i915->vgpu.initial_mmio,
+	       info->mmio_size);
 
-	memcpy(gvt->firmware.mmio, p, info->mmio_size);
+	memcpy(p, gvt->firmware.mmio, info->mmio_size);
 
 	crc32_start = offsetof(struct gvt_firmware_header, crc32) + 4;
 	h->crc32 = crc32_le(0, firmware + crc32_start, size - crc32_start);
Signature · 1 line
2.25.1
Reviewed-by on v6 3/3
#5 lore raw

Re: [PATCH v6 3/3] i915/gvt: Use the initial HW state snapshot saved in i915

Quoted 2 lines · Zhi Wang

The code of saving initial HW state snapshot has been moved into i915. Let the GVT-g core logic use that snapshot.

Looks good:

#6 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [v6,1/3] i915/gvt: Introduce the mmio table to support VFIO new mdev API

In reply to Zhi Wang
== Series Details ==

== Series Details ==

Series: series starting with [v6,1/3] i915/gvt: Introduce the mmio table to support VFIO new mdev API
URL : https://patchwork.freedesktop.org/series/99838/
State : failure

== Summary ==

CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/intel_gvt_mmio_table.o
drivers/gpu/drm/i915/intel_gvt_mmio_table.c: In function ‘iterate_generic_mmio’:
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:65:16: error: ‘RENDER_RING_BASE’ undeclared (first use in this function); did you mean ‘IDR_INIT_BASE’?

  MMIO_F(prefix(RENDER_RING_BASE), s, d); \
                ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~
./drivers/gpu/drm/i915/gt/intel_engine_regs.h:73:27: note: in expansion of macro ‘_MMIO’
 #define RING_IMR(base)    _MMIO((base) + 0xa8)
                           ^~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:65:9: note: in expansion of macro ‘RING_IMR’
  MMIO_F(prefix(RENDER_RING_BASE), s, d); \
         ^~~~~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:74:2: note: in expansion of macro ‘MMIO_RING_F’
MMIO_RING_F(prefix, 4, d)
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:81:2: note: in expansion of macro ‘MMIO_RING_D’
MMIO_RING_D(RING_IMR, D_ALL);
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:65:16: note: each undeclared identifier is reported only once for each function it appears in

  MMIO_F(prefix(RENDER_RING_BASE), s, d); \
                ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~
./drivers/gpu/drm/i915/gt/intel_engine_regs.h:73:27: note: in expansion of macro ‘_MMIO’
 #define RING_IMR(base)    _MMIO((base) + 0xa8)
                           ^~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:65:9: note: in expansion of macro ‘RING_IMR’
  MMIO_F(prefix(RENDER_RING_BASE), s, d); \
         ^~~~~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:74:2: note: in expansion of macro ‘MMIO_RING_F’
MMIO_RING_F(prefix, 4, d)
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:81:2: note: in expansion of macro ‘MMIO_RING_D’
MMIO_RING_D(RING_IMR, D_ALL);
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:66:16: error: ‘BLT_RING_BASE’ undeclared (first use in this function); did you mean ‘CTX_RING_TAIL’?

  MMIO_F(prefix(BLT_RING_BASE), s, d); \
                ^~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~
./drivers/gpu/drm/i915/gt/intel_engine_regs.h:73:27: note: in expansion of macro ‘_MMIO’
 #define RING_IMR(base)    _MMIO((base) + 0xa8)
                           ^~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:66:9: note: in expansion of macro ‘RING_IMR’
  MMIO_F(prefix(BLT_RING_BASE), s, d); \
         ^~~~~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:74:2: note: in expansion of macro ‘MMIO_RING_F’
MMIO_RING_F(prefix, 4, d)
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:81:2: note: in expansion of macro ‘MMIO_RING_D’
MMIO_RING_D(RING_IMR, D_ALL);
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:67:16: error: ‘GEN6_BSD_RING_BASE’ undeclared (first use in this function); did you mean ‘GEN8_CSB_PTR_MASK’?

  MMIO_F(prefix(GEN6_BSD_RING_BASE), s, d); \
                ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~
./drivers/gpu/drm/i915/gt/intel_engine_regs.h:73:27: note: in expansion of macro ‘_MMIO’
 #define RING_IMR(base)    _MMIO((base) + 0xa8)
                           ^~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:67:9: note: in expansion of macro ‘RING_IMR’
  MMIO_F(prefix(GEN6_BSD_RING_BASE), s, d); \
         ^~~~~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:74:2: note: in expansion of macro ‘MMIO_RING_F’
MMIO_RING_F(prefix, 4, d)
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:81:2: note: in expansion of macro ‘MMIO_RING_D’
MMIO_RING_D(RING_IMR, D_ALL);
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:68:16: error: ‘VEBOX_RING_BASE’ undeclared (first use in this function); did you mean ‘CTX_RING_TAIL’?

  MMIO_F(prefix(VEBOX_RING_BASE), s, d); \
                ^~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~
./drivers/gpu/drm/i915/gt/intel_engine_regs.h:73:27: note: in expansion of macro ‘_MMIO’
 #define RING_IMR(base)    _MMIO((base) + 0xa8)
                           ^~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:68:9: note: in expansion of macro ‘RING_IMR’
  MMIO_F(prefix(VEBOX_RING_BASE), s, d); \
         ^~~~~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:74:2: note: in expansion of macro ‘MMIO_RING_F’
MMIO_RING_F(prefix, 4, d)
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:81:2: note: in expansion of macro ‘MMIO_RING_D’
MMIO_RING_D(RING_IMR, D_ALL);
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:70:17: error: ‘GEN8_BSD2_RING_BASE’ undeclared (first use in this function); did you mean ‘GEN8_CSB_PTR_MASK’?

   MMIO_F(prefix(GEN8_BSD2_RING_BASE), s, d); \
                 ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~
./drivers/gpu/drm/i915/gt/intel_engine_regs.h:73:27: note: in expansion of macro ‘_MMIO’
 #define RING_IMR(base)    _MMIO((base) + 0xa8)
                           ^~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:70:10: note: in expansion of macro ‘RING_IMR’
   MMIO_F(prefix(GEN8_BSD2_RING_BASE), s, d); \
          ^~~~~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:74:2: note: in expansion of macro ‘MMIO_RING_F’
MMIO_RING_F(prefix, 4, d)
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:81:2: note: in expansion of macro ‘MMIO_RING_D’
MMIO_RING_D(RING_IMR, D_ALL);
^~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:82:9: error: ‘SDEIMR’ undeclared (first use in this function); did you mean ‘IPEIR’?

  MMIO_D(SDEIMR, D_ALL);
         ^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:82:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(SDEIMR, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:83:9: error: ‘SDEIER’ undeclared (first use in this function); did you mean ‘IPEIR’?

  MMIO_D(SDEIER, D_ALL);
         ^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:83:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(SDEIER, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:84:9: error: ‘SDEIIR’ undeclared (first use in this function); did you mean ‘IPEIR’?

  MMIO_D(SDEIIR, D_ALL);
         ^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:84:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(SDEIIR, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:85:9: error: ‘SDEISR’ undeclared (first use in this function); did you mean ‘IPEIR’?

  MMIO_D(SDEISR, D_ALL);
         ^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:85:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(SDEISR, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:87:9: error: ‘GEN8_GAMW_ECO_DEV_RW_IA’ undeclared (first use in this function)

  MMIO_D(GEN8_GAMW_ECO_DEV_RW_IA, D_BDW_PLUS);
         ^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:87:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GEN8_GAMW_ECO_DEV_RW_IA, D_BDW_PLUS);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:88:9: error: ‘BSD_HWS_PGA_GEN7’ undeclared (first use in this function); did you mean ‘RING_HWS_PGA_GEN6’?

  MMIO_D(BSD_HWS_PGA_GEN7, D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:88:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(BSD_HWS_PGA_GEN7, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:89:9: error: ‘BLT_HWS_PGA_GEN7’ undeclared (first use in this function); did you mean ‘RING_HWS_PGA_GEN6’?

  MMIO_D(BLT_HWS_PGA_GEN7, D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:89:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(BLT_HWS_PGA_GEN7, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:90:9: error: ‘VEBOX_HWS_PGA_GEN7’ undeclared (first use in this function); did you mean ‘RING_HWS_PGA_GEN6’?

  MMIO_D(VEBOX_HWS_PGA_GEN7, D_ALL);
         ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:90:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(VEBOX_HWS_PGA_GEN7, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:103:9: error: ‘GEN7_SC_INSTDONE’ undeclared (first use in this function); did you mean ‘RING_INSTDONE’?

  MMIO_D(GEN7_SC_INSTDONE, D_BDW_PLUS);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:103:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GEN7_SC_INSTDONE, D_BDW_PLUS);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:107:9: error: ‘GEN7_CXT_SIZE’ undeclared (first use in this function); did you mean ‘GEN6_PD_SIZE’?

  MMIO_D(GEN7_CXT_SIZE, D_ALL);
         ^~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:107:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GEN7_CXT_SIZE, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:123:9: error: ‘GEN7_GT_MODE’ undeclared (first use in this function); did you mean ‘RING_MI_MODE’?

  MMIO_D(GEN7_GT_MODE, D_ALL);
         ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:123:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GEN7_GT_MODE, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:124:9: error: ‘CACHE_MODE_0_GEN7’ undeclared (first use in this function); did you mean ‘RING_MODE_GEN7’?

  MMIO_D(CACHE_MODE_0_GEN7, D_ALL);
         ^~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:124:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(CACHE_MODE_0_GEN7, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:125:9: error: ‘CACHE_MODE_1’ undeclared (first use in this function); did you mean ‘ACC_MODE’?

  MMIO_D(CACHE_MODE_1, D_ALL);
         ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:125:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(CACHE_MODE_1, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:126:9: error: ‘CACHE_MODE_0’ undeclared (first use in this function); did you mean ‘ACC_MODE’?

  MMIO_D(CACHE_MODE_0, D_ALL);
         ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:126:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(CACHE_MODE_0, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:129:9: error: ‘_3D_CHICKEN3’ undeclared (first use in this function)

  MMIO_D(_3D_CHICKEN3, D_ALL);
         ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:129:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(_3D_CHICKEN3, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:131:9: error: ‘FF_SLICE_CS_CHICKEN2’ undeclared (first use in this function)

  MMIO_D(FF_SLICE_CS_CHICKEN2, D_ALL);
         ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:131:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(FF_SLICE_CS_CHICKEN2, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:133:9: error: ‘GAM_ECOCHK’ undeclared (first use in this function); did you mean ‘SHM_LOCK’?

  MMIO_D(GAM_ECOCHK, D_ALL);
         ^~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:133:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GAM_ECOCHK, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:134:9: error: ‘GEN7_COMMON_SLICE_CHICKEN1’ undeclared (first use in this function)

  MMIO_D(GEN7_COMMON_SLICE_CHICKEN1, D_ALL);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:134:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GEN7_COMMON_SLICE_CHICKEN1, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:135:9: error: ‘COMMON_SLICE_CHICKEN2’ undeclared (first use in this function)

  MMIO_D(COMMON_SLICE_CHICKEN2, D_ALL);
         ^~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:135:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(COMMON_SLICE_CHICKEN2, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:144:9: error: ‘HALF_SLICE_CHICKEN3’ undeclared (first use in this function)

  MMIO_D(HALF_SLICE_CHICKEN3, D_ALL);
         ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:144:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(HALF_SLICE_CHICKEN3, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:145:9: error: ‘GEN7_HALF_SLICE_CHICKEN1’ undeclared (first use in this function)

  MMIO_D(GEN7_HALF_SLICE_CHICKEN1, D_ALL);
         ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:145:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(GEN7_HALF_SLICE_CHICKEN1, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:152:9: error: ‘DERRMR’ undeclared (first use in this function)

  MMIO_D(DERRMR, D_ALL);
         ^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:152:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(DERRMR, D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:153:9: error: implicit declaration of function ‘PIPEDSL’ [-Werror=implicit-function-declaration]

  MMIO_D(PIPEDSL(PIPE_A), D_ALL);
         ^~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:153:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPEDSL(PIPE_A), D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:153:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’

  MMIO_D(PIPEDSL(PIPE_A), D_ALL);
         ^~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:153:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPEDSL(PIPE_A), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:154:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPEDSL(PIPE_B), D_ALL);
         ^~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:154:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPEDSL(PIPE_B), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:155:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPEDSL(PIPE_C), D_ALL);
         ^~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:155:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPEDSL(PIPE_C), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:156:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPEDSL(_PIPE_EDP), D_ALL);
         ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:156:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPEDSL(_PIPE_EDP), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:157:9: error: implicit declaration of function ‘PIPECONF’; did you mean ‘PIPE_BUF’? [-Werror=implicit-function-declaration]
  MMIO_D(PIPECONF(PIPE_A), D_ALL);
         ^~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:157:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPECONF(PIPE_A), D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:157:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’

  MMIO_D(PIPECONF(PIPE_A), D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:157:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPECONF(PIPE_A), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:158:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPECONF(PIPE_B), D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:158:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPECONF(PIPE_B), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:159:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPECONF(PIPE_C), D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:159:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPECONF(PIPE_C), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:160:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPECONF(_PIPE_EDP), D_ALL);
         ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:160:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPECONF(_PIPE_EDP), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:161:9: error: implicit declaration of function ‘PIPESTAT’; did you mean ‘IPC_STAT’? [-Werror=implicit-function-declaration]
  MMIO_D(PIPESTAT(PIPE_A), D_ALL);
         ^~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:161:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPESTAT(PIPE_A), D_ALL);
^~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:161:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’

  MMIO_D(PIPESTAT(PIPE_A), D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:161:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPESTAT(PIPE_A), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/display/intel_display.h:30,

                 from drivers/gpu/drm/i915/display/intel_cdclk.h:11,
                 from drivers/gpu/drm/i915/i915_drv.h:67,
                 from drivers/gpu/drm/i915/intel_gvt_mmio_table.c:25:
./drivers/gpu/drm/i915/i915_reg_defs.h:82:60: note: expected ‘i915_reg_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
 static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
                                                 ~~~~~~~~~~~^~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:162:9: error: incompatible type for argument 1 of ‘i915_mmio_reg_offset’
  MMIO_D(PIPESTAT(PIPE_B), D_ALL);
         ^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_gvt_mmio_table.c:54:57: note: in definition of macro ‘MMIO_F’
   ret = iter->handle_mmio_cb(iter, i915_mmio_reg_offset(reg), \
                                                         ^~~

drivers/gpu/drm/i915/intel_gvt_mmio_table.c:162:2: note: in expansion of macro ‘MMIO_D’
MMIO_D(PIPESTAT(PIPE_B), D_ALL);
^~~~~~
In file included from drivers/gpu/drm/i915/di

maintainer
#7 lore raw
In reply to Zhi Wang
Quoted 8 lines · Zhi Wang

From: Zhi Wang <[email protected]>

To support the new mdev interfaces and the re-factor patches from Christoph, which moves the GVT-g code into a dedicated module, the GVT-g initialization path has to be separated into two phases:

a) Early initialization.

Quoted 8 lines

The early initialization of GVT requires to be done when loading i915. Mostly it's because the initial clean HW state needs to be saved before i915 touches the HW.

b) Late initalization.

This phases of initalization will setup the rest components of GVT-g, which can be done later when the dedicated module is being loaded.

What's the baseline for this series?

Quoted 53 lines

v6:

- Move the mmio_table.c into i915. (Christoph)
- Keep init_device_info and related structures in GVT-g. (Christoph)
- Refine the callbacks of the iterator. (Christoph)
- Move the flags of MMIO register defination to GVT-g. (Chrsitoph)
- Move the mmio block handling to GVT-g.

v5:

- Re-design the mmio table framework. (Christoph)

v4:

- Fix the errors of patch checking scripts.

v3:

- Fix the errors when CONFIG_DRM_I915_WERROR is turned on. (Jani)

v2:

- Implement a mmio table instead of generating it by marco in i915. (Jani)

Cc Christoph Hellwig <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Vivi Rodrigo <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi Wang <[email protected]>
---
 drivers/gpu/drm/i915/Makefile               |    2 +-
 drivers/gpu/drm/i915/gvt/cmd_parser.c       |    2 +-
 drivers/gpu/drm/i915/gvt/gvt.h              |    3 +-
 drivers/gpu/drm/i915/gvt/handlers.c         | 1062 ++-------------
 drivers/gpu/drm/i915/gvt/mmio.h             |   17 -
 drivers/gpu/drm/i915/gvt/reg.h              |    9 +-
 drivers/gpu/drm/i915/intel_gvt.c            |   20 +-
 drivers/gpu/drm/i915/intel_gvt.h            |   37 +
 drivers/gpu/drm/i915/intel_gvt_mmio_table.c | 1308 +++++++++++++++++++
 9 files changed, 1501 insertions(+), 959 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_gvt_mmio_table.c
drivers/gpu/drm/i915/intel_gvt.h +0 -0
index d7d3fb6186fd..6d3031f3ac25 100644

drivers/gpu/drm/i915/intel_gvt.h line 29

Quoted 4 lines
drivers/gpu/drm/i915/intel_gvt.h +1 -0
@@ -26,7 +26,32 @@
 
 struct drm_i915_private;
 
+#include <linux/kernel.h>

Please use minimal includes. Looks like linux/types.h is enough. Please also put the includes before the forward declarations.

Quoted 7 lines
drivers/gpu/drm/i915/intel_gvt.h +6 -0
+
 #ifdef CONFIG_DRM_I915_GVT
+
+#define D_BDW   (1 << 0)
+#define D_SKL	(1 << 1)
+#define D_KBL	(1 << 2)
+#define D_BXT	(1 << 3)

drivers/gpu/drm/i915/intel_gvt.h line 46

Quoted 10 lines
drivers/gpu/drm/i915/intel_gvt.h +10 -0
+#define D_CFL	(1 << 4)
+
+#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_PRE_SKL	(D_BDW)
+#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)

If these really need to be in a header in i915/, I think they need to be longer with some namespacing or something. I do wish these could be hidden though.

drivers/gpu/drm/i915/intel_gvt.h line 53

Quoted 7 lines
drivers/gpu/drm/i915/intel_gvt.h +7 -0
+
+struct intel_gvt_mmio_table_iter {
+	struct drm_i915_private *i915;
+	void *data;
+	int (*handle_mmio_cb)(struct intel_gvt_mmio_table_iter *iter,
+			      u32 offset, u32 device, u32 size);
+};

We're heavily transitioning towards having a corresponding .h for each .c instead of catch all headers. It's still a work in progress, but I'd prefer having the declarations for stuff in intel_gvt_mmio_table.c placed in intel_gvt_mmio_table.h, and named accordingly. Like I suggested in my previous mails.

Quoted 17 lines
drivers/gpu/drm/i915/intel_gvt.h +3 -0
+
 int intel_gvt_init(struct drm_i915_private *dev_priv);
 void intel_gvt_driver_remove(struct drm_i915_private *dev_priv);
 int intel_gvt_init_device(struct drm_i915_private *dev_priv);
@@ -34,6 +59,8 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv);
 int intel_gvt_init_host(void);
 void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv);
 void intel_gvt_resume(struct drm_i915_private *dev_priv);
+unsigned long intel_gvt_get_device_type(struct drm_i915_private *i915);
+int intel_gvt_iterate_mmio_table(struct intel_gvt_mmio_table_iter *iter);
 #else
 static inline int intel_gvt_init(struct drm_i915_private *dev_priv)
 {
@@ -51,6 +78,16 @@ static inline void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv)
 static inline void intel_gvt_resume(struct drm_i915_private *dev_priv)
 {
 }

drivers/gpu/drm/i915/intel_gvt.h static inline void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) · line 90

Quoted 10 lines
drivers/gpu/drm/i915/intel_gvt.h +10 -0
+
+unsigned long intel_gvt_get_device_type(struct drm_i915_private *i915)
+{
+	return 0;
+}
+
+int intel_gvt_iterate_mmio_table(struct intel_gvt_mmio_table_iter *iter)
+{
+	return 0;
+}

Stubs need to be static inlines.

Quoted 20 lines
drivers/gpu/drm/i915/intel_gvt.h +0 -0
 #endif
 
 #endif /* _INTEL_GVT_H_ */
drivers/gpu/drm/i915/intel_gvt_mmio_table.c new file +11 -0
new file mode 100644
index 000000000000..b9de72e939d3
@@ -0,0 +1,1308 @@
+/*
+ * Copyright(c) 2021 Intel Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next

drivers/gpu/drm/i915/intel_gvt_mmio_table.c line 21

Quoted 10 lines
drivers/gpu/drm/i915/intel_gvt_mmio_table.c new file +10 -0
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.

Please use SPDX headers for new files.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#8 lore raw
Quoted 12 lines · Jani Nikula
Quoted 12 lines

#ifdef CONFIG_DRM_I915_GVT

drivers/gpu/drm/i915/intel_gvt.h +11 -0
+
+#define D_BDW   (1 << 0)
+#define D_SKL	(1 << 1)
+#define D_KBL	(1 << 2)
+#define D_BXT	(1 << 3)
+#define D_CFL	(1 << 4)
+
+#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
Quoted 8 lines

drivers/gpu/drm/i915/intel_gvt.h line 46

Quoted 4 lines
drivers/gpu/drm/i915/intel_gvt.h +4 -0
+#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_PRE_SKL	(D_BDW)
+#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)

If these really need to be in a header in i915/, I think they need to be longer with some namespacing or something. I do wish these could be hidden though.

I think we could actually kill them off entirely. They are used as arguments to the macros that setup the mmio table.

Thefunctions to build these tabls are already organized by families, so we'd need relatively few conditions to just build them the right way. There also are some runtime checks in the callbacks, but they seem entirely superflous as far as I can tell.

Only the cmd parser is a bit messy. So maybe we could keep these constants just for the cmd parser inside of gvt for now (and clean that up later) and remove them entirely from the mmio table.

maintainer
#9 lore raw
Quoted 25 lines · Christoph Hellwig
Quoted 12 lines · Jani Nikula
Quoted 12 lines

#ifdef CONFIG_DRM_I915_GVT

drivers/gpu/drm/i915/intel_gvt.h +11 -0
+
+#define D_BDW   (1 << 0)
+#define D_SKL	(1 << 1)
+#define D_KBL	(1 << 2)
+#define D_BXT	(1 << 3)
+#define D_CFL	(1 << 4)
+
+#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
Quoted 8 lines

drivers/gpu/drm/i915/intel_gvt.h line 46

Quoted 4 lines
drivers/gpu/drm/i915/intel_gvt.h +4 -0
+#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_PRE_SKL	(D_BDW)
+#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)

If these really need to be in a header in i915/, I think they need to be longer with some namespacing or something. I do wish these could be hidden though.

I think we could actually kill them off entirely. They are used as arguments to the macros that setup the mmio table.

Quoted 8 lines

Thefunctions to build these tabls are already organized by families, so we'd need relatively few conditions to just build them the right way. There also are some runtime checks in the callbacks, but they seem entirely superflous as far as I can tell.

Only the cmd parser is a bit messy. So maybe we could keep these constants just for the cmd parser inside of gvt for now (and clean that up later) and remove them entirely from the mmio table.

I'm fine with cleaning this up in follow-up, provided the follow-up actually happens! ;)

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#10 lore raw
Quoted 31 lines · Jani Nikula
Quoted 30 lines · Christoph Hellwig
Quoted 12 lines · Jani Nikula
Quoted 12 lines

#ifdef CONFIG_DRM_I915_GVT

drivers/gpu/drm/i915/intel_gvt.h +11 -0
+
+#define D_BDW   (1 << 0)
+#define D_SKL	(1 << 1)
+#define D_KBL	(1 << 2)
+#define D_BXT	(1 << 3)
+#define D_CFL	(1 << 4)
+
+#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
Quoted 8 lines

drivers/gpu/drm/i915/intel_gvt.h line 46

Quoted 4 lines
drivers/gpu/drm/i915/intel_gvt.h +4 -0
+#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_PRE_SKL	(D_BDW)
+#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)

If these really need to be in a header in i915/, I think they need to be longer with some namespacing or something. I do wish these could be hidden though.

I think we could actually kill them off entirely. They are used as arguments to the macros that setup the mmio table.

Thefunctions to build these tabls are already organized by families, so we'd need relatively few conditions to just build them the right way. There also are some runtime checks in the callbacks, but they seem entirely superflous as far as I can tell.

Quoted 6 lines
Quoted 3 lines

Only the cmd parser is a bit messy. So maybe we could keep these constants just for the cmd parser inside of gvt for now (and clean that up later) and remove them entirely from the mmio table.

I'm fine with cleaning this up in follow-up, provided the follow-up actually happens! ;)

Thanks so much for the comments and the support. :)

Quoted 5 lines

BR,
Jani.

#11 lore raw
In reply to Christoph Hellwig
Quoted 25 lines · Christoph Hellwig
Quoted 12 lines · Jani Nikula
Quoted 12 lines

#ifdef CONFIG_DRM_I915_GVT

drivers/gpu/drm/i915/intel_gvt.h +11 -0
+
+#define D_BDW   (1 << 0)
+#define D_SKL	(1 << 1)
+#define D_KBL	(1 << 2)
+#define D_BXT	(1 << 3)
+#define D_CFL	(1 << 4)
+
+#define D_GEN9PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
+#define D_GEN8PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_SKL_PLUS	(D_SKL | D_KBL | D_BXT | D_CFL)
Quoted 8 lines

drivers/gpu/drm/i915/intel_gvt.h line 46

Quoted 4 lines
drivers/gpu/drm/i915/intel_gvt.h +4 -0
+#define D_BDW_PLUS	(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)
+
+#define D_PRE_SKL	(D_BDW)
+#define D_ALL		(D_BDW | D_SKL | D_KBL | D_BXT | D_CFL)

If these really need to be in a header in i915/, I think they need to be longer with some namespacing or something. I do wish these could be hidden though.

I think we could actually kill them off entirely. They are used as arguments to the macros that setup the mmio table.

Quoted 9 lines

Thefunctions to build these tabls are already organized by families, so we'd need relatively few conditions to just build them the right way. There also are some runtime checks in the callbacks, but they seem entirely superflous as far as I can tell.

Only the cmd parser is a bit messy. So maybe we could keep these constants just for the cmd parser inside of gvt for now (and clean that up later) and remove them entirely from the mmio table.

I agree that's the correct way for not exporting this to i915 by just organizing them in the functions, like what you said. But I guess it's also matter of time and schedule as well. If we go that direction, it might take longer time for coding as this is a big re-factor. Also, we need our QA to do another full test run. That needs to be considered. (If we are ok with that)

Besides, we have to have a methodology to make sure everything is the same as before.
Currently I am comparing the numbers of tracked mmio and the mmio snapshot. It would be nice to have more insight. :)

Thanks,
Zhi.

#12 lore raw

Just curious, what is the state of this seris? It would be good to have it ready early on for the next merge window as there is quite a backlog that depends on it.

maintainer
#13 lore raw
Quoted 3 lines · Christoph Hellwig

Just curious, what is the state of this seris? It would be good to have it ready early on for the next merge window as there is quite a backlog that depends on it.

Can't speak for the status of the series, but for drm the deadline for changes headed for the merge window is around -rc5/-rc6 timeframe i.e. this has already missed the upcoming merge window.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#14 lore raw
Quoted 8 lines · Jani Nikula
Quoted 3 lines · Christoph Hellwig

Just curious, what is the state of this seris? It would be good to have it ready early on for the next merge window as there is quite a backlog that depends on it.

Can't speak for the status of the series, but for drm the deadline for changes headed for the merge window is around -rc5/-rc6 timeframe i.e. this has already missed the upcoming merge window.

I know. I meant the next one, not the one ending now. And I don't want to miss another one.

#15 lore raw

I was actually testing it for almost two weeks, but still I met some hang and I was trying to figure where the problem is as this is quite a big change. Let's see if I can figure it out this week.

Thanks,
Zhi.

Quoted 13 lines · Christoph Hellwig
Quoted 8 lines · Jani Nikula
Quoted 3 lines · Christoph Hellwig

Just curious, what is the state of this seris? It would be good to have it ready early on for the next merge window as there is quite a backlog that depends on it.

Can't speak for the status of the series, but for drm the deadline for changes headed for the merge window is around -rc5/-rc6 timeframe i.e. this has already missed the upcoming merge window.

I know. I meant the next one, not the one ending now. And I don't want to miss another one.

maintainer
#16 lore raw
In reply to Christoph Hellwig
Quoted 2 lines · Christoph Hellwig

I know. I meant the next one, not the one ending now. And I don't want to miss another one.

Ok, good, thanks.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#17 lore raw
In reply to Zhi Wang

A cover letter with the changelog, the base and maybe a pointer to a git tree would be nice.

drivers/gpu/drm/i915/gvt/handlers.c void intel_gvt_clean_mmio_info(struct intel_gvt *gvt) · line 2876

Quoted 8 lines
drivers/gpu/drm/i915/gvt/handlers.c +8 -0
+static int handle_mmio_cb(struct intel_gvt_mmio_table_iter *iter, u32 offset,
+			  u32 device, u32 size)
+{
+	if (size < 1024 || offset == i915_mmio_reg_offset(GEN9_GFX_MOCS(0)))
+		return handle_mmio(iter, offset, device, size);
+	else
+		return handle_mmio_block(iter, offset, device, size);
+}

No need for an else statement after a return statement.

Quoted 1 line

+/* XXX FIXME i915 has changed PP_XXX definition */

Btw, can someone explain this comment? I has always puzzled me.