xref: /openbmc/linux/arch/mips/kernel/module.c (revision ba837d38)
14e6a05feSThiemo Seufer /*
24e6a05feSThiemo Seufer  *  This program is free software; you can redistribute it and/or modify
34e6a05feSThiemo Seufer  *  it under the terms of the GNU General Public License as published by
44e6a05feSThiemo Seufer  *  the Free Software Foundation; either version 2 of the License, or
54e6a05feSThiemo Seufer  *  (at your option) any later version.
64e6a05feSThiemo Seufer  *
74e6a05feSThiemo Seufer  *  This program is distributed in the hope that it will be useful,
84e6a05feSThiemo Seufer  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
94e6a05feSThiemo Seufer  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
104e6a05feSThiemo Seufer  *  GNU General Public License for more details.
114e6a05feSThiemo Seufer  *
124e6a05feSThiemo Seufer  *  You should have received a copy of the GNU General Public License
134e6a05feSThiemo Seufer  *  along with this program; if not, write to the Free Software
144e6a05feSThiemo Seufer  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
154e6a05feSThiemo Seufer  *
164e6a05feSThiemo Seufer  *  Copyright (C) 2001 Rusty Russell.
174e6a05feSThiemo Seufer  *  Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
184e6a05feSThiemo Seufer  *  Copyright (C) 2005 Thiemo Seufer
194e6a05feSThiemo Seufer  */
204e6a05feSThiemo Seufer 
214e6a05feSThiemo Seufer #undef DEBUG
224e6a05feSThiemo Seufer 
234e6a05feSThiemo Seufer #include <linux/moduleloader.h>
244e6a05feSThiemo Seufer #include <linux/elf.h>
2527ac792cSAndrea Righi #include <linux/mm.h>
26761845f0SRalf Baechle #include <linux/numa.h>
274e6a05feSThiemo Seufer #include <linux/vmalloc.h>
284e6a05feSThiemo Seufer #include <linux/slab.h>
294e6a05feSThiemo Seufer #include <linux/fs.h>
304e6a05feSThiemo Seufer #include <linux/string.h>
314e6a05feSThiemo Seufer #include <linux/kernel.h>
321da177e4SLinus Torvalds #include <linux/spinlock.h>
3394bb0c1aSDavid Daney #include <linux/jump_label.h>
3494bb0c1aSDavid Daney 
35656be92fSAtsushi Nemoto #include <asm/pgtable.h>	/* MODULE_START */
361da177e4SLinus Torvalds 
374e6a05feSThiemo Seufer struct mips_hi16 {
384e6a05feSThiemo Seufer 	struct mips_hi16 *next;
394e6a05feSThiemo Seufer 	Elf_Addr *addr;
404e6a05feSThiemo Seufer 	Elf_Addr value;
414e6a05feSThiemo Seufer };
424e6a05feSThiemo Seufer 
431da177e4SLinus Torvalds static LIST_HEAD(dbe_list);
441da177e4SLinus Torvalds static DEFINE_SPINLOCK(dbe_lock);
451da177e4SLinus Torvalds 
4666574cc0SJonas Bonn #ifdef MODULE_START
474e6a05feSThiemo Seufer void *module_alloc(unsigned long size)
484e6a05feSThiemo Seufer {
49d0a21265SDavid Rientjes 	return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
50cb9e3c29SAndrey Ryabinin 				GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
51d0a21265SDavid Rientjes 				__builtin_return_address(0));
5266574cc0SJonas Bonn }
53656be92fSAtsushi Nemoto #endif
544e6a05feSThiemo Seufer 
556ede8123SRalf Baechle int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v)
564e6a05feSThiemo Seufer {
574e6a05feSThiemo Seufer 	return 0;
584e6a05feSThiemo Seufer }
594e6a05feSThiemo Seufer 
604e6a05feSThiemo Seufer static int apply_r_mips_32_rel(struct module *me, u32 *location, Elf_Addr v)
614e6a05feSThiemo Seufer {
624e6a05feSThiemo Seufer 	*location += v;
634e6a05feSThiemo Seufer 
644e6a05feSThiemo Seufer 	return 0;
654e6a05feSThiemo Seufer }
664e6a05feSThiemo Seufer 
674e6a05feSThiemo Seufer static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
684e6a05feSThiemo Seufer {
694e6a05feSThiemo Seufer 	if (v % 4) {
706f9fdeb6SRalf Baechle 		pr_err("module %s: dangerous R_MIPS_26 REL relocation\n",
716f9fdeb6SRalf Baechle 		       me->name);
724e6a05feSThiemo Seufer 		return -ENOEXEC;
734e6a05feSThiemo Seufer 	}
744e6a05feSThiemo Seufer 
754e6a05feSThiemo Seufer 	if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
7655d791f3SSteven J. Hill 		pr_err("module %s: relocation overflow\n",
774e6a05feSThiemo Seufer 		       me->name);
784e6a05feSThiemo Seufer 		return -ENOEXEC;
794e6a05feSThiemo Seufer 	}
804e6a05feSThiemo Seufer 
814e6a05feSThiemo Seufer 	*location = (*location & ~0x03ffffff) |
824e6a05feSThiemo Seufer 		    ((*location + (v >> 2)) & 0x03ffffff);
834e6a05feSThiemo Seufer 
844e6a05feSThiemo Seufer 	return 0;
854e6a05feSThiemo Seufer }
864e6a05feSThiemo Seufer 
874e6a05feSThiemo Seufer static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
884e6a05feSThiemo Seufer {
894e6a05feSThiemo Seufer 	struct mips_hi16 *n;
904e6a05feSThiemo Seufer 
914e6a05feSThiemo Seufer 	/*
924e6a05feSThiemo Seufer 	 * We cannot relocate this one now because we don't know the value of
934e6a05feSThiemo Seufer 	 * the carry we need to add.  Save the information, and let LO16 do the
944e6a05feSThiemo Seufer 	 * actual relocation.
954e6a05feSThiemo Seufer 	 */
964e6a05feSThiemo Seufer 	n = kmalloc(sizeof *n, GFP_KERNEL);
974e6a05feSThiemo Seufer 	if (!n)
984e6a05feSThiemo Seufer 		return -ENOMEM;
994e6a05feSThiemo Seufer 
1004e6a05feSThiemo Seufer 	n->addr = (Elf_Addr *)location;
1014e6a05feSThiemo Seufer 	n->value = v;
102861667dcSRalf Baechle 	n->next = me->arch.r_mips_hi16_list;
103861667dcSRalf Baechle 	me->arch.r_mips_hi16_list = n;
1044e6a05feSThiemo Seufer 
1054e6a05feSThiemo Seufer 	return 0;
1064e6a05feSThiemo Seufer }
1074e6a05feSThiemo Seufer 
108c54de490SRalf Baechle static void free_relocation_chain(struct mips_hi16 *l)
109c54de490SRalf Baechle {
110c54de490SRalf Baechle 	struct mips_hi16 *next;
111c54de490SRalf Baechle 
112c54de490SRalf Baechle 	while (l) {
113c54de490SRalf Baechle 		next = l->next;
114c54de490SRalf Baechle 		kfree(l);
115c54de490SRalf Baechle 		l = next;
116c54de490SRalf Baechle 	}
117c54de490SRalf Baechle }
118c54de490SRalf Baechle 
1194e6a05feSThiemo Seufer static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)
1204e6a05feSThiemo Seufer {
1214e6a05feSThiemo Seufer 	unsigned long insnlo = *location;
122c54de490SRalf Baechle 	struct mips_hi16 *l;
1234e6a05feSThiemo Seufer 	Elf_Addr val, vallo;
1244e6a05feSThiemo Seufer 
1254e6a05feSThiemo Seufer 	/* Sign extend the addend we extract from the lo insn.	*/
1264e6a05feSThiemo Seufer 	vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
1274e6a05feSThiemo Seufer 
128861667dcSRalf Baechle 	if (me->arch.r_mips_hi16_list != NULL) {
129861667dcSRalf Baechle 		l = me->arch.r_mips_hi16_list;
1304e6a05feSThiemo Seufer 		while (l != NULL) {
131c54de490SRalf Baechle 			struct mips_hi16 *next;
1324e6a05feSThiemo Seufer 			unsigned long insn;
1334e6a05feSThiemo Seufer 
1344e6a05feSThiemo Seufer 			/*
1354e6a05feSThiemo Seufer 			 * The value for the HI16 had best be the same.
1364e6a05feSThiemo Seufer 			 */
1374e6a05feSThiemo Seufer 			if (v != l->value)
1384e6a05feSThiemo Seufer 				goto out_danger;
1394e6a05feSThiemo Seufer 
1404e6a05feSThiemo Seufer 			/*
1414e6a05feSThiemo Seufer 			 * Do the HI16 relocation.  Note that we actually don't
1424e6a05feSThiemo Seufer 			 * need to know anything about the LO16 itself, except
1434e6a05feSThiemo Seufer 			 * where to find the low 16 bits of the addend needed
1444e6a05feSThiemo Seufer 			 * by the LO16.
1454e6a05feSThiemo Seufer 			 */
1464e6a05feSThiemo Seufer 			insn = *l->addr;
1474e6a05feSThiemo Seufer 			val = ((insn & 0xffff) << 16) + vallo;
1484e6a05feSThiemo Seufer 			val += v;
1494e6a05feSThiemo Seufer 
1504e6a05feSThiemo Seufer 			/*
1514e6a05feSThiemo Seufer 			 * Account for the sign extension that will happen in
1524e6a05feSThiemo Seufer 			 * the low bits.
1534e6a05feSThiemo Seufer 			 */
1544e6a05feSThiemo Seufer 			val = ((val >> 16) + ((val & 0x8000) != 0)) & 0xffff;
1554e6a05feSThiemo Seufer 
1564e6a05feSThiemo Seufer 			insn = (insn & ~0xffff) | val;
1574e6a05feSThiemo Seufer 			*l->addr = insn;
1584e6a05feSThiemo Seufer 
1594e6a05feSThiemo Seufer 			next = l->next;
1604e6a05feSThiemo Seufer 			kfree(l);
1614e6a05feSThiemo Seufer 			l = next;
1624e6a05feSThiemo Seufer 		}
1634e6a05feSThiemo Seufer 
164861667dcSRalf Baechle 		me->arch.r_mips_hi16_list = NULL;
1654e6a05feSThiemo Seufer 	}
1664e6a05feSThiemo Seufer 
1674e6a05feSThiemo Seufer 	/*
1684e6a05feSThiemo Seufer 	 * Ok, we're done with the HI16 relocs.	 Now deal with the LO16.
1694e6a05feSThiemo Seufer 	 */
1704e6a05feSThiemo Seufer 	val = v + vallo;
1714e6a05feSThiemo Seufer 	insnlo = (insnlo & ~0xffff) | (val & 0xffff);
1724e6a05feSThiemo Seufer 	*location = insnlo;
1734e6a05feSThiemo Seufer 
1744e6a05feSThiemo Seufer 	return 0;
1754e6a05feSThiemo Seufer 
1764e6a05feSThiemo Seufer out_danger:
177c54de490SRalf Baechle 	free_relocation_chain(l);
178c54de490SRalf Baechle 	me->arch.r_mips_hi16_list = NULL;
179d3cac35cSRalf Baechle 
1806f9fdeb6SRalf Baechle 	pr_err("module %s: dangerous R_MIPS_LO16 REL relocation\n", me->name);
1814e6a05feSThiemo Seufer 
1824e6a05feSThiemo Seufer 	return -ENOEXEC;
1834e6a05feSThiemo Seufer }
1844e6a05feSThiemo Seufer 
1855d3c7925SPaul Burton static int apply_r_mips_pc_rel(struct module *me, u32 *location, Elf_Addr v,
1865d3c7925SPaul Burton 			       unsigned bits)
1875d3c7925SPaul Burton {
1885d3c7925SPaul Burton 	unsigned long mask = GENMASK(bits - 1, 0);
1895d3c7925SPaul Burton 	unsigned long se_bits;
1905d3c7925SPaul Burton 	long offset;
1915d3c7925SPaul Burton 
1925d3c7925SPaul Burton 	if (v % 4) {
1935d3c7925SPaul Burton 		pr_err("module %s: dangerous R_MIPS_PC%u REL relocation\n",
1945d3c7925SPaul Burton 		       me->name, bits);
1955d3c7925SPaul Burton 		return -ENOEXEC;
1965d3c7925SPaul Burton 	}
1975d3c7925SPaul Burton 
1985d3c7925SPaul Burton 	/* retrieve & sign extend implicit addend */
1995d3c7925SPaul Burton 	offset = *location & mask;
2005d3c7925SPaul Burton 	offset |= (offset & BIT(bits - 1)) ? ~mask : 0;
2015d3c7925SPaul Burton 
2025d3c7925SPaul Burton 	offset += ((long)v - (long)location) >> 2;
2035d3c7925SPaul Burton 
2045d3c7925SPaul Burton 	/* check the sign bit onwards are identical - ie. we didn't overflow */
2055d3c7925SPaul Burton 	se_bits = (offset & BIT(bits - 1)) ? ~0ul : 0;
2065d3c7925SPaul Burton 	if ((offset & ~mask) != (se_bits & ~mask)) {
2075d3c7925SPaul Burton 		pr_err("module %s: relocation overflow\n", me->name);
2085d3c7925SPaul Burton 		return -ENOEXEC;
2095d3c7925SPaul Burton 	}
2105d3c7925SPaul Burton 
2115d3c7925SPaul Burton 	*location = (*location & ~mask) | (offset & mask);
2125d3c7925SPaul Burton 
2135d3c7925SPaul Burton 	return 0;
2145d3c7925SPaul Burton }
2155d3c7925SPaul Burton 
2165d3c7925SPaul Burton static int apply_r_mips_pc16_rel(struct module *me, u32 *location, Elf_Addr v)
2175d3c7925SPaul Burton {
2185d3c7925SPaul Burton 	return apply_r_mips_pc_rel(me, location, v, 16);
2195d3c7925SPaul Burton }
2205d3c7925SPaul Burton 
2215d3c7925SPaul Burton static int apply_r_mips_pc21_rel(struct module *me, u32 *location, Elf_Addr v)
2225d3c7925SPaul Burton {
2235d3c7925SPaul Burton 	return apply_r_mips_pc_rel(me, location, v, 21);
2245d3c7925SPaul Burton }
2255d3c7925SPaul Burton 
2265d3c7925SPaul Burton static int apply_r_mips_pc26_rel(struct module *me, u32 *location, Elf_Addr v)
2275d3c7925SPaul Burton {
2285d3c7925SPaul Burton 	return apply_r_mips_pc_rel(me, location, v, 26);
2295d3c7925SPaul Burton }
2305d3c7925SPaul Burton 
2314e6a05feSThiemo Seufer static int (*reloc_handlers_rel[]) (struct module *me, u32 *location,
2324e6a05feSThiemo Seufer 				Elf_Addr v) = {
2334e6a05feSThiemo Seufer 	[R_MIPS_NONE]		= apply_r_mips_none,
2344e6a05feSThiemo Seufer 	[R_MIPS_32]		= apply_r_mips_32_rel,
2354e6a05feSThiemo Seufer 	[R_MIPS_26]		= apply_r_mips_26_rel,
2364e6a05feSThiemo Seufer 	[R_MIPS_HI16]		= apply_r_mips_hi16_rel,
2375d3c7925SPaul Burton 	[R_MIPS_LO16]		= apply_r_mips_lo16_rel,
2385d3c7925SPaul Burton 	[R_MIPS_PC16]		= apply_r_mips_pc16_rel,
2395d3c7925SPaul Burton 	[R_MIPS_PC21_S2]	= apply_r_mips_pc21_rel,
2405d3c7925SPaul Burton 	[R_MIPS_PC26_S2]	= apply_r_mips_pc26_rel,
2414e6a05feSThiemo Seufer };
2424e6a05feSThiemo Seufer 
2434e6a05feSThiemo Seufer int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
2444e6a05feSThiemo Seufer 		   unsigned int symindex, unsigned int relsec,
2454e6a05feSThiemo Seufer 		   struct module *me)
2464e6a05feSThiemo Seufer {
2474e6a05feSThiemo Seufer 	Elf_Mips_Rel *rel = (void *) sechdrs[relsec].sh_addr;
24804211a57SPaul Burton 	int (*handler)(struct module *me, u32 *location, Elf_Addr v);
2494e6a05feSThiemo Seufer 	Elf_Sym *sym;
2504e6a05feSThiemo Seufer 	u32 *location;
25104211a57SPaul Burton 	unsigned int i, type;
2524e6a05feSThiemo Seufer 	Elf_Addr v;
2534e6a05feSThiemo Seufer 	int res;
2544e6a05feSThiemo Seufer 
2554e6a05feSThiemo Seufer 	pr_debug("Applying relocate section %u to %u\n", relsec,
2564e6a05feSThiemo Seufer 	       sechdrs[relsec].sh_info);
2574e6a05feSThiemo Seufer 
258861667dcSRalf Baechle 	me->arch.r_mips_hi16_list = NULL;
2594e6a05feSThiemo Seufer 	for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
2604e6a05feSThiemo Seufer 		/* This is where to make the change */
2614e6a05feSThiemo Seufer 		location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
2624e6a05feSThiemo Seufer 			+ rel[i].r_offset;
2634e6a05feSThiemo Seufer 		/* This is the symbol it is referring to */
2644e6a05feSThiemo Seufer 		sym = (Elf_Sym *)sechdrs[symindex].sh_addr
2654e6a05feSThiemo Seufer 			+ ELF_MIPS_R_SYM(rel[i]);
266ba837d38SAndrzej Hajda 		if (sym->st_value >= -MAX_ERRNO) {
267f3bf07b9SAtsushi Nemoto 			/* Ignore unresolved weak symbol */
268f3bf07b9SAtsushi Nemoto 			if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
269f3bf07b9SAtsushi Nemoto 				continue;
27055d791f3SSteven J. Hill 			pr_warn("%s: Unknown symbol %s\n",
2714e6a05feSThiemo Seufer 				me->name, strtab + sym->st_name);
2724e6a05feSThiemo Seufer 			return -ENOENT;
2734e6a05feSThiemo Seufer 		}
2744e6a05feSThiemo Seufer 
27504211a57SPaul Burton 		type = ELF_MIPS_R_TYPE(rel[i]);
2764e6a05feSThiemo Seufer 
27704211a57SPaul Burton 		if (type < ARRAY_SIZE(reloc_handlers_rel))
27804211a57SPaul Burton 			handler = reloc_handlers_rel[type];
27904211a57SPaul Burton 		else
28004211a57SPaul Burton 			handler = NULL;
28104211a57SPaul Burton 
28204211a57SPaul Burton 		if (!handler) {
28304211a57SPaul Burton 			pr_err("%s: Unknown relocation type %u\n",
28404211a57SPaul Burton 			       me->name, type);
28504211a57SPaul Burton 			return -EINVAL;
28604211a57SPaul Burton 		}
28704211a57SPaul Burton 
28804211a57SPaul Burton 		v = sym->st_value;
28904211a57SPaul Burton 		res = handler(me, location, v);
2904e6a05feSThiemo Seufer 		if (res)
2914e6a05feSThiemo Seufer 			return res;
2924e6a05feSThiemo Seufer 	}
2934e6a05feSThiemo Seufer 
294c54de490SRalf Baechle 	/*
295c54de490SRalf Baechle 	 * Normally the hi16 list should be deallocated at this point.	A
296c54de490SRalf Baechle 	 * malformed binary however could contain a series of R_MIPS_HI16
297c54de490SRalf Baechle 	 * relocations not followed by a R_MIPS_LO16 relocation.  In that
298c54de490SRalf Baechle 	 * case, free up the list and return an error.
299c54de490SRalf Baechle 	 */
300c54de490SRalf Baechle 	if (me->arch.r_mips_hi16_list) {
301c54de490SRalf Baechle 		free_relocation_chain(me->arch.r_mips_hi16_list);
302c54de490SRalf Baechle 		me->arch.r_mips_hi16_list = NULL;
303c54de490SRalf Baechle 
304c54de490SRalf Baechle 		return -ENOEXEC;
305c54de490SRalf Baechle 	}
306c54de490SRalf Baechle 
3074e6a05feSThiemo Seufer 	return 0;
3084e6a05feSThiemo Seufer }
3094e6a05feSThiemo Seufer 
3101da177e4SLinus Torvalds /* Given an address, look for it in the module exception tables. */
3111da177e4SLinus Torvalds const struct exception_table_entry *search_module_dbetables(unsigned long addr)
3121da177e4SLinus Torvalds {
3131da177e4SLinus Torvalds 	unsigned long flags;
3141da177e4SLinus Torvalds 	const struct exception_table_entry *e = NULL;
3151da177e4SLinus Torvalds 	struct mod_arch_specific *dbe;
3161da177e4SLinus Torvalds 
3171da177e4SLinus Torvalds 	spin_lock_irqsave(&dbe_lock, flags);
3181da177e4SLinus Torvalds 	list_for_each_entry(dbe, &dbe_list, dbe_list) {
3191da177e4SLinus Torvalds 		e = search_extable(dbe->dbe_start, dbe->dbe_end - 1, addr);
3201da177e4SLinus Torvalds 		if (e)
3211da177e4SLinus Torvalds 			break;
3221da177e4SLinus Torvalds 	}
3231da177e4SLinus Torvalds 	spin_unlock_irqrestore(&dbe_lock, flags);
3241da177e4SLinus Torvalds 
3251da177e4SLinus Torvalds 	/* Now, if we found one, we are running inside it now, hence
3261da177e4SLinus Torvalds 	   we cannot unload the module, hence no refcnt needed. */
3271da177e4SLinus Torvalds 	return e;
3281da177e4SLinus Torvalds }
3291da177e4SLinus Torvalds 
3303a4fa0a2SRobert P. J. Day /* Put in dbe list if necessary. */
3311da177e4SLinus Torvalds int module_finalize(const Elf_Ehdr *hdr,
3321da177e4SLinus Torvalds 		    const Elf_Shdr *sechdrs,
3331da177e4SLinus Torvalds 		    struct module *me)
3341da177e4SLinus Torvalds {
3351da177e4SLinus Torvalds 	const Elf_Shdr *s;
3361da177e4SLinus Torvalds 	char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
3371da177e4SLinus Torvalds 
33894bb0c1aSDavid Daney 	/* Make jump label nops. */
33994bb0c1aSDavid Daney 	jump_label_apply_nops(me);
34094bb0c1aSDavid Daney 
3411da177e4SLinus Torvalds 	INIT_LIST_HEAD(&me->arch.dbe_list);
3421da177e4SLinus Torvalds 	for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
3431da177e4SLinus Torvalds 		if (strcmp("__dbe_table", secstrings + s->sh_name) != 0)
3441da177e4SLinus Torvalds 			continue;
3451da177e4SLinus Torvalds 		me->arch.dbe_start = (void *)s->sh_addr;
3461da177e4SLinus Torvalds 		me->arch.dbe_end = (void *)s->sh_addr + s->sh_size;
3471da177e4SLinus Torvalds 		spin_lock_irq(&dbe_lock);
3481da177e4SLinus Torvalds 		list_add(&me->arch.dbe_list, &dbe_list);
3491da177e4SLinus Torvalds 		spin_unlock_irq(&dbe_lock);
3501da177e4SLinus Torvalds 	}
3511da177e4SLinus Torvalds 	return 0;
3521da177e4SLinus Torvalds }
3531da177e4SLinus Torvalds 
3541da177e4SLinus Torvalds void module_arch_cleanup(struct module *mod)
3551da177e4SLinus Torvalds {
3561da177e4SLinus Torvalds 	spin_lock_irq(&dbe_lock);
3571da177e4SLinus Torvalds 	list_del(&mod->arch.dbe_list);
3581da177e4SLinus Torvalds 	spin_unlock_irq(&dbe_lock);
3591da177e4SLinus Torvalds }
360