Skip to content

Commit a7f290d

Browse files
ozbenhpaulusmack
authored andcommitted
[PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel
This patch moves the vdso's to arch/powerpc, adds support for the 32 bits vdso to the 32 bits kernel, rename systemcfg (finally !), and adds some new (still untested) routines to both vdso's: clock_gettime() with support for CLOCK_REALTIME and CLOCK_MONOTONIC, clock_getres() (same clocks) and get_tbfreq() for glibc to retreive the timebase frequency. Tom,Steve: The implementation of get_tbfreq() I've done for 32 bits returns a long long (r3, r4) not a long. This is such that if we ever add support for >4Ghz timebases on ppc32, the userland interface won't have to change. I have tested gettimeofday() using some glibc patches in both ppc32 and ppc64 kernels using 32 bits userland (I haven't had a chance to test a 64 bits userland yet, but the implementation didn't change and was tested earlier). I haven't tested yet the new functions. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 6761c4a commit a7f290d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1541
-430
lines changed

arch/powerpc/kernel/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ CFLAGS_btext.o += -fPIC
1212
endif
1313

1414
obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
15-
irq.o signal_32.o pmc.o
15+
irq.o signal_32.o pmc.o vdso.o
16+
obj-y += vdso32/
1617
obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
1718
signal_64.o ptrace32.o systbl.o \
1819
paca.o ioctl32.o cpu_setup_power4.o \
1920
firmware.o sysfs.o udbg.o
21+
obj-$(CONFIG_PPC64) += vdso64/
2022
obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
2123
obj-$(CONFIG_POWER4) += idle_power4.o
2224
obj-$(CONFIG_PPC_OF) += of_device.o

arch/powerpc/kernel/asm-offsets.c

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
#include <asm/cputable.h>
3838
#include <asm/thread_info.h>
3939
#include <asm/rtas.h>
40+
#include <asm/vdso_datapage.h>
4041
#ifdef CONFIG_PPC64
4142
#include <asm/paca.h>
4243
#include <asm/lppaca.h>
4344
#include <asm/iseries/hv_lp_event.h>
4445
#include <asm/cache.h>
45-
#include <asm/systemcfg.h>
4646
#include <asm/compat.h>
4747
#endif
4848

@@ -251,25 +251,42 @@ int main(void)
251251

252252
DEFINE(TASK_SIZE, TASK_SIZE);
253253
DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
254-
#else /* CONFIG_PPC64 */
255-
/* systemcfg offsets for use by vdso */
256-
DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct systemcfg, tb_orig_stamp));
257-
DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct systemcfg, tb_ticks_per_sec));
258-
DEFINE(CFG_TB_TO_XS, offsetof(struct systemcfg, tb_to_xs));
259-
DEFINE(CFG_STAMP_XSEC, offsetof(struct systemcfg, stamp_xsec));
260-
DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct systemcfg, tb_update_count));
261-
DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct systemcfg, tz_minuteswest));
262-
DEFINE(CFG_TZ_DSTTIME, offsetof(struct systemcfg, tz_dsttime));
263-
DEFINE(CFG_SYSCALL_MAP32, offsetof(struct systemcfg, syscall_map_32));
264-
DEFINE(CFG_SYSCALL_MAP64, offsetof(struct systemcfg, syscall_map_64));
254+
#endif /* ! CONFIG_PPC64 */
265255

