Skip to contentSkip to conversation

KVM: arm64: Increase number of user memslots

PATCH In review [email protected] 3 participants 7 messages Mar 8, 2017 – Mar 9, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover KVM: arm64: Increase number of user memslots

From: Linu Cherian <[email protected]>

v3 -> v4:
- Add missing commit messages in patches 1 and 3

v2 -> v3:
- Added documentation for KVM_CAP_NR_MEMSLOTS
- Removed KVM_PRIVATE_MEM_SLOTS which is unused
- KVM_USER_MEM_SLOTS changed to 512 from 508

v1 -> v2:
- Enabling KVM_CAP_NR_MEMSLOTS for arm/arm64 moved to separate patch.
- Updated commit message so that what is reported to userspace is explicit.

Linu Cherian (4):
KVM: Add documentation for KVM_CAP_NR_MEMSLOTS
KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64
KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are
unused
KVM: arm64: Increase number of user memslots to 512

 Documentation/virtual/kvm/api.txt | 4 ++++
 arch/arm/include/asm/kvm_host.h   | 1 -
 arch/arm/kvm/arm.c                | 3 +++
 arch/arm64/include/asm/kvm_host.h | 3 +--
 4 files changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/4 KVM: Add documentation for KVM_CAP_NR_MEMSLOTS

From: Linu Cherian <[email protected]>

Add documentation for KVM_CAP_NR_MEMSLOTS capability.

---
 Documentation/virtual/kvm/api.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/virtual/kvm/api.txt +4 -0
index 03145b7..7b82f1c 100644
@@ -951,6 +951,10 @@ This ioctl allows the user to create or modify a guest physical memory
 slot.  When changing an existing slot, it may be moved in the guest
 physical memory space, or its flags may be modified.  It may not be
 resized.  Slots may not overlap in guest physical address space.
+Bits 0-15 of "slot" specifies the slot id and this value should be
+less than the maximum number of user memory slots supported per VM.
+The maximum allowed slots can be queried using KVM_CAP_NR_MEMSLOTS,
+if this capability is supported by the architecture.
 
 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of "slot"
 specifies the address space which is being modified.  They must be
Signature · 1 line
1.9.1
#2 lore raw

PATCH v4 2/4 KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64

In reply to [email protected]

From: Linu Cherian <[email protected]>

Return KVM_USER_MEM_SLOTS for userspace capability query on NR_MEMSLOTS.

---
 arch/arm/kvm/arm.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kvm/arm.c +3 -0
index 9d74464..b64b47f 100644
@@ -221,6 +221,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_MAX_VCPUS:
 		r = KVM_MAX_VCPUS;
 		break;
+	case KVM_CAP_NR_MEMSLOTS:
+		r = KVM_USER_MEM_SLOTS;
+		break;
 	case KVM_CAP_MSI_DEVID:
 		if (!kvm)
 			r = -EINVAL;
Signature · 1 line
1.9.1
#3 lore raw

PATCH v4 3/4 KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are unused

In reply to [email protected]

From: Linu Cherian <[email protected]>

arm/arm64 architecture doesnt use private memslots, hence removing KVM_PRIVATE_MEM_SLOTS macro definition.

---
 arch/arm/include/asm/kvm_host.h   | 1 -
 arch/arm64/include/asm/kvm_host.h | 1 -
 2 files changed, 2 deletions(-)
arch/arm/include/asm/kvm_host.h +0 -1
index d5423ab..b9b39f0 100644
@@ -30,7 +30,6 @@
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
 #define KVM_USER_MEM_SLOTS 32
-#define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HAVE_ONE_REG
 #define KVM_HALT_POLL_NS_DEFAULT 500000
arch/arm64/include/asm/kvm_host.h +0 -1
index e505038..a0409b0 100644
@@ -31,7 +31,6 @@
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
 #define KVM_USER_MEM_SLOTS 32
