Skip to content

Commit a298b86

Browse files
wayne renfanghuaqi
authored andcommitted
libsecureshield: remove perf measurements feature in secureshield time
this feature relys on TIMER1 to measure the overhead. In V2, applicaiton can direcly access TIMER1 related aux reg. It's not necessary feaure.
1 parent 38c27c8 commit a298b86

File tree

6 files changed

+8
-102
lines changed

6 files changed

+8
-102
lines changed

example/baremetal/secureshield/test_case/background_container.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
#include "background_container.h"
7979

8080

81-
82-
8381
static void tst_func7(int arg)
8482
{
8583
EMBARC_PRINTF("test function 7 in background container:%d\r\n", arg);
@@ -102,26 +100,16 @@ void default_interrupt_handler(void *p_exinf)
102100

103101
int main(void)
104102
{
105-
//unsigned int cycles;
106103

107104
EMBARC_PRINTF("timer0 interrupt prioirty is:%d\r\n", secureshield_int_pri_get(INTNO_TIMER0));
108105

109-
//secureshield_perf_config();
110-
111-
//secureshield_perf_start();
112106
int_handler_install(INTNO_SWI0, soft_interrupt0);
113107
int_enable(INTNO_SWI0);
114-
//cycles = secureshield_perf_end();
115-
116-
//EMBARC_PRINTF("int_enable cycles:%d\r\n", cycles);
117-
108+
118109
EMBARC_PRINTF("container call from background to 1 \r\n");
119110
EMBARC_PRINTF("ret is:%x\r\n", container_call(container1, tst_func1, 1));
120111

121-
//secureshield_perf_start();
122112
container_call(container1, tst_func2, 1, 2);
123-
//cycles = secureshield_perf_end();
124-
//EMBARC_PRINTF("container call out cycles:%d\r\n", cycles);
125113

126114
EMBARC_PRINTF("container call from background to 2\r\n");
127115
EMBARC_PRINTF("ret is:%x\r\n", container_call(container2, tst_func5, 1, 2, 3, 4, 5));
@@ -136,10 +124,6 @@ int main(void)
136124

137125
tst_func7(7);
138126

139-
/* comment out the following line to test memory violation */
140-
//challenge2->initialized = 0;
141-
142-
143127
return E_SYS;
144128
}
145129

library/secureshield/core/inc/secureshield_sys.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ extern int32_t container_id_self(void);
4343
#if SECURESHIELD_VERSION == 1
4444

4545
extern void secureshield_sys_ops(INT_EXC_FRAME *frame);
46-
extern void perf_config(uint32_t overhead);
47-
extern void perf_start(void);
48-
extern uint32_t perf_end(void);
4946

5047
#elif SECURESHIELD_VERSION == 2
5148
/* secureshield version 1 specific system services */

library/secureshield/core/src/v1/secureshield_sys.c

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -180,41 +180,6 @@ int32_t vmpu_ac_aux(uint8_t container_id, uint32_t start, uint32_t size)
180180
return 0;
181181
}
182182

183-
static uint32_t g_perf_overhead;
184-
185-
/**
186-
* \brief config the performance benchmark service
187-
* \param[in] overhead overhead of performance benchmark service
188-
*/
189-
void perf_config(uint32_t overhead)
190-
{
191-
if (overhead == 0) {
192-
// enable timer1 to measure performance
193-
_arc_sr_reg(AUX_TIMER1_CTRL, 0);
194-
_arc_sr_reg(AUX_TIMER1_LIMIT, 0xFFFFFFFF);
195-
_arc_sr_reg(AUX_TIMER1_CTRL, 0x2);
196-
} else {
197-
g_perf_overhead = overhead;
198-
}
199-
}
200-
201-
/**
202-
* \brief start to measure
203-
*/
204-
void perf_start(void)
205-
{
206-
_arc_sr_reg(AUX_TIMER1_CNT, 0);
207-
}
208-
209-
/**
210-
* \brief end to measure
211-
* \return result
212-
*/
213-
uint32_t perf_end(void)
214-
{
215-
return _arc_lr_reg(AUX_TIMER1_CNT) - g_perf_overhead;
216-
}
217-
218183
/**
219184
* \brief get the current active container id
220185
* \return current active container id
@@ -257,15 +222,6 @@ void secureshield_sys_ops(INT_EXC_FRAME *frame)
257222
SECURESHIELD_DBG("write aux reg 0x%x\r\n", frame->r1);
258223
secure_arc_sr_reg(frame->r1, frame->r2);
259224
break;
260-
case SECURESHIELD_SYS_PERF_CFG:
261-
perf_config(frame->r1);
262-
break;
263-
case SECURESHIELD_SYS_PERF_START:
264-
perf_start();
265-
break;
266-
case SECURESHIELD_SYS_PERF_END:
267-
frame->r0 = perf_end();
268-
break;
269225
case SECURESHIELD_SYS_CONTAINER_ID_SELF:
270226
frame->r0 = container_id_self();
271227
break;

library/secureshield/export/inc/secureshield_secure_call_exports.h

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@
5757
#define SECURESHIELD_INT_EXC_CPU_LOCK (10)
5858
#define SECURESHIELD_INT_EXC_CPU_UNLOCK (11)
5959

60-
61-
/* system-level operations codes */
62-
#define SECURESHIELD_SYS_LR (0)
63-
#define SECURESHIELD_SYS_SR (1)
64-
#define SECURESHIELD_SYS_PERF_CFG (2)
65-
#define SECURESHIELD_SYS_PERF_START (3)
66-
#define SECURESHIELD_SYS_PERF_END (4)
67-
#define SECURESHIELD_SYS_CONTAINER_ID_SELF (5)
68-
#define SECURESHIELD_SYS_CONTAINER_ID_CALLER (6)
69-
70-
7160
/* get the immediate from trap instruction */
7261
#define SECURESHIELD_TRAP_IMMEDIATE(trap_instn) ((trap_instn >> 5) & 0x3F)
7362

