lkml.org 
[lkml]   [2014]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Xen-devel] [PATCH 3/3] x86/xen: use the maximum MFN to calculate the required DMA mask
>>> On 12.11.14 at 16:25, <david.vrabel@citrix.com> 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.
Hence I'd suggest

u64
xen_swiotlb_get_required_mask(struct device *dev)
{
unsigned long max_mfn;

max_mfn = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);

return DMA_BIT_MASK(__fls(max_mfn - 1) + 1 + PAGE_SHIFT);
}

Jan



\
 
 \ /
  Last update: 2014-11-12 17:21    [W:0.148 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site