From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: "Jens Axboe" <axboe@kernel.dk>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"David Heidelberg" <david@ixit.cz>,
"Peter Geis" <pgwipeout@gmail.com>,
"Stephen Warren" <swarren@wwwdotorg.org>,
"Nicolas Chauvet" <kwizart@gmail.com>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Billy Laws" <blaws05@gmail.com>,
"Nils Östlund" <nils@naltan.com>,
"Christoph Hellwig" <hch@infradead.org>,
"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
linux-tegra@vger.kernel.org, linux-block@vger.kernel.org,
"Andrey Danin" <danindrey@mail.ru>,
"Gilles Grandou" <gilles@grandou.net>,
"Ryan Grachek" <ryan@edited.us>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Steve McIntyre" <steve@einval.com>,
"Randy Dunlap" <rdunlap@infradead.org>,
linux-efi <linux-efi@vger.kernel.org>
Subject: Re: [PATCH v5 6/6] soc/tegra: Expose Boot Configuration Table via sysfs
Date: Mon, 18 May 2020 09:45:57 +0200 [thread overview]
Message-ID: <20200518074557.GA12306@qmqm.qmqm.pl> (raw)
In-Reply-To: <20200516153644.13748-7-digetx@gmail.com>
On Sat, May 16, 2020 at 06:36:44PM +0300, Dmitry Osipenko wrote:
> It's quite useful to have unencrypted BCT exposed to userspace for
> debugging purposes, so let's expose it via sysfs. The BCT data will be
> present in '/sys/tegra/boot_config_table' binary file if BCT is available.
[...]
> +/*
> + * spare_bct[] will be released once kernel is booted, hence not wasting
> + * kernel space if BCT is missing. The tegra_bct can't be allocated during
> + * of BCT setting up because it's too early for the slab allocator.
> + */
> +static u8 spare_bct[SZ_8K] __initdata;
> +static u8 *tegra_bct;
> +
> +static ssize_t boot_config_table_read(struct file *filp,
> + struct kobject *kobj,
> + struct bin_attribute *bin_attr,
> + char *buf, loff_t off, size_t count)
> +{
> + memcpy(buf, tegra_bct + off, count);
> + return count;
> +}
> +static BIN_ATTR_RO(boot_config_table, 0);
> +
> +static int __init tegra_bootdata_bct_sysfs_init(void)
> +{
> + if (!bin_attr_boot_config_table.size)
> + return 0;
> +
> + tegra_bct = kmalloc(GFP_KERNEL, bin_attr_boot_config_table.size);
> + if (!tegra_bct)
> + return -ENOMEM;
> +
> + memcpy(tegra_bct, spare_bct, bin_attr_boot_config_table.size);
> +
> + return sysfs_create_bin_file(tegra_soc_kobj,
> + &bin_attr_boot_config_table);
Should we consider freeing the table if sysfs registration fails?
> +}
> +late_initcall(tegra_bootdata_bct_sysfs_init)
> +
> +void __init tegra_bootdata_bct_setup(void __iomem *bct_ptr, size_t bct_size)
> +{
> + memcpy_fromio(spare_bct, bct_ptr, bct_size);
> + bin_attr_boot_config_table.size = bct_size;
[...]
The size isn't checked anywhere. How the maximum is obtained? At least
a comment would be good if the 8k limit is guaranteed by other means.
Best Regards,
Michał Mirosław
next prev parent reply other threads:[~2020-05-18 7:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-16 15:36 [PATCH v5 0/6] Introduce NVIDIA Tegra Partition Table Dmitry Osipenko
2020-05-16 15:36 ` [PATCH v5 1/6] mmc: core: Add raw_boot_mult field to mmc_ext_csd Dmitry Osipenko
2020-05-16 15:36 ` [PATCH v5 2/6] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko
2020-05-16 15:36 ` [PATCH v5 3/6] partitions: Introduce NVIDIA Tegra Partition Table Dmitry Osipenko
2020-05-16 15:36 ` [PATCH v5 4/6] partitions/efi: Support GPT entry lookup at a non-standard location Dmitry Osipenko
2020-05-16 15:51 ` Randy Dunlap
2020-05-16 16:50 ` Dmitry Osipenko
2020-05-16 16:58 ` Randy Dunlap
2020-05-17 0:11 ` Dmitry Osipenko
2020-05-17 2:07 ` Randy Dunlap
2020-05-16 15:36 ` [PATCH v5 5/6] partitions/tegra: Support enforced GPT scanning Dmitry Osipenko
2020-05-16 15:52 ` Randy Dunlap
2020-05-16 15:36 ` [PATCH v5 6/6] soc/tegra: Expose Boot Configuration Table via sysfs Dmitry Osipenko
2020-05-18 7:45 ` Michał Mirosław [this message]
2020-05-18 8:00 ` Dmitry Osipenko
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=20200518074557.GA12306@qmqm.qmqm.pl \
--to=mirq-linux@rere.qmqm.pl \
--cc=adrian.hunter@intel.com \
--cc=ard.biesheuvel@linaro.org \
--cc=axboe@kernel.dk \
--cc=blaws05@gmail.com \
--cc=danindrey@mail.ru \
--cc=dave@stgolabs.net \
--cc=david@ixit.cz \
--cc=digetx@gmail.com \
--cc=gilles@grandou.net \
--cc=hch@infradead.org \
--cc=jonathanh@nvidia.com \
--cc=kwizart@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=nils@naltan.com \
--cc=pgwipeout@gmail.com \
--cc=rdunlap@infradead.org \
--cc=ryan@edited.us \
--cc=steve@einval.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
--cc=ulf.hansson@linaro.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