All of lore.kernel.org
 help / color / mirror / Atom feed
From: Itaru Kitayama <itaru.kitayama@riken.jp>
To: "kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Subject: [PATCH] KVM: arm64: Check GICV address is placed at a 4Kb boundary
Date: Wed, 29 Jun 2016 15:22:45 +0900	[thread overview]
Message-ID: <cb18ab2d-12d9-bdd2-8432-801af488e340@riken.jp> (raw)

Make sure GICV physical address is placed at a 4Kb boundary as spec 
says, not host kernel's page boundary. This prevents !4Kb kernels from 
returning an ENXIO prematurely during the KVM init phase at boot.
Tested on Overdrive 3000 with 64Kb page-size kernel with ACPI.

Signed-off-by: Itaru Kitayama <itaru.kitayama@riken.jp>
Cc: Marc Zyngier <marc.zyngier@arm.com>


diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c
index e31405e..0123e5d 100644
--- a/virt/kvm/arm/vgic/vgic-v2.c
+++ b/virt/kvm/arm/vgic/vgic-v2.c
@@ -309,17 +309,15 @@ int vgic_v2_probe(const struct gic_kvm_info *info)
                 return -ENXIO;
         }

-       if (!PAGE_ALIGNED(info->vcpu.start)) {
-               kvm_err("GICV physical address 0x%llx not page aligned\n",
+       if (!IS_ALIGNED(info->vcpu.start, SZ_4K)) {
+               kvm_err("GICV physical address 0x%llx not 4Kb aligned\n",
                         (unsigned long long)info->vcpu.start);
                 return -ENXIO;
         }

-       if (!PAGE_ALIGNED(resource_size(&info->vcpu))) {
-               kvm_err("GICV size 0x%llx not a multiple of page size 
0x%lx\n",
-                       (unsigned long long)resource_size(&info->vcpu),
+       if (!PAGE_ALIGNED(resource_size(&info->vcpu)))
+               kvm_warn("GICV size 0x%llx not a multiple of page size 
0x%lx, system may be unsafe\n", (unsigned long 
long)resource_size(&info->vcpu),
                         PAGE_SIZE);
-               return -ENXIO;
         }

         kvm_vgic_global_state.vctrl_base = ioremap(info->vctrl.start,

             reply	other threads:[~2016-06-29  6:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29  6:22 Itaru Kitayama [this message]
2016-06-29 12:43 ` [PATCH] KVM: arm64: Check GICV address is placed at a 4Kb boundary Christoffer Dall
2016-06-30  3:23   ` 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=cb18ab2d-12d9-bdd2-8432-801af488e340@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.