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 5734FA0032; Mon, 13 Dec 2021 08:09:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE82140140; Mon, 13 Dec 2021 08:09:25 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 0CB7E40042 for ; Mon, 13 Dec 2021 08:09:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639379364; x=1670915364; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=In+fZOEtkw1IXg0eDb/vJbMB03mfJ75wyJG+z3jxmxg=; b=Hx+wqxhfT1aFKVkGlKe+72YXTYO9DgzO6TWa7IHusu2U8PHjBjo6slcz +YuVXiRDA6jjkbm0vR5kXsk8fbOGaXOvOjpu92gbfO0WMVG1Qd+H3Xpzs opqWOKEWRyziQcnmLzgvfO+y+yCbviIlTU88eY1wGhb+7tn5Qt4ShXhUo ak/8Tqna+zCZjSN3ky6llQdbQrNOrGfQpRZx8EK7mKxGJY1Pxd9nocL37 8eYeWUeED261duCQzBtvV5L558xZ/0Rn1g7CcRJibO+9OkYJTR7mNRjp5 YY7rK86vWufXwKiU1oGr8kwu1qpgm1lnQyO/q4z5KEO/GnMTq+A5Aree5 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10196"; a="262799975" X-IronPort-AV: E=Sophos;i="5.88,201,1635231600"; d="scan'208";a="262799975" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2021 23:09:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,201,1635231600"; d="scan'208";a="518499594" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga007.fm.intel.com with ESMTP; 12 Dec 2021 23:09:19 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sun, 12 Dec 2021 23:09:18 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sun, 12 Dec 2021 23:09:18 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Sun, 12 Dec 2021 23:09:18 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Sun, 12 Dec 2021 23:09:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l+7Vn979NJenyTzwRTFZu32+KDudmtP9JinLXsI4/Kj4Q/RfNV2vLYOnKYeEMmIxqFOQOviw0DjLKOolM/X3h9zyDprT2l7XWcfaihqZkISb+Gt3qwLtMDiKKvu3lLNTTaKvQX8ajm4w3ZaRGkXG3UMkjAjEw+vxEe84RbeAckM53xIv/ufaBj4GEwhU+nYu3ccX7M+Mn+B1XXXt4wJv98ursqR+BvImAbUzBRyL8NWOvUoTVz9lpVaSulzwPZWzoHco/4VnT+mvPVuqP9JUhbfYRadZrt0ioSydrjZNDwxO4cHSdMcSTKdX8uMQ89s5Yav0a7gG2zbd12t53pPHnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3pg7VV2CC+8cTw46ENhc7lC+NxX+FY+U6PA4IvE/Ovo=; b=CHgcnh0/O2z3/RwBhUNkSsTNITxybZmZb76w4wUi1OtnQ51QMx0Wnwa5/IPeloW5hfQ3WXyED8nH0iyoQwxt6cER/XinVyKuryyQII+PKFoQZBJImis9Yb42q4R+tutevpFS1Etaxbfh2aWLPLTpzgGA0lLACj8R3m3UrbwfGydOG/e1sL7ZZteefdDdJoug7owWX2F4n7W41xS7kMHRBh8ZZZDHoCvzREBiurtq0AiKSXTYAIQMCmc1YQbLuFMoxaIDI07OTH1r3xQtEhBlhgTsdRULC2HA2jRZ8f8KRi069+P6hIjoNH/6RpMSl3xOcOYjleHwDUVGShwy4StWLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3pg7VV2CC+8cTw46ENhc7lC+NxX+FY+U6PA4IvE/Ovo=; b=NautPLAx3ZWUhfU0haBVcoayUwacX6jOJqaA78ebyZvDV0selPo0II0vq18M0LJBOG0DVAaT+DVFtdnZY/dCO498aq/QOSDZbN1AbaweDGUS21DApeJuHrvubZ4v5RzaN7ETVLCKjYu9BnkskOgPxKdLyGitgFPw5MjBT2GZXXw= Received: from DM8PR11MB5751.namprd11.prod.outlook.com (2603:10b6:8:12::16) by DM5PR11MB1947.namprd11.prod.outlook.com (2603:10b6:3:110::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Mon, 13 Dec 2021 07:09:11 +0000 Received: from DM8PR11MB5751.namprd11.prod.outlook.com ([fe80::5cd0:a2e7:ce1b:16c]) by DM8PR11MB5751.namprd11.prod.outlook.com ([fe80::5cd0:a2e7:ce1b:16c%4]) with mapi id 15.20.4690.015; Mon, 13 Dec 2021 07:09:11 +0000 From: "Wang, Xiao W" To: "Pei, Andy" , "dev@dpdk.org" CC: "Xia, Chenbo" Subject: RE: [PATCH 2/3] vdpa/ifc: check lm_cfg is not NULL before use lm_cfg Thread-Topic: [PATCH 2/3] vdpa/ifc: check lm_cfg is not NULL before use lm_cfg Thread-Index: AQHX7+BtSMgFkr/54kqd3+ggxAu/Dawv/4xA Date: Mon, 13 Dec 2021 07:09:11 +0000 Message-ID: References: <1639369756-103116-1-git-send-email-andy.pei@intel.com> In-Reply-To: <1639369756-103116-1-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0c24a7ec-31d5-46dd-0901-08d9be0776d3 x-ms-traffictypediagnostic: DM5PR11MB1947:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wY7hGXFwKOIf586QByUtFgKl2hv3MmQcVWQgBrBkF7Vj8Mt6CQr/YxMrt49ONLH1Q0MYVSAZ7v4xhgexCmkM2FGJd8SxhE7jOZ9tiLjYnhENziaqMNtoSiaGUUz6NFo1u8aQktbzMyiP+vBvb+M1nNQgNq6LvwbWmVseJFtQ49pfqbuspB46K5GD0K02Ex+VTdDrQwy1WvqkyFcJW3E/mYuc0D4oNPgadrPuD7E4V9c2IQuUJtaNroPtfDnNoDf8p/i8wYBHF22qjy9JF/gYFtgguHVjFUvHK9sqWkJ5MrZpNoUkJERuBdNmbnBGHR2QFfmvbt0DyQj6CKMGSvNv4IVpJBi4ItfhE0YS2FJq8LvAfzgs4CFtVfm+XP3bXsNjK487y4ZkGenh0+kiPYTsTwJAq+u5rmpr9HNIF1hum8976sqdd2Q2+iCs6IQo0rfi/d7EuHXWDSRZY8SmzTucKGq8V5TTaGyKMA400zzFKS/tnHX0CaqNVKT5rO0K4udlW/PyZ7YKyXfi9ZnhdArMSxIaO2BI1dErpSy5BXq2quuX3X5D4lWq6ZQdCsDWUCTtdLUWo8Z3+4iZEkVs48QWRgq5bNLUg9thK+0uQ8FYT8gilSGcTUsa7ELlz8wJEvRAmHPIfy+E/BfJ/tL0vvH6tdFTHuqgfWqkIUUUkguglr+aGAInY9esQKE5x8+qHkFxHo/wy1nRfgu5WiTQUuPb/A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5751.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(52536014)(8936002)(33656002)(7696005)(110136005)(82960400001)(53546011)(316002)(26005)(86362001)(55016003)(122000001)(38070700005)(71200400001)(4326008)(107886003)(5660300002)(38100700002)(186003)(508600001)(8676002)(64756008)(9686003)(76116006)(83380400001)(66946007)(6506007)(66476007)(66446008)(2906002)(66556008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?b2NqGRjtVGplQI9n8CSXhdfuOkOFqmUD8He5S3Xdol6LpBHj0o5AqZai?= =?Windows-1252?Q?8Ocjx3l29YDkxtY9SLP+NVZ9RWAcRvkpUUF8bENFjjdehJ8FWr5Ymz/B?= =?Windows-1252?Q?MFt41GG/WwXVBo2j8K5xCUrdGHmnc8gNg0EcNr8fcuuOvrtT5cko5SUn?= =?Windows-1252?Q?VbT8q2OAAPWmnfJVDqXiyu+D5jwOzlUjtXPir8sQ6TPxvF+V1jli7MI+?= =?Windows-1252?Q?2Hu3wII8ojbQMgZOwKWFu5MZls7gRbS556T3wpiGk9rVblUodXx+Nzo1?= =?Windows-1252?Q?RvsEE4/vtvSW79vbjnXO1dWb22GTqqkUu5E1wZ744mKvkxGORWadJr0H?= =?Windows-1252?Q?Brcfdsj9fInZrbBSSFl9l6cwZzmRyO45JU1EpCyIeAHObhT1+QBjfZCN?= =?Windows-1252?Q?yIF58eTqKIosZRZfDDCX4un6nm2dkUtBisDR4rpirfV9chjWTDXctc4/?= =?Windows-1252?Q?Zh2zxO/Q9rqqGo4V61psypKu6L+Iq++TUbp1PjpQ4qxRX3+9zlNf5Ki3?= =?Windows-1252?Q?7TgNuZxndO0BpWJ2GdhWYNIpQw6eiz3Q9F8YXvkz7K+eJczSsGE7hWLn?= =?Windows-1252?Q?RzmFz4znVgNBMJg1hsUdrKwxov05KCKDR30AoE+GONUHHPK4CwTubI2N?= =?Windows-1252?Q?9Az6I1USjuJSmrC/Xe6MDm8XmIAaggX9oCXDPFmDdBbIMDNahlya4f1E?= =?Windows-1252?Q?4buffvvYL0P28zTpMG7aTFR8L2/I57i/4GOvnHAzBliBebzELZNWoIB8?= =?Windows-1252?Q?5W6ixBBGrxjOa4vKq5f66LjZGl8cygDRSqnv9Q0sXvR/ZwwNl5odbEVS?= =?Windows-1252?Q?YwEpWayanG/D0EviqiBVOj/RAjAsOFeHGqtkDla+A3hVKOpfCRbw6YPf?= =?Windows-1252?Q?91zJzs3CaHCcUkP2Z6bJeO7V2u5SzzfAcHidpG6SW2rszfMouMCS00wb?= =?Windows-1252?Q?A25sEuBJ0Hh72D/PusYlp5n+zMqBwFDseBeeDJajhJjndGDnd5wMmIpZ?= =?Windows-1252?Q?5j/ah0y3b5zJvl58rSZUfC6FQytkUH8eemfVSYdTXqoPeMI6XAEnNbL6?= =?Windows-1252?Q?JX6aIaJ027OCF+2MV+i65YzQpLpz3IuYAtfcD39j3wqpq9dkXOE91PEs?= =?Windows-1252?Q?Ks9zMldB4joAANVWhh6cWmN6bOpZ7xkN1s878XFE7YN5ReQO6jJKtg/D?= =?Windows-1252?Q?S1hntQ+g0648eBEYD3t4fv+Gf9H0kupMnDHzwqTBS5XieayEt2RbBvUm?= =?Windows-1252?Q?n7nTCq1/fUlVo/J02esPcLeoXo74ce6nE47k+qMHB7Lp7PwM3ixjyJsw?= =?Windows-1252?Q?q38t9nGXfMJUBTfvRtxsruT6NUnXN/A9W/C3rgtxNAILumsSgFjqmSSV?= =?Windows-1252?Q?yesvdPV8ApAWexG/vZi+kndKZ79hMdnYpteIuCb46ExVHmYbrPe+hw4I?= =?Windows-1252?Q?Fc6o2Oc+gK0hVGr4iTlc3Zjz1M3haPulOmz/uuGyIQq56TnM40r9s1XM?= =?Windows-1252?Q?J3+gobuSqVaabSqQOH+G2q1aBCGb0/TKwtG51rnbp6wLTJne5ihjQMHA?= =?Windows-1252?Q?w2q5iNcBtzHTpCB8Y0Ny9iJUMVqdoLbRImw+4qynQ0u2zZLDx34z/Z+5?= =?Windows-1252?Q?FtxTntjun+ZtvqpW3hoQb8ThJ8oiQvUqAV6GxOjQkFnixFRsflkGzqeA?= =?Windows-1252?Q?jbtAiJ1VUwA2wLuKin3RXl9H3KpkvoJNhwoBtiF+3TDZTWcMkKuwOFzi?= =?Windows-1252?Q?hY8UQhp99mRCyIrDiGc=3D?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5751.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c24a7ec-31d5-46dd-0901-08d9be0776d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2021 07:09:11.6160 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dFMyaf6oO6mb/FHMkzX1e2C/8SpeCU85UcldVp1TrQMbigC/DV3VBAkhF1ZSj+1jrP/NTgW5B8KH+X6JgceJmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1947 X-OriginatorOrg: intel.com 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 Hi, Comments inline. BRs, Xiao > -----Original Message----- > From: Pei, Andy > Sent: Monday, December 13, 2021 12:29 PM > To: dev@dpdk.org > Cc: Pei, Andy ; Xia, Chenbo ; > Wang, Xiao W > Subject: [PATCH 2/3] vdpa/ifc: check lm_cfg is not NULL before use lm_cfg >=20 > check lm_cfg is not NULL before use lm_cfg. > when init hardware, if lm_cfg is NULL, output some debug information. 1. We need to capitalize the first letter in a sentence. 2. If lm_cfg is null, then I assume device doesn't support HW LM feature. B= ut in below code change, many places just return silently, is it an issue? >=20 > Signed-off-by: Andy Pei > --- > drivers/vdpa/ifc/base/ifcvf.c | 32 ++++++++++++++++++++++++-------- > 1 file changed, 24 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.= c > index d10c1fd..b9b061f 100644 > --- a/drivers/vdpa/ifc/base/ifcvf.c > +++ b/drivers/vdpa/ifc/base/ifcvf.c > @@ -87,6 +87,8 @@ > } >=20 > hw->lm_cfg =3D hw->mem_resource[4].addr; > + if (!hw->lm_cfg) > + DEBUGOUT("HW mem_resource[4] is NULL, so lm_cfg is > NULL.\n"); We need to make the debug message more human readable. >=20 > if (hw->common_cfg =3D=3D NULL || hw->notify_base =3D=3D NULL || > hw->isr =3D=3D NULL || hw->dev_cfg =3D=3D NULL) { > @@ -218,10 +220,13 @@ > &cfg->queue_used_hi); > IFCVF_WRITE_REG16(hw->vring[i].size, &cfg->queue_size); >=20 > - *(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET + > - (i / 2) * IFCVF_LM_CFG_SIZE + (i % 2) * 4) =3D > - (u32)hw->vring[i].last_avail_idx | > - ((u32)hw->vring[i].last_used_idx << 16); > + if (lm_cfg !=3D NULL) { > + *(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET + > + (i / 2) * IFCVF_LM_CFG_SIZE + > + (i % 2) * 4) =3D > + (u32)hw->vring[i].last_avail_idx | > + ((u32)hw->vring[i].last_used_idx << 16); > + } >=20 > IFCVF_WRITE_REG16(i + 1, &cfg->queue_msix_vector); > if (IFCVF_READ_REG16(&cfg->queue_msix_vector) =3D=3D > @@ -254,10 +259,14 @@ > IFCVF_WRITE_REG16(i, &cfg->queue_select); > IFCVF_WRITE_REG16(0, &cfg->queue_enable); > IFCVF_WRITE_REG16(IFCVF_MSI_NO_VECTOR, &cfg- > >queue_msix_vector); > - ring_state =3D *(u32 *)(hw->lm_cfg + > IFCVF_LM_RING_STATE_OFFSET + > - (i / 2) * IFCVF_LM_CFG_SIZE + (i % 2) * 4); > - hw->vring[i].last_avail_idx =3D (u16)(ring_state >> 16); > - hw->vring[i].last_used_idx =3D (u16)(ring_state >> 16); > + if (hw->lm_cfg !=3D NULL) { > + ring_state =3D *(u32 *)(hw->lm_cfg + > + IFCVF_LM_RING_STATE_OFFSET + > + (i / 2) * IFCVF_LM_CFG_SIZE + > + (i % 2) * 4); > + hw->vring[i].last_avail_idx =3D (u16)(ring_state >> 16); > + hw->vring[i].last_used_idx =3D (u16)(ring_state >> 16); > + } > } > } >=20 > @@ -292,6 +301,9 @@ >=20 > lm_cfg =3D hw->lm_cfg; >=20 > + if (lm_cfg =3D=3D NULL) > + return; > + > *(u32 *)(lm_cfg + IFCVF_LM_BASE_ADDR_LOW) =3D > log_base & IFCVF_32_BIT_MASK; >=20 > @@ -313,6 +325,10 @@ > u8 *lm_cfg; >=20 > lm_cfg =3D hw->lm_cfg; > + > + if (lm_cfg =3D=3D NULL) > + return; > + > *(u32 *)(lm_cfg + IFCVF_LM_LOGGING_CTRL) =3D IFCVF_LM_DISABLE; > } >=20 > -- > 1.8.3.1