Skip to content

Commit

Permalink
core: hfic: fix HF_INTERRUPT HVC calls
Browse files Browse the repository at this point in the history
The HF_INTERRUPT HVC calls has until now not been completely correct.
HF_INTERRUPT_ENABLE is used to enable/disable a virtual interrupt on the
current CPU while HF_INTERRUPT_RECONFIGURE is used to globally enable a
physical interrupt. So update the HFIC callbacks accordingly.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
jenswi-linaro committed Jan 29, 2024
1 parent 36480a8 commit 6502bf9
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions core/drivers/hfic.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define HF_INTERRUPT_ENABLE 0xff03
#define HF_INTERRUPT_GET 0xff04
#define HF_INTERRUPT_DEACTIVATE 0xff08
#define HF_INTERRUPT_RECONFIGURE 0xff09

#define HF_INVALID_INTID 0xffffffff
#define HF_MANAGED_EXIT_INTID 4
Expand All @@ -28,32 +29,39 @@
#define HF_ENABLE 1
#define HF_DISABLE 0

#define HF_INT_RECONFIGURE_STATUS 2

struct hfic_data {
struct itr_chip chip;
};

static struct hfic_data hfic_data __nex_bss;

static void hfic_op_add(struct itr_chip *chip __unused, size_t it __unused,
static void hfic_op_add(struct itr_chip *chip __unused, size_t it,
uint32_t type __unused, uint32_t prio __unused)
{
uint32_t res __maybe_unused = 0;

res = thread_hvc(HF_INTERRUPT_ENABLE, it, HF_ENABLE,
HF_INTERRUPT_TYPE_IRQ);
assert(!res);
}

static void hfic_op_enable(struct itr_chip *chip __unused, size_t it)
{
uint32_t res __maybe_unused = 0;

res = thread_hvc(HF_INTERRUPT_ENABLE, it, HF_ENABLE,
HF_INTERRUPT_TYPE_IRQ);
res = thread_hvc(HF_INTERRUPT_RECONFIGURE, it,
HF_INT_RECONFIGURE_STATUS, HF_ENABLE);
assert(!res);
}

static void hfic_op_disable(struct itr_chip *chip __unused, size_t it)
{
uint32_t res __maybe_unused = 0;

res = thread_hvc(HF_INTERRUPT_ENABLE, it, HF_DISABLE,
HF_INTERRUPT_TYPE_IRQ);
res = thread_hvc(HF_INTERRUPT_RECONFIGURE, it,
HF_INT_RECONFIGURE_STATUS, HF_DISABLE);
assert(!res);
}

Expand Down

0 comments on commit 6502bf9

Please sign in to comment.