lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202405071438.u3Dit6EW-lkp@intel.com>
Date: Tue, 7 May 2024 14:20:27 +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: hexagon-randconfig-r064-20240507
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
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/202405071438.u3Dit6EW-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/irqchip/irq-stm32mp-exti.c:10:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from drivers/irqchip/irq-stm32mp-exti.c:10:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from drivers/irqchip/irq-stm32mp-exti.c:10:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> drivers/irqchip/irq-stm32mp-exti.c:340:9: error: no member named 'parent_data' in 'struct irq_data'
     340 |         if (d->parent_data->chip)
         |             ~  ^
>> drivers/irqchip/irq-stm32mp-exti.c:341:3: error: call to undeclared function 'irq_chip_eoi_parent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     341 |                 irq_chip_eoi_parent(d);
         |                 ^
   drivers/irqchip/irq-stm32mp-exti.c:353:9: error: no member named 'parent_data' in 'struct irq_data'
     353 |         if (d->parent_data->chip)
         |             ~  ^
>> drivers/irqchip/irq-stm32mp-exti.c:354:3: error: call to undeclared function 'irq_chip_mask_parent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     354 |                 irq_chip_mask_parent(d);
         |                 ^
   drivers/irqchip/irq-stm32mp-exti.c:366:9: error: no member named 'parent_data' in 'struct irq_data'
     366 |         if (d->parent_data->chip)
         |             ~  ^
>> drivers/irqchip/irq-stm32mp-exti.c:367:3: error: call to undeclared function 'irq_chip_unmask_parent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     367 |                 irq_chip_unmask_parent(d);
         |                 ^
   drivers/irqchip/irq-stm32mp-exti.c:428:9: error: no member named 'parent_data' in 'struct irq_data'
     428 |         if (d->parent_data->chip)
         |             ~  ^
>> drivers/irqchip/irq-stm32mp-exti.c:429:10: error: call to undeclared function 'irq_chip_set_affinity_parent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     429 |                 return irq_chip_set_affinity_parent(d, dest, force);
         |                        ^
   drivers/irqchip/irq-stm32mp-exti.c:429:10: note: did you mean 'irq_set_affinity_hint'?
   include/linux/interrupt.h:349:19: note: 'irq_set_affinity_hint' declared here
     349 | static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
         |                   ^
>> drivers/irqchip/irq-stm32mp-exti.c:488:14: error: use of undeclared identifier 'irq_chip_eoi_parent'
     488 |         .irq_eoi                = irq_chip_eoi_parent,
         |                                   ^
>> drivers/irqchip/irq-stm32mp-exti.c:489:14: error: use of undeclared identifier 'irq_chip_ack_parent'
     489 |         .irq_ack                = irq_chip_ack_parent,
         |                                   ^
>> drivers/irqchip/irq-stm32mp-exti.c:492:20: error: use of undeclared identifier 'irq_chip_retrigger_hierarchy'
     492 |         .irq_retrigger          = irq_chip_retrigger_hierarchy,
         |                                   ^
>> drivers/irqchip/irq-stm32mp-exti.c:493:19: error: use of undeclared identifier 'irq_chip_set_type_parent'
     493 |         .irq_set_type           = irq_chip_set_type_parent,
         |                                   ^
>> drivers/irqchip/irq-stm32mp-exti.c:496:47: error: use of undeclared identifier 'irq_chip_set_affinity_parent'; 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
   include/linux/interrupt.h:349:19: note: 'irq_set_affinity_hint' declared here
     349 | static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
         |                   ^
>> drivers/irqchip/irq-stm32mp-exti.c:530:2: error: call to undeclared function 'irq_domain_set_hwirq_and_chip'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     530 |         irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
         |         ^
>> drivers/irqchip/irq-stm32mp-exti.c:540:44: error: no member named 'parent' in 'struct irq_domain'
     540 |                 if (of_node_to_fwnode(out_irq.np) != dm->parent->fwnode)
         |                                                      ~~  ^
>> drivers/irqchip/irq-stm32mp-exti.c:546:10: error: call to undeclared function 'irq_domain_alloc_irqs_parent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     546 |                 return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
         |                        ^
   drivers/irqchip/irq-stm32mp-exti.c:546:10: note: did you mean 'irq_domain_alloc_irqs'?
   include/linux/irqdomain.h:576:19: note: 'irq_domain_alloc_irqs' declared here
     576 | static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
         |                   ^
   drivers/irqchip/irq-stm32mp-exti.c:554:25: error: no member named 'parent' in 'struct irq_domain'
     554 |                 p_fwspec.fwnode = dm->parent->fwnode;
         |                                   ~~  ^
   drivers/irqchip/irq-stm32mp-exti.c:560:10: error: call to undeclared function 'irq_domain_alloc_irqs_parent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     560 |                 return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
         |                        ^
>> drivers/irqchip/irq-stm32mp-exti.c:598:10: error: use of undeclared identifier 'irq_domain_free_irqs_common'; did you mean 'irq_domain_free_irqs'?
     598 |         .free   = irq_domain_free_irqs_common,
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                   irq_domain_free_irqs
   include/linux/irqdomain.h:582:20: note: 'irq_domain_free_irqs' declared here
     582 | static inline void irq_domain_free_irqs(unsigned int virq,
         |                    ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   6 warnings and 20 errors generated.


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" (525 bytes)

View attachment "config" of type "text/plain" (134732 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