Skip to content

Commit dc8cfaf

Browse files
jgross1pull[bot]
authored andcommitted
kvm: rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS
KVM_MAX_VCPU_ID is not specifying the highest allowed vcpu-id, but the number of allowed vcpu-ids. This has already led to confusion, so rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS to make its semantics more clear Suggested-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210913135745.13944-3-jgross@suse.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 47398a6 commit dc8cfaf

File tree

14 files changed

+17
-17
lines changed

14 files changed

+17
-17
lines changed

Documentation/virt/kvm/devices/xics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Groups:
2222
Errors:
2323

2424
======= ==========================================
25-
-EINVAL Value greater than KVM_MAX_VCPU_ID.
25+
-EINVAL Value greater than KVM_MAX_VCPU_IDS.
2626
-EFAULT Invalid user pointer for attr->addr.
2727
-EBUSY A vcpu is already connected to the device.
2828
======= ==========================================

Documentation/virt/kvm/devices/xive.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ the legacy interrupt mode, referred as XICS (POWER7/8).
9191
Errors:
9292

9393
======= ==========================================
94-
-EINVAL Value greater than KVM_MAX_VCPU_ID.
94+
-EINVAL Value greater than KVM_MAX_VCPU_IDS.
9595
-EFAULT Invalid user pointer for attr->addr.
9696
-EBUSY A vCPU is already connected to the device.
9797
======= ==========================================

arch/mips/kvm/mips.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
10731073
r = KVM_MAX_VCPUS;
10741074
break;
10751075
case KVM_CAP_MAX_VCPU_ID:
1076-
r = KVM_MAX_VCPU_ID;
1076+
r = KVM_MAX_VCPU_IDS;
10771077
break;
10781078
case KVM_CAP_MIPS_FPU:
10791079
/* We don't handle systems with inconsistent cpu_has_fpu */

arch/powerpc/include/asm/kvm_book3s.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ extern int kvmppc_h_logical_ci_store(struct kvm_vcpu *vcpu);
434434
#define SPLIT_HACK_OFFS 0xfb000000
435435

436436
/*
437-
* This packs a VCPU ID from the [0..KVM_MAX_VCPU_ID) space down to the
437+
* This packs a VCPU ID from the [0..KVM_MAX_VCPU_IDS) space down to the
438438
* [0..KVM_MAX_VCPUS) space, using knowledge of the guest's core stride
439439
* (but not its actual threading mode, which is not available) to avoid
440440
* collisions.

arch/powerpc/include/asm/kvm_host.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333

3434
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
3535
#include <asm/kvm_book3s_asm.h> /* for MAX_SMT_THREADS */
36-
#define KVM_MAX_VCPU_ID (MAX_SMT_THREADS * KVM_MAX_VCORES)
36+
#define KVM_MAX_VCPU_IDS (MAX_SMT_THREADS * KVM_MAX_VCORES)
3737
#define KVM_MAX_NESTED_GUESTS KVMPPC_NR_LPIDS
3838

3939
#else
40-
#define KVM_MAX_VCPU_ID KVM_MAX_VCPUS
40+
#define KVM_MAX_VCPU_IDS KVM_MAX_VCPUS
4141
#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
4242

4343
#define __KVM_HAVE_ARCH_INTC_INITIALIZED

arch/powerpc/kvm/book3s_xive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ int kvmppc_xive_set_nr_servers(struct kvmppc_xive *xive, u64 addr)
19281928

19291929
pr_devel("%s nr_servers=%u\n", __func__, nr_servers);
19301930

1931-
if (!nr_servers || nr_servers > KVM_MAX_VCPU_ID)
1931+
if (!nr_servers || nr_servers > KVM_MAX_VCPU_IDS)
19321932
return -EINVAL;
19331933

19341934
mutex_lock(&xive->lock);

arch/powerpc/kvm/powerpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
649649
r = KVM_MAX_VCPUS;
650650
break;
651651
case KVM_CAP_MAX_VCPU_ID:
652-
r = KVM_MAX_VCPU_ID;
652+
r = KVM_MAX_VCPU_IDS;
653653
break;
654654
#ifdef CONFIG_PPC_BOOK3S_64
655655
case KVM_CAP_PPC_GET_SMMU_INFO:

arch/x86/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* so ratio of 4 should be enough.
5151
*/
5252
#define KVM_VCPU_ID_RATIO 4
53-
#define KVM_MAX_VCPU_ID (KVM_MAX_VCPUS * KVM_VCPU_ID_RATIO)
53+
#define KVM_MAX_VCPU_IDS (KVM_MAX_VCPUS * KVM_VCPU_ID_RATIO)
5454

5555
/* memory slots that are not exposed to userspace */
5656
#define KVM_PRIVATE_MEM_SLOTS 3

arch/x86/kvm/ioapic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
9696
static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)
9797
{
9898
ioapic->rtc_status.pending_eoi = 0;
99-
bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID);
99+
bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_IDS);
100100
}
101101

102102
static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic);

arch/x86/kvm/ioapic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ struct kvm_vcpu;
3939

4040
struct dest_map {
4141
/* vcpu bitmap where IRQ has been sent */
42-
DECLARE_BITMAP(map, KVM_MAX_VCPU_ID);
42+
DECLARE_BITMAP(map, KVM_MAX_VCPU_IDS);
4343

4444
/*
4545
* Vector sent to a given vcpu, only valid when
4646
* the vcpu's bit in map is set
4747
*/
48-
u8 vectors[KVM_MAX_VCPU_ID];
48+
u8 vectors[KVM_MAX_VCPU_IDS];
4949
};
5050

5151

arch/x86/kvm/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4077,7 +4077,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
40774077
r = KVM_MAX_VCPUS;
40784078
break;
40794079
case KVM_CAP_MAX_VCPU_ID:
4080-
r = KVM_MAX_VCPU_ID;
4080+
r = KVM_MAX_VCPU_IDS;
40814081
break;
40824082
case KVM_CAP_PV_MMU: /* obsolete */
40834083
r = 0;

include/linux/kvm_host.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
#include <asm/kvm_host.h>
4040
#include <linux/kvm_dirty_ring.h>
4141

42-
#ifndef KVM_MAX_VCPU_ID
43-
#define KVM_MAX_VCPU_ID KVM_MAX_VCPUS
42+
#ifndef KVM_MAX_VCPU_IDS
43+
#define KVM_MAX_VCPU_IDS KVM_MAX_VCPUS
4444
#endif
4545

4646
/*

tools/testing/selftests/kvm/kvm_create_max_vcpus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
5353
kvm_max_vcpu_id = kvm_max_vcpus;
5454

5555
TEST_ASSERT(kvm_max_vcpu_id >= kvm_max_vcpus,
56-
"KVM_MAX_VCPU_ID (%d) must be at least as large as KVM_MAX_VCPUS (%d).",
56+
"KVM_MAX_VCPU_IDS (%d) must be at least as large as KVM_MAX_VCPUS (%d).",
5757
kvm_max_vcpu_id, kvm_max_vcpus);
5858

5959
test_vcpu_creation(0, kvm_max_vcpus);

virt/kvm/kvm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3595,7 +3595,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id)
35953595
struct kvm_vcpu *vcpu;
35963596
struct page *page;
35973597

3598-
if (id >= KVM_MAX_VCPU_ID)
3598+
if (id >= KVM_MAX_VCPU_IDS)
35993599
return -EINVAL;
36003600

36013601
mutex_lock(&kvm->lock);

0 commit comments

Comments
 (0)