[meghadey-crypto:d_msix_one 6/8] kernel/irq/msi.c:122:27: error: implicit declaration of function 'pci_msix_vec_count'

From: kernel test robot
Date: Thu Sep 09 2021 - 15:49:54 EST


tree: https://github.com/meghadey/crypto d_msix_one
head: fa7e3d01a9b3e08be49c417733dfc030ca6f1b80
commit: fecb2c96796ae216252f783daef6fe56efab40d7 [6/8] PCI/MSI: Enable dynamic allocation of MSI-X vectors
config: arm-buildonly-randconfig-r006-20210908 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/meghadey/crypto/commit/fecb2c96796ae216252f783daef6fe56efab40d7
git remote add meghadey-crypto https://github.com/meghadey/crypto
git fetch --no-tags meghadey-crypto d_msix_one
git checkout fecb2c96796ae216252f783daef6fe56efab40d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

kernel/irq/msi.c: In function 'msi_populate_sysfs':
>> kernel/irq/msi.c:122:27: error: implicit declaration of function 'pci_msix_vec_count' [-Werror=implicit-function-declaration]
122 | num_msi = pci_msix_vec_count(to_pci_dev(dev));
| ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


vim +/pci_msix_vec_count +122 kernel/irq/msi.c

96
97 /**
98 * msi_populate_sysfs - Populate msi_irqs sysfs entries for devices
99 * @dev: The device(PCI, platform etc) who will get sysfs entries
100 *
101 * Return attribute_group ** so that specific bus MSI can save it to
102 * somewhere during initilizing msi irqs. If devices has no MSI irq,
103 * return NULL; if it fails to populate sysfs, return ERR_PTR
104 */
105 const struct attribute_group **msi_populate_sysfs(struct device *dev)
106 {
107 const struct attribute_group **msi_irq_groups;
108 struct attribute **msi_attrs, *msi_attr;
109 struct device_attribute *msi_dev_attr;
110 struct attribute_group *msi_irq_group;
111 struct msi_desc *entry;
112 int ret = -ENOMEM;
113 int num_msi = 0;
114 int count = 0;
115 int i;
116
117 entry = first_msi_entry(dev);
118 if (IS_ENABLED(CONFIG_PCI_MSI) && entry->msi_attrib.is_msix) {
119 /* Since msi-x vectors can be allocated multiple times,
120 * allocate maximum no. of vectors supported by the device
121 */
> 122 num_msi = pci_msix_vec_count(to_pci_dev(dev));
123 } else {
124 /* Determine how many msi entries we have */
125 for_each_msi_entry(entry, dev)
126 num_msi += entry->nvec_used;
127 }
128
129 if (!num_msi)
130 return NULL;
131
132 /* Dynamically create the MSI attributes for the device */
133 msi_attrs = kcalloc(num_msi + 1, sizeof(void *), GFP_KERNEL);
134 if (!msi_attrs)
135 return ERR_PTR(-ENOMEM);
136
137 for_each_msi_entry(entry, dev) {
138 for (i = 0; i < entry->nvec_used; i++) {
139 msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
140 if (!msi_dev_attr)
141 goto error_attrs;
142 msi_attrs[count] = &msi_dev_attr->attr;
143
144 sysfs_attr_init(&msi_dev_attr->attr);
145 msi_dev_attr->attr.name = kasprintf(GFP_KERNEL, "%d",
146 entry->irq + i);
147 if (!msi_dev_attr->attr.name)
148 goto error_attrs;
149 msi_dev_attr->attr.mode = 0444;
150 msi_dev_attr->show = msi_mode_show;
151 ++count;
152 }
153 }
154
155 msi_irq_group = kzalloc(sizeof(*msi_irq_group), GFP_KERNEL);
156 if (!msi_irq_group)
157 goto error_attrs;
158 msi_irq_group->name = "msi_irqs";
159 msi_irq_group->attrs = msi_attrs;
160
161 msi_irq_groups = kcalloc(2, sizeof(void *), GFP_KERNEL);
162 if (!msi_irq_groups)
163 goto error_irq_group;
164 msi_irq_groups[0] = msi_irq_group;
165
166 ret = sysfs_create_groups(&dev->kobj, msi_irq_groups);
167 if (ret)
168 goto error_irq_groups;
169
170 return msi_irq_groups;
171
172 error_irq_groups:
173 kfree(msi_irq_groups);
174 error_irq_group:
175 kfree(msi_irq_group);
176 error_attrs:
177 count = 0;
178 msi_attr = msi_attrs[count];
179 while (msi_attr) {
180 msi_dev_attr = container_of(msi_attr, struct device_attribute, attr);
181 kfree(msi_attr->name);
182 kfree(msi_dev_attr);
183 ++count;
184 msi_attr = msi_attrs[count];
185 }
186 kfree(msi_attrs);
187 return ERR_PTR(ret);
188 }
189

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip