Skip to content

Commit f51af34

Browse files
lrq-maxsean-jc
authored andcommitted
KVM: SVM: remove useless input parameter in snp_safe_alloc_page
The input parameter 'vcpu' in snp_safe_alloc_page is not used. Therefore, remove it. Suggested-by: Sean Christopherson <[email protected]> Signed-off-by: Li RongQing <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent c3f38fa commit f51af34

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

arch/x86/kvm/svm/nested.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ int svm_allocate_nested(struct vcpu_svm *svm)
11811181
if (svm->nested.initialized)
11821182
return 0;
11831183

1184-
vmcb02_page = snp_safe_alloc_page(&svm->vcpu);
1184+
vmcb02_page = snp_safe_alloc_page();
11851185
if (!vmcb02_page)
11861186
return -ENOMEM;
11871187
svm->nested.vmcb02.ptr = page_address(vmcb02_page);

arch/x86/kvm/svm/sev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3380,7 +3380,7 @@ void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector)
33803380
}
33813381
}
33823382

3383-
struct page *snp_safe_alloc_page(struct kvm_vcpu *vcpu)
3383+
struct page *snp_safe_alloc_page(void)
33843384
{
33853385
unsigned long pfn;
33863386
struct page *p;

arch/x86/kvm/svm/svm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static int svm_cpu_init(int cpu)
703703
int ret = -ENOMEM;
704704

705705
memset(sd, 0, sizeof(struct svm_cpu_data));
706-
sd->save_area = snp_safe_alloc_page(NULL);
706+
sd->save_area = snp_safe_alloc_page();
707707
if (!sd->save_area)
708708
return ret;
709709

@@ -1421,7 +1421,7 @@ static int svm_vcpu_create(struct kvm_vcpu *vcpu)
14211421
svm = to_svm(vcpu);
14221422

14231423
err = -ENOMEM;
1424-
vmcb01_page = snp_safe_alloc_page(vcpu);
1424+
vmcb01_page = snp_safe_alloc_page();
14251425
if (!vmcb01_page)
14261426
goto out;
14271427

@@ -1430,7 +1430,7 @@ static int svm_vcpu_create(struct kvm_vcpu *vcpu)
14301430
* SEV-ES guests require a separate VMSA page used to contain
14311431
* the encrypted register state of the guest.
14321432
*/
1433-
vmsa_page = snp_safe_alloc_page(vcpu);
1433+
vmsa_page = snp_safe_alloc_page();
14341434
if (!vmsa_page)
14351435
goto error_free_vmcb_page;
14361436
}
@@ -4920,7 +4920,7 @@ static int svm_vm_init(struct kvm *kvm)
49204920

49214921
static void *svm_alloc_apic_backing_page(struct kvm_vcpu *vcpu)
49224922
{
4923-
struct page *page = snp_safe_alloc_page(vcpu);
4923+
struct page *page = snp_safe_alloc_page();
49244924

49254925
if (!page)
49264926
return NULL;

arch/x86/kvm/svm/svm.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ void sev_guest_memory_reclaimed(struct kvm *kvm);
694694
int sev_handle_vmgexit(struct kvm_vcpu *vcpu);
695695

696696
/* These symbols are used in common code and are stubbed below. */
697-
struct page *snp_safe_alloc_page(struct kvm_vcpu *vcpu);
697+
struct page *snp_safe_alloc_page(void);
698698
void sev_free_vcpu(struct kvm_vcpu *vcpu);
699699
void sev_vm_destroy(struct kvm *kvm);
700700
void __init sev_set_cpu_caps(void);
@@ -704,7 +704,8 @@ int sev_cpu_init(struct svm_cpu_data *sd);
704704
int sev_dev_get_attr(u32 group, u64 attr, u64 *val);
705705
extern unsigned int max_sev_asid;
706706
#else
707-
static inline struct page *snp_safe_alloc_page(struct kvm_vcpu *vcpu) {
707+
static inline struct page *snp_safe_alloc_page(void)
708+
{
708709
return alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
709710
}
710711

0 commit comments

Comments
 (0)