From patchwork Tue Nov 30 13:25:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 12647301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16A74C433FE for ; Tue, 30 Nov 2021 13:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232336AbhK3N2x (ORCPT ); Tue, 30 Nov 2021 08:28:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60086 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232446AbhK3N2x (ORCPT ); Tue, 30 Nov 2021 08:28:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28978B817AF for ; Tue, 30 Nov 2021 13:25:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDDA5C53FD0; Tue, 30 Nov 2021 13:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638278731; bh=7dWtS7IabxxufChgE1lrOYtnRbIhcoqfnxK0McNkq24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vAV09VvlgCi4BmB785AnVmL78OyNnkcCbv5fASp2yOJfqoo1htW0GjYfe7prBsrNJ ohiLx4XYAuSnggHTXTZWrMJ7lZLNQVQ2g8+7l2MJSi4IXp6gpOaOo5gK3SlQDllur1 DqVL2OCOzEeY+bfny1AXNikSZWfYhnAWbrB0ARa9GzPErGv0nET0GlumofFav9gaHw Oq1t9a+ORF0xfzp8RWxzGc502VAdcCmGHzAMA0JRE8GkOuYJy87YQJXV+atuP/eTJg CrgzX031+kn0qdlKLrAxz3K8a0MA5fTVSTcvpoy5BqQ1h+35F1Dd4oAWluwVu//rg1 1AHLvCbhtL7vw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Lorenzo Pieralisi Cc: pali@kernel.org, linux-pci@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH v3 01/11] PCI: pci-bridge-emul: Add description for class_revision field Date: Tue, 30 Nov 2021 14:25:13 +0100 Message-Id: <20211130132523.28126-2-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211130132523.28126-1-kabel@kernel.org> References: <20211130132523.28126-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Pali Rohár 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. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- 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 db97cddfc85e..a4af1a533d71 100644 --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -265,7 +265,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);