Topics

[PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.


Zhong, Zarcd <zarcd.zhong@...>
 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Laszlo Ersek
 

On 01/04/21 10:48, Zhong, Zarcd wrote:
From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@intel.com>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail
in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail
in high 32bit.

 

    Cc: Ray Ni <ray.ni@intel.com>

    Cc: Hao A Wu <hao.a.wu@intel.com>


Please post the patch with git-send-email.

Laszlo


Ni, Ray
 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Ni, Ray
 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Zhong, Zarcd <zarcd.zhong@...>
 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Zhong, Zarcd <zarcd.zhong@...>
 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Kim, Andrew <andrew.kim@...>
 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Kim, Andrew <andrew.kim@...>
 

BTW, to be clear for this to try.

Could you confirm if this is right update with your suggestion?

 

 

      if (EFI_ERROR (Status)) {

        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

        return Offset + 4;

      }

 

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 9:38 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...>

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Friday, January 15, 2021 4:11 PM
To: Ni, Ray <ray.ni@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

  Your suggestion for one line patch test PASS.   

 

Attached file is the patch. Please help to review.

 

From: Kim, Andrew <andrew.kim@...>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

It works fine with this Ray’s solution. Customer confirmed it.

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 10:14 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

BTW, to be clear for this to try.

Could you confirm if this is right update with your suggestion?

 

 

      if (EFI_ERROR (Status)) {

        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

        return Offset + 4;

      }

 

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 9:38 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Wu, Hao A
 

Hello,

 

Could you help to follow the suggestion by Laszlo and use the ‘git-send-email’ command rather than attaching the patch file:

https://edk2.groups.io/g/devel/message/69828

 

You can keep the "Reviewed-by" tag by Ray when sending out the patch.

Thanks in advance.

 

Best Regards,

Hao Wu

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Friday, January 15, 2021 4:30 PM
To: Wu, Hao A <hao.a.wu@...>
Cc: Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@...>; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Hao,

 

Please help to review this patch and push it to open source EDKii. Thanks

 

From: Ni, Ray <ray.ni@...>
Sent: Friday, January 15, 2021 4:12 PM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Reviewed-by: Ray Ni <ray.ni@...>

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Friday, January 15, 2021 4:11 PM
To: Ni, Ray <ray.ni@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

  Your suggestion for one line patch test PASS.   

 

Attached file is the patch. Please help to review.

 

From: Kim, Andrew <andrew.kim@...>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

It works fine with this Ray’s solution. Customer confirmed it.

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 10:14 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

BTW, to be clear for this to try.

Could you confirm if this is right update with your suggestion?

 

 

      if (EFI_ERROR (Status)) {

        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

        return Offset + 4;

      }

 

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 9:38 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Kim, Andrew <andrew.kim@...>
 

Hi Zarcd,

 

It works fine with this Ray’s solution. Customer confirmed it.

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 10:14 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

BTW, to be clear for this to try.

Could you confirm if this is right update with your suggestion?

 

 

      if (EFI_ERROR (Status)) {

        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

        return Offset + 4;

      }

 

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 9:38 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Zhong, Zarcd <zarcd.zhong@...>
 

Hi Ray,

 

  Your suggestion for one line patch test PASS.   

 

Attached file is the patch. Please help to review.

 

From: Kim, Andrew <andrew.kim@...>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

It works fine with this Ray’s solution. Customer confirmed it.

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 10:14 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

BTW, to be clear for this to try.

Could you confirm if this is right update with your suggestion?

 

 

      if (EFI_ERROR (Status)) {

        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

        return Offset + 4;

      }

 

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 9:38 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Zhong, Zarcd <zarcd.zhong@...>
 

Hi Hao,

 

Please help to review this patch and push it to open source EDKii. Thanks

 

From: Ni, Ray <ray.ni@...>
Sent: Friday, January 15, 2021 4:12 PM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Reviewed-by: Ray Ni <ray.ni@...>

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Friday, January 15, 2021 4:11 PM
To: Ni, Ray <ray.ni@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

  Your suggestion for one line patch test PASS.   

 

Attached file is the patch. Please help to review.

 

From: Kim, Andrew <andrew.kim@...>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

It works fine with this Ray’s solution. Customer confirmed it.

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 10:14 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

BTW, to be clear for this to try.

Could you confirm if this is right update with your suggestion?

 

 

      if (EFI_ERROR (Status)) {

        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

        return Offset + 4;

      }

 

 

-Andrew

 

From: Kim, Andrew
Sent: Thursday, January 14, 2021 9:38 AM
To: Zhong, Zarcd <zarcd.zhong@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Zarcd,

 

Thanks for this update.

 

Sure, I will let you know once it has been verified.

 

-Andrew

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@...>
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Kim,

 

Ray suggests  a one line patch instead of google’s solution.

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Could you help to verify Ray’s solution on that card?

 

 

 

 

From: Ni, Ray <ray.ni@...>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I may not say very clearly. I prefer to just keep below line. Can you check whether that can work?

+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

Thanks,
Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Hi Ray,

 

Attached patch is updated with below add. Thanks for your remind.

 

PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;

 

 

From: Ni, Ray <ray.ni@...>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

Zarcd,

I can understand that this patch is needed for some buggy pci devices whose
VF bar behaves strangely. Incompatible PCI protocol can only deal with normal
PCI bar. And this patch is just to enhance the error handling logic.

 

Can you please use below code for error handling?

+        PciIoDevice->VfPciBar[BarIndex].BarType     = PciBarTypeUnknown

 

I understand that your change is aligned to existing error handling in the beginning
of PciIovParseVfBar().

But that logic runs before PciIoDevice->VfPciBar[BarIndex].BarType is assigned.

The key is to reset the BarType to PciBarTypeUnknown so that the resource summary
code doesn’t count this bar.

 

Thanks,

Ray

 

From: Zhong, Zarcd <zarcd.zhong@...>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

From 7518212a85269e486d06dcea927a3d34e23372c2 Mon Sep 17 00:00:00 2001

From: Zarcd Zhong <zarcd.zhong@...>

Date: Mon, 4 Jan 2021 17:32:54 +0800

Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

 

    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

 

    Clear length and alignment for low 32bit of MEM64 BAR if sizing fail in high 32bit.

 

    Cc: Ray Ni <ray.ni@...>

    Cc: Hao A Wu <hao.a.wu@...>


Laszlo Ersek
 

Andrew, Zarcd,

if you plan to exchange messages through the list repeatedly and/or over
the longer term, then:

- welcome to the list!

- please do accept the invites that I sent to you guys, and join the
list as actual subscribers. Having to approve your messages one by one
gets old *real fast*.

Thanks
Laszlo


nmd5434 <nmd114@...>
 

From: Zarcd Zhong <zarcd.zhong@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

Address MEM64 BAR in type unknown if sizing fail in high 32bit.

L: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>
---
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 1b64924b7b..a24065e8ba 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1686,6 +1686,7 @@ PciIovParseVfBar (
);

if (EFI_ERROR (Status)) {
+ PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;
return Offset + 4;
}

--
2.16.2.windows.1


Zhong, Zarcd <zarcd.zhong@...>
 

Hi All,

Below mail is sent by GIT send-email. Please help to push it to EDKII. Thanks.

-----Original Message-----
From: nmd5434 <nmd114@sina.com>
Sent: Friday, January 15, 2021 5:34 PM
To: devel@edk2.groups.io
Cc: Zhong, Zarcd <zarcd.zhong@intel.com>
Subject: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.

From: Zarcd Zhong <zarcd.zhong@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3149

Address MEM64 BAR in type unknown if sizing fail in high 32bit.

L: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>
---
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 1b64924b7b..a24065e8ba 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1686,6 +1686,7 @@ PciIovParseVfBar (
);

if (EFI_ERROR (Status)) {
+ PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;
return Offset + 4;
}

--
2.16.2.windows.1