From patchwork Wed Oct 9 08:35:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13827787 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 96955193438 for ; Wed, 9 Oct 2024 08:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728463077; cv=none; b=cjazuXiV6EdbJovVNVYHWis41Rx+smSqG2e0EanuZHzVgOe5p1CO5cLqZd11Ah1s9iMcQhQNgcuUMeddK67Y6ovGvj9IvWg0c7r0O7X0h16IAUEKMjg83U1TCDtdkiuI11Eg15/FUY8De1d4myKRxWDQFd+HgNadAm85At9JpWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728463077; c=relaxed/simple; bh=1G+pEtntUe6ZQw3bO6bhaoH2cS+X3nDY9vjN4pE1htc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YyRkKd5ZBF31N8RoZDspPOUaEoGPongFfwnwpBAmzUK4ceC+sg+0ie6X4zjpb96d+0+w9B8XgDLqgYU7mlE7ZxqMnUmWrKd4ICmtby3TC/s4fYkFq6Cl7NTGZhOhKMt4zcMIYnDCx2cOTJDJr2aWmM4Grk4f7EiwRgt67cmYNg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fC4DWxGO; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fC4DWxGO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728463074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QnZVeWBmT+J+LidRf6mImSoyv0oTiirkxqtpTQtBia8=; b=fC4DWxGO06507Q9t9nbUCj8a6w4abBJiI25IG5mtjuO6Xcufr6yj5YjAjZbMSwT3/sOkmM vU90pqOKVuGI7DP+4f9dNseps+LVKIF7CrHwBXuDKBurnbdX+zedy3KIA0WjcTPSPDXBzS TdAhQ7287H5GnsMsqS1S8Q0pn3EFu8c= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-171-tEVtBKyyNxuckKan_dOXmw-1; Wed, 09 Oct 2024 04:37:53 -0400 X-MC-Unique: tEVtBKyyNxuckKan_dOXmw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7acca6cbe87so1143054285a.1 for ; Wed, 09 Oct 2024 01:37:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728463073; x=1729067873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QnZVeWBmT+J+LidRf6mImSoyv0oTiirkxqtpTQtBia8=; b=CSZ1hyIWwFH6hjSSQ1SY5x9ywuvncSTvcAJ0nse+2AiyEWIuFcM4rM2SUAMWHpicAV JRwtsX++G5fqKlK6a9LCGeoWD/Y1MQKMUXPi6qbeKWMI1DSHDlLW83zOBSRTd1zmuYcG uojjxBN7mRyIuRvmaGcXVJlGYzUcUreW2UpdFn6ZZxiI1lEUWbEWFMaOR3kNONzq6BdI 50qYMw07MDoxeD6CVVIn8JyUyN9ZwS824/Sfi7GiTd3uYyzTTxxm2pbzsgvCPvOVwMEs j68j1YaZqJTg9dBdXO3khGYmVBmDiCX+bg8pBehaGSP8Kc4PYRqUweHdtURXoy8RhAzT jDeA== X-Forwarded-Encrypted: i=1; AJvYcCUG+EPDyxL9G2NRfylEeikvjzAnqhtileb8k33P98/Toro8ESd1hMWME8qVXaHEMmBC6q6iFStZwOI=@vger.kernel.org X-Gm-Message-State: AOJu0YzHTNWKx613DJWFpc2dl8zg2WAPVbi8k2w3WA128sikOzqTfC4v EQPenxJxogLo/eT511zYg8gcjTF7a9Hpp/C0H/lqay0RYdy4KDCc894leH+tl579nZW8kYYDXGQ /BqcES3e10eG/qEhFv4Qf2JIPagdqqvhwkUavpO+KPGyXXa5o1Rzb8bBFOQ== X-Received: by 2002:a05:620a:40a:b0:7a7:fdef:27a with SMTP id af79cd13be357-7b0874d7cdemr203381885a.58.1728463072686; Wed, 09 Oct 2024 01:37:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVcvq1l/JiYDRYGcvT0xuobZAhQYwMoKmOoPhvJp1jfhxUy6a6lyXKK7lz5Kz5T1IwGDIQGw== X-Received: by 2002:a05:620a:40a:b0:7a7:fdef:27a with SMTP id af79cd13be357-7b0874d7cdemr203375485a.58.1728463072097; Wed, 09 Oct 2024 01:37:52 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ae75615aa2sm439643585a.14.2024.10.09.01.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 01:37:51 -0700 (PDT) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Sergey Shtylyov , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rasesh Mody , GR-Linux-NIC-Dev@marvell.com, Igor Mitsyanko , Sergey Matyukevich , Kalle Valo , Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Bjorn Helgaas , Alex Williamson , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Jaroslav Kysela , Takashi Iwai , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mostafa Saleh , Andy Shevchenko , Hannes Reinecke , John Garry , Soumya Negi , Jason Gunthorpe , Yi Liu , "Dr. David Alan Gilbert" , Christian Brauner , Ankit Agrawal , Reinette Chatre , Eric Auger , Ye Bin , =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= , Pierre-Louis Bossart , Maarten Lankhorst , Kai Vehmanen , Peter Ujfalusi , Rui Salvaterra , Marc Zyngier Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, ntb@lists.linux.dev, linux-pci@vger.kernel.org, linux-staging@lists.linux.dev, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-sound@vger.kernel.org Subject: [RFC PATCH 08/13] PCI: MSI: Use never-managed version of pci_intx() Date: Wed, 9 Oct 2024 10:35:14 +0200 Message-ID: <20241009083519.10088-9-pstanner@redhat.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241009083519.10088-1-pstanner@redhat.com> References: <20241009083519.10088-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pci_intx() is a hybrid function which can sometimes be managed through devres. To remove this hybrid nature from pci_intx(), it is necessary to port users to either an always-managed or a never-managed version. MSI sets up its own separate devres callback implicitly in pcim_setup_msi_release(). This callback ultimately uses pci_intx(), which is problematic since the callback of course runs on driver-detach. That problem has last been described here: https://lore.kernel.org/all/ee44ea7ac760e73edad3f20b30b4d2fff66c1a85.camel@redhat.com/ Replace the call to pci_intx() with one to the never-managed version pci_intx_unmanaged(). Signed-off-by: Philipp Stanner --- This MSI part here is probably the part of the series that needs most attention. --- drivers/pci/msi/api.c | 2 +- drivers/pci/msi/msi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c index b956ce591f96..c95e2e7dc9ab 100644 --- a/drivers/pci/msi/api.c +++ b/drivers/pci/msi/api.c @@ -289,7 +289,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, */ if (affd) irq_create_affinity_masks(1, affd); - pci_intx(dev, 1); + pci_intx_unmanaged(dev, 1); return 1; } } diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index 3a45879d85db..53f13b09db50 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(pci_write_msi_msg); static void pci_intx_for_msi(struct pci_dev *dev, int enable) { if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG)) - pci_intx(dev, enable); + pci_intx_unmanaged(dev, enable); } static void pci_msi_set_enable(struct pci_dev *dev, int enable)