Skip to content

Commit b119518

Browse files
committed
Merge tag 'kvm-s390-next-7.0-1' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
- gmap rewrite: completely new memory management for kvm/s390 - vSIE improvement - maintainership change for s390 vfio-pci - small quality of life improvement for protected guests
2 parents bf2c313 + e3372ff commit b119518

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5920
-5502
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6518,6 +6518,40 @@ the capability to be present.
65186518

65196519
`flags` must currently be zero.
65206520

6521+
4.144 KVM_S390_KEYOP
6522+
--------------------
6523+
6524+
:Capability: KVM_CAP_S390_KEYOP
6525+
:Architectures: s390
6526+
:Type: vm ioctl
6527+
:Parameters: struct kvm_s390_keyop (in/out)
6528+
:Returns: 0 in case of success, < 0 on error
6529+
6530+
The specified key operation is performed on the given guest address. The
6531+
previous storage key (or the relevant part thereof) will be returned in
6532+
`key`.
6533+
6534+
::
6535+
6536+
struct kvm_s390_keyop {
6537+
__u64 guest_addr;
6538+
__u8 key;
6539+
__u8 operation;
6540+
};
6541+
6542+
Currently supported values for ``operation``:
6543+
6544+
KVM_S390_KEYOP_ISKE
6545+
Returns the storage key for the guest address ``guest_addr`` in ``key``.
6546+
6547+
KVM_S390_KEYOP_RRBE
6548+
Resets the reference bit for the guest address ``guest_addr``, returning the
6549+
R and C bits of the old storage key in ``key``; the remaining fields of
6550+
the storage key will be set to 0.
6551+
6552+
KVM_S390_KEYOP_SSKE
6553+
Sets the storage key for the guest address ``guest_addr`` to the key
6554+
specified in ``key``, returning the previous value in ``key``.
65216555

65226556
.. _kvm_run:
65236557

@@ -9384,6 +9418,14 @@ The presence of this capability indicates that KVM_RUN will update the
93849418
KVM_RUN_X86_GUEST_MODE bit in kvm_run.flags to indicate whether the
93859419
vCPU was executing nested guest code when it exited.
93869420

9421+
8.46 KVM_CAP_S390_KEYOP
9422+
-----------------------
9423+
9424+
:Architectures: s390
9425+
9426+
The presence of this capability indicates that the KVM_S390_KEYOP ioctl is
9427+
available.
9428+
93879429
KVM exits with the register state of either the L1 or L2 guest
93889430
depending on which executed at the time of an exit. Userspace must
93899431
take care to differentiate between these cases.

MAINTAINERS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13914,14 +13914,12 @@ L: kvm@vger.kernel.org
1391413914
S: Supported
1391513915
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
1391613916
F: Documentation/virt/kvm/s390*
13917-
F: arch/s390/include/asm/gmap.h
1391813917
F: arch/s390/include/asm/gmap_helpers.h
1391913918
F: arch/s390/include/asm/kvm*
1392013919
F: arch/s390/include/uapi/asm/kvm*
1392113920
F: arch/s390/include/uapi/asm/uvdevice.h
1392213921
F: arch/s390/kernel/uv.c
1392313922
F: arch/s390/kvm/
13924-
F: arch/s390/mm/gmap.c
1392513923
F: arch/s390/mm/gmap_helpers.c
1392613924
F: drivers/s390/char/uvdevice.c
1392713925
F: tools/testing/selftests/drivers/s390x/uvdevice/
@@ -23111,7 +23109,8 @@ F: include/uapi/linux/vfio_ccw.h
2311123109

2311223110
S390 VFIO-PCI DRIVER
2311323111
M: Matthew Rosato <mjrosato@linux.ibm.com>
23114-
M: Eric Farman <farman@linux.ibm.com>
23112+
M: Farhan Ali <alifm@linux.ibm.com>
23113+
R: Eric Farman <farman@linux.ibm.com>
2311523114
L: linux-s390@vger.kernel.org
2311623115
L: kvm@vger.kernel.org
2311723116
S: Supported

arch/s390/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ config GENERIC_BUG_RELATIVE_POINTERS
3232
config GENERIC_LOCKBREAK
3333
def_bool y if PREEMPTION
3434

35-
config PGSTE
36-
def_bool y if KVM
37-
3835
config AUDIT_ARCH
3936
def_bool y
4037

arch/s390/include/asm/dat-bits.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,32 @@
99
#ifndef _S390_DAT_BITS_H
1010
#define _S390_DAT_BITS_H
1111

