@@ -25,8 +25,11 @@ struct imsic_intp_file_hw {
2525
2626struct imsic_global_hw {
2727 struct imsic_intp_file_hw s_file ;
28+ struct imsic_intp_file_hw guest_file ;
2829} __attribute__((__packed__ , aligned (0x1000ULL )));
2930
31+ extern volatile struct imsic_global_hw * imsic [PLAT_CPU_NUM ];
32+
3033/**
3134 * @brief Initializes the IMSIC
3235 *
@@ -68,16 +71,28 @@ void imsic_set_enbl(irqid_t intp_id);
6871 * Only little endian is supported.
6972 *
7073 * @param target_cpu The ID of the target CPU
74+ * @param msi_id The MSI ID to be sent
7175 */
72- void imsic_send_msi (cpuid_t target_cpu );
76+ static inline void imsic_send_msi (cpuid_t target_cpu , irqid_t msi_id )
77+ {
78+ imsic [target_cpu ]-> s_file .seteipnum_le = msi_id ;
79+ }
7380
7481/**
75- * @brief Inject an interrupt into a guest.
82+ * @brief Sends an MSI to the guest file of specified CPU with the specified IPI ID.
83+ *
84+ * The function sends an MSI to the target CPU's guest file by setting the seteipnum_le
85+ * register in the IMSIC. The seteipnum_le register is used to specify the ID of the
86+ * interrupt being sent. Only little endian is supported. This function assume a single guest
87+ * interrupt file per hart.
7688 *
77- * @param guest_file Guest interrupt file ID
78- * @param intp_id Interrupt ID
89+ * @param target_cpu The ID of the target CPU
90+ * @param msi_id The MSI ID to be injected in the guest interrupt file
7991 */
80- void imsic_inject_pend (size_t guest_file , irqid_t intp_id );
92+ static inline void imsic_send_guest_msi (cpuid_t target_cpu , irqid_t msi_id )
93+ {
94+ imsic [target_cpu ]-> guest_file .seteipnum_le = msi_id ;
95+ }
8196
8297/**
8398 * @brief Handles interrupts in the IMSIC.
0 commit comments