From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7D30C433FE for ; Tue, 11 Oct 2022 09:08:13 +0000 (UTC) Received: from localhost ([::1]:49706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiBFE-0001EG-HM for qemu-devel@archiver.kernel.org; Tue, 11 Oct 2022 05:08:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiBAZ-0007GI-T2 for qemu-devel@nongnu.org; Tue, 11 Oct 2022 05:03:25 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiBAI-0003i4-KO for qemu-devel@nongnu.org; Tue, 11 Oct 2022 05:03:21 -0400 Received: from fraeml706-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MmqX95RFYz67xwN; Tue, 11 Oct 2022 17:01:29 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml706-chm.china.huawei.com (10.206.15.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 11 Oct 2022 11:03:02 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 11 Oct 2022 10:03:01 +0100 Date: Tue, 11 Oct 2022 10:03:00 +0100 To: CC: Michael Tsirkin , Ben Widawsky , , Subject: Re: [RFC PATCH 1/6] qemu/bswap: Add const_le64() Message-ID: <20221011100300.00006c99@huawei.com> In-Reply-To: <20221010222944.3923556-2-ira.weiny@intel.com> References: <20221010222944.3923556-1-ira.weiny@intel.com> <20221010222944.3923556-2-ira.weiny@intel.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via On Mon, 10 Oct 2022 15:29:39 -0700 ira.weiny@intel.com wrote: > From: Ira Weiny > > Gcc requires constant versions of cpu_to_le* calls. > > Add a 64 bit version. > > Signed-off-by: Ira Weiny Seems reasonable to me but I'm not an expert in this stuff. FWIW Reviewed-by: Jonathan Cameron There are probably a lot of places in the CXL emulation where our endian handling isn't correct but so far it hasn't mattered as all the supported architectures are little endian. Good to not introduce more cases however! Jonathan > --- > include/qemu/bswap.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h > index 346d05f2aab3..08e607821102 100644 > --- a/include/qemu/bswap.h > +++ b/include/qemu/bswap.h > @@ -192,10 +192,20 @@ CPU_CONVERT(le, 64, uint64_t) > (((_x) & 0x0000ff00U) << 8) | \ > (((_x) & 0x00ff0000U) >> 8) | \ > (((_x) & 0xff000000U) >> 24)) > +# define const_le64(_x) \ > + ((((_x) & 0x00000000000000ffU) << 56) | \ > + (((_x) & 0x000000000000ff00U) << 40) | \ > + (((_x) & 0x0000000000ff0000U) << 24) | \ > + (((_x) & 0x00000000ff000000U) << 8) | \ > + (((_x) & 0x000000ff00000000U) >> 8) | \ > + (((_x) & 0x0000ff0000000000U) >> 24) | \ > + (((_x) & 0x00ff000000000000U) >> 40) | \ > + (((_x) & 0xff00000000000000U) >> 56)) > # define const_le16(_x) \ > ((((_x) & 0x00ff) << 8) | \ > (((_x) & 0xff00) >> 8)) > #else > +# define const_le64(_x) (_x) > # define const_le32(_x) (_x) > # define const_le16(_x) (_x) > #endif