summaryrefslogtreecommitdiffstats
path: root/hw/ppc/spapr_iommu.c
diff options
context:
space:
mode:
authorAlexey Kardashevskiy2015-05-07 07:33:29 +0200
committerAlexander Graf2015-06-03 23:56:50 +0200
commitf1215ea702e6e6cb3876221cf1f7f60133e08c30 (patch)
tree9ae49ff634feb0c97c72f83055cc9995d319f405 /hw/ppc/spapr_iommu.c
parentspapr_iommu: Disable in-kernel IOMMU tables for >4GB windows (diff)
downloadqemu-f1215ea702e6e6cb3876221cf1f7f60133e08c30.tar.gz
qemu-f1215ea702e6e6cb3876221cf1f7f60133e08c30.tar.xz
qemu-f1215ea702e6e6cb3876221cf1f7f60133e08c30.zip
spapr_iommu: Make H_PUT_TCE_INDIRECT endian-safe
PAPR is defined as big endian so TCEs need an adjustment so does this patch. This changes code to have ldq_be_phys() in one place. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/ppc/spapr_iommu.c')
-rw-r--r--hw/ppc/spapr_iommu.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index e19bf89929..65ca4691a4 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -247,7 +247,7 @@ static target_ulong h_put_tce_indirect(PowerPCCPU *cpu,
target_ulong ioba1 = ioba;
target_ulong tce_list = args[2];
target_ulong npages = args[3];
- target_ulong ret = H_PARAMETER;
+ target_ulong ret = H_PARAMETER, tce = 0;
sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
CPUState *cs = CPU(cpu);
hwaddr page_mask, page_size;
@@ -267,7 +267,7 @@ static target_ulong h_put_tce_indirect(PowerPCCPU *cpu,
for (i = 0; i < npages; ++i, ioba += page_size) {
target_ulong off = (tce_list & ~SPAPR_TCE_RW) +
i * sizeof(target_ulong);
- target_ulong tce = ldq_phys(cs->as, off);
+ tce = ldq_be_phys(cs->as, off);
ret = put_tce_emu(tcet, ioba, tce);
if (ret) {
@@ -278,8 +278,7 @@ static target_ulong h_put_tce_indirect(PowerPCCPU *cpu,
/* Trace last successful or the first problematic entry */
i = i ? (i - 1) : 0;
trace_spapr_iommu_indirect(liobn, ioba1, tce_list, i,
- ldq_phys(cs->as,
- tce_list + i * sizeof(target_ulong)),
+ tce,
ret);
return ret;