stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org, pali@kernel.org,
	"Marek Behún" <kabel@kernel.org>
Subject: [PATCH 5.15 01/30] PCI: pci-bridge-emul: Add description for class_revision field
Date: Wed,  4 May 2022 18:57:26 +0200	[thread overview]
Message-ID: <20220504165755.30002-2-kabel@kernel.org> (raw)
In-Reply-To: <20220504165755.30002-1-kabel@kernel.org>

From: Pali Rohár <pali@kernel.org>

commit 9319230ac147067652b58fe849ffe0ceec098665 upstream.

The current assignment to the class_revision member

  class_revision |= cpu_to_le32(PCI_CLASS_BRIDGE_PCI << 16);

can make the reader think that class is at high 16 bits of the member and
revision at low 16 bits.

In reality, class is at high 24 bits, but the class for PCI Bridge Normal
Decode is PCI_CLASS_BRIDGE_PCI << 8.

Change the assignment and add a comment to make this clearer.

Link: https://lore.kernel.org/r/20211130172913.9727-2-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/pci/pci-bridge-emul.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c
index 37504c2cce9b..0a4e71301537 100644
--- a/drivers/pci/pci-bridge-emul.c
+++ b/drivers/pci/pci-bridge-emul.c
@@ -284,7 +284,11 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge,
 {
 	BUILD_BUG_ON(sizeof(bridge->conf) != PCI_BRIDGE_CONF_END);
 
-	bridge->conf.class_revision |= cpu_to_le32(PCI_CLASS_BRIDGE_PCI << 16);
+	/*
+	 * class_revision: Class is high 24 bits and revision is low 8 bit of this member,
+	 * while class for PCI Bridge Normal Decode has the 24-bit value: PCI_CLASS_BRIDGE_PCI << 8
+	 */
+	bridge->conf.class_revision |= cpu_to_le32((PCI_CLASS_BRIDGE_PCI << 8) << 8);
 	bridge->conf.header_type = PCI_HEADER_TYPE_BRIDGE;
 	bridge->conf.cache_line_size = 0x10;
 	bridge->conf.status = cpu_to_le16(PCI_STATUS_CAP_LIST);
-- 
2.35.1


  reply	other threads:[~2022-05-04 17:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 16:57 [PATCH 5.15 00/30] PCIe Aardvark controller backports for 5.15 Marek Behún
2022-05-04 16:57 ` Marek Behún [this message]
2022-05-04 16:57 ` [PATCH 5.15 02/30] PCI: pci-bridge-emul: Add definitions for missing capabilities registers Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 03/30] PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2 registers on emulated bridge Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 04/30] PCI: aardvark: Clear all MSIs at setup Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 05/30] PCI: aardvark: Comment actions in driver remove method Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 06/30] PCI: aardvark: Disable bus mastering when unbinding driver Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 07/30] PCI: aardvark: Mask all interrupts " Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 08/30] PCI: aardvark: Fix memory leak in driver unbind Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 09/30] PCI: aardvark: Assert PERST# when unbinding driver Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 10/30] PCI: aardvark: Disable link training " Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 11/30] PCI: aardvark: Disable common PHY " Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 12/30] PCI: aardvark: Replace custom PCIE_CORE_INT_* macros with PCI_INTERRUPT_* Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 13/30] PCI: aardvark: Rewrite IRQ code to chained IRQ handler Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 14/30] PCI: aardvark: Check return value of generic_handle_domain_irq() when processing INTx IRQ Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 15/30] PCI: aardvark: Make MSI irq_chip structures static driver structures Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 16/30] PCI: aardvark: Make msi_domain_info structure a static driver structure Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 17/30] PCI: aardvark: Use dev_fwnode() instead of of_node_to_fwnode(dev->of_node) Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 18/30] PCI: aardvark: Refactor unmasking summary MSI interrupt Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 19/30] PCI: aardvark: Add support for masking MSI interrupts Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 20/30] PCI: aardvark: Fix setting MSI address Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 21/30] PCI: aardvark: Enable MSI-X support Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 22/30] PCI: aardvark: Add support for ERR interrupt on emulated bridge Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 23/30] PCI: aardvark: Optimize writing PCI_EXP_RTCTL_PMEIE and PCI_EXP_RTSTA_PME " Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 24/30] PCI: aardvark: Add support for PME interrupts Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 25/30] PCI: aardvark: Fix support for PME requester on emulated bridge Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 26/30] PCI: aardvark: Use separate INTA interrupt for emulated root bridge Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 27/30] PCI: aardvark: Remove irq_mask_ack() callback for INTx interrupts Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 28/30] PCI: aardvark: Don't mask irq when mapping Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 29/30] PCI: aardvark: Drop __maybe_unused from advk_pcie_disable_phy() Marek Behún
2022-05-04 16:57 ` [PATCH 5.15 30/30] PCI: aardvark: Update comment about link going down after link-up Marek Behún
2022-05-10 12:06 ` [PATCH 5.15 00/30] PCIe Aardvark controller backports for 5.15 Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220504165755.30002-2-kabel@kernel.org \
    --to=kabel@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=pali@kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).