All of lore.kernel.org
 help / color / mirror / Atom feed
From: andre.przywara@arm.com (Andre Przywara)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 16/20] arm64: GICv3: introduce symbolic names for GICv3 ICC_SGI1R_EL1 fields
Date: Wed, 14 Jan 2015 16:31:20 +0000	[thread overview]
Message-ID: <1421253084-9663-17-git-send-email-andre.przywara@arm.com> (raw)
In-Reply-To: <1421253084-9663-1-git-send-email-andre.przywara@arm.com>

The gic_send_sgi() function used hardcoded bit shift values to
generate the ICC_SGI1R_EL1 register value.
Replace this with symbolic names to allow reusing them later.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
---
Changelog v6...v7:
 (none)

Changelog v5...v6:
 (none)

Changelog v4...v5:
 (add Reviewed-by:)

Changelog v3...v4:
- (new patch)

 drivers/irqchip/irq-gic-v3.c       |   14 +++++++++-----
 include/linux/irqchip/arm-gic-v3.h |   12 ++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 1a146cc..2ab290b 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -481,15 +481,19 @@ out:
 	return tlist;
 }
 
+#define MPIDR_TO_SGI_AFFINITY(cluster_id, level) \
+	(MPIDR_AFFINITY_LEVEL(cluster_id, level) \
+		<< ICC_SGI1R_AFFINITY_## level ##_SHIFT)
+
 static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq)
 {
 	u64 val;
 
-	val = (MPIDR_AFFINITY_LEVEL(cluster_id, 3) << 48	|
-	       MPIDR_AFFINITY_LEVEL(cluster_id, 2) << 32	|
-	       irq << 24			    		|
-	       MPIDR_AFFINITY_LEVEL(cluster_id, 1) << 16	|
-	       tlist);
+	val = (MPIDR_TO_SGI_AFFINITY(cluster_id, 3)	|
+	       MPIDR_TO_SGI_AFFINITY(cluster_id, 2)	|
+	       irq << ICC_SGI1R_SGI_ID_SHIFT		|
+	       MPIDR_TO_SGI_AFFINITY(cluster_id, 1)	|
+	       tlist << ICC_SGI1R_TARGET_LIST_SHIFT);
 
 	pr_debug("CPU%d: ICC_SGI1R_EL1 %llx\n", smp_processor_id(), val);
 	gic_write_sgi1r(val);
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 3fb4d85..800544b 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -280,6 +280,18 @@
 #define ICC_SRE_EL2_SRE			(1 << 0)
 #define ICC_SRE_EL2_ENABLE		(1 << 3)
 
+#define ICC_SGI1R_TARGET_LIST_SHIFT	0
+#define ICC_SGI1R_TARGET_LIST_MASK	(0xffff << ICC_SGI1R_TARGET_LIST_SHIFT)
+#define ICC_SGI1R_AFFINITY_1_SHIFT	16
+#define ICC_SGI1R_AFFINITY_1_MASK	(0xff << ICC_SGI1R_AFFINITY_1_SHIFT)
+#define ICC_SGI1R_SGI_ID_SHIFT		24
+#define ICC_SGI1R_SGI_ID_MASK		(0xff << ICC_SGI1R_SGI_ID_SHIFT)
+#define ICC_SGI1R_AFFINITY_2_SHIFT	32
+#define ICC_SGI1R_AFFINITY_2_MASK	(0xffULL << ICC_SGI1R_AFFINITY_1_SHIFT)
+#define ICC_SGI1R_IRQ_ROUTING_MODE_BIT	40
+#define ICC_SGI1R_AFFINITY_3_SHIFT	48
+#define ICC_SGI1R_AFFINITY_3_MASK	(0xffULL << ICC_SGI1R_AFFINITY_1_SHIFT)
+
 /*
  * System register definitions
  */
-- 
1.7.9.5

  parent reply	other threads:[~2015-01-14 16:31 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 16:31 [PATCH v7 00/20] KVM GICv3 emulation Andre Przywara
2015-01-14 16:31 ` [PATCH v7 01/20] arm/arm64: KVM: rework MPIDR assignment and add accessors Andre Przywara
2015-01-14 16:31 ` [PATCH v7 02/20] arm/arm64: KVM: pass down user space provided GIC type into vGIC code Andre Przywara
2015-01-14 16:31 ` [PATCH v7 03/20] arm/arm64: KVM: refactor vgic_handle_mmio() function Andre Przywara
2015-01-14 16:31 ` [PATCH v7 04/20] arm/arm64: KVM: wrap 64 bit MMIO accesses with two 32 bit ones Andre Przywara
2015-01-14 16:31 ` [PATCH v7 05/20] arm/arm64: KVM: introduce per-VM ops Andre Przywara
2015-01-14 16:31 ` [PATCH v7 06/20] arm/arm64: KVM: move kvm_register_device_ops() into vGIC probing Andre Przywara
2015-01-14 16:31 ` [PATCH v7 07/20] arm/arm64: KVM: dont rely on a valid GICH base address Andre Przywara
2015-01-14 16:31 ` [PATCH v7 08/20] arm/arm64: KVM: make the maximum number of vCPUs a per-VM value Andre Przywara
2015-01-15 12:18   ` Christoffer Dall
2015-01-14 16:31 ` [PATCH v7 09/20] arm/arm64: KVM: make the value of ICC_SRE_EL1 a per-VM variable Andre Przywara
2015-01-14 16:31 ` [PATCH v7 10/20] arm/arm64: KVM: refactor MMIO accessors Andre Przywara
2015-01-14 16:31 ` [PATCH v7 11/20] arm/arm64: KVM: refactor/wrap vgic_set/get_attr() Andre Przywara
2015-01-14 16:31 ` [PATCH v7 12/20] arm/arm64: KVM: add vgic.h header file Andre Przywara
2015-01-14 16:31 ` [PATCH v7 13/20] arm/arm64: KVM: split GICv2 specific emulation code from vgic.c Andre Przywara
2015-01-14 16:31 ` [PATCH v7 14/20] arm/arm64: KVM: add opaque private pointer to MMIO data Andre Przywara
2015-01-14 16:31 ` [PATCH v7 15/20] arm/arm64: KVM: add virtual GICv3 distributor emulation Andre Przywara
2015-01-15 12:21   ` Christoffer Dall
2015-01-16 14:11     ` Andre Przywara
2015-01-16 18:55       ` Christoffer Dall
2015-01-14 16:31 ` Andre Przywara [this message]
2015-01-14 16:31 ` [PATCH v7 17/20] arm64: KVM: add SGI generation register emulation Andre Przywara
2015-01-14 16:31 ` [PATCH v7 18/20] arm/arm64: KVM: enable kernel side of GICv3 emulation Andre Przywara
2015-01-15 12:25   ` Christoffer Dall
2015-01-14 16:31 ` [PATCH v7 19/20] arm/arm64: KVM: allow userland to request a virtual GICv3 Andre Przywara
2015-01-15 12:27   ` Christoffer Dall
2015-01-14 16:31 ` [PATCH v7 20/20] arm/arm64: KVM: force alignment of VGIC dist/CPU/redist addresses Andre Przywara
2015-01-15 12:29   ` Christoffer Dall
2015-01-19 10:55 ` [PATCH v7 00/20] KVM GICv3 emulation Andre Przywara
2015-01-19 13:07   ` Christoffer Dall

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=1421253084-9663-17-git-send-email-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=linux-arm-kernel@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.