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 4310C42943; Fri, 14 Apr 2023 18:45:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A926410F6; Fri, 14 Apr 2023 18:45:31 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2082.outbound.protection.outlook.com [40.107.237.82]) by mails.dpdk.org (Postfix) with ESMTP id 3E71340144 for ; Fri, 14 Apr 2023 18:45:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ij6hGAj1GzLOy9hydaj0mmQULujXbw3TNYAQWC3Y0eHyBxxsvJlrIq7t4w/YZsWysyW+NCnFYanuAj21eKbvQsqHUGDGhT2YK0blVh63w1Isi4bHNQFLTNU3AIZI+6r0+famKk+sifx08GMOTOt2/E9QO/UYWz94RcU4ar8BOnaHcvNc7yBcqGpSlwU0gaIkwJfX/8tGyaWh8128T4S1O2gvtjl3n2dQzSMhJOWznYZU/SP2OlJkWccwXbKf0VQY9rjsI6SUAUr5yhblEDh3OYtMKoh1NFukGqNMWqng4o4qq5rcM1hE1sS2cOI4k1LA9mpjwIwk58bsGt3G6ykC2g== 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=5rG60QHvIWib6Q6jxouA1xFbuCz/ey2k2MRnJEctKpU=; b=WcqcDD5+MH3jYTCbXMGH40QpBHqyoeHrhZ0Wa2eu/G5vdabF9NZEToW2a4dHnKxXIWvtb7YX3CeHCwd5A2KhJ/uO+ATTRgA0gVtyXuSBwFfcTxpJR1geVzJGEy3ED29iGpSGkLBYf2ElT+Pvm9Hf+Vkf7bKMExuRq+NHJtW46dFygwkmc0RPTuUZt/EI8BQW2PevVIlxEZ+P9ryJ+TR8OmcmbMK73zjPZdP2IM4+JMr80phgWmRT1Z184SQdtNP6sdpIY1/e+Jg113djt1/QxeaA5D+Au82ov/We6ytbN3C40ozfXiALn/KaahkvKyr95yzvM74ouZIOir7+hb6fgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5rG60QHvIWib6Q6jxouA1xFbuCz/ey2k2MRnJEctKpU=; b=IkXRGTxP20w/Hk6/k+VIzsn6KpByZ0h+yP+m/joF8AqJM0qvaSOF2zausbzGzCdcVYIhTy2HI15V+pQisdwTtEwOXH/RWCyKmv86NzMxyf0erjncK7p31/XxKPFn5YjtCVp0tv3h5q9phecIy5o21nQ3P8JHc6i+clquMVpUEo8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by IA0PR12MB8228.namprd12.prod.outlook.com (2603:10b6:208:402::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.43; Fri, 14 Apr 2023 16:45:28 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::5e2c:c0ed:88a6:a4c7]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::5e2c:c0ed:88a6:a4c7%7]) with mapi id 15.20.6298.030; Fri, 14 Apr 2023 16:45:28 +0000 Message-ID: <87a8300b-18af-db19-5d7b-331d8002ba6e@amd.com> Date: Fri, 14 Apr 2023 17:45:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Nipun Gupta , dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com Cc: harpreet.anand@amd.com, nikhil.agarwal@amd.com References: <20230124140746.594066-1-nipun.gupta@amd.com> <20230413132704.17586-1-nipun.gupta@amd.com> <20230413132704.17586-2-nipun.gupta@amd.com> From: Ferruh Yigit Subject: Re: [PATCH v2 1/6] bus/cdx: introduce cdx bus In-Reply-To: <20230413132704.17586-2-nipun.gupta@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0405.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::33) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|IA0PR12MB8228:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f2328f5-d1cd-4b26-8a2b-08db3d07a6c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ku94HsMg1+2R/w7Uo99Awe2ABE/S+ocpsXSaNR0MrZc3iK7b5l9VcYKFG6FIHU+x1bvoKCZ+BcH4PZLGD/v915+F2U28gxSTjHORYKZ91uz62TRVQ5RbPY7bB0AZHPpMjyuFUJa5HyeKNqMfijltm+HTkKjtL8To69F7Jljza5ZCtgnpLXWEDFvxrC2f0HtVmUXxgodRLdVE2QDWA8lHVCkJjM2qYnwKypu8oYyGbXAFGzPI4qS+ODsK8o5uyvqMSFbn6yzMK8neMLBlWPnhH3DCPUFJ8k/6CS0/T5B7cd6ZkGY5KuHIM02DJ0iIvBvbX9L34miirk9x7E/CtqDwD7QlXywjLzVek/fycyYpQ3d/VWR6fCWFL/auU6VHqdzvBvA1H+5Yd1uM8U1vJ7UBxB+/27ZsD6Rm4AcUz1yu1lafe5O+lBZxWRxoEH8KcYTvu4YlJPp3TZ3iv2SwNvsVtUElUIg96Y+F0GclYFcWx3eZx7BNH13QNY/1+IdDBLRz4G+dziTT7l4UxMUdlNTkH1J4mGAf2RjM7q5mrgbNT81l+PhjjmvG2PWc1eSJLbK3BdXAnQHBCTIOn7FkJfAgl8lEn1XtrxATDFc1MReXd6WVg048XTW0ckYAMaY/g6VXwm6zMoTXnw+H/al4FUbDJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(396003)(366004)(39860400002)(376002)(451199021)(478600001)(8936002)(5660300002)(38100700002)(66476007)(66556008)(8676002)(66946007)(41300700001)(4326008)(316002)(31686004)(36756003)(6512007)(53546011)(6506007)(26005)(86362001)(2616005)(186003)(31696002)(83380400001)(44832011)(6666004)(2906002)(6486002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bUt1Yzdsc0liZjhyWjBCdnRsQTZTeHpZQkdFcXpDWkFoVS9DSUcvU1FWWnpQ?= =?utf-8?B?QTMvQmV1MDkxRHFxUGUwbUZHV1ovMTB2alRLN0RSN1czN0pPQTRocVhpeUlP?= =?utf-8?B?ck45WnBJWGFjVzZlU0VJWmc0S2hQNXpIT2o3T0YrRVhnZyswTDBTRE00RlhO?= =?utf-8?B?M0FuSm83RCtOVEs2cGQ2d0tpNzVsbU1jeXEwY25QYnU2c1pBZkcwaDlVWEJT?= =?utf-8?B?VHJ2b25BNE5VVTlHSktZaVE0cFVyZFlrREJ2UVFIKy91bjRQWTYxQjlyYzFj?= =?utf-8?B?UWdLck43dDBkY3dxQk9OcHA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?= =?utf-8?Q?7UKfzwKpj6exTmsfdUtD3KtfD?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f2328f5-d1cd-4b26-8a2b-08db3d07a6c5 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2023 16:45:27.8724 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j5mCp959e0UOmQmwukqlamP2SjCpXyQUDOVODO/3PMXHy9BYMcxsdw1BxDmZFlmx X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8228 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 On 4/13/2023 2:26 PM, Nipun Gupta wrote: > CDX bus supports multiple type of devices, which can be > exposed to user-space via vfio-cdx. > > vfio-cdx provides the MMIO IO_MEMORY regions as well as the > DMA interface for the device (IOMMU). > > This support aims to enable the DPDK to support the cdx > devices in user-space using VFIO interface. > > Signed-off-by: Nipun Gupta <...> > +/* map a particular resource from a file */ > +void * > +cdx_map_resource(void *requested_addr, int fd, off_t offset, size_t size, > + int additional_flags) > +{ > + void *mapaddr; > + > + /* Map the cdx MMIO memory resource of device */ > + mapaddr = rte_mem_map(requested_addr, size, > + RTE_PROT_READ | RTE_PROT_WRITE, > + RTE_MAP_SHARED | additional_flags, fd, offset); > + if (mapaddr == NULL) { > + CDX_BUS_ERR("%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)", > + __func__, fd, requested_addr, size, > + (unsigned long long)offset, `checkpatches.sh` complains about '%l' usage, and 'offset' seems defined as 'off_t' type. As far as I can see 'off_t' is not part of C standard (but posix standard), and it is signed, also not clear if 32 bits or 64 bits. Since caller of this function already passes parameter with 'uint64_t' type, why not change the 'offset' type of this function to 'uint64_t' for simplification, and use 'PRIu64' format specifier?