Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp869460ybb; Fri, 20 Mar 2020 09:23:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs9P+/FQbTKyGZoPKs+szyi2tftZvydj74H7GS+U9mVNgG2IEhMKTbNsUIU2GgBzEO142Yn X-Received: by 2002:aca:100c:: with SMTP id 12mr6939607oiq.22.1584721401469; Fri, 20 Mar 2020 09:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584721401; cv=none; d=google.com; s=arc-20160816; b=tFgJ8f7ryH0DFkeS294YImyQ9InXqRlZ4F64ZcPODjQWZTZEybYlqVCFI7ibCvINPs hZGnISgbHEuFjCb2SoXpiS43FTdkSFYechGVhvPOvzh8Ht8wVjEfGXhzxJvl69xz/LjY DOJ9A1K3yhEvkiwa3c9RwKCN5UyIbpbjjoAvHCMMVhnk3WN8UkippcyUFM2e9EbPwVeJ URPk9ofeSwHid4S+ojFmO6CVypOWnbxkD+EidjcL589usCE48OLyI4mg8t1UOt6qbO9z myVC/g2+37WLgx2S8vjbxd3Cp+EUSpl82S8x8DPmkqqjg9lAVaqDzycFTRg5actNb/HW hECg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uVnj2zVQ0+2VuWR3igejOkLMg22DCP8tH7gBaRkHgfE=; b=Mt9tLmmffIuQ4TpxJc2DLj3jhPfwFwYm4f6eeh/73JuailXdSwJ9WXzqWES+iI6f4l iMeUyJoM0Le92LGN2YSLecuKgt7gFyrhoJPDYS6n3wfFIM9oMTL7foRccl47W7kQIKMD A9wOUhvhFyXKnQT/NuGw/5QLg76zSH0gueUciwsMmVO8QWNXFxc7uBJcMGAw3wzKowTf oVCHRwb281czYh+nhEtKl/AVbJDFC0k2E2RKnFaSAFXTxcP27y6Jhy5o5xIgq+XDYzsL Txr66QugL0N1+Z7Ehh0h1lMBhCy2Dn7xVx9BiXU33VznnJtgnetRFgUYfuhW45ggmSjJ 6GYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FmcaAOO4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r71si2907596oie.265.2020.03.20.09.22.58; Fri, 20 Mar 2020 09:23:21 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FmcaAOO4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbgCTQUf (ORCPT + 99 others); Fri, 20 Mar 2020 12:20:35 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:34766 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727758AbgCTQUd (ORCPT ); Fri, 20 Mar 2020 12:20:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584721232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uVnj2zVQ0+2VuWR3igejOkLMg22DCP8tH7gBaRkHgfE=; b=FmcaAOO4gl1I9Tt2eVan0S/Kwp7yeYQi/bNg3ZqxJo05nzixlcqDhJvYLMH1OOgzjTmszm Yc4vG5+X3WJCtAuIUpCrgUyODr+28CyMVC4eC+rGq4KDrzbYjXy2307DrFlvjDMmfjjZ/i W5QWsoeD5hizON7KAQbaO7vTf28pJ4A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-Q7liX-c3MfWpXOwb_TrONQ-1; Fri, 20 Mar 2020 12:20:29 -0400 X-MC-Unique: Q7liX-c3MfWpXOwb_TrONQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84D9C106BBDD; Fri, 20 Mar 2020 16:20:27 +0000 (UTC) Received: from laptop.redhat.com (ovpn-113-142.ams2.redhat.com [10.36.113.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70A2560BFB; Fri, 20 Mar 2020 16:20:17 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, joro@8bytes.org, alex.williamson@redhat.com, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, jean-philippe.brucker@arm.com, will.deacon@arm.com, robin.murphy@arm.com Cc: marc.zyngier@arm.com, peter.maydell@linaro.org, zhangfei.gao@gmail.com Subject: [PATCH v10 07/11] vfio: Use capability chains to handle device specific irq Date: Fri, 20 Mar 2020 17:19:07 +0100 Message-Id: <20200320161911.27494-8-eric.auger@redhat.com> In-Reply-To: <20200320161911.27494-1-eric.auger@redhat.com> References: <20200320161911.27494-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tina Zhang Caps the number of irqs with fixed indexes and uses capability chains to chain device specific irqs. Signed-off-by: Tina Zhang Signed-off-by: Eric Auger [Eric: Put cap_offset at the end of the vfio_irq_info struct, remove GFX IRQ at the moment and remove any reference to this latter in the commit message] --- --- include/uapi/linux/vfio.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 40d770f80e3d..f0fd26d058c9 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -459,11 +459,27 @@ struct vfio_irq_info { #define VFIO_IRQ_INFO_MASKABLE (1 << 1) #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) #define VFIO_IRQ_INFO_NORESIZE (1 << 3) +#define VFIO_IRQ_INFO_FLAG_CAPS (1 << 4) /* Info supports caps */ __u32 index; /* IRQ index */ __u32 count; /* Number of IRQs within this index */ + __u32 cap_offset; /* Offset within info struct of first cap */ }; #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) =20 +/* + * The irq type capability allows IRQs unique to a specific device or + * class of devices to be exposed. + * + * The structures below define version 1 of this capability. + */ +#define VFIO_IRQ_INFO_CAP_TYPE 3 + +struct vfio_irq_info_cap_type { + struct vfio_info_cap_header header; + __u32 type; /* global per bus driver */ + __u32 subtype; /* type specific */ +}; + /** * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_ir= q_set) * @@ -565,7 +581,8 @@ enum { VFIO_PCI_MSIX_IRQ_INDEX, VFIO_PCI_ERR_IRQ_INDEX, VFIO_PCI_REQ_IRQ_INDEX, - VFIO_PCI_NUM_IRQS + VFIO_PCI_NUM_IRQS =3D 5 /* Fixed user ABI, IRQ indexes >=3D5 use */ + /* device specific cap to define content */ }; =20 /* --=20 2.20.1