From: Andrew Jones <andrew.jones@linux.dev>
To: kvm-riscv@lists.infradead.org
Subject: [kvm-unit-tests PATCH 4/3] riscv: Provide helpers for IPIs
Date: Fri, 30 Aug 2024 13:01:36 +0200 [thread overview]
Message-ID: <20240830110135.2232665-2-andrew.jones@linux.dev> (raw)
In-Reply-To: <20240830101221.2202707-5-andrew.jones@linux.dev>
Provide a few functions to enable/disable/acknowledge IPIs.
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---
lib/riscv/asm/csr.h | 3 ++-
lib/riscv/asm/processor.h | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/riscv/asm/csr.h b/lib/riscv/asm/csr.h
index 24b333e02589..16f5ddd762de 100644
--- a/lib/riscv/asm/csr.h
+++ b/lib/riscv/asm/csr.h
@@ -51,7 +51,8 @@
#define IRQ_S_GEXT 12
#define IRQ_PMU_OVF 13
-#define IE_TIE (_AC(0x1, UL) << IRQ_S_TIMER)
+#define IE_SSIE (_AC(1, UL) << IRQ_S_SOFT)
+#define IE_TIE (_AC(1, UL) << IRQ_S_TIMER)
#define IP_TIP IE_TIE
diff --git a/lib/riscv/asm/processor.h b/lib/riscv/asm/processor.h
index 4c9ad968460d..8989d8d686f9 100644
--- a/lib/riscv/asm/processor.h
+++ b/lib/riscv/asm/processor.h
@@ -32,6 +32,21 @@ static inline void local_irq_disable(void)
csr_clear(CSR_SSTATUS, SR_SIE);
}
+static inline void local_ipi_enable(void)
+{
+ csr_set(CSR_SIE, IE_SSIE);
+}
+
+static inline void local_ipi_disable(void)
+{
+ csr_clear(CSR_SIE, IE_SSIE);
+}
+
+static inline void ipi_ack(void)
+{
+ csr_clear(CSR_SIP, IE_SSIE);
+}
+
void install_exception_handler(unsigned long cause, void (*handler)(struct pt_regs *));
void install_irq_handler(unsigned long cause, void (*handler)(struct pt_regs *));
void do_handle_exception(struct pt_regs *regs);
--
2.45.2
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Jones <andrew.jones@linux.dev>
To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org
Cc: atishp@rivosinc.com, cade.richard@berkeley.edu, jamestiotio@gmail.com
Subject: [kvm-unit-tests PATCH 4/3] riscv: Provide helpers for IPIs
Date: Fri, 30 Aug 2024 13:01:36 +0200 [thread overview]
Message-ID: <20240830110135.2232665-2-andrew.jones@linux.dev> (raw)
In-Reply-To: <20240830101221.2202707-5-andrew.jones@linux.dev>
Provide a few functions to enable/disable/acknowledge IPIs.
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---
lib/riscv/asm/csr.h | 3 ++-
lib/riscv/asm/processor.h | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/riscv/asm/csr.h b/lib/riscv/asm/csr.h
index 24b333e02589..16f5ddd762de 100644
--- a/lib/riscv/asm/csr.h
+++ b/lib/riscv/asm/csr.h
@@ -51,7 +51,8 @@
#define IRQ_S_GEXT 12
#define IRQ_PMU_OVF 13
-#define IE_TIE (_AC(0x1, UL) << IRQ_S_TIMER)
+#define IE_SSIE (_AC(1, UL) << IRQ_S_SOFT)
+#define IE_TIE (_AC(1, UL) << IRQ_S_TIMER)
#define IP_TIP IE_TIE
diff --git a/lib/riscv/asm/processor.h b/lib/riscv/asm/processor.h
index 4c9ad968460d..8989d8d686f9 100644
--- a/lib/riscv/asm/processor.h
+++ b/lib/riscv/asm/processor.h
@@ -32,6 +32,21 @@ static inline void local_irq_disable(void)
csr_clear(CSR_SSTATUS, SR_SIE);
}
+static inline void local_ipi_enable(void)
+{
+ csr_set(CSR_SIE, IE_SSIE);
+}
+
+static inline void local_ipi_disable(void)
+{
+ csr_clear(CSR_SIE, IE_SSIE);
+}
+
+static inline void ipi_ack(void)
+{
+ csr_clear(CSR_SIP, IE_SSIE);
+}
+
void install_exception_handler(unsigned long cause, void (*handler)(struct pt_regs *));
void install_irq_handler(unsigned long cause, void (*handler)(struct pt_regs *));
void do_handle_exception(struct pt_regs *regs);
--
2.45.2
next prev parent reply other threads:[~2024-08-30 11:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 10:12 [kvm-unit-tests PATCH 0/3] riscv: Improve on-cpu and IPI support Andrew Jones
2024-08-30 10:12 ` Andrew Jones
2024-08-30 10:12 ` [kvm-unit-tests PATCH 1/3] lib/cpumask: Fix and simplify a few functions Andrew Jones
2024-08-30 10:12 ` Andrew Jones
2024-08-30 10:12 ` [kvm-unit-tests PATCH 2/3] lib/on-cpus: Introduce on_cpumask and on_cpumask_async Andrew Jones
2024-08-30 10:12 ` Andrew Jones
2024-08-30 10:12 ` [kvm-unit-tests PATCH 3/3] riscv: Introduce SBI IPI convenience functions Andrew Jones
2024-08-30 10:12 ` Andrew Jones
2024-08-30 11:01 ` Andrew Jones [this message]
2024-08-30 11:01 ` [kvm-unit-tests PATCH 4/3] riscv: Provide helpers for IPIs Andrew Jones
2024-09-03 13:41 ` [kvm-unit-tests PATCH 0/3] riscv: Improve on-cpu and IPI support Andrew Jones
2024-09-03 13:41 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240830110135.2232665-2-andrew.jones@linux.dev \
--to=andrew.jones@linux.dev \
--cc=kvm-riscv@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.