From: Wei Wang2 <wei.wang2@amd.com>
To: xen-devel@lists.xensource.com
Cc: "Kay, Allen M" <allen.m.kay@intel.com>
Subject: Re: [PATCH] passthru: Fix pci bar remapping for passthru devices
Date: Tue, 21 Jul 2009 11:57:25 +0200 [thread overview]
Message-ID: <200907211157.25952.wei.wang2@amd.com> (raw)
In-Reply-To: <57C9024A16AD2D4C97DC78E552063EA3A91348A3@orsmsx505.amr.corp.intel.com>
Hi Allen,
Pls find my explanations inline.
> I thought the originally code already handles sizing of the BAR operations
> (writing all 1's and reading the size back). How did it work before? Did it
> work because we are relying on the a well behaved guest to restore the
> original value of the BAR after the sizing operation?
In early qemu, remapping mmio was only allowed by pt_cmd_reg_write(). But
currently, guest code can also trigger mmio remapping from pt_bar_reg_write()
and pt_exp_rom_bar_reg_write() and this will cause the problem.
> By reading the code, it is not obvious to me how does not doing r->addr =
> cfg_entry->data operation prevents calling of pt_bar_mapping_one() to
> create p2m mapping.
Guest OS probes pci bar after guest bios doing this, so r->addr will still
have the old mmio base address assigned by guest bios before guest OS
writing '1's. If we prevent r->addr from being updated by cfg_entry->data,
pt_bar_mapping_one() will not trigger any actual p2m updates because it will
check whether r->addr has already been changed before calling r->map_func().
Thanks,
Wei
> Allen
>
> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Wei Wang2 Sent:
> Monday, July 20, 2009 7:04 AM
> To: xen-devel@lists.xensource.com
> Subject: [Xen-devel] [PATCH] passthru: Fix pci bar remapping for passthru
> devices
>
> Hi,
> When guest code tries to get the block size of mmio, it will write all "1"s
> into pci bar register and then qemu will return all "0"s to the don't care
> bits in the emulated bar register to indicate the block size to guest code.
> In this case, we should not create p2m mapping in pt_bar_reg_write() and
> pt_exp_rom_bar_reg_write(). Attached patch fixes this issue, additional
> comment can be found in the patch.
>
> Thanks,
> Wei
>
> Signed-off-by: Wei Wang <wei.wang2@amd.com>
> --
> AMD GmbH, Germany
> Operating System Research Center
>
> Legal Information:
> Advanced Micro Devices GmbH
> Karl-Hammerschmidt-Str. 34
> 85609 Dornach b. München
>
> Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
> Sitz: Dornach, Gemeinde Aschheim, Landkreis München
> Registergericht München, HRB Nr. 43632
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
prev parent reply other threads:[~2009-07-21 9:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 14:03 [PATCH] passthru: Fix pci bar remapping for passthru devices Wei Wang2
2009-07-20 14:26 ` Jiang, Yunhong
2009-07-20 14:47 ` Wei Wang2
2009-07-20 15:48 ` Jiang, Yunhong
2009-07-20 16:29 ` Wei Wang2
2009-07-21 9:06 ` Jiang, Yunhong
2009-07-21 14:31 ` Ian Jackson
2009-07-20 14:48 ` Keir Fraser
2009-07-20 15:49 ` Jiang, Yunhong
2009-07-20 23:39 ` Kay, Allen M
2009-07-21 9:57 ` Wei Wang2 [this message]
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=200907211157.25952.wei.wang2@amd.com \
--to=wei.wang2@amd.com \
--cc=allen.m.kay@intel.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.