266-
/* timeval/timezone offsets for use by vdso */
256+
/* datapage offsets for use by vdso */
257+
DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct vdso_data, tb_orig_stamp));
258+
DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct vdso_data, tb_ticks_per_sec));
259+
DEFINE(CFG_TB_TO_XS, offsetof(struct vdso_data, tb_to_xs));
260+
DEFINE(CFG_STAMP_XSEC, offsetof(struct vdso_data, stamp_xsec));
261+
DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct vdso_data, tb_update_count));
262+
DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct vdso_data, tz_minuteswest));
263+
DEFINE(CFG_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
264+
DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
265+
DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
266+
DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
267+
#ifdef CONFIG_PPC64
268+
DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64));
267269
DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec));
268270
DEFINE(TVAL64_TV_USEC, offsetof(struct timeval, tv_usec));
269271
DEFINE(TVAL32_TV_SEC, offsetof(struct compat_timeval, tv_sec));
270272
DEFINE(TVAL32_TV_USEC, offsetof(struct compat_timeval, tv_usec));
273+
DEFINE(TSPC32_TV_SEC, offsetof(struct compat_timespec, tv_sec));
274+
DEFINE(TSPC32_TV_NSEC, offsetof(struct compat_timespec, tv_nsec));
275+
#else
276+
DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec));
277+
DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec));
278+
DEFINE(TSPEC32_TV_SEC, offsetof(struct timespec, tv_sec));
279+
DEFINE(TSPEC32_TV_NSEC, offsetof(struct timespec, tv_nsec));
280+
#endif
281+
/* timeval/timezone offsets for use by vdso */
271282
DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
272283
DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
273-
#endif /* CONFIG_PPC64 */
284+
285+
/* Other bits used by the vdso */
286+
DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
287+
DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
288+
DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
289+
DEFINE(CLOCK_REALTIME_RES, TICK_NSEC);
290+
274291
return 0;
275292
}

arch/powerpc/kernel/paca.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@
1515
#include <asm/processor.h>
1616
#include <asm/ptrace.h>
1717
#include <asm/page.h>
18-
#include <asm/systemcfg.h>
1918
#include <asm/lppaca.h>
2019
#include <asm/iseries/it_lp_queue.h>
2120
#include <asm/paca.h>
2221

23-
static union {
24-
struct systemcfg data;
25-
u8 page[PAGE_SIZE];
26-
} systemcfg_store __attribute__((__section__(".data.page.aligned")));
27-
struct systemcfg *_systemcfg = &systemcfg_store.data;
28-
2922

3023
/* This symbol is provided by the linker - let it fill in the paca
3124
* field correctly */

arch/powerpc/kernel/proc_ppc64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <linux/slab.h>
2424
#include <linux/kernel.h>
2525

26-
#include <asm/systemcfg.h>
26+
#include <asm/vdso_datapage.h>
2727
#include <asm/rtas.h>
2828
#include <asm/uaccess.h>
2929
#include <asm/prom.h>
@@ -72,7 +72,7 @@ static int __init proc_ppc64_init(void)
7272
if (!pde)
7373
return 1;
7474
pde->nlink = 1;
75-
pde->data = _systemcfg;
75+
pde->data = vdso_data;
7676
pde->size = PAGE_SIZE;
7777
pde->proc_fops = &page_map_fops;
7878

arch/powerpc/kernel/rtas-proc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <asm/rtas.h>
3333
#include <asm/machdep.h> /* for ppc_md */
3434
#include <asm/time.h>
35-
#include <asm/systemcfg.h>
3635

3736
/* Token for Sensors */
3837
#define KEY_SWITCH 0x0001

arch/powerpc/kernel/setup-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <asm/io.h>
3434
#include <asm/prom.h>
3535
#include <asm/processor.h>
36-
#include <asm/systemcfg.h>
36+
#include <asm/vdso_datapage.h>
3737
#include <asm/pgtable.h>
3838
#include <asm/smp.h>
3939
#include <asm/elf.h>
@@ -564,7 +564,7 @@ void __init smp_setup_cpu_maps(void)
564564
cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
565565
}
566566

567-
_systemcfg->processorCount = num_present_cpus();
567+
vdso_data->processorCount = num_present_cpus();
568568
#endif /* CONFIG_PPC64 */
569569
}
570570
#endif /* CONFIG_SMP */

arch/powerpc/kernel/setup_64.c

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#include <asm/lmb.h>
5858
#include <asm/iseries/it_lp_naca.h>
5959
#include <asm/firmware.h>
60-
#include <asm/systemcfg.h>
6160
#include <asm/xmon.h>
6261
#include <asm/udbg.h>
6362

