On Mon, Aug 16, 2021 at 02:54:30PM -0400, Felix Kuehling wrote: > I think you're right. We only need the start and end address from > lookup_resource and we already know that anyway. It means we can drop > patch 3 from the series. > > Just to be sure, we'll confirm that the end address determined by our > driver matches the one from lookup_resource (coming from the system > address map in the system BIOS). If there were a mismatch, it would > probably be a bug (in the driver or the BIOS) that we'd need to fix anyway. Or rather that the driver claimed area is smaller or the same as the bios range. No harm (except for potential peformance implications) when you don't use all of it. > I don't really see the "mess" you're talking about. Including the above, > there are only 3 conditional statements in that function that are not > error-handling related: > > /* Page migration works on Vega10 or newer */ > if (kfddev->device_info->asic_family < CHIP_VEGA10) > return -EINVAL; > ... > if (xgmi_connected_to_cpu) > res = lookup_resource(&iomem_resource, adev->gmc.aper_base); > else > res = devm_request_free_mem_region(adev->dev, &iomem_resource, size); > ... > pgmap->type = xgmi_connected_to_cpu ? > MEMORY_DEVICE_GENERIC : MEMORY_DEVICE_PRIVATE; > Plus the devm_release_mem_region error handling that is currently missing.