mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Song Gao <gaosong@loongson.cn>
To: maobibo@loongson.cn, chenhuacai@kernel.org
Cc: kvm@vger.kernel.org, loongarch@lists.linux.dev,
	kernel@xen0n.name, linux-kernel@vger.kernel.org,
	lixianglai@loongson.cn
Subject: [PATCH v3 1/4] LongArch: KVM: Add some maccros for AVEC
Date: Sat,  6 Dec 2025 14:46:55 +0800	[thread overview]
Message-ID: <20251206064658.714100-2-gaosong@loongson.cn> (raw)
In-Reply-To: <20251206064658.714100-1-gaosong@loongson.cn>

Add some maccros for AVEC interrupt controller, so the dintc can use
those maccros.

Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 arch/loongarch/include/asm/irq.h     | 8 ++++++++
 drivers/irqchip/irq-loongarch-avec.c | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/loongarch/include/asm/irq.h b/arch/loongarch/include/asm/irq.h
index 12bd15578c33..aaa022fcb9e3 100644
--- a/arch/loongarch/include/asm/irq.h
+++ b/arch/loongarch/include/asm/irq.h
@@ -50,6 +50,14 @@ void spurious_interrupt(void);
 #define NR_LEGACY_VECTORS	16
 #define IRQ_MATRIX_BITS		NR_VECTORS
 
+#define AVEC_VIRQ_SHIFT		4
+#define AVEC_VIRQ_BIT		8
+#define AVEC_VIRQ_MASK		GENMASK(AVEC_VIRQ_BIT - 1, 0)
+#define AVEC_CPU_SHIFT		12
+#define AVEC_CPU_BIT		16
+#define AVEC_CPU_MASK		GENMASK(AVEC_CPU_BIT - 1, 0)
+
+
 #define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
 void arch_trigger_cpumask_backtrace(const struct cpumask *mask, int exclude_cpu);
 
diff --git a/drivers/irqchip/irq-loongarch-avec.c b/drivers/irqchip/irq-loongarch-avec.c
index bf52dc8345f5..f0118cfd4363 100644
--- a/drivers/irqchip/irq-loongarch-avec.c
+++ b/drivers/irqchip/irq-loongarch-avec.c
@@ -209,8 +209,9 @@ static void avecintc_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
 	struct avecintc_data *adata = irq_data_get_irq_chip_data(d);
 
 	msg->address_hi = 0x0;
-	msg->address_lo = (loongarch_avec.msi_base_addr | (adata->vec & 0xff) << 4)
-			  | ((cpu_logical_map(adata->cpu & 0xffff)) << 12);
+	msg->address_lo = (loongarch_avec.msi_base_addr |
+			(adata->vec & AVEC_VIRQ_MASK) << AVEC_VIRQ_SHIFT) |
+			((cpu_logical_map(adata->cpu & AVEC_CPU_MASK)) << AVEC_CPU_SHIFT);
 	msg->data = 0x0;
 }
 
-- 
2.39.3


  reply	other threads:[~2025-12-06  7:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-06  6:46 [PATCH v3 0/4] LongArch: KVM: Add AVEC support irqchip in kernel Song Gao
2025-12-06  6:46 ` Song Gao [this message]
2025-12-08  3:45   ` [PATCH v3 1/4] LongArch: KVM: Add some maccros for AVEC Bibo Mao
2025-12-06  6:46 ` [PATCH v3 2/4] LongArch: KVM: Add DINTC device support Song Gao
2025-12-08  3:54   ` Bibo Mao
2025-12-06  6:46 ` [PATCH v3 3/4] LongArch: KVM: Add irqfd set dintc msi Song Gao
2025-12-08  3:58   ` Bibo Mao
2025-12-06  6:46 ` [PATCH v3 4/4] LongArch: KVM: Add dintc inject msi to the dest vcpu Song Gao
2025-12-08  4:04   ` Bibo Mao
2025-12-13 12:39 ` [PATCH v3 0/4] LongArch: KVM: Add AVEC support irqchip in kernel Huacai Chen

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=20251206064658.714100-2-gaosong@loongson.cn \
    --to=gaosong@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixianglai@loongson.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®