From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrsLi-00042a-VW for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:55:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrsLd-00042N-DE for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:55:29 -0400 Received: from [199.232.76.173] (port=39031 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrsLd-00042K-Az for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:55:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58048) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrsLc-0002WM-Oe for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:55:25 -0400 Message-ID: <4ABF52A5.5080409@redhat.com> Date: Sun, 27 Sep 2009 13:55:17 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCHv2] qemu: target library, use it in msix References: <20090923200635.GA21246@redhat.com> <20090927082020.GA23513@redhat.com> <4ABF4110.80300@redhat.com> <20090927114459.GA24031@redhat.com> In-Reply-To: <20090927114459.GA24031@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Blue Swirl , qemu-devel@nongnu.org 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 or target_phys_addr_t input and expect it to work. >> 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. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.