From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] slow_map: minor improvements to ROM BAR handling
Date: Tue, 22 Dec 2009 17:19:11 +0200 [thread overview]
Message-ID: <20091222151911.GC18541@redhat.com> (raw)
In-Reply-To: <4B30CAF2.4040409@suse.de>
On Tue, Dec 22, 2009 at 02:34:42PM +0100, Alexander Graf wrote:
> Michael S. Tsirkin wrote:
> > On Tue, Dec 22, 2009 at 01:05:23PM +0100, Alexander Graf wrote:
> >
> >> Michael S. Tsirkin wrote:
> >>
> >>> ROM BAR can be handled same as regular BAR:
> >>> load_option_roms utility will take care of
> >>> copying it to RAM as appropriate.
> >>>
> >>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >>> ---
> >>>
> >>> This patch applies on top of agraf's one,
> >>> it takes care of non-page aligned ROM BARs as well:
> >>> they mostly are taken care of, we just do not
> >>> need to warn user about them.
> >>>
> >>> hw/device-assignment.c | 20 +++++++++-----------
> >>> 1 files changed, 9 insertions(+), 11 deletions(-)
> >>>
> >>> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
> >>> index 000fa61..066fdb6 100644
> >>> --- a/hw/device-assignment.c
> >>> +++ b/hw/device-assignment.c
> >>> @@ -486,25 +486,23 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
> >>> : PCI_BASE_ADDRESS_SPACE_MEMORY;
> >>>
> >>> if (cur_region->size & 0xFFF) {
> >>> - fprintf(stderr, "PCI region %d at address 0x%llx "
> >>> - "has size 0x%x, which is not a multiple of 4K. "
> >>> - "You might experience some performance hit due to that.\n",
> >>> - i, (unsigned long long)cur_region->base_addr,
> >>> - cur_region->size);
> >>> + if (i != PCI_ROM_SLOT) {
> >>> + fprintf(stderr, "PCI region %d at address 0x%llx "
> >>> + "has size 0x%x, which is not a multiple of 4K. "
> >>> + "You might experience some performance hit "
> >>> + "due to that.\n",
> >>> + i, (unsigned long long)cur_region->base_addr,
> >>> + cur_region->size);
> >>> + }
> >>> slow_map = 1;
> >>>
> >>>
> >> This is wrong. You're setting slow_map = 1 on code that is very likely
> >> to be executed inside the guest. That doesn't work.
> >>
> >
> > It is? Can you really run code directly from a PCI card?
> > I looked at BIOS boot specification and it always talks
> > about shadowing PCI ROMs.
> >
>
> I'm not sure the BIOS is the only one executing ROMs. If it is, then I'm
> good with the change.
> Maybe it'd make sense to also add a read only flag so we don't
> accidently try to write to the ROM region with slow_map.
>
> Alex
Correct: I think it's made readonly down the road with mprotect,
so attempt to do so will crash qemu :)
--
MST
next prev parent reply other threads:[~2009-12-22 15:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 11:10 [PATCH] slow_map: minor improvements to ROM BAR handling Michael S. Tsirkin
2009-12-22 12:05 ` Alexander Graf
2009-12-22 12:43 ` Michael S. Tsirkin
2009-12-22 13:34 ` Alexander Graf
2009-12-22 15:19 ` Michael S. Tsirkin [this message]
2009-12-22 15:23 ` Avi Kivity
2009-12-22 15:24 ` Alexander Graf
2009-12-22 15:28 ` Michael S. Tsirkin
2009-12-22 15:36 ` Alexander Graf
2009-12-22 15:39 ` Avi Kivity
2009-12-22 15:41 ` Alexander Graf
2009-12-22 15:47 ` Avi Kivity
2009-12-22 16:00 ` Alexander Graf
2009-12-22 16:05 ` Michael S. Tsirkin
2009-12-22 16:10 ` Alexander Graf
2009-12-23 9:07 ` Avi Kivity
2009-12-23 9:15 ` Michael S. Tsirkin
2009-12-23 9:25 ` Avi Kivity
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=20091222151911.GC18541@redhat.com \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/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