aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-02-24mmc: support packed write command for eMMC4.5 devicesSeungwon Jeon7-17/+571
This patch supports packed write command of eMMC4.5 devices. Several writes can be grouped in packed command and all data of the individual commands can be sent in a single transfer on the bus. Large amounts of data in one transfer rather than several data of small size are effective for eMMC write internally. As a result, packed command help write throughput be improved. The following tables show the results of packed write. Type A: test none | packed iozone 25.8 | 31 tiotest 27.6 | 31.2 lmdd 31.2 | 35.4 Type B: test none | packed iozone 44.1 | 51.1 tiotest 47.9 | 52.5 lmdd 51.6 | 59.2 Type C: test none | packed iozone 19.5 | 32 tiotest 19.9 | 34.5 lmdd 22.8 | 40.7 Signed-off-by: Seungwon Jeon <[email protected]> Reviewed-by: Maya Erez <[email protected]> Reviewed-by: Namjae Jeon <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: add packed command feature of eMMC4.5Seungwon Jeon4-2/+48
This patch adds packed command feature of eMMC4.5. The maximum number for packing read (or write) is offered and exception event relevant to packed command which is used for error handling is enabled. If host wants to use this feature, MMC_CAP2_PACKED_CMD should be set. Signed-off-by: Seungwon Jeon <[email protected]> Reviewed-by: Maya Erez <[email protected]> Reviewed-by: Subhash Jadavani <[email protected]> Reviewed-by: Namjae Jeon <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: rtsx: remove driving adjustmentRoger Tseng1-5/+0
Several new models of readers use different way to select driving capability (a necessary adjustment along with voltage change). Removing this from device-independent rtsx_pci_sdmmc module. It will be implemented in device-depend calls encapsulated by rtsx_pci_switch_output_voltage(). Signed-off-by: Roger Tseng <[email protected]> Reviewed-by: Wei WANG <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: use regulator_can_change_voltage() instead of regulator_count_voltagesMarek Szyprowski1-1/+1
mmc_regulator_set_ocr() depends on the ability of regulator to change the voltage value. When regulator cannot change its voltage output, some code is skipped to avoid reporting false errors on some boards, which use MMC hosts with fixed regulators (e.g. Samsung Goni and UniversalC210 boards). This patch replaces a hacky workaround based on regulator_count_voltages() value with the correct call to recently introduced regulator_can_change_voltage() function in regulators core. Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-pxav3: add pm runtime supportKevin Liu1-1/+95
Signed-off-by: Kevin Liu <[email protected]> Signed-off-by: Jialing Fu <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: fix indentationJaehoon Chung1-12/+11
This patch fixes incorrect indentation. (Just code cleanup) Signed-off-by: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: block: don't start new request when the card is removedSeungwon Jeon1-2/+8
It's not necessary to start a new request while error handling if the card was removed. Signed-off-by: Seungwon Jeon <[email protected]> Acked-by: Jaehoon Chung <[email protected]> Tested-by: Konstantin Dorfman <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: fix permanent sleep of mmcqd during card removalSeungwon Jeon1-0/+1
This patch is derived from: "mmc: fix async request mechanism for sequential read scenarios". According as async transfer, a request is handled with twice mmc_start_req. When the card is removed, the request is actually not issued in the first mmc_start_req [__mmc_start_data_req]. And then mmc_wait_for_data_req_done will come in the next mmc_start_req. But there is no event for completions. wake_up_interruptible is needed in __mmc_start_data_req for the case of removed card. Signed-off-by: Seungwon Jeon <[email protected]> Acked-by: Jaehoon Chung <[email protected]> Tested-by: Konstantin Dorfman <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci: enhance preset value functionKevin Liu5-58/+102
4d55c5a1 ("mmc: sdhci: enable preset value after uhs initialization") added preset value support and enabled it by default during sd card init. Below are the enhancements introduced by this patch: 1. In current code, preset value is enabled after setting clock finished, which means the clock is manually set by driver firstly and then suddenly switched to preset value at this point. So the first setting is useless and unnecessary. What's more, the first clock setting may differ from the preset one. The better way is enable preset value just after switch to UHS mode so the preset value can take effect immediately. So move preset value enable from mmc_sd_init_card to sdhci_set_ios which will be called during set timing. 2. In current code, preset value is disabled at the beginning of mmc_attach_sd. It's too late since low freq (400khz) should be set in mmc_power_up. So move preset value disable to sdhci_set_ios which will be called during power up. 3. host->clock and ios->drv_type should also be updated according to the preset value if it's enabled. Current code missed this. 4. This patch also introduce a quirk to disable preset value in case preset value doesn't work. This patch has been verified on sdhci-pxav3 platform with both preset enabled and disabled. Signed-off-by: Kevin Liu <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()Roland Stigge1-1/+1
When irq_of_parse_and_map() returns an error, it does as zero. But in mmc_spi_get_pdata(), the error return case is compared against NO_IRQ. This might work where NO_IRQ is zero (defaults to zero when undefined, as on MIPS) but not where NO_IRQ is different, e.g. on ARM where it's -1. This patch changes to comparison with 0 which is the error return value of irq_of_parse_and_map(). Tested on ARM that mmc_spi is working now. Signed-off-by: Roland Stigge <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: MAINTAINERS update for omap_hsmmcBalaji T K1-1/+1
Update Maintainer email for omap_hsmmc, as Venkatraman will no longer be able to maintain omap_hsmmc driver. Signed-off-by: Balaji T K <[email protected]> Acked-by: Venkatraman S <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-pltfm: Add a common clk API implementation of get_timeout_clockLars-Peter Clausen6-46/+18
Quite a few drivers have a implementation of the get_timeout_clock callback which simply returns the result of clk_get_rate on the device's clock. This patch adds a common implementation of this to the sdhci-pltfm module and replaces all custom implementations with the common one. Signed-off-by: Lars-Peter Clausen <[email protected]> Tested-by: Stephen Warren <[email protected]> Acked-by: Shawn Guo <[email protected]> Tested-by: Kevin Liu <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci: update signal voltage switch codeKevin Liu1-114/+78
The protocol related code is moved to core stack. So update the host driver accordingly. Signed-off-by: Kevin Liu <[email protected]> Tested-by: Tim Wang <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: Fixup signal voltage switchJohan Rudholm3-17/+107
When switching SD and SDIO cards from 3.3V to 1.8V signal levels, the clock should be gated for 5 ms during the step. After enabling the clock, the host should wait for at least 1 ms before checking for failure. Failure by the card to switch is indicated by dat[0:3] being pulled low. The host should check for this condition and power-cycle the card if failure is indicated. Add a retry mechanism for the SDIO case. If the voltage switch fails repeatedly, give up and continue the initialization using the original voltage. This patch places a couple of requirements on the host driver: 1) mmc_set_ios with ios.clock = 0 must gate the clock 2) mmc_power_off must actually cut the power to the card 3) The card_busy host_ops member must be implemented if these requirements are not fulfilled, the 1.8V signal voltage switch will still be attempted but may not be successful. Signed-off-by: Johan Rudholm <[email protected]> Signed-off-by: Kevin Liu <[email protected]> Acked-by: Ulf Hansson <[email protected]> Tested-by: Wei WANG <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: Break out start_signal_voltage_switchJohan Rudholm5-21/+31
Allow callers to access the start_signal_voltage_switch host_ops member without going through any cmd11 logic. This is mostly a preparation for the following signal voltage switch patch. Also, reset ios.signal_voltage to its original value if start_signal_voltage_switch fails. Signed-off-by: Johan Rudholm <[email protected]> Acked-by: Ulf Hansson <[email protected]> Tested-by: Wei WANG <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: Add card_busy to host_opsJohan Rudholm1-0/+3
This host_ops member is used to test if the card is signaling busy by pulling dat[0:3] low. Signed-off-by: Johan Rudholm <[email protected]> Acked-by: Ulf Hansson <[email protected]> Tested-by: Wei WANG <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: Add mmc_power_cycleJohan Rudholm2-0/+9
Add mmc_power_cycle which can be used to power cycle for instance SD-cards. Signed-off-by: Johan Rudholm <[email protected]> Acked-by: Ulf Hansson <[email protected]> Tested-by: Wei WANG <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sd: Simplify by using mmc_host_uhsJohan Rudholm1-4/+2
Signed-off-by: Johan Rudholm <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: expose RPMB partition only for CMD23 capable hostsBalaji T K1-1/+1
SET_BLOCK_COUNT CMD23 is needed for all access to RPMB partition. If block count is not set by CMD23, all subsequent read/write commands fail as per eMMC specification. So, If the host does not support CMD23, do not expose RPMB partition. Accessing RPMB partition can cause hang / huge delay for hosts which do not support CMD23. Signed-off-by: Balaji T K <[email protected]> Reported-and-Tested-by: Peter Ujfalusi <[email protected]> Cc: stable <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: goldfish: emulated MMC deviceMike Lockwood3-0/+578
This driver handles the virtual MMC device present in the Goldfish emulator. The patch folds together initial work from Mike Lockwood and patches by San Mehat, Jun Nakajima and Tom Keel <[email protected]> plus cleanups by Alan Cox to get it all into 3.6 shape. Signed-off-by: Mike A. Chan <[email protected]> [cleaned up and x86 support added] Signed-off-by: Sheng Yang <[email protected]> Signed-off-by: Yunhong Jiang <[email protected]> Signed-off-by: Xiaohui Xin <[email protected]> Signed-off-by: Jun Nakajima <[email protected]> Signed-off-by: Bruce Beare <[email protected]> [Moved to 3.4] Signed-off-by: Tom Keel <[email protected]> [Moved to 3.7] Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: dt: bus-width can be an optional propertyShawn Guo1-3/+2
None of mmc drivers implements bus-width as a required device tree property. Instead, some drivers like atmel-mci, dw_mmc, sdhci-s3c implement it as an optional one, and will force bus width to be 1 when the property is absent. Let's change the common binding to reflect what the drivers are usually doing. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: support 8bit modeSascha Hauer2-2/+55
The i.MX esdhc has a nonstandard bit layout for the SDHCI_HOST_CONTROL register. To support 8bit bus width on i.MX populate the platform_bus_width callback. This is tested on an i.MX25, but should according to the datasheets work on the other i.MX using this hardware aswell. The i.MX6, while having a SDHCI_SPEC_300 controller, still uses the same nonstandard register layout. Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci: rename platform_8bit_width to platform_bus_widthSascha Hauer6-14/+14
The 8bit in the function name is misleading. When set, it will be used to set the bus width, regardless of whether 8bit or another bus width is requested, so change the function name to platform_bus_width. Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: Auto CMD23 support for usdhcShawn Guo1-1/+9
SDHCI core will try to use Auto CMD23 for mmc card. Currently, we will see the following message with mmc card on usdhc due to the lacking of Auto CMD23 support in the driver. $ mmc0: new high speed MMC card at address 0001 mmcblk1: mmc0:0001 MMC02G 1.87 GiB mmcblk1: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb00 mmcblk1: retrying using single block read mmcblk1: Enable Auto CMD23 support for usdhc so that mmc card can work in multiple block mode. Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: manually reset MIX_CTRL for usdhcShawn Guo1-1/+8
It's another violation to SDHC spec that software reset on usdhc does not reset MIX_CTRL register. Have to do it manually, otherwise the preserving of the register bits (e.g. AC23EN) may cause mmc card fail to be initialized. Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: separate transfer mode from command write for usdhcShawn Guo1-11/+14
The combining of SDHCI_TRANSFER_MODE and SDHCI_COMMAND writes is only required for esdhc, but not necessarily for usdhc. Different from esdhc where the bits for transfer mode and command are all in the same register CMD_XFR_TYP, usdhc has a newly introduced register MIX_CTRL to hold transfer mode bits. So it makes more sense to separate transfer mode from command write for usdhc. Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: core: move the cache disabling operation to mmc_suspendMaya Erez2-7/+8
Cache control is an eMMC feature and in therefore should be part of MMC's bus resume operations, performed in mmc_suspend, rather than in the generic mmc_suspend_host(). Signed-off-by: Maya Erez <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24MAINTAINERS: mmc: add maintainer entry for dw_mmc driverSeungwon Jeon1-0/+8
Add maintainer entry for the Synopsys DW host driver which is used in various SOC including EXYNOS series. As Will Newton will no longer be able to take care of dw_mmc*, I and Jaehoon Chung are willing to maintain it. Signed-off-by: Seungwon Jeon <[email protected]> Signed-off-by: Jaehoon Chung <[email protected]> Acked-by: Will Newton <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: Remove unused variablesFabio Estevam1-5/+0
3f175a6e5 (mmc: sdhci-esdhc-imx: remove ESDHC_CD_GPIO handling from IO accessory) introduced the following build warnings: drivers/mmc/host/sdhci-esdhc-imx.c:149:30: warning: unused variable 'boarddata' [-Wunused-variable] drivers/mmc/host/sdhci-esdhc-imx.c:181:30: warning: unused variable 'boarddata' [-Wunused-variable] Remove the unused variables. Signed-off-by: Fabio Estevam <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: fix DT binding documentation SDHCI left-overGuennadi Liakhovetski1-1/+1
The file Documentation/devicetree/bindings/mmc/mmc.txt is common for all MMC host drivers. Use a generic MMC host reference instead of an SDHCI left-over. Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: name esdhc specific definitions with ESDHC_ prefixShawn Guo1-20/+20
Rename esdhc local definitions with ESDHC_ rather than SDHCI_ prefix, so that we can distinguish them from SDHCI core definitions from name. A couple of bit fields are also changed use shift for consistency and better readability. Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: remove D3CD check from SDHCI_HOST_CONTROL writeShawn Guo1-4/+2
SDHCI_CTRL_D3CD is not a standard SDHCI_HOST_CONTROL, so there is no need to check it in SDHCI_HOST_CONTROL write at all. Remove it. Signed-off-by: Shawn Guo <[email protected]> Tested-by: Dirk Behme <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: sdhci-esdhc-imx: fix host version readShawn Guo1-8/+11
When commit 95a2482 (mmc: sdhci-esdhc-imx: add basic imx6q usdhc support) works around host version issue on imx6q, it gets the register address fixup "reg ^= 2" lost for imx25/35/51/53 esdhc. Thus, the controller version on these SoCs is wrongly identified as v1 while it's actually v2. Add the address fixup back and take a different approach to correct imx6q host version, so that the host version read gets back to work for all SoCs. Signed-off-by: Shawn Guo <[email protected]> Cc: <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: vt8500: Remove erroneous __exitp in wmt_mci_driverTony Prisk1-1/+1
With the __devinit/__devexit attributes having been removed, this __exitp attribute causes an unused function warning and should be removed as well. Signed-off-by: Tony Prisk <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: dw_mmc: Remove DW_MCI_QUIRK_NO_WRITE_PROTECTDoug Anderson2-14/+1
The original quirk was added in the change 'mmc: dw_mmc: add quirk to indicate missing write protect line'. The original quirk was added at a controller level even though each slot has its own write protect (so the quirk should be at the slot level). A recent change (mmc: dw_mmc: Add "disable-wp" device tree property) added a slot-level quirk and support for the quirk directly to dw_mmc. Signed-off-by: Doug Anderson <[email protected]> Acked-by: Will Newton <[email protected]> Acked-by: Olof Johansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: dw_mmc: Handle wp-gpios from device treeDoug Anderson1-0/+34
On some SoCs (like exynos5250) you need to use an external GPIO for write protect. Add support for wp-gpios to the core dw_mmc driver since it could be useful across multiple SoCs. With this change I am able to make use of the write protect for the external SD slot on exynos5250-snow. Signed-off-by: Doug Anderson <[email protected]> Acked-by: Seungwon Jeon <[email protected]> Acked-by: Olof Johansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: dw_mmc: exynos: Remove code for wp-gpiosDoug Anderson1-10/+0
The exynos code claimed the write protect with devm_gpio_request() but never did anything with it. That meant that anyone using a write protect GPIO would effectively be write protected all the time. The handling for wp-gpios belongs in the main dw_mmc driver and has been moved there. Signed-off-by: Doug Anderson <[email protected]> Acked-by: Seungwon Jeon <[email protected]> Acked-by: Olof Johansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24ARM: dts: Add disable-wp for sd card slot on smdk5250Doug Anderson1-0/+1
The next change will remove the code from the dw_mmc-exynos that added the DW_MCI_QUIRK_NO_WRITE_PROTECT. Keep existing functionality of having no write protect pin on smdk5250 by adding the disable-wp property. Signed-off-by: Doug Anderson <[email protected]> Acked-by: Seungwon Jeon <[email protected]> Acked-by: Olof Johansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: dw_mmc: Add "disable-wp" device tree propertyDoug Anderson3-3/+59
The "disable-wp" property is used to specify that a given SD card slot doesn't have a concept of write protect. This eliminates the need for special case code for SD slots that should never be write protected (like a micro SD slot or a dev board). The dw_mmc driver is special in needing to specify "disable-wp" because the lack of a "wp-gpios" property means to use the special purpose write protect line. On some other mmc devices the lack of "wp-gpios" means that write protect should be disabled. Signed-off-by: Doug Anderson <[email protected]> Acked-by: Seungwon Jeon <[email protected]> Acked-by: Will Newton <[email protected]> Acked-by: Olof Johansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: correct the EXCEPTION_EVENTS_STATUS value in commentZhang, YiX X1-1/+1
The right value is 54 according to eMMC 4.5 specification. Signed-off-by: ZhangYi <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: mxs-mmc: Fix warning due to incorrect typeFabio Estevam1-1/+1
Fixes the following warning when building with W=1 option: drivers/mmc/host/mxs-mmc.c: In function 'mxs_mmc_adtc': drivers/mmc/host/mxs-mmc.c:401:2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] The warning happens because 'i' is used in 'for_each_sg(sgl, sg, sg_len, i)' and should be made unsigned. Signed-off-by: Fabio Estevam <[email protected]> Acked-by: Marek Vasut <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: mxs-mmc: Add MODULE_ALIAS()Fabio Estevam1-0/+1
Add an entry for MODULE_ALIAS(). Signed-off-by: Fabio Estevam <[email protected]> Acked-by: Marek Vasut <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24mmc: mvsdio: add pinctrl integrationThomas Petazzoni1-0/+6
On many Marvell SoCs, the pins used for the SDIO interface are part of the MPP pins, that are muxable pins. In order to get the muxing of those pins correct, this commit integrates the mvsdio driver with the pinctrl infrastructure by calling devm_pinctrl_get_select_default() during ->probe(). Note that we permit this function to fail because not all Marvell platforms have yet been fully converted to using the pinctrl infrastructure. Signed-off-by: Thomas Petazzoni <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Stefan Peter <[email protected]> Tested-by: Florian Fainelli <[email protected]> Signed-off-by: Jason Cooper <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-02-24gianfar: fix compile fail for NET_POLL=y due to struct packingPaul Gortmaker1-12/+14
Commit ee873fda3bec7c668407b837fc5519eb961fcd37 ("gianfar: Pack struct gfar_priv_grp into three cachelines") moved the irq number and names off into a separate struct and created accessors for them. However it was never tested with NET_POLL enabled, and so some conversions that were simply overlooked went undetected until now. Make the netpoll ones also use the gfar_irq() accessors. Reported-by: Benjamin Herrenschmidt <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Claudiu Manoil <[email protected]> Cc: Jianhua Xie <[email protected]> Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2013-02-24drivers/vfio: remove depends on CONFIG_EXPERIMENTALKees Cook1-1/+1
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it from any "depends on" lines in Kconfigs. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Alex Williamson <[email protected]>
2013-02-24x86/mm/pageattr: Prevent PSE and GLOABL leftovers to confuse pmd/pte_present ↵Andrea Arcangeli1-3/+47
and pmd_huge Without this patch any kernel code that reads kernel memory in non present kernel pte/pmds (as set by pageattr.c) will crash. With this kernel code: static struct page *crash_page; static unsigned long *crash_address; [..] crash_page = alloc_pages(GFP_KERNEL, 9); crash_address = page_address(crash_page); if (set_memory_np((unsigned long)crash_address, 1)) printk("set_memory_np failure\n"); [..] The kernel will crash if inside the "crash tool" one would try to read the memory at the not present address. crash> p crash_address crash_address = $8 = (long unsigned int *) 0xffff88023c000000 crash> rd 0xffff88023c000000 [ *lockup* ] The lockup happens because _PAGE_GLOBAL and _PAGE_PROTNONE shares the same bit, and pageattr leaves _PAGE_GLOBAL set on a kernel pte which is then mistaken as _PAGE_PROTNONE (so pte_present returns true by mistake and the kernel fault then gets confused and loops). With THP the same can happen after we taught pmd_present to check _PAGE_PROTNONE and _PAGE_PSE in commit 027ef6c87853b0a9df5317 ("mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP"). THP has the same problem with _PAGE_GLOBAL as the 4k pages, but it also has a problem with _PAGE_PSE, which must be cleared too. After the patch is applied copy_user correctly returns -EFAULT and doesn't lockup anymore. crash> p crash_address crash_address = $9 = (long unsigned int *) 0xffff88023c000000 crash> rd 0xffff88023c000000 rd: read error: kernel virtual address: ffff88023c000000 type: "64-bit KVADDR" Signed-off-by: Andrea Arcangeli <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Shaohua Li <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2013-02-24Revert "x86, mm: Make spurious_fault check explicitly check explicitly check ↵Andrea Arcangeli1-7/+1
the PRESENT bit" I got a report for a minor regression introduced by commit 027ef6c87853b ("mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP"). So the problem is, pageattr creates kernel pagetables (pte and pmds) that breaks pte_present/pmd_present and the patch above exposed this invariant breakage for pmd_present. The same problem already existed for the pte and pte_present and it was fixed by commit 660a293ea9be709 ("x86, mm: Make spurious_fault check explicitly check the PRESENT bit") (if it wasn't for that commit, it wouldn't even be a regression). That fix avoids the pagefault to use pte_present. I could follow through by stopping using pmd_present/pmd_huge too. However I think it's more robust to fix pageattr and to clear the PSE/GLOBAL bitflags too in addition to the present bitflag. So the kernel page fault can keep using the regular pte_present/pmd_present/pmd_huge. The confusion arises because _PAGE_GLOBAL and _PAGE_PROTNONE are sharing the same bit, and in the pmd case we pretend _PAGE_PSE to be set only in present pmds (to facilitate split_huge_page final tlb flush). Signed-off-by: Andrea Arcangeli <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Shaohua Li <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2013-02-24x86/mm/numa: Don't check if node is NUMA_NO_NODEWen Congyang1-2/+1
If we aren't debugging per_cpu maps, the cpu's node is stored in per_cpu variable numa_node. If `node' is NUMA_NO_NODE, it means the caller wants to clear the cpu's node. So we should also call set_cpu_numa_node() in this case. Signed-off-by: Wen Congyang <[email protected]> Cc: Len Brown <[email protected]> Cc: Pavel Machek <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2013-02-24cputime: Use local_clock() for full dynticks cputime accountingFrederic Weisbecker1-1/+1
Running the full dynticks cputime accounting with preemptible kernel debugging trigger the following warning: [ 4.488303] BUG: using smp_processor_id() in preemptible [00000000] code: init/1 [ 4.490971] caller is native_sched_clock+0x22/0x80 [ 4.493663] Pid: 1, comm: init Not tainted 3.8.0+ #13 [ 4.496376] Call Trace: [ 4.498996] [<ffffffff813410eb>] debug_smp_processor_id+0xdb/0xf0 [ 4.501716] [<ffffffff8101e642>] native_sched_clock+0x22/0x80 [ 4.504434] [<ffffffff8101db99>] sched_clock+0x9/0x10 [ 4.507185] [<ffffffff81096ccd>] fetch_task_cputime+0xad/0x120 [ 4.509916] [<ffffffff81096dd5>] task_cputime+0x35/0x60 [ 4.512622] [<ffffffff810f146e>] acct_update_integrals+0x1e/0x40 [ 4.515372] [<ffffffff8117d2cf>] do_execve_common+0x4ff/0x5c0 [ 4.518117] [<ffffffff8117cf14>] ? do_execve_common+0x144/0x5c0 [ 4.520844] [<ffffffff81867a10>] ? rest_init+0x160/0x160 [ 4.523554] [<ffffffff8117d457>] do_execve+0x37/0x40 [ 4.526276] [<ffffffff810021a3>] run_init_process+0x23/0x30 [ 4.528953] [<ffffffff81867aac>] kernel_init+0x9c/0xf0 [ 4.531608] [<ffffffff8188356c>] ret_from_fork+0x7c/0xb0 We use sched_clock() to perform and fixup the cputime accounting. However we are calling it with preemption enabled from the read side, which trigger the bug above. To fix this up, use local_clock() instead. It takes care of preemption and also provide a more reliable clock source. This is welcome for this kind of statistic that is widely relied on in userspace. Reported-by: Thomas Gleixner <[email protected]> Reported-by: Ingo Molnar <[email protected]> Suggested-by: Thomas Gleixner <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Cc: Li Zhong <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Kevin Hilman <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
2013-02-24cputime: Constify timeval_to_cputime(timeval) argumentLi Zhong1-1/+1
Saw the following compiler warning on the linux-next tree: kernel/itimer.c: In function 'set_cpu_itimer': kernel/itimer.c:152:2: warning: passing argument 1 of 'timeval_to_cputime' discards 'const' qualifier from pointer target type [enabled by default] ... timeval_to_cputime() is always passed a constant timeval in argument, we need to teach the nsecs based cputime implementation about that. Signed-off-by: Li Zhong <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Kevin Hilman <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Kevin Hilman <[email protected]>