[PATCH 2/3] firmware: arm_ffa: Rename the references to SRI to include NPI

Sudeep Holla sudeep.holla at arm.com
Wed Apr 10 04:39:47 PDT 2024


In preparation to support handling of Notification Pending Interrupt(NPI)
in addition to the existing support for Schedule Reciever Interrupt(SRI),
rename all the references to SRI to reflect that it can be either SRI or
NRI. This change is just cosmetic and doesn't impact any features yet.
It also doesn't add the support for NPIs yet.

Signed-off-by: Sudeep Holla <sudeep.holla at arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 41 ++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 4a576af7b8fd..c299cb9e6889 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -100,7 +100,8 @@ struct ffa_drv_info {
 	bool mem_ops_native;
 	bool bitmap_created;
 	bool notif_enabled;
-	unsigned int sched_recv_irq;
+	/* Schedule Receiver(SRI) or Notification pending interrupt(NPI) */
+	unsigned int sr_or_np_irq;
 	unsigned int cpuhp_state;
 	struct ffa_pcpu_irq __percpu *irq_pcpu;
 	struct workqueue_struct *notif_pcpu_wq;
@@ -1291,7 +1292,7 @@ static void ffa_partitions_cleanup(void)
 #define FFA_FEAT_SCHEDULE_RECEIVER_INT		(2)
 #define FFA_FEAT_MANAGED_EXIT_INT		(3)
 
-static irqreturn_t irq_handler(int irq, void *irq_data)
+static irqreturn_t sri_handler(int irq, void *irq_data)
 {
 	struct ffa_pcpu_irq *pcpu = irq_data;
 	struct ffa_drv_info *info = pcpu->info;
@@ -1306,12 +1307,12 @@ static void ffa_sched_recv_irq_work_fn(struct work_struct *work)
 	ffa_notification_info_get();
 }
 
-static int ffa_sched_recv_irq_map(void)
+static int ffa_sr_or_np_irq_map(void)
 {
-	int ret, irq, sr_intid;
+	int ret, irq, intr_id;
 
-	/* The returned sr_intid is assumed to be SGI donated to NS world */
-	ret = ffa_features(FFA_FEAT_SCHEDULE_RECEIVER_INT, 0, &sr_intid, NULL);
+	/* The returned intr_id is assumed to be SGI donated to NS world */
+	ret = ffa_features(FFA_FEAT_SCHEDULE_RECEIVER_INT, 0, &intr_id, NULL);
 	if (ret < 0) {
 		if (ret != -EOPNOTSUPP)
 			pr_err("Failed to retrieve scheduler Rx interrupt\n");
@@ -1329,12 +1330,12 @@ static int ffa_sched_recv_irq_map(void)
 
 		oirq.np = gic;
 		oirq.args_count = 1;
-		oirq.args[0] = sr_intid;
+		oirq.args[0] = intr_id;
 		irq = irq_create_of_mapping(&oirq);
 		of_node_put(gic);
 #ifdef CONFIG_ACPI
 	} else {
-		irq = acpi_register_gsi(NULL, sr_intid, ACPI_EDGE_SENSITIVE,
+		irq = acpi_register_gsi(NULL, intr_id, ACPI_EDGE_SENSITIVE,
 					ACPI_ACTIVE_HIGH);
 #endif
 	}
@@ -1347,23 +1348,23 @@ static int ffa_sched_recv_irq_map(void)
 	return irq;
 }
 
-static void ffa_sched_recv_irq_unmap(void)
+static void ffa_sr_or_np_irq_unmap(void)
 {
-	if (drv_info->sched_recv_irq) {
-		irq_dispose_mapping(drv_info->sched_recv_irq);
-		drv_info->sched_recv_irq = 0;
+	if (drv_info->sr_or_np_irq) {
+		irq_dispose_mapping(drv_info->sr_or_np_irq);
+		drv_info->sr_or_np_irq = 0;
 	}
 }
 
 static int ffa_cpuhp_pcpu_irq_enable(unsigned int cpu)
 {
-	enable_percpu_irq(drv_info->sched_recv_irq, IRQ_TYPE_NONE);
+	enable_percpu_irq(drv_info->sr_or_np_irq, IRQ_TYPE_NONE);
 	return 0;
 }
 
 static int ffa_cpuhp_pcpu_irq_disable(unsigned int cpu)
 {
-	disable_percpu_irq(drv_info->sched_recv_irq);
+	disable_percpu_irq(drv_info->sr_or_np_irq);
 	return 0;
 }
 
@@ -1379,8 +1380,8 @@ static void ffa_uninit_pcpu_irq(void)
 		drv_info->notif_pcpu_wq = NULL;
 	}
 
-	if (drv_info->sched_recv_irq)
-		free_percpu_irq(drv_info->sched_recv_irq, drv_info->irq_pcpu);
+	if (drv_info->sr_or_np_irq)
+		free_percpu_irq(drv_info->sr_or_np_irq, drv_info->irq_pcpu);
 
 	if (drv_info->irq_pcpu) {
 		free_percpu(drv_info->irq_pcpu);
@@ -1402,7 +1403,7 @@ static int ffa_init_pcpu_irq(unsigned int irq)
 
 	drv_info->irq_pcpu = irq_pcpu;
 
-	ret = request_percpu_irq(irq, irq_handler, "ARM-FFA", irq_pcpu);
+	ret = request_percpu_irq(irq, sri_handler, "ARM-FFA-SRI", irq_pcpu);
 	if (ret) {
 		pr_err("Error registering notification IRQ %d: %d\n", irq, ret);
 		return ret;
@@ -1428,7 +1429,7 @@ static int ffa_init_pcpu_irq(unsigned int irq)
 static void ffa_notifications_cleanup(void)
 {
 	ffa_uninit_pcpu_irq();
-	ffa_sched_recv_irq_unmap();
+	ffa_sr_or_np_irq_unmap();
 
 	if (drv_info->bitmap_created) {
 		ffa_notification_bitmap_destroy();
@@ -1452,13 +1453,13 @@ static void ffa_notifications_setup(void)
 		drv_info->bitmap_created = true;
 	}
 
-	irq = ffa_sched_recv_irq_map();
+	irq = ffa_sr_or_np_irq_map();
 	if (irq <= 0) {
 		ret = irq;
 		goto cleanup;
 	}
 
-	drv_info->sched_recv_irq = irq;
+	drv_info->sr_or_np_irq = irq;
 
 	ret = ffa_init_pcpu_irq(irq);
 	if (ret)

-- 
2.43.2




More information about the linux-arm-kernel mailing list