Skip to contentSkip to conversation

Calgary and bad_dma_address

DISCUSSION Pete Zaitcev 3 participants 4 messages Sep 10, 2008

lore
Share & tools
lore
#0 lore raw

Hi, guys:

I was reading arch/x86/kernel/pci-calgary_64.c today, and noticed that apparently nothing prevents iommu_area_alloc from returning a zero. But bad_dma_address is zero too. Doesn't it concern anyone? If the first allocation asks for a page-aligned buffer to be mapped, a spurious bad address will result, if I understand this right.

The simplest way to avoid the problem is to lose a page and set a bit in tce_table_setparms():
set_bit(tbl->it_map, bad_dma_address);
But I don't see anything like that done anywhere.

-- Pete

#1 lore raw

From: Pete Zaitcev <[email protected]>
Date: Tue, 9 Sep 2008 21:19:41 -0600

Quoted 5 lines

I was reading arch/x86/kernel/pci-calgary_64.c today, and noticed that apparently nothing prevents iommu_area_alloc from returning a zero. But bad_dma_address is zero too. Doesn't it concern anyone? If the first allocation asks for a page-aligned buffer to be mapped, a spurious bad address will result, if I understand this right.

Won't the device range reserves done by calls of calgary_reserve_mem_region() take care of this?

#2 lore raw
Quoted 6 lines · David Miller
Quoted 3 lines

I was reading arch/x86/kernel/pci-calgary_64.c today, and noticed that apparently nothing prevents iommu_area_alloc from returning a zero. But bad_dma_address is zero too. Doesn't it concern anyone?

Won't the device range reserves done by calls of calgary_reserve_mem_region() take care of this?

Sorry, my mistake. Indeed it does, thanks.

-- Pete

#3 lore raw
In reply to Pete Zaitcev
Quoted 7 lines · On Tue, 9 Sep 2008 21:19:41 -0600 Pete Zaitcev <[email protected]> wrote:

Hi, guys:

I was reading arch/x86/kernel/pci-calgary_64.c today, and noticed that apparently nothing prevents iommu_area_alloc from returning a zero. But bad_dma_address is zero too. Doesn't it concern anyone? If the first allocation asks for a page-aligned buffer to be mapped, a spurious bad address will result, if I understand this right.

Does calgary_reserve_regions() prevent that?