Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3038738pxj; Mon, 17 May 2021 16:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH8gDRT/J8mk7PfkilOzpjBlK97A8QjKAFZuyhM6qxSubJ8R8Vqzmb+I6IMD6wpMl3ur4C X-Received: by 2002:a02:b107:: with SMTP id r7mr2465768jah.8.1621293101363; Mon, 17 May 2021 16:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621293101; cv=none; d=google.com; s=arc-20160816; b=0xu99jsmygid+rla120AV2cJzRgJJQ/to4s4lXADsf+kV8nybABB2xEp9Z/ehugmPN ZpgHqf2gZOvYTWzRwOKE4BBcpswMB9PPGI1Q7PtwjFwd9+Th14AjI3/9AwHJY7G0Qq5I eHpnBuoxxAn0Ow54hLHPPE7TpeijfNn2xTytwKmLqnP68y/cqV+7OIirGUz83/iEEcRx PIJV4N31e2fHjtcZygAMAyNU1nVyPssKihTRKfK27mk5r2wm7J0nNjr49NSEGqnpGT0E GtynQG2Y4KZmHNrG0BpB/KS7/4MRkEoGeCyNGye67BlT2Xd+H5cyNda/6FmZoRLfEMPA rbYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+QIw4qnHHTII5nWi1vNONTUjtX/cK6cpaP1Xo9975SI=; b=hwzs1M3uS7a4Jt3Wg3MUzSyFr9HNvsGhiQJvuRf53b/DYjLMt+UMtkdj9nG35XUHCs Avh2txvt2nBauFuIiEHmBnUHnPynranSuIUiBJ531M4XQ2phbKibq8YPOC/UhMQXWtXv fJdrkSRZoBjMB3TXmisp+zJPzfpXaFIxC6ukAcq/PNw1a1NbRISKaV85TzvgmxMqZBXV 8wlZ/eDXIHIjad+2mkvWJZWUqyvN96FTqc/UabPV8v6IuDVA82E0maW5pAMtU81kefhc rG4AYrQwsuCra1FdHHNX58x3cnlSGyECUSX/Db6E2HTk7lmA4BKdN3cgZVQCcqf0KzsD sGUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rpv/s54E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 16si22250378iou.15.2021.05.17.16.11.27; Mon, 17 May 2021 16:11:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rpv/s54E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239120AbhEQOWL (ORCPT + 99 others); Mon, 17 May 2021 10:22:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:36022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239132AbhEQOSs (ORCPT ); Mon, 17 May 2021 10:18:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B7CBA6135C; Mon, 17 May 2021 14:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260638; bh=JpDUeprsjKlfBMz1CXq7XKtzVol5HwPWf7W0ae9Xz/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rpv/s54EB6+cWaFlG2+ShH+6Eshn1MhUub+jg2R6wgtxpmHG1xv9vZpy8AxxXpRsV BJMg3iTdA5umB46/K/eGuoaQZOVGaOjhpX1DhcGUDmoyBhGENkEfssyytq6Pp25IKx Vg09700eoccCkpASXoCWCEakHA4jLxiNoXrrLqgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gunthorpe , Dave Jiang , Dan Williams , Vinod Koul , Sasha Levin Subject: [PATCH 5.12 171/363] dmaengine: idxd: removal of pcim managed mmio mapping Date: Mon, 17 May 2021 16:00:37 +0200 Message-Id: <20210517140308.380545206@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Jiang [ Upstream commit a39c7cd0438ee2f0b859ee1eb86cdc52217d2223 ] The devm managed lifetime is incompatible with 'struct device' objects that resides in idxd context. This is one of the series that clean up the idxd driver 'struct device' lifetime. Remove pcim_* management of the PCI device and the ioremap of MMIO BAR and replace with unmanaged versions. This is for consistency of removing all the pcim/devm based calls. Reported-by: Jason Gunthorpe Fixes: bfe1d56091c1 ("dmaengine: idxd: Init and probe for Intel data accelerators") Signed-off-by: Dave Jiang Reviewed-by: Dan Williams Link: https://lore.kernel.org/r/161852984150.2203940.8043988289748519056.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/idxd/init.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index 5cf1bf095ae1..11a2e14b5b80 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -384,32 +384,36 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct idxd_device *idxd; int rc; - rc = pcim_enable_device(pdev); + rc = pci_enable_device(pdev); if (rc) return rc; dev_dbg(dev, "Alloc IDXD context\n"); idxd = idxd_alloc(pdev); - if (!idxd) - return -ENOMEM; + if (!idxd) { + rc = -ENOMEM; + goto err_idxd_alloc; + } dev_dbg(dev, "Mapping BARs\n"); - idxd->reg_base = pcim_iomap(pdev, IDXD_MMIO_BAR, 0); - if (!idxd->reg_base) - return -ENOMEM; + idxd->reg_base = pci_iomap(pdev, IDXD_MMIO_BAR, 0); + if (!idxd->reg_base) { + rc = -ENOMEM; + goto err_iomap; + } dev_dbg(dev, "Set DMA masks\n"); rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) - return rc; + goto err; rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) - return rc; + goto err; idxd_set_type(idxd); @@ -423,13 +427,13 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) rc = idxd_probe(idxd); if (rc) { dev_err(dev, "Intel(R) IDXD DMA Engine init failed\n"); - return -ENODEV; + goto err; } rc = idxd_setup_sysfs(idxd); if (rc) { dev_err(dev, "IDXD sysfs setup failed\n"); - return -ENODEV; + goto err; } idxd->state = IDXD_DEV_CONF_READY; @@ -438,6 +442,13 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) idxd->hw.version); return 0; + + err: + pci_iounmap(pdev, idxd->reg_base); + err_iomap: + err_idxd_alloc: + pci_disable_device(pdev); + return rc; } static void idxd_flush_pending_llist(struct idxd_irq_entry *ie) @@ -493,6 +504,8 @@ static void idxd_shutdown(struct pci_dev *pdev) idxd_msix_perm_clear(idxd); pci_free_irq_vectors(pdev); + pci_iounmap(pdev, idxd->reg_base); + pci_disable_device(pdev); destroy_workqueue(idxd->wq); } -- 2.30.2