@@ -375,9 +374,8 @@ static void __init initialize_cache_info(void)
375374
DBG("Argh, can't find dcache properties ! "
376375
"sizep: %p, lsizep: %p\n", sizep, lsizep);
377376

378-
_systemcfg->dcache_size = ppc64_caches.dsize = size;
379-
_systemcfg->dcache_line_size =
380-
ppc64_caches.dline_size = lsize;
377+
ppc64_caches.dsize = size;
378+
ppc64_caches.dline_size = lsize;
381379
ppc64_caches.log_dline_size = __ilog2(lsize);
382380
ppc64_caches.dlines_per_page = PAGE_SIZE / lsize;
383381

@@ -393,22 +391,13 @@ static void __init initialize_cache_info(void)
393391
DBG("Argh, can't find icache properties ! "
394392
"sizep: %p, lsizep: %p\n", sizep, lsizep);
395393

396-
_systemcfg->icache_size = ppc64_caches.isize = size;
397-
_systemcfg->icache_line_size =
398-
ppc64_caches.iline_size = lsize;
394+
ppc64_caches.isize = size;
395+
ppc64_caches.iline_size = lsize;
399396
ppc64_caches.log_iline_size = __ilog2(lsize);
400397
ppc64_caches.ilines_per_page = PAGE_SIZE / lsize;
401398
}
402399
}
403400

404-
/* Add an eye catcher and the systemcfg layout version number */
405-
strcpy(_systemcfg->eye_catcher, "SYSTEMCFG:PPC64");
406-
_systemcfg->version.major = SYSTEMCFG_MAJOR;
407-
_systemcfg->version.minor = SYSTEMCFG_MINOR;
408-
_systemcfg->processor = mfspr(SPRN_PVR);
409-
_systemcfg->platform = _machine;
410-
_systemcfg->physicalMemorySize = lmb_phys_mem_size();
411-
412401
DBG(" <- initialize_cache_info()\n");
413402
}
414403

@@ -495,15 +484,14 @@ void __init setup_system(void)
495484

496485
printk("-----------------------------------------------------\n");
497486
printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
498-
printk("ppc64_interrupt_controller = 0x%ld\n", ppc64_interrupt_controller);
499-
printk("systemcfg = 0x%p\n", _systemcfg);
500-
printk("systemcfg->platform = 0x%x\n", _systemcfg->platform);
501-
printk("systemcfg->processorCount = 0x%lx\n", _systemcfg->processorCount);
502-
printk("systemcfg->physicalMemorySize = 0x%lx\n", _systemcfg->physicalMemorySize);
487+
printk("ppc64_interrupt_controller = 0x%ld\n",
488+
ppc64_interrupt_controller);
489+
printk("platform = 0x%x\n", _machine);
490+
printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size());
503491
printk("ppc64_caches.dcache_line_size = 0x%x\n",
504-
ppc64_caches.dline_size);
492+
ppc64_caches.dline_size);
505493
printk("ppc64_caches.icache_line_size = 0x%x\n",
506-
ppc64_caches.iline_size);
494+
ppc64_caches.iline_size);
507495
printk("htab_address = 0x%p\n", htab_address);
508496
printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
509497
printk("-----------------------------------------------------\n");
@@ -567,33 +555,6 @@ static void __init emergency_stack_init(void)
567555
__va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE;
568556
}
569557

