public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Haojian Zhuang <haojian.zhuang@linaro.org>,
	hao.a.wu@intel.com, feng.tian@intel.com,
	leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	edk2-devel@lists.01.org
Subject: Re: [PATCH] MdeModulePkg: ScsiDiskDxe: fix to support EFI_ERASE_BLOCK_PROTOCOL
Date: Tue, 18 Apr 2017 17:03:04 +0200	[thread overview]
Message-ID: <ca8cc1d0-ae44-f871-6961-bfacfbf2d6cb@redhat.com> (raw)
In-Reply-To: <1492263886-17209-1-git-send-email-haojian.zhuang@linaro.org>



On 15/04/2017 15:44, Haojian Zhuang wrote:
> If bit TPZ and bit TPRZ are set, the erase feature is implemented.
> If bit TPZ is set and bit TPRZ is clear, the discard feature is
> implemented. And discard is a non-secure variant of the erase
> functionality.
> 
> So the detecting operation of EFI_ERASE_BLOCK_PROTOCOL, we should
> consider to support both functionality. Since discard functionality is
> only supported in some UFS devices.
> 
> And both of these two features are relied on UNMAP command.

Hi,

you need to use WRITE SAME, with a zero payload and the UNMAP bit set in
the command descriptor, in order to achieve a "secure" erase
functionality.  UNMAP is only an advisory command, and does not
guarantee that the blocks are unmapped.

Discard can use either WRITE SAME or UNMAP.

Also,

>      // Bits TPE and TPRZ should both be set to enable the erase feature on UFS.
> +    // Setting bit TPE and clearing bit TPRZ to enable the discard feature on UFS.
>      //
> -    if (((CapacityData16->LowestAlignLogic2 & BIT7) == 0) ||
> -        ((CapacityData16->LowestAlignLogic2 & BIT6) == 0)) {
> +    if ((CapacityData16->LowestAlignLogic2 & BIT7) == 0) {
>        DEBUG ((
>          EFI_D_VERBOSE,
>          "ScsiDisk EraseBlock: Either TPE or TPRZ is not set: 0x%x.\n",

The debug message is now wrong.

Paolo


      parent reply	other threads:[~2017-04-18 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-15 13:44 [PATCH] MdeModulePkg: ScsiDiskDxe: fix to support EFI_ERASE_BLOCK_PROTOCOL Haojian Zhuang
2017-04-17  1:58 ` Wu, Hao A
2017-04-17 14:03   ` Haojian Zhuang
2017-04-18 13:06     ` Wu, Hao A
2017-04-18 13:17       ` Haojian Zhuang
2017-04-18 15:03 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca8cc1d0-ae44-f871-6961-bfacfbf2d6cb@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox