refactor(gic): make the concept of SGI generic

Software generated interrupts (SGIs) are a GICv2/3/4 concept. However,
they are deeply embedded in how TFTF handles wake ups. This patch
promotes the SGI to an abstract concept that can be performed
independently of the interrupt controller, largely the same as it is
used today. To do that the interrupt interface for an SGI is separated
from the general IRQ and each SGI is assigned a linear index from 0
onwards. Translating from SGI to IRQ is done via a hook in arm_gic.c
that will be multiplexed to the appropriate driver. For GIC <= v3 this
is a thin wrapper around the identity mapping as SGIs map to INTIDs from
0 through 15. For GICv5 the mapping is different and an SGI is an LPI
and calculated as recommended by chapter 2.5 in the spec.

Additionally, the definitions of SGI numbers are made generic as no
platform has utilised the difference.

Change-Id: I7e6a5fbe655098c5e235b98f6dda8a14619a5904
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
diff --git a/drivers/arm/gic/arm_gic.c b/drivers/arm/gic/arm_gic.c
index 5fe8316..ff51420 100644
--- a/drivers/arm/gic/arm_gic.c
+++ b/drivers/arm/gic/arm_gic.c
@@ -143,6 +143,15 @@
 		gicv2_gicd_set_ipriorityr(num, priority);
 }
 
+uint32_t arm_gic_get_sgi_num(uint32_t seq_id, unsigned int core_pos)
+{
+	if (gicv5_detected) {
+		return gicv5_get_sgi_num(seq_id, core_pos);
+	} else {
+		return gicv2v3_get_sgi_num(seq_id, core_pos);
+	}
+}
+
 void arm_gic_send_sgi(unsigned int sgi_id, unsigned int core_pos)
 {
 	if (gicv3_detected)
diff --git a/include/drivers/arm/arm_gic.h b/include/drivers/arm/arm_gic.h
index 472f190..802e797 100644
--- a/include/drivers/arm/arm_gic.h
+++ b/include/drivers/arm/arm_gic.h
@@ -68,6 +68,12 @@
 void arm_gic_send_sgi(unsigned int sgi_id, unsigned int core_pos);
 
 /******************************************************************************
+ * Get the INTID for an SGI with number `seq_id` for a core with index
+ * `core_pos`.
+ *****************************************************************************/
+unsigned int arm_gic_get_sgi_num(unsigned int seq_id, unsigned int core_pos);
+
+/******************************************************************************
  * Set the interrupt target of interrupt ID `num` to a core with index
  * `core_pos`
  *****************************************************************************/
diff --git a/include/drivers/arm/gic_v2v3_common.h b/include/drivers/arm/gic_v2v3_common.h
index 7bcae6a..8182d5d 100644
--- a/include/drivers/arm/gic_v2v3_common.h
+++ b/include/drivers/arm/gic_v2v3_common.h
@@ -91,6 +91,13 @@
 void gicd_set_ipriorityr(uintptr_t base, unsigned int interrupt_id,
 					unsigned int priority);
 
+static inline unsigned int gicv2v3_get_sgi_num(unsigned int irq_num,
+						unsigned int core_pos)
+{
+	/* the SGI index is the INTID */
+	return irq_num;
+}
+
 /*******************************************************************************
  * Private GIC Distributor interface accessors for reading and writing
  * entire registers
diff --git a/include/lib/irq.h b/include/lib/irq.h
index d4d0a3c..49fab13 100644
--- a/include/lib/irq.h
+++ b/include/lib/irq.h
@@ -10,6 +10,20 @@
 #include <cdefs.h>
 #include <platform_def.h> /* For CACHE_WRITEBACK_GRANULE */
 #include <stdint.h>
+#include <drivers/arm/arm_gic.h>
+
+/*******************************************************************************
+ * Non-Secure Software Generated Interupts IDs
+ ******************************************************************************/
+#define IRQ_NS_SGI_0			0
+#define IRQ_NS_SGI_1			1
+#define IRQ_NS_SGI_2			2
+#define IRQ_NS_SGI_3			3
+#define IRQ_NS_SGI_4			4
+#define IRQ_NS_SGI_5			5
+#define IRQ_NS_SGI_6			6
+#define IRQ_NS_SGI_7			7
+#define IRQ_NUM_SGIS			(IRQ_NS_SGI_7 + 1)
 
 /*
  * SGI sent by the timer management framework to notify CPUs when the system
@@ -51,6 +65,11 @@
 void tftf_irq_setup(void);
 
 /*
+ * Get the INTID for an SGI with sequential number seq_id
+ */
+unsigned int tftf_irq_get_my_sgi_num(unsigned int seq_id);
+
+/*
  * Generic handler called upon reception of an IRQ.
  *
  * This function acknowledges the interrupt, calls the user-defined handler
@@ -68,11 +87,13 @@
  * Enable interrupt #irq_num for the calling core.
  */
 void tftf_irq_enable(unsigned int irq_num, uint8_t irq_priority);
+void tftf_irq_enable_sgi(unsigned int sgi_id, uint8_t irq_priority);
 
 /*
  * Disable interrupt #irq_num for the calling core.
  */
 void tftf_irq_disable(unsigned int irq_num);
+void tftf_irq_disable_sgi(unsigned int sgi_id);
 
 /*
  * Register an interrupt handler for a given interrupt number.
@@ -82,6 +103,7 @@
  * Return 0 on success, a negative value otherwise.
  */
 int tftf_irq_register_handler(unsigned int num, irq_handler_t irq_handler);
+int tftf_irq_register_handler_sgi(unsigned int sgi_id, irq_handler_t irq_handler);
 
 /*
  * Unregister an interrupt handler for a given interrupt number.
@@ -90,6 +112,7 @@
  * Return 0 on success, a negative value otherwise.
  */
 int tftf_irq_unregister_handler(unsigned int irq_num);
+int tftf_irq_unregister_handler_sgi(unsigned int sgi_id);
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/lib/exceptions/irq.c b/lib/exceptions/irq.c
index b99857c..5128df7 100644
--- a/lib/exceptions/irq.c
+++ b/lib/exceptions/irq.c
@@ -61,6 +61,12 @@
 	return &spurious_desc_handler;
 }
 
