From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrsDj-0002O0-4m for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:47:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrsDd-0002No-FK for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:47:13 -0400 Received: from [199.232.76.173] (port=36507 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrsDd-0002Nl-AC for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:47:09 -0400 Received: from mx20.gnu.org ([199.232.41.8]:7827) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MrsDc-0000U8-Ua for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:47:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrsDc-0007d7-7K for qemu-devel@nongnu.org; Sun, 27 Sep 2009 07:47:08 -0400 Date: Sun, 27 Sep 2009 13:45:00 +0200 From: "Michael S. Tsirkin" Subject: Re: [Qemu-devel] Re: [PATCHv2] qemu: target library, use it in msix Message-ID: <20090927114459.GA24031@redhat.com> References: <20090923200635.GA21246@redhat.com> <20090927082020.GA23513@redhat.com> <4ABF4110.80300@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ABF4110.80300@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Blue Swirl , qemu-devel@nongnu.org On Sun, Sep 27, 2009 at 12:40:16PM +0200, Avi Kivity wrote: > On 09/27/2009 10:20 AM, Michael S. Tsirkin wrote: >> On Thu, Sep 24, 2009 at 08:50:11PM +0300, Blue Swirl wrote: >> >>> On Wed, Sep 23, 2009 at 11:06 PM, Michael S. Tsirkin wrote: >>> >>>> This creates target.c, which builds per-target, and makes it possible >>>> for devices to become target-independent. Use it in msix, reverting >>>> part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no longer have >>>> to pass target page around. >>>> >>> >>>> +unsigned target_page_align(unsigned value) >>>> +{ >>>> + return TARGET_PAGE_ALIGN(value); >>>> +} >>>> >>> This must be: >>> target_phys_addr_t target_page_align(target_phys_addr_t value) >>> >> 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. > 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. > or just > > uint64_t target_page_align(); > (which is wasteful on 32/32 guests and 32 hosts). > -- > Do not meddle in the internals of kernels, for they are subtle and quick to panic.