From 94d71e8f6abc05285a90a11655286caa860367e3 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Tue, 3 Feb 2015 00:29:58 +0000 Subject: [PATCH] MFC r277792: Fix bug in mapppings of multiple pages exposed by updates to the VSCSI support in QEMU. Each page of a many page mapping was getting mapped to the same physical address, which is not the desired behavior. git-svn-id: svn://svn.freebsd.org/base/stable/10@278122 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/powerpc/pseries/plpar_iommu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/powerpc/pseries/plpar_iommu.c b/sys/powerpc/pseries/plpar_iommu.c index 8db374c7b..5edbf6d50 100644 --- a/sys/powerpc/pseries/plpar_iommu.c +++ b/sys/powerpc/pseries/plpar_iommu.c @@ -191,13 +191,13 @@ phyp_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs, tce = trunc_page(segs[i].ds_addr); tce |= 0x3; /* read/write */ - if (papr_supports_stuff_tce) { - error = phyp_hcall(H_STUFF_TCE, window->map->iobn, - alloced, tce, allocsize/PAGE_SIZE); - } else { - for (j = 0; j < allocsize; j += PAGE_SIZE) - error = phyp_hcall(H_PUT_TCE, window->map->iobn, - alloced + j, tce + j); + for (j = 0; j < allocsize; j += PAGE_SIZE) { + error = phyp_hcall(H_PUT_TCE, window->map->iobn, + alloced + j, tce + j); + if (error < 0) { + panic("IOMMU mapping error: %d\n", error); + return (ENOMEM); + } } segs[i].ds_addr = alloced + (segs[i].ds_addr & PAGE_MASK); -- 2.45.0