Merge tag 'for-5.15/parisc' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Sep 2021 20:16:00 +0000 (13:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Sep 2021 20:16:00 +0000 (13:16 -0700)
Pull parisc architecture updates from Helge Deller:

 - Fix a kernel crash when a signal is delivered to bad userspace stack

 - Fix fall-through warnings in math-emu code

 - Increase size of gcc stack frame check

 - Switch coding from 'pci_' to 'dma_' API

 - Make struct parisc_driver::remove() return void

 - Some parisc related Makefile changes

 - Minor cleanups, e.g. change to octal permissions, fix macro
   collisions, fix PMD_ORDER collision, replace spaces with tabs

* tag 'for-5.15/parisc' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: math-emu: Fix fall-through warnings
  parisc: fix crash with signals and alloca
  parisc: Fix compile failure when building 64-bit kernel natively
  parisc: ccio-dma.c: Added tab instead of spaces
  parisc/parport_gsc: switch from 'pci_' to 'dma_' API
  parisc: move core-y in arch/parisc/Makefile to arch/parisc/Kbuild
  parisc: switch from 'pci_' to 'dma_' API
  parisc: Make struct parisc_driver::remove() return void
  parisc: remove unused arch/parisc/boot/install.sh and its phony target
  parisc: Rename PMD_ORDER to PMD_TABLE_ORDER
  parisc: math-emu: Avoid "fmt" macro collision
  parisc: Increase size of gcc stack frame check
  parisc: Replace symbolic permissions with octal permissions

1  2 
Makefile
drivers/parisc/ccio-dma.c
lib/Kconfig.debug
sound/parisc/harmony.c

diff --combined Makefile
+++ b/Makefile
@@@ -404,6 -404,11 +404,11 @@@ ifeq ($(ARCH),sparc64
         SRCARCH := sparc
  endif
  
+ # Additional ARCH settings for parisc
+ ifeq ($(ARCH),parisc64)
+        SRCARCH := parisc
+ endif
  export cross_compiling :=
  ifneq ($(SRCARCH),$(SUBARCH))
  cross_compiling := 1
@@@ -841,11 -846,6 +846,11 @@@ endi
  # for the randomize_kstack_offset feature. Disable it for all compilers.
  KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
  
 +# Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
 +ifdef CONFIG_ZERO_CALL_USED_REGS
 +KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
 +endif
 +
  DEBUG_CFLAGS  :=
  
  # Workaround for GCC versions < 5.0
  #define CMD_TLB_PURGE        33         /* IO_COMMAND to Purge I/O TLB entry */
  
  struct ioa_registers {
-         /* Runway Supervisory Set */
-         int32_t    unused1[12];
-         uint32_t   io_command;             /* Offset 12 */
-         uint32_t   io_status;              /* Offset 13 */
-         uint32_t   io_control;             /* Offset 14 */
-         int32_t    unused2[1];
-         /* Runway Auxiliary Register Set */
-         uint32_t   io_err_resp;            /* Offset  0 */
-         uint32_t   io_err_info;            /* Offset  1 */
-         uint32_t   io_err_req;             /* Offset  2 */
-         uint32_t   io_err_resp_hi;         /* Offset  3 */
-         uint32_t   io_tlb_entry_m;         /* Offset  4 */
-         uint32_t   io_tlb_entry_l;         /* Offset  5 */
-         uint32_t   unused3[1];
-         uint32_t   io_pdir_base;           /* Offset  7 */
-         uint32_t   io_io_low_hv;           /* Offset  8 */
-         uint32_t   io_io_high_hv;          /* Offset  9 */
-         uint32_t   unused4[1];
-         uint32_t   io_chain_id_mask;       /* Offset 11 */
-         uint32_t   unused5[2];
-         uint32_t   io_io_low;              /* Offset 14 */
-         uint32_t   io_io_high;             /* Offset 15 */
+       /* Runway Supervisory Set */
+       int32_t    unused1[12];
+       uint32_t   io_command;             /* Offset 12 */
+       uint32_t   io_status;              /* Offset 13 */
+       uint32_t   io_control;             /* Offset 14 */
+       int32_t    unused2[1];
+       /* Runway Auxiliary Register Set */
+       uint32_t   io_err_resp;            /* Offset  0 */
+       uint32_t   io_err_info;            /* Offset  1 */
+       uint32_t   io_err_req;             /* Offset  2 */
+       uint32_t   io_err_resp_hi;         /* Offset  3 */
+       uint32_t   io_tlb_entry_m;         /* Offset  4 */
+       uint32_t   io_tlb_entry_l;         /* Offset  5 */
+       uint32_t   unused3[1];
+       uint32_t   io_pdir_base;           /* Offset  7 */
+       uint32_t   io_io_low_hv;           /* Offset  8 */
+       uint32_t   io_io_high_hv;          /* Offset  9 */
+       uint32_t   unused4[1];
+       uint32_t   io_chain_id_mask;       /* Offset 11 */
+       uint32_t   unused5[2];
+       uint32_t   io_io_low;              /* Offset 14 */
+       uint32_t   io_io_high;             /* Offset 15 */
  };
  
  /*
  ** In order for a Runway address to reside within GSC+ extended address space:
  **    Runway Address [0:7]    must identically compare to 8'b11111111
  **    Runway Address [8:11]   must be equal to IO_IO_LOW(_HV)[16:19]
- **    Runway Address [12:23]  must be greater than or equal to
+ **    Runway Address [12:23]  must be greater than or equal to
  **               IO_IO_LOW(_HV)[20:31] and less than IO_IO_HIGH(_HV)[20:31].
  **    Runway Address [24:39]  is not used in the comparison.
  **
@@@ -226,10 -226,10 +226,10 @@@ struct ioc 
        struct ioa_registers __iomem *ioc_regs;  /* I/O MMU base address */
        u8  *res_map;                   /* resource map, bit == pdir entry */
        u64 *pdir_base;                 /* physical base address */
-       u32 pdir_size;                  /* bytes, function of IOV Space size */
-       u32 res_hint;                   /* next available IOVP - 
+       u32 pdir_size;                  /* bytes, function of IOV Space size */
+       u32 res_hint;                   /* next available IOVP -
                                           circular search */
-       u32 res_size;                   /* size of resource map in bytes */
+       u32 res_size;                   /* size of resource map in bytes */
        spinlock_t res_lock;
  
  #ifdef CCIO_COLLECT_STATS
        unsigned short cujo20_bug;
  
        /* STUFF We don't need in performance path */
-       u32 chainid_shift;              /* specify bit location of chain_id */
+       u32 chainid_shift;              /* specify bit location of chain_id */
        struct ioc *next;               /* Linked list of discovered iocs */
        const char *name;               /* device name from firmware */
        unsigned int hw_path;           /* the hardware path this ioc is associatd with */
@@@ -293,7 -293,7 +293,7 @@@ static int ioc_count
  ** cause the kernel to panic anyhow.
  */
  #define CCIO_SEARCH_LOOP(ioc, res_idx, mask, size)  \
-        for(; res_ptr < res_end; ++res_ptr) { \
+       for (; res_ptr < res_end; ++res_ptr) { \
                int ret;\
                unsigned int idx;\
                idx = (unsigned int)((unsigned long)res_ptr - (unsigned long)ioc->res_map); \
  #define CCIO_FIND_FREE_MAPPING(ioa, res_idx, mask, size) \
         u##size *res_ptr = (u##size *)&((ioc)->res_map[ioa->res_hint & ~((size >> 3) - 1)]); \
         u##size *res_end = (u##size *)&(ioc)->res_map[ioa->res_size]; \
-        CCIO_SEARCH_LOOP(ioc, res_idx, mask, size); \
-        res_ptr = (u##size *)&(ioc)->res_map[0]; \
-        CCIO_SEARCH_LOOP(ioa, res_idx, mask, size);
+       CCIO_SEARCH_LOOP(ioc, res_idx, mask, size); \
+       res_ptr = (u##size *)&(ioc)->res_map[0]; \
+       CCIO_SEARCH_LOOP(ioa, res_idx, mask, size);
  
  /*
  ** Find available bit in this ioa's resource map.
@@@ -348,9 -348,9 +348,9 @@@ ccio_alloc_range(struct ioc *ioc, struc
        
        BUG_ON(pages_needed == 0);
        BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE);
-      
-       DBG_RES("%s() size: %d pages_needed %d\n", 
-               __func__, size, pages_needed);
+       DBG_RES("%s() size: %d pages_needed %d\n",
+                       __func__, size, pages_needed);
  
        /*
        ** "seek and ye shall find"...praying never hurts either...
@@@ -416,7 -416,7 +416,7 @@@ resource_found
  #define CCIO_FREE_MAPPINGS(ioc, res_idx, mask, size) \
          u##size *res_ptr = (u##size *)&((ioc)->res_map[res_idx]); \
          BUG_ON((*res_ptr & mask) != mask); \
-         *res_ptr &= ~(mask);
+       *res_ptr &= ~(mask);
  
  /**
   * ccio_free_range - Free pages from the ioc's resource map.
@@@ -518,9 -518,9 +518,9 @@@ typedef unsigned long space_t
  ** when it passes in BIDIRECTIONAL flag.
  */
  static u32 hint_lookup[] = {
-       [PCI_DMA_BIDIRECTIONAL] = HINT_STOP_MOST | HINT_SAFE_DMA | IOPDIR_VALID,
-       [PCI_DMA_TODEVICE]      = HINT_STOP_MOST | HINT_PREFETCH | IOPDIR_VALID,
-       [PCI_DMA_FROMDEVICE]    = HINT_STOP_MOST | IOPDIR_VALID,
+       [DMA_BIDIRECTIONAL]     = HINT_STOP_MOST | HINT_SAFE_DMA | IOPDIR_VALID,
+       [DMA_TO_DEVICE]         = HINT_STOP_MOST | HINT_PREFETCH | IOPDIR_VALID,
+       [DMA_FROM_DEVICE]       = HINT_STOP_MOST | IOPDIR_VALID,
  };
  
  /**
@@@ -845,7 -845,7 +845,7 @@@ static void 
  ccio_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag,
                unsigned long attrs)
  {
-       void *ret;
+       void *ret;
  #if 0
  /* GRANT Need to establish hierarchy for non-PCI devs as well
  ** and then provide matching gsc_map_xxx() functions for them as well.
                return 0;
        }
  #endif
-         ret = (void *) __get_free_pages(flag, get_order(size));
+       ret = (void *) __get_free_pages(flag, get_order(size));
  
        if (ret) {
                memset(ret, 0, size);
-               *dma_handle = ccio_map_single(dev, ret, size, PCI_DMA_BIDIRECTIONAL);
+               *dma_handle = ccio_map_single(dev, ret, size, DMA_BIDIRECTIONAL);
        }
  
        return ret;
@@@ -918,7 -918,7 +918,7 @@@ ccio_map_sg(struct device *dev, struct 
        BUG_ON(!dev);
        ioc = GET_IOC(dev);
        if (!ioc)
 -              return 0;
 +              return -EINVAL;
        
        DBG_RUN_SG("%s() START %d entries\n", __func__, nents);
  
@@@ -1022,8 -1022,8 +1022,8 @@@ static const struct dma_map_ops ccio_op
        .free =                 ccio_free,
        .map_page =             ccio_map_page,
        .unmap_page =           ccio_unmap_page,
-       .map_sg =               ccio_map_sg,
-       .unmap_sg =             ccio_unmap_sg,
+       .map_sg =               ccio_map_sg,
+       .unmap_sg =             ccio_unmap_sg,
        .get_sgtable =          dma_common_get_sgtable,
        .alloc_pages =          dma_common_alloc_pages,
        .free_pages =           dma_common_free_pages,
@@@ -1080,7 -1080,7 +1080,7 @@@ static int ccio_proc_info(struct seq_fi
                max = ioc->usingle_pages - ioc->usg_pages;
                seq_printf(m, "pci_unmap_single: %8ld calls  %8ld pages (avg %d/1000)\n",
                           min, max, (int)((max * 1000)/min));
-  
                seq_printf(m, "pci_map_sg()    : %8ld calls  %8ld pages (avg %d/1000)\n",
                           ioc->msg_calls, ioc->msg_pages,
                           (int)((ioc->msg_pages * 1000)/ioc->msg_calls));
@@@ -1169,7 -1169,7 +1169,7 @@@ void __init ccio_cujo20_fixup(struct pa
        idx = PDIR_INDEX(iovp) >> 3;
  
        while (idx < ioc->res_size) {
-               res_ptr[idx] |= 0xff;
+               res_ptr[idx] |= 0xff;
                idx += PDIR_INDEX(CUJO_20_STEP) >> 3;
        }
  }
@@@ -1297,7 -1297,7 +1297,7 @@@ ccio_ioc_init(struct ioc *ioc
        DBG_INIT(" base %p\n", ioc->pdir_base);
  
        /* resource map size dictated by pdir_size */
-       ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
+       ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
        DBG_INIT("%s() res_size 0x%x\n", __func__, ioc->res_size);
        
        ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, 
diff --combined lib/Kconfig.debug
@@@ -346,7 -346,7 +346,7 @@@ config FRAME_WAR
        int "Warn for stack frames larger than"
        range 0 8192
        default 2048 if GCC_PLUGIN_LATENT_ENTROPY
-       default 1280 if (!64BIT && PARISC)
+       default 1536 if (!64BIT && PARISC)
        default 1024 if (!64BIT && !PARISC)
        default 2048 if 64BIT
        help
@@@ -1235,7 -1235,7 +1235,7 @@@ config PROVE_LOCKIN
        depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
        select LOCKDEP
        select DEBUG_SPINLOCK
 -      select DEBUG_MUTEXES
 +      select DEBUG_MUTEXES if !PREEMPT_RT
        select DEBUG_RT_MUTEXES if RT_MUTEXES
        select DEBUG_RWSEMS
        select DEBUG_WW_MUTEX_SLOWPATH
@@@ -1299,7 -1299,7 +1299,7 @@@ config LOCK_STA
        depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
        select LOCKDEP
        select DEBUG_SPINLOCK
 -      select DEBUG_MUTEXES
 +      select DEBUG_MUTEXES if !PREEMPT_RT
        select DEBUG_RT_MUTEXES if RT_MUTEXES
        select DEBUG_LOCK_ALLOC
        default n
@@@ -1335,7 -1335,7 +1335,7 @@@ config DEBUG_SPINLOC
  
  config DEBUG_MUTEXES
        bool "Mutex debugging: basic checks"
 -      depends on DEBUG_KERNEL
 +      depends on DEBUG_KERNEL && !PREEMPT_RT
        help
         This feature allows mutex semantics violations to be detected and
         reported.
@@@ -1345,8 -1345,7 +1345,8 @@@ config DEBUG_WW_MUTEX_SLOWPAT
        depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
        select DEBUG_LOCK_ALLOC
        select DEBUG_SPINLOCK
 -      select DEBUG_MUTEXES
 +      select DEBUG_MUTEXES if !PREEMPT_RT
 +      select DEBUG_RT_MUTEXES if PREEMPT_RT
        help
         This feature enables slowpath testing for w/w mutex users by
         injecting additional -EDEADLK wound/backoff cases. Together with
@@@ -1369,7 -1368,7 +1369,7 @@@ config DEBUG_LOCK_ALLO
        bool "Lock debugging: detect incorrect freeing of live locks"
        depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
        select DEBUG_SPINLOCK
 -      select DEBUG_MUTEXES
 +      select DEBUG_MUTEXES if !PREEMPT_RT
        select DEBUG_RT_MUTEXES if RT_MUTEXES
        select LOCKDEP
        help
@@@ -1680,6 -1679,33 +1680,6 @@@ config DEBUG_WQ_FORCE_RR_CP
          feature by default.  When enabled, memory and cache locality will
          be impacted.
  
 -config DEBUG_BLOCK_EXT_DEVT
 -      bool "Force extended block device numbers and spread them"
 -      depends on DEBUG_KERNEL
 -      depends on BLOCK
 -      default n
 -      help
 -        BIG FAT WARNING: ENABLING THIS OPTION MIGHT BREAK BOOTING ON
 -        SOME DISTRIBUTIONS.  DO NOT ENABLE THIS UNLESS YOU KNOW WHAT
 -        YOU ARE DOING.  Distros, please enable this and fix whatever
 -        is broken.
 -
 -        Conventionally, block device numbers are allocated from
 -        predetermined contiguous area.  However, extended block area
 -        may introduce non-contiguous block device numbers.  This
 -        option forces most block device numbers to be allocated from
 -        the extended space and spreads them to discover kernel or
 -        userland code paths which assume predetermined contiguous
 -        device number allocation.
 -
 -        Note that turning on this debug option shuffles all the
 -        device numbers for all IDE and SCSI devices including libata
 -        ones, so root partition specified using device number
 -        directly (via rdev or root=MAJ:MIN) won't work anymore.
 -        Textual device names (root=/dev/sdXn) will continue to work.
 -
 -        Say N if you are unsure.
 -
  config CPU_HOTPLUG_STATE_CONTROL
        bool "Enable CPU hotplug state control"
        depends on DEBUG_KERNEL
@@@ -1945,13 -1971,6 +1945,13 @@@ config FAIL_MMC_REQUES
          and to test how the mmc host driver handles retries from
          the block device.
  
 +config FAIL_SUNRPC
 +      bool "Fault-injection capability for SunRPC"
 +      depends on FAULT_INJECTION_DEBUG_FS && SUNRPC_DEBUG
 +      help
 +        Provide fault-injection capability for SunRPC and
 +        its consumers.
 +
  config FAULT_INJECTION_STACKTRACE_FILTER
        bool "stacktrace filter for fault-injection capabilities"
        depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
diff --combined sound/parisc/harmony.c
@@@ -563,9 -563,22 +563,9 @@@ snd_harmony_capture_close(struct snd_pc
          return 0;
  }
  
 -static int 
 -snd_harmony_hw_params(struct snd_pcm_substream *ss,
 -                    struct snd_pcm_hw_params *hw)
 -{
 -      struct snd_harmony *h = snd_pcm_substream_chip(ss);
 -      
 -      if (h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS)
 -              ss->runtime->dma_addr = __pa(ss->runtime->dma_area);
 -
 -      return 0;
 -}
 -
  static const struct snd_pcm_ops snd_harmony_playback_ops = {
        .open = snd_harmony_playback_open,
        .close = snd_harmony_playback_close,
 -      .hw_params = snd_harmony_hw_params,
        .prepare = snd_harmony_playback_prepare,
        .trigger = snd_harmony_playback_trigger,
        .pointer = snd_harmony_playback_pointer,
  static const struct snd_pcm_ops snd_harmony_capture_ops = {
          .open = snd_harmony_capture_open,
          .close = snd_harmony_capture_close,
 -        .hw_params = snd_harmony_hw_params,
          .prepare = snd_harmony_capture_prepare,
          .trigger = snd_harmony_capture_trigger,
          .pointer = snd_harmony_capture_pointer,
@@@ -954,11 -968,10 +954,10 @@@ free_and_ret
        return err;
  }
  
- static int __exit
+ static void __exit
  snd_harmony_remove(struct parisc_device *padev)
  {
        snd_card_free(parisc_get_drvdata(padev));
-       return 0;
  }
  
  static struct parisc_driver snd_harmony_driver __refdata = {