Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753308AbaKLPza (ORCPT ); Wed, 12 Nov 2014 10:55:30 -0500 Received: from mail.emea.novell.com ([130.57.118.101]:53466 "EHLO mail.emea.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbaKLPz2 convert rfc822-to-8bit (ORCPT ); Wed, 12 Nov 2014 10:55:28 -0500 Message-Id: <546390FC0200007800046E50@mail.emea.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.0.1 Date: Wed, 12 Nov 2014 15:55:24 +0000 From: "Jan Beulich" To: "David Vrabel" Cc: , "Thomas Gleixner" , "Greg Kroah-Hartman" , , "Boris Ostrovsky" , "Ingo Molnar" , , "H. Peter Anvin" Subject: Re: [Xen-devel] [PATCH 3/3] x86/xen: use the maximum MFN to calculate the required DMA mask References: <1415805906-27316-1-git-send-email-david.vrabel@citrix.com> <1415805906-27316-4-git-send-email-david.vrabel@citrix.com> In-Reply-To: <1415805906-27316-4-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> On 12.11.14 at 16:25, 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/