Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2273550imc; Tue, 12 Mar 2019 10:21:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfKt7ldoZi7WwOOrun+YxtDWTRKdB6z7m5D0u5xUef3V440YbSLuBuDJa9xNDW4YtYIJDo X-Received: by 2002:a65:4bce:: with SMTP id p14mr11056320pgr.68.1552411264677; Tue, 12 Mar 2019 10:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552411264; cv=none; d=google.com; s=arc-20160816; b=hTzIRkC3KpfXNhOYpk+2G2VtFF7/5EA++gQCsl4M7efx5lNV+CpnCNb2/J2YK3GvRR WJ8AS/O4z5NfLzm580qnGSQgbtpsALMf7IrLs0lQadJqhzNFu2jkNzHExqJh6C3K7V1l IXFjR1Y9d0DFU2CQ9vANo4A36KhxqXVehsY/JcS89vh+V4wvmUahL29O6Gp10ql5Ebeg HLMhzT7I/i4zqavhvXh9YVLDhfF5uzzqAHrr+Mi7+inubHILyDq1/U3MnB/ZclUUP5pk RgGevZ3nj1awZcXH/5Z/O9bLw1ZHjykoE0ddA74YgXR+dytQu6zZBGCLclZ1UP8IPPfr zP3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Jkf1TLq4aenoXTqFwHChkZYMdaLHQKne0xkogiK01WI=; b=QJB081/iPXNF8iubsoniPOTwnumB/cvt0Fza+2zQe3LdFMPNJt6LUlGItfJxP25xJ1 2e65qNGA5Mdn0o/3RHpAZomSzE+6JTzvrVsYbb9w4xsYLmnp+GTi2i/E5m3uzcBqHmm0 j1HeIpVX+hEC+EvHeo8K1KeNbuchEzpCyWV6xCPeRiaLVGeWeoI7/ldDe0DcYbKSFhjc 1pJwxfmI8iEayTZl7NAoZv0Nw83lq9mmPMc5apW1OVGPN96f6Q1TaQva6QAqxQ0Z7S5P YLrUfN11CpGu02Yjv2n0iy+0i33m/w0EWmeOs4xlcwjw4fl9MXyb2Fld21TeIBiY49SY 09aQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r5si3628195plo.40.2019.03.12.10.20.48; Tue, 12 Mar 2019 10:21:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729157AbfCLRTW (ORCPT + 99 others); Tue, 12 Mar 2019 13:19:22 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:30073 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729350AbfCLRTB (ORCPT ); Tue, 12 Mar 2019 13:19:01 -0400 Received: from [192.168.108.8] (unknown [213.36.7.13]) (Authenticated sender: marc.w.gonzalez) by smtp3-g21.free.fr (Postfix) with ESMTPSA id 5DF8313F8D5; Tue, 12 Mar 2019 18:18:40 +0100 (CET) Subject: Re: [RFC PATCH v1] PCI: qcom: Use quirk to override incorrect device class To: Stanimir Varbanov , Bjorn Helgaas Cc: Andy Gross , David Brown , Bjorn Andersson , PCI , MSM , LKML , Jeffrey Hugo References: <94bb3f22-c5a7-1891-9d89-42a520e9a592@free.fr> <65321fe3-ca29-c454-63ae-98a46c2e5158@mm-sol.com> From: Marc Gonzalez Message-ID: <1205cbfb-ac06-63a5-9401-75d4e68b15b5@free.fr> Date: Tue, 12 Mar 2019 18:18:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <65321fe3-ca29-c454-63ae-98a46c2e5158@mm-sol.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/03/2019 13:42, Stanimir Varbanov wrote: > On 3/11/19 4:56 PM, Marc Gonzalez wrote: > >> Some chips report an incorrect device class. Override the incorrect >> value using a quirk, instead of code in the read function. >> >> Signed-off-by: Marc Gonzalez >> --- >> FWIW, this quirk is no longer required on recent chips: >> msm8996 (tested by Stanimir), msm8998 (tested by me), sdm845 (untested) are unaffected >> apq/ipq8064 is affected => what is the device ID for these chips? >> others? >> >> Stanimir added: "this will become a real problem (now we use the driver as RC) >> when someone decide to use it as an endpoint" >> --- >> drivers/pci/controller/dwc/pcie-qcom.c | 14 ++++++-------- >> 1 file changed, 6 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c >> index 3de5510fd3d5..94da2c9c2ad5 100644 >> --- a/drivers/pci/controller/dwc/pcie-qcom.c >> +++ b/drivers/pci/controller/dwc/pcie-qcom.c >> @@ -1136,17 +1136,15 @@ static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, >> { >> struct dw_pcie *pci = to_dw_pcie_from_pp(pp); >> >> - /* the device class is not reported correctly from the register */ >> - if (where == PCI_CLASS_REVISION && size == 4) { >> - *val = readl(pci->dbi_base + PCI_CLASS_REVISION); >> - *val &= 0xff; /* keep revision id */ >> - *val |= PCI_CLASS_BRIDGE_PCI << 16; >> - return PCIBIOS_SUCCESSFUL; >> - } >> - > > once you dropped the above snippet this function becomes absolutely > useless so please delete it at all and also from qcom_pcie_dw_ops. Good catch. >> return dw_pcie_read(pci->dbi_base + where, size, val); >> } >> >> +static void qcom_fixup_class(struct pci_dev *dev) >> +{ >> + dev->class = PCI_CLASS_BRIDGE_PCI << 8; >> +} >> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class); > > I wonder, in case that dw_pcie_setup_rc() already has a write to > PCI_CLASS_DEVICE configuration register to set it as a bridge do we > still need to do the above fixup? I don't know, I don't have an affected device. Unless the msm8998 /is/ affected, and dw_pcie_setup_rc() actually fixes it? Regards.