/* Early gen2 devices have a cacheline of just 32 bytes, using 64 is overkill, * but keeps the logic simple. Indeed, the whole purpose of this macro is just * to give some inclination as to some of the magic values used in the various * workarounds!
*/ #define CACHELINE_BYTES 64 #define CACHELINE_DWORDS (CACHELINE_BYTES / sizeof(u32))
/* * The register defines to be used with the following macros need to accept a * base param, e.g: * * REG_FOO(base) _MMIO((base) + <relative offset>) * ENGINE_READ(engine, REG_FOO); * * register arrays are to be defined and accessed as follows: * * REG_BAR(base, i) _MMIO((base) + <relative offset> + (i) * <shift>) * ENGINE_READ_IDX(engine, REG_BAR, i)
*/
/* seqno size is actually only a uint32, but since we plan to use MI_FLUSH_DW to * do the writes, and that must have qw aligned offsets, simply pretend it's 8b.
*/
cur = READ_ONCE(execlists->active);
smp_rmb(); /* pairs with overwrite protection in process_csb() */ do {
old = cur;
active = READ_ONCE(*cur);
cur = READ_ONCE(execlists->active);
smp_rmb(); /* and complete the seqlock retry */
} while (unlikely(cur != old));
return active;
}
staticinline u32
intel_read_status_page(conststruct intel_engine_cs *engine, int reg)
{ /* Ensure that the compiler doesn't optimize away the load. */ return READ_ONCE(engine->status_page.addr[reg]);
}
staticinlinevoid
intel_write_status_page(struct intel_engine_cs *engine, int reg, u32 value)
{ /* 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!
*/
drm_clflush_virt_range(&engine->status_page.addr[reg], sizeof(value));
WRITE_ONCE(engine->status_page.addr[reg], value);
drm_clflush_virt_range(&engine->status_page.addr[reg], sizeof(value));
}
/* * Reads a dword out of the status page, which is written to from the command * queue by automatic updates, MI_REPORT_HEAD, MI_STORE_DATA_INDEX, or * MI_STORE_DATA_IMM. * * The following dwords have a reserved meaning: * 0x00: ISR copy, updated when an ISR bit not set in the HWSTAM changes. * 0x04: ring 0 head pointer * 0x05: ring 1 head pointer (915-class) * 0x06: ring 2 head pointer (915-class) * 0x10-0x1b: Context status DWords (GM45) * 0x1f: Last written status offset. (GM45) * 0x20-0x2f: Reserved (Gen6+) * * The area from dword 0x30 to 0x3ff is available for driver usage.
*/ #define I915_GEM_HWS_PREEMPT 0x32 #define I915_GEM_HWS_PREEMPT_ADDR (I915_GEM_HWS_PREEMPT * sizeof(u32)) #define I915_GEM_HWS_SEQNO 0x40 #define I915_GEM_HWS_SEQNO_ADDR (I915_GEM_HWS_SEQNO * sizeof(u32)) #define I915_GEM_HWS_MIGRATE (0x42 * sizeof(u32)) #define I915_GEM_HWS_GGTT_BIND 0x46 #define I915_GEM_HWS_GGTT_BIND_ADDR (I915_GEM_HWS_GGTT_BIND * sizeof(u32)) #define I915_GEM_HWS_PXP 0x60 #define I915_GEM_HWS_PXP_ADDR (I915_GEM_HWS_PXP * sizeof(u32)) #define I915_GEM_HWS_GSC 0x62 #define I915_GEM_HWS_GSC_ADDR (I915_GEM_HWS_GSC * sizeof(u32)) #define I915_GEM_HWS_SCRATCH 0x80
staticinlinebool
intel_virtual_engine_has_heartbeat(conststruct intel_engine_cs *engine)
{ /* * For non-GuC submission we expect the back-end to look at the * heartbeat status of the actual physical engine that the work * has been (or is being) scheduled on, so we should only reach * here with GuC submission enabled.
*/
GEM_BUG_ON(!intel_engine_uses_guc(engine));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.