|
@@ -454,14 +454,22 @@ intel_read_status_page(struct intel_engine_cs *engine, int reg)
|
|
|
}
|
|
|
|
|
|
static inline void
|
|
|
-intel_write_status_page(struct intel_engine_cs *engine,
|
|
|
- int reg, u32 value)
|
|
|
+intel_write_status_page(struct intel_engine_cs *engine, int reg, u32 value)
|
|
|
{
|
|
|
- mb();
|
|
|
- clflush(&engine->status_page.page_addr[reg]);
|
|
|
- engine->status_page.page_addr[reg] = value;
|
|
|
- clflush(&engine->status_page.page_addr[reg]);
|
|
|
- mb();
|
|
|
+ /* Writing into the status page should be done sparingly. Since
|
|
|
+ * we do when we are uncertain of the device state, we take a bit
|
|
|
+ * of extra paranoia to try and ensure that the HWS takes the value
|
|
|
+ * we give and that it doesn't end up trapped inside the CPU!
|
|
|
+ */
|
|
|
+ if (static_cpu_has(X86_FEATURE_CLFLUSH)) {
|
|
|
+ mb();
|
|
|
+ clflush(&engine->status_page.page_addr[reg]);
|
|
|
+ engine->status_page.page_addr[reg] = value;
|
|
|
+ clflush(&engine->status_page.page_addr[reg]);
|
|
|
+ mb();
|
|
|
+ } else {
|
|
|
+ WRITE_ONCE(engine->status_page.page_addr[reg], value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*
|