diff --git a/executer/kernel/mcctrl/Makefile.in b/executer/kernel/mcctrl/Makefile.in index e305497f..6567c0f6 100644 --- a/executer/kernel/mcctrl/Makefile.in +++ b/executer/kernel/mcctrl/Makefile.in @@ -9,7 +9,6 @@ IHK_BASE=$(src)/../../../../ihk obj-m += mcctrl.o -# POSTK_DEBUG_ARCH_DEP_83, arch depend translate_rva_to_rpa() move ccflags-y := -I$(IHK_BASE)/linux/include \ -I$(IHK_BASE)/linux/include/ihk/arch/$(ARCH) \ -I$(IHK_BASE)/ikc/include \ diff --git a/executer/kernel/mcctrl/arch/arm64/archdeps.c b/executer/kernel/mcctrl/arch/arm64/archdeps.c index af661ec3..e7871ea6 100644 --- a/executer/kernel/mcctrl/arch/arm64/archdeps.c +++ b/executer/kernel/mcctrl/arch/arm64/archdeps.c @@ -6,7 +6,6 @@ #include "../../../config.h" #include "../../mcctrl.h" -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ //#define SC_DEBUG #ifdef SC_DEBUG @@ -14,7 +13,6 @@ #else #define dprintk(...) #endif -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ #define D(fmt, ...) printk("%s(%d) " fmt, __func__, __LINE__, ##__VA_ARGS__) @@ -212,7 +210,6 @@ struct page_table { int asid; }; -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ int translate_rva_to_rpa(ihk_os_t os, unsigned long rpt, unsigned long rva, unsigned long *rpap, unsigned long *pgsizep) { @@ -307,7 +304,6 @@ out: error, rva, rpa, pgsize); return error; } -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ #ifdef POSTK_DEBUG_ARCH_DEP_12 #define PFN_WRITE_COMBINED PTE_ATTRINDX(MT_NORMAL_NC) diff --git a/executer/kernel/mcctrl/arch/arm64/include/archdeps.h b/executer/kernel/mcctrl/arch/arm64/include/archdeps.h index 06da517e..6e2df253 100644 --- a/executer/kernel/mcctrl/arch/arm64/include/archdeps.h +++ b/executer/kernel/mcctrl/arch/arm64/include/archdeps.h @@ -1,5 +1,4 @@ /* archdeps.h COPYRIGHT FUJITSU LIMITED 2017 */ -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ #ifndef __HEADER_MCCTRL_ARM64_ARCHDEPS_H #define __HEADER_MCCTRL_ARM64_ARCHDEPS_H @@ -15,4 +14,3 @@ static inline bool pte_is_write_combined(pte_t pte) } #endif /* POSTK_DEBUG_ARCH_DEP_12 */ #endif /* __HEADER_MCCTRL_ARM64_ARCHDEPS_H */ -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ diff --git a/executer/kernel/mcctrl/arch/x86_64/archdeps.c b/executer/kernel/mcctrl/arch/x86_64/archdeps.c index 2cd88941..5bbcf294 100644 --- a/executer/kernel/mcctrl/arch/x86_64/archdeps.c +++ b/executer/kernel/mcctrl/arch/x86_64/archdeps.c @@ -5,7 +5,6 @@ #include "../../../config.h" #include "../../mcctrl.h" -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ //#define SC_DEBUG #ifdef SC_DEBUG @@ -13,7 +12,6 @@ #else #define dprintk(...) #endif -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) static struct vdso_image *_vdso_image_64; @@ -288,7 +286,6 @@ get_rsp_ctx(void *ctx) return tctx->rsp; } -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ int translate_rva_to_rpa(ihk_os_t os, unsigned long rpt, unsigned long rva, unsigned long *rpap, unsigned long *pgsizep) { @@ -358,7 +355,6 @@ out: error, rva, rpa, pgsize); return error; } -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ #ifdef POSTK_DEBUG_ARCH_DEP_12 #define PFN_WRITE_COMBINED _PAGE_PWT diff --git a/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h b/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h index 24645e6f..4656343f 100644 --- a/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h +++ b/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h @@ -1,5 +1,4 @@ /* archdeps.h COPYRIGHT FUJITSU LIMITED 2017 */ -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ #ifndef __HEADER_MCCTRL_X86_64_ARCHDEPS_H #define __HEADER_MCCTRL_X86_64_ARCHDEPS_H @@ -15,4 +14,3 @@ static inline bool pte_is_write_combined(pte_t pte) } #endif /* POSTK_DEBUG_ARCH_DEP_12 */ #endif /* __HEADER_MCCTRL_X86_64_ARCHDEPS_H */ -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ diff --git a/executer/kernel/mcctrl/syscall.c b/executer/kernel/mcctrl/syscall.c index f430b1d0..80917747 100644 --- a/executer/kernel/mcctrl/syscall.c +++ b/executer/kernel/mcctrl/syscall.c @@ -49,9 +49,7 @@ #include "../../../config.h" #include "mcctrl.h" #include -#ifdef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ #include -#endif /* POSTK_DEBUG_ARCH_DEP_83 */ #define ALIGN_WAIT_BUF(z) (((z + 63) >> 6) << 6) @@ -212,80 +210,6 @@ struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc } #endif /* !POSTK_DEBUG_ARCH_DEP_56 */ -#ifndef POSTK_DEBUG_ARCH_DEP_83 /* arch depend translate_rva_to_rpa() move */ -#if 1 /* x86 depend, host OS side */ -int translate_rva_to_rpa(ihk_os_t os, unsigned long rpt, unsigned long rva, - unsigned long *rpap, unsigned long *pgsizep) -{ - unsigned long rpa; - int offsh; - int i; - int ix; - unsigned long phys; - unsigned long *pt; - int error; - unsigned long pgsize; - - rpa = rpt; - offsh = 39; - pgsize = 0; - /* i = 0: PML4, 1: PDPT, 2: PDT, 3: PT */ - for (i = 0; i < 4; ++i) { - ix = (rva >> offsh) & 0x1FF; - phys = ihk_device_map_memory(ihk_os_to_dev(os), rpa, PAGE_SIZE); - pt = ihk_device_map_virtual(ihk_os_to_dev(os), phys, PAGE_SIZE, NULL, 0); - dprintk("rpa %#lx offsh %d ix %#x phys %#lx pt %p pt[ix] %#lx\n", - rpa, offsh, ix, phys, pt, pt[ix]); - -#define PTE_P 0x001 - if (!(pt[ix] & PTE_P)) { - ihk_device_unmap_virtual(ihk_os_to_dev(os), pt, PAGE_SIZE); - ihk_device_unmap_memory(ihk_os_to_dev(os), phys, PAGE_SIZE); - error = -EFAULT; - dprintk("Remote PTE is not present for 0x%lx (rpt: %lx) ?\n", rva, rpt); - goto out; - } - -#define PTE_PS 0x080 - if (pt[ix] & PTE_PS) { - pgsize = 1UL << offsh; - rpa = pt[ix] & ((1UL << 52) - 1) & ~(pgsize - 1); - rpa |= rva & (pgsize - 1); - - /* For GB pages, just report regular 2MB page */ - if (offsh == 30) { - pgsize = 1UL << 21; - dprintk("%s: GB page translated 0x%lx -> 0x%lx, pgsize: %lu\n", - __FUNCTION__, rva, rpa, pgsize); - } - - ihk_device_unmap_virtual(ihk_os_to_dev(os), pt, PAGE_SIZE); - ihk_device_unmap_memory(ihk_os_to_dev(os), phys, PAGE_SIZE); - error = 0; - goto found; - } - - rpa = pt[ix] & ((1UL << 52) - 1) & ~((1UL << 12) - 1); - offsh -= 9; - ihk_device_unmap_virtual(ihk_os_to_dev(os), pt, PAGE_SIZE); - ihk_device_unmap_memory(ihk_os_to_dev(os), phys, PAGE_SIZE); - } - pgsize = 1UL << 12; - rpa |= rva & (pgsize - 1); - -found: - error = 0; - *rpap = rpa; - *pgsizep = pgsize; - -out: - dprintk("translate_rva_to_rpa: %d rva %#lx --> rpa %#lx (%lx)\n", - error, rva, rpa, pgsize); - return error; -} -#endif -#endif /* !POSTK_DEBUG_ARCH_DEP_83 */ - static int __notify_syscall_requester(ihk_os_t os, struct ikc_scd_packet *packet, struct syscall_response *res) {