Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp525383pxb; Wed, 3 Mar 2021 08:53:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJ20+zi+6LIb0CdMdPVmJ7VPyxaFnI0UREeXDbKd8/XGMUbdM+U4MYwKKcUgxAx+4mqSWV X-Received: by 2002:a17:907:a06b:: with SMTP id ia11mr15547386ejc.294.1614790397771; Wed, 03 Mar 2021 08:53:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614790397; cv=none; d=google.com; s=arc-20160816; b=ODAxQ6HthQK0+C/+WE3l+Q47JZ8c59REpDwRmW5PejXb1BpDFn2QPBIzF1Esv0AEwR QeIK/FdZzfbe64xV6v8hA2JnGxGFuBoef3UAfGF8oQVtgMnROHs+5d4ThwJURr2qlNC6 VuIjIcFB8fEWJTA1cAcN48geF3PJF0P22RjKHt8iVHQt4gp7aYKJaPby4ygJ0Fr5c4o/ yIbQOgDDac6WKpSelT4XJqXBlAbk7O2Ihqm5SBCV8npXbkQ6gA0sg0GUubo8ZNyoRdhy kHUKesei2tted1zGv2/ZLxHnPFClD0Kckrww029IyA2sFZZKLYPLAK7IAyzJdZXNqOMn 5rpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=CVrOgUIAawHnEvCewO0kKDdh1FuzFvcgVnx0rAYY4I0=; b=XVez+RUQyDhohwFC9xeVtYw5939rg2zNaxqfpRuX1N0M/eKjpycclUu7YZfI7KhETf KUkoEiP2OCsUwvHotoxB3ELuFXS8YoEe8h8fA1rO211k26TcYf4C6xWDBbvb8fGT/7/s cRsIl9Unrt2e01phfOfx6bWUlgACPtMokRJvQsp7RAfON+OwaCmcKk6N41A9ORQT+7Gm WE0rI4V5Ag3jMYUUl/W65PvaPBvpB8okHmYMcU8goNGbmRafD2CLeZD1WIZzidGBhA25 TKjCsrAdIoDvZ0cNKe2qCO1YlBCEGtD1ai1GoLadtUNTMtIshzrbe6396I6xxJcPRab7 1/rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WcI3s3Sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si9814141ejx.652.2021.03.03.08.52.28; Wed, 03 Mar 2021 08:53:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WcI3s3Sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239865AbhCBA0n (ORCPT + 99 others); Mon, 1 Mar 2021 19:26:43 -0500 Received: from z11.mailgun.us ([104.130.96.11]:54898 "EHLO z11.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239776AbhCAS1R (ORCPT ); Mon, 1 Mar 2021 13:27:17 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614623214; h=Content-Type: MIME-Version: Message-ID: In-Reply-To: Date: References: Subject: Cc: To: From: Sender; bh=CVrOgUIAawHnEvCewO0kKDdh1FuzFvcgVnx0rAYY4I0=; b=WcI3s3SxWDu4MZPsXPw1vWReYamTiIKHz9gd9bAdh737xurfh1O/xk//bSj1X0i91MmP/dWi zdsyPRSQMaV8tE+iGv10cGr/CSijn3+uikdPn67PLRDu7l3cEIeVH4qTtxmpS708XTTYAECl e0+/AU+0pGwKIf0vTjRFHOwf4PU= X-Mailgun-Sending-Ip: 104.130.96.11 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 603d31df9d2570c9fed12fd1 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 01 Mar 2021 18:26:39 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 25D57C43462; Mon, 1 Mar 2021 18:26:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 51884C433C6; Mon, 1 Mar 2021 18:26:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 51884C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Bhaumik Bhatt Cc: jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Gokul Sriram Palanisamy , Manivannan Sadhasivam , hemantk@codeaurora.org, sricharan@codeaurora.org, ath11k@lists.infradead.org Subject: Re: [PATCH v2] bus: mhi: core: Add unique qrtr node id support References: <1614336169-31467-1-git-send-email-gokulsri@codeaurora.org> <1614336169-31467-2-git-send-email-gokulsri@codeaurora.org> <20210226145245.GB70936@thinkpad> <87k0qrceih.fsf@tynnyri.adurom.net> <10e511e8dfa8d393ec4c4765668fe229@codeaurora.org> Date: Mon, 01 Mar 2021 20:26:34 +0200 In-Reply-To: <10e511e8dfa8d393ec4c4765668fe229@codeaurora.org> (Bhaumik Bhatt's message of "Mon, 01 Mar 2021 10:17:10 -0800") Message-ID: <87o8g291d1.fsf@codeaurora.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bhaumik Bhatt writes: > On 2021-03-01 03:14 AM, Kalle Valo wrote: >> + ath11k list >> >> Manivannan Sadhasivam writes: >> >>> On Fri, Feb 26, 2021 at 04:12:49PM +0530, Gokul Sriram Palanisamy >>> wrote: >>>> On platforms with two or more identical mhi >>>> devices, qmi service will run with identical >>>> qrtr-node-id. Because of this identical ID, >>>> host qrtr-lookup cannot register more than one >>>> qmi service with identical node ID. Ultimately, >>>> only one qmi service will be avilable for the >>>> underlying drivers to communicate with. >>>> >>>> On QCN9000, it implements a unique qrtr-node-id >>>> and qmi instance ID using a unique instance ID >>>> written to a debug register from host driver >>>> soon after SBL is loaded. >>>> >>>> This change generates a unique instance ID from >>>> PCIe domain number and bus number, writes to the >>>> given debug register just after SBL is loaded so >>>> that it is available for FW when the QMI service >>>> is spawned. >>>> >>>> sample: >>>> root@OpenWrt:/# qrtr-lookup >>>> Service Version Instance Node Port >>>> 15 1 0 8 1 Test service >>>> 69 1 8 8 2 ATH10k WLAN firmware service >>>> 15 1 0 24 1 Test service >>>> 69 1 24 24 2 ATH10k WLAN firmware service >>>> >>>> Here 8 and 24 on column 3 (QMI Instance ID) >>>> and 4 (QRTR Node ID) are the node IDs that >>>> is unique per mhi device. >>>> >>>> Signed-off-by: Gokul Sriram Palanisamy >>>> --- >>>> drivers/bus/mhi/core/boot.c | 14 ++++++++++++++ >>>> 1 file changed, 14 insertions(+) >>>> >>>> diff --git a/drivers/bus/mhi/core/boot.c >>>> b/drivers/bus/mhi/core/boot.c >>>> index c2546bf..5e5dad5 100644 >>>> --- a/drivers/bus/mhi/core/boot.c >>>> +++ b/drivers/bus/mhi/core/boot.c >>>> @@ -16,8 +16,12 @@ >>>> #include >>>> #include >>>> #include >>>> +#include >>>> #include "internal.h" >>>> >>>> +#define QRTR_INSTANCE_MASK 0x000000FF >>>> +#define QRTR_INSTANCE_SHIFT 0 >>>> + >>>> /* Setup RDDM vector table for RDDM transfer and program RXVEC */ >>>> void mhi_rddm_prepare(struct mhi_controller *mhi_cntrl, >>>> struct image_info *img_info) >>>> @@ -391,6 +395,9 @@ void mhi_fw_load_handler(struct mhi_controller >>>> *mhi_cntrl) >>>> const struct firmware *firmware = NULL; >>>> struct image_info *image_info; >>>> struct device *dev = &mhi_cntrl->mhi_dev->dev; >>>> + struct pci_dev *pci_dev = to_pci_dev(mhi_cntrl->cntrl_dev); >>>> + struct pci_bus *bus = pci_dev->bus; >>>> + uint32_t instance; >>>> const char *fw_name; >>>> void *buf; >>>> dma_addr_t dma_addr; >>>> @@ -466,6 +473,13 @@ void mhi_fw_load_handler(struct >>>> mhi_controller *mhi_cntrl) >>>> return; >>>> } >>>> >>>> + instance = ((pci_domain_nr(bus) & 0xF) << 4) | (bus->number & 0xF); >>>> + instance &= QRTR_INSTANCE_MASK; >>>> + >>>> + mhi_write_reg_field(mhi_cntrl, mhi_cntrl->bhi, >>>> + BHI_ERRDBG2, QRTR_INSTANCE_MASK, >>>> + QRTR_INSTANCE_SHIFT, instance); >>> >>> You cannot not do this in MHI stack. Why can't you do this in the >>> MHI controller >>> specific to QCN9000? And btw, is QCN9000 supported in mainline? >> >> I'm not sure what QCN9000 means but I'm guessing it's QCN9074. We have >> initial QCN9074 support in ath11k but there are some issues still so >> it's not enabled by default (yet): >> >> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=ath-next&id=4e80946197a83a6115e308334618449b77696d6a >> >> And I suspect we have this same qrtr issue with any ath11k PCI device, >> including QCA6390, so this is not a QCN9074 specific problem. >> >> BTW Gokul, please always CC the ath11k list when submitting patches >> which are related to ath11k. > > QRTR sits on top of MHI so shouldn't this be handled outside of MHI > after MHI is operational? We cannot allow PCI code in MHI core driver > but this can be handled pre or post MHI power-up in whatever way you > desire that does not have to directly involve MHI. Sure, makes sense. I was just replying to Mani's question about status of QCN9000 upstream support. So should we handle this within ath11k, is that the right approach? I also suspect that for QCN9074 and QCA6390 we have to do this a bit differently, so it would be easier to handle the differences between devices (and firmware versions) inside ath11k. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches