qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] pci: Error on PCI capability collisions


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH] pci: Error on PCI capability collisions
Date: Wed, 24 Aug 2011 12:10:32 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2011-08-24 12:04, Michael S. Tsirkin wrote:
> On Tue, Aug 23, 2011 at 07:28:08PM +0200, Jan Kiszka wrote:
>> From: Alex Williamson <address@hidden>
>>
>> Nothing good can happen when we overlap capabilities
>>
>> [ Jan: rebased over qemu, minor formatting ]
>>
>> Signed-off-by: Jan Kiszka <address@hidden>
> 
> This doesn't build for me:
> 
> /scm/qemu/hw/pci.c: In function ‘pci_add_capability’:
> /scm/qemu/hw/pci.c:1970:45: error: ‘PCIDevice’ has no member named 
> ‘config_map’

Yeah, sorry, forgot to refresh the commit before posting.

> 
> I think that what that includes is the capability including each given
> offset, right?  It would be easy to write some code scanning the
> capability list to figure this value out.
> Something along the lines of (untested):
> 
> static
> uint8_t pci_find_capability_at_offset(PCIDevice *pdev, uint8_t offset)
> {                                       
>     uint8_t next, prev, found = 0;
> 
>     if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST))
>         return 0;
> 
>     for (prev = PCI_CAPABILITY_LIST; (next = pdev->config[prev]);
>          prev = next + PCI_CAP_LIST_NEXT)
>         if (next <= offset && next > found)
>             found = next;
> 
>     return found;
> }

Sounds useful, will enhance the patch.

(Originally, I just wanted to reduce the qemu-kvm delta... :) )

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]