Skip to content

Commit 67c4866

Browse files
huthbonzini
authored andcommitted
KVM: PPC: Standardize on "int" return types in the powerpc KVM code
Most functions that are related to kvm_arch_vm_ioctl() already use "int" as return type to pass error values back to the caller. Some outlier functions use "long" instead for no good reason (they do not really require long values here). Let's standardize on "int" here to avoid casting the values back and forth between the two types. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230208140105.655814-2-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 45cf86f commit 67c4866

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

arch/powerpc/include/asm/kvm_ppc.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ extern void kvmppc_map_magic(struct kvm_vcpu *vcpu);
156156

157157
extern int kvmppc_allocate_hpt(struct kvm_hpt_info *info, u32 order);
158158
extern void kvmppc_set_hpt(struct kvm *kvm, struct kvm_hpt_info *info);
159-
extern long kvmppc_alloc_reset_hpt(struct kvm *kvm, int order);
159+
extern int kvmppc_alloc_reset_hpt(struct kvm *kvm, int order);
160160
extern void kvmppc_free_hpt(struct kvm_hpt_info *info);
161161
extern void kvmppc_rmap_reset(struct kvm *kvm);
162162
extern void kvmppc_map_vrma(struct kvm_vcpu *vcpu,
@@ -170,7 +170,7 @@ extern int kvmppc_switch_mmu_to_hpt(struct kvm *kvm);
170170
extern int kvmppc_switch_mmu_to_radix(struct kvm *kvm);
171171
extern void kvmppc_setup_partition_table(struct kvm *kvm);
172172

173-
extern long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
173+
extern int kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
174174
struct kvm_create_spapr_tce_64 *args);
175175
#define kvmppc_ioba_validate(stt, ioba, npages) \
176176
(iommu_tce_check_ioba((stt)->page_shift, (stt)->offset, \
@@ -211,10 +211,10 @@ extern void kvmppc_bookehv_exit(void);
211211
extern int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu);
212212

213213
extern int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *);
214-
extern long kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm,
215-
struct kvm_ppc_resize_hpt *rhpt);
216-
extern long kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm,
214+
extern int kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm,
217215
struct kvm_ppc_resize_hpt *rhpt);
216+
extern int kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm,
217+
struct kvm_ppc_resize_hpt *rhpt);
218218

219219
int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq);
220220

@@ -286,8 +286,8 @@ struct kvmppc_ops {
286286
int (*emulate_mtspr)(struct kvm_vcpu *vcpu, int sprn, ulong spr_val);
287287
int (*emulate_mfspr)(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val);
288288
void (*fast_vcpu_kick)(struct kvm_vcpu *vcpu);
289-
long (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl,
290-
unsigned long arg);
289+
int (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl,
290+
unsigned long arg);
291291
int (*hcall_implemented)(unsigned long hcall);
292292
int (*irq_bypass_add_producer)(struct irq_bypass_consumer *,
293293
struct irq_bypass_producer *);

arch/powerpc/kvm/book3s_64_mmu_hv.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ void kvmppc_set_hpt(struct kvm *kvm, struct kvm_hpt_info *info)
124124
info->virt, (long)info->order, kvm->arch.lpid);
125125
}
126126

127-
long kvmppc_alloc_reset_hpt(struct kvm *kvm, int order)
127+
int kvmppc_alloc_reset_hpt(struct kvm *kvm, int order)
128128
{
129-
long err = -EBUSY;
129+
int err = -EBUSY;
130130
struct kvm_hpt_info info;
131131

132132
mutex_lock(&kvm->arch.mmu_setup_lock);
@@ -1468,8 +1468,8 @@ static void resize_hpt_prepare_work(struct work_struct *work)
14681468
mutex_unlock(&kvm->arch.mmu_setup_lock);
14691469
}
14701470

1471-
long kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm,
1472-
struct kvm_ppc_resize_hpt *rhpt)
1471+
int kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm,
1472+
struct kvm_ppc_resize_hpt *rhpt)
14731473
{
14741474
unsigned long flags = rhpt->flags;
14751475
unsigned long shift = rhpt->shift;
@@ -1534,13 +1534,13 @@ static void resize_hpt_boot_vcpu(void *opaque)
15341534
/* Nothing to do, just force a KVM exit */
15351535
}
15361536

1537-
long kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm,
1538-
struct kvm_ppc_resize_hpt *rhpt)
1537+
int kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm,
1538+
struct kvm_ppc_resize_hpt *rhpt)
15391539
{
15401540
unsigned long flags = rhpt->flags;
15411541
unsigned long shift = rhpt->shift;
15421542
struct kvm_resize_hpt *resize;
1543-
long ret;
1543+
int ret;
15441544

15451545
if (flags != 0 || kvm_is_radix(kvm))
15461546
return -EINVAL;

arch/powerpc/kvm/book3s_64_vio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ static const struct file_operations kvm_spapr_tce_fops = {
288288
.release = kvm_spapr_tce_release,
289289
};
290290

291-
long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
292-
struct kvm_create_spapr_tce_64 *args)
291+
int kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
292+
struct kvm_create_spapr_tce_64 *args)
293293
{
294294
struct kvmppc_spapr_tce_table *stt = NULL;
295295
struct kvmppc_spapr_tce_table *siter;

arch/powerpc/kvm/book3s_hv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5779,12 +5779,12 @@ static void kvmppc_irq_bypass_del_producer_hv(struct irq_bypass_consumer *cons,
57795779
}
57805780
#endif
57815781

5782-
static long kvm_arch_vm_ioctl_hv(struct file *filp,
5783-
unsigned int ioctl, unsigned long arg)
5782+
static int kvm_arch_vm_ioctl_hv(struct file *filp,
5783+
unsigned int ioctl, unsigned long arg)
57845784
{
57855785
struct kvm *kvm __maybe_unused = filp->private_data;
57865786
void __user *argp = (void __user *)arg;
5787-
long r;
5787+
int r;
57885788

57895789
switch (ioctl) {
57905790

arch/powerpc/kvm/book3s_pr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,8 +2042,8 @@ static int kvmppc_core_check_processor_compat_pr(void)
20422042
return 0;
20432043
}
20442044

2045-
static long kvm_arch_vm_ioctl_pr(struct file *filp,
2046-
unsigned int ioctl, unsigned long arg)
2045+
static int kvm_arch_vm_ioctl_pr(struct file *filp,
2046+
unsigned int ioctl, unsigned long arg)
20472047
{
20482048
return -ENOTTY;
20492049
}

0 commit comments

Comments
 (0)