Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mmc-v4.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
"MMC core:
- Ensure that debugfs files are removed properly
- Fix missing blk_put_request()
- Deal with errors from blk_get_request()
- Rewind mmc bus suspend operations at failures
- Prepend '0x' to ocr and pre_eol_info in sysfs to identify as hex

MMC host:
- sdhci-msm: Make it optional to wait for signal level changes
- sdhci: Avoid swiotlb buffer being full"

* tag 'mmc-v4.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
mmc: core: prepend 0x to OCR entry in sysfs
mmc: core: prepend 0x to pre_eol_info entry in sysfs
mmc: sdhci: Avoid swiotlb buffer being full
mmc: sdhci-msm: Optionally wait for signal level changes
mmc: block: Ensure that debugfs files are removed
mmc: core: Do not leave the block driver in a suspended state
mmc: block: Check return value of blk_get_request()
mmc: block: Fix missing blk_put_request()

+99 -22
+59 -8
drivers/mmc/core/block.c
··· 122 122 struct device_attribute force_ro; 123 123 struct device_attribute power_ro_lock; 124 124 int area_type; 125 + 126 + /* debugfs files (only in main mmc_blk_data) */ 127 + struct dentry *status_dentry; 128 + struct dentry *ext_csd_dentry; 125 129 }; 126 130 127 131 /* Device type for RPMB character devices */ ··· 237 233 238 234 /* Dispatch locking to the block layer */ 239 235 req = blk_get_request(mq->queue, REQ_OP_DRV_OUT, __GFP_RECLAIM); 236 + if (IS_ERR(req)) { 237 + count = PTR_ERR(req); 238 + goto out_put; 239 + } 240 240 req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_BOOT_WP; 241 241 blk_execute_rq(mq->queue, NULL, req, 0); 242 242 ret = req_to_mmc_queue_req(req)->drv_op_result; 243 + blk_put_request(req); 243 244 244 245 if (!ret) { 245 246 pr_info("%s: Locking boot partition ro until next power on\n", ··· 257 248 set_disk_ro(part_md->disk, 1); 258 249 } 259 250 } 260 - 251 + out_put: 261 252 mmc_blk_put(md); 262 253 return count; 263 254 } ··· 633 624 req = blk_get_request(mq->queue, 634 625 idata->ic.write_flag ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 635 626 __GFP_RECLAIM); 627 + if (IS_ERR(req)) { 628 + err = PTR_ERR(req); 629 + goto cmd_done; 630 + } 636 631 idatas[0] = idata; 637 632 req_to_mmc_queue_req(req)->drv_op = 638 633 rpmb ? MMC_DRV_OP_IOCTL_RPMB : MMC_DRV_OP_IOCTL; ··· 704 691 req = blk_get_request(mq->queue, 705 692 idata[0]->ic.write_flag ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 706 693 __GFP_RECLAIM); 694 + if (IS_ERR(req)) { 695 + err = PTR_ERR(req); 696 + goto cmd_err; 697 + } 707 698 req_to_mmc_queue_req(req)->drv_op = 708 699 rpmb ? MMC_DRV_OP_IOCTL_RPMB : MMC_DRV_OP_IOCTL; 709 700 req_to_mmc_queue_req(req)->drv_op_data = idata; ··· 2567 2550 2568 2551 /* Ask the block layer about the card status */ 2569 2552 req = blk_get_request(mq->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); 2553 + if (IS_ERR(req)) 2554 + return PTR_ERR(req); 2570 2555 req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_CARD_STATUS; 2571 2556 blk_execute_rq(mq->queue, NULL, req, 0); 2572 2557 ret = req_to_mmc_queue_req(req)->drv_op_result; ··· 2576 2557 *val = ret; 2577 2558 ret = 0; 2578 2559 } 2560 + blk_put_request(req); 2579 2561 2580 2562 return ret; 2581 2563 } ··· 2603 2583 2604 2584 /* Ask the block layer for the EXT CSD */ 2605 2585 req = blk_get_request(mq->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); 2586 + if (IS_ERR(req)) { 2587 + err = PTR_ERR(req); 2588 + goto out_free; 2589 + } 2606 2590 req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_EXT_CSD; 2607 2591 req_to_mmc_queue_req(req)->drv_op_data = &ext_csd; 2608 2592 blk_execute_rq(mq->queue, NULL, req, 0); 2609 2593 err = req_to_mmc_queue_req(req)->drv_op_result; 2594 + blk_put_request(req); 2610 2595 if (err) { 2611 2596 pr_err("FAILED %d\n", err); 2612 2597 goto out_free; ··· 2657 2632 .llseek = default_llseek, 2658 2633 }; 2659 2634 2660 - static int mmc_blk_add_debugfs(struct mmc_card *card) 2635 + static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) 2661 2636 { 2662 2637 struct dentry *root; 2663 2638 ··· 2667 2642 root = card->debugfs_root; 2668 2643 2669 2644 if (mmc_card_mmc(card) || mmc_card_sd(card)) { 2670 - if (!debugfs_create_file("status", S_IRUSR, root, card, 2671 - &mmc_dbg_card_status_fops)) 2645 + md->status_dentry = 2646 + debugfs_create_file("status", S_IRUSR, root, card, 2647 + &mmc_dbg_card_status_fops); 2648 + if (!md->status_dentry) 2672 2649 return -EIO; 2673 2650 } 2674 2651 2675 2652 if (mmc_card_mmc(card)) { 2676 - if (!debugfs_create_file("ext_csd", S_IRUSR, root, card, 2677 - &mmc_dbg_ext_csd_fops)) 2653 + md->ext_csd_dentry = 2654 + debugfs_create_file("ext_csd", S_IRUSR, root, card, 2655 + &mmc_dbg_ext_csd_fops); 2656 + if (!md->ext_csd_dentry) 2678 2657 return -EIO; 2679 2658 } 2680 2659 2681 2660 return 0; 2682 2661 } 2683 2662 2663 + static void mmc_blk_remove_debugfs(struct mmc_card *card, 2664 + struct mmc_blk_data *md) 2665 + { 2666 + if (!card->debugfs_root) 2667 + return; 2668 + 2669 + if (!IS_ERR_OR_NULL(md->status_dentry)) { 2670 + debugfs_remove(md->status_dentry); 2671 + md->status_dentry = NULL; 2672 + } 2673 + 2674 + if (!IS_ERR_OR_NULL(md->ext_csd_dentry)) { 2675 + debugfs_remove(md->ext_csd_dentry); 2676 + md->ext_csd_dentry = NULL; 2677 + } 2678 + } 2684 2679 2685 2680 #else 2686 2681 2687 - static int mmc_blk_add_debugfs(struct mmc_card *card) 2682 + static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) 2688 2683 { 2689 2684 return 0; 2685 + } 2686 + 2687 + static void mmc_blk_remove_debugfs(struct mmc_card *card, 2688 + struct mmc_blk_data *md) 2689 + { 2690 2690 } 2691 2691 2692 2692 #endif /* CONFIG_DEBUG_FS */ ··· 2753 2703 } 2754 2704 2755 2705 /* Add two debugfs entries */ 2756 - mmc_blk_add_debugfs(card); 2706 + mmc_blk_add_debugfs(card, md); 2757 2707 2758 2708 pm_runtime_set_autosuspend_delay(&card->dev, 3000); 2759 2709 pm_runtime_use_autosuspend(&card->dev); ··· 2779 2729 { 2780 2730 struct mmc_blk_data *md = dev_get_drvdata(&card->dev); 2781 2731 2732 + mmc_blk_remove_debugfs(card, md); 2782 2733 mmc_blk_remove_parts(card, md); 2783 2734 pm_runtime_get_sync(&card->dev); 2784 2735 mmc_claim_host(card->host);
+3
drivers/mmc/core/bus.c
··· 157 157 return ret; 158 158 159 159 ret = host->bus_ops->suspend(host); 160 + if (ret) 161 + pm_generic_resume(dev); 162 + 160 163 return ret; 161 164 } 162 165
+1
drivers/mmc/core/debugfs.c
··· 314 314 void mmc_remove_card_debugfs(struct mmc_card *card) 315 315 { 316 316 debugfs_remove_recursive(card->debugfs_root); 317 + card->debugfs_root = NULL; 317 318 }
+2 -2
drivers/mmc/core/mmc.c
··· 781 781 MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); 782 782 MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv); 783 783 MMC_DEV_ATTR(rev, "0x%x\n", card->ext_csd.rev); 784 - MMC_DEV_ATTR(pre_eol_info, "%02x\n", card->ext_csd.pre_eol_info); 784 + MMC_DEV_ATTR(pre_eol_info, "0x%02x\n", card->ext_csd.pre_eol_info); 785 785 MMC_DEV_ATTR(life_time, "0x%02x 0x%02x\n", 786 786 card->ext_csd.device_life_time_est_typ_a, 787 787 card->ext_csd.device_life_time_est_typ_b); ··· 791 791 MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size); 792 792 MMC_DEV_ATTR(raw_rpmb_size_mult, "%#x\n", card->ext_csd.raw_rpmb_size_mult); 793 793 MMC_DEV_ATTR(rel_sectors, "%#x\n", card->ext_csd.rel_sectors); 794 - MMC_DEV_ATTR(ocr, "%08x\n", card->ocr); 794 + MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr); 795 795 MMC_DEV_ATTR(cmdq_en, "%d\n", card->ext_csd.cmdq_en); 796 796 797 797 static ssize_t mmc_fwrev_show(struct device *dev,
+1 -1
drivers/mmc/core/sd.c
··· 675 675 MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); 676 676 MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); 677 677 MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); 678 - MMC_DEV_ATTR(ocr, "%08x\n", card->ocr); 678 + MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr); 679 679 680 680 681 681 static ssize_t mmc_dsr_show(struct device *dev,
+14
drivers/mmc/host/sdhci-msm.c
··· 29 29 #define CORE_VERSION_MAJOR_MASK (0xf << CORE_VERSION_MAJOR_SHIFT) 30 30 #define CORE_VERSION_MINOR_MASK 0xff 31 31 32 + #define CORE_MCI_GENERICS 0x70 33 + #define SWITCHABLE_SIGNALING_VOLTAGE BIT(29) 34 + 32 35 #define CORE_HC_MODE 0x78 33 36 #define HC_MODE_EN 0x1 34 37 #define CORE_POWER 0x0 ··· 1031 1028 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 1032 1029 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); 1033 1030 bool done = false; 1031 + u32 val; 1034 1032 1035 1033 pr_debug("%s: %s: request %d curr_pwr_state %x curr_io_level %x\n", 1036 1034 mmc_hostname(host->mmc), __func__, req_type, 1037 1035 msm_host->curr_pwr_state, msm_host->curr_io_level); 1036 + 1037 + /* 1038 + * The power interrupt will not be generated for signal voltage 1039 + * switches if SWITCHABLE_SIGNALING_VOLTAGE in MCI_GENERICS is not set. 1040 + */ 1041 + val = readl(msm_host->core_mem + CORE_MCI_GENERICS); 1042 + if ((req_type & REQ_IO_HIGH || req_type & REQ_IO_LOW) && 1043 + !(val & SWITCHABLE_SIGNALING_VOLTAGE)) { 1044 + return; 1045 + } 1038 1046 1039 1047 /* 1040 1048 * The IRQ for request type IO High/LOW will be generated when -
+19 -11
drivers/mmc/host/sdhci.c
··· 21 21 #include <linux/dma-mapping.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/scatterlist.h> 24 + #include <linux/swiotlb.h> 24 25 #include <linux/regulator/consumer.h> 25 26 #include <linux/pm_runtime.h> 26 27 #include <linux/of.h> ··· 3652 3651 spin_lock_init(&host->lock); 3653 3652 3654 3653 /* 3655 - * Maximum number of segments. Depends on if the hardware 3656 - * can do scatter/gather or not. 3657 - */ 3658 - if (host->flags & SDHCI_USE_ADMA) 3659 - mmc->max_segs = SDHCI_MAX_SEGS; 3660 - else if (host->flags & SDHCI_USE_SDMA) 3661 - mmc->max_segs = 1; 3662 - else /* PIO */ 3663 - mmc->max_segs = SDHCI_MAX_SEGS; 3664 - 3665 - /* 3666 3654 * Maximum number of sectors in one transfer. Limited by SDMA boundary 3667 3655 * size (512KiB). Note some tuning modes impose a 4MiB limit, but this 3668 3656 * is less anyway. 3669 3657 */ 3670 3658 mmc->max_req_size = 524288; 3659 + 3660 + /* 3661 + * Maximum number of segments. Depends on if the hardware 3662 + * can do scatter/gather or not. 3663 + */ 3664 + if (host->flags & SDHCI_USE_ADMA) { 3665 + mmc->max_segs = SDHCI_MAX_SEGS; 3666 + } else if (host->flags & SDHCI_USE_SDMA) { 3667 + mmc->max_segs = 1; 3668 + if (swiotlb_max_segment()) { 3669 + unsigned int max_req_size = (1 << IO_TLB_SHIFT) * 3670 + IO_TLB_SEGSIZE; 3671 + mmc->max_req_size = min(mmc->max_req_size, 3672 + max_req_size); 3673 + } 3674 + } else { /* PIO */ 3675 + mmc->max_segs = SDHCI_MAX_SEGS; 3676 + } 3671 3677 3672 3678 /* 3673 3679 * Maximum segment size. Could be one segment with the maximum number