1
0
forked from rpms/kernel

Compare commits

...

5 Commits

Author SHA1 Message Date
c91222a086 Merge branch 'a9' into a9-ppc64le 2024-02-27 15:31:05 +03:00
a05eef1a2b Fix compilation error 2023-12-07 18:04:09 +03:00
d4e07315a1 Merge branch 'a9' into a9-ppc64le 2023-12-07 16:59:02 +03:00
2bb8a3f5fc Update PPC configs 2023-03-29 19:02:49 +02:00
c8588126da Enable KVM on ppc64le 2023-03-29 18:35:14 +02:00
5 changed files with 220 additions and 3 deletions

View File

@ -0,0 +1,12 @@
diff -aruN linux-5.14.0-362.8.1.el9_3/arch/powerpc/kvm/book3s_64_vio_hv.c linux-5.14.0-362.8.1.el9_3.alma/arch/powerpc/kvm/book3s_64_vio_hv.c
--- linux-5.14.0-362.8.1.el9_3/arch/powerpc/kvm/book3s_64_vio_hv.c 2023-11-07 20:57:43
+++ linux-5.14.0-362.8.1.el9_3.alma/arch/powerpc/kvm/book3s_64_vio_hv.c 2023-12-07 17:59:41
@@ -488,7 +488,7 @@
/*
* used to check for invalidations in progress
*/
- mmu_seq = kvm->mmu_notifier_seq;
+ mmu_seq = kvm->mmu_invalidate_seq;
smp_rmb();
stt = kvmppc_find_table(vcpu->kvm, liobn);

View File

