From: John Snow <jsnow@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Jordan Hargrave <jharg93@gmail.com>,
Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ahci: map memory via device's address space instead of address_space_memory
Date: Mon, 09 Mar 2015 18:42:07 -0400 [thread overview]
Message-ID: <54FE21BF.8060905@redhat.com> (raw)
In-Reply-To: <54EF97F0.7020104@redhat.com>
On 02/26/2015 05:02 PM, Paolo Bonzini wrote:
>
>
> On 26/02/2015 22:31, Jordan Hargrave wrote:
>>
>> 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.
>
> That's a bug in QEMU. map_page must be skipped unless PORT_CMD_FIS_ON
> is set in pr->cmd (also, QEMU is never resetting PORT_CMD_FIS_ON when
> PORT_CMD_FIS_RX goes down).
>
> Paolo
>
map_page must be skipped *if* PORT_CMD_FIS_ON is set -- or rather, that
produces undefined behavior in the AHCI spec. We can only set these
fields when the FIS Receive Engine is off. We can only modify the CLB if
PxCMD.ST is off.
We also never actually reset PORT_CMD_FIS_RX or PORT_CMD_FIS_ON
ourselves, so the status bit will get reset when the user writes zeroes
to those bits when writing PxCMD. (We always clear PORT_CMD_FIS_ON and
PORT_CMD_LIST_ON both upon any write to PxCMD, then re-add these flags
if we see the user has written PORT_CMD_START or PORT_CMD_FIS_RX.)
So I think I can fix this just by delaying the CLB and FB mappings to
the PORT_CMD_LIST_ON and PORT_CMD_FIS_ON events. I'll send a patch.
next prev parent reply other threads:[~2015-03-09 22:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 5:13 [Qemu-devel] [PATCH] ahci: map memory via device's address space instead of address_space_memory Jordan Hargrave
2015-02-26 14:45 ` Stefan Hajnoczi
2015-02-26 21:31 ` Jordan Hargrave
2015-02-26 22:02 ` Paolo Bonzini
2015-03-09 22:42 ` John Snow [this message]
2015-02-26 22:31 ` John Snow
[not found] ` <CAC1AzdcoEUtiGyCSXSf0bniUvQZ9tTeX2Vc9KQUyBfQxFV+JFg@mail.gmail.com>
2015-03-02 16:37 ` John Snow
2015-03-12 17:41 ` John Snow
-- strict thread matches above, loose matches on Subject: below --
2014-07-03 8:26 Le Tan
2014-07-03 8:28 ` Michael S. Tsirkin
2014-07-03 8:47 ` Paolo Bonzini
2014-07-03 8:43 ` Jan Kiszka
2014-07-03 9:41 ` Paolo Bonzini
2014-07-03 10:11 ` Michael S. Tsirkin
2014-07-03 10:02 ` Michael S. Tsirkin
2014-07-03 16:45 ` Jan Kiszka
2014-07-03 20:30 ` Michael S. Tsirkin
2014-07-04 5:26 ` Jan Kiszka
2014-07-06 5:58 ` Michael S. Tsirkin
2014-07-07 8:23 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54FE21BF.8060905@redhat.com \
--to=jsnow@redhat.com \
--cc=jharg93@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).