570-
/*
571-
* Called from setup_arch to initialize the bitmap of available
572-
* syscalls in the systemcfg page
573-
*/
574-
void __init setup_syscall_map(void)
575-
{
576-
unsigned int i, count64 = 0, count32 = 0;
577-
extern unsigned long *sys_call_table;
578-
extern unsigned long sys_ni_syscall;
579-
580-
581-
for (i = 0; i < __NR_syscalls; i++) {
582-
if (sys_call_table[i*2] != sys_ni_syscall) {
583-
count64++;
584-
_systemcfg->syscall_map_64[i >> 5] |=
585-
0x80000000UL >> (i & 0x1f);
586-
}
587-
if (sys_call_table[i*2+1] != sys_ni_syscall) {
588-
count32++;
589-
_systemcfg->syscall_map_32[i >> 5] |=
590-
0x80000000UL >> (i & 0x1f);
591-
}
592-
}
593-
printk(KERN_INFO "Syscall map setup, %d 32-bit and %d 64-bit syscalls\n",
594-
count32, count64);
595-
}
596-
597558
/*
598559
* Called into from start_kernel, after lock_kernel has been called.
599560
* Initializes bootmem, which is unsed to manage page allocation until
@@ -635,9 +596,6 @@ void __init setup_arch(char **cmdline_p)
635596
do_init_bootmem();
636597
sparse_init();
637598

638-
/* initialize the syscall map in systemcfg */
639-
setup_syscall_map();
640-
641599
#ifdef CONFIG_DUMMY_CONSOLE
642600
conswitchp = &dummy_con;
643601
#endif

arch/powerpc/kernel/signal_32.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
#include <asm/uaccess.h>
4444
#include <asm/cacheflush.h>
4545
#include <asm/sigcontext.h>
46+
#include <asm/vdso.h>
4647
#ifdef CONFIG_PPC64
4748
#include "ppc32.h"
4849
#include <asm/unistd.h>
49-
#include <asm/vdso.h>
5050
#else
5151
#include <asm/ucontext.h>
5252
#include <asm/pgtable.h>
@@ -809,14 +809,11 @@ static int handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
809809

810810
/* Save user registers on the stack */
811811
frame = &rt_sf->uc.uc_mcontext;
812-
#ifdef CONFIG_PPC64
813812
if (vdso32_rt_sigtramp && current->thread.vdso_base) {
814813
if (save_user_regs(regs, frame, 0))
815814
goto badframe;
816815
regs->link = current->thread.vdso_base + vdso32_rt_sigtramp;
817-
} else
818-
#endif
819-
{
816+
} else {
820817
if (save_user_regs(regs, frame, __NR_rt_sigreturn))
821818
goto badframe;
822819
regs->link = (unsigned long) frame->tramp;
@@ -1090,14 +1087,11 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
10901087
|| __put_user(sig, &sc->signal))
10911088
goto badframe;
10921089

1093-
#ifdef CONFIG_PPC64
10941090
if (vdso32_sigtramp && current->thread.vdso_base) {
10951091
if (save_user_regs(regs, &frame->mctx, 0))
10961092
goto badframe;
10971093
regs->link = current->thread.vdso_base + vdso32_sigtramp;
1098-
} else
1099-
#endif
1100-
{
1094+
} else {
11011095
if (save_user_regs(regs, &frame->mctx, __NR_sigreturn))
11021096
goto badframe;
11031097
regs->link = (unsigned long) frame->mctx.tramp;

arch/powerpc/kernel/smp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include <asm/cputable.h>
4545
#include <asm/system.h>
4646
#include <asm/mpic.h>
47-
#include <asm/systemcfg.h>
47+
#include <asm/vdso_datapage.h>
4848
#ifdef CONFIG_PPC64
4949
#include <asm/paca.h>
5050
#endif
@@ -371,7 +371,7 @@ int generic_cpu_disable(void)
371371

372372
cpu_clear(cpu, cpu_online_map);
373373
#ifdef CONFIG_PPC64
374-
_systemcfg->processorCount--;
374+
vdso_data->processorCount--;
375375
fixup_irqs(cpu_online_map);
376376
#endif
377377
return 0;

arch/powerpc/kernel/sysfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <asm/firmware.h>
1717
#include <asm/hvcall.h>
1818
#include <asm/prom.h>
19-
#include <asm/systemcfg.h>
2019
#include <asm/paca.h>
2120
#include <asm/lppaca.h>
2221
#include <asm/machdep.h>

0 commit comments

Comments
 (0)