Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3729201rdg; Wed, 18 Oct 2023 04:35:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxLuVJcw/NlKU7Wd6qETBo2ksV4W0hlz4TuMSuNN/e6aywNKZUX9tghl2vKQLuiZibdMF+ X-Received: by 2002:a05:6871:d06:b0:1e9:b811:da13 with SMTP id vh6-20020a0568710d0600b001e9b811da13mr5051856oab.49.1697628899683; Wed, 18 Oct 2023 04:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697628899; cv=none; d=google.com; s=arc-20160816; b=odAB8xBICVizTKEr/EA4xQOZata7HHdpnWztnwHdSK4B7Zi7gkyL5+tL20SMP4gj9T TdDStKGaW/xo2x6pien36QMMZPuFpBWgie7oayC5OuTDkeA7fgR6lGE6wl9KqRwiiOPv inqMJZKBOyua2q7nAJe3c9POnO3OK7tN5LU8ds//FjFnfrj72S+FeG5yRQgsqzKTBGgR hCmJYNbs6GEnQjSQbGnhYjDep9CglStC8u2wqZ/u+dKxOEpHFSGZQdA1mtzd2mtHcIf5 LLbMhFB1vPea4tAghknPqlYztuAbWGCnpMsvL1VrMkEe3mlH/nh1ioIHlD/Vv2iOdCgZ K70Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0ydEZu3R7Q7mStE0Pa3hj4GczRLBqagLHsYHro15TR8=; fh=a4jVY77fL8q59y9vETjVHhCjkDpQmBwhOdq5bpbAGHU=; b=vUgmuSCuUbtunOuEN8Lq3iRDrQdiWiEEO8QVHuikaVQXR7wh6ELtN8yukO3DW+JmrD xUblK2yorl6yBXEV73xoOP/cgDVRg542uY+hrGenQ2sMNwZsKIHv+jl7szELtPjq7RM/ WjVycao5ZFhBHnuoshha1kZ/g++bzFC5X4A0ZJAacPrh3pAedI2sOgRgMfh+/JiToidr Ptz4XZeKgd+MQjv2rhTA3Rt1j5DBWkB6lrsTWPH9ZgLFL7/haqvOhGoTYVSro5uZnTnR WwnqbQDSxqK2CXLjSSiFE+HXSPGbWK7lVb3S5wmzIp2ZOjNc52/JeBS4MZtyXecx7xPx 0eng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hXDENuY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id x26-20020a656aba000000b005aa589ef664si1901824pgu.557.2023.10.18.04.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 04:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hXDENuY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0C6048023712; Wed, 18 Oct 2023 04:34:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231246AbjJRLee (ORCPT + 99 others); Wed, 18 Oct 2023 07:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbjJRLec (ORCPT ); Wed, 18 Oct 2023 07:34:32 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79680114; Wed, 18 Oct 2023 04:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697628870; x=1729164870; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eqc17uG/Wp2D66WXcFZdwU3+R9wxUscpDbfeTvikXZs=; b=hXDENuY7dRREPQA7nPotsPyhE0JAPBdkS7GfYJ5kFTB0IEo9+wuzB3jn VqSR7dQZHfKiVctWPYS5vTdTDvq0bXLZmmQ0nmvkKznJzGxCkYafGroTG AUrjv2oX4uajsrfcTDeR0gTtccAGUoBJJGkkPs8puqNX4ONH+YkBAnAPN rWvYlhKIDoNy64tmRsGPzo00X9XGQLR0/+Aw3Xy72I7eJOhHabxp1k12B FMB1uzQ1im5bRkYB1Xnhcx8PXLIRf9/8pykYUnNkLprF1W1ZyP9qVdmGw 31iRItZfYWsCuguLWoC9jW5xZijJOHLUCDCpOyNfpng91Pw0Ts31bkgkP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="383215922" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="383215922" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 04:34:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="826855323" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="826855323" Received: from suguccin-mobl1.amr.corp.intel.com (HELO localhost) ([10.252.44.63]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 04:34:25 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Bjorn Helgaas , linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Jonathan Cameron , Mahesh J Salgaonkar , "Oliver O'Halloran" , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5/7] PCI/DPC: Use defined fields with DPC_CTL register Date: Wed, 18 Oct 2023 14:32:52 +0300 Message-Id: <20231018113254.17616-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018113254.17616-1-ilpo.jarvinen@linux.intel.com> References: <20231018113254.17616-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 04:34:57 -0700 (PDT) Instead of using a literal to clear bits, add PCI_EXP_DPC_CTL_EN_MASK and use the usual pattern to modify a bitfield. While at it, rearrange RMW code more logically together. Signed-off-by: Ilpo Järvinen --- drivers/pci/pcie/dpc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c index a5c259ada9ea..0048a11bd119 100644 --- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -18,6 +18,9 @@ #include "portdrv.h" #include "../pci.h" +#define PCI_EXP_DPC_CTL_EN_MASK (PCI_EXP_DPC_CTL_EN_FATAL | \ + PCI_EXP_DPC_CTL_EN_NONFATAL) + static const char * const rp_pio_error_string[] = { "Configuration Request received UR Completion", /* Bit Position 0 */ "Configuration Request received CA Completion", /* Bit Position 1 */ @@ -369,12 +372,13 @@ static int dpc_probe(struct pcie_device *dev) } pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CAP, &cap); - pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, &ctl); - ctl = (ctl & 0xfff4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN; + pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, &ctl); + ctl &= ~PCI_EXP_DPC_CTL_EN_MASK; + ctl |= PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN; pci_write_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, ctl); - pci_info(pdev, "enabled with IRQ %d\n", dev->irq); + pci_info(pdev, "enabled with IRQ %d\n", dev->irq); pci_info(pdev, "error containment capabilities: Int Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n", cap & PCI_EXP_DPC_IRQ, FLAG(cap, PCI_EXP_DPC_CAP_RP_EXT), FLAG(cap, PCI_EXP_DPC_CAP_POISONED_TLP), -- 2.30.2