Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.14] Initialize MMC devices in predictable order #57

Open
wants to merge 2 commits into
base: amlogic-3.14.y
Choose a base branch
from

Conversation

codesnake
Copy link
Collaborator

Make sure MMC devices (mmcblkX) always get predictable index (in the order they are defined in device tree).

Because MMC devices are initialized asynchronously to optimize boot time, we cannot guarantee mmcblkX will belong to specific MMC device. Amlogic boards usually have /dev/mmcblk0 representing SD card slot. But in some cases if the device has internal eMMC memory, SD-card slot may become /dev/mmcblk1 while /dev/mmcblk0 is assigned to internal eMMC.

This PR makes sure MMC devices are always get indexes assigned in the order they are defined in device tree.

codesnake and others added 2 commits July 28, 2017 12:54
… is already set to a correct value after a call to mmc_host_alloc()
Commit 520bd7a ("mmc: core: Optimize boot time by detecting cards
simultaneously") causes regressions for some platforms.

These platforms relies on fixed mmcblk device indexes, instead of
deploying the defacto standard with UUID/PARTUUID. In other words their
rootfs needs to be available at hardcoded paths, like /dev/mmcblk0p2.

Such guarantees have never been made by the kernel, but clearly the above
commit changes the behaviour. More precisely, because of that the order
changes of how cards becomes detected, so do their corresponding mmcblk
device indexes.

As the above commit significantly improves boot time for some platforms
(magnitude of seconds), let's avoid reverting this change but instead
restore the behaviour of how mmcblk device indexes becomes picked.

By using the same index for the mmcblk device as for the corresponding mmc
host device, the probe order of mmc host devices decides the index we get
for the mmcblk device.

For those platforms that suffers from a regression, one could expect that
this updated behaviour should be sufficient to meet their expectations of
"fixed" mmcblk device indexes.

Another side effect from this change, is that the same index is used for
the mmc host device, the mmcblk device and the mmc block queue. That
should clarify their relationship.

Reported-by: Peter Hurley <[email protected]>
Reported-by: Laszlo Fiat <[email protected]>
Cc: Linus Torvalds <[email protected]>
Fixes: 520bd7a ("mmc: core: Optimize boot time by detecting cards
simultaneously")
Cc: <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
@wrxtasy
Copy link
Contributor

wrxtasy commented Sep 18, 2017

Tested this commit on a eMMC only ODROID C2, and mmcblk0 found in the following file has to be changed to mmcblk1

https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Odroid_C2/bootloader/boot.ini#L13

However once mmcblk0 is changed to mmcblk1 - a micro SDHC LE only image refuses to boot.

Please do NOT merge this.

@codesnake codesnake changed the title Initialize MMC devices in predictable order [3.14] Initialize MMC devices in predictable order Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants