From patchwork Fri Sep 29 11:57:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 146806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp82510vqb; Fri, 29 Sep 2023 15:46:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7pY9hxJLnTnBeZ7B9Xzz4Xk34wyQl6Rojc6m/0W98Q3VhnUWXgfht2KH/OsDRcxdtFykK X-Received: by 2002:a05:6a20:734c:b0:140:f6c4:aa71 with SMTP id v12-20020a056a20734c00b00140f6c4aa71mr6276977pzc.8.1696027616778; Fri, 29 Sep 2023 15:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696027616; cv=none; d=google.com; s=arc-20160816; b=xR9/OTCe9le1+FY6PpU7lsBomDQLo1Kkk1KBnnyIQTzvVzcQRZUc0gPAgaoSlcSXnl yd0YSYYM0EoRqUNyT95YsrEKuf9zTWoQP9jLtfybkgb5q28nvX5MzFLhCzW1knHCvO5s fmIh15qbDTsSiG+xfw63J1Hq5JbBT62sBtvxiJTcO5WAWQqqlwHIS6UxAG8B/YUPFDKW wcm6Q1iPZpzpiJau5VKbCuc1NLOLcR1NVGL+bKlEKxE2JXXFZOqiioBc0YnZzBMBQ/xz rOQn3/vWLUA+bnGEFAL9aCo1jxKS9fgrEUoJruspDShljVOiF3HSXSIwW0dRCZ5nbjIP OyXA== 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=Tfvpicn8pL/jbOcTJ12N+j+1r+H8Fv9F9ia5tsPhlIY=; fh=Ukf6VIDSN7DNB/FF2XYy98DhTedS/HP3L/XKqlHoW0Q=; b=DtueRJ2WBxMySusw6fcfxIg1laxsQ5cuj2TxGg8w/2XiVnjhN20Srk68lq70r/4xcr FU78irJD+Cwf2ZvrXtyPDN24boAsX5yeJAINshODACm7VU7Bk88gTzcUcYThKXpKcQeZ 8vptCi1LdMDrLUyzDhMtGAge1zqZhcBYjSfXL2ggW6Su7FZsEykPj22HhFZ+rJULK12L q12boKH0XG7gBLJIBtpwvS8a9rXxFuCNIAzoM3jjc6RtthDeIWAwY9OEnqV5P6b8Hs3C lwv2gStLAYpR4V8yzLsAajFbHMZVNv25m3KNkwIIYFYxxeF7D1gCeCivkUbv33xXvGXu yeoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SeAWNw5+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id r136-20020a632b8e000000b00573f7b6999csi20667301pgr.440.2023.09.29.15.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 15:46:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SeAWNw5+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 48ED082ABA80; Fri, 29 Sep 2023 04:58:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233120AbjI2L54 (ORCPT + 20 others); Fri, 29 Sep 2023 07:57:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbjI2L5z (ORCPT ); Fri, 29 Sep 2023 07:57:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0171ECC0; Fri, 29 Sep 2023 04:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695988673; x=1727524673; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hHkykAT64KFeDdyczTYQ6xW3x+LfVkMtEWBZ1a9eYwk=; b=SeAWNw5+JpwyjyMMRUADm82ZBBoH2lA9EMGM/9NlRGC3CkW0pGsTHwxU WJcbtqUl/PTJfzXiOTMyhRzz+ElAsizJ3yWD+u/gVhY6GRVml3WFrzzQy oXOtAV4zXLKxXscmJlX3kbWlqqiaXVS/dMKWukppNBxEKYIWrQzUkpjpf u+NSxnl/VLFBUC87Eb2uRAGaA0qB/UVWlNx48ttCEOG8i07gObNZDeFMy xeATnAZpQkl9ogT9Wl8WSDJDOH8T/Yj9BZ+S+0aifd3GaAHIqpoC1dxMs SnwpSdR2coeBHF2tGjC7lB8NROsU2IqZUmkE/V40z9xVy409KchVw7ZUR Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="413185323" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="413185323" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:57:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="838581" Received: from valeks2x-mobl.ger.corp.intel.com (HELO localhost) ([10.252.53.242]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:57:46 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Lukas Wunner , Alexandru Gagniuc , Krishna chaitanya chundru , Srinivas Pandruvada , "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Bjorn Helgaas , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alex Deucher , Daniel Lezcano , Amit Kucheria , Zhang Rui , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v3 01/10] PCI: Protect Link Control 2 Register with RMW locking Date: Fri, 29 Sep 2023 14:57:14 +0300 Message-Id: <20230929115723.7864-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230929115723.7864-1-ilpo.jarvinen@linux.intel.com> References: <20230929115723.7864-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 04:58:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778413854008811698 X-GMAIL-MSGID: 1778413854008811698 PCIe Bandwidth Controller performs RMW accesses the Link Control 2 Register which can occur concurrently to other sources of Link Control 2 Register writes. Therefore, add Link Control 2 Register among the PCI Express Capability Registers that need RMW locking. Signed-off-by: Ilpo Järvinen Reviewed-by: Lukas Wunner --- Documentation/PCI/pciebus-howto.rst | 8 ++++---- include/linux/pci.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Documentation/PCI/pciebus-howto.rst b/Documentation/PCI/pciebus-howto.rst index a0027e8fb0d0..3ba322ca1ce1 100644 --- a/Documentation/PCI/pciebus-howto.rst +++ b/Documentation/PCI/pciebus-howto.rst @@ -218,7 +218,7 @@ that is shared between many drivers including the service drivers. RMW Capability accessors (pcie_capability_clear_and_set_word(), pcie_capability_set_word(), and pcie_capability_clear_word()) protect a selected set of PCI Express Capability Registers (Link Control -Register and Root Control Register). Any change to those registers -should be performed using RMW accessors to avoid problems due to -concurrent updates. For the up-to-date list of protected registers, -see pcie_capability_clear_and_set_word(). +Register, Root Control Register, and Link Control 2 Register). Any +change to those registers should be performed using RMW accessors to +avoid problems due to concurrent updates. For the up-to-date list of +protected registers, see pcie_capability_clear_and_set_word(). diff --git a/include/linux/pci.h b/include/linux/pci.h index 8c7c2c3c6c65..16db80f8b15c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1243,6 +1243,7 @@ static inline int pcie_capability_clear_and_set_word(struct pci_dev *dev, { switch (pos) { case PCI_EXP_LNKCTL: + case PCI_EXP_LNKCTL2: case PCI_EXP_RTCTL: return pcie_capability_clear_and_set_word_locked(dev, pos, clear, set);