-#define KVM_PRIVATE_MEM_SLOTS 4
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HALT_POLL_NS_DEFAULT 500000
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH v4 4/4 KVM: arm64: Increase number of user memslots to 512

In reply to [email protected]

From: Linu Cherian <[email protected]>

Having only 32 memslots is a real constraint for the maximum number of PCI devices that can be assigned to a single guest. Assuming each PCI device/virtual function having two memory BAR regions, we could assign only 15 devices/virtual functions to a guest.

Hence increase KVM_USER_MEM_SLOTS to 512 as done in other archs like powerpc.

---
 arch/arm64/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/kvm_host.h +1 -1
index a0409b0..4027002 100644
@@ -30,7 +30,7 @@
 
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
-#define KVM_USER_MEM_SLOTS 32
+#define KVM_USER_MEM_SLOTS 512
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_HALT_POLL_NS_DEFAULT 500000
 
Signature · 1 line
1.9.1
Acked-by on the v4 series
#5 lore raw
In reply to [email protected]
Quoted 22 lines · On Wed, Mar 08 2017 at 6:08:31 am GMT, [email protected] wrote:

From: Linu Cherian <[email protected]>

v3 -> v4:
- Add missing commit messages in patches 1 and 3

v2 -> v3:
- Added documentation for KVM_CAP_NR_MEMSLOTS
- Removed KVM_PRIVATE_MEM_SLOTS which is unused
- KVM_USER_MEM_SLOTS changed to 512 from 508

v1 -> v2:
- Enabling KVM_CAP_NR_MEMSLOTS for arm/arm64 moved to separate patch.
- Updated commit message so that what is reported to userspace is explicit.

Linu Cherian (4):
KVM: Add documentation for KVM_CAP_NR_MEMSLOTS
KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64
KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are
unused
KVM: arm64: Increase number of user memslots to 512

Quoted 5 lines
 Documentation/virtual/kvm/api.txt | 4 ++++
 arch/arm/include/asm/kvm_host.h   | 1 -
 arch/arm/kvm/arm.c                | 3 +++
 arch/arm64/include/asm/kvm_host.h | 3 +--
 4 files changed, 8 insertions(+), 3 deletions(-)

For the whole series:

Christoffer: if you're happy with this series, I'll take it as part of the next batch of fixes.

Thanks,

	M.
Signature · 1 line
Jazz is not dead, it just smell funny.
Reviewed-by
#6 lore raw
Quoted 29 lines · Marc Zyngier
Quoted 22 lines · On Wed, Mar 08 2017 at 6:08:31 am GMT, [email protected] wrote:

From: Linu Cherian <[email protected]>

v3 -> v4:
- Add missing commit messages in patches 1 and 3

v2 -> v3:
- Added documentation for KVM_CAP_NR_MEMSLOTS
- Removed KVM_PRIVATE_MEM_SLOTS which is unused
- KVM_USER_MEM_SLOTS changed to 512 from 508

v1 -> v2:
- Enabling KVM_CAP_NR_MEMSLOTS for arm/arm64 moved to separate patch.
- Updated commit message so that what is reported to userspace is explicit.

Linu Cherian (4):
KVM: Add documentation for KVM_CAP_NR_MEMSLOTS
KVM: arm/arm64: Enable KVM_CAP_NR_MEMSLOTS on arm/arm64
KVM: arm/arm64: Remove KVM_PRIVATE_MEM_SLOTS definition that are
unused
KVM: arm64: Increase number of user memslots to 512

Quoted 5 lines
 Documentation/virtual/kvm/api.txt | 4 ++++
 arch/arm/include/asm/kvm_host.h   | 1 -
 arch/arm/kvm/arm.c                | 3 +++
 arch/arm64/include/asm/kvm_host.h | 3 +--
 4 files changed, 8 insertions(+), 3 deletions(-)
Quoted 7 lines

For the whole series:

Christoffer: if you're happy with this series, I'll take it as part of the next batch of fixes.

Yes: