From patchwork Wed Jul 17 11:44:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Witwicki X-Patchwork-Id: 813056 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 E3FE941C63 for ; Wed, 17 Jul 2024 11:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216812; cv=fail; b=StxxVSI8glX0EzPUGpeFlKG7pWUJYSi9RWQnvjVwplDGX4UDyiMh4EYhgU3LrFuFWLHV0E0Krv04Ohzdk+RxDj4FokajgAYlTNr9uvjFSIhHyhewfNDHWr6uMtHsIiXKdc09UFnyOGGi8+lcgJkKkOKniresDZzKMUGV3Ow0/Pw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216812; c=relaxed/simple; bh=gAx8372tY0EGB8c3RX6udjDo4RjCrPx7J6CMR7+S6vk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=V1cOswPSTGWiE83OAnpVD+AgeA/pYepHhrUoyfc51KUE+gq2oU2pGSbwkfCnEWooFtQl8idO6JXPlwtNu9NuylQr7z/Ww1IxGnRox894u/CEyz72BK1nHVyf9OZsxub0kK97cBDl4W2/Ew2qfqH08mdqylQWkZDhO7/4aU/MuLU= ARC-Authentication-Results: i=2; 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=bIght3ws; arc=fail smtp.client-ip=192.198.163.12 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bIght3ws" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721216810; x=1752752810; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=gAx8372tY0EGB8c3RX6udjDo4RjCrPx7J6CMR7+S6vk=; b=bIght3wsEjBemHLF7GXPBRqqmD97lRRovTzrN/6VrlxEMrdgRrYZrMwU IHl2tlIk4c50XC8z8hMzv3YVqndspZqRLwFTDDZzUo0hU9B/cIfWmCksH H/M+Jrm2/1ZKAkPAlH+sNzB69zE0ZqFsKyXK4i4VNuNad8lCoskUtNP6d RD1bmFlo1V42xAypx4DvOSF16Raf9I4WSh40nXxUZEMQrhcx9T5bb5qNV RTJoniKVWl7GaSzBaco/QZdV7kJ/Dfs1I8kKS50sI1JHPt71y/Kn/ItyX RwWudyctCjQ6njUfV+KjEERzs6jS14WzpJ/fFHM8uxsyhoOZalCsheTBm w==; X-CSE-ConnectionGUID: a4ee/l+9SjeojVrXsEKt4g== X-CSE-MsgGUID: ZaEiqEnLRsSR5V+xPysv7g== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="22572886" X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="22572886" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2024 04:46:49 -0700 X-CSE-ConnectionGUID: pKnHb2lLQRC7AZBQMtaF5w== X-CSE-MsgGUID: lsD75+zJRJ+RDgHhzUb0VA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="50971664" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa007.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Jul 2024 04:46:49 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:48 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:48 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 17 Jul 2024 04:46:48 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.47) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rWHDVpvFPhOikPGiXFNDKlqEwrKOgJ7RmctFRDFa6Hdt+iY4X/BBOq3BJ8rRfU5sOV5x0VwWKzRLlluingzTbPesi4mkBAS06ujPQylF+FsGvCgCkaJEuJlyteS+amufbwBAlQWCnsjWS3tlX2VzjHAZIFgBJpzxdjJuOyx9HgESq/oSyMI3qq0vR2oExSaeBJ1RuqlgCa2KR4T7Fa1UxZ+IduZ0VYH3Nwyc3jYZnJvuEBd2sVXfsgAISmuMBpvO2j10fJKEQ7TWNh6aTtjFfaN9CUmcbuQFj50fKj6VM2gd46F/ywVetAIlg7KjNn7T22y3xTch7HgM+lM7f6e+qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nyXTAd7qGDr7POckqcydjmUc/q9J+IuqseLF7BUe7VQ=; b=IqgLipVGK/kHAa99wEbWzvQV57MIdGG/bH5dN4ya0GtUq68l8G/AWLu1zQISwbhcgSrmkGFXytQvtetT7twd8LikXoJ31uB659cbDmlZbTdmxLIKd6Ftx4C4xRRFkWDngyXSWcp2Gra140OTANvSEpqT3SSySefDAGpG8bgogUamnheQ2v3/WM1ITzSdH4NbL0f6TCMZhuUO3MT+x/VeNmDbnCjJje9nUnEZjpGkdcamXJhyT4zvBinzWWFGQEAuul6LMgGPYHLndqrSki1Ay7IImp60Zozd6baNfGp0fMqqZK+4JrNUYI1M+SwuO8QIMXaNvuhYSautU6+i/PRR+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) by PH0PR11MB7710.namprd11.prod.outlook.com (2603:10b6:510:298::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Wed, 17 Jul 2024 11:46:46 +0000 Received: from PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6]) by PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6%3]) with mapi id 15.20.7762.027; Wed, 17 Jul 2024 11:46:46 +0000 From: Michal Witwicki To: CC: , , Adam Guerin , Michal Witwicki , Giovanni Cabiddu , Przemek Kitszel Subject: [PATCH 1/5] crypto: qat - preserve ADF_GENERAL_SEC Date: Wed, 17 Jul 2024 07:44:56 -0400 Message-ID: <20240717114544.364892-2-michal.witwicki@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717114544.364892-1-michal.witwicki@intel.com> References: <20240717114544.364892-1-michal.witwicki@intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-ClientProxiedBy: DBBPR09CA0046.eurprd09.prod.outlook.com (2603:10a6:10:d4::34) To PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB5830:EE_|PH0PR11MB7710:EE_ X-MS-Office365-Filtering-Correlation-Id: d35653ad-d484-428b-c394-08dca65622b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: sKLO0Zciq+xnLkTKEpB5PKq99U8l2BYgKJuVuLdEGycqZQpuGWmCvBNR+QcbMhhN7MSN/IYYcpmxfuy0dRHrZ42J/oU+JfsBjWHCSWHCD81hlnS25orFY0vHQP0ihrUxVyN5a2/N057C9QIYJ7m5ZJUfp4VGwnHhfcONLVV3wUegSCMkEtt22Ut9Cue4Zqh+atfIOM4KD4WiqS5YxNqqWky6d6QU4D5lSTS5mNeRJTGAQkE5JAckonxWl/G1kQBzUnHPEFPziPk/L8H03qoiTi9pd5pIZochBwnkW8ovPGDS+d4rU2N+OV2Yqc846EGjKFEDMSQDSWDqKk1hlw9FFhFwz7njtlxnSB9qNI/6VmF5dhnzb0OcTQDu9QhOlTZ1V8wMr4IeNsYNHiXiLNVZ/KtmLluEDPhzMD6YwSQR2C+MPZ0niu34f2+4hJzgRX5h7mWjyjMyYBi9MYzXuqLPYP68TmKHIlFPaqWYPoKGo2HIfelha9E7YvuysOf+T21+sxRfoaJnyGC6xmefLXgGbwrNFalcmfnza8TUleKqm5Ifj9KeBY3ucaZEnw6sEshdsb/Hf9lluLRT+lbtz3Xr8blFE0rDEGPQRCLwu60NDO9gWl6pM0zHIpfekVo5asc5kYiWmZFwc7/WA1X9Nn4iJ7DaPfJaH0cGuEverX+k+nKtJeXfHgwQFo3To0AcXLhcj6bCtLocH0QtBqH4QjtZVC3SELE7TB9CpFF3kGYhBx6GUcmzo+cq0kf7s3gxuJ3EZqsuZIk3ivmZGCkXRXBeQhSjwGXGDWDSKqEQaf7ARyDDwHAcB646HLtFBvXltmwrRhoBBAesecxexWz3PDyX0bMaetFa1vM8zUhuUPDR7Jag06Vx0dHZwjc5s0odp0oBvJTMxw5pt/CJsigUF38CpxoAg5gaLMu0N3B88qYWNMFXRP5arad+XSVvlbu/McYDKWlsWgzV9jf5oxKHRQKMTYetnmnUSjGwERk7bP7HFtYuZrDusTa+HCz8Lxrdzn1UiObUKchkaFyGH28Tg4BdgMvwk4ccDGXRgh79eE/cWQBCUdX1gtvPl/Oj2shTCfsSdtlW+Uzkxea3uVOHpBcHdSmnwFRy/5CClu7Z8OU/QWm3rMrk2PugHB8Fg7Za9s7xnLc1y0uN2qlG8o2x3Aw7SDM6FsHl19acZs2CMFs8eozUXrVaD0Kwd+McqxQZmMEVV+wD3S6lLlhmY0Zr0ZCYuuW1E0Aa0Ey5yrutjsWWJVUtQyyDNi9VJVf7Qws4XK4dBTq3pEXoSDNgytmPazQdBSdMztEEBRu7ZzRRaDzySmhvlre3Ru5e7Y9cz9zA/dQmpm0EjYucf0NJHnCW2HWI1w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5830.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z8qxAZMEcEwve/PZtHDxdPCoUpu/tMxnpskRUQM9ej7CDzmadNMeJbnaC58v4B4q6VkBBFr7Fa4E5eYTt1Uh1IySjSx++hQsrJ0ZaHkChi08OBla2T39EQxpq21wp6h1yg8QrX15OzUR5Uiw/VxB8m5ACC7+p5NI7TLqMPO+vg0Mia54KSjvinEysGWIimMKKTxkRng4IPbGpaNVFQU3yZhUJDvTW9DJHGUSPMug0XgB/g50hoXMwmFJv0OArFYQuHZyrv7WUUBWjVa1jvgRR+ahxrFIKRRFPzeWUU2BueLr/OuXoP+aebPom3+L0RPt0RGe3RPJ9Q2MWK6XRE9F7t3fSNzLfTBhRfNjdsgJu6KxyZvllI/S852D/yhjfKO29zH+KKUVTIqjZe2JdM3VKXbwx+qEI3dLew82c2AuUgB6L5QojmbXW1n+MwycoC7wPgaFm5AyNZsv3PxvUvKBPkuQGDUjd7P4R8V8RLuicyee7rJMMEO3LyDSIfVSd/wrkj9lNgp0N7hHORs7UB7aU7MTjWOUv6r0SW+qMgpZODbc1BQ+uAw4yiS6QoeitDdgr/6e+G19XdG2Z+HX73fr27QP6K3aDvMn4nobKyOnNJDKMk/0GG9Z+p4eZfaYlnAuQOtsZvDEf7ApxMtbFQel7p6SGKWR74qi1Pwiv04WaYNlXpD7SADr6LOb9QTnqR22vJ1bxPzfAOEQap5qmaVpyLBvWCfcdyT+fGDICnVB8I0XbESHxE+CVhrHyfXNUvsSHPju3dlcc0mzkflFJCU/Lewp6bvP/k6dFxjyBhnIVlKU+6ngkF1pYI3jQ2Hj1y7+JghHvRyI5HM0CUFclyIh4/XsIk1JTi6adrOtpnNA6x8h0E124sQElzbeK8dGjBRcNH01QJcuN0yErmaIHImT5B4y0fKh+aYE7/7f3pPvcV6PKe6aPufT+rzSa8VISQ+niOrEzM9s4CPzHQFO61FDrt+86rDXrW1djtyFWtqsSAfSXsDKGvLAmkGmPfRbp4dRkhpwNqWXkkgG0MW5qp5SyaTfPFXr4hLQUUzTwGVASSWjCOt3HNkSfqE9/Xg7/OjL6cw9P83remFZHzw3/pgJOo5dTzBU0CbFGjiin67sPElAXypkb9UtW1VjrEHx2ljAHKteMOLROCdA25IYmKUm2CdVvdM05L9k3JRmTW7Q9Kem/9D/7l3eM7u2SVfzOjeoTSjV1WAfVTrZIcwPvTkVAFe/RRqLRRiNltFVm94S4pKe06F+0TAgFh7ZwDfevi1+KDraYz0uxx5R8osBWgNFFEtQF/KBYZ7ehHKzefLtRqGQijaDUUEFBTSycaT+6p6xGG5qgP1tCrSK3+62l3QR8C6cgAMjsO4GQ0LMvrSX69v8CE5bjrXMuu/mAD8SnlXWrTUbUTwIyUCUpPHMvSAY9mxCEnfjKdoxwPksfzWfpA9eFoTmTin8WFCJinTYQ6b9QDrMHM2zASUM3RolPn7MPzC/PAHyhpRdxu0nO3msayCQ4TS7mJfxZ1BA8Kp4KcZjDHE6SZ60k1PsSTku4A/YiVdTzsRBUGru93iLgjEiHPMnNC0QKdXaJrwS9fukRHKwlzcXOk6mbA8hI2DhbWIL4A== X-MS-Exchange-CrossTenant-Network-Message-Id: d35653ad-d484-428b-c394-08dca65622b7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5830.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 11:46:46.1246 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tk+YXIGrZhw86P27O8YOPJIsiRKP5ADnNFG8Gys9wGnw03NaILwjxMuruhaROSNWqCUKys7Cvsx402j4TtP+QNysfuQIExSUHcbglI5YxPY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB7710 X-OriginatorOrg: intel.com From: Adam Guerin The ADF_GENERAL_SEC configuration section contains values that must be preserved during state transitions (down -> up, up -> down). This patch modifies the logic in adf_dev_shutdown() to maintain all key values within this section, rather than selectively saving and restoring only the ADF_SERVICES_ENABLED attribute. To achieve this, a new function has been introduced that deletes all configuration sections except for the one specified by name. This function is invoked during adf_dev_down(), with ADF_GENERAL_SEC as the argument. Consequently, the adf_dev_shutdown_cache_cfg() function has been removed as it is now redundant. Additionally, this patch eliminates the cache_config parameter from the adf_dev_down() function since ADF_GENERAL_SEC should always be retained. This change does not cause any side effects because all entries in the key-value store are cleared when a module is unloaded. Signed-off-by: Adam Guerin Co-developed-by: Michal Witwicki Signed-off-by: Michal Witwicki Reviewed-by: Giovanni Cabiddu Reviewed-by: Przemek Kitszel --- drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 4 +- .../crypto/intel/qat/qat_c3xxxvf/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_common/adf_aer.c | 2 +- drivers/crypto/intel/qat/qat_common/adf_cfg.c | 29 ++++++++++++++ drivers/crypto/intel/qat/qat_common/adf_cfg.h | 2 + .../intel/qat/qat_common/adf_common_drv.h | 2 +- .../crypto/intel/qat/qat_common/adf_ctl_drv.c | 6 +-- .../crypto/intel/qat/qat_common/adf_init.c | 40 ++----------------- .../crypto/intel/qat/qat_common/adf_sriov.c | 2 +- .../crypto/intel/qat/qat_common/adf_sysfs.c | 4 +- .../crypto/intel/qat/qat_common/adf_vf_isr.c | 2 +- .../crypto/intel/qat/qat_dh895xcc/adf_drv.c | 4 +- .../crypto/intel/qat/qat_dh895xccvf/adf_drv.c | 4 +- 17 files changed, 60 insertions(+), 61 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_420xx/adf_drv.c b/drivers/crypto/intel/qat/qat_420xx/adf_drv.c index 2a3598409eeb..f49818a13013 100644 --- a/drivers/crypto/intel/qat/qat_420xx/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_420xx/adf_drv.c @@ -163,7 +163,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err: adf_cleanup_accel(accel_dev); return ret; @@ -177,7 +177,7 @@ static void adf_remove(struct pci_dev *pdev) pr_err("QAT: Driver removal failed\n"); return; } - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); } diff --git a/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c b/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c index d26564cebdec..659905e45950 100644 --- a/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c @@ -165,7 +165,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err: adf_cleanup_accel(accel_dev); return ret; @@ -179,7 +179,7 @@ static void adf_remove(struct pci_dev *pdev) pr_err("QAT: Driver removal failed\n"); return; } - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); } diff --git a/drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c b/drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c index 956a4c85609a..4d18057745d4 100644 --- a/drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c @@ -202,7 +202,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err_free_reg: pci_release_regions(accel_pci_dev->pci_dev); out_err_disable: @@ -221,7 +221,7 @@ static void adf_remove(struct pci_dev *pdev) pr_err("QAT: Driver removal failed\n"); return; } - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); adf_cleanup_pci_dev(accel_dev); kfree(accel_dev); diff --git a/drivers/crypto/intel/qat/qat_c3xxxvf/adf_drv.c b/drivers/crypto/intel/qat/qat_c3xxxvf/adf_drv.c index a8de9cd09c05..f0023cfb234c 100644 --- a/drivers/crypto/intel/qat/qat_c3xxxvf/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_c3xxxvf/adf_drv.c @@ -176,7 +176,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err_free_reg: pci_release_regions(accel_pci_dev->pci_dev); out_err_disable: @@ -196,7 +196,7 @@ static void adf_remove(struct pci_dev *pdev) return; } adf_flush_vf_wq(accel_dev); - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); adf_cleanup_pci_dev(accel_dev); kfree(accel_dev); diff --git a/drivers/crypto/intel/qat/qat_c62x/adf_drv.c b/drivers/crypto/intel/qat/qat_c62x/adf_drv.c index ad0ca4384998..e6b5de55434e 100644 --- a/drivers/crypto/intel/qat/qat_c62x/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_c62x/adf_drv.c @@ -202,7 +202,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err_free_reg: pci_release_regions(accel_pci_dev->pci_dev); out_err_disable: @@ -221,7 +221,7 @@ static void adf_remove(struct pci_dev *pdev) pr_err("QAT: Driver removal failed\n"); return; } - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); adf_cleanup_pci_dev(accel_dev); kfree(accel_dev); diff --git a/drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c b/drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c index 53b8ddb63364..2bd5b0ff00e3 100644 --- a/drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_c62xvf/adf_drv.c @@ -176,7 +176,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err_free_reg: pci_release_regions(accel_pci_dev->pci_dev); out_err_disable: @@ -196,7 +196,7 @@ static void adf_remove(struct pci_dev *pdev) return; } adf_flush_vf_wq(accel_dev); - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); adf_cleanup_pci_dev(accel_dev); kfree(accel_dev); diff --git a/drivers/crypto/intel/qat/qat_common/adf_aer.c b/drivers/crypto/intel/qat/qat_common/adf_aer.c index 04260f61d042..ec7913ab00a2 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_aer.c +++ b/drivers/crypto/intel/qat/qat_common/adf_aer.c @@ -44,7 +44,7 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev, adf_pf2vf_notify_restarting(accel_dev); adf_pf2vf_wait_for_restarting_complete(accel_dev); pci_clear_master(pdev); - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); return PCI_ERS_RESULT_NEED_RESET; } diff --git a/drivers/crypto/intel/qat/qat_common/adf_cfg.c b/drivers/crypto/intel/qat/qat_common/adf_cfg.c index 2cf102ad4ca8..b0fc453fa3fb 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_cfg.c +++ b/drivers/crypto/intel/qat/qat_common/adf_cfg.c @@ -100,6 +100,8 @@ void adf_cfg_dev_dbgfs_rm(struct adf_accel_dev *accel_dev) } static void adf_cfg_section_del_all(struct list_head *head); +static void adf_cfg_section_del_all_except(struct list_head *head, + const char *section_name); void adf_cfg_del_all(struct adf_accel_dev *accel_dev) { @@ -111,6 +113,17 @@ void adf_cfg_del_all(struct adf_accel_dev *accel_dev) clear_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); } +void adf_cfg_del_all_except(struct adf_accel_dev *accel_dev, + const char *section_name) +{ + struct adf_cfg_device_data *dev_cfg_data = accel_dev->cfg; + + down_write(&dev_cfg_data->lock); + adf_cfg_section_del_all_except(&dev_cfg_data->sec_list, section_name); + up_write(&dev_cfg_data->lock); + clear_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); +} + /** * adf_cfg_dev_remove() - Clears acceleration device configuration table. * @accel_dev: Pointer to acceleration device. @@ -185,6 +198,22 @@ static void adf_cfg_section_del_all(struct list_head *head) } } +static void adf_cfg_section_del_all_except(struct list_head *head, + const char *section_name) +{ + struct list_head *list, *tmp; + struct adf_cfg_section *ptr; + + list_for_each_prev_safe(list, tmp, head) { + ptr = list_entry(list, struct adf_cfg_section, list); + if (!strcmp(ptr->name, section_name)) + continue; + adf_cfg_keyval_del_all(&ptr->param_head); + list_del(list); + kfree(ptr); + } +} + static struct adf_cfg_key_val *adf_cfg_key_value_find(struct adf_cfg_section *s, const char *key) { diff --git a/drivers/crypto/intel/qat/qat_common/adf_cfg.h b/drivers/crypto/intel/qat/qat_common/adf_cfg.h index c0c9052b2213..2afa6f0d15c5 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_cfg.h +++ b/drivers/crypto/intel/qat/qat_common/adf_cfg.h @@ -35,6 +35,8 @@ void adf_cfg_dev_dbgfs_add(struct adf_accel_dev *accel_dev); void adf_cfg_dev_dbgfs_rm(struct adf_accel_dev *accel_dev); int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name); void adf_cfg_del_all(struct adf_accel_dev *accel_dev); +void adf_cfg_del_all_except(struct adf_accel_dev *accel_dev, + const char *section_name); int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev, const char *section_name, const char *key, const void *val, diff --git a/drivers/crypto/intel/qat/qat_common/adf_common_drv.h b/drivers/crypto/intel/qat/qat_common/adf_common_drv.h index 3bec9e20bad0..f7ecabdf7805 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_common_drv.h +++ b/drivers/crypto/intel/qat/qat_common/adf_common_drv.h @@ -56,7 +56,7 @@ int adf_service_register(struct service_hndl *service); int adf_service_unregister(struct service_hndl *service); int adf_dev_up(struct adf_accel_dev *accel_dev, bool init_config); -int adf_dev_down(struct adf_accel_dev *accel_dev, bool cache_config); +int adf_dev_down(struct adf_accel_dev *accel_dev); int adf_dev_restart(struct adf_accel_dev *accel_dev); void adf_devmgr_update_class_index(struct adf_hw_device_data *hw_data); diff --git a/drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c b/drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c index 26a1662fafbb..70fa0f6497a9 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c +++ b/drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c @@ -247,7 +247,7 @@ static void adf_ctl_stop_devices(u32 id) if (!accel_dev->is_vf) continue; - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); } } @@ -256,7 +256,7 @@ static void adf_ctl_stop_devices(u32 id) if (!adf_dev_started(accel_dev)) continue; - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); } } } @@ -319,7 +319,7 @@ static int adf_ctl_ioctl_dev_start(struct file *fp, unsigned int cmd, if (ret) { dev_err(&GET_DEV(accel_dev), "Failed to start qat_dev%d\n", ctl_data->device_id); - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); } out: kfree(ctl_data); diff --git a/drivers/crypto/intel/qat/qat_common/adf_init.c b/drivers/crypto/intel/qat/qat_common/adf_init.c index 74f0818c0703..593fe9abe88c 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_init.c +++ b/drivers/crypto/intel/qat/qat_common/adf_init.c @@ -393,9 +393,9 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev) clear_bit(ADF_STATUS_IRQ_ALLOCATED, &accel_dev->status); } - /* Delete configuration only if not restarting */ + /* If not restarting, delete all cfg sections except for GENERAL */ if (!test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) - adf_cfg_del_all(accel_dev); + adf_cfg_del_all_except(accel_dev, ADF_GENERAL_SEC); if (hw_data->exit_arb) hw_data->exit_arb(accel_dev); @@ -445,33 +445,7 @@ void adf_error_notifier(struct adf_accel_dev *accel_dev) } } -static int adf_dev_shutdown_cache_cfg(struct adf_accel_dev *accel_dev) -{ - char services[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = {0}; - int ret; - - ret = adf_cfg_get_param_value(accel_dev, ADF_GENERAL_SEC, - ADF_SERVICES_ENABLED, services); - - adf_dev_stop(accel_dev); - adf_dev_shutdown(accel_dev); - - if (!ret) { - ret = adf_cfg_section_add(accel_dev, ADF_GENERAL_SEC); - if (ret) - return ret; - - ret = adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, - ADF_SERVICES_ENABLED, - services, ADF_STR); - if (ret) - return ret; - } - - return 0; -} - -int adf_dev_down(struct adf_accel_dev *accel_dev, bool reconfig) +int adf_dev_down(struct adf_accel_dev *accel_dev) { int ret = 0; @@ -480,15 +454,9 @@ int adf_dev_down(struct adf_accel_dev *accel_dev, bool reconfig) mutex_lock(&accel_dev->state_lock); - if (reconfig) { - ret = adf_dev_shutdown_cache_cfg(accel_dev); - goto out; - } - adf_dev_stop(accel_dev); adf_dev_shutdown(accel_dev); -out: mutex_unlock(&accel_dev->state_lock); return ret; } @@ -535,7 +503,7 @@ int adf_dev_restart(struct adf_accel_dev *accel_dev) if (!accel_dev) return -EFAULT; - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); ret = adf_dev_up(accel_dev, false); /* if device is already up return success*/ diff --git a/drivers/crypto/intel/qat/qat_common/adf_sriov.c b/drivers/crypto/intel/qat/qat_common/adf_sriov.c index 8d645e7e04aa..baf2e1cc1121 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_sriov.c +++ b/drivers/crypto/intel/qat/qat_common/adf_sriov.c @@ -192,7 +192,7 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs) return -EBUSY; } - ret = adf_dev_down(accel_dev, true); + ret = adf_dev_down(accel_dev); if (ret) return ret; } diff --git a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c index 4e7f70d4049d..4fcd61ff70d1 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c @@ -62,7 +62,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr, break; } - ret = adf_dev_down(accel_dev, true); + ret = adf_dev_down(accel_dev); if (ret) return ret; @@ -76,7 +76,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr, } else if (ret) { dev_err(dev, "Failed to start device qat_dev%d\n", accel_id); - adf_dev_down(accel_dev, true); + adf_dev_down(accel_dev); return ret; } break; diff --git a/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c b/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c index cdbb2d687b1b..783ee8c0fc14 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c +++ b/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c @@ -71,7 +71,7 @@ static void adf_dev_stop_async(struct work_struct *work) struct adf_accel_dev *accel_dev = stop_data->accel_dev; adf_dev_restarting_notify(accel_dev); - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); /* Re-enable PF2VF interrupts */ adf_enable_pf2vf_interrupts(accel_dev); diff --git a/drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c index 40b456b8035b..2a50cce41515 100644 --- a/drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c @@ -202,7 +202,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err_free_reg: pci_release_regions(accel_pci_dev->pci_dev); out_err_disable: @@ -221,7 +221,7 @@ static void adf_remove(struct pci_dev *pdev) pr_err("QAT: Driver removal failed\n"); return; } - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); adf_cleanup_pci_dev(accel_dev); kfree(accel_dev); diff --git a/drivers/crypto/intel/qat/qat_dh895xccvf/adf_drv.c b/drivers/crypto/intel/qat/qat_dh895xccvf/adf_drv.c index d59cb1ba2ad5..7cb015b55122 100644 --- a/drivers/crypto/intel/qat/qat_dh895xccvf/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_dh895xccvf/adf_drv.c @@ -176,7 +176,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; out_err_dev_stop: - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); out_err_free_reg: pci_release_regions(accel_pci_dev->pci_dev); out_err_disable: @@ -196,7 +196,7 @@ static void adf_remove(struct pci_dev *pdev) return; } adf_flush_vf_wq(accel_dev); - adf_dev_down(accel_dev, false); + adf_dev_down(accel_dev); adf_cleanup_accel(accel_dev); adf_cleanup_pci_dev(accel_dev); kfree(accel_dev); From patchwork Wed Jul 17 11:44:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Witwicki X-Patchwork-Id: 813252 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 0BD94626CB for ; Wed, 17 Jul 2024 11:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216815; cv=fail; b=cdhrprYrK/nIC7uOz0inbajmAAyfEG3t987g+oKGcLooZl+WWHKNH2OFia2HvMTxW2vHVG6J6aV2bMao4avrw6hoegtrZ9rLi+cdySEQLr+Z0Zvk1wHBhCEacye9qqouJXZMjXOYH9kkZAPtcsS2u9cgXz7INbWQL34FbLA4gFE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216815; c=relaxed/simple; bh=+QLy4NYwZWpFId2JW+oQfngL3ZKynlpR3lTLxStoLME=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=REX6Ngp+3ZuOMMR5EE5LEV3IiSVFzzRVX0zTq9RiWYraVAI0kWaXuDr5wbS0r/3mNqRe77RGGrfSP2ZxQ6dwiXTgH+/LJeIfU8yowHtiuW2TpQbwFhKey8JzueUqtv09Cuzl3x+VHMrbL5OvMrMRYgw8upc54radyMraSfMnduQ= ARC-Authentication-Results: i=2; 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=We/UUc/U; arc=fail smtp.client-ip=192.198.163.12 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="We/UUc/U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721216814; x=1752752814; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=+QLy4NYwZWpFId2JW+oQfngL3ZKynlpR3lTLxStoLME=; b=We/UUc/UdXeCXF419cgiGgxhXwPcOdhM5V2QNtQoJ1dF6aKX3KlGXHUY fGtrUUtpWs+1HCgaG3WSA4LlvHr4u8h8TtCRKW3OlBxFzhrFlij8vRhpe XVp1aiKOKH0kTBakzylMTb819ogTsZr8RAB0cPzwxOoDzx/LYg0zGxMrl UM4un7DKYtf9TX3ryxI+Y/fWXEvw+EKTW0B4Uk5lJ4imlO4meVKhSwWQt g+OSSDFJsOCVl9JvEXr14GwTjJej7wo8onODGiSr07hzwnUe6LTQhfJgY tcrIORmX9YDgwbuxW8QWLXYjreIQHZRGqNYp7dSZcQr4LyR+0z9/Hgqz4 w==; X-CSE-ConnectionGUID: JEW5QBCwQTagD1eF8+RJTg== X-CSE-MsgGUID: Op275RAuRFSEDWmQ4S00dg== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="22572908" X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="22572908" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2024 04:46:54 -0700 X-CSE-ConnectionGUID: BTBbciZ4TqKR/YTHHSRu5Q== X-CSE-MsgGUID: GjH+xJy2S/WKaOn83eOf1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="55207386" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Jul 2024 04:46:54 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:53 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:52 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 17 Jul 2024 04:46:52 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.47) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PTpDzdLjFtxuGv2adf2A/QPGBKyXrP8yrBL4ZEkleS/eAnhpNP7pZpalcyY76ADpaHQR1S9QVzz1vGh6b/JTNriNOUwwHz1Ig36tU52PpzVD4c3hIMsrhasLn8HMJvc8/lrUiC+dMEwHPmN6cry0Cc9gpjrqTXbfF8xJCuXMKKnHeJ85gm9tQFtjJz/oyS0p46Abx6W8tib+Qz9GvhpYwr6cIolR2jDPysR4HTFeSkImaEuQW0IafsRx1xY04CkrvqLB7pmwn+xIAILAxzw8y2TZP39UzG0TFHko9fZyFNUxmEDphf9HCQ1IaNvNvMPMqKoSXint8N3qWU7WBr1YuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MwWr7Bn2vGfUDRuoKvUvC3AmRdfUX3PTzSK/KA5e6cU=; b=TmEIyp7PfYCKDR4NFBTlirPg9YELm02MGe/sWeKBTwgW2TWPeak8UEtQfR618iqK07CM/BZYA3QKCxKHwKYZ+8t7khMWXzkmc3RUbBtXt7OWZ4kk2ztnnyDYARICvP+cYoS3eNfGN0ic+eQaxBmWRInXhiN2BqK8TMq3Zl8Op1q7nSKo8As23R0ZFNplKtUaD1S0mbo6AsEb+JYrCzTPPUrGLvlhvhFW7cmd/yfI+ohi1KthonYPovEnykAij38+IKLpPh1FMKMthS1AbkS5fj9oH7evaa6BZJIfWYpuFANq9DQAymMT5iWM0fpSNQq7JwOMoA6juSGiaRbNb+7Okw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) by PH0PR11MB7710.namprd11.prod.outlook.com (2603:10b6:510:298::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Wed, 17 Jul 2024 11:46:50 +0000 Received: from PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6]) by PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6%3]) with mapi id 15.20.7762.027; Wed, 17 Jul 2024 11:46:50 +0000 From: Michal Witwicki To: CC: , , Michal Witwicki , Giovanni Cabiddu , Przemek Kitszel Subject: [PATCH 2/5] crypto: qat - disable IOV in adf_dev_stop() Date: Wed, 17 Jul 2024 07:44:57 -0400 Message-ID: <20240717114544.364892-3-michal.witwicki@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717114544.364892-1-michal.witwicki@intel.com> References: <20240717114544.364892-1-michal.witwicki@intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-ClientProxiedBy: DBBPR09CA0046.eurprd09.prod.outlook.com (2603:10a6:10:d4::34) To PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB5830:EE_|PH0PR11MB7710:EE_ X-MS-Office365-Filtering-Correlation-Id: 610f8998-3e25-4dc5-196c-08dca656256c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: +yyCGDC1bQBdPsRDXw4FpNxNLXBJh7DrADqiDAU9Z4rI1XoPbjaQP7k8DYaC17+cwoB1JGh3d6jCFz1JL+1SO65G/Yk+5d2f8NUI4agoCO40RK83cVf91V5cdWNCKdyZEuIcq4a2DvT1JykbERu+PZRMJ2lQlKqpfmMnZRr4freEUqy0J6KvEbgGuvCEFjGHEhyU0BaUzT1GQqXPlhMz40jae2aPxvj741UutiPd94T4JLAVf8y3cWx//cGPk90QCK3csYMtMY72OgefQEmGxgxjmy275FU15WJz+xx05nhvwoaHUZDbevdqXzHTij8g2LXt/HMEp1ie1CC/xIiTRcPgc3E7+KZIDJSJHTQKFxmAa1esQsjdhfXOzEGrJimbSs0DeDIgdWaa9i+FDVCmN9rEad44NoRMEwn6EaRv0UVbMMS4x2SSetJq9Xes9Nalv8dSqXgfxmq+jQ6MefGjFvtLoYuixarW4aEy7ijnevzemDBywc0ky3MlLQ+vlPjnX28Y9eAqtbTcaLTWqef+SgQQ2SzB1UOrFRkE8FeZ+qMkl9D1dHGPreCGzp4xRl8WZqt4a7IewcLs3OC5HAvHlArxp/EeWbJdDAHxsN2BdoIuNRSJU2OUFP6A7iILdfJQ5P8p+7C4fl6im31dQnNUOb67hNDuTq9hRiKpMVmJuPstMVt9m97bub5NGgg/2U8awPG8LY5hlX0kQrUwlQlh1I/I/cbcPBuT/ljoQb8zHSZD3mD38QCm7fSYAtL9j80XYplVx98ZBBhQgVC0LKsGHOs9LZBMYd10NZyO95koZ/oOx6TN6IJyJTsXUFKoYFqoT64zDSAM7PDHBs3lz1geSIMWsH13r7OrK9NA+MMM+DMop/LSbUeOKUYWEHsNvXcCTVptIqBLjj7ELF3sQDhbksaSyaKz/WWSR9eI3G4W6YCl6fn1n2TxvpVTS8SbXbk7YQ4bo5SJ0px4NkFKcpNZ/p2qQceWE8ybVCFuBIjrdJSK/pukDHqsLCzLhaI15rWy2PTgJw7n0JonBRUoIBXjYaAfgNtNwYslmkWrUtxGHU5D9yAXit0qKdJ3rxnLvM/NaGPKQWUg2Uun6vtD+EJaAqb4W8wAHxTuGERTeCE5DXqYWECg232HXiAvxEsUyZquNu8tZe5pKL3fw6eG+jqRxGdPoWjno3BEW+TLwpsdSzaZACdcR6Yun56RrOGXVufRuVxw83N4wlC1/oQkDlgZdEsJTv2lk1MkTt2dzh2/3CEXN0pMRVBw3ZH3TlPPz56nkMUd95YfN+9ZBsHpS7jb1iqyjh8vfvJUigp9TU3/+btL3ciHjORRnR4dbVPkrN7hD7QXT2qYJj8T/9RnenXycA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5830.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R3vFgsrHUCaP8vFdkuHJ8oMzRsUDQsc1tNt0UmiChWFzgpGFZpRtEq/dG+WWNhyB8+wpU9z0nVgRpAOCn0UC3zyR3Iu/VpBGLaSSYd97p4+wYsa8FkJLDLV2+ym71jgnA+/wU0zUgw+jpek4nrusEydWpyIQtK9dysDNCkPoWfGNEEyOf3rEIShGVDUkC/WgbdKaBuBgAxflsvGWaQcUhH66WxwrtkfG3BuFV0SmZvznTHxuwZgUgWtfgop624PrlYJEMmpcoMI0A00Zo2R6Tc+WZ5pmG2kzQWgcUOaYQe5/Hi1/PXK3ZIUTaXpIphN6VB3kSGPO12pl7hBC/dlDL3cMjsvMnFeiMoU2shwF9WBKnaW09trSeLZ+kQD56G8rPdAmoYfTA/SWyAO/FxSzPdbnGrwSrj5JHpoUozUnOH1xYmhVUlxh9Eh0XpwHWSeLYChuwPs4vRseUFlWQ7G4brx1axeHwl19WLwHWNqGI8IllE7uD9AOAVhMWJV1OCSZ6EIUXHljytTAtdEfZs0eWNMSuZgPAZbcwB1NgI8LJJoJJ4N79NwlNrB6VX1Sx3TUoBKTnxaxoEnMlTXu1uMzCMVUL4EycBGe6IttdWTB7DpXgkgzAADgv9JumCDw0lIlltQ5ORlprlUmi4V1gV/bOQcVVHzLJfhqVIkMyTF+RWcSnyu9M+M7QWn73pphtRpKQjBgkD2NGRAMYjlJvsrB8f8iq0eFCTkCBqJ+dmBoVw5IISN/3brM556aXw3G+uZ9I+N2/JdnWZpDKrLC1M+f6xQdjIQ+36K5oPg5fmJm+zdRoFii17RGJYYNSuziPEC9cmnW3qEOfutu0gMKmIIwpr0vZg+o0OT5/QCOZm2kTOT9RaDuzuk6iXL7NG0Ugk2RlLWC3SsyPq+yrhbNELiJAafDjHD7oZFWcE/1HmG5kQdBvl8sLZmfdwDVzKNpJAmZqT4eWdQSPqlY9JEicoOnqcsbwPaMaQ3cr8Wvvk/4lMusuaqmxCSQaWx0vgNNx/aAYWUHrY4aa6Z6tR9gvEXHVqPHnKaV4YsKxxJfYHTYKyybkHnMqE9h6qjUHcp2XLR1+PnCYk7EVk7JpJ13xIKEbCvxe4gRybJi9uB1lfDk4ZSM2n+3yEISxGzBhg8SJro6nvcBWcjj6x4i4YAxJNkGdpDcQZooxBqpZMMETaQ+SXplgULZ8j3ME53CCzihLhQWjBEWxhPkGSygeXTxj7s7YnsswvJGmRTH5vixzcFPDa9l3KOQyJV8/7O32jpPkPr7nguck3I4xSXIyiHLMaDuQnHiYH/Ai7E6h8RhfIKyr3ghBnNhLMgVF/t/gvfEapI761MYFOW3atVgafh/CkNxUxD2+MnYD/N2sNUksNRXhQUk1jE2q0I7sV1w0JKWnig/cvsOHBhpF3nawGYnjewpvaj5owIJP4g0g5Entd9m/rltt/X7lbYutuJJVTYeD75n/I1IHZG56h/7yVxYMpnaZmeozSN/1QmpiKonxpX4iX0P8T68Wf+1olnWaOZMWlngJEGDqTqRZ+K21Mp6iq6J4btAKqT9Yd5PZyFoJa3GeRCZT2tntSLzO4q5gLVAVqXYey2JQN1Bcfxz11sg9C0UVA== X-MS-Exchange-CrossTenant-Network-Message-Id: 610f8998-3e25-4dc5-196c-08dca656256c X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5830.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 11:46:50.7745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f6msHUZReHw9LfKqnoSFe6NhnK8Wr60G3hud1byFieK1rwqne+YTpBePkTKSs5KWlSLO0l/MX0+JIcHNWGlDFYs97FKtja5WgtZvnI2uC10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB7710 X-OriginatorOrg: intel.com Disabling IOV has the side effect of re-enabling the AEs that might attempt to do DMAs into the heartbeat buffers. Move the disable_iov() function in adf_dev_stop() before the AEs are stopped. Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV") Signed-off-by: Michal Witwicki Reviewed-by: Giovanni Cabiddu Reviewed-by: Przemek Kitszel --- drivers/crypto/intel/qat/qat_common/adf_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/adf_init.c b/drivers/crypto/intel/qat/qat_common/adf_init.c index 593fe9abe88c..f189cce7d153 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_init.c +++ b/drivers/crypto/intel/qat/qat_common/adf_init.c @@ -323,6 +323,8 @@ static void adf_dev_stop(struct adf_accel_dev *accel_dev) if (hw_data->stop_timer) hw_data->stop_timer(accel_dev); + hw_data->disable_iov(accel_dev); + if (wait) msleep(100); @@ -386,8 +388,6 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev) adf_tl_shutdown(accel_dev); - hw_data->disable_iov(accel_dev); - if (test_bit(ADF_STATUS_IRQ_ALLOCATED, &accel_dev->status)) { hw_data->free_irq(accel_dev); clear_bit(ADF_STATUS_IRQ_ALLOCATED, &accel_dev->status); From patchwork Wed Jul 17 11:44:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Witwicki X-Patchwork-Id: 813055 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 888B913CFBC for ; Wed, 17 Jul 2024 11:46:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216819; cv=fail; b=GayLbdbn/ysiXG3LzQNdeCOnv77dYXOlSnDc0JkNTvXBGonvQPp7cnB38a0GdxO3lY+SWYjK59hLj1mq01Biqo4uXPFXShu57v5Sz1s2twK7/87dnKSW/8XmDGM41fXP7tr0Xq+C2GXJ7Qcvq0fAmihpEr9gTDSxtdtFpU7UpBk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216819; c=relaxed/simple; bh=1jqSK8/+2JIBb2/ir8Kc9ZeOEzChsqjrYVaYJDHj3GA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=b/ijZgmPSVih89YRDMrassfJ19fWaoXiLxC2hXRAW81ucvE4JoS3+BYyq6u8PYgmTfbcfRl/PKQZ7wHa/OOraIyLK004xehS4p/gbEMIe82lI+nsiF5VjxN5/h37iK5NdfBHyaZ5zJ2xxe1lJ8pR31+HPAx0Yxfh6Z+WfPf+L0g= ARC-Authentication-Results: i=2; 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=FYcfvl1P; arc=fail smtp.client-ip=192.198.163.12 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FYcfvl1P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721216818; x=1752752818; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=1jqSK8/+2JIBb2/ir8Kc9ZeOEzChsqjrYVaYJDHj3GA=; b=FYcfvl1Ps62Ut0ADtktdHkikzt6ZQ9VWsJzKWzlXWBWALN1of5A4blTO JToIRkrHkrOJWirm1IIYanhtcdpZQoon/qWiM1PFy03EE6NbMpjpPRCHA IaywoRtjag3nYLLzPF9daIoXXs1CWUQT92gpIJfXnSEYcsXo2ArG+mC9f XLSZSS05fdwexS05oQIJtIjL3GRQYJMdyEQp6/zQGDCCWxbulKrOaYojT 3Dl3Z6gyzH8UnyWxLyGGnNTFoqIb5q9ctWlfjbdlANv4LMwnur4LDJJsj zfxw7YZ1DkE7dRY2DsePtNCTCWMFNcoYlhdcUkEwRFsCmHNTbWsp2ulBE w==; X-CSE-ConnectionGUID: IS4edo8NSMeJbGgSzFdRBg== X-CSE-MsgGUID: DqdV58K/TfGfCHUhB7qzyQ== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="22572919" X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="22572919" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2024 04:46:58 -0700 X-CSE-ConnectionGUID: KA95izjvQ8a3I0c+p5TuxA== X-CSE-MsgGUID: 4Hc05/hJSgqbrUgk++IzZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="55207404" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Jul 2024 04:46:58 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:56 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 17 Jul 2024 04:46:56 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.175) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 17 Jul 2024 04:46:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ujoltb28h5jBNdKQWe9bC2lul+JqXSkLCcZey0o5ofLG8mFHt07K3nQC+Z8jQrNg8kaVeOSm6E5fsT/0CmP7a6vXGGhxzMhZozNxm7p98m1J5ikN8YBioU49G5fmnuACx6JQ9eAjAc4jPqCITvmXCL47F7zSB5arMPJu9piZAh8qo+GVL3yQ8bxVBjTRouTEGfQ3dcQdLN/TQ9kfTp+AyM+k+mLLvK0UNcn/icri10Jv8RQe3VxwKKX3JFEM7qcWNAEU/WWh4t3iuk1dslMJMziH4DhAQEr+O6rpr/e3nKfJ4xSCN9PsRtNacqcW+aQbaZPEa5L1NNLwzuT9bbYhhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m2lw8x1P01pWKmRbH4dFHiCEwzy1fXOVtXWADSmHNho=; b=V0qiIwlerwwbU812q7ZhA2Kz5K9EgBt0ObMvH2DRPeo9U4nslPt6Wv/0WnLpOLlNDi0n76FJ36qfka0NNOH4mjn3tfVQWqZs/FXbgJS4Tqcv9/ExTT3o5NKnNXCnnvGohGG3it/DGkmow8hzgE667WLxioJdNDFUnaFhGbiMY6Zp1Zj+irlr7nCQeJv65jZ7FAR636PxsCMC2r7HR4l/jJpU9hrRt5AVqdV4Vx4zetrKERUoYv2Vxi8J7zUa278x+jm9A6bfnW0vVdku79zr/+NcJSW0HDdNLTOHeD5/IGOEHh0eVFYn6EutGD3lcQrSH3gQfbUaqupESAxZis2ZwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) by CH3PR11MB7794.namprd11.prod.outlook.com (2603:10b6:610:125::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Wed, 17 Jul 2024 11:46:53 +0000 Received: from PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6]) by PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6%3]) with mapi id 15.20.7762.027; Wed, 17 Jul 2024 11:46:53 +0000 From: Michal Witwicki To: CC: , , Michal Witwicki , Giovanni Cabiddu , Przemek Kitszel Subject: [PATCH 3/5] crypto: qat - fix recovery flow for VFs Date: Wed, 17 Jul 2024 07:44:58 -0400 Message-ID: <20240717114544.364892-4-michal.witwicki@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717114544.364892-1-michal.witwicki@intel.com> References: <20240717114544.364892-1-michal.witwicki@intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-ClientProxiedBy: DBBPR09CA0046.eurprd09.prod.outlook.com (2603:10a6:10:d4::34) To PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB5830:EE_|CH3PR11MB7794:EE_ X-MS-Office365-Filtering-Correlation-Id: a83cd593-9482-4bef-4f71-08dca6562742 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: cmtcOw4xa9cCFSxaDGAKmuwTqEaN9KeLerkYJ41CTxJvj/cubaUsIoSIDizjHGI+T4d2I3sICLxByccU2dBv5XiXijuvY3yrVIbm0iooVUxS6N9Ymkz4qTa0V3oRRzZzG8VvlZj5woLoWfnX80vZy2mtkF+p5qx/1sE5xMCiO3CgRQGxC7gd3DbjdKKgFW5Tmd6E5IRwYtdl/Any/cIIPGTL8pjMoTriXyK7Dz7+I2Ot0mW9x4fIvBd/hypH4j4qOjeuMCcp0twXBCzdrFZK/Bkk9Vqm3mDmn2/y0WlK1SkBZvB9xJZ/fSq5bNfU2Babh3b7VWIibqy47eK3JtNWchOgIsINn1/4H6OALk/wGJAuSXT9Ty444jsDVrSogcFi0PlqohB+1EfBYqG/Nt9Ry9WfQOcaBZ20clLskklqPp29ipZQR32tudGAIKQ5P4Q25YmuiGMBhDxjJaDnrjzXQCXEWQiaSc/rkquoCN7JNRfFDiZdEwB3DO7Vw7AvoeuEWyfzfyZHJ9pbuvrKwo1JS0T9TjBNbV0dcnBn5adx5+i+J3CJ4EhWkrFJi2QDfGAXYcNIUxDmcJ5wUfTVY8RFemCQ8uzX6UcQalLvtAxiMSgu4eLNs5vfoaV9v/8cleAKtj2fbJkiBEtBpbU2Q6GpLpQq9zdgHUt8YMq5C60W0vQq13IE3fQqSTQvFz2/sD04tVTE8p9dbsPOIX15LDygUHpAJD9i92zTb8Ru2Bv3HqIXpgoH30I/LnT/ifluw0Sz2uKyIqz1wV5jtcqABsAu/5WLTlBGY1TrMRbUDYEwmF+sxIjoZRF5pEcIV+u9wd0hFg3+9SScE7nR7Cn+AotxykMAUNJf/PWuJhDm62gkEJbfiBB0RTX9MpwVyZ3EnxYq/5hXlAudpOwroi+zrmHuE7WMpAKhghv6LMmvO12Om+Fnl3nz1TLWbC1u7vYQvpS2Trg3PmPMnfibDmDe8QiKk7MWvwIFwbYNUetoNsW9mh2O9oJ5uE7CXXWBEIwhhrlbOFq7kYnDXK2T5AAaqeBhvJ7kxjlWJHbFPwEVP6kOneWGeihyB7enjZ84nqPwW8uM+77k8siZKwYQ2Jdo7JvIywyzGU44Kp7kit1uA109Q7s4vlh7dA718L+f1xbcxmcVhw9STv+zvzf3tWM4XOY1YkAwfUX6fRzDUb2JsYBV3RFPnVMp6HD864nNjzdbfYaEQgsB/+zBevLRAFSMH62WXpr3cOJyMuYQgsp5lWaZrxJnCwDuIJBbTSpEoBgXpviHF4fpHErVUJpo5RyBRTBBJLllcA79Z8pEdAILx2zFy9ogE4t7TXbh3jzZMdk3PdXllaO42ymJtLMWqNlSoZWmnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5830.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +c/H0xMGjZ2XVXHuxWDn4X1r0hApUwPkawNAqVX4BnWA7AhZsL5/RSVXzunxlHALt21IWw86QnUcVbEjHuTqRQE1ynkCziYPM/91qPWYlAEyIBABl9JrZbfDYGIcRkMRRc8ZQSCrpeDgGsSQqIB6m4VsTTIXUXqLmjpHtojNxhT9hNUy+BGOtwiDW3pTV4Np3ddFczsqg5C9i+1j4kD0MOGe2NKwR4DKjzxCGU29Y339pCoWT2OqKn00pu6vGNtfu5xXMbLtWgAB3Q1s9zbf/ImMlgNM90GARVfRynbTGfgwa/LixdC6ZuGc/fOilmKfj+LE450ZwzvzhxRzjj1cBOOnv7U4N+U7NehTmh1vot3uvSxXoR72E1L9bD6Gq/O/vhUAbIJXKkVTaBG6fMiX28Gt8AtQ8Ztk8nUIw8LxG/202+Ze8c9pKhurpcFpEkezUj7Z5YIW2MVKYvqeNLZZJr3vzOTru/vTlnZSueN7Jnus0rTFF53N6ODUYZa/RF9TkT+wQ0chT7ZpdAVAV5Nx63apXZJgwutQCqdGbmHmiLAZKnnra4VIIuF4gYkF1h9lk+S/qHbDEZwzWwWXfbRp4YZZbHdvzWxhcoXvtl4YZVN85mNbcRk0kcvvF9EE5+hnNmP+c6u5TrqepTfnqwVctcw1v048Yi5RDoAJ8xse5A6s0e/BdWkoPPB7HCJ88H+uE+XrhrhSvMaNhXGSkd3OpOn15Ej4KzLcXy9nvkCyHIk6GlG49Wlu4GgGCIQI8xRa/04xku3zmXvsvtJKC4RDmRlK/mg7hkOtAtZgtPND1V739R/BL0CYr47Jf1YDAhtor/ZIQkrhi+VF5ec3Qvabr+nd9LV1Dl7V7/WV5MPjebwU8p5px3BrZuP+O65YHHEOucYgTjm8aAiprgmL6ZRGkR6DsZYZG61u/pSzQAWqKRnRVpZaW1NlJlrEW65Xwid6GncJII2NHHHAIJUAkuhBzTFIQncNfh4YCSJa9INUzsTzxxWjB2gCsmbEvOpFBMkTv6aaod4RML+2fq+MW3/MgmS7k74o01gyCmpf6Xig31mSiuRvECqgP4zeaoqozPDvI5AGxkn1vIJJE2kq+9W9j/jgio7sYpa6kht5BLtaljyroVzz+6mTR3lwJaeWLqZtN0nMCux8TwuurxTPjKnSBwLO3S/OegGQbd3ftgvPzCGx3vnnfkKVbanaB8nIeEHzjVoW0bOovXRLDdPIkuv4WaUKJRByU63GM8tr6UKUNUafFGwmWFH2PTwKtEe3lkziQTI23G6Dqr7Oys4ot+aHrNNp4cbJ76aykg0jM5Xil4y7D/pUIo3T4aRamnnfDsbFkVoEAaepqG8wB0LHm28bNYpFBA2zusQdgD4ys4Ap0ter+0EHM1l4ulxL7qYh2i+yxl4TGshGxR1Pq+cvN0Z4Fnyt7eCkaNevAKrhGwQipWjAyzrKqAJ73yMezx8liId9ykepAiTk/VBMMarnXY206Rbkp3naZy9gUF0TyW2pEVHFAmmmWvCrpwD+ivFw1+nKXJnKmZSOaLWfsBCDuAA/dEbKsrCATNacGI2oTdxClimQRgW5rWvyV2Feb4RlAZ703F0jkWuoIBPG5FyJgUv/8g== X-MS-Exchange-CrossTenant-Network-Message-Id: a83cd593-9482-4bef-4f71-08dca6562742 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5830.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 11:46:53.7181 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7lm/xwBA5B9n51cNHf4haZeJHv1cKoiBWpLEGgFnquTcbVkSWChhGeL9s80g1jr7p8OO0Hect9gguJV2T0wGULNDo58FhAB4fTl6nuUcw84= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7794 X-OriginatorOrg: intel.com When the PFVF protocol was updated to support version 5, i.e. ADF_PFVF_COMPAT_FALLBACK, the compatibility version for the VF was updated without supporting the message RESTARTING_COMPLETE required for such version. Add support for the ADF_VF2PF_MSGTYPE_RESTARTING_COMPLETE message in the VF drivers. This message is sent by the VF driver to the PF to notify the completion of the shutdown flow. Fixes: ec26f8e6c784 ("crypto: qat - update PFVF protocol for recovery") Signed-off-by: Michal Witwicki Reviewed-by: Giovanni Cabiddu Reviewed-by: Przemek Kitszel --- .../crypto/intel/qat/qat_common/adf_pfvf_vf_msg.c | 14 ++++++++++++++ .../crypto/intel/qat/qat_common/adf_pfvf_vf_msg.h | 1 + drivers/crypto/intel/qat/qat_common/adf_vf_isr.c | 2 ++ 3 files changed, 17 insertions(+) diff --git a/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.c b/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.c index 1141258db4b6..10c91e56d6be 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.c +++ b/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.c @@ -48,6 +48,20 @@ void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev) } EXPORT_SYMBOL_GPL(adf_vf2pf_notify_shutdown); +void adf_vf2pf_notify_restart_complete(struct adf_accel_dev *accel_dev) +{ + struct pfvf_message msg = { .type = ADF_VF2PF_MSGTYPE_RESTARTING_COMPLETE }; + + /* Check compatibility version */ + if (accel_dev->vf.pf_compat_ver < ADF_PFVF_COMPAT_FALLBACK) + return; + + if (adf_send_vf2pf_msg(accel_dev, msg)) + dev_err(&GET_DEV(accel_dev), + "Failed to send Restarting complete event to PF\n"); +} +EXPORT_SYMBOL_GPL(adf_vf2pf_notify_restart_complete); + int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) { u8 pf_version; diff --git a/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.h b/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.h index 71bc0e3f1d93..d79340ab3134 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.h +++ b/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_msg.h @@ -6,6 +6,7 @@ #if defined(CONFIG_PCI_IOV) int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev); void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev); +void adf_vf2pf_notify_restart_complete(struct adf_accel_dev *accel_dev); int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev); int adf_vf2pf_get_capabilities(struct adf_accel_dev *accel_dev); int adf_vf2pf_get_ring_to_svc(struct adf_accel_dev *accel_dev); diff --git a/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c b/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c index 783ee8c0fc14..a4636ec9f9ca 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c +++ b/drivers/crypto/intel/qat/qat_common/adf_vf_isr.c @@ -13,6 +13,7 @@ #include "adf_cfg.h" #include "adf_cfg_strings.h" #include "adf_cfg_common.h" +#include "adf_pfvf_vf_msg.h" #include "adf_transport_access_macros.h" #include "adf_transport_internal.h" @@ -75,6 +76,7 @@ static void adf_dev_stop_async(struct work_struct *work) /* Re-enable PF2VF interrupts */ adf_enable_pf2vf_interrupts(accel_dev); + adf_vf2pf_notify_restart_complete(accel_dev); kfree(stop_data); } From patchwork Wed Jul 17 11:44:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Witwicki X-Patchwork-Id: 813251 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 8777413CFBC for ; Wed, 17 Jul 2024 11:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216823; cv=fail; b=S4r8hNPzOmY06fCo8ffCOLTJdP//WMaeorEiCtKXiED2aBr6//kg8HT8x7fKanodZALzs6l2FYVMaRMNomLVOr7wGNZA2AGXWGEUG9ie5Z2SThsBC6RjWamTCWkPOGMed4bf11NkZrZbWjsDk/w5FTCqVSF63byQGYoahVTvd0Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216823; c=relaxed/simple; bh=6sh2uEiv7Hd6FuF8MPeayrblto0+bZRTK4f3dIwrkhI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Vzwsl5vUCaXaraqfz6elFe3zQ+pg2vUKISVBJusmc1ufsfO9RzCvWVP8iPZMRm3zQ1NcF/FOmiysz0hudUcXkDPsObypg+DUAFGb/jGNg6pj+fXPnQzGegMsInRD2KiwbkvwI7rLHupamHc+dg6wKfF5exYQZhMaLX0JYA43j7w= ARC-Authentication-Results: i=2; 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=ly0uLilZ; arc=fail smtp.client-ip=192.198.163.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ly0uLilZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721216822; x=1752752822; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=6sh2uEiv7Hd6FuF8MPeayrblto0+bZRTK4f3dIwrkhI=; b=ly0uLilZF/q18A3Hxz8jSLyrQUWzBbPebb1QqSaWqG5yaHZMpMVet4j8 kHNFvZRD62/e+97AT/in6564SWHTwcL45gqwhJ7BnlQXnborBDFvChWZN GiftCr4FbCg3qglFW8o6uR3hK/7p5ddk/GWizeE+7oI2dJaanp3AJ+g4s nijEe5OWbWxFGdq1xa8ANEUxnMa/TF9xBmlDT5sGJ++hh/41kCmc92ud+ kS7kaPbucdOG9kxMYevvZaIIl6LACUhozgT36kLLIQmxhmE5uocnVWcI/ fn0dF124Ge+LisVyr8VjXCBMJPfIbNtuIln72efw7EbRFQP6G2IBUZC0V g==; X-CSE-ConnectionGUID: 85MhiPETTtOwxxrB0vUQ9g== X-CSE-MsgGUID: QvGhR5F3T5Ow2sCPGwFY+g== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="21617739" X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="21617739" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2024 04:47:01 -0700 X-CSE-ConnectionGUID: QpYATMZQRBKUXUwdeTZqmA== X-CSE-MsgGUID: 3RfE1XgTTmW+O5TOr/DKMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="81406958" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Jul 2024 04:47:01 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:47:00 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 17 Jul 2024 04:47:00 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 17 Jul 2024 04:47:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m4AmYqUZHNCwLSl4SlOZkCsq+up7NXG8WbIt1Q6+tB58xROjC8cbtmusuQx0OxsiUAzby6+nfLCRafJ5EhqP3X4OpeH0TWAL35OTkeH3ce/AsvFd2wmbwwnzHiXafumkvaPLpkGrQtmPpjkSwey7rx38GiZ6K2fROQUGajAgKyEbAgWGxB3hJ+B9DhonRsmiRsRXl1v31QhvY1GifX2sEurWAanVQqIhGzWCPVkYPXPcxwJlMEt1REFKv0vra/Dy0fQIjHw6b62CVexdKmDJrlaOjn+uLt0eB6tDjXu7xKPOFs7Hjhu/UeqghyN+gxO3hN7lWTOBJGWp0Gu54CGLIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lHOGUz8HY2zAgr7fONQ5Re3zDb4pevl9lZJCtvdEH0c=; b=Y9HvAON3y7JXPstHt6dhKZ+yZnUlWfUQ618CBV4gil4QnE70WYJUQi+gf6k867peoDGe49gYVebmKBJMUnDlbrN4FFb2vC1j4hAgM9LTtJqMpycrjgGykNhkrki80/62AMXbn8N9HngqpdHHV4nN1Q2VhWnjkxZ8KJft+74g0ePqTOIrrV8QmIPKYXpxnaHFb3XNVl8NE55caDJQtmrn0DE4Pwxwej9xawUM6uk+zoke1ZVlnFTRIxhYRIvoV0oVuHXqfZYpI2c+DA6vFMFc/gDbVCqQrMCgCRQMaWWO1sIWpnoWYgamT0ODB1AbEJOA3SZ3hISC/BLVnx1pdM0A7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) by CH3PR11MB7794.namprd11.prod.outlook.com (2603:10b6:610:125::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Wed, 17 Jul 2024 11:46:58 +0000 Received: from PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6]) by PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6%3]) with mapi id 15.20.7762.027; Wed, 17 Jul 2024 11:46:58 +0000 From: Michal Witwicki To: CC: , , Michal Witwicki , Giovanni Cabiddu , Przemek Kitszel Subject: [PATCH 4/5] crypto: qat - ensure correct order in VF restarting handler Date: Wed, 17 Jul 2024 07:44:59 -0400 Message-ID: <20240717114544.364892-5-michal.witwicki@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717114544.364892-1-michal.witwicki@intel.com> References: <20240717114544.364892-1-michal.witwicki@intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-ClientProxiedBy: DBBPR09CA0046.eurprd09.prod.outlook.com (2603:10a6:10:d4::34) To PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB5830:EE_|CH3PR11MB7794:EE_ X-MS-Office365-Filtering-Correlation-Id: 50013319-7c2b-4e7a-33d6-08dca65629d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: wHE0CrDWI5t2tYPUoL+bQ4mYi9g6w4Km64KBJifmfK+sKzRkApgmJiFxgJ3qOrTMlY9tKnwgQMedipV6ZJE1CNVMzTwAuNyMVxc1HRQ1zd/L0vSCnImgEUeMZlfPK/p7BH7VTZSwK7mVL/vmNqnyAVXt0L8AF0QGq0D80uwJ3XWtDL8ML4h3nRK8BNMAz8Og0b++WUfwZXXSDjaNLI0pvByo5w7uRbpC2607Oh0PtMjfxqltsK7KmbdBD58B5wfJwk3xok9E4iY73hMfzPb1N8fclqzufxH3M/uItCFvDJw6VOzDuaTs/McKFF7yhDDZF4ra6zlWBPVHNbNgpKfOaZOg7yMRGi0mn7DybsQ9JFyMXf+Xv50BAn5gPkoiAv23vUCTeMZ4Hp7V7VjfSnxGun6OQP/zP572AlalVT1ZxTvDD99ILVhgzrTgL/pLwFLWiONhfyBY9FIqp9BOmM6QakzPaqyPA0Zj85HgSzzKYwT+MWg2szahHvFh2dZX7BcqR2csCqje1O5PmHv0RqixOQL+b/zzjj1W2RprQa1bYcxiMdK/X4bsPiw66fO7QFqDDtFTKHZPWMcLzs732qNpimpDKlktyuSsiZP3Xq5WamXxKycB7oEvI/ZnlANfSUT+o5zhVnIvzBRJTaonm3qL2l/QXjkvP2HCoh/8mszsuslT6MIPHXLLA87L2DNThgXI/SfSju7UgGW79Si2M4MZwpSLQzU5JMDV+gJe1vXN3VMsGTBNblIJlpRLNJdL85et2511dNQUEJxSSUe4AC4UW26b1nFuPSFYTWt8k+2nyJiISEWpoqRPxAWxYxdHDDpS6Vzf9G9YWgr5V3leTbWERG1dSwPS0P2Xpjjh+Jol7pQMcgmxePcNn/KgwLR639bf241okJ5c2nCv8wtALVWKQkPIyipIMPcpaY4dKaGQxA+gWHTYcXijOae+1EaJ0zG5rMrPH/2RjUlrqOtI9Am7uCQRs+w4pohha5aMl8gTe8+ahnQg20XlSpe68C4KWO+OVXPHpZxukk5ynaBrjxm3vNKu+iLgumICKRVyIYvaqGCAcij9oXUotYZR1rOgzembbpF1Dttfzo0+zmfjVGl/QvqLfr6QFc0VuRvR/mjtJFbX8HTYp1Tqt+Uvv/wJfSPjYLreG+IvYjGepK/SnPHZvtPKjYD/41AlvemJJomiczqKzWEr542NpJMf4d/4hItQoS9YrUYu0I2WSoEtguNVB1fjpBC933W7SLv5XGz0L5mQSiq8rM88LT2kONxD6MvNlJFAL7Z+ORd8LNpvMghr/WbFiZ04KiwX8Wav/cmpku4K+kFUYmt52SRv6sWo8YOZgFqCaAfbFvPvRx5+VxnpJg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5830.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RrJJgoJ/yNnPkZBPx2BxIM3I2Hoq5JwTvpL/o2TXhFNCmcBgYp2DdlCM/vfxEcOscPGJ7BDppBENrcLh9ZZm1CycNIy18GpMbOt2+FQ7XkBKD3ArWiDDOpvtxU0/e0zTwrThAWH9IxmeEAn5dH3FiBNl+I1KVEDINOSh0+6Q3VWKCozHRav8Jw25EA1oqcLEK45l4B3pguF2clGkosgvJgHQHJbqLRO/5+eepyckcag5puanVVX3xikLhGt6Wqyl1ClknhCGTZkjoESBai6PWm8ZAuoAF/ASULCryZdLCWe3HkkrzamWJHN+PeOZymij+V1qSH4oGwXe8wZ1E29htHsK5oKDuPKbuPCk6DZeqRkvSQdnBksKDAxBtoB5hKJt2eQbee0pyAILd5neD1jgx4Nm3dkPOrB1ujfZFe2i1zVYNavupDYeVCFCNUH34uOYFhDu8svRhUAyF+ghCtv7TV6XKe/kaRPGZ4rj3BB6ZeFiZTHYvERdUaEpbFwdRI5zT4yU0AnupYsPX7h9xLCunOqYlqfazNosG9YTpgqep/crYgWB0hkK4bDx3qqu6GqG06vhNSozfzIQcgaJZv1ok1OXPhtU2Mp3f5/v6muI53RgsW8mnIZf1p0PeFuoyTQ1ymUx28mNuna645axfcqeKPD6i2fcq9aMSnjUObDTUFI66zmVCcT1R2qYMSD5nGLM9rJVzCq7teY3ggX1enubSNbIPlERDMOw9+RlnstvO5JblUo7HH6Dm1RN7yvBq1zFhzMyVwJOdHSCnEZk+dILv5cszN0DUs9xA89CW8S9quY99Xex55qQ9QsYI30G98s7FrUy1fVP6X9aF42TfV2wsecZKAp3OTB9QM5A05wzj5Y5VNDqk0eaqhtuVhLHICvlls0XnWZAWtmOLE3+bB5KpLmfX5lhTYG4LbwV0cL4nXo13SANiSyMBEKlc0Dx+B8lQhm4iIuuGAmcPQdbzA1aJaPqcLmaJGvY7ytEp8FEXPj/SXAuwQvRu17ND6aatpVtNpEiVbjfxJo0O2Ya+/YsJe7N4xrCYKJtmq06iziCEIboMFj3+ZKjnEGnKhlvjV0jgdlSSffKutEmtPBAR7llPJIUedS2JKDeopWsvMPoPI9tOSrw/fQ/U+/5nLEm2/x4nhwXp+mkOw7uLHwvxiOVqbRye0AmrcIxi5PelT/mXaHv9pJ7VaMfqUKQsz+kzYB87KVVE9BhFqGo6MHMyjGAp9rUI6U6dXvmdUV6EeW1EN9xKY9/zXwO2BJPdiKK/fJ4r5ZMAspYh7W6Zuk2CNv12rPYMvr4TP76liO9/o3eWWFMTN3XeKHt00etyH6f/XpnT0E6k9wwfP1BuH7Zc3PBJj+cxJ1EgQ/iKZ5K2XYEX/FZ5mu89ppocAX4TQHfmFGR8UTaH9WUB9wu5iuJwVb+8sM+LCJ4y4mlM0oDBzYh/zimc8YJedgmiaBvOy9je2scM4tT4mKugsVYNJ2m+8K+JqUnOPlZqZMySbr8C/NJjRDTvf65N6N/lAujepHOxRcEjoCrvVl8UvojGG9zzkLHhQ+kPpoM+zFi69RUbI8XQ3HxuRMlUNCO1DOucDfq0EgIidotycj6psw6SkpjDaA43Q== X-MS-Exchange-CrossTenant-Network-Message-Id: 50013319-7c2b-4e7a-33d6-08dca65629d7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5830.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 11:46:58.0303 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /3K8JieZmM4eEjbO/MU+3ldlSw7060M3p3xKNHRpPddDYMhLedT/5p3Q2vwdVni32OXtjeuliWdBMcEjpOOrD3zo/waQvvs26M0G2MKuqG4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7794 X-OriginatorOrg: intel.com In the process of sending the ADF_PF2VF_MSGTYPE_RESTARTING message to Virtual Functions (VFs), the Physical Function (PF) should set the `vf->restarting` flag to true before dispatching the message. This change is necessary to prevent a race condition where the handling of the ADF_VF2PF_MSGTYPE_RESTARTING_COMPLETE message (which sets the `vf->restarting` flag to false) runs immediately after the message is sent, but before the flag is set to true. Set the `vf->restarting` to true before sending the message ADF_PF2VF_MSGTYPE_RESTARTING, if supported by the version of the protocol and if the VF is started. Fixes: ec26f8e6c784 ("crypto: qat - update PFVF protocol for recovery") Signed-off-by: Michal Witwicki Reviewed-by: Giovanni Cabiddu Reviewed-by: Przemek Kitszel --- drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c b/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c index 0e31f4b41844..0cee3b23dee9 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c +++ b/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c @@ -18,14 +18,17 @@ void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev) dev_dbg(&GET_DEV(accel_dev), "pf2vf notify restarting\n"); for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) { - vf->restarting = false; + if (vf->init && vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK) + vf->restarting = true; + else + vf->restarting = false; + if (!vf->init) continue; + if (adf_send_pf2vf_msg(accel_dev, i, msg)) dev_err(&GET_DEV(accel_dev), "Failed to send restarting msg to VF%d\n", i); - else if (vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK) - vf->restarting = true; } } From patchwork Wed Jul 17 11:45:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Witwicki X-Patchwork-Id: 813054 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 5A5E217F50C for ; Wed, 17 Jul 2024 11:47:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216825; cv=fail; b=S7WnfTgBcNxUnbnzJmtnGsH4fyDeqPKlzczuTLLd0ka0nYpakO3THd9v7VpyC3cxeiWWi2b5oEdXbxkha7mp028EX8DWZ2ClLxAVOx5pnDGtYhiEl1ASMGdbxqqi18dBxsZzdmbKZHa7xBtAYVfCF+UKD/nAJaN3q1evTOpIe1g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721216825; c=relaxed/simple; bh=TKqXMUAOuYpdX1YLzxSKpzRS+v2n+QeQCp6nc8LVJtk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=nra1+tVSnlZH0UclAzPraqqUs745lXcQeRHD5OMFSSNb3KHIPzdyS5bSPmYJU7yEQHEs0eaJaTXlZz9FdJ1yTanxflOxiikTLMF26MIEclVj6OYu8sLvHU4n2kgskG7z3EJYXcWW50nur8Zd5mLkNnFrSsYfdoMNnF4/sUrrNeA= ARC-Authentication-Results: i=2; 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=JYhtEHXX; arc=fail smtp.client-ip=192.198.163.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JYhtEHXX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721216824; x=1752752824; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=TKqXMUAOuYpdX1YLzxSKpzRS+v2n+QeQCp6nc8LVJtk=; b=JYhtEHXXbkt5Y+iAqowyJQoqQddHh053iMIC0APTUFGL8WfqvTL+COpa NP0gQ48mJGzIc8HHcxeiS8aPjhOAUFuecv30fd+Pu83XJ+F+DV9buPVG/ xE6tZhUfESVqmiGETSohKrjHoju4YUdBk4WhrZWrhjWL6jMFVqXOSZyh8 GNXFI8Uh7gCdu6F/rUV70VJEWIDxl0A059WS9nC/IIeetNuEDLX+dx6iI XYhzkPRdXQkpGMGJpelLyhnvgOVCGyPsH7rxw6j/M9jpOZK3roOMYDaFb vGQiPihG8hB2rE9nSopAr2lXTJX1lHDe1Bq57ctIonloMafRXzG3EWnDR A==; X-CSE-ConnectionGUID: j0HxVE6sQVSnp1Nuf6T4Sg== X-CSE-MsgGUID: S7EKXem3Q4eqDEkdivKOqg== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="21617747" X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="21617747" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2024 04:47:03 -0700 X-CSE-ConnectionGUID: cEeaZa52Sqe3esg2tisgEw== X-CSE-MsgGUID: VCTf56JPRcW3w8HDZ8pjfw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,214,1716274800"; d="scan'208";a="81406974" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Jul 2024 04:47:03 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 17 Jul 2024 04:47:02 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 17 Jul 2024 04:47:02 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 17 Jul 2024 04:47:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pdCh6mjiw78HhxKjJ4oT+xgjB9wVRr+0mWgQ/ngKBuJ8GMNfUlo6PptQoD+ptdd58qxPYghBD/dxBQJiAN4+uMfh4izkmlEvU3rmtN0onS21PHxBYgzLmuj6uVa68nb8X0zj/xZmqepp4dohKgl/djNh+Md7E3UCi9sCx9klF5flyu5kG7lbWD7TLlh/fr7fJLC8LfG4Ifk1m7VAziYJRWWsm3ZMTEva2ezpIzBEGABQPXhm0buYEsuiyO4hf71ADcWwb1mo4whrU815AbSzVpaCRXkSsBkadsnsizGBA/TdqLgVZnBCGxWCLcxL7rT1SL7NtHul5d+gG3xcC7+z8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cOKp+VBY6/NEXOl4bbh0EI8plq3/VXD0cc9pnHqrr0k=; b=DAiBf7tZqzKMzt6oQdcI8zjY520vZfbEA5NvbtLfZJzSMy6jIRspJeB/8S6LKn6bbZDzFWTzkTr1lsokKetgAkTjirZkXuL+ZEgzDwL05hO2b69mISKQVq6cxyzGm/hU1t6py9gELEJCwaHkcVBnDyEkLl/jckrS8ToXkjqIeS6FWeCxeqze7NZZGTYAoNWgfdGGanMS1Z+E1NndJNLx/EukhXvnhHzYYokdWfGJYUj3xSRNIs87OHMOZyApt0dSZQWg2ADCYkuJnqq/ZwIHRO2IkZncKESQeQwEKNQiDRx9m4IHZ5a1JXkqmkwXX2+IUhLmMfho8RpvePSzrKJf6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) by CH3PR11MB7794.namprd11.prod.outlook.com (2603:10b6:610:125::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Wed, 17 Jul 2024 11:47:00 +0000 Received: from PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6]) by PH0PR11MB5830.namprd11.prod.outlook.com ([fe80::c80d:3b17:3f40:10d6%3]) with mapi id 15.20.7762.027; Wed, 17 Jul 2024 11:47:00 +0000 From: Michal Witwicki To: CC: , , Michal Witwicki , Giovanni Cabiddu , Przemek Kitszel Subject: [PATCH 5/5] crypto: qat - allow disabling SR-IOV VFs Date: Wed, 17 Jul 2024 07:45:00 -0400 Message-ID: <20240717114544.364892-6-michal.witwicki@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240717114544.364892-1-michal.witwicki@intel.com> References: <20240717114544.364892-1-michal.witwicki@intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-ClientProxiedBy: DBBPR09CA0046.eurprd09.prod.outlook.com (2603:10a6:10:d4::34) To PH0PR11MB5830.namprd11.prod.outlook.com (2603:10b6:510:129::20) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB5830:EE_|CH3PR11MB7794:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c1cc8d4-b15f-49a4-9efe-08dca6562b64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: scGfeSJ+rCenOkm4Bg/9Vv4tMjPOhi576JeRLgDmVjhP2uPFbkPCd/QuC0alhSrwy9bKzwRZz0KptqGnN7zOCk+j0OW1TePJ1806JT06GJ9i5l2aV2ldeYU+a+0pKe/JqT2c437GD+dNHF/92KNBq4HR2WlteyrwzbEZ/VFubOIDB9u6SiUW1Yj/QLxdBdrMvr0aSSlTKLwcY3LS16obSydZZgdCJSerWL7v0wRrdnHe6mitYUzvVuNmGWP9o6SUrZ0pRE+r9HuI7fs5/ZCniBBNhpHqgq3mbxGONfPVMO/a2vlZwmSWPULCgc7xPL6f+51ERyNZalOCmNAgv3Kd1el2W8UQYnnBaWQzhty6WRREuJlfzXIWIYo9i7ITT+6F1H8p5Kh3tvMw13Lp9B/OOMAivTANB4Sh82mDotBKSROi6UnGPjhLzumPhtKHu7q61O8k+N7R2cWPT6xO5jm7tps7QeqJkkoTRPaHDYP68DpS5dWGkBdQRleACaMs+HUNgFpNnpd3Zb+WGJceO0DP98UCsOPW4TTjOaCqk9tXt9Mi1LRavwM5YuM70Uvxu93FZWjgeR5ZbLJCFCf1YogiXcyE7fkzVVQtBXFWcTNabNt9GdTJmmZEkhyDX7N27oMp8e/F+ig377aTeAuHjHHXZDWO5KSmk6ddXUPUdRqttueK2MUCpDTE/4APNKqRZFx8kC8WAUUXGJLi7UashV1+p5CH/4oo1zg8W0BeR2xLpZiLv9lJkhninlw+oP3152aNosLvcz0uBmaUCzAglrrOcSxaN35esBtU/iIVmoQSfHWyVfSoa7p+31cpEnHVRAM3uKsOgn3xSZ7t4f4pPuz9NLoTjP06VtnO5ll/tfGqZJE7xEbjkn2rZuL/xvks+Z/7eL4jPBcw1+0B5jFv8MyjeD03vdmj/Ubpr6EPtVCcAlnkHgdX9UpEL5hMTvf0T4K9ndVNoxW+lRfu9ndU3K9CTEgICqvtGJbYDBo3m/hM1bLP96cgaA0NiEA9njSFhBIHuQGR2RGoxgbNcC3kj7IQFYniVy9sTGE4N01avl11N7J4z/BLlpxZZXG1++rW2PqrSvjy8a8/eyouxTyp7b0mSDhdkst+nM0gFoHUsrjLLCEaYRBkFdXj+j9Gby/nAw8p6glM1rBXk/KOm4jKYpTfL8tZQm4BkXPUAY3p8QySoh0m0yZGlxfCAdE9GAy3tQRhDQ7bOqAX6Lfhe76GLotxnLqNyRiZR7tba7X37t3tzUZSl/Z47kkgX+9lFrIvdtcKGGv5forST147Vj7pxrPMAT32cFlLx1PW49X1gGoJ5/aGVLhn/gCZEkQOKukG6ZQbBHUJpSEcXafiPkvBO0vM5A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5830.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6t6hgLS1LaPVUpXYPs7d5Xz3/aNzPAIKzIpuE9tAjx5xo2QMPbybsxhSerTbT8Fc2MHMEqFHXnGNF6ktZYE0p3iYGc38+IObnqPsMZ95j8IPgEmXLZoI0UusZN2UY9FhbWYgpXSHVFvO005x1bKvAqzyCwXCvuzrC6vl3dVTmrf6YlA0GqNPi5KaTQanadG0w2CNHxWO9KKnQ2nZAWHsFCGSXiDWeKYRtcs6QpEHg7t4C+HnGam8+IRoQogaSmZ3opbFLx+m7eFR17HVjdq0OrY1WNS38v9WJEHAIlZYg3LKaZjUkgIzdi7XAizqri/6luC5IxVE29FKX7Lo/+rbBuu9sKdvbJ6zM+r2hBkk1pfcNVCETaFnUdeuGIIicfKzUTiUNDMkJpLxpiLRn7q2k9mKpQXt/SyVke2uljTnGLceVSSbuQSUfL5mjnRgXUyWyTYH9VX22BrbFlFufOI0NxzhXFhREqTqCGSausAL9/1qvzzy0dhdwLd67wro2SpAS4P2zDQAGdVXTWFYAmoxuGMOJovCM8DkY7GSCs7+IApdAiQEaWreCzHIyXF5M0YtqWBaOiXWlczIu5yjGQ18MxuWDvJXn+waxFvYqyVKmqTv8620C3IJFIMCfO/45k66Tcab8VFfX8nF8eXYfifoZ8OTWcXvVhC3xrMTXQeZ0sPqn3Se2TP8Mwy0Guyo9oet/Ld9Z9K3NqQE5q5dT+vVBsDMTx8nOV0ubU7r8FfNYydtDc2yiuUjCszjt4eTMqw+S7s7c1OVmHG6/hMVJIGcfvMS2l9+3vJ9aVXfn+8Bs/GmYfQ5EUFhi3b65V6/QUPKhkDGlIenv39uapun458DUqeRXsHktUJWhSoB5TV0nf1ZXBVoqz0NenImX9Qq1aht7e9wBzDbJKB7M9Fy3CB0ySVD2RMNAVo85rOeUnuAaY5VCUyRnpPVcNeKVbde+tBq4MS+IQ9yZOV9FDzaHOsPqROfDMCHkvefc9HmL7rbLm2iN1w33ni9Ig5lM9Ltr95kgn1Y0gad22r+MDY6cSNCkN22yBdAf1W9p3w4YG953tkx7YcHs86rsA58Hy4izD/d5Yt35a18VBPy1ZMQyDifVjj0n2oi8cEl1f/ULMEwizNYCITgsJ5/55fvoK7FLyqd/LCgqgq8b6m65gebdRFm1EY+YUw06T/QGUypiW/pJBwuzwf4W9SiysYGysPXrFULAqEKUbKozcrEBoZcGDseY0jEswowbrS+jbEHtKBvhqNcGEdvFxebnIJDQLGs8PBL25U5bDn6iku1gES3RaYkXBBwUkbABAQctcOZeDHIHGtPRYx9tta72St7v4KSchE9NlxxDLXImVpqeirPIqTOCOAP2MC+/r7nkmUEN6FXlt2LBwG/pMenPEMcGK+/GhlhcadtR3GX4PM5F15pqMEvHSUZYCYqtdY/CEeZkQ1HEgzgDbEUTcTiSpknTzOZV9AvaKJHwWvtaRdUN4cY6MvqDnxpP3WQBFicqk1Hw0RVhFf1FGF0QbJBE7XSMcBWOL1+RYg4+hUs2xiuN34+k25vmqkdDa5N32f4Csq1R6bALLJ1LI6kmKTUSPLp+WSqGGS5NlviaA4QDs5e4Bv5Lwr2Ew== X-MS-Exchange-CrossTenant-Network-Message-Id: 5c1cc8d4-b15f-49a4-9efe-08dca6562b64 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5830.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 11:47:00.6450 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7vViLtKXPiuGw04I4WHl5c7zS0/8xfrR3rATWb8625K8AGzAN/61D05fhwIADpKYFBLz+Cal6XgQwli1F0p6fxKtoOZ6VLDr8MWb0lNXP38= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7794 X-OriginatorOrg: intel.com The QAT driver allows enabling SR-IOV VFs but does not allow them to be disabled through a write to sysfs. Disabling SR-IOV VFs can be only achieved by bringing down and up a device using the attribute /sys/bus/pci/devices//qat/state. The documentation for the sysfs attribute `sriov_numvfs` specifies that "a userspace application wanting to disable the VFs would write a zero to this file". Add support for disabling SR-IOV VFs by writing '0' to the 'sriov_numvfs' attribute in sysfs. Enabling or disabling SR-IOV always requires adf_dev_down() to be called. This action subsequently leads to the deletion of the ADF_KERNEL_SEC configuration section. The keys ADF_NUM_CY and ADF_NUM_DC within that section must be set to '0', otherwise, the driver will register into the Linux Crypto Framework. Because of this, the configuration in the ADF_KERNEL_SEC section must be added before every sriov_enable. Signed-off-by: Michal Witwicki Reviewed-by: Giovanni Cabiddu Reviewed-by: Przemek Kitszel --- .../crypto/intel/qat/qat_common/adf_sriov.c | 194 ++++++++++++------ 1 file changed, 128 insertions(+), 66 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/adf_sriov.c b/drivers/crypto/intel/qat/qat_common/adf_sriov.c index baf2e1cc1121..c75d0b6cb0ad 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_sriov.c +++ b/drivers/crypto/intel/qat/qat_common/adf_sriov.c @@ -86,11 +86,133 @@ static int adf_enable_sriov(struct adf_accel_dev *accel_dev) return pci_enable_sriov(pdev, totalvfs); } +static int adf_add_sriov_configuration(struct adf_accel_dev *accel_dev) +{ + unsigned long val = 0; + int ret; + + ret = adf_cfg_section_add(accel_dev, ADF_KERNEL_SEC); + if (ret) + return ret; + + ret = adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_CY, + &val, ADF_DEC); + if (ret) + return ret; + + ret = adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_DC, + &val, ADF_DEC); + if (ret) + return ret; + + set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); + + return ret; +} + +static int adf_do_disable_sriov(struct adf_accel_dev *accel_dev) +{ + int ret; + + if (adf_dev_in_use(accel_dev)) { + dev_err(&GET_DEV(accel_dev), + "Cannot disable SR-IOV, device in use\n"); + return -EBUSY; + } + + if (adf_dev_started(accel_dev)) { + if (adf_devmgr_in_reset(accel_dev)) { + dev_err(&GET_DEV(accel_dev), + "Cannot disable SR-IOV, device in reset\n"); + return -EBUSY; + } + + ret = adf_dev_down(accel_dev); + if (ret) + goto err_del_cfg; + } + + adf_disable_sriov(accel_dev); + + ret = adf_dev_up(accel_dev, true); + if (ret) + goto err_del_cfg; + + return 0; + +err_del_cfg: + adf_cfg_del_all_except(accel_dev, ADF_GENERAL_SEC); + return ret; +} + +static int adf_do_enable_sriov(struct adf_accel_dev *accel_dev) +{ + struct pci_dev *pdev = accel_to_pci_dev(accel_dev); + int totalvfs = pci_sriov_get_totalvfs(pdev); + unsigned long val; + int ret; + + if (!device_iommu_mapped(&GET_DEV(accel_dev))) { + dev_warn(&GET_DEV(accel_dev), + "IOMMU should be enabled for SR-IOV to work correctly\n"); + return -EINVAL; + } + + if (adf_dev_started(accel_dev)) { + if (adf_devmgr_in_reset(accel_dev) || adf_dev_in_use(accel_dev)) { + dev_err(&GET_DEV(accel_dev), "Device busy\n"); + return -EBUSY; + } + + ret = adf_dev_down(accel_dev); + if (ret) + return ret; + } + + ret = adf_add_sriov_configuration(accel_dev); + if (ret) + goto err_del_cfg; + + /* Allocate memory for VF info structs */ + accel_dev->pf.vf_info = kcalloc(totalvfs, sizeof(struct adf_accel_vf_info), + GFP_KERNEL); + ret = -ENOMEM; + if (!accel_dev->pf.vf_info) + goto err_del_cfg; + + ret = adf_dev_up(accel_dev, false); + if (ret) { + dev_err(&GET_DEV(accel_dev), "Failed to start qat_dev%d\n", + accel_dev->accel_id); + goto err_free_vf_info; + } + + ret = adf_enable_sriov(accel_dev); + if (ret) + goto err_free_vf_info; + + val = 1; + ret = adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, + &val, ADF_DEC); + if (ret) + goto err_free_vf_info; + + return totalvfs; + +err_free_vf_info: + adf_dev_down(accel_dev); + kfree(accel_dev->pf.vf_info); + accel_dev->pf.vf_info = NULL; + return ret; +err_del_cfg: + adf_cfg_del_all_except(accel_dev, ADF_GENERAL_SEC); + return ret; +} + void adf_reenable_sriov(struct adf_accel_dev *accel_dev) { struct pci_dev *pdev = accel_to_pci_dev(accel_dev); char cfg[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = {0}; - unsigned long val = 0; if (adf_cfg_get_param_value(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, cfg)) @@ -99,15 +221,9 @@ void adf_reenable_sriov(struct adf_accel_dev *accel_dev) if (!accel_dev->pf.vf_info) return; - if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_CY, - &val, ADF_DEC)) - return; - - if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_DC, - &val, ADF_DEC)) + if (adf_add_sriov_configuration(accel_dev)) return; - set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); dev_dbg(&pdev->dev, "Re-enabling SRIOV\n"); adf_enable_sriov(accel_dev); } @@ -168,70 +284,16 @@ EXPORT_SYMBOL_GPL(adf_disable_sriov); int adf_sriov_configure(struct pci_dev *pdev, int numvfs) { struct adf_accel_dev *accel_dev = adf_devmgr_pci_to_accel_dev(pdev); - int totalvfs = pci_sriov_get_totalvfs(pdev); - unsigned long val; - int ret; if (!accel_dev) { dev_err(&pdev->dev, "Failed to find accel_dev\n"); return -EFAULT; } - if (!device_iommu_mapped(&pdev->dev)) - dev_warn(&pdev->dev, "IOMMU should be enabled for SR-IOV to work correctly\n"); - - if (accel_dev->pf.vf_info) { - dev_info(&pdev->dev, "Already enabled for this device\n"); - return -EINVAL; - } - - if (adf_dev_started(accel_dev)) { - if (adf_devmgr_in_reset(accel_dev) || - adf_dev_in_use(accel_dev)) { - dev_err(&GET_DEV(accel_dev), "Device busy\n"); - return -EBUSY; - } - - ret = adf_dev_down(accel_dev); - if (ret) - return ret; - } - - if (adf_cfg_section_add(accel_dev, ADF_KERNEL_SEC)) - return -EFAULT; - val = 0; - if (adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, - ADF_NUM_CY, (void *)&val, ADF_DEC)) - return -EFAULT; - ret = adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_DC, - &val, ADF_DEC); - if (ret) - return ret; - - set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status); - - /* Allocate memory for VF info structs */ - accel_dev->pf.vf_info = kcalloc(totalvfs, - sizeof(struct adf_accel_vf_info), - GFP_KERNEL); - if (!accel_dev->pf.vf_info) - return -ENOMEM; - - if (adf_dev_up(accel_dev, false)) { - dev_err(&GET_DEV(accel_dev), "Failed to start qat_dev%d\n", - accel_dev->accel_id); - return -EFAULT; - } - - ret = adf_enable_sriov(accel_dev); - if (ret) - return ret; - - val = 1; - adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, - &val, ADF_DEC); - - return numvfs; + if (numvfs) + return adf_do_enable_sriov(accel_dev); + else + return adf_do_disable_sriov(accel_dev); } EXPORT_SYMBOL_GPL(adf_sriov_configure);