summaryrefslogtreecommitdiff
path: root/meta-arm/meta-arm-bsp/recipes-bsp/hafnium/files/tc/0002-fix-ff-a-Use-FFA_INTERRUPT-to-signal-an-interrupted-.patch
blob: 2b57b239056ec88bad3d76c8bd75554925e760bd (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
From e6bcc390749f0560b3bc92507ecbaaabc7145200 Mon Sep 17 00:00:00 2001
From: Lucian Paul-Trifu <lucian.paul-trifu@arm.com>
Date: Wed, 10 Mar 2021 11:31:02 +0000
Subject: [PATCH 2/5] fix(ff-a): Use FFA_INTERRUPT to signal an interrupted
 FFA_MSG_WAIT

Rather than FFA_ERROR(INTERRUPTED).

Change-Id: I6b23a442714852b6183e0e46af6f0504ec0ee8f4
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Upstream-Status: Pending [Not submitted to upstream yet]
---
 src/api.c                                                  | 2 +-
 test/inc/test/vmapi/ffa.h                                  | 7 +++++++
 test/vmapi/arch/aarch64/gicv3/services/common.c            | 3 +--
 test/vmapi/arch/aarch64/gicv3/services/timer.c             | 2 +-
 test/vmapi/el0_partitions/services/interruptible.c         | 3 +--
 test/vmapi/el0_partitions/services/interruptible_echo.c    | 3 +--
 test/vmapi/el0_partitions/services/receive_block.c         | 2 +-
 .../primary_with_secondaries/services/interruptible.c      | 3 +--
 .../primary_with_secondaries/services/receive_block.c      | 2 +-
 9 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/api.c b/src/api.c
index b713b7c..00c4d44 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1588,7 +1588,7 @@ struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current,
 	 * received. If a message is received the return value will be set at
 	 * that time to FFA_SUCCESS.
 	 */
-	return_code = ffa_error(FFA_INTERRUPTED);
+	return_code = (struct ffa_value){.func = FFA_INTERRUPT_32};
 	if (api_ffa_msg_recv_block_interrupted(current)) {
 		goto out;
 	}
diff --git a/test/inc/test/vmapi/ffa.h b/test/inc/test/vmapi/ffa.h
index 8fc1223..f0f3e75 100644
--- a/test/inc/test/vmapi/ffa.h
+++ b/test/inc/test/vmapi/ffa.h
@@ -24,6 +24,13 @@
 		EXPECT_EQ(ffa_error_code(v), (ffa_error)); \
 	} while (0)
 
+#define EXPECT_FFA_INTERRUPT(value)                        \
+	do {                                               \
+		struct ffa_value v = (value);              \
+		EXPECT_EQ(v.func, FFA_INTERRUPT_32);       \
+	} while (0)
+
+
 /*
  * The bit 15 of the FF-A ID indicates whether the partition is executing
  * in the normal world, in case it is a Virtual Machine (VM); or in the
diff --git a/test/vmapi/arch/aarch64/gicv3/services/common.c b/test/vmapi/arch/aarch64/gicv3/services/common.c
index 06df28d..4ada9e2 100644
--- a/test/vmapi/arch/aarch64/gicv3/services/common.c
+++ b/test/vmapi/arch/aarch64/gicv3/services/common.c
@@ -22,8 +22,7 @@ struct ffa_value mailbox_receive_retry(void)
 
 	do {
 		received = ffa_msg_wait();
-	} while (received.func == FFA_ERROR_32 &&
-		 received.arg2 == FFA_INTERRUPTED);
+	} while (received.func == FFA_INTERRUPT_32);
 
 	return received;
 }
diff --git a/test/vmapi/arch/aarch64/gicv3/services/timer.c b/test/vmapi/arch/aarch64/gicv3/services/timer.c
index 156f160..d5d2816 100644
--- a/test/vmapi/arch/aarch64/gicv3/services/timer.c
+++ b/test/vmapi/arch/aarch64/gicv3/services/timer.c
@@ -104,7 +104,7 @@ TEST_SERVICE(timer)
 		} else if (receive) {
 			struct ffa_value res = ffa_msg_wait();
 
-			EXPECT_FFA_ERROR(res, FFA_INTERRUPTED);
+			EXPECT_FFA_INTERRUPT(res);
 		} else {
 			/* Busy wait until the timer fires. */
 			while (!timer_fired) {
diff --git a/test/vmapi/el0_partitions/services/interruptible.c b/test/vmapi/el0_partitions/services/interruptible.c
index 0d00b16..4c9f099 100644
--- a/test/vmapi/el0_partitions/services/interruptible.c
+++ b/test/vmapi/el0_partitions/services/interruptible.c
@@ -50,8 +50,7 @@ static struct ffa_value mailbox_receive_retry()
 	do {
 		irq();
 		received = ffa_msg_wait();
-	} while (received.func == FFA_ERROR_32 &&
-		 ffa_error_code(received) == FFA_INTERRUPTED);
+	} while (received.func == FFA_INTERRUPT_32);
 
 	return received;
 }
