From: "Yang, Sheng" <sheng.yang@intel.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm: device-assignment: Add PCI option ROM support
Date: Mon, 22 Jun 2009 13:32:21 +0800 [thread overview]
Message-ID: <200906221332.21651.sheng.yang@intel.com> (raw)
In-Reply-To: <1245419080.17330.98.camel@bling>
On Friday 19 June 2009 21:44:40 Alex Williamson wrote:
> On Fri, 2009-06-19 at 15:27 +0800, Yang, Sheng wrote:
> > On Friday 19 June 2009 00:28:41 Alex Williamson wrote:
> > > The one oddity I noticed is that even when the enable bit is clear, the
> > > guest can read the ROM. I don't know that this is actually illegal, vs
> > > returning zeros or ones though. It seems like maybe the generic PCI
> > > code isn't tracking the enable bit. I think that's an independent
> > > problem from this patch though. Thanks,
> >
> > That should be fine. I've taken a look at code, seems Linux kernel set
> > enable_bit when someone begin to read rom, and copy rom to buffer, then
> > unmap the rom. So the rom can be read when enable bit clear.
>
> For this testing, I used an mmap of the ROM address though, so the
> kernel caching shouldn't have been involved. It looks to me like the
> problem is that the map function provided via pci_register_io_region()
> only knows how to create mappings, not tear them down. I think maybe
> pci_update_mappings() should still call the map_func when new_addr is -1
> to let the io space drive shutdown the mapping. As it is, once we setup
> the mapping, it lives until something else happens to overlap it,
> regardless of the state of the PCI BAR. Thanks,
I think it may not necessary to tear them down, for the bar mapping won't
change IIUR.
And you are accessing the sysfs file, right? In the Linux kernel, IIRC,
pci_create_sysfs_dev_files() create sysfs file, and hook the read to
pci_read_rom(), which called pci_map_rom(), which would call pci_enable_rom(),
and write the enable_rom bit to the rom_base_reg. So that the rom can be read
regardless of enable_rom bit state - and .
But I also found something interested. The write hook of file, pci_write_rom()
seems won't cause NMI(and seems you need write a char rather than 0 to enable
the accessing?). So why NMI happen in host?...
--
regards
Yang, Sheng
next prev parent reply other threads:[~2009-06-22 5:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 16:29 [PATCH] kvm: device-assignment: Add PCI option ROM support Alex Williamson
2009-06-18 5:30 ` Yang, Sheng
2009-06-18 16:28 ` Alex Williamson
2009-06-19 7:27 ` Yang, Sheng
2009-06-19 13:44 ` Alex Williamson
2009-06-22 5:32 ` Yang, Sheng [this message]
2009-06-22 16:09 ` Alex Williamson
2009-06-23 1:25 ` Yang, Sheng
2009-06-22 8:38 ` 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=200906221332.21651.sheng.yang@intel.com \
--to=sheng.yang@intel.com \
--cc=alex.williamson@hp.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