habanalabs: use %pa to print pci bar size

PCI bar size is resource_size_t so we should use %pa to make it work
correctly on all architectures.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
Oded Gabbay 2022-06-27 11:30:43 +03:00
parent 0407c155f1
commit 9c7fde71a7
2 changed files with 22 additions and 28 deletions

View file

@ -801,6 +801,7 @@ static int gaudi_early_init(struct hl_device *hdev)
{ {
struct asic_fixed_properties *prop = &hdev->asic_prop; struct asic_fixed_properties *prop = &hdev->asic_prop;
struct pci_dev *pdev = hdev->pdev; struct pci_dev *pdev = hdev->pdev;
resource_size_t pci_bar_size;
u32 fw_boot_status; u32 fw_boot_status;
int rc; int rc;
@ -811,24 +812,20 @@ static int gaudi_early_init(struct hl_device *hdev)
} }
/* Check BAR sizes */ /* Check BAR sizes */
if (pci_resource_len(pdev, SRAM_BAR_ID) != SRAM_BAR_SIZE) { pci_bar_size = pci_resource_len(pdev, SRAM_BAR_ID);
dev_err(hdev->dev,
"Not " HL_NAME "? BAR %d size %llu, expecting %llu\n", if (pci_bar_size != SRAM_BAR_SIZE) {
SRAM_BAR_ID, dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
(unsigned long long) pci_resource_len(pdev, SRAM_BAR_ID, &pci_bar_size, SRAM_BAR_SIZE);
SRAM_BAR_ID),
SRAM_BAR_SIZE);
rc = -ENODEV; rc = -ENODEV;
goto free_queue_props; goto free_queue_props;
} }
if (pci_resource_len(pdev, CFG_BAR_ID) != CFG_BAR_SIZE) { pci_bar_size = pci_resource_len(pdev, CFG_BAR_ID);
dev_err(hdev->dev,
"Not " HL_NAME "? BAR %d size %llu, expecting %llu\n", if (pci_bar_size != CFG_BAR_SIZE) {
CFG_BAR_ID, dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
(unsigned long long) pci_resource_len(pdev, CFG_BAR_ID, &pci_bar_size, CFG_BAR_SIZE);
CFG_BAR_ID),
CFG_BAR_SIZE);
rc = -ENODEV; rc = -ENODEV;
goto free_queue_props; goto free_queue_props;
} }

View file

@ -608,6 +608,7 @@ static int goya_early_init(struct hl_device *hdev)
{ {
struct asic_fixed_properties *prop = &hdev->asic_prop; struct asic_fixed_properties *prop = &hdev->asic_prop;
struct pci_dev *pdev = hdev->pdev; struct pci_dev *pdev = hdev->pdev;
resource_size_t pci_bar_size;
u32 fw_boot_status, val; u32 fw_boot_status, val;
int rc; int rc;
@ -618,24 +619,20 @@ static int goya_early_init(struct hl_device *hdev)
} }
/* Check BAR sizes */ /* Check BAR sizes */
if (pci_resource_len(pdev, SRAM_CFG_BAR_ID) != CFG_BAR_SIZE) { pci_bar_size = pci_resource_len(pdev, SRAM_CFG_BAR_ID);
dev_err(hdev->dev,
"Not " HL_NAME "? BAR %d size %llu, expecting %llu\n", if (pci_bar_size != CFG_BAR_SIZE) {
SRAM_CFG_BAR_ID, dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
(unsigned long long) pci_resource_len(pdev, SRAM_CFG_BAR_ID, &pci_bar_size, CFG_BAR_SIZE);
SRAM_CFG_BAR_ID),
CFG_BAR_SIZE);
rc = -ENODEV; rc = -ENODEV;
goto free_queue_props; goto free_queue_props;
} }
if (pci_resource_len(pdev, MSIX_BAR_ID) != MSIX_BAR_SIZE) { pci_bar_size = pci_resource_len(pdev, MSIX_BAR_ID);
dev_err(hdev->dev,
"Not " HL_NAME "? BAR %d size %llu, expecting %llu\n", if (pci_bar_size != MSIX_BAR_SIZE) {
MSIX_BAR_ID, dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
(unsigned long long) pci_resource_len(pdev, MSIX_BAR_ID, &pci_bar_size, MSIX_BAR_SIZE);
MSIX_BAR_ID),
MSIX_BAR_SIZE);
rc = -ENODEV; rc = -ENODEV;
goto free_queue_props; goto free_queue_props;
} }