mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-15 12:00:26 +00:00
Convert IRQ-related macros to static inline functions and introduce
wrappers for arch-specific implementations. This follows the style we
defined for multi-arch development.
This is a follow-up update for commit
a7239d126 ("[FIXME] hv: risc-v add denpended implementation in cpu.h").
CPU_IRQ_ENABLE_ON_CONFIG -> local_irq_enable
CPU_IRQ_DISABLE_ON_CONFIG -> local_irq_disable
CPU_INT_ALL_DISABLE -> local_irq_save
CPU_INT_ALL_RESTORE -> local_irq_restore
Tracked-On: #8813
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Yifan Liu <yifan1.liu@intel.com>
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/*
|
|
* Copyright (C) 2023-2025 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
* Authors:
|
|
* Haicheng Li <haicheng.li@intel.com>
|
|
*/
|
|
|
|
#include <asm/trap.h>
|
|
#include <cpu.h>
|
|
#include <types.h>
|
|
|
|
static void init_interrupt_arch(__unused uint16_t pcpu_id)
|
|
{
|
|
uint64_t addr = (uint64_t)&strap_handler;
|
|
|
|
/*
|
|
* According to RISC-V Privileged Architecture
|
|
* 12.1.2. Supervisor Trap Vector Base Address (stvec) Register:
|
|
* The BASE field in stvec is a field that can hold any valid virtual
|
|
* or physical address, subject to the following alignment constraints:
|
|
* the address must be ``4-byte aligned``, and MODE settings other than
|
|
* Direct might impose additional alignment constraints on the
|
|
* value in the BASE field.
|
|
*/
|
|
cpu_csr_write(stvec, (addr | TRAP_VECTOR_MODE_DIRECT));
|
|
|
|
cpu_csr_write(sie, (IP_IE_SSI | IP_IE_STI | IP_IE_SEI));
|
|
}
|
|
|
|
/*
|
|
* TODO:
|
|
* This is the first step toward aligning with the common IRQ framework.
|
|
* For simplicity in this patchset, which focuses only on initialization,
|
|
* init_interrupt() is defined directly in arch/riscv/irq.c.
|
|
*
|
|
* Because interrupt handler registration via request_irq() is not yet
|
|
* implemented for RISC-V, fully aligning with the framework would require
|
|
* adding a few empty arch-specific functions as placeholders.
|
|
*
|
|
* Once request_irq() support is introduced, we can complete the integration
|
|
* with the common IRQ framework.
|
|
*/
|
|
void init_interrupt(uint16_t pcpu_id)
|
|
{
|
|
init_interrupt_arch(pcpu_id);
|
|
|
|
local_irq_enable();
|
|
}
|