Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp108510lqe; Tue, 9 Apr 2024 16:41:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/4lNcQakQCpkhurGwTkSwxjYcyOLbo47aJioda+b3yO1tMjMjKCh0HbIUNQECciKoIGyT9SmKijR0tTcFAyr2LQMDBuIBeR2rGu1aPw== X-Google-Smtp-Source: AGHT+IFfsufk9bAMKxOOYvihPFyUmITWW47F09lbFSAcz8KcrB4LRzgKY/Lh1dXwzElfpFvoVqRD X-Received: by 2002:a05:620a:4955:b0:78d:6701:15f3 with SMTP id vz21-20020a05620a495500b0078d670115f3mr1175552qkn.24.1712706110559; Tue, 09 Apr 2024 16:41:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712706110; cv=pass; d=google.com; s=arc-20160816; b=ulfB/HLRYb+E9Kb+Kn477jAO1Qpcf5gjd4PWVaUn7wtlftWAfSpETdpSb7UWNtw3Qk Vn4LFHi+x1evTDdHVJqkWjh5yVFHN5iAnNjHKISg8S0KwBGG+zupkQBW7wdtqMOPjH5J oSJSz4dzcITmIrRigLwEjFcKJDXzBuVEmwyEyVyzg97fQ8JMuH/vxLQh0oOi9IazYGa6 vNLkqgl1YdXL1vkIxR8EfxQKOlKQ3zQHiunqiY1mdOJGxQQ1jd7OkYnQQ0t7dedp2IJP m+UglcHBMqp5a93J1XxwQDJqfnW4kGhMmD+FU8OdgGBRvnsff+vJDLsT5j3BQIPP2hvO 6MHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=5Zi3ajWpE2Y0K18v+lm/RP2ikQentm+983z6/PPdoso=; fh=ff/2rgOSjULH/L3z/Y+PR5zkUTuzVJ4XEK4mTDNeRIg=; b=ZQ46Q9Jmziv0XsUFKTHsy9ykSv9AOgMJdEpfH9QHIu4w3GVJ1tAXTO0Zm8eyz8/iRQ eF4z3xzvHS7eeMuy5P0o4CLEybzV29vMfLbt6us/0IPpcPr5jmUr3DzqLUsZdcSIdbOQ tmnyOymh0aAu/bwaT/XmnCEq/6zdeqXU4qNHA9SqdMxz1gWAl41sccrW/uoiQlGeuU73 bZhr2obMy5WFSqxa+3X2ZFO/rZXxFbBGORyDMXEWPDYBe9ekiVhARooOLlUds4S7Zn9f Sa3Yf+m5145dQJWFafH29zfNL2axUKpv+ifXOcDJMSheDUTxlPLC4DniV0lSufWFn7CV VgYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="TN5/Mc3P"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-137705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137705-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t13-20020a05620a034d00b0078d617ffc19si6716635qkm.169.2024.04.09.16.41.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 16:41:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="TN5/Mc3P"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-137705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137705-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BC431C226BE for ; Tue, 9 Apr 2024 23:41:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8C4D158DD2; Tue, 9 Apr 2024 23:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TN5/Mc3P" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0900C158DC4; Tue, 9 Apr 2024 23:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712706102; cv=none; b=qgf04Re2vEEb/HRTOKGW8FKxBbd5AjEULQXK2rW8Fw1ajm+FEarcnl45LXY0NdIUCX3ulYnrbBqpfGJJseS0KKGBZk1UCYHHng1J9j6/S+ZS8rrC3E/ZC8UIQr9KfTEzM18lInwsd8wZf4EUY4FZPNzYRIQTncOPJCMCwKKh/Ms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712706102; c=relaxed/simple; bh=p+mYvSZ5jqONe0GguEhDFJy9lDuHfUm34Zjqnta0fOI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=C9SbSLqzz8J9q+0DebmpvUM0w3zzEU5/ZEV+B2jWITO8jwDDDV7cuiERV0GhTuYh1lViALGN/HK1o5cr1NjkmhuaBAoaf8XcA6RG7Wv2dBokaGGHR5xbQ2bcHBUn6AFDHvwawCSBUkcRlOxvksEX6Yjc7+4CJULIv26ebX5+5S8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TN5/Mc3P; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712706100; x=1744242100; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=p+mYvSZ5jqONe0GguEhDFJy9lDuHfUm34Zjqnta0fOI=; b=TN5/Mc3PYc1xEf9kCVpPh/Zkv3HV/d58iXv2SchH1uzn0JKcxHOQXA40 PiaevUHyQZvmZCtF/KHC5Tcy/uEsLeqWtpGzsvC9inN5MJ9r3KrFRNoZu fB4btTX+6gW9QylthK+md/Cv4S69heVPiv64ANNr1Nw3QxH0eejxEeDMf oiaQefOpCyaxoqXDYqT2W0OCP4C0aaX357TPIYT+QSTmqV4P5I4t7k+Wy KWmFi0JNt1m1WZPMlU6AV726jsq3PJov9SFjvpcIgUDmuT39j/8aSwv2E 366hjyyDOw/zwnhRD6vn4iDNhvyYjafg4TNbJeJvkG6HXNdlwvkZXV/aE Q==; X-CSE-ConnectionGUID: +EBV4Z/bSkudJ3yfzXW2RQ== X-CSE-MsgGUID: avjHO8xKTeq2ccdALrXnuA== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="33455057" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="33455057" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 16:41:39 -0700 X-CSE-ConnectionGUID: Vjcf5HX0ScC4EHPnMC4v+g== X-CSE-MsgGUID: Jf/eG5BzQ82g+XUisCpLoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="20261560" Received: from sj-4150-psse-sw-opae-dev3.sj.intel.com ([10.233.115.74]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 16:41:39 -0700 From: Peter Colberg To: Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Russ Weight , Marco Pagani , Matthew Gerlach , Peter Colberg Subject: [RFC PATCH v2 0/9] fpga: dfl: fix kernel warning on port release/assign for SRIOV Date: Tue, 9 Apr 2024 19:39:33 -0400 Message-ID: <20240409233942.828440-1-peter.colberg@intel.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit DFL ports are registered as platform devices in PF mode. The port device should be removed from the host when the user wants to configure the port as a VF and pass through to a virtual machine. The FME device ioctls DFL_FPGA_FME_PORT_RELEASE/ASSIGN are designed 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 the port assign ioctl is called, the platform device is added back by platform_device_add(), which conflicts with this comment of device_add(): "Do not call this routine more than once for any device structure", and will cause a kernel warning at runtime. This patch tries to completely unregister the port platform device on release and registers a new one 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 info even when the port platform device is unregistered. But with the change the platform_data will be freed in this case. So this patch introduces a new structure dfl_feature_dev_data for these APIs, which acts similarly to the previous dfl_feature_platform_data. The dfl_feature_platform_data then only needs a pointer to dfl_feature_dev_data to make the feature device driver work. The single monolithic v1 patch is split into multiple, smaller patches at the request of the maintainer. The first patch adds temporary macros that alias dfl_feature_dev_data ("fdata") to dfl_feature_platform_data ("pdata") and associated functions from the "fdata" to the corresponding "pdata" variants. Subsequent patches separate out most of the symbol name changes required by this patch series, one patch per file. The last patch of the series removes the macros and applies the actual change. Link: https://lore.kernel.org/all/DM6PR11MB3819F9CCD0A6126B55BCB47685FB9@DM6PR11MB3819.namprd11.prod.outlook.com/T/#t This series applies after the following non-RFC patches: - fpga: dfl: remove unused function is_dfl_feature_present - [v2] fpga: dfl: remove unused member pdata from struct dfl_{afu,fme} Changes since v1: - Split monolithic patch into series at request of maintainer. - Substitute binfo->type for removed function feature_dev_id_type() in parse_feature_irqs(). - Return ERR_PTR(-ENOMEM) on !feature->params in binfo_create_feature_dev_data(). - Reorder cdev as first member of struct dfl_feature_platform_data such that container_of() to obtain pdata evaluates to a no-op. - Change afu_ioctl_*() to receive dfl_feature_dev_data instead of dfl_feature_platform_data. - Change fme_hdr_ioctl_*() to receive dfl_feature_dev_data instead of dfl_feature_platform_data. - Replace local variable pdata with fdata in afu_mmap(). - Remove unused local variable pdata in afu_dev_{init,destroy}(). - Remove unused local variable pdata in fme_dev_{init,destroy}(). - Reorder local variables in afu_dma_unpin_pages() to reverse Christmas tree order. - Align kernel-doc function name for __dfl_fpga_cdev_find_port_data(). - Substitute @fdata for @pdata in kernel-doc comments for dfl_fme_create_mgr() and dfl_fme_destroy_mgr(). Peter Colberg (8): fpga: dfl: alias dfl_feature_dev_data to dfl_feature_platform_data fpga: dfl: migrate AFU DMA region management driver to dfl_feature_dev_data fpga: dfl: migrate AFU MMIO region management driver to dfl_feature_dev_data fpga: dfl: migrate FPGA Management Engine driver to dfl_feature_dev_data fpga: dfl: migrate FME partial reconfiguration driver to dfl_feature_dev_data fpga: dfl: migrate Accelerated Function Unit driver to dfl_feature_dev_data fpga: dfl: migrate DFL support header to dfl_feature_dev_data fpga: dfl: migrate dfl_get_feature_by_id() to dfl_feature_dev_data Xu Yilun (1): fpga: dfl: fix kernel warning on port release/assign for SRIOV drivers/fpga/dfl-afu-dma-region.c | 119 ++++---- drivers/fpga/dfl-afu-error.c | 59 ++-- drivers/fpga/dfl-afu-main.c | 281 +++++++++---------- drivers/fpga/dfl-afu-region.c | 51 ++-- drivers/fpga/dfl-afu.h | 26 +- drivers/fpga/dfl-fme-br.c | 24 +- drivers/fpga/dfl-fme-error.c | 98 +++---- drivers/fpga/dfl-fme-main.c | 86 +++--- drivers/fpga/dfl-fme-pr.c | 88 +++--- drivers/fpga/dfl.c | 433 +++++++++++++++--------------- drivers/fpga/dfl.h | 139 ++++++---- 11 files changed, 722 insertions(+), 682 deletions(-) -- 2.44.0