From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796162789; b=nZxarDgPiOllONJKnC/qyNHEgz5XiZESPhCobiitE1J5Jzv8a0NysvOEHa1brcxgJnyk MVIJCjwBpkLHiM0s9Kwt/fvfIqvxri0GsoIAjTppzzauIrOE+Yfxmo9MStNDPKVjB3CPJ KU0uL/1y6tuU5tXg/GgL0N/knTOs/rALHiIA/4r3dZwckzx2P/UaHt+kWMIxVpIv3DUC9 rVLIMK3NhtZZgH2ehbj3to78ovJP6/u5BRdojsW4mWA1q1h1z4lGciUb3ZES6XT8IfBoT 0qdHLuSot7cPXQSyZS26koorIF6h0iaC68PSEpo7HdlAsAlz66MQJuPzLX1co70kCBg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796162789; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Authority-Analysis:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=mylITlndYzn2XfuC+4CG/1TA5KHJnol82mzYHpmFcj4=; b=kpD4eBm0OXsvZImza49hrq0U8oWzKhE1+IIKN6fFTeSwY4sSUiGrYUkSeG6UX6JfAV9g FuveIB4RzDdJNLtoCIkuvWbh3+8do/WDQ06YR22g7REJKZDPSXhMlzZ54/Yi4nxC5nHBX QlaUGB3mFjBK9prdqabzuE5v56GLUaOaJRJvlrB4gOVZVCoVh2Lzj3h+5yTPh70MNx+FS q1IH4kkIwOwOKk5McDMtk2OY1LtZ2jmDcitqHBpESQUc8d9sYn86ITVadmQraxPL4dypV KDtAmaAoRemJdGQxNqoiiYr8AOfkHI2EqZQo+oDgheqdf75AOHaS/12cjORLIFWdkqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=p8DvGSdQ; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=DWjt4n+A; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB3CE606A322 for ; Tue, 1 Dec 2026 22:06:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB3CE606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=p8DvGSdQ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=DWjt4n+A Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B1JeoD63566449 for ; Tue, 1 Dec 2026 22:06:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= mylITlndYzn2XfuC+4CG/1TA5KHJnol82mzYHpmFcj4=; b=p8DvGSdQ+Ur4WoSu YBqU1y70M0gMybpcrmeG9xujlHFqI5GEcEK8Np5w53NA/5DU9MFIBSR2BorW6GMG 2dAmwjdNySRaTPg0Nrdj8e3cM+3SJtx07rIHEGD3ZPSFjJNkMEH4KXxh9ggQih2V 8DGgVCeCl8cAMc8vxVggO0HcpXJbQxxYfDr8OegtggHa3vU9pemBGfDblnhUSRns gRbD6hHfz6BfqKFzd6/hT+ROhvR3rDvOzFVvc5GfvgcceLPOixKdhHU8//X908Ym +Ijz+wlomA9n3ywd1Ntjdl5IhETSXH7ndkBzcV8VN/N7M+nVv1VUtMmoNmckLAWX TlJEpA== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ja4ky8f17-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 22:06:28 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-382af5cfc58so4795728eec.0 for ; Tue, 01 Dec 2026 14:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796162786; x=1796767586; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mylITlndYzn2XfuC+4CG/1TA5KHJnol82mzYHpmFcj4=; b=DWjt4n+AzLjr4ZvhNMZp9WZFOSJejU5g7+JaPA4VK+lMWcI3pw9s9zlRHuKyDo1BpZ Gkttv48hYd2Vkx6vmz4fbwOJ/F4J7R4MnxOwlRAkaix0rArgBaPDOVIoSQHaZmJkG+WT HZHGnRbc4m2qKIW60v3xK5Xb56YSzC05sHz1c1/7N4j+MWldbm9ue3s5MZoHV7+c/N4n PdvN9Wv6X1F63D2MhnOe48yoXSROictvPPqdvLIz5EU80OMzoQcZgJFlgHi8GhGm1Sjm rpeNpkHGApHFi7HZ3lacPVnTmbdRaaIfVHYlNL2CyG3lQscYXVzpcidYkopwgIivxZpa sr/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796162786; x=1796767586; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mylITlndYzn2XfuC+4CG/1TA5KHJnol82mzYHpmFcj4=; b=ly74c+dtnwl6D+fRTWKWBQ9qLasuZSMmPrRS/OTTpd0zyBPku62hJGieiKg3DjZbCn WbowIg+9rMMOl1bxgUIGr2WwzQ2cPgC3cmUtrWHwjnVPyQ+El/OiwJRJKhZPq8wmMrty F/41q0mBUAa1KOa76WahP3PfDY5lzx5KryPB7zK7+nbcM3WhDJj+uZDc/Nn9DRKbGZSf UZejbS4Xyjwhkr3YFA5UbgMNjMfQduqyo/sqnEKwPjT8w34/3Zox/vUcsTAtKGVfCnQJ 9C2G2CZYfypjeeflIu7/8avyznyCx1r8XD1By12UUN2suSRs/WmHWwXCCagPMK/gOtAC PbZA== X-Forwarded-Encrypted: i=1; AL+hErGDvq5+O+aVvVP5vidyiPn0Dii/hz307A7T3zt3dkI5txVSgDFux0ZHFpMwGcxMJFrpwGCQRAcf5XQvZ18=@vger.kernel.org X-Gm-Message-State: APuU4Z91fF0bbCFzctufobr5bvPUI6z1K/IkFVf9f2Acj+4IOu5Xzq2M fFLaJWYNrYVz7PlsZRceklbTnSu5zp92ApYEnJ0+K55wL9HvF21fSMMJTQxi7YapTc+c0TOl6r1 1AsRuO7Jao9HpBfXAlPux4jbrmnEPQH/nOGOJwFwNNMtm4yBHfge3tg1aXg6o6zFTtAOX6GOFit o= X-Gm-Gg: AZFdTZdtBNnpKyV+1FrAItgnyBq+iagMB0BoFedmzAveaIWGdfRQo6DS1675gekhiiF r670iYlK09PGflkvPB5kzM7ad7UdfYJGDLDGRbaOmoYQ/F/CBcWk5QYDrIjRiWdvCmRyW7ew5z3 2r8HJXUGiKqyNzHAcNacRO6d8i7TmpHbOwk90H7PxhkIUTSvLiLKuJah2262AwLXfiLeBwBPZSO LZCkS9EArgLEYDEzU6nLuapemPu4NJVnAVNAPhwvO9RRTTB53eyf9wbgLbKWG1w6Y//J7uoi90L 5qQx7RHsbDU51rv8idcexrhfGoLfVpVzQ68x0OopkRAS1Wtz5vzR+Dh55kVBFnG4g2jq347MHpu Rg23QP9fon8my6BUk4vLTVRX3nXhdTSLKo4o+efy/jRuyxWMLXWroJwAYzjbwndjthAWinoENge 01Oo2787UHoUmZFXYWO/ACFA== X-Received: by 2002:a05:7300:26a2:b0:386:b0ea:3263 with SMTP id 5a478bee46e88-386b0ea340cmr28393812eec.40.1796162786247; Tue, 01 Dec 2026 14:06:26 -0800 (PST) X-Received: by 2002:a05:7300:26a2:b0:386:b0ea:3263 with SMTP id 5a478bee46e88-386b0ea340cmr28393782eec.40.1796162785556; Tue, 01 Dec 2026 14:06:25 -0800 (PST) Received: from [10.226.59.182] (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385f68bc0adsm106573078eec.13.2026.12.01.14.06.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 14:06:25 -0800 (PST) Message-ID: <2cc01439-5efd-4c25-bdb9-1accb7f3bb79@oss.qualcomm.com> Date: Tue, 1 Dec 2026 15:06:24 -0700 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] bus: mhi: host: Add debug port personality switching To: Hongxing Xu Cc: Manivannan Sadhasivam , mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <6b3fbc60-34ec-4b7e-bbc7-84a0ec5d496e@oss.qualcomm.com> <20261124124319.2316-1-xing1989093@163.com> Content-Language: en-US From: Jeff Hugo In-Reply-To: <20261124124319.2316-1-xing1989093@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=O8ysLx9W c=1 sm=1 tr=0 ts=6b0f44e4 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=vc3bFuIfw7S4DPCbS6oA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA4OCBTYWx0ZWRfX6XHFKsA8rg0t YruIIpEGF56Ae3pWY06n5cLmhSOUS+vEW+6lZzWtM7AGg7Vez2ZGYEeR49oXnwb4UvUUvY87Ulg LCKqifxpuDNKkSQIbTCtZE6CDxb95tM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA4OCBTYWx0ZWRfX3P8VnJNOx0SS 4Ic0bJRZ8MJEt3mExi564VZd25KL8Nt5EuGQ6ZxdJ79ltxqheJhlMIbCVTedwkJhUUc+EWK/SJg t81gLYcDx0XLZXeWluwr7a/6R51OX1Htx0WGOJCd5+xhfQDk3+UQiYtdnO3R/3bWYs7+/6E2YU4 XH/2rBxx4P1h4ARhrDZe1dnCejRiAKTIxlkNfSLevHA+lk3I/1D392O64JgsBorPomsMU8DWruV A/aG80Ua86kUT+CCcXYCG6z2DV8wjPH7OjOapp/597hYpjw6/z1ZFjRt79i61ALqwOxb1GJib/C 0oeiHq2NM+XPW2+0aOi73RtB1rafdoePGicP2fNDbQavF2n4IEv+//U3HPB4sxWq5s4K5L9vEo2 isvrJcIzH2XkHeM/QwQlvwNXKasRHy/7vDlIez/Jv3613ABYZfBlB8naCIydVU9H/J8UpiKV90R o8oeXRzNio7hTLPo/UQ== X-Proofpoint-ORIG-GUID: NsR1FmWDcUQY7drgQl9KGSdVBlXs6I9B X-Proofpoint-GUID: NsR1FmWDcUQY7drgQl9KGSdVBlXs6I9B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_04,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010088 On 11/24/2026 5:43 AM, Hongxing Xu wrote: > Two questions, both pointing into this patch, so answering them together. > >>> +What: /sys/bus/mhi/devices/.../debug_ports >> >> Why sysfs and not debugfs? > > Because this is not a debugging aid. It is a documented ABI that end > users and provisioning tools drive on a shipped system, and it has to > remain available there. How is this not a debugging aid? Your patch subject says "Add debug port". Your commit text mentions a "debug personality" and "debug ports" among other uses of "debug". I'm confused, debug != debugging? I didn't ask this before, but since you are claiming this is not a debugging aid, how does one put the device into this alternate mode? Load a signed APDP (Apps Processor Debug Policy) file? That is a debugging flow, and not something that is easily done in an arbitrary situation. > What userspace gains is the ability to bring up, on demand, a group of > ports that a given firmware product configuration does not enable by > default: the diagnostic interface, and the same applies to the ADB and > AT ports. A single switch that creates or destroys that whole group is > what is needed; poking channels one at a time is not. That is why it is > described alongside the other controller attributes in > Documentation/ABI/stable/sysfs-bus-mhi. > > debugfs cannot serve this, for two concrete reasons. > > The first is availability. CONFIG_MHI_BUS_DEBUG is a bool with no > default, so it is off in the configurations product kernels ship, and > it is a compile-time switch: with it disabled, debugfs.c is not built > and the calls in mhi_register_controller() resolve to empty stubs. A > user who needs these ports would have to rebuild the kernel to get at > the control, which is not a usable interface. What product kernels are you referring to? I use CONFIG_MHI_BUS_DEBUG regularly on RHEL and Ubuntu for a variety of device types. This is starting to look like a niche problem. > The second is capability. MHI's debugfs already exposes states, events, > channels and devices, and all of them are read-only listings. There is > no debugfs entry in MHI that can create or destroy an MHI device, so > this is not a choice between two equivalent interfaces. I don't know how this is an argument. What you are arguing for does not exist in sysfs either. You are creating it. > There is also a security reason to keep these ports off unless they are > wanted. The diagnostic and ADB ports on a WWAN module are a meaningful > attack surface, and a module that does not need them should not be > exposing them. Hiding that decision behind an interface that is absent > on production kernels would defeat the point. I thought your argument was that these interfaces are inactive in normal mode. How can they be a security issue? > >>> + * @debug_ports: Whether the debug port personality is active, ... >>> + * @debug_ports_pending: Latest personality requested from userspace, >>> + * applied by debug_ports_work >>> + * @debug_ports_work: Applies @debug_ports_pending from the ordered >>> + * high priority workqueue, ... >> >> Are these optional? > > None of the three can be dropped for this feature to work, though none > of them is populated by a driver either. So every controller must support these? That's not acceptable to me. > debug_ports records the personality that is currently applied. It is > read by mhi_chan_is_available() on every enumeration, which is what > keeps a debug-only channel hidden while the commercial personality is > active, and it backs the sysfs attribute so userspace can read back > what is in effect. It belongs to the controller because the setting > covers the controller as a whole. > > debug_ports_pending carries the value userspace has just written. The > create and destroy work cannot run in the store function itself: > channel devices are created and destroyed by the state transitions on > the ordered hiprio_wq, and pm_mutex does not exclude those transitions, > because a transition releases it before calling > device_for_each_child(). So the work has to be queued on that same > ordered workqueue, and by the time it runs it needs somewhere to read > the request from. Keeping it separate from debug_ports also keeps > "requested" and "applied" distinct while a switch is in flight. > > debug_ports_work is that work item. It is initialised in > mhi_register_controller() next to the other work items, queued on the > ordered workqueue, and flushed by the store so the write returns only > once the ports exist. > > All three are zero-initialised, so a controller that declares no > debug-only channel starts in the commercial personality and behaves > exactly as before. I am happy to say so explicitly in the kernel-doc. > > Could I ask what you have in mind here? If the concern is that the docs > should mark driver-populated fields as optional, these are not > driver-populated and I can word it that way. If you would rather this > state lived somewhere other than struct mhi_controller, I would like to > know your preference before reworking it. You made a mistake, and I initially missed it. You document these in the controller config struct, but add them to the controller struct. That is not valid. One of those structures is populated by the controller driver, and the other is not. This will need to be fixed, but I think there are fundamental problems with what you are attempting to accomplish here which should be addressed before this implementation detail becomes relevant. -Jeff