1 /*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7 #pragma once
8
9 #include <smp/ipi.h>
10 #include <arch/kernel/tlb.h>
11 #include <mode/smp/ipi.h>
12 #include <arch/kernel/tlb_bitmap.h>
13
14 /*
15 * This is a wrapper around invalidatePCID that can be used to invalidate
16 * an ASID and, in the case of SMP, potentially clear a vspace of having
17 * any translations on this core
18 */
invalidateLocalASID(vspace_root_t * vspace,asid_t asid)19 static inline void invalidateLocalASID(vspace_root_t *vspace, asid_t asid)
20 {
21 invalidateLocalPCID(INVPCID_TYPE_SINGLE, (void *)0, asid);
22 #ifdef ENABLE_SMP_SUPPORT
23 if (pptr_to_paddr(vspace) != getCurrentUserVSpaceRoot()) {
24 tlb_bitmap_unset(vspace, getCurrentCPUIndex());
25 }
26 #endif /* ENABLE_SMP_SUPPORT */
27 }
28
invalidatePCID(word_t type,void * vaddr,asid_t asid,word_t mask)29 static inline void invalidatePCID(word_t type, void *vaddr, asid_t asid, word_t mask)
30 {
31 invalidateLocalPCID(type, vaddr, asid);
32 SMP_COND_STATEMENT(doRemoteInvalidatePCID(type, vaddr, asid, mask));
33 }
34
invalidateASID(vspace_root_t * vspace,asid_t asid,word_t mask)35 static inline void invalidateASID(vspace_root_t *vspace, asid_t asid, word_t mask)
36 {
37 invalidateLocalASID(vspace, asid);
38 SMP_COND_STATEMENT(doRemoteInvalidateASID(vspace, asid, mask));
39 }
40
41