From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E274513CF9E for ; Wed, 12 Jun 2024 06:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718172903; cv=none; b=YjWOhxxWcJ59cVJmUftClpbcwReHpbbmXa43coPj8Lf5oPndiK3UxawI0e5xQenskVNdE7FZq/tKTDRPqf1qnZ3WUGOKLi3/PBt9N+xTzhM5jsdnL0R+uD+nFtdRwp0W0xnXEg38YJ6U0NibclQ0AVtMH3Smegh+CILs+oQ/ZMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718172903; c=relaxed/simple; bh=i2ZIe4aBjQVeX3802b5SX9UqNgXJzpYb7raknpDn/pk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CD3EZg3Kau5TWt0hU0bBrub1SUKwQOEpROWaB8jyyaYediPh+c7DR+nBshr3GYBK09CLw0tnuMN6SWjg2bWOnuN2Z1K3pGmS1IHnGnQSDTz20RTJbIIjz3ZMOU8zlFDzzbV4ttZkT8OE6YRDqmXLOIjmSkAdQtw8dL0utiKngS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UpnFpHEP; arc=none smtp.client-ip=209.85.167.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UpnFpHEP" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3d220039bc6so2134759b6e.2 for ; Tue, 11 Jun 2024 23:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718172901; x=1718777701; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=mxqWgg2v/hVgWMCH9L846X5qk5UWjlKSRMUhsZwMVok=; b=UpnFpHEP7SYJIJVHI0mP4vEMpRK6C5E9qar0/NKJwI4QgO+UBHQFiuDDULF06zlYGt dDmPxpPwdIjU9Lgwt+6tua1EXPHBFmHT6qtOS1Rt+bEQDIU30xbnp58gNfl6PRayX2hQ zEA+YfjP6mqp7eAnojMfgcIPq5HTpNdbirM4pM5uJdDjdlH9Q1fIOgvHbquMe+MGRwIB C5NZ0xUSLfnIF2owLn7jk09+QuG0JkntXkNx4Xz/MyIdMi/484AxKjk6AAKdJM7z3v0K tgA8gWnQei3GQSop+kyyfj4PqpQivrq5ounfdVAs1ySmeVXv7TNyb3rwpiANozgxYmEE R+dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718172901; x=1718777701; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mxqWgg2v/hVgWMCH9L846X5qk5UWjlKSRMUhsZwMVok=; b=aCV7eLjm2+u/TWJlqW7HJt3X87ubMWFpu0aWE9KhHq4awgHgmmTIcD4mAOwYWF8Yer 8J/cgxwJqThBvz7nU24IZu3WYvw8uwbzNgn4gY+aUs9avb4WN2pDBWLob6tpgKDDs7j2 bh+2+djmtz7rF2cX3sI4slNXobRxBLdN8RJfyoCOgkg9e7tZCwTfk7ZkWoV+A3lnE31Q zjNNbtQ5ZrMgx2TFVj4zm3lBEzFtXBoPIZet23MN0pIAXxdWPNoTGnYTaJPoB5TsSkcD S9wx8J++uI5HL/C7RlBEFG06zaReNbHjQT05QL6zR1rAQRT74RelZC7Ov1jYHBlUK4H6 zbLw== X-Forwarded-Encrypted: i=1; AJvYcCUHcN0CQ74PmW2CDQR3wLq5wgmC+K62yVljPQsdy2NLXQpiqYzDBGgAVAWGn1lj+1ifpMkNpdgwspZojTovXMMb61BuoNpiAo00xA== X-Gm-Message-State: AOJu0YxTVJSoZrCaeJZ5ov+BZXee29x5fyRWOaTMpqY6zzwxeFV48dWO u8TFQ8d0gxfIzdIydbvDRImdOzQ6rrDg1dO7Z/1/MKUwmfNN2f2Wm/XNcu0TbA== X-Google-Smtp-Source: AGHT+IFxppmgGAwZZlpP35K5VTaKTEVZFBRJrQUxH5Xn3BfV36uFmqpVK6xRnkznoBcATBpU+IiVLw== X-Received: by 2002:a05:6808:191d:b0:3d2:1839:a5bc with SMTP id 5614622812f47-3d23e126d05mr1169369b6e.29.1718172900897; Tue, 11 Jun 2024 23:15:00 -0700 (PDT) Received: from thinkpad ([120.60.129.29]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6de224fa32csm9390805a12.44.2024.06.11.23.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 23:15:00 -0700 (PDT) Date: Wed, 12 Jun 2024 11:44:54 +0530 From: Manivannan Sadhasivam To: Mayank Rana Cc: Rob Herring , linux-pci@vger.kernel.org, lpieralisi@kernel.org, kw@linux.com, bhelgaas@google.com, andersson@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, quic_ramkri@quicinc.com, quic_nkela@quicinc.com, quic_shazhuss@quicinc.com, quic_msarkar@quicinc.com, quic_nitegupt@quicinc.com Subject: Re: [RFC PATCH 2/2] PCI: Add Qualcomm PCIe ECAM root complex driver Message-ID: <20240612061454.GF2645@thinkpad> References: <1712257884-23841-3-git-send-email-quic_mrana@quicinc.com> <20240405052918.GA2953@thinkpad> <20240406041717.GD2678@thinkpad> <0b738556-0042-43ab-80f2-d78ed3b432f7@quicinc.com> <20240410165829.GA418382-robh@kernel.org> <20240606023952.GA3481@thinkpad> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Jun 10, 2024 at 10:17:31AM -0700, Mayank Rana wrote: > > On 6/5/2024 7:39 PM, Manivannan Sadhasivam wrote: > > On Fri, May 31, 2024 at 03:47:24PM -0700, Mayank Rana wrote: > > > Hi Rob / Mani > > > > > > On 4/15/2024 4:30 PM, Mayank Rana wrote: > > > > Hi Rob > > > > > > > > Excuse me for late response on this (was OOO). > > > > On 4/10/2024 9:58 AM, Rob Herring wrote: > > > > > On Mon, Apr 08, 2024 at 11:57:58AM -0700, Mayank Rana wrote: > > > > > > Hi Mani > > > > > > > > > > > > On 4/5/2024 9:17 PM, Manivannan Sadhasivam wrote: > > > > > > > On Fri, Apr 05, 2024 at 10:41:15AM -0700, Mayank Rana wrote: > > > > > > > > Hi Mani > > > > > > > > > > > > > > > > On 4/4/2024 10:30 PM, Manivannan Sadhasivam wrote: > > > > > > > > > On Thu, Apr 04, 2024 at 12:11:24PM -0700, Mayank Rana wrote: > > > > > > > > > > On some of Qualcomm platform, firmware > > > > > > > > > > configures PCIe controller into > > > > > > > > > > ECAM mode allowing static memory allocation for > > > > > > > > > > configuration space of > > > > > > > > > > supported bus range. Firmware also takes care of > > > > > > > > > > bringing up PCIe PHY > > > > > > > > > > and performing required operation to bring PCIe > > > > > > > > > > link into D0. Firmware > > > > > > > > > > also manages system resources (e.g. > > > > > > > > > > clocks/regulators/resets/ bus voting). > > > > > > > > > > Hence add Qualcomm PCIe ECAM root complex driver > > > > > > > > > > which enumerates PCIe > > > > > > > > > > root complex and connected PCIe devices. > > > > > > > > > > Firmware won't be enumerating > > > > > > > > > > or powering up PCIe root complex until this > > > > > > > > > > driver invokes power domain > > > > > > > > > > based notification to bring PCIe link into D0/D3cold mode. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Is this an in-house PCIe IP of Qualcomm or the same > > > > > > > > > DWC IP that is used in other > > > > > > > > > SoCs? > > > > > > > > > > > > > > > > > > - Mani > > > > > > > > Driver is validated on SA8775p-ride platform using PCIe DWC IP for > > > > > > > > now.Although this driver doesn't need to know used PCIe > > > > > > > > controller and PHY > > > > > > > > IP as well programming sequence as that would be taken > > > > > > > > care by firmware. > > > > > > > > > > > > > > > > > > > > > > Ok, so it is the same IP but firmware is controlling the > > > > > > > resources now. This > > > > > > > information should be present in the commit message. > > > > > > > > > > > > > > Btw, there is an existing generic ECAM host controller driver: > > > > > > > drivers/pci/controller/pci-host-generic.c > > > > > > > > > > > > > > This driver is already being used by several vendors as > > > > > > > well. So we should try > > > > > > > to extend it for Qcom usecase also. > > > > > > > > > > I would take it a bit further and say if you need your own driver, then > > > > > just use the default QCom driver. Perhaps extend it to support ECAM. > > > > > Better yet, copy your firmware setup and always configure the QCom h/w > > > > > to use ECAM. > > > > Good suggestion. Although here we are having 2 set of requirements: > > > > 1. ECAM configuration > > > > 2. Managing PCIe controller and PHY resources and programming from > > > > firmware as well > > > > Hence it is not feasible to use default QCOM driver. > > > > > If you want to extend the generic driver, that's fine, but we don't need > > > > > a 3rd. > > > > I did consider this part before coming up with new driver. Although I > > > > felt that > > > > below mentioned functionality may not look more generic to be part of > > > > pci-host-generic.c driver. > > > > > > I did review pci-host-generic.c driver for usage. although there > > > > > > are more > > > > > > functionalityneeded for use case purpose as below: > > > > > > 1. MSI functionality > > > > > > > > > > Pretty sure the generic driver already supports that. > > > > I don't find any MSI support with pci-host-generic.c driver. > > > > > > 2. Suspend/Resume > > > > > > > > > > Others might want that to work as well. > > > > Others firmware won't have way to handle D3cold and D0 functionality > > > > handling as > > > > needed here for supporting suspend/resume as I don't find any interface > > > > for pci-host-generic.c driver to notify firmware. here we are having way > > > > to talk to firmware using GenPD based power domain usage to communicate > > > > with firmware. > > > > > > > > > > 3. Wakeup Functionality (not part of current change, but would be added > > > > > > later) > > > > > > > > > > Others might want that to work as well. > > > > possible if suspend/resume support is available or used. > > > > > > 4. Here this driver provides way to virtualized PCIe controller. > > > > > > So VMs only > > > > > > talk to a generic ECAM whereas HW is only directed accessed by > > > > > > service VM. > > > > > > > > > > That's the existing driver. If if doesn't work for a VM, fix the VM. > > > > Correct. > > > > > > 5. Adding more Auto based safety use cases related implementation > > > > > > > > > > Now that's just hand waving. > > > > Here I am trying to provide new set of changes plan to be added as part > > > > of required functionality. > > > > > > > > > > Hence keeping pci-host-generic.c as generic driver where above > > > > > > functionality > > > > > > may not be needed. > > > > > > > > > > Duplicating things to avoid touching existing drivers is not how kernel > > > > > development works. > > > > I shall try your suggestion and see how it looks in terms of code > > > > changes. Perhaps then we can have more clarity in terms of adding more > > > > functionality into generic or having separate driver. > > > I just learnt that previously dwc related PCIe ECAM driver and MSI > > > controller driver tried out as: > > > > > > https://lore.kernel.org/linux-pci/20170821192907.8695-1-ard.biesheuvel@linaro.org/ > > > > > > Although there were few concerns at that time. Due to that having dwc > > > specific MSI functionality based driver was dropped, and pci-host-generic.c > > > driver is being updated using with dwc/snps specific ECAM operation. > > > > > > In current discussion, it seems that we are discussing to have identical > > > approach here. > > > > > > Atleast on Qualcomm SA8775p platform, I don't have any other way to support > > > MSI functionality i.e. extended SPI or ITS/LPI based MSI or using GICv2m > > > functionality are not supported. > > > > > > I don't see any other approach other than MSI based implementation within > > > pci-host-generic.c driver for dwc/snps based MSI controller. > > > > > > Do you have any suggestion on this ? > > > > > > > Since this ECAM driver is going to be used in newer Qcom SoCs, why can't you use > > GICv3 for MSI handling? > Yes, that is plan further as look like we have limitation on just SA8775. > So I see two options here: > 1. Update pcie-host-generic.c without MSI based functionality, and leave > with MSI functionality differently on SA8775 > 2. Also possible to make pcie-host-designware.c based MSI functionality as > separate driver, and try to use with pcie-host-generic.c driver. That way we > would still use existing MSI related code base, and able to use with ECAM > driver. > > Do you see using above option 2 as good way to allow SNPS/DWC based MSI > controller functionality with ECAM and Non-ECAM driver ? > IMO, it is not worth splitting the code just for one platform since you said the future ECAM based platforms will not require DWC MSI. But if you have a strong requirement to use upstream DWC MSI for SA8775, then you can do the split. - Mani -- மணிவண்ணன் சதாசிவம்