Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp521021imu; Thu, 20 Dec 2018 00:31:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/VkXR3yGDww9ATDL7aGkMh9M14a6IVYO5yE32VJZ17swfe6Fx09F+usfi6V/erUoDPsUvm1 X-Received: by 2002:a63:e950:: with SMTP id q16mr5779551pgj.138.1545294673938; Thu, 20 Dec 2018 00:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545294673; cv=none; d=google.com; s=arc-20160816; b=T32Xi3gPhmA4cRRtYqiQDOlLzAcBpOaBOAS8/Scfqq94kVK+tsA1fMV2dWbKYHE/qV Jh/Uzk2TK4+AxgUby2GFMBVPLv0QdpuggVCGMeK/OiFXeLxdbCdM9K3m9sM9KgKxvoYK 5rcnp8GuSIniAOwF1BKzjiIRpxS0wkO3s/tdbXKFl9b5UhlyGrBcXuVe3aY0kd6scftz 46eZRjEd3crpUvQn0h9gNsb314CP8v3FYdcupSe82z+qGrIC+eQendw86zT1Kdtd9nZZ mHd8vhHfL4PRwU+jJkBr9TjpkMSjs8ZN4TuPXbF1dIU77YbSR01tkOcl7AS8xxIR7ku9 M4IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=/8u8PROyasxtlkVkx/H5xTGLiYqD/YhHGv1ZW0X0J7E=; b=gEhrRAn2ET0GDSgJ3e2T6VHeQi2o98CA1+BAmJCR38B/yAMqJkSFUNHoR8cKrzADeF p0ynuaarQB2DhCPylFHJzFVNwDB3vUYWiD7Al7bRFEQ5glSd2xtKRgSSKaHzAc6uXPVm OE2NR4INBiReteM8Jv6KPv7m+H/ibFcVuiU/We9yuAdxRBLBnidBbrIMOR4bv6S1oZ6K sDxYhVcNIJPyyhXc08i1Mu0ZBOOMeycv4KQEPYwxbOAL7SybNlRrJb8YmyDwBaPKDcV4 mlGi8XR7jOUMsIaNQJl1/DYIt4RRzKenchvOXr8kzbEDyX3030ll3bY/ZCh/jnhP1WEe q9Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si17653155pgi.359.2018.12.20.00.30.58; Thu, 20 Dec 2018 00:31:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731131AbeLTIZI (ORCPT + 99 others); Thu, 20 Dec 2018 03:25:08 -0500 Received: from ozlabs.ru ([107.173.13.209]:54979 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731110AbeLTIZH (ORCPT ); Thu, 20 Dec 2018 03:25:07 -0500 Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id BE537AE80491; Thu, 20 Dec 2018 03:25:01 -0500 (EST) From: Alexey Kardashevskiy To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy , David Gibson , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, Alistair Popple , Reza Arbab , Sam Bobroff , Piotr Jaroszynski , =?UTF-8?q?Leonardo=20Augusto=20Guimar=C3=A3es=20Garcia?= , Jose Ricardo Ziviani , Daniel Henrique Barboza , Alex Williamson , Paul Mackerras , linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH kernel v7 19/20] vfio_pci: Allow regions to add own capabilities Date: Thu, 20 Dec 2018 19:23:49 +1100 Message-Id: <20181220082350.58113-20-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181220082350.58113-1-aik@ozlabs.ru> References: <20181220082350.58113-1-aik@ozlabs.ru> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VFIO regions already support region capabilities with a limited set of fields. However the subdriver might have to report to the userspace additional bits. This adds an add_capability() hook to vfio_pci_regops. Signed-off-by: Alexey Kardashevskiy Acked-by: Alex Williamson --- Changes: v3: * removed confusing rationale for the patch, the next patch makes use of it anyway --- drivers/vfio/pci/vfio_pci_private.h | 3 +++ drivers/vfio/pci/vfio_pci.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h index 86aab05..93c1738 100644 --- a/drivers/vfio/pci/vfio_pci_private.h +++ b/drivers/vfio/pci/vfio_pci_private.h @@ -62,6 +62,9 @@ struct vfio_pci_regops { int (*mmap)(struct vfio_pci_device *vdev, struct vfio_pci_region *region, struct vm_area_struct *vma); + int (*add_capability)(struct vfio_pci_device *vdev, + struct vfio_pci_region *region, + struct vfio_info_cap *caps); }; struct vfio_pci_region { diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 4a6f7c0..6cb70cf 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -763,6 +763,12 @@ static long vfio_pci_ioctl(void *device_data, if (ret) return ret; + if (vdev->region[i].ops->add_capability) { + ret = vdev->region[i].ops->add_capability(vdev, + &vdev->region[i], &caps); + if (ret) + return ret; + } } } -- 2.17.1