This fix introduces the H_GET_TCE hypervisor call which is basically the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).
The hcall H_GET_TCE is required by the kdump kernel which is calling it to
retrieve the TCE set up by the panicing kernel.
Signed-off-by: Laurent Dufour <redacted>
---
arch/powerpc/include/asm/kvm_ppc.h | 2 ++
arch/powerpc/kvm/book3s_64_vio_hv.c | 28 ++++++++++++++++++++++++++++
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +-
3 files changed, 31 insertions(+), 1 deletion(-)
@@ -75,3 +75,31 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,returnH_TOO_HARD;}EXPORT_SYMBOL_GPL(kvmppc_h_put_tce);++longkvmppc_h_get_tce(structkvm_vcpu*vcpu,unsignedlongliobn,+unsignedlongioba)+{+structkvm*kvm=vcpu->kvm;+structkvmppc_spapr_tce_table*stt;++list_for_each_entry(stt,&kvm->arch.spapr_tce_tables,list){+if(stt->liobn==liobn){+unsignedlongidx=ioba>>SPAPR_TCE_SHIFT;+structpage*page;+u64*tbl;++if(ioba>=stt->window_size)+returnH_PARAMETER;++page=stt->pages[idx/TCES_PER_PAGE];+tbl=(u64*)page_address(page);++vcpu->arch.gpr[4]=tbl[idx%TCES_PER_PAGE];+returnH_SUCCESS;+}+}++/* Didn't find the liobn, punt it to userspace */+returnH_TOO_HARD;+}+EXPORT_SYMBOL_GPL(kvmppc_h_get_tce);
From: Alexander Graf <hidden> Date: 2014-02-21 15:57:41
On 21.02.2014, at 16:31, Laurent Dufour [off-list ref] =
wrote:
This fix introduces the H_GET_TCE hypervisor call which is basically =
the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).
=20
The hcall H_GET_TCE is required by the kdump kernel which is calling =
it to
retrieve the TCE set up by the panicing kernel.
=20
Signed-off-by: Laurent Dufour <redacted>
Thanks, applied to kvm-ppc-queue. Btw, why exactly are we using struct =
page pointers and alloc_page rather than __get_free_page() and simple =
page start pointers?
Alex
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2014-02-21 19:24:27
On Fri, 2014-02-21 at 16:31 +0100, Laurent Dufour wrote:
This fix introduces the H_GET_TCE hypervisor call which is basically the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).
The hcall H_GET_TCE is required by the kdump kernel which is calling it to
retrieve the TCE set up by the panicing kernel.
Alexey, will that work for VFIO ? Or are those patches *still* not
upstream ?
@@ -75,3 +75,31 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,returnH_TOO_HARD;}EXPORT_SYMBOL_GPL(kvmppc_h_put_tce);++longkvmppc_h_get_tce(structkvm_vcpu*vcpu,unsignedlongliobn,+unsignedlongioba)+{+structkvm*kvm=vcpu->kvm;+structkvmppc_spapr_tce_table*stt;++list_for_each_entry(stt,&kvm->arch.spapr_tce_tables,list){+if(stt->liobn==liobn){+unsignedlongidx=ioba>>SPAPR_TCE_SHIFT;+structpage*page;+u64*tbl;++if(ioba>=stt->window_size)+returnH_PARAMETER;++page=stt->pages[idx/TCES_PER_PAGE];+tbl=(u64*)page_address(page);++vcpu->arch.gpr[4]=tbl[idx%TCES_PER_PAGE];+returnH_SUCCESS;+}+}++/* Didn't find the liobn, punt it to userspace */+returnH_TOO_HARD;+}+EXPORT_SYMBOL_GPL(kvmppc_h_get_tce);
On 02/22/2014 06:23 AM, Benjamin Herrenschmidt wrote:
On Fri, 2014-02-21 at 16:31 +0100, Laurent Dufour wrote:
quoted
This fix introduces the H_GET_TCE hypervisor call which is basically the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).
The hcall H_GET_TCE is required by the kdump kernel which is calling it to
retrieve the TCE set up by the panicing kernel.
@@ -75,3 +75,31 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,returnH_TOO_HARD;}EXPORT_SYMBOL_GPL(kvmppc_h_put_tce);++longkvmppc_h_get_tce(structkvm_vcpu*vcpu,unsignedlongliobn,+unsignedlongioba)+{+structkvm*kvm=vcpu->kvm;+structkvmppc_spapr_tce_table*stt;++list_for_each_entry(stt,&kvm->arch.spapr_tce_tables,list){+if(stt->liobn==liobn){+unsignedlongidx=ioba>>SPAPR_TCE_SHIFT;+structpage*page;+u64*tbl;++if(ioba>=stt->window_size)+returnH_PARAMETER;++page=stt->pages[idx/TCES_PER_PAGE];+tbl=(u64*)page_address(page);++vcpu->arch.gpr[4]=tbl[idx%TCES_PER_PAGE];+returnH_SUCCESS;+}+}++/* Didn't find the liobn, punt it to userspace */+returnH_TOO_HARD;+}+EXPORT_SYMBOL_GPL(kvmppc_h_get_tce);
On 02/22/2014 11:28 AM, Alexey Kardashevskiy wrote:
On 02/22/2014 06:23 AM, Benjamin Herrenschmidt wrote:
quoted
On Fri, 2014-02-21 at 16:31 +0100, Laurent Dufour wrote:
quoted
This fix introduces the H_GET_TCE hypervisor call which is basically the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).
The hcall H_GET_TCE is required by the kdump kernel which is calling it to
retrieve the TCE set up by the panicing kernel.
Alexey, will that work for VFIO ?
Yes.
Oh! My bad, this is _G_et. Not, this won't support VFIO but this should not
break the current "slow" VFIO support in upstream.
quoted
Or are those patches *still* not
upstream ?
Yes.
This part is still true. I cannot get Alex Graf attention even on much
simpler things for several months.
@@ -75,3 +75,31 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,returnH_TOO_HARD;}EXPORT_SYMBOL_GPL(kvmppc_h_put_tce);++longkvmppc_h_get_tce(structkvm_vcpu*vcpu,unsignedlongliobn,+unsignedlongioba)+{+structkvm*kvm=vcpu->kvm;+structkvmppc_spapr_tce_table*stt;++list_for_each_entry(stt,&kvm->arch.spapr_tce_tables,list){+if(stt->liobn==liobn){+unsignedlongidx=ioba>>SPAPR_TCE_SHIFT;+structpage*page;+u64*tbl;++if(ioba>=stt->window_size)+returnH_PARAMETER;++page=stt->pages[idx/TCES_PER_PAGE];+tbl=(u64*)page_address(page);++vcpu->arch.gpr[4]=tbl[idx%TCES_PER_PAGE];+returnH_SUCCESS;+}+}++/* Didn't find the liobn, punt it to userspace */+returnH_TOO_HARD;+}+EXPORT_SYMBOL_GPL(kvmppc_h_get_tce);
On 21.02.2014, at 16:31, Laurent Dufour [off-list ref] wrote:
quoted
This fix introduces the H_GET_TCE hypervisor call which is basically the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).
The hcall H_GET_TCE is required by the kdump kernel which is calling it to
retrieve the TCE set up by the panicing kernel.
Signed-off-by: Laurent Dufour <redacted>
Thanks, applied to kvm-ppc-queue. Btw, why exactly are we using struct page pointers and alloc_page rather than __get_free_page() and simple page start pointers?
FWIW, I'm not so familiar with that part of code, it seems that this is
due to the page fault handler (kvm_spapr_tce_fault) which is part of the
mmap file operation handlers associated to the fd returned by
kvm_vm_ioctl_create_spapr_tce. Underlying vma's operation requires the
page fault handler to return a struct page value in the vm_fault structure.
Cheers,
Laurent.