<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/drivers/mmc/core/mmc_ops.c, branch jd/unified-crypt-queue</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/drivers/mmc/core/mmc_ops.c?h=jd%2Funified-crypt-queue</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/drivers/mmc/core/mmc_ops.c?h=jd%2Funified-crypt-queue'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2020-03-26T13:45:31Z</updated>
<entry>
<title>mmc: core: Re-work the code for eMMC sanitize</title>
<updated>2020-03-26T13:45:31Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-03-16T15:21:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=55c2b8b9a383487f4f083f62d163fe3278fece1a'/>
<id>urn:sha1:55c2b8b9a383487f4f083f62d163fe3278fece1a</id>
<content type='text'>
The error path for sanitize operations that completes with -ETIMEDOUT, is
tightly coupled with the internal request handling code of the core. More
precisely, mmc_wait_for_req_done() checks for specific sanitize errors.
This is not only inefficient as it affects all types of requests, but also
hackish.

Therefore, let's improve the behaviour by moving the error path out of the
mmc core. To do that, retuning needs to be held while running the sanitize
operation.

Moreover, to avoid exporting unnecessary symbols to the mmc block module,
let's move the code into the mmc_ops.c file. While updating the actual
code, let's also take the opportunity to clean up some of the mess around
it.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Link: https://lore.kernel.org/r/20200316152152.15122-1-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Fixup support for HW busy detection for HPI commands</title>
<updated>2020-03-24T13:35:40Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:48Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=892bf1001459fc38c7e9bc248633681ca628e614'/>
<id>urn:sha1:892bf1001459fc38c7e9bc248633681ca628e614</id>
<content type='text'>
In case the host specify a max_busy_timeout, we need to validate that the
needed timeout for the HPI command conforms to that requirement. If that's
not the case, let's convert from a R1B response to a R1 response, as to
instruct the host to avoid HW busy detection.

Additionally, when R1B is used we must also inform the host about the busy
timeout for the command, so let's do that via updating cmd.busy_timeout.

Finally, when R1B is used and in case the host supports HW busy detection,
there should be no need for doing polling, so then skip that.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-12-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Convert to mmc_poll_for_busy() for HPI commands</title>
<updated>2020-03-24T13:35:40Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:47Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=490ff95f8e2c89d7541f187bae78d340b20d0ef0'/>
<id>urn:sha1:490ff95f8e2c89d7541f187bae78d340b20d0ef0</id>
<content type='text'>
Rather than open coding the polling loop in mmc_interrupt_hpi(), let's
convert to use mmc_poll_for_busy().

Note that, moving to mmc_poll_for_busy() for HPI also improves the
behaviour according to below.

- Adds support for polling via the optional -&gt;card_busy() host ops.
- Require R1_READY_FOR_DATA to be set in the CMD13 response before exiting
  the polling loop.
- Adds a throttling mechanism to avoid CPU hogging when polling.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-11-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Drop redundant out-parameter to mmc_send_hpi_cmd()</title>
<updated>2020-03-24T13:35:40Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=9f94d04752ad6bf6a704637c61590fe55c4c0d82'/>
<id>urn:sha1:9f94d04752ad6bf6a704637c61590fe55c4c0d82</id>
<content type='text'>
The 'u32 *status' is unused by the caller, so let's drop it.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-10-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Convert to mmc_poll_for_busy() for erase/trim/discard</title>
<updated>2020-03-24T13:35:40Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:45Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=0d84c3e6a5b2cd4ddd68b7ef7cf7c2dafd5146ef'/>
<id>urn:sha1:0d84c3e6a5b2cd4ddd68b7ef7cf7c2dafd5146ef</id>
<content type='text'>
Rather than open coding the polling loop in mmc_do_erase(), let's convert
to use mmc_poll_for_busy().

To allow a slightly different error parsing during polling, compared to the
__mmc_switch() case, a new in-parameter to mmc_poll_for_busy() is needed,
but other than that the conversion is straight forward.

