From patchwork Wed Apr 10 11:39:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13624128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7524BCD11C2 for ; Wed, 10 Apr 2024 11:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LDH8KAVH2HjONTFzRGQvEPAbRRRCzBgL059/v304Fkw=; b=1YvSC5wXSzmDbQ UQTtlrxDqf7yhz7b16Eksy2FmGGjJ2lyb3M9SVY6PTUfV5z/XcHt5vDvjM00zwLgsMHZo/+eUYU6J W4JnDlQ5ipPQVIuLYgQyNrmBUSOwXnGMaxPy6WI++L1rwYEO7V35w+a4rmGzBcfCWA/nt/j0viZwU ipqGMEAGq2OtMdVTVR6zHFlGbmEF5Yxbd3m80yRz7+BiNui7YgJcY0HDJOypTmZI2CGk19Xh267mZ jbfAGPfQxADf7xKKhdNz7d6C7e9YBXR0WXybopqhNGCpHnaImWjR1gOhNnXNiNMDZtVd9UzL1b86d lcBeCXTEtEoNyc3MNUOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruWJN-00000006gRy-2H8O; Wed, 10 Apr 2024 11:40:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruWJC-00000006gNQ-25AA for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2024 11:40:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 486321595; Wed, 10 Apr 2024 04:40:33 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 860B63F6C4; Wed, 10 Apr 2024 04:40:02 -0700 (PDT) From: Sudeep Holla Date: Wed, 10 Apr 2024 12:39:47 +0100 Subject: [PATCH 2/3] firmware: arm_ffa: Rename the references to SRI to include NPI MIME-Version: 1.0 Message-Id: <20240410-ffa_npi_support-v1-2-1a5223391bd1@arm.com> References: <20240410-ffa_npi_support-v1-0-1a5223391bd1@arm.com> In-Reply-To: <20240410-ffa_npi_support-v1-0-1a5223391bd1@arm.com> To: linux-arm-kernel@lists.infradead.org Cc: Marc Bonnici , Olivier Deprez , Lorenzo Pieralisi , Bertrand Marquis , Jens Wiklander , Sudeep Holla X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4747; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=RYDS53McaJkVRqrNrlYk3FHNqmglBrU65hzxtjX3i3c=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBmFnqP5ZYYLQ3TQ3p4K1GEBJfpHFu+Qqd2elL76 7KYSwRCBpKJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZhZ6jwAKCRAAQbq8MX7i mJIdEACfskFudMVmmuKdfMBkWhkcMjl5vou3nBjTouuBpmCU6l5DPNHQ1+3leU9N4IuSkZtXFX/ +b2ltDkYqcSrr5P9BW6hY3DsGiPUt7l1rnN3oLOV9rArNGz6h72ygsCgkOiwvquNea4wgoOrrFV A2ALKYyAQPNmDPHcNA8calYjMZzsstNjNwZN0YvJ0+6tvmCg/ioE2fiN9dk/LM5Asb4kDpZeOPR DfFQWEfDZ964BRiFL1B6Y0VBVFSSuMF6h+Lnu+2VoVFDrruFVEDEz9bThqPMQNvEiECxcXPtoIE EcBbnijL50pxzu7Zmy8TK/D1y+Af/kXJqZiAfueGoJKtXhrgHVg1NHxHLvMpN0nt6NijVFzxEJ9 jpgb56sxMLSLV/iytHE6V1kLc8jnCnbVKvivJa0C+NGunYYjmX79UOR6YCJq1KVSo/eCYifUo/k 8dUyYFIc/tYvX55kFwjXMVVUJYmOrd1IB+0O3ju+5WArtUq0U2hrbMriZErs1i2gjD2nYY/sWOa xDER6qlrCxuiEfmX4BRRI5xbnVlVbDodcWeNgtwqQuqjae2d60bLK+CEFL40kctjR9RwcNNwwBg XhSymnJ8K3qJbd3DyHEPLxApNacrqXebuCpCxZ/qZjSKM3UZufkvmfKplmplajH+/GB8eqEpL/D 6vPc0WmaEsRlCNA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_044006_699891_746062EC X-CRM114-Status: GOOD ( 17.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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)