public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] slow_map: minor improvements to ROM BAR handling
Date: Tue, 22 Dec 2009 18:05:01 +0200	[thread overview]
Message-ID: <20091222160501.GC18676@redhat.com> (raw)
In-Reply-To: <4B30ED34.2000000@suse.de>

On Tue, Dec 22, 2009 at 05:00:52PM +0100, Alexander Graf wrote:
> Avi Kivity wrote:
> > On 12/22/2009 05:41 PM, Alexander Graf wrote:
> >>
> >>> We could certainly extend emulate.c to fetch instruction bytes from
> >>> userspace.  It uses ->read_std() now, so we'd need to switch to
> >>> ->read_emulated() and add appropriate buffering.
> >>>      
> >> I thought the policy on emulate.c was to not have a full instruction
> >> emulator but only emulate instructions that do PT modifications or MMIO
> >> access?
> >>    
> >
> > It's not a policy, just laziness.  With emulate_invalid_guest_state=1
> > we need many more instructions.  Of course I don't want to add
> > instructions just for the sake of it, since they will be untested.
> >
> > I'd much prefer not to run from mmio if possible - just pointing out
> > it's doable.
> 
> Right...
> 
> >> emulator is _really_ small. It only does a few MMU specific
> >> instructions, a couple of privileged ones and MMIO accessing ones.
> >>    
> > Btw, we're in the same situation with PowerPC here. The instruction
> >
> > Plus, you have a fixed length instruction length, likely more regular
> > too.  I imagine powerpc is load/store, so you don't have to emulate a
> > zillion ALU instructions?
> 
> Well, it's certainly doable (and easier than on x86). But I'm on the
> same position as you on the x86 side. Why increase the emulator size at
> least 10 times if we don't have to?
> 
> Either way, people will report bugs when / if they actually start
> executing code off MMIO. So let's not care too much about it for now.
> Just make sure the read-only check is in.
> 
> Alex

So I think all we need is this on top?

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 066fdb6..0c3c8f4 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -233,7 +233,8 @@ static void assigned_dev_iomem_map_slow(PCIDevice *pci_dev, int region_num,
     int m;
 
     DEBUG("slow map\n");
-    m = cpu_register_io_memory(slow_bar_read, slow_bar_write, region);
+    m = cpu_register_io_memory(slow_bar_read, region_num == PCI_ROM_SLOT ?
+                               NULL : slow_bar_write, region);
     cpu_register_physical_memory(e_phys, e_size, m);
 
     /* MSI-X MMIO page */

  reply	other threads:[~2009-12-22 16:07 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
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 [this message]
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=20091222160501.GC18676@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