Subject: Re: [PATCH v2 34/37] KVM: PPC: Book3S HV: add virtual mode handlers for HPT hcalls and page faults

From: Nicholas Piggin <[email-masked]>
Date: Thu, 04 Mar 2021 21:05:02 +1000

Excerpts from Fabiano Rosas's message of March 4, 2021 6:09 am:
> Nicholas Piggin <[email-masked]> writes:
> 
>> In order to support hash guests in the P9 path (which does not do real
>> mode hcalls or page fault handling), these real-mode hash specific
>> interrupts need to be implemented in virt mode.
>>
>> Signed-off-by: Nicholas Piggin <[email-masked]>
>> ---
>>  arch/powerpc/kvm/book3s_hv.c | 118 +++++++++++++++++++++++++++++++++--
>>  1 file changed, 113 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>> index 9d2fa21201c1..1bbc46f2cfbf 100644
>> --- a/arch/powerpc/kvm/book3s_hv.c
>> +++ b/arch/powerpc/kvm/book3s_hv.c
>> @@ -935,6 +935,52 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
>>  		return RESUME_HOST;
>>
>>  	switch (req) {
>> +	case H_REMOVE:
>> +		ret = kvmppc_h_remove(vcpu, kvmppc_get_gpr(vcpu, 4),
>> +					kvmppc_get_gpr(vcpu, 5),
>> +					kvmppc_get_gpr(vcpu, 6));
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +	case H_ENTER:
>> +		ret = kvmppc_h_enter(vcpu, kvmppc_get_gpr(vcpu, 4),
>> +					kvmppc_get_gpr(vcpu, 5),
>> +					kvmppc_get_gpr(vcpu, 6),
>> +					kvmppc_get_gpr(vcpu, 7));
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +	case H_READ:
>> +		ret = kvmppc_h_read(vcpu, kvmppc_get_gpr(vcpu, 4),
>> +					kvmppc_get_gpr(vcpu, 5));
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +	case H_CLEAR_MOD:
>> +		ret = kvmppc_h_clear_mod(vcpu, kvmppc_get_gpr(vcpu, 4),
>> +					kvmppc_get_gpr(vcpu, 5));
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +	case H_CLEAR_REF:
>> +		ret = kvmppc_h_clear_ref(vcpu, kvmppc_get_gpr(vcpu, 4),
>> +					kvmppc_get_gpr(vcpu, 5));
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +	case H_PROTECT:
>> +		ret = kvmppc_h_protect(vcpu, kvmppc_get_gpr(vcpu, 4),
>> +					kvmppc_get_gpr(vcpu, 5),
>> +					kvmppc_get_gpr(vcpu, 6));
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +	case H_BULK_REMOVE:
>> +		ret = kvmppc_h_bulk_remove(vcpu);
>> +		if (ret == H_TOO_HARD)
>> +			return RESUME_HOST;
>> +		break;
>> +
> 
> Some of these symbols need to be exported.
> 
> ERROR: modpost: "kvmppc_h_bulk_remove" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_h_clear_mod" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_xive_xics_hcall" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_h_remove" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "decrementers_next_tb" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_hpte_hv_fault" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_h_protect" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_h_enter" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_h_clear_ref" [arch/powerpc/kvm/kvm-hv.ko] undefined!
> ERROR: modpost: "kvmppc_h_read" [arch/powerpc/kvm/kvm-hv.ko] undefined!

Yeah sorry about that there's a few issues there, I'll try polish that 
up a bit before the next post.

Thanks,
Nick