[edk2-devel] [PATCH] MdeModulePkg/NvmExpressDxe: fix check for Cap.Css

Mara Sophie Grosch via groups.io posted 1 patch 2 years, 1 month ago
Failed in applying to current master (apply log)
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] MdeModulePkg/NvmExpressDxe: fix check for Cap.Css
Posted by Mara Sophie Grosch via groups.io 2 years, 1 month ago
Fix the check for NVMe command set being supported by the controller.

Was problematic with qemu (6.2.0, Debian 1:6.2+dfsg-3), which sets 0xC1
in that register, making the OVMF think the NVMe controller does not
support NVMe.

Uncovered by commit 9dd14fc91c174eae87fd122c7ac70073a363527f, which
changed the number of bits included in the Css register from 4 to 8.

Signed-off-by: Mara Sophie Grosch <littlefox@lf-net.org>
---
  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
index d87212ffb2..b90c48731c 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
@@ -761,7 +761,7 @@ NvmeControllerInit (
      return Status;
    }
  
-  if (Private->Cap.Css != 0x01) {
+  if ((Private->Cap.Css & BIT0) == 0) {
      DEBUG ((DEBUG_INFO, "NvmeControllerInit: the controller doesn't support NVMe command set\n"));
      return EFI_UNSUPPORTED;
    }
-- 
2.35.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87797): https://edk2.groups.io/g/devel/message/87797
Mute This Topic: https://groups.io/mt/89833412/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/NvmExpressDxe: fix check for Cap.Css
Posted by Wu, Hao A 2 years, 1 month ago
The change is good to me.

Could you help to apply this change to the code in MdeModulePkg\Bus\Pci\NvmExpressPei\ as well?
Really sorry for missing the above comment in previous reply.

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Mara
> Sophie Grosch via groups.io
> Sent: Tuesday, March 22, 2022 1:06 AM
> To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/NvmExpressDxe: fix check for
> Cap.Css
> 
> Fix the check for NVMe command set being supported by the controller.
> 
> Was problematic with qemu (6.2.0, Debian 1:6.2+dfsg-3), which sets 0xC1 in that
> register, making the OVMF think the NVMe controller does not support NVMe.
> 
> Uncovered by commit 9dd14fc91c174eae87fd122c7ac70073a363527f, which
> changed the number of bits included in the Css register from 4 to 8.
> 
> Signed-off-by: Mara Sophie Grosch <littlefox@lf-net.org>
> ---
>   MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> index d87212ffb2..b90c48731c 100644
> --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> @@ -761,7 +761,7 @@ NvmeControllerInit (
>       return Status;
>     }
> 
> -  if (Private->Cap.Css != 0x01) {
> +  if ((Private->Cap.Css & BIT0) == 0) {
>       DEBUG ((DEBUG_INFO, "NvmeControllerInit: the controller doesn't support
> NVMe command set\n"));
>       return EFI_UNSUPPORTED;
>     }
> --
> 2.35.1
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87806): https://edk2.groups.io/g/devel/message/87806
Mute This Topic: https://groups.io/mt/89833412/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] MdeModulePkg/NvmExpressDxe: fix check for Cap.Css
Posted by Mara Sophie Grosch via groups.io 2 years, 1 month ago
Will do tomorrow (UTC+1), thanks for reviewing :)

Am 22. März 2022 01:28:45 UTC schrieb "Wu, Hao A" <hao.a.wu@intel.com>:
>The change is good to me.
>
>Could you help to apply this change to the code in MdeModulePkg\Bus\Pci\NvmExpressPei\ as well?
>Really sorry for missing the above comment in previous reply.
>
>Best Regards,
>Hao Wu
>
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Mara
>> Sophie Grosch via groups.io
>> Sent: Tuesday, March 22, 2022 1:06 AM
>> To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>
>> Subject: [edk2-devel] [PATCH] MdeModulePkg/NvmExpressDxe: fix check for
>> Cap.Css
>> 
>> Fix the check for NVMe command set being supported by the controller.
>> 
>> Was problematic with qemu (6.2.0, Debian 1:6.2+dfsg-3), which sets 0xC1 in that
>> register, making the OVMF think the NVMe controller does not support NVMe.
>> 
>> Uncovered by commit 9dd14fc91c174eae87fd122c7ac70073a363527f, which
>> changed the number of bits included in the Css register from 4 to 8.
>> 
>> Signed-off-by: Mara Sophie Grosch <littlefox@lf-net.org>
>> ---
>>   MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
>> b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
>> index d87212ffb2..b90c48731c 100644
>> --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
>> +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
>> @@ -761,7 +761,7 @@ NvmeControllerInit (
>>       return Status;
>>     }
>> 
>> -  if (Private->Cap.Css != 0x01) {
>> +  if ((Private->Cap.Css & BIT0) == 0) {
>>       DEBUG ((DEBUG_INFO, "NvmeControllerInit: the controller doesn't support
>> NVMe command set\n"));
>>       return EFI_UNSUPPORTED;
>>     }
>> --
>> 2.35.1
>> 
>> 
>> 
>> 
>
>
>
>
>
>

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87808): https://edk2.groups.io/g/devel/message/87808
Mute This Topic: https://groups.io/mt/89833412/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-