From 47bcbf5587583067fdc1cc954bc6bca9484242e7 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Tue, 24 May 2011 22:20:21 +0200 Subject: [PATCH 1/1] patches for 2.6.32 to work as a kexecd kernel --- ...rm-invalidate-TLBs-when-enabling-mmu.patch | 26 +++ ...it_atags_procfs-to-check-tag-hdrsize.patch | 177 ++++++++++++++++++ ...sh-h-and-remove-unnecessary-comments.patch | 120 ++++++++++++ 3 files changed, 323 insertions(+) create mode 100644 kernel-patches/0001-arm-invalidate-TLBs-when-enabling-mmu.patch create mode 100644 kernel-patches/0004-arm-fix-init_atags_procfs-to-check-tag-hdrsize.patch create mode 100644 kernel-patches/0005-arm-fix-typo-in-cacheflush-h-and-remove-unnecessary-comments.patch diff --git a/kernel-patches/0001-arm-invalidate-TLBs-when-enabling-mmu.patch b/kernel-patches/0001-arm-invalidate-TLBs-when-enabling-mmu.patch new file mode 100644 index 0000000..4069871 --- /dev/null +++ b/kernel-patches/0001-arm-invalidate-TLBs-when-enabling-mmu.patch @@ -0,0 +1,26 @@ +From f8a6bbe8437ae48f5638a58472e5bb8c3f9101cf Mon Sep 17 00:00:00 2001 +From: Saeed Bishara +Date: Sun, 14 Feb 2010 18:28:46 +0200 +Subject: [PATCH] arm: invalidate TLBs when enabling mmu + + +Signed-off-by: Saeed Bishara +--- + arch/arm/boot/compressed/head.S | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S +index 40ef902..f421d06 100644 +--- a/arch/arm/boot/compressed/head.S ++++ b/arch/arm/boot/compressed/head.S +@@ -481,6 +481,7 @@ __armv7_mmu_cache_on: + mcr p15, 0, r0, c1, c0, 0 @ load control register + mrc p15, 0, r0, c1, c0, 0 @ and read it back + mov r0, #0 ++ mcr p15, 0, r0, c8, c7, 0 @ invalidate I,D TLBs + mcr p15, 0, r0, c7, c5, 4 @ ISB + mov pc, r12 + +-- +1.6.0.4 + diff --git a/kernel-patches/0004-arm-fix-init_atags_procfs-to-check-tag-hdrsize.patch b/kernel-patches/0004-arm-fix-init_atags_procfs-to-check-tag-hdrsize.patch new file mode 100644 index 0000000..84717a1 --- /dev/null +++ b/kernel-patches/0004-arm-fix-init_atags_procfs-to-check-tag-hdrsize.patch @@ -0,0 +1,177 @@ + +Delivered-To: eric.y.miao@gmail.com +Received: by 10.229.89.5 with SMTP id c5cs439662qcm; + Fri, 18 Dec 2009 19:48:56 -0800 (PST) +Received: by 10.220.122.229 with SMTP id m37mr3710050vcr.75.1261194536337; + Fri, 18 Dec 2009 19:48:56 -0800 (PST) +Return-Path: +Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) + by mx.google.com with ESMTP id 15si5178130vws.113.2009.12.18.19.48.55; + Fri, 18 Dec 2009 19:48:56 -0800 (PST) +Received-SPF: neutral (google.com: 18.85.46.34 is neither permitted nor denied by domain of linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org) client-ip=18.85.46.34; +Authentication-Results: mx.google.com; spf=neutral (google.com: 18.85.46.34 is neither permitted nor denied by domain of linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org) smtp.mail=linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) + id 1NLqHA-0005fo-Vx; Sat, 19 Dec 2009 03:46:40 +0000 +Received: from mho-01-ewr.mailhop.org ([204.13.248.71]) + by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) + id 1NLqH4-0005fB-Se for linux-arm-kernel@lists.infradead.org; + Sat, 19 Dec 2009 03:46:39 +0000 +Received: from c-67-160-239-110.hsd1.ca.comcast.net ([67.160.239.110] + helo=[127.0.0.1]) by mho-01-ewr.mailhop.org with esmtpa (Exim 4.68) + (envelope-from ) + id 1NLqH4-000HuN-CC; Sat, 19 Dec 2009 03:46:34 +0000 +X-Mail-Handler: MailHop Outbound by DynDNS +X-Originating-IP: 67.160.239.110 +X-Report-Abuse-To: abuse@dyndns.com (see + http://www.dyndns.com/services/mailhop/outbound_abuse.html for + abuse reporting information) +X-MHO-User: U2FsdGVkX1+sI1hhEpkgqBCPoi5GTu+G +Subject: [PATCH 4/5] arm: Fix init_atags_procfs() to check tag->hdr.size +To: linux-arm-kernel@lists.infradead.org +From: Tony Lindgren +Date: Fri, 18 Dec 2009 19:46:30 -0800 +Message-ID: <20091219034630.26198.35713.stgit@localhost> +In-Reply-To: <20091219034151.26198.26570.stgit@localhost> +References: <20091219034151.26198.26570.stgit@localhost> +User-Agent: StGit/0.15-6-gbbd0 +MIME-Version: 1.0 +X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) + MR-646709E3 +X-CRM114-CacheID: sfid-20091218_224635_034795_3362075B +X-CRM114-Status: GOOD ( 24.83 ) +X-Spam-Score: 0.0 (/) +X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: + Content analysis details: (0.0 points) + pts rule name description + ---- ---------------------- + -------------------------------------------------- _SUMMARY_ +Cc: linux-omap@vger.kernel.org +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.12 +Precedence: list +List-Id: +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Sender: linux-arm-kernel-bounces@lists.infradead.org +Errors-To: linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org + +The tag->hdr.size cannot be larger than XXX. +Otherwise we can getsomething similar during boot: + +Unable to handle kernel paging request at virtual address 61a05020 +... + +Signed-off-by: Tony Lindgren +--- + arch/arm/include/asm/setup.h | 12 +++++++++--- + arch/arm/kernel/atags.c | 2 +- + arch/arm/kernel/compat.c | 2 +- + arch/arm/kernel/setup.c | 4 ++-- + arch/arm/mach-orion5x/common.c | 2 +- + 5 files changed, 14 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h +index 5ccce0a..3ca36bb 100644 +--- a/arch/arm/include/asm/setup.h ++++ b/arch/arm/include/asm/setup.h +@@ -21,6 +21,11 @@ + /* The list ends with an ATAG_NONE node. */ + #define ATAG_NONE 0x00000000 + ++/* Some sanity checks are needed */ ++#define ATAG_MAX_SZ PAGE_SIZE ++#define atag_valid(tag) \ ++ ((tag)->hdr.size && ((tag)->hdr.size <= ATAG_MAX_SZ)) ++ + struct tag_header { + __u32 size; + __u32 tag; +@@ -173,9 +178,10 @@ struct tagtable { + int (*parse)(const struct tag *); + }; + +-#define tag_member_present(tag,member) \ +- ((unsigned long)(&((struct tag *)0L)->member + 1) \ +- <= (tag)->hdr.size * 4) ++#define tag_member_present(tag,member) \ ++ (atag_valid(tag) && \ ++ (((unsigned long)(&((struct tag *)0L)->member + 1) \ ++ <= (tag)->hdr.size * 4)) + + #define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size)) + #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) +diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags.c +index 42a1a14..14d0993 100644 +--- a/arch/arm/kernel/atags.c ++++ b/arch/arm/kernel/atags.c +@@ -51,7 +51,7 @@ static int __init init_atags_procfs(void) + return -EINVAL; + } + +- for (; tag->hdr.size; tag = tag_next(tag)) ++ for (; atag_valid(tag); tag = tag_next(tag)) + ; + + /* include the terminating ATAG_NONE */ +diff --git a/arch/arm/kernel/compat.c b/arch/arm/kernel/compat.c +index 0a13854..3e63ee1 100644 +--- a/arch/arm/kernel/compat.c ++++ b/arch/arm/kernel/compat.c +@@ -220,7 +220,7 @@ void __init convert_to_tag_list(struct tag *tags) + + void __init squash_mem_tags(struct tag *tag) + { +- for (; tag->hdr.size; tag = tag_next(tag)) ++ for (; atag_valid(tag); tag = tag_next(tag)) + if (tag->hdr.tag == ATAG_MEM) + tag->hdr.tag = ATAG_NONE; + } +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c +index c6c57b6..53d7181 100644 +--- a/arch/arm/kernel/setup.c ++++ b/arch/arm/kernel/setup.c +@@ -556,7 +556,7 @@ request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc) + */ + static int __init parse_tag_core(const struct tag *tag) + { +- if (tag->hdr.size > 2) { ++ if ((atag_valid(tag) && (tag->hdr.size > 2))) { + if ((tag->u.core.flags & 1) == 0) + root_mountflags &= ~MS_RDONLY; + ROOT_DEV = old_decode_dev(tag->u.core.rootdev); +@@ -660,7 +660,7 @@ static int __init parse_tag(const struct tag *tag) + */ + static void __init parse_tags(const struct tag *t) + { +- for (; t->hdr.size; t = tag_next(t)) ++ for (; atag_valid(t); t = tag_next(t)) + if (!parse_tag(t)) + printk(KERN_WARNING + "Ignoring unrecognised tag 0x%08x\n", +diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c +index f87fa12..8afee34 100644 +--- a/arch/arm/mach-orion5x/common.c ++++ b/arch/arm/mach-orion5x/common.c +@@ -717,7 +717,7 @@ void __init orion5x_init(void) + void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t, + char **from, struct meminfo *meminfo) + { +- for (; t->hdr.size; t = tag_next(t)) ++ for (; atag_valid(t); t = tag_next(t)) + if (t->hdr.tag == ATAG_MEM && + (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK || + t->u.mem.start & ~PAGE_MASK)) { + + +_______________________________________________ +linux-arm-kernel mailing list +linux-arm-kernel@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/kernel-patches/0005-arm-fix-typo-in-cacheflush-h-and-remove-unnecessary-comments.patch b/kernel-patches/0005-arm-fix-typo-in-cacheflush-h-and-remove-unnecessary-comments.patch new file mode 100644 index 0000000..d87f3c5 --- /dev/null +++ b/kernel-patches/0005-arm-fix-typo-in-cacheflush-h-and-remove-unnecessary-comments.patch @@ -0,0 +1,120 @@ + +Delivered-To: eric.y.miao@gmail.com +Received: by 10.229.89.5 with SMTP id c5cs439661qcm; + Fri, 18 Dec 2009 19:48:56 -0800 (PST) +Received: by 10.220.121.203 with SMTP id i11mr3689463vcr.51.1261194536336; + Fri, 18 Dec 2009 19:48:56 -0800 (PST) +Return-Path: +Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) + by mx.google.com with ESMTP id 28si5192987vws.112.2009.12.18.19.48.55; + Fri, 18 Dec 2009 19:48:56 -0800 (PST) +Received-SPF: neutral (google.com: 18.85.46.34 is neither permitted nor denied by domain of linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org) client-ip=18.85.46.34; +Authentication-Results: mx.google.com; spf=neutral (google.com: 18.85.46.34 is neither permitted nor denied by domain of linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org) smtp.mail=linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) + id 1NLqHL-0005gu-T7; Sat, 19 Dec 2009 03:46:51 +0000 +Received: from mho-02-ewr.mailhop.org ([204.13.248.72]) + by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) + id 1NLqHG-0005g5-0G for linux-arm-kernel@lists.infradead.org; + Sat, 19 Dec 2009 03:46:50 +0000 +Received: from c-67-160-239-110.hsd1.ca.comcast.net ([67.160.239.110] + helo=[127.0.0.1]) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.68) + (envelope-from ) + id 1NLqHF-0000m7-KU; Sat, 19 Dec 2009 03:46:45 +0000 +X-Mail-Handler: MailHop Outbound by DynDNS +X-Originating-IP: 67.160.239.110 +X-Report-Abuse-To: abuse@dyndns.com (see + http://www.dyndns.com/services/mailhop/outbound_abuse.html for + abuse reporting information) +X-MHO-User: U2FsdGVkX18k2SKO6fppqloB4saxBGWQ +Subject: [PATCH 5/5] arm: Fix typo in cacheflush.h and remove unnecessary + comments +To: linux-arm-kernel@lists.infradead.org +From: Tony Lindgren +Date: Fri, 18 Dec 2009 19:46:44 -0800 +Message-ID: <20091219034644.26198.28856.stgit@localhost> +In-Reply-To: <20091219034151.26198.26570.stgit@localhost> +References: <20091219034151.26198.26570.stgit@localhost> +User-Agent: StGit/0.15-6-gbbd0 +MIME-Version: 1.0 +X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) + MR-646709E3 +X-CRM114-CacheID: sfid-20091218_224646_095455_D5BC1139 +X-CRM114-Status: GOOD ( 16.66 ) +X-Spam-Score: 0.0 (/) +X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: + Content analysis details: (0.0 points) + pts rule name description + ---- ---------------------- + -------------------------------------------------- _SUMMARY_ +Cc: linux-omap@vger.kernel.org +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.12 +Precedence: list +List-Id: +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Sender: linux-arm-kernel-bounces@lists.infradead.org +Errors-To: linux-arm-kernel-bounces+eric.y.miao=gmail.com@lists.infradead.org + +While dealing with the kexec fixes, I noticed these. + +Signed-off-by: Tony Lindgren +--- + arch/arm/include/asm/cacheflush.h | 2 +- + arch/arm/mm/proc-v6.S | 2 -- + arch/arm/mm/proc-v7.S | 2 -- + 3 files changed, 1 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h +index 730aefc..e9fb1d3 100644 +--- a/arch/arm/include/asm/cacheflush.h ++++ b/arch/arm/include/asm/cacheflush.h +@@ -154,7 +154,7 @@ + * Please note that the implementation of these, and the required + * effects are cache-type (VIVT/VIPT/PIPT) specific. + * +- * flush_cache_kern_all() ++ * flush_cache_all() + * + * Unconditionally clean and invalidate the entire cache. + * +diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S +index 395cc90..7a5337e 100644 +--- a/arch/arm/mm/proc-v6.S ++++ b/arch/arm/mm/proc-v6.S +@@ -59,8 +59,6 @@ ENTRY(cpu_v6_proc_fin) + * to what would be the reset vector. + * + * - loc - location to jump to for soft reset +- * +- * It is assumed that: + */ + .align 5 + ENTRY(cpu_v6_reset) +diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S +index d2a8074..7aaf88a 100644 +--- a/arch/arm/mm/proc-v7.S ++++ b/arch/arm/mm/proc-v7.S +@@ -63,8 +63,6 @@ ENDPROC(cpu_v7_proc_fin) + * to what would be the reset vector. + * + * - loc - location to jump to for soft reset +- * +- * It is assumed that: + */ + .align 5 + ENTRY(cpu_v7_reset) + + +_______________________________________________ +linux-arm-kernel mailing list +linux-arm-kernel@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- 2.39.5