From: Itaru Kitayama <itaru.kitayama@riken.jp>
To: kvmarm@lists.cs.columbia.edu
Cc: marc.zyngier@arm.com
Subject: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
Date: Fri, 1 Jul 2016 13:57:56 +0900 [thread overview]
Message-ID: <5775F854.3060306@riken.jp> (raw)
[-- 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
next reply other threads:[~2016-07-01 4:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 4:57 Itaru Kitayama [this message]
2016-07-01 8:40 ` [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment 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
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=5775F854.3060306@riken.jp \
--to=itaru.kitayama@riken.jp \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=marc.zyngier@arm.com \
/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.