From: Bjorn Helgaas <helgaas@kernel.org>
To: "Michał Winiarski" <michal.winiarski@intel.com>
Cc: linux-pci@vger.kernel.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Christian König" <christian.koenig@amd.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Michal Wajdeczko" <michal.wajdeczko@intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Matt Roper" <matthew.d.roper@intel.com>
Subject: Re: [PATCH v4 6/7] PCI: Allow drivers to control VF BAR size
Date: Mon, 28 Oct 2024 11:50:31 -0500 [thread overview]
Message-ID: <20241028165031.GA1106195@bhelgaas> (raw)
In-Reply-To: <20241025215038.3125626-7-michal.winiarski@intel.com>
On Fri, Oct 25, 2024 at 11:50:37PM +0200, Michał Winiarski wrote:
> Drivers could leverage the fact that the VF BAR MMIO reservation is
> created for total number of VFs supported by the device by resizing the
> BAR to larger size when smaller number of VFs is enabled.
>
> Add a pci_iov_vf_bar_set_size() function to control the size and a
> pci_iov_vf_bar_get_sizes() helper to get the VF BAR sizes that will
> allow up to num_vfs to be successfully enabled with the current
> underlying reservation size.
> ...
> + * pci_iov_vf_bar_get_sizes - get VF BAR sizes that allow to create up to num_vfs
> + * @dev: the PCI device
> + * @resno: the resource number
> + * @num_vfs: number of VFs
> + *
> + * Get the sizes of a VF resizable BAR that can fit up to num_vfs within the
> + * resource that reserves the MMIO space (originally up to total_VFs) the as
> + * bitmask defined in the spec (bit 0=1MB, bit 19=512GB).
This sentence doesn't quite parse; something is missing around "the as".
I'm guessing you mean to say something about the return value being a
bitmask of VF BAR sizes that can be accommodated if num_vfs are
enabled? If so, maybe combine it with the following paragraph:
> + * Returns 0 if BAR isn't resizable.
> + *
> + */
> +u32 pci_iov_vf_bar_get_sizes(struct pci_dev *dev, int resno, int num_vfs)
> +{
> + resource_size_t size;
> + u32 sizes;
> + int i;
> +
> + sizes = pci_rebar_get_possible_sizes(dev, resno);
> + if (!sizes)
> + return 0;
> +
> + while (sizes > 0) {
> + i = __fls(sizes);
> + size = pci_rebar_size_to_bytes(i);
> +
> + if (size * num_vfs <= pci_resource_len(dev, resno))
> + break;
> +
> + sizes &= ~BIT(i);
> + }
> +
> + return sizes;
> +}
> +EXPORT_SYMBOL_GPL(pci_iov_vf_bar_get_sizes);
next prev parent reply other threads:[~2024-10-28 16:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 21:50 [PATCH v4 0/7] PCI: VF resizable BAR Michał Winiarski
2024-10-25 21:50 ` [PATCH v4 1/7] PCI/IOV: Restore VF resizable BAR state after reset Michał Winiarski
2024-10-29 13:01 ` Christian König
2024-10-25 21:50 ` [PATCH v4 2/7] PCI: Add a helper to identify IOV resources Michał Winiarski
2024-10-29 13:18 ` Christian König
2024-10-25 21:50 ` [PATCH v4 3/7] PCI: Add a helper to convert between standard and " Michał Winiarski
2024-10-29 13:20 ` Christian König
2024-11-06 14:22 ` Ilpo Järvinen
2024-11-12 14:40 ` Michał Winiarski
2024-10-25 21:50 ` [PATCH v4 4/7] PCI: Allow IOV resources to be resized in pci_resize_resource() Michał Winiarski
2024-10-25 21:50 ` [PATCH v4 5/7] PCI/IOV: Check that VF BAR fits within the reservation Michał Winiarski
2024-10-28 11:20 ` Michał Winiarski
2024-10-28 16:56 ` Bjorn Helgaas
2024-10-30 11:43 ` Michał Winiarski
2024-10-30 16:55 ` Bjorn Helgaas
2024-11-12 14:31 ` Michał Winiarski
2024-10-25 21:50 ` [PATCH v4 6/7] PCI: Allow drivers to control VF BAR size Michał Winiarski
2024-10-28 16:50 ` Bjorn Helgaas [this message]
2024-11-12 14:55 ` Michał Winiarski
2024-10-25 21:50 ` [PATCH v4 7/7] drm/xe/pf: Set VF LMEM " Michał Winiarski
2024-10-25 23:16 ` ✓ CI.Patch_applied: success for PCI: VF resizable BAR (rev3) Patchwork
2024-10-25 23:16 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-25 23:17 ` ✓ CI.KUnit: success " Patchwork
2024-10-25 23:29 ` ✓ CI.Build: " Patchwork
2024-10-25 23:31 ` ✓ CI.Hooks: " Patchwork
2024-10-25 23:33 ` ✗ CI.checksparse: warning " Patchwork
2024-10-25 23:57 ` ✗ CI.BAT: failure " Patchwork
2024-10-27 15:13 ` ✗ CI.FULL: " Patchwork
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=20241028165031.GA1106195@bhelgaas \
--to=helgaas@kernel.org \
--cc=airlied@gmail.com \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.d.roper@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=michal.winiarski@intel.com \
--cc=mripard@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
/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