All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
	张东旭 <xu910121@sina.com>,
	linux-arm-kernel@lists.infradead.org, dave.martin@arm.com
Subject: [PATCH 1/5] KVM: arm64: Fix build error in user_mem_abort()
Date: Fri,  6 Nov 2020 16:44:12 +0000	[thread overview]
Message-ID: <20201106164416.326787-2-maz@kernel.org> (raw)
In-Reply-To: <20201106164416.326787-1-maz@kernel.org>

From: Gavin Shan <gshan@redhat.com>

The PUD and PMD are folded into PGD when the following options are
enabled. In that case, PUD_SHIFT is equal to PMD_SHIFT and we fail
to build with the indicated errors:

   CONFIG_ARM64_VA_BITS_42=y
   CONFIG_ARM64_PAGE_SHIFT=16
   CONFIG_PGTABLE_LEVELS=3

   arch/arm64/kvm/mmu.c: In function ‘user_mem_abort’:
   arch/arm64/kvm/mmu.c:798:2: error: duplicate case value
     case PMD_SHIFT:
     ^~~~
   arch/arm64/kvm/mmu.c:791:2: note: previously used here
     case PUD_SHIFT:
     ^~~~

This fixes the issue by skipping the check on PUD huge page when PUD
and PMD are folded into PGD.

Fixes: 2f40c46021bbb ("KVM: arm64: Use fallback mapping sizes for contiguous huge page sizes")
Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201103003009.32955-1-gshan@redhat.com
---
 arch/arm64/kvm/mmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index c7c6df6309d5..a109c5001827 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -788,10 +788,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 	}
 
 	switch (vma_shift) {
+#ifndef __PAGETABLE_PMD_FOLDED
 	case PUD_SHIFT:
 		if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
 			break;
 		fallthrough;
+#endif
 	case CONT_PMD_SHIFT:
 		vma_shift = PMD_SHIFT;
 		fallthrough;
-- 
2.28.0

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

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Andrew Jones" <drjones@redhat.com>,
	"Gavin Shan" <gshan@redhat.com>,
	kvm@vger.kernel.org, "Suzuki K Poulose" <suzuki.poulose@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	"Eric Auger" <eric.auger@redhat.com>, 张东旭 <xu910121@sina.com>,
	linux-arm-kernel@lists.infradead.org,
	"James Morse" <james.morse@arm.com>,
	dave.martin@arm.com,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>
Subject: [PATCH 1/5] KVM: arm64: Fix build error in user_mem_abort()
Date: Fri,  6 Nov 2020 16:44:12 +0000	[thread overview]
Message-ID: <20201106164416.326787-2-maz@kernel.org> (raw)
In-Reply-To: <20201106164416.326787-1-maz@kernel.org>

From: Gavin Shan <gshan@redhat.com>

The PUD and PMD are folded into PGD when the following options are
enabled. In that case, PUD_SHIFT is equal to PMD_SHIFT and we fail
to build with the indicated errors:

   CONFIG_ARM64_VA_BITS_42=y
   CONFIG_ARM64_PAGE_SHIFT=16
   CONFIG_PGTABLE_LEVELS=3

   arch/arm64/kvm/mmu.c: In function ‘user_mem_abort’:
   arch/arm64/kvm/mmu.c:798:2: error: duplicate case value
     case PMD_SHIFT:
     ^~~~
   arch/arm64/kvm/mmu.c:791:2: note: previously used here
     case PUD_SHIFT:
     ^~~~

This fixes the issue by skipping the check on PUD huge page when PUD
and PMD are folded into PGD.

Fixes: 2f40c46021bbb ("KVM: arm64: Use fallback mapping sizes for contiguous huge page sizes")
Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201103003009.32955-1-gshan@redhat.com
---
 arch/arm64/kvm/mmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index c7c6df6309d5..a109c5001827 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -788,10 +788,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 	}
 
 	switch (vma_shift) {
+#ifndef __PAGETABLE_PMD_FOLDED
 	case PUD_SHIFT:
 		if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
 			break;
 		fallthrough;
+#endif
 	case CONT_PMD_SHIFT:
 		vma_shift = PMD_SHIFT;
 		fallthrough;
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Andrew Jones" <drjones@redhat.com>,
	"Eric Auger" <eric.auger@redhat.com>,
	"Gavin Shan" <gshan@redhat.com>, 张东旭 <xu910121@sina.com>,
	dave.martin@arm.com, "James Morse" <james.morse@arm.com>,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] KVM: arm64: Fix build error in user_mem_abort()
Date: Fri,  6 Nov 2020 16:44:12 +0000	[thread overview]
Message-ID: <20201106164416.326787-2-maz@kernel.org> (raw)
In-Reply-To: <20201106164416.326787-1-maz@kernel.org>

From: Gavin Shan <gshan@redhat.com>

The PUD and PMD are folded into PGD when the following options are
enabled. In that case, PUD_SHIFT is equal to PMD_SHIFT and we fail
to build with the indicated errors:

   CONFIG_ARM64_VA_BITS_42=y
   CONFIG_ARM64_PAGE_SHIFT=16
   CONFIG_PGTABLE_LEVELS=3

   arch/arm64/kvm/mmu.c: In function ‘user_mem_abort’:
   arch/arm64/kvm/mmu.c:798:2: error: duplicate case value
     case PMD_SHIFT:
     ^~~~
   arch/arm64/kvm/mmu.c:791:2: note: previously used here
     case PUD_SHIFT:
     ^~~~

This fixes the issue by skipping the check on PUD huge page when PUD
and PMD are folded into PGD.

Fixes: 2f40c46021bbb ("KVM: arm64: Use fallback mapping sizes for contiguous huge page sizes")
Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201103003009.32955-1-gshan@redhat.com
---
 arch/arm64/kvm/mmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index c7c6df6309d5..a109c5001827 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -788,10 +788,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 	}
 
 	switch (vma_shift) {
+#ifndef __PAGETABLE_PMD_FOLDED
 	case PUD_SHIFT:
 		if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
 			break;
 		fallthrough;
+#endif
 	case CONT_PMD_SHIFT:
 		vma_shift = PMD_SHIFT;
 		fallthrough;
-- 
2.28.0


  reply	other threads:[~2020-11-06 16:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 16:44 [GIT PULL] KVM/arm64 fixes for 5.10, take #2 Marc Zyngier
2020-11-06 16:44 ` Marc Zyngier
2020-11-06 16:44 ` Marc Zyngier
2020-11-06 16:44 ` Marc Zyngier [this message]
2020-11-06 16:44   ` [PATCH 1/5] KVM: arm64: Fix build error in user_mem_abort() Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44 ` [PATCH 2/5] KVM: arm64: Don't hide ID registers from userspace Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44 ` [PATCH 3/5] KVM: arm64: Consolidate REG_HIDDEN_GUEST/USER Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44 ` [PATCH 4/5] KVM: arm64: Check RAZ visibility in ID register accessors Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44 ` [PATCH 5/5] KVM: arm64: Remove AA64ZFR0_EL1 accessors Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-06 16:44   ` Marc Zyngier
2020-11-08  9:15 ` [GIT PULL] KVM/arm64 fixes for 5.10, take #2 Paolo Bonzini
2020-11-08  9:15   ` Paolo Bonzini
2020-11-08  9:15   ` Paolo Bonzini

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=20201106164416.326787-2-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=dave.martin@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pbonzini@redhat.com \
    --cc=xu910121@sina.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.