qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH 2/2] pci: don't overwrite pci header type.
Date: Wed, 16 Jun 2010 15:12:25 -0500	[thread overview]
Message-ID: <4C193029.8040704@codemonkey.ws> (raw)
In-Reply-To: <20100616192223.GA7530@redhat.com>

On 06/16/2010 02:22 PM, Michael S. Tsirkin wrote:
> On Wed, Jun 16, 2010 at 07:02:54PM +0000, Blue Swirl wrote:
>    
>> On Wed, Jun 16, 2010 at 6:51 PM, Michael S. Tsirkin<mst@redhat.com>  wrote:
>>      
>>> On Wed, Jun 16, 2010 at 06:41:22PM +0000, Blue Swirl wrote:
>>>        
>>>> On Wed, Jun 16, 2010 at 8:54 AM, Michael S. Tsirkin<mst@redhat.com>  wrote:
>>>>          
>>>>> On Wed, Jun 16, 2010 at 11:20:02AM +0900, Isaku Yamahata wrote:
>>>>>            
>>>>>> On Tue, Jun 15, 2010 at 12:12:07PM +0300, Michael S. Tsirkin wrote:
>>>>>>              
>>>>>>> On Tue, Jun 15, 2010 at 02:06:46PM +0900, Isaku Yamahata wrote:
>>>>>>>                
>>>>>>>> Don't overwrite pci header type.
>>>>>>>> Otherwise, multi function bit which pci_init_header_type() sets
>>>>>>>> appropriately is lost.
>>>>>>>> Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero
>>>>>>>> which is already zero cleared.
>>>>>>>>
>>>>>>>> Signed-off-by: Isaku Yamahata<yamahata@valinux.co.jp>
>>>>>>>>                  
>>>>>>> ...
>>>>>>>
>>>>>>>                
>>>>>>>> diff --git a/hw/apb_pci.c b/hw/apb_pci.c
>>>>>>>> index 31c8d70..cdf3bc2 100644
>>>>>>>> --- a/hw/apb_pci.c
>>>>>>>> +++ b/hw/apb_pci.c
>>>>>>>> @@ -428,7 +428,8 @@ static int pbm_pci_host_init(PCIDevice *d)
>>>>>>>>                    PCI_STATUS_DEVSEL_MEDIUM);
>>>>>>>>       pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
>>>>>>>>       pci_set_byte(d->config + PCI_HEADER_TYPE,
>>>>>>>> -                 PCI_HEADER_TYPE_NORMAL);
>>>>>>>> +                 (pci_get_byte(d->config + PCI_HEADER_TYPE)&
>>>>>>>> +                  PCI_HEADER_TYPE_MULTI_FUNCTION) | PCI_HEADER_TYPE_NORMAL);
>>>>>>>>                  
>>>>>>> what is this doing?
>>>>>>>                
>>>>>> It changes the header type to normal device(bit 1-7) without overwriting
>>>>>> multi function bit(bit 8).
>>>>>>              
>>>>> Don't we know what the multi function bit value is?
>>>>>
>>>>>            
>>>>>> Apb host bridge specifies PCI_HEADER_TYPE_BRIDGE in PCIDeviceInfo,
>>>>>> on the other hand pbc_pci_host_init() sets the register
>>>>>> to PCI_HEADER_TYPE_NORMAL.
>>>>>> To be honest I don't know why it does so, but that is what Blue wants.
>>>>>>              
>>>>> BTW I think it would be prettier to have is_bridge instead of header_type
>>>>> as a qdev property. Agree?
>>>>>            
>>>> Good idea.
>>>>
>>>>          
>>>>>> So I touch only multi function bit(bit 8) and leave other bit (bit 1-7)
>>>>>> unchanged.
>>>>>>
>>>>>> If you don't like this hunk, I'll drop this hunk and leave it to Blue.
>>>>>> What do you think?
>>>>>>              
>>>>> Blue Swirl, could you comment on this please?
>>>>>            
>>>> I'd go for is_bridge and drop the override for header type in apb_pci.c then.
>>>>          
>>> Yes, but what header type does it need?
>>>        
>> The type should be bridge (to allow writes to bridge registers), but
>> PCI header should use PCI_HEADER_TYPE_NORMAL (because the PBM
>> specification says so).
>>      
> I can no longer get the PBM specs now: are there
> alternative links? Need to fix links in code.
>    

BTW, I set up http://wiki.qemu.org/Documentation/HardwareManuals so we 
could start archiving these specification when allowed.

Regards,

Anthony Liguori

>    
>>>>>> static PCIDeviceInfo pbm_pci_host_info = {
>>>>>>      .qdev.name = "pbm",
>>>>>>      .qdev.size = sizeof(PCIDevice),
>>>>>>      .init      = pbm_pci_host_init,
>>>>>>      .header_type  = PCI_HEADER_TYPE_BRIDGE,<<<<<  Here
>>>>>> };
>>>>>>
>>>>>> --
>>>>>> yamahata
>>>>>>              
>>>>>            
>>>        
>    

  parent reply	other threads:[~2010-06-16 20:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  5:06 [Qemu-devel] [PATCH 0/2] pci: multi-function bit fixes Isaku Yamahata
2010-06-15  5:06 ` [Qemu-devel] [PATCH 1/2] pci: set PCI multi-function bit appropriately Isaku Yamahata
2010-06-15  5:06 ` [Qemu-devel] [PATCH 2/2] pci: don't overwrite pci header type Isaku Yamahata
2010-06-15  9:12   ` [Qemu-devel] " Michael S. Tsirkin
2010-06-16  2:20     ` Isaku Yamahata
2010-06-16  8:54       ` Michael S. Tsirkin
2010-06-16  9:43         ` Isaku Yamahata
2010-06-16 11:19           ` Michael S. Tsirkin
2010-06-16 11:38             ` Isaku Yamahata
2010-06-16 12:43               ` Michael S. Tsirkin
2010-06-16 18:41         ` Blue Swirl
2010-06-16 18:51           ` Michael S. Tsirkin
2010-06-16 19:02             ` Blue Swirl
2010-06-16 19:22               ` Michael S. Tsirkin
2010-06-16 19:59                 ` Blue Swirl
2010-06-16 20:12                 ` Anthony Liguori [this message]
2010-06-15  9:42   ` [Qemu-devel] " malc

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=4C193029.8040704@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=blauwirbel@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /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;
as well as URLs for NNTP newsgroup(s).