Received: from eggs.gnu.org ([2001:4830:134:3::10]:50198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTTWj-0007W1-1P for qemu-devel@nongnu.org; Thu, 05 Mar 2015 06:01:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTTWc-000560-Rz for qemu-devel@nongnu.org; Thu, 05 Mar 2015 06:01:12 -0500 Received: from host217-34-137-81.in-addr.btopenworld.com ([217.34.137.81]:38742 helo=external.sentinel2) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTTWc-00055f-LR for qemu-devel@nongnu.org; Thu, 05 Mar 2015 06:01:06 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 05 Mar 2015 11:01:04 +0000 From: Gordan Bobic In-Reply-To: <1425552166.12745.57.camel@nilsson.home.kraxel.org> References: <97fd6e025b9dfa941ea0d7677b52f66c@mail.shatteredsilicon.net> <1425475231.8389.63.camel@nilsson.home.kraxel.org> <9779520a9ba5544750f4eb570ce3bf8c@mail.shatteredsilicon.net> <1425542908.12745.22.camel@nilsson.home.kraxel.org> <1425552166.12745.57.camel@nilsson.home.kraxel.org> Message-ID: Subject: Re: [Qemu-devel] =?utf-8?q?QEMU_etc/e820_and_fw=5Fcfg?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On 2015-03-05 10:42, Gerd Hoffmann wrote: > Hi, > >> >> Thank you for responding. The situation I have is that my PCIe >> >> bridges are buggy and they seem to bypass the upstream PCIe hub >> >> IOMMU. The problem with this is that when the guest accesses >> >> RAM within it's emulated address space that overlaps with >> >> PCI I/O memory ranges in the host's address space, what should >> >> have ended up in RAM in the guest ends up trampling over the >> >> IOMEM on the host. >> > >> > The iommu isn't involved here at all. When the pci devices are >> > accessing host ram via busmaster dma, *this* goes through the iommu. >> > And unless you are trying to use pci device assignment the iommu should >> > not matter at all. >> >> I am using PCI device assignment. I'm passing a PCI devices to the >> guest VM. > > Oh. I didn't expect someone trying to use device assign with a > known-broken iommu. /me looks surprised. Since all I have is lemons I'm trying to make lemonade. :) >> I'm pretty sure I am dealing with a hardware bug here. I have >> a workaround that I know works (mark the host's IOMEM areas >> as reserved) - I just need a way to get QEMU to adjust the >> exposed e820 map accordingly. > > Add "e820_add_entry(start, size, E820_RESERVED)" calls in qemu. Could you please point me at the correct file/function to add the relevant block into? I would probably look to do add these based on a config file in /etc/qemu/. Happy to forward a patch for inclusion if I manage to make it work. > Also make sure the firmware doesn't use those ranges, which may need > firmware patching. At least seabios should happily add those > reservations to the e820 map, but will not look at them otherwise, so > you could end up with pci bars being mapped within the reserved > regions. Are you saying that seabios will find reserved areas in the e820 map and despite that map a BAR into a reserved block? That's pretty broken... > The linux kernel might fix it up at boot though. If you mean inside the VM, Linux-on-Linux isn't my intended use case, though. > Not fully sure how OVMF behaves here. Thanks for your input. I'll find an appropriate place to ask about OVMF once I have the QEMU patched appropriately. Gordan