-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aclint): add support for aclint sswi
Features: - IPIs sent via ACLINT instead of SBI ECALLs
- Loading branch information
1 parent
ef30f5b
commit db37707
Showing
7 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright (c) Bao Project and Contributors. All rights reserved. | ||
*/ | ||
|
||
#include <arch/aclint.h> | ||
#include <cpu.h> | ||
#include <bao.h> | ||
#include <platform.h> | ||
|
||
volatile struct aclint_sswi_hw *aclint_sswi; | ||
|
||
void aclint_init(){ | ||
aclint_sswi = (void*) mem_alloc_map_dev(&cpu()->as, SEC_HYP_GLOBAL, INVALID_VA, | ||
platform.arch.aclint_sswi.base, NUM_PAGES(sizeof(struct aclint_sswi_hw))); | ||
|
||
} | ||
|
||
void aclint_send_ipi(cpuid_t target_hart) { | ||
cpuid_t aclint_index = aclint_plat_hart_id_to_sswi_index(target_hart); | ||
if(target_hart < platform.cpu_num) { | ||
aclint_sswi->setssip[aclint_index] = ACLINT_SSWI_SET_SETSSIP; | ||
} | ||
} | ||
|
||
/** | ||
* By default aclint hart index is equal to the hart identifier | ||
* This may be overwritten on the platform defined code | ||
*/ | ||
|
||
__attribute__((weak)) | ||
cpuid_t aclint_plat_sswi_index_to_hart_id(cpuid_t sswi_index){ | ||
return sswi_index; | ||
} | ||
|
||
__attribute__((weak)) | ||
cpuid_t aclint_plat_hart_id_to_sswi_index(cpuid_t hart_id){ | ||
return hart_id; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright (c) Bao Project and Contributors. All rights reserved. | ||
*/ | ||
|
||
#ifndef ACLINT_H | ||
#define ACLINT_H | ||
|
||
#include <bao.h> | ||
#include <platform.h> | ||
|
||
#define ACLINT_SSWI_MAX_HARTS (4095) | ||
#define ACLINT_SSWI_SET_SETSSIP (0x1) | ||
|
||
struct aclint_sswi_hw { | ||
uint32_t setssip [ACLINT_SSWI_MAX_HARTS]; | ||
uint32_t res; | ||
} __attribute__((__packed__, aligned(PAGE_SIZE))); | ||
|
||
extern volatile struct aclint_sswi_hw *aclint_sswi; | ||
|
||
void aclint_init(); | ||
void aclint_send_ipi(cpuid_t hart); | ||
|
||
cpuid_t aclint_plat_sswi_index_to_hart_id(cpuid_t sswi_index); | ||
cpuid_t aclint_plat_hart_id_to_sswi_index(cpuid_t hard_id); | ||
|
||
#endif /* ACLINT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters