Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2749620rwi; Tue, 11 Oct 2022 12:51:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7T65SL4JyLRfrA5HbM0EhaLzCDxLYLXDsE/mz5JEPy6/wJYkjv+UvwcrOFd5P4Hp3U6XO5 X-Received: by 2002:a17:903:1110:b0:178:9f67:b543 with SMTP id n16-20020a170903111000b001789f67b543mr26019840plh.131.1665517883361; Tue, 11 Oct 2022 12:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665517883; cv=none; d=google.com; s=arc-20160816; b=KPKUXSe+xIO+Gtr4wEnE8hDi02X0P8SxFdY2Y8TF1yRBRxQ0mMlOb83ArqHhiPcC9t a/JiTm7t0BrctTaE7egvn94BcQsBNiBC5xIKZR37lHW5xh2qTh97RYonv12QCEV+z++w qhuZ1j7x3NQBzeaG9Uzz/MqCH0LJ77T9lMBwOuXAYYdrda9nkWCNubRV3a+A6PlmZKiV U57nvn5q35SWnrgvd63d4XFHKqjg1VlV13KZVHTUcyXrhtVo6p6XNVm6MmylUXdhgFTX RlB80KLuKPTjm4BZaVoMw3HPmQ7wJ6A4W7FYG0vAmZZgVSY+CiK8XTrKGrj/YE898SoR ek2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=a2I8otcqoVQjYNYDGvUGwP30DEIINxDXT7uwZdeQKk4=; b=sZsgjNUHxc5tQpcb2iGGBFGY+mcnWUf4FMgalfG8Np4a9x6TI2FgQlTJkvktQhjwvI Y82IyGfFsj7Arh17sejPT1ESihX3pbwnIpL64CirgdzEurai/+ftiIoGaeavpdk8zGpM +ooCCgOsNYrwJW8UXKS+HpAfUPWsNM4RnJmrGUiUk+1c9ToPeHxsPCAfOFLpP5VfdXOR y/kDgfZSd7zP7QsH8BGWEjTTgP7UM7N5ZbuOjTrGVWP8RxkWiSzS7aLUIDxV+TYJkhBc sMlAsKbc98GNlcb/P37jwEq+cpwfGH/VYh+IgXG3diofosTO1yWa7wGXRaOLcbxOlvzP kjWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G0YZBqSE; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv2-20020a17090b1b4200b001fab519341asi11783911pjb.188.2022.10.11.12.51.10; Tue, 11 Oct 2022 12:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G0YZBqSE; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229456AbiJKTgr (ORCPT + 99 others); Tue, 11 Oct 2022 15:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiJKTgq (ORCPT ); Tue, 11 Oct 2022 15:36:46 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C3E7814E9; Tue, 11 Oct 2022 12:36:45 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id s10so18140912ljp.5; Tue, 11 Oct 2022 12:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=a2I8otcqoVQjYNYDGvUGwP30DEIINxDXT7uwZdeQKk4=; b=G0YZBqSE4a25/7HFxTyY8WwaSIiyWXVquLoPlSW1ihrLHtaugKwH2KKJe52cuc65qX cWXSLB0Z7+WBc5HXK9bmf0iIu5QhYschPBpxuVctJVGaLtGONk3y3GYx0kiLNFhe6SMc nO9NkMlEqqLnU9rI3MHwXNDbnf2ckgvdkOo8XaoNNFilWfxNhvL8dOYkHqfA0woVF+wS DbfWJQzdpHQV9XKG1rx3sMExPF0dUOAMsgzmknNLXG3+rpv2D8GUL4PADNkrMeRHSdxF 0v8dz6d6gUVNOo2EbQGHFT2cvy5CAoORdS8oyPvU+8eLiOojqeFNubdtL98GQ4QCGr4g b27Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a2I8otcqoVQjYNYDGvUGwP30DEIINxDXT7uwZdeQKk4=; b=3GNXKmALqUNS68H4q3894kGLwuCorVAhqBPiDcjMux76S8TU5EvM+ltIQQAboqC1+M s+7D27guuASFs9p/zEeUvd+q3r3gDSHy1+6H2c4TmiWkDdZ0ZVwAa+Cpuo8eSiC1tsuj LJqLSAX02PxSLhT4xf1KTUY2YwmtpD9Zu0ZXcED2aSKo1kNP2r1US0QdlBOrrRyzB9M8 pzn3QmsFVPZR3rirbXPLaN2NhCRqyMBU+CFcXoI1tetni2w9ybEyIrAitmdEvMbXv5VG VinAtc40bimKtzik2hTCEKy8Lb0FN5ySInVuEPYewh99aAwRV8Lb0rPe33hUVM2doZRB l+/g== X-Gm-Message-State: ACrzQf2GNi2F1ShY/sNh6j/sbwHu77caTj5LPoqYGYFEks1mnsOjRO7e fUnXFJ81bsCYLskAGEMfu5t+YwmjTf9cAQHgk80= X-Received: by 2002:a2e:9d81:0:b0:266:a1d7:74b4 with SMTP id c1-20020a2e9d81000000b00266a1d774b4mr9013743ljj.423.1665517003260; Tue, 11 Oct 2022 12:36:43 -0700 (PDT) MIME-Version: 1.0 References: <20220807221152.38948-1-Igor.Skalkin@opensynergy.com> <20220807185846-mutt-send-email-mst@kernel.org> <02222fcb-eaba-617a-c51c-f939678e3d74@opensynergy.com> <20221007090223-mutt-send-email-mst@kernel.org> In-Reply-To: From: Luiz Augusto von Dentz Date: Tue, 11 Oct 2022 12:36:31 -0700 Message-ID: Subject: Re: [PATCH] virtio_bt: Fix alignment in configuration struct To: Igor Skalkin Cc: "Michael S. Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, mgo@opensynergy.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Igor, On Tue, Oct 11, 2022 at 5:23 AM Igor Skalkin wrote: > > Hi Luiz, > > Current version of this patch is wrong [q]changing uapi like this can't > be done, will break userspace[/q], next version is in process, will be > sent in few days. Thanks for the update, I will wait for the next version then. > Best regards, > Igor > On 10/7/22 21:33, Luiz Augusto von Dentz wrote: > > Hi Michael, > > > > On Fri, Oct 7, 2022 at 6:03 AM Michael S. Tsirkin wrot= e: > >> > >> On Mon, Aug 08, 2022 at 02:04:43PM +0200, Igor Skalkin wrote: > >>> On 8/8/22 01:00, Michael S. Tsirkin wrote: > >>> > >>> On Mon, Aug 08, 2022 at 12:11:52AM +0200, Igor Skalkin wrote: > >>> > >>> According to specification [1], "For the device-specific con= figuration > >>> space, the driver MUST use 8 bit wide accesses for 8 bit wid= e fields, > >>> 16 bit wide and aligned accesses for 16 bit wide fields and = 32 bit wide > >>> and aligned accesses for 32 and 64 bit wide fields.". > >>> > >>> Current version of the configuration structure: > >>> > >>> struct virtio_bt_config { > >>> __u8 type; > >>> __u16 vendor; > >>> __u16 msft_opcode; > >>> } __attribute__((packed)); > >>> > >>> has both 16bit fields non-aligned. > >>> > >>> This commit fixes it. > >>> > >>> [1] https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/= v1/query?url=3Dhttps%3a%2f%2fdocs.oasis%2dopen.org%2fvirtio%2fvirtio%2fv1.1= %2fvirtio%2dv1.1.pdf&umid=3Db1110db2-819d-4f27-b35e-18ac23ce0ab4&auth=3D53c= 7c7de28b92dfd96e93d9dd61a23e634d2fbec-2c53002097633a932e7d67b899e6bf6999cdc= 899 > >>> > >>> Signed-off-by: Igor Skalkin > >>> > >>> This is all true enough, but the problem is > >>> 1. changing uapi like this can't be done, will break userspace > >>> 2. the driver has more issues and no one seems to want to > >>> maintain it. > >>> I posted a patch "Bluetooth: virtio_bt: mark broken" and intend > >>> to merge it for this release. > >>> > >>> This is very sad. We already use this driver in our projects. > >> > >> Ping. If we still have no maintainer I'm marking it broken, users > >> should at least be warned. > > > > Please resend. > > > >> > >>> Our virtio bluetooth device has two backends - HCI_USER socket backen= d for one > >>> platform and uart backend for the other, and works well (after applyi= ng your > >>> "[PATCH] Bluetooth: virtio_bt: fix device remove") patch, so this "de= vice > >>> removal" problem can probably be considered solved . > >>> We could help with the rest of the problems you listed that can be so= lved > >>> (specification, QEMU support). > >>> And the only problem that is difficult to solve (because of the need = to change > >>> UAPI header files) is just this one with unaligned configuration fiel= ds. > >>> At the moment, it does not reproduce, because without VIRTIO_BT_F_VND= _HCI > >>> (Indicates vendor command support) feature negotiated, the driver doe= s not > >>> read the non-aligned configuration fields. > >>> > >>> So, what would you advise us to do? Continuing to use the "marked bro= ken" > >>> driver, start writing a specification for a new from scratch, better = one? > >>> Or is there any way to bring this one back to life? > >>> > >>> > >>> > >>> --- > >>> include/uapi/linux/virtio_bt.h | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/include/uapi/linux/virtio_bt.h b/include/uapi/l= inux/virtio_bt.h > >>> index a7bd48daa9a9..adc03709cc4f 100644 > >>> --- a/include/uapi/linux/virtio_bt.h > >>> +++ b/include/uapi/linux/virtio_bt.h > >>> @@ -23,9 +23,9 @@ enum virtio_bt_config_vendor { > >>> }; > >>> > >>> struct virtio_bt_config { > >>> - __u8 type; > >>> __u16 vendor; > >>> __u16 msft_opcode; > >>> + __u8 type; > >>> } __attribute__((packed)); > >>> > >>> #endif /* _UAPI_LINUX_VIRTIO_BT_H */ > >>> -- > >>> 2.34.1 > >>> > >>> -- > >>> > >>> Best regards, > >>> > >>> Igor Skalkin > >>> Software Engineer > >>> > >>> OpenSynergy GmbH > >>> Rotherstr. 20, 10245 Berlin > >>> > >>> igor.skalkin@opensynergy.com > >>> www.opensynergy.com > >>> > >>> registered: Amtsgericht Charlottenburg, HRB 108616B > >>> General Management: Rolf Morich, Stefaan Sonck Thiebaut > >>> > >>> > >>> Please mind our privacy notice pursuant to Art. 13 GDPR. // Unsere Hi= nweise zum > >>> Datenschutz gem. Art. 13 DSGVO finden Sie hier. > >> > > > > > > Please mind our privacy notice pursuant to Art. 13 GDPR. // Unse= re Hinweise zum Datenschutz gem. Art. 13 DSGVO finden Sie hier. --=20 Luiz Augusto von Dentz