All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhao, Yu" <yu.zhao@intel.com>
To: Kouya Shimura <kouya@jp.fujitsu.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 3/3] ioemu: use the sysfs interface to enable the PCI ROM
Date: Tue, 03 Feb 2009 10:17:30 +0800	[thread overview]
Message-ID: <4987A93A.8030007@intel.com> (raw)
In-Reply-To: <7k63jsl48a.fsf@pingu.sky.yk.fujitsu.co.jp>

Kouya,

I remember the kernel would write base address combined with enable bit 
into ROM BAR when writing '1' to the sysfs, but looks like it doesn't do 
so (the kernel only does this when user maps rom entry through sysfs).

I'll send a patch to fix this.

Thanks,
Yu

Kouya Shimura wrote:
> Hi Yu,
> 
> This patch disabled the hvm from reading the PCI option ROM again.
> Should the kernel(dom0) know the BAR of hidden PCI?
> I don't understand what the problem is. Writing to the real BAR
> of option ROM looks harmless.
> 
> The cause of original problem, which I fixed before about invisibility
> of option ROM, is not the enable flag(bit0) but the address(=0) of ROM
> BAR. Thus your patch looks pointless.
> 
> If you intend to map the ROM in dom0, writing "1" to sysfs is not
> enough. At least, trying to read the ROM is necessary to map the ROM.
> (although nothing can be read in dom0.)
> 
> Thanks,
> Kouya
> 
> Yu Zhao writes:
>> Writing the base address directly to the ROM BAR may cause problem
>> since the kernel is not aware of the operation.
>>
>> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
>> ---
>>  hw/pass-through.c |   25 +++++++++++++++++++++++--
>>  1 files changed, 23 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/pass-through.c b/hw/pass-through.c
>> index 207bdf0..e76a3c3 100644
>> --- a/hw/pass-through.c
>> +++ b/hw/pass-through.c
>> @@ -1447,6 +1447,27 @@ exit:
>>      return val;
>>  }
>>  
>> +static int pt_pci_enable_rom(struct pci_dev *dev)
>> +{
>> +    FILE *fp;
>> +    char path[PATH_MAX];
>> +
>> +    sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.%x/rom",
>> +            dev->domain, dev->bus, dev->dev, dev->func);
>> +
>> +    fp = fopen(path, "w");
>> +    if ( !fp )
>> +    {
>> +        PT_LOG("Can't open %s: %s\n", path, strerror(errno));
>> +        return -1;
>> +    }
>> +
>> +    fprintf(fp, "1");
>> +    fclose(fp);
>> +
>> +    return 0;
>> +}
>> +
>>  static void pt_libpci_fixup(struct pci_dev *dev)
>>  {
>>  #if PCI_LIB_VERSION < 0x030100
>> @@ -1526,8 +1547,8 @@ static int pt_register_regions(struct pt_dev *assigned_device)
>>  
>>          /* Re-set BAR reported by OS, otherwise ROM can't be read. */
>>          if ( (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) == 0 )
>> -            pci_write_long(pci_dev, PCI_ROM_ADDRESS,
>> -                           (pci_dev->rom_base_addr | PCI_ROM_ADDRESS_MASK));
>> +            if ( pt_pci_enable_rom(pci_dev) )
>> +                return -1;
>>  
>>          assigned_device->bases[PCI_ROM_SLOT].e_physbase =
>>              pci_dev->rom_base_addr;
>> -- 
>> 1.5.6.4
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel

      reply	other threads:[~2009-02-03  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-24  4:47 [PATCH 1/3] ioemu: check mmap return value when mapping MSI-x table Yu Zhao
2009-01-24  4:47 ` [PATCH 2/3] ioemu: add libpci fixup to handle recent change in PCIUtils Yu Zhao
2009-01-24  4:47 ` [PATCH 3/3] ioemu: use the sysfs interface to enable the PCI ROM Yu Zhao
2009-02-03  1:05   ` Kouya Shimura
2009-02-03  2:17     ` Zhao, Yu [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=4987A93A.8030007@intel.com \
    --to=yu.zhao@intel.com \
    --cc=kouya@jp.fujitsu.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.