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>
This commit is contained in:
Juergen Gross 2021-09-13 15:57:44 +02:00 committed by Paolo Bonzini
parent 1e254d0d86
commit a1c42ddedf
14 changed files with 17 additions and 17 deletions

View File

@ -22,7 +22,7 @@ Groups:
Errors: Errors:
======= ========================================== ======= ==========================================
-EINVAL Value greater than KVM_MAX_VCPU_ID. -EINVAL Value greater than KVM_MAX_VCPU_IDS.
-EFAULT Invalid user pointer for attr->addr. -EFAULT Invalid user pointer for attr->addr.
-EBUSY A vcpu is already connected to the device. -EBUSY A vcpu is already connected to the device.
======= ========================================== ======= ==========================================

View File

@ -91,7 +91,7 @@ the legacy interrupt mode, referred as XICS (POWER7/8).
Errors: Errors:
======= ========================================== ======= ==========================================
-EINVAL Value greater than KVM_MAX_VCPU_ID. -EINVAL Value greater than KVM_MAX_VCPU_IDS.
-EFAULT Invalid user pointer for attr->addr. -EFAULT Invalid user pointer for attr->addr.
-EBUSY A vCPU is already connected to the device. -EBUSY A vCPU is already connected to the device.
======= ========================================== ======= ==========================================

View File

@ -1073,7 +1073,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
r = KVM_MAX_VCPUS; r = KVM_MAX_VCPUS;
break; break;
case KVM_CAP_MAX_VCPU_ID: case KVM_CAP_MAX_VCPU_ID:
r = KVM_MAX_VCPU_ID; r = KVM_MAX_VCPU_IDS;
break; break;
case KVM_CAP_MIPS_FPU: case KVM_CAP_MIPS_FPU:
/* We don't handle systems with inconsistent cpu_has_fpu */ /* We don't handle systems with inconsistent cpu_has_fpu */

View File

@ -434,7 +434,7 @@ extern int kvmppc_h_logical_ci_store(struct kvm_vcpu *vcpu);
#define SPLIT_HACK_OFFS 0xfb000000 #define SPLIT_HACK_OFFS 0xfb000000
/* /*
* This packs a VCPU ID from the [0..KVM_MAX_VCPU_ID) space down to the * This packs a VCPU ID from the [0..KVM_MAX_VCPU_IDS) space down to the
* [0..KVM_MAX_VCPUS) space, using knowledge of the guest's core stride * [0..KVM_MAX_VCPUS) space, using knowledge of the guest's core stride
* (but not its actual threading mode, which is not available) to avoid * (but not its actual threading mode, which is not available) to avoid
* collisions. * collisions.

View File

@ -33,11 +33,11 @@
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
#include <asm/kvm_book3s_asm.h> /* for MAX_SMT_THREADS */ #include <asm/kvm_book3s_asm.h> /* for MAX_SMT_THREADS */
#define KVM_MAX_VCPU_ID (MAX_SMT_THREADS * KVM_MAX_VCORES) #define KVM_MAX_VCPU_IDS (MAX_SMT_THREADS * KVM_MAX_VCORES)
#define KVM_MAX_NESTED_GUESTS KVMPPC_NR_LPIDS #define KVM_MAX_NESTED_GUESTS KVMPPC_NR_LPIDS
#else #else
#define KVM_MAX_VCPU_ID KVM_MAX_VCPUS #define KVM_MAX_VCPU_IDS KVM_MAX_VCPUS
#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ #endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
#define __KVM_HAVE_ARCH_INTC_INITIALIZED #define __KVM_HAVE_ARCH_INTC_INITIALIZED

View File

@ -1928,7 +1928,7 @@ int kvmppc_xive_set_nr_servers(struct kvmppc_xive *xive, u64 addr)
pr_devel("%s nr_servers=%u\n", __func__, nr_servers); pr_devel("%s nr_servers=%u\n", __func__, nr_servers);
if (!nr_servers || nr_servers > KVM_MAX_VCPU_ID) if (!nr_servers || nr_servers > KVM_MAX_VCPU_IDS)
return -EINVAL; return -EINVAL;
mutex_lock(&xive->lock); mutex_lock(&xive->lock);

View File

