Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp58965rwb; Tue, 13 Dec 2022 14:04:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf7lNqaeDcFcBnikawBFydP/HJc68BeF5YKnzOdgP53ucVUVwD/afbv0jYRYK6HU88UBPEOp X-Received: by 2002:a05:6a20:13a8:b0:a6:3d7c:9849 with SMTP id w40-20020a056a2013a800b000a63d7c9849mr31953050pzh.46.1670969094178; Tue, 13 Dec 2022 14:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670969094; cv=none; d=google.com; s=arc-20160816; b=Q+UiOQoI50B6iWpZU/LmJgQlC/QGxiQRkxzKbdZXCsn7whb2NxIiCenBBW5/33T5a+ 6M6A8iHtEoMVB0bt6+maH3OUQC9McRgvLoEW3cKe6yeL6uX9ZYJ5LjIQcNrqi+jVLaAU Nk5mbBKy+c6XSubB/Lrz7Km3HB27PUJDEwJKM7+1G62Fjoly2ZL07CddCifNVHE++68f 68EyES2zrZvV9Hp5UVoiVrTi+ksGu0rTdXvl1SKho/X5U8dxocqOG+YdRmDWrOCwXmSm Nhra0n3LE1GHInGUMNTlauDDL8FiXc2BLKzUWrqgiijxJhl3JtukAqVGxRTjvvpnpaZh O+XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=YYxK8R9uZHWdxGKfedPVShUO1H2C0fIaBRi0iT1Y5Iw=; b=Y1pTuLUWA6B+gy6QcXec0VAJLDtFoWZ3mPNaKVKkfNWcE+z9XzSVsI8lbwFMouorbk Z6clIhW99W88birBOJ5YDtoKmqjoxs3eUupJ/Uu04b8h8xMesp6cojEmn/cTcEJOEeBc hcfbfzZMIEpEl1PMhk/K2CXIlZB/IdUqZFxz0LEBSTLnyBXeRVlBqUChJjQhnZlklSDg 3I4qwEUnzWWvCjiNsbfdAMdHPAITVRtPoioIbr5Rk+dwkwHNaPXUS10r20LQSRVbRIqg sbFc2O9TxrCqO1aK9QXO59vzExf4knyrKDQ4+nxDgE2FTP0nw01jxXJu1ogipO7ApFIl 3T/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=icQ7Gn7g; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a634651000000b0045c88c3b799si13101272pgk.709.2022.12.13.14.04.44; Tue, 13 Dec 2022 14:04:54 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=icQ7Gn7g; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236149AbiLMVh7 (ORCPT + 72 others); Tue, 13 Dec 2022 16:37:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236367AbiLMVhx (ORCPT ); Tue, 13 Dec 2022 16:37:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC654F587; Tue, 13 Dec 2022 13:37:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 68C72B815BE; Tue, 13 Dec 2022 21:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE099C433F0; Tue, 13 Dec 2022 21:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670967469; bh=HcXX0RARN3I+UoWquQo+DGm5xVSzYdRpmI93ak8n568=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=icQ7Gn7gzrap9RUm5z5buouvFxdzmPCrLnoJ5EANFRXsHHTbyyl1Ax50IF2hpJCsP J4s4I0zdHTd9AJw+BhKgk3yqriEqfYK5gK3kNE9Jpddqe5whUQLdhmL1UUR1vuT5nK 9js58GAaGVtQZAQD64k1229c+yRKJFndnZTxBetcrYxvYR7H7s0nvTStXzJe8TOAv3 2vDCyfL+8lqj64cgUg+Vqn34M5ziBXYgeGQLJEXKFJoHMOcSifl+07lPWOeD8Hd35K 9aS08FvHtDFWpIIPm89ubLUvH5kwQnqy9PzhgBvqetVIluQF3hvIbZCHr0qzbn00v2 tlHNApqLmgVQQ== Date: Tue, 13 Dec 2022 15:37:47 -0600 From: Bjorn Helgaas To: Christoph Hellwig Cc: Mika Westerberg , Sathyanarayanan Kuppuswamy , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: Re: [PATCH v3] PCI/portdrv: Allow AER service only for Root Ports & RCECs Message-ID: <20221213213747.GA209007@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Mon, Dec 12, 2022 at 12:46:11AM -0800, Christoph Hellwig wrote: > On Fri, Dec 09, 2022 at 06:29:22PM -0600, Bjorn Helgaas wrote: > > + if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || > > + pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) && > > + dev->aer_cap && pci_aer_available() && > > (pcie_ports_native || host->native_aer)) > > Eww, this is really hard to follow. Can you split this out into > a little helper, that actually documents the decisions based > on some of the wording you have in the current comit message? I completely agree. We have basically the same sort of thing for PCIE_PORT_SERVICE_HP (also added this cycle), PCIE_PORT_SERVICE_AER, PCIE_PORT_SERVICE_PME, and PCIE_PORT_SERVICE_DPC. I'd really like to figure out a way to centralize the check for pcie_ports_native, host->native_aer, etc., because they clutter a lot of places. I didn't have time to work on that this cycle, but maybe next time. Bjorn