hnvram: fix hnvram partition write flushing
On Chimera with Linux 4.4, hnvram write operations are failing:
NPAPID1600X0002# hnvram -w PLATFORM_NAME=GFCH100
ioctl(hnvram, BLKFLSBUF, 0): Operation not permitted
ioctl(hnvram, BLKFLSBUF, 0): Operation not permitted
[HMX_NVRAM_SetField] field(16)-PLATFORM_NAME error(00000006) : HMX_NVRAM_Write
Unable to write PLATFORM_NAME
This happens because:
1. On Chimera, hnvram partition is on eMMC
2. On Linux 4.4, mmc_blk_ioctl() does not allow write buffer flushes
for MMC partitions:
/*
* The caller must have CAP_SYS_RAWIO, and must be calling this on the
* whole block device, not on a partition. This prevents overspray
* between sibling partitions.
*/
if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
return -EPERM;
}
Fix:
When hnvram lives on MMC partition, flush the entire MMC device.
Change-Id: Idea3c35c8670c78212e940bc9417ab04080d10c2
1 file changed