diff --git a/mcs_km/include/mmu_map.h b/mcs_km/include/mmu_map.h index f1abdd0b45cac5f6cd11edb19126a89a7d7017cf..2d6dc79326535918194d3e42fa913c23aa84ec2a 100644 --- a/mcs_km/include/mmu_map.h +++ b/mcs_km/include/mmu_map.h @@ -1 +1,3 @@ extern void mem_map_info_set(unsigned long loadaddr); + +extern void set_bar_addr(unsigned long phy_addr); diff --git a/mcs_km/main.c b/mcs_km/main.c index 09f6f25bba26197205967dc064911d32a31995b4..8375017c690cabe33a64aadd8a0748bbb249589b 100644 --- a/mcs_km/main.c +++ b/mcs_km/main.c @@ -129,9 +129,16 @@ static int init_mcs_ipi(void) return err; } +/* + * send X86_MCS_IPI + * Destination Mode: Physical + */ static void send_clientos_ipi(const unsigned int cpu) { - apic->send_IPI(cpu, X86_MCS_IPI_VECTOR); + int apicid = apic->cpu_present_to_apicid(cpu); + + weak_wrmsr_fence(); + wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) apicid) << 32 | X86_MCS_IPI_VECTOR); } static unsigned int mcs_poll(struct file *file, poll_table *wait) diff --git a/mcs_km/mmu_map.c b/mcs_km/mmu_map.c index 2cdcefc89ce2be0fba8f59065ccaea2df0ac8b27..1d4e17fe2f7c752ec15d5a77678afd95df9b952b 100644 --- a/mcs_km/mmu_map.c +++ b/mcs_km/mmu_map.c @@ -46,6 +46,16 @@ enum { TABLE_MAX }; +const char* mem_name[] = { + "PAGE_TABLE", + "BAR_TABLE", + "DMA_TABLE", + "SHAREMEM_TABLE", + "LOG_TABLE", + "TEXT_TABLE", + "DATA_TABLE", +}; + static mmu_map_info clientos_map_info[TABLE_MAX] = { { // pagetable @@ -55,7 +65,7 @@ static mmu_map_info clientos_map_info[TABLE_MAX] = { .attr = MEM_ATTR_CACHE_RWX, .page_size = PAGE_SIZE_4K, }, { - // bar, unused + // bar .va = 0xf00008000, .pa = 0x0, .size = 0x100000, @@ -99,6 +109,12 @@ static mmu_map_info clientos_map_info[TABLE_MAX] = { } }; +void set_bar_addr(unsigned long phy_addr) +{ + clientos_map_info[BAR_TABLE].pa = phy_addr; +} +EXPORT_SYMBOL_GPL(set_bar_addr); + static void mem_mmu_page_table(mmu_map_info *map_info) { unsigned long mapped, val; @@ -113,8 +129,6 @@ static void mem_mmu_page_table(mmu_map_info *map_info) return; } - pr_info("map pa 0x%lx va 0x%lx pagesize 0x%lx\n", map_info->pa, map_info->va, map_info->page_size); - ppe = pml + PAGE_TABLE_OFFSET; pde = ppe + PAGE_TABLE_OFFSET; pte = pde + PAGE_TABLE_OFFSET; @@ -171,7 +185,10 @@ void mem_map_info_set(unsigned long loadaddr) memunmap(table_base); for (i = 0; i < TABLE_MAX; i++) { - if (i != BAR_TABLE) { + if (clientos_map_info[i].pa != 0) { + pr_info("map %s: pa 0x%lx, va 0x%lx, size 0x%lx, pagesize 0x%lx\n", + mem_name[i], clientos_map_info[i].pa, clientos_map_info[i].va, + clientos_map_info[i].size, clientos_map_info[i].page_size); mem_mmu_page_table(&clientos_map_info[i]); } } diff --git a/rpmsg_pty_demo/rpmsg_main.c b/rpmsg_pty_demo/rpmsg_main.c index 428609f751ceea78e39de19552a97d8f9c1c8ea0..14e1dba137c68945e7ec81a7fb5b396364ccd66f 100644 --- a/rpmsg_pty_demo/rpmsg_main.c +++ b/rpmsg_pty_demo/rpmsg_main.c @@ -13,7 +13,7 @@ static struct client_os_inst client_os = { /* physical address start of shared device mem */ - .phy_shared_mem = 0x390000000, + .phy_shared_mem = 0x3fde00000, /* size of shared device mem */ .shared_mem_size = 0x30000, .vring_size = VRING_SIZE,