Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2025 20:39:10 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        j_yoon.choi@samsung.com
Cc:        "freebsd-hackers@FreeBSD.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Universal Flash Storage Driver Proposal
Message-ID:  <CANCZdfppZRLd3v=6jrBiCHdZUa8ixEfzE2CxmB6Ktx%2BTHHqbiQ@mail.gmail.com>
In-Reply-To: <20250314052853epcms2p77524d50719009d62188486032c30f6c5@epcms2p7>
References:  <CGME20250314052853epcms2p77524d50719009d62188486032c30f6c5@epcms2p7> <20250314052853epcms2p77524d50719009d62188486032c30f6c5@epcms2p7>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Thu, Mar 13, 2025 at 11:28 PM Jaeyoon Choi <j_yoon.choi@samsung.com>
wrote:

> Hi Warner,
> I'm back in the office :).
>
> > I've been studying UMASS and have a different idea. I'm starting to not
> > like the PIM flags
> > now that I've read it.
> >
> > There's about a dozen commands that different USB flash devices can't do
> in
> > various ways.
> > I've started to convert umass to just fail the command as illegal when a
> > bad command is
> > sent to it. I've also been modifying the da, cd, etc drivers to notice
> the
> > illegal commands and
> > modify its behavior. It isn't a new idea: the periph drivers have been
> > doing it to cope with
> > drives that don't support READ(6) commands. It's recently (in the last 5
> > years) expanded to
> > dealing with other commands like SYNCHRONIZE CACHE, MODE SENSE.
> >
> > The idea is to allow the device to reject the command as illegal. In the
> > cases of reduced SCSI
> > command sets, like RBC, UFS, etc the SIM should reject known bad commands
> > at the SIM
> > layer because history has shown that some of the
> > lower-quality-but-still-working-enough drives
> > can hang when unexpected commands are sent to them.
> >
> > Not supporting MODE SENSE(6) likely is going to be a somewhat larger
> change.
>
> I will follow up on your UMASS modification.
> And if you give me a guide, I'll follow it
>

Yes. Changing MODE SENSE(6) to MODE SENSE(10) likely will cause problems
with some completion routines, but that's fixable.

I'm about to commit a number of changes that will show how to 'reject'
commands
properly.