+unsigned int tftf_irq_get_my_sgi_num(unsigned int seq_id)
+{
+	unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());
+	return arm_gic_get_sgi_num(seq_id, core_pos);
+}
+
 void tftf_send_sgi(unsigned int sgi_id, unsigned int core_pos)
 {
 	assert(IS_SGI(sgi_id));
@@ -100,6 +106,13 @@
 	VERBOSE("Enabled IRQ #%u\n", irq_num);
 }
 
+void tftf_irq_enable_sgi(unsigned int sgi_id, uint8_t irq_priority)
+{
+	unsigned int irq_num = tftf_irq_get_my_sgi_num(sgi_id);
+
+	tftf_irq_enable(irq_num, irq_priority);
+}
+
 void tftf_irq_disable(unsigned int irq_num)
 {
 	/* Disable the interrupt */
@@ -108,6 +121,13 @@
 	VERBOSE("Disabled IRQ #%u\n", irq_num);
 }
 
+void tftf_irq_disable_sgi(unsigned int sgi_id)
+{
+	unsigned int irq_num = tftf_irq_get_my_sgi_num(sgi_id);
+
+	tftf_irq_disable(irq_num);
+}
+
 #define HANDLER_VALID(handler, expect_handler)		\
 	((expect_handler) ? ((handler) != NULL) : ((handler) == NULL))
 
@@ -150,6 +170,12 @@
 	return ret;
 }
 
+int tftf_irq_register_handler_sgi(unsigned int sgi_id, irq_handler_t irq_handler)
+{
+	unsigned int irq_num = tftf_irq_get_my_sgi_num(sgi_id);
+	return tftf_irq_register_handler(irq_num, irq_handler);
+}
+
 int tftf_irq_unregister_handler(unsigned int irq_num)
 {
 	int ret;
@@ -161,6 +187,12 @@
 	return ret;
 }
 
+int tftf_irq_unregister_handler_sgi(unsigned int sgi_id)
+{
+	unsigned int irq_num = tftf_irq_get_my_sgi_num(sgi_id);
+	return tftf_irq_unregister_handler(irq_num);
+}
+
 int tftf_irq_handler_dispatcher(void)
 {
 	unsigned int raw_iar;
diff --git a/lib/power_management/hotplug/hotplug.c b/lib/power_management/hotplug/hotplug.c
index 7d534b5..cb00cff 100644
--- a/lib/power_management/hotplug/hotplug.c
+++ b/lib/power_management/hotplug/hotplug.c
@@ -301,7 +301,7 @@
 	arm_gic_setup_local();
 
 	/* Enable the SGI used by the timer management framework */
-	tftf_irq_enable(IRQ_WAKE_SGI, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_WAKE_SGI, GIC_HIGHEST_NS_PRIORITY);
 	tftf_initialise_timer_secondary_core();
 
 	enable_irq();
diff --git a/lib/psci/psci.c b/lib/psci/psci.c
index 720d319..2c86e1c 100644
--- a/lib/psci/psci.c
+++ b/lib/psci/psci.c
@@ -269,7 +269,7 @@
 		return;
 	}
 
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	/*
 	 * Mask IRQ to prevent the interrupt handler being invoked
@@ -298,7 +298,7 @@
 	enable_irq();
 	isb();
 
-	tftf_irq_disable(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 
 	/*
 	 * The NULL State-ID returned SUCCESS. Hence State-ID is NULL
diff --git a/plat/amd/versal2/include/platform_def.h b/plat/amd/versal2/include/platform_def.h
index 206f292..814ea85 100644
--- a/plat/amd/versal2/include/platform_def.h
+++ b/plat/amd/versal2/include/platform_def.h
@@ -87,18 +87,6 @@
 #define CRASH_CONSOLE_BASE			PL011_UART1_BASE
 #define CRASH_CONSOLE_SIZE			PLAT_ARM_UART_SIZE
 
-/*******************************************************************************
- * Non-Secure Software Generated Interrupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0				0
-#define IRQ_NS_SGI_1				1
-#define IRQ_NS_SGI_2				2
-#define IRQ_NS_SGI_3				3
-#define IRQ_NS_SGI_4				4
-#define IRQ_NS_SGI_5				5
-#define IRQ_NS_SGI_6				6
-#define IRQ_NS_SGI_7				7
-
 /* Per-CPU Hypervisor Timer Interrupt ID */
 #define IRQ_PCPU_HP_TIMER			U(29)
 /* Datasheet: TIME00 event*/
diff --git a/plat/arm/corstone1000/include/platform_def.h b/plat/arm/corstone1000/include/platform_def.h
index a0d6f7b..91f4cda 100644
--- a/plat/arm/corstone1000/include/platform_def.h
+++ b/plat/arm/corstone1000/include/platform_def.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -134,18 +134,6 @@
 #define CACHE_WRITEBACK_SHIFT   6
 #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
 
