fpga: dfl: afu: update initialization of port_hdr driver
Subsystems (2)
PATCH 1/1 fpga: dfl: afu: update initialization of port_hdr driver
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact, performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different PCIe Physical Function (PF) than the management PF performing the actual port reset.
--- drivers/fpga/dfl-afu-main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/fpga/dfl-afu-main.c +12 -1
@@ -417,7 +417,18 @@ static const struct attribute_group port_hdr_group = {static int port_hdr_init (struct platform_device *pdev,struct dfl_feature *feature) { -port_reset (pdev); +void __iomem *base; +u8 rev; + + base =dfl_get_feature_ioaddr_by_id (&pdev->dev,PORT_FEATURE_ID_HEADER ); + + rev =dfl_feature_revision (base); + +if (rev <2 ) +port_reset (pdev); + +if (rev >2 ) +dev_info (&pdev->dev,"unexpected port feature revision, %u\n" , rev);return 0 ; }
Signature · 1 line
2.34.1
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
Quoted 2 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
Thanks,
Yilun
Quoted 19 lines
PCIe Physical Function (PF) than the management PF performing the actual port reset.
Signed-off-by Matthew Gerlach <[email protected]>--- drivers/fpga/dfl-afu-main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/fpga/dfl-afu-main.c +2
-1@@ -417,7 +417,18 @@ static const struct attribute_group port_hdr_group = {static int port_hdr_init (struct platform_device *pdev,struct dfl_feature *feature) { -port_reset (pdev); +void __iomem *base; +u8 rev;
drivers/fpga/dfl-afu-main.c static const struct attribute_group port_hdr_group = { · line 431
Quoted 10 lines
drivers/fpga/dfl-afu-main.c +10
-0+ + base =dfl_get_feature_ioaddr_by_id (&pdev->dev,PORT_FEATURE_ID_HEADER ); + + rev =dfl_feature_revision (base); + +if (rev <2 ) +port_reset (pdev); + +if (rev >2 ) +dev_info (&pdev->dev,"unexpected port feature revision, %u\n" , rev);
Remove the print. It is indicating an error but the function returns OK.
Thanks,
Yilun
Quoted 7 lines
drivers/fpga/dfl-afu-main.c +0
-0return 0 ; }Signature · 1 line
2.34.1
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 3 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
The use of revision 2 of the port_hdr IP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFs the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.
Quoted 27 lines
Thanks,
YilunQuoted 23 lines
PCIe Physical Function (PF) than the management PF performing the actual port reset.
Signed-off-by Matthew Gerlach <[email protected]>--- drivers/fpga/dfl-afu-main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/fpga/dfl-afu-main.c +6
-1@@ -417,7 +417,18 @@ static const struct attribute_group port_hdr_group = {static int port_hdr_init (struct platform_device *pdev,struct dfl_feature *feature) { -port_reset (pdev); +void __iomem *base; +u8 rev; + + base =dfl_get_feature_ioaddr_by_id (&pdev->dev,PORT_FEATURE_ID_HEADER ); + + rev =dfl_feature_revision (base);
Quoted 8 lines
drivers/fpga/dfl-afu-main.c static const struct attribute_group port_hdr_group = { · line 431
Quoted 6 lines
drivers/fpga/dfl-afu-main.c +6
-0+ +if (rev <2 ) +port_reset (pdev); + +if (rev >2 ) +dev_info (&pdev->dev,"unexpected port feature revision, %u\n" , rev);Remove the print. It is indicating an error but the function returns OK.
The message is intended to be informational, but I'll remove it because it could be confusing.
Quoted 3 lines
Thanks,
Yilun
Thanks for the feedback.
Quoted 9 lines
Quoted 8 lines
drivers/fpga/dfl-afu-main.c +0
-1return 0 ; } --2.34.1
Quoted 28 lines · On Wed, Jan 24, 2024 at 11:40:05AM -0800, [email protected] wrote:
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 1 line
Quoted 5 lines
Quoted 2 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
The use of revision 2 of the
port_hdrIP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFs
Sorry, I mean any specific indicator other than enumerate the revision number? As you said below, checking revision number may not make further things right, then you need to amend code each time.
Thanks,
Yilun
Quoted 7 lines
the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.
Quoted 32 lines · Xu Yilun
Quoted 31 lines · On Wed, Jan 24, 2024 at 11:40:05AM -0800, [email protected] wrote:
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 3 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
Quoted 6 lines
Quoted 2 lines
The use of revision 2 of the
port_hdrIP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFsSorry, I mean any specific indicator other than enumerate the revision number? As you said below, checking revision number may not make further things right, then you need to amend code each time.
Using a revision number to indicate the level of functionality for a particular IP block seems to be a widely used approach. What other indicator of functionality level did you have in mind?
The revision number of an IP block would change when new functionality is added to an IP block or the behavior of the IP block changes. It would be expected that SW might need to change in order to use the new functionality or to handle the change in behavior of the IP block. Ideally the new revision of an IP block would be compatible with existing SW, but that cannot be guaranteed.
Thanks,
Matthew
Quoted 12 lines
Thanks,
YilunQuoted 7 lines
the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.
Quoted 39 lines · On Tue, Jan 30, 2024 at 09:13:56AM -0800, [email protected] wrote:
Quoted 35 lines · Xu Yilun
Quoted 33 lines · On Wed, Jan 24, 2024 at 11:40:05AM -0800, [email protected] wrote:
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 3 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
The use of revision 2 of the
port_hdrIP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFs
Quoted 6 lines
Quoted 3 lines
Sorry, I mean any specific indicator other than enumerate the revision number? As you said below, checking revision number may not make further things right, then you need to amend code each time.
Using a revision number to indicate the level of functionality for a particular IP block seems to be a widely used approach. What other indicator
If you still want to make the existing driver work, some capability indication would have more compatibility. That's more reasonable approach. Or you need to change existing behavior for each new revision, that's not actually widely used.
Quoted 1 line
of functionality level did you have in mind?
I'm not trying to make the design. You tell me.
If finally no indicator could be used, we have to use revision number. That's OK but make SW work harder, so I'm asking if anything could be done to avoid that.
Quoted 7 lines
The revision number of an IP block would change when new functionality is added to an IP block or the behavior of the IP block changes. It would be expected that SW might need to change in order to use the new functionality or to handle the change in behavior of the IP block. Ideally the new revision of an IP block would be compatible with existing SW, but that cannot be guaranteed.
People make the IP block, and be compatible should be the concern if it want upstream support.
Thanks,
Yilun
Quoted 16 lines
Thanks,
MatthewQuoted 12 lines
Thanks,
YilunQuoted 7 lines
the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.
Quoted 44 lines · Xu Yilun
Quoted 43 lines · On Tue, Jan 30, 2024 at 09:13:56AM -0800, [email protected] wrote:
Quoted 38 lines · Xu Yilun
Quoted 28 lines · On Wed, Jan 24, 2024 at 11:40:05AM -0800, [email protected] wrote:
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 1 line
Quoted 5 lines
Quoted 2 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
The use of revision 2 of the
port_hdrIP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFsSorry, I mean any specific indicator other than enumerate the revision number? As you said below, checking revision number may not make further things right, then you need to amend code each time.
Quoted 7 lines
Quoted 2 lines
Using a revision number to indicate the level of functionality for a particular IP block seems to be a widely used approach. What other indicator
If you still want to make the existing driver work, some capability indication would have more compatibility. That's more reasonable approach. Or you need to change existing behavior for each new revision, that's not actually widely used.
I understand some capability indication would be better for compatibility implementation. A revision number change is not as explicit or precise as capability lists.
Quoted 4 lines
Quoted 2 lines
of functionality level did you have in mind?
I'm not trying to make the design. You tell me.
One could use parameter blocks introduced in version 1 of the Device Feature Header (DFH), or capability registers could be added the IP block. In this particular case it seems the least impact to upstreamed software is
to keep the DFH and the register map unchanged, except for an incremented
revision number field.
Quoted 4 lines
If finally no indicator could be used, we have to use revision number. That's OK but make SW work harder, so I'm asking if anything could be done to avoid that.
In this case, I don't think anything else can be done without bigger impacts to the SW.
Quoted 11 lines
Quoted 8 lines
The revision number of an IP block would change when new functionality is added to an IP block or the behavior of the IP block changes. It would be expected that SW might need to change in order to use the new functionality or to handle the change in behavior of the IP block. Ideally the new revision of an IP block would be compatible with existing SW, but that cannot be guaranteed.
People make the IP block, and be compatible should be the concern if it want upstream support.
Agreed, and making sure some capability mechanism exists when an IP is created would be a great start.
Thanks,
Matthew
Quoted 22 lines
Thanks,
YilunQuoted 16 lines
Thanks,
MatthewQuoted 12 lines
Thanks,
YilunQuoted 7 lines
the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.
Quoted 72 lines · On Wed, Jan 31, 2024 at 03:53:23PM -0800, [email protected] wrote:
Quoted 44 lines · Xu Yilun
Quoted 43 lines · On Tue, Jan 30, 2024 at 09:13:56AM -0800, [email protected] wrote:
Quoted 38 lines · Xu Yilun
Quoted 28 lines · On Wed, Jan 24, 2024 at 11:40:05AM -0800, [email protected] wrote:
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 1 line
Quoted 5 lines
Quoted 2 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
The use of revision 2 of the
port_hdrIP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFsSorry, I mean any specific indicator other than enumerate the revision number? As you said below, checking revision number may not make further things right, then you need to amend code each time.
Quoted 7 lines
Quoted 2 lines
Using a revision number to indicate the level of functionality for a particular IP block seems to be a widely used approach. What other indicator
If you still want to make the existing driver work, some capability indication would have more compatibility. That's more reasonable approach. Or you need to change existing behavior for each new revision, that's not actually widely used.
I understand some capability indication would be better for compatibility implementation. A revision number change is not as explicit or precise as capability lists.
Quoted 4 lines
Quoted 2 lines
of functionality level did you have in mind?
I'm not trying to make the design. You tell me.
One could use parameter blocks introduced in version 1 of the Device Feature Header (DFH), or capability registers could be added the IP block. In this particular case it seems the least impact to upstreamed software is to keep the DFH and the register map unchanged, except for an incremented revision number field.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
If finally no indicator could be used, we have to use revision number. That's OK but make SW work harder, so I'm asking if anything could be done to avoid that.
In this case, I don't think anything else can be done without bigger impacts to the SW.
Changing the existing SW is not a problem, repeat the same change every time is a problem. So if we make sure port reset is no longer needed after version 1, then this patch is OK. Otherwise, please re-evaluate.
Thanks,
Yilun
Quoted 41 lines
Quoted 10 lines
Quoted 9 lines
The revision number of an IP block would change when new functionality is added to an IP block or the behavior of the IP block changes. It would be expected that SW might need to change in order to use the new functionality or to handle the change in behavior of the IP block. Ideally the new revision of an IP block would be compatible with existing SW, but that cannot be guaranteed.
Quoted 2 lines
People make the IP block, and be compatible should be the concern if it want upstream support.
Agreed, and making sure some capability mechanism exists when an IP is created would be a great start.
Thanks,
MatthewQuoted 22 lines
Thanks,
YilunQuoted 16 lines
Thanks,
MatthewQuoted 12 lines
Thanks,
YilunQuoted 7 lines
the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.
Quoted 77 lines · Xu Yilun
Quoted 76 lines · On Wed, Jan 31, 2024 at 03:53:23PM -0800, [email protected] wrote:
Quoted 44 lines · Xu Yilun
Quoted 43 lines · On Tue, Jan 30, 2024 at 09:13:56AM -0800, [email protected] wrote:
Quoted 38 lines · Xu Yilun
Quoted 28 lines · On Wed, Jan 24, 2024 at 11:40:05AM -0800, [email protected] wrote:
Quoted 7 lines · Xu Yilun
Quoted 3 lines · Matthew Gerlach
Revision 2 of the Device Feature List (DFL) Port feature has slightly different requirements than revision 1. Revision 2 does not need the port to reset at driver startup. In fact,
Please help illustrate what's the difference between Revision 1 & 2, and why revision 2 needs not.
I will update the commit message to clarify the differences between revision 1 and 2.
Quoted 7 lines
Quoted 3 lines
performing a port reset during driver initialization can cause driver race conditions when the port is connected to a different
Please reorganize this part, in this description there seems be a software racing bug and the patch is a workaround. But the fact is port reset shouldn't been done for a new HW.
Reorganizing the commit message a bit will help to clarify why port reset should not be performed during driver initialization with revision 2 of the hardware.
Quoted 1 line
Quoted 5 lines
Quoted 2 lines
BTW: Is there a way to tell whether the port is connected to a different PF? Any guarantee that revision 3, 4 ... would need a port reset or not?
The use of revision 2 of the
port_hdrIP block indicates that the port can be connected multiple PFs, but there is nothing explicitly stating which PFsSorry, I mean any specific indicator other than enumerate the revision number? As you said below, checking revision number may not make further things right, then you need to amend code each time.
Quoted 7 lines
Quoted 2 lines
Using a revision number to indicate the level of functionality for a particular IP block seems to be a widely used approach. What other indicator
If you still want to make the existing driver work, some capability indication would have more compatibility. That's more reasonable approach. Or you need to change existing behavior for each new revision, that's not actually widely used.
I understand some capability indication would be better for compatibility implementation. A revision number change is not as explicit or precise as capability lists.
Quoted 4 lines
Quoted 2 lines
of functionality level did you have in mind?
I'm not trying to make the design. You tell me.
One could use parameter blocks introduced in version 1 of the Device Feature Header (DFH), or capability registers could be added the IP block. In this particular case it seems the least impact to upstreamed software is to keep the DFH and the register map unchanged, except for an incremented revision number field.
Quoted 4 lines
If finally no indicator could be used, we have to use revision number. That's OK but make SW work harder, so I'm asking if anything could be done to avoid that.
Quoted 6 lines
Quoted 2 lines
In this case, I don't think anything else can be done without bigger impacts to the SW.
Changing the existing SW is not a problem, repeat the same change every time is a problem. So if we make sure port reset is no longer needed after version 1, then this patch is OK. Otherwise, please re-evaluate.
The initial port reset will no longer be after version 1. The requirement for the initial state of the logic in side the port to be valid will remain.
Thanks,
Matthew
Quoted 46 lines
Thanks,
YilunQuoted 41 lines
Quoted 10 lines
Quoted 9 lines
The revision number of an IP block would change when new functionality is added to an IP block or the behavior of the IP block changes. It would be expected that SW might need to change in order to use the new functionality or to handle the change in behavior of the IP block. Ideally the new revision of an IP block would be compatible with existing SW, but that cannot be guaranteed.
Quoted 2 lines
People make the IP block, and be compatible should be the concern if it want upstream support.
Agreed, and making sure some capability mechanism exists when an IP is created would be a great start.
Thanks,
MatthewQuoted 22 lines
Thanks,
YilunQuoted 16 lines
Thanks,
MatthewQuoted 12 lines
Thanks,
YilunQuoted 7 lines
the port is connected to.
It is hard to predict the requirements and implementation of a future revision of an IP block. If a requirement of a future revision is to work with existing software, then the future revision would not require a port reset at driver initialization.