From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A35EBA09FF; Tue, 29 Dec 2020 07:05:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4A85C9E8; Tue, 29 Dec 2020 07:05:11 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id ABE45C9D8 for ; Tue, 29 Dec 2020 07:05:09 +0100 (CET) IronPort-SDR: +ZB8P+KLpRzMHcya5dPPI3YKtuda+gcCptjwcFnebkpudLPAXWZcAp0ShdifwX8M1M4kTnlPLa 0DMWBODwggRg== X-IronPort-AV: E=McAfee;i="6000,8403,9848"; a="176616082" X-IronPort-AV: E=Sophos;i="5.78,457,1599548400"; d="scan'208";a="176616082" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2020 22:05:07 -0800 IronPort-SDR: d5AKIsuge6wiMyyrSmbN7EvwDruaAaHs6qFPp/gV5kHd9tCdlnJ2hr9C9eF5ssDmfKly0ELPJq gZfs0DxWC6uw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,457,1599548400"; d="scan'208";a="358808818" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga002.jf.intel.com with ESMTP; 28 Dec 2020 22:05:07 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 28 Dec 2020 22:05:04 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 28 Dec 2020 22:05:04 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 28 Dec 2020 22:05:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WkUpM3z+Noh0j4LJbOxR+bu0vodYqOnF1M4dMmIxoNVU5ZDVq1Cje8BVkRXhKQzt0zB7HeeepIVndGQZaKq7JORlUEmKWFwVuRyRiylYMNwlwqTumOKiyfDnr0P3nOxYBs2WN0qh6VXbrX/5Iz+SV98AHmz1zRbzkbiidI+rROJYjnSkpopLuQYQyU8/75ZQ7MLMsLYAgu5cH/qkDYMSE442Num1WK5zN4ZbQacyx/uzjP84odpZyvJnH8HV3lsY+dghdRdzQI7M/YWu+uX82dYQ03VjlZfFmq0IXzxTCV7tJSjTl0MEF/CX3ak9NKQg/RRA2lOdd29gh0NQZR5AJw== 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-SenderADCheck; bh=2dCe7GlRIBpMnyvFSoodGKFDaWK3cNqbeyP0KVOdUKY=; b=Y+QIqQXYCscSSEVcc3Fq5XvKZ1LwhZp+vc/OXpuqVYfISDY/3DONdsZEduklbk4z+p0yo/uI8sOI5rTfknVS5n+ajkme3D/gs0lWN32ARxcMQZLBWvRKiVrOjOC6yudLYNHdFdPKx7kzEkxzbAJbPlPzmlgisxZ/zoB/IgdbdlKiJG7WWenk+k5hLhK6/6z9S8TE42t1UrqrX2cMQgi3Z6unI7w9wGCo8HQ4HsRDHWYRiv6E4wM4wriGkiyc6RaMVMbKWyFDBWVDcf/OR2IV0gPXaSnVv4aSyT8Z36lZcwrNNGIufVXmY+sQtIL0F7oFwDMJ4OGkAm9g3vX8yhg6FQ== 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=2dCe7GlRIBpMnyvFSoodGKFDaWK3cNqbeyP0KVOdUKY=; b=AfIThDjtR6N+Mc9uuIRxSZ7XQiI7aPZDx06n5B3aoR5le0/zEp2OgwNOfRf25k1SGmJDed9NIZS+efFd3giFGrzvmueAYOz/gEQ5tQPo1yTQuT12d3neafJar5HBALGx+asWg27TzqDv9R76n/0I/0jVBDUERuTCYZ2Zeg/Ep/o= Received: from BN6PR11MB4052.namprd11.prod.outlook.com (2603:10b6:405:7a::37) by BN7PR11MB2724.namprd11.prod.outlook.com (2603:10b6:406:b3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.29; Tue, 29 Dec 2020 06:05:02 +0000 Received: from BN6PR11MB4052.namprd11.prod.outlook.com ([fe80::5cba:8ba9:1710:dd4]) by BN6PR11MB4052.namprd11.prod.outlook.com ([fe80::5cba:8ba9:1710:dd4%7]) with mapi id 15.20.3700.031; Tue, 29 Dec 2020 06:05:02 +0000 From: "Wu, Jingjing" To: "Xia, Chenbo" , "dev@dpdk.org" , "thomas@monjalon.net" , "david.marchand@redhat.com" CC: "stephen@networkplumber.org" , "Liang, Cunming" , "Lu, Xiuchun" , "Li, Miao" Thread-Topic: [PATCH v2 5/8] emu/iavf: add resource management and internal logic of iavf Thread-Index: AQHW1dJWnJivGgSMuES1iuGZhWNhlqoNpNng Date: Tue, 29 Dec 2020 06:05:02 +0000 Message-ID: References: <20201218074736.93999-1-chenbo.xia@intel.com> <20201219062806.56477-1-chenbo.xia@intel.com> <20201219062806.56477-6-chenbo.xia@intel.com> In-Reply-To: <20201219062806.56477-6-chenbo.xia@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.39] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5a52ceeb-dbaf-4917-2055-08d8abbfae57 x-ms-traffictypediagnostic: BN7PR11MB2724: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uw1//V9KZO4nyqOhMqA4uvXDt5N2TuGW66eN6tylHurQaGF+N5CvdxCQdZnoI1rqBCIj1eNxhJ02Z8iHwziYarYiO9Jk8VlOFV7rOrtugM8fdSfxfrQUSIdFFJCvcrpylDW/2BgkTfleQuKg61gB3RQziFvcjHQ9LHQD4PU8JMzUF2fCWbq9F11/52mzA88PTnEputa0pzWk+6SiAPUv3XSYpbhx68UEtUU1K/gY98ERaMjwOrN5SCbpAR1tiKtnipYUsqF/5RHBo12t7lzdepatzbpBUVMHO2KPVtxfciUqGE9xzuisWCK9SvL7nFnaIwiCGZrZCuk8H1Urp50IlbNUQrsBSHAWMFYL7p7iajtFwDItGODEGi8RrK2NQfQnbOUosKNnbjOPC/9h08s0Sw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR11MB4052.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(376002)(346002)(136003)(39860400002)(5660300002)(478600001)(186003)(107886003)(9686003)(55016002)(110136005)(52536014)(54906003)(33656002)(7696005)(6506007)(2906002)(86362001)(8936002)(66556008)(8676002)(76116006)(26005)(71200400001)(64756008)(66446008)(83380400001)(66946007)(316002)(4326008)(66476007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?whLY+aro0huuBQJ9Tz8QTPdMxke4B7Q6LRur5Kue+PyrZrX6mDaVnL75VN0e?= =?us-ascii?Q?ph8efAVSKIwkPRsvt6v+XO/X/DMT2ablv/vrsgcB6S3Q/tyGwfp8/dnwEpEs?= =?us-ascii?Q?oYuzACHVYNpB1RGYHOUxq7O4wGnXIqXePvkZ19S4YP+QYlO0hfR/Wxu+8esd?= =?us-ascii?Q?3mdiyM2oYt0wHjk3mlEZI7ZaRGd5mqKB0no4uXvvhHrXcddFLSzfGZPh4gjz?= =?us-ascii?Q?zmU5W3RnL12cF3xJEm9DTUwfMdVLycm5noPem3y25ZJSlvQeGzXDXmPRTU5p?= =?us-ascii?Q?8nDOhmzakVAcHvSIiYz3a8D/KYb55nRrLZTyLCgOYKQclela1z3U0lr/ZOeA?= =?us-ascii?Q?IvmxAEc39ni6SQhyRpZ3mGVxckC85aC6mA08m/hGJJ1jB3ne5q7gqJ3szmBB?= =?us-ascii?Q?K31ajWD+wZ5zg5QDX6PUzdWBv+ePMTpvGLldFLdvIo9OC676BCQxw1fcAE4n?= =?us-ascii?Q?Q09f3uhKvZNI3urx/RyEsDRg2RZNwUzIq4MJ3tRIvufe7h3Ipb53b89Yg1rL?= =?us-ascii?Q?bFyjPlv859zafM4w5+eSZ0FZoz8AkFZoF8ZTTC6i/dwQqWdjnBpSkdqN47nl?= =?us-ascii?Q?knr/YhYSl4bddWkNv5F/4CmIC/RxVBtJjWlkPQ1iG8gy+z+sPq15pxNzg4QO?= =?us-ascii?Q?5V+SWjHvg75pKqD/1u9EKt8nuvP7GIu6KiTm1k2+31D3c1k6l25c6ou4doJ/?= =?us-ascii?Q?rJ4DeZoAct3Tcx+Lsgu3STnY2UKqWX+t5TUp2KSEIID9hSopbjQNhRsxRWHW?= =?us-ascii?Q?v+JIA1xg+FypdGnQOHNw4xMZW1AIvH9m9wP1GY3WjXOcr2xICcWWIQoxmu/4?= =?us-ascii?Q?xuvFpCjRs6jzkwFbRtVoyv/LoCWkYTKRotec3ajtaMCQ733S1noljnpLLHF4?= =?us-ascii?Q?Ux3p+g9dOZQXFy+egZhpfIEIPL4tZGpPxO2rXGKsoz98Usu+AjQiV0Hui2fo?= =?us-ascii?Q?/Sj7STIJEPocLcBHJFU1Acbx6YRGtd3AAGkYGj6N9Fs=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR11MB4052.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a52ceeb-dbaf-4917-2055-08d8abbfae57 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Dec 2020 06:05:02.3234 (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: iqRbfPL+nfXR1OvV0+kTQgrgrS2TcXa7DoYb4n1pLpGtg4Rywqwk4ltztxE8q6BiQroZ1ZeIgpzYvP1PdsIKww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2724 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 5/8] emu/iavf: add resource management and internal logic of iavf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > +static ssize_t iavf_emu_bar0_rw(struct rte_vfio_user_reg_info *reg, char > *buf, > + size_t count, loff_t pos, bool iswrite) { > + struct iavf_emudev *dev =3D (struct iavf_emudev *)reg->priv; > + char *reg_pos; > + > + if (!reg->base) { > + EMU_IAVF_LOG(ERR, "BAR 0 does not exist\n"); > + return -EFAULT; > + } > + > + if (pos + count > reg->info->size) { > + EMU_IAVF_LOG(ERR, "Access exceeds BAR 0 size\n"); > + return -EINVAL; > + } > + > + reg_pos =3D (char *)reg->base + pos; > + > + if (!iswrite) { > + rte_memcpy(buf, reg_pos, count); > + } else { > + int tmp; > + uint32_t val; > + int idx =3D -1; > + > + if (count !=3D 4) > + return -EINVAL; > + > + val =3D *(uint32_t *)buf; > + /* Only handle interrupt enable/disable for now */ > + if (pos =3D=3D IAVF_VFINT_DYN_CTL01) { > + tmp =3D val & IAVF_VFINT_DYN_CTL01_INTENA_MASK; > + idx =3D 0; > + } else if ((pos >=3D IAVF_VFINT_DYN_CTLN1(0)) && pos <=3D > + > IAVF_VFINT_DYN_CTLN1(RTE_IAVF_EMU_MAX_INTR - 1)) { > + tmp =3D val & IAVF_VFINT_DYN_CTLN1_INTENA_MASK; > + idx =3D pos - IAVF_VFINT_DYN_CTLN1(0); > + if (idx % 4) > + return -EINVAL; > + idx =3D idx / 4; Should be idx =3D idx / 4 + 1; ? > + } > + > + if (idx !=3D -1 && > + tmp !=3D dev->intr->info[idx].enable && dev->ready) { > + dev->ops->update_status(dev->edev); > + dev->intr->info[idx].enable =3D tmp; dev->intr->info[idx].enable need to be set before update_status callback is= called. > + } > + > + rte_memcpy(reg_pos, buf, count); > + } > + > + return count; > +}