-/*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0		0
-#define IRQ_NS_SGI_1		1
-#define IRQ_NS_SGI_2		2
-#define IRQ_NS_SGI_3		3
-#define IRQ_NS_SGI_4		4
-#define IRQ_NS_SGI_5		5
-#define IRQ_NS_SGI_6		6
-#define IRQ_NS_SGI_7		7
-
 #define PLAT_MAX_SPI_OFFSET_ID	220
 
 /* The IRQ generated by Ethernet controller */
diff --git a/plat/arm/fvp/include/platform_def.h b/plat/arm/fvp/include/platform_def.h
index 322d264..089e0a8 100644
--- a/plat/arm/fvp/include/platform_def.h
+++ b/plat/arm/fvp/include/platform_def.h
@@ -274,18 +274,6 @@
 #define CACHE_WRITEBACK_SHIFT		6
 #define CACHE_WRITEBACK_GRANULE		(1 << CACHE_WRITEBACK_SHIFT)
 
-/*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_1			1
-#define IRQ_NS_SGI_2			2
-#define IRQ_NS_SGI_3			3
-#define IRQ_NS_SGI_4			4
-#define IRQ_NS_SGI_5			5
-#define IRQ_NS_SGI_6			6
-#define IRQ_NS_SGI_7			7
-
 /*
  * On FVP, consider that the last SPI is the Trusted Random Number Generator
  * interrupt.
diff --git a/plat/arm/juno/include/platform_def.h b/plat/arm/juno/include/platform_def.h
index 2de11fd..89e5601 100644
--- a/plat/arm/juno/include/platform_def.h
+++ b/plat/arm/juno/include/platform_def.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -225,18 +225,6 @@
 #define CACHE_WRITEBACK_SHIFT   6
 #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
 
-/*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0		0
-#define IRQ_NS_SGI_1		1
-#define IRQ_NS_SGI_2		2
-#define IRQ_NS_SGI_3		3
-#define IRQ_NS_SGI_4		4
-#define IRQ_NS_SGI_5		5
-#define IRQ_NS_SGI_6		6
-#define IRQ_NS_SGI_7		7
-
 #define PLAT_MAX_SPI_OFFSET_ID	220
 
 /* The IRQ generated by Ethernet controller */
diff --git a/plat/arm/n1sdp/include/platform_def.h b/plat/arm/n1sdp/include/platform_def.h
index 71409fc..91d6b3c 100644
--- a/plat/arm/n1sdp/include/platform_def.h
+++ b/plat/arm/n1sdp/include/platform_def.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -135,10 +135,6 @@
 #define CACHE_WRITEBACK_SHIFT  		 6
 #define CACHE_WRITEBACK_GRANULE		 (1 << CACHE_WRITEBACK_SHIFT)
 
-/* Non-Secure Software Generated Interupts IDs */
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_7			7
-
 /*
  * AP UART1 interrupt is considered as the maximum SPI.
  * MAX_SPI_ID = MIN_SPI_ID + PLAT_MAX_SPI_OFFSET_ID = 96
diff --git a/plat/arm/neoverse_rd/common/include/nrd2/nrd_plat_arm_def2.h b/plat/arm/neoverse_rd/common/include/nrd2/nrd_plat_arm_def2.h
index ba1ddb8..26515b3 100644
--- a/plat/arm/neoverse_rd/common/include/nrd2/nrd_plat_arm_def2.h
+++ b/plat/arm/neoverse_rd/common/include/nrd2/nrd_plat_arm_def2.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -76,14 +76,6 @@
 #define MAX_IO_DEVICES			U(1)
 #define MAX_IO_HANDLES			U(1)
 
-/*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-
-/* Non-Secure Software Generated Interupts IDs */
-#define IRQ_NS_SGI_0			U(0)
-#define IRQ_NS_SGI_7			U(7)
-
 /* Maximum SPI */
 #define PLAT_MAX_SPI_OFFSET_ID	U(256)
 
@@ -162,4 +154,4 @@
 #define FLASH_SIZE			NRD_ROS_FLASH_SIZE
 #define NOR_FLASH_BLOCK_SIZE		UL(0x40000)     /* 256KB */
 
-#endif /* NRD_PLAT_ARM_DEF2_H */
\ No newline at end of file
+#endif /* NRD_PLAT_ARM_DEF2_H */
diff --git a/plat/arm/neoverse_rd/common/include/nrd3/nrd_plat_arm_def3.h b/plat/arm/neoverse_rd/common/include/nrd3/nrd_plat_arm_def3.h
index 20c748e..5c2f59e 100644
--- a/plat/arm/neoverse_rd/common/include/nrd3/nrd_plat_arm_def3.h
+++ b/plat/arm/neoverse_rd/common/include/nrd3/nrd_plat_arm_def3.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -68,13 +68,6 @@
 #define MAX_IO_DEVICES			U(1)
 #define MAX_IO_HANDLES			U(1)
 
-/*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-
-#define IRQ_NS_SGI_0			U(0)
-#define IRQ_NS_SGI_7			U(7)
-
 /* Maximum SPI */
 #define PLAT_MAX_SPI_OFFSET_ID		U(256)
 
@@ -152,4 +145,4 @@
 #define FLASH_SIZE			NRD_ROS_FLASH_SIZE
 #define NOR_FLASH_BLOCK_SIZE		UL(0x40000)     /* 256KB */
 
