From patchwork Mon Aug 19 16:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13768734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3854C3DA4A for ; Mon, 19 Aug 2024 17:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=abZiwvPf4gC19vxFT17Sz8slSRtUXISkEhAwbNUMlrw=; b=PBBHYtF1wdYn7RYb8KuFLw1uYf L+tcCBRkZLV0QXpm9f07x67YMegEYtCVYEIBnnYn+GibpiMLoh/BLp8WyrJuL0I6+wsS9IOzpuHBr 9sTf6TB5Q1GT+EuNCxaZmri5lo5szFl/wJncyOEDXz8PyIER89Q20Yqtbtt4oRfXSVolbG7MWeKqi pE5sT8JcgZa0ZJb2tAuvXGgLpygyYOy+edmffoVfV8jCnKWQ4T3hBx2IaxTPYNrFFyTSAdelBKLOA jM92ES5E6N+qch6tHMzSqfegXzCzRmf/FyzDbfl8qWEWPiCm9NvL9vH4htuN08X9GtSqZ5JCU3OAi MGfEjs8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg5pp-00000002Jom-2Huv; Mon, 19 Aug 2024 17:06:25 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg5dF-00000002FpF-2WSg for linux-arm-kernel@bombadil.infradead.org; Mon, 19 Aug 2024 16:53:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=abZiwvPf4gC19vxFT17Sz8slSRtUXISkEhAwbNUMlrw=; b=kkjWa0ira3jBaB2fsY8QAxK0TG tkcKOZGgj3SCHFqUUJY1vgdUqtSGuAfLN8kWnoP+A6xzK8QQ0jsZiDHFwLBfpBYWrHTcjKKn9BhVI Z17mHxYJbACiNjisdVqND81pEDpN9E46uFh2w9SbNaEkKOKs6bs2T3pVk/bJ8/W9Ov9IFKyPcMBCr 8cvCJp+m3kiUN9namHLiebpSkzKdFW2m4tOXsCLb+wFeJRAYfc65BkQQOf9Zcc5tA2RNh5KSU2yQ2 Ar7+1kPXm6BhUjiwxnSQVzCBkXZc70U1rbDfTNwcyXVL9xVk5hd+lWVzIVyi2lEb3JL9pHYoDW/+V 6YmlIVNA==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg5dB-00000009Ay5-3WKp for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 16:53:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724086394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abZiwvPf4gC19vxFT17Sz8slSRtUXISkEhAwbNUMlrw=; b=jHEosUDaYifn+Ib8dZE0Kf2u7oL3JJsB3kc9nht8ZBXoqYGpo6wjgxrbWcQmsc8QeqQNWz qaoQJ9qGgxK5QuYalpxO+w75hndqL5VRMJj4hDLOEGcq+wJkWWWGm9uVIrOYePD8Zo2rB2 Z4jJ71/qaXpBrwdCLGvV2woVkTMVDEI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724086400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abZiwvPf4gC19vxFT17Sz8slSRtUXISkEhAwbNUMlrw=; b=E8vZQWYFNZGNoI+phuPVzqZF6X3k5u30Kj4FRqWaEnwWluXoOaAqT2Wo4Da+U0RROlSd+U xTkTQAk7R4n9twZ8gWGddsK393nQv6rTW24RwRiE6OCItas+m4rd1Y1IYiIEdxjEkjH//1 dIpm+mBX84aXydY/gNRr61LLxrlq55w= Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-PBYGXrP5MZKheQLV3PmPsQ-1; Mon, 19 Aug 2024 12:53:13 -0400 X-MC-Unique: PBYGXrP5MZKheQLV3PmPsQ-1 Received: by mail-vk1-f199.google.com with SMTP id 71dfb90a1353d-4f5111f666fso188781e0c.0 for ; Mon, 19 Aug 2024 09:53:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724086392; x=1724691192; 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=abZiwvPf4gC19vxFT17Sz8slSRtUXISkEhAwbNUMlrw=; b=vLzFXAhiBau8xRiX4y25zCmQP7AC3oIWNJNFsskCEKr5lxmgDp3BxEYqzZdLOnon25 +JcjE5JYMwBO4zpeR+BgYIqWSeZLV75yzMAOU1biW5NNmJ3CBkx/WR45YhQp2ANWAGsF xwlUYnRQe/fWCX21ISy6EaNubBqTn3EpzFQDRuLJNzDcjdyQUsKkl9yEmzP1pHGjazJi wtke8xVS2hTGkvnhorW+CS7BbdVPRS1tZrs5YuSDyOxDsIER0FPKpdRA2FaZ61m13Gfm KxiWg+rXw4ogQP1QhX1+hNyWrfytj0bAhLIXwGKsnLQOAfMXRAxCTN69eLYBuBsIJTa3 Pwow== X-Forwarded-Encrypted: i=1; AJvYcCVSYgYc9zx9SD5YjtQk6QeOL1DtAbqT3g5mqf++kw8uLNXk29tqfZKmTxLMwWzmBMwyuakl2b7kYPZP/eKUp9+k@lists.infradead.org X-Gm-Message-State: AOJu0YztnUcMzPVrjwY0DWASJLeCHmBscFqeT+uD0q6XDKejLgS5imdp lQZKoeF+sWJZsy33SVQ6WlxX08bmymWJm79obW7UQ3dRLM0DPMVP65cbeg7ZGCoV5K9ZSmIALF8 yq8FZ2BZP/VpRo/wV/8vfjbijos3UJFTpkEOfjSn9QJBp4p5vS6srO2zb+BsvZ9WkcthMZSI3 X-Received: by 2002:a05:6102:5127:b0:493:bb70:940 with SMTP id ada2fe7eead31-4977992674fmr7984167137.2.1724086392206; Mon, 19 Aug 2024 09:53:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSFSVYmUjqgNVHiq1+h9E7HGJis8qQ3DMxEZS8Skowa7KMQsueVdBGNDdQuxxSfXwtk0QtBA== X-Received: by 2002:a05:6102:5127:b0:493:bb70:940 with SMTP id ada2fe7eead31-4977992674fmr7984139137.2.1724086391863; Mon, 19 Aug 2024 09:53:11 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff01e293sm446579885a.26.2024.08.19.09.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 09:53:11 -0700 (PDT) From: Philipp Stanner To: onathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , Philipp Stanner , Hannes Reinecke , Damien Le Moal , Chaitanya Kulkarni , "Martin K. Petersen" Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH 8/9] vdap: solidrun: Replace deprecated PCI functions Date: Mon, 19 Aug 2024 18:51:48 +0200 Message-ID: <20240819165148.58201-10-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240819165148.58201-2-pstanner@redhat.com> References: <20240819165148.58201-2-pstanner@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_175322_115818_B5693963 X-CRM114-Status: GOOD ( 17.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org solidrun utilizes pcim_iomap_regions(), which has been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"), among other things because it forces usage of quite a complicated bitmask mechanism. The bitmask handling code can entirely be removed by replacing pcim_iomap_regions() and pcim_iomap_table(). Replace pcim_iomap_regions() and pcim_iomap_table() with pci_iomap_region(). Signed-off-by: Philipp Stanner --- drivers/vdpa/solidrun/snet_main.c | 47 +++++++++++-------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c index 99428a04068d..abf027ca35e1 100644 --- a/drivers/vdpa/solidrun/snet_main.c +++ b/drivers/vdpa/solidrun/snet_main.c @@ -556,33 +556,24 @@ static const struct vdpa_config_ops snet_config_ops = { static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet) { char name[50]; - int ret, i, mask = 0; + int i; + + snprintf(name, sizeof(name), "psnet[%s]-bars", pci_name(pdev)); + /* We don't know which BAR will be used to communicate.. * We will map every bar with len > 0. * * Later, we will discover the BAR and unmap all other BARs. */ for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (pci_resource_len(pdev, i)) - mask |= (1 << i); - } - - /* No BAR can be used.. */ - if (!mask) { - SNET_ERR(pdev, "Failed to find a PCI BAR\n"); - return -ENODEV; - } - - snprintf(name, sizeof(name), "psnet[%s]-bars", pci_name(pdev)); - ret = pcim_iomap_regions(pdev, mask, name); - if (ret) { - SNET_ERR(pdev, "Failed to request and map PCI BARs\n"); - return ret; - } + if (pci_resource_len(pdev, i)) { + psnet->bars[i] = pcim_iomap_region(pdev, i, name); + if (IS_ERR(psnet->bars[i])) { + SNET_ERR(pdev, "Failed to request and map PCI BARs\n"); + return PTR_ERR(psnet->bars[i]); + } + } - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (mask & (1 << i)) - psnet->bars[i] = pcim_iomap_table(pdev)[i]; } return 0; @@ -591,18 +582,15 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet) static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet) { char name[50]; - int ret; snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev)); /* Request and map BAR */ - ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name); - if (ret) { + snet->bar = pcim_iomap_region(pdev, snet->psnet->cfg.vf_bar, name); + if (IS_ERR(snet->bar)) { SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n"); - return ret; + return PTR_ERR(snet->bar); } - snet->bar = pcim_iomap_table(pdev)[snet->psnet->cfg.vf_bar]; - return 0; } @@ -650,15 +638,12 @@ static int psnet_detect_bar(struct psnet *psnet, u32 off) static void psnet_unmap_unused_bars(struct pci_dev *pdev, struct psnet *psnet) { - int i, mask = 0; + int i; for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (psnet->bars[i] && i != psnet->barno) - mask |= (1 << i); + pcim_iounmap_region(pdev, i); } - - if (mask) - pcim_iounmap_regions(pdev, mask); } /* Read SNET config from PCI BAR */