From patchwork Thu Oct 10 10:32:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 13829905 X-Patchwork-Delegate: bhelgaas@google.com Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 7FA971C231C; Thu, 10 Oct 2024 10:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.16 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728556345; cv=fail; b=BetDVpN1rp8WVd1uSNwcjw4kk4P+VqhJv56IKiW4SAcSK78ijrrwrh3C8ER4z4pM0GjDtmEa4Ft6kphQrIbkqaqjumZgDPPpaVfSGqblKg6eH3DNGXTcQRNAyTKs4mwVST2w86TtWtpdgkmcIYK7OJBVCzEgLprfKE+B3kfxBQI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728556345; c=relaxed/simple; bh=EnFCLTRhaSlbiiAj9WkS562z1cdHDnijHo6AeVHAiTw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=FDXtQ6bJSrJVTCpQvBjyxmrtEzwXPrbi6cIFNUdmMTiW27L9wTCAeyg2GBNYNZuBCedoE14D+x3ZOM9HcnYo4VPFQuNJYODXlXGPf2XyQ8T1iBTgF6UJW3yYdnuhKM1XON7EsSEfzzU24fl/4aThiQNsc6dssj78HNNZP3ei9Yo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Im//7s9Y; arc=fail smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Im//7s9Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728556343; x=1760092343; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=EnFCLTRhaSlbiiAj9WkS562z1cdHDnijHo6AeVHAiTw=; b=Im//7s9Y4ke/0xxJNt9tvAYSus2CRWoOGMNS7qTFXEFIiwmKJRb7h4pd WKtVE5XMNt4iuIsO0aS+pmK/bP2Z4eRbtjft/rJKODxAkNraCK7p450hZ kcxp+dc6Ajcp7qBnvVOd461UIzIYdcaYrb1m6Q/JWebpNOFSr6MlJFQ5W OeW3gLPBnSWQLtJE8SEGTcxYU+8ChznNmn8TtsFHyPmEkA0Ty4fO218lM X+MTzfA99DUIZJoD2L5kbiTArb3XqW1n6IDmDF+H2EbUoeCbYqJbn1V+K YyXxGtwsbkx5b8YSF6THBf3IdFCYLh6FrBZmf9LoiRCsjZ1tWPF8/DOC9 A==; X-CSE-ConnectionGUID: knA46fi0Rj+ZE6NqK7PI6A== X-CSE-MsgGUID: 4HvojHgZQ6GSVmbzJdcjlA== X-IronPort-AV: E=McAfee;i="6700,10204,11220"; a="15528434" X-IronPort-AV: E=Sophos;i="6.11,192,1725346800"; d="scan'208";a="15528434" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2024 03:32:22 -0700 X-CSE-ConnectionGUID: GzonanFNRG+dmbLgm142ZQ== X-CSE-MsgGUID: cWaq87CCR16gnhX8GEWmfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,192,1725346800"; d="scan'208";a="76464938" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa010.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Oct 2024 03:32:22 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 10 Oct 2024 03:32:21 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 10 Oct 2024 03:32:21 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 10 Oct 2024 03:32:21 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.43) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 10 Oct 2024 03:32:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PTkKE+CM+SPD7StpZ8YKVCYqf42P6fpETw3uH8utQZaEWqDNHzVVvr9rcqDx/lmymaYgD/BIwi3Uz3YfddCbkwcp2HckAqiFW2F9ikDfFfKe+vK0/bSXMFU9D8Gmcgnr57rkNAaeL7mE+GbviYMAVMwAdLznXKgEwy/hr7BegJn9MIXyCrG174sv+/00z1vp8jLJlO/7gxUNkcTa08MCB4iXKu29yGxOLRVfep+zlE843GGOjCgF6WLTpCg0p+8W4el6CznCp45bSfqBMZ9raaGDHpvUh6+GwpiK5gHTa8loL2dgYmu86KtCboKZTzOrZpCxguRJddJ4ypog8uOXiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WHNZiwbsESwo2PZik+oXAQ+zuQFZTsGm7BehrubSLZc=; b=pxC0cIks/3P+pal+/Xzmnqg3+ViuD8zkqT590ciNHXDDMndoII907CwX9MBisyY1/6E5PTwpxR61VilIaxEUglZaIBIPt1hKXRfYuLaxGhexaOsGYbi4GYocdp4OOYWEhoUiXhQ80lobeyGL7U3RPzEONU8dG/kuPfl9W0+kIUwWpaZxBNMNDdjHtqinsGq/4UFlS7InnP3gGj93ZhMb2HgfvprgdB+kiKHJPFmzkOwC/uNLB6iaBmCqm9eTB6DeukvcUqfkdl8lbGvNdtNOvKpdTVa/KgRAX3EQSotKtN+4HpD69/EO3FZ8NJtmjAFF2aQ9PUeD6yjp6s4UpCSAwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by MN6PR11MB8103.namprd11.prod.outlook.com (2603:10b6:208:473::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Thu, 10 Oct 2024 10:32:19 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::927a:9c08:26f7:5b39]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::927a:9c08:26f7:5b39%5]) with mapi id 15.20.8048.013; Thu, 10 Oct 2024 10:32:19 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: , , , , "Bjorn Helgaas" , =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , =?utf-8?q?Ilpo_J=C3=A4rvi?= =?utf-8?q?nen?= CC: Rodrigo Vivi , Michal Wajdeczko , Lucas De Marchi , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matt Roper , =?utf-8?q?Micha=C5=82_Winiarski?= Subject: [PATCH v3 2/5] PCI: Add a helper to identify IOV resources Date: Thu, 10 Oct 2024 12:32:00 +0200 Message-ID: <20241010103203.382898-3-michal.winiarski@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241010103203.382898-1-michal.winiarski@intel.com> References: <20241010103203.382898-1-michal.winiarski@intel.com> X-ClientProxiedBy: WA1P291CA0024.POLP291.PROD.OUTLOOK.COM (2603:10a6:1d0:19::18) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|MN6PR11MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 6031fa4b-da8e-48cd-dc63-08dce916d134 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yEsIlWCjLF0hlr1uU68hDv/ESA3KX0W?= =?utf-8?q?PZ2YPNnC5fOazABPW+EI8W7SUCBcynUf34BOC4k8eGaCbUGRED3qU4zco73+EmAeN?= =?utf-8?q?EIs3fZhCSgjacxlNOoQCzCmRfA8yACApDkpAZbnL8Nu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42aEMZooY?= =?utf-8?q?M3VKT4lCwWATAEyM6eVH3jPCZg1jqdTS8VZfxq1FzsulJBZH016w/qdMgsh0ygaV1?= =?utf-8?q?+Z8C8B02eA89iW52cs+Ec0VjsQcr5rdAxcCrQJBhgMJf2WUdGvTIpwiixj2eTZ2A5?= =?utf-8?q?4w+H26NtHkWylXi3gmeH+21X/zlr5ipVDTjiAA2ZW3YxP4oHMvfAUXE/Pl9YTgQyq?= =?utf-8?q?3z/+5a/TnqElN/ZcGEHYmESr1GqhP8FcNluQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5373.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7+mG90ySPLmBieRmx+lcbLkLUX1N?= =?utf-8?q?c7bivzHZKoAy5wDfDnIhUpGNdRikPX8koHvnTGxVPvUwOlK2fhR4fxHkJ0D6qK3jd?= =?utf-8?q?mwn7OmIO/kSSc6KD37Tj9J4qYL/jMDjJsKMmTOj+t61jmyzKD5vHpd8WCb0bTBi1J?= =?utf-8?q?yumdMkAvAJ9L++mZPlQrpiq1NmoZLDpAea/ro0Ft0x1FsFTqgs8u0k1dzdx4JEa8+?= =?utf-8?q?WypVQ5wngJ0sdRSxZj6h65JJ2mOnpulbAAWjJyfSriDPTa2xKBMPww/NaavbNX8Q3?= =?utf-8?q?6lFzXAJjWT8kbtncalI8VDdR1TPOHK4bwEwCNdC6yxAAYBokGF8rRaoOH72wOltO5?= =?utf-8?q?zqYfla8hzL9+/bVrKtC0o9HppFthM+Or0u0DHafuT1cHh3Q4xkDkoJ2mtzRj8gz/4?= =?utf-8?q?yWkT8V9oFVhZS1XSYPeiqOvuatVSPA9e31ULFq426nnhOnQEqkAC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q?yKQ3AfMMQi/Fag1L8TLoBmjFqErWEC/6oX9rkTSTCHaPJU/1mKSk/Zdz7idzSxiSD?= =?utf-8?q?c2jOjC9U0W4FM+yrk3T76SpB6lcx7tboWU5oZIpl75tUqN/xmFF/47eJlxjGpOaG/?= =?utf-8?q?pPhOdQY3at0N4IFv6CpeRYe+K63H2PHBGe/5qVUa4Mx5VFEEpV9BzVfl0LstfnlgR?= =?utf-8?q?cDM7D9ZXyD4ZagLBVZqmO8BEpdn41poFgA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6031fa4b-da8e-48cd-dc63-08dce916d134 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 10:32:18.9403 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a1CMItMzJCuZTf5+fWMsnu2+z76wkLe8L05/aM7wRue+n9U12dztUBQsFOrO2kEjpGv0Y4AHxxby6qc6Gw5MjE3b7/WU/e542s+8AYdEs3o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR11MB8103 X-OriginatorOrg: intel.com There are multiple places where special handling is required for IOV resources. Extract it to a helper and drop a few ifdefs. Signed-off-by: Michał Winiarski Reviewed-by: Ilpo Järvinen --- drivers/pci/pci.h | 18 ++++++++++++++---- drivers/pci/setup-bus.c | 5 +---- drivers/pci/setup-res.c | 4 +--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 14d00ce45bfa9..c55f2d7a4f37e 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -580,6 +580,10 @@ void pci_iov_update_resource(struct pci_dev *dev, int resno); resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno); void pci_restore_iov_state(struct pci_dev *dev); int pci_iov_bus_range(struct pci_bus *bus); +static inline bool pci_resource_is_iov(int resno) +{ + return resno >= PCI_IOV_RESOURCES && resno <= PCI_IOV_RESOURCE_END; +} extern const struct attribute_group sriov_pf_dev_attr_group; extern const struct attribute_group sriov_vf_dev_attr_group; #else @@ -589,12 +593,20 @@ static inline int pci_iov_init(struct pci_dev *dev) } static inline void pci_iov_release(struct pci_dev *dev) { } static inline void pci_iov_remove(struct pci_dev *dev) { } +static inline void pci_iov_update_resource(struct pci_dev *dev, int resno) { } +static inline resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno) +{ + return 0; +} static inline void pci_restore_iov_state(struct pci_dev *dev) { } static inline int pci_iov_bus_range(struct pci_bus *bus) { return 0; } - +static inline bool pci_resource_is_iov(int resno) +{ + return false; +} #endif /* CONFIG_PCI_IOV */ #ifdef CONFIG_PCIE_PTM @@ -616,12 +628,10 @@ unsigned long pci_cardbus_resource_alignment(struct resource *); static inline resource_size_t pci_resource_alignment(struct pci_dev *dev, struct resource *res) { -#ifdef CONFIG_PCI_IOV int resno = res - dev->resource; - if (resno >= PCI_IOV_RESOURCES && resno <= PCI_IOV_RESOURCE_END) + if (pci_resource_is_iov(resno)) return pci_sriov_resource_alignment(dev, resno); -#endif if (dev->class >> 8 == PCI_CLASS_BRIDGE_CARDBUS) return pci_cardbus_resource_alignment(res); return resource_alignment(res); diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 23082bc0ca37a..8909948bc9a9f 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1093,17 +1093,14 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, (r->flags & mask) != type3)) continue; r_size = resource_size(r); -#ifdef CONFIG_PCI_IOV /* Put SRIOV requested res to the optional list */ - if (realloc_head && i >= PCI_IOV_RESOURCES && - i <= PCI_IOV_RESOURCE_END) { + if (realloc_head && pci_resource_is_iov(i)) { add_align = max(pci_resource_alignment(dev, r), add_align); r->end = r->start - 1; add_to_list(realloc_head, dev, r, r_size, 0 /* Don't care */); children_add_size += r_size; continue; } -#endif /* * aligns[0] is for 1MB (since bridge memory * windows are always at least 1MB aligned), so diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index c6d933ddfd464..e2cf79253ebda 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -127,10 +127,8 @@ void pci_update_resource(struct pci_dev *dev, int resno) { if (resno <= PCI_ROM_RESOURCE) pci_std_update_resource(dev, resno); -#ifdef CONFIG_PCI_IOV - else if (resno >= PCI_IOV_RESOURCES && resno <= PCI_IOV_RESOURCE_END) + else if (pci_resource_is_iov(resno)) pci_iov_update_resource(dev, resno); -#endif } int pci_claim_resource(struct pci_dev *dev, int resource)