drm/i915/guc: Unify notify() functions

The Gen11+ and the legacy function differ in the register and value
written to interrupt the GuC. However, while on older gen the value
matches a bit on the register, on Gen11+ the value is a SW defined
payload that is sent to the FW. Since the FW behaves the same no matter
what value we pass to it, we can just write the same thing on all gens
and get rid of the function pointer by saving the register offset.
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191217012316.13271-6-daniele.ceraolospurio@intel.com
parent 8c69bd74
...@@ -32,18 +32,17 @@ ...@@ -32,18 +32,17 @@
* just the HuC, but more are expected to land in the future). * just the HuC, but more are expected to land in the future).
*/ */
static void gen8_guc_raise_irq(struct intel_guc *guc) void intel_guc_notify(struct intel_guc *guc)
{ {
struct intel_gt *gt = guc_to_gt(guc); struct intel_gt *gt = guc_to_gt(guc);
intel_uncore_write(gt->uncore, GUC_SEND_INTERRUPT, GUC_SEND_TRIGGER); /*
} * On Gen11+, the value written to the register is passes as a payload
* to the FW. However, the FW currently treats all values the same way
static void gen11_guc_raise_irq(struct intel_guc *guc) * (H2G interrupt), so we can just write the value that the HW expects
{ * on older gens.
struct intel_gt *gt = guc_to_gt(guc); */
intel_uncore_write(gt->uncore, guc->notify_reg, GUC_SEND_TRIGGER);
intel_uncore_write(gt->uncore, GEN11_GUC_HOST_INTERRUPT, 0);
} }
static inline i915_reg_t guc_send_reg(struct intel_guc *guc, u32 i) static inline i915_reg_t guc_send_reg(struct intel_guc *guc, u32 i)
...@@ -178,12 +177,12 @@ void intel_guc_init_early(struct intel_guc *guc) ...@@ -178,12 +177,12 @@ void intel_guc_init_early(struct intel_guc *guc)
mutex_init(&guc->send_mutex); mutex_init(&guc->send_mutex);
spin_lock_init(&guc->irq_lock); spin_lock_init(&guc->irq_lock);
if (INTEL_GEN(i915) >= 11) { if (INTEL_GEN(i915) >= 11) {
guc->notify = gen11_guc_raise_irq; guc->notify_reg = GEN11_GUC_HOST_INTERRUPT;
guc->interrupts.reset = gen11_reset_guc_interrupts; guc->interrupts.reset = gen11_reset_guc_interrupts;
guc->interrupts.enable = gen11_enable_guc_interrupts; guc->interrupts.enable = gen11_enable_guc_interrupts;
guc->interrupts.disable = gen11_disable_guc_interrupts; guc->interrupts.disable = gen11_disable_guc_interrupts;
} else { } else {
guc->notify = gen8_guc_raise_irq; guc->notify_reg = GUC_SEND_INTERRUPT;
guc->interrupts.reset = gen9_reset_guc_interrupts; guc->interrupts.reset = gen9_reset_guc_interrupts;
guc->interrupts.enable = gen9_enable_guc_interrupts; guc->interrupts.enable = gen9_enable_guc_interrupts;
guc->interrupts.disable = gen9_disable_guc_interrupts; guc->interrupts.disable = gen9_disable_guc_interrupts;
......
...@@ -64,14 +64,14 @@ struct intel_guc { ...@@ -64,14 +64,14 @@ struct intel_guc {
enum forcewake_domains fw_domains; enum forcewake_domains fw_domains;
} send_regs; } send_regs;
/* register used to send interrupts to the GuC FW */
i915_reg_t notify_reg;
/* Store msg (e.g. log flush) that we see while CTBs are disabled */ /* Store msg (e.g. log flush) that we see while CTBs are disabled */
u32 mmio_msg; u32 mmio_msg;
/* To serialize the intel_guc_send actions */ /* To serialize the intel_guc_send actions */
struct mutex send_mutex; struct mutex send_mutex;
/* GuC's FW specific notify function */
void (*notify)(struct intel_guc *guc);
}; };
static static
...@@ -88,11 +88,6 @@ intel_guc_send_and_receive(struct intel_guc *guc, const u32 *action, u32 len, ...@@ -88,11 +88,6 @@ intel_guc_send_and_receive(struct intel_guc *guc, const u32 *action, u32 len,
response_buf, response_buf_size); response_buf, response_buf_size);
} }
static inline void intel_guc_notify(struct intel_guc *guc)
{
guc->notify(guc);
}
static inline void intel_guc_to_host_event_handler(struct intel_guc *guc) static inline void intel_guc_to_host_event_handler(struct intel_guc *guc)
{ {
intel_guc_ct_event_handler(&guc->ct); intel_guc_ct_event_handler(&guc->ct);
...@@ -130,6 +125,7 @@ void intel_guc_init_send_regs(struct intel_guc *guc); ...@@ -130,6 +125,7 @@ void intel_guc_init_send_regs(struct intel_guc *guc);
void intel_guc_write_params(struct intel_guc *guc); void intel_guc_write_params(struct intel_guc *guc);
int intel_guc_init(struct intel_guc *guc); int intel_guc_init(struct intel_guc *guc);
void intel_guc_fini(struct intel_guc *guc); void intel_guc_fini(struct intel_guc *guc);
void intel_guc_notify(struct intel_guc *guc);
int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len, int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len,
u32 *response_buf, u32 response_buf_size); u32 *response_buf, u32 response_buf_size);
int intel_guc_to_host_process_recv_msg(struct intel_guc *guc, int intel_guc_to_host_process_recv_msg(struct intel_guc *guc,
......
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