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 DDDB8A04AD for ; Wed, 19 Jan 2022 15:51:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B07C741147; Wed, 19 Jan 2022 15:51:01 +0100 (CET) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id ED22D41147 for ; Wed, 19 Jan 2022 15:51:00 +0100 (CET) Received: by mail-wm1-f45.google.com with SMTP id ay14-20020a05600c1e0e00b0034d7bef1b5dso7880842wmb.3 for ; Wed, 19 Jan 2022 06:51:00 -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=4rP5wLt9wV3Hzr2WV9MSUeTzKwG4cyCdVC5G0/+EHSRQ2LvYdrzEx6hwvWmweveAVm PkbTx3fgnia0D8+SFyYVpRwGZgUYM6aZurYhOhDDAsKzBMnfKIPd2nE/bBpD9okFMMo6 EHaNUD06McjRfYxuu6VzhHfmW9lFygabTrrljf8GTLz/ubrKHwyWDrVMqGoZ0lomyhkb U2rsWCeV2wIbsQ8sohS3KjpDsXLCkZtQSq8jOOmkxcAL9EfmcVJ1eNdVCXiXVVjrQ/l7 yE+Wi0GQz+YCCG/w1jViZYR7qKSq995F3Kn9COoRl4YPCF2kY3pEi7p4I5W00uIIcz60 NF/Q== X-Gm-Message-State: AOAM532qX0InDvodMpQAooB4iw3A/mZl10avaF0yHzmzwzNyXPBwykhu UdsMJR3i0/tmI1lOEYizqPgx1w== 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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