Besides addressing the open coding issue, moving to mmc_poll_for_busy() for
erase/trim/discard improves the behaviour according to below.

- Adds support for polling via the optional -&gt;card_busy() host ops.
- Returns zero to indicate success when the final polling attempt finds the
  card non-busy, even if the timeout expired.
- Exits the polling loop when state moves to R1_STATE_TRAN, rather than
  when leaving R1_STATE_PRG.
- Decreases the starting range for throttling to 32-64us.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-9-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Update CMD13 busy check for CMD6 commands</title>
<updated>2020-03-24T13:35:39Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=2a1c7cda52b7b9db50086a40654dc5c03fca866f'/>
<id>urn:sha1:2a1c7cda52b7b9db50086a40654dc5c03fca866f</id>
<content type='text'>
Through mmc_poll_for_busy() a CMD13 may be sent to get the status of the
(e)MMC card. If the state of the card is R1_STATE_PRG, the card is
considered as being busy, which means we continue to poll with CMD13. This
seems to be sufficient, but it's also unnecessary fragile, as it means a
new command/request could potentially be sent to the card when it's in an
unknown state.

To try to improve the situation, but also to move towards a more consistent
CMD13 polling behaviour in the mmc core, let's deploy the same policy we
use for regular I/O write requests. In other words, let's check that card
returns to the R1_STATE_TRAN and that the R1_READY_FOR_DATA bit is set in
the CMD13 response, before exiting the polling loop.

Note that, potentially this changed behaviour could lead to unnecessary
waiting for the timeout to expire, if the card for some reason, moves to an
unexpected error state. However, as we bail out from the polling loop when
R1_SWITCH_ERROR bit is set or when the CMD13 fails, this shouldn't be an
issue.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-8-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Split up mmc_poll_for_busy()</title>
<updated>2020-03-24T13:35:39Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=6972096a03ae40f1365d2829f92fd19202b2b326'/>
<id>urn:sha1:6972096a03ae40f1365d2829f92fd19202b2b326</id>
<content type='text'>
To make the code more readable, move the part that gets the busy status of
the card out into a separate function, mmc_busy_status(). Then call it from
mmc_poll_for_busy().

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-6-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Drop redundant in-parameter to __mmc_switch()</title>
<updated>2020-03-24T13:35:39Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=02098ccdd823b598e92508918e20b37a1169df42'/>
<id>urn:sha1:02098ccdd823b598e92508918e20b37a1169df42</id>
<content type='text'>
The use_busy_signal in-parameter is set true by all callers of
__mmc_switch(), hence it's redundant so drop it.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-5-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Extend mmc_switch_status() to rid of __mmc_switch_status()</title>
<updated>2020-03-24T13:35:39Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=60db8a47497d5e44e4227c9957dae9a2dc72389b'/>
<id>urn:sha1:60db8a47497d5e44e4227c9957dae9a2dc72389b</id>
<content type='text'>
To simplify code, let's extend mmc_switch_status() to cope with needs
addressed in __mmc_switch_status(). Then move all users to the updated
mmc_switch_status() API and drop __mmc_switch_status() altogether.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-4-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Drop unused define</title>
<updated>2020-03-24T13:35:39Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2020-02-04T08:54:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=ebd4f4bd01a97db44971762ff7a876c06c9b605f'/>
<id>urn:sha1:ebd4f4bd01a97db44971762ff7a876c06c9b605f</id>
<content type='text'>
The last user of MMC_OPS_TIMEOUT_MS was recently removed, however the
define stayed around. Let's remove it.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Tested-by: Baolin Wang &lt;baolin.wang7@gmail.com&gt;
Tested-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Reviewed-by: Ludovic Barre &lt;ludovic.barre@st.com&gt;
Link: https://lore.kernel.org/r/20200204085449.32585-3-ulf.hansson@linaro.org
</content>
</entry>
</feed>
