* [Qemu-devel] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE
@ 2014-02-21 9:29 Laurent Dufour
2014-02-21 11:33 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-03-03 13:02 ` Laurent Dufour
0 siblings, 2 replies; 5+ messages in thread
From: Laurent Dufour @ 2014-02-21 9:29 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-ppc, qemu-devel, Greg Kurz
This patch introduces the hypervisor call H_GET_TCE 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 <ldufour@linux.vnet.ibm.com>
---
hw/ppc/spapr_iommu.c | 37 +++++++++++++++++++++++++++++++++++++
trace-events | 1 +
2 files changed, 38 insertions(+)
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index ef45f4f..d9fe946 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -243,6 +243,42 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
return ret;
}
+static target_ulong get_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
+ target_ulong *tce)
+{
+ if (ioba >= tcet->window_size) {
+ hcall_dprintf("spapr_iommu_get_tce on out-of-bounds IOBA 0x"
+ TARGET_FMT_lx "\n", ioba);
+ return H_PARAMETER;
+ }
+
+ *tce = tcet->table[ioba >> SPAPR_TCE_PAGE_SHIFT];
+
+ return H_SUCCESS;
+}
+
+static target_ulong h_get_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+ target_ulong opcode, target_ulong *args)
+{
+ target_ulong liobn = args[0];
+ target_ulong ioba = args[1];
+ target_ulong tce = 0;
+ target_ulong ret = H_PARAMETER;
+ sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
+
+ ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
+
+ if (tcet) {
+ ret = get_tce_emu(tcet, ioba, &tce);
+ if (!ret) {
+ args[0] = tce;
+ }
+ }
+ trace_spapr_iommu_get(liobn, ioba, ret, tce);
+
+ return ret;
+}
+
int spapr_dma_dt(void *fdt, int node_off, const char *propname,
uint32_t liobn, uint64_t window, uint32_t size)
{
@@ -295,6 +331,7 @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
/* hcall-tce */
spapr_register_hypercall(H_PUT_TCE, h_put_tce);
+ spapr_register_hypercall(H_GET_TCE, h_get_tce);
}
static TypeInfo spapr_tce_table_info = {
diff --git a/trace-events b/trace-events
index 0b3c1ac..5b306a0 100644
--- a/trace-events
+++ b/trace-events
@@ -1136,6 +1136,7 @@ xics_ics_eoi(int nr) "ics_eoi: irq %#x"
# hw/ppc/spapr_iommu.c
spapr_iommu_put(uint64_t liobn, uint64_t ioba, uint64_t tce, uint64_t ret) "liobn=%"PRIx64" ioba=0x%"PRIx64" tce=0x%"PRIx64" ret=%"PRId64
+spapr_iommu_get(uint64_t liobn, uint64_t ioba, uint64_t ret, uint64_t tce) "liobn=%"PRIx64" ioba=0x%"PRIx64" ret=%"PRId64" tce=0x%"PRIx64
spapr_iommu_xlate(uint64_t liobn, uint64_t ioba, uint64_t tce, unsigned perm, unsigned pgsize) "liobn=%"PRIx64" 0x%"PRIx64" -> 0x%"PRIx64" perm=%u mask=%x"
spapr_iommu_new_table(uint64_t liobn, void *tcet, void *table, int fd) "liobn=%"PRIx64" tcet=%p table=%p fd=%d"
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE
2014-02-21 9:29 [Qemu-devel] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE Laurent Dufour
@ 2014-02-21 11:33 ` Greg Kurz
2014-03-03 13:02 ` Laurent Dufour
1 sibling, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2014-02-21 11:33 UTC (permalink / raw)
To: Laurent Dufour; +Cc: qemu-ppc, Alexander Graf, qemu-devel
On Fri, 21 Feb 2014 10:29:06 +0100
Laurent Dufour <ldufour@linux.vnet.ibm.com> wrote:
> This patch introduces the hypervisor call H_GET_TCE 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 <ldufour@linux.vnet.ibm.com>
> ---
FWIW, you can add this :)
Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> hw/ppc/spapr_iommu.c | 37 +++++++++++++++++++++++++++++++++++++
> trace-events | 1 +
> 2 files changed, 38 insertions(+)
>
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index ef45f4f..d9fe946 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -243,6 +243,42 @@ static target_ulong h_put_tce(PowerPCCPU *cpu,
> sPAPREnvironment *spapr, return ret;
> }
>
> +static target_ulong get_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
> + target_ulong *tce)
> +{
> + if (ioba >= tcet->window_size) {
> + hcall_dprintf("spapr_iommu_get_tce on out-of-bounds IOBA 0x"
> + TARGET_FMT_lx "\n", ioba);
> + return H_PARAMETER;
> + }
> +
> + *tce = tcet->table[ioba >> SPAPR_TCE_PAGE_SHIFT];
> +
> + return H_SUCCESS;
> +}
> +
> +static target_ulong h_get_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
> + target_ulong opcode, target_ulong *args)
> +{
> + target_ulong liobn = args[0];
> + target_ulong ioba = args[1];
> + target_ulong tce = 0;
> + target_ulong ret = H_PARAMETER;
> + sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
> +
> + ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
> +
> + if (tcet) {
> + ret = get_tce_emu(tcet, ioba, &tce);
> + if (!ret) {
> + args[0] = tce;
> + }
> + }
> + trace_spapr_iommu_get(liobn, ioba, ret, tce);
> +
> + return ret;
> +}
> +
> int spapr_dma_dt(void *fdt, int node_off, const char *propname,
> uint32_t liobn, uint64_t window, uint32_t size)
> {
> @@ -295,6 +331,7 @@ static void spapr_tce_table_class_init(ObjectClass
> *klass, void *data)
>
> /* hcall-tce */
> spapr_register_hypercall(H_PUT_TCE, h_put_tce);
> + spapr_register_hypercall(H_GET_TCE, h_get_tce);
> }
>
> static TypeInfo spapr_tce_table_info = {
> diff --git a/trace-events b/trace-events
> index 0b3c1ac..5b306a0 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -1136,6 +1136,7 @@ xics_ics_eoi(int nr) "ics_eoi: irq %#x"
>
> # hw/ppc/spapr_iommu.c
> spapr_iommu_put(uint64_t liobn, uint64_t ioba, uint64_t tce, uint64_t
> ret) "liobn=%"PRIx64" ioba=0x%"PRIx64" tce=0x%"PRIx64" ret=%"PRId64
> +spapr_iommu_get(uint64_t liobn, uint64_t ioba, uint64_t ret, uint64_t
> tce) "liobn=%"PRIx64" ioba=0x%"PRIx64" ret=%"PRId64" tce=0x%"PRIx64
> spapr_iommu_xlate(uint64_t liobn, uint64_t ioba, uint64_t tce, unsigned
> perm, unsigned pgsize) "liobn=%"PRIx64" 0x%"PRIx64" -> 0x%"PRIx64"
> perm=%u mask=%x" spapr_iommu_new_table(uint64_t liobn, void *tcet, void
> *table, int fd) "liobn=%"PRIx64" tcet=%p table=%p fd=%d"
>
>
>
--
Gregory Kurz kurzgreg@fr.ibm.com
gkurz@linux.vnet.ibm.com
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)562 165 496
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE
2014-02-21 9:29 [Qemu-devel] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE Laurent Dufour
2014-02-21 11:33 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
@ 2014-03-03 13:02 ` Laurent Dufour
2014-03-03 17:26 ` Alexander Graf
2014-03-03 18:37 ` Andreas Färber
1 sibling, 2 replies; 5+ messages in thread
From: Laurent Dufour @ 2014-03-03 13:02 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-ppc, qemu-devel, Greg Kurz
On 21/02/2014 10:29, Laurent Dufour wrote:
> This patch introduces the hypervisor call H_GET_TCE 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.
Hi,
Is there an issue with that patch ?
Regards,
Laurent.
> Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> ---
> hw/ppc/spapr_iommu.c | 37 +++++++++++++++++++++++++++++++++++++
> trace-events | 1 +
> 2 files changed, 38 insertions(+)
>
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index ef45f4f..d9fe946 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -243,6 +243,42 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
> return ret;
> }
>
> +static target_ulong get_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
> + target_ulong *tce)
> +{
> + if (ioba >= tcet->window_size) {
> + hcall_dprintf("spapr_iommu_get_tce on out-of-bounds IOBA 0x"
> + TARGET_FMT_lx "\n", ioba);
> + return H_PARAMETER;
> + }
> +
> + *tce = tcet->table[ioba >> SPAPR_TCE_PAGE_SHIFT];
> +
> + return H_SUCCESS;
> +}
> +
> +static target_ulong h_get_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
> + target_ulong opcode, target_ulong *args)
> +{
> + target_ulong liobn = args[0];
> + target_ulong ioba = args[1];
> + target_ulong tce = 0;
> + target_ulong ret = H_PARAMETER;
> + sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
> +
> + ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
> +
> + if (tcet) {
> + ret = get_tce_emu(tcet, ioba, &tce);
> + if (!ret) {
> + args[0] = tce;
> + }
> + }
> + trace_spapr_iommu_get(liobn, ioba, ret, tce);
> +
> + return ret;
> +}
> +
> int spapr_dma_dt(void *fdt, int node_off, const char *propname,
> uint32_t liobn, uint64_t window, uint32_t size)
> {
> @@ -295,6 +331,7 @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
>
> /* hcall-tce */
> spapr_register_hypercall(H_PUT_TCE, h_put_tce);
> + spapr_register_hypercall(H_GET_TCE, h_get_tce);
> }
>
> static TypeInfo spapr_tce_table_info = {
> diff --git a/trace-events b/trace-events
> index 0b3c1ac..5b306a0 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -1136,6 +1136,7 @@ xics_ics_eoi(int nr) "ics_eoi: irq %#x"
>
> # hw/ppc/spapr_iommu.c
> spapr_iommu_put(uint64_t liobn, uint64_t ioba, uint64_t tce, uint64_t ret) "liobn=%"PRIx64" ioba=0x%"PRIx64" tce=0x%"PRIx64" ret=%"PRId64
> +spapr_iommu_get(uint64_t liobn, uint64_t ioba, uint64_t ret, uint64_t tce) "liobn=%"PRIx64" ioba=0x%"PRIx64" ret=%"PRId64" tce=0x%"PRIx64
> spapr_iommu_xlate(uint64_t liobn, uint64_t ioba, uint64_t tce, unsigned perm, unsigned pgsize) "liobn=%"PRIx64" 0x%"PRIx64" -> 0x%"PRIx64" perm=%u mask=%x"
> spapr_iommu_new_table(uint64_t liobn, void *tcet, void *table, int fd) "liobn=%"PRIx64" tcet=%p table=%p fd=%d"
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE
2014-03-03 13:02 ` Laurent Dufour
@ 2014-03-03 17:26 ` Alexander Graf
2014-03-03 18:37 ` Andreas Färber
1 sibling, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2014-03-03 17:26 UTC (permalink / raw)
To: Laurent Dufour; +Cc: qemu-ppc, qemu-devel, Greg Kurz
Laurent Dufour wrote:
> On 21/02/2014 10:29, Laurent Dufour wrote:
>
>> This patch introduces the hypervisor call H_GET_TCE 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.
>>
>
> Hi,
>
> Is there an issue with that patch ?
>
I couldn't find any :). Thanks, applied to ppc-next.
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE
2014-03-03 13:02 ` Laurent Dufour
2014-03-03 17:26 ` Alexander Graf
@ 2014-03-03 18:37 ` Andreas Färber
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2014-03-03 18:37 UTC (permalink / raw)
To: Laurent Dufour, Alexander Graf; +Cc: qemu-ppc, qemu-devel, Greg Kurz
Am 03.03.2014 14:02, schrieb Laurent Dufour:
> On 21/02/2014 10:29, Laurent Dufour wrote:
>> This patch introduces the hypervisor call H_GET_TCE 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.
>
> Hi,
>
> Is there an issue with that patch ?
It's "panicking", I think, but otherwise looks sane,
Reviewed-by: Andreas Färber <afaerber@suse.de>
Maybe Alex can verify and update.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-03 18:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-21 9:29 [Qemu-devel] [PATCH] target-ppc: Introduce hypervisor call H_GET_TCE Laurent Dufour
2014-02-21 11:33 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-03-03 13:02 ` Laurent Dufour
2014-03-03 17:26 ` Alexander Graf
2014-03-03 18:37 ` Andreas Färber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).