qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] s390: implement pci instructions


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/3] s390: implement pci instructions
Date: Tue, 11 Nov 2014 12:17:17 +0000

On 11 November 2014 12:10, Frank Blaschka <address@hidden> wrote:
> On Mon, Nov 10, 2014 at 04:56:21PM +0100, Alexander Graf wrote:
>> > +static uint8_t barsize(uint64_t size)
>> > +{
>> > +    uint64_t mask = 1;
>> > +    int i;
>> > +
>> > +    if (!size) {
>> > +        return 0;
>> > +    }
>> > +
>> > +    for (i = 0; i < 64; i++) {
>> > +        if (size & mask) {
>> > +            break;
>> > +        }
>> > +        mask = (mask << 1);
>> > +    }
>> > +
>> > +    return i;
>> > +}
>>
>> Isn't there an existing helper for this in the PCI layer?
>>
>
> Did not find one, this function is used to fill a s390 specific len
> in an instruction intercept (architecture specific encoding of the len).

If you do need to implement this here then you should probably
be using ctz64(). I think what you have here is equivalent to

    return size ? ctz64(size) : 0;

but you should check that.

thanks
-- PMM



reply via email to

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