Commit f9e932a8 authored by Radhakrishna Sripada's avatar Radhakrishna Sripada

drm/i915: Move display and media IP version to runtime info

Future platforms can read the IP version from a register and the
IP version numbers need not be hard coded in device info. Move the
ip version for media and display to runtime info.

On platforms where hard coding of IP version is required, update
the IP version in __runtime under device_info.

v2:
 - Avoid name collision for ip versions(Jani)
v4.1:
 - Fix build error in mock_gem_device.c
v4.2:
 - Use ip instead of version for ip_vesion member.(MattR)
Suggested-by: default avatarJani Nikula <jani.nikula@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarRadhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220902221054.173524-1-radhakrishna.sripada@intel.com
parent 6f3562b3
...@@ -466,19 +466,19 @@ static inline struct intel_gt *to_gt(struct drm_i915_private *i915) ...@@ -466,19 +466,19 @@ static inline struct intel_gt *to_gt(struct drm_i915_private *i915)
#define IP_VER(ver, rel) ((ver) << 8 | (rel)) #define IP_VER(ver, rel) ((ver) << 8 | (rel))
#define GRAPHICS_VER(i915) (RUNTIME_INFO(i915)->graphics.ver) #define GRAPHICS_VER(i915) (RUNTIME_INFO(i915)->graphics.ip.ver)
#define GRAPHICS_VER_FULL(i915) IP_VER(RUNTIME_INFO(i915)->graphics.ver, \ #define GRAPHICS_VER_FULL(i915) IP_VER(RUNTIME_INFO(i915)->graphics.ip.ver, \
RUNTIME_INFO(i915)->graphics.rel) RUNTIME_INFO(i915)->graphics.ip.rel)
#define IS_GRAPHICS_VER(i915, from, until) \ #define IS_GRAPHICS_VER(i915, from, until) \
(GRAPHICS_VER(i915) >= (from) && GRAPHICS_VER(i915) <= (until)) (GRAPHICS_VER(i915) >= (from) && GRAPHICS_VER(i915) <= (until))
#define MEDIA_VER(i915) (INTEL_INFO(i915)->media.ver) #define MEDIA_VER(i915) (RUNTIME_INFO(i915)->media.ip.ver)
#define MEDIA_VER_FULL(i915) IP_VER(INTEL_INFO(i915)->media.ver, \ #define MEDIA_VER_FULL(i915) IP_VER(RUNTIME_INFO(i915)->media.ip.ver, \
INTEL_INFO(i915)->media.rel) RUNTIME_INFO(i915)->media.ip.rel)
#define IS_MEDIA_VER(i915, from, until) \ #define IS_MEDIA_VER(i915, from, until) \
(MEDIA_VER(i915) >= (from) && MEDIA_VER(i915) <= (until)) (MEDIA_VER(i915) >= (from) && MEDIA_VER(i915) <= (until))
#define DISPLAY_VER(i915) (INTEL_INFO(i915)->display.ver) #define DISPLAY_VER(i915) (RUNTIME_INFO(i915)->display.ip.ver)
#define IS_DISPLAY_VER(i915, from, until) \ #define IS_DISPLAY_VER(i915, from, until) \
(DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until)) (DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until))
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
#define PLATFORM(x) .platform = (x) #define PLATFORM(x) .platform = (x)
#define GEN(x) \ #define GEN(x) \
.__runtime.graphics.ver = (x), \ .__runtime.graphics.ip.ver = (x), \
.media.ver = (x), \ .__runtime.media.ip.ver = (x), \
.display.ver = (x) .__runtime.display.ip.ver = (x)
#define I845_PIPE_OFFSETS \ #define I845_PIPE_OFFSETS \
.display.pipe_offsets = { \ .display.pipe_offsets = { \
...@@ -740,7 +740,7 @@ static const struct intel_device_info bxt_info = { ...@@ -740,7 +740,7 @@ static const struct intel_device_info bxt_info = {
static const struct intel_device_info glk_info = { static const struct intel_device_info glk_info = {
GEN9_LP_FEATURES, GEN9_LP_FEATURES,
PLATFORM(INTEL_GEMINILAKE), PLATFORM(INTEL_GEMINILAKE),
.display.ver = 10, .__runtime.display.ip.ver = 10,
.display.dbuf.size = 1024 - 4, /* 4 blocks for bypass path allocation */ .display.dbuf.size = 1024 - 4, /* 4 blocks for bypass path allocation */
GLK_COLORS, GLK_COLORS,
}; };
...@@ -919,7 +919,7 @@ static const struct intel_device_info rkl_info = { ...@@ -919,7 +919,7 @@ static const struct intel_device_info rkl_info = {
static const struct intel_device_info dg1_info = { static const struct intel_device_info dg1_info = {
GEN12_FEATURES, GEN12_FEATURES,
DGFX_FEATURES, DGFX_FEATURES,
.__runtime.graphics.rel = 10, .__runtime.graphics.ip.rel = 10,
PLATFORM(INTEL_DG1), PLATFORM(INTEL_DG1),
.__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D),
.require_force_probe = 1, .require_force_probe = 1,
...@@ -962,7 +962,7 @@ static const struct intel_device_info adl_s_info = { ...@@ -962,7 +962,7 @@ static const struct intel_device_info adl_s_info = {
.display.has_hotplug = 1, \ .display.has_hotplug = 1, \
.display.has_ipc = 1, \ .display.has_ipc = 1, \
.display.has_psr = 1, \ .display.has_psr = 1, \
.display.ver = 13, \ .__runtime.display.ip.ver = 13, \
.__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), \ .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), \
.display.pipe_offsets = { \ .display.pipe_offsets = { \
[TRANSCODER_A] = PIPE_A_OFFSET, \ [TRANSCODER_A] = PIPE_A_OFFSET, \
...@@ -1006,8 +1006,8 @@ static const struct intel_device_info adl_p_info = { ...@@ -1006,8 +1006,8 @@ static const struct intel_device_info adl_p_info = {
I915_GTT_PAGE_SIZE_2M I915_GTT_PAGE_SIZE_2M
#define XE_HP_FEATURES \ #define XE_HP_FEATURES \
.__runtime.graphics.ver = 12, \ .__runtime.graphics.ip.ver = 12, \
.__runtime.graphics.rel = 50, \ .__runtime.graphics.ip.rel = 50, \
XE_HP_PAGE_SIZES, \ XE_HP_PAGE_SIZES, \
.dma_mask_size = 46, \ .dma_mask_size = 46, \
.has_3d_pipeline = 1, \ .has_3d_pipeline = 1, \
...@@ -1027,8 +1027,8 @@ static const struct intel_device_info adl_p_info = { ...@@ -1027,8 +1027,8 @@ static const struct intel_device_info adl_p_info = {
.__runtime.ppgtt_type = INTEL_PPGTT_FULL .__runtime.ppgtt_type = INTEL_PPGTT_FULL
#define XE_HPM_FEATURES \ #define XE_HPM_FEATURES \
.media.ver = 12, \ .__runtime.media.ip.ver = 12, \
.media.rel = 50 .__runtime.media.ip.rel = 50
__maybe_unused __maybe_unused
static const struct intel_device_info xehpsdv_info = { static const struct intel_device_info xehpsdv_info = {
...@@ -1053,8 +1053,8 @@ static const struct intel_device_info xehpsdv_info = { ...@@ -1053,8 +1053,8 @@ static const struct intel_device_info xehpsdv_info = {
XE_HP_FEATURES, \ XE_HP_FEATURES, \
XE_HPM_FEATURES, \ XE_HPM_FEATURES, \
DGFX_FEATURES, \ DGFX_FEATURES, \
.__runtime.graphics.rel = 55, \ .__runtime.graphics.ip.rel = 55, \
.media.rel = 55, \ .__runtime.media.ip.rel = 55, \
PLATFORM(INTEL_DG2), \ PLATFORM(INTEL_DG2), \
.has_4tile = 1, \ .has_4tile = 1, \
.has_64k_pages = 1, \ .has_64k_pages = 1, \
...@@ -1096,8 +1096,8 @@ static const struct intel_device_info pvc_info = { ...@@ -1096,8 +1096,8 @@ static const struct intel_device_info pvc_info = {
XE_HPC_FEATURES, XE_HPC_FEATURES,
XE_HPM_FEATURES, XE_HPM_FEATURES,
DGFX_FEATURES, DGFX_FEATURES,
.__runtime.graphics.rel = 60, .__runtime.graphics.ip.rel = 60,
.media.rel = 60, .__runtime.media.ip.rel = 60,
PLATFORM(INTEL_PONTEVECCHIO), PLATFORM(INTEL_PONTEVECCHIO),
.display = { 0 }, .display = { 0 },
.has_flat_ccs = 0, .has_flat_ccs = 0,
...@@ -1110,7 +1110,7 @@ static const struct intel_device_info pvc_info = { ...@@ -1110,7 +1110,7 @@ static const struct intel_device_info pvc_info = {
#define XE_LPDP_FEATURES \ #define XE_LPDP_FEATURES \
XE_LPD_FEATURES, \ XE_LPD_FEATURES, \
.display.ver = 14, \ .__runtime.display.ip.ver = 14, \
.display.has_cdclk_crawl = 1, \ .display.has_cdclk_crawl = 1, \
.__runtime.fbc_mask = BIT(INTEL_FBC_A) | BIT(INTEL_FBC_B) .__runtime.fbc_mask = BIT(INTEL_FBC_A) | BIT(INTEL_FBC_B)
...@@ -1122,9 +1122,9 @@ static const struct intel_device_info mtl_info = { ...@@ -1122,9 +1122,9 @@ static const struct intel_device_info mtl_info = {
* Real graphics IP version will be obtained from hardware GMD_ID * Real graphics IP version will be obtained from hardware GMD_ID
* register. Value provided here is just for sanity checking. * register. Value provided here is just for sanity checking.
*/ */
.__runtime.graphics.ver = 12, .__runtime.graphics.ip.ver = 12,
.__runtime.graphics.rel = 70, .__runtime.graphics.ip.rel = 70,
.media.ver = 13, .__runtime.media.ip.ver = 13,
PLATFORM(INTEL_METEORLAKE), PLATFORM(INTEL_METEORLAKE),
.display.has_modular_fia = 1, .display.has_modular_fia = 1,
.has_flat_ccs = 0, .has_flat_ccs = 0,
...@@ -1280,7 +1280,7 @@ bool i915_pci_resource_valid(struct pci_dev *pdev, int bar) ...@@ -1280,7 +1280,7 @@ bool i915_pci_resource_valid(struct pci_dev *pdev, int bar)
static bool intel_mmio_bar_valid(struct pci_dev *pdev, struct intel_device_info *intel_info) static bool intel_mmio_bar_valid(struct pci_dev *pdev, struct intel_device_info *intel_info)
{ {
int gttmmaddr_bar = intel_info->__runtime.graphics.ver == 2 ? GEN2_GTTMMADR_BAR : GTTMMADR_BAR; int gttmmaddr_bar = intel_info->__runtime.graphics.ip.ver == 2 ? GEN2_GTTMMADR_BAR : GTTMMADR_BAR;
return i915_pci_resource_valid(pdev, gttmmaddr_bar); return i915_pci_resource_valid(pdev, gttmmaddr_bar);
} }
......
...@@ -92,21 +92,29 @@ void intel_device_info_print(const struct intel_device_info *info, ...@@ -92,21 +92,29 @@ void intel_device_info_print(const struct intel_device_info *info,
const struct intel_runtime_info *runtime, const struct intel_runtime_info *runtime,
struct drm_printer *p) struct drm_printer *p)
{ {
if (runtime->graphics.rel) if (runtime->graphics.ip.rel)
drm_printf(p, "graphics version: %u.%02u\n", runtime->graphics.ver, drm_printf(p, "graphics version: %u.%02u\n",
runtime->graphics.rel); runtime->graphics.ip.ver,
runtime->graphics.ip.rel);
else else
drm_printf(p, "graphics version: %u\n", runtime->graphics.ver); drm_printf(p, "graphics version: %u\n",
runtime->graphics.ip.ver);
if (info->media.rel) if (runtime->media.ip.rel)
drm_printf(p, "media version: %u.%02u\n", info->media.ver, info->media.rel); drm_printf(p, "media version: %u.%02u\n",
runtime->media.ip.ver,
runtime->media.ip.rel);
else else
drm_printf(p, "media version: %u\n", info->media.ver); drm_printf(p, "media version: %u\n",
runtime->media.ip.ver);
if (info->display.rel) if (runtime->display.ip.rel)
drm_printf(p, "display version: %u.%02u\n", info->display.ver, info->display.rel); drm_printf(p, "display version: %u.%02u\n",
runtime->display.ip.ver,
runtime->display.ip.rel);
else else
drm_printf(p, "display version: %u\n", info->display.ver); drm_printf(p, "display version: %u\n",
runtime->display.ip.ver);
drm_printf(p, "gt: %d\n", info->gt); drm_printf(p, "gt: %d\n", info->gt);
drm_printf(p, "memory-regions: %x\n", runtime->memory_regions); drm_printf(p, "memory-regions: %x\n", runtime->memory_regions);
......
...@@ -199,7 +199,15 @@ struct ip_version { ...@@ -199,7 +199,15 @@ struct ip_version {
}; };
struct intel_runtime_info { struct intel_runtime_info {
struct ip_version graphics; struct {
struct ip_version ip;
} graphics;
struct {
struct ip_version ip;
} media;
struct {
struct ip_version ip;
} display;
/* /*
* Platform mask is used for optimizing or-ed IS_PLATFORM calls into * Platform mask is used for optimizing or-ed IS_PLATFORM calls into
...@@ -245,8 +253,6 @@ struct intel_runtime_info { ...@@ -245,8 +253,6 @@ struct intel_runtime_info {
}; };
struct intel_device_info { struct intel_device_info {
struct ip_version media;
enum intel_platform platform; enum intel_platform platform;
unsigned int dma_mask_size; /* available DMA address bits */ unsigned int dma_mask_size; /* available DMA address bits */
...@@ -258,9 +264,6 @@ struct intel_device_info { ...@@ -258,9 +264,6 @@ struct intel_device_info {
#undef DEFINE_FLAG #undef DEFINE_FLAG
struct { struct {
u8 ver;
u8 rel;
u8 abox_mask; u8 abox_mask;
struct { struct {
......
...@@ -172,7 +172,7 @@ struct drm_i915_private *mock_gem_device(void) ...@@ -172,7 +172,7 @@ struct drm_i915_private *mock_gem_device(void)
/* Using the global GTT may ask questions about KMS users, so prepare */ /* Using the global GTT may ask questions about KMS users, so prepare */
drm_mode_config_init(&i915->drm); drm_mode_config_init(&i915->drm);
RUNTIME_INFO(i915)->graphics.ver = -1; RUNTIME_INFO(i915)->graphics.ip.ver = -1;
RUNTIME_INFO(i915)->page_sizes = RUNTIME_INFO(i915)->page_sizes =
I915_GTT_PAGE_SIZE_4K | I915_GTT_PAGE_SIZE_4K |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment