From patchwork Wed Nov 13 12:41:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873604 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 3F1F01FF7BA for ; Wed, 13 Nov 2024 12:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501758; cv=none; b=ZtYVPiZWp4/Kdmr3ioG/Sv4WYqaIYhzNzQEJtSlcVx53HmpLli81ehQjQ8aBjMQD5b2y2SrhLQohTVe6/WRZCx5zDqF0vTAn9DPZDC5pHLjkZjhTSMZTDVQnKz4oO0shdhJvR4QeTc3Cuvzh5ZPG+WVYEPjgvjqxoJ5XJMfkGII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501758; c=relaxed/simple; bh=bgMBIrqJQ9t8T1fEYfqtJT8lwKygdOf5COXhN7ImFl0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YM57ph8dR419wOWbrodYa6BQ6eGFAtW7aj64frI8vp+tdJa1kslR/0FyqWuca9TtJGphEuHPpKw3HIdZxlbDMllKycORGatMNwLpZYKZKQpJZ8dXBW5mudIzIdalMOkbf4Gd7R/EblNsRLqQxleYDixLxamIPkypOTPBjr3VgUw= 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=XL+m+3ib; arc=none smtp.client-ip=170.10.133.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="XL+m+3ib" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501755; 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=40yBQL1XcEoYGtru1ianOSHWnjsf7gEjQJGHFwcCtv4=; b=XL+m+3ibNuYo5FUr+cUZKKak7uafOUgPanYIv+ypG51R1NA0nI5zC6hEjRqQBEmsDfjuzV xYVztn2y803+TFoSGWsqgKxFRx3xoagP0U7pdWqlRv1M82cZpcMyxRsLJ/ukKx+NRP9Nhj GJh0ABHv/YdlbgllmCHwtEuQQToRme4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-184-dueGQNuAOqiL1Sp8NZBSVw-1; Wed, 13 Nov 2024 07:42:34 -0500 X-MC-Unique: dueGQNuAOqiL1Sp8NZBSVw-1 X-Mimecast-MFC-AGG-ID: dueGQNuAOqiL1Sp8NZBSVw Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d462b64e3so3574147f8f.3 for ; Wed, 13 Nov 2024 04:42:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501753; x=1732106553; 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=40yBQL1XcEoYGtru1ianOSHWnjsf7gEjQJGHFwcCtv4=; b=X7RciNBqe5TSqX3UTKT6kxh0oiQdkEN2bPvGbkWpd3ISW4y4ZxfTl38NOm7thn96cL KgBazrSPQqXlNfuCtGKy+yr6QpZYFo2ltMsMqUxfONvWs9BDlMceFZWzpAbFz7XZJ2Qu tn+k4DyNdtPq8gsA7UKKgr3xM8NTGuaXqHpkHxIfDcSBZYMTSxQCzD+H6zs7VwRwZYRO /7k+AEw40PtbBZnRtHUbnJ6qpO2zjNDdfJua2Y7ovupecWe0Og7qjVLE6OOXmVB5/VAH GbLwDU93TtNniQniWnr2uJWuC3s+WXtWLoeBSv92ECpF+UT7lInq//UpL6+I274xZAQv tiPQ== X-Forwarded-Encrypted: i=1; AJvYcCV6lNyKtVyN1GANTd9i7bVvc3Br7kV0xDxRSwmxXnT2kDdN2yyFf+3+aMnBSJyZ8dBrSuA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+FEAf+uEtpzQMGxvEB0TdNQiP157S71RURuHyeCh+/Qefwk17 uk33NvNTYqWfqdNPPgvbldjfuQX5gygGjtjKf/lHeFrJgtvFfwSyy7L32lgf91cI2Zqh5RTD938 LSMp76hsBR+bqZKVcgaMRziQ0AHIUXuGXnQJyNqaTWqujYQwJQQ== X-Received: by 2002:a05:6000:1566:b0:37d:501f:483f with SMTP id ffacd0b85a97d-381f187fa4fmr18333234f8f.44.1731501752897; Wed, 13 Nov 2024 04:42:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IG88cAt9vbjd+Fv+tUe500AG/cZtHBmig9dl5++H5KHNhJiR6Bbh9nCCmpa1PrZQ9oi5jDTmQ== X-Received: by 2002:a05:6000:1566:b0:37d:501f:483f with SMTP id ffacd0b85a97d-381f187fa4fmr18333208f8f.44.1731501752404; Wed, 13 Nov 2024 04:42:32 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:32 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 01/11] PCI: Prepare removing devres from pci_intx() Date: Wed, 13 Nov 2024 13:41:49 +0100 Message-ID: <20241113124158.22863-3-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pci_intx() is a hybrid function which sometimes performs devres operations, depending on whether pcim_enable_device() has been used to enable the pci_dev. This sometimes-managed nature of the function is problematic. Notably, it causes the function to allocate under some circumstances which makes it unusable from interrupt context. To, ultimately, remove the hybrid nature from pci_intx(), it is first necessary to provide an always-managed and a never-managed version of that function. Then, all callers of pci_intx() can be ported to the version they need, depending whether they use pci_enable_device() or pcim_enable_device(). An always-managed function exists, namely pcim_intx(), for which __pcim_intx(), a never-managed version of pci_intx() has been implemented. Make __pcim_intx() a public function under the name pci_intx_unmanaged(). Make pcim_intx() a public function. Signed-off-by: Philipp Stanner Reviewed-by: Damien Le Moal --- drivers/pci/devres.c | 24 +++--------------------- drivers/pci/pci.c | 29 +++++++++++++++++++++++++++++ include/linux/pci.h | 2 ++ 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index b133967faef8..d32827a1f2f4 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -411,31 +411,12 @@ static inline bool mask_contains_bar(int mask, int bar) return mask & BIT(bar); } -/* - * This is a copy of pci_intx() used to bypass the problem of recursive - * function calls due to the hybrid nature of pci_intx(). - */ -static void __pcim_intx(struct pci_dev *pdev, int enable) -{ - u16 pci_command, new; - - pci_read_config_word(pdev, PCI_COMMAND, &pci_command); - - if (enable) - new = pci_command & ~PCI_COMMAND_INTX_DISABLE; - else - new = pci_command | PCI_COMMAND_INTX_DISABLE; - - if (new != pci_command) - pci_write_config_word(pdev, PCI_COMMAND, new); -} - static void pcim_intx_restore(struct device *dev, void *data) { struct pci_dev *pdev = to_pci_dev(dev); struct pcim_intx_devres *res = data; - __pcim_intx(pdev, res->orig_intx); + pci_intx_unmanaged(pdev, res->orig_intx); } static struct pcim_intx_devres *get_or_create_intx_devres(struct device *dev) @@ -472,10 +453,11 @@ int pcim_intx(struct pci_dev *pdev, int enable) return -ENOMEM; res->orig_intx = !enable; - __pcim_intx(pdev, enable); + pci_intx_unmanaged(pdev, enable); return 0; } +EXPORT_SYMBOL_GPL(pcim_intx); static void pcim_disable_device(void *pdev_raw) { diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 225a6cd2e9ca..c945811b207a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4480,6 +4480,35 @@ void pci_disable_parity(struct pci_dev *dev) } } +/** + * pci_intx_unmanaged - enables/disables PCI INTx for device dev, + * unmanaged version + * @pdev: the PCI device to operate on + * @enable: boolean: whether to enable or disable PCI INTx + * + * Enables/disables PCI INTx for device @pdev + * + * This function behavios identically to pci_intx(), but is never managed with + * devres. + */ +void pci_intx_unmanaged(struct pci_dev *pdev, int enable) +{ + u16 pci_command, new; + + pci_read_config_word(pdev, PCI_COMMAND, &pci_command); + + if (enable) + new = pci_command & ~PCI_COMMAND_INTX_DISABLE; + else + new = pci_command | PCI_COMMAND_INTX_DISABLE; + + if (new == pci_command) + return; + + pci_write_config_word(pdev, PCI_COMMAND, new); +} +EXPORT_SYMBOL_GPL(pci_intx_unmanaged); + /** * pci_intx - enables/disables PCI INTx for device dev * @pdev: the PCI device to operate on diff --git a/include/linux/pci.h b/include/linux/pci.h index 573b4c4c2be6..6b8cde76d564 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1353,6 +1353,7 @@ int __must_check pcim_set_mwi(struct pci_dev *dev); int pci_try_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); void pci_disable_parity(struct pci_dev *dev); +void pci_intx_unmanaged(struct pci_dev *pdev, int enable); void pci_intx(struct pci_dev *dev, int enable); bool pci_check_and_mask_intx(struct pci_dev *dev); bool pci_check_and_unmask_intx(struct pci_dev *dev); @@ -2293,6 +2294,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) { } #endif +int pcim_intx(struct pci_dev *pdev, int enabled); void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar, const char *name); From patchwork Wed Nov 13 12:41:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873605 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 45C26200C99 for ; Wed, 13 Nov 2024 12:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501760; cv=none; b=FapwRixZC9iNTGX/6Wd2usMyuhnIboBVoVA0jFYXTd7tuC7Egr7plxqFwxUDzQqqM7pwO+gEPnkd5COCJPVcZEtpER2fgDQDVxzzEVcXk3ISRieTtKNAOzG1NmCqNLnI7Bx4n8++Ziird2yTZvyls0ixdQiwbgPQrNaISSXp5qw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501760; c=relaxed/simple; bh=dO0Bt5S9xKcwhKAQUQyexaV6kggyDnL6IVx7RfRRupg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tOiiy9GehZwc5SEnfrASSjI6RTBXtZwOZqch5skwvLxm9q3SfD+3Wxpwdxmg2TMP1HUYfwBjOc6s1kz3WQymlLFAnUn9QSgejGV3HeISqczn1NoeCZ3cWqAZK/7CvY56vLE1eeb4r+QmXnfvGIe4ANx5HrendAoaXCnNY3bbg9A= 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=VY2zWb8g; arc=none smtp.client-ip=170.10.133.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="VY2zWb8g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501757; 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=2UdUsG2Ce2FuhD+Vr0J1b3PhjfLKCU3S+xUJ9DfCqJQ=; b=VY2zWb8gPbG6gXH1s73Fkb6J4iDC2pyaem5dDS5/hZ/uR24q90F4I3ex6CkPcRSDXm87/E enWzJMRXv3t2fIskDTeGK3nKeqt/DU59vYW6cD09CBrqtSC2N6p9oXXN8QNe+exScjnryR i4CubUKKO/veMEoCOirm0gY1J0WP8Ck= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-56BFbYxSNPyfz3RYxMVmHw-1; Wed, 13 Nov 2024 07:42:36 -0500 X-MC-Unique: 56BFbYxSNPyfz3RYxMVmHw-1 X-Mimecast-MFC-AGG-ID: 56BFbYxSNPyfz3RYxMVmHw Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d5ca192b8so479990f8f.1 for ; Wed, 13 Nov 2024 04:42:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501755; x=1732106555; 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=2UdUsG2Ce2FuhD+Vr0J1b3PhjfLKCU3S+xUJ9DfCqJQ=; b=KKtSbBD/fafqCQAwd+Tfw0ECe4HTUlSLI70wy61GOhdBXGDXlJ1YVLShq9HYsPaU0D nmt3XJcVkr8UB0OLYozbR25I9aGDjb6dFZ9jo1BtYhdE/FCvKP9lpqG4Dhps11NfaorT O5Ie3gSDdYehhsLyCDGYPwDYrHmQ0433pgiK7+J7MngvnoNA36r4W3yn+A1NtAXUoSye O1ZPRbsA4cIfxUu1gPS4QlMcMBESpdtWxSUlCU+AhaVopNfkWqbIGeSPHrvKV/gYQ3Vz 6kMkCMfMvS0vHkMqySkQlX2Kc9ghiTUNIQoCEmsKCQ997nTqq4naGYVbo0Kd9GUHw9a8 kmLA== X-Forwarded-Encrypted: i=1; AJvYcCX5nNFpEeoDBmr9ujFt5nzVBJYNVSyCGHknPtc7VUPUAZWLEW8S41ZqskLuYIRGJw+ykoQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9JtNa1UAiDr/ECfTAHqWFL2l87rMHUNbkP26VENbETnOeNSlH ynbR4d9TDHk72fEEMWE5jdcEaoXS5BO7FMEwg+70F8uvD0w2JbooyXLUXhVJD7RUEJRZZV2e2he 2zuatER3f5ts0UqBEImVWVO6Cob3+I2bdnsXkzUMtRqKXZAzAcw== X-Received: by 2002:a05:6000:2d84:b0:381:f443:21c6 with SMTP id ffacd0b85a97d-381f44325dbmr11520859f8f.0.1731501755011; Wed, 13 Nov 2024 04:42:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpGOsc1jx0uRyavECo6HCq0VfxiOW2oXCFxduoG1UVcDJiaH+xI1Ywem/WU8zILNl7MjLF9A== X-Received: by 2002:a05:6000:2d84:b0:381:f443:21c6 with SMTP id ffacd0b85a97d-381f44325dbmr11520807f8f.0.1731501754619; Wed, 13 Nov 2024 04:42:34 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:34 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 02/11] drivers/xen: Use never-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:50 +0100 Message-ID: <20241113124158.22863-4-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. xen enables its PCI-Device with pci_enable_device(). Thus, it needs the never-managed version. Replace pci_intx() with pci_intx_unmanaged(). Signed-off-by: Philipp Stanner Acked-by: Juergen Gross --- drivers/xen/xen-pciback/conf_space_header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c index fc0332645966..8d26d64232e8 100644 --- a/drivers/xen/xen-pciback/conf_space_header.c +++ b/drivers/xen/xen-pciback/conf_space_header.c @@ -106,7 +106,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) if (dev_data && dev_data->allow_interrupt_control && ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE)) - pci_intx(dev, !(value & PCI_COMMAND_INTX_DISABLE)); + pci_intx_unmanaged(dev, !(value & PCI_COMMAND_INTX_DISABLE)); cmd->val = value; From patchwork Wed Nov 13 12:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873606 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 076DD2022F3 for ; Wed, 13 Nov 2024 12:42:40 +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=1731501762; cv=none; b=qeby6CovCsjHxr5ETMvOWs+lYwnDjYm+gRn+nE9LdjxyUY2HYITZkE8tGuncxbVfEli5FWkFE6lUjx7nmqj9HzjgxXuPzLgpUiYd9H/FcIwO+aLuuFuPU/CfUcLRCLefHhW6HXHVIYb5acF2LpWs3jQTGQDPRvzyO/KPdJCAhSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501762; c=relaxed/simple; bh=aUCGLjcQl9VmrAUkFfZbWR6faxCWERPxZ3SRIvsnn3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SklpRhV7t/nlFBbF7MUUmS/3CGaoDPOf/NCGbWsR6n1x2X3XFgc6GRVXrH7LwxURUl9orgiUJmWGepsvDFSSeu0ARV0QHzGVZ8+M4oG82xTqsMJpmZiU6f/xhOCLXbcVAk0VvpNXqFVRE8yh1qreebDpYNXggv9UbkxX3VYE6Fc= 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=MGbp1b4a; 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="MGbp1b4a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501759; 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=SZ3Ct+htOyFcNtVrHcgotVRsHQNuDZcXgRKY/qB2q+Y=; b=MGbp1b4aryyHuIOclsujcc+SFZCP2fTokwnW4qv0v4IovZcT0hWJ7ir4FUKZNrR4yi8FCM OFPlXZQ533ISngZgKXTdDyUB7ynqpvl1MReGzmbBGoriA4UguKrdeuLb333y0pW/rUROr6 9fg/npPetSCxMnkidCL4/DchDGrZmPk= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-267-u9JXB-KiMN-1iMJoBjbstw-1; Wed, 13 Nov 2024 07:42:38 -0500 X-MC-Unique: u9JXB-KiMN-1iMJoBjbstw-1 X-Mimecast-MFC-AGG-ID: u9JXB-KiMN-1iMJoBjbstw Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-37d47127e69so3552771f8f.1 for ; Wed, 13 Nov 2024 04:42:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501757; x=1732106557; 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=SZ3Ct+htOyFcNtVrHcgotVRsHQNuDZcXgRKY/qB2q+Y=; b=P9l+f+30Ht4VIg9pa9+MwTMignRA3neEDZ7bKDaWyu+pxb86UZ4S1MIBy2tZwF7J3b oWcrCVVk/HXgVSQNwRU9JL9S/cRpV7y5V5+qNmQbDDxQzPZCvDN4xt9891K5Hnm5G22v 46x8l7T6f4IqH5AeKrF+/OPlvAJx1DTWqvrXW5KLDG7lhRXxVqoxTRGZWt9+ufyr5lOI CNhzD1hjfqaJ1w6KEEIe4iueycGe6ppuqcVwsniNgQZc7PQtJuf1Ji5FHewDOwUP1KNP tiLnfroO/DsWafDocrTORikZDDGH+22JgC6DbMqdvXIPfuB40g+5RyNL9n8Vw6/aoNDE 3ZDg== X-Forwarded-Encrypted: i=1; AJvYcCWMi4E0lc0UA2kYfLxyaDIT9uSWYctd5WLm/GIZAbwLNu6zuM61JDYmRFXzrMU/lmujAqE=@vger.kernel.org X-Gm-Message-State: AOJu0YzvuwjYgCjasKvl+D3uMuJ0KgJrnDBSBf6fUe4v2bzEbA/YgUPt ic0jIywNKU0cxJKWrwC5GdC7FJDP1LjTYf1IUBzf5wHN82zSphmgLcZt5XUpRPQ79psnFC8Hqqg 3iL3s/VC8+f6Vg0Utc+9fJ5/pK/xYdYnCqjavY/sorrVXiDv3Pw== X-Received: by 2002:a5d:64c5:0:b0:37d:52e3:e3f0 with SMTP id ffacd0b85a97d-381f1883da1mr17924915f8f.44.1731501757424; Wed, 13 Nov 2024 04:42:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHe7Ekl12tv+ThW/wGcJN/HoeLWpkbF0cAp2d3sxxoUKqIzhIJ/U/mQj+3PQSguFn+Xr9yXfw== X-Received: by 2002:a5d:64c5:0:b0:37d:52e3:e3f0 with SMTP id ffacd0b85a97d-381f1883da1mr17924840f8f.44.1731501756841; Wed, 13 Nov 2024 04:42:36 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:36 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 03/11] net/ethernet: Use never-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:51 +0100 Message-ID: <20241113124158.22863-5-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. broadcom/bnx2x and brocade/bna enable their PCI-Device with pci_enable_device(). Thus, they need the never-managed version. Replace pci_intx() with pci_intx_unmanaged(). Signed-off-by: Philipp Stanner --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +- drivers/net/ethernet/brocade/bna/bnad.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 678829646cec..2ae63d6e6792 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -1669,7 +1669,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp) REG_WR(bp, IGU_REG_PF_CONFIGURATION, val); if (val & IGU_PF_CONF_INT_LINE_EN) - pci_intx(bp->pdev, true); + pci_intx_unmanaged(bp->pdev, true); barrier(); diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ece6f3b48327..2b37462d406e 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -2669,7 +2669,7 @@ bnad_enable_msix(struct bnad *bnad) } } - pci_intx(bnad->pcidev, 0); + pci_intx_unmanaged(bnad->pcidev, 0); return; From patchwork Wed Nov 13 12:41:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873607 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 ED24D203713 for ; Wed, 13 Nov 2024 12:42:42 +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=1731501765; cv=none; b=Fo/EgYzSp6aD4aFFIrlvWFZtcT5V8xZi6F1mSKbiEEFdIFDFzmRj8le1H4UtfUM+NpwJ6XT/YPsTMC1Ddca5hxz/pT2q6fSIYP7KL/GHoCYRs3vig5/dxPVlQFXI/HSP+GAbEtSR3cLWQ45Ea+2RXdoAgXzbJKb7Rd0qeL3rUJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501765; c=relaxed/simple; bh=FwPT6FGBHOp4TzyWZ+h6yZzXXEFY9IxzClXNmK7SQw8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fUvLOmOO7C8pFVU6i0LMflJKhiPGSJRvxUkSWRqK5VuVaZ4p0ntgS+wUUtZ2sYq6HtAO4nf/ABcN6yORsr12ujXy78B1vpOuKzCMB0U8CdvKlMMb0WX1g1uULNCdI3UT9kzOxIwXiDXkZOXbqdTRFll+Wv3qQlDr7mQENWaERBI= 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=JUBUb2sJ; 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="JUBUb2sJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501762; 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=gh5xBESPiuO8YtWqrs+YzUNc8fkB81YlCR9KwN+kONI=; b=JUBUb2sJ6lmLtjD2P+zpgM/hMKmQgPxZ4LkmPmnHXriC5evhoMxhguZvZCUSzt5LXTBkMV kxS0VS4tADjKCdYYzfzQjpg3kd1zAcYOQvrFl2xFPXEMciBavlInIrQ5SfxS5+wkxzRi1D xCrriWhrIBToFTdElOFVSdjBfCPDOSI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-149-3VuUWeOkNmCBuZ8uNMooGg-1; Wed, 13 Nov 2024 07:42:40 -0500 X-MC-Unique: 3VuUWeOkNmCBuZ8uNMooGg-1 X-Mimecast-MFC-AGG-ID: 3VuUWeOkNmCBuZ8uNMooGg Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4315dd8fe7fso63095885e9.3 for ; Wed, 13 Nov 2024 04:42:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501759; x=1732106559; 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=gh5xBESPiuO8YtWqrs+YzUNc8fkB81YlCR9KwN+kONI=; b=gktHk8/w1VH2QkSIqrfxSknRMDG7PCVKoGy5WBN6rBgzmIzbjUW1D2l/LSW0b2uzrJ c/Lrs8SEaTWjETjmHXeNh+c18KFiTIvibnKfV2N9GVOOKNjWQHkoYWBiKmjja/utidOK vrcXWduGC0qbwZO4d1Hfy4EhXa3il2qsUSRtTCOvAGVFDtzWP9A1DS3uypLOMYzN4oDm +8/6cyX82YSKciT7pASJzjHFPynQgdlWNIIPsst0VG13Ai6IPxx0DeJxBoZfMHAm2MUS cXewv6ZJwFI9uftHTCSU3K3fZAiV9HYVS1EfotEEEJFRoO9Bif09IhcAw1xPDdYSTS3O 2D8A== X-Forwarded-Encrypted: i=1; AJvYcCXAqAmzA5wP3es/TfiNiFFJVNFRQcbvmRkl9BqkA3mkM0qc1nm0QuKsToKIC8qIChSGK4I=@vger.kernel.org X-Gm-Message-State: AOJu0YwcC6jPdWVia5eBB4Of1rCVVuDNa2Wufl1Es7eeBWBxqCximkKi YgResHPL4SE2J0B4cfHynq745kBtqiXwpUr+fdVkGW8OQkD7JJFt0K1Vk83F1UwIiYwF1s8UhGr K5XCXstfyd0hmkz28k1hxeQn5afjI759uzqaLJdiJsqI4yjLONg== X-Received: by 2002:a05:6000:1868:b0:37c:d1ea:f1ce with SMTP id ffacd0b85a97d-381f1871ae1mr21127494f8f.25.1731501759573; Wed, 13 Nov 2024 04:42:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjSkicOa2vHaglKeMl2d4NOiMMxDq6ITRAVtvhVhWcLJvAFiM/FAEZ/6qNVryGFEz3sYUTmQ== X-Received: by 2002:a05:6000:1868:b0:37c:d1ea:f1ce with SMTP id ffacd0b85a97d-381f1871ae1mr21127442f8f.25.1731501759149; Wed, 13 Nov 2024 04:42:39 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:38 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 04/11] net/ntb: Use never-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:52 +0100 Message-ID: <20241113124158.22863-6-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. hw/amd and how/intel enable their PCI-Device with pci_enable_device(). Thus, they need the never-managed version. Replace pci_intx() with pci_intx_unmanaged(). Signed-off-by: Philipp Stanner Acked-by: Shyam Sundar S K #for ntb_hw_amd.c Acked-by: Dave Jiang # for ntb_hw_gen1.c --- drivers/ntb/hw/amd/ntb_hw_amd.c | 4 ++-- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index d687e8c2cc78..b146f170e839 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev, err_msi_enable: /* Try to set up intx irq */ - pci_intx(pdev, 1); + pci_intx_unmanaged(pdev, 1); rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED, "ndev_irq_isr", ndev); @@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev) if (pci_dev_msi_enabled(pdev)) pci_disable_msi(pdev); else - pci_intx(pdev, 0); + pci_intx_unmanaged(pdev, 0); } } diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c index 079b8cd79785..9ad9d7fe227e 100644 --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c @@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev, /* Try to set up intx irq */ - pci_intx(pdev, 1); + pci_intx_unmanaged(pdev, 1); rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED, "ndev_irq_isr", ndev); From patchwork Wed Nov 13 12:41:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873608 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 796D52040AC for ; Wed, 13 Nov 2024 12:42:45 +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=1731501767; cv=none; b=FN7mPnL8fJ1UteJrk1A8TQHtryBQtEDkhuvajkKzdrSkxhxaeq0dEIy0N/3JhDCFsVh3KMVcA6jPQ+xB9SsXJxtA6MVotu9+X/Q27jXcfedOzylv4i3h5ZDsLOhn02u8OCFMb1Byojs9oaufGO2OVchKxmY3yD3dh+s4WXsKcNU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501767; c=relaxed/simple; bh=pl7sVd3EkZjYz8a4hu3qyOtH7RHbVGi7fS/efUFEh0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uZIw+PYTqibwmOVboY3bY5i7RT2YLrM7/ORR50rl261pvQg09FKbaaTXJkNPZaMV4uRoYRDD5wWxXPcJp8iBiqVww+lP9PTsT3aWtIIwix5+XRbwtuNXjQ+l5HDZCOU7DwSbDrbG+EQU4x8MFfQufcZjetGGDeZ21Ii/nZ+xGgs= 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=dW5YAEf/; 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="dW5YAEf/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501764; 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=i/tiT1oHv++iZFY5S8iNVJ0nRwrLe5bjQFEltGuWg0g=; b=dW5YAEf/5ooFCvuwzB2bhR29pORWvhGocapDFKbI3wVrrqDSxhe877FphXca2zFj7+EZBz 5dnpIGTZ3FiS3DhMKt41mu0k6uuat30/KyuvoO8b8XqgIyM+XKhqbcQeV4VkAQ4sUnFH8e SvMekspMgA7Q3m587ffAuINscP7JVmg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-_Fm162JhPLeUGVdhxWpHHQ-1; Wed, 13 Nov 2024 07:42:43 -0500 X-MC-Unique: _Fm162JhPLeUGVdhxWpHHQ-1 X-Mimecast-MFC-AGG-ID: _Fm162JhPLeUGVdhxWpHHQ Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-37d589138a9so4188105f8f.1 for ; Wed, 13 Nov 2024 04:42:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501762; x=1732106562; 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=i/tiT1oHv++iZFY5S8iNVJ0nRwrLe5bjQFEltGuWg0g=; b=Sbu4/svOaz06tGwX8oUdWx1IAk87q/zQgmHJi6rf+KSXoaHa96q2FQ7SlIGhu1L5Gh 3G+mNmPYtBHqmmH25jWFMNxKFnhF6MUYbKnKI9KPPgf1vIPR+pMAD613Ur80nKzAuI91 CHF3DyMTxUfSsxwTxmNh2wGbMKk+rB3ztSJzwcVIUJH8G+X9Yi72Fem/oMRGuj4E5CGi j1JAWNFzU6NRby3qiw3QsyrbX3BkqrF4gvzci1k1kHLK2w1UodvDFmb+rxZldVDEx/xq Np/ZOBpK6694YpVfv8RS1G9xacSN9b6NequHnmHR5Wcm4pv2zCBw5N3oEKuStTuNJgk7 0h9g== X-Forwarded-Encrypted: i=1; AJvYcCU2Zmm8ek0CNe4HFyHWNx68nSZv6e6rmRmWPX5p4EiiKJX7YRx6aSderjEHR7BjAf91M4E=@vger.kernel.org X-Gm-Message-State: AOJu0YyQKrRmMku50Rdi2JG7FYThtAykAJDrCFBgD23gY4zmRJjdocXd bM/cBS9N8Z76byIk40mxtQfUdBBKPzZQvmw87YeBUUivMnYtXhbWrWh60m8fOmKMan2h+QJARX+ CevqrUU6Jx6Xmnj34bpKPFXkqUIuY/1fvU1Z6HlI8rWi23Qa/Qw== X-Received: by 2002:a5d:5983:0:b0:381:bdeb:1799 with SMTP id ffacd0b85a97d-381f186cd09mr18144231f8f.16.1731501761782; Wed, 13 Nov 2024 04:42:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5699iopflHa4MIh1vN3HWtOXM+FnSWh5U2CqZjf/QXNdmzfM7vRlX36oxsyFaMlA1GtkJXQ== X-Received: by 2002:a5d:5983:0:b0:381:bdeb:1799 with SMTP id ffacd0b85a97d-381f186cd09mr18144148f8f.16.1731501761273; Wed, 13 Nov 2024 04:42:41 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:40 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 05/11] misc: Use never-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:53 +0100 Message-ID: <20241113124158.22863-7-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. cardreader/rtsx_pcr.c and tifm_7xx1.c enable their PCI-Device with pci_enable_device(). Thus, they need the never-managed version. Replace pci_intx() with pci_intx_unmanaged(). Signed-off-by: Philipp Stanner --- drivers/misc/cardreader/rtsx_pcr.c | 2 +- drivers/misc/tifm_7xx1.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c index be3d4e0e50cc..e25e6d560dd7 100644 --- a/drivers/misc/cardreader/rtsx_pcr.c +++ b/drivers/misc/cardreader/rtsx_pcr.c @@ -1057,7 +1057,7 @@ static int rtsx_pci_acquire_irq(struct rtsx_pcr *pcr) } pcr->irq = pcr->pci->irq; - pci_intx(pcr->pci, !pcr->msi_en); + pci_intx_unmanaged(pcr->pci, !pcr->msi_en); return 0; } diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index 1d54680d6ed2..5f9c7ccae8d2 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c @@ -327,7 +327,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, goto err_out; } - pci_intx(dev, 1); + pci_intx_unmanaged(dev, 1); fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM ? 4 : 2, &dev->dev); @@ -368,7 +368,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, err_out_free: tifm_free_adapter(fm); err_out_int: - pci_intx(dev, 0); + pci_intx_unmanaged(dev, 0); pci_release_regions(dev); err_out: if (!pci_dev_busy) @@ -392,7 +392,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev) tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt)); iounmap(fm->addr); - pci_intx(dev, 0); + pci_intx_unmanaged(dev, 0); pci_release_regions(dev); pci_disable_device(dev); From patchwork Wed Nov 13 12:41:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873609 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 608401FF7A8 for ; Wed, 13 Nov 2024 12:42:47 +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=1731501769; cv=none; b=W1VDMe/kRBZH0GyPIf3y3vTgCfCXWjuagGbTgEnzSMWQjWjKMbecpDpUX53vmT3JCxtakIi9mmWJfkVWLCaC04OEdYiaf3j4RKl89gKX9mxqhopajqLS76e6xJkf54nXF/WPgTJTUXUCMQGY9+cR1HUFaLCsdTnUDFsF+Xqhf/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501769; c=relaxed/simple; bh=aRW1yWnGapeZAVe/15kwhBfTtKfyb2GHv/JRGJfOWSg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jHmC7A05epiSa6r17h/uBnnBEc9xrGKAJq7ynQivVTMdEb1rWpreCH/QMI4lpa6GFdHg+OZGXbeYMCgojEfqqM9SQ5QJBrJg6hkNbR6E7Pslld7iyZiVAauU6xF0FOvZtRjMi8l4Nppsx+m4RRMcY8xl1UsUF9eA1iXF1ZwcD54= 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=a8Byig9J; 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="a8Byig9J" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501766; 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=op+AvZ1YCKZsOQFtb06qEXzMr+HQn8e2wB0EdtWp+RY=; b=a8Byig9JE/ZQp4SLy7ju1eoaxT8Y4ILCY39ii+0Q12RGChX02H6mns7GTVUV4LO9wkvC83 DZz2YgM3Jb9r5y2wjokXv5zUA7WAx4BzUSaPMNBoqr7jtoCse/ySzXLRlzMh4jHeyWQhpn yfydZRT4myMZod/19+9x0iA8ieBz+3c= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-461-y_xroo-TM_S7fNO8m0C-fw-1; Wed, 13 Nov 2024 07:42:45 -0500 X-MC-Unique: y_xroo-TM_S7fNO8m0C-fw-1 X-Mimecast-MFC-AGG-ID: y_xroo-TM_S7fNO8m0C-fw Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-37d95264eb4so3855547f8f.2 for ; Wed, 13 Nov 2024 04:42:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501764; x=1732106564; 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=op+AvZ1YCKZsOQFtb06qEXzMr+HQn8e2wB0EdtWp+RY=; b=ChRY8AX8gQDBsSqbfBMY0Pz7QftZ8PXSduBmLLHya+MGwPCPSFYXiEhrRheA+d/j75 hXxhv8cIHuN/ugR8BvdB83feKsWDtBCWRw+h8zea4U35DwMSQr2TAxf0lzw/v+f7Bj6e HwElBt9wGbJWy5V7bH/6PiHwhBOpUyXy8/aL1BD4UzoF+yJDVCOOf9HZ1mxAPqWxNwGs HXZIMy/t552j9MuaLqyLMSrRG7SoBeexLTP+SmN1SuN/IjpJvN8QpayQrtVcpf7mn9jq LfgFUUqbJPf7UDVTcoToBWnGTMEwr3/JxI2f02Vx7y9VtNQhrMfY69Uoroim5H3HeyNj lMRg== X-Forwarded-Encrypted: i=1; AJvYcCU8vAORBf18Im02dhH8J9Cq+7L4Lw6NoesIRJnpDSE1D/TbzZZmMyHT53sdHvyWhtxbVrY=@vger.kernel.org X-Gm-Message-State: AOJu0YxrCY2Onw9kTKR6SExDRlmQal5dSie+zGB2KDGnLfW0Na5J0FCT KMsYYoOgRc5Thb6qKPZRNPhaxOFfLvLsC3EM1KhrD16C7RFTBdWhpkxIyRvNm5EAwkCWPPWUosz 33KbZDQH2XxdYm2CJ/xtuA+vYLhyR3oXPWLfiDWIwujWbErR0jQ== X-Received: by 2002:a05:6000:704:b0:382:d0a:fe4e with SMTP id ffacd0b85a97d-3820df7add5mr2320641f8f.40.1731501763949; Wed, 13 Nov 2024 04:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvKoYvBUp37kzzcOw/kNuKZIW7fG0pUujGd0dqmiteiiQa85bm4vAcxVjs1ubCq0XbXcf6/A== X-Received: by 2002:a05:6000:704:b0:382:d0a:fe4e with SMTP id ffacd0b85a97d-3820df7add5mr2320584f8f.40.1731501763480; Wed, 13 Nov 2024 04:42:43 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:43 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 06/11] vfio/pci: Use never-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:54 +0100 Message-ID: <20241113124158.22863-8-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. vfio enables its PCI-Device with pci_enable_device(). Thus, it needs the never-managed version. Replace pci_intx() with pci_intx_unmanaged(). Signed-off-by: Philipp Stanner --- drivers/vfio/pci/vfio_pci_core.c | 2 +- drivers/vfio/pci/vfio_pci_intrs.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 1ab58da9f38a..90240c8d51aa 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev) if (vfio_pci_nointx(pdev)) { pci_info(pdev, "Masking broken INTx support\n"); vdev->nointx = true; - pci_intx(pdev, 0); + pci_intx_unmanaged(pdev, 0); } else vdev->pci_2_3 = pci_intx_mask_supported(pdev); } diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 8382c5834335..40abb0b937a2 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev) */ if (unlikely(!is_intx(vdev))) { if (vdev->pci_2_3) - pci_intx(pdev, 0); + pci_intx_unmanaged(pdev, 0); goto out_unlock; } @@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev) * mask, not just when something is pending. */ if (vdev->pci_2_3) - pci_intx(pdev, 0); + pci_intx_unmanaged(pdev, 0); else disable_irq_nosync(pdev->irq); @@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data) */ if (unlikely(!is_intx(vdev))) { if (vdev->pci_2_3) - pci_intx(pdev, 1); + pci_intx_unmanaged(pdev, 1); goto out_unlock; } @@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev, */ ctx->masked = vdev->virq_disabled; if (vdev->pci_2_3) { - pci_intx(pdev, !ctx->masked); + pci_intx_unmanaged(pdev, !ctx->masked); irqflags = IRQF_SHARED; } else { irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0; @@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix) * via their shutdown paths. Restore for NoINTx devices. */ if (vdev->nointx) - pci_intx(pdev, 0); + pci_intx_unmanaged(pdev, 0); vdev->irq_type = VFIO_PCI_NUM_IRQS; } From patchwork Wed Nov 13 12:41:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873610 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 48146206061 for ; Wed, 13 Nov 2024 12:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501771; cv=none; b=onSDHHIxrS3/yer80LvcMobYOuCzbJWG8UMZSJpjPPCVAlTesTA6cznT15Z89cDEsA3BSZjWjKAaNPu5o7D/sdNyYaUCzm9e4nRy3PA7+U5vpUtGELBg4tTrz2eX19ZpgOuhBuI+BynNlRREmRpe9ySisbXvujsc7Zc+oLzkV8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501771; c=relaxed/simple; bh=x/7QFhAzHkLj8+w14TM+V3xJvs5L48Anth4HQxPkvDk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hjAK0mi3gkwZ+yjmy5q8AbY/PmefoCKYlzh3wa32JydiK0/BlT3sRxdDQVRFwneeK2i6oytiK69FgCwBys1exWC80WYmZCrk2OP/G1bG7a4NoHSvpLfpbdMw/A69IV2fSYwAAJwZTxee7I96vvqN+vHcw/O+/mJ3OBScKPxo8nA= 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=PQjxxlg2; arc=none smtp.client-ip=170.10.133.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="PQjxxlg2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501768; 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=NsJKOkpA+QoYlzqeYDbY0Dl9xjdlxWNvzFNzd4dMwhk=; b=PQjxxlg2DkGN8DG4vDH2PICeQs7kfCV2vBxNb/MtQ5DRbGuhW/MiIKDE6PuOaRm40l3tcy W+e8/hg95847ObDgplNAfPVqeuzdo5M00Podq0E++NffN07EKi3f4GrXOUmKSWsprA6zOV VdeYK2RZYJzsOgN5GXYpunoFH0olmtA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-568-l9XOEAxHM4aIira7b5OThw-1; Wed, 13 Nov 2024 07:42:47 -0500 X-MC-Unique: l9XOEAxHM4aIira7b5OThw-1 X-Mimecast-MFC-AGG-ID: l9XOEAxHM4aIira7b5OThw Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4315f48bd70so48007665e9.2 for ; Wed, 13 Nov 2024 04:42:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501766; x=1732106566; 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=NsJKOkpA+QoYlzqeYDbY0Dl9xjdlxWNvzFNzd4dMwhk=; b=f09SnbOgtmW1OMY4IuybSafPEwAOE67j7sLCqYrZu0e0BxK24lurwtzt/NfGBhm89N rQ11xiwATfb5gRNEsug+WRI3oBZm5lks8aO8b5YFwP4BaSACEKHgictMGB/ITBcbJEl/ AN06786vrHSIhGkidor/+MXSKlDMWzPlfaU0r61hBOnmD+3oJpvG+t9QVpU0xZD/OLQ4 w0Bx5bfUe/4+RJ8O/IHkysCWoUbzEI9UlwuvQXFX/NmlINkliQF6aN5DtlJMUXV3I7vm GmJDinrlstwntlvcM+qkR+PGBmZWlxNG3BbfyGP2KLecfC8JJABaukBueQbuBMWOdXWO tEiw== X-Forwarded-Encrypted: i=1; AJvYcCWUVHfFtS9Eg0lzczt+ywS/Tdf0o9/iJJfw72rgtJ2GI6dSwWn2stAoSBxjDPT+aKMxyzM=@vger.kernel.org X-Gm-Message-State: AOJu0YxNli791+pzdnOYgQmN4QhP0shpqdzbQsexhH0fbgxwuYSqbaaK VyxkW0845UrbDrz5XKir7xjXBR9Kx1CUbva3AU0yzqL83+A8VLg8RpaS67Fx7Mppih9FUiVn8lE CSf4l0QrrqigpY6vL9t61ndnTsSslkNaLCGSuPZlT/0ThDfwPyg== X-Received: by 2002:a5d:47ac:0:b0:37d:5282:1339 with SMTP id ffacd0b85a97d-3820df6136cmr2369037f8f.22.1731501766129; Wed, 13 Nov 2024 04:42:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpjkcG3JEnob3xzqfsNCARyMkng1y9gR5mdhMcNm6Gi1JEJjom42U2s4Q7CInAPcp8pAzepA== X-Received: by 2002:a5d:47ac:0:b0:37d:5282:1339 with SMTP id ffacd0b85a97d-3820df6136cmr2368992f8f.22.1731501765706; Wed, 13 Nov 2024 04:42:45 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:45 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 07/11] PCI: MSI: Use never-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:55 +0100 Message-ID: <20241113124158.22863-9-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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 --- 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) From patchwork Wed Nov 13 12:41:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873611 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 DA439206E7A for ; Wed, 13 Nov 2024 12:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501773; cv=none; b=Z28O3Upq97JcSMAZhTuiegAWkIDLTBk2hP0a6fBSfBHfpOmQe68TalXVOojzViIUYdwCTaHqvq86rfyNJiVakiOn99gbckrcFMq5GKu9Izx7sfRXN18We1EOy/Euix4aqcq4D78m4BSi+T8Wj0nz5Zwqtz5PNFVuSeSrGgvyBEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501773; c=relaxed/simple; bh=MUiRmak5FNTX4BeqThw6CC4zJAkFAsefAFRx+ZXrFxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ovKRG2uo+XquqFfiqKabG54/cABiDpF+oC3spswGyItb0Tdy27fLhfGg0UC0J5Nsz67YZ/SkQsa/TNTf5mEGKpumX10dx+00AhwH+a58wBj3yKXJAXiAvqpZP3QeRNtB6WbFcG25Rvklv30HLt5p83JyLUF/5rQmIPp+lLPJX3I= 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=DMVLuTmA; arc=none smtp.client-ip=170.10.133.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="DMVLuTmA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501771; 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=b5TnIcD2VuI/o8JjOCySaF7mhNl7bXEt7dRvprez4ds=; b=DMVLuTmA0kuh2jx7qyVMqg6NHUoDUxiqlWTE5R60UCm3EfyfsD0qmRDwLvOaJifTpQCXP0 FJZyOsn7RJcqgZV7z1lhKyPz0wUBQ8zFLJiD8L+m8tt+UY5YBeBsnOpUWSwS5pwVD0jplE pBR6m2WDAhRfVC/d6LvLoFvTxZbDtAk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-2gg2kIsoNOCJQ_E2bNaV9w-1; Wed, 13 Nov 2024 07:42:49 -0500 X-MC-Unique: 2gg2kIsoNOCJQ_E2bNaV9w-1 X-Mimecast-MFC-AGG-ID: 2gg2kIsoNOCJQ_E2bNaV9w Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d4af408dcso3517866f8f.0 for ; Wed, 13 Nov 2024 04:42:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501768; x=1732106568; 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=b5TnIcD2VuI/o8JjOCySaF7mhNl7bXEt7dRvprez4ds=; b=v8dvOkjCXg+mD/zlPZK5Dq7XiM0luVX0+76RMGBmuKEZ5XJNz+eYINR3mmjTT/yy/S LlQ/6fniMXAUgDZ/rVjFbevTxCmbKuPuANyS18RYcDga2G7C4NIn8SHUEvxfWtr/oDZv Wjd4PxzXpQNpDhjnYtZbyYU2ED1mSRKuaReE1LoLGR+0q37RhmE8jkFqQ8M/mxU9Qicp 5JY93VUEsO8jFnLvOmm6SZYXOaWDqqVSH0TdDiapTh5R8MQ42oJh+W/qKoBiYv7RKHfV Cqwp96Ecn6xogVxgZSB5Z3vSqjA2JIRUccGOLZic9dpuQnr1JJz0Q19ceWqiBEkAhvSI SGoA== X-Forwarded-Encrypted: i=1; AJvYcCXKxMncSWFUY2RA35mkpUds+bdqg6YU8QsXpYtXzSXFOnAf+3HryT9NSBiEJcxiKU2HgTY=@vger.kernel.org X-Gm-Message-State: AOJu0YxzTK5Q1cXY1RwzI/BUVoC1DxFXYUESdEicQwX/CXmz9fMspvd7 uujfDGCbCj10aZ/Fff6DtJxNkxF03k9YoCXYHTLwFrShkokX83wikjE99TRaxHDOFiX7BcKN8fn wmK1nQIzORqqQoKU7ZUE7ZPNUkIvoj/W0380MZYKUudA85qLtBg== X-Received: by 2002:a05:6000:1849:b0:37d:4fab:c198 with SMTP id ffacd0b85a97d-381f1872412mr16049020f8f.26.1731501768603; Wed, 13 Nov 2024 04:42:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IENWR7lbl0r7wQqB6gDJ8hrTMl+DYmwC3EqYiDIUkKDx+oOeWHz/jLeLc4U+c0kMvjHX7biQA== X-Received: by 2002:a05:6000:1849:b0:37d:4fab:c198 with SMTP id ffacd0b85a97d-381f1872412mr16048957f8f.26.1731501768174; Wed, 13 Nov 2024 04:42:48 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:47 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Sergey Shtylyov Subject: [PATCH v2 08/11] ata: Use always-managed version of pci_intx() Date: Wed, 13 Nov 2024 13:41:56 +0100 Message-ID: <20241113124158.22863-10-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. All users in ata enable their PCI-Device with pcim_enable_device(). Thus, they need the always-managed version. Replace pci_intx() with pcim_intx(). Signed-off-by: Philipp Stanner Reviewed-by: Sergey Shtylyov Acked-by: Niklas Cassel --- drivers/ata/ahci.c | 2 +- drivers/ata/ata_piix.c | 2 +- drivers/ata/pata_rdc.c | 2 +- drivers/ata/sata_sil24.c | 2 +- drivers/ata/sata_sis.c | 2 +- drivers/ata/sata_uli.c | 2 +- drivers/ata/sata_vsc.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 45f63b09828a..9273ff3d4732 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1985,7 +1985,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (ahci_init_msi(pdev, n_ports, hpriv) < 0) { /* legacy intx interrupts */ - pci_intx(pdev, 1); + pcim_intx(pdev, 1); } hpriv->irq = pci_irq_vector(pdev, 0); diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 093b940bc953..d441246fa357 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -1725,7 +1725,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * message-signalled interrupts currently). */ if (port_flags & PIIX_FLAG_CHECKINTR) - pci_intx(pdev, 1); + pcim_intx(pdev, 1); if (piix_check_450nx_errata(pdev)) { /* This writes into the master table but it does not diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c index 0a9689862f71..09792aac7f9d 100644 --- a/drivers/ata/pata_rdc.c +++ b/drivers/ata/pata_rdc.c @@ -340,7 +340,7 @@ static int rdc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) return rc; host->private_data = hpriv; - pci_intx(pdev, 1); + pcim_intx(pdev, 1); host->flags |= ATA_HOST_PARALLEL_SCAN; diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 72c03cbdaff4..b771ebd41252 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c @@ -1317,7 +1317,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (sata_sil24_msi && !pci_enable_msi(pdev)) { dev_info(&pdev->dev, "Using MSI\n"); - pci_intx(pdev, 0); + pcim_intx(pdev, 0); } pci_set_master(pdev); diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index ef8724986de3..b8b6d9eff3b8 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c @@ -290,7 +290,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } pci_set_master(pdev); - pci_intx(pdev, 1); + pcim_intx(pdev, 1); return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, IRQF_SHARED, &sis_sht); } diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index 60ea45926cd1..52894ff49dcb 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c @@ -221,7 +221,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } pci_set_master(pdev); - pci_intx(pdev, 1); + pcim_intx(pdev, 1); return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, IRQF_SHARED, &uli_sht); } diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index d39b87537168..a53a2dfc1e17 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c @@ -384,7 +384,7 @@ static int vsc_sata_init_one(struct pci_dev *pdev, pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x80); if (pci_enable_msi(pdev) == 0) - pci_intx(pdev, 0); + pcim_intx(pdev, 0); /* * Config offset 0x98 is "Extended Control and Status Register 0" From patchwork Wed Nov 13 12:41:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873612 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 37C64207A03 for ; Wed, 13 Nov 2024 12:42:54 +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=1731501776; cv=none; b=VIXMXp8/kxy7xkfvqleXflWpgFYllgeFlG/doPup40sNGYFzcC+mqwLSlgVT2uVDuQV74BQczX2cMWuEmLdBBv1N4Now5uSJONfGnXyNYSmE9gFybLEtHcgrr2udF0zCaUTSXMaZkJs0UkIULLXjpU9Jdg8OB5/WpsTzoT9917A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501776; c=relaxed/simple; bh=MBsD3LRvT8a2cfMDXV+fpnigYjcMu2XVeQIVlBba0hA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nzYOcZWqc1s57Y623jy6SOTBxmHwt7sPah+Hl8xAR8R8sVwVTcogf44l3kvQcxcoD3yloKW4F0WD0lWMDPzb14JGFpjHnIO8ZhuGhJ4dKb6PUqh5BLcFSzgaWI/IcpCWfRYAEH2d//emVy+nrwzXIeRF/pjg6Dz7hSjVgbNAaeg= 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=Dopkn/pP; 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="Dopkn/pP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501773; 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=OYummHyMeO18Vto9q2ZMMfeLT6TZU1cjZPgJKtQfrDY=; b=Dopkn/pPpVANfj5j+iqitLtJX1sR7kmhTzVXei4U9f9UIuPEKg0HLKyOsG6rXt5Z7HKeNg 9WIFvjFmmFpFWjagneq5xqpyHJ2WhxhDtrqKN4NznMXDt8RmpZCGNImDGl4cfr/kh3h5yJ bzD2YZt7c+fgc/kbABoJNnBBhN5Ggs4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-RSvhk8t6PaGPFWP_6sjFWw-1; Wed, 13 Nov 2024 07:42:52 -0500 X-MC-Unique: RSvhk8t6PaGPFWP_6sjFWw-1 X-Mimecast-MFC-AGG-ID: RSvhk8t6PaGPFWP_6sjFWw Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-37d462b64e3so3574304f8f.3 for ; Wed, 13 Nov 2024 04:42:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501771; x=1732106571; 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=OYummHyMeO18Vto9q2ZMMfeLT6TZU1cjZPgJKtQfrDY=; b=YwAwQaLtxjDNINw+3qdYB7wFOWiN4xMGEBC43eKCAcSdwjXCYBI9Q9iXBMFLC98fUu 8gUJtpIc5c4Hwzu0Vn/v7FiWcZOiXfsKG3IxwuFfCW+yxIhqVWb4oBsi8Tx0liV9BYOO tj6fBmMwPQmfmlMqwnE30kj49j9o1umDDl3kWEtEQLNpVUXacUoTW6/mxTDQg2kiSy3F dle8peZhdhIqLoROckf+MDSRVIkeJn4VT3y//obcUM7pEEVrWJ1xgQrJ6kbP6LM++P2R Ortta5hVb+OAJBMHHiohViQyVfH0blSpogeIzDPlja/lUnpaCyh9KCEMM0aZgtuHcmqC G+cA== X-Forwarded-Encrypted: i=1; AJvYcCWiEVnWf9P7ZXCxgpm8lu52ZXj7IE41gdmy9zaXzVsvLPUA9cm5alrQfC/Ya50Ph6bSRnk=@vger.kernel.org X-Gm-Message-State: AOJu0YzFTmKWa5T6mBabY9yegfsd3okM7UtTU0iouY7uDMmKZgPsMvlH ij3mIj9SgWR2o8Ayf7OcfiDspBuJvIFW/WtlSN4GjnmfIUhfuBl7rlzEtHPecgCrxi0/4+zWfBD Aug4vNStMqkXckUMG9NDFhxfGHh+VRN9AeSfefb6QF3RuNMKmIg== X-Received: by 2002:a05:6000:18af:b0:36c:ff0c:36d7 with SMTP id ffacd0b85a97d-381f1863104mr17589991f8f.2.1731501770782; Wed, 13 Nov 2024 04:42:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaBVI43qrL6OFk13wQNBZS22ld2QbZy7MjquOncWveKQvBM2tKSYuVKq3Lye0eFRQdag4y9Q== X-Received: by 2002:a05:6000:18af:b0:36c:ff0c:36d7 with SMTP id ffacd0b85a97d-381f1863104mr17589974f8f.2.1731501770406; Wed, 13 Nov 2024 04:42:50 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:50 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 09/11] wifi: qtnfmac: use always-managed version of pcim_intx() Date: Wed, 13 Nov 2024 13:41:57 +0100 Message-ID: <20241113124158.22863-11-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. qtnfmac enables its PCI-Device with pcim_enable_device(). Thus, it needs the always-managed version. Replace pci_intx() with pcim_intx(). Signed-off-by: Philipp Stanner Acked-by: Kalle Valo --- drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c index f66eb43094d4..3adcfac2886f 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c @@ -204,7 +204,7 @@ static void qtnf_pcie_init_irq(struct qtnf_pcie_bus_priv *priv, bool use_msi) if (!priv->msi_enabled) { pr_warn("legacy PCIE interrupts enabled\n"); - pci_intx(pdev, 1); + pcim_intx(pdev, 1); } } From patchwork Wed Nov 13 12:41:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873613 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 81106200B8B for ; Wed, 13 Nov 2024 12:42:56 +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=1731501778; cv=none; b=i18ZmkaA0XtNfd6eAZElEaRQThBSUq9AS6MsHyMxH9Dyw0+A+BzaXNSkYQGRbFZcIhSML42a/q+iJxR/3T6RGZHZS9yz0w4XWpjL+L9FrhZ9B6U+pYLLktYQjpmlwZRfSkx7F2sG4ekjcMfgD7/A+02PYPXvHYGU84s6UbXc7PU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501778; c=relaxed/simple; bh=aAbe7GmqFC4E4dG0vzWtJY0/IVRJ0ypsn5oCbly1PXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iiwPdu1vaQZeDVbhtnRxwVKOPCegZ4YWltwiqLxvppaqAww9h9k3v6MI0fyJynjF/AKj12dol9o86Gd8SuGrIRDJeZPOZaV9ml0GC5KUYwiun1IVzCE6353c0ycgboCKa4wGMTC1dFjo66qR3hcgYTvH+LZQejvPvNpC2KglSgE= 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=Bn4CiGAx; 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="Bn4CiGAx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501775; 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=nkAJx4kdHqc1uo2Ugvp3a9JlaC6teLxc6IU39omygl8=; b=Bn4CiGAxEvYGZ4SPJKKB88A9fcrHZ1GFKdgJBMMhp8280Wci16bl29skT64ZLHFKtfNK0B ZW+wNgZezGsr9abYNix44oenGO4YpUIyr67/WB7Z1k82gvuaeKLw6EgfiTgFev8wzFG+XJ 8TaSt6jJ474WyzvCKwjRNllzkezg53Y= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-0EnPdwstOgSlqzazgdE49A-1; Wed, 13 Nov 2024 07:42:54 -0500 X-MC-Unique: 0EnPdwstOgSlqzazgdE49A-1 X-Mimecast-MFC-AGG-ID: 0EnPdwstOgSlqzazgdE49A Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-37d4a211177so3851038f8f.0 for ; Wed, 13 Nov 2024 04:42:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501773; x=1732106573; 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=nkAJx4kdHqc1uo2Ugvp3a9JlaC6teLxc6IU39omygl8=; b=wtscobPkaFoGBAFUAmqnNUgTgE/0sYVklyJPZv54sdOFKrHLTv6RaZ7HHaU8IE/Vx2 qqZiTQMJgwOOWXqHjEzOtESvK6kiOfnwuni4lnUO3GUMx7ldo/ArdoztDalqKYT6B6R9 bzx/GFtaqdnZGENyhXGckHQyzn/AZpeEm8bYpksg31qozBOcCtSnk8jlvOicy4P2PuTw GoG+CRSIy0mg2jORsI077vBfZY4XwAxTLUIL9OLpnNyzXBhwTey0CrTnul4okMZaPUWk j3uI2t/8cTZZuFMlYiLp8IOJcI0/CjVNLJ8nsM1nftwfsOZQg5y9W7y4F00KBGRWG8cL OLng== X-Forwarded-Encrypted: i=1; AJvYcCW6mMsXONaED26oP3StR0dYA81MMV+2hVNUcMHqcHzokjtUd7DU0zS4PMrdU6Fzb3Hz61I=@vger.kernel.org X-Gm-Message-State: AOJu0YzyoYHJUgM1crF84LYXyl4SsE7FmUtaK3GR4kq2vMUmRNQq9C2F C+wMEAj+RR7c+YXN6UbBRfQriQB8xY882orpxFJS0yODRyS02+RP5veHYn0JdLqdHa3ey7cJCSn ZXLYByyfh7VhgeVkxRORApVKujSVjFfnxQI/pxqMr6A9Y2Rl73w== X-Received: by 2002:a05:6000:154d:b0:37d:45f0:dd0a with SMTP id ffacd0b85a97d-381f18672b7mr16331783f8f.1.1731501773070; Wed, 13 Nov 2024 04:42:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPqy3tZYPqlqBkgyQss8AcuM2Gl+gY1MhPytnhmt1YoQ9bjJfa0GqSVyef5YXet7H2WA4PfQ== X-Received: by 2002:a05:6000:154d:b0:37d:45f0:dd0a with SMTP id ffacd0b85a97d-381f18672b7mr16331752f8f.1.1731501772675; Wed, 13 Nov 2024 04:42:52 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:52 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Basavaraj Natikar Subject: [PATCH v2 10/11] HID: amd_sfh: Use always-managed version of pcim_intx() Date: Wed, 13 Nov 2024 13:41:58 +0100 Message-ID: <20241113124158.22863-12-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. All users of amd_mp2_pci_remove(), where pci_intx() is used, call pcim_enable_device(), which is why the driver needs the always-managed version. Replace pci_intx() with pcim_intx(). Signed-off-by: Philipp Stanner Acked-by: Basavaraj Natikar --- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 ++-- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c index 0c28ca349bcd..48cfd0c58241 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -122,7 +122,7 @@ int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata) { int rc; - pci_intx(privdata->pdev, true); + pcim_intx(privdata->pdev, true); rc = devm_request_irq(&privdata->pdev->dev, privdata->pdev->irq, amd_sfh_irq_handler, 0, DRIVER_NAME, privdata); @@ -248,7 +248,7 @@ static void amd_mp2_pci_remove(void *privdata) struct amd_mp2_dev *mp2 = privdata; amd_sfh_hid_client_deinit(privdata); mp2->mp2_ops->stop_all(mp2); - pci_intx(mp2->pdev, false); + pcim_intx(mp2->pdev, false); amd_sfh_clear_intr(mp2); } diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c index db36d87d5634..ec9feb8e023b 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c @@ -289,7 +289,7 @@ static void amd_mp2_pci_remove(void *privdata) sfh_deinit_emp2(); amd_sfh_hid_client_deinit(privdata); mp2->mp2_ops->stop_all(mp2); - pci_intx(mp2->pdev, false); + pcim_intx(mp2->pdev, false); amd_sfh_clear_intr(mp2); } From patchwork Wed Nov 13 12:41:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13873614 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 D591720F5DD for ; Wed, 13 Nov 2024 12:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501781; cv=none; b=f7U2H5CWyKPEUBGL8DQzgXOVEbzMjvc6FqBqkMZz1PjtUrW3JHMROTF1x3zFn0JJMnuEzvqoAeaNfm98VLvdzRo32ntXjpiWPtdYdTuPCfnP90pHUmfyjIPdrfg8oHgYayzPbhrKzXzud8cCLGpwKpv6glUSvtPMFvA+Hs5gPJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731501781; c=relaxed/simple; bh=3bU4Fky5S+T5ZKdRjWv15RJoxK3LBV1shV2FamLl7eU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OcQia4pZPhuDuKIPrD2lll68GPlPImqx/+pAMUejq8cxSZvuL44yuLQSQUvOLwUqSE29hZTThkHv3MKt7GXg7qjYAPlNfL4SzYoptKQWp838HN/RxFBDBg34SC1gkykea9Ebez8oGWnRg5jCAazJI/iU5GXpz7NJszzZruAHbNE= 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=h8/Nkeoi; arc=none smtp.client-ip=170.10.133.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="h8/Nkeoi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731501778; 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=Vd9hh7PH7g9r1RCJwCwuck8xpSTmXt7A/cY6nKWhVMY=; b=h8/NkeoiobYep3hCFhM415xXSI8RQo+bZZsDOc9eYxqlzZwv3+Kp5lJLa96/UyI8lEyeAc CoxA0DUoEXOZx192vtUf4n9kMkdUsAC4AIX5AaqT7QbQ4mnsmfaEAya3U3noTcwtauSnG4 f2xrTWUNWA/rBuhTRogb+rTT9LIHgiE= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-vkYcJN2EOIOTR3pjtj_PYw-1; Wed, 13 Nov 2024 07:42:56 -0500 X-MC-Unique: vkYcJN2EOIOTR3pjtj_PYw-1 X-Mimecast-MFC-AGG-ID: vkYcJN2EOIOTR3pjtj_PYw Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d458087c0so439269f8f.1 for ; Wed, 13 Nov 2024 04:42:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731501775; x=1732106575; 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=Vd9hh7PH7g9r1RCJwCwuck8xpSTmXt7A/cY6nKWhVMY=; b=SV73L/vBLyWoSVntTVNNcc000i0QG7Tn7HTVmRVfqHK19T0VPnrfsSOr5a87ibYGG0 rOX54ecOlCkOrLEyPpgcCWIaE5q9uyZGqRErFYh8Y8SvxiEHjMXNZ9aDA+lvCK5EAAIr gI9yGeoC5YYYkSdSIQdQb1fOBgz3M3vaTbtGbQFWbAG9EhAPVfS2sV2ga09WfKgbWBu2 gspINpMjrvep99Gu9v2D0JSPiGvOV3lkYPXvRLwNVjwIjTBi1rVe2jxJqmUS7tDmSaQr 8My0imxw/Hi9DF88kieX9NuwzGeN4OaeK2HOFPyt552sOCIdjBzwDA7K6vyRibc+UPqH AKag== X-Forwarded-Encrypted: i=1; AJvYcCX2Bfy1WTsZ6YMofymUGegLFNpGvg4D8qu2t3f20XpB+jEWJx+Y0i6n2ryGJ0IL4chbRXI=@vger.kernel.org X-Gm-Message-State: AOJu0YzPnBPnZiNFj5Y+VIAv/UvW4IwnBx6ss2vIDRxc8bejsHh59aD6 2nrTTcDLpOrGv6Jl7khLtE+/pbznTvC3iHW9bldt+R9PqNg7HdsZFF9kbq7RFZLfc75KeoDVkZ6 LmcPGjC4rtefKRhFTT4jROuytB8UtLY2VvkduyUWM5Pa7oGyo6Q== X-Received: by 2002:a5d:59a9:0:b0:37d:3780:31d2 with SMTP id ffacd0b85a97d-381f0f5e2c0mr15195852f8f.15.1731501775481; Wed, 13 Nov 2024 04:42:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7pOukOPMDH1wuk1i6Jiz8xlWOF0F0DNhl9nXwctJdSW8HPrAiyNLBY18f7vZ+XBFDhbQ0GA== X-Received: by 2002:a5d:59a9:0:b0:37d:3780:31d2 with SMTP id ffacd0b85a97d-381f0f5e2c0mr15195814f8f.15.1731501774995; Wed, 13 Nov 2024 04:42:54 -0800 (PST) Received: from eisenberg.redhat.com (nat-pool-muc-u.redhat.com. [149.14.88.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99aa18sm18023528f8f.61.2024.11.13.04.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 04:42:54 -0800 (PST) From: Philipp Stanner To: Damien Le Moal , Niklas Cassel , Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires , Arnd Bergmann , Greg Kroah-Hartman , Alex Dubov , Sudarsana Kalluru , Manish Chopra , Andrew Lunn , "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 , Philipp Stanner , Mario Limonciello , Chen Ni , Ricky Wu , Al Viro , Breno Leitao , Kevin Tian , Thomas Gleixner , Mostafa Saleh , Andy Shevchenko , Jason Gunthorpe , Yi Liu , Kunwu Chan , Ankit Agrawal , Christian Brauner , Reinette Chatre , Eric Auger , Ye Bin 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, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 11/11] Remove devres from pci_intx() Date: Wed, 13 Nov 2024 13:41:59 +0100 Message-ID: <20241113124158.22863-13-pstanner@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113124158.22863-2-pstanner@redhat.com> References: <20241113124158.22863-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: kvm@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. This hybrid nature is undesirable. Since all users of pci_intx() have by now been ported either to always-managed pcim_intx() or never-managed pci_intx_unmanaged(), the devres functionality can be removed from pci_intx(). Consequently, pci_intx_unmanaged() is now redundant, because pci_intx() itself is now unmanaged. Remove the devres functionality from pci_intx(). Have all users of pci_intx_unmanaged() call pci_intx(). Remove pci_intx_unmanaged(). Signed-off-by: Philipp Stanner --- drivers/misc/cardreader/rtsx_pcr.c | 2 +- drivers/misc/tifm_7xx1.c | 6 +-- .../net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +- drivers/net/ethernet/brocade/bna/bnad.c | 2 +- drivers/ntb/hw/amd/ntb_hw_amd.c | 4 +- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/pci/devres.c | 4 +- drivers/pci/msi/api.c | 2 +- drivers/pci/msi/msi.c | 2 +- drivers/pci/pci.c | 43 +------------------ drivers/vfio/pci/vfio_pci_core.c | 2 +- drivers/vfio/pci/vfio_pci_intrs.c | 10 ++--- drivers/xen/xen-pciback/conf_space_header.c | 2 +- include/linux/pci.h | 1 - 14 files changed, 22 insertions(+), 62 deletions(-) diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c index e25e6d560dd7..be3d4e0e50cc 100644 --- a/drivers/misc/cardreader/rtsx_pcr.c +++ b/drivers/misc/cardreader/rtsx_pcr.c @@ -1057,7 +1057,7 @@ static int rtsx_pci_acquire_irq(struct rtsx_pcr *pcr) } pcr->irq = pcr->pci->irq; - pci_intx_unmanaged(pcr->pci, !pcr->msi_en); + pci_intx(pcr->pci, !pcr->msi_en); return 0; } diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index 5f9c7ccae8d2..1d54680d6ed2 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c @@ -327,7 +327,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, goto err_out; } - pci_intx_unmanaged(dev, 1); + pci_intx(dev, 1); fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM ? 4 : 2, &dev->dev); @@ -368,7 +368,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, err_out_free: tifm_free_adapter(fm); err_out_int: - pci_intx_unmanaged(dev, 0); + pci_intx(dev, 0); pci_release_regions(dev); err_out: if (!pci_dev_busy) @@ -392,7 +392,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev) tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt)); iounmap(fm->addr); - pci_intx_unmanaged(dev, 0); + pci_intx(dev, 0); pci_release_regions(dev); pci_disable_device(dev); diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 2ae63d6e6792..678829646cec 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -1669,7 +1669,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp) REG_WR(bp, IGU_REG_PF_CONFIGURATION, val); if (val & IGU_PF_CONF_INT_LINE_EN) - pci_intx_unmanaged(bp->pdev, true); + pci_intx(bp->pdev, true); barrier(); diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 2b37462d406e..ece6f3b48327 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -2669,7 +2669,7 @@ bnad_enable_msix(struct bnad *bnad) } } - pci_intx_unmanaged(bnad->pcidev, 0); + pci_intx(bnad->pcidev, 0); return; diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index b146f170e839..d687e8c2cc78 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev, err_msi_enable: /* Try to set up intx irq */ - pci_intx_unmanaged(pdev, 1); + pci_intx(pdev, 1); rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED, "ndev_irq_isr", ndev); @@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev) if (pci_dev_msi_enabled(pdev)) pci_disable_msi(pdev); else - pci_intx_unmanaged(pdev, 0); + pci_intx(pdev, 0); } } diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c index 9ad9d7fe227e..079b8cd79785 100644 --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c @@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev, /* Try to set up intx irq */ - pci_intx_unmanaged(pdev, 1); + pci_intx(pdev, 1); rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED, "ndev_irq_isr", ndev); diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index d32827a1f2f4..6f8f712fe34e 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -416,7 +416,7 @@ static void pcim_intx_restore(struct device *dev, void *data) struct pci_dev *pdev = to_pci_dev(dev); struct pcim_intx_devres *res = data; - pci_intx_unmanaged(pdev, res->orig_intx); + pci_intx(pdev, res->orig_intx); } static struct pcim_intx_devres *get_or_create_intx_devres(struct device *dev) @@ -453,7 +453,7 @@ int pcim_intx(struct pci_dev *pdev, int enable) return -ENOMEM; res->orig_intx = !enable; - pci_intx_unmanaged(pdev, enable); + pci_intx(pdev, enable); return 0; } diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c index c95e2e7dc9ab..b956ce591f96 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_unmanaged(dev, 1); + pci_intx(dev, 1); return 1; } } diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index 53f13b09db50..3a45879d85db 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_unmanaged(dev, enable); + pci_intx(dev, enable); } static void pci_msi_set_enable(struct pci_dev *dev, int enable) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c945811b207a..df537c6f383d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4481,17 +4481,13 @@ void pci_disable_parity(struct pci_dev *dev) } /** - * pci_intx_unmanaged - enables/disables PCI INTx for device dev, - * unmanaged version + * pci_intx - enables/disables PCI INTx for device dev * @pdev: the PCI device to operate on * @enable: boolean: whether to enable or disable PCI INTx * * Enables/disables PCI INTx for device @pdev - * - * This function behavios identically to pci_intx(), but is never managed with - * devres. */ -void pci_intx_unmanaged(struct pci_dev *pdev, int enable) +void pci_intx(struct pci_dev *pdev, int enable) { u16 pci_command, new; @@ -4507,41 +4503,6 @@ void pci_intx_unmanaged(struct pci_dev *pdev, int enable) pci_write_config_word(pdev, PCI_COMMAND, new); } -EXPORT_SYMBOL_GPL(pci_intx_unmanaged); - -/** - * pci_intx - enables/disables PCI INTx for device dev - * @pdev: the PCI device to operate on - * @enable: boolean: whether to enable or disable PCI INTx - * - * Enables/disables PCI INTx for device @pdev - * - * NOTE: - * This is a "hybrid" function: It's normally unmanaged, but becomes managed - * when pcim_enable_device() has been called in advance. This hybrid feature is - * DEPRECATED! If you want managed cleanup, use pcim_intx() instead. - */ -void pci_intx(struct pci_dev *pdev, int enable) -{ - u16 pci_command, new; - - pci_read_config_word(pdev, PCI_COMMAND, &pci_command); - - if (enable) - new = pci_command & ~PCI_COMMAND_INTX_DISABLE; - else - new = pci_command | PCI_COMMAND_INTX_DISABLE; - - if (new != pci_command) { - /* Preserve the "hybrid" behavior for backwards compatibility */ - if (pci_is_managed(pdev)) { - WARN_ON_ONCE(pcim_intx(pdev, enable) != 0); - return; - } - - pci_write_config_word(pdev, PCI_COMMAND, new); - } -} EXPORT_SYMBOL_GPL(pci_intx); /** diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 90240c8d51aa..1ab58da9f38a 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev) if (vfio_pci_nointx(pdev)) { pci_info(pdev, "Masking broken INTx support\n"); vdev->nointx = true; - pci_intx_unmanaged(pdev, 0); + pci_intx(pdev, 0); } else vdev->pci_2_3 = pci_intx_mask_supported(pdev); } diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 40abb0b937a2..8382c5834335 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev) */ if (unlikely(!is_intx(vdev))) { if (vdev->pci_2_3) - pci_intx_unmanaged(pdev, 0); + pci_intx(pdev, 0); goto out_unlock; } @@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev) * mask, not just when something is pending. */ if (vdev->pci_2_3) - pci_intx_unmanaged(pdev, 0); + pci_intx(pdev, 0); else disable_irq_nosync(pdev->irq); @@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data) */ if (unlikely(!is_intx(vdev))) { if (vdev->pci_2_3) - pci_intx_unmanaged(pdev, 1); + pci_intx(pdev, 1); goto out_unlock; } @@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev, */ ctx->masked = vdev->virq_disabled; if (vdev->pci_2_3) { - pci_intx_unmanaged(pdev, !ctx->masked); + pci_intx(pdev, !ctx->masked); irqflags = IRQF_SHARED; } else { irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0; @@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix) * via their shutdown paths. Restore for NoINTx devices. */ if (vdev->nointx) - pci_intx_unmanaged(pdev, 0); + pci_intx(pdev, 0); vdev->irq_type = VFIO_PCI_NUM_IRQS; } diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c index 8d26d64232e8..fc0332645966 100644 --- a/drivers/xen/xen-pciback/conf_space_header.c +++ b/drivers/xen/xen-pciback/conf_space_header.c @@ -106,7 +106,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) if (dev_data && dev_data->allow_interrupt_control && ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE)) - pci_intx_unmanaged(dev, !(value & PCI_COMMAND_INTX_DISABLE)); + pci_intx(dev, !(value & PCI_COMMAND_INTX_DISABLE)); cmd->val = value; diff --git a/include/linux/pci.h b/include/linux/pci.h index 6b8cde76d564..1b2a6dd1dfed 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1353,7 +1353,6 @@ int __must_check pcim_set_mwi(struct pci_dev *dev); int pci_try_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); void pci_disable_parity(struct pci_dev *dev); -void pci_intx_unmanaged(struct pci_dev *pdev, int enable); void pci_intx(struct pci_dev *dev, int enable); bool pci_check_and_mask_intx(struct pci_dev *dev); bool pci_check_and_unmask_intx(struct pci_dev *dev);