Received: from eggs.gnu.org ([208.118.235.92]:39397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UX2Ge-0006pv-Fb for qemu-devel@nongnu.org; Tue, 30 Apr 2013 00:34:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UX2Gd-0000ZK-E3 for qemu-devel@nongnu.org; Tue, 30 Apr 2013 00:34:16 -0400 Received: from mail-gg0-x229.google.com ([2607:f8b0:4002:c02::229]:40350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UX2Gd-0000Z7-9x for qemu-devel@nongnu.org; Tue, 30 Apr 2013 00:34:15 -0400 Received: by mail-gg0-f169.google.com with SMTP id b6so21976ggm.14 for ; Mon, 29 Apr 2013 21:34:14 -0700 (PDT) From: Alexey Kardashevskiy Date: Tue, 30 Apr 2013 14:33:51 +1000 Message-Id: <1367296434-15453-2-git-send-email-aik@ozlabs.ru> In-Reply-To: <1367296434-15453-1-git-send-email-aik@ozlabs.ru> References: <1367296434-15453-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH 1/4] pseries: Factor out check for out-of-bounds LIOBN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agraf@suse.de Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au From: David Gibson PAPR defines LIOBNs (Logical IO Bus Numbers) to be 32-bit, and we check for values that aren't in the code for H_PUT_TCE. This patch factors the check into spapr_tce_find_by_liobn(), which already checks if a 32-bit LIOBN actually exists. This will become more important as future patches add other hypercalls which need to look up a LIOBN. At the same time we fix the typo in the message. Signed-off-by: David Gibson Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_iommu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index d2782cf..c6aa4fe 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -55,6 +55,12 @@ static sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn) { sPAPRTCETable *tcet; + if (liobn & 0xFFFFFFFF00000000ULL) { + hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n", + liobn); + return NULL; + } + QLIST_FOREACH(tcet, &spapr_tce_tables, list) { if (tcet->liobn == liobn) { return tcet; @@ -218,12 +224,6 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong tce = args[2]; sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn); - if (liobn & 0xFFFFFFFF00000000ULL) { - hcall_dprintf("spapr_vio_put_tce on out-of-boundsw LIOBN " - TARGET_FMT_lx "\n", liobn); - return H_PARAMETER; - } - ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1); if (tcet) { -- 1.7.10.4