Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10588158ybi; Thu, 11 Jul 2019 07:43:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlrqZq5SAnRSAHx34R0VHew3HqtnjpM/dLltoYIBkxLeNabxkrW9XclcSoUSxQgQEEKN54 X-Received: by 2002:a63:6eca:: with SMTP id j193mr4757260pgc.74.1562856238927; Thu, 11 Jul 2019 07:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562856238; cv=none; d=google.com; s=arc-20160816; b=F+g/rCAhOA/uhOh//u0gsjHcr/zVaX0OYM4XrWhqso672gpEKXbDmTBmPbuxAqyJ+S smE0QbV1BbC6Iv4quav4WEG9PaSnJKcDVYHmLO+NLd/E1k1RVcv3Z6Z/FhtCdj913VnS fby3L0vMgKEqANiT4zYqZTf6RE2jzSdnL8W4ytK8yjTw7DeQfk40kjSBU5cPb7wjOzTg 2ZCqhXq3BMpNznf0nRRomydmeK3/E5zZ/ncLBsuKrWi3SfFYtjJtsjSzjvNapA96A9LP c8QhcVp4Pe6WhVxwCDIzvQdypTyigG5fpJPGOrzmlqGIj441wmuZizruvcNTMOH6AcGe vRJQ== 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; bh=VIXc6JOUHQaVoZ5IF3IE+yvqbdG2yhjglOzW53jWen8=; b=Df86p04oiJ7AwMnK9V16h/RbfcHMAUVfDZOcQv5g65eTgUYH8l/RqYWBljZE1AWulk UWQbRYPxSE0W3YPydFV+wVMhByH03GfLEaGB2fAVEqgGP4lGk1anqjrKQforKz3OtDWV 6+ACQSeHoMS/gDO/Bk6wU1sbQ9ctG2YSEb4p1aH7aL/5uwxlb5FaOyssAhgi2KMxS9GZ nOtWcItGHR57lFp7T6nUjs3Ka2JY2akOa61pgJno6yp60VsC7z/ISVDlkcFI3UEfLxu8 /R5LyhdW18h3oPpedqnBD3v0u9YXTX0CBhPx9RMag/+HnQSt4934/t0JhCtv05PfJuXZ 2U1w== 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; dmarc=fail (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 b11si5139349plz.307.2019.07.11.07.43.43; Thu, 11 Jul 2019 07:43:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728747AbfGKN6l (ORCPT + 99 others); Thu, 11 Jul 2019 09:58:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55019 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728473AbfGKN6k (ORCPT ); Thu, 11 Jul 2019 09:58:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5894D308FBA9; Thu, 11 Jul 2019 13:58:40 +0000 (UTC) Received: from laptop.redhat.com (ovpn-116-46.ams2.redhat.com [10.36.116.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00CAE60A97; Thu, 11 Jul 2019 13:58:22 +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: kevin.tian@intel.com, ashok.raj@intel.com, marc.zyngier@arm.com, peter.maydell@linaro.org, vincent.stehle@arm.com, zhangfei.gao@gmail.com, tina.zhang@intel.com Subject: [PATCH v9 07/11] vfio: Use capability chains to handle device specific irq Date: Thu, 11 Jul 2019 15:56:21 +0200 Message-Id: <20190711135625.20684-8-eric.auger@redhat.com> In-Reply-To: <20190711135625.20684-1-eric.auger@redhat.com> References: <20190711135625.20684-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 11 Jul 2019 13:58:40 +0000 (UTC) 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 bec761edae9b..b53714ae02c5 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -452,11 +452,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) +/* + * 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_irq_set) * @@ -558,7 +574,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 = 5 /* Fixed user ABI, IRQ indexes >=5 use */ + /* device specific cap to define content */ }; /* -- 2.20.1