diff --git a/demos/linux+freertos/devicetrees/fvp-a-aarch32/linux.dts b/demos/linux+freertos/devicetrees/fvp-a-aarch32/linux.dts index 7e247d5..d8a8888 100644 --- a/demos/linux+freertos/devicetrees/fvp-a-aarch32/linux.dts +++ b/demos/linux+freertos/devicetrees/fvp-a-aarch32/linux.dts @@ -86,7 +86,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/fvp-a/linux.dts b/demos/linux+freertos/devicetrees/fvp-a/linux.dts index 9d2c5cd..25f54ae 100644 --- a/demos/linux+freertos/devicetrees/fvp-a/linux.dts +++ b/demos/linux+freertos/devicetrees/fvp-a/linux.dts @@ -86,7 +86,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/fvp-r/linux.dts b/demos/linux+freertos/devicetrees/fvp-r/linux.dts index a605ef6..f6e3ce1 100644 --- a/demos/linux+freertos/devicetrees/fvp-r/linux.dts +++ b/demos/linux+freertos/devicetrees/fvp-r/linux.dts @@ -86,7 +86,7 @@ reg = <0x0 0x70000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/imx8qm/linux.dts b/demos/linux+freertos/devicetrees/imx8qm/linux.dts index f571273..e74d654 100644 --- a/demos/linux+freertos/devicetrees/imx8qm/linux.dts +++ b/demos/linux+freertos/devicetrees/imx8qm/linux.dts @@ -259,7 +259,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; interrupt-parent = <&gic>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/qemu-aarch64-virt/linux.dts b/demos/linux+freertos/devicetrees/qemu-aarch64-virt/linux.dts index d35e6f4..fa5f0ec 100644 --- a/demos/linux+freertos/devicetrees/qemu-aarch64-virt/linux.dts +++ b/demos/linux+freertos/devicetrees/qemu-aarch64-virt/linux.dts @@ -120,7 +120,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/qemu-riscv64-virt/linux.dts b/demos/linux+freertos/devicetrees/qemu-riscv64-virt/linux.dts index 736b854..bfdbe68 100644 --- a/demos/linux+freertos/devicetrees/qemu-riscv64-virt/linux.dts +++ b/demos/linux+freertos/devicetrees/qemu-riscv64-virt/linux.dts @@ -135,7 +135,7 @@ read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; interrupt-parent = <&plic>; - interrupts = <52>; + interrupts = <20>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/rpi4/linux.dts b/demos/linux+freertos/devicetrees/rpi4/linux.dts index 53b9d5c..dd8dd0b 100644 --- a/demos/linux+freertos/devicetrees/rpi4/linux.dts +++ b/demos/linux+freertos/devicetrees/rpi4/linux.dts @@ -108,7 +108,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+freertos/devicetrees/tx2/linux.dts b/demos/linux+freertos/devicetrees/tx2/linux.dts index 9eb74b1..c3ff07c 100644 --- a/demos/linux+freertos/devicetrees/tx2/linux.dts +++ b/demos/linux+freertos/devicetrees/tx2/linux.dts @@ -183,7 +183,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; @@ -195,4 +195,4 @@ bootargs = "clk_ignore_unused ip=192.168.42.15 carrier_timeout=0"; }; -}; \ No newline at end of file +}; diff --git a/demos/linux+freertos/devicetrees/zcu104/linux.dts b/demos/linux+freertos/devicetrees/zcu104/linux.dts index b4cc734..7248499 100644 --- a/demos/linux+freertos/devicetrees/zcu104/linux.dts +++ b/demos/linux+freertos/devicetrees/zcu104/linux.dts @@ -138,7 +138,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/fvp-a-aarch32/linux.dts b/demos/linux+zephyr/devicetrees/fvp-a-aarch32/linux.dts index e42cf8f..bf4bd5f 100644 --- a/demos/linux+zephyr/devicetrees/fvp-a-aarch32/linux.dts +++ b/demos/linux+zephyr/devicetrees/fvp-a-aarch32/linux.dts @@ -86,7 +86,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/fvp-a/linux.dts b/demos/linux+zephyr/devicetrees/fvp-a/linux.dts index 6689e32..53d5355 100644 --- a/demos/linux+zephyr/devicetrees/fvp-a/linux.dts +++ b/demos/linux+zephyr/devicetrees/fvp-a/linux.dts @@ -79,7 +79,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/fvp-r/linux.dts b/demos/linux+zephyr/devicetrees/fvp-r/linux.dts index 60219ff..0a5ed0e 100644 --- a/demos/linux+zephyr/devicetrees/fvp-r/linux.dts +++ b/demos/linux+zephyr/devicetrees/fvp-r/linux.dts @@ -80,7 +80,7 @@ reg = <0x0 0x70000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/imx8qm/linux.dts b/demos/linux+zephyr/devicetrees/imx8qm/linux.dts index f571273..e74d654 100644 --- a/demos/linux+zephyr/devicetrees/imx8qm/linux.dts +++ b/demos/linux+zephyr/devicetrees/imx8qm/linux.dts @@ -259,7 +259,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; interrupt-parent = <&gic>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/qemu-aarch64-virt/linux.dts b/demos/linux+zephyr/devicetrees/qemu-aarch64-virt/linux.dts index e9032b8..ac398dd 100644 --- a/demos/linux+zephyr/devicetrees/qemu-aarch64-virt/linux.dts +++ b/demos/linux+zephyr/devicetrees/qemu-aarch64-virt/linux.dts @@ -114,7 +114,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/rpi4/linux.dts b/demos/linux+zephyr/devicetrees/rpi4/linux.dts index 53b9d5c..dd8dd0b 100644 --- a/demos/linux+zephyr/devicetrees/rpi4/linux.dts +++ b/demos/linux+zephyr/devicetrees/rpi4/linux.dts @@ -108,7 +108,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/devicetrees/tx2/linux.dts b/demos/linux+zephyr/devicetrees/tx2/linux.dts index 9eb74b1..c3ff07c 100644 --- a/demos/linux+zephyr/devicetrees/tx2/linux.dts +++ b/demos/linux+zephyr/devicetrees/tx2/linux.dts @@ -183,7 +183,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; @@ -195,4 +195,4 @@ bootargs = "clk_ignore_unused ip=192.168.42.15 carrier_timeout=0"; }; -}; \ No newline at end of file +}; diff --git a/demos/linux+zephyr/devicetrees/zcu104/linux.dts b/demos/linux+zephyr/devicetrees/zcu104/linux.dts index b4cc734..7248499 100644 --- a/demos/linux+zephyr/devicetrees/zcu104/linux.dts +++ b/demos/linux+zephyr/devicetrees/zcu104/linux.dts @@ -138,7 +138,7 @@ reg = <0x0 0xf0000000 0x0 0x00010000>; read-channel = <0x0 0x2000>; write-channel = <0x2000 0x2000>; - interrupts = <0 52 1>; + interrupts = <0 20 1>; id = <0>; }; diff --git a/demos/linux+zephyr/zephyr/app/src/main.c b/demos/linux+zephyr/zephyr/app/src/main.c index f563fcf..3128f80 100644 --- a/demos/linux+zephyr/zephyr/app/src/main.c +++ b/demos/linux+zephyr/zephyr/app/src/main.c @@ -41,6 +41,7 @@ void uart_rx_handler() { snprintf(msg, MSG_SIZE, "zephyr has received %ld uart interrupts!\n", irq_count); bao_ipcshmem_write(shmem, msg, strnlen(msg, MSG_SIZE)+1); + bao_ipcshmem_notify(shmem); } void shmem_irq_handler(const struct device *dev) { diff --git a/guests/linux/patches/v6.1/0003-bao-ipcshmem-receive-ipc-message-from-ipc-interrupt.patch b/guests/linux/patches/v6.1/0003-bao-ipcshmem-receive-ipc-message-from-ipc-interrupt.patch new file mode 100644 index 0000000..dd50504 --- /dev/null +++ b/guests/linux/patches/v6.1/0003-bao-ipcshmem-receive-ipc-message-from-ipc-interrupt.patch @@ -0,0 +1,60 @@ +From be0d07b654e3e1011e87df84709155683120acd3 Mon Sep 17 00:00:00 2001 +From: Clay Chang +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 | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/bao/bao-ipcshmem.c b/drivers/bao/bao-ipcshmem.c +index e9cc304ea..9af4f6e37 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, 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; + +@@ -322,4 +339,5 @@ module_exit(bao_ipcshmem_exit); + MODULE_LICENSE("GPL"); + MODULE_AUTHOR("David Cerdeira"); + MODULE_AUTHOR("José Martins"); ++MODULE_AUTHOR("Clay Chang"); + MODULE_DESCRIPTION("bao ipc through shared-memory sample driver"); +-- +2.34.1 +