From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <zhiyong.yang@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id AC9491B012;
 Wed,  3 Jan 2018 04:29:47 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 02 Jan 2018 19:29:46 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.45,500,1508828400"; d="scan'208";a="191932997"
Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203])
 by fmsmga006.fm.intel.com with ESMTP; 02 Jan 2018 19:29:46 -0800
Received: from bgsmsx151.gar.corp.intel.com (10.224.48.42) by
 FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Tue, 2 Jan 2018 19:29:45 -0800
Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.245]) by
 BGSMSX151.gar.corp.intel.com ([169.254.3.14]) with mapi id 14.03.0319.002;
 Wed, 3 Jan 2018 08:59:42 +0530
From: "Yang, Zhiyong" <zhiyong.yang@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
CC: "dev@dpdk.org" <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
 "stable@dpdk.org" <stable@dpdk.org>
Thread-Topic: [PATCH v2] bus/pci: fix wrong intr_handle.type with
 uio_pci_generic
Thread-Index: AQHTgHpsBXdhyAxWxkCsI7O9d0f53KNZzS0AgAexitA=
Date: Wed, 3 Jan 2018 03:29:42 +0000
Message-ID: <E182254E98A5DA4EB1E657AC7CB9BD2A8B01D835@BGSMSX101.gar.corp.intel.com>
References: <20171228061210.64767-1-zhiyong.yang@intel.com>
 <20171229075511.33180-1-zhiyong.yang@intel.com> <2110508.9oViqIghhz@xps>
In-Reply-To: <2110508.9oViqIghhz@xps>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-version: 11.0.0.116
dlp-reaction: no-action
x-originating-ip: [10.223.10.10]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2] bus/pci: fix wrong intr_handle.type with
 uio_pci_generic
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Jan 2018 03:29:48 -0000



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Friday, December 29, 2017 7:07 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org
> Subject: Re: [PATCH v2] bus/pci: fix wrong intr_handle.type with uio_pci_=
generic
>=20
> 29/12/2017 08:55, Zhiyong Yang:
> > For virtio legacy device, testpmd startup fails when using
> > uio_pci_generic. The issue is caused by invoking the function
> > pci_ioport_map. The right intr_handle.type is already set before
> > calling it, we should avoid overwriting the default value "RTE_
> > INTR_HANDLE_UNKNOWN" in it. Besides, the removal has no harm to other
> > cases since it already is set to this value (0) at init.
>=20
> To be more precise, it is set to 0 by a memset on the whole struct during
> allocation in the scan function (pci_scan_one).
>=20
> > --- a/drivers/bus/pci/linux/pci.c
> > +++ b/drivers/bus/pci/linux/pci.c
> > @@ -723,7 +723,6 @@ pci_ioport_map(struct rte_pci_device *dev, int bar
> __rte_unused,
> >  	if (!found)
> >  		return -1;
> >
> > -	dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN;
>=20
> There is the same assignment in pci_vfio_map_resource_primary(),
> pci_vfio_map_resource_secondary() and pci_uio_map_resource().
>=20
> Please could you check why there is such assignments?

In general, the operation in the three functions intends to initialize the =
"intr_handle.type",
For example,
For pci_uio_map_resource(),  it wants to get "unknown" status once the code=
 returns abnormally after initializing.
If the code goes smoothly,  dev->intr_handle.type must be assigned to "RTE_=
INTR_HANDLE_UIO"  for bsd environment,
Or must be assigned to "RTE_INTR_HANDLE_UIO" or " RTE_INTR_HANDLE_UIO_INTX"=
 for linux environment
In consideration of the "memset" in pci_scan_one, it can be removed to has =
no harm to the existing logic.=20
Of course, keeping it is ok.

pci_vfio_map_resource_primary() and pci_vfio_map_resource_secondary() are s=
imilar.

The author was emphasizing that  intr_handle.type should be initialized (0)=
 and can be assigned to a right value after it.
Once fails, we can read a status "unknown". I guess.

Turn back  to the patch, it is crude to assign "unknown" directly since  pc=
i_ioport_map is not only used by real "unknown"
But also is used to handle uio_pci_generic driver on X86 platform. It is a =
special case to cause error for uio_pci_generic.=20

Thanks
Zhiyong=20