/* * VF can only use part of the GGTT as allocated by the PF: * * WOPCM GUC_GGTT_TOP * |<------------ Total GGTT size ------------------>| * * VF GGTT base -->|<- size ->| * * +--------------------+----------+-----------------+ * |////////////////////| block |\\\\\\\\\\\\\\\\\| * +--------------------+----------+-----------------+ * * |<--- balloon[0] --->|<-- VF -->|<-- balloon[1] ->|
*/
/** * xe_tile_sriov_vf_prepare_ggtt - Prepare a VF's GGTT configuration. * @tile: the &xe_tile * * This function is for VF use only. * * Return: 0 on success or a negative error code on failure.
*/ int xe_tile_sriov_vf_prepare_ggtt(struct xe_tile *tile)
{ struct xe_device *xe = tile_to_xe(tile); int err;
err = vf_init_ggtt_balloons(tile); if (err) return err;
err = vf_balloon_ggtt(tile); if (err) {
vf_fini_ggtt_balloons(tile); return err;
}
/** * DOC: GGTT nodes shifting during VF post-migration recovery * * The first fixup applied to the VF KMD structures as part of post-migration * recovery is shifting nodes within &xe_ggtt instance. The nodes are moved * from range previously assigned to this VF, into newly provisioned area. * The changes include balloons, which are resized accordingly. * * The balloon nodes are there to eliminate unavailable ranges from use: one * reserves the GGTT area below the range for current VF, and another one * reserves area above. * * Below is a GGTT layout of example VF, with a certain address range assigned to * said VF, and inaccessible areas above and below: * * 0 4GiB * |<--------------------------- Total GGTT size ----------------------------->| * WOPCM GUC_TOP * |<-------------- Area mappable by xe_ggtt instance ---------------->| * * +---+---------------------------------+----------+----------------------+---+ * |\\\|/////////////////////////////////| VF mem |//////////////////////|\\\| * +---+---------------------------------+----------+----------------------+---+ * * Hardware enforced access rules before migration: * * |<------- inaccessible for VF ------->|<VF owned>|<-- inaccessible for VF ->| * * GGTT nodes used for tracking allocations: * * |<---------- balloon ------------>|<- nodes->|<----- balloon ------>| * * After the migration, GGTT area assigned to the VF might have shifted, either * to lower or to higher address. But we expect the total size and extra areas to * be identical, as migration can only happen between matching platforms. * Below is an example of GGTT layout of the VF after migration. Content of the * GGTT for VF has been moved to a new area, and we receive its address from GuC: * * +---+----------------------+----------+---------------------------------+---+ * |\\\|//////////////////////| VF mem |/////////////////////////////////|\\\| * +---+----------------------+----------+---------------------------------+---+ * * Hardware enforced access rules after migration: * * |<- inaccessible for VF -->|<VF owned>|<------- inaccessible for VF ------->| * * So the VF has a new slice of GGTT assigned, and during migration process, the * memory content was copied to that new area. But the &xe_ggtt nodes are still * tracking allocations using the old addresses. The nodes within VF owned area * have to be shifted, and balloon nodes need to be resized to properly mask out * areas not owned by the VF. * * Fixed &xe_ggtt nodes used for tracking allocations: * * |<------ balloon ------>|<- nodes->|<----------- balloon ----------->| * * Due to use of GPU profiles, we do not expect the old and new GGTT ares to * overlap; but our node shifting will fix addresses properly regardless.
*/
/** * xe_tile_sriov_vf_fixup_ggtt_nodes - Shift GGTT allocations to match assigned range. * @tile: the &xe_tile struct instance * @shift: the shift value * * Since Global GTT is not virtualized, each VF has an assigned range * within the global space. This range might have changed during migration, * which requires all memory addresses pointing to GGTT to be shifted.
*/ void xe_tile_sriov_vf_fixup_ggtt_nodes(struct xe_tile *tile, s64 shift)
{ struct xe_ggtt *ggtt = tile->mem.ggtt;
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.