change function names

This commit is contained in:
Tomoki Shirasawa
2012-12-17 16:15:05 +09:00
parent 0a808057eb
commit 4693789608
49 changed files with 800 additions and 800 deletions

View File

@ -4,8 +4,8 @@
(X86_CPU_LOCAL_OFFSET_TSS + X86_TSS_OFFSET_SP0)
.text
.globl aal_mc_switch_context
aal_mc_switch_context:
.globl ihk_mc_switch_context
ihk_mc_switch_context:
pushfq
popq %rax
testq %rdi, %rdi

View File

@ -250,9 +250,9 @@ static void init_smp_processor(void)
static char *trampoline_va, *first_page_va;
void aal_mc_init_ap(void)
void ihk_mc_init_ap(void)
{
struct aal_mc_cpu_info *cpu_info = aal_mc_get_cpu_info();
struct ihk_mc_cpu_info *cpu_info = ihk_mc_get_cpu_info();
trampoline_va = map_fixed_area(AP_TRAMPOLINE, AP_TRAMPOLINE_SIZE,
0);
@ -270,7 +270,7 @@ void aal_mc_init_ap(void)
extern void init_page_table(void);
extern char x86_syscall[];
long (*__x86_syscall_handler)(int, aal_mc_user_context_t *);
long (*__x86_syscall_handler)(int, ihk_mc_user_context_t *);
void init_syscall(void)
{
@ -344,10 +344,10 @@ void arch_show_interrupt_context(const void *reg);
void handle_interrupt(int vector, struct x86_regs *regs)
{
struct aal_mc_interrupt_handler *h;
struct ihk_mc_interrupt_handler *h;
dkprintf("CPU[%d] got interrupt, vector: %d, RIP: 0x%lX\n",
aal_mc_get_processor_id(), vector, regs->rip);
ihk_mc_get_processor_id(), vector, regs->rip);
if (vector < 0 || vector > 255) {
panic("Invalid interrupt vector.");
@ -439,7 +439,7 @@ static void __x86_wakeup(int apicid, unsigned long ip)
}
}
/** AAL Functions **/
/** IHK Functions **/
void cpu_halt(void)
{
@ -475,8 +475,8 @@ unsigned long cpu_disable_interrupt_save(void)
return flags;
}
int aal_mc_register_interrupt_handler(int vector,
struct aal_mc_interrupt_handler *h)
int ihk_mc_register_interrupt_handler(int vector,
struct ihk_mc_interrupt_handler *h)
{
if (vector < 32 || vector > 255) {
return -EINVAL;
@ -486,8 +486,8 @@ int aal_mc_register_interrupt_handler(int vector,
return 0;
}
int aal_mc_unregister_interrupt_handler(int vector,
struct aal_mc_interrupt_handler *h)
int ihk_mc_unregister_interrupt_handler(int vector,
struct ihk_mc_interrupt_handler *h)
{
list_del(&h->list);
@ -496,7 +496,7 @@ int aal_mc_unregister_interrupt_handler(int vector,
extern unsigned long __page_fault_handler_address;
void aal_mc_set_page_fault_handler(void (*h)(unsigned long, void *))
void ihk_mc_set_page_fault_handler(void (*h)(unsigned long, void *))
{
__page_fault_handler_address = (unsigned long)h;
}
@ -505,7 +505,7 @@ extern char trampoline_code_data[], trampoline_code_data_end[];
struct page_table *get_init_page_table(void);
unsigned long get_transit_page_table(void);
void aal_mc_boot_cpu(int cpuid, unsigned long pc)
void ihk_mc_boot_cpu(int cpuid, unsigned long pc)
{
unsigned long *p;
@ -532,7 +532,7 @@ void aal_mc_boot_cpu(int cpuid, unsigned long pc)
}
}
void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
void ihk_mc_init_context(ihk_mc_kernel_context_t *new_ctx,
void *stack_pointer, void (*next_function)(void))
{
unsigned long *sp;
@ -542,7 +542,7 @@ void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
}
sp = stack_pointer;
memset(new_ctx, 0, sizeof(aal_mc_kernel_context_t));
memset(new_ctx, 0, sizeof(ihk_mc_kernel_context_t));
/* Set the return address */
new_ctx->rsp = (unsigned long)(sp - 1);
@ -551,43 +551,43 @@ void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
extern char enter_user_mode[];
void aal_mc_init_user_process(aal_mc_kernel_context_t *ctx,
aal_mc_user_context_t **puctx,
void ihk_mc_init_user_process(ihk_mc_kernel_context_t *ctx,
ihk_mc_user_context_t **puctx,
void *stack_pointer, unsigned long new_pc,
unsigned long user_sp)
{
char *sp;
aal_mc_user_context_t *uctx;
ihk_mc_user_context_t *uctx;
sp = stack_pointer;
sp -= sizeof(aal_mc_user_context_t);
uctx = (aal_mc_user_context_t *)sp;
sp -= sizeof(ihk_mc_user_context_t);
uctx = (ihk_mc_user_context_t *)sp;
*puctx = uctx;
memset(uctx, 0, sizeof(aal_mc_user_context_t));
memset(uctx, 0, sizeof(ihk_mc_user_context_t));
uctx->cs = USER_CS;
uctx->rip = new_pc;
uctx->ss = USER_DS;
uctx->rsp = user_sp;
uctx->rflags = RFLAGS_IF;
aal_mc_init_context(ctx, sp, (void (*)(void))enter_user_mode);
ihk_mc_init_context(ctx, sp, (void (*)(void))enter_user_mode);
ctx->rsp0 = (unsigned long)stack_pointer;
}
void aal_mc_modify_user_context(aal_mc_user_context_t *uctx,
enum aal_mc_user_context_regtype reg,
void ihk_mc_modify_user_context(ihk_mc_user_context_t *uctx,
enum ihk_mc_user_context_regtype reg,
unsigned long value)
{
if (reg == AAL_UCR_STACK_POINTER) {
if (reg == IHK_UCR_STACK_POINTER) {
uctx->rsp = value;
} else if (reg == AAL_UCR_PROGRAM_COUNTER) {
} else if (reg == IHK_UCR_PROGRAM_COUNTER) {
uctx->rip = value;
}
}
void aal_mc_print_user_context(aal_mc_user_context_t *uctx)
void ihk_mc_print_user_context(ihk_mc_user_context_t *uctx)
{
kprintf("CS:RIP = %04lx:%16lx\n", uctx->cs, uctx->rip);
kprintf("%16lx %16lx %16lx %16lx\n%16lx %16lx %16lx\n",
@ -595,12 +595,12 @@ void aal_mc_print_user_context(aal_mc_user_context_t *uctx)
uctx->rsi, uctx->rdi, uctx->rsp);
}
void aal_mc_set_syscall_handler(long (*handler)(int, aal_mc_user_context_t *))
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *))
{
__x86_syscall_handler = handler;
}
void aal_mc_delay_us(int us)
void ihk_mc_delay_us(int us)
{
arch_delay(us);
}
@ -629,12 +629,12 @@ void arch_show_interrupt_context(const void *reg)
kprintf_unlock(irqflags);
}
int aal_mc_arch_set_special_register(enum aal_asr_type type,
int ihk_mc_arch_set_special_register(enum ihk_asr_type type,
unsigned long value)
{
/* GS modification is not permitted */
switch (type) {
case AAL_ASR_X86_FS:
case IHK_ASR_X86_FS:
wrmsr(MSR_FS_BASE, value);
return 0;
default:
@ -642,12 +642,12 @@ int aal_mc_arch_set_special_register(enum aal_asr_type type,
}
}
int aal_mc_arch_get_special_register(enum aal_asr_type type,
int ihk_mc_arch_get_special_register(enum ihk_asr_type type,
unsigned long *value)
{
/* GS modification is not permitted */
switch (type) {
case AAL_ASR_X86_FS:
case IHK_ASR_X86_FS:
*value = rdmsr(MSR_FS_BASE);
return 0;
default:
@ -655,9 +655,9 @@ int aal_mc_arch_get_special_register(enum aal_asr_type type,
}
}
int aal_mc_interrupt_cpu(int cpu, int vector)
int ihk_mc_interrupt_cpu(int cpu, int vector)
{
kprintf("[%d] aal_mc_interrupt_cpu: %d\n", aal_mc_get_processor_id(), cpu);
kprintf("[%d] ihk_mc_interrupt_cpu: %d\n", ihk_mc_get_processor_id(), cpu);
wait_icr_idle();
x86_issue_ipi(cpu, vector);

View File

@ -12,17 +12,17 @@
int __kprintf(const char *format, ...);
#endif
typedef int aal_spinlock_t;
typedef int ihk_spinlock_t;
#define AAL_STATIC_SPINLOCK_FUNCS
#define IHK_STATIC_SPINLOCK_FUNCS
static void aal_mc_spinlock_init(aal_spinlock_t *lock)
static void ihk_mc_spinlock_init(ihk_spinlock_t *lock)
{
*lock = 0;
}
#define SPIN_LOCK_UNLOCKED 0
static unsigned long aal_mc_spinlock_lock(aal_spinlock_t *lock)
static unsigned long ihk_mc_spinlock_lock(ihk_spinlock_t *lock)
{
int inc = 0x00010000;
int tmp;
@ -46,7 +46,7 @@ static unsigned long aal_mc_spinlock_lock(aal_spinlock_t *lock)
#ifdef DEBUG_SPINLOCK
__kprintf("[%d] trying to grab lock: 0x%lX\n",
aal_mc_get_processor_id(), lock);
ihk_mc_get_processor_id(), lock);
#endif
asm volatile("lock; xaddl %0, %1\n"
"movzwl %w0, %2\n\t"
@ -64,19 +64,19 @@ static unsigned long aal_mc_spinlock_lock(aal_spinlock_t *lock)
: "memory", "cc");
#ifdef DEBUG_SPINLOCK
__kprintf("[%d] holding lock: 0x%lX\n", aal_mc_get_processor_id(), lock);
__kprintf("[%d] holding lock: 0x%lX\n", ihk_mc_get_processor_id(), lock);
#endif
return flags;
}
static void aal_mc_spinlock_unlock(aal_spinlock_t *lock, unsigned long flags)
static void ihk_mc_spinlock_unlock(ihk_spinlock_t *lock, unsigned long flags)
{
asm volatile ("lock incw %0" : "+m"(*lock) : : "memory", "cc");
cpu_restore_interrupt(flags);
#ifdef DEBUG_SPINLOCK
__kprintf("[%d] released lock: 0x%lX\n", aal_mc_get_processor_id(), lock);
__kprintf("[%d] released lock: 0x%lX\n", ihk_mc_get_processor_id(), lock);
#endif
}

View File

@ -79,7 +79,7 @@
#define PFL1_KERN_ATTR (PFL1_PRESENT | PFL1_WRITABLE)
/* For easy conversion, it is better to be the same as architecture's ones */
enum aal_mc_pt_attribute {
enum ihk_mc_pt_attribute {
PTATTR_ACTIVE = 0x01,
PTATTR_WRITABLE = 0x02,
PTATTR_USER = 0x04,
@ -104,5 +104,5 @@ void *map_fixed_area(unsigned long phys, unsigned long size, int uncachable);
#define AP_TRAMPOLINE_SIZE 0x4000
/* Local is cachable */
#define AAL_IKC_QUEUE_PT_ATTR (PTATTR_WRITABLE | PTATTR_UNCACHABLE)
#define IHK_IKC_QUEUE_PT_ATTR (PTATTR_WRITABLE | PTATTR_UNCACHABLE)
#endif

View File

@ -1,50 +1,50 @@
#ifndef HEADER_X86_COMMON_AAL_ATOMIC_H
#define HEADER_X86_COMMON_AAL_ATOMIC_H
#ifndef HEADER_X86_COMMON_IHK_ATOMIC_H
#define HEADER_X86_COMMON_IHK_ATOMIC_H
typedef struct {
int counter;
} aal_atomic_t;
} ihk_atomic_t;
#define AAL_ATOMIC_INIT(i) { (i) }
#define IHK_ATOMIC_INIT(i) { (i) }
static inline int aal_atomic_read(const aal_atomic_t *v)
static inline int ihk_atomic_read(const ihk_atomic_t *v)
{
return (*(volatile int *)&(v)->counter);
}
static inline void aal_atomic_set(aal_atomic_t *v, int i)
static inline void ihk_atomic_set(ihk_atomic_t *v, int i)
{
v->counter = i;
}
static inline void aal_atomic_add(int i, aal_atomic_t *v)
static inline void ihk_atomic_add(int i, ihk_atomic_t *v)
{
asm volatile("lock addl %1,%0"
: "+m" (v->counter)
: "ir" (i));
}
static inline void aal_atomic_sub(int i, aal_atomic_t *v)
static inline void ihk_atomic_sub(int i, ihk_atomic_t *v)
{
asm volatile("lock subl %1,%0"
: "+m" (v->counter)
: "ir" (i));
}
static inline void aal_atomic_inc(aal_atomic_t *v)
static inline void ihk_atomic_inc(ihk_atomic_t *v)
{
asm volatile("lock incl %0"
: "+m" (v->counter));
}
static inline void aal_atomic_dec(aal_atomic_t *v)
static inline void ihk_atomic_dec(ihk_atomic_t *v)
{
asm volatile("lock decl %0"
: "+m" (v->counter));
}
static inline int aal_atomic_dec_and_test(aal_atomic_t *v)
static inline int ihk_atomic_dec_and_test(ihk_atomic_t *v)
{
unsigned char c;
@ -54,7 +54,7 @@ static inline int aal_atomic_dec_and_test(aal_atomic_t *v)
return c != 0;
}
static inline int aal_atomic_inc_and_test(aal_atomic_t *v)
static inline int ihk_atomic_inc_and_test(ihk_atomic_t *v)
{
unsigned char c;
@ -64,7 +64,7 @@ static inline int aal_atomic_inc_and_test(aal_atomic_t *v)
return c != 0;
}
static inline int aal_atomic_add_return(int i, aal_atomic_t *v)
static inline int ihk_atomic_add_return(int i, ihk_atomic_t *v)
{
int __i;
@ -75,12 +75,12 @@ static inline int aal_atomic_add_return(int i, aal_atomic_t *v)
return i + __i;
}
static inline int aal_atomic_sub_return(int i, aal_atomic_t *v)
static inline int ihk_atomic_sub_return(int i, ihk_atomic_t *v)
{
return aal_atomic_add_return(-i, v);
return ihk_atomic_add_return(-i, v);
}
#define aal_atomic_inc_return(v) (aal_atomic_add_return(1, v))
#define aal_atomic_dec_return(v) (aal_atomic_sub_return(1, v))
#define ihk_atomic_inc_return(v) (ihk_atomic_add_return(1, v))
#define ihk_atomic_dec_return(v) (ihk_atomic_sub_return(1, v))
#endif

View File

@ -8,20 +8,20 @@ struct x86_kregs {
unsigned long rsp0;
};
typedef struct x86_kregs aal_mc_kernel_context_t;
typedef struct x86_kregs ihk_mc_kernel_context_t;
/* XXX: User context should contain floating point registers */
typedef struct x86_regs aal_mc_user_context_t;
typedef struct x86_regs ihk_mc_user_context_t;
#define aal_mc_syscall_arg0(uc) (uc)->rdi
#define aal_mc_syscall_arg1(uc) (uc)->rsi
#define aal_mc_syscall_arg2(uc) (uc)->rdx
#define aal_mc_syscall_arg3(uc) (uc)->r10
#define aal_mc_syscall_arg4(uc) (uc)->r8
#define aal_mc_syscall_arg5(uc) (uc)->r9
#define ihk_mc_syscall_arg0(uc) (uc)->rdi
#define ihk_mc_syscall_arg1(uc) (uc)->rsi
#define ihk_mc_syscall_arg2(uc) (uc)->rdx
#define ihk_mc_syscall_arg3(uc) (uc)->r10
#define ihk_mc_syscall_arg4(uc) (uc)->r8
#define ihk_mc_syscall_arg5(uc) (uc)->r9
#define aal_mc_syscall_ret(uc) (uc)->rax
#define ihk_mc_syscall_ret(uc) (uc)->rax
#define aal_mc_syscall_pc(uc) (uc)->rip
#define aal_mc_syscall_sp(uc) (uc)->rsp
#define ihk_mc_syscall_pc(uc) (uc)->rip
#define ihk_mc_syscall_sp(uc) (uc)->rsp
#endif

View File

@ -1,11 +1,11 @@
#ifndef HEADER_X86_COMMON_AAL_IKC_H
#define HEADER_X86_COMMON_AAL_IKC_H
#ifndef HEADER_X86_COMMON_IHK_IKC_H
#define HEADER_X86_COMMON_IHK_IKC_H
#include <ikc/ihk.h>
/* manycore side */
int aal_mc_ikc_init_first(struct aal_ikc_channel_desc *,
aal_ikc_ph_t handler);
int ihk_mc_ikc_init_first(struct ihk_ikc_channel_desc *,
ihk_ikc_ph_t handler);
#endif

View File

@ -103,7 +103,7 @@ static unsigned long read_perfctr(int counter)
return rdpmc(counter);
}
#define aal_mc_mb() asm volatile("mfence" : : : "memory");
#define ihk_mc_mb() asm volatile("mfence" : : : "memory");
struct x86_desc_ptr {
uint16_t size;

View File

@ -11,7 +11,7 @@ struct x86_cpu_local_variables *locals;
void init_processors_local(int max_id)
{
/* Is contiguous allocating adequate?? */
locals = aal_mc_alloc_pages(max_id, 0);
locals = ihk_mc_alloc_pages(max_id, 0);
memset(locals, 0, PAGE_SIZE * max_id);
kprintf("locals = %p\n", locals);
@ -30,14 +30,14 @@ static void *get_x86_cpu_local_kstack(int id)
struct x86_cpu_local_variables *get_x86_this_cpu_local(void)
{
int id = aal_mc_get_processor_id();
int id = ihk_mc_get_processor_id();
return get_x86_cpu_local_variable(id);
}
void *get_x86_this_cpu_kstack(void)
{
int id = aal_mc_get_processor_id();
int id = ihk_mc_get_processor_id();
return get_x86_cpu_local_kstack(id);
}
@ -52,14 +52,14 @@ static void set_gs_base(void *address)
wrmsr(MSR_GS_BASE, (unsigned long)address);
}
static aal_atomic_t last_processor_id = AAL_ATOMIC_INIT(-1);
static ihk_atomic_t last_processor_id = IHK_ATOMIC_INIT(-1);
void assign_processor_id(void)
{
int id;
struct x86_cpu_local_variables *v;
id = aal_atomic_inc_return(&last_processor_id);
id = ihk_atomic_inc_return(&last_processor_id);
v = get_x86_cpu_local_variable(id);
set_gs_base(v);
@ -67,8 +67,8 @@ void assign_processor_id(void)
v->processor_id = id;
}
/** AAL **/
int aal_mc_get_processor_id(void)
/** IHK **/
int ihk_mc_get_processor_id(void)
{
int id;
@ -77,7 +77,7 @@ int aal_mc_get_processor_id(void)
return id;
}
int aal_mc_get_hardware_processor_id(void)
int ihk_mc_get_hardware_processor_id(void)
{
struct x86_cpu_local_variables *v = get_x86_this_cpu_local();

View File

@ -2,12 +2,12 @@
#if 0
void aal_mc_spinlock_init(aal_spinlock_t *lock)
void ihk_mc_spinlock_init(ihk_spinlock_t *lock)
{
*lock = 0;
}
void aal_mc_spinlock_lock(aal_spinlock_t *lock, unsigned long *flags)
void ihk_mc_spinlock_lock(ihk_spinlock_t *lock, unsigned long *flags)
{
int inc = 0x00010000;
int tmp;
@ -26,7 +26,7 @@ void aal_mc_spinlock_lock(aal_spinlock_t *lock, unsigned long *flags)
: "+Q" (inc), "+m" (*lock), "=r" (tmp) : : "memory", "cc");
}
void aal_mc_spinlock_unlock(aal_spinlock_t *lock, unsigned long *flags)
void ihk_mc_spinlock_unlock(ihk_spinlock_t *lock, unsigned long *flags)
{
asm volatile ("lock incw %0" : "+m"(*lock) : : "memory", "cc");
cpu_restore_interrupt(*flags);

View File

@ -10,7 +10,7 @@
static char *last_page;
extern char _head[], _end[];
struct aal_mc_pa_ops *pa_ops;
struct ihk_mc_pa_ops *pa_ops;
extern unsigned long x86_kernel_phys_base;
@ -32,7 +32,7 @@ void *early_alloc_page(void)
return p;
}
void *arch_alloc_page(enum aal_mc_ap_flag flag)
void *arch_alloc_page(enum ihk_mc_ap_flag flag)
{
if (pa_ops)
return pa_ops->alloc_page(1, flag);
@ -45,7 +45,7 @@ void arch_free_page(void *ptr)
pa_ops->free_page(ptr, 1);
}
void *aal_mc_alloc_pages(int npages, enum aal_mc_ap_flag flag)
void *ihk_mc_alloc_pages(int npages, enum ihk_mc_ap_flag flag)
{
if (pa_ops)
return pa_ops->alloc_page(npages, flag);
@ -53,26 +53,26 @@ void *aal_mc_alloc_pages(int npages, enum aal_mc_ap_flag flag)
return NULL;
}
void aal_mc_free_pages(void *p, int npages)
void ihk_mc_free_pages(void *p, int npages)
{
if (pa_ops)
pa_ops->free_page(p, npages);
}
void *aal_mc_allocate(int size, enum aal_mc_ap_flag flag)
void *ihk_mc_allocate(int size, enum ihk_mc_ap_flag flag)
{
if (pa_ops && pa_ops->alloc)
return pa_ops->alloc(size, flag);
else
return aal_mc_alloc_pages(1, flag);
return ihk_mc_alloc_pages(1, flag);
}
void aal_mc_free(void *p)
void ihk_mc_free(void *p)
{
if (pa_ops && pa_ops->free)
return pa_ops->free(p);
else
return aal_mc_free_pages(p, 1);
return ihk_mc_free_pages(p, 1);
}
void *get_last_early_heap(void)
@ -146,8 +146,8 @@ static void init_normal_area(struct page_table *pt)
unsigned long map_start, map_end, phys, pt_phys;
int ident_index, virt_index;
map_start = aal_mc_get_memory_address(AAL_MC_GMA_MAP_START, 0);
map_end = aal_mc_get_memory_address(AAL_MC_GMA_MAP_END, 0);
map_start = ihk_mc_get_memory_address(IHK_MC_GMA_MAP_START, 0);
map_end = ihk_mc_get_memory_address(IHK_MC_GMA_MAP_END, 0);
kprintf("map_start = %lx, map_end = %lx\n", map_start, map_end);
ident_index = map_start >> PTL4_SHIFT;
@ -180,15 +180,15 @@ static struct page_table *__alloc_new_pt(void)
*/
#define ATTR_MASK (PTATTR_WRITABLE | PTATTR_USER | PTATTR_ACTIVE)
static unsigned long attr_to_l4attr(enum aal_mc_pt_attribute attr)
static unsigned long attr_to_l4attr(enum ihk_mc_pt_attribute attr)
{
return (attr & ATTR_MASK) | PFL4_PRESENT;
}
static unsigned long attr_to_l3attr(enum aal_mc_pt_attribute attr)
static unsigned long attr_to_l3attr(enum ihk_mc_pt_attribute attr)
{
return (attr & ATTR_MASK) | PFL3_PRESENT;
}
static unsigned long attr_to_l2attr(enum aal_mc_pt_attribute attr)
static unsigned long attr_to_l2attr(enum ihk_mc_pt_attribute attr)
{
unsigned long r = (attr & (ATTR_MASK | PTATTR_LARGEPAGE));
@ -197,7 +197,7 @@ static unsigned long attr_to_l2attr(enum aal_mc_pt_attribute attr)
}
return r;
}
static unsigned long attr_to_l1attr(enum aal_mc_pt_attribute attr)
static unsigned long attr_to_l1attr(enum ihk_mc_pt_attribute attr)
{
if (attr & PTATTR_UNCACHABLE) {
return (attr & ATTR_MASK) | PFL1_PWT | PFL1_PWT;
@ -398,7 +398,7 @@ static int __clear_pt_page(struct page_table *pt, void *virt, int largepage)
return 0;
}
int aal_mc_pt_virt_to_phys(struct page_table *pt,
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
void *virt, unsigned long *phys)
{
int l4idx, l3idx, l2idx, l1idx;
@ -438,7 +438,7 @@ int aal_mc_pt_virt_to_phys(struct page_table *pt,
return 0;
}
int aal_mc_pt_print_pte(struct page_table *pt, void *virt)
int ihk_mc_pt_print_pte(struct page_table *pt, void *virt)
{
int l4idx, l3idx, l2idx, l1idx;
unsigned long v = (unsigned long)virt;
@ -483,33 +483,33 @@ int aal_mc_pt_print_pte(struct page_table *pt, void *virt)
}
int set_pt_large_page(struct page_table *pt, void *virt, unsigned long phys,
enum aal_mc_pt_attribute attr)
enum ihk_mc_pt_attribute attr)
{
return __set_pt_page(pt, virt, phys, attr | PTATTR_LARGEPAGE
| PTATTR_ACTIVE);
}
int aal_mc_pt_set_large_page(page_table_t pt, void *virt,
unsigned long phys, enum aal_mc_pt_attribute attr)
int ihk_mc_pt_set_large_page(page_table_t pt, void *virt,
unsigned long phys, enum ihk_mc_pt_attribute attr)
{
return __set_pt_page(pt, virt, phys, attr | PTATTR_LARGEPAGE
| PTATTR_ACTIVE);
}
int aal_mc_pt_set_page(page_table_t pt, void *virt,
unsigned long phys, enum aal_mc_pt_attribute attr)
int ihk_mc_pt_set_page(page_table_t pt, void *virt,
unsigned long phys, enum ihk_mc_pt_attribute attr)
{
return __set_pt_page(pt, virt, phys, attr | PTATTR_ACTIVE);
}
int aal_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
enum aal_mc_pt_prepare_flag flag)
int ihk_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
enum ihk_mc_pt_prepare_flag flag)
{
int l4idx, l4e, ret = 0;
unsigned long v = (unsigned long)virt;
struct page_table *pt = p, *newpt;
unsigned long l;
enum aal_mc_pt_attribute attr = PTATTR_WRITABLE;
enum ihk_mc_pt_attribute attr = PTATTR_WRITABLE;
if (!pt) {
pt = init_pt;
@ -517,7 +517,7 @@ int aal_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
l4idx = ((v) >> PTL4_SHIFT) & (PT_ENTRIES - 1);
if (flag == AAL_MC_PT_FIRST_LEVEL) {
if (flag == IHK_MC_PT_FIRST_LEVEL) {
l4e = ((v + size) >> PTL4_SHIFT) & (PT_ENTRIES - 1);
for (; l4idx <= l4e; l4idx++) {
@ -545,9 +545,9 @@ int aal_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
return ret;
}
struct page_table *aal_mc_pt_create(void)
struct page_table *ihk_mc_pt_create(void)
{
struct page_table *pt = aal_mc_alloc_pages(1, 0);
struct page_table *pt = ihk_mc_alloc_pages(1, 0);
memset(pt->entry, 0, PAGE_SIZE);
/* Copy the kernel space */
@ -557,7 +557,7 @@ struct page_table *aal_mc_pt_create(void)
return pt;
}
int aal_mc_pt_clear_page(page_table_t pt, void *virt)
int ihk_mc_pt_clear_page(page_table_t pt, void *virt)
{
return __clear_pt_page(pt, virt, 0);
}
@ -575,7 +575,7 @@ void load_page_table(struct page_table *pt)
asm volatile ("movq %0, %%cr3" : : "r"(pt_addr) : "memory");
}
void aal_mc_load_page_table(struct page_table *pt)
void ihk_mc_load_page_table(struct page_table *pt)
{
load_page_table(pt);
}
@ -668,7 +668,7 @@ void init_page_table(void)
extern void __reserve_arch_pages(unsigned long, unsigned long,
void (*)(unsigned long, unsigned long, int));
void aal_mc_reserve_arch_pages(unsigned long start, unsigned long end,
void ihk_mc_reserve_arch_pages(unsigned long start, unsigned long end,
void (*cb)(unsigned long, unsigned long, int))
{
/* Reserve Text + temporal heap */
@ -681,7 +681,7 @@ void aal_mc_reserve_arch_pages(unsigned long start, unsigned long end,
__reserve_arch_pages(start, end, cb);
}
void aal_mc_set_page_allocator(struct aal_mc_pa_ops *ops)
void ihk_mc_set_page_allocator(struct ihk_mc_pa_ops *ops)
{
last_page = NULL;
pa_ops = ops;

View File

@ -5,29 +5,29 @@
#include <string.h>
extern void arch_set_mikc_queue(void *r, void *w);
aal_ikc_ph_t arch_master_channel_packet_handler;
ihk_ikc_ph_t arch_master_channel_packet_handler;
int aal_mc_ikc_init_first_local(struct aal_ikc_channel_desc *channel,
aal_ikc_ph_t packet_handler)
int ihk_mc_ikc_init_first_local(struct ihk_ikc_channel_desc *channel,
ihk_ikc_ph_t packet_handler)
{
struct aal_ikc_queue_head *rq, *wq;
struct ihk_ikc_queue_head *rq, *wq;
aal_ikc_system_init(NULL);
ihk_ikc_system_init(NULL);
memset(channel, 0, sizeof(struct aal_ikc_channel_desc));
memset(channel, 0, sizeof(struct ihk_ikc_channel_desc));
/* Place both sides in this side */
rq = arch_alloc_page(0);
wq = arch_alloc_page(0);
aal_ikc_init_queue(rq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
aal_ikc_init_queue(wq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
ihk_ikc_init_queue(rq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
ihk_ikc_init_queue(wq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
arch_master_channel_packet_handler = packet_handler;
aal_ikc_init_desc(channel, IKC_OS_HOST, 0, rq, wq,
aal_ikc_master_channel_packet_handler);
aal_ikc_enable_channel(channel);
ihk_ikc_init_desc(channel, IKC_OS_HOST, 0, rq, wq,
ihk_ikc_master_channel_packet_handler);
ihk_ikc_enable_channel(channel);
/* Set boot parameter */
arch_set_mikc_queue(rq, wq);

View File

@ -48,7 +48,7 @@ static int set_perfctr_x86(int counter, int event, int mask, int inv, int count,
CVAL2(event, mask, inv, count));
}
int aal_mc_perfctr_init(int counter, enum aal_perfctr_type type, int mode)
int ihk_mc_perfctr_init(int counter, enum ihk_perfctr_type type, int mode)
{
if (counter < 0 || counter >= X86_IA32_NUM_PERF_COUNTERS) {
return -EINVAL;
@ -67,7 +67,7 @@ int aal_mc_perfctr_init(int counter, enum aal_perfctr_type type, int mode)
extern void x86_march_perfctr_start(unsigned long counter_mask);
#endif
int aal_mc_perfctr_start(unsigned long counter_mask)
int ihk_mc_perfctr_start(unsigned long counter_mask)
{
unsigned int value = 0;
@ -82,7 +82,7 @@ int aal_mc_perfctr_start(unsigned long counter_mask)
return 0;
}
int aal_mc_perfctr_stop(unsigned long counter_mask)
int ihk_mc_perfctr_stop(unsigned long counter_mask)
{
unsigned int value;
@ -94,7 +94,7 @@ int aal_mc_perfctr_stop(unsigned long counter_mask)
return 0;
}
int aal_mc_perfctr_reset(int counter)
int ihk_mc_perfctr_reset(int counter)
{
if (counter < 0 || counter >= X86_IA32_NUM_PERF_COUNTERS) {
return -EINVAL;
@ -105,7 +105,7 @@ int aal_mc_perfctr_reset(int counter)
return 0;
}
int aal_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
{
int i, j;
@ -118,7 +118,7 @@ int aal_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
return 0;
}
unsigned long aal_mc_perfctr_read(int counter)
unsigned long ihk_mc_perfctr_read(int counter)
{
if (counter < 0 || counter >= X86_IA32_NUM_PERF_COUNTERS) {
return -EINVAL;

View File

@ -20,7 +20,7 @@ static DECLARE_WAIT_QUEUE_HEAD(wq_prepare);
extern struct mcctrl_channel *channels;
int mcctrl_ikc_set_recv_cpu(int cpu);
static long mcexec_prepare_image(aal_os_t os,
static long mcexec_prepare_image(ihk_os_t os,
struct program_load_desc * __user udesc)
{
struct program_load_desc desc, *pdesc;
@ -97,18 +97,18 @@ free_out:
return ret;
}
int mcexec_load_image(aal_os_t os, struct program_transfer *__user upt)
int mcexec_load_image(ihk_os_t os, struct program_transfer *__user upt)
{
struct program_transfer pt;
unsigned long phys, ret = 0;
void *rpm;
#if 0
unsigned long dma_status = 0;
aal_dma_channel_t channel;
struct aal_dma_request request;
ihk_dma_channel_t channel;
struct ihk_dma_request request;
void *p;
channel = aal_device_get_dma_channel(aal_os_to_dev(os), 0);
channel = ihk_device_get_dma_channel(ihk_os_to_dev(os), 0);
if (!channel) {
return -EINVAL;
}
@ -118,23 +118,23 @@ int mcexec_load_image(aal_os_t os, struct program_transfer *__user upt)
return -EFAULT;
}
phys = aal_device_map_memory(aal_os_to_dev(os), pt.dest, PAGE_SIZE);
#ifdef CONFIG_KNF
phys = ihk_device_map_memory(ihk_os_to_dev(os), pt.dest, PAGE_SIZE);
#ifdef CONFIG_MIC
rpm = ioremap_wc(phys, PAGE_SIZE);
#else
rpm = aal_device_map_virtual(aal_os_to_dev(os), phys, PAGE_SIZE, NULL, 0);
rpm = ihk_device_map_virtual(ihk_os_to_dev(os), phys, PAGE_SIZE, NULL, 0);
#endif
if (copy_from_user(rpm, pt.src, PAGE_SIZE)) {
ret = -EFAULT;
}
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
iounmap(rpm);
#else
aal_device_unmap_virtual(aal_os_to_dev(os), rpm, PAGE_SIZE);
ihk_device_unmap_virtual(ihk_os_to_dev(os), rpm, PAGE_SIZE);
#endif
aal_device_unmap_memory(aal_os_to_dev(os), phys, PAGE_SIZE);
ihk_device_unmap_memory(ihk_os_to_dev(os), phys, PAGE_SIZE);
return ret;
@ -154,7 +154,7 @@ int mcexec_load_image(aal_os_t os, struct program_transfer *__user upt)
request.notify = (void *)virt_to_phys(&dma_status);
request.priv = (void *)1;
aal_dma_request(channel, &request);
ihk_dma_request(channel, &request);
while (!dma_status) {
mb();
@ -169,7 +169,7 @@ int mcexec_load_image(aal_os_t os, struct program_transfer *__user upt)
extern unsigned long last_thread_exec;
static long mcexec_start_image(aal_os_t os,
static long mcexec_start_image(ihk_os_t os,
struct program_load_desc * __user udesc)
{
struct program_load_desc desc;
@ -205,7 +205,7 @@ int mcexec_syscall(struct mcctrl_channel *c, unsigned long arg)
}
#ifndef DO_USER_MODE
int __do_in_kernel_syscall(aal_os_t os, struct mcctrl_channel *c,
int __do_in_kernel_syscall(ihk_os_t os, struct mcctrl_channel *c,
struct syscall_request *sc);
static int remaining_job, base_cpu, job_pos;
#endif
@ -213,7 +213,7 @@ static int remaining_job, base_cpu, job_pos;
extern int num_channels;
extern int mcctrl_dma_abort;
int mcexec_wait_syscall(aal_os_t os, struct syscall_wait_desc *__user req)
int mcexec_wait_syscall(ihk_os_t os, struct syscall_wait_desc *__user req)
{
struct syscall_wait_desc swd;
struct mcctrl_channel *c;
@ -289,7 +289,7 @@ int mcexec_wait_syscall(aal_os_t os, struct syscall_wait_desc *__user req)
return 0;
}
long mcexec_pin_region(aal_os_t os, unsigned long *__user arg)
long mcexec_pin_region(ihk_os_t os, unsigned long *__user arg)
{
struct prepare_dma_desc desc;
int pin_shift = 16;
@ -318,7 +318,7 @@ long mcexec_pin_region(aal_os_t os, unsigned long *__user arg)
return 0;
}
long mcexec_free_region(aal_os_t os, unsigned long *__user arg)
long mcexec_free_region(ihk_os_t os, unsigned long *__user arg)
{
struct free_dma_desc desc;
int pin_shift = 16;
@ -339,7 +339,7 @@ long mcexec_free_region(aal_os_t os, unsigned long *__user arg)
return 0;
}
long mcexec_load_syscall(aal_os_t os, struct syscall_load_desc *__user arg)
long mcexec_load_syscall(ihk_os_t os, struct syscall_load_desc *__user arg)
{
struct syscall_load_desc desc;
unsigned long phys;
@ -349,11 +349,11 @@ long mcexec_load_syscall(aal_os_t os, struct syscall_load_desc *__user arg)
return -EFAULT;
}
phys = aal_device_map_memory(aal_os_to_dev(os), desc.src, desc.size);
#ifdef CONFIG_KNF
phys = ihk_device_map_memory(ihk_os_to_dev(os), desc.src, desc.size);
#ifdef CONFIG_MIC
rpm = ioremap_wc(phys, desc.size);
#else
rpm = aal_device_map_virtual(aal_os_to_dev(os), phys, desc.size, NULL, 0);
rpm = ihk_device_map_virtual(ihk_os_to_dev(os), phys, desc.size, NULL, 0);
#endif
dprintk("mcexec_load_syscall: %s (desc.size: %d)\n", rpm, desc.size);
@ -362,20 +362,20 @@ long mcexec_load_syscall(aal_os_t os, struct syscall_load_desc *__user arg)
return -EFAULT;
}
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
iounmap(rpm);
#else
aal_device_unmap_virtual(aal_os_to_dev(os), rpm, desc.size);
ihk_device_unmap_virtual(ihk_os_to_dev(os), rpm, desc.size);
#endif
aal_device_unmap_memory(aal_os_to_dev(os), phys, desc.size);
ihk_device_unmap_memory(ihk_os_to_dev(os), phys, desc.size);
/*
aal_dma_channel_t channel;
struct aal_dma_request request;
ihk_dma_channel_t channel;
struct ihk_dma_request request;
unsigned long dma_status = 0;
channel = aal_device_get_dma_channel(aal_os_to_dev(os), 0);
channel = ihk_device_get_dma_channel(ihk_os_to_dev(os), 0);
if (!channel) {
return -EINVAL;
}
@ -389,7 +389,7 @@ long mcexec_load_syscall(aal_os_t os, struct syscall_load_desc *__user arg)
request.notify = (void *)virt_to_phys(&dma_status);
request.priv = (void *)1;
aal_dma_request(channel, &request);
ihk_dma_request(channel, &request);
while (!dma_status) {
mb();
@ -400,15 +400,15 @@ long mcexec_load_syscall(aal_os_t os, struct syscall_load_desc *__user arg)
return 0;
}
long mcexec_ret_syscall(aal_os_t os, struct syscall_ret_desc *__user arg)
long mcexec_ret_syscall(ihk_os_t os, struct syscall_ret_desc *__user arg)
{
struct syscall_ret_desc ret;
struct mcctrl_channel *mc;
#if 0
aal_dma_channel_t channel;
struct aal_dma_request request;
ihk_dma_channel_t channel;
struct ihk_dma_request request;
channel = aal_device_get_dma_channel(aal_os_to_dev(os), 0);
channel = ihk_device_get_dma_channel(ihk_os_to_dev(os), 0);
if (!channel) {
return -EINVAL;
}
@ -429,12 +429,12 @@ long mcexec_ret_syscall(aal_os_t os, struct syscall_ret_desc *__user arg)
unsigned long phys;
void *rpm;
phys = aal_device_map_memory(aal_os_to_dev(os), ret.dest,
phys = ihk_device_map_memory(ihk_os_to_dev(os), ret.dest,
ret.size);
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
rpm = ioremap_wc(phys, ret.size);
#else
rpm = aal_device_map_virtual(aal_os_to_dev(os), phys,
rpm = ihk_device_map_virtual(ihk_os_to_dev(os), phys,
ret.size, NULL, 0);
#endif
@ -444,12 +444,12 @@ long mcexec_ret_syscall(aal_os_t os, struct syscall_ret_desc *__user arg)
mc->param.response_va->status = 1;
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
iounmap(rpm);
#else
aal_device_unmap_virtual(aal_os_to_dev(os), rpm, ret.size);
ihk_device_unmap_virtual(ihk_os_to_dev(os), rpm, ret.size);
#endif
aal_device_unmap_memory(aal_os_to_dev(os), phys, ret.size);
ihk_device_unmap_memory(ihk_os_to_dev(os), phys, ret.size);
/*
memset(&request, 0, sizeof(request));
@ -462,7 +462,7 @@ long mcexec_ret_syscall(aal_os_t os, struct syscall_ret_desc *__user arg)
request.notify = (void *)mc->param.response_rpa;
request.priv = (void *)1;
aal_dma_request(channel, &request);
ihk_dma_request(channel, &request);
*/
} else {
mc->param.response_va->status = 1;
@ -471,7 +471,7 @@ long mcexec_ret_syscall(aal_os_t os, struct syscall_ret_desc *__user arg)
return 0;
}
long __mcctrl_control(aal_os_t os, unsigned int req, unsigned long arg)
long __mcctrl_control(ihk_os_t os, unsigned int req, unsigned long arg)
{
switch (req) {
case MCEXEC_UP_PREPARE_IMAGE:

View File

@ -9,17 +9,17 @@
#include <linux/slab.h>
#include "mcctrl.h"
extern long __mcctrl_control(aal_os_t, unsigned int, unsigned long);
extern int prepare_ikc_channels(aal_os_t os);
extern void destroy_ikc_channels(aal_os_t os);
extern long __mcctrl_control(ihk_os_t, unsigned int, unsigned long);
extern int prepare_ikc_channels(ihk_os_t os);
extern void destroy_ikc_channels(ihk_os_t os);
static long mcctrl_ioctl(aal_os_t os, unsigned int request, void *priv,
static long mcctrl_ioctl(ihk_os_t os, unsigned int request, void *priv,
unsigned long arg)
{
return __mcctrl_control(os, request, arg);
}
static struct aal_os_user_call_handler mcctrl_uchs[] = {
static struct ihk_os_user_call_handler mcctrl_uchs[] = {
{ .request = MCEXEC_UP_PREPARE_IMAGE, .func = mcctrl_ioctl },
{ .request = MCEXEC_UP_LOAD_IMAGE, .func = mcctrl_ioctl },
{ .request = MCEXEC_UP_START_IMAGE, .func = mcctrl_ioctl },
@ -30,16 +30,16 @@ static struct aal_os_user_call_handler mcctrl_uchs[] = {
{ .request = MCEXEC_UP_FREE_DMA, .func = mcctrl_ioctl },
};
static struct aal_os_user_call mcctrl_uc = {
static struct ihk_os_user_call mcctrl_uc = {
.num_handlers = sizeof(mcctrl_uchs) / sizeof(mcctrl_uchs[0]),
.handlers = mcctrl_uchs,
};
static aal_os_t os;
static ihk_os_t os;
static int __init mcctrl_init(void)
{
os = aal_host_find_os(0, NULL);
os = ihk_host_find_os(0, NULL);
if (!os) {
printk("OS #0 not found.\n");
return -ENOENT;
@ -49,13 +49,13 @@ static int __init mcctrl_init(void)
return -EINVAL;
}
return aal_os_register_user_call_handlers(os, &mcctrl_uc);
return ihk_os_register_user_call_handlers(os, &mcctrl_uc);
}
static void __exit mcctrl_exit(void)
{
printk("mcctrl: unregistered.\n");
aal_os_unregister_user_call_handlers(os, &mcctrl_uc);
ihk_os_unregister_user_call_handlers(os, &mcctrl_uc);
destroy_ikc_channels(os);
}

View File

@ -15,10 +15,10 @@ int num_channels;
struct mcctrl_channel *channels;
void mcexec_prepare_ack(unsigned long arg);
static void mcctrl_ikc_init(aal_os_t os, int cpu, unsigned long rphys);
static void mcctrl_ikc_init(ihk_os_t os, int cpu, unsigned long rphys);
int mcexec_syscall(struct mcctrl_channel *c, unsigned long arg);
static int syscall_packet_handler(struct aal_ikc_channel_desc *c,
static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *__os)
{
struct ikc_scd_packet *pisp = __packet;
@ -45,7 +45,7 @@ int mcctrl_ikc_send(int cpu, struct ikc_scd_packet *pisp)
if (cpu < 0 || cpu >= num_channels || !channels[cpu].c) {
return -EINVAL;
}
return aal_ikc_send(channels[cpu].c, pisp, 0);
return ihk_ikc_send(channels[cpu].c, pisp, 0);
}
int mcctrl_ikc_send_msg(int cpu, int msg, int ref, unsigned long arg)
@ -60,15 +60,15 @@ int mcctrl_ikc_send_msg(int cpu, int msg, int ref, unsigned long arg)
packet.ref = ref;
packet.arg = arg;
return aal_ikc_send(channels[cpu].c, &packet, 0);
return ihk_ikc_send(channels[cpu].c, &packet, 0);
}
int mcctrl_ikc_set_recv_cpu(int cpu)
{
aal_ikc_channel_set_cpu(channels[cpu].c,
aal_ikc_get_processor_id());
ihk_ikc_channel_set_cpu(channels[cpu].c,
ihk_ikc_get_processor_id());
kprintf("Setting the target to %d\n",
aal_ikc_get_processor_id());
ihk_ikc_get_processor_id());
return 0;
}
@ -84,7 +84,7 @@ int mcctrl_ikc_is_valid_thread(int cpu)
unsigned long *mcctrl_doorbell_va;
unsigned long mcctrl_doorbell_pa;
static void mcctrl_ikc_init(aal_os_t os, int cpu, unsigned long rphys)
static void mcctrl_ikc_init(ihk_os_t os, int cpu, unsigned long rphys)
{
struct ikc_scd_packet packet;
struct mcctrl_channel *pmc = channels + cpu;
@ -97,12 +97,12 @@ static void mcctrl_ikc_init(aal_os_t os, int cpu, unsigned long rphys)
printk("IKC init: %d\n", cpu);
phys = aal_device_map_memory(aal_os_to_dev(os), rphys,
phys = ihk_device_map_memory(ihk_os_to_dev(os), rphys,
sizeof(struct ikc_scd_init_param));
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
rpm = ioremap_wc(phys, sizeof(struct ikc_scd_init_param));
#else
rpm = aal_device_map_virtual(aal_os_to_dev(os), phys,
rpm = ihk_device_map_virtual(ihk_os_to_dev(os), phys,
sizeof(struct ikc_scd_init_param),
NULL, 0);
#endif
@ -121,14 +121,14 @@ static void mcctrl_ikc_init(aal_os_t os, int cpu, unsigned long rphys)
pmc->param.response_rpa = rpm->response_page;
pmc->param.response_pa
= aal_device_map_memory(aal_os_to_dev(os),
= ihk_device_map_memory(ihk_os_to_dev(os),
pmc->param.response_rpa,
PAGE_SIZE);
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
pmc->param.response_va = ioremap_cache(pmc->param.response_pa,
PAGE_SIZE);
#else
pmc->param.response_va = aal_device_map_virtual(aal_os_to_dev(os),
pmc->param.response_va = ihk_device_map_virtual(ihk_os_to_dev(os),
pmc->param.response_pa,
PAGE_SIZE, NULL, 0);
#endif
@ -151,22 +151,22 @@ static void mcctrl_ikc_init(aal_os_t os, int cpu, unsigned long rphys)
pmc->param.request_va, pmc->param.response_va,
pmc->param.doorbell_va);
aal_ikc_send(pmc->c, &packet, 0);
ihk_ikc_send(pmc->c, &packet, 0);
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
iounmap(rpm);
#else
aal_device_unmap_virtual(aal_os_to_dev(os), rpm,
ihk_device_unmap_virtual(ihk_os_to_dev(os), rpm,
sizeof(struct ikc_scd_init_param));
#endif
aal_device_unmap_memory(aal_os_to_dev(os), phys,
ihk_device_unmap_memory(ihk_os_to_dev(os), phys,
sizeof(struct ikc_scd_init_param));
}
static int connect_handler(struct aal_ikc_channel_info *param)
static int connect_handler(struct ihk_ikc_channel_info *param)
{
struct aal_ikc_channel_desc *c;
struct ihk_ikc_channel_desc *c;
int cpu;
c = param->channel;
@ -185,7 +185,7 @@ static int connect_handler(struct aal_ikc_channel_info *param)
return 0;
}
static struct aal_ikc_listen_param listen_param = {
static struct ihk_ikc_listen_param listen_param = {
.port = 501,
.handler = connect_handler,
.pkt_size = sizeof(struct ikc_scd_packet),
@ -193,14 +193,14 @@ static struct aal_ikc_listen_param listen_param = {
.magic = 0x1129,
};
int prepare_ikc_channels(aal_os_t os)
int prepare_ikc_channels(ihk_os_t os)
{
struct aal_cpu_info *info;
struct ihk_cpu_info *info;
mcctrl_doorbell_va = (void *)__get_free_page(GFP_KERNEL);
mcctrl_doorbell_pa = virt_to_phys(mcctrl_doorbell_va);
info = aal_os_get_cpu_info(os);
info = ihk_os_get_cpu_info(os);
if (!info) {
printk("Error: cannot retrieve CPU info.\n");
return -EINVAL;
@ -218,36 +218,36 @@ int prepare_ikc_channels(aal_os_t os)
return -ENOMEM;
}
aal_ikc_listen_port(os, &listen_param);
ihk_ikc_listen_port(os, &listen_param);
return 0;
}
void __destroy_ikc_channel(aal_os_t os, struct mcctrl_channel *pmc)
void __destroy_ikc_channel(ihk_os_t os, struct mcctrl_channel *pmc)
{
free_pages((unsigned long)pmc->param.request_va,
REQUEST_SHIFT - PAGE_SHIFT);
free_page((unsigned long)pmc->param.post_va);
#ifdef CONFIG_KNF
#ifdef CONFIG_MIC
iounmap(pmc->param.response_va);
#else
aal_device_unmap_virtual(aal_os_to_dev(os), pmc->param.response_va,
ihk_device_unmap_virtual(ihk_os_to_dev(os), pmc->param.response_va,
PAGE_SIZE);
#endif
aal_device_unmap_memory(aal_os_to_dev(os),
ihk_device_unmap_memory(ihk_os_to_dev(os),
pmc->param.response_pa, PAGE_SIZE);
free_pages((unsigned long)pmc->dma_buf,
DMA_PIN_SHIFT - PAGE_SHIFT);
}
void destroy_ikc_channels(aal_os_t os)
void destroy_ikc_channels(ihk_os_t os)
{
int i;
for (i = 0; i < num_channels; i++) {
if (channels[i].c) {
// aal_ikc_disconnect(channels[i].c);
aal_ikc_free_channel(channels[i].c);
// ihk_ikc_disconnect(channels[i].c);
ihk_ikc_free_channel(channels[i].c);
__destroy_ikc_channel(os, channels + i);
printk("Channel #%d freed.\n", i);
}

View File

@ -25,7 +25,7 @@ struct ikc_scd_packet {
};
struct mcctrl_priv {
aal_os_t os;
ihk_os_t os;
struct program_load_desc *desc;
};
@ -53,7 +53,7 @@ struct syscall_params {
};
struct mcctrl_channel {
struct aal_ikc_channel_desc *c;
struct ihk_ikc_channel_desc *c;
struct syscall_params param;
struct ikc_scd_init_param init;
void *dma_buf;

View File

@ -14,7 +14,7 @@
//#define SC_DEBUG
#ifdef SC_DEBUG
static struct aal_dma_request last_request;
static struct ihk_dma_request last_request;
static void print_dma_lastreq(void)
{
@ -29,14 +29,14 @@ static void print_dma_lastreq(void)
unsigned long last_thread_exec = 0;
#ifndef DO_USER_MODE
static int do_async_copy(aal_os_t os, unsigned long dest, unsigned long src,
static int do_async_copy(ihk_os_t os, unsigned long dest, unsigned long src,
unsigned long size, unsigned int inbound)
{
struct aal_dma_request request;
aal_dma_channel_t channel;
struct ihk_dma_request request;
ihk_dma_channel_t channel;
unsigned long asize = ALIGN_WAIT_BUF(size);
channel = aal_device_get_dma_channel(aal_os_to_dev(os), 0);
channel = ihk_device_get_dma_channel(ihk_os_to_dev(os), 0);
if (!channel) {
return -EINVAL;
}
@ -55,7 +55,7 @@ static int do_async_copy(aal_os_t os, unsigned long dest, unsigned long src,
last_request = request;
#endif
aal_dma_request(channel, &request);
ihk_dma_request(channel, &request);
return 0;
}
@ -119,7 +119,7 @@ static unsigned long translate_remote_va(struct mcctrl_channel *c,
extern struct mcctrl_channel *channels;
int __do_in_kernel_syscall(aal_os_t os, struct mcctrl_channel *c,
int __do_in_kernel_syscall(ihk_os_t os, struct mcctrl_channel *c,
struct syscall_request *sc)
{
int ret;

View File

@ -40,16 +40,16 @@ void ap_start(void)
void ap_init(void)
{
struct aal_mc_cpu_info *cpu_info;
struct ihk_mc_cpu_info *cpu_info;
int i;
int bsp_hw_id;
aal_mc_init_ap();
ihk_mc_init_ap();
wrmsr(MSR_IA32_TIME_STAMP_COUNTER, 0);
cpu_info = aal_mc_get_cpu_info();
bsp_hw_id = aal_mc_get_hardware_processor_id();
cpu_info = ihk_mc_get_cpu_info();
bsp_hw_id = ihk_mc_get_hardware_processor_id();
/* If no information exists, UP mode */
if (!cpu_info) {
@ -63,7 +63,7 @@ void ap_init(void)
if (cpu_info->hw_ids[i] == bsp_hw_id) {
continue;
}
aal_mc_boot_cpu(cpu_info->hw_ids[i], (unsigned long)ap_wait);
ihk_mc_boot_cpu(cpu_info->hw_ids[i], (unsigned long)ap_wait);
kprintf(" %d", cpu_info->hw_ids[i]);
num_processors++;

View File

@ -4,30 +4,30 @@
int memcpy_async(unsigned long dest, unsigned long src,
unsigned long len, int wait, unsigned long *notify)
{
struct aal_dma_request req;
struct ihk_dma_request req;
unsigned long fin = 0;
if (notify)
*notify = 0;
memset(&req, 0, sizeof(req));
/* Physical */
req.src_os = (aal_os_t)AAL_THIS_OS;
req.src_os = (ihk_os_t)IHK_THIS_OS;
req.src_phys = src;
req.dest_os = (aal_os_t)AAL_THIS_OS;
req.dest_os = (ihk_os_t)IHK_THIS_OS;
req.dest_phys = dest;
req.size = len;
if (notify) {
req.notify_os = (aal_os_t)AAL_THIS_OS;
req.notify_os = (ihk_os_t)IHK_THIS_OS;
req.notify = (void *)virt_to_phys(notify);
req.priv = (void *)1;
} else if (wait) {
req.notify_os = (aal_os_t)AAL_THIS_OS;
req.notify_os = (ihk_os_t)IHK_THIS_OS;
req.notify = (void *)virt_to_phys(&fin);
req.priv = (void *)1;
}
aal_mc_dma_request(0, &req);
ihk_mc_dma_request(0, &req);
if (wait) {
while (!fin) {
barrier();

View File

@ -4,11 +4,11 @@
#include <ihk/debug.h>
#include <ihk/lock.h>
struct aal_kmsg_buf kmsg_buf AAL_KMSG_ALIGN;
struct ihk_kmsg_buf kmsg_buf IHK_KMSG_ALIGN;
extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
extern int sprintf(char * buf, const char *fmt, ...);
static aal_spinlock_t kmsg_lock;
static ihk_spinlock_t kmsg_lock;
/* TODO: lock */
void kputs(char *buf)
@ -16,7 +16,7 @@ void kputs(char *buf)
int len = strlen(buf);
unsigned long flags;
flags = aal_mc_spinlock_lock(&kmsg_lock);
flags = ihk_mc_spinlock_lock(&kmsg_lock);
if (len + kmsg_buf.tail > kmsg_buf.len) {
kmsg_buf.tail = 0;
@ -25,19 +25,19 @@ void kputs(char *buf)
strncpy(kmsg_buf.str + kmsg_buf.tail, buf, len);
kmsg_buf.tail += len;
aal_mc_spinlock_unlock(&kmsg_lock, flags);
ihk_mc_spinlock_unlock(&kmsg_lock, flags);
}
#define KPRINTF_LOCAL_BUF_LEN 1024
int kprintf_lock()
{
return aal_mc_spinlock_lock(&kmsg_lock);
return ihk_mc_spinlock_lock(&kmsg_lock);
}
void kprintf_unlock(int irqflags)
{
aal_mc_spinlock_unlock(&kmsg_lock, irqflags);
ihk_mc_spinlock_unlock(&kmsg_lock, irqflags);
}
/* Caller must hold kmsg_lock! */
@ -70,7 +70,7 @@ int kprintf(const char *format, ...)
unsigned long flags;
char buf[KPRINTF_LOCAL_BUF_LEN];
flags = aal_mc_spinlock_lock(&kmsg_lock);
flags = ihk_mc_spinlock_lock(&kmsg_lock);
/* Copy into the local buf */
va_start(va, format);
@ -85,14 +85,14 @@ int kprintf(const char *format, ...)
memcpy(kmsg_buf.str + kmsg_buf.tail, buf, len);
kmsg_buf.tail += len;
aal_mc_spinlock_unlock(&kmsg_lock, flags);
ihk_mc_spinlock_unlock(&kmsg_lock, flags);
return len;
}
void kmsg_init(void)
{
aal_mc_spinlock_init(&kmsg_lock);
ihk_mc_spinlock_init(&kmsg_lock);
kmsg_buf.tail = 0;
kmsg_buf.len = sizeof(kmsg_buf.str);
memset(kmsg_buf.str, 0, kmsg_buf.len);

View File

@ -80,7 +80,7 @@
void futex_queue_init(struct futex_queue *queue)
{
aal_mc_spinlock_init(&queue->lock);
ihk_mc_spinlock_init(&queue->lock);
INIT_LIST_HEAD(&queue->futex_list);
}
@ -115,13 +115,13 @@ static struct futex_queue *queue_lock(struct futex *futex, int *irqflags)
{
struct futex_queue *queue = get_queue(futex->uaddr);
futex->lock_ptr = &queue->lock;
*irqflags = aal_mc_spinlock_lock(&queue->lock);
*irqflags = ihk_mc_spinlock_lock(&queue->lock);
return queue;
}
static void queue_unlock(struct futex_queue *futex_queue, int irqflags)
{
aal_mc_spinlock_unlock(&futex_queue->lock, irqflags);
ihk_mc_spinlock_unlock(&futex_queue->lock, irqflags);
}
static void queue_me(struct futex *futex, struct futex_queue *futex_queue)
@ -131,7 +131,7 @@ static void queue_me(struct futex *futex, struct futex_queue *futex_queue)
static int unqueue_me(struct futex *futex)
{
aal_spinlock_t *lock_ptr;
ihk_spinlock_t *lock_ptr;
int irqflags;
int status = 0;
@ -140,7 +140,7 @@ retry:
lock_ptr = futex->lock_ptr;
barrier();
if (lock_ptr != NULL) {
irqflags = aal_mc_spinlock_lock(lock_ptr);
irqflags = ihk_mc_spinlock_lock(lock_ptr);
/*
* q->lock_ptr can change between reading it and
* spin_lock(), causing us to take the wrong lock. This
@ -155,13 +155,13 @@ retry:
* we can detect whether we acquired the correct lock.
*/
if (lock_ptr != futex->lock_ptr) {
aal_mc_spinlock_unlock(lock_ptr, irqflags);
ihk_mc_spinlock_unlock(lock_ptr, irqflags);
goto retry;
}
//WARN_ON(list_empty(&futex->link));
list_del(&futex->link);
aal_mc_spinlock_unlock(lock_ptr, irqflags);
ihk_mc_spinlock_unlock(lock_ptr, irqflags);
status = 1;
}
@ -172,23 +172,23 @@ static void lock_two_queues(struct futex_queue *queue1, int *irqflags1,
struct futex_queue *queue2, int *irqflags2)
{
if (queue1 < queue2)
*irqflags1 = aal_mc_spinlock_lock(&queue1->lock);
*irqflags1 = ihk_mc_spinlock_lock(&queue1->lock);
*irqflags2 = aal_mc_spinlock_lock(&queue2->lock);
*irqflags2 = ihk_mc_spinlock_lock(&queue2->lock);
if (queue1 > queue2)
*irqflags1 = aal_mc_spinlock_lock(&queue1->lock);
*irqflags1 = ihk_mc_spinlock_lock(&queue1->lock);
}
static void unlock_two_queues(struct futex_queue *queue1, int irqflags1,
struct futex_queue *queue2, int irqflags2)
{
if (queue1 == queue2) {
aal_mc_spinlock_unlock(&queue2->lock, irqflags2);
ihk_mc_spinlock_unlock(&queue2->lock, irqflags2);
}
else {
aal_mc_spinlock_unlock(&queue2->lock, irqflags2);
aal_mc_spinlock_unlock(&queue1->lock, irqflags1);
ihk_mc_spinlock_unlock(&queue2->lock, irqflags2);
ihk_mc_spinlock_unlock(&queue1->lock, irqflags1);
}
}
@ -316,7 +316,7 @@ static int futex_wake(uint32_t __user *uaddr, int nr_wake, uint32_t bitset)
return -EINVAL;
queue = get_queue(uaddr);
irqflags = aal_mc_spinlock_lock(&queue->lock);
irqflags = ihk_mc_spinlock_lock(&queue->lock);
head = &queue->futex_list;
list_for_each_entry_safe(this, next, head, link) {
@ -327,7 +327,7 @@ static int futex_wake(uint32_t __user *uaddr, int nr_wake, uint32_t bitset)
}
}
aal_mc_spinlock_unlock(&queue->lock, irqflags);
ihk_mc_spinlock_unlock(&queue->lock, irqflags);
return nr_woke;
}

View File

@ -22,7 +22,7 @@ void check_mapping_for_proc(struct process *proc, unsigned long addr)
{
unsigned long __phys;
if (aal_mc_pt_virt_to_phys(proc->vm->page_table, (void*)addr, &__phys)) {
if (ihk_mc_pt_virt_to_phys(proc->vm->page_table, (void*)addr, &__phys)) {
kprintf("check_map: no mapping for 0x%lX\n", addr);
}
else {
@ -51,13 +51,13 @@ static void process_msg_prepare_process(unsigned long rphys)
+ sizeof(struct program_image_section) * 16;
npages = (sz + PAGE_SIZE - 1) >> PAGE_SHIFT;
phys = aal_mc_map_memory(NULL, rphys, sz);
p = aal_mc_map_virtual(phys, npages, PTATTR_WRITABLE);
phys = ihk_mc_map_memory(NULL, rphys, sz);
p = ihk_mc_map_virtual(phys, npages, PTATTR_WRITABLE);
n = p->num_sections;
dkprintf("# of sections: %d\n", n);
pn = aal_mc_allocate(sizeof(struct program_load_desc)
pn = ihk_mc_allocate(sizeof(struct program_load_desc)
+ sizeof(struct program_image_section) * n, 0);
memcpy_long(pn, p, sizeof(struct program_load_desc)
+ sizeof(struct program_image_section) * n);
@ -77,20 +77,20 @@ static void process_msg_prepare_process(unsigned long rphys)
#if 0
if (range_npages <= 256) {
#endif
up = virt_to_phys(aal_mc_alloc_pages(range_npages, 0));
up = virt_to_phys(ihk_mc_alloc_pages(range_npages, 0));
add_process_memory_range(proc, s, e, up, 0);
{
void *_virt = (void *)s;
unsigned long _phys;
if (aal_mc_pt_virt_to_phys(proc->vm->page_table,
if (ihk_mc_pt_virt_to_phys(proc->vm->page_table,
_virt, &_phys)) {
kprintf("ERROR: no mapping for 0x%lX\n", _virt);
}
for (_virt = (void *)s + PAGE_SIZE;
(unsigned long)_virt < e; _virt += PAGE_SIZE) {
unsigned long __phys;
if (aal_mc_pt_virt_to_phys(proc->vm->page_table,
if (ihk_mc_pt_virt_to_phys(proc->vm->page_table,
_virt, &__phys)) {
kprintf("ERROR: no mapping for 0x%lX\n", _virt);
panic("mapping");
@ -117,12 +117,12 @@ static void process_msg_prepare_process(unsigned long rphys)
{
void *_virt = (void *)s;
unsigned long _phys;
aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
_virt, &_phys);
for (_virt = (void *)s + PAGE_SIZE;
(unsigned long)_virt < e; _virt += PAGE_SIZE) {
unsigned long __phys;
aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
_virt, &__phys);
if (__phys != _phys + PAGE_SIZE) {
kprintf("0x%lX + PAGE_SIZE is not physically contigous, from 0x%lX to 0x%lX\n", _virt - PAGE_SIZE, _phys, __phys);
@ -181,7 +181,7 @@ static void process_msg_prepare_process(unsigned long rphys)
addr = e;
e = addr + PAGE_SIZE * ARGENV_PAGE_COUNT;
args_envs = aal_mc_alloc_pages(ARGENV_PAGE_COUNT, 0);
args_envs = ihk_mc_alloc_pages(ARGENV_PAGE_COUNT, 0);
args_envs_p = virt_to_phys(args_envs);
add_process_memory_range(proc, addr, e,
@ -195,9 +195,9 @@ static void process_msg_prepare_process(unsigned long rphys)
// Map in remote physical addr of args and copy it
args_envs_npages = (p->args_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
dkprintf("args_envs_npages: %d\n", args_envs_npages);
args_envs_rp = aal_mc_map_memory(NULL, (unsigned long)p->args, p->args_len);
args_envs_rp = ihk_mc_map_memory(NULL, (unsigned long)p->args, p->args_len);
dkprintf("args_envs_rp: 0x%lX\n", args_envs_rp);
args_envs_r = (char *)aal_mc_map_virtual(args_envs_rp, args_envs_npages,
args_envs_r = (char *)ihk_mc_map_virtual(args_envs_rp, args_envs_npages,
PTATTR_WRITABLE);
dkprintf("args_envs_r: 0x%lX\n", args_envs_r);
@ -205,17 +205,17 @@ static void process_msg_prepare_process(unsigned long rphys)
memcpy_long(args_envs, args_envs_r, p->args_len + 8);
aal_mc_unmap_virtual(args_envs_r, args_envs_npages, 0);
aal_mc_unmap_memory(NULL, args_envs_rp, p->args_len);
ihk_mc_unmap_virtual(args_envs_r, args_envs_npages, 0);
ihk_mc_unmap_memory(NULL, args_envs_rp, p->args_len);
dkprintf("envs: 0x%lX, envs_len: %d\n", p->envs, p->envs_len);
// Map in remote physical addr of envs and copy it after args
args_envs_npages = (p->envs_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
dkprintf("args_envs_npages: %d\n", args_envs_npages);
args_envs_rp = aal_mc_map_memory(NULL, (unsigned long)p->envs, p->envs_len);
args_envs_rp = ihk_mc_map_memory(NULL, (unsigned long)p->envs, p->envs_len);
dkprintf("args_envs_rp: 0x%lX\n", args_envs_rp);
args_envs_r = (char *)aal_mc_map_virtual(args_envs_rp, args_envs_npages,
args_envs_r = (char *)ihk_mc_map_virtual(args_envs_rp, args_envs_npages,
PTATTR_WRITABLE);
dkprintf("args_envs_r: 0x%lX\n", args_envs_r);
@ -223,8 +223,8 @@ static void process_msg_prepare_process(unsigned long rphys)
memcpy_long(args_envs + p->args_len, args_envs_r, p->envs_len + 8);
aal_mc_unmap_virtual(args_envs_r, args_envs_npages, 0);
aal_mc_unmap_memory(NULL, args_envs_rp, p->envs_len);
ihk_mc_unmap_virtual(args_envs_r, args_envs_npages, 0);
ihk_mc_unmap_memory(NULL, args_envs_rp, p->envs_len);
// Update variables
argc = *((int*)(args_envs));
@ -259,10 +259,10 @@ static void process_msg_prepare_process(unsigned long rphys)
dkprintf("new process : %p [%d] / table : %p\n", proc, proc->pid,
proc->vm->page_table);
aal_mc_free(pn);
ihk_mc_free(pn);
aal_mc_unmap_virtual(p, npages, 1);
aal_mc_unmap_memory(NULL, phys, sz);
ihk_mc_unmap_virtual(p, npages, 1);
ihk_mc_unmap_memory(NULL, phys, sz);
}
static void process_msg_init(struct ikc_scd_init_param *pcp)
@ -285,29 +285,29 @@ static void process_msg_init_acked(unsigned long pphys)
lparam = &cpu_local_var(scp);
lparam->request_rpa = param->request_page;
lparam->request_pa = aal_mc_map_memory(NULL, param->request_page,
lparam->request_pa = ihk_mc_map_memory(NULL, param->request_page,
REQUEST_PAGE_COUNT * PAGE_SIZE);
lparam->request_va = aal_mc_map_virtual(lparam->request_pa,
lparam->request_va = ihk_mc_map_virtual(lparam->request_pa,
REQUEST_PAGE_COUNT,
PTATTR_WRITABLE);
lparam->doorbell_rpa = param->doorbell_page;
lparam->doorbell_pa = aal_mc_map_memory(NULL, param->doorbell_page,
lparam->doorbell_pa = ihk_mc_map_memory(NULL, param->doorbell_page,
DOORBELL_PAGE_COUNT *
PAGE_SIZE);
lparam->doorbell_va = aal_mc_map_virtual(lparam->doorbell_pa,
lparam->doorbell_va = ihk_mc_map_virtual(lparam->doorbell_pa,
DOORBELL_PAGE_COUNT,
PTATTR_WRITABLE);
lparam->post_rpa = param->post_page;
lparam->post_pa = aal_mc_map_memory(NULL, param->post_page,
lparam->post_pa = ihk_mc_map_memory(NULL, param->post_page,
PAGE_SIZE);
lparam->post_va = aal_mc_map_virtual(lparam->post_pa, 1,
lparam->post_va = ihk_mc_map_virtual(lparam->post_pa, 1,
PTATTR_WRITABLE);
lparam->post_fin = 1;
dkprintf("Syscall parameters: (%d)\n", aal_mc_get_processor_id());
dkprintf("Syscall parameters: (%d)\n", ihk_mc_get_processor_id());
dkprintf(" Response: %lx, %p\n",
lparam->response_pa, lparam->response_va);
dkprintf(" Request : %lx, %lx, %p\n",
@ -318,14 +318,14 @@ static void process_msg_init_acked(unsigned long pphys)
lparam->post_pa, lparam->post_rpa, lparam->post_va);
}
static void syscall_channel_send(struct aal_ikc_channel_desc *c,
static void syscall_channel_send(struct ihk_ikc_channel_desc *c,
struct ikc_scd_packet *packet)
{
aal_ikc_send(c, packet, 0);
ihk_ikc_send(c, packet, 0);
}
static int syscall_packet_handler(struct aal_ikc_channel_desc *c,
void *__packet, void *aal_os)
static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *ihk_os)
{
struct ikc_scd_packet *packet = __packet;
struct ikc_scd_packet pckt;
@ -350,7 +350,7 @@ static int syscall_packet_handler(struct aal_ikc_channel_desc *c,
dkprintf("SCD_MSG_SCHEDULE_PROCESS: %lx\n", packet->arg);
runq_add_proc((struct process *)packet->arg,
aal_mc_get_processor_id());
ihk_mc_get_processor_id());
//cpu_local_var(next) = (struct process *)packet->arg;
return 0;
@ -360,7 +360,7 @@ static int syscall_packet_handler(struct aal_ikc_channel_desc *c,
void init_host_syscall_channel(void)
{
struct aal_ikc_connect_param param;
struct ihk_ikc_connect_param param;
struct ikc_scd_packet pckt;
param.port = 501;
@ -370,9 +370,9 @@ void init_host_syscall_channel(void)
param.handler = syscall_packet_handler;
dkprintf("(syscall) Trying to connect host ...");
while (aal_ikc_connect(NULL, &param) != 0) {
while (ihk_ikc_connect(NULL, &param) != 0) {
dkprintf(".");
aal_mc_delay_us(1000 * 1000);
ihk_mc_delay_us(1000 * 1000);
}
dkprintf("connected.\n");
@ -380,7 +380,7 @@ void init_host_syscall_channel(void)
process_msg_init(&cpu_local_var(iip));
pckt.msg = SCD_MSG_INIT_CHANNEL;
pckt.ref = aal_mc_get_processor_id();
pckt.ref = ihk_mc_get_processor_id();
pckt.arg = virt_to_phys(&cpu_local_var(iip));
syscall_channel_send(param.channel, &pckt);
}

View File

@ -16,7 +16,7 @@ struct malloc_header {
#define CPU_STATUS_DISABLE (0)
#define CPU_STATUS_IDLE (1)
#define CPU_STATUS_RUNNING (2)
extern aal_spinlock_t cpu_status_lock;
extern ihk_spinlock_t cpu_status_lock;
struct cpu_local_var {
/* malloc */
@ -25,12 +25,12 @@ struct cpu_local_var {
struct process idle;
struct process_vm idle_vm;
aal_spinlock_t runq_lock;
ihk_spinlock_t runq_lock;
struct process *current;
struct list_head runq;
size_t runq_len;
struct aal_ikc_channel_desc *syscall_channel;
struct ihk_ikc_channel_desc *syscall_channel;
struct syscall_params scp;
struct ikc_scd_init_param iip;
@ -43,7 +43,7 @@ struct cpu_local_var {
struct cpu_local_var *get_cpu_local_var(int id);
static struct cpu_local_var *get_this_cpu_local_var(void)
{
return get_cpu_local_var(aal_mc_get_processor_id());
return get_cpu_local_var(ihk_mc_get_processor_id());
}
#define cpu_local_var(name) get_this_cpu_local_var()->name

View File

@ -211,13 +211,13 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
struct futex {
struct list_head link;
struct waitq waitq;
aal_spinlock_t * lock_ptr;
ihk_spinlock_t * lock_ptr;
uint32_t __user * uaddr;
uint32_t bitset;
};
struct futex_queue {
aal_spinlock_t lock;
ihk_spinlock_t lock;
struct list_head futex_list;
};

View File

@ -11,7 +11,7 @@ extern void mc_ikc_test_init(void);
extern void cpu_local_var_init(void);
extern void kmalloc_init(void);
extern void ap_start(void);
extern void aal_mc_dma_init(void);
extern void ihk_mc_dma_init(void);
extern void init_host_syscall_channel(void);
extern void sched_init(void);
extern void pc_ap_init(void);

View File

@ -3,7 +3,7 @@
#include <ihk/mm.h>
void *kmalloc(int size, enum aal_mc_ap_flag flag);
void *kmalloc(int size, enum ihk_mc_ap_flag flag);
void kfree(void *ptr);
#endif

View File

@ -7,7 +7,7 @@
/* Optimization barrier */
/* The "volatile" is due to gcc bugs
* NOTE: already defined in aal/manycore/generic/include/aal/cpu.h
* NOTE: already defined in ihk/manycore/generic/include/ihk/cpu.h
* #define barrier() __asm__ __volatile__("": : :"memory")
*/

View File

@ -1,7 +1,7 @@
#ifndef __HEADER_PAGE_H
#define __HEADER_PAGE_H
void *allocate_pages(int npages, enum aal_mc_ap_flag flag);
void *allocate_pages(int npages, enum ihk_mc_ap_flag flag);
void free_pages(void *va, int npages);
#endif

View File

@ -49,13 +49,13 @@ struct process {
struct process_vm *vm;
aal_mc_kernel_context_t ctx;
aal_mc_user_context_t *uctx;
ihk_mc_kernel_context_t ctx;
ihk_mc_user_context_t *uctx;
// Runqueue list entry
struct list_head sched_list;
aal_spinlock_t spin_sleep_lock;
ihk_spinlock_t spin_sleep_lock;
int spin_sleep;
struct thread {
@ -65,7 +65,7 @@ struct process {
};
struct process_vm {
aal_atomic_t refcount;
ihk_atomic_t refcount;
struct page_table *page_table;
struct list_head vm_range_list;
@ -74,13 +74,13 @@ struct process_vm {
// Address space private futexes
struct futex_queue futex_queues[1 << FUTEX_HASHBITS];
aal_spinlock_t page_table_lock;
aal_spinlock_t memory_range_lock;
ihk_spinlock_t page_table_lock;
ihk_spinlock_t memory_range_lock;
// to protect the followings:
// 1. addition of process "memory range" (extend_process_region, add_process_memory_range)
// 2. addition of process page table (allocate_pages, update_process_page_table)
// note that physical memory allocator (aal_mc_alloc_pages, aal_pagealloc_alloc)
// is protected by its own lock (see aal/manycore/generic/page_alloc.c)
// note that physical memory allocator (ihk_mc_alloc_pages, ihk_pagealloc_alloc)
// is protected by its own lock (see ihk/manycore/generic/page_alloc.c)
};

View File

@ -135,7 +135,7 @@ struct syscall_params {
unsigned long post_rpa, post_pa;
struct syscall_post *post_va;
unsigned long post_fin;
struct syscall_post post_buf AAL_DMA_ALIGN;
struct syscall_post post_buf IHK_DMA_ALIGN;
};
#endif

View File

@ -16,7 +16,7 @@ int default_wake_function(struct waitq_entry *wait, unsigned mode, int flags,
void *key);
typedef struct waitq {
aal_spinlock_t lock;
ihk_spinlock_t lock;
struct list_head waitq;
} waitq_t;

View File

@ -24,20 +24,20 @@
#endif
extern struct aal_kmsg_buf kmsg_buf;
extern struct ihk_kmsg_buf kmsg_buf;
extern long syscall(int, aal_mc_user_context_t *);
extern long syscall(int, ihk_mc_user_context_t *);
static void handler_init(void)
{
aal_mc_set_syscall_handler(syscall);
ihk_mc_set_syscall_handler(syscall);
}
unsigned long data[1024] __attribute__((aligned(64)));
static void dma_test(void)
{
struct aal_dma_request req;
struct ihk_dma_request req;
unsigned long fin = 0;
int i, j;
@ -52,20 +52,20 @@ static void dma_test(void)
kprintf("DMA Test Started.\n");
memset(&req, 0, sizeof(req));
req.src_os = AAL_THIS_OS;
req.src_os = IHK_THIS_OS;
req.src_phys = virt_to_phys(data);
req.dest_os = AAL_THIS_OS;
req.dest_os = IHK_THIS_OS;
req.dest_phys = virt_to_phys(&data[256]);
req.size = 64;
req.notify = (void *)virt_to_phys(&fin);
req.notify_os = AAL_THIS_OS;
req.notify_os = IHK_THIS_OS;
req.priv = (void *)0x2984;
kprintf("VtoP : %p, %lx\n", data, virt_to_phys(data));
kprintf("notify : %p, %lx (%lx)\n", &fin, virt_to_phys(&fin),
sizeof(req));
if (aal_mc_dma_request(0, &req) != 0) {
if (ihk_mc_dma_request(0, &req) != 0) {
kprintf("Failed to request DMA!\n");
}
kprintf("DMA Test Wait.\n");
@ -83,11 +83,11 @@ static void dma_test(void)
}
}
extern char *aal_mc_get_kernel_args(void);
extern char *ihk_mc_get_kernel_args(void);
char *find_command_line(char *name)
{
char *cmdline = aal_mc_get_kernel_args();
char *cmdline = ihk_mc_get_kernel_args();
if (!cmdline) {
return NULL;
@ -126,9 +126,9 @@ void pc_init(void)
dkprintf("perfctr mode : priv = %d, set = %d\n", kmode, imode);
for (i = 0; i < 4; i++) {
aal_mc_perfctr_init(i, x[imode][i], kmode);
ihk_mc_perfctr_init(i, x[imode][i], kmode);
}
aal_mc_perfctr_start(0xf);
ihk_mc_perfctr_start(0xf);
}
void pc_ap_init(void)
@ -143,12 +143,12 @@ static void pc_test(void)
pc_init();
aal_mc_perfctr_read_mask(0xf, st);
ihk_mc_perfctr_read_mask(0xf, st);
for (i = 0; i < sizeof(data) / sizeof(data[0]); i++) {
data[i] += i;
asm volatile ("" : : : "memory");
}
aal_mc_perfctr_read_mask(0xf, ed);
ihk_mc_perfctr_read_mask(0xf, ed);
kprintf("perfctr:(%ld) %ld, %ld, %ld, %ld\n", st[0], ed[0] - st[0],
ed[1] - st[1], ed[2] - st[2], ed[3] - st[3]);
@ -157,12 +157,12 @@ static void pc_test(void)
static void rest_init(void)
{
char *cmdline;
cmdline = aal_mc_get_kernel_args();
cmdline = ihk_mc_get_kernel_args();
kprintf("KCommand Line: %s\n", cmdline);
handler_init();
aal_mc_dma_init();
ihk_mc_dma_init();
dma_test();
//pc_test();
@ -215,7 +215,7 @@ int main(void)
post_init();
kputs("MCK/AAL booted.\n");
kputs("MCK/IHK booted.\n");
#ifdef DCFA_KMOD
mc_cmd_client_init();

View File

@ -35,7 +35,7 @@ void testmem(void *v, unsigned long size)
}
static int test_packet_handler(struct aal_ikc_channel_desc *c,
static int test_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *__os)
{
struct ikc_test_packet *packet = __packet;
@ -47,27 +47,27 @@ static int test_packet_handler(struct aal_ikc_channel_desc *c,
kprintf("Test msg : %x, %x\n", packet->msg);
a = (unsigned long)packet->param1 << 12;
pp = aal_mc_map_memory(NULL, a, 4 * 1024 * 1024);
v = aal_mc_map_virtual(pp, 4 * 1024,
pp = ihk_mc_map_memory(NULL, a, 4 * 1024 * 1024);
v = ihk_mc_map_virtual(pp, 4 * 1024,
PTATTR_UNCACHABLE);
testmem(v, 4 * 1024 * 1024);
aal_mc_unmap_virtual(v, 4 * 1024, 1);
aal_mc_unmap_memory(NULL, pp, 4 * 1024 * 1024);
ihk_mc_unmap_virtual(v, 4 * 1024, 1);
ihk_mc_unmap_memory(NULL, pp, 4 * 1024 * 1024);
} else if (packet->msg == 0x11110012) {
p.msg = 0x11110013;
for (i = 0; i < 10; i++) {
aal_ikc_send(c, &p, 0);
ihk_ikc_send(c, &p, 0);
}
} else if (packet->msg == 0x1111001a) {
kprintf("Packet, I am %d.\n", aal_mc_get_processor_id());
kprintf("Packet, I am %d.\n", ihk_mc_get_processor_id());
}
return 0;
}
static int test_handler(struct aal_ikc_channel_info *param)
static int test_handler(struct ihk_ikc_channel_info *param)
{
kprintf("Test connected : %p\n", param->channel);
@ -76,7 +76,7 @@ static int test_handler(struct aal_ikc_channel_info *param)
return 0;
}
static struct aal_ikc_listen_param test_listen_param = {
static struct ihk_ikc_listen_param test_listen_param = {
.port = 500,
.handler = test_handler,
.pkt_size = sizeof(struct ikc_test_packet),
@ -86,6 +86,6 @@ static struct aal_ikc_listen_param test_listen_param = {
void mc_ikc_test_init(void)
{
aal_ikc_listen_port(NULL, &test_listen_param);
ihk_ikc_listen_port(NULL, &test_listen_param);
kprintf("Listener registered port %d\n", 500);
}

View File

@ -19,10 +19,10 @@
#define dkprintf(...)
#endif
static struct aal_page_allocator_desc *pa_allocator;
static struct ihk_page_allocator_desc *pa_allocator;
static unsigned long pa_start, pa_end;
extern int aal_mc_pt_print_pte(struct page_table *pt, void *virt);
extern int ihk_mc_pt_print_pte(struct page_table *pt, void *virt);
static void reserve_pages(unsigned long start, unsigned long end, int type)
{
@ -37,12 +37,12 @@ static void reserve_pages(unsigned long start, unsigned long end, int type)
}
dkprintf("reserve: %016lx - %016lx (%ld pages)\n", start, end,
(end - start) >> PAGE_SHIFT);
aal_pagealloc_reserve(pa_allocator, start, end);
ihk_pagealloc_reserve(pa_allocator, start, end);
}
void *allocate_pages(int npages, enum aal_mc_ap_flag flag)
void *allocate_pages(int npages, enum ihk_mc_ap_flag flag)
{
unsigned long pa = aal_pagealloc_alloc(pa_allocator, npages);
unsigned long pa = ihk_pagealloc_alloc(pa_allocator, npages);
/* all_pagealloc_alloc returns zero when error occured,
and callee (in mcos/kernel/process.c) so propagate it */
return pa ? phys_to_virt(pa) : 0;
@ -50,10 +50,10 @@ void *allocate_pages(int npages, enum aal_mc_ap_flag flag)
void free_pages(void *va, int npages)
{
aal_pagealloc_free(pa_allocator, virt_to_phys(va), npages);
ihk_pagealloc_free(pa_allocator, virt_to_phys(va), npages);
}
static struct aal_mc_pa_ops allocator = {
static struct ihk_mc_pa_ops allocator = {
.alloc_page = allocate_pages,
.free_page = free_pages,
};
@ -68,7 +68,7 @@ static void page_fault_handler(unsigned long address, void *regs,
irqflags = kprintf_lock();
__kprintf("[%d] Page fault for 0x%lX, (rbp: 0x%lX)\n",
aal_mc_get_processor_id(), address, rbp);
ihk_mc_get_processor_id(), address, rbp);
__kprintf("%s for %s access in %s mode (reserved bit %s set), it %s an instruction fetch\n",
(error & PF_PROT ? "protection fault" : "no page found"),
@ -84,7 +84,7 @@ static void page_fault_handler(unsigned long address, void *regs,
if (range->start <= address && range->end > address) {
__kprintf("address is in range, flag: 0x%X! \n", range->flag);
found = 1;
aal_mc_pt_print_pte(cpu_local_var(current)->vm->page_table,
ihk_mc_pt_print_pte(cpu_local_var(current)->vm->page_table,
(void*)address);
break;
}
@ -96,7 +96,7 @@ static void page_fault_handler(unsigned long address, void *regs,
kprintf_unlock(irqflags);
/* TODO */
aal_mc_debug_show_interrupt_context(regs);
ihk_mc_debug_show_interrupt_context(regs);
#ifdef DEBUG_PRINT_MEM
{
@ -119,14 +119,14 @@ static void page_allocator_init(void)
void *page_map;
unsigned int i;
pa_start = aal_mc_get_memory_address(AAL_MC_GMA_AVAIL_START, 0);
pa_end = aal_mc_get_memory_address(AAL_MC_GMA_AVAIL_END, 0);
pa_start = ihk_mc_get_memory_address(IHK_MC_GMA_AVAIL_START, 0);
pa_end = ihk_mc_get_memory_address(IHK_MC_GMA_AVAIL_END, 0);
pa_start &= PAGE_MASK;
pa_end = (pa_end + PAGE_SIZE - 1) & PAGE_MASK;
/*
page_map_pa = aal_mc_get_memory_address(AAL_MC_GMA_HEAP_START, 0);
page_map_pa = ihk_mc_get_memory_address(IHK_MC_GMA_HEAP_START, 0);
page_map = phys_to_virt(page_map_pa);
* Can't allocate in reserved area
* TODO: figure this out automatically!
@ -134,29 +134,29 @@ static void page_allocator_init(void)
page_map_pa = 0x100000;
page_map = phys_to_virt(page_map_pa);
pa_allocator = __aal_pagealloc_init(pa_start, pa_end - pa_start,
pa_allocator = __ihk_pagealloc_init(pa_start, pa_end - pa_start,
PAGE_SIZE, page_map, &pages);
reserve_pages(page_map_pa, page_map_pa + pages * PAGE_SIZE, 0);
/* BIOS reserved ranges */
for (i = 1; i <= aal_mc_get_memory_address(AAL_MC_NR_RESERVED_AREAS, 0);
for (i = 1; i <= ihk_mc_get_memory_address(IHK_MC_NR_RESERVED_AREAS, 0);
++i) {
reserve_pages(aal_mc_get_memory_address(AAL_MC_RESERVED_AREA_START, i),
aal_mc_get_memory_address(AAL_MC_RESERVED_AREA_END, i), 0);
reserve_pages(ihk_mc_get_memory_address(IHK_MC_RESERVED_AREA_START, i),
ihk_mc_get_memory_address(IHK_MC_RESERVED_AREA_END, i), 0);
}
aal_mc_reserve_arch_pages(pa_start, pa_end, reserve_pages);
ihk_mc_reserve_arch_pages(pa_start, pa_end, reserve_pages);
kprintf("Available pages: %ld pages\n",
aal_pagealloc_count(pa_allocator));
ihk_pagealloc_count(pa_allocator));
/* Notify the aal to use my page allocator */
aal_mc_set_page_allocator(&allocator);
/* Notify the ihk to use my page allocator */
ihk_mc_set_page_allocator(&allocator);
/* And prepare some exception handlers */
aal_mc_set_page_fault_handler(page_fault_handler);
ihk_mc_set_page_fault_handler(page_fault_handler);
}
void register_kmalloc(void)
@ -165,19 +165,19 @@ void register_kmalloc(void)
allocator.free = kfree;
}
static struct aal_page_allocator_desc *vmap_allocator;
static struct ihk_page_allocator_desc *vmap_allocator;
static void virtual_allocator_init(void)
{
vmap_allocator = aal_pagealloc_init(MAP_VMAP_START,
vmap_allocator = ihk_pagealloc_init(MAP_VMAP_START,
MAP_VMAP_SIZE, PAGE_SIZE);
/* Make sure that kernel first-level page table copying works */
aal_mc_pt_prepare_map(NULL, (void *)MAP_VMAP_START, MAP_VMAP_SIZE,
AAL_MC_PT_FIRST_LEVEL);
ihk_mc_pt_prepare_map(NULL, (void *)MAP_VMAP_START, MAP_VMAP_SIZE,
IHK_MC_PT_FIRST_LEVEL);
}
void *aal_mc_map_virtual(unsigned long phys, int npages,
enum aal_mc_pt_attribute attr)
void *ihk_mc_map_virtual(unsigned long phys, int npages,
enum ihk_mc_pt_attribute attr)
{
void *p;
unsigned long i, offset;
@ -185,31 +185,31 @@ void *aal_mc_map_virtual(unsigned long phys, int npages,
offset = (phys & (PAGE_SIZE - 1));
phys = phys & PAGE_MASK;
p = (void *)aal_pagealloc_alloc(vmap_allocator, npages);
p = (void *)ihk_pagealloc_alloc(vmap_allocator, npages);
if (!p) {
return NULL;
}
for (i = 0; i < npages; i++) {
aal_mc_pt_set_page(NULL, (char *)p + (i << PAGE_SHIFT),
ihk_mc_pt_set_page(NULL, (char *)p + (i << PAGE_SHIFT),
phys + (i << PAGE_SHIFT), attr);
}
return (char *)p + offset;
}
void aal_mc_unmap_virtual(void *va, int npages, int free_physical)
void ihk_mc_unmap_virtual(void *va, int npages, int free_physical)
{
unsigned long i;
va = (void *)((unsigned long)va & PAGE_MASK);
for (i = 0; i < npages; i++) {
aal_mc_pt_clear_page(NULL, (char *)va + (i << PAGE_SHIFT));
ihk_mc_pt_clear_page(NULL, (char *)va + (i << PAGE_SHIFT));
}
if (free_physical)
aal_pagealloc_free(vmap_allocator, virt_to_phys(va), npages);
ihk_pagealloc_free(vmap_allocator, virt_to_phys(va), npages);
}
/* moved from aal_knc/manycore/knf/setup.c */
/* moved from ihk_knc/manycore/mic/setup.c */
/*static*/ void *sbox_base = (void *)SBOX_BASE;
void sbox_write(int offset, unsigned int value)
{
@ -224,7 +224,7 @@ unsigned int sbox_read(int offset)
unsigned int free_bitmap_micpa = ((~((1ULL<<(NUM_SMPT_ENTRIES_IN_USE - NUM_SMPT_ENTRIES_MICPA))-1))&((1ULL << NUM_SMPT_ENTRIES_IN_USE) - 1));
void aal_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa) {
void ihk_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa) {
int i;
for(i = NUM_SMPT_ENTRIES_IN_USE - 1; i >= NUM_SMPT_ENTRIES_IN_USE - NUM_SMPT_ENTRIES_MICPA; i--) {
if((free_bitmap_micpa >> i) & 1) {
@ -233,7 +233,7 @@ void aal_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa) {
break;
}
}
kprintf("aal_mc_map_micpa,1,i=%d,host_pa=%lx,mic_pa=%llx\n", i, host_pa, *mic_pa);
kprintf("ihk_mc_map_micpa,1,i=%d,host_pa=%lx,mic_pa=%llx\n", i, host_pa, *mic_pa);
if(i == NUM_SMPT_ENTRIES_IN_USE - NUM_SMPT_ENTRIES_MICPA - 1) {
*mic_pa = 0;
return;
@ -242,21 +242,21 @@ void aal_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa) {
*mic_pa += (host_pa & (MIC_SYSTEM_PAGE_SIZE-1));
}
int aal_mc_free_micpa(unsigned long mic_pa) {
int ihk_mc_free_micpa(unsigned long mic_pa) {
int smpt_ndx = ((mic_pa - MIC_SYSTEM_BASE) >> MIC_SYSTEM_PAGE_SHIFT);
if(smpt_ndx >= NUM_SMPT_ENTRIES_IN_USE ||
smpt_ndx < NUM_SMPT_ENTRIES_IN_USE - NUM_SMPT_ENTRIES_MICPA) {
dkprintf("aal_mc_free_micpa,mic_pa=%llx,out of range\n", mic_pa);
dkprintf("ihk_mc_free_micpa,mic_pa=%llx,out of range\n", mic_pa);
return -1;
}
free_bitmap_micpa |= (1ULL << smpt_ndx);
kprintf("aal_mc_free_micpa,index=%d,freed\n", smpt_ndx);
kprintf("ihk_mc_free_micpa,index=%d,freed\n", smpt_ndx);
return 0;
}
void aal_mc_clean_micpa(void){
void ihk_mc_clean_micpa(void){
free_bitmap_micpa = ((~((1ULL<<(NUM_SMPT_ENTRIES_IN_USE - NUM_SMPT_ENTRIES_MICPA))-1))&((1ULL << NUM_SMPT_ENTRIES_IN_USE) - 1));
kprintf("aal_mc_clean_micpa\n");
kprintf("ihk_mc_clean_micpa\n");
}
void mem_init(void)
@ -278,7 +278,7 @@ void kmalloc_init(void)
register_kmalloc();
}
void *kmalloc(int size, enum aal_mc_ap_flag flag)
void *kmalloc(int size, enum ihk_mc_ap_flag flag)
{
struct cpu_local_var *v = get_this_cpu_local_var();
struct malloc_header *h = &v->free_list, *prev, *p;

View File

@ -5,27 +5,27 @@
#include <ikc/msg.h>
#include <kmalloc.h>
static struct aal_ikc_channel_desc *mchannel;
static int arch_master_channel_packet_handler(struct aal_ikc_channel_desc *,
static struct ihk_ikc_channel_desc *mchannel;
static int arch_master_channel_packet_handler(struct ihk_ikc_channel_desc *,
void *__packet, void *arg);
void ikc_master_init(void)
{
mchannel = kmalloc(sizeof(struct aal_ikc_channel_desc) +
sizeof(struct aal_ikc_master_packet), 0);
mchannel = kmalloc(sizeof(struct ihk_ikc_channel_desc) +
sizeof(struct ihk_ikc_master_packet), 0);
aal_mc_ikc_init_first(mchannel, arch_master_channel_packet_handler);
ihk_mc_ikc_init_first(mchannel, arch_master_channel_packet_handler);
}
extern int host_ikc_inited;
static int arch_master_channel_packet_handler(struct aal_ikc_channel_desc *c,
static int arch_master_channel_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *arg)
{
struct aal_ikc_master_packet *packet = __packet;
struct ihk_ikc_master_packet *packet = __packet;
switch (packet->msg) {
case AAL_IKC_MASTER_MSG_INIT_ACK:
case IHK_IKC_MASTER_MSG_INIT_ACK:
kprintf("Master channel init acked.\n");
host_ikc_inited = 1;
break;
@ -34,7 +34,7 @@ static int arch_master_channel_packet_handler(struct aal_ikc_channel_desc *c,
return 0;
}
struct aal_ikc_channel_desc *aal_mc_get_master_channel(void)
struct ihk_ikc_channel_desc *ihk_mc_get_master_channel(void)
{
return mchannel;
}

View File

@ -27,12 +27,12 @@ void init_process_vm(struct process_vm *vm)
{
int i;
aal_mc_spinlock_init(&vm->memory_range_lock);
aal_mc_spinlock_init(&vm->page_table_lock);
ihk_mc_spinlock_init(&vm->memory_range_lock);
ihk_mc_spinlock_init(&vm->page_table_lock);
aal_atomic_set(&vm->refcount, 1);
ihk_atomic_set(&vm->refcount, 1);
INIT_LIST_HEAD(&vm->vm_range_list);
vm->page_table = aal_mc_pt_create();
vm->page_table = ihk_mc_pt_create();
/* Initialize futex queues */
for (i = 0; i < (1 << FUTEX_HASHBITS); ++i)
@ -44,13 +44,13 @@ struct process *create_process(unsigned long user_pc)
{
struct process *proc;
proc = aal_mc_alloc_pages(KERNEL_STACK_NR_PAGES, 0);
proc = ihk_mc_alloc_pages(KERNEL_STACK_NR_PAGES, 0);
if (!proc)
return NULL;
memset(proc, 0, sizeof(struct process));
aal_mc_init_user_process(&proc->ctx, &proc->uctx,
ihk_mc_init_user_process(&proc->ctx, &proc->uctx,
((char *)proc) +
KERNEL_STACK_NR_PAGES * PAGE_SIZE, user_pc, 0);
@ -58,7 +58,7 @@ struct process *create_process(unsigned long user_pc)
init_process_vm(proc->vm);
aal_mc_spinlock_init(&proc->spin_sleep_lock);
ihk_mc_spinlock_init(&proc->spin_sleep_lock);
proc->spin_sleep = 0;
return proc;
@ -69,20 +69,20 @@ struct process *clone_process(struct process *org, unsigned long pc,
{
struct process *proc;
proc = aal_mc_alloc_pages(KERNEL_STACK_NR_PAGES, 0);
proc = ihk_mc_alloc_pages(KERNEL_STACK_NR_PAGES, 0);
memset(proc, 0, KERNEL_STACK_NR_PAGES);
/* NOTE: sp is the user mode stack! */
aal_mc_init_user_process(&proc->ctx, &proc->uctx,
ihk_mc_init_user_process(&proc->ctx, &proc->uctx,
((char *)proc) +
KERNEL_STACK_NR_PAGES * PAGE_SIZE, pc, sp);
memcpy(proc->uctx, org->uctx, sizeof(*org->uctx));
aal_mc_modify_user_context(proc->uctx, AAL_UCR_STACK_POINTER, sp);
aal_mc_modify_user_context(proc->uctx, AAL_UCR_PROGRAM_COUNTER, pc);
ihk_mc_modify_user_context(proc->uctx, IHK_UCR_STACK_POINTER, sp);
ihk_mc_modify_user_context(proc->uctx, IHK_UCR_PROGRAM_COUNTER, pc);
aal_atomic_inc(&org->vm->refcount);
ihk_atomic_inc(&org->vm->refcount);
proc->vm = org->vm;
return proc;
@ -92,11 +92,11 @@ extern void __host_update_process_range(struct process *process,
struct vm_range *range);
void update_process_page_table(struct process *process, struct vm_range *range,
enum aal_mc_pt_attribute flag)
enum ihk_mc_pt_attribute flag)
{
unsigned long p, pa = range->phys;
unsigned long flags = aal_mc_spinlock_lock(&process->vm->page_table_lock);
unsigned long flags = ihk_mc_spinlock_lock(&process->vm->page_table_lock);
p = range->start;
while (p < range->end) {
#ifdef USE_LARGE_PAGES
@ -106,7 +106,7 @@ void update_process_page_table(struct process *process, struct vm_range *range,
(pa & (LARGE_PAGE_SIZE - 1)) == 0 &&
(range->end - p) >= LARGE_PAGE_SIZE) {
if (aal_mc_pt_set_large_page(process->vm->page_table, (void *)p,
if (ihk_mc_pt_set_large_page(process->vm->page_table, (void *)p,
pa, PTATTR_WRITABLE | PTATTR_USER | flag) != 0) {
kprintf("ERROR:setting large page for 0x%lX -> 0x%lX\n", p, pa);
panic("");
@ -119,7 +119,7 @@ void update_process_page_table(struct process *process, struct vm_range *range,
}
else {
#endif
aal_mc_pt_set_page(process->vm->page_table, (void *)p,
ihk_mc_pt_set_page(process->vm->page_table, (void *)p,
pa, PTATTR_WRITABLE | PTATTR_USER | flag);
pa += PAGE_SIZE;
@ -128,7 +128,7 @@ void update_process_page_table(struct process *process, struct vm_range *range,
}
#endif
}
aal_mc_spinlock_unlock(&process->vm->page_table_lock, flags);
ihk_mc_spinlock_unlock(&process->vm->page_table_lock, flags);
}
int add_process_large_range(struct process *process,
@ -156,7 +156,7 @@ int add_process_large_range(struct process *process,
npages_allocated += 64) {
struct vm_range sub_range;
virt = aal_mc_alloc_pages(64, 0);
virt = ihk_mc_alloc_pages(64, 0);
if (!virt) {
return -ENOMEM;
}
@ -209,7 +209,7 @@ int add_process_memory_range(struct process *process,
range->end - range->start, range->end - range->start);
if (flag & VR_REMOTE) {
update_process_page_table(process, range, AAL_PTA_REMOTE);
update_process_page_table(process, range, IHK_PTA_REMOTE);
} else if (flag & VR_IO_NOCACHE) {
update_process_page_table(process, range, PTATTR_UNCACHABLE);
} else {
@ -239,7 +239,7 @@ void init_process_stack(struct process *process, struct program_load_desc *pn,
{
int s_ind = 0;
int arg_ind;
char *stack = aal_mc_alloc_pages(USER_STACK_NR_PAGES, 0);
char *stack = ihk_mc_alloc_pages(USER_STACK_NR_PAGES, 0);
unsigned long *p = (unsigned long *)(stack +
(USER_STACK_NR_PAGES * PAGE_SIZE));
@ -273,7 +273,7 @@ void init_process_stack(struct process *process, struct program_load_desc *pn,
/* argc */
p[s_ind] = argc;
aal_mc_modify_user_context(process->uctx, AAL_UCR_STACK_POINTER,
ihk_mc_modify_user_context(process->uctx, IHK_UCR_STACK_POINTER,
USER_END + sizeof(unsigned long) * s_ind);
process->vm->region.stack_end = USER_END;
process->vm->region.stack_start = USER_END -
@ -365,13 +365,13 @@ int remove_process_region(struct process *proc,
return -EINVAL;
}
flags = aal_mc_spinlock_lock(&proc->vm->page_table_lock);
flags = ihk_mc_spinlock_lock(&proc->vm->page_table_lock);
/* We defer freeing to the time of exit */
while (start < end) {
aal_mc_pt_clear_page(proc->vm->page_table, (void *)start);
ihk_mc_pt_clear_page(proc->vm->page_table, (void *)start);
start += PAGE_SIZE;
}
aal_mc_spinlock_unlock(&proc->vm->page_table_lock, flags);
ihk_mc_spinlock_unlock(&proc->vm->page_table_lock, flags);
return 0;
}
@ -381,7 +381,7 @@ void free_process_memory(struct process *proc)
{
struct vm_range *range, *next;
if (!aal_atomic_dec_and_test(&proc->vm->refcount)) {
if (!ihk_atomic_dec_and_test(&proc->vm->refcount)) {
return;
}
@ -390,12 +390,12 @@ void free_process_memory(struct process *proc)
if (!(range->flag & VR_REMOTE) &&
!(range->flag & VR_IO_NOCACHE) &&
!(range->flag & VR_RESERVED)) {
aal_mc_free_pages(phys_to_virt(range->phys),
ihk_mc_free_pages(phys_to_virt(range->phys),
(range->end - range->start)
>> PAGE_SHIFT);
}
list_del(&range->list);
aal_mc_free(range);
ihk_mc_free(range);
}
/* TODO: Free page tables */
proc->status = PS_ZOMBIE;
@ -403,14 +403,14 @@ void free_process_memory(struct process *proc)
void destroy_process(struct process *proc)
{
aal_mc_free_pages(proc, 1);
ihk_mc_free_pages(proc, 1);
}
static void idle(void)
{
//unsigned int flags;
//flags = aal_mc_spinlock_lock(&cpu_status_lock);
//aal_mc_spinlock_unlock(&cpu_status_lock, flags);
//flags = ihk_mc_spinlock_lock(&cpu_status_lock);
//ihk_mc_spinlock_unlock(&cpu_status_lock, flags);
cpu_local_var(status) = CPU_STATUS_IDLE;
while (1) {
@ -430,15 +430,15 @@ void sched_init(void)
idle_process->vm = &cpu_local_var(idle_vm);
aal_mc_init_context(&idle_process->ctx, NULL, idle);
idle_process->pid = aal_mc_get_processor_id();
ihk_mc_init_context(&idle_process->ctx, NULL, idle);
idle_process->pid = ihk_mc_get_processor_id();
INIT_LIST_HEAD(&cpu_local_var(runq));
cpu_local_var(runq_len) = 0;
aal_mc_spinlock_init(&cpu_local_var(runq_lock));
ihk_mc_spinlock_init(&cpu_local_var(runq_lock));
#ifdef TIMER_CPU_ID
if (aal_mc_get_processor_id() == TIMER_CPU_ID) {
if (ihk_mc_get_processor_id() == TIMER_CPU_ID) {
init_timers();
wake_timers_loop();
}
@ -452,7 +452,7 @@ void schedule(void)
int switch_ctx = 0;
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&(v->runq_lock));
irqstate = ihk_mc_spinlock_lock(&(v->runq_lock));
next = NULL;
prev = v->current;
@ -490,28 +490,28 @@ void schedule(void)
if (switch_ctx) {
dkprintf("[%d] schedule: %d => %d \n",
aal_mc_get_processor_id(),
ihk_mc_get_processor_id(),
prev ? prev->pid : 0, next ? next->pid : 0);
aal_mc_load_page_table(next->vm->page_table);
ihk_mc_load_page_table(next->vm->page_table);
dkprintf("[%d] schedule: tlsblock_base: 0x%lX\n",
aal_mc_get_processor_id(), next->thread.tlsblock_base);
ihk_mc_get_processor_id(), next->thread.tlsblock_base);
/* Set up new TLS.. */
do_arch_prctl(ARCH_SET_FS, next->thread.tlsblock_base);
aal_mc_spinlock_unlock(&(v->runq_lock), irqstate);
ihk_mc_spinlock_unlock(&(v->runq_lock), irqstate);
if (prev) {
aal_mc_switch_context(&prev->ctx, &next->ctx);
ihk_mc_switch_context(&prev->ctx, &next->ctx);
}
else {
aal_mc_switch_context(NULL, &next->ctx);
ihk_mc_switch_context(NULL, &next->ctx);
}
}
else {
aal_mc_spinlock_unlock(&(v->runq_lock), irqstate);
ihk_mc_spinlock_unlock(&(v->runq_lock), irqstate);
}
}
@ -523,7 +523,7 @@ int sched_wakeup_process(struct process *proc, int valid_states)
unsigned long irqstate;
struct cpu_local_var *v = get_cpu_local_var(proc->cpu_id);
irqstate = aal_mc_spinlock_lock(&(proc->spin_sleep_lock));
irqstate = ihk_mc_spinlock_lock(&(proc->spin_sleep_lock));
if (proc->spin_sleep) {
dkprintf("sched_wakeup_process() spin wakeup: cpu_id: %d\n",
proc->cpu_id);
@ -532,12 +532,12 @@ int sched_wakeup_process(struct process *proc, int valid_states)
proc->spin_sleep = 0;
status = 0;
}
aal_mc_spinlock_unlock(&(proc->spin_sleep_lock), irqstate);
ihk_mc_spinlock_unlock(&(proc->spin_sleep_lock), irqstate);
if (spin_slept)
return status;
irqstate = aal_mc_spinlock_lock(&(v->runq_lock));
irqstate = ihk_mc_spinlock_lock(&(v->runq_lock));
if (proc->status & valid_states) {
proc->status = PS_RUNNING;
@ -547,10 +547,10 @@ int sched_wakeup_process(struct process *proc, int valid_states)
status = -EINVAL;
}
aal_mc_spinlock_unlock(&(v->runq_lock), irqstate);
ihk_mc_spinlock_unlock(&(v->runq_lock), irqstate);
if (!status && (proc->cpu_id != aal_mc_get_processor_id())) {
aal_mc_interrupt_cpu(get_x86_cpu_local_variable(proc->cpu_id)->apic_id,
if (!status && (proc->cpu_id != ihk_mc_get_processor_id())) {
ihk_mc_interrupt_cpu(get_x86_cpu_local_variable(proc->cpu_id)->apic_id,
0xd1);
}
@ -578,13 +578,13 @@ void runq_add_proc(struct process *proc, int cpu_id)
struct cpu_local_var *v = get_cpu_local_var(cpu_id);
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&(v->runq_lock));
irqstate = ihk_mc_spinlock_lock(&(v->runq_lock));
__runq_add_proc(proc, cpu_id);
aal_mc_spinlock_unlock(&(v->runq_lock), irqstate);
ihk_mc_spinlock_unlock(&(v->runq_lock), irqstate);
/* Kick scheduler */
if (cpu_id != aal_mc_get_processor_id())
aal_mc_interrupt_cpu(
if (cpu_id != ihk_mc_get_processor_id())
ihk_mc_interrupt_cpu(
get_x86_cpu_local_variable(cpu_id)->apic_id, 0xd1);
}
@ -594,13 +594,13 @@ void runq_del_proc(struct process *proc, int cpu_id)
struct cpu_local_var *v = get_cpu_local_var(cpu_id);
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&(v->runq_lock));
irqstate = ihk_mc_spinlock_lock(&(v->runq_lock));
list_del(&proc->sched_list);
--v->runq_len;
if (!v->runq_len)
get_cpu_local_var(cpu_id)->status = CPU_STATUS_IDLE;
aal_mc_spinlock_unlock(&(v->runq_lock), irqstate);
ihk_mc_spinlock_unlock(&(v->runq_lock), irqstate);
}

View File

@ -33,7 +33,7 @@
#define dkprintf(...)
#endif
static aal_atomic_t pid_cnt = AAL_ATOMIC_INIT(1024);
static ihk_atomic_t pid_cnt = IHK_ATOMIC_INIT(1024);
int memcpy_async(unsigned long dest, unsigned long src,
unsigned long len, int wait, unsigned long *notify);
@ -59,7 +59,7 @@ static void send_syscall(struct syscall_request *req)
memcpy_async_wait(&cpu_local_var(scp).post_fin);
cpu_local_var(scp).post_va->v[0] = cpu_local_var(scp).post_idx;
w = aal_mc_get_processor_id() + 1;
w = ihk_mc_get_processor_id() + 1;
memcpy_async_wait(&fin);
@ -68,27 +68,27 @@ static void send_syscall(struct syscall_request *req)
#ifdef SYSCALL_BY_IKC
packet.msg = SCD_MSG_SYSCALL_ONESIDE;
packet.ref = aal_mc_get_processor_id();
packet.ref = ihk_mc_get_processor_id();
packet.arg = cpu_local_var(scp).request_rpa;
aal_ikc_send(cpu_local_var(syscall_channel), &packet, 0);
//aal_ikc_send(get_cpu_local_var(0)->syscall_channel, &packet, 0);
ihk_ikc_send(cpu_local_var(syscall_channel), &packet, 0);
//ihk_ikc_send(get_cpu_local_var(0)->syscall_channel, &packet, 0);
#endif
}
int do_syscall(struct syscall_request *req, aal_mc_user_context_t *ctx)
int do_syscall(struct syscall_request *req, ihk_mc_user_context_t *ctx)
{
struct syscall_response *res = cpu_local_var(scp).response_va;
dkprintf("SC(%d)[%3d] sending syscall\n",
aal_mc_get_processor_id(),
ihk_mc_get_processor_id(),
req->number);
send_syscall(req);
dkprintf("SC(%d)[%3d] waiting for host.. \n",
aal_mc_get_processor_id(),
ihk_mc_get_processor_id(),
req->number);
while (!res->status) {
@ -96,19 +96,19 @@ int do_syscall(struct syscall_request *req, aal_mc_user_context_t *ctx)
}
dkprintf("SC(%d)[%3d] got host reply: %d \n",
aal_mc_get_processor_id(),
ihk_mc_get_processor_id(),
req->number, res->ret);
return res->ret;
}
long sys_brk(int n, aal_mc_user_context_t *ctx)
long sys_brk(int n, ihk_mc_user_context_t *ctx)
{
unsigned long address = aal_mc_syscall_arg0(ctx);
unsigned long address = ihk_mc_syscall_arg0(ctx);
struct vm_regions *region = &cpu_local_var(current)->vm->region;
unsigned long r;
dkprintf("SC(%d)[sys_brk] brk_start=%lx,end=%lx\n", aal_mc_get_processor_id(), region->brk_start, region->brk_end);
dkprintf("SC(%d)[sys_brk] brk_start=%lx,end=%lx\n", ihk_mc_get_processor_id(), region->brk_start, region->brk_end);
/* brk change fail, including glibc trick brk(0) to obtain current brk */
if(address < region->brk_start) {
@ -123,13 +123,13 @@ long sys_brk(int n, aal_mc_user_context_t *ctx)
}
/* try to extend memory region */
unsigned long flags = aal_mc_spinlock_lock(&cpu_local_var(current)->vm->memory_range_lock);
unsigned long flags = ihk_mc_spinlock_lock(&cpu_local_var(current)->vm->memory_range_lock);
region->brk_end =
extend_process_region(cpu_local_var(current),
region->brk_start, region->brk_end,
address, 0);
aal_mc_spinlock_unlock(&cpu_local_var(current)->vm->memory_range_lock, flags);
dkprintf("SC(%d)[sys_brk] brk_end set to %lx\n", aal_mc_get_processor_id(), region->brk_end);
ihk_mc_spinlock_unlock(&cpu_local_var(current)->vm->memory_range_lock, flags);
dkprintf("SC(%d)[sys_brk] brk_end set to %lx\n", ihk_mc_get_processor_id(), region->brk_end);
r = region->brk_end;
@ -138,15 +138,15 @@ long sys_brk(int n, aal_mc_user_context_t *ctx)
}
#define SYSCALL_DECLARE(name) long sys_##name(int n, aal_mc_user_context_t *ctx)
#define SYSCALL_HEADER struct syscall_request request AAL_DMA_ALIGN; \
#define SYSCALL_DECLARE(name) long sys_##name(int n, ihk_mc_user_context_t *ctx)
#define SYSCALL_HEADER struct syscall_request request IHK_DMA_ALIGN; \
request.number = n
#define SYSCALL_ARG_D(n) request.args[n] = aal_mc_syscall_arg##n(ctx)
#define SYSCALL_ARG_D(n) request.args[n] = ihk_mc_syscall_arg##n(ctx)
#define SYSCALL_ARG_MO(n) \
do { \
unsigned long __phys; \
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, \
(void *)aal_mc_syscall_arg##n(ctx),\
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, \
(void *)ihk_mc_syscall_arg##n(ctx),\
&__phys)) { \
return -EFAULT; \
}\
@ -155,8 +155,8 @@ long sys_brk(int n, aal_mc_user_context_t *ctx)
#define SYSCALL_ARG_MI(n) \
do { \
unsigned long __phys; \
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, \
(void *)aal_mc_syscall_arg##n(ctx),\
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, \
(void *)ihk_mc_syscall_arg##n(ctx),\
&__phys)) { \
return -EFAULT; \
}\
@ -195,7 +195,7 @@ SYSCALL_DECLARE(open)
{
SYSCALL_HEADER;
dkprintf("open: %s\n", (char*)aal_mc_syscall_arg0(ctx));
dkprintf("open: %s\n", (char*)ihk_mc_syscall_arg0(ctx));
SYSCALL_ARGS_3(MI, D, D);
SYSCALL_FOOTER;
}
@ -203,7 +203,7 @@ SYSCALL_DECLARE(open)
SYSCALL_DECLARE(stat)
{
SYSCALL_HEADER;
dkprintf("stat(\"%s\");\n", (char*)aal_mc_syscall_arg0(ctx));
dkprintf("stat(\"%s\");\n", (char*)ihk_mc_syscall_arg0(ctx));
SYSCALL_ARGS_2(MO, MO);
SYSCALL_FOOTER;
}
@ -211,7 +211,7 @@ SYSCALL_DECLARE(stat)
SYSCALL_DECLARE(time)
{
SYSCALL_HEADER;
if(aal_mc_syscall_arg0(ctx)) {
if(ihk_mc_syscall_arg0(ctx)) {
SYSCALL_ARGS_1(MO);
} else {
SYSCALL_ARGS_1(D);
@ -233,7 +233,7 @@ static DECLARE_WAITQ(my_waitq);
SYSCALL_DECLARE(ioctl)
{
switch (aal_mc_syscall_arg0(ctx)) {
switch (ihk_mc_syscall_arg0(ctx)) {
case 0: {
struct waitq_entry my_wait;
@ -284,7 +284,7 @@ SYSCALL_DECLARE(ioctl)
SYSCALL_HEADER;
/* Very ad-hoc for termios */
switch(aal_mc_syscall_arg1(ctx)) {
switch(ihk_mc_syscall_arg1(ctx)) {
case 0x5401:
SYSCALL_ARGS_3(D, D, MO);
SYSCALL_FOOTER;
@ -328,7 +328,7 @@ SYSCALL_DECLARE(close)
SYSCALL_ARGS_1(D);
SYSCALL_FOOTER;
#if 0
dkprintf("[%d] close() \n", aal_mc_get_processor_id());
dkprintf("[%d] close() \n", ihk_mc_get_processor_id());
return -EBADF;
#endif
/*
@ -351,11 +351,11 @@ SYSCALL_DECLARE(exit_group)
SYSCALL_HEADER;
#ifdef DCFA_KMOD
do_mod_exit((int)aal_mc_syscall_arg0(ctx));
do_mod_exit((int)ihk_mc_syscall_arg0(ctx));
#endif
do_syscall(&request, ctx);
runq_del_proc(cpu_local_var(current), aal_mc_get_processor_id());
runq_del_proc(cpu_local_var(current), ihk_mc_get_processor_id());
free_process_memory(cpu_local_var(current));
//cpu_local_var(next) = &cpu_local_var(idle);
@ -373,29 +373,29 @@ SYSCALL_DECLARE(mmap)
unsigned long lockr;
kprintf("syscall.c,mmap,addr=%lx,len=%lx,prot=%lx,flags=%x,fd=%x,offset=%lx\n",
aal_mc_syscall_arg0(ctx), aal_mc_syscall_arg1(ctx),
aal_mc_syscall_arg2(ctx), aal_mc_syscall_arg3(ctx),
aal_mc_syscall_arg4(ctx), aal_mc_syscall_arg5(ctx)
ihk_mc_syscall_arg0(ctx), ihk_mc_syscall_arg1(ctx),
ihk_mc_syscall_arg2(ctx), ihk_mc_syscall_arg3(ctx),
ihk_mc_syscall_arg4(ctx), ihk_mc_syscall_arg5(ctx)
);
//kprintf("syscall.c,mmap,dumping kmsg...\n");
// send_kmsg(ctx);
// return -EINVAL; // debug
if((aal_mc_syscall_arg3(ctx) & 0x10) == 0x10) {
if((ihk_mc_syscall_arg3(ctx) & 0x10) == 0x10) {
// libc/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
// #define MAP_FIXED 0x10
// use the given vaddr as is
struct syscall_request request AAL_DMA_ALIGN;
struct syscall_request request IHK_DMA_ALIGN;
request.number = n;
// do a job similar to mcos/kernel/host.c:process_msg_prepare_process
unsigned long s = (aal_mc_syscall_arg0(ctx)) & PAGE_MASK;
unsigned long e = (s + aal_mc_syscall_arg1(ctx)
unsigned long s = (ihk_mc_syscall_arg0(ctx)) & PAGE_MASK;
unsigned long e = (s + ihk_mc_syscall_arg1(ctx)
+ PAGE_SIZE - 1) & PAGE_MASK;
int range_npages = (e - s) >> PAGE_SHIFT;
unsigned long pa;
int r = aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, (void *)s, &pa);
int r = ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, (void *)s, &pa);
// va range is not overwrapped with existing mmap
if(r != 0) {
@ -415,7 +415,7 @@ SYSCALL_DECLARE(mmap)
}
e = (e + (LARGE_PAGE_SIZE - 1)) & LARGE_PAGE_MASK;
p = (unsigned long)aal_mc_alloc_pages(
p = (unsigned long)ihk_mc_alloc_pages(
(e - s + 2 * LARGE_PAGE_SIZE) >> PAGE_SHIFT, 0);
p_aligned = (p + LARGE_PAGE_SIZE + (LARGE_PAGE_SIZE - 1))
@ -432,7 +432,7 @@ SYSCALL_DECLARE(mmap)
else {
#endif
// allocate physical address
pa = virt_to_phys(aal_mc_alloc_pages(range_npages, 0));
pa = virt_to_phys(ihk_mc_alloc_pages(range_npages, 0));
// add page_table, add memory-range
add_process_memory_range(cpu_local_var(current), s, e, pa, 0);
@ -450,29 +450,29 @@ SYSCALL_DECLARE(mmap)
kprintf("syscall.c,clearing from %lx to %lx\n", s, e);
memset((void*)phys_to_virt(pa), 0, e - s);
}
if ((aal_mc_syscall_arg3(ctx) & 0x20) == 0x20) {
if ((ihk_mc_syscall_arg3(ctx) & 0x20) == 0x20) {
// #define MAP_ANONYMOUS 0x20
kprintf("syscall.c,MAP_FIXED,MAP_ANONYMOUS\n");
return aal_mc_syscall_arg0(ctx); // maybe we should return zero
return ihk_mc_syscall_arg0(ctx); // maybe we should return zero
} else {
kprintf("syscall.c,MAP_FIXED,!MAP_ANONYMOUS\n");
// lseek(mmap_fd, mmap_off, SEEK_SET);
// read(mmap_fd, mmap_addr, mmap_len);
SYSCALL_ARGS_6(MO, D, D, D, D, D);
int r = do_syscall(&request, ctx);
if(r == 0) { return aal_mc_syscall_arg0(ctx); } else { return -EINVAL; }
if(r == 0) { return ihk_mc_syscall_arg0(ctx); } else { return -EINVAL; }
}
} else if ((aal_mc_syscall_arg3(ctx) & 0x20) == 0x20) {
} else if ((ihk_mc_syscall_arg3(ctx) & 0x20) == 0x20) {
// #define MAP_ANONYMOUS 0x20
kprintf("syscall.c,!MAP_FIXED,MAP_ANONYMOUS\n");
unsigned long flags = aal_mc_spinlock_lock(&cpu_local_var(current)->vm->memory_range_lock);
unsigned long flags = ihk_mc_spinlock_lock(&cpu_local_var(current)->vm->memory_range_lock);
unsigned long s = (region->map_end + PAGE_SIZE - 1) & PAGE_MASK;
unsigned long map_end_aligned = region->map_end;
unsigned long len = (aal_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
unsigned long len = (ihk_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
dkprintf("syscall.c,mmap,len=%lx", len);
#ifdef USE_NOCACHE_MMAP
if ((aal_mc_syscall_arg3(ctx) & 0x40) == 0x40) {
if ((ihk_mc_syscall_arg3(ctx) & 0x40) == 0x40) {
dkprintf("syscall.c,mmap,nocache,len=%lx\n", len);
region->map_end = extend_process_region(
cpu_local_var(current), region->map_start, map_end_aligned,
@ -488,7 +488,7 @@ SYSCALL_DECLARE(mmap)
s + len, 0);
}
aal_mc_spinlock_unlock(&cpu_local_var(current)->vm->memory_range_lock, flags);
ihk_mc_spinlock_unlock(&cpu_local_var(current)->vm->memory_range_lock, flags);
dkprintf("syscall.c,mmap,map_end=%lx,s+len=%lx\n", region->map_end, s+len);
#ifdef USE_LARGE_PAGES
if (region->map_end >= s + len) {
@ -502,16 +502,16 @@ SYSCALL_DECLARE(mmap)
return -EINVAL;
}
} else if ((aal_mc_syscall_arg3(ctx) & 0x02) == 0x02) {
} else if ((ihk_mc_syscall_arg3(ctx) & 0x02) == 0x02) {
// #define MAP_PRIVATE 0x02
unsigned long flags = aal_mc_spinlock_lock(&cpu_local_var(current)->vm->memory_range_lock);
unsigned long flags = ihk_mc_spinlock_lock(&cpu_local_var(current)->vm->memory_range_lock);
#if 1 /* takagidebug*/
unsigned long amt_align = 0x100000; /* takagi */
unsigned long s = ((region->map_end + amt_align - 1) & ~(amt_align - 1));
unsigned long len = (aal_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
dkprintf("(%d),syscall.c,!MAP_FIXED,!MAP_ANONYMOUS,amt_align=%lx,s=%lx,len=%lx\n", aal_mc_get_processor_id(), amt_align, s, len);
unsigned long len = (ihk_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
dkprintf("(%d),syscall.c,!MAP_FIXED,!MAP_ANONYMOUS,amt_align=%lx,s=%lx,len=%lx\n", ihk_mc_get_processor_id(), amt_align, s, len);
region->map_end =
extend_process_region(cpu_local_var(current),
region->map_start,
@ -519,18 +519,18 @@ SYSCALL_DECLARE(mmap)
s + len, 0);
#else
unsigned long s = (region->map_end + PAGE_SIZE - 1) & PAGE_MASK;
unsigned long len = (aal_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
unsigned long len = (ihk_mc_syscall_arg1(ctx) + PAGE_SIZE - 1) & PAGE_MASK;
region->map_end =
extend_process_region(cpu_local_var(current),
region->map_start,
region->map_end,
s + len, 0);
#endif
aal_mc_spinlock_unlock(&cpu_local_var(current)->vm->memory_range_lock, flags);
ihk_mc_spinlock_unlock(&cpu_local_var(current)->vm->memory_range_lock, flags);
if (region->map_end < s + len) { return -EINVAL; }
s = region->map_end - len;
struct syscall_request request AAL_DMA_ALIGN;
struct syscall_request request IHK_DMA_ALIGN;
request.number = n;
kprintf("syscall.c,!MAP_FIXED,!MAP_ANONYMOUS,MAP_PRIVATE\n");
@ -539,7 +539,7 @@ SYSCALL_DECLARE(mmap)
SYSCALL_ARGS_6(MO, D, D, D, D, D);
// overwriting request.args[0]
unsigned long __phys;
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, (void *)s, &__phys)) {
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table, (void *)s, &__phys)) {
return -EFAULT;
}
request.args[0] = __phys;
@ -548,7 +548,7 @@ SYSCALL_DECLARE(mmap)
if(r == 0) { return s; } else { return -EINVAL; }
}
dkprintf("mmap flags not supported: fd = %lx, %lx\n",
aal_mc_syscall_arg4(ctx), aal_mc_syscall_arg5(ctx));
ihk_mc_syscall_arg4(ctx), ihk_mc_syscall_arg5(ctx));
while(1);
}
@ -556,8 +556,8 @@ SYSCALL_DECLARE(munmap)
{
unsigned long address, len;
address = aal_mc_syscall_arg0(ctx);
len = aal_mc_syscall_arg1(ctx);
address = ihk_mc_syscall_arg0(ctx);
len = ihk_mc_syscall_arg1(ctx);
return remove_process_region(cpu_local_var(current), address,
address + len);
@ -581,8 +581,8 @@ SYSCALL_DECLARE(uname)
unsigned long phys;
int ret;
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
(void *)aal_mc_syscall_arg0(ctx), &phys)) {
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
(void *)ihk_mc_syscall_arg0(ctx), &phys)) {
return -EFAULT;
}
@ -605,7 +605,7 @@ SYSCALL_DECLARE(getcwd)
SYSCALL_DECLARE(access)
{
kprintf("access: %s\n", (char*)aal_mc_syscall_arg0(ctx));
kprintf("access: %s\n", (char*)ihk_mc_syscall_arg0(ctx));
SYSCALL_HEADER;
SYSCALL_ARGS_2(MI, D);
SYSCALL_FOOTER;
@ -628,14 +628,14 @@ SYSCALL_DECLARE(fcntl)
SYSCALL_DECLARE(readlink)
{
SYSCALL_HEADER;
dkprintf("readlink: %s\n", (char*)aal_mc_syscall_arg0(ctx));
dkprintf("readlink: %s\n", (char*)ihk_mc_syscall_arg0(ctx));
SYSCALL_ARGS_3(MI, MO, D);
SYSCALL_FOOTER;
}
long sys_getxid(int n, aal_mc_user_context_t *ctx)
long sys_getxid(int n, ihk_mc_user_context_t *ctx)
{
struct syscall_request request AAL_DMA_ALIGN;
struct syscall_request request IHK_DMA_ALIGN;
request.number = n;
@ -645,15 +645,15 @@ long sys_getxid(int n, aal_mc_user_context_t *ctx)
long do_arch_prctl(unsigned long code, unsigned long address)
{
int err = 0;
enum aal_asr_type type;
enum ihk_asr_type type;
switch (code) {
case ARCH_SET_FS:
case ARCH_GET_FS:
type = AAL_ASR_X86_FS;
type = IHK_ASR_X86_FS;
break;
case ARCH_GET_GS:
type = AAL_ASR_X86_GS;
type = IHK_ASR_X86_GS;
break;
case ARCH_SET_GS:
return -ENOTSUPP;
@ -664,16 +664,16 @@ long do_arch_prctl(unsigned long code, unsigned long address)
switch (code) {
case ARCH_SET_FS:
kprintf("[%d] arch_prctl: ARCH_SET_FS: 0x%lX\n",
aal_mc_get_processor_id(), address);
ihk_mc_get_processor_id(), address);
cpu_local_var(current)->thread.tlsblock_base = address;
err = aal_mc_arch_set_special_register(type, address);
err = ihk_mc_arch_set_special_register(type, address);
break;
case ARCH_SET_GS:
err = aal_mc_arch_set_special_register(type, address);
err = ihk_mc_arch_set_special_register(type, address);
break;
case ARCH_GET_FS:
case ARCH_GET_GS:
err = aal_mc_arch_get_special_register(type,
err = ihk_mc_arch_get_special_register(type,
(unsigned long*)address);
break;
default:
@ -686,8 +686,8 @@ long do_arch_prctl(unsigned long code, unsigned long address)
SYSCALL_DECLARE(arch_prctl)
{
return do_arch_prctl(aal_mc_syscall_arg0(ctx),
aal_mc_syscall_arg1(ctx));
return do_arch_prctl(ihk_mc_syscall_arg0(ctx),
ihk_mc_syscall_arg1(ctx));
}
@ -695,16 +695,16 @@ SYSCALL_DECLARE(clone)
{
int i;
int cpuid = -1;
int clone_flags = aal_mc_syscall_arg0(ctx);
int clone_flags = ihk_mc_syscall_arg0(ctx);
//unsigned long flags; /* spinlock */
struct aal_mc_cpu_info *cpu_info = aal_mc_get_cpu_info();
struct ihk_mc_cpu_info *cpu_info = ihk_mc_get_cpu_info();
struct process *new;
dkprintf("[%d] clone(): stack_pointr: 0x%lX\n",
aal_mc_get_processor_id(),
(unsigned long)aal_mc_syscall_arg1(ctx));
ihk_mc_get_processor_id(),
(unsigned long)ihk_mc_syscall_arg1(ctx));
//flags = aal_mc_spinlock_lock(&cpu_status_lock);
//flags = ihk_mc_spinlock_lock(&cpu_status_lock);
for (i = 0; i < cpu_info->ncpus; i++) {
if (get_cpu_local_var(i)->status == CPU_STATUS_IDLE) {
cpuid = i;
@ -715,50 +715,50 @@ SYSCALL_DECLARE(clone)
if (cpuid < 0)
return -EAGAIN;
new = clone_process(cpu_local_var(current), aal_mc_syscall_pc(ctx),
aal_mc_syscall_arg1(ctx));
new = clone_process(cpu_local_var(current), ihk_mc_syscall_pc(ctx),
ihk_mc_syscall_arg1(ctx));
if (!new) {
return -ENOMEM;
}
/* Allocate new pid */
new->pid = aal_atomic_inc_return(&pid_cnt);
new->pid = ihk_atomic_inc_return(&pid_cnt);
if (clone_flags & CLONE_PARENT_SETTID) {
dkprintf("clone_flags & CLONE_PARENT_SETTID: 0x%lX\n",
(unsigned long)aal_mc_syscall_arg2(ctx));
(unsigned long)ihk_mc_syscall_arg2(ctx));
*(int*)aal_mc_syscall_arg2(ctx) = new->pid;
*(int*)ihk_mc_syscall_arg2(ctx) = new->pid;
}
if (clone_flags & CLONE_CHILD_CLEARTID) {
dkprintf("clone_flags & CLONE_CHILD_CLEARTID: 0x%lX\n",
(unsigned long)aal_mc_syscall_arg3(ctx));
(unsigned long)ihk_mc_syscall_arg3(ctx));
new->thread.clear_child_tid = (int*)aal_mc_syscall_arg3(ctx);
new->thread.clear_child_tid = (int*)ihk_mc_syscall_arg3(ctx);
}
if (clone_flags & CLONE_SETTLS) {
dkprintf("clone_flags & CLONE_SETTLS: 0x%lX\n",
(unsigned long)aal_mc_syscall_arg4(ctx));
(unsigned long)ihk_mc_syscall_arg4(ctx));
new->thread.tlsblock_base =
(unsigned long)aal_mc_syscall_arg4(ctx);
(unsigned long)ihk_mc_syscall_arg4(ctx);
}
else {
new->thread.tlsblock_base =
cpu_local_var(current)->thread.tlsblock_base;
}
aal_mc_syscall_ret(new->uctx) = 0;
ihk_mc_syscall_ret(new->uctx) = 0;
dkprintf("clone: kicking scheduler!\n");
runq_add_proc(new, cpuid);
//while (1) { cpu_halt(); }
#if 0
aal_mc_syscall_ret(new->uctx) = 0;
ihk_mc_syscall_ret(new->uctx) = 0;
/* Hope it is scheduled after... :) */
request.number = n;
@ -774,7 +774,7 @@ SYSCALL_DECLARE(clone)
SYSCALL_DECLARE(set_tid_address)
{
cpu_local_var(current)->thread.clear_child_tid =
(int*)aal_mc_syscall_arg2(ctx);
(int*)ihk_mc_syscall_arg2(ctx);
return cpu_local_var(current)->pid;
}
@ -782,9 +782,9 @@ SYSCALL_DECLARE(set_tid_address)
// see linux-2.6.34.13/kernel/signal.c
SYSCALL_DECLARE(tgkill)
{
int tgid = aal_mc_syscall_arg0(ctx);
int pid = aal_mc_syscall_arg1(ctx);
int sig = aal_mc_syscall_arg2(ctx);
int tgid = ihk_mc_syscall_arg0(ctx);
int pid = ihk_mc_syscall_arg1(ctx);
int sig = ihk_mc_syscall_arg2(ctx);
if(pid <= 0 || tgid <= 0) { return -EINVAL; }
// search pid
@ -804,18 +804,18 @@ SYSCALL_DECLARE(set_robust_list)
SYSCALL_DECLARE(writev)
{
/* Adhoc implementation of writev calling write sequentially */
struct syscall_request request AAL_DMA_ALIGN;
struct syscall_request request IHK_DMA_ALIGN;
unsigned long seg;
size_t seg_ret, ret = 0;
int fd = aal_mc_syscall_arg0(ctx);
struct iovec *iov = (struct iovec*)aal_mc_syscall_arg1(ctx);
unsigned long nr_segs = aal_mc_syscall_arg2(ctx);
int fd = ihk_mc_syscall_arg0(ctx);
struct iovec *iov = (struct iovec*)ihk_mc_syscall_arg1(ctx);
unsigned long nr_segs = ihk_mc_syscall_arg2(ctx);
for (seg = 0; seg < nr_segs; ++seg) {
unsigned long __phys;
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
(void *)iov[seg].iov_base, &__phys)) {
return -EFAULT;
}
@ -859,12 +859,12 @@ SYSCALL_DECLARE(futex)
uint64_t timeout = 0; // No timeout
uint32_t val2 = 0;
uint32_t *uaddr = (uint32_t *)aal_mc_syscall_arg0(ctx);
int op = (int)aal_mc_syscall_arg1(ctx);
uint32_t val = (uint32_t)aal_mc_syscall_arg2(ctx);
struct timespec *utime = (struct timespec*)aal_mc_syscall_arg3(ctx);
uint32_t *uaddr2 = (uint32_t *)aal_mc_syscall_arg4(ctx);
uint32_t val3 = (uint32_t)aal_mc_syscall_arg5(ctx);
uint32_t *uaddr = (uint32_t *)ihk_mc_syscall_arg0(ctx);
int op = (int)ihk_mc_syscall_arg1(ctx);
uint32_t val = (uint32_t)ihk_mc_syscall_arg2(ctx);
struct timespec *utime = (struct timespec*)ihk_mc_syscall_arg3(ctx);
uint32_t *uaddr2 = (uint32_t *)ihk_mc_syscall_arg4(ctx);
uint32_t val3 = (uint32_t)ihk_mc_syscall_arg5(ctx);
dkprintf("futex,uaddr=%lx,op=%x, val=%x, utime=%lx, uaddr2=%lx, val3=%x, []=%x\n", (unsigned long)uaddr, op, val, utime, uaddr2, val3, *uaddr);
@ -874,14 +874,14 @@ SYSCALL_DECLARE(futex)
if (utime && (op == FUTEX_WAIT_BITSET || op == FUTEX_WAIT)) {
/* gettimeofday(&tv_now, NULL) from host */
struct syscall_request request AAL_DMA_ALIGN;
struct syscall_request request IHK_DMA_ALIGN;
struct timeval tv_now;
request.number = 96;
unsigned long __phys;
dkprintf("futex,utime and FUTEX_WAIT_*, uaddr=%lx, []=%x\n", (unsigned long)uaddr, *uaddr);
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
(void *)&tv_now, &__phys)) {
return -EFAULT;
}
@ -894,7 +894,7 @@ SYSCALL_DECLARE(futex)
return -EFAULT;
}
dkprintf("futex, FUTEX_WAIT_*, arg3 != NULL, pc=%lx\n", (unsigned long)aal_mc_syscall_pc(ctx));
dkprintf("futex, FUTEX_WAIT_*, arg3 != NULL, pc=%lx\n", (unsigned long)ihk_mc_syscall_pc(ctx));
dkprintf("now->tv_sec=%016ld,tv_nsec=%016ld\n", tv_now.tv_sec, tv_now.tv_usec * 1000);
dkprintf("utime->tv_sec=%016ld,tv_nsec=%016ld\n", utime->tv_sec, utime->tv_nsec);
@ -910,18 +910,18 @@ SYSCALL_DECLARE(futex)
/* Requeue parameter in 'utime' if op == FUTEX_CMP_REQUEUE.
* number of waiters to wake in 'utime' if op == FUTEX_WAKE_OP. */
if (op == FUTEX_CMP_REQUEUE || op == FUTEX_WAKE_OP)
val2 = (uint32_t) (unsigned long) aal_mc_syscall_arg3(ctx);
val2 = (uint32_t) (unsigned long) ihk_mc_syscall_arg3(ctx);
// we don't have timer interrupt and wakeup, so fake it by just pausing
if (utime && (op == FUTEX_WAIT_BITSET || op == FUTEX_WAIT)) {
// gettimeofday(&tv_now, NULL);
struct syscall_request request AAL_DMA_ALIGN;
struct syscall_request request IHK_DMA_ALIGN;
struct timeval tv_now;
request.number = 96;
#if 1
unsigned long __phys;
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
(void *)&tv_now,
&__phys)) {
return -EFAULT;
@ -933,7 +933,7 @@ SYSCALL_DECLARE(futex)
return -EFAULT;
}
dkprintf("futex,FUTEX_WAIT_BITSET,arg3!=NULL,pc=%lx\n", (unsigned long)aal_mc_syscall_pc(ctx));
dkprintf("futex,FUTEX_WAIT_BITSET,arg3!=NULL,pc=%lx\n", (unsigned long)ihk_mc_syscall_pc(ctx));
dkprintf(" now->tv_sec=%016ld,tv_nsec=%016ld\n", tv_now.tv_sec, tv_now.tv_usec * 1000);
dkprintf("utime->tv_sec=%016ld,tv_nsec=%016ld\n", utime->tv_sec, utime->tv_nsec);
@ -963,7 +963,7 @@ SYSCALL_DECLARE(futex)
SYSCALL_DECLARE(exit)
{
#ifdef DCFA_KMOD
do_mod_exit((int)aal_mc_syscall_arg0(ctx));
do_mod_exit((int)ihk_mc_syscall_arg0(ctx));
#endif
/* If there is a clear_child_tid address set, clear it and wake it.
@ -990,14 +990,14 @@ SYSCALL_DECLARE(exit)
SYSCALL_DECLARE(getrlimit)
{
int ret;
int resource = aal_mc_syscall_arg0(ctx);
struct rlimit *rlm = (struct rlimit *)aal_mc_syscall_arg1(ctx);
int resource = ihk_mc_syscall_arg0(ctx);
struct rlimit *rlm = (struct rlimit *)ihk_mc_syscall_arg1(ctx);
switch (resource) {
case RLIMIT_STACK:
dkprintf("[%d] getrlimit() RLIMIT_STACK\n", aal_mc_get_processor_id());
dkprintf("[%d] getrlimit() RLIMIT_STACK\n", ihk_mc_get_processor_id());
rlm->rlim_cur = (512*4096); /* Linux provides 8MB */
rlm->rlim_max = (1024*1024*1024);
ret = 0;
@ -1014,17 +1014,17 @@ SYSCALL_DECLARE(getrlimit)
SYSCALL_DECLARE(sched_setaffinity)
{
#if 0
int pid = (int)aal_mc_syscall_arg0(ctx);
unsigned int len = (unsigned int)aal_mc_syscall_arg1(ctx);
int pid = (int)ihk_mc_syscall_arg0(ctx);
unsigned int len = (unsigned int)ihk_mc_syscall_arg1(ctx);
#endif
cpu_set_t *mask = (cpu_set_t *)aal_mc_syscall_arg2(ctx);
cpu_set_t *mask = (cpu_set_t *)ihk_mc_syscall_arg2(ctx);
unsigned long __phys;
#if 0
int i;
#endif
/* TODO: check mask is in user's page table */
if(!mask) { return -EFAULT; }
if (aal_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->page_table,
(void *)mask,
&__phys)) {
return -EFAULT;
@ -1043,11 +1043,11 @@ SYSCALL_DECLARE(sched_setaffinity)
// see linux-2.6.34.13/kernel/sched.c
SYSCALL_DECLARE(sched_getaffinity)
{
//int pid = (int)aal_mc_syscall_arg0(ctx);
unsigned int len = (int)aal_mc_syscall_arg1(ctx);
//int pid = (int)ihk_mc_syscall_arg0(ctx);
unsigned int len = (int)ihk_mc_syscall_arg1(ctx);
int cpu_id;
cpu_set_t *mask = (cpu_set_t *)aal_mc_syscall_arg2(ctx);
struct aal_mc_cpu_info *cpu_info = aal_mc_get_cpu_info();
cpu_set_t *mask = (cpu_set_t *)ihk_mc_syscall_arg2(ctx);
struct ihk_mc_cpu_info *cpu_info = ihk_mc_get_cpu_info();
if(len*8 < cpu_info->ncpus) { return -EINVAL; }
if(len & (sizeof(unsigned long)-1)) { return -EINVAL; }
int min_len = MIN2(len, sizeof(cpu_set_t));
@ -1088,8 +1088,8 @@ SYSCALL_DECLARE(mod_call) {
int mod_id;
unsigned long long uargs;
mod_id = aal_mc_syscall_arg0(ctx);
uargs = aal_mc_syscall_arg1(ctx);
mod_id = ihk_mc_syscall_arg0(ctx);
uargs = ihk_mc_syscall_arg1(ctx);
dkprintf("mod_call id:%d, uargs=0x%llx, type=%s, command=%x\n", mod_id, uargs, mod_id==1?"ibmic":"dcfampi", *((uint32_t*)(((char*)uargs)+0)));
@ -1111,43 +1111,43 @@ static void do_mod_exit(int status){
SYSCALL_DECLARE(process_data_section) {
unsigned long s = cpu_local_var(current)->vm->region.data_start;
unsigned long e = cpu_local_var(current)->vm->region.data_end;
*((unsigned long*)aal_mc_syscall_arg0(ctx)) = s;
*((unsigned long*)aal_mc_syscall_arg1(ctx)) = e;
*((unsigned long*)ihk_mc_syscall_arg0(ctx)) = s;
*((unsigned long*)ihk_mc_syscall_arg1(ctx)) = e;
return 0;
}
/* select counter type */
SYSCALL_DECLARE(pmc_init)
{
int counter = aal_mc_syscall_arg0(ctx);
int counter = ihk_mc_syscall_arg0(ctx);
enum aal_perfctr_type type = (enum aal_perfctr_type)aal_mc_syscall_arg1(ctx);
/* see aal/manycore/generic/include/aal/perfctr.h */
enum ihk_perfctr_type type = (enum ihk_perfctr_type)ihk_mc_syscall_arg1(ctx);
/* see ihk/manycore/generic/include/ihk/perfctr.h */
int mode = PERFCTR_USER_MODE;
return aal_mc_perfctr_init(counter, type, mode);
return ihk_mc_perfctr_init(counter, type, mode);
}
SYSCALL_DECLARE(pmc_start)
{
unsigned long counter = aal_mc_syscall_arg0(ctx);
return aal_mc_perfctr_start(1 << counter);
unsigned long counter = ihk_mc_syscall_arg0(ctx);
return ihk_mc_perfctr_start(1 << counter);
}
SYSCALL_DECLARE(pmc_stop)
{
unsigned long counter = aal_mc_syscall_arg0(ctx);
return aal_mc_perfctr_stop(1 << counter);
unsigned long counter = ihk_mc_syscall_arg0(ctx);
return ihk_mc_perfctr_stop(1 << counter);
}
SYSCALL_DECLARE(pmc_reset)
{
int counter = aal_mc_syscall_arg0(ctx);
return aal_mc_perfctr_reset(counter);
int counter = ihk_mc_syscall_arg0(ctx);
return ihk_mc_perfctr_reset(counter);
}
static long (*syscall_table[])(int, aal_mc_user_context_t *) = {
static long (*syscall_table[])(int, ihk_mc_user_context_t *) = {
[0] = sys_read,
[1] = sys_write,
[2] = sys_open,
@ -1263,20 +1263,20 @@ static char *syscall_name[] = {
#if 0
aal_spinlock_t cpu_status_lock;
ihk_spinlock_t cpu_status_lock;
static int clone_init(void)
{
unsigned long flags;
aal_mc_spinlock_init(&cpu_status_lock);
ihk_mc_spinlock_init(&cpu_status_lock);
return 0;
}
#endif
long syscall(int num, aal_mc_user_context_t *ctx)
long syscall(int num, ihk_mc_user_context_t *ctx)
{
long l;
@ -1286,22 +1286,22 @@ long syscall(int num, aal_mc_user_context_t *ctx)
if(num != 24) // if not sched_yield
#endif
dkprintf("SC(%d:%d)[%3d=%s](%lx, %lx,%lx, %lx, %lx, %lx)@%lx,sp:%lx",
aal_mc_get_processor_id(),
aal_mc_get_hardware_processor_id(),
ihk_mc_get_processor_id(),
ihk_mc_get_hardware_processor_id(),
num, syscall_name[num],
aal_mc_syscall_arg0(ctx), aal_mc_syscall_arg1(ctx),
aal_mc_syscall_arg2(ctx), aal_mc_syscall_arg3(ctx),
aal_mc_syscall_arg4(ctx), aal_mc_syscall_arg5(ctx),
aal_mc_syscall_pc(ctx), aal_mc_syscall_sp(ctx));
ihk_mc_syscall_arg0(ctx), ihk_mc_syscall_arg1(ctx),
ihk_mc_syscall_arg2(ctx), ihk_mc_syscall_arg3(ctx),
ihk_mc_syscall_arg4(ctx), ihk_mc_syscall_arg5(ctx),
ihk_mc_syscall_pc(ctx), ihk_mc_syscall_sp(ctx));
#if 1
#if 0
if(num != 24) // if not sched_yield
#endif
dkprintf(",*sp:%lx,*(sp+8):%lx,*(sp+16):%lx,*(sp+24):%lx",
*((unsigned long*)aal_mc_syscall_sp(ctx)),
*((unsigned long*)(aal_mc_syscall_sp(ctx)+8)),
*((unsigned long*)(aal_mc_syscall_sp(ctx)+16)),
*((unsigned long*)(aal_mc_syscall_sp(ctx)+24)));
*((unsigned long*)ihk_mc_syscall_sp(ctx)),
*((unsigned long*)(ihk_mc_syscall_sp(ctx)+8)),
*((unsigned long*)(ihk_mc_syscall_sp(ctx)+16)),
*((unsigned long*)(ihk_mc_syscall_sp(ctx)+24)));
#endif
#if 0
if(num != 24) // if not sched_yield
@ -1313,13 +1313,13 @@ long syscall(int num, aal_mc_user_context_t *ctx)
l = syscall_table[num](num, ctx);
dkprintf("SC(%d)[%3d] ret: %d\n",
aal_mc_get_processor_id(), num, l);
ihk_mc_get_processor_id(), num, l);
} else {
dkprintf("USC[%3d](%lx, %lx, %lx, %lx, %lx) @ %lx | %lx\n", num,
aal_mc_syscall_arg0(ctx), aal_mc_syscall_arg1(ctx),
aal_mc_syscall_arg2(ctx), aal_mc_syscall_arg3(ctx),
aal_mc_syscall_arg4(ctx), aal_mc_syscall_pc(ctx),
aal_mc_syscall_sp(ctx));
ihk_mc_syscall_arg0(ctx), ihk_mc_syscall_arg1(ctx),
ihk_mc_syscall_arg2(ctx), ihk_mc_syscall_arg3(ctx),
ihk_mc_syscall_arg4(ctx), ihk_mc_syscall_pc(ctx),
ihk_mc_syscall_sp(ctx));
//while(1);
l = -ENOSYS;
}

View File

@ -33,12 +33,12 @@
#define LOOP_TIMEOUT 500
struct list_head timers;
aal_spinlock_t timers_lock;
ihk_spinlock_t timers_lock;
void init_timers(void)
{
aal_mc_spinlock_init(&timers_lock);
ihk_mc_spinlock_init(&timers_lock);
INIT_LIST_HEAD(&timers);
}
@ -49,10 +49,10 @@ uint64_t schedule_timeout(uint64_t timeout)
unsigned long irqflags;
struct process *proc = cpu_local_var(current);
irqflags = aal_mc_spinlock_lock(&proc->spin_sleep_lock);
irqflags = ihk_mc_spinlock_lock(&proc->spin_sleep_lock);
dkprintf("schedule_timeout() spin sleep timeout: %lu\n", timeout);
proc->spin_sleep = 1;
aal_mc_spinlock_unlock(&proc->spin_sleep_lock, irqflags);
ihk_mc_spinlock_unlock(&proc->spin_sleep_lock, irqflags);
/* Spin sleep.. */
for (;;) {
@ -60,7 +60,7 @@ uint64_t schedule_timeout(uint64_t timeout)
uint64_t t_e;
int spin_over = 0;
irqflags = aal_mc_spinlock_lock(&proc->spin_sleep_lock);
irqflags = ihk_mc_spinlock_lock(&proc->spin_sleep_lock);
/* Woken up by someone? */
if (!proc->spin_sleep) {
@ -75,7 +75,7 @@ uint64_t schedule_timeout(uint64_t timeout)
}
}
aal_mc_spinlock_unlock(&proc->spin_sleep_lock, irqflags);
ihk_mc_spinlock_unlock(&proc->spin_sleep_lock, irqflags);
t_s = rdtsc();
@ -105,9 +105,9 @@ uint64_t schedule_timeout(uint64_t timeout)
waitq_init_entry(&my_wait, cpu_local_var(current));
/* Add ourself to the timer queue */
irqflags = aal_mc_spinlock_lock(&timers_lock);
irqflags = ihk_mc_spinlock_lock(&timers_lock);
list_add_tail(&my_timer.list, &timers);
aal_mc_spinlock_unlock(&timers_lock, irqflags);
ihk_mc_spinlock_unlock(&timers_lock, irqflags);
dkprintf("schedule_timeout() sleep timeout: %lu\n", my_timer.timeout);
@ -116,14 +116,14 @@ uint64_t schedule_timeout(uint64_t timeout)
schedule();
waitq_finish_wait(&my_timer.processes, &my_wait);
irqflags = aal_mc_spinlock_lock(&timers_lock);
irqflags = ihk_mc_spinlock_lock(&timers_lock);
/* Waken up by someone else then timeout? */
if (my_timer.timeout) {
list_del(&my_timer.list);
}
aal_mc_spinlock_unlock(&timers_lock, irqflags);
ihk_mc_spinlock_unlock(&timers_lock, irqflags);
dkprintf("schedule_timeout() woken up, timeout: %lu\n",
my_timer.timeout);
@ -149,7 +149,7 @@ void wake_timers_loop(void)
/* Iterate and decrease timeout for all timers,
* wake up if timeout reaches zero. */
irqflags = aal_mc_spinlock_lock(&timers_lock);
irqflags = ihk_mc_spinlock_lock(&timers_lock);
list_for_each_entry_safe(timer, timer_next, &timers, list) {
@ -165,6 +165,6 @@ void wake_timers_loop(void)
}
}
aal_mc_spinlock_unlock(&timers_lock, irqflags);
ihk_mc_spinlock_unlock(&timers_lock, irqflags);
}
}

View File

@ -15,7 +15,7 @@ default_wake_function(waitq_entry_t *entry, unsigned mode,
void
waitq_init(waitq_t *waitq)
{
aal_mc_spinlock_init(&waitq->lock);
ihk_mc_spinlock_init(&waitq->lock);
INIT_LIST_HEAD(&waitq->waitq);
}
@ -33,9 +33,9 @@ waitq_active(waitq_t *waitq)
int active;
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&waitq->lock);
irqstate = ihk_mc_spinlock_lock(&waitq->lock);
active = !list_empty(&waitq->waitq);
aal_mc_spinlock_unlock(&waitq->lock, irqstate);
ihk_mc_spinlock_unlock(&waitq->lock, irqstate);
return active;
}
@ -45,9 +45,9 @@ waitq_add_entry(waitq_t *waitq, waitq_entry_t *entry)
{
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&waitq->lock);
irqstate = ihk_mc_spinlock_lock(&waitq->lock);
waitq_add_entry_locked(waitq, entry);
aal_mc_spinlock_unlock(&waitq->lock, irqstate);
ihk_mc_spinlock_unlock(&waitq->lock, irqstate);
}
@ -64,9 +64,9 @@ waitq_remove_entry(waitq_t *waitq, waitq_entry_t *entry)
{
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&waitq->lock);
irqstate = ihk_mc_spinlock_lock(&waitq->lock);
waitq_remove_entry_locked(waitq, entry);
aal_mc_spinlock_unlock(&waitq->lock, irqstate);
ihk_mc_spinlock_unlock(&waitq->lock, irqstate);
}
@ -83,11 +83,11 @@ waitq_prepare_to_wait(waitq_t *waitq, waitq_entry_t *entry, int state)
{
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&waitq->lock);
irqstate = ihk_mc_spinlock_lock(&waitq->lock);
if (list_empty(&entry->link))
list_add(&entry->link, &waitq->waitq);
cpu_local_var(current)->status = state;
aal_mc_spinlock_unlock(&waitq->lock, irqstate);
ihk_mc_spinlock_unlock(&waitq->lock, irqstate);
}
void
@ -104,12 +104,12 @@ waitq_wakeup(waitq_t *waitq)
struct list_head *tmp;
waitq_entry_t *entry;
irqstate = aal_mc_spinlock_lock(&waitq->lock);
irqstate = ihk_mc_spinlock_lock(&waitq->lock);
list_for_each(tmp, &waitq->waitq) {
entry = list_entry(tmp, waitq_entry_t, link);
entry->func(entry, 0, 0, NULL);
}
aal_mc_spinlock_unlock(&waitq->lock, irqstate);
ihk_mc_spinlock_unlock(&waitq->lock, irqstate);
}
@ -118,9 +118,9 @@ waitq_wake_nr(waitq_t * waitq, int nr)
{
unsigned long irqstate;
irqstate = aal_mc_spinlock_lock(&waitq->lock);
irqstate = ihk_mc_spinlock_lock(&waitq->lock);
int count = waitq_wake_nr_locked(waitq, nr);
aal_mc_spinlock_unlock(&waitq->lock, irqstate);
ihk_mc_spinlock_unlock(&waitq->lock, irqstate);
if (count > 0)
schedule();

View File

@ -14,7 +14,7 @@ void panic(const char *msg)
extern void arch_show_interrupt_context(const void*);
void aal_mc_debug_show_interrupt_context(const void *reg)
void ihk_mc_debug_show_interrupt_context(const void *reg)
{
arch_show_interrupt_context(reg);
}

View File

@ -1,5 +1,5 @@
#ifndef AAL_CPU_H
#define AAL_CPU_H
#ifndef IHK_CPU_H
#define IHK_CPU_H
#include <list.h>
#include <ihk/context.h>
@ -14,68 +14,68 @@ void cpu_pause(void);
unsigned long cpu_disable_interrupt_save(void);
struct aal_mc_interrupt_handler {
struct ihk_mc_interrupt_handler {
struct list_head list;
void (*func)(void *);
void *priv;
};
int aal_mc_register_interrupt_handler(int vector,
struct aal_mc_interrupt_handler *h);
int aal_mc_unregister_interrupt_handler(int vector,
struct aal_mc_interrupt_handler *h);
int ihk_mc_register_interrupt_handler(int vector,
struct ihk_mc_interrupt_handler *h);
int ihk_mc_unregister_interrupt_handler(int vector,
struct ihk_mc_interrupt_handler *h);
enum aal_mc_gv_type {
AAL_GV_IKC = 1,
enum ihk_mc_gv_type {
IHK_GV_IKC = 1,
};
int aal_mc_get_vector(enum aal_mc_gv_type type);
int aal_mc_interrupt_host(int cpu, int vector);
int ihk_mc_get_vector(enum ihk_mc_gv_type type);
int ihk_mc_interrupt_host(int cpu, int vector);
struct aal_mc_cpu_info {
struct ihk_mc_cpu_info {
int ncpus;
int *hw_ids;
int *nodes;
};
struct aal_mc_cpu_info *aal_mc_get_cpu_info(void);
void aal_mc_boot_cpu(int cpuid, unsigned long pc);
int aal_mc_get_processor_id(void);
int aal_mc_get_hardware_processor_id(void);
struct ihk_mc_cpu_info *ihk_mc_get_cpu_info(void);
void ihk_mc_boot_cpu(int cpuid, unsigned long pc);
int ihk_mc_get_processor_id(void);
int ihk_mc_get_hardware_processor_id(void);
void aal_mc_delay_us(int us);
void aal_mc_set_syscall_handler(long (*handler)(int, aal_mc_user_context_t *));
void ihk_mc_delay_us(int us);
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *));
void aal_mc_init_ap(void);
void ihk_mc_init_ap(void);
void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
void ihk_mc_init_context(ihk_mc_kernel_context_t *new_ctx,
void *stack_pointer,
void (*next_function)(void));
void aal_mc_switch_context(aal_mc_kernel_context_t *old_ctx,
aal_mc_kernel_context_t *new_ctx);
int aal_mc_interrupt_cpu(int cpu, int vector);
void ihk_mc_switch_context(ihk_mc_kernel_context_t *old_ctx,
ihk_mc_kernel_context_t *new_ctx);
int ihk_mc_interrupt_cpu(int cpu, int vector);
void aal_mc_init_user_process(aal_mc_kernel_context_t *ctx,
aal_mc_user_context_t **puctx,
void ihk_mc_init_user_process(ihk_mc_kernel_context_t *ctx,
ihk_mc_user_context_t **puctx,
void *stack_pointer, unsigned long user_pc,
unsigned long user_sp);
enum aal_mc_user_context_regtype {
AAL_UCR_STACK_POINTER = 1,
AAL_UCR_PROGRAM_COUNTER = 2,
enum ihk_mc_user_context_regtype {
IHK_UCR_STACK_POINTER = 1,
IHK_UCR_PROGRAM_COUNTER = 2,
};
void aal_mc_modify_user_context(aal_mc_user_context_t *uctx,
enum aal_mc_user_context_regtype reg,
void ihk_mc_modify_user_context(ihk_mc_user_context_t *uctx,
enum ihk_mc_user_context_regtype reg,
unsigned long value);
void aal_mc_debug_show_interrupt_context(const void *reg);
void ihk_mc_debug_show_interrupt_context(const void *reg);
enum aal_asr_type {
AAL_ASR_X86_FS,
AAL_ASR_X86_GS,
enum ihk_asr_type {
IHK_ASR_X86_FS,
IHK_ASR_X86_GS,
};
int aal_mc_arch_set_special_register(enum aal_asr_type, unsigned long value);
int aal_mc_arch_get_special_register(enum aal_asr_type, unsigned long *value);
int ihk_mc_arch_set_special_register(enum ihk_asr_type, unsigned long value);
int ihk_mc_arch_get_special_register(enum ihk_asr_type, unsigned long *value);
#endif

View File

@ -1,12 +1,12 @@
#ifndef AAL_DEBUG_H
#define AAL_DEBUG_H
#ifndef IHK_DEBUG_H
#define IHK_DEBUG_H
#include <ihk/memconst.h>
struct aal_kmsg_buf {
struct ihk_kmsg_buf {
int tail;
int len;
char str[AAL_KMSG_SIZE - sizeof(int) * 2];
char str[IHK_KMSG_SIZE - sizeof(int) * 2];
};
extern int kprintf(const char *format, ...);

View File

@ -3,19 +3,19 @@
#include <ihk/ikc.h>
struct aal_dma_request {
aal_os_t src_os;
struct ihk_dma_request {
ihk_os_t src_os;
unsigned long src_phys;
aal_os_t dest_os;
ihk_os_t dest_os;
unsigned long dest_phys;
unsigned long size;
void (*callback)(void *);
void *priv;
aal_os_t notify_os;
ihk_os_t notify_os;
unsigned long *notify;
};
int aal_mc_dma_request(int channel, struct aal_dma_request *req);
int ihk_mc_dma_request(int channel, struct ihk_dma_request *req);
#endif

View File

@ -1,12 +1,12 @@
#ifndef __HEADER_GENERIC_AAL_LOCK
#define __HEADER_GENERIC_AAL_LOCK
#ifndef __HEADER_GENERIC_IHK_LOCK
#define __HEADER_GENERIC_IHK_LOCK
#include <arch-lock.h>
#ifndef AAL_STATIC_SPINLOCK_FUNCS
void aal_mc_spinlock_init(aal_spinlock_t *);
void aal_mc_spinlock_lock(aal_spinlock_t *, unsigned long *);
void aal_mc_spinlock_unlock(aal_spinlock_t *, unsigned long *);
#ifndef IHK_STATIC_SPINLOCK_FUNCS
void ihk_mc_spinlock_init(ihk_spinlock_t *);
void ihk_mc_spinlock_lock(ihk_spinlock_t *, unsigned long *);
void ihk_mc_spinlock_unlock(ihk_spinlock_t *, unsigned long *);
#endif
#endif

View File

@ -1,99 +1,99 @@
#ifndef __HEADER_GENERIC_AAL_MM_H
#define __HEADER_GENERIC_AAL_MM_H
#ifndef __HEADER_GENERIC_IHK_MM_H
#define __HEADER_GENERIC_IHK_MM_H
#include <memory.h>
enum aal_mc_gma_type {
AAL_MC_GMA_MAP_START,
AAL_MC_GMA_MAP_END,
AAL_MC_GMA_AVAIL_START,
AAL_MC_GMA_AVAIL_END,
AAL_MC_GMA_HEAP_START,
AAL_MC_NR_RESERVED_AREAS,
AAL_MC_RESERVED_AREA_START,
AAL_MC_RESERVED_AREA_END,
enum ihk_mc_gma_type {
IHK_MC_GMA_MAP_START,
IHK_MC_GMA_MAP_END,
IHK_MC_GMA_AVAIL_START,
IHK_MC_GMA_AVAIL_END,
IHK_MC_GMA_HEAP_START,
IHK_MC_NR_RESERVED_AREAS,
IHK_MC_RESERVED_AREA_START,
IHK_MC_RESERVED_AREA_END,
};
enum aal_mc_ma_type {
AAL_MC_MA_AVAILABLE,
AAL_MC_MA_RESERVED,
AAL_MC_MA_SPECIAL,
enum ihk_mc_ma_type {
IHK_MC_MA_AVAILABLE,
IHK_MC_MA_RESERVED,
IHK_MC_MA_SPECIAL,
};
enum aal_mc_ap_flag {
AAL_MC_AP_FLAG,
enum ihk_mc_ap_flag {
IHK_MC_AP_FLAG,
};
enum aal_mc_pt_prepare_flag {
AAL_MC_PT_FIRST_LEVEL,
AAL_MC_PT_LAST_LEVEL,
enum ihk_mc_pt_prepare_flag {
IHK_MC_PT_FIRST_LEVEL,
IHK_MC_PT_LAST_LEVEL,
};
struct aal_mc_memory_area {
struct ihk_mc_memory_area {
unsigned long start;
unsigned long size;
enum aal_mc_ma_type type;
enum ihk_mc_ma_type type;
};
struct aal_mc_memory_node {
struct ihk_mc_memory_node {
int node;
int nareas;
struct aal_mc_memory_area *areas;
struct ihk_mc_memory_area *areas;
};
unsigned long aal_mc_get_memory_address(enum aal_mc_gma_type, int);
unsigned long ihk_mc_get_memory_address(enum ihk_mc_gma_type, int);
void aal_mc_reserve_arch_pages(unsigned long start, unsigned long end,
void ihk_mc_reserve_arch_pages(unsigned long start, unsigned long end,
void (*cb)(unsigned long, unsigned long, int));
struct aal_mc_pa_ops {
void *(*alloc_page)(int, enum aal_mc_ap_flag);
struct ihk_mc_pa_ops {
void *(*alloc_page)(int, enum ihk_mc_ap_flag);
void (*free_page)(void *, int);
void *(*alloc)(int, enum aal_mc_ap_flag);
void *(*alloc)(int, enum ihk_mc_ap_flag);
void (*free)(void *);
};
void aal_mc_set_page_allocator(struct aal_mc_pa_ops *);
void aal_mc_set_page_fault_handler(void (*h)(unsigned long, void *, unsigned long));
void ihk_mc_set_page_allocator(struct ihk_mc_pa_ops *);
void ihk_mc_set_page_fault_handler(void (*h)(unsigned long, void *, unsigned long));
unsigned long aal_mc_map_memory(void *os, unsigned long phys,
unsigned long ihk_mc_map_memory(void *os, unsigned long phys,
unsigned long size);
void aal_mc_unmap_memory(void *os, unsigned long phys, unsigned long size);
void ihk_mc_unmap_memory(void *os, unsigned long phys, unsigned long size);
void *aal_mc_map_virtual(unsigned long phys, int npages,
enum aal_mc_pt_attribute attr);
void aal_mc_unmap_virtual(void *va, int npages, int free_physical);
void *ihk_mc_map_virtual(unsigned long phys, int npages,
enum ihk_mc_pt_attribute attr);
void ihk_mc_unmap_virtual(void *va, int npages, int free_physical);
extern void *sbox_base;
extern unsigned int free_bitmap_micpa;
void aal_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa);
int aal_mc_free_micpa(unsigned long mic_pa);
void aal_mc_clean_micpa(void);
void ihk_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa);
int ihk_mc_free_micpa(unsigned long mic_pa);
void ihk_mc_clean_micpa(void);
void *aal_mc_alloc_pages(int npages, enum aal_mc_ap_flag flag);
void aal_mc_free_pages(void *p, int npages);
void *aal_mc_allocate(int size, enum aal_mc_ap_flag flag);
void aal_mc_free(void *p);
void *ihk_mc_alloc_pages(int npages, enum ihk_mc_ap_flag flag);
void ihk_mc_free_pages(void *p, int npages);
void *ihk_mc_allocate(int size, enum ihk_mc_ap_flag flag);
void ihk_mc_free(void *p);
void *arch_alloc_page(enum aal_mc_ap_flag flag);
void *arch_alloc_page(enum ihk_mc_ap_flag flag);
void arch_free_page(void *ptr);
typedef void *page_table_t;
int aal_mc_pt_set_page(page_table_t pt, void *virt, unsigned long phys,
enum aal_mc_pt_attribute attr);
int aal_mc_pt_set_large_page(page_table_t pt, void *virt,
unsigned long phys, enum aal_mc_pt_attribute attr);
int aal_mc_pt_change_page(page_table_t pt, void *virt,
enum aal_mc_pt_attribute);
int aal_mc_pt_clear_page(page_table_t pt, void *virt);
int aal_mc_pt_prepare_map(page_table_t pt, void *virt, unsigned long size,
enum aal_mc_pt_prepare_flag);
int ihk_mc_pt_set_page(page_table_t pt, void *virt, unsigned long phys,
enum ihk_mc_pt_attribute attr);
int ihk_mc_pt_set_large_page(page_table_t pt, void *virt,
unsigned long phys, enum ihk_mc_pt_attribute attr);
int ihk_mc_pt_change_page(page_table_t pt, void *virt,
enum ihk_mc_pt_attribute);
int ihk_mc_pt_clear_page(page_table_t pt, void *virt);
int ihk_mc_pt_prepare_map(page_table_t pt, void *virt, unsigned long size,
enum ihk_mc_pt_prepare_flag);
struct page_table *aal_mc_pt_create(void);
void aal_mc_load_page_table(struct page_table *pt);
int aal_mc_pt_virt_to_phys(struct page_table *pt,
struct page_table *ihk_mc_pt_create(void);
void ihk_mc_load_page_table(struct page_table *pt);
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
void *virt, unsigned long *phys);
#endif

View File

@ -1,28 +1,28 @@
#ifndef __HEADER_GENERIC_AAL_PAGE_ALLOC
#define __HEADER_GENERIC_AAL_PAGE_ALLOC
#ifndef __HEADER_GENERIC_IHK_PAGE_ALLOC
#define __HEADER_GENERIC_IHK_PAGE_ALLOC
struct aal_page_allocator_desc {
struct ihk_page_allocator_desc {
unsigned long start;
unsigned int last;
unsigned int count;
unsigned int flag;
unsigned int shift;
aal_spinlock_t lock;
ihk_spinlock_t lock;
unsigned int pad;
unsigned long map[0];
};
unsigned long aal_pagealloc_count(void *__desc);
void *__aal_pagealloc_init(unsigned long start, unsigned long size,
unsigned long ihk_pagealloc_count(void *__desc);
void *__ihk_pagealloc_init(unsigned long start, unsigned long size,
unsigned long unit, void *initial,
unsigned long *pdescsize);
void *aal_pagealloc_init(unsigned long start, unsigned long size,
void *ihk_pagealloc_init(unsigned long start, unsigned long size,
unsigned long unit);
void aal_pagealloc_destroy(void *__desc);
unsigned long aal_pagealloc_alloc(void *__desc, int npages);
void aal_pagealloc_reserve(void *desc, unsigned long start, unsigned long end);
void aal_pagealloc_free(void *__desc, unsigned long address, int npages);
unsigned long aal_pagealloc_count(void *__desc);
void ihk_pagealloc_destroy(void *__desc);
unsigned long ihk_pagealloc_alloc(void *__desc, int npages);
void ihk_pagealloc_reserve(void *desc, unsigned long start, unsigned long end);
void ihk_pagealloc_free(void *__desc, unsigned long address, int npages);
unsigned long ihk_pagealloc_count(void *__desc);
#endif

View File

@ -1,10 +1,10 @@
#ifndef HEADER_GENERIC_AAL_PERFCTR_H
#define HEADER_GENERIC_AAL_PERFCTR_H
#ifndef HEADER_GENERIC_IHK_PERFCTR_H
#define HEADER_GENERIC_IHK_PERFCTR_H
#define PERFCTR_USER_MODE 0x01
#define PERFCTR_KERNEL_MODE 0x02
enum aal_perfctr_type {
enum ihk_perfctr_type {
APT_TYPE_DATA_PAGE_WALK,
APT_TYPE_DATA_READ_MISS,
APT_TYPE_DATA_WRITE_MISS,
@ -30,12 +30,12 @@ enum aal_perfctr_type {
PERFCTR_MAX_TYPE,
};
int aal_mc_perfctr_init(int counter, enum aal_perfctr_type type, int mode);
int aal_mc_perfctr_start(unsigned long counter_mask);
int aal_mc_perfctr_stop(unsigned long counter_mask);
int aal_mc_perfctr_reset(int counter);
int aal_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
unsigned long aal_mc_perfctr_read(int counter);
int ihk_mc_perfctr_init(int counter, enum ihk_perfctr_type type, int mode);
int ihk_mc_perfctr_start(unsigned long counter_mask);
int ihk_mc_perfctr_stop(unsigned long counter_mask);
int ihk_mc_perfctr_reset(int counter);
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
unsigned long ihk_mc_perfctr_read(int counter);
#endif

View File

@ -1,5 +1,5 @@
/*
* AAL - Generic page allocator (manycore version)
* IHK - Generic page allocator (manycore version)
* (C) Copyright 2011 Taku Shimosawa.
*/
#include <types.h>
@ -11,7 +11,7 @@
#include <memory.h>
#include <bitops.h>
void *allocate_pages(int npages, enum aal_mc_ap_flag flag);
void *allocate_pages(int npages, enum ihk_mc_ap_flag flag);
void free_pages(void *, int npages);
#define MAP_INDEX(n) ((n) >> 6)
@ -19,12 +19,12 @@ void free_pages(void *, int npages);
#define ADDRESS(desc, index, bit) \
((desc)->start + (((index) * 64 + (bit)) << ((desc)->shift)))
void *__aal_pagealloc_init(unsigned long start, unsigned long size,
void *__ihk_pagealloc_init(unsigned long start, unsigned long size,
unsigned long unit, void *initial,
unsigned long *pdescsize)
{
/* Unit must be power of 2, and size and start must be unit-aligned */
struct aal_page_allocator_desc *desc;
struct ihk_page_allocator_desc *desc;
int i, page_shift, descsize, mapsize, mapaligned;
int flag = 0;
@ -50,7 +50,7 @@ void *__aal_pagealloc_init(unsigned long start, unsigned long size,
memset(desc, 0, descsize * PAGE_SIZE);
if (!desc) {
kprintf("AAL: failed to allocate page-allocator-desc "\
kprintf("IHK: failed to allocate page-allocator-desc "\
"(%lx, %lx, %lx)\n", start, size, unit);
return NULL;
}
@ -64,7 +64,7 @@ void *__aal_pagealloc_init(unsigned long start, unsigned long size,
kprintf("Page allocator: %lx - %lx (%d)\n", start, start + size,
page_shift);
aal_mc_spinlock_init(&desc->lock);
ihk_mc_spinlock_init(&desc->lock);
/* Reserve align padding area */
for (i = mapsize; i < mapaligned * 8; i++) {
@ -74,26 +74,26 @@ void *__aal_pagealloc_init(unsigned long start, unsigned long size,
return desc;
}
void *aal_pagealloc_init(unsigned long start, unsigned long size,
void *ihk_pagealloc_init(unsigned long start, unsigned long size,
unsigned long unit)
{
return __aal_pagealloc_init(start, size, unit, NULL, NULL);
return __ihk_pagealloc_init(start, size, unit, NULL, NULL);
}
void aal_pagealloc_destroy(void *__desc)
void ihk_pagealloc_destroy(void *__desc)
{
struct aal_page_allocator_desc *desc = __desc;
struct ihk_page_allocator_desc *desc = __desc;
free_pages(desc, desc->flag);
}
static unsigned long __aal_pagealloc_large(struct aal_page_allocator_desc *desc,
static unsigned long __ihk_pagealloc_large(struct ihk_page_allocator_desc *desc,
int nblocks)
{
unsigned long flags;
unsigned int i, j, mi;
flags = aal_mc_spinlock_lock(&desc->lock);
flags = ihk_mc_spinlock_lock(&desc->lock);
for (i = 0, mi = desc->last; i < desc->count; i++, mi++) {
if (mi >= desc->count) {
mi = 0;
@ -110,18 +110,18 @@ static unsigned long __aal_pagealloc_large(struct aal_page_allocator_desc *desc,
for (j = mi; j < mi + nblocks; j++) {
desc->map[j] = (unsigned long)-1;
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
return ADDRESS(desc, mi, 0);
}
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
return 0;
}
unsigned long aal_pagealloc_alloc(void *__desc, int npages)
unsigned long ihk_pagealloc_alloc(void *__desc, int npages)
{
struct aal_page_allocator_desc *desc = __desc;
struct ihk_page_allocator_desc *desc = __desc;
unsigned int i, mi;
int j;
unsigned long v, mask, flags;
@ -129,12 +129,12 @@ unsigned long aal_pagealloc_alloc(void *__desc, int npages)
/* If requested page is more than the half of the element,
* we allocate the whole element (ulong) */
if (npages >= 32) {
return __aal_pagealloc_large(desc, (npages + 63) >> 6);
return __ihk_pagealloc_large(desc, (npages + 63) >> 6);
}
mask = (1UL << npages) - 1;
flags = aal_mc_spinlock_lock(&desc->lock);
flags = ihk_mc_spinlock_lock(&desc->lock);
for (i = 0, mi = desc->last; i < desc->count; i++, mi++) {
if (mi >= desc->count) {
mi = 0;
@ -148,21 +148,21 @@ unsigned long aal_pagealloc_alloc(void *__desc, int npages)
if (!(v & (mask << j))) { /* free */
desc->map[mi] |= (mask << j);
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
return ADDRESS(desc, mi, j);
}
}
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
/* We use null pointer for failure */
return 0;
}
void aal_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
void ihk_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
{
int i, n;
struct aal_page_allocator_desc *desc = __desc;
struct ihk_page_allocator_desc *desc = __desc;
unsigned long flags;
n = (end + (1 << desc->shift) - 1 - desc->start) >> desc->shift;
@ -171,7 +171,7 @@ void aal_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
return;
}
flags = aal_mc_spinlock_lock(&desc->lock);
flags = ihk_mc_spinlock_lock(&desc->lock);
for (; i < n; i++) {
if (!(i & 63) && i + 63 < n) {
desc->map[MAP_INDEX(i)] = (unsigned long)-1L;
@ -180,12 +180,12 @@ void aal_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
desc->map[MAP_INDEX(i)] |= (1UL << MAP_BIT(i));
}
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
}
void aal_pagealloc_free(void *__desc, unsigned long address, int npages)
void ihk_pagealloc_free(void *__desc, unsigned long address, int npages)
{
struct aal_page_allocator_desc *desc = __desc;
struct ihk_page_allocator_desc *desc = __desc;
int i;
unsigned mi;
unsigned long flags;
@ -194,21 +194,21 @@ void aal_pagealloc_free(void *__desc, unsigned long address, int npages)
if (npages >= 32) {
npages = (npages + 63) & ~63;
}
flags = aal_mc_spinlock_lock(&desc->lock);
flags = ihk_mc_spinlock_lock(&desc->lock);
mi = (address - desc->start) >> desc->shift;
for (i = 0; i < npages; i++, mi++) {
desc->map[MAP_INDEX(mi)] &= ~(1UL << MAP_BIT(mi));
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
}
unsigned long aal_pagealloc_count(void *__desc)
unsigned long ihk_pagealloc_count(void *__desc)
{
struct aal_page_allocator_desc *desc = __desc;
struct ihk_page_allocator_desc *desc = __desc;
unsigned long i, j, n = 0;
unsigned long flags;
flags = aal_mc_spinlock_lock(&desc->lock);
flags = ihk_mc_spinlock_lock(&desc->lock);
/* XXX: Very silly counting */
for (i = 0; i < desc->count; i++) {
for (j = 0; j < 64; j++) {
@ -217,21 +217,21 @@ unsigned long aal_pagealloc_count(void *__desc)
}
}
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
return n;
}
void __aal_pagealloc_zero_free_pages(void *__desc)
void __ihk_pagealloc_zero_free_pages(void *__desc)
{
struct aal_page_allocator_desc *desc = __desc;
struct ihk_page_allocator_desc *desc = __desc;
unsigned int mi;
int j;
unsigned long v, flags;
kprintf("zeroing free memory... ");
flags = aal_mc_spinlock_lock(&desc->lock);
flags = ihk_mc_spinlock_lock(&desc->lock);
for (mi = 0; mi < desc->count; mi++) {
v = desc->map[mi];
@ -245,7 +245,7 @@ kprintf("zeroing free memory... ");
}
}
}
aal_mc_spinlock_unlock(&desc->lock, flags);
ihk_mc_spinlock_unlock(&desc->lock, flags);
kprintf("\nzeroing done\n");
}