[Intel-xe] [RFC PATCH v2 3/3] drm/xe: Add platform specific functions for a new platform
Francois Dugast
francois.dugast at intel.com
Tue Mar 14 15:51:11 UTC 2023
This shows how platform specific code for a new platform can be
separated and maintained in its own file. With the use of function
pointers the modifications to the common code are minimal.
Signed-off-by: Francois Dugast <francois.dugast at intel.com>
---
drivers/gpu/drm/xe/Makefile | 1 +
drivers/gpu/drm/xe/xe_gt.c | 4 ++++
drivers/gpu/drm/xe/xe_guc_pc.c | 5 +++++
drivers/gpu/drm/xe/xe_newplatform.c | 21 +++++++++++++++++++++
drivers/gpu/drm/xe/xe_newplatform.h | 15 +++++++++++++++
drivers/gpu/drm/xe/xe_platform_types.h | 1 +
6 files changed, 47 insertions(+)
create mode 100644 drivers/gpu/drm/xe/xe_newplatform.c
create mode 100644 drivers/gpu/drm/xe/xe_newplatform.h
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index b94e65c91101..f5344f028c6e 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -67,6 +67,7 @@ xe-y += xe_bb.o \
xe_mmio.o \
xe_mocs.o \
xe_module.o \
+ xe_newplatform.o \
xe_pci.o \
xe_pcode.o \
xe_pm.o \
diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index 3b092f951378..92362900825c 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -30,6 +30,7 @@
#include "xe_migrate.h"
#include "xe_mmio.h"
#include "xe_mocs.h"
+#include "xe_newplatform.h"
#include "xe_reg_sr.h"
#include "xe_ring_ops.h"
#include "xe_sa.h"
@@ -390,6 +391,9 @@ int xe_gt_init_early(struct xe_gt *gt)
case XE_TIGERLAKE:
xe->gt_funcs->setup_private_ppat = tgl_setup_private_ppat;
break;
+ case XE_NEWPLATFORM:
+ xe->gt_funcs->setup_private_ppat = newplatform_setup_private_ppat;
+ break;
default:
DRM_ERROR("Unsupported platform\n");
break;
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 71d48148061c..be21524b334f 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -19,6 +19,7 @@
#include "xe_guc_ct.h"
#include "xe_map.h"
#include "xe_mmio.h"
+#include "xe_newplatform.h"
#include "xe_pcode.h"
#define MCHBAR_MIRROR_BASE_SNB 0x140000
@@ -913,6 +914,10 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
xe->guc_pc_funcs->init_fused_rp_values = tgl_init_fused_rp_values;
xe->guc_pc_funcs->update_rpe_value = tgl_update_rpe_value;
break;
+ case XE_NEWPLATFORM:
+ xe->guc_pc_funcs->init_fused_rp_values = newplatform_init_fused_rp_values;
+ xe->guc_pc_funcs->update_rpe_value = newplatform_update_rpe_value;
+ break;
default:
DRM_ERROR("Unsupported platform\n");
break;
diff --git a/drivers/gpu/drm/xe/xe_newplatform.c b/drivers/gpu/drm/xe/xe_newplatform.c
new file mode 100644
index 000000000000..d69901addcbb
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_newplatform.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include "xe_newplatform.h"
+
+void newplatform_setup_private_ppat(struct xe_gt *gt)
+{
+ /* platform specific implementation */
+}
+
+void newplatform_init_fused_rp_values(struct xe_guc_pc *pc)
+{
+ /* platform specific implementation */
+}
+
+void newplatform_update_rpe_value(struct xe_guc_pc *pc)
+{
+ /* platform specific implementation */
+}
diff --git a/drivers/gpu/drm/xe/xe_newplatform.h b/drivers/gpu/drm/xe/xe_newplatform.h
new file mode 100644
index 000000000000..7c7a7f53c930
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_newplatform.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_NEW_PLATFORM_H_
+#define _XE_NEW_PLATFORM_H_
+
+#include "xe_gt.h"
+
+void newplatform_setup_private_ppat(struct xe_gt *gt);
+void newplatform_init_fused_rp_values(struct xe_guc_pc *pc);
+void newplatform_update_rpe_value(struct xe_guc_pc *pc);
+
+#endif
diff --git a/drivers/gpu/drm/xe/xe_platform_types.h b/drivers/gpu/drm/xe/xe_platform_types.h
index 9239c1329941..1866055fcb52 100644
--- a/drivers/gpu/drm/xe/xe_platform_types.h
+++ b/drivers/gpu/drm/xe/xe_platform_types.h
@@ -18,6 +18,7 @@ enum xe_platform {
XE_ALDERLAKE_S,
XE_ALDERLAKE_P,
XE_METEORLAKE,
+ XE_NEWPLATFORM,
};
enum xe_subplatform {
--
2.25.1
More information about the Intel-xe
mailing list