Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Zhiyuan Dai <daizhiyuan@phytium.com.cn>
Cc: bhelgaas@google.com, christian.koenig@amd.com,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2] PCI: Update Resizable BAR Capability Register fields
Date: Wed, 19 Feb 2025 12:34:24 -0600	[thread overview]
Message-ID: <20250219183424.GA226683@bhelgaas> (raw)
In-Reply-To: <20250219022712.276287-1-daizhiyuan@phytium.com.cn>

On Wed, Feb 19, 2025 at 10:27:12AM +0800, Zhiyuan Dai wrote:
> PCI Express Base Spec r6.0 defines BAR size up to 8 EB (2^63 bytes),
> but supporting anything bigger than 128TB requires changes to pci_rebar_get_possible_sizes()
> to read the additional Capability bits from the Control register.
> 
> Signed-off-by: Zhiyuan Dai <daizhiyuan@phytium.com.cn>
> ---
>  drivers/pci/pci.c             | 14 ++++++++++----
>  include/uapi/linux/pci_regs.h |  3 ++-
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 661f98c6c63a..8903deb2d891 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -3752,12 +3752,13 @@ static int pci_rebar_find_pos(struct pci_dev *pdev, int bar)
>   * @bar: BAR to query
>   *
>   * Get the possible sizes of a resizable BAR as bitmask defined in the spec
> - * (bit 0=1MB, bit 19=512GB). Returns 0 if BAR isn't resizable.
> + * (bit 0=1MB, bit 43=8EB). Returns 0 if BAR isn't resizable.
>   */
> -u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
> +u64 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)

Callers need to be updated so they're prepared for a u64 instead of a
u32.

If you don't actually need sizes bigger than 128TB right now, it's
fine to keep this as a u32, only add support up to 128TB, and leave
the >128TB support for later.

Bjorn

  reply	other threads:[~2025-02-19 18:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18  6:40 [PATCH] PCI: Update Resizable BAR Capability Register fields Zhiyuan Dai
2025-02-18 20:25 ` Bjorn Helgaas
2025-02-19  2:27   ` [PATCH v2] " Zhiyuan Dai
2025-02-19 18:34     ` Bjorn Helgaas [this message]
2025-02-20  1:25       ` [PATCH v3] " Zhiyuan Dai
2025-02-21  1:21         ` Krzysztof Wilczyński
2025-02-21 22:35         ` Bjorn Helgaas
2025-02-20  1:30       ` Zhiyuan Dai
2025-02-20  9:18         ` Christian König
2025-02-20 12:42         ` Niklas Cassel
2025-02-21  1:09           ` Zhiyuan Dai
2025-03-06 11:34             ` Ilpo Järvinen
2025-03-07  5:35               ` [PATCH v4] " Zhiyuan Dai
2025-03-07 17:32                 ` Bjorn Helgaas
2025-03-11  1:11                   ` Zhiyuan Dai

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=20250219183424.GA226683@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=daizhiyuan@phytium.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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