From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPoTw-0007Bo-Vd for qemu-devel@nongnu.org; Mon, 23 Feb 2015 03:35:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPoTr-0006Jw-98 for qemu-devel@nongnu.org; Mon, 23 Feb 2015 03:35:12 -0500 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:59594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPoTq-0006C9-FQ for qemu-devel@nongnu.org; Mon, 23 Feb 2015 03:35:07 -0500 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Feb 2015 18:35:02 +1000 From: Alexey Kardashevskiy Date: Mon, 23 Feb 2015 19:33:52 +1100 Message-Id: <1424680440-10913-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1424680440-10913-1-git-send-email-aik@ozlabs.ru> References: <1424680440-10913-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH 02/10] spapr_iommu: Make H_PUT_TCE_INDIRECT endian-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf 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 Reviewed-by: David Gibson --- hw/ppc/spapr_iommu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 4de6ba1..4b857e8 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -246,7 +246,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; @@ -266,7 +266,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) { @@ -277,8 +277,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; -- 2.0.0