Commit dff0fc49 authored by Vinay Belgaumkar's avatar Vinay Belgaumkar Committed by John Harrison

drm/i915/guc/slpc: Initial definitions for SLPC

Add macros to check for SLPC support. This feature is currently supported
for Gen12+ and enabled whenever GuC submission is enabled/selected.

Include templates for SLPC init/fini and enable.

v2: Move SLPC helper functions to intel_guc_slpc.c/.h. Define
basic template for SLPC structure in intel_guc_slpc_types.h.
Fix copyright (Michal W)

v3: Review comments (Michal W)

v4: Include supported/selected inside slpc struct (Michal W)
Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarVinay Belgaumkar <vinay.belgaumkar@intel.com>
Signed-off-by: default avatarSundaresan Sujaritha <sujaritha.sundaresan@intel.com>
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210730202119.23810-2-vinay.belgaumkar@intel.com
parent 3989de0e
...@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \ ...@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
gt/uc/intel_guc_fw.o \ gt/uc/intel_guc_fw.o \
gt/uc/intel_guc_log.o \ gt/uc/intel_guc_log.o \
gt/uc/intel_guc_log_debugfs.o \ gt/uc/intel_guc_log_debugfs.o \
gt/uc/intel_guc_slpc.o \
gt/uc/intel_guc_submission.o \ gt/uc/intel_guc_submission.o \
gt/uc/intel_huc.o \ gt/uc/intel_huc.o \
gt/uc/intel_huc_debugfs.o \ gt/uc/intel_huc_debugfs.o \
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "gt/intel_gt_irq.h" #include "gt/intel_gt_irq.h"
#include "gt/intel_gt_pm_irq.h" #include "gt/intel_gt_pm_irq.h"
#include "intel_guc.h" #include "intel_guc.h"
#include "intel_guc_slpc.h"
#include "intel_guc_ads.h" #include "intel_guc_ads.h"
#include "intel_guc_submission.h" #include "intel_guc_submission.h"
#include "i915_drv.h" #include "i915_drv.h"
...@@ -157,6 +158,7 @@ void intel_guc_init_early(struct intel_guc *guc) ...@@ -157,6 +158,7 @@ void intel_guc_init_early(struct intel_guc *guc)
intel_guc_ct_init_early(&guc->ct); intel_guc_ct_init_early(&guc->ct);
intel_guc_log_init_early(&guc->log); intel_guc_log_init_early(&guc->log);
intel_guc_submission_init_early(guc); intel_guc_submission_init_early(guc);
intel_guc_slpc_init_early(&guc->slpc);
mutex_init(&guc->send_mutex); mutex_init(&guc->send_mutex);
spin_lock_init(&guc->irq_lock); spin_lock_init(&guc->irq_lock);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "intel_guc_ct.h" #include "intel_guc_ct.h"
#include "intel_guc_log.h" #include "intel_guc_log.h"
#include "intel_guc_reg.h" #include "intel_guc_reg.h"
#include "intel_guc_slpc_types.h"
#include "intel_uc_fw.h" #include "intel_uc_fw.h"
#include "i915_utils.h" #include "i915_utils.h"
#include "i915_vma.h" #include "i915_vma.h"
...@@ -30,6 +31,7 @@ struct intel_guc { ...@@ -30,6 +31,7 @@ struct intel_guc {
struct intel_uc_fw fw; struct intel_uc_fw fw;
struct intel_guc_log log; struct intel_guc_log log;
struct intel_guc_ct ct; struct intel_guc_ct ct;
struct intel_guc_slpc slpc;
/* Global engine used to submit requests to GuC */ /* Global engine used to submit requests to GuC */
struct i915_sched_engine *sched_engine; struct i915_sched_engine *sched_engine;
......
// SPDX-License-Identifier: MIT
/*
* Copyright © 2021 Intel Corporation
*/
#include "i915_drv.h"
#include "intel_guc_slpc.h"
#include "gt/intel_gt.h"
static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
{
return container_of(slpc, struct intel_guc, slpc);
}
static bool __detect_slpc_supported(struct intel_guc *guc)
{
/* GuC SLPC is unavailable for pre-Gen12 */
return guc->submission_supported &&
GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
}
static bool __guc_slpc_selected(struct intel_guc *guc)
{
if (!intel_guc_slpc_is_supported(guc))
return false;
return guc->submission_selected;
}
void intel_guc_slpc_init_early(struct intel_guc_slpc *slpc)
{
struct intel_guc *guc = slpc_to_guc(slpc);
slpc->supported = __detect_slpc_supported(guc);
slpc->selected = __guc_slpc_selected(guc);
}
int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
{
return 0;
}
void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
{
}
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2021 Intel Corporation
*/
#ifndef _INTEL_GUC_SLPC_H_
#define _INTEL_GUC_SLPC_H_
#include "intel_guc_submission.h"
#include "intel_guc_slpc_types.h"
static inline bool intel_guc_slpc_is_supported(struct intel_guc *guc)
{
return guc->slpc.supported;
}
static inline bool intel_guc_slpc_is_wanted(struct intel_guc *guc)
{
return guc->slpc.selected;
}
static inline bool intel_guc_slpc_is_used(struct intel_guc *guc)
{
return intel_guc_submission_is_used(guc) && intel_guc_slpc_is_wanted(guc);
}
void intel_guc_slpc_init_early(struct intel_guc_slpc *slpc);
int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
#endif
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2021 Intel Corporation
*/
#ifndef _INTEL_GUC_SLPC_TYPES_H_
#define _INTEL_GUC_SLPC_TYPES_H_
#include <linux/types.h>
struct intel_guc_slpc {
bool supported;
bool selected;
};
#endif
...@@ -75,16 +75,18 @@ static void __confirm_options(struct intel_uc *uc) ...@@ -75,16 +75,18 @@ static void __confirm_options(struct intel_uc *uc)
struct drm_i915_private *i915 = uc_to_gt(uc)->i915; struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
drm_dbg(&i915->drm, drm_dbg(&i915->drm,
"enable_guc=%d (guc:%s submission:%s huc:%s)\n", "enable_guc=%d (guc:%s submission:%s huc:%s slpc:%s)\n",
i915->params.enable_guc, i915->params.enable_guc,
yesno(intel_uc_wants_guc(uc)), yesno(intel_uc_wants_guc(uc)),
yesno(intel_uc_wants_guc_submission(uc)), yesno(intel_uc_wants_guc_submission(uc)),
yesno(intel_uc_wants_huc(uc))); yesno(intel_uc_wants_huc(uc)),
yesno(intel_uc_wants_guc_slpc(uc)));
if (i915->params.enable_guc == 0) { if (i915->params.enable_guc == 0) {
GEM_BUG_ON(intel_uc_wants_guc(uc)); GEM_BUG_ON(intel_uc_wants_guc(uc));
GEM_BUG_ON(intel_uc_wants_guc_submission(uc)); GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
GEM_BUG_ON(intel_uc_wants_huc(uc)); GEM_BUG_ON(intel_uc_wants_huc(uc));
GEM_BUG_ON(intel_uc_wants_guc_slpc(uc));
return; return;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "intel_guc.h" #include "intel_guc.h"
#include "intel_guc_submission.h" #include "intel_guc_submission.h"
#include "intel_guc_slpc.h"
#include "intel_huc.h" #include "intel_huc.h"
#include "i915_params.h" #include "i915_params.h"
...@@ -83,6 +84,7 @@ __uc_state_checker(x, func, uses, used) ...@@ -83,6 +84,7 @@ __uc_state_checker(x, func, uses, used)
uc_state_checkers(guc, guc); uc_state_checkers(guc, guc);
uc_state_checkers(huc, huc); uc_state_checkers(huc, huc);
uc_state_checkers(guc, guc_submission); uc_state_checkers(guc, guc_submission);
uc_state_checkers(guc, guc_slpc);
#undef uc_state_checkers #undef uc_state_checkers
#undef __uc_state_checker #undef __uc_state_checker
......
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