Merge pull request #601 in SEL4/sel4 from ~HALMATARY/sel4:SMP to master

* commit '53c6b52438ea29241c8a75a4c4cb5de99313022f':
  SMP: Abstract architecture/platform independent parts of smp.h  and ipi.h
This commit is contained in:
Hesham Almatary 2017-01-13 17:22:10 +11:00
commit 4bd07b9d2f
19 changed files with 133 additions and 93 deletions

View file

@ -16,7 +16,7 @@
#include <arch/types.h>
#include <util.h>
#include <object/structures.h>
#include <model/smp.h>
#include <smp/smp.h>
#ifdef CONFIG_IPC_BUF_GLOBALS_FRAME
extern word_t armKSGlobalsFrame[BIT(ARMSmallPageBits) / sizeof(word_t)] VISIBLE;

View file

@ -1,15 +0,0 @@
/*
* Copyright 2016, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(D61_GPL)
*/
#pragma once
/* placeholder for future arm multicore implementation */

View file

@ -0,0 +1,13 @@
/*
* Copyright 2016, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(D61_GPL)
*/
/* Placeholder for future ARM shared ipi.h */
#pragma once

View file

@ -16,7 +16,7 @@
#include <config.h>
#include <types.h>
#include <plat/machine.h>
#include <arch/kernel/ipi.h>
#include <smp/ipi.h>
#if CONFIG_MAX_NUM_NODES > 1

View file

@ -13,7 +13,7 @@
#ifndef __MODE_KERNEL_TLB_H
#define __MODE_KERNEL_TLB_H
#include <arch/kernel/ipi.h>
#include <mode/kernel/ipi.h>
#include <arch/kernel/tlb.h>
static inline void invalidateTLBEntry(vptr_t vptr, word_t mask)

View file

@ -14,7 +14,7 @@
#include <config.h>
#include <object/structures.h>
#include <arch/types.h>
#include <model/smp.h>
#include <smp/smp.h>
extern pdpte_t ia32KSGlobalPDPT[BIT(PDPT_INDEX_BITS)];
extern pde_t ia32KSGlobalPD[BIT(PD_INDEX_BITS + PDPT_INDEX_BITS)];

View file

@ -16,7 +16,7 @@
#include <config.h>
#include <types.h>
#include <plat/machine.h>
#include <arch/kernel/ipi.h>
#include <smp/ipi.h>
#if CONFIG_MAX_NUM_NODES > 1

View file

@ -13,7 +13,7 @@
#ifndef __MODE_KERNEL_TLB_H
#define __MODE_KERNEL_TLB_H
#include <arch/kernel/ipi.h>
#include <smp/ipi.h>
#include <arch/kernel/tlb.h>
#include <mode/kernel/ipi.h>
#include <arch/kernel/tlb_bitmap.h>

View file

@ -15,7 +15,7 @@
#include <object/structures.h>
#include <arch/types.h>
#include <model/smp.h>
#include <smp/smp.h>
extern pml4e_t x64KSGlobalPML4[BIT(PML4_INDEX_BITS)];
extern pdpte_t x64KSGlobalPDPT[BIT(PDPT_INDEX_BITS)];

View file

@ -18,7 +18,7 @@
#include <util.h>
#include <mode/machine.h>
#include <arch/model/statedata.h>
#include <arch/kernel/ipi.h>
#include <smp/ipi.h>
#if CONFIG_MAX_NUM_NODES > 1

View file

