Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16483985rwd; Mon, 26 Jun 2023 10:34:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Un3GF/6YGAMhhCblI/zx13u1FVilRqveQXZKbOhqsysfcpV0fgYD+S6Ef4/vcIPpPGSME X-Received: by 2002:a50:fe90:0:b0:51d:a308:74f9 with SMTP id d16-20020a50fe90000000b0051da30874f9mr1057663edt.29.1687800863774; Mon, 26 Jun 2023 10:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687800863; cv=none; d=google.com; s=arc-20160816; b=RhOGcH5Uosb1lLi+OlLXLDxAXKiDzpwLLBGuDgvDpeGlBI+o3Vivf8QwYru9CLFzT9 c2pREKS3i4h5ymj0uM7mWfldXnB6EThFW1Eew2AQ3bM4BVC9aRNM3V37xDSaddRsTVs4 0xVm8+3RofZZbAZCnLYOGFUvpIE7UK5hnVyj120Jcv0txF3iA3DhnHf+tONxMCcBr/JH D0PWm9/WTVzGOf+ADAVCv9p8Th95w/i8v9XQy5dpeLar+ZycXO+jeRCmOt6AQt0oq07a Bk8hE9bSD0U8mtDOiqyHvK8yXxfGFZSM9QgaumICiDTEYpODOfcBysTf6o+6urAUpy9K HS6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=NkiFzCe25ddo2CI1iUwfIKdPfKGFMT4upqMXkk7C3OQ=; fh=AIOi71bgrz7+sodeLr+rBO4TRxWP5PngeQgCj5vg4sw=; b=CEutDejjD7YtJQrZucGk9+h6fOvhC8VI4EZwDacs+DcSPvyVboQP62Y125BpEzVukv q3TZbh3PcBCsUDUPUGjlqKrX1eQrZp6kSTEEKfVaDikHG8hWFyY5bj9R4TwdwB2K4Wip n9Q1LtAfXd48wwbssR2k+UV8klmBNuqUhr6BOTlgEdzmDBCdus+/tC1s4+fWHktLpHyK aei6SwBQuNti9rZsZR4LNTZ3t8g08I90pf571+ru7hsxA+/IqFhgB37RebELX8TcqDBm l5pGKLk1j91N8UgnpKwYNFoHXtAFiA7RWds3kXNv7sjDScz6+jcuSaKPvlrhAXdZCR9c nHIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WvfTG+Ce; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a50ee08000000b0051a48ec8ed7si2943203eds.523.2023.06.26.10.33.58; Mon, 26 Jun 2023 10:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@quicinc.com header.s=qcppdkim1 header.b=WvfTG+Ce; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229637AbjFZRTA (ORCPT + 99 others); Mon, 26 Jun 2023 13:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjFZRSl (ORCPT ); Mon, 26 Jun 2023 13:18:41 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E212D49 for ; Mon, 26 Jun 2023 10:16:24 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35QAbfRq019286; Mon, 26 Jun 2023 17:15:59 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=NkiFzCe25ddo2CI1iUwfIKdPfKGFMT4upqMXkk7C3OQ=; b=WvfTG+Ce7OiqRZEwOJypw6r1nMQ/R0jtiAAIIAgz0VJLJIrAAVa3C/9xr69fqlvxi48l iE4agheJleyfEyZQUJPvjyEvLZ+iQxKaQoTp+/OIJsoSWxE8Ro9N+D8HRvFqzW73J420 bx+WePGvCngnh5uFXOLEoZdHddUwqECKX6qxIxRd9iFe/49u4Rlrr907HKXT/OtGd3Tj jQ7CFQzLJIl6kkiXeCG10o2AtyvFCmDA+66INFAdvhgotncKWtEq9V1Jt+Y7g+BCpAkJ hFi02Ka4KdLlzbq15kQAZ/5FB0s6lheuWqXpBWyQhr6m7Sx14jd9wAy+7UzzWi0DUe9E sw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rdssdmmaa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Jun 2023 17:15:58 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35QHFvhs001058 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Jun 2023 17:15:57 GMT Received: from [10.226.59.182] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 26 Jun 2023 10:15:57 -0700 Message-ID: <507f4cc2-15c2-8323-878e-4da00505bc45@quicinc.com> Date: Mon, 26 Jun 2023 11:15:56 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v2 0/2] Add MHI quirk for QAIC Content-Language: en-US To: Manivannan Sadhasivam CC: , , References: <20230519163902.4170-1-quic_jhugo@quicinc.com> <20230608115928.GA5672@thinkpad> From: Jeffrey Hugo In-Reply-To: <20230608115928.GA5672@thinkpad> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: tc5UBN98mjMhOlVn5IJFVr011CeDJDEI X-Proofpoint-ORIG-GUID: tc5UBN98mjMhOlVn5IJFVr011CeDJDEI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-26_14,2023-06-26_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 clxscore=1015 malwarescore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306260158 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On 6/8/2023 5:59 AM, Manivannan Sadhasivam wrote: > On Fri, May 19, 2023 at 10:39:00AM -0600, Jeffrey Hugo wrote: >> With the QAIC driver in -next, I'd like to suggest some MHI changes that >> specific to AIC100 devices, but perhaps provide a framework for other >> device oddities. >> >> AIC100 devices technically violate the MHI spec in two ways. Sadly, these >> issues comes from the device hardware, so host SW needs to work around >> them. >> >> Thie first issue, presented in this series, has to do with the >> SOC_HW_VERSION register. This register is suposed to be initialized by the >> hardware prior to the MHI being accessable by the host to contain a >> version string for the SoC of the device. This could be used by the host >> MHI controller software to identify and handle version to version changes. >> The AIC100 hardware does not initialize this register, and thus it >> contains garbage. >> >> This would not be much of a problem normally - the QAIC driver would just >> never use it. However the MHI stack uses this register as part of the init >> sequence and if the controller reports that the register is inaccessable >> then the init sequence fails. On some AIC100 cards, the garbage value >> ends up being 0xFFFFFFFF which is PCIe spec defined to be a special value >> indicating the access failed. The MHI controller cannot tell if that >> value is a PCIe link issue, or just garbage. >> >> QAIC needs a way to tell MHI not to use this register. Other buses have a >> quirk mechanism - a way to describe oddities in a particular >> implementation that have some kind of workaround. Since this seems to be >> the first need for such a thing in MHI, introduce a quirk framework. >> >> The second issue AIC100 has involves the PK Hash registers. A solution for >> this is expected to be proposed in the near future and is anticipated to >> make use of the quirk framework proposed here. With PK Hash, there are two >> oddities to handle. AIC100 does not initialize these registers until the >> SBL is running, which is later than the spec indicates, and in practice >> is after MHI reads/caches them. Also, AIC100 does not have enough >> registers defined to fully report the 5 PK Hash slots, so a custom >> reporting format is defined by the device. >> > > Looking at the two issues you reported above, it looks to me that they can be > handled inside the aic100 mhi_controller driver itself. Since the MHI stack > exports the read_reg callback to controller drivers, if some registers are not > supported by the device, then the callback can provide some fixed dummy data > emulating the register until the issue is fixed in the device (if at all). > > Quirk framework could be useful if the device misbehaves against the protocol > itself but for the register issues like this, I think the controller driver can > handle itself. > > What do you think? I think for the HW_VERSION register, your suggestion is very good, and something I plan to adopt. For the PK Hash registers, I don't think it quite works. HW_VERSION I can hard code to a valid value, or just stub out to 0 since that appears to be only consumed by the MHI Controller, and we don't use it. The PK Hash registers are programmed into the SoC, and can be unique from SoC to SoC. I don't see how the driver can provide valid, but faked information for them. Also, the user consumes this data via sysfs. We'd like to give the data to the user, and we can't fake it. Also the data is dynamic. Lets start with the dynamic data issue. Right now MHI reads these registers once, and caches the values. I would propose a quirk to change that behavior for AIC100, but does MHI really need to operate in a "read once" mode? Would something actually break if MHI read the registers every time the sysfs node is accessed? Then sysfs would display the latest data, which would be beneficial to AIC100 and should not be a behavior change for other devices which have static data (MHI just displays the same data because it hasn't changed). Do you recall the reason behind making the PK Hash registers read once and cached? > > - Mani > >> v2: >> -Fix build error >> -Fix typo in commit text >> >> Jeffrey Hugo (2): >> bus: mhi: host: Add quirk framework and initial quirk >> accel/qaic: Add MHI_QUIRK_SOC_HW_VERSION_UNRELIABLE >> >> drivers/accel/qaic/mhi_controller.c | 1 + >> drivers/bus/mhi/host/init.c | 13 +++++++++---- >> include/linux/mhi.h | 18 ++++++++++++++++++ >> 3 files changed, 28 insertions(+), 4 deletions(-) >> >> -- >> 2.40.1 >> >> >