blob: 2b57b239056ec88bad3d76c8bd75554925e760bd [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From e6bcc390749f0560b3bc92507ecbaaabc7145200 Mon Sep 17 00:00:00 2001
2From: Lucian Paul-Trifu <lucian.paul-trifu@arm.com>
3Date: Wed, 10 Mar 2021 11:31:02 +0000
4Subject: [PATCH 2/5] fix(ff-a): Use FFA_INTERRUPT to signal an interrupted
5 FFA_MSG_WAIT
6
7Rather than FFA_ERROR(INTERRUPTED).
8
9Change-Id: I6b23a442714852b6183e0e46af6f0504ec0ee8f4
10Signed-off-by: Ben Horgan <ben.horgan@arm.com>
11Upstream-Status: Pending [Not submitted to upstream yet]
12---
13 src/api.c | 2 +-
14 test/inc/test/vmapi/ffa.h | 7 +++++++
15 test/vmapi/arch/aarch64/gicv3/services/common.c | 3 +--
16 test/vmapi/arch/aarch64/gicv3/services/timer.c | 2 +-
17 test/vmapi/el0_partitions/services/interruptible.c | 3 +--
18 test/vmapi/el0_partitions/services/interruptible_echo.c | 3 +--
19 test/vmapi/el0_partitions/services/receive_block.c | 2 +-
20 .../primary_with_secondaries/services/interruptible.c | 3 +--
21 .../primary_with_secondaries/services/receive_block.c | 2 +-
22 9 files changed, 15 insertions(+), 12 deletions(-)
23
24diff --git a/src/api.c b/src/api.c
25index b713b7c..00c4d44 100644
26--- a/src/api.c
27+++ b/src/api.c
28@@ -1588,7 +1588,7 @@ struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current,
29 * received. If a message is received the return value will be set at
30 * that time to FFA_SUCCESS.
31 */
32- return_code = ffa_error(FFA_INTERRUPTED);
33+ return_code = (struct ffa_value){.func = FFA_INTERRUPT_32};
34 if (api_ffa_msg_recv_block_interrupted(current)) {
35 goto out;
36 }
37diff --git a/test/inc/test/vmapi/ffa.h b/test/inc/test/vmapi/ffa.h
38index 8fc1223..f0f3e75 100644
39--- a/test/inc/test/vmapi/ffa.h
40+++ b/test/inc/test/vmapi/ffa.h
41@@ -24,6 +24,13 @@
42 EXPECT_EQ(ffa_error_code(v), (ffa_error)); \
43 } while (0)
44
45+#define EXPECT_FFA_INTERRUPT(value) \
46+ do { \
47+ struct ffa_value v = (value); \
48+ EXPECT_EQ(v.func, FFA_INTERRUPT_32); \
49+ } while (0)
50+
51+
52 /*
53 * The bit 15 of the FF-A ID indicates whether the partition is executing
54 * in the normal world, in case it is a Virtual Machine (VM); or in the
55diff --git a/test/vmapi/arch/aarch64/gicv3/services/common.c b/test/vmapi/arch/aarch64/gicv3/services/common.c
56index 06df28d..4ada9e2 100644
57--- a/test/vmapi/arch/aarch64/gicv3/services/common.c
58+++ b/test/vmapi/arch/aarch64/gicv3/services/common.c
59@@ -22,8 +22,7 @@ struct ffa_value mailbox_receive_retry(void)
60
61 do {
62 received = ffa_msg_wait();
63- } while (received.func == FFA_ERROR_32 &&
64- received.arg2 == FFA_INTERRUPTED);
65+ } while (received.func == FFA_INTERRUPT_32);
66
67 return received;
68 }
69diff --git a/test/vmapi/arch/aarch64/gicv3/services/timer.c b/test/vmapi/arch/aarch64/gicv3/services/timer.c
70index 156f160..d5d2816 100644
71--- a/test/vmapi/arch/aarch64/gicv3/services/timer.c
72+++ b/test/vmapi/arch/aarch64/gicv3/services/timer.c
73@@ -104,7 +104,7 @@ TEST_SERVICE(timer)
74 } else if (receive) {
75 struct ffa_value res = ffa_msg_wait();
76
77- EXPECT_FFA_ERROR(res, FFA_INTERRUPTED);
78+ EXPECT_FFA_INTERRUPT(res);
79 } else {
80 /* Busy wait until the timer fires. */
81 while (!timer_fired) {
82diff --git a/test/vmapi/el0_partitions/services/interruptible.c b/test/vmapi/el0_partitions/services/interruptible.c
83index 0d00b16..4c9f099 100644
84--- a/test/vmapi/el0_partitions/services/interruptible.c
85+++ b/test/vmapi/el0_partitions/services/interruptible.c
86@@ -50,8 +50,7 @@ static struct ffa_value mailbox_receive_retry()
87 do {
88 irq();
89 received = ffa_msg_wait();
90- } while (received.func == FFA_ERROR_32 &&
91- ffa_error_code(received) == FFA_INTERRUPTED);
92+ } while (received.func == FFA_INTERRUPT_32);
93
94 return received;
95 }
96diff --git a/test/vmapi/el0_partitions/services/interruptible_echo.c b/test/vmapi/el0_partitions/services/interruptible_echo.c
97index b618cf2..a857783 100644
98--- a/test/vmapi/el0_partitions/services/interruptible_echo.c
99+++ b/test/vmapi/el0_partitions/services/interruptible_echo.c
100@@ -39,8 +39,7 @@ static struct ffa_value mailbox_receive_retry()
101 do {
102 irq();
103 received = ffa_msg_wait();
104- } while (received.func == FFA_ERROR_32 &&
105- received.arg2 == FFA_INTERRUPTED);
106+ } while (received.func == FFA_INTERRUPT_32);
107
108 return received;
109 }
110diff --git a/test/vmapi/el0_partitions/services/receive_block.c b/test/vmapi/el0_partitions/services/receive_block.c
111index 05a22f3..60da28b 100644
112--- a/test/vmapi/el0_partitions/services/receive_block.c
113+++ b/test/vmapi/el0_partitions/services/receive_block.c
114@@ -27,7 +27,7 @@ TEST_SERVICE(receive_block)
115
116 for (i = 0; i < 10; ++i) {
117 struct ffa_value res = ffa_msg_wait();
118- EXPECT_FFA_ERROR(res, FFA_INTERRUPTED);
119+ EXPECT_FFA_INTERRUPT(res);
120 }
121
122 memcpy_s(SERVICE_SEND_BUFFER(), FFA_MSG_PAYLOAD_MAX, message,
123diff --git a/test/vmapi/primary_with_secondaries/services/interruptible.c b/test/vmapi/primary_with_secondaries/services/interruptible.c
124index cc1c1f9..005d1ff 100644
125--- a/test/vmapi/primary_with_secondaries/services/interruptible.c
126+++ b/test/vmapi/primary_with_secondaries/services/interruptible.c
127@@ -46,8 +46,7 @@ struct ffa_value mailbox_receive_retry()
128
129 do {
130 received = ffa_msg_wait();
131- } while (received.func == FFA_ERROR_32 &&
132- ffa_error_code(received) == FFA_INTERRUPTED);
133+ } while (received.func == FFA_INTERRUPT_32);
134
135 return received;
136 }
137diff --git a/test/vmapi/primary_with_secondaries/services/receive_block.c b/test/vmapi/primary_with_secondaries/services/receive_block.c
138index edb4e3c..a6805ae 100644
139--- a/test/vmapi/primary_with_secondaries/services/receive_block.c
140+++ b/test/vmapi/primary_with_secondaries/services/receive_block.c
141@@ -40,7 +40,7 @@ TEST_SERVICE(receive_block)
142
143 for (i = 0; i < 10; ++i) {
144 struct ffa_value res = ffa_msg_wait();
145- EXPECT_FFA_ERROR(res, FFA_INTERRUPTED);
146+ EXPECT_FFA_INTERRUPT(res);
147 }
148
149 memcpy_s(SERVICE_SEND_BUFFER(), FFA_MSG_PAYLOAD_MAX, message,
150--
1512.17.1
152