@ -649,7 +649,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
r = KVM_MAX_VCPUS; r = KVM_MAX_VCPUS;
break; break;
case KVM_CAP_MAX_VCPU_ID: case KVM_CAP_MAX_VCPU_ID:
r = KVM_MAX_VCPU_ID; r = KVM_MAX_VCPU_IDS;
break; break;
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
case KVM_CAP_PPC_GET_SMMU_INFO: case KVM_CAP_PPC_GET_SMMU_INFO:

View File

@ -50,7 +50,7 @@
* so ratio of 4 should be enough. * so ratio of 4 should be enough.
*/ */
#define KVM_VCPU_ID_RATIO 4 #define KVM_VCPU_ID_RATIO 4
#define KVM_MAX_VCPU_ID (KVM_MAX_VCPUS * KVM_VCPU_ID_RATIO) #define KVM_MAX_VCPU_IDS (KVM_MAX_VCPUS * KVM_VCPU_ID_RATIO)
/* memory slots that are not exposed to userspace */ /* memory slots that are not exposed to userspace */
#define KVM_PRIVATE_MEM_SLOTS 3 #define KVM_PRIVATE_MEM_SLOTS 3

View File

@ -96,7 +96,7 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic) static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)
{ {
ioapic->rtc_status.pending_eoi = 0; ioapic->rtc_status.pending_eoi = 0;
bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID); bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_IDS);
} }
static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic); static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic);

View File

@ -39,13 +39,13 @@ struct kvm_vcpu;
struct dest_map { struct dest_map {
/* vcpu bitmap where IRQ has been sent */ /* vcpu bitmap where IRQ has been sent */
DECLARE_BITMAP(map, KVM_MAX_VCPU_ID); DECLARE_BITMAP(map, KVM_MAX_VCPU_IDS);
/* /*
* Vector sent to a given vcpu, only valid when * Vector sent to a given vcpu, only valid when
* the vcpu's bit in map is set * the vcpu's bit in map is set
*/ */
u8 vectors[KVM_MAX_VCPU_ID]; u8 vectors[KVM_MAX_VCPU_IDS];
}; };

View File

@ -4077,7 +4077,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
r = KVM_MAX_VCPUS; r = KVM_MAX_VCPUS;
break; break;
case KVM_CAP_MAX_VCPU_ID: case KVM_CAP_MAX_VCPU_ID:
r = KVM_MAX_VCPU_ID; r = KVM_MAX_VCPU_IDS;
break; break;
case KVM_CAP_PV_MMU: /* obsolete */ case KVM_CAP_PV_MMU: /* obsolete */
r = 0; r = 0;

View File

@ -39,8 +39,8 @@
#include <asm/kvm_host.h> #include <asm/kvm_host.h>
#include <linux/kvm_dirty_ring.h> #include <linux/kvm_dirty_ring.h>
#ifndef KVM_MAX_VCPU_ID #ifndef KVM_MAX_VCPU_IDS
#define KVM_MAX_VCPU_ID KVM_MAX_VCPUS #define KVM_MAX_VCPU_IDS KVM_MAX_VCPUS
#endif #endif
/* /*

View File

@ -53,7 +53,7 @@ int main(int argc, char *argv[])
kvm_max_vcpu_id = kvm_max_vcpus; kvm_max_vcpu_id = kvm_max_vcpus;
TEST_ASSERT(kvm_max_vcpu_id >= kvm_max_vcpus, TEST_ASSERT(kvm_max_vcpu_id >= kvm_max_vcpus,
"KVM_MAX_VCPU_ID (%d) must be at least as large as KVM_MAX_VCPUS (%d).", "KVM_MAX_VCPU_IDS (%d) must be at least as large as KVM_MAX_VCPUS (%d).",
kvm_max_vcpu_id, kvm_max_vcpus); kvm_max_vcpu_id, kvm_max_vcpus);
test_vcpu_creation(0, kvm_max_vcpus); test_vcpu_creation(0, kvm_max_vcpus);

View File

@ -3595,7 +3595,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id)
struct kvm_vcpu *vcpu; struct kvm_vcpu *vcpu;
struct page *page; struct page *page;
if (id >= KVM_MAX_VCPU_ID) if (id >= KVM_MAX_VCPU_IDS)
return -EINVAL; return -EINVAL;
mutex_lock(&kvm->lock); mutex_lock(&kvm->lock);