@@ -110,12 +99,6 @@
11099
#define SECURESHIELD_INT_EXC_CPU_UNLOCK (11)
111100

112101

113-
#define SECURESHIELD_SYS_LR (0)
114-
#define SECURESHIELD_SYS_SR (1)
115-
#define SECURESHIELD_SYS_CONTAINER_ID_SELF (5)
116-
#define SECURESHIELD_SYS_CONTAINER_ID_CALLER (6)
117-
118-
119102
#define SECURESHIELD_SECURE_CALL(id, metadata, ...) \
120103
({ \
121104
SECURESHIELD_MACRO_REGS_ARGS(uint32_t, ##__VA_ARGS__) \
@@ -138,4 +121,10 @@
138121
#error "unsupported secureshield version"
139122
#endif
140123

124+
/* runtime system service call id */
125+
#define SECURESHIELD_SYS_LR (0)
126+
#define SECURESHIELD_SYS_SR (1)
127+
#define SECURESHIELD_SYS_CONTAINER_ID_SELF (2)
128+
#define SECURESHIELD_SYS_CONTAINER_ID_CALLER (3)
129+
141130
#endif/*_SECURESHIELD_SECURE_CALL_EXPORTS_H_*/

library/secureshield/export/inc/secureshield_sys_ops_exports.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@
3838
extern "C" {
3939
#endif
4040

41+
#if SECURESHIELD_VERSION == 1
4142

4243

43-
#if SECURESHIELD_VERSION == 1
44-
extern void secureshield_perf_config(void);
45-
extern void secureshield_perf_start(void);
46-
extern uint32_t secureshield_perf_end(void);
4744
#elif SECURESHIELD_VERSION == 2
4845

4946
extern void secureshield_except_bit_clear(void);

library/secureshield/export/src/sys_ops.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,6 @@ void secureshield_arc_sr_reg(uint32_t addr, uint32_t val)
5454
}
5555
}
5656

57-
void secureshield_perf_config(void)
58-
{
59-
SECURESHIELD_SECURE_CALL(SECURESHIELD_SECURE_CALL_SYS, "", SECURESHIELD_SYS_PERF_CFG, 0);
60-
secureshield_perf_start();
61-
SECURESHIELD_SECURE_CALL(SECURESHIELD_SECURE_CALL_SYS, "", SECURESHIELD_SYS_PERF_CFG, secureshield_perf_end());
62-
}
63-
64-
void secureshield_perf_start(void)
65-
{
66-
SECURESHIELD_SECURE_CALL(SECURESHIELD_SECURE_CALL_SYS, "", SECURESHIELD_SYS_PERF_START);
67-
}
68-
69-
uint32_t secureshield_perf_end(void)
70-
{
71-
return SECURESHIELD_SECURE_CALL(SECURESHIELD_SECURE_CALL_SYS, "", SECURESHIELD_SYS_PERF_END);
72-
}
73-
7457
int32_t secureshield_container_id_self(void)
7558
{
7659
return SECURESHIELD_SECURE_CALL(SECURESHIELD_SECURE_CALL_SYS, "", SECURESHIELD_SYS_CONTAINER_ID_SELF);

0 commit comments

Comments
 (0)