From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (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 AC6B3262FC0 for ; Thu, 25 Dec 2025 06:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766643711; cv=none; b=NhBBGMA666HCLgBqhPKCQAzHKxrWDdiekfd864bD+uHUfMgwDtcZaXRF7KMhiwgL/LhUtz/XB452dremrLsLC0qki47wWSInz/65tKIgeNm9cQjAUYAJPY8LInAmrZCVp/YMOwQLsxixM4wAmcHgxYcXnFyGjFbNkKSIjm8X3Uw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766643711; c=relaxed/simple; bh=20KWL9YL31PPu0PJpIyTVKycYfQRADE1IeEq1ykjvnc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dVVwlIPA0R4EG1JKIVs+K3F4ODd0l7LVam/+6L8xeizr+zORItTnJG/GFigYWry3XNy4xZ0fyVcoWbnZO3DktV/Y0P4zeqAq7En43yq9npbzAVcq30MSHMLNKUljbqHJix13K8bmXgbZ4erQYr2SgZ/FWlF2mIcVq8wBgEe1+1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (4096-bit key) header.d=canonical.com header.i=@canonical.com header.b=ePbztko6; arc=none smtp.client-ip=185.125.188.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=canonical.com header.i=@canonical.com header.b="ePbztko6" Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 02CB63F920 for ; Thu, 25 Dec 2025 06:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20251003; t=1766643707; bh=EPJYonuix71oUm57s5z59HxPVVbLV4aoSyqepsIGEOI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ePbztko6nwjPkQGCChpSFBqzmOLI6/KubDANx44ysZ+n2Ztgoh+OoWoSgstFvyJ13 5zsjnVnpUmQuRYBPTjc+pMZiRR8nh0xh7SFcz/KcSgtqtPYsPvnto3LSZLFHUY9XP7 MG4yt+VPoeZUXmrakj31En3hX3ySbglz4ALMiOX1A8r0zp2k0jgfNEzaSjVHjsZH0O f4Tbi99vn9BPObrdaLzOhTxGmRi1NZBvf2KEHthhHgYAk5VOZ8pBdWipjx+gBkTWma +rEUw/385jdadpJ/1/UYzGFhrFToCfZsfSm/l5hDJtKEjrbsPbJeP9uCEpZROhbMkz bph07bTCP5kbURZUCU6tzh6G8fi0e+1eN1ATXNz8YTNIY45fCmw3w+VxJNJ76ietQm xf1uW7n7IrzzfFndyggi3OHrgB7L6ivk26SQ3fZZBJZrR1EEFCxrPDoAH0e1IZ6O6Q AoYcEzuPFW5y6arMwPIwaogBUCOAI7lioloxrIqdt/N3XiOnX7yod+Uxx3ThbO6V6M n45NRSdxqJ1B28Dr4oY3e0ZtpfSQMQC44vMFZU1yvHEQWUGPZjCsKAVMmjdOESswfy hcEXJpzpuAQu/aUlq6MdQXl5O56XVGCRbntBysmpKEa9KNj9sqlsMLw8Fkq2p63b/b HWxAB90nCdAEmnMPvfslaTTE= Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-64b756e2fd1so5687824a12.1 for ; Wed, 24 Dec 2025 22:21:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766643706; x=1767248506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=EPJYonuix71oUm57s5z59HxPVVbLV4aoSyqepsIGEOI=; b=o725WnhwpVSFcFc5j8hhZPgk0UHIMVeXlHj0k/AKATtZo0RSVmTHDvgntS+Wne2HGE 21gkzpCHS42oeazVqXQgswP5B7Wu5UuUzcYSZ/WoWKMCVp4v93n7yb4ifPzgms0npGbD 0bYGFW4H4cAxLJTA6MTDFh/ML7sPmpeJxsu2S6m6P4qc4wc2/4AHDprzmorrWZFV1dQA iilQTJKtqU5tbWQdYmUl/Ov2pv+M0yqKPT1DJtE0cbgkQkqgi7OsnA7HCdprbtmYzHvV SsHvkZF1KkunLdywlt+AZ5KSNvBCKmcPgRueN8bznyOCu/XVnSn6PNp+Ty7SHsyWK4RB J4nQ== X-Forwarded-Encrypted: i=1; AJvYcCUiK8tzDdFAx/ibUQgjdTmVWctxWnqMIYa1tv332MN2bXmcDxY25J6cdkKQE5N2uyWlv3TZCZuakmfEA44=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9NECefY/OVhpRKy9KzVw1F0LFf4YOdKkVaK8ua8GqpW5ec+jl xyAQJ/58R1dkkzdMSISlCJmvraL5kRXzt70kTGt96cEuF+zWsOILv2hVri5fDpjvTCPJsPc6TWw F1L74s1thydVAiRCN3rTChwwlMi9SMLwUjO2W5NZudDymC4LVXRsnz8HbMAbubXE2frtWEk5Fj8 QDuPmo5Q== X-Gm-Gg: AY/fxX5mhuuJV499zv0t13fJNOOZaMSnV+9uL1CxyKYeVgZQ/b6UDBaMLUxj1SaNEEN ExqFcAVs7JEbwuIGNjjjC5b2Ad2tZ09lkxEnipMfqTgPGmSfFArB3jGyPHg8A8nAB+6uMezU6C5 uFyMOp7N0W3VDflF/5Pku5WL+LiySk+BEaW+ta4t7evoUs0jaPsbpuIMcQ+iLGPwiqGNeTzt+Gk O+CagBNo6V9hp5gdUHsvWhFz/QofuUXF5oLNJznL2o8S7Y2VJ2gjOm6KWsvWXI4WvmsBGxMdlyg RUYHiDQGq6e+wvx0Bn2FG6gQO7TnkPhiwSCy6W+oxjhjP9MdvI9bAtJCyQq2JqeKqdW58Er232p KorC8+VdCkoBFnP4oIDGbdd1s X-Received: by 2002:a17:907:2d0e:b0:b76:bcf5:a38a with SMTP id a640c23a62f3a-b8036a924ffmr2184480766b.0.1766643706191; Wed, 24 Dec 2025 22:21:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGC0cEg1z21yzaWoEYG+U6OebSRyp1hetz+m9tmpGkKhV/J46dGAMWMW+VVsjRTQhXfq0zyGQ== X-Received: by 2002:a17:907:2d0e:b0:b76:bcf5:a38a with SMTP id a640c23a62f3a-b8036a924ffmr2184477666b.0.1766643705750; Wed, 24 Dec 2025 22:21:45 -0800 (PST) Received: from localhost.localdomain ([103.155.100.1]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f0ecb9sm1948058466b.56.2025.12.24.22.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 22:21:45 -0800 (PST) From: Aaron Ma To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] ice: recap the VSI and QoS info after rebuild Date: Thu, 25 Dec 2025 14:21:22 +0800 Message-ID: <20251225062122.736308-2-aaron.ma@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251225062122.736308-1-aaron.ma@canonical.com> References: <20251225062122.736308-1-aaron.ma@canonical.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix IRDMA hardware initialization timeout (-110) after resume by separating VSI-dependent configuration from RDMA resource allocation, ensuring VSI is rebuilt before IRDMA accesses it. After resume from suspend, IRDMA hardware initialization fails: ice: IRDMA hardware initialization FAILED init_state=4 status=-110 Separate RDMA initialization into two phases: 1. ice_init_rdma() - Allocate resources only (no VSI/QoS access, no plug) 2. ice_rdma_finalize_setup() - Assign VSI/QoS info and plug device This allows: - ice_init_rdma() to stay in ice_resume() (mirrors ice_deinit_rdma() in ice_suspend() - VSI assignment deferred until after ice_vsi_rebuild() completes - QoS info updated after ice_dcb_rebuild() completes - Device plugged only when control queues, VSI, and DCB are all ready Fixes: bc69ad74867db ("ice: avoid IRQ collision to fix init failure on ACPI S3 resume") Reviewed-by: Aleksandr Loktionov Signed-off-by: Aaron Ma --- V1 -> V2: no changes. V2 -> V3: - mirrors init_rdma in resume as Tony Nguyen suggested to fix the memleak and move ice_plug_aux_dev/ice_unplug_aux_dev out of init/deinit rdma. - ensure the correct VSI/QoS info is loaded after rebuild. drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_idc.c | 41 +++++++++++++++++------ drivers/net/ethernet/intel/ice/ice_main.c | 7 +++- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 147aaee192a79..6463c1fea7871 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -989,6 +989,7 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset); void ice_print_link_msg(struct ice_vsi *vsi, bool isup); int ice_plug_aux_dev(struct ice_pf *pf); void ice_unplug_aux_dev(struct ice_pf *pf); +void ice_rdma_finalize_setup(struct ice_pf *pf); int ice_init_rdma(struct ice_pf *pf); void ice_deinit_rdma(struct ice_pf *pf); bool ice_is_wol_supported(struct ice_hw *hw); diff --git a/drivers/net/ethernet/intel/ice/ice_idc.c b/drivers/net/ethernet/intel/ice/ice_idc.c index 420d45c2558b6..b6079a6cb7736 100644 --- a/drivers/net/ethernet/intel/ice/ice_idc.c +++ b/drivers/net/ethernet/intel/ice/ice_idc.c @@ -360,6 +360,35 @@ void ice_unplug_aux_dev(struct ice_pf *pf) auxiliary_device_uninit(adev); } +/** + * ice_rdma_finalize_setup - Complete RDMA setup after VSI is ready + * @pf: ptr to ice_pf + * + * Sets VSI-dependent information and plugs aux device. + * Must be called after ice_init_rdma(), ice_vsi_rebuild(), and + * ice_dcb_rebuild() complete. + */ +void ice_rdma_finalize_setup(struct ice_pf *pf) +{ + struct iidc_rdma_priv_dev_info *privd; + + if (!ice_is_rdma_ena(pf) || !pf->cdev_info) + return; + + privd = pf->cdev_info->iidc_priv; + if (!privd || !pf->vsi[0] || !pf->vsi[0]->netdev) + return; + + /* Assign VSI info now that VSI is valid */ + privd->netdev = pf->vsi[0]->netdev; + privd->vport_id = pf->vsi[0]->vsi_num; + + /* Update QoS info after DCB has been rebuilt */ + ice_setup_dcb_qos_info(pf, &privd->qos_info); + + ice_plug_aux_dev(pf); +} + /** * ice_init_rdma - initializes PF for RDMA use * @pf: ptr to ice_pf @@ -398,23 +427,16 @@ int ice_init_rdma(struct ice_pf *pf) } cdev->iidc_priv = privd; - privd->netdev = pf->vsi[0]->netdev; privd->hw_addr = (u8 __iomem *)pf->hw.hw_addr; cdev->pdev = pf->pdev; - privd->vport_id = pf->vsi[0]->vsi_num; pf->cdev_info->rdma_protocol |= IIDC_RDMA_PROTOCOL_ROCEV2; - ice_setup_dcb_qos_info(pf, &privd->qos_info); - ret = ice_plug_aux_dev(pf); - if (ret) - goto err_plug_aux_dev; + return 0; -err_plug_aux_dev: - pf->cdev_info->adev = NULL; - xa_erase(&ice_aux_id, pf->aux_idx); err_alloc_xa: + xa_erase(&ice_aux_id, pf->aux_idx); kfree(privd); err_privd_alloc: kfree(cdev); @@ -432,7 +454,6 @@ void ice_deinit_rdma(struct ice_pf *pf) if (!ice_is_rdma_ena(pf)) return; - ice_unplug_aux_dev(pf); xa_erase(&ice_aux_id, pf->aux_idx); kfree(pf->cdev_info->iidc_priv); kfree(pf->cdev_info); diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 4bb68e7a00f5f..1851e9932cefe 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5135,6 +5135,9 @@ int ice_load(struct ice_pf *pf) if (err) goto err_init_rdma; + /* Finalize RDMA: VSI already created, assign info and plug device */ + ice_rdma_finalize_setup(pf); + ice_service_task_restart(pf); clear_bit(ICE_DOWN, pf->state); @@ -5166,6 +5169,7 @@ void ice_unload(struct ice_pf *pf) devl_assert_locked(priv_to_devlink(pf)); + ice_unplug_aux_dev(pf); ice_deinit_rdma(pf); ice_deinit_features(pf); ice_tc_indir_block_unregister(vsi); @@ -5594,6 +5598,7 @@ static int ice_suspend(struct device *dev) */ disabled = ice_service_task_stop(pf); + ice_unplug_aux_dev(pf); ice_deinit_rdma(pf); /* Already suspended?, then there is nothing to do */ @@ -7803,7 +7808,7 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) ice_health_clear(pf); - ice_plug_aux_dev(pf); + ice_rdma_finalize_setup(pf); if (ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) ice_lag_rebuild(pf); -- 2.43.0