public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Zhiyuan Dai" <daizhiyuan@phytium.com.cn>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	bhelgaas@google.com
Cc: cassel@kernel.org, christian.koenig@amd.com, helgaas@kernel.org,
	 LKML <linux-kernel@vger.kernel.org>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v3] PCI: Update Resizable BAR Capability Register fields
Date: Thu, 6 Mar 2025 13:34:19 +0200 (EET)	[thread overview]
Message-ID: <3a6952a9-c80b-bbff-fb38-18c61722bdda@linux.intel.com> (raw)
In-Reply-To: <20250221010951.361570-1-daizhiyuan@phytium.com.cn>

[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]

On Fri, 21 Feb 2025, 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.
> 
> If 8EB support is required, callers will need to be updated to handle u64 
> instead of u32. For now, support is limited to 128TB, and support for 
> sizes greater than 128TB can be deferred to a later time.
> 
> Signed-off-by: Zhiyuan Dai <daizhiyuan@phytium.com.cn>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Niklas Cassel <cassel@kernel.org>
> ---
>  drivers/pci/pci.c             | 4 ++--
>  include/uapi/linux/pci_regs.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 661f98c6c63a..77b9ceefb4e1 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -3752,7 +3752,7 @@ 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 31=128TB). Returns 0 if BAR isn't resizable.
>   */
>  u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
>  {
> @@ -3800,7 +3800,7 @@ int pci_rebar_get_current_size(struct pci_dev *pdev, int bar)
>   * pci_rebar_set_size - set a new size for a BAR
>   * @pdev: PCI device
>   * @bar: BAR to set size to
> - * @size: new size as defined in the spec (0=1MB, 19=512GB)
> + * @size: new size as defined in the spec (0=1MB, 31=128TB)
>   *
>   * Set the new size of a BAR as defined in the spec.
>   * Returns zero if resizing was successful, error code otherwise.
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 1601c7ed5fab..ce99d4f34ce5 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -1013,7 +1013,7 @@
>  
>  /* Resizable BARs */
>  #define PCI_REBAR_CAP		4	/* capability register */
> -#define  PCI_REBAR_CAP_SIZES		0x00FFFFF0  /* supported BAR sizes */
> +#define  PCI_REBAR_CAP_SIZES		0xFFFFFFF0  /* supported BAR sizes */
>  #define PCI_REBAR_CTRL		8	/* control register */
>  #define  PCI_REBAR_CTRL_BAR_IDX		0x00000007  /* BAR index */
>  #define  PCI_REBAR_CTRL_NBAR_MASK	0x000000E0  /* # of resizable BARs */

pbus_size_mem() can only handle up to 8TB so its aligns array should be 
enlarged as well to support sizes up to 128TB.

-- 
 i.

  reply	other threads:[~2025-03-06 11: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
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 [this message]
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=3a6952a9-c80b-bbff-fb38-18c61722bdda@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=daizhiyuan@phytium.com.cn \
    --cc=helgaas@kernel.org \
    --cc=kw@linux.com \
    --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