cxl/pci: Reserve all device regions at once
authorIra Weiny <ira.weiny@intel.com>
Fri, 28 May 2021 00:49:19 +0000 (17:49 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 6 Jun 2021 00:37:05 +0000 (17:37 -0700)
commitf8a7e8c29be873b90fcc426e93bdb6184df5970e
tree7c430f48c3d8cd2fe319ad6f219baca3f3084943
parent07d62eac422c5c8aec6ec1dacdc27423334b2d17
cxl/pci: Reserve all device regions at once

In order to remap individual register sets each bar region must be
reserved prior to mapping.  Because the details of individual register
sets are contained within the BARs themselves, the bar must be mapped 2
times, once to extract this information and a second time for each
register set.

Rather than attempt to reserve each BAR individually and track if that
bar has been reserved.  Open code pcim_iomap_regions() by first
reserving all memory regions on the device and then mapping the bars
individually as needed.

NOTE pci_request_mem_regions() does not need a corresponding
pci_release_mem_regions() because the pci device is managed via
pcim_enable_device().

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20210528004922.3980613-3-ira.weiny@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/pci.c