-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ipc_interrupt): enable ipc delivery via interrupt in Linux
- register ipc_message_handler to receive ipc notification in bao-ipcshmem driver - modify configs to define interrupt_offset in Linux VM - call bao_ipcshmem_notify in uart_rx_handler in Zephyr Tested: - qemu-aarch64-virt - linux+freertos - linux+zephyr - rip4 - linux+freertos
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
guests/linux/patches/v6.1/0003-bao-ipcshmem-receive-ipc-message-from-ipc-interrupt.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 602da8977a7af47c22e8c79cf6ec70b2d48a8a74 Mon Sep 17 00:00:00 2001 | ||
From: Clay Chang <[email protected]> | ||
Date: Mon, 17 Jul 2023 18:49:55 +0800 | ||
Subject: [PATCH 3/3] bao-ipcshmem: receive ipc message from ipc interrupt | ||
|
||
--- | ||
drivers/bao/bao-ipcshmem.c | 17 +++++++++++++++++ | ||
1 file changed, 17 insertions(+) | ||
|
||
diff --git a/drivers/bao/bao-ipcshmem.c b/drivers/bao/bao-ipcshmem.c | ||
index e9cc304ea..6bc6332fd 100644 | ||
--- a/drivers/bao/bao-ipcshmem.c | ||
+++ b/drivers/bao/bao-ipcshmem.c | ||
@@ -181,6 +181,15 @@ static struct file_operations bao_ipcshmem_fops = { | ||
.release = bao_ipcshmem_release_fops | ||
}; | ||
|
||
+static irqreturn_t ipc_message_handler(int irq, void *data) | ||
+{ | ||
+ struct bao_ipcshmem *bao = (struct bao_ipcshmem *)data; | ||
+ | ||
+ pr_info("ipc message: %s", (char *)bao->read_base); | ||
+ | ||
+ return IRQ_HANDLED; | ||
+} | ||
+ | ||
int bao_ipcshmem_register(struct platform_device *pdev) | ||
{ | ||
int ret = 0; | ||
@@ -194,6 +203,7 @@ int bao_ipcshmem_register(struct platform_device *pdev) | ||
bool rd_in_range, wr_in_range, disjoint; | ||
void* shmem_base_addr = NULL; | ||
int id = -1; | ||
+ unsigned int irq; | ||
struct bao_ipcshmem *bao; | ||
|
||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
@@ -241,6 +251,13 @@ int bao_ipcshmem_register(struct platform_device *pdev) | ||
bao->write_base = shmem_base_addr + write_offset; | ||
bao->physical_base = (void *)r->start; | ||
|
||
+ irq = platform_get_irq(pdev, 0); | ||
+ ret = devm_request_irq(&pdev->dev, irq, ipc_message_handler, IRQF_TRIGGER_RISING /*| IRQF_TRIGGER_FALLING*/, bao->label, (void *)bao); | ||
+ if (ret != 0) { | ||
+ pr_err("failed to request irq: ret=%d\n", ret); | ||
+ goto err_unmap; | ||
+ } | ||
+ | ||
cdev_init(&bao->cdev, &bao_ipcshmem_fops); | ||
bao->cdev.owner = owner; | ||
|
||
-- | ||
2.34.1 | ||
|