tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
queue-4.19
head: 49ada0390dee8e4db4da2ebcbc0b63e2d177c169
commit: 5402de18b5c1d78b413cb87aee997b95db5ec1e2 [8/35] mmc: core: Respect
MMC_CAP_NEED_RSP_BUSY for erase/trim/discard
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.2.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5402de18b5c1d78b413cb87aee997b95db5ec1e2
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
Note: the sashal-linux-stable/queue-4.19 HEAD 49ada0390dee8e4db4da2ebcbc0b63e2d177c169
builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
drivers/mmc/core/core.c: In function 'mmc_do_erase':
> drivers/mmc/core/core.c:2049:27: error:
'MMC_CAP_NEED_RSP_BUSY' undeclared (first use in this function); did you mean
'MMC_CAP_NEEDS_POLL'?
2049 | if (!(card->host->caps &
MMC_CAP_NEED_RSP_BUSY) &&
| ^~~~~~~~~~~~~~~~~~~~~
| MMC_CAP_NEEDS_POLL
drivers/mmc/core/core.c:2049:27: note: each undeclared identifier is reported only once
for each function it appears in
vim +2049 drivers/mmc/core/core.c
1965
1966 static int mmc_do_erase(struct mmc_card *card, unsigned int from,
1967 unsigned int to, unsigned int arg)
1968 {
1969 struct mmc_command cmd = {};
1970 unsigned int qty = 0, busy_timeout = 0;
1971 bool use_r1b_resp = false;
1972 unsigned long timeout;
1973 int loop_udelay=64, udelay_max=32768;
1974 int err;
1975
1976 mmc_retune_hold(card->host);
1977
1978 /*
1979 * qty is used to calculate the erase timeout which depends on how many
1980 * erase groups (or allocation units in SD terminology) are affected.
1981 * We count erasing part of an erase group as one erase group.
1982 * For SD, the allocation units are always a power of 2. For MMC, the
1983 * erase group size is almost certainly also power of 2, but it does not
1984 * seem to insist on that in the JEDEC standard, so we fall back to
1985 * division in that case. SD may not specify an allocation unit size,
1986 * in which case the timeout is based on the number of write blocks.
1987 *
1988 * Note that the timeout for secure trim 2 will only be correct if the
1989 * number of erase groups specified is the same as the total of all
1990 * preceding secure trim 1 commands. Since the power may have been
1991 * lost since the secure trim 1 commands occurred, it is generally
1992 * impossible to calculate the secure trim 2 timeout correctly.
1993 */
1994 if (card->erase_shift)
1995 qty += ((to >> card->erase_shift) -
1996 (from >> card->erase_shift)) + 1;
1997 else if (mmc_card_sd(card))
1998 qty += to - from + 1;
1999 else
2000 qty += ((to / card->erase_size) -
2001 (from / card->erase_size)) + 1;
2002
2003 if (!mmc_card_blockaddr(card)) {
2004 from <<= 9;
2005 to <<= 9;
2006 }
2007
2008 if (mmc_card_sd(card))
2009 cmd.opcode = SD_ERASE_WR_BLK_START;
2010 else
2011 cmd.opcode = MMC_ERASE_GROUP_START;
2012 cmd.arg = from;
2013 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
2014 err = mmc_wait_for_cmd(card->host, &cmd, 0);
2015 if (err) {
2016 pr_err("mmc_erase: group start error %d, "
2017 "status %#x\n", err, cmd.resp[0]);
2018 err = -EIO;
2019 goto out;
2020 }
2021
2022 memset(&cmd, 0, sizeof(struct mmc_command));
2023 if (mmc_card_sd(card))
2024 cmd.opcode = SD_ERASE_WR_BLK_END;
2025 else
2026 cmd.opcode = MMC_ERASE_GROUP_END;
2027 cmd.arg = to;
2028 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
2029 err = mmc_wait_for_cmd(card->host, &cmd, 0);
2030 if (err) {
2031 pr_err("mmc_erase: group end error %d, status %#x\n",
2032 err, cmd.resp[0]);
2033 err = -EIO;
2034 goto out;
2035 }
2036
2037 memset(&cmd, 0, sizeof(struct mmc_command));
2038 cmd.opcode = MMC_ERASE;
2039 cmd.arg = arg;
2040 busy_timeout = mmc_erase_timeout(card, arg, qty);
2041 /*
2042 * If the host controller supports busy signalling and the timeout for
2043 * the erase operation does not exceed the max_busy_timeout, we should
2044 * use R1B response. Or we need to prevent the host from doing hw busy
2045 * detection, which is done by converting to a R1 response instead.
2046 * Note, some hosts requires R1B, which also means they are on their own
2047 * when it comes to deal with the busy timeout.
2048 */
2049 if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY)
&&
2050 card->host->max_busy_timeout &&
2051 busy_timeout > card->host->max_busy_timeout) {
2052 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
2053 } else {
2054 cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
2055 cmd.busy_timeout = busy_timeout;
2056 use_r1b_resp = true;
2057 }
2058
2059 err = mmc_wait_for_cmd(card->host, &cmd, 0);
2060 if (err) {
2061 pr_err("mmc_erase: erase error %d, status %#x\n",
2062 err, cmd.resp[0]);
2063 err = -EIO;
2064 goto out;
2065 }
2066
2067 if (mmc_host_is_spi(card->host))
2068 goto out;
2069
2070 /*
2071 * In case of when R1B + MMC_CAP_WAIT_WHILE_BUSY is used, the polling
2072 * shall be avoided.
2073 */
2074 if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) &&
use_r1b_resp)
2075 goto out;
2076
2077 timeout = jiffies + msecs_to_jiffies(busy_timeout);
2078 do {
2079 memset(&cmd, 0, sizeof(struct mmc_command));
2080 cmd.opcode = MMC_SEND_STATUS;
2081 cmd.arg = card->rca << 16;
2082 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
2083 /* Do not retry else we can't see errors */
2084 err = mmc_wait_for_cmd(card->host, &cmd, 0);
2085 if (err || R1_STATUS(cmd.resp[0])) {
2086 pr_err("error %d requesting status %#x\n",
2087 err, cmd.resp[0]);
2088 err = -EIO;
2089 goto out;
2090 }
2091
2092 /* Timeout if the device never becomes ready for data and
2093 * never leaves the program state.
2094 */
2095 if (time_after(jiffies, timeout)) {
2096 pr_err("%s: Card stuck in programming state! %s\n",
2097 mmc_hostname(card->host), __func__);
2098 err = -EIO;
2099 goto out;
2100 }
2101 if ((cmd.resp[0] & R1_READY_FOR_DATA) &&
2102 R1_CURRENT_STATE(cmd.resp[0]) != R1_STATE_PRG)
2103 break;
2104
2105 usleep_range(loop_udelay, loop_udelay*2);
2106 if (loop_udelay < udelay_max)
2107 loop_udelay *= 2;
2108 } while (1);
2109
2110 out:
2111 mmc_retune_release(card->host);
2112 return err;
2113 }
2114
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org