* [PATCH v1 0/3] Support EFI partition on NVIDIA Tegra devices @ 2021-03-27 21:20 Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 1/3] mmc: core: Add raw_boot_mult field to mmc_ext_csd Dmitry Osipenko ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Dmitry Osipenko @ 2021-03-27 21:20 UTC (permalink / raw) To: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Davidlohr Bueso, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel Cc: linux-tegra, linux-block, linux-efi Hi, This series adds support for gpt_sector=<sector> kernel parameter used specifically by Android devices that are based on NVIDIA Tegra SoCs. This parameter is supplied by downstream bootloader, it tells the number of a sector where EFI entry is located on EMMC storage. A year ago we tried to upstream the support of gpt_sector and then the support of NVIDIA's proprietary partition table, which was suggested by Christoph Hellwig, but that effort didn't get enough attention. Now, a year later, we have more Tegra devices running mainline kernel and the situation hasn't changed, we still need to support the quirks needed for accessing internal EMMC storage of the Tegra devices. This time I'm trying to get back to variant with supporting the gpt_sector parameter, but in a way which doesn't disturb anything other than the EMMC of NVIDIA Tegra devices, which previously was suggested by Christoph Hellwig as well. Dmitry Osipenko (3): mmc: core: Add raw_boot_mult field to mmc_ext_csd mmc: block: Add mmc_bdev_to_card() helper partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices block/partitions/Kconfig | 8 +++ block/partitions/Makefile | 1 + block/partitions/check.h | 2 + block/partitions/core.c | 3 ++ block/partitions/efi.c | 18 +++++++ block/partitions/tegra.c | 108 +++++++++++++++++++++++++++++++++++++ drivers/mmc/core/block.c | 15 ++++++ drivers/mmc/core/mmc.c | 2 + include/linux/mmc/blkdev.h | 13 +++++ include/linux/mmc/card.h | 1 + 10 files changed, 171 insertions(+) create mode 100644 block/partitions/tegra.c create mode 100644 include/linux/mmc/blkdev.h -- 2.30.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v1 1/3] mmc: core: Add raw_boot_mult field to mmc_ext_csd 2021-03-27 21:20 [PATCH v1 0/3] Support EFI partition on NVIDIA Tegra devices Dmitry Osipenko @ 2021-03-27 21:20 ` Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko 2021-03-27 21:21 ` [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices Dmitry Osipenko 2 siblings, 0 replies; 14+ messages in thread From: Dmitry Osipenko @ 2021-03-27 21:20 UTC (permalink / raw) To: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Davidlohr Bueso, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel Cc: linux-tegra, linux-block, linux-efi Bootloader of NVIDIA Tegra devices linearizes the boot0/boot1/main partitions into a single virtual space, and thus, all partition addresses are shifted by the size of boot0 + boot1 partitions. The offset needs to be known in order to find the EFI entry on internal EMMC storage of Tegra devices. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- drivers/mmc/core/mmc.c | 2 ++ include/linux/mmc/card.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 8741271d3971..ed29f6076472 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -417,6 +417,8 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT]; card->ext_csd.raw_hc_erase_grp_size = ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]; + card->ext_csd.raw_boot_mult = + ext_csd[EXT_CSD_BOOT_MULT]; if (card->ext_csd.rev >= 3) { u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT]; card->ext_csd.part_config = ext_csd[EXT_CSD_PART_CONFIG]; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index f9ad35dd6012..720e2a1ac1cd 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -109,6 +109,7 @@ struct mmc_ext_csd { u8 raw_hc_erase_gap_size; /* 221 */ u8 raw_erase_timeout_mult; /* 223 */ u8 raw_hc_erase_grp_size; /* 224 */ + u8 raw_boot_mult; /* 226 */ u8 raw_sec_trim_mult; /* 229 */ u8 raw_sec_erase_mult; /* 230 */ u8 raw_sec_feature_support;/* 231 */ -- 2.30.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper 2021-03-27 21:20 [PATCH v1 0/3] Support EFI partition on NVIDIA Tegra devices Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 1/3] mmc: core: Add raw_boot_mult field to mmc_ext_csd Dmitry Osipenko @ 2021-03-27 21:20 ` Dmitry Osipenko 2021-03-27 21:21 ` [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices Dmitry Osipenko 2 siblings, 0 replies; 14+ messages in thread From: Dmitry Osipenko @ 2021-03-27 21:20 UTC (permalink / raw) To: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Davidlohr Bueso, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel Cc: linux-tegra, linux-block, linux-efi Add mmc_bdev_to_card() helper which is needed for finding EFI entry on EMMC of NVIDIA Tegra devices. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- drivers/mmc/core/block.c | 15 +++++++++++++++ include/linux/mmc/blkdev.h | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 include/linux/mmc/blkdev.h diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index fe5892d30778..666066fd6037 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -40,6 +40,7 @@ #include <linux/debugfs.h> #include <linux/mmc/ioctl.h> +#include <linux/mmc/blkdev.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h> #include <linux/mmc/mmc.h> @@ -306,6 +307,20 @@ static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr, return ret; } +struct mmc_card *mmc_bdev_to_card(struct block_device *bdev) +{ + struct mmc_blk_data *md; + + if (bdev->bd_disk->major != MMC_BLOCK_MAJOR) + return NULL; + + md = mmc_blk_get(bdev->bd_disk); + if (!md) + return NULL; + + return md->queue.card; +} + static int mmc_blk_open(struct block_device *bdev, fmode_t mode) { struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); diff --git a/include/linux/mmc/blkdev.h b/include/linux/mmc/blkdev.h new file mode 100644 index 000000000000..67608c58de70 --- /dev/null +++ b/include/linux/mmc/blkdev.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * linux/include/linux/mmc/blkdev.h + */ +#ifndef LINUX_MMC_BLOCK_DEVICE_H +#define LINUX_MMC_BLOCK_DEVICE_H + +struct block_device; +struct mmc_card; + +struct mmc_card *mmc_bdev_to_card(struct block_device *bdev); + +#endif /* LINUX_MMC_BLOCK_DEVICE_H */ -- 2.30.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices 2021-03-27 21:20 [PATCH v1 0/3] Support EFI partition on NVIDIA Tegra devices Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 1/3] mmc: core: Add raw_boot_mult field to mmc_ext_csd Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko @ 2021-03-27 21:21 ` Dmitry Osipenko 2021-03-29 6:18 ` Christoph Hellwig 2021-03-29 17:31 ` Davidlohr Bueso 2 siblings, 2 replies; 14+ messages in thread From: Dmitry Osipenko @ 2021-03-27 21:21 UTC (permalink / raw) To: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Davidlohr Bueso, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel Cc: linux-tegra, linux-block, linux-efi All NVIDIA Tegra20..124 Android devices use proprietary bootloader which supplies the gpt_sector=<sector> kernel cmdline parameter that should be used for looking up the EFI partition table on internal EMMC storage. If the kernel cmdline parameter isn't supplied, then the partition is expected to be placed around the last but one sector of EMMC. Apparently this was done in order to hide the PT from a usual userspace tools since EFI entry exists only for compatibility with a Linux kernel, while a custom proprietary partition table is what is really used by these Android devices, thus these tools may corrupt the real PT, making device unbootable and very difficult to restore. Add support for the gpt_sector cmdline parameter which will be used for finding EFI entry on internal EMMC storage of NVIDIA Tegra20+ devices. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- block/partitions/Kconfig | 8 +++ block/partitions/Makefile | 1 + block/partitions/check.h | 2 + block/partitions/core.c | 3 ++ block/partitions/efi.c | 18 +++++++ block/partitions/tegra.c | 108 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 140 insertions(+) create mode 100644 block/partitions/tegra.c diff --git a/block/partitions/Kconfig b/block/partitions/Kconfig index 6e2a649669e5..be086916c6a6 100644 --- a/block/partitions/Kconfig +++ b/block/partitions/Kconfig @@ -268,3 +268,11 @@ config CMDLINE_PARTITION help Say Y here if you want to read the partition table from bootargs. The format for the command line is just like mtdparts. + +config TEGRA_PARTITION + bool "NVIDIA Tegra Partition support" if PARTITION_ADVANCED + default y if ARCH_TEGRA + depends on EFI_PARTITION && MMC_BLOCK && (ARCH_TEGRA || COMPILE_TEST) + help + Say Y here if you would like to be able to read the hard disk + partition table format used by NVIDIA Tegra machines. diff --git a/block/partitions/Makefile b/block/partitions/Makefile index a7f05cdb02a8..83cb70c6d08d 100644 --- a/block/partitions/Makefile +++ b/block/partitions/Makefile @@ -20,3 +20,4 @@ obj-$(CONFIG_IBM_PARTITION) += ibm.o obj-$(CONFIG_EFI_PARTITION) += efi.o obj-$(CONFIG_KARMA_PARTITION) += karma.o obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o +obj-$(CONFIG_TEGRA_PARTITION) += tegra.o diff --git a/block/partitions/check.h b/block/partitions/check.h index c577e9ee67f0..5fcc85087465 100644 --- a/block/partitions/check.h +++ b/block/partitions/check.h @@ -22,6 +22,7 @@ struct parsed_partitions { int limit; bool access_beyond_eod; char *pp_buf; + sector_t force_gpt_sector; }; typedef struct { @@ -67,4 +68,5 @@ int osf_partition(struct parsed_partitions *state); int sgi_partition(struct parsed_partitions *state); int sun_partition(struct parsed_partitions *state); int sysv68_partition(struct parsed_partitions *state); +int tegra_partition_forced_gpt(struct parsed_partitions *state); int ultrix_partition(struct parsed_partitions *state); diff --git a/block/partitions/core.c b/block/partitions/core.c index 1a7558917c47..1a0247f3354c 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -82,6 +82,9 @@ static int (*check_part[])(struct parsed_partitions *) = { #endif #ifdef CONFIG_SYSV68_PARTITION sysv68_partition, +#endif +#ifdef CONFIG_TEGRA_PARTITION + tegra_partition_forced_gpt, #endif NULL }; diff --git a/block/partitions/efi.c b/block/partitions/efi.c index b64bfdd4326c..f016a7f11239 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c @@ -98,6 +98,15 @@ static int force_gpt; static int __init force_gpt_fn(char *str) { + /* + * This check allows to properly parse cmdline variants like + * "gpt gpt_sector=<sector>" and "gpt_sector=<sector> gpt" since + * "gpt" overlaps with the "gpt_sector=", see tegra_gpt_sector_fn(). + * The argument is absent for a boolean cmdline option. + */ + if (strlen(str)) + return 0; + force_gpt = 1; return 1; } @@ -621,6 +630,15 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt, if (!good_agpt && force_gpt) good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes); + /* + * The force_gpt_sector is used by NVIDIA Tegra partition parser in + * order to convey a non-standard location of the GPT entry for lookup. + * By default force_gpt_sector is set to 0 and has no effect. + */ + if (!good_agpt && force_gpt && state->force_gpt_sector) + good_agpt = is_gpt_valid(state, state->force_gpt_sector, + &agpt, &aptes); + /* The obviously unsuccessful case */ if (!good_pgpt && !good_agpt) goto fail; diff --git a/block/partitions/tegra.c b/block/partitions/tegra.c new file mode 100644 index 000000000000..585a2778ecc4 --- /dev/null +++ b/block/partitions/tegra.c @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: GPL-2.0 + +#define pr_fmt(fmt) "tegra-partition: " fmt + +#include <linux/blkdev.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/sizes.h> + +#include <linux/mmc/blkdev.h> +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> + +#include <soc/tegra/common.h> + +#include "check.h" + +#define TEGRA_PT_ERR(_state, fmt, ...) \ + pr_debug("%s: " fmt, \ + (_state)->bdev->bd_disk->disk_name, ##__VA_ARGS__) + +static const struct of_device_id tegra_sdhci_match[] = { + { .compatible = "nvidia,tegra20-sdhci", }, + { .compatible = "nvidia,tegra30-sdhci", }, + { .compatible = "nvidia,tegra114-sdhci", }, + { .compatible = "nvidia,tegra124-sdhci", }, + {} +}; + +static int +tegra_partition_table_emmc_boot_offset(struct parsed_partitions *state) +{ + struct mmc_card *card = mmc_bdev_to_card(state->bdev); + + /* filter out unrelated and untested boot sources */ + if (!card || card->ext_csd.rev < 3 || + !mmc_card_is_blockaddr(card) || + mmc_card_is_removable(card->host) || + bdev_logical_block_size(state->bdev) != SZ_512 || + !of_match_node(tegra_sdhci_match, card->host->parent->of_node)) { + TEGRA_PT_ERR(state, "unexpected boot source\n"); + return -1; + } + + /* + * eMMC storage has two special boot partitions in addition to the + * main one. NVIDIA's bootloader linearizes eMMC boot0->boot1->main + * accesses, this means that the partition table addresses are shifted + * by the size of boot partitions. In accordance with the eMMC + * specification, the boot partition size is calculated as follows: + * + * boot partition size = 128K byte x BOOT_SIZE_MULT + * + * This function returns number of sectors occupied by the both boot + * partitions. + */ + return card->ext_csd.raw_boot_mult * SZ_128K / + SZ_512 * MMC_NUM_BOOT_PARTITION; +} + +/* + * This allows a kernel command line option 'gpt_sector=<sector>' to + * enable GPT header lookup at a non-standard location. This option + * is provided to kernel by NVIDIA's proprietary bootloader. + */ +static sector_t tegra_gpt_sector; +static int __init tegra_gpt_sector_fn(char *str) +{ + WARN_ON(kstrtoull(str, 10, &tegra_gpt_sector) < 0); + return 1; +} +__setup("gpt_sector=", tegra_gpt_sector_fn); + +int tegra_partition_forced_gpt(struct parsed_partitions *state) +{ + int ret, boot_offset; + + if (!soc_is_tegra()) + return 0; + + boot_offset = tegra_partition_table_emmc_boot_offset(state); + if (boot_offset < 0) + return 0; + + if (tegra_gpt_sector) { + state->force_gpt_sector = tegra_gpt_sector; + } else { + /* + * Some Tegra devices do not use gpt_sector=<sector> kernel + * command line option. In this case these devices should + * have a GPT entry at the end of the block device and then + * the GPT entry address is calculated like this: + * + * gpt_sector = ext_csd.sectors_num - ext_csd.boot_sectors_num - 1 + * + * This algorithm is defined by NVIDIA and used on Android + * devices. + */ + state->force_gpt_sector = get_capacity(state->bdev->bd_disk); + state->force_gpt_sector -= boot_offset + 1; + } + + ret = efi_partition(state); + state->force_gpt_sector = 0; + + return ret; +} -- 2.30.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices 2021-03-27 21:21 ` [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices Dmitry Osipenko @ 2021-03-29 6:18 ` Christoph Hellwig 2021-03-29 13:07 ` Dmitry Osipenko 2021-03-29 17:31 ` Davidlohr Bueso 1 sibling, 1 reply; 14+ messages in thread From: Christoph Hellwig @ 2021-03-29 6:18 UTC (permalink / raw) To: Dmitry Osipenko Cc: Jens Axboe, Thierry Reding, Jonathan Hunter, Micha?? Miros??aw, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Davidlohr Bueso, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel, linux-tegra, linux-block, linux-efi On Sun, Mar 28, 2021 at 12:21:00AM +0300, Dmitry Osipenko wrote: > All NVIDIA Tegra20..124 Android devices use proprietary bootloader > which supplies the gpt_sector=<sector> kernel cmdline parameter that > should be used for looking up the EFI partition table on internal EMMC > storage. If the kernel cmdline parameter isn't supplied, then the > partition is expected to be placed around the last but one sector of EMMC. > > Apparently this was done in order to hide the PT from a usual userspace > tools since EFI entry exists only for compatibility with a Linux kernel, That's weird, because nothin in Linux relies in EFI partition tables. > while a custom proprietary partition table is what is really used by > these Android devices, thus these tools may corrupt the real PT, making > device unbootable and very difficult to restore. > > Add support for the gpt_sector cmdline parameter which will be used > for finding EFI entry on internal EMMC storage of NVIDIA Tegra20+ devices. Didn't we plan to just support the actual partition table format insted? ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices 2021-03-29 6:18 ` Christoph Hellwig @ 2021-03-29 13:07 ` Dmitry Osipenko 0 siblings, 0 replies; 14+ messages in thread From: Dmitry Osipenko @ 2021-03-29 13:07 UTC (permalink / raw) To: Christoph Hellwig Cc: Jens Axboe, Thierry Reding, Jonathan Hunter, Micha?? Miros??aw, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Ard Biesheuvel, Davidlohr Bueso, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel, linux-tegra, linux-block, linux-efi 29.03.2021 09:18, Christoph Hellwig пишет: > On Sun, Mar 28, 2021 at 12:21:00AM +0300, Dmitry Osipenko wrote: >> All NVIDIA Tegra20..124 Android devices use proprietary bootloader >> which supplies the gpt_sector=<sector> kernel cmdline parameter that >> should be used for looking up the EFI partition table on internal EMMC >> storage. If the kernel cmdline parameter isn't supplied, then the >> partition is expected to be placed around the last but one sector of EMMC. >> >> Apparently this was done in order to hide the PT from a usual userspace >> tools since EFI entry exists only for compatibility with a Linux kernel, > > That's weird, because nothin in Linux relies in EFI partition tables. > >> while a custom proprietary partition table is what is really used by >> these Android devices, thus these tools may corrupt the real PT, making >> device unbootable and very difficult to restore. >> >> Add support for the gpt_sector cmdline parameter which will be used >> for finding EFI entry on internal EMMC storage of NVIDIA Tegra20+ devices. > > Didn't we plan to just support the actual partition table format insted? > Ideally we need to support both forced-gpt and tegra-partition. At first we should check whether GPT entry exists and use it on success, otherwise fall back to tegra-partition. This will allow to properly support all kind of devices. The majority of devices have the GPT entry, so will be good to support it at least. My understanding that this all require involvement from Jens Axboe in order to get the patches merged. Previously he didn't show interest to any of the patches and my assumption was that he didn't want to have another partition, although I don't know for sure because he never answered. If you could help with reviewing and applying of the patches, then I will be happy to try again with re-sending a full patchset, which includes the tegra-partition support. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices 2021-03-27 21:21 ` [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices Dmitry Osipenko 2021-03-29 6:18 ` Christoph Hellwig @ 2021-03-29 17:31 ` Davidlohr Bueso 2021-03-29 18:38 ` Dmitry Osipenko 1 sibling, 1 reply; 14+ messages in thread From: Davidlohr Bueso @ 2021-03-29 17:31 UTC (permalink / raw) To: Dmitry Osipenko Cc: Jens Axboe, Thierry Reding, Jonathan Hunter, Micha?? Miros??aw, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel, linux-tegra, linux-block, linux-efi On Sun, 28 Mar 2021, Dmitry Osipenko wrote: >All NVIDIA Tegra20..124 Android devices use proprietary bootloader >which supplies the gpt_sector=<sector> kernel cmdline parameter that >should be used for looking up the EFI partition table on internal EMMC >storage. If the kernel cmdline parameter isn't supplied, then the >partition is expected to be placed around the last but one sector of EMMC. > >Apparently this was done in order to hide the PT from a usual userspace >tools since EFI entry exists only for compatibility with a Linux kernel, >while a custom proprietary partition table is what is really used by >these Android devices, thus these tools may corrupt the real PT, making >device unbootable and very difficult to restore. > >Add support for the gpt_sector cmdline parameter which will be used >for finding EFI entry on internal EMMC storage of NVIDIA Tegra20+ devices. Since this is proprietary and playing yucky games hiding the pt, why not just force for the fallback on Nvidia's side and always just use the entry at the end of the block device? I'm not loving introducing a generic parameter for an obscure ad-hoc feature. Thanks, Davidlohr ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices 2021-03-29 17:31 ` Davidlohr Bueso @ 2021-03-29 18:38 ` Dmitry Osipenko 0 siblings, 0 replies; 14+ messages in thread From: Dmitry Osipenko @ 2021-03-29 18:38 UTC (permalink / raw) To: Davidlohr Bueso Cc: Jens Axboe, Thierry Reding, Jonathan Hunter, Micha?? Miros??aw, David Heidelberg, Peter Geis, Ulf Hansson, Adrian Hunter, Christoph Hellwig, Ard Biesheuvel, Randy Dunlap, Ion Agorria, Svyatoslav Ryhel, linux-tegra, linux-block, linux-efi 29.03.2021 20:31, Davidlohr Bueso пишет: > On Sun, 28 Mar 2021, Dmitry Osipenko wrote: > >> All NVIDIA Tegra20..124 Android devices use proprietary bootloader >> which supplies the gpt_sector=<sector> kernel cmdline parameter that >> should be used for looking up the EFI partition table on internal EMMC >> storage. If the kernel cmdline parameter isn't supplied, then the >> partition is expected to be placed around the last but one sector of >> EMMC. >> >> Apparently this was done in order to hide the PT from a usual userspace >> tools since EFI entry exists only for compatibility with a Linux kernel, >> while a custom proprietary partition table is what is really used by >> these Android devices, thus these tools may corrupt the real PT, making >> device unbootable and very difficult to restore. >> >> Add support for the gpt_sector cmdline parameter which will be used >> for finding EFI entry on internal EMMC storage of NVIDIA Tegra20+ >> devices. > > Since this is proprietary and playing yucky games hiding the pt, why not > just force for the fallback on Nvidia's side and always just use the entry > at the end of the block device? I'm not loving introducing a generic > parameter for an obscure ad-hoc feature. I understand the reluctance to support the ad-hoc features, I wouldn't want to support this myself if I was in yours position. This all is necessary solely in order to provide a good user experience using mainline kernel on the consumer devices that have Tegra SoC inside. A more advanced users could bypass the secure boot restrictions and reformat the partition table as they wish, but this is very involved. The only reason I'm submitting these patches is to allow more people to have fun with their devices running mainline Linux without a need to bother with extra out-of-tree patches. There are total four possible variants of the PT that I'm aware about: 1. GPT entry exists at the proper "backup" location in the end of a block device. Unfortunately only Nexus 7 is known to have this. 2. GPT entry exists at the give sector offset using the gpt_sector=<> parameter. This offset may or may not match the offset that we can calculate based on EMMC boot offset. This case is common for the vast majority of devices. 3. GPT entry exists at the expected sector offset which is calculated based on EMMC boot offset. This is common for devices that use older versions of NVIDIA bootloader which doesn't provide the gpt_sector=<> parameter. 4. GPT entry doesn't exist at all and other means are used to convey the partition table info. This is rare, but happens for the oldest devices. Using a reversed-engineered tegra-partition format helps in this case. Technically we could use the reversed-engineered tegra-partition without caring about GPT at all, but this may result in a different number of a visible partitions to the system in comparison to the GPT entry because some of partitions may be hidden from the GPT, like partition where media keys are stored and etc. This could be confusing and quite inconvenient when /dev/mmcblk0p4 becomes /dev/mmcblk0p6, so it's more preferred to use the existing GPT entry. ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v1 0/3] Introduce NVIDIA Tegra Partition Table @ 2020-02-24 23:18 Dmitry Osipenko 2020-02-24 23:18 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko 0 siblings, 1 reply; 14+ messages in thread From: Dmitry Osipenko @ 2020-02-24 23:18 UTC (permalink / raw) To: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Stephen Warren, Nicolas Chauvet, Ulf Hansson, Adrian Hunter, Billy Laws Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-block-u79uwXL29TY76Z2rM5mHXA, Andrey Danin, Gilles Grandou, Ryan Grachek, linux-mmc-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Some NVIDIA Tegra devices have GPT entry at a wrong location and others may even not have it at all. So either a custom workaround for GPT parsing or TegraPT support is needed for those devices if we want to support them in upstream kernel. The former solution was already rejected [1], let's try the latter. [1] https://patchwork.ozlabs.org/patch/1240809/ Big thanks to everyone who helped with figuring out the TegraPT format! Dmitry Osipenko (3): mmc: core: Add raw_boot_mult field to mmc_ext_csd mmc: block: Add mmc_bdev_to_card() helper partitions: Introduce NVIDIA Tegra Partition Table arch/arm/mach-tegra/tegra.c | 35 +++ block/partitions/Kconfig | 8 + block/partitions/Makefile | 1 + block/partitions/check.c | 4 + block/partitions/tegra.c | 373 ++++++++++++++++++++++++++++ block/partitions/tegra.h | 71 ++++++ drivers/mmc/core/block.c | 14 ++ drivers/mmc/core/mmc.c | 2 + include/linux/mmc/card.h | 4 + include/soc/tegra/bct.h | 42 ++++ include/soc/tegra/common.h | 9 + include/soc/tegra/partition_table.h | 18 ++ 12 files changed, 581 insertions(+) create mode 100644 block/partitions/tegra.c create mode 100644 block/partitions/tegra.h create mode 100644 include/soc/tegra/bct.h create mode 100644 include/soc/tegra/partition_table.h -- 2.24.0 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper 2020-02-24 23:18 [PATCH v1 0/3] Introduce NVIDIA Tegra Partition Table Dmitry Osipenko @ 2020-02-24 23:18 ` Dmitry Osipenko 2020-02-25 14:53 ` Ulf Hansson [not found] ` <20200224231841.26550-3-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 2 replies; 14+ messages in thread From: Dmitry Osipenko @ 2020-02-24 23:18 UTC (permalink / raw) To: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Stephen Warren, Nicolas Chauvet, Ulf Hansson, Adrian Hunter, Billy Laws Cc: linux-tegra, linux-block, Andrey Danin, Gilles Grandou, Ryan Grachek, linux-mmc, linux-kernel NVIDIA Tegra Partition Table takes into account MMC card's BOOT_SIZE_MULT parameter, and thus, the partition parser needs to retrieve that EXT_CSD value from the block device. This patch introduces new helper which takes block device for the input argument and returns corresponding MMC card. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- drivers/mmc/core/block.c | 14 ++++++++++++++ include/linux/mmc/card.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 663d87924e5e..5d853450c764 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -301,6 +301,20 @@ static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr, return ret; } +struct mmc_card *mmc_bdev_to_card(struct block_device *bdev) +{ + struct mmc_blk_data *md; + + if (bdev->bd_disk->major != MMC_BLOCK_MAJOR) + return NULL; + + md = mmc_blk_get(bdev->bd_disk); + if (!md) + return NULL; + + return md->queue.card; +} + static int mmc_blk_open(struct block_device *bdev, fmode_t mode) { struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 90b1d83ce675..daccb0cc25f8 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -7,6 +7,7 @@ #ifndef LINUX_MMC_CARD_H #define LINUX_MMC_CARD_H +#include <linux/blkdev.h> #include <linux/device.h> #include <linux/mod_devicetable.h> @@ -324,4 +325,6 @@ bool mmc_card_is_blockaddr(struct mmc_card *card); #define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) #define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO) +struct mmc_card *mmc_bdev_to_card(struct block_device *bdev); + #endif /* LINUX_MMC_CARD_H */ -- 2.24.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper 2020-02-24 23:18 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko @ 2020-02-25 14:53 ` Ulf Hansson 2020-02-25 15:46 ` Dmitry Osipenko [not found] ` <20200224231841.26550-3-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 1 sibling, 1 reply; 14+ messages in thread From: Ulf Hansson @ 2020-02-25 14:53 UTC (permalink / raw) To: Dmitry Osipenko Cc: Jens Axboe, Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Stephen Warren, Nicolas Chauvet, Adrian Hunter, Billy Laws, linux-tegra, linux-block, Andrey Danin, Gilles Grandou, Ryan Grachek, linux-mmc, Linux Kernel Mailing List On Tue, 25 Feb 2020 at 00:22, Dmitry Osipenko <digetx@gmail.com> wrote: > > NVIDIA Tegra Partition Table takes into account MMC card's BOOT_SIZE_MULT > parameter, and thus, the partition parser needs to retrieve that EXT_CSD > value from the block device. This patch introduces new helper which takes > block device for the input argument and returns corresponding MMC card. Rather than returning the card, why not return the value you are looking for instead? That sound more straightforward, but also allows mmc core code to stay closer to the mmc core. Kind regards Uffe > > Signed-off-by: Dmitry Osipenko <digetx@gmail.com> > --- > drivers/mmc/core/block.c | 14 ++++++++++++++ > include/linux/mmc/card.h | 3 +++ > 2 files changed, 17 insertions(+) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index 663d87924e5e..5d853450c764 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -301,6 +301,20 @@ static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr, > return ret; > } > > +struct mmc_card *mmc_bdev_to_card(struct block_device *bdev) > +{ > + struct mmc_blk_data *md; > + > + if (bdev->bd_disk->major != MMC_BLOCK_MAJOR) > + return NULL; > + > + md = mmc_blk_get(bdev->bd_disk); > + if (!md) > + return NULL; > + > + return md->queue.card; > +} > + > static int mmc_blk_open(struct block_device *bdev, fmode_t mode) > { > struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h > index 90b1d83ce675..daccb0cc25f8 100644 > --- a/include/linux/mmc/card.h > +++ b/include/linux/mmc/card.h > @@ -7,6 +7,7 @@ > #ifndef LINUX_MMC_CARD_H > #define LINUX_MMC_CARD_H > > +#include <linux/blkdev.h> > #include <linux/device.h> > #include <linux/mod_devicetable.h> > > @@ -324,4 +325,6 @@ bool mmc_card_is_blockaddr(struct mmc_card *card); > #define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) > #define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO) > > +struct mmc_card *mmc_bdev_to_card(struct block_device *bdev); > + > #endif /* LINUX_MMC_CARD_H */ > -- > 2.24.0 > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper 2020-02-25 14:53 ` Ulf Hansson @ 2020-02-25 15:46 ` Dmitry Osipenko 0 siblings, 0 replies; 14+ messages in thread From: Dmitry Osipenko @ 2020-02-25 15:46 UTC (permalink / raw) To: Ulf Hansson, Jens Axboe Cc: Thierry Reding, Jonathan Hunter, Michał Mirosław, David Heidelberg, Peter Geis, Stephen Warren, Nicolas Chauvet, Adrian Hunter, Billy Laws, linux-tegra, linux-block, Andrey Danin, Gilles Grandou, Ryan Grachek, linux-mmc, Linux Kernel Mailing List 25.02.2020 17:53, Ulf Hansson пишет: > On Tue, 25 Feb 2020 at 00:22, Dmitry Osipenko <digetx@gmail.com> wrote: >> >> NVIDIA Tegra Partition Table takes into account MMC card's BOOT_SIZE_MULT >> parameter, and thus, the partition parser needs to retrieve that EXT_CSD >> value from the block device. This patch introduces new helper which takes >> block device for the input argument and returns corresponding MMC card. > > Rather than returning the card, why not return the value you are > looking for instead? That sound more straightforward, but also allows > mmc core code to stay closer to the mmc core. Please take a look at patch #3, in particular see the tegra_partition_table_emmc_boot_offset(). We already need more than just the BOOT_SIZE_MULT from the struct mmc_card, in the the v2 of this series we will probably need even a bit more. I'll adjust the commit's message of this patch in v2, saying that more than BOOT_SIZE_MULT is needed from the struct mmc_card. Are you okay with this variant? ---- BTW, do you have any idea how partition table scanning of MMC's boot0/1 partitions potentially could be implemented? It's not uncommon for Tegra devices that partition table could reside in one of the MMC's boot partitions (Nexus 7 is one example). For now I don't see how the scanning could be implemented easily because all boot0/boot1/main partitions are very separated from each other in the kernel's MMC_BLOCK. One potential hack that comes into my mind is that the boot0/1 partitions could be always registered before the main MMC partition and then they always will be scanned first, i.e. before the main partition. This will allow to read out partition table from the boot partitions and stash it for the main. ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <20200224231841.26550-3-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper 2020-02-24 23:18 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko 2020-02-25 14:53 ` Ulf Hansson @ 2020-02-27 0:40 ` kbuild test robot 1 sibling, 0 replies; 14+ messages in thread From: kbuild test robot @ 2020-02-27 0:40 UTC (permalink / raw) To: Dmitry Osipenko Cc: kbuild-all-hn68Rpc1hR1g9hUCZPvPmw, Jens Axboe, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-block-u79uwXL29TY76Z2rM5mHXA, Andrey Danin, Gilles Grandou, Ryan Grachek, linux-mmc-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 4777 bytes --] Hi Dmitry, I love your patch! Yet something to improve: [auto build test ERROR on block/for-next] [also build test ERROR on tegra/for-next linus/master v5.6-rc3 next-20200226] [cannot apply to ulf.hansson-mmc/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Dmitry-Osipenko/Introduce-NVIDIA-Tegra-Partition-Table/20200225-072610 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: m68k-randconfig-a001-20200227 (attached as .config) compiler: m68k-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=m68k If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> All errors (new ones prefixed by >>): drivers/mmc/host/wbsd.c: In function 'wbsd_request_end': drivers/mmc/host/wbsd.c:210:14: error: implicit declaration of function 'claim_dma_lock'; did you mean 'can_do_mlock'? [-Werror=implicit-function-declaration] dmaflags = claim_dma_lock(); ^~~~~~~~~~~~~~ can_do_mlock >> drivers/mmc/host/wbsd.c:213:3: error: implicit declaration of function 'release_dma_lock'; did you mean 'release_pages'? [-Werror=implicit-function-declaration] release_dma_lock(dmaflags); ^~~~~~~~~~~~~~~~ release_pages cc1: some warnings being treated as errors vim +213 drivers/mmc/host/wbsd.c ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 201 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 202 static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq) ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 203 { ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 204 unsigned long dmaflags; ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 205 cfa7f52164d6cd drivers/mmc/wbsd.c Pierre Ossman 2006-01-08 206 if (host->dma >= 0) { ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 207 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 208 * Release ISA DMA controller. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 209 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 @210 dmaflags = claim_dma_lock(); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 211 disable_dma(host->dma); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 212 clear_dma_ff(host->dma); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 @213 release_dma_lock(dmaflags); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 214 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 215 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 216 * Disable DMA on host. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 217 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 218 wbsd_write_index(host, WBSD_IDX_DMA, 0); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 219 } ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 220 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 221 host->mrq = NULL; ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 222 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 223 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 224 * MMC layer might call back into the driver so first unlock. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 225 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 226 spin_unlock(&host->lock); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 227 mmc_request_done(host->mmc, mrq); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 228 spin_lock(&host->lock); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 229 } ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 230 :::::: The code at line 213 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :::::: TO: Linus Torvalds <torvalds-gWtpgVMusWVb5UGfqNBoRg@public.gmane.org> :::::: CC: Linus Torvalds <torvalds-gWtpgVMusWVb5UGfqNBoRg@public.gmane.org> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 28023 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper @ 2020-02-27 0:40 ` kbuild test robot 0 siblings, 0 replies; 14+ messages in thread From: kbuild test robot @ 2020-02-27 0:40 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 4753 bytes --] Hi Dmitry, I love your patch! Yet something to improve: [auto build test ERROR on block/for-next] [also build test ERROR on tegra/for-next linus/master v5.6-rc3 next-20200226] [cannot apply to ulf.hansson-mmc/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Dmitry-Osipenko/Introduce-NVIDIA-Tegra-Partition-Table/20200225-072610 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: m68k-randconfig-a001-20200227 (attached as .config) compiler: m68k-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=m68k If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/mmc/host/wbsd.c: In function 'wbsd_request_end': drivers/mmc/host/wbsd.c:210:14: error: implicit declaration of function 'claim_dma_lock'; did you mean 'can_do_mlock'? [-Werror=implicit-function-declaration] dmaflags = claim_dma_lock(); ^~~~~~~~~~~~~~ can_do_mlock >> drivers/mmc/host/wbsd.c:213:3: error: implicit declaration of function 'release_dma_lock'; did you mean 'release_pages'? [-Werror=implicit-function-declaration] release_dma_lock(dmaflags); ^~~~~~~~~~~~~~~~ release_pages cc1: some warnings being treated as errors vim +213 drivers/mmc/host/wbsd.c ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 201 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 202 static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq) ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 203 { ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 204 unsigned long dmaflags; ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 205 cfa7f52164d6cd drivers/mmc/wbsd.c Pierre Ossman 2006-01-08 206 if (host->dma >= 0) { ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 207 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 208 * Release ISA DMA controller. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 209 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 @210 dmaflags = claim_dma_lock(); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 211 disable_dma(host->dma); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 212 clear_dma_ff(host->dma); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 @213 release_dma_lock(dmaflags); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 214 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 215 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 216 * Disable DMA on host. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 217 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 218 wbsd_write_index(host, WBSD_IDX_DMA, 0); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 219 } ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 220 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 221 host->mrq = NULL; ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 222 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 223 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 224 * MMC layer might call back into the driver so first unlock. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 225 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 226 spin_unlock(&host->lock); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 227 mmc_request_done(host->mmc, mrq); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 228 spin_lock(&host->lock); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 229 } ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 230 :::::: The code at line 213 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org> :::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 28023 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper @ 2020-02-27 0:40 ` kbuild test robot 0 siblings, 0 replies; 14+ messages in thread From: kbuild test robot @ 2020-02-27 0:40 UTC (permalink / raw) To: Dmitry Osipenko Cc: kbuild-all, Jens Axboe, linux-tegra, linux-block, Andrey Danin, Gilles Grandou, Ryan Grachek, linux-mmc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 4672 bytes --] Hi Dmitry, I love your patch! Yet something to improve: [auto build test ERROR on block/for-next] [also build test ERROR on tegra/for-next linus/master v5.6-rc3 next-20200226] [cannot apply to ulf.hansson-mmc/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Dmitry-Osipenko/Introduce-NVIDIA-Tegra-Partition-Table/20200225-072610 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: m68k-randconfig-a001-20200227 (attached as .config) compiler: m68k-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=m68k If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/mmc/host/wbsd.c: In function 'wbsd_request_end': drivers/mmc/host/wbsd.c:210:14: error: implicit declaration of function 'claim_dma_lock'; did you mean 'can_do_mlock'? [-Werror=implicit-function-declaration] dmaflags = claim_dma_lock(); ^~~~~~~~~~~~~~ can_do_mlock >> drivers/mmc/host/wbsd.c:213:3: error: implicit declaration of function 'release_dma_lock'; did you mean 'release_pages'? [-Werror=implicit-function-declaration] release_dma_lock(dmaflags); ^~~~~~~~~~~~~~~~ release_pages cc1: some warnings being treated as errors vim +213 drivers/mmc/host/wbsd.c ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 201 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 202 static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq) ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 203 { ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 204 unsigned long dmaflags; ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 205 cfa7f52164d6cd drivers/mmc/wbsd.c Pierre Ossman 2006-01-08 206 if (host->dma >= 0) { ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 207 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 208 * Release ISA DMA controller. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 209 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 @210 dmaflags = claim_dma_lock(); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 211 disable_dma(host->dma); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 212 clear_dma_ff(host->dma); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 @213 release_dma_lock(dmaflags); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 214 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 215 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 216 * Disable DMA on host. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 217 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 218 wbsd_write_index(host, WBSD_IDX_DMA, 0); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 219 } ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 220 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 221 host->mrq = NULL; ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 222 ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 223 /* ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 224 * MMC layer might call back into the driver so first unlock. ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 225 */ ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 226 spin_unlock(&host->lock); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 227 mmc_request_done(host->mmc, mrq); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 228 spin_lock(&host->lock); ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 229 } ^1da177e4c3f41 drivers/mmc/wbsd.c Linus Torvalds 2005-04-16 230 :::::: The code at line 213 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org> :::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 28023 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2021-03-29 18:39 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-03-27 21:20 [PATCH v1 0/3] Support EFI partition on NVIDIA Tegra devices Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 1/3] mmc: core: Add raw_boot_mult field to mmc_ext_csd Dmitry Osipenko 2021-03-27 21:20 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko 2021-03-27 21:21 ` [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices Dmitry Osipenko 2021-03-29 6:18 ` Christoph Hellwig 2021-03-29 13:07 ` Dmitry Osipenko 2021-03-29 17:31 ` Davidlohr Bueso 2021-03-29 18:38 ` Dmitry Osipenko -- strict thread matches above, loose matches on Subject: below -- 2020-02-24 23:18 [PATCH v1 0/3] Introduce NVIDIA Tegra Partition Table Dmitry Osipenko 2020-02-24 23:18 ` [PATCH v1 2/3] mmc: block: Add mmc_bdev_to_card() helper Dmitry Osipenko 2020-02-25 14:53 ` Ulf Hansson 2020-02-25 15:46 ` Dmitry Osipenko [not found] ` <20200224231841.26550-3-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2020-02-27 0:40 ` kbuild test robot 2020-02-27 0:40 ` kbuild test robot 2020-02-27 0:40 ` kbuild test robot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.