From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752747AbbCWQRf (ORCPT ); Mon, 23 Mar 2015 12:17:35 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:35679 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbbCWQRc (ORCPT ); Mon, 23 Mar 2015 12:17:32 -0400 Date: Mon, 23 Mar 2015 17:17:25 +0100 From: Cornelia Huck To: Gerd Hoffmann Cc: "Michael S. Tsirkin" , virtio-dev@lists.oasis-open.org, open list , "open list:ABI/API" , virtualization@lists.linux-foundation.org Subject: Re: [PATCH 1/1] Add virtio-input driver. Message-ID: <20150323171725.5c459dec.cornelia.huck@de.ibm.com> In-Reply-To: <1427123129.27137.62.camel@nilsson.home.kraxel.org> References: <1426756391-26585-1-git-send-email-kraxel@redhat.com> <1426756391-26585-2-git-send-email-kraxel@redhat.com> <20150319123940-mutt-send-email-mst@redhat.com> <1426847327.32097.60.camel@nilsson.home.kraxel.org> <20150321225356-mutt-send-email-mst@redhat.com> <1427097238.6365.27.camel@nilsson.home.kraxel.org> <1427118292.27137.39.camel@nilsson.home.kraxel.org> <20150323144803-mutt-send-email-mst@redhat.com> <1427120855.27137.55.camel@nilsson.home.kraxel.org> <20150323155106-mutt-send-email-mst@redhat.com> <1427123129.27137.62.camel@nilsson.home.kraxel.org> Organization: IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz =?UTF-8?B?R2VzY2jDpGZ0c2bDvGhydW5nOg==?= Dirk Wittkopp Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032316-0009-0000-0000-00000394EA65 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Mar 2015 16:05:29 +0100 Gerd Hoffmann wrote: > On Mo, 2015-03-23 at 15:54 +0100, Michael S. Tsirkin wrote: > > On Mon, Mar 23, 2015 at 03:27:35PM +0100, Gerd Hoffmann wrote: > > > Hi, > > > > > > > > > > You are doing leXXX everywhere, that's VERSION_1 dependency. > > > > > > > virtio_cread will do byteswaps differently without VERSION_1. > > > > > > > Just don't go there. > > > > > > > So to clarify, you dislike using __virtio32 in virtio input header? > > > > > > Well, as I understand things __virtio32 implies byteorder depends on > > > whenever we are using VERSION_1 or not. And non-transitional drivers > > > should not need it as everything is by definition little endian. > > > > > > So, yes, your suggestion to just require VERSION_1 in the driver implies > > > in my eyes that there should be no reason to use __virtio32 instead of > > > __le32. > > > > > > Or do I miss something here? > > > > > > cheers, > > > Gerd > > > > > > > You are right but then if you do require VERSION_1 then > > __virtio32 becomes identical to __le32. > > Except that sparse doesn't know that and throws errors when I mix the > two. > > > There's some runtime overhead as we check on each access, > > but it shouldn't matter here, right? > > Correct, config space is used at initialization time only. > > > I guess we could add virtio_cread_le - is this what > > you'd like? > > I just want something that makes both you and sparse happy. I don't > care much whenever that is adding virtio_cread_le() or using __virtio32 > even though it'll effectively is __le32 due to VERSION_1 being required. I think it is clearer if you use __virtio32: The fact that virtio-input is VERSION_1 only is not apparent from looking at the config space definition, and explicitly forcing le accesses makes it look similar to the oddballs like virtio-balloon. Just my two cents.