@ -0,0 +1,190 @@
From eaaaed137eccb9e8f3a88f6297e214f53885196f Mon Sep 17 00:00:00 2001
From: Sean Christopherson <seanjc@google.com>
Date: Mon, 6 Dec 2021 20:54:14 +0100
Subject: [PATCH] KVM: PPC: Avoid referencing userspace memory region in
memslot updates
For PPC HV, get the number of pages directly from the new memslot instead
of computing the same from the userspace memory region, and explicitly
check for !DELETE instead of inferring the same when toggling mmio_update.
The motivation for these changes is to avoid referencing the @mem param
so that it can be dropped in a future commit.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Message-Id: <1e97fb5198be25f98ef82e63a8d770c682264cc9.1638817639.git.maciej.szmigiero@oracle.com>
---
arch/powerpc/include/asm/kvm_ppc.h | 4 ----
arch/powerpc/kvm/book3s.c | 6 ++----
arch/powerpc/kvm/book3s_hv.c | 12 +++---------
arch/powerpc/kvm/book3s_pr.c | 2 --
arch/powerpc/kvm/booke.c | 2 --
arch/powerpc/kvm/powerpc.c | 4 ++--
6 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index b01760dd1374df..935c58dc38c493 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -200,12 +200,10 @@ extern void kvmppc_core_destroy_vm(struct kvm *kvm);
extern void kvmppc_core_free_memslot(struct kvm *kvm,
struct kvm_memory_slot *slot);
extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
struct kvm_memory_slot *new,
enum kvm_mr_change change);
extern void kvmppc_core_commit_memory_region(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change);
@@ -275,12 +273,10 @@ struct kvmppc_ops {
int (*get_dirty_log)(struct kvm *kvm, struct kvm_dirty_log *log);
void (*flush_memslot)(struct kvm *kvm, struct kvm_memory_slot *memslot);
int (*prepare_memory_region)(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
struct kvm_memory_slot *new,
enum kvm_mr_change change);
void (*commit_memory_region)(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change);
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 8250e8308674c7..6d525285dbe8f2 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -847,21 +847,19 @@ void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)
}
int kvmppc_core_prepare_memory_region(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- return kvm->arch.kvm_ops->prepare_memory_region(kvm, mem, old, new, change);
+ return kvm->arch.kvm_ops->prepare_memory_region(kvm, old, new, change);
}
void kvmppc_core_commit_memory_region(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new, change);
+ kvm->arch.kvm_ops->commit_memory_region(kvm, old, new, change);
}
bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index d7594d49d288a3..2b59ecc5f8c698 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4854,15 +4854,12 @@ static void kvmppc_core_free_memslot_hv(struct kvm_memory_slot *slot)
}
static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- unsigned long npages = mem->memory_size >> PAGE_SHIFT;
-
if (change == KVM_MR_CREATE) {
- new->arch.rmap = vzalloc(array_size(npages,
+ new->arch.rmap = vzalloc(array_size(new->npages,
sizeof(*new->arch.rmap)));
if (!new->arch.rmap)
return -ENOMEM;
@@ -4874,20 +4871,17 @@ static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
}
static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- unsigned long npages = mem->memory_size >> PAGE_SHIFT;
-
/*
- * If we are making a new memslot, it might make
+ * If we are creating or modifying a memslot, it might make
* some address that was previously cached as emulated
* MMIO be no longer emulated MMIO, so invalidate
* all the caches of emulated MMIO translations.
*/
- if (npages)
+ if (change != KVM_MR_DELETE)
atomic64_inc(&kvm->arch.mmio_update);
/*
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index ffb559cf25f435..30426e8c8cf66b 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1899,7 +1899,6 @@ static void kvmppc_core_flush_memslot_pr(struct kvm *kvm,
}
static int kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
struct kvm_memory_slot *new,
enum kvm_mr_change change)
@@ -1908,7 +1907,6 @@ static int kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
}
static void kvmppc_core_commit_memory_region_pr(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 93c2ac2bee0913..53b4c9597c303e 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1821,7 +1821,6 @@ void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot)
}
int kvmppc_core_prepare_memory_region(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
struct kvm_memory_slot *new,
enum kvm_mr_change change)
@@ -1830,7 +1829,6 @@ int kvmppc_core_prepare_memory_region(struct kvm *kvm,
}
void kvmppc_core_commit_memory_region(struct kvm *kvm,
- const struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index e875874cf8367d..575140ecb23c82 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -703,7 +703,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- return kvmppc_core_prepare_memory_region(kvm, mem, old, new, change);
+ return kvmppc_core_prepare_memory_region(kvm, old, new, change);
}
void kvm_arch_commit_memory_region(struct kvm *kvm,
@@ -712,7 +712,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
const struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
- kvmppc_core_commit_memory_region(kvm, mem, old, new, change);
+ kvmppc_core_commit_memory_region(kvm, old, new, change);
}
void kvm_arch_flush_shadow_memslot(struct kvm *kvm,

View File

@ -2559,7 +2559,12 @@ CONFIG_KUNIT_EXAMPLE_TEST=m
CONFIG_KUNIT=m CONFIG_KUNIT=m
CONFIG_KUNIT_TEST=m CONFIG_KUNIT_TEST=m
CONFIG_KVM_AMD_SEV=y CONFIG_KVM_AMD_SEV=y
# CONFIG_KVM_BOOK3S_64 is not set CONFIG_KVM_BOOK3S_64=m
CONFIG_KVM_BOOK3S_64_HV=m
# CONFIG_KVM_BOOK3S_64_PR is not set
# CONFIG_KVM_BOOK3S_HV_EXIT_TIMING is not set
CONFIG_KVM_BOOK3S_PR_POSSIBLE=y
CONFIG_KVM_XICS=y
CONFIG_KVM_GUEST=y CONFIG_KVM_GUEST=y
CONFIG_KVM_SMM=y CONFIG_KVM_SMM=y
# CONFIG_KVM_XEN is not set # CONFIG_KVM_XEN is not set

View File

@ -2539,7 +2539,12 @@ CONFIG_KUNIT_EXAMPLE_TEST=m
CONFIG_KUNIT=m CONFIG_KUNIT=m
CONFIG_KUNIT_TEST=m CONFIG_KUNIT_TEST=m
CONFIG_KVM_AMD_SEV=y CONFIG_KVM_AMD_SEV=y
# CONFIG_KVM_BOOK3S_64 is not set CONFIG_KVM_BOOK3S_64=m
CONFIG_KVM_BOOK3S_64_HV=m
# CONFIG_KVM_BOOK3S_64_PR is not set
# CONFIG_KVM_BOOK3S_HV_EXIT_TIMING is not set
CONFIG_KVM_BOOK3S_PR_POSSIBLE=y
CONFIG_KVM_XICS=y
CONFIG_KVM_GUEST=y CONFIG_KVM_GUEST=y
CONFIG_KVM_SMM=y CONFIG_KVM_SMM=y
# CONFIG_KVM_XEN is not set # CONFIG_KVM_XEN is not set

View File

@ -627,7 +627,7 @@ Name: kernel
License: GPLv2 and Redistributable, no modification permitted License: GPLv2 and Redistributable, no modification permitted
URL: https://www.kernel.org/ URL: https://www.kernel.org/
Version: %{specversion} Version: %{specversion}
Release: %{pkg_release} Release: %{pkg_release}.kvm
# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD. # DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
# SET %%nobuildarches (ABOVE) INSTEAD # SET %%nobuildarches (ABOVE) INSTEAD
%if 0%{?fedora} %if 0%{?fedora}
@ -948,8 +948,11 @@ Patch1: patch-%{patchversion}-redhat.patch
%endif %endif
# AlmaLinux patches # AlmaLinux patches
Patch100: eaaaed137eccb9e8f3a88f6297e214f53885196f.patch
Patch101: Rename-mmu_notifier_seq-to-mmu_invalidate_seq-in-book3s_64_vio_hv.patch
Patch1001: 0001-nvme-pci-add-BOGUS_NID-for-Intel-0a54-device.patch Patch1001: 0001-nvme-pci-add-BOGUS_NID-for-Intel-0a54-device.patch
# empty final patch to facilitate testing of kernel patches # empty final patch to facilitate testing of kernel patches
Patch999999: linux-kernel-test.patch Patch999999: linux-kernel-test.patch
@ -1695,6 +1698,8 @@ ApplyOptionalPatch patch-%{patchversion}-redhat.patch
%endif %endif
ApplyPatch 0001-nvme-pci-add-BOGUS_NID-for-Intel-0a54-device.patch ApplyPatch 0001-nvme-pci-add-BOGUS_NID-for-Intel-0a54-device.patch
ApplyOptionalPatch eaaaed137eccb9e8f3a88f6297e214f53885196f.patch
ApplyOptionalPatch Rename-mmu_notifier_seq-to-mmu_invalidate_seq-in-book3s_64_vio_hv.patch
ApplyOptionalPatch linux-kernel-test.patch ApplyOptionalPatch linux-kernel-test.patch