| 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 |
| |