From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzgfq-00051E-Nv for qemu-devel@nongnu.org; Tue, 02 Jun 2015 03:31:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzgfn-0004v8-Cx for qemu-devel@nongnu.org; Tue, 02 Jun 2015 03:31:46 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:37039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzgfn-0004tu-3d for qemu-devel@nongnu.org; Tue, 02 Jun 2015 03:31:43 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 Jun 2015 08:31:40 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4893C17D805F for ; Tue, 2 Jun 2015 08:32:35 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t527VbJE24772776 for ; Tue, 2 Jun 2015 07:31:37 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t527VbOK002762 for ; Tue, 2 Jun 2015 01:31:37 -0600 Message-ID: <556D5BD8.5040307@de.ibm.com> Date: Tue, 02 Jun 2015 09:31:36 +0200 From: Christian Borntraeger MIME-Version: 1.0 References: <1433166716-36861-1-git-send-email-mimu@linux.vnet.ibm.com> In-Reply-To: <1433166716-36861-1-git-send-email-mimu@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] virtio-input: const_le16 and const_le32 not build time constant List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Mueller , qemu-devel@nongnu.org Cc: Peter Maydell , Gerd Hoffmann Am 01.06.2015 um 15:51 schrieb Michael Mueller: > As the implementation of const_le16 and const_le32 is not build time constant > on big endian systems this need to be fixed. > > CC hw/input/virtio-input-hid.o > hw/input/virtio-input-hid.c:340:13: error: initializer element is not constant > hw/input/virtio-input-hid.c:340:13: error: (near initialization for ‘virtio_keyboard_config[1].u.ids.bustype’) > ... > > Signed-off-by: Michael Mueller > --- > include/hw/virtio/virtio-input.h | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h > index a265519..bcee355 100644 > --- a/include/hw/virtio/virtio-input.h > +++ b/include/hw/virtio/virtio-input.h > @@ -14,8 +14,14 @@ typedef struct virtio_input_config virtio_input_config; > typedef struct virtio_input_event virtio_input_event; > > #if defined(HOST_WORDS_BIGENDIAN) > -# define const_le32(_x) bswap32(_x) > -# define const_le16(_x) bswap32(_x) > +# define const_le32(_x) \ > + (((_x & 0x000000ffU) << 24) | \ > + ((_x & 0x0000ff00U) << 8) | \ > + ((_x & 0x00ff0000U) >> 8) | \ > + ((_x & 0xff000000U) >> 24)) > +# define const_le16(_x) \ > + (((_x & 0x00ff) << 8) | \ > + ((_x & 0xff00) >> 8)) > #else > # define const_le32(_x) (_x) > # define const_le16(_x) (_x) > Would be good to have this fixed soon. I cannot build current qemu/master on s390. This patch fixes it for me. An alternative solution might be to not use const_le* in the code. Christian