-#endif /* NRD_PLAT_ARM_DEF3_H */
\ No newline at end of file
+#endif /* NRD_PLAT_ARM_DEF3_H */
diff --git a/plat/arm/tc/include/platform_def.h b/plat/arm/tc/include/platform_def.h
index 82fa6c2..28325c3 100644
--- a/plat/arm/tc/include/platform_def.h
+++ b/plat/arm/tc/include/platform_def.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -129,10 +129,6 @@
 #define CACHE_WRITEBACK_SHIFT  		 6
 #define CACHE_WRITEBACK_GRANULE		 (1 << CACHE_WRITEBACK_SHIFT)
 
-/* Non-Secure Software Generated Interupts IDs */
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_7			7
-
 /* AP UART1 interrupt is considered as the maximum SPI */
 #define PLAT_MAX_SPI_OFFSET_ID		64
 
diff --git a/plat/hisilicon/hikey960/include/platform_def.h b/plat/hisilicon/hikey960/include/platform_def.h
index e3e878f..8119c51 100644
--- a/plat/hisilicon/hikey960/include/platform_def.h
+++ b/plat/hisilicon/hikey960/include/platform_def.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -80,18 +80,6 @@
 #define PL011_BAUDRATE			115200
 #define PL011_UART_CLK_IN_HZ		19200000
 
-/*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_1			1
-#define IRQ_NS_SGI_2			2
-#define IRQ_NS_SGI_3			3
-#define IRQ_NS_SGI_4			4
-#define IRQ_NS_SGI_5			5
-#define IRQ_NS_SGI_6			6
-#define IRQ_NS_SGI_7			7
-
 /* Per-CPU Hypervisor Timer Interrupt ID */
 #define IRQ_PCPU_HP_TIMER		26
 /* Datasheet: TIME00 event*/
diff --git a/plat/nvidia/tegra186/include/platform_def.h b/plat/nvidia/tegra186/include/platform_def.h
index 8ad93ad..76ebd60 100644
--- a/plat/nvidia/tegra186/include/platform_def.h
+++ b/plat/nvidia/tegra186/include/platform_def.h
@@ -104,18 +104,6 @@
 #define PLAT_SUSPEND_ENTRY_EXIT_TIME	1000
 
 /*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_1			1
-#define IRQ_NS_SGI_2			2
-#define IRQ_NS_SGI_3			3
-#define IRQ_NS_SGI_4			4
-#define IRQ_NS_SGI_5			5
-#define IRQ_NS_SGI_6			6
-#define IRQ_NS_SGI_7			7
-
-/*******************************************************************************
  * Per-CPU Hypervisor Timer Interrupt ID
  ******************************************************************************/
 #define IRQ_PCPU_HP_TIMER		26
diff --git a/plat/nvidia/tegra194/include/platform_def.h b/plat/nvidia/tegra194/include/platform_def.h
index 0cd3ecd..6d3a0bb 100644
--- a/plat/nvidia/tegra194/include/platform_def.h
+++ b/plat/nvidia/tegra194/include/platform_def.h
@@ -105,18 +105,6 @@
 #define PLAT_SUSPEND_ENTRY_EXIT_TIME	1000
 
 /*******************************************************************************
- * Non-Secure Software Generated Interupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_1			1
-#define IRQ_NS_SGI_2			2
-#define IRQ_NS_SGI_3			3
-#define IRQ_NS_SGI_4			4
-#define IRQ_NS_SGI_5			5
-#define IRQ_NS_SGI_6			6
-#define IRQ_NS_SGI_7			7
-
-/*******************************************************************************
  * Per-CPU Hypervisor Timer Interrupt ID
  ******************************************************************************/
 #define IRQ_PCPU_HP_TIMER		26
diff --git a/plat/nvidia/tegra210/include/platform_def.h b/plat/nvidia/tegra210/include/platform_def.h
index 0e369b3..29f4252 100644
--- a/plat/nvidia/tegra210/include/platform_def.h
+++ b/plat/nvidia/tegra210/include/platform_def.h
@@ -102,18 +102,6 @@
 #define PLAT_SUSPEND_ENTRY_TIME		500
 #define PLAT_SUSPEND_ENTRY_EXIT_TIME	1000
 
-/******************************************************************************
-* Non-Secure Software Generated Interupts IDs
-******************************************************************************/
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_1			1
-#define IRQ_NS_SGI_2			2
-#define IRQ_NS_SGI_3			3
-#define IRQ_NS_SGI_4			4
-#define IRQ_NS_SGI_5			5
-#define IRQ_NS_SGI_6			6
-#define IRQ_NS_SGI_7			7
-
 /*******************************************************************************
  * Per-CPU Hypervisor Timer Interrupt ID
  ******************************************************************************/
diff --git a/plat/xilinx/versal/include/platform_def.h b/plat/xilinx/versal/include/platform_def.h
index 1e6bd5d..09b4acc 100644
--- a/plat/xilinx/versal/include/platform_def.h
+++ b/plat/xilinx/versal/include/platform_def.h
@@ -85,18 +85,6 @@
 #define CRASH_CONSOLE_BASE			PL011_UART0_BASE
 #define CRASH_CONSOLE_SIZE			PLAT_ARM_UART_SIZE
 
-/*******************************************************************************
- * Non-Secure Software Generated Interrupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0				0
-#define IRQ_NS_SGI_1				1
-#define IRQ_NS_SGI_2				2
-#define IRQ_NS_SGI_3				3
-#define IRQ_NS_SGI_4				4
-#define IRQ_NS_SGI_5				5
-#define IRQ_NS_SGI_6				6
-#define IRQ_NS_SGI_7				7
-
 /* Per-CPU Hypervisor Timer Interrupt ID */
 #define IRQ_PCPU_HP_TIMER			U(29)
 /* Datasheet: TIME00 event*/
