[jonmason-ntb:ntb-next-hacking 16/18] drivers/irqchip/irq-imx-mu-msi.c:138:30: error: variable has incomplete type 'struct msi_domain_ops'

From: kernel test robot
Date: Sat Aug 13 2022 - 22:50:48 EST


tree: https://github.com/jonmason/ntb ntb-next-hacking
head: d90921d21692b59734d2452efea346217a526f44
commit: 1db755129d2544df84dc197095c14170cfa419c7 [16/18] irqchip: imx mu worked as msi controller
config: arm-randconfig-r016-20220810 (https://download.01.org/0day-ci/archive/20220814/202208141041.iKTkTxDJ-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/jonmason/ntb/commit/1db755129d2544df84dc197095c14170cfa419c7
git remote add jonmason-ntb https://github.com/jonmason/ntb
git fetch --no-tags jonmason-ntb ntb-next-hacking
git checkout 1db755129d2544df84dc197095c14170cfa419c7
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/

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

All errors (new ones prefixed by >>):

>> drivers/irqchip/irq-imx-mu-msi.c:138:30: error: variable has incomplete type 'struct msi_domain_ops'
static struct msi_domain_ops its_pmsi_ops = {
^
drivers/irqchip/irq-imx-mu-msi.c:138:15: note: forward declaration of 'struct msi_domain_ops'
static struct msi_domain_ops its_pmsi_ops = {
^
>> drivers/irqchip/irq-imx-mu-msi.c:142:12: error: use of undeclared identifier 'MSI_FLAG_USE_DEF_DOM_OPS'
.flags = (MSI_FLAG_USE_DEF_DOM_OPS |
^
>> drivers/irqchip/irq-imx-mu-msi.c:143:6: error: use of undeclared identifier 'MSI_FLAG_USE_DEF_CHIP_OPS'
MSI_FLAG_USE_DEF_CHIP_OPS |
^
>> drivers/irqchip/irq-imx-mu-msi.c:144:6: error: use of undeclared identifier 'MSI_FLAG_PCI_MSIX'
MSI_FLAG_PCI_MSIX),
^
>> drivers/irqchip/irq-imx-mu-msi.c:141:31: error: variable has incomplete type 'struct msi_domain_info'
static struct msi_domain_info imx_mu_msi_domain_info = {
^
drivers/irqchip/irq-imx-mu-msi.c:141:15: note: forward declaration of 'struct msi_domain_info'
static struct msi_domain_info imx_mu_msi_domain_info = {
^
>> drivers/irqchip/irq-imx-mu-msi.c:179:2: error: use of undeclared identifier 'msi_alloc_info_t'
msi_alloc_info_t *info = args;
^
>> drivers/irqchip/irq-imx-mu-msi.c:179:20: error: use of undeclared identifier 'info'
msi_alloc_info_t *info = args;
^
drivers/irqchip/irq-imx-mu-msi.c:197:30: error: use of undeclared identifier 'info'
err = iommu_dma_prepare_msi(info->desc, msi_data->msiir_addr + pos * 4);
^
>> drivers/irqchip/irq-imx-mu-msi.c:262:25: error: call to undeclared function 'platform_msi_create_irq_domain'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
msi_data->msi_domain = platform_msi_create_irq_domain(
^
9 errors generated.


vim +138 drivers/irqchip/irq-imx-mu-msi.c

137
> 138 static struct msi_domain_ops its_pmsi_ops = {
139 };
140
> 141 static struct msi_domain_info imx_mu_msi_domain_info = {
> 142 .flags = (MSI_FLAG_USE_DEF_DOM_OPS |
> 143 MSI_FLAG_USE_DEF_CHIP_OPS |
> 144 MSI_FLAG_PCI_MSIX),
145 .ops = &its_pmsi_ops,
146 .chip = &imx_mu_msi_irq_chip,
147 };
148
149 static void imx_mu_msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
150 {
151 struct imx_mu_msi *msi_data = irq_data_get_irq_chip_data(data);
152
153 msg->address_hi = upper_32_bits(msi_data->msiir_addr);
154 msg->address_lo = lower_32_bits(msi_data->msiir_addr + 4 * data->hwirq);
155 msg->data = data->hwirq;
156
157 iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), msg);
158 }
159
160 static int imx_mu_msi_set_affinity(struct irq_data *irq_data,
161 const struct cpumask *mask, bool force)
162
163 {
164 return IRQ_SET_MASK_OK;
165 }
166
167 static struct irq_chip imx_mu_msi_parent_chip = {
168 .name = "MU",
169 .irq_compose_msi_msg = imx_mu_msi_compose_msg,
170 .irq_set_affinity = imx_mu_msi_set_affinity,
171 };
172
173 static int imx_mu_msi_domain_irq_alloc(struct irq_domain *domain,
174 unsigned int virq,
175 unsigned int nr_irqs,
176 void *args)
177 {
178 struct imx_mu_msi *msi_data = domain->host_data;
> 179 msi_alloc_info_t *info = args;
180 int pos, err = 0;
181
182 pm_runtime_get_sync(&msi_data->pdev->dev);
183
184 WARN_ON(nr_irqs != 1);
185
186 spin_lock(&msi_data->lock);
187 pos = find_first_zero_bit(&msi_data->used, msi_data->irqs_num);
188 if (pos < msi_data->irqs_num)
189 __set_bit(pos, &msi_data->used);
190 else
191 err = -ENOSPC;
192 spin_unlock(&msi_data->lock);
193
194 if (err)
195 return err;
196
197 err = iommu_dma_prepare_msi(info->desc, msi_data->msiir_addr + pos * 4);
198 if (err)
199 return err;
200
201 irq_domain_set_info(domain, virq, pos,
202 &imx_mu_msi_parent_chip, msi_data,
203 handle_simple_irq, NULL, NULL);
204 return 0;
205 }
206
207 static void imx_mu_msi_domain_irq_free(struct irq_domain *domain,
208 unsigned int virq, unsigned int nr_irqs)
209 {
210 struct irq_data *d = irq_domain_get_irq_data(domain, virq);
211 struct imx_mu_msi *msi_data = irq_data_get_irq_chip_data(d);
212 int pos;
213
214 pos = d->hwirq;
215 if (pos < 0 || pos >= msi_data->irqs_num) {
216 pr_err("failed to teardown msi. Invalid hwirq %d\n", pos);
217 return;
218 }
219
220 spin_lock(&msi_data->lock);
221 __clear_bit(pos, &msi_data->used);
222 spin_unlock(&msi_data->lock);
223
224 pm_runtime_put(&msi_data->pdev->dev);
225 }
226
227 static const struct irq_domain_ops imx_mu_msi_domain_ops = {
228 .alloc = imx_mu_msi_domain_irq_alloc,
229 .free = imx_mu_msi_domain_irq_free,
230 };
231
232 static void imx_mu_msi_irq_handler(struct irq_desc *desc)
233 {
234 struct imx_mu_msi *msi_data = irq_desc_get_handler_data(desc);
235 u32 status;
236 int i;
237
238 status = imx_mu_read(msi_data, msi_data->cfg->xSR[IMX_MU_RSR]);
239
240 chained_irq_enter(irq_desc_get_chip(desc), desc);
241 for (i = 0; i < IMX_MU_CHANS; i++) {
242 if (status & IMX_MU_xSR_RFn(msi_data->cfg->type, i)) {
243 imx_mu_read(msi_data, msi_data->cfg->xRR + i * 4);
244 generic_handle_domain_irq(msi_data->parent, i);
245 }
246 }
247 chained_irq_exit(irq_desc_get_chip(desc), desc);
248 }
249
250 static int imx_mu_msi_domains_init(struct imx_mu_msi *msi_data)
251 {
252 /* Initialize MSI domain parent */
253 msi_data->parent = irq_domain_add_linear(NULL,
254 msi_data->irqs_num,
255 &imx_mu_msi_domain_ops,
256 msi_data);
257 if (!msi_data->parent) {
258 dev_err(&msi_data->pdev->dev, "failed to create IRQ domain\n");
259 return -ENOMEM;
260 }
261
> 262 msi_data->msi_domain = platform_msi_create_irq_domain(
263 of_node_to_fwnode(msi_data->pdev->dev.of_node),
264 &imx_mu_msi_domain_info,
265 msi_data->parent);
266
267 if (!msi_data->msi_domain) {
268 dev_err(&msi_data->pdev->dev, "failed to create MSI domain\n");
269 irq_domain_remove(msi_data->parent);
270 return -ENOMEM;
271 }
272
273 return 0;
274 }
275

--
0-DAY CI Kernel Test Service
https://01.org/lkp