From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C619BC44508 for ; Wed, 15 Jul 2026 07:43:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 94C6380BD2; Wed, 15 Jul 2026 07:43:55 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1BazXl3BPitw; Wed, 15 Jul 2026 07:43:53 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6737380BCF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1784101433; bh=AYAlIbLB6X0GecHObbyrvXXBG7k1g/UCDRjvsUf6hcY=; h=From:To:Cc:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=0O0Ub0AIU1FsAa836GB3mh4qFl2Y7u4bimyDMVYCvoEVrYBX9wehZ26uR191D7nvZ +yV8DxyLjGOvw6fT1Eo4XXIa0oyhKOsTJuuKhEhMiIaFjSgpi3JFERjFU8/QMvmfsL LepvhOYjr6GVVRoQLcRusKVnnd18xVpOxGQkFWoqZF6O5Ql8cYrZ/oRovSfdIoEygn EfE4UBfRAuOYlJrG6M/1oCdnLOjPozps2IGqv0zZiCjiczWUc+6bLPQmriLSDe0vHW C5co3YaWm2YTWjRYEbKDS7wSFGSUtuP2SyFH4p6YLJiM5ofLkSoyMKou8lU9HjfukP pmGbKo0wkGS6w== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 6737380BCF; Wed, 15 Jul 2026 07:43:53 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists1.osuosl.org (Postfix) with ESMTP id D089849D for ; Wed, 15 Jul 2026 07:43:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id B0EB440055 for ; Wed, 15 Jul 2026 07:43:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id fte6M18xrBvX for ; Wed, 15 Jul 2026 07:43:51 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::102b; helo=mail-pj1-x102b.google.com; envelope-from=mhun512@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org EB3104004C DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EB3104004C Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by smtp2.osuosl.org (Postfix) with ESMTPS id EB3104004C for ; Wed, 15 Jul 2026 07:43:50 +0000 (UTC) Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-38511175ad3so4233455a91.2 for ; Wed, 15 Jul 2026 00:43:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784101430; x=1784706230; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AYAlIbLB6X0GecHObbyrvXXBG7k1g/UCDRjvsUf6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ywqKaHStk+KrZayu+R0J/EH8BIWWDp8N+sN8uNLJOnbf/3PeRchq8VrZ2hJm SdBesL1fJwOoOxvDN+XoNbiVinnea7NB4paxhUyqnVaAAu7jw8L6drO5Pzr X-Received: by 2002:a17:90b:1d52:b0:381:a766:efcb with SMTP id 98e67ed59e1d1-38e1ae5f663mr5684089a91.4.1784101430164; Wed, 15 Jul 2026 00:43:50 -0700 (PDT) Received: from localhost.localdomain ([14.5.152.27]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38e172fd17asm2707964a91.12.2026.07.15.00.43.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Jul 2026 00:43:49 -0700 (PDT) From: Myeonghun Pak To: Tony Nguyen , Przemek Kitszel , intel-wired-lan@lists.osuosl.org Cc: Milena Olech , Emil Tantilov , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Myeonghun Pak , Ijae Kim Date: Wed, 15 Jul 2026 16:43:42 +0900 Message-Id: <20260715074342.49281-1-mhun512@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784101430; x=1784706230; darn=lists.osuosl.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=AYAlIbLB6X0GecHObbyrvXXBG7k1g/UCDRjvsUf6hcY=; b=h5lJp6OsdeNuZG8DGzwqEuAOyPcci6TreCErAmNZIxN8DoB1xKtkf2jB2ulf3tyTeH 2cCl972yZOZVpkrXtM3wtUVy0i03kRC3GPdzk8eTh8HrSAkkgCoI8gpf/kUlPgFv+0t6 vB23Iu+Klu4xhi2A75nYtmPYAu6yYdhscYtjJGpvb1cWaJXZmXzplK8kGEAKScmoGAis W64HmoieH9e2OHbaYFikD0y8UtVVbeZRjtAqQdzPoULN+C7z4XLOPkeiV8XtqWiRbxJ6 h1Lwpadq5mvzCU4uNVd10bTeaYmOeZWEbVbxuu3rGvg3EfHWnBIvu8eMdJBVQWHcwl3x AezA== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=h5lJp6Os Subject: [Intel-wired-lan] [PATCH v2] idpf: disable PCIe PTM on probe failure and removal X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" idpf_probe() enables PCIe Precision Time Measurement with pci_enable_ptm(pdev, NULL), which programs the PTM control bits and sets pdev->ptm_enabled when the bus/controller supports it. If a later probe step fails, the error path releases the allocated workqueues and adapter memory without disabling PTM. The remove path has the same imbalance when a successfully probed device is detached. In both cases, the PCI core's software PTM state and the device's PTM control bits remain set with no bound driver. Add pci_disable_ptm() to the common probe unwind after the PTM enable and to idpf_remove(). pci_disable_ptm() is a no-op when PTM was not enabled, so the non-fatal pci_enable_ptm() failure remains safe. pcim_enable_device() only arranges for pci_disable_device() and does not undo the PTM enable. Fixes: 8d5e12c5921c ("idpf: add initial PTP support") Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- Changes in v2: - Disable PTM in the probe error path, as requested by Emil Tantilov. drivers/net/ethernet/intel/idpf/idpf_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c index 0dd741dcfc..f08ce13c20 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_main.c +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c @@ -159,6 +159,7 @@ static void idpf_remove(struct pci_dev *pdev) mutex_destroy(&adapter->queue_lock); mutex_destroy(&adapter->vc_buf_lock); + pci_disable_ptm(pdev); pci_set_drvdata(pdev, NULL); kfree(adapter); } @@ -266,7 +267,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) { pci_err(pdev, "DMA configuration failed: %pe\n", ERR_PTR(err)); - goto err_free; + goto err_disable_ptm; } pci_set_master(pdev); @@ -279,7 +280,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (!adapter->init_wq) { dev_err(dev, "Failed to allocate init workqueue\n"); err = -ENOMEM; - goto err_free; + goto err_disable_ptm; } adapter->serv_wq = alloc_workqueue("%s-%s-service", @@ -366,6 +367,8 @@ err_mbx_wq_alloc: destroy_workqueue(adapter->serv_wq); err_serv_wq_alloc: destroy_workqueue(adapter->init_wq); +err_disable_ptm: + pci_disable_ptm(pdev); err_free: kfree(adapter); return err; -- 2.47.1