/** * xe_ttm_stolen_cpu_access_needs_ggtt() - If we can't directly CPU access * stolen, can we then fallback to mapping through the GGTT. * @xe: xe device * * Some older integrated platforms don't support reliable CPU access for stolen, * however on such hardware we can always use the mappable part of the GGTT for * CPU access. Check if that's the case for this device.
*/ bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe)
{ return GRAPHICS_VERx100(xe) < 1270 && !IS_DGFX(xe);
}
/* Use DSM base address instead for stolen memory */
mgr->stolen_base = (xe_mmio_read64_2x32(mmio, DSMBASE) & BDSM_MASK) - tile_offset; if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base)) return 0;
/* Carve out the top of DSM as it contains the reserved WOPCM region */
wopcm_size = get_wopcm_size(xe); if (drm_WARN_ON(&xe->drm, !wopcm_size)) return 0;
/* Verify usage fits in the actual resource available */ if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, LMEM_BAR))
mgr->io_base = tile_io_start + mgr->stolen_base;
/* * There may be few KB of platform dependent reserved memory at the end * of vram which is not part of the DSM. Such reserved memory portion is * always less then DSM granularity so align down the stolen_size to DSM * granularity to accommodate such reserve vram portion.
*/ return ALIGN_DOWN(stolen_size, SZ_1M);
}
/* * Check GGMS: it should be fixed 0x3 (8MB), which corresponds to the * GTT size
*/ if (drm_WARN_ON(&xe->drm, (ggc & GGMS_MASK) != GGMS_MASK)) return 0;
/* * Graphics >= 1270 uses the offset to the GSMBASE as address in the * PTEs, together with the DM flag being set. Previously there was no * such flag so the address was the io_base. * * DSMBASE = GSMBASE + 8MB
*/
mgr->stolen_base = SZ_8M;
mgr->io_base = pci_resource_start(pdev, 2) + mgr->stolen_base;
/* Carve out the top of DSM as it contains the reserved WOPCM region */
wopcm_size = get_wopcm_size(xe); if (drm_WARN_ON(&xe->drm, !wopcm_size)) return 0;
/* * This workaround is primarily implemented by the BIOS. We * just need to figure out whether the BIOS has applied the * workaround (meaning the programmed address falls within * the DSM) and, if so, reserve that part of the DSM to * prevent accidental reuse. The DSM location should be just * below the WOPCM.
*/ if (gscpsmi_base >= mgr->io_base &&
gscpsmi_base < mgr->io_base + stolen_size) {
xe_gt_dbg(media_gt, "Reserving %llu bytes of DSM for Wa_14019821291\n",
mgr->io_base + stolen_size - gscpsmi_base);
stolen_size = gscpsmi_base - mgr->io_base;
}
}
if (drm_WARN_ON(&xe->drm, stolen_size + SZ_8M > pci_resource_len(pdev, 2))) return 0;
if (!stolen_size) {
drm_dbg_kms(&xe->drm, "No stolen memory support\n"); return 0;
}
/* * We don't try to attempt partial visible support for stolen vram, * since stolen is always at the end of vram, and the BAR size is pretty * much always 256M, with small-bar.
*/
io_size = 0; if (mgr->io_base && !xe_ttm_stolen_cpu_access_needs_ggtt(xe))
io_size = stolen_size;
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.