All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
@ 2016-07-01  4:57 Itaru Kitayama
  2016-07-01  8:40 ` Marc Zyngier
  0 siblings, 1 reply; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-01  4:57 UTC (permalink / raw)
  To: kvmarm; +Cc: marc.zyngier


[-- Attachment #1.1: Type: text/plain, Size: 2435 bytes --]

This is merely an update to the patch Marc posted in 2014:

https://lists.cs.columbia.edu/pipermail/kvmarm/2014-June/010055.html

This updated patch is against today's current kvmarm git tree tag, 
kvm-for-arm-v4.7-rc6.

The GIC CPU interface is always 4k aligned. If the host is using
64k pages, it is critical to place the guest's GICC interface at the
same relative alignment as the host's GICV. Failure to do so results
in an impossibility for the guest to deal with interrupts.

Add a KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute for the VGIC, allowing
userspace to retrieve the GICV offset in a page. It becomes then trivial
to adjust the GICC base address for the guest.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com <https://lists.cs.columbia.edu/mailman/listinfo/kvmarm>>
Signed-off-by: Itaru Kitayama <itaru.kitayama@riken.jp>

diff --git a/arch/arm64/include/uapi/asm/kvm.h 
b/arch/arm64/include/uapi/asm/kvm.h
index f209ea1..803b097 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -203,6 +203,7 @@ struct kvm_arch_memory_slot {
  #define   KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << 
KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
  #define KVM_DEV_ARM_VGIC_GRP_NR_IRQS   3
  #define KVM_DEV_ARM_VGIC_GRP_CTRL      4
+#define KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET 5
  #define   KVM_DEV_ARM_VGIC_CTRL_INIT   0

  /* Device Control API on vcpu fd */
diff --git a/virt/kvm/arm/vgic/vgic-kvm-device.c 
b/virt/kvm/arm/vgic/vgic-kvm-device.c
index 850eb88..3e33778 100644
--- a/virt/kvm/arm/vgic/vgic-kvm-device.c
+++ b/virt/kvm/arm/vgic/vgic-kvm-device.c
@@ -196,8 +196,14 @@ static int vgic_get_common_attr(struct kvm_device *dev,
                              VGIC_NR_PRIVATE_IRQS, uaddr);
                 break;
         }
+       case KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET: {
+               u32 __user *uaddr = (u32 __user *)(long)attr->addr;
+               u32 val = kvm_vgic_global_state.vcpu_base & ~PAGE_MASK;
+               r = put_user(val, uaddr);
+               break;
         }

+       }
         return r;
  }

@@ -362,6 +368,7 @@ static int vgic_v2_has_attr(struct kvm_device *dev,
         case KVM_DEV_ARM_VGIC_GRP_CPU_REGS:
                 return vgic_v2_has_attr_regs(dev, attr);
         case KVM_DEV_ARM_VGIC_GRP_NR_IRQS:
+       case KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET:
                 return 0;
         case KVM_DEV_ARM_VGIC_GRP_CTRL:
                 switch (attr->attr) {

[-- Attachment #1.2: Type: text/html, Size: 3830 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-07-10  6:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01  4:57 [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment Itaru Kitayama
2016-07-01  8:40 ` Marc Zyngier
2016-07-01  8:59   ` Itaru Kitayama
2016-07-01  9:20     ` Marc Zyngier
2016-07-09  0:27       ` Itaru Kitayama
2016-07-09  0:34         ` Itaru Kitayama
2016-07-09 10:08         ` Marc Zyngier
2016-07-09 10:32           ` Itaru Kitayama
2016-07-09 20:09             ` Marc Zyngier
2016-07-10  6:49               ` Itaru Kitayama

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.