[kernel] enable crash on other architectures

Josh Boyer jwboyer at fedoraproject.org
Tue Nov 5 23:58:10 UTC 2013


On Tue, Nov 5, 2013 at 4:50 PM, Kyle McMartin <kyle at fedoraproject.org> wrote:
> commit 0a346ea31151e4f114eb0cdb3aa25a55f300bae5
> Author: Kyle McMartin <kyle at fedoraproject.org>
> Date:   Tue Nov 5 16:51:00 2013 -0500
>
>     enable crash on other architectures

Er, why?  We've debated several times just dropping crash entirely.

Also, please post for review first.

>  config-arm-generic     |    2 +
>  config-powerpc-generic |    2 +
>  config-s390x           |    2 +
>  crash-driver.patch     |  270 +++++++++++++++++++++++++++++++++++-------------
>  kernel.spec            |    3 +
>  5 files changed, 205 insertions(+), 74 deletions(-)
> ---
> diff --git a/config-arm-generic b/config-arm-generic
> index aaa88ee..a0cf6e6 100644
> --- a/config-arm-generic
> +++ b/config-arm-generic
> @@ -149,3 +149,5 @@ CONFIG_SMC911X=m
>  # CONFIG_SCSI_IPS is not set
>  # CONFIG_SCSI_CXGB3_ISCSI is not set
>  # CONFIG_SCSI_CXGB4_ISCSI is not set
> +
> +CONFIG_CRASH=m
> diff --git a/config-powerpc-generic b/config-powerpc-generic
> index 2037e89..7ba1a5d 100644
> --- a/config-powerpc-generic
> +++ b/config-powerpc-generic
> @@ -379,3 +379,5 @@ CONFIG_BACKLIGHT_PWM=m
>  CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=n
>
>  CONFIG_XZ_DEC_POWERPC=y
> +
> +CONFIG_CRASH=m
> diff --git a/config-s390x b/config-s390x
> index c81b679..f9f1f82 100644
> --- a/config-s390x
> +++ b/config-s390x
> @@ -277,3 +277,5 @@ CONFIG_SCM_BLOCK_CLUSTER_WRITE=y
>  # CONFIG_IEEE802154_DRIVERS is not set
>
>  # CONFIG_FMC is not set
> +
> +CONFIG_CRASH=m
> diff --git a/crash-driver.patch b/crash-driver.patch
> index a7b7b72..61c5dfd 100644
> --- a/crash-driver.patch
> +++ b/crash-driver.patch
> @@ -1,24 +1,57 @@
> -From f72d640713d01b3b704c6e84ab49b62f19fc9c22 Mon Sep 17 00:00:00 2001
> -From: Kyle McMartin <kyle at phobos.i.jkkm.org>
> -Date: Tue, 30 Mar 2010 00:16:25 -0400
> -Subject: [PATCH] dev-crash-driver.patch
> +From 9fcd8dd1ccc20ea8d466d48e887e92b832e22d56 Mon Sep 17 00:00:00 2001
> +From: Kyle McMartin <kyle at dreadnought.bos.jkkm.org>
> +Date: Tue, 5 Nov 2013 13:16:00 -0500
> +Subject: [PATCH] crash-driver
>
>  ---
> - arch/ia64/include/asm/crash.h |   90 +++++++++++++++++++++++++++++
> - arch/ia64/kernel/ia64_ksyms.c |    3 +
> - arch/x86/include/asm/crash.h  |   75 ++++++++++++++++++++++++
> - arch/x86/mm/ioremap.c         |    2 +
> - drivers/char/Kconfig          |    3 +
> - drivers/char/Makefile         |    2 +
> - drivers/char/crash.c          |  128 +++++++++++++++++++++++++++++++++++++++++
> - 7 files changed, 303 insertions(+), 0 deletions(-)
> + arch/arm/include/asm/crash.h     |   6 ++
> + arch/arm64/include/asm/crash.h   |   6 ++
> + arch/ia64/include/asm/crash.h    |  90 +++++++++++++++++++++++++++
> + arch/ia64/kernel/ia64_ksyms.c    |   3 +
> + arch/powerpc/include/asm/crash.h |   6 ++
> + arch/s390/include/asm/crash.h    |  60 ++++++++++++++++++
> + arch/x86/include/asm/crash.h     |   6 ++
> + drivers/char/Kconfig             |   3 +
> + drivers/char/Makefile            |   2 +
> + drivers/char/crash.c             | 128 +++++++++++++++++++++++++++++++++++++++
> + include/asm-generic/crash.h      |  72 ++++++++++++++++++++++
> + 11 files changed, 382 insertions(+)
> + create mode 100644 arch/arm/include/asm/crash.h
> + create mode 100644 arch/arm64/include/asm/crash.h
>   create mode 100644 arch/ia64/include/asm/crash.h
> + create mode 100644 arch/powerpc/include/asm/crash.h
> + create mode 100644 arch/s390/include/asm/crash.h
>   create mode 100644 arch/x86/include/asm/crash.h
>   create mode 100644 drivers/char/crash.c
> + create mode 100644 include/asm-generic/crash.h
>
> +diff --git a/arch/arm/include/asm/crash.h b/arch/arm/include/asm/crash.h
> +new file mode 100644
> +index 0000000..1d2e537
> +--- /dev/null
> ++++ b/arch/arm/include/asm/crash.h
> +@@ -0,0 +1,6 @@
> ++#ifndef _ARM_CRASH_H
> ++#define _ARM_CRASH_H
> ++
> ++#include <asm-generic/crash.h>
> ++
> ++#endif /* _ARM_CRASH_H */
> +diff --git a/arch/arm64/include/asm/crash.h b/arch/arm64/include/asm/crash.h
> +new file mode 100644
> +index 0000000..a7fcc28
> +--- /dev/null
> ++++ b/arch/arm64/include/asm/crash.h
> +@@ -0,0 +1,6 @@
> ++#ifndef _ARM64_CRASH_H
> ++#define _ARM64_CRASH_H
> ++
> ++#include <asm-generic/crash.h>
> ++
> ++#endif /* _ARM64_CRASH_H */
>  diff --git a/arch/ia64/include/asm/crash.h b/arch/ia64/include/asm/crash.h
>  new file mode 100644
> -index 0000000..541af84
> +index 0000000..28bd955
>  --- /dev/null
>  +++ b/arch/ia64/include/asm/crash.h
>  @@ -0,0 +1,90 @@
> @@ -68,7 +101,7 @@ index 0000000..541af84
>  +                      return NULL;
>  +      }
>  +
> -+      switch (type = efi_mem_type(offset))
> ++      switch (type = efi_mem_type(offset))
>  +      {
>  +      case EFI_LOADER_CODE:
>  +      case EFI_LOADER_DATA:
> @@ -79,7 +112,7 @@ index 0000000..541af84
>  +
>  +      default:
>  +              printk(KERN_INFO
> -+                  "crash memory driver: invalid memory type for %lx: %d\n",
> ++                  "crash memory driver: invalid memory type for %lx: %d\n",
>  +                      offset, type);
>  +              return NULL;
>  +      }
> @@ -96,7 +129,7 @@ index 0000000..541af84
>  +
>  +      if (!page->virtual) {
>  +              printk(KERN_INFO
> -+                  "crash memory driver: offset: %lx page: %lx page->virtual: NULL\n",
> ++                  "crash memory driver: offset: %lx page: %lx page->virtual: NULL\n",
>  +                      offset, (unsigned long)page);
>  +              return NULL;
>  +      }
> @@ -104,8 +137,8 @@ index 0000000..541af84
>  +      return (page->virtual + (offset & (PAGE_SIZE-1)));
>  +}
>  +
> -+static inline void unmap_virtual(struct page *page)
> -+{
> ++static inline void unmap_virtual(struct page *page)
> ++{
>  +      return;
>  +}
>  +
> @@ -113,7 +146,7 @@ index 0000000..541af84
>  +
>  +#endif /* _ASM_IA64_CRASH_H */
>  diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
> -index 7f4a0ed..552fe24 100644
> +index 5b7791d..aee4b87 100644
>  --- a/arch/ia64/kernel/ia64_ksyms.c
>  +++ b/arch/ia64/kernel/ia64_ksyms.c
>  @@ -84,6 +84,9 @@ EXPORT_SYMBOL(ia64_save_scratch_fpregs);
> @@ -126,50 +159,47 @@ index 7f4a0ed..552fe24 100644
>   #if defined(CONFIG_IA64_ESI) || defined(CONFIG_IA64_ESI_MODULE)
>   extern void esi_call_phys (void);
>   EXPORT_SYMBOL_GPL(esi_call_phys);

We could probably drop ia64 from this patch entirely, couldn't we?
Nobody that I'm aware of supports Fedora on ia64.

> -diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h
> +diff --git a/arch/powerpc/include/asm/crash.h b/arch/powerpc/include/asm/crash.h
>  new file mode 100644
> -index 0000000..dfcc006
> +index 0000000..daa8c4d
>  --- /dev/null
> -+++ b/arch/x86/include/asm/crash.h
> -@@ -0,0 +1,73 @@
> -+#ifndef _ASM_I386_CRASH_H
> -+#define _ASM_I386_CRASH_H
> ++++ b/arch/powerpc/include/asm/crash.h
> +@@ -0,0 +1,6 @@
> ++#ifndef _PPC64_CRASH_H
> ++#define _PPC64_CRASH_H
>  +
> -+/*
> -+ * linux/include/asm-i386/crash.h
> -+ *
> -+ * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
> -+ *
> -+ * This program is free software; you can redistribute it and/or modify
> -+ * it under the terms of the GNU General Public License as published by
> -+ * the Free Software Foundation; either version 2, or (at your option)
> -+ * any later version.
> -+ *
> -+ * This program is distributed in the hope that it will be useful,
> -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
> -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -+ * GNU General Public License for more details.
> -+ *
> -+ * You should have received a copy of the GNU General Public License
> -+ * along with this program; if not, write to the Free Software
> -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> -+ *
> -+ */
> ++#include <asm-generic/crash.h>
> ++
> ++#endif /* _PPC64_CRASH_H */
> +diff --git a/arch/s390/include/asm/crash.h b/arch/s390/include/asm/crash.h
> +new file mode 100644
> +index 0000000..552be5e
> +--- /dev/null
> ++++ b/arch/s390/include/asm/crash.h
> +@@ -0,0 +1,60 @@
> ++#ifndef _S390_CRASH_H
> ++#define _S390_CRASH_H
>  +
>  +#ifdef __KERNEL__
>  +
>  +#include <linux/mm.h>
>  +#include <linux/highmem.h>
> -+#include <asm/mmzone.h>
>  +
> -+static inline void *
> -+map_virtual(u64 offset, struct page **pp)
> ++/*
> ++ * For swapped prefix pages get bounce buffer using xlate_dev_mem_ptr()
> ++ */
> ++static inline void *map_virtual(u64 offset, struct page **pp)
>  +{
>  +      struct page *page;
>  +      unsigned long pfn;
>  +      void *vaddr;
>  +
> -+      pfn = (unsigned long)(offset >> PAGE_SHIFT);
> ++      vaddr = xlate_dev_mem_ptr(offset);
> ++      pfn = ((unsigned long) vaddr) >> PAGE_SHIFT;
> ++      if ((unsigned long) vaddr != offset)
> ++              page = pfn_to_page(pfn);
> ++      else
> ++              page = NULL;
>  +
>  +      if (!page_is_ram(pfn)) {
>  +              printk(KERN_INFO
> @@ -183,30 +213,44 @@ index 0000000..dfcc006
>  +              return NULL;
>  +      }
>  +
> -+      page = pfn_to_page(pfn);
> -+
> -+      vaddr = kmap(page);
> -+      if (!vaddr) {
> -+              printk(KERN_INFO
> -+                  "crash memory driver: pfn: %lx kmap(page: %lx) failed\n",
> -+                      pfn, (unsigned long)page);
> -+              return NULL;
> -+      }
> -+
>  +      *pp = page;
> -+      return (vaddr + (offset & (PAGE_SIZE-1)));
> ++      return vaddr;
>  +}
>  +
> -+static inline void unmap_virtual(struct page *page)
> -+{
> -+      kunmap(page);
> ++/*
> ++ * Free bounce buffer if necessary
> ++ */
> ++static inline void unmap_virtual(struct page *page)
> ++{
> ++      void *vaddr;
> ++
> ++      if (page) {
> ++              /*
> ++               * Because for bounce buffers vaddr will never be 0
> ++               * unxlate_dev_mem_ptr() will always free the bounce buffer.
> ++               */
> ++              vaddr = (void *)(page_to_pfn(page) << PAGE_SHIFT);
> ++              unxlate_dev_mem_ptr(0, vaddr);
> ++      }
>  +}
>  +
>  +#endif /* __KERNEL__ */
>  +
> -+#endif /* _ASM_I386_CRASH_H */
> ++#endif /* _S390_CRASH_H */

Was this requested by the s390x guys?

josh


More information about the kernel mailing list