diff --git a/plat/xilinx/versal_net/include/platform_def.h b/plat/xilinx/versal_net/include/platform_def.h
index 12c5910..fce271d 100644
--- a/plat/xilinx/versal_net/include/platform_def.h
+++ b/plat/xilinx/versal_net/include/platform_def.h
@@ -86,18 +86,6 @@
 #define CRASH_CONSOLE_BASE			PL011_UART0_BASE
 #define CRASH_CONSOLE_SIZE			PLAT_ARM_UART_SIZE
 
-/*******************************************************************************
- * Non-Secure Software Generated Interrupts IDs
- ******************************************************************************/
-#define IRQ_NS_SGI_0				0
-#define IRQ_NS_SGI_1				1
-#define IRQ_NS_SGI_2				2
-#define IRQ_NS_SGI_3				3
-#define IRQ_NS_SGI_4				4
-#define IRQ_NS_SGI_5				5
-#define IRQ_NS_SGI_6				6
-#define IRQ_NS_SGI_7				7
-
 /* Per-CPU Hypervisor Timer Interrupt ID */
 #define IRQ_PCPU_HP_TIMER			U(26)
 /* Datasheet: TIME00 event*/
diff --git a/plat/xilinx/zynqmp/include/platform_def.h b/plat/xilinx/zynqmp/include/platform_def.h
index cb3a707..e7128de 100644
--- a/plat/xilinx/zynqmp/include/platform_def.h
+++ b/plat/xilinx/zynqmp/include/platform_def.h
@@ -70,17 +70,6 @@
 #define CACHE_WRITEBACK_SHIFT		6
 #define CACHE_WRITEBACK_GRANULE		(1 << CACHE_WRITEBACK_SHIFT)
 
-/* Non-Secure Software Generated Interrupts IDs */
-
-#define IRQ_NS_SGI_0			0
-#define IRQ_NS_SGI_1			1
-#define IRQ_NS_SGI_2			2
-#define IRQ_NS_SGI_3			3
-#define IRQ_NS_SGI_4			4
-#define IRQ_NS_SGI_5			5
-#define IRQ_NS_SGI_6			6
-#define IRQ_NS_SGI_7			7
-
 /* Platform specific page table and MMU setup constants */
 
 #define PLAT_PHY_ADDR_SPACE_SIZE	(ULL(1) << 32)
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index 51e49b8..9543704 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -578,7 +578,7 @@
 	}
 
 	/* Enable the SGI used by the timer management framework */
-	tftf_irq_enable(IRQ_WAKE_SGI, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_WAKE_SGI, GIC_HIGHEST_NS_PRIORITY);
 	enable_irq();
 
 	if (new_test_session()) {
diff --git a/tftf/framework/timer/timer_framework.c b/tftf/framework/timer/timer_framework.c
index 556d46e..5830b5a 100644
--- a/tftf/framework/timer/timer_framework.c
+++ b/tftf/framework/timer/timer_framework.c
@@ -490,7 +490,7 @@
 	 * Also register same handler to IRQ_WAKE_SGI, as it can be waken
 	 * by it.
 	 */
-	ret = tftf_irq_register_handler(IRQ_WAKE_SGI, irq_handler);
+	ret = tftf_irq_register_handler_sgi(IRQ_WAKE_SGI, irq_handler);
 	assert(!ret);
 
 	return ret;
@@ -504,7 +504,7 @@
 	/*
 	 * Unregister the handler for IRQ_WAKE_SGI also
 	 */
-	ret = tftf_irq_unregister_handler(IRQ_WAKE_SGI);
+	ret = tftf_irq_unregister_handler_sgi(IRQ_WAKE_SGI);
 	assert(!ret);
 	/* Validate a handler is registered */
 	assert(timer_handler[core_pos]);
diff --git a/tftf/tests/framework_validation_tests/test_timer_framework.c b/tftf/tests/framework_validation_tests/test_timer_framework.c
index 421ddc6..59a22b1 100644
--- a/tftf/tests/framework_validation_tests/test_timer_framework.c
+++ b/tftf/tests/framework_validation_tests/test_timer_framework.c
@@ -48,7 +48,7 @@
 	unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());
 	unsigned int irq_id = *(unsigned int *) data;
 
-	assert(irq_id == IRQ_WAKE_SGI || irq_id == tftf_get_timer_irq());
+	assert(irq_id == tftf_irq_get_my_sgi_num(IRQ_WAKE_SGI) || irq_id == tftf_get_timer_irq());
 	assert(requested_irq_received[core_pos] == 0);
 
 	if (irq_id == tftf_get_timer_irq()) {
@@ -71,10 +71,10 @@
 	unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());
 	unsigned int irq_id = *(unsigned int *) data;
 
-	assert(irq_id == IRQ_WAKE_SGI || irq_id == tftf_get_timer_irq());
+	assert(irq_id == tftf_irq_get_my_sgi_num(IRQ_WAKE_SGI) || irq_id == tftf_get_timer_irq());
 	assert(requested_irq_received[core_pos] == 0);
 
