Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753266AbdLMPcg (ORCPT ); Wed, 13 Dec 2017 10:32:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbdLMPcb (ORCPT ); Wed, 13 Dec 2017 10:32:31 -0500 Subject: Re: [PATCH] vfio: Simplify capability helper To: Peter Xu , Alex Williamson References: <20171212195850.13691.40496.stgit@gimli.home> <20171213064936.GC7780@xz-mi> <0bb4e51a-6fd2-e946-8927-b8d9fe491b07@redhat.com> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, aik@ozlabs.ru, kwankhede@nvidia.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com From: Auger Eric Message-ID: <989db37e-2569-cd6b-fd66-d297d4f8d29e@redhat.com> Date: Wed, 13 Dec 2017 16:32:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <0bb4e51a-6fd2-e946-8927-b8d9fe491b07@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 13 Dec 2017 15:32:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1601 Lines: 50 Hi, On 13/12/17 16:04, Auger Eric wrote: > Hi Peter, > > On 13/12/17 07:49, Peter Xu wrote: >> On Tue, Dec 12, 2017 at 12:59:39PM -0700, Alex Williamson wrote: >>> The vfio_info_add_capability() helper requires the caller to pass a >>> capability ID, which it then uses to fill in header fields, assuming >>> hard coded versions. This makes for an awkward and rigid interface. >>> The only thing we want this helper to do is allocate sufficient >>> space in the caps buffer and chain this capability into the list. >>> Reduce it to that simple task. >>> >>> Signed-off-by: Alex Williamson >> >> Reviewed-by: Peter Xu >> >> Though during review I had a question related to the function >> msix_sparse_mmap_cap(): Is it possible that one PCI device BAR is very >> small (e.g., 4K) that only contains the MSI-X table (and another small >> PBA area)? If so, should we just mark that region unmappable instead >> of setting vfio_region_info_cap_sparse_mmap.nr_areas to 1 in >> msix_sparse_mmap_cap()? >> >> /* If MSI-X table is aligned to the start or end, only one area */ >> if (((vdev->msix_offset & PAGE_MASK) == 0) || >> (PAGE_ALIGN(vdev->msix_offset + vdev->msix_size) >= end)) >> nr_areas = 1; >> >> Thanks, >> > if I understand the code correctly, if the MSI-X table exactly matches > the BAR, a sparse mmap region is reported with offset/size = 0. Is that > correct? > > Thanks > > Eric > looks fixed by [RFC PATCH kernel] vfio-pci: Fix sparse capability when no parts of MSIX BAR can be mapped Sorry for the noise. Thanks Eric