> > Test how? I'm not sure I understand this question well enough to answer,
> > so maybe a few examples will help me focus an answer.
>
> I was wondering how you do unit tests and integration tests for device
> drivers.
> Is there a framework to write unit tests when developing a device driver?
> Is there any tool you use for Integration test (e.g. FIO(flexible I/O
> tester))
> (I'm a FreeBSD newbie, so please forgive me if this is a stupid question).
>

FIO would work. It will do the basic I/O. But it destroys the data on the
drive.
For testing purposes, though, it's fine.


> > In the mean time, I'll see if I can locate a copy of the UFS standard
> > or a reasonable summary. The ones at jedec.org are a bit too expensive
> > for me to buy on my own. I've found excerpts of it datasheets at best,
> which
> > may suffice for my review needs.
>
> If you register with JEDEC, you can get the documentation for UFS 2.1
> version
> for free, although it is not the latest spec.
> There are two documents to look at for the UFS specification.
> UFSHCI, which is the host interface, and UFS, which is the device.
> - UFS 2.1 spec: https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf
> - UFSHCI 2.1 spec:
> https://www.jedec.org/sites/default/files/docs/JESD223C.pdf


I've grabbed these. Thanks. I also found some vague command lists for newer
versions in data sheets.

My implementation will be based on UFS 4.1, but the basics are the same.
> The main differences between UFS 2.1 and 4.1 are as follows
> - I/O queue changed from single queue to multi-queue
> - Maximum HS-GEAR changed from 3 -> 5, which improves bandwidth
> - Supports Write Booster (SLC caching)
> - Supports Host Performance Booster (HPB)
>
> I will explain the specification changes when I request a review of the
> features added in UFS 4.1.
>

Great! That would be perfect. The last two look interesting...

Warner


> Thanks,
> Jaeyoon
>

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Mar 13, 2025 at 11:28 PM Jaeyoon Choi &lt;<a href="mailto:j_yoon.choi@samsung.com">j_yoon.choi@samsung.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Warner,<br>
I&#39;m back in the office :).<br>
<br>
&gt; I&#39;ve been studying UMASS and have a different idea. I&#39;m starting to not<br>
&gt; like the PIM flags<br>
&gt; now that I&#39;ve read it.<br>
&gt; <br>
&gt; There&#39;s about a dozen commands that different USB flash devices can&#39;t do in<br>
&gt; various ways.<br>
&gt; I&#39;ve started to convert umass to just fail the command as illegal when a<br>
&gt; bad command is<br>
&gt; sent to it. I&#39;ve also been modifying the da, cd, etc drivers to notice the<br>
&gt; illegal commands and<br>
&gt; modify its behavior. It isn&#39;t a new idea: the periph drivers have been<br>
&gt; doing it to cope with<br>
&gt; drives that don&#39;t support READ(6) commands. It&#39;s recently (in the last 5<br>
&gt; years) expanded to<br>
&gt; dealing with other commands like SYNCHRONIZE CACHE, MODE SENSE.<br>
&gt; <br>
&gt; The idea is to allow the device to reject the command as illegal. In the<br>
&gt; cases of reduced SCSI<br>
&gt; command sets, like RBC, UFS, etc the SIM should reject known bad commands<br>
&gt; at the SIM<br>
&gt; layer because history has shown that some of the<br>
&gt; lower-quality-but-still-working-enough drives<br>
&gt; can hang when unexpected commands are sent to them.<br>
&gt; <br>
&gt; Not supporting MODE SENSE(6) likely is going to be a somewhat larger change.<br>
<br>
I will follow up on your UMASS modification.<br>
And if you give me a guide, I&#39;ll follow it<br></blockquote><div><br></div><div>Yes. Changing MODE SENSE(6) to MODE SENSE(10) likely will cause problems</div><div>with some completion routines, but that&#39;s fixable.</div><div><br></div><div>I&#39;m about to commit a number of changes that will show how to &#39;reject&#39; commands</div><div>properly.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; Test how? I&#39;m not sure I understand this question well enough to answer,<br>
&gt; so maybe a few examples will help me focus an answer.<br>
<br>
I was wondering how you do unit tests and integration tests for device drivers.<br>
Is there a framework to write unit tests when developing a device driver?<br>
Is there any tool you use for Integration test (e.g. FIO(flexible I/O tester))<br>
(I&#39;m a FreeBSD newbie, so please forgive me if this is a stupid question).<br></blockquote><div><br></div><div>FIO would work. It will do the basic I/O. But it destroys the data on the drive.</div><div>For testing purposes, though, it&#39;s fine.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; In the mean time, I&#39;ll see if I can locate a copy of the UFS standard<br>
&gt; or a reasonable summary. The ones at <a href="http://jedec.org" rel="noreferrer" target="_blank">jedec.org</a> are a bit too expensive<br>
&gt; for me to buy on my own. I&#39;ve found excerpts of it datasheets at best, which<br>
&gt; may suffice for my review needs.<br>
<br>
If you register with JEDEC, you can get the documentation for UFS 2.1 version <br>
for free, although it is not the latest spec.<br>
There are two documents to look at for the UFS specification. <br>
UFSHCI, which is the host interface, and UFS, which is the device.<br>
- UFS 2.1 spec: <a href="https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf" rel="noreferrer" target="_blank">https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf</a><br>;
- UFSHCI 2.1 spec: <a href="https://www.jedec.org/sites/default/files/docs/JESD223C.pdf" rel="noreferrer" target="_blank">https://www.jedec.org/sites/default/files/docs/JESD223C.pdf</a></blockquote><div><br></div><div>I&#39;ve grabbed these. Thanks. I also found some vague command lists for newer</div><div>versions in data sheets.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
My implementation will be based on UFS 4.1, but the basics are the same.<br>
The main differences between UFS 2.1 and 4.1 are as follows<br>
- I/O queue changed from single queue to multi-queue<br>
- Maximum HS-GEAR changed from 3 -&gt; 5, which improves bandwidth<br>
- Supports Write Booster (SLC caching)<br>
- Supports Host Performance Booster (HPB)<br>
<br>
I will explain the specification changes when I request a review of the<br>
features added in UFS 4.1.<br></blockquote><div><br></div><div>Great! That would be perfect. The last two look interesting...</div><div><br></div><div>Warner</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks,<br>
Jaeyoon<br>
</blockquote></div></div>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfppZRLd3v=6jrBiCHdZUa8ixEfzE2CxmB6Ktx%2BTHHqbiQ>