public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
@ 2021-01-04  9:48 Zhong, Zarcd
  2021-01-06 14:27 ` [edk2-devel] " Laszlo Ersek
  2021-01-13  7:01 ` Ni, Ray
  0 siblings, 2 replies; 16+ messages in thread
From: Zhong, Zarcd @ 2021-01-04  9:48 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Ni, Ray, Wu, Hao A


[-- Attachment #1.1: Type: text/plain, Size: 482 bytes --]

>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>

[-- Attachment #1.2: Type: text/html, Size: 2526 bytes --]

[-- Attachment #2: 0001-MdeModulePkg-Bus-Pci-PciBusDxe-Handle-BAR-sizing-fai.patch --]
[-- Type: application/octet-stream, Size: 1482 bytes --]

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 aligment 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>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 1b64924b7b..8a827be268 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1686,6 +1686,16 @@ PciIovParseVfBar (
                 );
 
       if (EFI_ERROR (Status)) {
+        //
+        // Reset length/alignment for low 32bit in MEM64 BAR if sizing fail in high 32bit.
+        //
+        PciIoDevice->VfPciBar[BarIndex].BaseAddress = 0;
+        PciIoDevice->VfPciBar[BarIndex].Length      = 0;
+        PciIoDevice->VfPciBar[BarIndex].Alignment   = 0;
+        //
+        // Decrement the offset to lower 32bit of MEM64 BAR.
+        //
+        PciIoDevice->VfPciBar[BarIndex].Offset = (UINT16) (Offset - 4);
         return Offset + 4;
       }
 
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-04  9:48 [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64 Zhong, Zarcd
@ 2021-01-06 14:27 ` Laszlo Ersek
  2021-01-13  7:01 ` Ni, Ray
  1 sibling, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2021-01-06 14:27 UTC (permalink / raw)
  To: devel, zarcd.zhong; +Cc: Ni, Ray, Wu, Hao A

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-04  9:48 [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64 Zhong, Zarcd
  2021-01-06 14:27 ` [edk2-devel] " Laszlo Ersek
@ 2021-01-13  7:01 ` Ni, Ray
  2021-01-14  2:47   ` Zhong, Zarcd
  1 sibling, 1 reply; 16+ messages in thread
From: Ni, Ray @ 2021-01-13  7:01 UTC (permalink / raw)
  To: Zhong, Zarcd, devel@edk2.groups.io; +Cc: Wu, Hao A, Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

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@intel.com>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 4666 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-13  7:01 ` Ni, Ray
@ 2021-01-14  2:47   ` Zhong, Zarcd
  2021-01-14  5:58     ` Ni, Ray
  0 siblings, 1 reply; 16+ messages in thread
From: Zhong, Zarcd @ 2021-01-14  2:47 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io; +Cc: Wu, Hao A, Kinney, Michael D


[-- Attachment #1.1: Type: text/plain, Size: 2106 bytes --]

Hi Ray,

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

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


From: Ni, Ray <ray.ni@intel.com>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #1.2: Type: text/html, Size: 5840 bytes --]

[-- Attachment #2: 0001-MdeModulePkg-Bus-Pci-PciBusDxe-Handle-BAR-sizing-fai.patch --]
[-- Type: application/octet-stream, Size: 1554 bytes --]

From 6b8c8dfb8a4a3d8358e9065272d2cb24efdc9c57 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 aligment 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>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 1b64924b7b..bf84653ebf 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1686,6 +1686,17 @@ PciIovParseVfBar (
                 );
 
       if (EFI_ERROR (Status)) {
+        //
+        // Reset length/alignment for low 32bit in MEM64 BAR if sizing fail in high 32bit.
+        //
+        PciIoDevice->VfPciBar[BarIndex].BaseAddress = 0;
+        PciIoDevice->VfPciBar[BarIndex].Length      = 0;
+        PciIoDevice->VfPciBar[BarIndex].Alignment   = 0;
+        //
+        // Decrement the offset to lower 32bit of MEM64 BAR.
+        //
+        PciIoDevice->VfPciBar[BarIndex].Offset = (UINT16) (Offset - 4);
+        PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;
         return Offset + 4;
       }
 
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-14  2:47   ` Zhong, Zarcd
@ 2021-01-14  5:58     ` Ni, Ray
  2021-01-14  6:31       ` Zhong, Zarcd
  0 siblings, 1 reply; 16+ messages in thread
From: Ni, Ray @ 2021-01-14  5:58 UTC (permalink / raw)
  To: Zhong, Zarcd, devel@edk2.groups.io; +Cc: Wu, Hao A, Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 2777 bytes --]

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@intel.com>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 7203 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-14  5:58     ` Ni, Ray
@ 2021-01-14  6:31       ` Zhong, Zarcd
  2021-01-14 17:37         ` Kim, Andrew
  0 siblings, 1 reply; 16+ messages in thread
From: Zhong, Zarcd @ 2021-01-14  6:31 UTC (permalink / raw)
  To: Kim, Andrew; +Cc: Wu, Hao A, Kinney, Michael D, devel@edk2.groups.io, Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 3459 bytes --]

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@intel.com>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 8661 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-14  6:31       ` Zhong, Zarcd
@ 2021-01-14 17:37         ` Kim, Andrew
  2021-01-14 18:13           ` Kim, Andrew
  0 siblings, 1 reply; 16+ messages in thread
From: Kim, Andrew @ 2021-01-14 17:37 UTC (permalink / raw)
  To: Zhong, Zarcd; +Cc: Wu, Hao A, Kinney, Michael D, devel@edk2.groups.io, Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 4077 bytes --]

Hi Zarcd,

Thanks for this update.

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

-Andrew

From: Zhong, Zarcd <zarcd.zhong@intel.com>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 9914 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-14 17:37         ` Kim, Andrew
@ 2021-01-14 18:13           ` Kim, Andrew
  2021-01-15  7:52             ` Kim, Andrew
  2021-01-15  9:00             ` [edk2-devel] " Laszlo Ersek
  0 siblings, 2 replies; 16+ messages in thread
From: Kim, Andrew @ 2021-01-14 18:13 UTC (permalink / raw)
  To: Zhong, Zarcd; +Cc: Wu, Hao A, Kinney, Michael D, devel@edk2.groups.io, Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 4853 bytes --]

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@intel.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 11689 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-14 18:13           ` Kim, Andrew
@ 2021-01-15  7:52             ` Kim, Andrew
  2021-01-15  8:10               ` Zhong, Zarcd
  2021-01-15  9:00             ` [edk2-devel] " Laszlo Ersek
  1 sibling, 1 reply; 16+ messages in thread
From: Kim, Andrew @ 2021-01-15  7:52 UTC (permalink / raw)
  To: Zhong, Zarcd; +Cc: Wu, Hao A, Kinney, Michael D, devel@edk2.groups.io, Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 5430 bytes --]

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@intel.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 12833 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-15  7:52             ` Kim, Andrew
@ 2021-01-15  8:10               ` Zhong, Zarcd
  2021-01-15  8:11                 ` Ni, Ray
  0 siblings, 1 reply; 16+ messages in thread
From: Zhong, Zarcd @ 2021-01-15  8:10 UTC (permalink / raw)
  To: Ni, Ray; +Cc: Wu, Hao A, Kinney, Michael D, devel@edk2.groups.io, Kim, Andrew


[-- Attachment #1.1: Type: text/plain, Size: 6053 bytes --]

Hi Ray,

  Your suggestion for one line patch test PASS.

Attached file is the patch. Please help to review.

From: Kim, Andrew <andrew.kim@intel.com>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #1.2: Type: text/html, Size: 14053 bytes --]

[-- Attachment #2: 0001-MdeModulePkg-Bus-Pci-PciBusDxe-Handle-BAR-sizing-fai.patch --]
[-- Type: application/octet-stream, Size: 1062 bytes --]

From d80fd690e67d08991037b717cd766aebd1996502 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

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

    Cc: Ray Ni <ray.ni@intel.com>
    Cc: Hao A Wu <hao.a.wu@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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-15  8:10               ` Zhong, Zarcd
@ 2021-01-15  8:11                 ` Ni, Ray
  2021-01-15  8:30                   ` Zhong, Zarcd
  0 siblings, 1 reply; 16+ messages in thread
From: Ni, Ray @ 2021-01-15  8:11 UTC (permalink / raw)
  To: Zhong, Zarcd
  Cc: Wu, Hao A, Kinney, Michael D, devel@edk2.groups.io, Kim, Andrew

[-- Attachment #1: Type: text/plain, Size: 6631 bytes --]

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

From: Zhong, Zarcd <zarcd.zhong@intel.com>
Sent: Friday, January 15, 2021 4:11 PM
To: Ni, Ray <ray.ni@intel.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io; Kim, Andrew <andrew.kim@intel.com>
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@intel.com<mailto:andrew.kim@intel.com>>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 15160 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-15  8:11                 ` Ni, Ray
@ 2021-01-15  8:30                   ` Zhong, Zarcd
  2021-01-15  8:36                     ` Wu, Hao A
  0 siblings, 1 reply; 16+ messages in thread
From: Zhong, Zarcd @ 2021-01-15  8:30 UTC (permalink / raw)
  To: Wu, Hao A; +Cc: Kinney, Michael D, devel@edk2.groups.io, Kim, Andrew, Ni, Ray


[-- Attachment #1.1: Type: text/plain, Size: 7280 bytes --]

Hi Hao,

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

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

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

From: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Friday, January 15, 2021 4:11 PM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
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@intel.com<mailto:andrew.kim@intel.com>>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #1.2: Type: text/html, Size: 16317 bytes --]

[-- Attachment #2: 0001-MdeModulePkg-Bus-Pci-PciBusDxe-Handle-BAR-sizing-fai.patch --]
[-- Type: application/octet-stream, Size: 1062 bytes --]

From d80fd690e67d08991037b717cd766aebd1996502 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

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

    Cc: Ray Ni <ray.ni@intel.com>
    Cc: Hao A Wu <hao.a.wu@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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-15  8:30                   ` Zhong, Zarcd
@ 2021-01-15  8:36                     ` Wu, Hao A
  0 siblings, 0 replies; 16+ messages in thread
From: Wu, Hao A @ 2021-01-15  8:36 UTC (permalink / raw)
  To: Zhong, Zarcd, devel@edk2.groups.io, Laszlo Ersek
  Cc: Kinney, Michael D, devel@edk2.groups.io, Kim, Andrew, Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 8118 bytes --]

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

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

From: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Friday, January 15, 2021 4:11 PM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
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@intel.com<mailto:andrew.kim@intel.com>>
Sent: Friday, January 15, 2021 3:53 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Wednesday, January 13, 2021 10:32 PM
To: Kim, Andrew <andrew.kim@intel.com<mailto:andrew.kim@intel.com>>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Thursday, January 14, 2021 1:59 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Thursday, January 14, 2021 10:48 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 13, 2021 3:01 PM
To: Zhong, Zarcd <zarcd.zhong@intel.com<mailto:zarcd.zhong@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
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@intel.com<mailto:zarcd.zhong@intel.com>>
Sent: Monday, January 4, 2021 5:48 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
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@intel.com<mailto: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<mailto:ray.ni@intel.com>>
    Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

[-- Attachment #2: Type: text/html, Size: 18166 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-14 18:13           ` Kim, Andrew
  2021-01-15  7:52             ` Kim, Andrew
@ 2021-01-15  9:00             ` Laszlo Ersek
  1 sibling, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2021-01-15  9:00 UTC (permalink / raw)
  To: devel, andrew.kim, Zhong, Zarcd; +Cc: Wu, Hao A, Kinney, Michael D, Ni, Ray

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
       [not found] <3149>
@ 2021-01-15  9:34 ` nmd5434
  2021-01-15  9:39   ` Zhong, Zarcd
  0 siblings, 1 reply; 16+ messages in thread
From: nmd5434 @ 2021-01-15  9:34 UTC (permalink / raw)
  To: devel; +Cc: Zarcd Zhong

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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64.
  2021-01-15  9:34 ` nmd5434
@ 2021-01-15  9:39   ` Zhong, Zarcd
  0 siblings, 0 replies; 16+ messages in thread
From: Zhong, Zarcd @ 2021-01-15  9:39 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Ni, Ray, Wu, Hao A

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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-01-15  9:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-04  9:48 [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Handle BAR sizing fail in high 32bit of MEM64 Zhong, Zarcd
2021-01-06 14:27 ` [edk2-devel] " Laszlo Ersek
2021-01-13  7:01 ` Ni, Ray
2021-01-14  2:47   ` Zhong, Zarcd
2021-01-14  5:58     ` Ni, Ray
2021-01-14  6:31       ` Zhong, Zarcd
2021-01-14 17:37         ` Kim, Andrew
2021-01-14 18:13           ` Kim, Andrew
2021-01-15  7:52             ` Kim, Andrew
2021-01-15  8:10               ` Zhong, Zarcd
2021-01-15  8:11                 ` Ni, Ray
2021-01-15  8:30                   ` Zhong, Zarcd
2021-01-15  8:36                     ` Wu, Hao A
2021-01-15  9:00             ` [edk2-devel] " Laszlo Ersek
     [not found] <3149>
2021-01-15  9:34 ` nmd5434
2021-01-15  9:39   ` Zhong, Zarcd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox