From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19B87C433DB for ; Wed, 6 Jan 2021 00:53:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 940802173E for ; Wed, 6 Jan 2021 00:53:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 940802173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NMIJcENKWVH52g7iiTUYRBq0IHnhaZFliPtbQr9Ubbo=; b=gu6EyjrNeqDijo7V+x4y/vezT si8VBae8k+fwsvoWqNQizP9/tufyN72BD/jHnqs2FmSBANbxCM36LCzxkGjOHdp2riVfe1TvhyprY TKl3s7g1YZ9CubtjUz3MSzBp/L3za4oxNbK/qr/CVHc371njXTDZ7Ovx2s4qsogXadN2PhWF1Axjw Mtwxeo9ofrbIHdCvUW7H2Yn+n1+IfQgFy4Ap/pZ3kbj76s8xIu3o/F40FCDHLfzvcejJnFfNpOPYy RXYZD0E77v/sLst1qSU+C6nPSuuGFp3+pyy3L277fExOvkrrun3qP2YZtf6dnjxg11hPRbDvCyE5e iZY3bDLEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwx2d-0006nj-Px; Wed, 06 Jan 2021 00:51:12 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwx2a-0006mY-2p for linux-arm-kernel@lists.infradead.org; Wed, 06 Jan 2021 00:51:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2VuGgG2Y0oR6VaHF+A2Tlk5qtM6i8jJ0JeuAdLPEIVg=; b=YtyM+2Ss06xrA0JR7dBINeoXw 4jdKkyHo49FRvf/FV/c3qm5xE4AyVEtItlodEp1L2+RNlD1SeuFL2mWp3wLydV/ULsYxTgYAzHXxG EAJhIpgHroWFEyvqN+YGlnsYm1O3ER2MNM/6RVqxmy0hsz8+oZ7s344+yfEgfLE7cbL/h084Xr+B9 g7gAMS+C6zIBs+i0eRXW1jMAMi3sgRZf3QAwztWXuo4F7eF3FhoQAF0ofEl0sBZF828Xs/grfWXLV RFRiuDI7T+xrYg2m4Mz1gqb0lfw3xVPkGdFy3KLZmtosxjq61B/rXHHJI3bLqS1JbceneNZlPU6E2 ff046hNcA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45162) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kwx2N-0001D4-K8; Wed, 06 Jan 2021 00:50:55 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kwx2L-0008Az-I1; Wed, 06 Jan 2021 00:50:53 +0000 Date: Wed, 6 Jan 2021 00:50:53 +0000 From: Russell King - ARM Linux admin To: Bjorn Helgaas Subject: Re: [PATCH 2/3] ARM: iop32x: improve N2100 PCI broken parity quirk Message-ID: <20210106005053.GG1551@shell.armlinux.org.uk> References: <20210106002833.GA1286114@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210106002833.GA1286114@bjorn-Precision-5520> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210105_195108_256664_22DB35C9 X-CRM114-Status: GOOD ( 22.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Realtek linux nic maintainers , "linux-pci@vger.kernel.org" , "netdev@vger.kernel.org" , Bjorn Helgaas , Jakub Kicinski , David Miller , "linux-arm-kernel@lists.infradead.org" , Heiner Kallweit Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 05, 2021 at 06:28:33PM -0600, Bjorn Helgaas wrote: > On Tue, Jan 05, 2021 at 10:42:31AM +0100, Heiner Kallweit wrote: > > { > > - if (dev->bus->number == 0 && > > - (dev->devfn == PCI_DEVFN(1, 0) || > > - dev->devfn == PCI_DEVFN(2, 0))) > > - dev->broken_parity_status = 1; > > + if (machine_is_n2100()) > > + pci_quirk_broken_parity(dev); > > Whatever "machine_is_n2100()" is (I can't find the definition), it is > surely not equivalent to "00:01.0 || 00:02.0". That change probably > should be a separate patch with some explanation. It isn't equivalent. It says "if this machine is N2100" which is a completely different thing from matching the bus/devfn numbers. You won't find a definition for machine_is_n2100() in the kernel; it is generated from the machine table by scripts, along with lots of similar definitions for each machine type: /* The type of machine we're running on */ extern unsigned int __machine_arch_type; #ifdef CONFIG_MACH_N2100 # ifdef machine_arch_type # undef machine_arch_type # define machine_arch_type __machine_arch_type # else # define machine_arch_type MACH_TYPE_N2100 # endif # define machine_is_n2100() (machine_arch_type == MACH_TYPE_N2100) #else # define machine_is_n2100() (0) #endif The upshot of the above is that machine_is_n2100() is constant zero if the platform is not configured (thereby allowing the compiler to eliminate the code.) If it is the _only_ platform selected, then it evaluates to an always-true expression. Otherwise, it becomes a run-time evaluated conditional. We may have better ways to do this in modern kernels, but this was invented decades ago, and works with zero runtime overhead. > If this makes the quirk safe to use in a generic kernel, that sounds > like a good thing. > > I guess a parity problem could be the result of a defect in either the > device (e.g., 0x8169), which would be an issue in *all* platforms, or > a platform-specific issue in the way it's wired up. I assume it's the > latter because the quirk is not in drivers/pci/quirks.c. > > Why is it safe to restrict this to device ID 0x8169? If this is > platform issue, it might affect any device in the slot. You assume the platform has multiple PCI slots - it doesn't. It's an embedded platform (it's sold as a NAS) and it has a single mini-PCI slot for a WiFi card. Without that populated, lspci -n looks like this: 00:01.0 0200: 10ec:8169 (rev 10) 00:02.0 0200: 10ec:8169 (rev 10) 00:03.0 0180: 1095:3512 (rev 01) 00:04.0 0c03: 1106:3038 (rev 61) 00:04.1 0c03: 1106:3038 (rev 61) 00:04.2 0c03: 1106:3104 (rev 63) Where all those devices are soldered to the board. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel