Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp984716lqb; Wed, 17 Apr 2024 17:44:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIfA5PyIJQxzW0T1UmT3EHJxCMyudoBXilGPEB6FH7i9CBOBuIIuiQsYmeTmo0taseFky5GYzT4hzFpe9pNrPjjA1pjS+fsCB0KczQmg== X-Google-Smtp-Source: AGHT+IF4O4kOJ9PgpK2qz2xqebJwhRbNtC5JJwZYh0lmbNlOCphmxID62WCUGzk5IbpM5T0eUlvu X-Received: by 2002:a17:906:8414:b0:a52:1297:cd2c with SMTP id n20-20020a170906841400b00a521297cd2cmr599027ejx.63.1713401068359; Wed, 17 Apr 2024 17:44:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713401068; cv=pass; d=google.com; s=arc-20160816; b=ZEfChgX8MMERzAmLkRQRjy599jA5fDUQ8Ig8kM+kTiutzniWwNnwLA+Q5F7eQEOAnZ EBtH0+kq+gFHDQazw9c8sdk9vKqtqQffiD66aiZc6coQg1iiIrc7tCwZ5oClypuYHfqs eSWecQUZDq+O/HLclLzQ+mzAoW8wslRQN0U4WsUhk7zolZidoPJuclJySZpOuMP/cyoo Xzau+XUZTFSduMi4GnMf7dQ6AUz+WHR1jNaI40scgKAdBMsOocbUd8WQ0vtPndrhW2WV x2CII99q8gJE+HImm3tiE3lD/Nr/dDijy3CNBfAVrzdJ8a+U7KktpVFmb4NU+yw1tldK lXsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=rD+mHmtU4mAFLFQFVxtNM6N4AgCUPCAOpF1iYtnrnPE=; fh=aFIEjBqANOuiNkjRcbq9L9j7su6KF3K/BsCHTK6jEOQ=; b=OPGZ+8cYtseiHbCIfq0jYrIWb3ZT5wc1u2O0iGhLBlli3haCQKq3hcjuci80+AUkX7 lK6QcR5yqqUU8Ht7QAJDxq7DL5MkE34pIo4HDDySa1GR3s7tzIWITKYPt7M9rX/Vb8xA dqtn/GFxu20y6CJe3vTBDspdlENIRWBnn+9bJ7C5+lPzK/mpGyVvF6mep2HqwnF5LzLG w+rOkWoaJksWo7b0FZhy2qSdGZGEBSZ4GBw5t+KQ7lUg06gah8fVX5oOc3T9ez8Vb9gr FkisYoa8F8fSjZIJlgXzprDYB2bVlPpvagN+Qd4tQ8gIpkhYckqxOuaxJwrYjWb/eJ0s bnHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WtsjMMHq; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gq12-20020a170906e24c00b00a5211c384a3si186533ejb.648.2024.04.17.17.44.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 17:44:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WtsjMMHq; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DDCFA1F21C44 for ; Thu, 18 Apr 2024 00:44:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62F44611B; Thu, 18 Apr 2024 00:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="WtsjMMHq" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5367D53AC for ; Thu, 18 Apr 2024 00:44:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713401057; cv=none; b=WaRZ1zSXUk50jf60u+XwJ64p7WlS4Fuuwq22qx2M8Nx9Uz/tFzKx6I8+RE4XjQpZRzsXOiFd9GNMLe2lF4UwSAl9JSur5oC7/oGT3CeFOyWr1W+0ucdcYqEuELe5RCEdHHqj4Eq/hHA8HxaubGt8+A0qGIayRYUbSGT7CNrMvjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713401057; c=relaxed/simple; bh=aA/hzPDFwtes2tr83iy94JIEdPxIYnMbOjQ1pvaUxhU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=YU2cjiFQuSDVGxL3s6Sn2oD2Hls1RGslhRY7v+LDriaeLNWXDkvdQz3SgE6quDejmVadSP26+edtgqsi8wi8Hyachpfsw/BFfsRnE0UYEIv5dkHNSCfenUSvTEpjF69VHV90EFNcIXzIw/zOF6fYHudbgg70QDHuZRPF8/tM5mM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=WtsjMMHq; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43HNdAwP014608; Thu, 18 Apr 2024 00:44:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=rD+mHmtU4mAFLFQFVxtNM6N4AgCUPCAOpF1iYtnrnPE=; b=Wt sjMMHqxLTYivoHYg4CAG/1fuX0Gs1cbYECtMrwRWCXF6hRbUCaj6IyD5/LJssry/ QCdcbb7oJp1VmF1nYOeY9yE+RVHrwFmBss4oZNLmSXScT9OBMgqadjGCS3+rI9y/ aigXlb3tv4qjNSvvRGzblUkdqTUihTGfpzg8K7fN4HGPqsbv3OUw+DUC9tktHfAX wVjK6IeeHTWf35Z1ycwnW47pMtGNGMPbNzGEeoKQitNynraYGumyKwk69f/ZAOux aAxtKqzkWnNT4ztmUPykw5sDpmqAtIJuUqHQx6/gEx2NN+S5S98WMX74yh9HUIQg Yy8IkVLpEtNRh5uyqQdA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xjr92g41j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 00:44:11 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43I0iAe7018326 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 00:44:10 GMT Received: from [10.253.9.153] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 17 Apr 2024 17:44:09 -0700 Message-ID: <85d93186-f792-4b53-b885-fb2630dd9c6c@quicinc.com> Date: Thu, 18 Apr 2024 08:44:00 +0800 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/4] Bluetooth: hci_ldisc: Add a ioctl HCIUARTSETPROTODATA To: Luiz Augusto von Dentz CC: , , , <",linux-kernel"@vger.kernel.org> References: <1710914907-30012-1-git-send-email-quic_zijuhu@quicinc.com> <1713358336-29619-1-git-send-email-quic_zijuhu@quicinc.com> <1713358336-29619-4-git-send-email-quic_zijuhu@quicinc.com> Content-Language: en-US From: quic_zijuhu In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Hdla6IFl1e9g0WZvsLS9UpUzdR1mx62F X-Proofpoint-ORIG-GUID: Hdla6IFl1e9g0WZvsLS9UpUzdR1mx62F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-17_20,2024-04-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 spamscore=0 clxscore=1011 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404180003 On 4/18/2024 5:27 AM, Luiz Augusto von Dentz wrote: > Hi Zijun, > > On Wed, Apr 17, 2024 at 8:53 AM Zijun Hu wrote: >> >> HCIUARTSETPROTODATA is introduced to specify protocol specific settings >> prior to HCIUARTSETPROTO, for protocal QCA, it is used by tool btattch >> to specify soc type. >> >> Signed-off-by: Zijun Hu >> --- >> drivers/bluetooth/hci_ldisc.c | 10 ++++++++++ >> drivers/bluetooth/hci_uart.h | 3 +++ >> 2 files changed, 13 insertions(+) >> >> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c >> index a26367e9fb19..4be09c61bae5 100644 >> --- a/drivers/bluetooth/hci_ldisc.c >> +++ b/drivers/bluetooth/hci_ldisc.c >> @@ -506,6 +506,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) >> /* disable alignment support by default */ >> hu->alignment = 1; >> hu->padding = 0; >> + hu->proto_data = 0; >> >> INIT_WORK(&hu->init_ready, hci_uart_init_work); >> INIT_WORK(&hu->write_work, hci_uart_write_work); >> @@ -795,6 +796,15 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd, >> err = hu->hdev_flags; >> break; >> >> + case HCIUARTSETPROTODATA: >> + if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) { >> + err = -EBUSY; >> + } else { >> + hu->proto_data = arg; >> + BT_DBG("HCIUARTSETPROTODATA %lu okay.", arg); >> + } >> + break; >> + >> default: >> err = n_tty_ioctl_helper(tty, cmd, arg); >> break; >> diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h >> index 68c8c7e95d64..fc35e9bd4398 100644 >> --- a/drivers/bluetooth/hci_uart.h >> +++ b/drivers/bluetooth/hci_uart.h >> @@ -18,6 +18,8 @@ >> #define HCIUARTGETDEVICE _IOR('U', 202, int) >> #define HCIUARTSETFLAGS _IOW('U', 203, int) >> #define HCIUARTGETFLAGS _IOR('U', 204, int) >> +/* Used prior to HCIUARTSETPROTO */ >> +#define HCIUARTSETPROTODATA _IOW('U', 205, unsigned long) > > Don't think this will gonna fly, Im not going to introduce vendor > specific like this, besides if the kernel is not able to discover this > data why would userspace be? > i don't think so as explained below. 1) For the final product, BT device will get many configuration info from board configuration such DT|ACPI during driver probe phase, But for tool btattach case, it has no way to get such configuration info due to derived from hci_ldisc. so i introduce a new ioctl to let user specify some such required info when possible to make btattach work. 2) present ioctl HCIUARTSETPROTO has been introduced specify vendor protocol, why can't introduce a new ioctl to specify protocol specific settings ? is HCIUARTSETPROTO vendor specific? 3) ioctl()'s designed purpose is for variant non-standard settings, do you have suggestions about how to specify device driver specify settings from user if ioct() is not suitable? 4) hci_ldisc driver don't parse and touch such user specified settings and pass it into vendor driver directly does it has any problem? >> /* UART protocols */ >> #define HCI_UART_MAX_PROTO 12 >> @@ -71,6 +73,7 @@ struct hci_uart { >> struct work_struct init_ready; >> struct work_struct write_work; >> >> + unsigned long proto_data; >> const struct hci_uart_proto *proto; >> struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */ >> void *priv; >> -- >> 2.7.4 >> > >