Skip to content

Conversation

IgnoreWarnings
Copy link
Collaborator

@IgnoreWarnings IgnoreWarnings commented Aug 8, 2024

This PR adds devices and drivers with features of binding, unbinding and probing. The IpDevice class adds additional features for devices which correspond to an ip on the fpga, such as getting the ip name and baseaddress.

Used by #783.

@IgnoreWarnings IgnoreWarnings added the enhancement New feature or request label Aug 8, 2024
@IgnoreWarnings IgnoreWarnings force-pushed the fpga-drivers branch 5 times, most recently from 85e5d8b to b9e6468 Compare August 8, 2024 22:26
Copy link
Member

@n-eiling n-eiling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should go into common/lib/kernel. Also there we already have a class Device in pci.hpp. Maybe it makes sense to make a top class Device from which you derive PciDevice and PlatformDevice (instead of IpDevice)?

Doesn't this make some of the functions in common/kernel obsolete? Can we remove something there?
Also please add me to the CODEOWNERS file for the new files you created.

@IgnoreWarnings
Copy link
Collaborator Author

I think this should go into common/lib/kernel. Also there we already have a class Device in pci.hpp. Maybe it makes sense to make a top class Device from which you derive PciDevice and PlatformDevice (instead of IpDevice)?

Doesn't this make some of the functions in common/kernel obsolete? Can we remove something there? Also please add me to the CODEOWNERS file for the new files you created.

Thank you for the tip. It is a good Idea to move it to the Kernel.

Refactor

Naming
The existing Device in "pci.cpp", which is specific for PCI devices, should be renamed to PciDevice.

File Structure
The class should be move to its own "PciDevice" file.

Obsolete Code / Integration
PciDevice can be partially integrated with the new system. Obviously the existing PciDevice wasnt designed with inheritance in mind, which makes it tough to identify common grounds.
The whole code there is questionable: it uses hard coded c_strings as paths, c pointers, fprintf instead of logging, obscure naming... e.g.:

if (tmp[0] && strcmp(tmp, "*")) {
long int x = strtol(tmp, &e, 16);                        
if ((e && *e) || (x < 0 || x > 0x7fffffff)) {...}

I dont think it is worth to port this to the modern style in this PR. Just leave it as is.
@n-eiling Whats your opinion on the suggestions?

@IgnoreWarnings
Copy link
Collaborator Author

I will add you as author.

@IgnoreWarnings
Copy link
Collaborator Author

Also the Device class i implemented is a toplevel class. IpDevice is what is used for vfio platform devices ;)

@IgnoreWarnings
Copy link
Collaborator Author

Waiting for #814

@IgnoreWarnings IgnoreWarnings force-pushed the fpga-drivers branch 7 times, most recently from 491d487 to f1116c6 Compare August 26, 2024 10:36
@IgnoreWarnings IgnoreWarnings marked this pull request as ready for review August 30, 2024 11:32
@IgnoreWarnings IgnoreWarnings requested a review from stv0g as a code owner August 30, 2024 11:32
@IgnoreWarnings
Copy link
Collaborator Author

I think this should go into common/lib/kernel. Also there we already have a class Device in pci.hpp. Maybe it makes sense to make a top class Device from which you derive PciDevice and PlatformDevice (instead of IpDevice)?

Doesn't this make some of the functions in common/kernel obsolete? Can we remove something there? Also please add me to the CODEOWNERS file for the new files you created.

A seperate PR will integrate pci_device with the new interface #816

@IgnoreWarnings
Copy link
Collaborator Author

@stv0g @n-eiling
I addressed all your suggestions and rebased the branch on master.
Would you like me to squash the (conversation) commits before merge?

Copy link
Contributor

@stv0g stv0g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little request: please do not resolve conversations about points raised by a reviewer yourself. Its the task of the reviewer to check if the points have been addressed.

@IgnoreWarnings
Copy link
Collaborator Author

A little request: please do not resolve conversations about points raised by a reviewer yourself. Its the task of the reviewer to check if the points have been addressed.

Okay, I will from now on leave closing discretion to reviewer.

@IgnoreWarnings
Copy link
Collaborator Author

Lets only comment the headers to avoid duplication.

@stv0g
Copy link
Contributor

stv0g commented Oct 16, 2024

Lets only comment the headers to avoid duplication.

This will break consistency. If its decided to add descriptions/comments only to headers we need to do this in all source files of the repo. As this would be a larger change, we will need to do it in a separete MR. So for now, please keep consistent with the rest of the code base. Thanks :)

@IgnoreWarnings
Copy link
Collaborator Author

Lets only comment the headers to avoid duplication.

This will break consistency. If its decided to add descriptions/comments only to headers we need to do this in all source files of the repo. As this would be a larger change, we will need to do it in a separete MR. So for now, please keep consistent with the rest of the code base. Thanks :)

The headers and cpp files can be commented but it makes no sense to write the same description in both. This is what will really break consistency because an update of one comment will not automatically update the other. It breaks DRY Principle and introduces dependency.

@IgnoreWarnings
Copy link
Collaborator Author

IgnoreWarnings commented Oct 23, 2024

Also if you want comments in a specific way, write a coding guideline so I dont have to guess and you dont have to write 10+ change requests only regarding comments.

@IgnoreWarnings
Copy link
Collaborator Author

@stv0g I added the comments (duplicated) in the .cpp files.

IgnoreWarnings and others added 2 commits October 31, 2024 12:02
Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
@stv0g stv0g enabled auto-merge (rebase) October 31, 2024 11:02
@stv0g stv0g merged commit 1520743 into master Oct 31, 2024
2 checks passed
@stv0g stv0g deleted the fpga-drivers branch October 31, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants