[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202405071235.s40EZ8t6-lkp@intel.com>
Date: Tue, 7 May 2024 13:13:04 +0800
From: kernel test robot <lkp@...el.com>
To: Antonio Borneo <antonio.borneo@...s.st.com>,
Russell King <linux@...linux.org.uk>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Thomas Gleixner <tglx@...utronix.de>
Cc: oe-kbuild-all@...ts.linux.dev,
Antonio Borneo <antonio.borneo@...s.st.com>,
linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/8] irqchip/stm32mp-exti: allow build as module
Hi Antonio,
kernel test robot noticed the following build errors:
[auto build test ERROR on 382d2ffe86efb1e2fa803d2cf17e5bfc34e574f3]
url: https://github.com/intel-lab-lkp/linux/commits/Antonio-Borneo/irqchip-stm32-exti-add-CONFIG_STM32MP_EXTI/20240506-213819
base: 382d2ffe86efb1e2fa803d2cf17e5bfc34e574f3
patch link: https://lore.kernel.org/r/20240506133256.948712-7-antonio.borneo%40foss.st.com
patch subject: [PATCH 6/8] irqchip/stm32mp-exti: allow build as module
config: i386-buildonly-randconfig-005-20240507
compiler: gcc-11 (Ubuntu 11.4.0-4ubuntu1) 11.4.0
reproduce (this is a W=1 build):
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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405071235.s40EZ8t6-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/irqchip/irq-stm32mp-exti.c: In function 'stm32mp_exti_eoi':
>> drivers/irqchip/irq-stm32mp-exti.c:340:14: error: 'struct irq_data' has no member named 'parent_data'
340 | if (d->parent_data->chip)
| ^~
>> drivers/irqchip/irq-stm32mp-exti.c:341:17: error: implicit declaration of function 'irq_chip_eoi_parent'; did you mean 'irq_chip_pm_put'? [-Werror=implicit-function-declaration]
341 | irq_chip_eoi_parent(d);
| ^~~~~~~~~~~~~~~~~~~
| irq_chip_pm_put
drivers/irqchip/irq-stm32mp-exti.c: In function 'stm32mp_exti_mask':
drivers/irqchip/irq-stm32mp-exti.c:353:14: error: 'struct irq_data' has no member named 'parent_data'
353 | if (d->parent_data->chip)
| ^~
>> drivers/irqchip/irq-stm32mp-exti.c:354:17: error: implicit declaration of function 'irq_chip_mask_parent' [-Werror=implicit-function-declaration]
354 | irq_chip_mask_parent(d);
| ^~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-stm32mp-exti.c: In function 'stm32mp_exti_unmask':
drivers/irqchip/irq-stm32mp-exti.c:366:14: error: 'struct irq_data' has no member named 'parent_data'
366 | if (d->parent_data->chip)
| ^~
>> drivers/irqchip/irq-stm32mp-exti.c:367:17: error: implicit declaration of function 'irq_chip_unmask_parent' [-Werror=implicit-function-declaration]
367 | irq_chip_unmask_parent(d);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-stm32mp-exti.c: In function 'stm32mp_exti_set_affinity':
drivers/irqchip/irq-stm32mp-exti.c:428:14: error: 'struct irq_data' has no member named 'parent_data'
428 | if (d->parent_data->chip)
| ^~
>> drivers/irqchip/irq-stm32mp-exti.c:429:24: error: implicit declaration of function 'irq_chip_set_affinity_parent'; did you mean 'irq_set_affinity_hint'? [-Werror=implicit-function-declaration]
429 | return irq_chip_set_affinity_parent(d, dest, force);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| irq_set_affinity_hint
drivers/irqchip/irq-stm32mp-exti.c: At top level:
>> drivers/irqchip/irq-stm32mp-exti.c:488:35: error: 'irq_chip_eoi_parent' undeclared here (not in a function); did you mean 'irq_chip_pm_put'?
488 | .irq_eoi = irq_chip_eoi_parent,
| ^~~~~~~~~~~~~~~~~~~
| irq_chip_pm_put
>> drivers/irqchip/irq-stm32mp-exti.c:489:35: error: 'irq_chip_ack_parent' undeclared here (not in a function); did you mean 'irq_chip_pm_put'?
489 | .irq_ack = irq_chip_ack_parent,
| ^~~~~~~~~~~~~~~~~~~
| irq_chip_pm_put
>> drivers/irqchip/irq-stm32mp-exti.c:492:35: error: 'irq_chip_retrigger_hierarchy' undeclared here (not in a function)
492 | .irq_retrigger = irq_chip_retrigger_hierarchy,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/irqchip/irq-stm32mp-exti.c:493:35: error: 'irq_chip_set_type_parent' undeclared here (not in a function)
493 | .irq_set_type = irq_chip_set_type_parent,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/irqchip/irq-stm32mp-exti.c:496:60: error: 'irq_chip_set_affinity_parent' undeclared here (not in a function); did you mean 'irq_set_affinity_hint'?
496 | .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? irq_chip_set_affinity_parent : NULL,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| irq_set_affinity_hint
drivers/irqchip/irq-stm32mp-exti.c: In function 'stm32mp_exti_domain_alloc':
>> drivers/irqchip/irq-stm32mp-exti.c:530:9: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip'; did you mean 'irq_domain_get_irq_data'? [-Werror=implicit-function-declaration]
530 | irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| irq_domain_get_irq_data
>> drivers/irqchip/irq-stm32mp-exti.c:540:56: error: 'struct irq_domain' has no member named 'parent'
540 | if (of_node_to_fwnode(out_irq.np) != dm->parent->fwnode)
| ^~
>> drivers/irqchip/irq-stm32mp-exti.c:546:24: error: implicit declaration of function 'irq_domain_alloc_irqs_parent'; did you mean 'irq_domain_alloc_irqs'? [-Werror=implicit-function-declaration]
546 | return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| irq_domain_alloc_irqs
drivers/irqchip/irq-stm32mp-exti.c:554:37: error: 'struct irq_domain' has no member named 'parent'
554 | p_fwspec.fwnode = dm->parent->fwnode;
| ^~
drivers/irqchip/irq-stm32mp-exti.c: At top level:
>> drivers/irqchip/irq-stm32mp-exti.c:597:10: error: 'const struct irq_domain_ops' has no member named 'alloc'
597 | .alloc = stm32mp_exti_domain_alloc,
| ^~~~~
>> drivers/irqchip/irq-stm32mp-exti.c:597:19: error: initialization of 'int (*)(struct irq_domain *, struct device_node *, enum irq_domain_bus_token)' from incompatible pointer type 'int (*)(struct irq_domain *, unsigned int, unsigned int, void *)' [-Werror=incompatible-pointer-types]
597 | .alloc = stm32mp_exti_domain_alloc,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-stm32mp-exti.c:597:19: note: (near initialization for 'stm32mp_exti_domain_ops.match')
>> drivers/irqchip/irq-stm32mp-exti.c:598:10: error: 'const struct irq_domain_ops' has no member named 'free'
598 | .free = irq_domain_free_irqs_common,
| ^~~~
>> drivers/irqchip/irq-stm32mp-exti.c:598:19: error: 'irq_domain_free_irqs_common' undeclared here (not in a function); did you mean 'irq_domain_free_irqs'?
598 | .free = irq_domain_free_irqs_common,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| irq_domain_free_irqs
drivers/irqchip/irq-stm32mp-exti.c: In function 'stm32mp_exti_probe':
>> drivers/irqchip/irq-stm32mp-exti.c:693:18: error: implicit declaration of function 'irq_domain_add_hierarchy'; did you mean 'irq_domain_is_hierarchy'? [-Werror=implicit-function-declaration]
693 | domain = irq_domain_add_hierarchy(parent_domain, 0,
| ^~~~~~~~~~~~~~~~~~~~~~~~
| irq_domain_is_hierarchy
>> drivers/irqchip/irq-stm32mp-exti.c:693:16: warning: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
693 | domain = irq_domain_add_hierarchy(parent_domain, 0,
| ^
cc1: some warnings being treated as errors
vim +340 drivers/irqchip/irq-stm32mp-exti.c
64782652b8d981 Antonio Borneo 2024-05-06 327
4386976d39c92f Antonio Borneo 2024-05-06 328 static void stm32mp_exti_eoi(struct irq_data *d)
64782652b8d981 Antonio Borneo 2024-05-06 329 {
4386976d39c92f Antonio Borneo 2024-05-06 330 struct stm32mp_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
4386976d39c92f Antonio Borneo 2024-05-06 331 const struct stm32mp_exti_bank *bank = chip_data->reg_bank;
64782652b8d981 Antonio Borneo 2024-05-06 332
64782652b8d981 Antonio Borneo 2024-05-06 333 raw_spin_lock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 334
4386976d39c92f Antonio Borneo 2024-05-06 335 stm32mp_exti_write_bit(d, bank->rpr_ofst);
4386976d39c92f Antonio Borneo 2024-05-06 336 stm32mp_exti_write_bit(d, bank->fpr_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 337
64782652b8d981 Antonio Borneo 2024-05-06 338 raw_spin_unlock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 339
64782652b8d981 Antonio Borneo 2024-05-06 @340 if (d->parent_data->chip)
64782652b8d981 Antonio Borneo 2024-05-06 @341 irq_chip_eoi_parent(d);
64782652b8d981 Antonio Borneo 2024-05-06 342 }
64782652b8d981 Antonio Borneo 2024-05-06 343
4386976d39c92f Antonio Borneo 2024-05-06 344 static void stm32mp_exti_mask(struct irq_data *d)
64782652b8d981 Antonio Borneo 2024-05-06 345 {
4386976d39c92f Antonio Borneo 2024-05-06 346 struct stm32mp_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
4386976d39c92f Antonio Borneo 2024-05-06 347 const struct stm32mp_exti_bank *bank = chip_data->reg_bank;
64782652b8d981 Antonio Borneo 2024-05-06 348
64782652b8d981 Antonio Borneo 2024-05-06 349 raw_spin_lock(&chip_data->rlock);
4386976d39c92f Antonio Borneo 2024-05-06 350 chip_data->mask_cache = stm32mp_exti_clr_bit(d, bank->imr_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 351 raw_spin_unlock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 352
64782652b8d981 Antonio Borneo 2024-05-06 353 if (d->parent_data->chip)
64782652b8d981 Antonio Borneo 2024-05-06 @354 irq_chip_mask_parent(d);
64782652b8d981 Antonio Borneo 2024-05-06 355 }
64782652b8d981 Antonio Borneo 2024-05-06 356
4386976d39c92f Antonio Borneo 2024-05-06 357 static void stm32mp_exti_unmask(struct irq_data *d)
64782652b8d981 Antonio Borneo 2024-05-06 358 {
4386976d39c92f Antonio Borneo 2024-05-06 359 struct stm32mp_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
4386976d39c92f Antonio Borneo 2024-05-06 360 const struct stm32mp_exti_bank *bank = chip_data->reg_bank;
64782652b8d981 Antonio Borneo 2024-05-06 361
64782652b8d981 Antonio Borneo 2024-05-06 362 raw_spin_lock(&chip_data->rlock);
4386976d39c92f Antonio Borneo 2024-05-06 363 chip_data->mask_cache = stm32mp_exti_set_bit(d, bank->imr_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 364 raw_spin_unlock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 365
64782652b8d981 Antonio Borneo 2024-05-06 366 if (d->parent_data->chip)
64782652b8d981 Antonio Borneo 2024-05-06 @367 irq_chip_unmask_parent(d);
64782652b8d981 Antonio Borneo 2024-05-06 368 }
64782652b8d981 Antonio Borneo 2024-05-06 369
4386976d39c92f Antonio Borneo 2024-05-06 370 static int stm32mp_exti_set_type(struct irq_data *d, unsigned int type)
64782652b8d981 Antonio Borneo 2024-05-06 371 {
4386976d39c92f Antonio Borneo 2024-05-06 372 struct stm32mp_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
4386976d39c92f Antonio Borneo 2024-05-06 373 const struct stm32mp_exti_bank *bank = chip_data->reg_bank;
64782652b8d981 Antonio Borneo 2024-05-06 374 struct hwspinlock *hwlock = chip_data->host_data->hwlock;
64782652b8d981 Antonio Borneo 2024-05-06 375 void __iomem *base = chip_data->host_data->base;
64782652b8d981 Antonio Borneo 2024-05-06 376 u32 rtsr, ftsr;
64782652b8d981 Antonio Borneo 2024-05-06 377 int err;
64782652b8d981 Antonio Borneo 2024-05-06 378
64782652b8d981 Antonio Borneo 2024-05-06 379 raw_spin_lock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 380
64782652b8d981 Antonio Borneo 2024-05-06 381 if (hwlock) {
64782652b8d981 Antonio Borneo 2024-05-06 382 err = hwspin_lock_timeout_in_atomic(hwlock, HWSPNLCK_TIMEOUT);
64782652b8d981 Antonio Borneo 2024-05-06 383 if (err) {
64782652b8d981 Antonio Borneo 2024-05-06 384 pr_err("%s can't get hwspinlock (%d)\n", __func__, err);
64782652b8d981 Antonio Borneo 2024-05-06 385 goto unlock;
64782652b8d981 Antonio Borneo 2024-05-06 386 }
64782652b8d981 Antonio Borneo 2024-05-06 387 }
64782652b8d981 Antonio Borneo 2024-05-06 388
4386976d39c92f Antonio Borneo 2024-05-06 389 rtsr = readl_relaxed(base + bank->rtsr_ofst);
4386976d39c92f Antonio Borneo 2024-05-06 390 ftsr = readl_relaxed(base + bank->ftsr_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 391
4386976d39c92f Antonio Borneo 2024-05-06 392 err = stm32mp_exti_convert_type(d, type, &rtsr, &ftsr);
64782652b8d981 Antonio Borneo 2024-05-06 393 if (err)
64782652b8d981 Antonio Borneo 2024-05-06 394 goto unspinlock;
64782652b8d981 Antonio Borneo 2024-05-06 395
4386976d39c92f Antonio Borneo 2024-05-06 396 writel_relaxed(rtsr, base + bank->rtsr_ofst);
4386976d39c92f Antonio Borneo 2024-05-06 397 writel_relaxed(ftsr, base + bank->ftsr_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 398
64782652b8d981 Antonio Borneo 2024-05-06 399 unspinlock:
64782652b8d981 Antonio Borneo 2024-05-06 400 if (hwlock)
64782652b8d981 Antonio Borneo 2024-05-06 401 hwspin_unlock_in_atomic(hwlock);
64782652b8d981 Antonio Borneo 2024-05-06 402 unlock:
64782652b8d981 Antonio Borneo 2024-05-06 403 raw_spin_unlock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 404
64782652b8d981 Antonio Borneo 2024-05-06 405 return err;
64782652b8d981 Antonio Borneo 2024-05-06 406 }
64782652b8d981 Antonio Borneo 2024-05-06 407
4386976d39c92f Antonio Borneo 2024-05-06 408 static int stm32mp_exti_set_wake(struct irq_data *d, unsigned int on)
64782652b8d981 Antonio Borneo 2024-05-06 409 {
4386976d39c92f Antonio Borneo 2024-05-06 410 struct stm32mp_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
64782652b8d981 Antonio Borneo 2024-05-06 411 u32 mask = BIT(d->hwirq % IRQS_PER_BANK);
64782652b8d981 Antonio Borneo 2024-05-06 412
64782652b8d981 Antonio Borneo 2024-05-06 413 raw_spin_lock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 414
64782652b8d981 Antonio Borneo 2024-05-06 415 if (on)
64782652b8d981 Antonio Borneo 2024-05-06 416 chip_data->wake_active |= mask;
64782652b8d981 Antonio Borneo 2024-05-06 417 else
64782652b8d981 Antonio Borneo 2024-05-06 418 chip_data->wake_active &= ~mask;
64782652b8d981 Antonio Borneo 2024-05-06 419
64782652b8d981 Antonio Borneo 2024-05-06 420 raw_spin_unlock(&chip_data->rlock);
64782652b8d981 Antonio Borneo 2024-05-06 421
64782652b8d981 Antonio Borneo 2024-05-06 422 return 0;
64782652b8d981 Antonio Borneo 2024-05-06 423 }
64782652b8d981 Antonio Borneo 2024-05-06 424
4386976d39c92f Antonio Borneo 2024-05-06 425 static int stm32mp_exti_set_affinity(struct irq_data *d,
64782652b8d981 Antonio Borneo 2024-05-06 426 const struct cpumask *dest, bool force)
64782652b8d981 Antonio Borneo 2024-05-06 427 {
64782652b8d981 Antonio Borneo 2024-05-06 @428 if (d->parent_data->chip)
64782652b8d981 Antonio Borneo 2024-05-06 @429 return irq_chip_set_affinity_parent(d, dest, force);
64782652b8d981 Antonio Borneo 2024-05-06 430
64782652b8d981 Antonio Borneo 2024-05-06 431 return IRQ_SET_MASK_OK_DONE;
64782652b8d981 Antonio Borneo 2024-05-06 432 }
64782652b8d981 Antonio Borneo 2024-05-06 433
4386976d39c92f Antonio Borneo 2024-05-06 434 static int stm32mp_exti_suspend(struct device *dev)
64782652b8d981 Antonio Borneo 2024-05-06 435 {
4386976d39c92f Antonio Borneo 2024-05-06 436 struct stm32mp_exti_host_data *host_data = dev_get_drvdata(dev);
4386976d39c92f Antonio Borneo 2024-05-06 437 struct stm32mp_exti_chip_data *chip_data;
64782652b8d981 Antonio Borneo 2024-05-06 438 int i;
64782652b8d981 Antonio Borneo 2024-05-06 439
64782652b8d981 Antonio Borneo 2024-05-06 440 for (i = 0; i < host_data->drv_data->bank_nr; i++) {
64782652b8d981 Antonio Borneo 2024-05-06 441 chip_data = &host_data->chips_data[i];
4386976d39c92f Antonio Borneo 2024-05-06 442 stm32mp_chip_suspend(chip_data, chip_data->wake_active);
64782652b8d981 Antonio Borneo 2024-05-06 443 }
64782652b8d981 Antonio Borneo 2024-05-06 444
64782652b8d981 Antonio Borneo 2024-05-06 445 return 0;
64782652b8d981 Antonio Borneo 2024-05-06 446 }
64782652b8d981 Antonio Borneo 2024-05-06 447
4386976d39c92f Antonio Borneo 2024-05-06 448 static int stm32mp_exti_resume(struct device *dev)
64782652b8d981 Antonio Borneo 2024-05-06 449 {
4386976d39c92f Antonio Borneo 2024-05-06 450 struct stm32mp_exti_host_data *host_data = dev_get_drvdata(dev);
4386976d39c92f Antonio Borneo 2024-05-06 451 struct stm32mp_exti_chip_data *chip_data;
64782652b8d981 Antonio Borneo 2024-05-06 452 int i;
64782652b8d981 Antonio Borneo 2024-05-06 453
64782652b8d981 Antonio Borneo 2024-05-06 454 for (i = 0; i < host_data->drv_data->bank_nr; i++) {
64782652b8d981 Antonio Borneo 2024-05-06 455 chip_data = &host_data->chips_data[i];
4386976d39c92f Antonio Borneo 2024-05-06 456 stm32mp_chip_resume(chip_data, chip_data->mask_cache);
64782652b8d981 Antonio Borneo 2024-05-06 457 }
64782652b8d981 Antonio Borneo 2024-05-06 458
64782652b8d981 Antonio Borneo 2024-05-06 459 return 0;
64782652b8d981 Antonio Borneo 2024-05-06 460 }
64782652b8d981 Antonio Borneo 2024-05-06 461
4386976d39c92f Antonio Borneo 2024-05-06 462 static int stm32mp_exti_retrigger(struct irq_data *d)
64782652b8d981 Antonio Borneo 2024-05-06 463 {
4386976d39c92f Antonio Borneo 2024-05-06 464 struct stm32mp_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
4386976d39c92f Antonio Borneo 2024-05-06 465 const struct stm32mp_exti_bank *bank = chip_data->reg_bank;
64782652b8d981 Antonio Borneo 2024-05-06 466 void __iomem *base = chip_data->host_data->base;
64782652b8d981 Antonio Borneo 2024-05-06 467 u32 mask = BIT(d->hwirq % IRQS_PER_BANK);
64782652b8d981 Antonio Borneo 2024-05-06 468
4386976d39c92f Antonio Borneo 2024-05-06 469 writel_relaxed(mask, base + bank->swier_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 470
64782652b8d981 Antonio Borneo 2024-05-06 471 return 0;
64782652b8d981 Antonio Borneo 2024-05-06 472 }
64782652b8d981 Antonio Borneo 2024-05-06 473
4386976d39c92f Antonio Borneo 2024-05-06 474 static struct irq_chip stm32mp_exti_chip = {
4386976d39c92f Antonio Borneo 2024-05-06 475 .name = "stm32mp-exti",
4386976d39c92f Antonio Borneo 2024-05-06 476 .irq_eoi = stm32mp_exti_eoi,
4386976d39c92f Antonio Borneo 2024-05-06 477 .irq_mask = stm32mp_exti_mask,
4386976d39c92f Antonio Borneo 2024-05-06 478 .irq_unmask = stm32mp_exti_unmask,
4386976d39c92f Antonio Borneo 2024-05-06 479 .irq_retrigger = stm32mp_exti_retrigger,
4386976d39c92f Antonio Borneo 2024-05-06 480 .irq_set_type = stm32mp_exti_set_type,
4386976d39c92f Antonio Borneo 2024-05-06 481 .irq_set_wake = stm32mp_exti_set_wake,
64782652b8d981 Antonio Borneo 2024-05-06 482 .flags = IRQCHIP_MASK_ON_SUSPEND,
4386976d39c92f Antonio Borneo 2024-05-06 483 .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? stm32mp_exti_set_affinity : NULL,
64782652b8d981 Antonio Borneo 2024-05-06 484 };
64782652b8d981 Antonio Borneo 2024-05-06 485
4386976d39c92f Antonio Borneo 2024-05-06 486 static struct irq_chip stm32mp_exti_chip_direct = {
4386976d39c92f Antonio Borneo 2024-05-06 487 .name = "stm32mp-exti-direct",
64782652b8d981 Antonio Borneo 2024-05-06 @488 .irq_eoi = irq_chip_eoi_parent,
64782652b8d981 Antonio Borneo 2024-05-06 @489 .irq_ack = irq_chip_ack_parent,
4386976d39c92f Antonio Borneo 2024-05-06 490 .irq_mask = stm32mp_exti_mask,
4386976d39c92f Antonio Borneo 2024-05-06 491 .irq_unmask = stm32mp_exti_unmask,
64782652b8d981 Antonio Borneo 2024-05-06 @492 .irq_retrigger = irq_chip_retrigger_hierarchy,
64782652b8d981 Antonio Borneo 2024-05-06 @493 .irq_set_type = irq_chip_set_type_parent,
4386976d39c92f Antonio Borneo 2024-05-06 494 .irq_set_wake = stm32mp_exti_set_wake,
64782652b8d981 Antonio Borneo 2024-05-06 495 .flags = IRQCHIP_MASK_ON_SUSPEND,
64782652b8d981 Antonio Borneo 2024-05-06 @496 .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? irq_chip_set_affinity_parent : NULL,
64782652b8d981 Antonio Borneo 2024-05-06 497 };
64782652b8d981 Antonio Borneo 2024-05-06 498
4386976d39c92f Antonio Borneo 2024-05-06 499 static int stm32mp_exti_domain_alloc(struct irq_domain *dm,
64782652b8d981 Antonio Borneo 2024-05-06 500 unsigned int virq,
64782652b8d981 Antonio Borneo 2024-05-06 501 unsigned int nr_irqs, void *data)
64782652b8d981 Antonio Borneo 2024-05-06 502 {
4386976d39c92f Antonio Borneo 2024-05-06 503 struct stm32mp_exti_host_data *host_data = dm->host_data;
4386976d39c92f Antonio Borneo 2024-05-06 504 struct stm32mp_exti_chip_data *chip_data;
64782652b8d981 Antonio Borneo 2024-05-06 505 u8 desc_irq;
64782652b8d981 Antonio Borneo 2024-05-06 506 struct irq_fwspec *fwspec = data;
64782652b8d981 Antonio Borneo 2024-05-06 507 struct irq_fwspec p_fwspec;
64782652b8d981 Antonio Borneo 2024-05-06 508 irq_hw_number_t hwirq;
64782652b8d981 Antonio Borneo 2024-05-06 509 int bank;
64782652b8d981 Antonio Borneo 2024-05-06 510 u32 event_trg;
64782652b8d981 Antonio Borneo 2024-05-06 511 struct irq_chip *chip;
64782652b8d981 Antonio Borneo 2024-05-06 512
64782652b8d981 Antonio Borneo 2024-05-06 513 hwirq = fwspec->param[0];
64782652b8d981 Antonio Borneo 2024-05-06 514 if (hwirq >= host_data->drv_data->bank_nr * IRQS_PER_BANK)
64782652b8d981 Antonio Borneo 2024-05-06 515 return -EINVAL;
64782652b8d981 Antonio Borneo 2024-05-06 516
64782652b8d981 Antonio Borneo 2024-05-06 517 bank = hwirq / IRQS_PER_BANK;
64782652b8d981 Antonio Borneo 2024-05-06 518 chip_data = &host_data->chips_data[bank];
64782652b8d981 Antonio Borneo 2024-05-06 519
64782652b8d981 Antonio Borneo 2024-05-06 520 /* Check if event is reserved (Secure) */
64782652b8d981 Antonio Borneo 2024-05-06 521 if (chip_data->event_reserved & BIT(hwirq % IRQS_PER_BANK)) {
64782652b8d981 Antonio Borneo 2024-05-06 522 dev_err(host_data->dev, "event %lu is reserved, secure\n", hwirq);
64782652b8d981 Antonio Borneo 2024-05-06 523 return -EPERM;
64782652b8d981 Antonio Borneo 2024-05-06 524 }
64782652b8d981 Antonio Borneo 2024-05-06 525
64782652b8d981 Antonio Borneo 2024-05-06 526 event_trg = readl_relaxed(host_data->base + chip_data->reg_bank->trg_ofst);
64782652b8d981 Antonio Borneo 2024-05-06 527 chip = (event_trg & BIT(hwirq % IRQS_PER_BANK)) ?
4386976d39c92f Antonio Borneo 2024-05-06 528 &stm32mp_exti_chip : &stm32mp_exti_chip_direct;
64782652b8d981 Antonio Borneo 2024-05-06 529
64782652b8d981 Antonio Borneo 2024-05-06 @530 irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
64782652b8d981 Antonio Borneo 2024-05-06 531
64782652b8d981 Antonio Borneo 2024-05-06 532 if (host_data->dt_has_irqs_desc) {
64782652b8d981 Antonio Borneo 2024-05-06 533 struct of_phandle_args out_irq;
64782652b8d981 Antonio Borneo 2024-05-06 534 int ret;
64782652b8d981 Antonio Borneo 2024-05-06 535
64782652b8d981 Antonio Borneo 2024-05-06 536 ret = of_irq_parse_one(host_data->dev->of_node, hwirq, &out_irq);
64782652b8d981 Antonio Borneo 2024-05-06 537 if (ret)
64782652b8d981 Antonio Borneo 2024-05-06 538 return ret;
64782652b8d981 Antonio Borneo 2024-05-06 539 /* we only support one parent, so far */
64782652b8d981 Antonio Borneo 2024-05-06 540 if (of_node_to_fwnode(out_irq.np) != dm->parent->fwnode)
64782652b8d981 Antonio Borneo 2024-05-06 541 return -EINVAL;
64782652b8d981 Antonio Borneo 2024-05-06 542
64782652b8d981 Antonio Borneo 2024-05-06 543 of_phandle_args_to_fwspec(out_irq.np, out_irq.args,
64782652b8d981 Antonio Borneo 2024-05-06 544 out_irq.args_count, &p_fwspec);
64782652b8d981 Antonio Borneo 2024-05-06 545
64782652b8d981 Antonio Borneo 2024-05-06 546 return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
64782652b8d981 Antonio Borneo 2024-05-06 547 }
64782652b8d981 Antonio Borneo 2024-05-06 548
64782652b8d981 Antonio Borneo 2024-05-06 549 if (!host_data->drv_data->desc_irqs)
64782652b8d981 Antonio Borneo 2024-05-06 550 return -EINVAL;
64782652b8d981 Antonio Borneo 2024-05-06 551
64782652b8d981 Antonio Borneo 2024-05-06 552 desc_irq = host_data->drv_data->desc_irqs[hwirq];
64782652b8d981 Antonio Borneo 2024-05-06 553 if (desc_irq != EXTI_INVALID_IRQ) {
64782652b8d981 Antonio Borneo 2024-05-06 554 p_fwspec.fwnode = dm->parent->fwnode;
64782652b8d981 Antonio Borneo 2024-05-06 555 p_fwspec.param_count = 3;
64782652b8d981 Antonio Borneo 2024-05-06 556 p_fwspec.param[0] = GIC_SPI;
64782652b8d981 Antonio Borneo 2024-05-06 557 p_fwspec.param[1] = desc_irq;
64782652b8d981 Antonio Borneo 2024-05-06 558 p_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
64782652b8d981 Antonio Borneo 2024-05-06 559
64782652b8d981 Antonio Borneo 2024-05-06 560 return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
64782652b8d981 Antonio Borneo 2024-05-06 561 }
64782652b8d981 Antonio Borneo 2024-05-06 562
64782652b8d981 Antonio Borneo 2024-05-06 563 return 0;
64782652b8d981 Antonio Borneo 2024-05-06 564 }
64782652b8d981 Antonio Borneo 2024-05-06 565
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
View attachment "reproduce" of type "text/plain" (400 bytes)
View attachment "config" of type "text/plain" (146104 bytes)
Powered by blists - more mailing lists