diff mbox series

[3/3] irqchip: xilinx: Add support to remove the Xilinx INTC driver module.

Message ID 20210427113136.12469-4-anirudha.sarangi@xilinx.com (mailing list archive)
State New, archived
Headers show
Series Updates in irqchip framework to remove irqchip | expand

Commit Message

Anirudha Sarangi April 27, 2021, 11:31 a.m. UTC
The existing Xilinx INTC driver does not have mechanism to remove the
driver when it is being used as a module. For example, if the Xilinx
INTC IP is part of a removable fpga partition and a user intends to
replace the removable partition with a new one, the existing
implementation will not support the same.
The enhancement is done by adding a new remove API and making other
necessary changes.

Signed-off-by: Anirudha Sarangi <anirudha.sarangi@xilinx.com>
---
 drivers/irqchip/irq-xilinx-intc.c | 49 +++++++++++++++++++++++++++++--
 1 file changed, 47 insertions(+), 2 deletions(-)

Comments

kernel test robot April 27, 2021, 4:27 p.m. UTC | #1
Hi Anirudha,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on robh/for-next linus/master v5.12 next-20210427]
[cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Anirudha-Sarangi/Updates-in-irqchip-framework-to-remove-irqchip/20210427-193255
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 765822e1569a37aab5e69736c52d4ad4a289eba6
config: microblaze-randconfig-s031-20210426 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/5ca8cc6e787f51feed9a979547906dded222b51b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anirudha-Sarangi/Updates-in-irqchip-framework-to-remove-irqchip/20210427-193255
        git checkout 5ca8cc6e787f51feed9a979547906dded222b51b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=microblaze 

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

All errors (new ones prefixed by >>):

   drivers/irqchip/irq-xilinx-intc.c: In function 'xilinx_intc_of_remove':
>> drivers/irqchip/irq-xilinx-intc.c:275:10: error: 'struct xintc_irq_chip' has no member named 'domain'
     275 |  if (irqc->domain) {
         |          ^~
   drivers/irqchip/irq-xilinx-intc.c:277:25: error: 'struct xintc_irq_chip' has no member named 'domain'
     277 |   irq_domain_remove(irqc->domain);
         |                         ^~


vim +275 drivers/irqchip/irq-xilinx-intc.c

   262	
   263	static int xilinx_intc_of_remove(struct device_node *intc,
   264					 struct device_node *parent)
   265	{
   266		int irq;
   267		struct xintc_irq_chip *irqc;
   268	
   269		if (!parent)
   270			return 0;
   271	
   272		irqc = intc->data;
   273		irq = irqc->irq;
   274		irq_set_chained_handler_and_data(irq, NULL, NULL);
 > 275		if (irqc->domain) {
   276			irq_dispose_mapping(irq);
   277			irq_domain_remove(irqc->domain);
   278		}
   279		/*
   280		 * Disable all external interrupts until they are
   281		 * explicity requested.
   282		 */
   283		xintc_write(irqc, IER, 0);
   284		/* Acknowledge any pending interrupts just in case. */
   285		xintc_write(irqc, IAR, 0xffffffff);
   286		/* Turn off the Master Enable. */
   287		xintc_write(irqc, MER, 0x0);
   288	
   289		iounmap(irqc->base);
   290		kfree(irqc);
   291	
   292		return 0;
   293	}
   294	

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

Patch

diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
index 642733a6cbdf..2c5b76efabf6 100644
--- a/drivers/irqchip/irq-xilinx-intc.c
+++ b/drivers/irqchip/irq-xilinx-intc.c
@@ -39,6 +39,7 @@  struct xintc_irq_chip {
 	struct		irq_domain *root_domain;
 	u32		intr_mask;
 	u32		nr_irq;
+	int		irq;
 };
 
 static struct xintc_irq_chip *primary_intc;
@@ -234,6 +235,8 @@  static int xilinx_intc_of_init(struct device_node *intc,
 
 	if (parent) {
 		irq = irq_of_parse_and_map(intc, 0);
+		irqc->irq = irq;
+		intc->data = irqc;
 		if (irq) {
 			irq_set_chained_handler_and_data(irq,
 							 xil_intc_irq_handler,
@@ -257,5 +260,47 @@  static int xilinx_intc_of_init(struct device_node *intc,
 
 }
 
-IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init);
-IRQCHIP_DECLARE(xilinx_intc_opb, "xlnx,opb-intc-1.00.c", xilinx_intc_of_init);
+static int xilinx_intc_of_remove(struct device_node *intc,
+				 struct device_node *parent)
+{
+	int irq;
+	struct xintc_irq_chip *irqc;
+
+	if (!parent)
+		return 0;
+
+	irqc = intc->data;
+	irq = irqc->irq;
+	irq_set_chained_handler_and_data(irq, NULL, NULL);
+	if (irqc->domain) {
+		irq_dispose_mapping(irq);
+		irq_domain_remove(irqc->domain);
+	}
+	/*
+	 * Disable all external interrupts until they are
+	 * explicity requested.
+	 */
+	xintc_write(irqc, IER, 0);
+	/* Acknowledge any pending interrupts just in case. */
+	xintc_write(irqc, IAR, 0xffffffff);
+	/* Turn off the Master Enable. */
+	xintc_write(irqc, MER, 0x0);
+
+	iounmap(irqc->base);
+	kfree(irqc);
+
+	return 0;
+}
+
+static struct irqc_init_remove_funps intc_funps = {
+		.irqchip_initp = xilinx_intc_of_init,
+		.irqchip_removep = xilinx_intc_of_remove,
+};
+
+IRQCHIP_PLATFORM_DRIVER_BEGIN(xilinx_intc_xps)
+IRQCHIP_MATCH("xlnx,xps-intc-1.00.a", &intc_funps)
+IRQCHIP_PLATFORM_DRIVER_END(xilinx_intc_xps)
+
+IRQCHIP_PLATFORM_DRIVER_BEGIN(xilinx_intc_opb)
+IRQCHIP_MATCH("xlnx,opb-intc-1.00.c", &intc_funps)
+IRQCHIP_PLATFORM_DRIVER_END(xilinx_intc_opb)