diff --git a/test/vmapi/el0_partitions/services/interruptible_echo.c b/test/vmapi/el0_partitions/services/interruptible_echo.c
index b618cf2..a857783 100644
--- a/test/vmapi/el0_partitions/services/interruptible_echo.c
+++ b/test/vmapi/el0_partitions/services/interruptible_echo.c
@@ -39,8 +39,7 @@ static struct ffa_value mailbox_receive_retry()
 	do {
 		irq();
 		received = ffa_msg_wait();
-	} while (received.func == FFA_ERROR_32 &&
-		 received.arg2 == FFA_INTERRUPTED);
+	} while (received.func == FFA_INTERRUPT_32);
 
 	return received;
 }
diff --git a/test/vmapi/el0_partitions/services/receive_block.c b/test/vmapi/el0_partitions/services/receive_block.c
index 05a22f3..60da28b 100644
--- a/test/vmapi/el0_partitions/services/receive_block.c
+++ b/test/vmapi/el0_partitions/services/receive_block.c
@@ -27,7 +27,7 @@ TEST_SERVICE(receive_block)
 
 	for (i = 0; i < 10; ++i) {
 		struct ffa_value res = ffa_msg_wait();
-		EXPECT_FFA_ERROR(res, FFA_INTERRUPTED);
+		EXPECT_FFA_INTERRUPT(res);
 	}
 
 	memcpy_s(SERVICE_SEND_BUFFER(), FFA_MSG_PAYLOAD_MAX, message,
diff --git a/test/vmapi/primary_with_secondaries/services/interruptible.c b/test/vmapi/primary_with_secondaries/services/interruptible.c
index cc1c1f9..005d1ff 100644
--- a/test/vmapi/primary_with_secondaries/services/interruptible.c
+++ b/test/vmapi/primary_with_secondaries/services/interruptible.c
@@ -46,8 +46,7 @@ struct ffa_value mailbox_receive_retry()
 
 	do {
 		received = ffa_msg_wait();
-	} while (received.func == FFA_ERROR_32 &&
-		 ffa_error_code(received) == FFA_INTERRUPTED);
+	} while (received.func == FFA_INTERRUPT_32);
 
 	return received;
 }
diff --git a/test/vmapi/primary_with_secondaries/services/receive_block.c b/test/vmapi/primary_with_secondaries/services/receive_block.c
index edb4e3c..a6805ae 100644
--- a/test/vmapi/primary_with_secondaries/services/receive_block.c
+++ b/test/vmapi/primary_with_secondaries/services/receive_block.c
@@ -40,7 +40,7 @@ TEST_SERVICE(receive_block)
 
 	for (i = 0; i < 10; ++i) {
 		struct ffa_value res = ffa_msg_wait();
-		EXPECT_FFA_ERROR(res, FFA_INTERRUPTED);
+		EXPECT_FFA_INTERRUPT(res);
 	}
 
 	memcpy_s(SERVICE_SEND_BUFFER(), FFA_MSG_PAYLOAD_MAX, message,
-- 
2.17.1