On Tue, Nov 19, 2024 at 08:10:16PM -0500, Peter Colberg wrote: > With the Intel FPGA PAC D5005, DFL ports are registered as platform > devices in PF mode. The port device must be removed from the host when > the user wants to configure the port as a VF for use by a user-space > driver, e.g., for pass-through to a virtual machine. The FME device > ioctls DFL_FPGA_FME_PORT_RELEASE/ASSIGN are assigned for this purpose. > > In the previous implementation, the port platform device is not > completely destroyed on port release: it is removed from the system by > platform_device_del(), but the platform device instance is retained. > When DFL_FPGA_FME_PORT_ASSIGN is called, the platform device is added > back with platform_device_add(), which conflicts with this comment of > device_add(): "Do not call this routine more than once for any device > structure", and would previously cause a kernel warning at runtime. > > This patch completely unregisters the port platform device on release > and registers a new device on assign. But the main work is to remove > the dependency on struct dfl_feature_platform_data for many internal DFL > APIs. This structure holds many DFL enumeration infos for feature > devices. Many DFL APIs are expected to work with these infos even when > the port platform device is unregistered. But after this change, the > platform_data will be freed on port release. Hence this patch introduces > a new structure dfl_feature_dev_data, which acts similarly to the > previous dfl_feature_platform_data. dfl_feature_platform_data then only > needs a pointer to dfl_feature_dev_data to query DFL enumeration infos. > > Link: https://lore.kernel.org/all/DM6PR11MB3819F9CCD0A6126B55BCB47685FB9@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#t > Link: https://patchwork.kernel.org/project/linux-fpga/cover/20240409233942.828440-1-peter.colberg@xxxxxxxxx/ > Link: https://patchwork.kernel.org/project/linux-fpga/cover/20240919203430.1278067-1-peter.colberg@xxxxxxxxx/ > Link: https://patchwork.kernel.org/project/linux-fpga/cover/20241025223714.394533-1-peter.colberg@xxxxxxxxx/ Applied this series to for-next. Thanks, Yilun