qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: [PATCHv2] qemu: target library, use it in msix


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] Re: [PATCHv2] qemu: target library, use it in msix
Date: Sun, 27 Sep 2009 14:00:41 +0200
User-agent: Mutt/1.5.19 (2009-01-05)

On Sun, Sep 27, 2009 at 01:55:17PM +0200, Avi Kivity wrote:
> On 09/27/2009 01:45 PM, Michael S. Tsirkin wrote:
>>
>>    
>>>> Thinking about this some more, this function just says "align a value to
>>>> page size". The value might not be a bus address at all, and indeed with
>>>> msix use, it is not. Makes sense?
>>>>
>>>>        
>>> In any case restricting it to unsigned invites truncation.
>>>      
>> If the value we are aligning fits in 32 bit, so does the aligned value.
>>    
>
> It's perfectly reasonable to call a such a function with a  
> target_ulong_t 

address@hidden qemu]$ grep -rIi target_ulong_t .
address@hidden qemu]$

?

> or target_phys_addr_t input and expect it to work.

Not if it's called target_page_align32 :)

>>>   We can have
>>>
>>>     target_phys_addr_t target_phys_page_align();
>>>     target_ulong_t target_virt_page_align();
>>>      
>> Right. And also
>>     target_page_align32();
>>     target_page_align64();
>>
>> We only use a 32 bit version now (passed value is a constant),
>> so I think I'll only implement it, and we'll add more when
>> they are used.
>>    
>
> How would the caller know what size argument they have?  They usually  
> have a target_phys_addr_t or a target_ulong_t.

In practice, the only user is now msix and it does not.  It has 0x1000
as a constant parameter.  For target_phys_addr_t users if we ever have
them, we'll just add target_phys_page_align. Generally it's unusual for
devices to care about size of target physical page.

> -- 
> Do not meddle in the internals of kernels, for they are subtle and quick to 
> panic.




reply via email to

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