| Message ID | 20240814-check_pci_probe_res-v1-1-122ee07821ab@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | ACPI: PCI: check if the io space is page aligned | expand |
Hi Miao,
kernel test robot noticed the following build errors:
[auto build test ERROR on 7c626ce4bae1ac14f60076d00eafe71af30450ba]
url: https://github.com/intel-lab-lkp/linux/commits/Miao-Wang-via-B4-Relay/ACPI-PCI-check-if-the-io-space-is-page-aligned/20240815-003833
base: 7c626ce4bae1ac14f60076d00eafe71af30450ba
patch link: https://lore.kernel.org/r/20240814-check_pci_probe_res-v1-1-122ee07821ab%40gmail.com
patch subject: [PATCH] ACPI: PCI: check if the io space is page aligned
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240816/202408162020.SGGpRl7q-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240816/202408162020.SGGpRl7q-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408162020.SGGpRl7q-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/pm_runtime.h:11,
from drivers/acpi/pci_root.c:17:
drivers/acpi/pci_root.c: In function 'acpi_pci_root_remap_iospace':
>> drivers/acpi/pci_root.c:873:31: error: incompatible type for argument 1 of '_dev_err'
873 | dev_err(device->dev,
| ~~~~~~^~~~~
| |
| struct device
include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
drivers/acpi/pci_root.c:873:17: note: in expansion of macro 'dev_err'
873 | dev_err(device->dev,
| ^~~~~~~
include/linux/dev_printk.h:50:36: note: expected 'const struct device *' but argument is of type 'struct device'
50 | void _dev_err(const struct device *dev, const char *fmt, ...);
| ~~~~~~~~~~~~~~~~~~~~~^~~
vim +/_dev_err +873 drivers/acpi/pci_root.c
860
861 static void acpi_pci_root_remap_iospace(struct acpi_device *device,
862 struct resource_entry *entry)
863 {
864 #ifdef PCI_IOBASE
865 struct resource *res = entry->res;
866 resource_size_t cpu_addr = res->start;
867 resource_size_t pci_addr = cpu_addr - entry->offset;
868 resource_size_t length = resource_size(res);
869 unsigned long port;
870
871 if (!PAGE_ALIGNED(cpu_addr) || !PAGE_ALIGNED(length) ||
872 !PAGE_ALIGNED(pci_addr)) {
> 873 dev_err(device->dev,
874 FW_BUG "I/O resource %pR or its offset %pa is not page aligned\n",
875 res, &entry->offset);
876 goto err;
877 }
878
879 if (pci_register_io_range(&device->fwnode, cpu_addr, length))
880 goto err;
881
882 port = pci_address_to_pio(cpu_addr);
883 if (port == (unsigned long)-1)
884 goto err;
885
886 res->start = port;
887 res->end = port + length - 1;
888 entry->offset = port - pci_addr;
889
890 if (pci_remap_iospace(res, cpu_addr) < 0)
891 goto err;
892
893 pr_info("Remapped I/O %pa to %pR\n", &cpu_addr, res);
894 return;
895 err:
896 res->flags |= IORESOURCE_DISABLED;
897 #endif
898 }
899
Hi Miao,
kernel test robot noticed the following build errors:
[auto build test ERROR on 7c626ce4bae1ac14f60076d00eafe71af30450ba]
url: https://github.com/intel-lab-lkp/linux/commits/Miao-Wang-via-B4-Relay/ACPI-PCI-check-if-the-io-space-is-page-aligned/20240815-003833
base: 7c626ce4bae1ac14f60076d00eafe71af30450ba
patch link: https://lore.kernel.org/r/20240814-check_pci_probe_res-v1-1-122ee07821ab%40gmail.com
patch subject: [PATCH] ACPI: PCI: check if the io space is page aligned
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20240816/202408162021.HaTAkOvd-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240816/202408162021.HaTAkOvd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408162021.HaTAkOvd-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/acpi/pci_root.c:18:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:22:
In file included from arch/riscv/include/asm/sections.h:9:
In file included from include/linux/mm.h:2228:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/acpi/pci_root.c:873:11: error: passing 'struct device' to parameter of incompatible type 'const struct device *'; take the address with &
873 | dev_err(device->dev,
| ^~~~~~~~~~~
| &
include/linux/dev_printk.h:154:44: note: expanded from macro 'dev_err'
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~
include/linux/dev_printk.h:110:11: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:50:36: note: passing argument to parameter 'dev' here
50 | void _dev_err(const struct device *dev, const char *fmt, ...);
| ^
1 warning and 1 error generated.
vim +873 drivers/acpi/pci_root.c
860
861 static void acpi_pci_root_remap_iospace(struct acpi_device *device,
862 struct resource_entry *entry)
863 {
864 #ifdef PCI_IOBASE
865 struct resource *res = entry->res;
866 resource_size_t cpu_addr = res->start;
867 resource_size_t pci_addr = cpu_addr - entry->offset;
868 resource_size_t length = resource_size(res);
869 unsigned long port;
870
871 if (!PAGE_ALIGNED(cpu_addr) || !PAGE_ALIGNED(length) ||
872 !PAGE_ALIGNED(pci_addr)) {
> 873 dev_err(device->dev,
874 FW_BUG "I/O resource %pR or its offset %pa is not page aligned\n",
875 res, &entry->offset);
876 goto err;
877 }
878
879 if (pci_register_io_range(&device->fwnode, cpu_addr, length))
880 goto err;
881
882 port = pci_address_to_pio(cpu_addr);
883 if (port == (unsigned long)-1)
884 goto err;
885
886 res->start = port;
887 res->end = port + length - 1;
888 entry->offset = port - pci_addr;
889
890 if (pci_remap_iospace(res, cpu_addr) < 0)
891 goto err;
892
893 pr_info("Remapped I/O %pa to %pR\n", &cpu_addr, res);
894 return;
895 err:
896 res->flags |= IORESOURCE_DISABLED;
897 #endif
898 }
899
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index d0bfb3706801..58fc64757bde 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -858,7 +858,7 @@ static void acpi_pci_root_validate_resources(struct device *dev, } } -static void acpi_pci_root_remap_iospace(struct fwnode_handle *fwnode, +static void acpi_pci_root_remap_iospace(struct acpi_device *device, struct resource_entry *entry) { #ifdef PCI_IOBASE @@ -868,7 +868,15 @@ static void acpi_pci_root_remap_iospace(struct fwnode_handle *fwnode, resource_size_t length = resource_size(res); unsigned long port; - if (pci_register_io_range(fwnode, cpu_addr, length)) + if (!PAGE_ALIGNED(cpu_addr) || !PAGE_ALIGNED(length) || + !PAGE_ALIGNED(pci_addr)) { + dev_err(device->dev, + FW_BUG "I/O resource %pR or its offset %pa is not page aligned\n", + res, &entry->offset); + goto err; + } + + if (pci_register_io_range(&device->fwnode, cpu_addr, length)) goto err; port = pci_address_to_pio(cpu_addr); @@ -910,7 +918,7 @@ int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info) else { resource_list_for_each_entry_safe(entry, tmp, list) { if (entry->res->flags & IORESOURCE_IO) - acpi_pci_root_remap_iospace(&device->fwnode, + acpi_pci_root_remap_iospace(device, entry); if (entry->res->flags & IORESOURCE_DISABLED)