From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D18FA04AD; Wed, 19 Jan 2022 15:51:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D637D4115C; Wed, 19 Jan 2022 15:51:01 +0100 (CET) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id 35D5D41147 for ; Wed, 19 Jan 2022 15:51:01 +0100 (CET) Received: by mail-wm1-f42.google.com with SMTP id q141-20020a1ca793000000b00347b48dfb53so6061425wme.0 for ; Wed, 19 Jan 2022 06:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z9xbu4ydzx4qxVwBbC6k+tHpWQryQj75Bd+OKG+HvfU=; b=H6JZZuLX/KV9QtXPfBB3PBJTuD4dSpQqNR8rM+cVGstPoRN6p7vivv+hLjQHf3U4Y6 L/HDw2o+ZjhhPN4a9Muc2MfRt2FNe/4slZypiGYYNUWz5PYhG7xbQCv82O4DRP4fsCi8 w5+a+Rw/mP3STAi/8mDFFKhXrJYH4Bq+ZX1164yU6q6iyl72DZSFsjQCCMbdCa1oiG4E rpL6uB437pHOMtI62I4EqKZ6L1Yx9fg0Oe6yYp2fDs7TKYDie+P8UlIP+oqBBdSiWcBC Kbqo6QQZ3ykzU4GB5y5xiYcHf0OrN+3gkAO7vyZZH1EMiAj2/mI5K7kjBwC8Qo1M5Iuf LXww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z9xbu4ydzx4qxVwBbC6k+tHpWQryQj75Bd+OKG+HvfU=; b=3DgruH2T5daeQSEKaHDt1YHo38Dr3erUSJW+NF2JqVOXhKA2/cIJ1VA+t7nI9MUPQh ffwb7FuJdK2KhwkZaII3RSB0ZgJDf5xvZzAMHpAsLSiG9FjsT8JkOq6zdYi8OTcxy/0C 89A9yXqXpsHMFuxpp8DJqZlDPr5LMQHlBKWk97uQcIC1Z9UIXJKQuA4f/T5g6mSKS8gW JETlqsqT8KI4O3J4RS8UJipXpUT2b7u+KCSlaKuT+SPI2CwPYDBGrlnfLFXPvzCWoCmG KcovpKZMHnjUESDVxsQ1wu12vFl59wckLBYSU/srkEhBiWZO6a5U+EyJH4WTxYOEXDXx JNHw== X-Gm-Message-State: AOAM533UBKL9Ofb0/XiLlcLRBArvrlCvq95v8iJS0f+w5yYQo7NDi3bv 6xtOIR5QskE8KHQ+NjvrBLg3EnRhwCOYIA== X-Google-Smtp-Source: ABdhPJwvkiB3k42SrcNIg2w41NrK/L7YzOfZFjT6cjZhrUoAepalyWaTgmsfuYnHE48c4UFiCbWc3g== X-Received: by 2002:adf:fbd1:: with SMTP id d17mr4723800wrs.626.1642603860673; Wed, 19 Jan 2022 06:51:00 -0800 (PST) Received: from DESKTOP-U5LNN3J.localdomain (89-79-181-52.dynamic.chello.pl. [89.79.181.52]) by smtp.gmail.com with ESMTPSA id w8sm28756wre.83.2022.01.19.06.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 06:50:59 -0800 (PST) From: Michal Krawczyk To: dev@dpdk.org Cc: upstream@semihalf.com, shaibran@amazon.com, Michal Krawczyk , hkalra@marvell.com, stable@dpdk.org Subject: [PATCH] bus/pci: assign driver's pointer before mapping Date: Wed, 19 Jan 2022 15:50:37 +0100 Message-Id: <20220119145037.28125-1-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Patch changing the way of accessing interrupt handle also changed order of the rte_pci_map_device() call and rte_pci_device:driver assignment. It was causing issues with Write Combine mapping on the Linux platform if it was used with the igb_uio module. Linux implementation of pci_uio_map_resource_by_index(), which is called by rte_pci_map_device(), needs access to the device's driver. Otherwise it won't be able to check the driver's flags and won't respect them. Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle") Cc: hkalra@marvell.com Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk --- drivers/bus/pci/pci_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 4a3a87f24f..def372b67e 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -247,9 +247,12 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, return -ENOMEM; } + dev->driver = dr; + if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { ret = rte_pci_map_device(dev); if (ret != 0) { + dev->driver = NULL; rte_intr_instance_free(dev->vfio_req_intr_handle); dev->vfio_req_intr_handle = NULL; rte_intr_instance_free(dev->intr_handle); @@ -257,8 +260,6 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, return ret; } } - - dev->driver = dr; } RTE_LOG(INFO, EAL, "Probe PCI driver: %s (%x:%x) device: "PCI_PRI_FMT" (socket %i)\n", -- 2.25.1