Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1935103rdb; Tue, 3 Oct 2023 05:53:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSBKramLn0VwBo3JkArVVrcm4QBBG3i9AFYV7iBGHLfs0Mz3jLhM8d85wYKXCqCOvPsO3s X-Received: by 2002:a05:6870:295:b0:1b0:89e0:114f with SMTP id q21-20020a056870029500b001b089e0114fmr13980928oaf.31.1696337617654; Tue, 03 Oct 2023 05:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696337617; cv=none; d=google.com; s=arc-20160816; b=HgMn+m77AHsTLflNEUrtnhnsz0zlm8cra445FMRYKQKlS1QwPM6v+Eije/DimRKg1O +P1OjfHoz3xQb0lXs4RMGDSzRrpeJqCDd38YJRmgQW5Y2DYJYqKelMwuB3ICEcC3Bl76 n2vPM7KzDCfgsi9WhqC5YJADnaDWO2xvHWnJNH/raI0Op1pVZBMRERvRB3GlwheHivPE KU7ysJKwV4g3sUMOH0Vt0qQSZ72vjh8sHFppDSZQCLRGmvBdFeAdnYs/fViSd34HHW7X hfezPPCtZRvQJ0MYyvEWxrIWJoH1BaubEjvQG1i5oce+A3HjCDe3kijhBC1VutqJQE3M 8sZw== 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=WD4aMEReG0QfqAHbigaIkY//IuTFs4PPW4uIlOTEJNU=; fh=40OfMyTgvQ/SDqiGjlZT1c0+70yJS9m8UhH5uZV2Ows=; b=GMFJsxyq0d9HCVHGuC/zt42qB1wQBBd//yREUbU03/YuMI/6Jm5veduoh9xOdTwIaP RZmEvRLwy3SsNEdeMNEISrfNJUq8nkxHelsZscnlKKhC/B3D2GlZFLIQ5CJ9Iy1DV4zn kpuxCqZlnK5BmsAD1N8Y0wtFrkIxC3XrXY6QlbaboS1t/aRqvzpyhll6DCr5tCpW5fJ0 VXBrbXotMpbVYFM93CDJgbGOR9HDlKOWveAKWiFWsO+tNUqT9tY2cm5iJCqHFvGNtHCp USahQd9CHrHryt8z1uNGIS+YKqLaWaJoUXdQi69wrhEH1YEvHKmXdS1Re44+XZhroQXv BcMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NZU5PvXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id n126-20020a632784000000b0057c24bae994si1361583pgn.355.2023.10.03.05.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 05:53:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NZU5PvXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 8C62D824E7A9; Tue, 3 Oct 2023 05:53:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232124AbjJCMxf (ORCPT + 99 others); Tue, 3 Oct 2023 08:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbjJCMxd (ORCPT ); Tue, 3 Oct 2023 08:53:33 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A675BF; Tue, 3 Oct 2023 05:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696337611; x=1727873611; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ColEi8Bgy84f92KFXrjvKWg7/PjGY+5N1fWbadVJ1hM=; b=NZU5PvXIqaUSGd5JFftfypJjvWLxU8ykj9ufeWIirf+zh/FRbPpPiopF 9QwLXEKwZAxKpJ2pyfiOnUK5BlLAhYKaSFdgn1ShZaIBSWU5u51bKNOcu C+xQW4Xv7cRH5SWCElgrMe+OpQDaNF7w1h0RB0cOwpewFfP1VK8Mquoed zxMgwIZBkhu/CMN4r0myEA2z2GiokcP5xtLUlQ+bW1UpE23SP9+triAaQ Ke0m7EG1SFZR3hS5L6mQRK0C4QgdSXogwdLB2QxQmYA2bf0HzwRuaKJfv IOtrI110Ecq8YBtdrX1M8e7P7/i9gyHMCuZnFJcvl4qAnJHvSQ4d0qU4k g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="447022379" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="447022379" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 05:53:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="998006040" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="998006040" Received: from bmihaile-mobl1.ger.corp.intel.com (HELO localhost) ([10.251.222.64]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 05:53:22 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , bcm-kernel-feedback-list@broadcom.com, jonathan.derrick@linux.dev, kw@linux.com, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org, lpieralisi@kernel.org, marek.vasut+renesas@gmail.com, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, m.karthikeyan@mobiveil.co.in, nirmal.patel@linux.intel.com, rjui@broadcom.com, robh@kernel.org, roy.zang@nxp.com, sbranden@broadcom.com, yoshihiro.shimoda.uh@renesas.com, Zhiqiang.Hou@nxp.com, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 1/3] PCI: vmd: Correct PCI Header Type Register's MFD bit check Date: Tue, 3 Oct 2023 15:52:58 +0300 Message-Id: <20231003125300.5541-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231003125300.5541-1-ilpo.jarvinen@linux.intel.com> References: <20231003125300.5541-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 05:53:36 -0700 (PDT) vmd_domain_reset() attempts to find whether the device may contain multiple functions by checking 0x80 (Multi-Function Device), however, the hdr_type variable has already been masked with PCI_HEADER_TYPE_MASK so the check can never true. To fix the issue, don't mask the read with PCI_HEADER_TYPE_MASK. Fixes: 6aab5622296b ("PCI: vmd: Clean up domain before enumeration") Signed-off-by: Ilpo Järvinen Cc: Nirmal Patel --- drivers/pci/controller/vmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index e718a816d481..d5b97a6aae56 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -525,8 +525,7 @@ static void vmd_domain_reset(struct vmd_dev *vmd) base = vmd->cfgbar + PCIE_ECAM_OFFSET(bus, PCI_DEVFN(dev, 0), 0); - hdr_type = readb(base + PCI_HEADER_TYPE) & - PCI_HEADER_TYPE_MASK; + hdr_type = readb(base + PCI_HEADER_TYPE); functions = (hdr_type & 0x80) ? 8 : 1; for (fn = 0; fn < functions; fn++) { -- 2.30.2