From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSTLd-0002Xa-KT for qemu-devel@nongnu.org; Mon, 02 Mar 2015 11:37:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSTLY-0006gC-Hf for qemu-devel@nongnu.org; Mon, 02 Mar 2015 11:37:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSTLY-0006fs-A3 for qemu-devel@nongnu.org; Mon, 02 Mar 2015 11:37:32 -0500 Message-ID: <54F491C9.4040705@redhat.com> Date: Mon, 02 Mar 2015 11:37:29 -0500 From: John Snow MIME-Version: 1.0 References: <20150226144504.GA23124@stefanha-thinkpad.redhat.com> <54EF9EC6.3030407@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] ahci: map memory via device's address space instead of address_space_memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jordan Hargrave Cc: qemu-devel On 03/02/2015 11:03 AM, Jordan Hargrave wrote: > > > On Thu, Feb 26, 2015 at 4:31 PM, John Snow > wrote: > > (Please don't top-post on qemu-devel: gmail is kind of awful about > this, but if you expand the conversation while in-reply, you can > edit beneath the quote instead of above.) > > On 02/26/2015 04:31 PM, Jordan Hargrave wrote: > > The problem is the FIS registers have stale data. > > SeaBIOS initialization leaves the registers: > PORT_FIS_ADDR = 0x7fae0000 > PORT_FIS_ADDR_HI = 0x0 > > My OS initializes DMAR page tables and then enables the IOMMU > translation. > Then OS initializes AHCI driver. Writes VIRTUAL DMA to FIS > registers. > eg. FIS DMA address is 0x10000 (maps to some hardware physical > address > via iommu) > > The OS writes 0x00 PORT_FIS_ADDR_HI -> qemu calls map_page (0x00 > << 32) > | 0x7fae0000... 0x7fae0000 is stale, and is not in the IOMMU > page map. > Causes a non-recoverable IOMMU fault. > > > > OK, I see. > > We can probably fix this by delaying the map and having it map > on-demand before first access, setting a dirty flag if the registers > have changed since last use. > > It might be an AHCI spec violation to change this register once the > FIS Receive Engine is active, too, so it might not be too hard of a > change; perhaps we can just map the FIS Receive Buffer once the FRE > is started. > > Did you want to send a patch, or should I? > > --js > > > I'm not as familiar with qemu internals yet to figure out how to map the > memory on demand. I switched order of FIS initialization in my OS > driver for the time being. The same problem was happening with the > PORT_ADDR_LST/PORT_ADDR_LST_HI register initialization pwas well. Okay, I'll pick this up, then. Thanks!