-	if (irq_id == IRQ_WAKE_SGI) {
+	if (irq_id == tftf_irq_get_my_sgi_num(IRQ_WAKE_SGI)) {
 		spin_lock(&irq_handler_lock);
 		multiple_timer_count++;
 		spin_unlock(&irq_handler_lock);
diff --git a/tftf/tests/framework_validation_tests/test_validation_irq.c b/tftf/tests/framework_validation_tests/test_validation_irq.c
index 914a1ca..6955191 100644
--- a/tftf/tests/framework_validation_tests/test_validation_irq.c
+++ b/tftf/tests/framework_validation_tests/test_validation_irq.c
@@ -46,13 +46,13 @@
 	counter = 0;
 
 	/* Now register a handler */
-	ret = tftf_irq_register_handler(sgi_id, increment_counter);
+	ret = tftf_irq_register_handler_sgi(sgi_id, increment_counter);
 	if (ret != 0) {
 		tftf_testcase_printf("Failed to register initial IRQ handler\n");
 		return TEST_RESULT_FAIL;
 	}
 
-	tftf_irq_enable(sgi_id, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	/*
 	 * Send the SGI to the calling core and check the IRQ handler has been
@@ -64,6 +64,8 @@
 	while (counter != 1)
 		;
 
+	// TODO all this crap tests tftf itself. It's just slow. Drop?
+	// or add it to some test group that's not built/run by default.
 	/*
 	 * Try to overwrite the IRQ handler. This should fail.
 	 * In debug builds, it would trigger an assertion so we can't test that
@@ -72,7 +74,7 @@
 	 * replace the existing handler and that's something that can be tested.
 	 */
 #if !DEBUG
-	ret = tftf_irq_register_handler(sgi_id, set_counter_to_42);
+	ret = tftf_irq_register_handler_sgi(sgi_id, set_counter_to_42);
 	if (ret == 0) {
 		tftf_testcase_printf(
 			"Overwriting the IRQ handler should have failed\n");
@@ -85,7 +87,7 @@
 		;
 
 	/* Unregister the IRQ handler */
-	ret = tftf_irq_unregister_handler(sgi_id);
+	ret = tftf_irq_unregister_handler_sgi(IRQ_NS_SGI_0);
 	if (ret != 0) {
 		tftf_testcase_printf("Failed to unregister IRQ handler\n");
 		return TEST_RESULT_FAIL;
@@ -116,7 +118,7 @@
 	 * In release builds though, it should just do nothing.
 	 */
 #if !DEBUG
-	ret = tftf_irq_unregister_handler(sgi_id);
+	ret = tftf_irq_unregister_handler_sgi(sgi_id);
 	if (ret == 0) {
 		tftf_testcase_printf(
 			"Unregistering the IRQ handler again should have failed\n");
@@ -124,7 +126,7 @@
 	}
 #endif
 
-	tftf_irq_disable(sgi_id);
+	tftf_irq_disable_sgi(sgi_id);
 
 	return TEST_RESULT_SUCCESS;
 }
diff --git a/tftf/tests/framework_validation_tests/test_validation_sgi.c b/tftf/tests/framework_validation_tests/test_validation_sgi.c
index 0f9ac9b..cafcb7a 100644
--- a/tftf/tests/framework_validation_tests/test_validation_sgi.c
+++ b/tftf/tests/framework_validation_tests/test_validation_sgi.c
@@ -45,17 +45,18 @@
 	unsigned int mpid = read_mpidr_el1();
 	unsigned int core_pos = platform_get_core_pos(mpid);
 	const unsigned int sgi_id = IRQ_NS_SGI_0;
+	const unsigned int sgi_irq = tftf_irq_get_my_sgi_num(sgi_id);
 	test_result_t test_res = TEST_RESULT_SUCCESS;
 	int ret;
 
 	/* Register the local IRQ handler for the SGI */
-	ret = tftf_irq_register_handler(sgi_id, sgi_handler);
+	ret = tftf_irq_register_handler_sgi(sgi_id, sgi_handler);
 	if (ret != 0) {
 		tftf_testcase_printf("Failed to register IRQ %u (%d)",
 				sgi_id, ret);
 		return TEST_RESULT_FAIL;
 	}
-	tftf_irq_enable(sgi_id, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(sgi_id, GIC_HIGHEST_NS_PRIORITY);
 
 	/* Send the SGI to the lead CPU */
 	tftf_send_sgi(sgi_id, core_pos);
@@ -68,14 +69,14 @@
 		continue;
 
 	/* Verify the data received in the SGI handler */
-	if (sgi_data != sgi_id) {
+	if (sgi_data != sgi_irq) {
 		tftf_testcase_printf("Wrong IRQ ID, expected %u, got %u\n",
-			sgi_id, sgi_data);
+			sgi_irq, sgi_data);
 		test_res = TEST_RESULT_FAIL;
 	}
 
-	tftf_irq_disable(sgi_id);
-	tftf_irq_unregister_handler(sgi_id);
+	tftf_irq_disable_sgi(sgi_id);
+	tftf_irq_unregister_handler_sgi(sgi_id);
 
 	return test_res;
 }
diff --git a/tftf/tests/misc_tests/test_pmu_leakage.c b/tftf/tests/misc_tests/test_pmu_leakage.c
index 9b2f735..82b81f4 100644
--- a/tftf/tests/misc_tests/test_pmu_leakage.c
+++ b/tftf/tests/misc_tests/test_pmu_leakage.c
@@ -182,7 +182,7 @@
 	power_state = tftf_make_psci_pstate(MPIDR_AFFLVL0,
 					    PSTATE_TYPE_STANDBY, stateid);
 
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	/*
 	 * Mask IRQ to prevent the interrupt handler being invoked
@@ -203,7 +203,7 @@
 	enable_irq();
 	isb();
 
-	tftf_irq_disable(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 
 	return evt_cnt;
 }
@@ -241,7 +241,7 @@
 
 		cnt_sum += evt_cnt;
 
-		tftf_irq_disable(IRQ_NS_SGI_0);
+		tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 	}
 
 	avg_cnt = cnt_sum / ITERATIONS_CNT;
diff --git a/tftf/tests/misc_tests/test_ras_kfh_reflect.c b/tftf/tests/misc_tests/test_ras_kfh_reflect.c
index 7d771a4..9392231 100644
--- a/tftf/tests/misc_tests/test_ras_kfh_reflect.c
+++ b/tftf/tests/misc_tests/test_ras_kfh_reflect.c
@@ -89,12 +89,12 @@
 
 	waitms(50);
 
-	ret = tftf_irq_register_handler(sgi_id, irq_handler);
+	ret = tftf_irq_register_handler_sgi(sgi_id, irq_handler);
 	 if (ret != 0) {
                 tftf_testcase_printf("Failed to register initial IRQ handler\n");
                 return TEST_RESULT_FAIL;
         }
-	tftf_irq_enable(sgi_id, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(sgi_id, GIC_HIGHEST_NS_PRIORITY);
 	tftf_send_sgi(sgi_id, core_pos);
 
 	if ((serror_triggered == false) || (irq_triggered == false)) {
@@ -102,7 +102,7 @@
 		return TEST_RESULT_FAIL;
 	}
 
-	ret = tftf_irq_unregister_handler(sgi_id);
+	ret = tftf_irq_unregister_handler_sgi(sgi_id);
 	if (ret != 0) {
 		tftf_testcase_printf("Failed to unregister IRQ handler\n");
 		return TEST_RESULT_FAIL;
diff --git a/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c b/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c
index 883102e..fb60988 100644
--- a/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c
+++ b/tftf/tests/runtime_services/realm_payload/host_realm_payload_multiple_rec_tests.c
@@ -284,12 +284,12 @@
 	}
 
 destroy_realm:
-	tftf_irq_enable(IRQ_NS_SGI_7, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_7, GIC_HIGHEST_NS_PRIORITY);
 	for (unsigned int i = 1U; i < rec_count; i++) {
 		INFO("Raising NS IRQ for rec %u\n", i);
 		host_rec_send_sgi(&realm, IRQ_NS_SGI_7, i);
 	}
-	tftf_irq_disable(IRQ_NS_SGI_7);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_7);
 	ret2 = host_destroy_realm(&realm);
 	if (!ret1 || !ret2) {
 		ERROR("%s(): enter=%d destroy=%d\n",
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
index 2697fac..6e7f3f7 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
@@ -354,7 +354,7 @@
 	 * Enable reception of SGI 0 on the calling CPU.
 	 * SGI 0 will serve as the wake-up event to come out of suspend.
 	 */
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	expected_return_val = tftf_psci_make_composite_state_id(
 			PSTATE_AFF_LVL_0, PSTATE_TYPE_POWERDOWN, &stateid);
@@ -377,7 +377,7 @@
 
 	psci_ret = tftf_cpu_suspend(power_state);
 
-	tftf_irq_disable(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 
 	if (psci_ret != PSCI_E_SUCCESS) {
 		tftf_testcase_printf("Failed to suspend (%i)\n", psci_ret);
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c
index e802d43..ba67ab1 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c
@@ -49,7 +49,7 @@
 	unsigned int irq_id = *(unsigned int *) data;
 #endif
 
-	assert(irq_id == IRQ_WAKE_SGI || irq_id == tftf_get_timer_irq());
+	assert(irq_id == tftf_irq_get_my_sgi_num(IRQ_WAKE_SGI) || irq_id == tftf_get_timer_irq());
 	assert(requested_irq_received[core_pos] == 0);
 
 	requested_irq_received[core_pos] = 1;
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
index e79293b..4563bcb 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
@@ -323,14 +323,14 @@
 	int sgi_ret;
 
 	/* Register the local IRQ handler for the SGI */
-	sgi_ret = tftf_irq_register_handler(sgi_id, sgi_handler);
+	sgi_ret = tftf_irq_register_handler_sgi(sgi_id, sgi_handler);
 	if (sgi_ret != 0) {
 		tftf_testcase_printf("Failed to register IRQ %u (%d)",
 				sgi_id, sgi_ret);
 		return TEST_RESULT_FAIL;
 	}
 	/* Enable SGI */
-	tftf_irq_enable(sgi_id, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(sgi_id, GIC_HIGHEST_NS_PRIORITY);
 
 	/* Signal to the lead CPU that we are ready to receive SGI */
 	tftf_send_event(&cpu_ready[core_pos]);
@@ -342,8 +342,8 @@
 	tftf_send_event(&sgi_received[core_pos]);
 
 	/* Unregister SGI handler */
-	tftf_irq_disable(sgi_id);
-	tftf_irq_unregister_handler(sgi_id);
+	tftf_irq_disable_sgi(sgi_id);
+	tftf_irq_unregister_handler_sgi(sgi_id);
 	return TEST_RESULT_SUCCESS;
 }
 
@@ -458,6 +458,7 @@
 {
 	unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());
 	const unsigned int sgi_id = IRQ_NS_SGI_0;
+	const unsigned int sgi_irq = tftf_irq_get_my_sgi_num(sgi_id);
 	int sgi_ret;
 	int psci_ret;
 	test_result_t ret = TEST_RESULT_SUCCESS;
@@ -473,7 +474,7 @@
 	wakeup_irq_rcvd[core_pos] = 0;
 
 	/* Register the local IRQ handler for the SGI */
-	sgi_ret = tftf_irq_register_handler(sgi_id, sgi_handler);
+	sgi_ret = tftf_irq_register_handler_sgi(sgi_id, sgi_handler);
 	if (sgi_ret != 0) {
 		tftf_testcase_printf("Failed to register IRQ %u (%d)",
 				sgi_id, sgi_ret);
@@ -489,7 +490,7 @@
 	 */
 	tftf_program_timer(SUSPEND_TIME_3_SECS);
 
-	tftf_irq_enable(sgi_id, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(sgi_id, GIC_HIGHEST_NS_PRIORITY);
 	disable_irq();
 
 	/* Send the SGI to the lead CPU */
@@ -517,9 +518,9 @@
 		;
 
 	/* Verify the sgi data received by the SGI handler */
-	if (sgi_data != sgi_id) {
+	if (sgi_data != sgi_irq) {
 		tftf_testcase_printf("Wrong IRQ ID, expected %u, got %u\n",
-				sgi_id, sgi_data);
+				sgi_irq, sgi_data);
 		ret = TEST_RESULT_FAIL;
 	}
 
@@ -531,8 +532,8 @@
 	tftf_cancel_timer();
 
 	/* Unregister SGI handler */
-	tftf_irq_disable(sgi_id);
-	tftf_irq_unregister_handler(sgi_id);
+	tftf_irq_disable_sgi(sgi_id);
+	tftf_irq_unregister_handler_sgi(sgi_id);
 
 	return ret;
 }
@@ -662,13 +663,13 @@
 	unsigned int core_pos = platform_get_core_pos(mpid);
 	int ret;
 
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	/* Tell the lead CPU that the calling CPU is about to suspend itself */
 	tftf_send_event(&cpu_ready[core_pos]);
 
 	ret = tftf_cpu_suspend(deepest_power_state);
-	tftf_irq_disable(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 
 	if (ret) {
 		ERROR(" CPU suspend failed with error %x\n", ret);
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c
index 565914b..ac3b338 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c
@@ -408,8 +408,8 @@
 	test_result_t ret;
 	unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());
 
-	tftf_irq_register_handler(IRQ_NS_SGI_0, validate_pstate_sgi_handler);
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_register_handler_sgi(IRQ_NS_SGI_0, validate_pstate_sgi_handler);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	/*
 	 * Mask IRQ to prevent the interrupt handler being invoked
@@ -428,8 +428,8 @@
 	while (!sgi_received[core_pos])
 		;
 
-	tftf_irq_disable(IRQ_NS_SGI_0);
-	tftf_irq_unregister_handler(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
+	tftf_irq_unregister_handler_sgi(IRQ_NS_SGI_0);
 
 	return ret;
 }
diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c
index 3e24ccd..3af35ad 100644
--- a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c
+++ b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c
@@ -66,7 +66,7 @@
 {
 	/* SGIs #0 - #6 are freely available. */
 
-	int ret = tftf_irq_register_handler(IRQ_NS_SGI_0, test_handler);
+	int ret = tftf_irq_register_handler_sgi(IRQ_NS_SGI_0, test_handler);
 
 	if (ret != 0) {
 		tftf_testcase_printf(
@@ -75,7 +75,7 @@
 		return -1;
 	}
 
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	return 0;
 }
@@ -83,9 +83,9 @@
 /* Disable and unregister the dummy handler for SGI #0. */
 static void unregister_and_disable_test_sgi_handler(void)
 {
-	tftf_irq_disable(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 
-	tftf_irq_unregister_handler(IRQ_NS_SGI_0);
+	tftf_irq_unregister_handler_sgi(IRQ_NS_SGI_0);
 }
 
 /*
diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c b/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c
index eb04006..d038f86 100644
--- a/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c
+++ b/tftf/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c
@@ -64,7 +64,7 @@
 		shared_data.wait_for_fiq = 1;
 
 	/* Register Handler for the interrupt. SGIs #0 - #6 are available. */
-	rc = tftf_irq_register_handler(IRQ_NS_SGI_0, sgi_handler);
+	rc = tftf_irq_register_handler_sgi(IRQ_NS_SGI_0, sgi_handler);
 	if (rc != 0) {
 		tftf_testcase_printf("Failed to register SGI handler. "
 				"Error code = %d\n", rc);
@@ -72,7 +72,7 @@
 	}
 
 	/* Enable SGI #0 */
-	tftf_irq_enable(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
+	tftf_irq_enable_sgi(IRQ_NS_SGI_0, GIC_HIGHEST_NS_PRIORITY);
 
 	/* Set PSTATE.I to 0. */
 	disable_irq();
@@ -99,10 +99,10 @@
 	enable_irq();
 
 	/* Disable SGI #0 */
-	tftf_irq_disable(IRQ_NS_SGI_0);
+	tftf_irq_disable_sgi(IRQ_NS_SGI_0);
 
 	/* Unregister handler */
-	rc = tftf_irq_unregister_handler(IRQ_NS_SGI_0);
+	rc = tftf_irq_unregister_handler_sgi(IRQ_NS_SGI_0);
 	if (rc != 0) {
 		tftf_testcase_printf("Failed to unregister IRQ handler. "
 				     "Error code = %d\n", rc);