From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0084.outbound.protection.outlook.com [104.47.42.84]) by dpdk.org (Postfix) with ESMTP id D300D239 for ; Mon, 18 Sep 2017 13:15:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=br7HMiMdLVeqbwVuCQsE1fMdv6sau+/Ur1Yj7nE0t2U=; b=HmK5Q6egSk+Hze/Qxm5HDNg/BrxfaIAz2MfPaGt3cFz+fp8niVL4gkGCVfvoLoMTktBspooPP8ZwrHjmiF54D1pvjk+amOHP7Gzn92H+gyoKd3iX3d/o/X/zp/hcLFAtplT0UiA+m0xz7Khm+BiSx//AkhCV5Jc6uZtzkdPQl7o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [10.89.1.8] (14.140.2.178) by BN6PR07MB3090.namprd07.prod.outlook.com (10.172.105.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Mon, 18 Sep 2017 11:15:55 +0000 To: dev@dpdk.org References: <20170818125127.22346-1-shreyansh.jain@nxp.com> <20170825101954.28124-1-shreyansh.jain@nxp.com> <20170825101954.28124-2-shreyansh.jain@nxp.com> From: santosh Message-ID: <195eb86c-487a-7354-ca08-9a7d4d7f849e@caviumnetworks.com> Date: Mon, 18 Sep 2017 16:45:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170825101954.28124-2-shreyansh.jain@nxp.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0100.INDPRD01.PROD.OUTLOOK.COM (10.174.208.16) To BN6PR07MB3090.namprd07.prod.outlook.com (10.172.105.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2765aa8-9042-4178-733c-08d4fe86a30a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3090; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 3:VGHPofG+h59EUAIjEMLh9ZqiO+/0GprPTaQBtDYAtKb9GwyK44m2CoRuyEaLkHtezZX2MhueiRj0+ZrYw6cOuVlUdYjLIhKS0sm1Y5zg/3KlzH+zGk8ZLVPHix50Vo4wmyBfl3gujA4MALNLcfHkHPH0PxYGQ3llr9rJq4yAjKBUNu71oXMWlM7Rz1yiY0FL6Qt6v2ApRNa/qNeax/kVSoi070N43mDdu6dH0EC9gMAhQVE9QegTR4XDFaJChq8x; 25:LVGPnBVF1kazIwAOmYRPHj9kIf/++mO9/8ReKP2nMLq1DbR/XnjGHx/crYyRt+pmc64WFXEhrb3xgBhnkz4UBCRb+pXjI2KWRNY8Vnlm0tJnGpNU/1iMiUv4woZk7nRNnpVUj7ZOziVSbkHcfC21hUqQsRix+oSFd8keUjUJ45Uqb2o53xtywn7mNEIF6nu/qKVraMeb0OOa0DCa35OEGfztyQo1c/XHBjmJHhKWBvCeyUMKE51XkqzkwtalksSfL8l/4cs4Zj0kxXKDny6gvHKmvyoDYgqP8vd2qfN6T9UiRXyP1I6tE42ASIQrZStm5TG4K83RSK9KkeoPxV99eQ==; 31:O0pBw3xdPHJH9/FydptceDZ6mwBBADo/sSljb0+9gI2+dBdEAMURZX8BK3jmqbBehJH9TeEQrw8Mzqmj/TndP+caeOLDcflGP5d0r++XjEDKVEADsENhqGHnczFcfSz0PG25MOtDcyHMLzyJIrfxwwEmdEW2EVTOaQCdJsGqO3vRvJvsx6g5EVfyM94wQjCV/nH0clmDCsd8hsymmKwk0eD351+U88m4VALyTU8aOSk= X-MS-TrafficTypeDiagnostic: BN6PR07MB3090: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 20:oUQuYtksg6upfPgpYbUm9hEZRPdniWsim7NPxghayFDka2T5kWQjNHPxjKxiC9Gsb0qfLszu7A6CuWhpqagN480HCDGx/iYKsQc3sWHUu/3r7XuDuSNwsieCJfg+7WVOp7G3cnnPCnFzJnS2mko187Fupx1gqWO8XGw+tl3RUCUBeNnpf75kXUyyf3CqWzbh1TLTVQWWCyiWTZ56oamBilCVAaHZ/K53IEFxjXC9T+wOIE6LwNN2e5wRJ3tFn0MH54G+8vYtMS3I4lYsN/4s950EgHztnbjjR6nMMp1DhHs9BTkedJSTjR1h7xjD4NwzQjUCYSLhRVLBHynlw2Shx2tB9k+aNYAZALzex+iWjPBHmCZs75bo8BQvbKhKl6IRNXKeJhFiHOFBzpKR/q6uDaHMBCFrkNT4j5GeLQij6Sc507ECVKSPzDyIzKOMnOsgJBPA5M77MxOMTQhEfp4o8WdIuSKvKXCeMmd1CyI6tZxRuYJ1YUMSndfBTT37KLd4P9D02Z5q+Pr4hY/v9QgX5WDUpr51wFzvzt1y8A7+Q4xOUFtaah18lHxU6ealrAq/SIzTZhaOe+/nWDuJtQF/FKKph0iJ6FdTiQY+6AhvyXM= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684)(21532816269658); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(93006095)(3002001)(6041248)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3090; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3090; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 4:NNBTUdG7dwmAwaau1Tlk5We8fsoDIz83K9sBZ3KY2l9zxEKlrbW1bY7ZzVoM2bFff7U3X4AJkMQIKZe+qaoObuOt8ns5x5x0Nm46mgt9rukiKx8Xf+sIlf+J4vKykU46X4uPmM279qdL1DyPXRT3jn7soFWEvmS4bq27wfIrwGJdVG5NEj/SRlXxadE0HEEQVG136KVE+lPmrokZ8G6Sau28NWfuRXkzyuHIRutcvV/mH5BQbzesEiMNGpcZchItGmrakSovKKHcyiJjFWt79aw/A0g2pBpcgYA7MgBmL4W6h4upgNB3YYcTKZxcfRirisn08iQtOHPk84nKa7iuGhBsAE7gbToRlMNgOqC1GQY= X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(376002)(346002)(24454002)(199003)(377454003)(189002)(106356001)(5660300001)(47776003)(189998001)(65826007)(77096006)(6486002)(23746002)(90366009)(8936002)(316002)(16576012)(3846002)(6116002)(81156014)(53936002)(2361001)(8676002)(72206003)(68736007)(2351001)(6246003)(65806001)(65956001)(31696002)(66066001)(105586002)(110136004)(16526017)(478600001)(2950100002)(42882006)(54356999)(5009440100003)(86152003)(2906002)(6666003)(50986999)(76176999)(305945005)(36756003)(97736004)(101416001)(7736002)(31686004)(25786009)(83506001)(6916009)(230700001)(58126008)(33646002)(81166006)(64126003)(229853002)(50466002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3090; H:[10.89.1.8]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; BN6PR07MB3090; 23:mDpABmaSe35/dladE9cN5fVpVSTx5PyhBoFzu?= =?Windows-1252?Q?Qd3tTpjwdk4TbFgzJ1KVytFJ3b6HDP6THrcgYGagPweV5L41u4A/ahIQ?= =?Windows-1252?Q?VnQ1dG6DdVHFs4KgoUaIkDzFhMECqEzyQ0gpwNigU9FcrkMpobXyM6/1?= =?Windows-1252?Q?dKg40HbCB0aez6S5RNvibPyLQId7VG3+nwoVSJ7rMLvnz2ZaSJH5K5mO?= =?Windows-1252?Q?cX66W2PfU6lLEG3TEHr2rHVs9RitD7BeRMddsXWFhGExTSGVMUDDZHtu?= =?Windows-1252?Q?+hjMWXsxHwqp67vuFHefsKdFiez4arG9zArUXqB+8PR/xGDSl2HiJXBc?= =?Windows-1252?Q?jUR7MYrSmA0VOKAI17E57HKMWfT52P6DWXYB9+TJSCuZ3N5do0dVceVH?= =?Windows-1252?Q?xrULnb8W5ao9mbVkNRYBhMjIo+fNU//umPpq8Y4oQKuwWQ4KZTnF8E+x?= =?Windows-1252?Q?qmK2RPRMyaJrkhdtJoNWzxWlz7LSOcLhGqNYAU/RyM0E9bkXPX4W6Jk5?= =?Windows-1252?Q?fKQzwekulMz1oRKjPDxLsjK6mYuLfFkqvVSk6W3MTno8racoQVE2oGCv?= =?Windows-1252?Q?rWEHZ7QKFBjxt86G8hJtbUeCgQvpAg0jBHcam2Ky1deL924mId6X6fd8?= =?Windows-1252?Q?+nvuXJKrypTmOWYvtZDtSUqu5lO/m/Azp/Ipm+IbPJLgAR69nfCN31tU?= =?Windows-1252?Q?nxeMDaBDBCWcnDMhM7XLX1YKf1ccgRClaRN1NhEE/VlPO6Wy3xFtpP1w?= =?Windows-1252?Q?yV8i4P9zgJL1CDgORUQ4AM6fDIpglAtaItZzw9QUYIjmh0BkMEw44JAo?= =?Windows-1252?Q?nxM0lIb29ngR/Eyzd8Q2knHLD+Wx9D1k2TWXr0XG+kVi3ML0ra7tglCI?= =?Windows-1252?Q?l5c3YZKxU5bM5cX5T6l0MyxEVO0vcBmHJyPPkijvWZ7mCOXOHfZnGqEu?= =?Windows-1252?Q?fOtU2ODEV8sKq/1KtQiSY7UvBD57phIGHZA4+vu1BTIDhaqxo13nlW4M?= =?Windows-1252?Q?lXySR/o1VABvWRKHYgxNNKc82q1bDWUluMAsz8VBzyiKdehAvEXLwVQQ?= =?Windows-1252?Q?HIZU3mIqITJ3gaghsLhQWql/WADt24HWKRAjlAft2BgiFt/IWfOxS251?= =?Windows-1252?Q?nOneWAGMKqRplL/WMWi5Uzmdu0/XNdqtIiSkgqvmGZ/wEMwQ4ktE7gsO?= =?Windows-1252?Q?qhSk9zJL2WEynAqmy/fgVnWXiPceOd/uMMz1oRGEbFn25sTPhxBXvlI3?= =?Windows-1252?Q?HrTfZP95ajbyZ+W5BUTdqSu5OAwfV2s59U6oW8tqlJ69208CxGPB1MQo?= =?Windows-1252?Q?hZLwCsJzqyTngtgRrx3+4I72LjFNsmIbKmipxaCoBPNo4Dk9aqYgNyTN?= =?Windows-1252?Q?wIH2KZe7biI75+EQYmgAUvcYmkABVzrQywUFByBnYZJoD7VmWGN7Ngj0?= =?Windows-1252?Q?EFcu42DOJ4Oo0YV7crSGgf9RJq0qfeJrPGh+43rskZ4dCyU8sM2MXhM5?= =?Windows-1252?Q?AJ1s0T38NUkokjussoHS+fCVv7qBTqHa8ZBLOA9+c5FK+xZ84w04GnES?= =?Windows-1252?Q?JLIAXJH/fQ1GhrwsLlHL60FCptG/MZDE8BK?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3090; 6:dfUU31IWGereKyD1KXbdWpM5qNqtI6/U5HpeSQe+0m+R/Sa9R5sBy79FR1sX07jx5AhEAAWxNmyA/1jhTu1UuEMuTNyYpJhkOxS9PTLjSF4IiqHTXoltzBprTNNhvsz751DtDc2HDyeV2lXtv/uaF+quSxjBAuJzl2mz9FmWqPc8t+FThq4Tcl1xej+mwi/37pAE8yTPmLNBZ3y5IgmyajOsYIKDDHGKPL95RJaDM930Zdh/EX09tGDGIugnIoodV1Mza+14DuRIJM0bH/sG5+NunfntkPi6tFaU91Tnf2Mt5NiUEx9iPaHnAprywLc7s8erY6D3GvXWg03iUtIHuA==; 5:HIsMWN6vSB4QHRmpqMNhP3NWWHzygO+gUSVa6Z88OR72hyUQn/GOQpwR+rtA41n0r7R7NoXYUar3FrVRCCYHS3mzHyuhjF+v7ya57pUHvD/i+HOGkfyfrO9DYJHfVL8GM13/XiHqgVJjL1AKcRT3Vw==; 24:QesvnORsNgba1EDiTP3Dv0lpYU7Wtv6mu2j8TXiXf2BBVV/Hnr1pmTKEdc7rDfhmRFn1ODhslM67hp6coDBk8TToGE/ZdbBH0df0QdgWFP0=; 7:DRfmdQqBov7HQHS68TY7p/omoShLC1nwYHebjvXnjMqF8lXDGOncEiNdf4EEIB2/n0qk6LkqzeDGfqDhmech5gtvyo0SgEzRlrGH80iKmQm6bGaMj/5SQFRCOTSpgDTpQnWz75xrvOHh95ju1cFC8E8ceNcWBJYEesl0S3BPqvaa2s2ceyijoaUOB7jVvxevw/KI6997cx0g3A12ygSup35WHS0w1rxeuM6w9kKNcew= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 11:15:55.6151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3090 Subject: Re: [dpdk-dev] [PATCH v2 1/6] bus/fslmc: support only single group and container 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: , X-List-Received-Date: Mon, 18 Sep 2017 11:16:00 -0000 On Friday 25 August 2017 03:49 PM, Shreyansh Jain wrote: > Currently DPAA2 code doesn't support multiple groups and containers. > Remove such provision in code to simplify code. > > Signed-off-by: Shreyansh Jain > --- Reviewed-by: Santosh Shukla > drivers/bus/fslmc/fslmc_vfio.c | 70 +++++++++++++++--------------------------- > drivers/bus/fslmc/fslmc_vfio.h | 3 +- > 2 files changed, 26 insertions(+), 47 deletions(-) > > diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c > index 45e5927..3423b57 100644 > --- a/drivers/bus/fslmc/fslmc_vfio.c > +++ b/drivers/bus/fslmc/fslmc_vfio.c > @@ -62,8 +62,6 @@ > #include "portal/dpaa2_hw_pvt.h" > #include "portal/dpaa2_hw_dpio.h" > > -#define VFIO_MAX_CONTAINERS 1 > - > #define FSLMC_VFIO_LOG(level, fmt, args...) \ > RTE_LOG(level, EAL, "%s(): " fmt "\n", __func__, ##args) > > @@ -71,8 +69,8 @@ > #define SYSFS_FSL_MC_DEVICES "/sys/bus/fsl-mc/devices" > > /* Number of VFIO containers & groups with in */ > -static struct fslmc_vfio_group vfio_groups[VFIO_MAX_GRP]; > -static struct fslmc_vfio_container vfio_containers[VFIO_MAX_CONTAINERS]; > +static struct fslmc_vfio_group vfio_group; > +static struct fslmc_vfio_container vfio_container; > static int container_device_fd; > static uint32_t *msi_intr_vaddr; > void *(*rte_mcp_ptr_list); > @@ -90,22 +88,18 @@ rte_fslmc_object_register(struct rte_dpaa2_object *object) > TAILQ_INSERT_TAIL(&fslmc_obj_list, object, next); > } > > -static int vfio_connect_container(struct fslmc_vfio_group *vfio_group) > +static int vfio_connect_container(void) > { > - struct fslmc_vfio_container *container; > - int i, fd, ret; > + int fd, ret; > > /* Try connecting to vfio container if already created */ > - for (i = 0; i < VFIO_MAX_CONTAINERS; i++) { > - container = &vfio_containers[i]; > - if (!ioctl(vfio_group->fd, VFIO_GROUP_SET_CONTAINER, > - &container->fd)) { > - FSLMC_VFIO_LOG(INFO, > - "Container pre-exists with FD[0x%x] for this group", > - container->fd); > - vfio_group->container = container; > - return 0; > - } > + if (!ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, > + &vfio_container.fd)) { > + FSLMC_VFIO_LOG(INFO, > + "Container pre-exists with FD[0x%x] for this group", > + vfio_container.fd); > + vfio_group.container = &vfio_container; > + return 0; > } > > /* Opens main vfio file descriptor which represents the "container" */ > @@ -118,7 +112,7 @@ static int vfio_connect_container(struct fslmc_vfio_group *vfio_group) > /* Check whether support for SMMU type IOMMU present or not */ > if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) { > /* Connect group to container */ > - ret = ioctl(vfio_group->fd, VFIO_GROUP_SET_CONTAINER, &fd); > + ret = ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, &fd); > if (ret) { > FSLMC_VFIO_LOG(ERR, "Failed to setup group container"); > close(fd); > @@ -137,23 +131,11 @@ static int vfio_connect_container(struct fslmc_vfio_group *vfio_group) > return -EINVAL; > } > > - container = NULL; > - for (i = 0; i < VFIO_MAX_CONTAINERS; i++) { > - if (vfio_containers[i].used) > - continue; > - container = &vfio_containers[i]; > - } > - if (!container) { > - FSLMC_VFIO_LOG(ERR, "No free container found"); > - close(fd); > - return -ENOMEM; > - } > + vfio_container.used = 1; > + vfio_container.fd = fd; > + vfio_container.group = &vfio_group; > + vfio_group.container = &vfio_container; > > - container->used = 1; > - container->fd = fd; > - container->group_list[container->index] = vfio_group; > - vfio_group->container = container; > - container->index++; > return 0; > } > > @@ -222,7 +204,7 @@ int rte_fslmc_vfio_dmamap(void) > #endif > > /* SET DMA MAP for IOMMU */ > - group = &vfio_groups[0]; > + group = &vfio_group; > > if (!group->container) { > FSLMC_VFIO_LOG(ERR, "Container is not connected "); > @@ -392,7 +374,7 @@ int fslmc_vfio_process_group(void) > char path[PATH_MAX]; > int64_t v_addr; > int ndev_count; > - struct fslmc_vfio_group *group = &vfio_groups[0]; > + struct fslmc_vfio_group *group = &vfio_group; > static int process_once; > > /* if already done once */ > @@ -569,7 +551,7 @@ int fslmc_vfio_setup_group(void) > { > struct fslmc_vfio_group *group = NULL; > int groupid; > - int ret, i; > + int ret; > char *container; > struct vfio_group_status status = { .argsz = sizeof(status) }; > > @@ -599,13 +581,11 @@ int fslmc_vfio_setup_group(void) > FSLMC_VFIO_LOG(DEBUG, "VFIO iommu group id = %d", groupid); > > /* Check if group already exists */ > - for (i = 0; i < VFIO_MAX_GRP; i++) { > - group = &vfio_groups[i]; > - if (group->groupid == groupid) { > - FSLMC_VFIO_LOG(ERR, "groupid already exists %d", > - groupid); > - return 0; > - } > + group = &vfio_group; > + if (group->groupid == groupid) { > + FSLMC_VFIO_LOG(ERR, "groupid already exists %d", > + groupid); > + return 0; > } > > /* get the actual group fd */ > @@ -637,7 +617,7 @@ int fslmc_vfio_setup_group(void) > /* check if group does not have a container yet */ > if (!(status.flags & VFIO_GROUP_FLAGS_CONTAINER_SET)) { > /* Now connect this IOMMU group to given container */ > - ret = vfio_connect_container(group); > + ret = vfio_connect_container(); > if (ret) { > FSLMC_VFIO_LOG(ERR, "VFIO error connecting container" > " with groupid %d", groupid); > diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h > index 0aff9b1..942a33c 100644 > --- a/drivers/bus/fslmc/fslmc_vfio.h > +++ b/drivers/bus/fslmc/fslmc_vfio.h > @@ -44,7 +44,6 @@ > #define DPAA2_MC_DPBP_DEVID 10 > #define DPAA2_MC_DPCI_DEVID 11 > > -#define VFIO_MAX_GRP 1 > > typedef struct fslmc_vfio_device { > int fd; /* fslmc root container device ?? */ > @@ -64,7 +63,7 @@ typedef struct fslmc_vfio_container { > int fd; /* /dev/vfio/vfio */ > int used; > int index; /* index in group list */ > - struct fslmc_vfio_group *group_list[VFIO_MAX_GRP]; > + struct fslmc_vfio_group *group; > } fslmc_vfio_container; > > struct rte_dpaa2_object;