Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp94535pxx; Tue, 27 Oct 2020 22:34:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb0EvpMFNBwWRKKDWWJAKyM/7ZMW5Tf9uoKsSOCVPLrO3n/VafMETfQRqWAj4o3TOWRgRR X-Received: by 2002:a17:906:7016:: with SMTP id n22mr6132741ejj.402.1603863288158; Tue, 27 Oct 2020 22:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603863288; cv=none; d=google.com; s=arc-20160816; b=K6dJWKQVYvLFP2aL4xh4tbUahvkR4nmZls2LwkRXdgIt9yaFg7+4MMCZzE3sQASqsy 8zF4nG1dDab0U7pTXaPL3og38xPzjR6pmfet6hGC+P6hBNBQFUVHi6Cx12XYWi9chV5Y tkh5WG4b00XxqfoXcggfMct+UZx0DkPyTKnD2ByFxazWKDTTAhH3Zl+6fwogt5Z++Xw3 pueoWkDLUqi3GFExEM2deCADA64/A0rtVbAJeE8abj8u9P4xmHRCwPkxaLWktb78b/oo 7b07Et4zsr8s/F6AF0p4zuA2raUT40jrK9bmyTuslKxPAZ5A309gF8dupOSeZG7EmNPy 8ZUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=r0xwNq09SLVf9IAKX1jCbxlzGbnHbhH3r1mmzOeOSi8=; b=q9JQJmIzlPfPR3v/NX987r/yyCpk2S3elIpOCdbhI5Z/cxT/LzvUpMhOclEnpiirq2 XIXJGddFcwF1U/kAnwmd8v1RHWqQju7JoSGAnQH8XPI849VDPEiIseclT9aq5WBIVhVh /vsENlAf7fSxIasK7WH9/aVjbkr+Tjg5BJeohZO5QzGkcwT9PyWNdNu0d2M9sCVoI8OX owJH6ZmauLvOKoTUjhFCpfzwBj0pmNA/WKr5JgPoBXw0kI2s5TZ8k66h8azbOfaGMEOn QxPkPdQi71Yx7ARmo0AIalLiNLJbIOgivHcbQLBQIbuKun1usnOFaTbiMC9zRgOA+H5B Y/PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="Y/DJ1YQp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si2437404ejf.257.2020.10.27.22.34.23; Tue, 27 Oct 2020 22:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="Y/DJ1YQp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2894368AbgJ0IE5 (ORCPT + 99 others); Tue, 27 Oct 2020 04:04:57 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:4390 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508692AbgJ0IDw (ORCPT ); Tue, 27 Oct 2020 04:03:52 -0400 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 27 Oct 2020 01:03:57 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 27 Oct 2020 08:03:45 +0000 Received: from vidyas-desktop.nvidia.com (172.20.13.39) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Tue, 27 Oct 2020 08:03:42 +0000 From: Vidya Sagar To: , , , , , , , CC: , , , , , Subject: [PATCH V2 1/2] PCI/AER: Add pcie_is_ecrc_enabled() API Date: Tue, 27 Oct 2020 13:33:29 +0530 Message-ID: <20201027080330.8877-2-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201027080330.8877-1-vidyas@nvidia.com> References: <20201027080330.8877-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1603785837; bh=r0xwNq09SLVf9IAKX1jCbxlzGbnHbhH3r1mmzOeOSi8=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-NVConfidentiality:MIME-Version:Content-Type; b=Y/DJ1YQpJ9dWzdrAHRHxF7Ro99qwC02tqL8cdVONz8dE6v3rg/g1VGm6c7h+Q9emn pKW6K9Lo7Y9hLyZ7iJcHfdIf9ES0XMzH5ahEUmM5CdkOLX0MNznRqXZzA0QX84z2QC AKI3ZTs3cmr+b9CL1DPW5xKWJzdy8h1zozb3Oi03TAIX3MSHs5bouAJSqS3hk5PD5m CxOIJbNRZaDktMv++lgDIOglCfeqfgUJuurorhY74kmHChl+oZHx+IEKINGNHJSnos YShwDu/cUo9lRD1tM9vq4Co5iG4YyXcKHOd8xvnfHze0BvUq+C4oUzVuSpnEItl80A 1k764zZ4F0IAA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds pcie_is_ecrc_enabled() API to let other sub-systems (like DesignWare) to query if ECRC policy is enabled and perform any configuration required in those respective sub-systems. Signed-off-by: Vidya Sagar --- V2: * None from V1 drivers/pci/pci.h | 2 ++ drivers/pci/pcie/aer.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index fa12f7cbc1a0..325fdbf91dde 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -575,9 +575,11 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { } #ifdef CONFIG_PCIE_ECRC void pcie_set_ecrc_checking(struct pci_dev *dev); void pcie_ecrc_get_policy(char *str); +bool pcie_is_ecrc_enabled(void); #else static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { } static inline void pcie_ecrc_get_policy(char *str) { } +static inline bool pcie_is_ecrc_enabled(void) { return false; } #endif #ifdef CONFIG_PCIE_PTM diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 65dff5f3457a..24363c895aba 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -207,6 +207,17 @@ void pcie_ecrc_get_policy(char *str) ecrc_policy = i; } + +/** + * pcie_is_ecrc_enabled - returns if ECRC is enabled in the system or not + * + * Returns 1 if ECRC policy is enabled and 0 otherwise + */ +bool pcie_is_ecrc_enabled(void) +{ + return ecrc_policy == ECRC_POLICY_ON; +} +EXPORT_SYMBOL(pcie_is_ecrc_enabled); #endif /* CONFIG_PCIE_ECRC */ #define PCI_EXP_AER_FLAGS (PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | \ -- 2.17.1