{"id":2230196,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2230196/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260429122617.7324-8-ilpo.jarvinen@linux.intel.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260429122617.7324-8-ilpo.jarvinen@linux.intel.com>","list_archive_url":null,"date":"2026-04-29T12:26:13","name":"[07/11] PCI: Make pci_sriov_resource_alignment() pci_dev const","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8a4ba7fa90b1791b8bf28a0c0c04a6f1f7c7ea00","submitter":{"id":83553,"url":"http://patchwork.ozlabs.org/api/1.2/people/83553/?format=json","name":"Ilpo Järvinen","email":"ilpo.jarvinen@linux.intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260429122617.7324-8-ilpo.jarvinen@linux.intel.com/mbox/","series":[{"id":502050,"url":"http://patchwork.ozlabs.org/api/1.2/series/502050/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=502050","date":"2026-04-29T12:26:06","name":"PCI: pci_resource_alignment() improvement + cleanups","version":1,"mbox":"http://patchwork.ozlabs.org/series/502050/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230196/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230196/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-53392-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=ZeZaYtzO;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53392-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"ZeZaYtzO\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=198.175.65.20","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.intel.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5Gp40vzcz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 22:29:32 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id D53F8307036B\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 12:27:51 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6115939D6FD;\n\tWed, 29 Apr 2026 12:27:51 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.20])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id CAC0939657D;\n\tWed, 29 Apr 2026 12:27:49 +0000 (UTC)","from fmviesa002.fm.intel.com ([10.60.135.142])\n  by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 29 Apr 2026 05:27:49 -0700","from ijarvine-mobl1.ger.corp.intel.com (HELO localhost)\n ([10.245.245.212])\n  by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 29 Apr 2026 05:27:46 -0700"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777465671; cv=none;\n b=aFdhxn0w3AQsc/5GR5DGB1gpETACeTsHR7AvyMAAMZCu8Xmc9bp2LURIvmimBImwF6yizZnwRp0TtWXsvIyVLrC7aDQUHWM1PJeLpE6XgMpdSHk1yP5VGTLS5zatR/jijPihOApkpiLl8FgG0uL2rXArlAtfLb4YZ/9Gpe9jCDo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777465671; c=relaxed/simple;\n\tbh=bA/bw4uk6IaI0FTLifNPnecs/kfGu2r52xBhz7Tz1C8=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=FrotLXVs2BFV9aczKt+e6bjbOzaFbiDZoHeIvF8criskv9/iHhumw5uuDlmrYnJa+1G6VbLe8/kGhUcuSCiqHVP4rw5mhUtGp1Uu2fr2r/VbM0ugfjbiiQDM04lGTLd0A6TJC117ow1U83DyIWN76cq8Hc+ReflpAXHHnfTme+Y=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n spf=pass smtp.mailfrom=linux.intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=ZeZaYtzO; arc=none smtp.client-ip=198.175.65.20","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1777465670; x=1809001670;\n  h=from:to:cc:subject:date:message-id:in-reply-to:\n   references:mime-version:content-transfer-encoding;\n  bh=bA/bw4uk6IaI0FTLifNPnecs/kfGu2r52xBhz7Tz1C8=;\n  b=ZeZaYtzOA0gpp9TTnfc9QyC89ZZLvM/3kOrc/oZOHD2kKQcW0/370ITo\n   tix9BcxSZJgyL2zVZgZhhS6DRBfHGvJur31L48wEimQS8hrJ6gYrH0lWm\n   bMZ/oQZxXFk23U1zBhaZnceDPFIiwFdFa5dIoA6gVVycp6NCF+jqP5ku/\n   1tbH5GVmq1F1ra68xytzKR9gOKwKhKiioDh47tsHC2RzUbLug1kdGKioI\n   JKdgOWKh+GC7TKwpyu6gMZxB9urM1BLP+fAmY6QMk5tGZ2Pz7+OX0GFkr\n   Kb8kUh6FX1ZHA4S0wVbeT6PApRw9ZldeBd04KZOhmBEwjxp5OuM4IDeHr\n   g==;","X-CSE-ConnectionGUID":["a1z3ZFawSP+KFXI/seES4A==","BCDPRBVOSbePcbYVtec72A=="],"X-CSE-MsgGUID":["1z7G4ulOQxKK7uJGNKlFUg==","SJlZA8uUQp+C/qrp8OS4Pw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11770\"; a=\"78101842\"","E=Sophos;i=\"6.23,206,1770624000\";\n   d=\"scan'208\";a=\"78101842\"","E=Sophos;i=\"6.23,206,1770624000\";\n   d=\"scan'208\";a=\"257573672\""],"X-ExtLoop1":"1","From":"=?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>","To":"linux-pci@vger.kernel.org,\n\tBjorn Helgaas <bhelgaas@google.com>,\n\tShawn Jin <shawn.jin@asteralabs.com>,\n\tlinuxppc-dev@lists.ozlabs.org,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>,\n\tMichael Ellerman <mpe@ellerman.id.au>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\t\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\tlinux-kernel@vger.kernel.org","Cc":"=?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>","Subject":"[PATCH 07/11] PCI: Make pci_sriov_resource_alignment() pci_dev const","Date":"Wed, 29 Apr 2026 15:26:13 +0300","Message-Id":"<20260429122617.7324-8-ilpo.jarvinen@linux.intel.com>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20260429122617.7324-1-ilpo.jarvinen@linux.intel.com>","References":"<20260429122617.7324-1-ilpo.jarvinen@linux.intel.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit"},"content":"pci_sriov_resource_alignment() inputs struct pci_dev which it should not\nneed to alter to calculate alignment.\n\nMake pci_dev pci_sriov_resource_alignment() inputs const. It requires\nmaking pci_iov_resource_size() input const as well.\n\nSigned-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>\n---\n arch/powerpc/include/asm/machdep.h         | 2 +-\n arch/powerpc/kernel/pci-common.c           | 2 +-\n arch/powerpc/platforms/powernv/pci-sriov.c | 4 ++--\n arch/powerpc/platforms/powernv/pci.h       | 3 ++-\n arch/powerpc/platforms/pseries/setup.c     | 2 +-\n drivers/pci/iov.c                          | 7 ++++---\n drivers/pci/pci.h                          | 5 +++--\n include/linux/pci.h                        | 8 +++++---\n 8 files changed, 19 insertions(+), 14 deletions(-)","diff":"diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h\nindex 3298eec123a3..256f9309bf4f 100644\n--- a/arch/powerpc/include/asm/machdep.h\n+++ b/arch/powerpc/include/asm/machdep.h\n@@ -169,7 +169,7 @@ struct machdep_calls {\n \n #ifdef CONFIG_PCI_IOV\n \tvoid (*pcibios_fixup_sriov)(struct pci_dev *pdev);\n-\tresource_size_t (*pcibios_iov_resource_alignment)(struct pci_dev *, int resno);\n+\tresource_size_t (*pcibios_iov_resource_alignment)(const struct pci_dev *, int resno);\n \tint (*pcibios_sriov_enable)(struct pci_dev *pdev, u16 num_vfs);\n \tint (*pcibios_sriov_disable)(struct pci_dev *pdev);\n #endif /* CONFIG_PCI_IOV */\ndiff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c\nindex 8efe95a0c4ff..3c4ca90e2ab7 100644\n--- a/arch/powerpc/kernel/pci-common.c\n+++ b/arch/powerpc/kernel/pci-common.c\n@@ -254,7 +254,7 @@ resource_size_t pcibios_default_alignment(void)\n }\n \n #ifdef CONFIG_PCI_IOV\n-resource_size_t pcibios_iov_resource_alignment(struct pci_dev *pdev, int resno)\n+resource_size_t pcibios_iov_resource_alignment(const struct pci_dev *pdev, int resno)\n {\n \tif (ppc_md.pcibios_iov_resource_alignment)\n \t\treturn ppc_md.pcibios_iov_resource_alignment(pdev, resno);\ndiff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/powernv/pci-sriov.c\nindex 7105a573aec4..8652078801f2 100644\n--- a/arch/powerpc/platforms/powernv/pci-sriov.c\n+++ b/arch/powerpc/platforms/powernv/pci-sriov.c\n@@ -244,8 +244,8 @@ void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev)\n \t}\n }\n \n-resource_size_t pnv_pci_iov_resource_alignment(struct pci_dev *pdev,\n-\t\t\t\t\t\t      int resno)\n+resource_size_t pnv_pci_iov_resource_alignment(const struct pci_dev *pdev,\n+\t\t\t\t\t       int resno)\n {\n \tresource_size_t align = pci_iov_resource_size(pdev, resno);\n \tstruct pnv_phb *phb = pci_bus_to_pnvhb(pdev->bus);\ndiff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h\nindex 032b2081aedb..3ac718d471c2 100644\n--- a/arch/powerpc/platforms/powernv/pci.h\n+++ b/arch/powerpc/platforms/powernv/pci.h\n@@ -257,7 +257,8 @@ static inline struct pnv_iov_data *pnv_iov_get(const struct pci_dev *pdev)\n }\n \n void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev);\n-resource_size_t pnv_pci_iov_resource_alignment(struct pci_dev *pdev, int resno);\n+resource_size_t pnv_pci_iov_resource_alignment(const struct pci_dev *pdev,\n+\t\t\t\t\t       int resno);\n \n int pnv_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs);\n int pnv_pcibios_sriov_disable(struct pci_dev *pdev);\ndiff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c\nindex b670c6fdfcea..1223dc961242 100644\n--- a/arch/powerpc/platforms/pseries/setup.c\n+++ b/arch/powerpc/platforms/pseries/setup.c\n@@ -789,7 +789,7 @@ static void pseries_pci_fixup_iov_resources(struct pci_dev *pdev)\n \t\tpseries_disable_sriov_resources(pdev);\n }\n \n-static resource_size_t pseries_pci_iov_resource_alignment(struct pci_dev *pdev,\n+static resource_size_t pseries_pci_iov_resource_alignment(const struct pci_dev *pdev,\n \t\t\t\t\t\t\t  int resno)\n {\n \tconst __be32 *reg;\ndiff --git a/drivers/pci/iov.c b/drivers/pci/iov.c\nindex 91ac4e37ecb9..c86409835f73 100644\n--- a/drivers/pci/iov.c\n+++ b/drivers/pci/iov.c\n@@ -150,7 +150,7 @@ static void virtfn_remove_bus(struct pci_bus *physbus, struct pci_bus *virtbus)\n \t\tpci_remove_bus(virtbus);\n }\n \n-resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)\n+resource_size_t pci_iov_resource_size(const struct pci_dev *dev, int resno)\n {\n \tif (!dev->is_physfn)\n \t\treturn 0;\n@@ -1084,7 +1084,7 @@ void pci_iov_update_resource(struct pci_dev *dev, int resno)\n \t}\n }\n \n-resource_size_t __weak pcibios_iov_resource_alignment(struct pci_dev *dev,\n+resource_size_t __weak pcibios_iov_resource_alignment(const struct pci_dev *dev,\n \t\t\t\t\t\t      int resno)\n {\n \treturn pci_iov_resource_size(dev, resno);\n@@ -1100,7 +1100,8 @@ resource_size_t __weak pcibios_iov_resource_alignment(struct pci_dev *dev,\n  * the VF BAR size multiplied by the number of VFs.  The alignment\n  * is just the VF BAR size.\n  */\n-resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno)\n+resource_size_t pci_sriov_resource_alignment(const struct pci_dev *dev,\n+\t\t\t\t\t     int resno)\n {\n \treturn pcibios_iov_resource_alignment(dev, resno);\n }\ndiff --git a/drivers/pci/pci.h b/drivers/pci/pci.h\nindex 4fcf5a25ad9e..710803be3a79 100644\n--- a/drivers/pci/pci.h\n+++ b/drivers/pci/pci.h\n@@ -947,7 +947,8 @@ int pci_iov_init(struct pci_dev *dev);\n void pci_iov_release(struct pci_dev *dev);\n void pci_iov_remove(struct pci_dev *dev);\n void pci_iov_update_resource(struct pci_dev *dev, int resno);\n-resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno);\n+resource_size_t pci_sriov_resource_alignment(const struct pci_dev *dev,\n+\t\t\t\t\t     int resno);\n void pci_restore_iov_state(struct pci_dev *dev);\n int pci_iov_bus_range(struct pci_bus *bus);\n void pci_iov_resource_set_size(struct pci_dev *dev, int resno, int size);\n@@ -981,7 +982,7 @@ static inline int pci_iov_init(struct pci_dev *dev)\n static inline void pci_iov_release(struct pci_dev *dev) { }\n static inline void pci_iov_remove(struct pci_dev *dev) { }\n static inline void pci_iov_update_resource(struct pci_dev *dev, int resno) { }\n-static inline resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev,\n+static inline resource_size_t pci_sriov_resource_alignment(const struct pci_dev *dev,\n \t\t\t\t\t\t\t   int resno)\n {\n \treturn 0;\ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex 2c4454583c11..0ced3bbd08c0 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -2540,7 +2540,7 @@ int pci_vfs_assigned(struct pci_dev *dev);\n int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);\n int pci_sriov_get_totalvfs(struct pci_dev *dev);\n int pci_sriov_configure_simple(struct pci_dev *dev, int nr_virtfn);\n-resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);\n+resource_size_t pci_iov_resource_size(const struct pci_dev *dev, int resno);\n int pci_iov_vf_bar_set_size(struct pci_dev *dev, int resno, int size);\n u32 pci_iov_vf_bar_get_sizes(struct pci_dev *dev, int resno, int num_vfs);\n void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe);\n@@ -2548,7 +2548,8 @@ void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe);\n /* Arch may override these (weak) */\n int pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs);\n int pcibios_sriov_disable(struct pci_dev *pdev);\n-resource_size_t pcibios_iov_resource_alignment(struct pci_dev *dev, int resno);\n+resource_size_t pcibios_iov_resource_alignment(const struct pci_dev *dev,\n+\t\t\t\t\t       int resno);\n #else\n static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)\n {\n@@ -2593,7 +2594,8 @@ static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)\n static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)\n { return 0; }\n #define pci_sriov_configure_simple\tNULL\n-static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)\n+static inline resource_size_t pci_iov_resource_size(const struct pci_dev *dev,\n+\t\t\t\t\t\t    int resno)\n { return 0; }\n static inline int pci_iov_vf_bar_set_size(struct pci_dev *dev, int resno, int size)\n { return -ENODEV; }\n","prefixes":["07/11"]}