From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Darren Salt <devspam@moreofthesa.me.uk>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/7] pci: export PCI BAR size-reading functions
Date: Fri, 11 Dec 2020 10:07:48 +0100 [thread overview]
Message-ID: <a4bae8bb-dc56-7e43-b0f8-4545ec909e87@gmail.com> (raw)
In-Reply-To: <20201211005506.4554-2-devspam@moreofthesa.me.uk>
Am 11.12.20 um 01:55 schrieb Darren Salt:
> This is to assist driver modules which do BAR resizing.
>
> Signed-off-by: Darren Salt <devspam@moreofthesa.me.uk>
> ---
> drivers/pci/pci.c | 2 ++
> drivers/pci/pci.h | 2 --
> include/linux/pci.h | 4 ++++
> 3 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index e578d34095e9..3f6042d9ad83 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -3579,6 +3579,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
> pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap);
> return (cap & PCI_REBAR_CAP_SIZES) >> 4;
> }
> +EXPORT_SYMBOL(pci_rebar_get_possible_sizes);
>
> /**
> * pci_rebar_get_current_size - get the current size of a BAR
> @@ -3600,6 +3601,7 @@ int pci_rebar_get_current_size(struct pci_dev *pdev, int bar)
> pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl);
> return (ctrl & PCI_REBAR_CTRL_BAR_SIZE) >> PCI_REBAR_CTRL_BAR_SHIFT;
> }
> +EXPORT_SYMBOL(pci_rebar_get_current_size);
This is unnecessary. You can just look at the resource size instead
which is also more defensive regarding problems/errors.
Christian.
>
> /**
> * pci_rebar_set_size - set a new size for a BAR
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index f86cae9aa1f4..8373d94414e9 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -608,8 +608,6 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
> struct resource *res);
> #endif
>
> -u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar);
> -int pci_rebar_get_current_size(struct pci_dev *pdev, int bar);
> int pci_rebar_set_size(struct pci_dev *pdev, int bar, int size);
> static inline u64 pci_rebar_size_to_bytes(int size)
> {
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 22207a79762c..5aa035622741 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1226,7 +1226,11 @@ void pci_update_resource(struct pci_dev *dev, int resno);
> int __must_check pci_assign_resource(struct pci_dev *dev, int i);
> int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
> void pci_release_resource(struct pci_dev *dev, int resno);
> +
> +u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar);
> +int pci_rebar_get_current_size(struct pci_dev *pdev, int bar);
> int __must_check pci_resize_resource(struct pci_dev *dev, int i, int size);
> +
> int pci_select_bars(struct pci_dev *dev, unsigned long flags);
> bool pci_device_is_present(struct pci_dev *pdev);
> void pci_ignore_hotplug(struct pci_dev *dev);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-12-11 9:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 0:54 [PATCH 0/7] amdgpu, pci: improved BAR resizing support Darren Salt
2020-12-11 0:55 ` [PATCH 1/7] pci: export PCI BAR size-reading functions Darren Salt
2020-12-11 9:07 ` Christian König [this message]
2020-12-11 0:55 ` [PATCH 2/7] pci: add BAR bytes->size helper & expose size->bytes helper Darren Salt
2020-12-11 0:55 ` [PATCH 3/7] amdgpu: resize BAR0 to the maximum available size, even if it doesn't cover VRAM (v2) Darren Salt
2020-12-11 16:42 ` Christian König
2020-12-11 17:31 ` Darren Salt
2020-12-11 19:06 ` Alex Deucher
2020-12-14 8:12 ` Christian König
2020-12-14 15:46 ` Darren Salt
2020-12-14 20:44 ` Christian König
2020-12-11 0:55 ` [PATCH 4/7] amdgpu: module option controlling whether BAR0 resizing is done Darren Salt
2020-12-11 9:09 ` Christian König
2020-12-11 0:55 ` [PATCH 5/7] amdgpu: limit maximum FB BAR size when attempting to enlarge Darren Salt
2020-12-11 0:55 ` [PATCH 6/7] pci: allow for overriding the list of advertised BAR sizes Darren Salt
2020-12-11 0:55 ` [PATCH 7/7] amdgpu: allow overriding of the GPU's list of supported " Darren Salt
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=a4bae8bb-dc56-7e43-b0f8-4545ec909e87@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=devspam@moreofthesa.me.uk \
/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