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

Re: [Xen-devel] [PATCH 3/3] x86/xen: use the maximum MFN to calculate the required DMA mask



>>> On 12.11.14 at 16:55, <JBeulich@xxxxxxxx> wrote:
>>>> On 12.11.14 at 16:25, <david.vrabel@xxxxxxxxxx> wrote:
>> +u64
>> +xen_swiotlb_get_required_mask(struct device *dev)
>> +{
>> +    u64 max_mfn;
>> +
>> +    max_mfn = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
>> +
>> +    return DMA_BIT_MASK(fls64(max_mfn << PAGE_SHIFT) + 1);
>> +}
> 
> The value the hypercall returns is exclusive and an unsigned long.

The latter has further relevance: For one, HYPERVISOR_memory_op()
returns "int" currently - this needs to become "long" for the purpose
here (also for eventual future uses of XENMEM_maximum_gpfn and
XENMEM_{current,maximum}_reservation).

And then, using u64 rather than unsigned long for max_mfn would
still cause problems for 32-bit kernels on systems with memory
extending beyond the 8Tb boundary (since the long -> u64
conversion really goes long -> s64 -> u64).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.