Thread (20 messages) 20 messages, 3 authors, 2015-10-01
STALE3898d REVIEWED: 2 (0M)

[PATCH v4 03/11] KVM: arm/arm64: vgic: Convert struct vgic_lr to use bitfields

From: Marc Zyngier <hidden>
Date: 2015-08-07 15:45:39
Also in: kvm, kvmarm
Subsystem: kernel virtual machine for arm64 (kvm/arm64), the rest · Maintainers: Marc Zyngier, Oliver Upton, Linus Torvalds

As we're about to cram more information in the vgic_lr structure
(HW interrupt number and additional state information), we switch
to a layout similar to the HW's:

- use bitfields to save space (we don't need more than 10 bits
  to represent the irq numbers)
- source CPU and HW interrupt can share the same field, as
  a SGI doesn't have a physical line.

Reviewed-by: Alex Benn?e <redacted>
Reviewed-by: Christoffer Dall <redacted>
Signed-off-by: Marc Zyngier <redacted>
---
 include/kvm/arm_vgic.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 133ea00..a881e39 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -95,11 +95,15 @@ enum vgic_type {
 #define LR_STATE_ACTIVE		(1 << 1)
 #define LR_STATE_MASK		(3 << 0)
 #define LR_EOI_INT		(1 << 2)
+#define LR_HW			(1 << 3)
 
 struct vgic_lr {
-	u16	irq;
-	u8	source;
-	u8	state;
+	unsigned irq:10;
+	union {
+		unsigned hwirq:10;
+		unsigned source:3;
+	};
+	unsigned state:4;
 };
 
 struct vgic_vmcr {
-- 
2.1.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help