From patchwork Mon Oct 14 07:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13834263 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 35D9914D430 for ; Mon, 14 Oct 2024 07:53: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=1728892421; cv=none; b=FViJv87peqAwWpDMms4n9/A/FjTAjRGhc9wftEVBE0qG5+PT4HPRdND8ACx2irBorriZZm5x131102lJFGrh/VU8f+BETPpHS6WGIgL+lpldK+5Sa1Yl3tIWTCQuR274CHiuAxaHobjyPTwveUfe0ENqoDBwxynqTdEh8YG97AI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728892421; c=relaxed/simple; bh=veogpasXu8DFoes2pWWrRajzT/Tb+yGbiuMWIlqIVQU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iGu3hslBiTaeYzeM7MZmE8wiSfYer/wlaHSbrydLsDNL9WOR9ny8X0HkEFzmqfJaIk6kbmLeHwjcREbFBPxXrdNPybBpROwpobKTg+BeVSXl+q4nxsaR9metzIkaSxBJno4NQw8FtAwHfEmE/h2q8/N9Szf4KT3vcHb/iqfVKPo= 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=LM1j4My3; 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="LM1j4My3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728892419; 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=r7W6/l7rxCsNe9vQIzzAVccxaNC6ce1XTcoL6qo42AA=; b=LM1j4My3Q37KuKcEbKw93DpXVHPbpwTQtNshxpNiGIOMBIqQgxx6C/ma/EwTGEtYbdoA9U uttARD6aP+VrMF6dlF0qywEahqlMeIvV2Sdub01yRk3siQ8+blVRgovR5XDe4xvn6egGBa YyoHbCgueFv+S+UT+LRi/sajaEgFZ2w= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-oa4YBKq7OnOoZcIgaM_Cmg-1; Mon, 14 Oct 2024 03:53:37 -0400 X-MC-Unique: oa4YBKq7OnOoZcIgaM_Cmg-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a9a1828916fso37641466b.1 for ; Mon, 14 Oct 2024 00:53:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728892416; x=1729497216; 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=r7W6/l7rxCsNe9vQIzzAVccxaNC6ce1XTcoL6qo42AA=; b=lGCAgPicqc2Whf/9MkbMg6DYvr61WaH+TspUw70CrRKzM/XvUhgB0h+Y6nEOCcJAY1 nAqbUYBtA2/mNxdgNe8QEYKwiIE/y+VW54L08duLQuWis2GVnWykLlQMgSNSMvbG8XVy L4AGl/OQgUEov77Csq8exSbqvqE0LlU9+QaGm+lRXXfsa5VoIjRN+jTLYyMPvOMYwTMp 9qKxkKK+0H9KKpcdXnq1bOcYLV9EIOaqCQ82yakcQA52l0ALmv854PhgmYerx5zqw1XN /1Gey/AqvGM2ybfZInwA8nRpL/b2h4s38JiruYsmnJNpa1t6TcxmJDdRubsM5ktrURwd V9dw== X-Forwarded-Encrypted: i=1; AJvYcCVeFg6fcS1lCypa+Pl1XlhcP72f7tix4r+kkWeXzv96UrC0hnIc0dF2T2dBJgCvEIUwAfweDI5Fh0Ty@vger.kernel.org X-Gm-Message-State: AOJu0YzARFJJ/Cwx7PqT9I10CHI4w+yygWx1O2TWxDyUIUXElgaeDQfn qG8UKsxmvpEDV1tWCzFhWnzrb8zg1F0eQJfK9sXTmRq9YbvntdtttAir3+kE5Ghe4AKLDor9XsS KzCsvI23yiXiOSvJCbghQFloJ4kc0LZHDdryAUmix+OiBTKqq+Y+4MV1tmeA= X-Received: by 2002:a17:907:7ba9:b0:a99:4c71:704 with SMTP id a640c23a62f3a-a99b899df18mr956652966b.26.1728892416367; Mon, 14 Oct 2024 00:53:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcdlsL1TfE08opAxaZFL/GkS8KN4PCrsMz97DjWs5H+hxx58tt0LTAJvoIs9ET3WVAzpRpJg== X-Received: by 2002:a17:907:7ba9:b0:a99:4c71:704 with SMTP id a640c23a62f3a-a99b899df18mr956650866b.26.1728892415932; Mon, 14 Oct 2024 00:53:35 -0700 (PDT) Received: from eisenberg.fritz.box (200116b82d3798001d5778cfc1aeb0b3.dip.versatel-1u1.de. [2001:16b8:2d37:9800:1d57:78cf:c1ae:b0b3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99f86fa986sm243291666b.92.2024.10.14.00.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 00:53:35 -0700 (PDT) From: Philipp Stanner To: 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 , Bjorn Helgaas , Richard Cochran , Damien Le Moal , Hannes Reinecke , Al Viro , Keith Busch , Philipp Stanner , Li Zetao Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v7 1/5] PCI: Deprecate pcim_iounmap_regions() Date: Mon, 14 Oct 2024 09:53:22 +0200 Message-ID: <20241014075329.10400-2-pstanner@redhat.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241014075329.10400-1-pstanner@redhat.com> References: <20241014075329.10400-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The function pcim_iounmap_regions() is problematic because it uses a bitmask mechanism to release / iounmap multiple BARs at once. It, thus, prevents getting rid of the problematic iomap table mechanism which was deprecated in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). Make pcim_iounmap_region() public as the successor of pcim_iounmap_regions(). Mark pcim_iomap_regions() as deprecated. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 8 ++++++-- include/linux/pci.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index b133967faef8..a486bce18e0d 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -773,7 +773,7 @@ EXPORT_SYMBOL(pcim_iomap_region); * Unmap a BAR and release its region manually. Only pass BARs that were * previously mapped by pcim_iomap_region(). */ -static void pcim_iounmap_region(struct pci_dev *pdev, int bar) +void pcim_iounmap_region(struct pci_dev *pdev, int bar) { struct pcim_addr_devres res_searched; @@ -784,6 +784,7 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar) devres_release(&pdev->dev, pcim_addr_resource_release, pcim_addr_resources_match, &res_searched); } +EXPORT_SYMBOL(pcim_iounmap_region); /** * pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED) @@ -1015,11 +1016,14 @@ int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, EXPORT_SYMBOL(pcim_iomap_regions_request_all); /** - * pcim_iounmap_regions - Unmap and release PCI BARs + * pcim_iounmap_regions - Unmap and release PCI BARs (DEPRECATED) * @pdev: PCI device to map IO resources for * @mask: Mask of BARs to unmap and release * * Unmap and release regions specified by @mask. + * + * This function is DEPRECATED. Do not use it in new code. + * Use pcim_iounmap_region() instead. */ void pcim_iounmap_regions(struct pci_dev *pdev, int mask) { diff --git a/include/linux/pci.h b/include/linux/pci.h index 573b4c4c2be6..c4221aca20f9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2296,6 +2296,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass, 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); +void pcim_iounmap_region(struct pci_dev *pdev, int bar); void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); int pcim_request_region(struct pci_dev *pdev, int bar, const char *name);