Commit 847165d7 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull parisc architecture fixes from Helge Deller:

 - fix reference to exported symbols for parisc64 [Masahiro Yamada]

 - Block-TLB (BTLB) support on 32-bit CPUs

 - sparse and build-warning fixes

* tag 'parisc-for-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  linux/export: fix reference to exported functions for parisc64
  parisc: BTLB: Initialize BTLB tables at CPU startup
  parisc: firmware: Simplify calling non-PA20 functions
  parisc: BTLB: _edata symbol has to be page aligned for BTLB support
  parisc: BTLB: Add BTLB insert and purge firmware function wrappers
  parisc: BTLB: Clear possibly existing BTLB entries
  parisc: Prepare for Block-TLB support on 32-bit kernel
  parisc: shmparam.h: Document aliasing requirements of PA-RISC
  parisc: irq: Make irq_stack_union static to avoid sparse warning
  parisc: drivers: Fix sparse warning
  parisc: iosapic.c: Fix sparse warnings
  parisc: ccio-dma: Fix sparse warnings
  parisc: sba-iommu: Fix sparse warnigs
  parisc: sba: Fix compile warning wrt list of SBA devices
  parisc: sba_iommu: Fix build warning if procfs if disabled
parents 99214f67 08700ec7
...@@ -37,6 +37,7 @@ extern int split_tlb; ...@@ -37,6 +37,7 @@ extern int split_tlb;
extern int dcache_stride; extern int dcache_stride;
extern int icache_stride; extern int icache_stride;
extern struct pdc_cache_info cache_info; extern struct pdc_cache_info cache_info;
extern struct pdc_btlb_info btlb_info;
void parisc_setup_cache_timing(void); void parisc_setup_cache_timing(void);
#define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \ #define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef ASM_PARISC_MCKINLEY_H
#define ASM_PARISC_MCKINLEY_H
/* declared in arch/parisc/kernel/setup.c */
extern struct proc_dir_entry * proc_mckinley_root;
#endif /*ASM_PARISC_MCKINLEY_H*/
...@@ -44,10 +44,11 @@ int pdc_model_capabilities(unsigned long *capabilities); ...@@ -44,10 +44,11 @@ int pdc_model_capabilities(unsigned long *capabilities);
int pdc_model_platform_info(char *orig_prod_num, char *current_prod_num, char *serial_no); int pdc_model_platform_info(char *orig_prod_num, char *current_prod_num, char *serial_no);
int pdc_cache_info(struct pdc_cache_info *cache); int pdc_cache_info(struct pdc_cache_info *cache);
int pdc_spaceid_bits(unsigned long *space_bits); int pdc_spaceid_bits(unsigned long *space_bits);
#ifndef CONFIG_PA20
int pdc_btlb_info(struct pdc_btlb_info *btlb); int pdc_btlb_info(struct pdc_btlb_info *btlb);
int pdc_btlb_insert(unsigned long long vpage, unsigned long physpage, unsigned long len,
unsigned long entry_info, unsigned long slot);
int pdc_btlb_purge_all(void);
int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path); int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
#endif /* !CONFIG_PA20 */
int pdc_pim_toc11(struct pdc_toc_pim_11 *ret); int pdc_pim_toc11(struct pdc_toc_pim_11 *ret);
int pdc_pim_toc20(struct pdc_toc_pim_20 *ret); int pdc_pim_toc20(struct pdc_toc_pim_20 *ret);
int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa); int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
......
...@@ -310,6 +310,7 @@ extern void do_syscall_trace_exit(struct pt_regs *); ...@@ -310,6 +310,7 @@ extern void do_syscall_trace_exit(struct pt_regs *);
struct seq_file; struct seq_file;
extern void early_trap_init(void); extern void early_trap_init(void);
extern void collect_boot_cpu_data(void); extern void collect_boot_cpu_data(void);
extern void btlb_init_per_cpu(void);
extern int show_cpuinfo (struct seq_file *m, void *v); extern int show_cpuinfo (struct seq_file *m, void *v);
/* driver code in driver/parisc */ /* driver code in driver/parisc */
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
struct ioc { struct ioc {
void __iomem *ioc_hpa; /* I/O MMU base address */ void __iomem *ioc_hpa; /* I/O MMU base address */
char *res_map; /* resource map, bit == pdir entry */ char *res_map; /* resource map, bit == pdir entry */
u64 *pdir_base; /* physical base address */ __le64 *pdir_base; /* physical base address */
unsigned long ibase; /* pdir IOV Space base - shared w/lba_pci */ unsigned long ibase; /* pdir IOV Space base - shared w/lba_pci */
unsigned long imask; /* pdir IOV Space mask - shared w/lba_pci */ unsigned long imask; /* pdir IOV Space mask - shared w/lba_pci */
#ifdef ZX1_SUPPORT #ifdef ZX1_SUPPORT
...@@ -86,6 +86,9 @@ struct sba_device { ...@@ -86,6 +86,9 @@ struct sba_device {
struct ioc ioc[MAX_IOC]; struct ioc ioc[MAX_IOC];
}; };
/* list of SBA's in system, see drivers/parisc/sba_iommu.c */
extern struct sba_device *sba_list;
#define ASTRO_RUNWAY_PORT 0x582 #define ASTRO_RUNWAY_PORT 0x582
#define IKE_MERCED_PORT 0x803 #define IKE_MERCED_PORT 0x803
#define REO_MERCED_PORT 0x804 #define REO_MERCED_PORT 0x804
...@@ -110,7 +113,7 @@ static inline int IS_PLUTO(struct parisc_device *d) { ...@@ -110,7 +113,7 @@ static inline int IS_PLUTO(struct parisc_device *d) {
#define SBA_PDIR_VALID_BIT 0x8000000000000000ULL #define SBA_PDIR_VALID_BIT 0x8000000000000000ULL
#define SBA_AGPGART_COOKIE 0x0000badbadc0ffeeULL #define SBA_AGPGART_COOKIE (__force __le64) 0x0000badbadc0ffeeULL
#define SBA_FUNC_ID 0x0000 /* function id */ #define SBA_FUNC_ID 0x0000 /* function id */
#define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */ #define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */
......
...@@ -2,6 +2,21 @@ ...@@ -2,6 +2,21 @@
#ifndef _ASMPARISC_SHMPARAM_H #ifndef _ASMPARISC_SHMPARAM_H
#define _ASMPARISC_SHMPARAM_H #define _ASMPARISC_SHMPARAM_H
/*
* PA-RISC uses virtually indexed & physically tagged (VIPT) caches
* which has strict requirements when two pages to the same physical
* address are accessed through different mappings. Read the section
* "Address Aliasing" in the arch docs for more detail:
* PA-RISC 1.1 (page 3-6):
* https://parisc.wiki.kernel.org/images-parisc/6/68/Pa11_acd.pdf
* PA-RISC 2.0 (page F-5):
* https://parisc.wiki.kernel.org/images-parisc/7/73/Parisc2.0.pdf
*
* For Linux we allow kernel and userspace to map pages on page size
* granularity (SHMLBA) but have to ensure that, if two pages are
* mapped to the same physical address, the virtual and physical
* addresses modulo SHM_COLOUR are identical.
*/
#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
#define SHM_COLOUR 0x00400000 /* shared mappings colouring */ #define SHM_COLOUR 0x00400000 /* shared mappings colouring */
......
...@@ -275,6 +275,8 @@ int main(void) ...@@ -275,6 +275,8 @@ int main(void)
* and kernel data on physical huge pages */ * and kernel data on physical huge pages */
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
DEFINE(HUGEPAGE_SIZE, 1UL << REAL_HPAGE_SHIFT); DEFINE(HUGEPAGE_SIZE, 1UL << REAL_HPAGE_SHIFT);
#elif !defined(CONFIG_64BIT)
DEFINE(HUGEPAGE_SIZE, 4*1024*1024);
#else #else
DEFINE(HUGEPAGE_SIZE, PAGE_SIZE); DEFINE(HUGEPAGE_SIZE, PAGE_SIZE);
#endif #endif
......
...@@ -58,7 +58,7 @@ int pa_serialize_tlb_flushes __ro_after_init; ...@@ -58,7 +58,7 @@ int pa_serialize_tlb_flushes __ro_after_init;
struct pdc_cache_info cache_info __ro_after_init; struct pdc_cache_info cache_info __ro_after_init;
#ifndef CONFIG_PA20 #ifndef CONFIG_PA20
static struct pdc_btlb_info btlb_info __ro_after_init; struct pdc_btlb_info btlb_info __ro_after_init;
#endif #endif
DEFINE_STATIC_KEY_TRUE(parisc_has_cache); DEFINE_STATIC_KEY_TRUE(parisc_has_cache);
...@@ -264,12 +264,6 @@ parisc_cache_init(void) ...@@ -264,12 +264,6 @@ parisc_cache_init(void)
icache_stride = CAFL_STRIDE(cache_info.ic_conf); icache_stride = CAFL_STRIDE(cache_info.ic_conf);
#undef CAFL_STRIDE #undef CAFL_STRIDE
#ifndef CONFIG_PA20
if (pdc_btlb_info(&btlb_info) < 0) {
memset(&btlb_info, 0, sizeof btlb_info);
}
#endif
if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) == if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) ==
PDC_MODEL_NVA_UNSUPPORTED) { PDC_MODEL_NVA_UNSUPPORTED) {
printk(KERN_WARNING "parisc_cache_init: Only equivalent aliasing supported!\n"); printk(KERN_WARNING "parisc_cache_init: Only equivalent aliasing supported!\n");
......
...@@ -925,9 +925,9 @@ static __init void qemu_header(void) ...@@ -925,9 +925,9 @@ static __init void qemu_header(void)
pr_info("#define PARISC_MODEL \"%s\"\n\n", pr_info("#define PARISC_MODEL \"%s\"\n\n",
boot_cpu_data.pdc.sys_model_name); boot_cpu_data.pdc.sys_model_name);
#define p ((unsigned long *)&boot_cpu_data.pdc.model)
pr_info("#define PARISC_PDC_MODEL 0x%lx, 0x%lx, 0x%lx, " pr_info("#define PARISC_PDC_MODEL 0x%lx, 0x%lx, 0x%lx, "
"0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx\n\n", "0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx\n\n",
#define p ((unsigned long *)&boot_cpu_data.pdc.model)
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]);
#undef p #undef p
......
...@@ -687,7 +687,6 @@ int pdc_spaceid_bits(unsigned long *space_bits) ...@@ -687,7 +687,6 @@ int pdc_spaceid_bits(unsigned long *space_bits)
return retval; return retval;
} }
#ifndef CONFIG_PA20
/** /**
* pdc_btlb_info - Return block TLB information. * pdc_btlb_info - Return block TLB information.
* @btlb: The return buffer. * @btlb: The return buffer.
...@@ -696,18 +695,51 @@ int pdc_spaceid_bits(unsigned long *space_bits) ...@@ -696,18 +695,51 @@ int pdc_spaceid_bits(unsigned long *space_bits)
*/ */
int pdc_btlb_info(struct pdc_btlb_info *btlb) int pdc_btlb_info(struct pdc_btlb_info *btlb)
{ {
int retval; int retval;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags); if (IS_ENABLED(CONFIG_PA20))
retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0); return PDC_BAD_PROC;
memcpy(btlb, pdc_result, sizeof(*btlb));
spin_unlock_irqrestore(&pdc_lock, flags);
if(retval < 0) { spin_lock_irqsave(&pdc_lock, flags);
btlb->max_size = 0; retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0);
} memcpy(btlb, pdc_result, sizeof(*btlb));
return retval; spin_unlock_irqrestore(&pdc_lock, flags);
if(retval < 0) {
btlb->max_size = 0;
}
return retval;
}
int pdc_btlb_insert(unsigned long long vpage, unsigned long physpage, unsigned long len,
unsigned long entry_info, unsigned long slot)
{
int retval;
unsigned long flags;
if (IS_ENABLED(CONFIG_PA20))
return PDC_BAD_PROC;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INSERT, (unsigned long) (vpage >> 32),
(unsigned long) vpage, physpage, len, entry_info, slot);
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
}
int pdc_btlb_purge_all(void)
{
int retval;
unsigned long flags;
if (IS_ENABLED(CONFIG_PA20))
return PDC_BAD_PROC;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_PURGE_ALL);
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
} }
/** /**
...@@ -728,6 +760,9 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address, ...@@ -728,6 +760,9 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address,
int retval; int retval;
unsigned long flags; unsigned long flags;
if (IS_ENABLED(CONFIG_PA20))
return PDC_BAD_PROC;
spin_lock_irqsave(&pdc_lock, flags); spin_lock_irqsave(&pdc_lock, flags);
memcpy(pdc_result2, mod_path, sizeof(*mod_path)); memcpy(pdc_result2, mod_path, sizeof(*mod_path));
retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result), retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result),
...@@ -737,7 +772,6 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address, ...@@ -737,7 +772,6 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address,
return retval; return retval;
} }
#endif /* !CONFIG_PA20 */
/** /**
* pdc_lan_station_id - Get the LAN address. * pdc_lan_station_id - Get the LAN address.
......
...@@ -180,10 +180,10 @@ $pgt_fill_loop: ...@@ -180,10 +180,10 @@ $pgt_fill_loop:
std %dp,0x18(%r10) std %dp,0x18(%r10)
#endif #endif
#ifdef CONFIG_64BIT
/* Get PDCE_PROC for monarch CPU. */
#define MEM_PDC_LO 0x388 #define MEM_PDC_LO 0x388
#define MEM_PDC_HI 0x35C #define MEM_PDC_HI 0x35C
#ifdef CONFIG_64BIT
/* Get PDCE_PROC for monarch CPU. */
ldw MEM_PDC_LO(%r0),%r3 ldw MEM_PDC_LO(%r0),%r3
ldw MEM_PDC_HI(%r0),%r10 ldw MEM_PDC_HI(%r0),%r10
depd %r10, 31, 32, %r3 /* move to upper word */ depd %r10, 31, 32, %r3 /* move to upper word */
...@@ -269,7 +269,17 @@ stext_pdc_ret: ...@@ -269,7 +269,17 @@ stext_pdc_ret:
tovirt_r1 %r6 tovirt_r1 %r6
mtctl %r6,%cr30 /* restore task thread info */ mtctl %r6,%cr30 /* restore task thread info */
#endif #endif
#ifndef CONFIG_64BIT
/* clear all BTLBs */
ldi PDC_BLOCK_TLB,%arg0
load32 PA(stext_pdc_btlb_ret), %rp
ldw MEM_PDC_LO(%r0),%r3
bv (%r3)
ldi PDC_BTLB_PURGE_ALL,%arg1
stext_pdc_btlb_ret:
#endif
/* PARANOID: clear user scratch/user space SR's */ /* PARANOID: clear user scratch/user space SR's */
mtsp %r0,%sr0 mtsp %r0,%sr0
mtsp %r0,%sr1 mtsp %r0,%sr1
......
...@@ -365,7 +365,7 @@ union irq_stack_union { ...@@ -365,7 +365,7 @@ union irq_stack_union {
volatile unsigned int lock[1]; volatile unsigned int lock[1];
}; };
DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = { static DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = {
.slock = { 1,1,1,1 }, .slock = { 1,1,1,1 },
}; };
#endif #endif
......
...@@ -368,6 +368,8 @@ int init_per_cpu(int cpunum) ...@@ -368,6 +368,8 @@ int init_per_cpu(int cpunum)
/* FUTURE: Enable Performance Monitor : ccr bit 0x20 */ /* FUTURE: Enable Performance Monitor : ccr bit 0x20 */
init_percpu_prof(cpunum); init_percpu_prof(cpunum);
btlb_init_per_cpu();
return ret; return ret;
} }
......
...@@ -154,6 +154,7 @@ SECTIONS ...@@ -154,6 +154,7 @@ SECTIONS
} }
/* End of data section */ /* End of data section */
. = ALIGN(PAGE_SIZE);
_edata = .; _edata = .;
/* BSS */ /* BSS */
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/msgbuf.h> #include <asm/msgbuf.h>
#include <asm/sparsemem.h> #include <asm/sparsemem.h>
#include <asm/asm-offsets.h>
extern int data_start; extern int data_start;
extern void parisc_kernel_start(void); /* Kernel entry point in head.S */ extern void parisc_kernel_start(void); /* Kernel entry point in head.S */
...@@ -720,6 +721,77 @@ void __init paging_init(void) ...@@ -720,6 +721,77 @@ void __init paging_init(void)
parisc_bootmem_free(); parisc_bootmem_free();
} }
static void alloc_btlb(unsigned long start, unsigned long end, int *slot,
unsigned long entry_info)
{
const int slot_max = btlb_info.fixed_range_info.num_comb;
int min_num_pages = btlb_info.min_size;
unsigned long size;
/* map at minimum 4 pages */
if (min_num_pages < 4)
min_num_pages = 4;
size = HUGEPAGE_SIZE;
while (start < end && *slot < slot_max && size >= PAGE_SIZE) {
/* starting address must have same alignment as size! */
/* if correctly aligned and fits in double size, increase */
if (((start & (2 * size - 1)) == 0) &&
(end - start) >= (2 * size)) {
size <<= 1;
continue;
}
/* if current size alignment is too big, try smaller size */
if ((start & (size - 1)) != 0) {
size >>= 1;
continue;
}
if ((end - start) >= size) {
if ((size >> PAGE_SHIFT) >= min_num_pages)
pdc_btlb_insert(start >> PAGE_SHIFT, __pa(start) >> PAGE_SHIFT,
size >> PAGE_SHIFT, entry_info, *slot);
(*slot)++;
start += size;
continue;
}
size /= 2;
continue;
}
}
void btlb_init_per_cpu(void)
{
unsigned long s, t, e;
int slot;
/* BTLBs are not available on 64-bit CPUs */
if (IS_ENABLED(CONFIG_PA20))
return;
else if (pdc_btlb_info(&btlb_info) < 0) {
memset(&btlb_info, 0, sizeof btlb_info);
}
/* insert BLTLBs for code and data segments */
s = (uintptr_t) dereference_function_descriptor(&_stext);
e = (uintptr_t) dereference_function_descriptor(&_etext);
t = (uintptr_t) dereference_function_descriptor(&_sdata);
BUG_ON(t != e);
/* code segments */
slot = 0;
alloc_btlb(s, e, &slot, 0x13800000);
/* sanity check */
t = (uintptr_t) dereference_function_descriptor(&_edata);
e = (uintptr_t) dereference_function_descriptor(&__bss_start);
BUG_ON(t != e);
/* data segments */
s = (uintptr_t) dereference_function_descriptor(&_sdata);
e = (uintptr_t) dereference_function_descriptor(&__bss_stop);
alloc_btlb(s, e, &slot, 0x11800000);
}
#ifdef CONFIG_PA20 #ifdef CONFIG_PA20
/* /*
......
...@@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) ...@@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data)
static int __init static int __init
parisc_agp_init(void) parisc_agp_init(void)
{ {
extern struct sba_device *sba_list;
int err = -1; int err = -1;
struct parisc_device *sba = NULL, *lba = NULL; struct parisc_device *sba = NULL, *lba = NULL;
struct lba_device *lbadev = NULL; struct lba_device *lbadev = NULL;
......
...@@ -214,7 +214,7 @@ struct ioa_registers { ...@@ -214,7 +214,7 @@ struct ioa_registers {
struct ioc { struct ioc {
struct ioa_registers __iomem *ioc_regs; /* I/O MMU base address */ struct ioa_registers __iomem *ioc_regs; /* I/O MMU base address */
u8 *res_map; /* resource map, bit == pdir entry */ u8 *res_map; /* resource map, bit == pdir entry */
u64 *pdir_base; /* physical base address */ __le64 *pdir_base; /* physical base address */
u32 pdir_size; /* bytes, function of IOV Space size */ u32 pdir_size; /* bytes, function of IOV Space size */
u32 res_hint; /* next available IOVP - u32 res_hint; /* next available IOVP -
circular search */ circular search */
...@@ -339,7 +339,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) ...@@ -339,7 +339,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
BUG_ON(pages_needed == 0); BUG_ON(pages_needed == 0);
BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE); BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE);
DBG_RES("%s() size: %d pages_needed %d\n", DBG_RES("%s() size: %zu pages_needed %d\n",
__func__, size, pages_needed); __func__, size, pages_needed);
/* /*
...@@ -427,7 +427,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) ...@@ -427,7 +427,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
BUG_ON((pages_mapped * IOVP_SIZE) > DMA_CHUNK_SIZE); BUG_ON((pages_mapped * IOVP_SIZE) > DMA_CHUNK_SIZE);
BUG_ON(pages_mapped > BITS_PER_LONG); BUG_ON(pages_mapped > BITS_PER_LONG);
DBG_RES("%s(): res_idx: %d pages_mapped %d\n", DBG_RES("%s(): res_idx: %d pages_mapped %lu\n",
__func__, res_idx, pages_mapped); __func__, res_idx, pages_mapped);
#ifdef CCIO_COLLECT_STATS #ifdef CCIO_COLLECT_STATS
...@@ -543,7 +543,7 @@ static u32 hint_lookup[] = { ...@@ -543,7 +543,7 @@ static u32 hint_lookup[] = {
* index are bits 12:19 of the value returned by LCI. * index are bits 12:19 of the value returned by LCI.
*/ */
static void static void
ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba, ccio_io_pdir_entry(__le64 *pdir_ptr, space_t sid, unsigned long vba,
unsigned long hints) unsigned long hints)
{ {
register unsigned long pa; register unsigned long pa;
...@@ -719,7 +719,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size, ...@@ -719,7 +719,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
unsigned long flags; unsigned long flags;
dma_addr_t iovp; dma_addr_t iovp;
dma_addr_t offset; dma_addr_t offset;
u64 *pdir_start; __le64 *pdir_start;
unsigned long hint = hint_lookup[(int)direction]; unsigned long hint = hint_lookup[(int)direction];
BUG_ON(!dev); BUG_ON(!dev);
...@@ -746,8 +746,8 @@ ccio_map_single(struct device *dev, void *addr, size_t size, ...@@ -746,8 +746,8 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
pdir_start = &(ioc->pdir_base[idx]); pdir_start = &(ioc->pdir_base[idx]);
DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n", DBG_RUN("%s() %px -> %#lx size: %zu\n",
__func__, addr, (long)iovp | offset, size); __func__, addr, (long)(iovp | offset), size);
/* If not cacheline aligned, force SAFE_DMA on the whole mess */ /* If not cacheline aligned, force SAFE_DMA on the whole mess */
if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES)) if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES))
...@@ -805,7 +805,7 @@ ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size, ...@@ -805,7 +805,7 @@ ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
return; return;
} }
DBG_RUN("%s() iovp 0x%lx/%x\n", DBG_RUN("%s() iovp %#lx/%zx\n",
__func__, (long)iova, size); __func__, (long)iova, size);
iova ^= offset; /* clear offset bits */ iova ^= offset; /* clear offset bits */
...@@ -1283,7 +1283,7 @@ ccio_ioc_init(struct ioc *ioc) ...@@ -1283,7 +1283,7 @@ ccio_ioc_init(struct ioc *ioc)
iova_space_size>>20, iova_space_size>>20,
iov_order + PAGE_SHIFT); iov_order + PAGE_SHIFT);
ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, ioc->pdir_base = (__le64 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->pdir_size)); get_order(ioc->pdir_size));
if(NULL == ioc->pdir_base) { if(NULL == ioc->pdir_base) {
panic("%s() could not allocate I/O Page Table\n", __func__); panic("%s() could not allocate I/O Page Table\n", __func__);
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
static inline unsigned int static inline unsigned int
iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents, iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents,
unsigned long hint, unsigned long hint,
void (*iommu_io_pdir_entry)(u64 *, space_t, unsigned long, void (*iommu_io_pdir_entry)(__le64 *, space_t, unsigned long,
unsigned long)) unsigned long))
{ {
struct scatterlist *dma_sg = startsg; /* pointer to current DMA */ struct scatterlist *dma_sg = startsg; /* pointer to current DMA */
unsigned int n_mappings = 0; unsigned int n_mappings = 0;
unsigned long dma_offset = 0, dma_len = 0; unsigned long dma_offset = 0, dma_len = 0;
u64 *pdirp = NULL; __le64 *pdirp = NULL;
/* Horrible hack. For efficiency's sake, dma_sg starts one /* Horrible hack. For efficiency's sake, dma_sg starts one
* entry below the true start (it is immediately incremented * entry below the true start (it is immediately incremented
...@@ -31,8 +31,8 @@ iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents, ...@@ -31,8 +31,8 @@ iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents,
unsigned long vaddr; unsigned long vaddr;
long size; long size;
DBG_RUN_SG(" %d : %08lx/%05x %p/%05x\n", nents, DBG_RUN_SG(" %d : %08lx %p/%05x\n", nents,
(unsigned long)sg_dma_address(startsg), cnt, (unsigned long)sg_dma_address(startsg),
sg_virt(startsg), startsg->length sg_virt(startsg), startsg->length
); );
......
...@@ -202,9 +202,9 @@ static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 va ...@@ -202,9 +202,9 @@ static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 va
static DEFINE_SPINLOCK(iosapic_lock); static DEFINE_SPINLOCK(iosapic_lock);
static inline void iosapic_eoi(void __iomem *addr, unsigned int data) static inline void iosapic_eoi(__le32 __iomem *addr, __le32 data)
{ {
__raw_writel(data, addr); __raw_writel((__force u32)data, addr);
} }
/* /*
......
...@@ -118,8 +118,8 @@ struct iosapic_irt { ...@@ -118,8 +118,8 @@ struct iosapic_irt {
struct vector_info { struct vector_info {
struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */ struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */
struct irt_entry *irte; /* IRT entry */ struct irt_entry *irte; /* IRT entry */
u32 __iomem *eoi_addr; /* precalculate EOI reg address */ __le32 __iomem *eoi_addr; /* precalculate EOI reg address */
u32 eoi_data; /* IA64: ? PA: swapped txn_data */ __le32 eoi_data; /* IA64: ? PA: swapped txn_data */
int txn_irq; /* virtual IRQ number for processor */ int txn_irq; /* virtual IRQ number for processor */
ulong txn_addr; /* IA64: id_eid PA: partial HPA */ ulong txn_addr; /* IA64: id_eid PA: partial HPA */
u32 txn_data; /* CPU interrupt bit */ u32 txn_data; /* CPU interrupt bit */
......
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <asm/ropes.h> #include <asm/ropes.h>
#include <asm/mckinley.h> /* for proc_mckinley_root */
#include <asm/runway.h> /* for proc_runway_root */
#include <asm/page.h> /* for PAGE0 */ #include <asm/page.h> /* for PAGE0 */
#include <asm/pdc.h> /* for PDC_MODEL_* */ #include <asm/pdc.h> /* for PDC_MODEL_* */
#include <asm/pdcpat.h> /* for is_pdc_pat() */ #include <asm/pdcpat.h> /* for is_pdc_pat() */
...@@ -122,7 +120,7 @@ MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); ...@@ -122,7 +120,7 @@ MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
#endif #endif
static struct proc_dir_entry *proc_runway_root __ro_after_init; static struct proc_dir_entry *proc_runway_root __ro_after_init;
struct proc_dir_entry *proc_mckinley_root __ro_after_init; static struct proc_dir_entry *proc_mckinley_root __ro_after_init;
/************************************ /************************************
** SBA register read and write support ** SBA register read and write support
...@@ -204,7 +202,7 @@ static void ...@@ -204,7 +202,7 @@ static void
sba_dump_pdir_entry(struct ioc *ioc, char *msg, uint pide) sba_dump_pdir_entry(struct ioc *ioc, char *msg, uint pide)
{ {
/* start printing from lowest pde in rval */ /* start printing from lowest pde in rval */
u64 *ptr = &(ioc->pdir_base[pide & (~0U * BITS_PER_LONG)]); __le64 *ptr = &(ioc->pdir_base[pide & (~0U * BITS_PER_LONG)]);
unsigned long *rptr = (unsigned long *) &(ioc->res_map[(pide >>3) & ~(sizeof(unsigned long) - 1)]); unsigned long *rptr = (unsigned long *) &(ioc->res_map[(pide >>3) & ~(sizeof(unsigned long) - 1)]);
uint rcnt; uint rcnt;
...@@ -571,7 +569,7 @@ typedef unsigned long space_t; ...@@ -571,7 +569,7 @@ typedef unsigned long space_t;
*/ */
static void static void
sba_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba, sba_io_pdir_entry(__le64 *pdir_ptr, space_t sid, unsigned long vba,
unsigned long hint) unsigned long hint)
{ {
u64 pa; /* physical address */ u64 pa; /* physical address */
...@@ -615,7 +613,7 @@ static void ...@@ -615,7 +613,7 @@ static void
sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt) sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
{ {
u32 iovp = (u32) SBA_IOVP(ioc,iova); u32 iovp = (u32) SBA_IOVP(ioc,iova);
u64 *pdir_ptr = &ioc->pdir_base[PDIR_INDEX(iovp)]; __le64 *pdir_ptr = &ioc->pdir_base[PDIR_INDEX(iovp)];
#ifdef ASSERT_PDIR_SANITY #ifdef ASSERT_PDIR_SANITY
/* Assert first pdir entry is set. /* Assert first pdir entry is set.
...@@ -716,7 +714,7 @@ sba_map_single(struct device *dev, void *addr, size_t size, ...@@ -716,7 +714,7 @@ sba_map_single(struct device *dev, void *addr, size_t size,
unsigned long flags; unsigned long flags;
dma_addr_t iovp; dma_addr_t iovp;
dma_addr_t offset; dma_addr_t offset;
u64 *pdir_start; __le64 *pdir_start;
int pide; int pide;
ioc = GET_IOC(dev); ioc = GET_IOC(dev);
...@@ -1434,7 +1432,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) ...@@ -1434,7 +1432,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64); ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64);
DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", DBG_INIT("%s() hpa %px mem %ldMB IOV %dMB (%d bits)\n",
__func__, __func__,
ioc->ioc_hpa, ioc->ioc_hpa,
(unsigned long) totalram_pages() >> (20 - PAGE_SHIFT), (unsigned long) totalram_pages() >> (20 - PAGE_SHIFT),
...@@ -1471,7 +1469,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) ...@@ -1471,7 +1469,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
ioc->iovp_mask = ~(iova_space_mask + PAGE_SIZE - 1); ioc->iovp_mask = ~(iova_space_mask + PAGE_SIZE - 1);
#endif #endif
DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n", DBG_INIT("%s() IOV base %#lx mask %#0lx\n",
__func__, ioc->ibase, ioc->imask); __func__, ioc->ibase, ioc->imask);
/* /*
...@@ -1583,7 +1581,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, ...@@ -1583,7 +1581,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa,
if (!IS_PLUTO(sba_dev->dev)) { if (!IS_PLUTO(sba_dev->dev)) {
ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL);
DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", DBG_INIT("%s() hpa %px ioc_ctl 0x%Lx ->",
__func__, sba_dev->sba_hpa, ioc_ctl); __func__, sba_dev->sba_hpa, ioc_ctl);
ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE); ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE);
ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC; ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC;
...@@ -1668,14 +1666,14 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, ...@@ -1668,14 +1666,14 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa,
/* flush out the last writes */ /* flush out the last writes */
READ_REG(sba_dev->ioc[i].ioc_hpa + ROPE7_CTL); READ_REG(sba_dev->ioc[i].ioc_hpa + ROPE7_CTL);
DBG_INIT(" ioc[%d] ROPE_CFG 0x%Lx ROPE_DBG 0x%Lx\n", DBG_INIT(" ioc[%d] ROPE_CFG %#lx ROPE_DBG %lx\n",
i, i,
READ_REG(sba_dev->ioc[i].ioc_hpa + 0x40), (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x40),
READ_REG(sba_dev->ioc[i].ioc_hpa + 0x50) (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x50)
); );
DBG_INIT(" STATUS_CONTROL 0x%Lx FLUSH_CTRL 0x%Lx\n", DBG_INIT(" STATUS_CONTROL %#lx FLUSH_CTRL %#lx\n",
READ_REG(sba_dev->ioc[i].ioc_hpa + 0x108), (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x108),
READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400) (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400)
); );
if (IS_PLUTO(sba_dev->dev)) { if (IS_PLUTO(sba_dev->dev)) {
...@@ -1739,7 +1737,7 @@ sba_common_init(struct sba_device *sba_dev) ...@@ -1739,7 +1737,7 @@ sba_common_init(struct sba_device *sba_dev)
#ifdef ASSERT_PDIR_SANITY #ifdef ASSERT_PDIR_SANITY
/* Mark first bit busy - ie no IOVA 0 */ /* Mark first bit busy - ie no IOVA 0 */
sba_dev->ioc[i].res_map[0] = 0x80; sba_dev->ioc[i].res_map[0] = 0x80;
sba_dev->ioc[i].pdir_base[0] = 0xeeffc0addbba0080ULL; sba_dev->ioc[i].pdir_base[0] = (__force __le64) 0xeeffc0addbba0080ULL;
#endif #endif
/* Third (and last) part of PIRANHA BUG */ /* Third (and last) part of PIRANHA BUG */
...@@ -1899,9 +1897,7 @@ static int __init sba_driver_callback(struct parisc_device *dev) ...@@ -1899,9 +1897,7 @@ static int __init sba_driver_callback(struct parisc_device *dev)
int i; int i;
char *version; char *version;
void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE); void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE);
#ifdef CONFIG_PROC_FS struct proc_dir_entry *root __maybe_unused;
struct proc_dir_entry *root;
#endif
sba_dump_ranges(sba_addr); sba_dump_ranges(sba_addr);
...@@ -1967,7 +1963,6 @@ static int __init sba_driver_callback(struct parisc_device *dev) ...@@ -1967,7 +1963,6 @@ static int __init sba_driver_callback(struct parisc_device *dev)
hppa_dma_ops = &sba_ops; hppa_dma_ops = &sba_ops;
#ifdef CONFIG_PROC_FS
switch (dev->id.hversion) { switch (dev->id.hversion) {
case PLUTO_MCKINLEY_PORT: case PLUTO_MCKINLEY_PORT:
if (!proc_mckinley_root) if (!proc_mckinley_root)
...@@ -1985,7 +1980,6 @@ static int __init sba_driver_callback(struct parisc_device *dev) ...@@ -1985,7 +1980,6 @@ static int __init sba_driver_callback(struct parisc_device *dev)
proc_create_single("sba_iommu", 0, root, sba_proc_info); proc_create_single("sba_iommu", 0, root, sba_proc_info);
proc_create_single("sba_iommu-bitmap", 0, root, sba_proc_bitmap_info); proc_create_single("sba_iommu-bitmap", 0, root, sba_proc_bitmap_info);
#endif
return 0; return 0;
} }
......
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
#ifdef CONFIG_IA64 #ifdef CONFIG_IA64
#define KSYM_FUNC(name) @fptr(name) #define KSYM_FUNC(name) @fptr(name)
#elif defined(CONFIG_PARISC) && defined(CONFIG_64BIT)
#define KSYM_FUNC(name) P%name
#else #else
#define KSYM_FUNC(name) name #define KSYM_FUNC(name) name
#endif #endif
......
...@@ -1228,6 +1228,15 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf, ...@@ -1228,6 +1228,15 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
*/ */
s->is_func = (ELF_ST_TYPE(sym->st_info) == STT_FUNC); s->is_func = (ELF_ST_TYPE(sym->st_info) == STT_FUNC);
/*
* For parisc64, symbols prefixed $$ from the library have the symbol type
* STT_LOPROC. They should be handled as functions too.
*/
if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 &&
elf->hdr->e_machine == EM_PARISC &&
ELF_ST_TYPE(sym->st_info) == STT_LOPROC)
s->is_func = true;
if (match(secname, PATTERNS(INIT_SECTIONS))) if (match(secname, PATTERNS(INIT_SECTIONS)))
warn("%s: %s: EXPORT_SYMBOL used for init symbol. Remove __init or EXPORT_SYMBOL.\n", warn("%s: %s: EXPORT_SYMBOL used for init symbol. Remove __init or EXPORT_SYMBOL.\n",
mod->name, name); mod->name, name);
......
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