From: Damien Le Moal <dlemoal@kernel.org>
To: "Niklas Cassel" <cassel@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jonathan Corbet" <corbet@lwn.net>
Cc: Frank.Li@nxp.com, Koichiro Den <den@valinux.co.jp>,
linux-pci@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v4] PCI: endpoint: pci-epf-test: Allow overriding default BAR sizes
Date: Fri, 30 Jan 2026 11:53:17 +0900 [thread overview]
Message-ID: <feabcb08-bbc1-4d99-8529-7f3a7a442fcf@kernel.org> (raw)
In-Reply-To: <20260129132324.2036310-2-cassel@kernel.org>
On 1/29/26 22:23, Niklas Cassel wrote:
> Add bar{0,1,2,3,4,5}_size attributes in configfs, so that the user is not
> restricted to run pci-epf-test with the hardcoded BAR size values defined
> in pci-epf-test.c.
>
> This code is shamelessly more or less copy pasted from pci-epf-vntb.c
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Tested-by: Koichiro Den <den@valinux.co.jp>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
Looks OK to me.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
One nit below.
> +#define PCI_EPF_TEST_BAR_SIZE_W(_name, _id) \
> +static ssize_t pci_epf_test_##_name##_store(struct config_item *item, \
> + const char *page, \
> + size_t len) \
> +{ \
> + struct config_group *group = to_config_group(item); \
> + struct pci_epf_test *epf_test = \
> + container_of(group, struct pci_epf_test, group); \
> + int val; \
> + int ret; \
You can use one line to declare both variables.
> + \
> + /* \
> + * BAR sizes can only be modified before binding to an EPC, \
> + * pci_epf_test_alloc_space() is called in .bind(). \
> + */ \
> + if (epf_test->epf->epc) \
> + return -EINVAL; \
> + \
> + ret = kstrtouint(page, 0, &val); \
> + if (ret) \
> + return ret; \
> + \
> + if (!is_power_of_2(val)) \
> + return -EINVAL; \
> + \
> + epf_test->bar_size[_id] = val; \
> + \
> + return len; \
> +}
--
Damien Le Moal
Western Digital Research
prev parent reply other threads:[~2026-01-30 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 13:23 [PATCH v4] PCI: endpoint: pci-epf-test: Allow overriding default BAR sizes Niklas Cassel
2026-01-29 14:29 ` Niklas Cassel
2026-01-30 2:53 ` Damien Le Moal [this message]
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=feabcb08-bbc1-4d99-8529-7f3a7a442fcf@kernel.org \
--to=dlemoal@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=corbet@lwn.net \
--cc=den@valinux.co.jp \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@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