mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
drm/xe/mmio: Add check for minimal BAR size
We initialized the root tile's xe_mmio structure with a new size of 4MiB without sanity checks to see if mapped GTTMMADR_BAR was actually at least that size. Check BAR size against first 16MiB, which is expected minimum BAR size for the one-tile platforms. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patch.msgid.link/20260622132342.19600-4-michal.wajdeczko@intel.com
This commit is contained in:
parent
f8c64537f2
commit
16bc4493bb
|
|
@ -101,13 +101,18 @@ int xe_mmio_probe_early(struct xe_device *xe)
|
|||
struct xe_tile *root_tile = xe_device_get_root_tile(xe);
|
||||
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
|
||||
|
||||
xe->mmio.size = pci_resource_len(pdev, GTTMMADR_BAR);
|
||||
xe->mmio.regs = pcim_iomap(pdev, GTTMMADR_BAR, 0);
|
||||
if (!xe->mmio.regs) {
|
||||
xe_err(xe, "Failed to map GTTMMADR_BAR\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
xe->mmio.size = pci_resource_len(pdev, GTTMMADR_BAR);
|
||||
if (xe->mmio.size < SZ_16M) {
|
||||
xe_err(xe, "GTTMMADR_BAR is too small: %zu\n", xe->mmio.size);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Setup first tile; other tiles (if present) will be setup later. */
|
||||
xe_mmio_init(&root_tile->mmio, root_tile, xe->mmio.regs, SZ_4M);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user