From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCNaW-0005C1-Is for qemu-devel@nongnu.org; Thu, 22 Aug 2013 01:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCNaN-0008EF-TM for qemu-devel@nongnu.org; Thu, 22 Aug 2013 01:37:40 -0400 Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:59545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCNaN-0008E5-NB for qemu-devel@nongnu.org; Thu, 22 Aug 2013 01:37:31 -0400 Received: by mail-ea0-f171.google.com with SMTP id n15so662548ead.2 for ; Wed, 21 Aug 2013 22:37:30 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5215A36E.8090609@redhat.com> Date: Thu, 22 Aug 2013 07:36:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1377077318-12966-1-git-send-email-aik@ozlabs.ru> <1377077318-12966-3-git-send-email-aik@ozlabs.ru> <5214917B.4040607@redhat.com> <52157127.3010504@ozlabs.ru> In-Reply-To: <52157127.3010504@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] vfio: Fix 128 bit handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alex Williamson , qemu-devel@nongnu.org, Alexander Graf Il 22/08/2013 04:02, Alexey Kardashevskiy ha scritto: >> Int128 is opaque, please use int128_and. To build the constant you have >> three choices (from my preferred to IMHO worst): >> >> - add a new int128_exts64 function that sign-extends an int64_t > > Like this? I am really scared to screw here :) > > static inline Int128 int128_exts64(int64_t a) > { > return (Int128) { .lo = a, .hi = (a < 0) ? -1 : 0 }; > } Yes, or just a >> 63. >> - use int128_neg(int128_make64(TARGET_PAGE_SIZE)) or something like that > > Did you actually mean TARGET_PAGE_SIZE-1 (with -1)? I'll better use this > for now. it would be either ~(TARGET_PAGE_SIZE-1) or -TARGET_PAGE_SIZE, I think. >> - add a new int128_make function that takes a low/high pair and use >> int128_make(TARGET_PAGE_MASK, -1) > > I liked this one actually but you called it "worst" :) It is really the same as #1 but inlined, which is why I called it the worst. #2 is ugly for a different reason, namely because it changes the code more substantially, from using TARGET_PAGE_MASK pre-patch to TARGET_PAGE_SIZE post-patch. Paolo