forked from keystone-enclave/sm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathipi.c
32 lines (28 loc) · 869 Bytes
/
ipi.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <sbi/sbi_fifo.h>
#include <sbi/sbi_ipi.h>
#include <sbi/sbi_scratch.h>
#include <sbi/sbi_platform.h>
#include <sbi/sbi_console.h>
#include <sbi/sbi_hsm.h>
#include <sbi/sbi_domain.h>
#include "ipi.h"
#include "pmp.h"
void sbi_pmp_ipi_local_update(struct sbi_tlb_info *__info)
{
struct sbi_pmp_ipi_info* info = (struct sbi_pmp_ipi_info *) __info;
if (info->type == SBI_PMP_IPI_TYPE_SET) {
pmp_set_keystone(info->rid, (uint8_t) info->perm);
} else {
pmp_unset(info->rid);
}
}
void send_and_sync_pmp_ipi(int region_idx, int type, uint8_t perm)
{
ulong mask = 0;
ulong source_hart = current_hartid();
struct sbi_tlb_info tlb_info;
sbi_hsm_hart_interruptible_mask(sbi_domain_thishart_ptr(), 0, &mask);
SBI_TLB_INFO_INIT(&tlb_info, type, 0, region_idx, perm,
SBI_TLB_SM_PMP, source_hart);
sbi_tlb_request(mask, 0, &tlb_info);
}