@ -13,7 +13,7 @@
#ifndef __ARCH_KERNEL_TLB_H
#define __ARCH_KERNEL_TLB_H
#include <arch/kernel/ipi.h>
#include <arch/smp/ipi_inline.h>
static inline void invalidatePageStructureCacheASID(paddr_t root, asid_t asid, word_t mask)
{

View file

@ -0,0 +1,34 @@
/*
* Copyright 2016, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(D61_GPL)
*/
#ifndef __ARCH_KERNEL_IPI_H
#define __ARCH_KERNEL_IPI_H
#include <config.h>
#if CONFIG_MAX_NUM_NODES > 1
typedef enum {
IpiRemoteCall_Stall,
#ifdef CONFIG_VTX
IpiRemoteCall_ClearCurrentVCPU,
IpiRemoteCall_VMCheckBoundNotification,
#endif
IpiRemoteCall_InvalidatePageStructureCacheASID,
IpiRemoteCall_InvalidateTranslationSingle,
IpiRemoteCall_InvalidateTranslationSingleASID,
IpiRemoteCall_InvalidateTranslationAll,
IpiRemoteCall_switchFpuOwner,
IpiNumArchRemoteCall
} IpiRemoteCall_t;
#endif /* CONFIG_MAX_NUM_NODES > 1 */
#endif /* __ARCH_KERNEL_IPI_H */

View file

@ -0,0 +1,65 @@
/*
* Copyright 2016, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(D61_GPL)
*/
#ifndef __ARCH_KERNEL_IPI_INLINE_H
#define __ARCH_KERNEL_IPI_INLINE_H
#include <config.h>
#include <smp/ipi.h>
#if CONFIG_MAX_NUM_NODES > 1
static inline void doRemoteStall(word_t cpu)
{
doRemoteOp0Arg(IpiRemoteCall_Stall, cpu);
}
static inline void doRemoteswitchFpuOwner(user_fpu_state_t *new_owner, word_t cpu)
{
doRemoteOp1Arg(IpiRemoteCall_switchFpuOwner, (word_t)new_owner, cpu);
}
static inline void doRemoteInvalidatePageStructureCacheASID(paddr_t root, asid_t asid, word_t mask)
{
doRemoteMaskOp2Arg(IpiRemoteCall_InvalidatePageStructureCacheASID, root, asid, mask);
}
static inline void doRemoteInvalidateTranslationSingle(vptr_t vptr, word_t mask)
{
doRemoteMaskOp1Arg(IpiRemoteCall_InvalidateTranslationSingle, vptr, mask);
}
static inline void doRemoteInvalidateTranslationSingleASID(vptr_t vptr, asid_t asid, word_t mask)
{
doRemoteMaskOp2Arg(IpiRemoteCall_InvalidateTranslationSingleASID, vptr, asid, mask);
}
static inline void doRemoteInvalidateTranslationAll(word_t mask)
{
doRemoteMaskOp0Arg(IpiRemoteCall_InvalidateTranslationAll, mask);
}
#ifdef CONFIG_VTX
static inline void
doRemoteClearCurrentVCPU(word_t cpu)
{
doRemoteOp0Arg(IpiRemoteCall_ClearCurrentVCPU, cpu);
}
static inline void
doRemoteVMCheckBoundNotification(word_t cpu)
{
doRemoteOp0Arg(IpiRemoteCall_VMCheckBoundNotification, cpu);
}
#endif
#endif /* CONFIG_MAX_NUM_NODES > 1 */
#endif /* __ARCH_KERNEL_IPI_INLINE_H */

View file

@ -18,7 +18,7 @@
#include <object/structures.h>
#include <object/tcb.h>
#include <mode/types.h>
#include <model/smp.h>
#include <smp/smp.h>
#define NUM_READY_QUEUES (CONFIG_NUM_DOMAINS * CONFIG_NUM_PRIORITIES)

View file

@ -10,32 +10,19 @@
* @TAG(D61_GPL)
*/
#ifndef __ARCH_KERNEL_IPI_H
#define __ARCH_KERNEL_IPI_H
#ifndef __IPI_H
#define __IPI_H
#include <config.h>
#include <types.h>
#include <plat/machine.h>
#include <arch/smp/ipi.h>
#if CONFIG_MAX_NUM_NODES > 1
#define MAX_IPI_ARGS 3 /* Maximum number of parameters to remote function */
void Arch_handleIPI(irq_t irq);
typedef enum {
IpiRemoteCall_Stall,
#ifdef CONFIG_VTX
IpiRemoteCall_ClearCurrentVCPU,
IpiRemoteCall_VMCheckBoundNotification,
#endif
IpiRemoteCall_InvalidatePageStructureCacheASID,
IpiRemoteCall_InvalidateTranslationSingle,
IpiRemoteCall_InvalidateTranslationSingleASID,
IpiRemoteCall_InvalidateTranslationAll,
IpiRemoteCall_switchFpuOwner,
IpiNumArchRemoteCall
} IpiRemoteCall_t;
/*
* Run a synchronous function on all cores specified by mask. Return when target cores
* have all executed the function. Caller must hold the lock.
@ -131,49 +118,5 @@ static void inline doReschedule(word_t cpu)
}
}
static void inline doRemoteStall(word_t cpu)
{
doRemoteOp0Arg(IpiRemoteCall_Stall, cpu);
}
static void inline doRemoteswitchFpuOwner(user_fpu_state_t *new_owner, word_t cpu)
{
doRemoteOp1Arg(IpiRemoteCall_switchFpuOwner, (word_t)new_owner, cpu);
}
static void inline doRemoteInvalidatePageStructureCacheASID(paddr_t root, asid_t asid, word_t mask)
{
doRemoteMaskOp2Arg(IpiRemoteCall_InvalidatePageStructureCacheASID, root, asid, mask);
}
static void inline doRemoteInvalidateTranslationSingle(vptr_t vptr, word_t mask)
{
doRemoteMaskOp1Arg(IpiRemoteCall_InvalidateTranslationSingle, vptr, mask);
}
static void inline doRemoteInvalidateTranslationSingleASID(vptr_t vptr, asid_t asid, word_t mask)
{
doRemoteMaskOp2Arg(IpiRemoteCall_InvalidateTranslationSingleASID, vptr, asid, mask);
}
static void inline doRemoteInvalidateTranslationAll(word_t mask)
{
doRemoteMaskOp0Arg(IpiRemoteCall_InvalidateTranslationAll, mask);
}
#ifdef CONFIG_VTX
static inline void
doRemoteClearCurrentVCPU(word_t cpu)
{
doRemoteOp0Arg(IpiRemoteCall_ClearCurrentVCPU, cpu);
}
static inline void
doRemoteVMCheckBoundNotification(word_t cpu)
{
doRemoteOp0Arg(IpiRemoteCall_VMCheckBoundNotification, cpu);
}
#endif
#endif /* CONFIG_MAX_NUM_NODES */
#endif /* __ARCH_KERNEL_IPI_H */
#endif /* __IPI_H */

View file

@ -10,8 +10,8 @@
* @TAG(D61_GPL)
*/
#ifndef __MODEL_SMP_H_
#define __MODEL_SMP_H_
#ifndef __SMP_H_
#define __SMP_H_
#include <config.h>
@ -42,4 +42,4 @@
#endif /* CONFIG_MAX_NUM_NODES */
#endif /* __MODEL_SMP_H_ */
#endif /* __SMP_H_ */

View file

@ -12,9 +12,9 @@
#include <config.h>
#include <mode/kernel/ipi.h>
#include <arch/kernel/ipi.h>
#include <arch/kernel/lock.h>
#include <model/smp.h>
#include <smp/smp.h>
#include <smp/ipi.h>
#if CONFIG_MAX_NUM_NODES > 1

View file

@ -11,7 +11,7 @@
*/
#include <config.h>
#include <model/smp.h>
#include <smp/smp.h>
#include <arch/kernel/lock.h>
#if CONFIG_MAX_NUM_NODES > 1

View file

@ -22,7 +22,7 @@
#include <kernel/thread.h>
#include <model/statedata.h>
#include <machine/timer.h>
#include <arch/kernel/ipi.h>
#include <smp/ipi.h>
exception_t
decodeIRQControlInvocation(word_t invLabel, word_t length,