On 19/01/2017 04:32, Jason Wang wrote:
>>
>>>
>>>> + addr &= ~(sz - 1);
>>>> + } else {
>>>> + sz = VTD_PAGE_SIZE;
>>>> + }
>>>> + entry.target_as = &vtd_dev_as->as;
>>>> + entry.addr_mask = sz - 1;
>>>> + entry.iova = addr;
>>> If S=1, entry.iova must mask away the 1 bits that specified the size.
>>> For example,
>>>
>>> addr = 0xabcd1000
>>>
>>> has cto64(0xabcd1) == 1, so it indicates a 16K invalidation from
>>> 0xabcd0000 to 0xabcd3fff. The "1" must be masked away with "addr & -sz"
>>> or "addr & ~entry.addr_mask".
>>>
>>> Thanks,
>>>
>>> Paolo
>>
>> Good catch.
>
> It should be addr & ~(sz - 1) I think? And it has been done above :)
Oh, of course!
Paolo