From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [bug] dpdk-vfio: Invalid region/index assumption Date: Wed, 27 Jul 2016 16:14:57 -0600 Message-ID: <20160727161457.7992c756@t450s.home> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: anatoly.burakov@intel.com Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 67E6947D2 for ; Thu, 28 Jul 2016 00:14:59 +0200 (CEST) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, I took a quick look at the dpdk vfio code and spotted an invalid assumption that should probably be corrected ASAP. That is: lib/librte_eal/linuxapp/eal/eal_vfio.h: #define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL) #define VFIO_GET_REGION_IDX(x) (x >> 40) Region offset to index is an implementation detail of the kernel, the vfio API defines that the offset of a given region (BAR) is found via the offset field of struct vfio_region_info returned via the VFIO_DEVICE_GET_REGION_INFO ioctl. You're free to cache the offset into any sort of local variable you like, but the kernel may change the implementation of region index to offset at any point in time. This is explicitly not part of the ABI. Is there a place to file a bug, or is this sufficient? Thanks, Alex