From nobody Sat Feb 14 05:42:00 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F08231A83; Thu, 16 May 2024 09:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715851988; cv=none; b=nqgbEmKAfBL07lnOiugPqNKYK7UXIMUjr8a6UxFfFXeylrEoodoiuZeHB9bZU1tvG+GqO0X1JRFVstGwsq4gtN1Yeg0Pe+bjvAmAwnSR7EykHYLxVUk6+0HppxrsrLyu7z6a6BZerXK72UQuYPbE44UF8VRTB1See6Yk1i91z7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715851988; c=relaxed/simple; bh=C+sgypmpkReKGmyko3Nfq67Es9ksH8VsgZ2bo7aqLj4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Elhm/dexCpwIkJj+wfznaezRzIYs1ugb1qF1+q5YGJEYdNIcvgRjsbMrJG7Os9JRwRFaJsGITKnBSlhhzJmW4A4QF3H4zN8oiZ31gqcxOhmJXcOomBR7ZsEo4vgT2nA3651QZiDQkkrRo12XYF3YjttYf0eCoKf9eDo4CT+7Xi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AJ9kfWQ1; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AJ9kfWQ1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715851987; x=1747387987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C+sgypmpkReKGmyko3Nfq67Es9ksH8VsgZ2bo7aqLj4=; b=AJ9kfWQ1zco1XhTxktb4pednijLIml5ySsTNRvVDUHZo4VjrTwmYmCPl JDVIEzkewDWlS9vDfDnQMrWRz4OaLd5fUhW4rRpB6n7iIHIEVZgeUn2Eb cr+1muT1bhbj4tk/UAt8rmcT1CmhkHniagMxbFj1f2WeKsaJ4TSLBeQR4 5SFvINOYV04poLIdt1Go0iAMJgPrjHplEoUptG2RSEB/SWbeZDCM2/FA5 6h78n8Yaab5aRiZvN88QpyClIJoBnw2fmUgwUJH7nnEAAQo7ok+7mM6v5 YU8n/JHbMKxVOvMdx6OMvAqBsXaDa4MxsXUyFW8VdWQ2/cCaFvUnMHn8y g==; X-CSE-ConnectionGUID: cwpxKzZmQJqAR14M1T0aMQ== X-CSE-MsgGUID: +siXCHx/QymACWOI8mA4Fg== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="12113866" X-IronPort-AV: E=Sophos;i="6.08,164,1712646000"; d="scan'208";a="12113866" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2024 02:33:07 -0700 X-CSE-ConnectionGUID: CednYF2HQ6K5G5Nzjgwu1Q== X-CSE-MsgGUID: XPhJU6naTYi3P3A8Xl0uXw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,164,1712646000"; d="scan'208";a="31491042" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.108]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2024 02:33:00 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , "Maciej W . Rozycki" , Jonathan Cameron , Lukas Wunner , Alexandru Gagniuc , Krishna chaitanya chundru , Srinivas Pandruvada , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Lezcano , Amit Kucheria , Zhang Rui , Christophe JAILLET , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v6 1/8] PCI: Protect Link Control 2 Register with RMW locking Date: Thu, 16 May 2024 12:32:15 +0300 Message-Id: <20240516093222.1684-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240516093222.1684-1-ilpo.jarvinen@linux.intel.com> References: <20240516093222.1684-1-ilpo.jarvinen@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=A4rvinen Reviewed-by: Lukas Wunner --- Documentation/PCI/pciebus-howto.rst | 14 +++++++++----- include/linux/pci.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Documentation/PCI/pciebus-howto.rst b/Documentation/PCI/pciebu= s-howto.rst index a0027e8fb0d0..cd7857dd37aa 100644 --- a/Documentation/PCI/pciebus-howto.rst +++ b/Documentation/PCI/pciebus-howto.rst @@ -217,8 +217,12 @@ capability structure except the PCI Express capability= structure, 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(). +a selected set of PCI Express Capability Registers: + +* Link Control Register +* Root Control Register +* 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 16493426a04f..93faaf08965e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1273,6 +1273,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); --=20 2.39.2