12+
/*
13+
* vaddress union in order to easily decode a virtual address into its
14+
* region first index, region second index etc. parts.
15+
*/
16+
union vaddress {
17+
unsigned long addr;
18+
struct {
19+
unsigned long rfx : 11;
20+
unsigned long rsx : 11;
21+
unsigned long rtx : 11;
22+
unsigned long sx : 11;
23+
unsigned long px : 8;
24+
unsigned long bx : 12;
25+
};
26+
struct {
27+
unsigned long rfx01 : 2;
28+
unsigned long : 9;
29+
unsigned long rsx01 : 2;
30+
unsigned long : 9;
31+
unsigned long rtx01 : 2;
32+
unsigned long : 9;
33+
unsigned long sx01 : 2;
34+
unsigned long : 29;
35+
};
36+
};
37+
1238
union asce {
1339
unsigned long val;
1440
struct {
@@ -98,7 +124,8 @@ union region3_table_entry {
98124
struct {
99125
unsigned long : 53;
100126
unsigned long fc: 1; /* Format-Control */
101-
unsigned long : 4;
127+
unsigned long p : 1; /* DAT-Protection Bit */
128+
unsigned long : 3;
102129
unsigned long i : 1; /* Region-Invalid Bit */
103130
unsigned long cr: 1; /* Common-Region Bit */
104131
unsigned long tt: 2; /* Table-Type Bits */
@@ -140,7 +167,8 @@ union segment_table_entry {
140167
struct {
141168
unsigned long : 53;
142169
unsigned long fc: 1; /* Format-Control */
143-
unsigned long : 4;
170+
unsigned long p : 1; /* DAT-Protection Bit */
171+
unsigned long : 3;
144172
unsigned long i : 1; /* Segment-Invalid Bit */
145173
unsigned long cs: 1; /* Common-Segment Bit */
146174
unsigned long tt: 2; /* Table-Type Bits */

arch/s390/include/asm/gmap.h

Lines changed: 0 additions & 174 deletions
This file was deleted.

arch/s390/include/asm/gmap_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
void gmap_helper_zap_one_page(struct mm_struct *mm, unsigned long vmaddr);
1212
void gmap_helper_discard(struct mm_struct *mm, unsigned long vmaddr, unsigned long end);
1313
int gmap_helper_disable_cow_sharing(void);
14+
void gmap_helper_try_set_pte_unused(struct mm_struct *mm, unsigned long vmaddr);
1415

1516
#endif /* _ASM_S390_GMAP_HELPERS_H */

arch/s390/include/asm/hugetlb.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
3737
return __huge_ptep_get_and_clear(mm, addr, ptep);
3838
}
3939

40-
static inline void arch_clear_hugetlb_flags(struct folio *folio)
41-
{
42-
clear_bit(PG_arch_1, &folio->flags.f);
43-
}
44-
#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
45-
4640
#define __HAVE_ARCH_HUGE_PTE_CLEAR
4741
static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
4842
pte_t *ptep, unsigned long sz)

arch/s390/include/asm/kvm_host.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <asm/isc.h>
2828
#include <asm/guarded_storage.h>
2929

30+
#define KVM_HAVE_MMU_RWLOCK
3031
#define KVM_MAX_VCPUS 255
3132

3233
#define KVM_INTERNAL_MEM_SLOTS 1
@@ -441,6 +442,7 @@ struct kvm_vcpu_arch {
441442
bool acrs_loaded;
442443
struct kvm_s390_pv_vcpu pv;
443444
union diag318_info diag318_info;
445+
struct kvm_s390_mmu_cache *mc;
444446
};
445447

446448
struct kvm_vm_stat {
@@ -630,8 +632,12 @@ struct kvm_s390_pv {
630632
void *set_aside;
631633
struct list_head need_cleanup;
632634
struct mmu_notifier mmu_notifier;
635+
/* Protects against concurrent import-like operations */
636+
struct mutex import_lock;
633637
};
634638

639+
struct kvm_s390_mmu_cache;
640+
635641
struct kvm_arch {
636642
struct esca_block *sca;
637643
debug_info_t *dbf;
@@ -671,6 +677,7 @@ struct kvm_arch {
671677
struct kvm_s390_pv pv;
672678
struct list_head kzdev_list;
673679
spinlock_t kzdev_list_lock;
680+
struct kvm_s390_mmu_cache *mc;
674681
};
675682

676683
#define KVM_HVA_ERR_BAD (-1UL)

0 commit comments

Comments
 (0)