Commit 2572da44 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-5.17/parisc-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc architecture fixes from Helge Deller:

 - Fix miscompilations when function calls are made from inside a
   put_user() call

 - Drop __init from map_pages() declaration to avoid random boot crashes

 - Added #error messages if a 64-bit compiler was used to build a 32-bit
   kernel (and vice versa)

 - Fix out-of-bound data TLB miss faults in sba_iommu and ccio-dma
   drivers

 - Add ioread64_lo_hi() and iowrite64_lo_hi() functions to avoid kernel
   test robot errors

 - Fix link failure when 8250_gsc driver is built without CONFIG_IOSAPIC

* tag 'for-5.17/parisc-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  serial: parisc: GSC: fix build when IOSAPIC is not set
  parisc: Fix some apparent put_user() failures
  parisc: Show error if wrong 32/64-bit compiler is being used
  parisc: Add ioread64_lo_hi() and iowrite64_lo_hi()
  parisc: Fix sglist access in ccio-dma.c
  parisc: Fix data TLB miss in sba_unmap_sg
  parisc: Drop __init from map_pages declaration
parents c24449b3 6e879367
...@@ -12,6 +12,14 @@ ...@@ -12,6 +12,14 @@
#include <asm/barrier.h> #include <asm/barrier.h>
#include <linux/atomic.h> #include <linux/atomic.h>
/* compiler build environment sanity checks: */
#if !defined(CONFIG_64BIT) && defined(__LP64__)
#error "Please use 'ARCH=parisc' to build the 32-bit kernel."
#endif
#if defined(CONFIG_64BIT) && !defined(__LP64__)
#error "Please use 'ARCH=parisc64' to build the 64-bit kernel."
#endif
/* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion
* on use of volatile and __*_bit() (set/clear/change): * on use of volatile and __*_bit() (set/clear/change):
* *_bit() want use of volatile. * *_bit() want use of volatile.
......
...@@ -89,8 +89,8 @@ struct exception_table_entry { ...@@ -89,8 +89,8 @@ struct exception_table_entry {
__asm__("1: " ldx " 0(" sr "%2),%0\n" \ __asm__("1: " ldx " 0(" sr "%2),%0\n" \
"9:\n" \ "9:\n" \
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
: "=r"(__gu_val), "=r"(__gu_err) \ : "=r"(__gu_val), "+r"(__gu_err) \
: "r"(ptr), "1"(__gu_err)); \ : "r"(ptr)); \
\ \
(val) = (__force __typeof__(*(ptr))) __gu_val; \ (val) = (__force __typeof__(*(ptr))) __gu_val; \
} }
...@@ -123,8 +123,8 @@ struct exception_table_entry { ...@@ -123,8 +123,8 @@ struct exception_table_entry {
"9:\n" \ "9:\n" \
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
: "=&r"(__gu_tmp.l), "=r"(__gu_err) \ : "=&r"(__gu_tmp.l), "+r"(__gu_err) \
: "r"(ptr), "1"(__gu_err)); \ : "r"(ptr)); \
\ \
(val) = __gu_tmp.t; \ (val) = __gu_tmp.t; \
} }
...@@ -135,13 +135,12 @@ struct exception_table_entry { ...@@ -135,13 +135,12 @@ struct exception_table_entry {
#define __put_user_internal(sr, x, ptr) \ #define __put_user_internal(sr, x, ptr) \
({ \ ({ \
ASM_EXCEPTIONTABLE_VAR(__pu_err); \ ASM_EXCEPTIONTABLE_VAR(__pu_err); \
__typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \
\ \
switch (sizeof(*(ptr))) { \ switch (sizeof(*(ptr))) { \
case 1: __put_user_asm(sr, "stb", __x, ptr); break; \ case 1: __put_user_asm(sr, "stb", x, ptr); break; \
case 2: __put_user_asm(sr, "sth", __x, ptr); break; \ case 2: __put_user_asm(sr, "sth", x, ptr); break; \
case 4: __put_user_asm(sr, "stw", __x, ptr); break; \ case 4: __put_user_asm(sr, "stw", x, ptr); break; \
case 8: STD_USER(sr, __x, ptr); break; \ case 8: STD_USER(sr, x, ptr); break; \
default: BUILD_BUG(); \ default: BUILD_BUG(); \
} \ } \
\ \
...@@ -150,7 +149,9 @@ struct exception_table_entry { ...@@ -150,7 +149,9 @@ struct exception_table_entry {
#define __put_user(x, ptr) \ #define __put_user(x, ptr) \
({ \ ({ \
__put_user_internal("%%sr3,", x, ptr); \ __typeof__(&*(ptr)) __ptr = ptr; \
__typeof__(*(__ptr)) __x = (__typeof__(*(__ptr)))(x); \
__put_user_internal("%%sr3,", __x, __ptr); \
}) })
#define __put_kernel_nofault(dst, src, type, err_label) \ #define __put_kernel_nofault(dst, src, type, err_label) \
...@@ -180,8 +181,8 @@ struct exception_table_entry { ...@@ -180,8 +181,8 @@ struct exception_table_entry {
"1: " stx " %2,0(" sr "%1)\n" \ "1: " stx " %2,0(" sr "%1)\n" \
"9:\n" \ "9:\n" \
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
: "=r"(__pu_err) \ : "+r"(__pu_err) \
: "r"(ptr), "r"(x), "0"(__pu_err)) : "r"(ptr), "r"(x))
#if !defined(CONFIG_64BIT) #if !defined(CONFIG_64BIT)
...@@ -193,8 +194,8 @@ struct exception_table_entry { ...@@ -193,8 +194,8 @@ struct exception_table_entry {
"9:\n" \ "9:\n" \
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
: "=r"(__pu_err) \ : "+r"(__pu_err) \
: "r"(ptr), "r"(__val), "0"(__pu_err)); \ : "r"(ptr), "r"(__val)); \
} while (0) } while (0)
#endif /* !defined(CONFIG_64BIT) */ #endif /* !defined(CONFIG_64BIT) */
......
...@@ -346,6 +346,16 @@ u64 ioread64be(const void __iomem *addr) ...@@ -346,6 +346,16 @@ u64 ioread64be(const void __iomem *addr)
return *((u64 *)addr); return *((u64 *)addr);
} }
u64 ioread64_lo_hi(const void __iomem *addr)
{
u32 low, high;
low = ioread32(addr);
high = ioread32(addr + sizeof(u32));
return low + ((u64)high << 32);
}
u64 ioread64_hi_lo(const void __iomem *addr) u64 ioread64_hi_lo(const void __iomem *addr)
{ {
u32 low, high; u32 low, high;
...@@ -419,6 +429,12 @@ void iowrite64be(u64 datum, void __iomem *addr) ...@@ -419,6 +429,12 @@ void iowrite64be(u64 datum, void __iomem *addr)
} }
} }
void iowrite64_lo_hi(u64 val, void __iomem *addr)
{
iowrite32(val, addr);
iowrite32(val >> 32, addr + sizeof(u32));
}
void iowrite64_hi_lo(u64 val, void __iomem *addr) void iowrite64_hi_lo(u64 val, void __iomem *addr)
{ {
iowrite32(val >> 32, addr + sizeof(u32)); iowrite32(val >> 32, addr + sizeof(u32));
...@@ -530,6 +546,7 @@ EXPORT_SYMBOL(ioread32); ...@@ -530,6 +546,7 @@ EXPORT_SYMBOL(ioread32);
EXPORT_SYMBOL(ioread32be); EXPORT_SYMBOL(ioread32be);
EXPORT_SYMBOL(ioread64); EXPORT_SYMBOL(ioread64);
EXPORT_SYMBOL(ioread64be); EXPORT_SYMBOL(ioread64be);
EXPORT_SYMBOL(ioread64_lo_hi);
EXPORT_SYMBOL(ioread64_hi_lo); EXPORT_SYMBOL(ioread64_hi_lo);
EXPORT_SYMBOL(iowrite8); EXPORT_SYMBOL(iowrite8);
EXPORT_SYMBOL(iowrite16); EXPORT_SYMBOL(iowrite16);
...@@ -538,6 +555,7 @@ EXPORT_SYMBOL(iowrite32); ...@@ -538,6 +555,7 @@ EXPORT_SYMBOL(iowrite32);
EXPORT_SYMBOL(iowrite32be); EXPORT_SYMBOL(iowrite32be);
EXPORT_SYMBOL(iowrite64); EXPORT_SYMBOL(iowrite64);
EXPORT_SYMBOL(iowrite64be); EXPORT_SYMBOL(iowrite64be);
EXPORT_SYMBOL(iowrite64_lo_hi);
EXPORT_SYMBOL(iowrite64_hi_lo); EXPORT_SYMBOL(iowrite64_hi_lo);
EXPORT_SYMBOL(ioread8_rep); EXPORT_SYMBOL(ioread8_rep);
EXPORT_SYMBOL(ioread16_rep); EXPORT_SYMBOL(ioread16_rep);
......
...@@ -337,9 +337,9 @@ static void __init setup_bootmem(void) ...@@ -337,9 +337,9 @@ static void __init setup_bootmem(void)
static bool kernel_set_to_readonly; static bool kernel_set_to_readonly;
static void __init map_pages(unsigned long start_vaddr, static void __ref map_pages(unsigned long start_vaddr,
unsigned long start_paddr, unsigned long size, unsigned long start_paddr, unsigned long size,
pgprot_t pgprot, int force) pgprot_t pgprot, int force)
{ {
pmd_t *pmd; pmd_t *pmd;
pte_t *pg_table; pte_t *pg_table;
...@@ -449,7 +449,7 @@ void __init set_kernel_text_rw(int enable_read_write) ...@@ -449,7 +449,7 @@ void __init set_kernel_text_rw(int enable_read_write)
flush_tlb_all(); flush_tlb_all();
} }
void __ref free_initmem(void) void free_initmem(void)
{ {
unsigned long init_begin = (unsigned long)__init_begin; unsigned long init_begin = (unsigned long)__init_begin;
unsigned long init_end = (unsigned long)__init_end; unsigned long init_end = (unsigned long)__init_end;
...@@ -463,7 +463,6 @@ void __ref free_initmem(void) ...@@ -463,7 +463,6 @@ void __ref free_initmem(void)
/* The init text pages are marked R-X. We have to /* The init text pages are marked R-X. We have to
* flush the icache and mark them RW- * flush the icache and mark them RW-
* *
* This is tricky, because map_pages is in the init section.
* Do a dummy remap of the data section first (the data * Do a dummy remap of the data section first (the data
* section is already PAGE_KERNEL) to pull in the TLB entries * section is already PAGE_KERNEL) to pull in the TLB entries
* for map_kernel */ * for map_kernel */
......
...@@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ...@@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
ioc->usg_calls++; ioc->usg_calls++;
#endif #endif
while(sg_dma_len(sglist) && nents--) { while (nents && sg_dma_len(sglist)) {
#ifdef CCIO_COLLECT_STATS #ifdef CCIO_COLLECT_STATS
ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT;
...@@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ...@@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
ccio_unmap_page(dev, sg_dma_address(sglist), ccio_unmap_page(dev, sg_dma_address(sglist),
sg_dma_len(sglist), direction, 0); sg_dma_len(sglist), direction, 0);
++sglist; ++sglist;
nents--;
} }
DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
......
...@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ...@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
spin_unlock_irqrestore(&ioc->res_lock, flags); spin_unlock_irqrestore(&ioc->res_lock, flags);
#endif #endif
while (sg_dma_len(sglist) && nents--) { while (nents && sg_dma_len(sglist)) {
sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist), sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist),
direction, 0); direction, 0);
...@@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ...@@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
ioc->usingle_calls--; /* kluge since call is unmap_sg() */ ioc->usingle_calls--; /* kluge since call is unmap_sg() */
#endif #endif
++sglist; ++sglist;
nents--;
} }
DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
......
...@@ -26,7 +26,7 @@ static int __init serial_init_chip(struct parisc_device *dev) ...@@ -26,7 +26,7 @@ static int __init serial_init_chip(struct parisc_device *dev)
unsigned long address; unsigned long address;
int err; int err;
#ifdef CONFIG_64BIT #if defined(CONFIG_64BIT) && defined(CONFIG_IOSAPIC)
if (!dev->irq && (dev->id.sversion == 0xad)) if (!dev->irq && (dev->id.sversion == 0xad))
dev->irq = iosapic_serial_irq(dev); dev->irq = iosapic_serial_irq(dev);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment