Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2998300pxb; Mon, 16 Nov 2020 03:05:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJznnQQNFFgDrdzt2VCG319ahY+7eFTGGhv76RWDx0gjHcjtNJvlB5YNRbuGeZAWUpm6MEk2 X-Received: by 2002:a17:906:13d4:: with SMTP id g20mr13838349ejc.206.1605524737042; Mon, 16 Nov 2020 03:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605524737; cv=none; d=google.com; s=arc-20160816; b=RNcssYb8XVELTGP9mfRiL/foGdYhd5TIYR7J5dGJn99vchbTO94jIxKiDANYAxTrL8 YiS/+B1CmI1oVXfteUOo3F+bwKhbflcQi6BJ57Z+BEyoEop9JrwRe5YPX9NQ0w6Y/dQj ZcmHbC82V8QyemBIH6TwbKqKDDDT0VOdFyYvLOleej2JfEXHXLim7rri5akDsRbLhYFe CS8OO08yolFhZUrO1wxpM8c+OPDIRVvJepn1QxcFLa8gi+lS7NhgSqrWoPsXgDy1nuJh Jmzl5+ABxAeFaNgeJHmYN7RzxLDYyEigsNt50ob+VCPuxTBNP0seDF/WIuVUIMvrGJwJ dpUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q4hQUNWeVvrMyJW5B2CVV/vzK8bShCZT5rYetr9JqRg=; b=Cfv4a1gZniBWVHjVUUSbMbNRR+hebAY96CpCFL0x6xpqm9UUldlU2ThVOFTwnkCeJW xBI9gYBrabm0n/RVLZPRdibKaHin8M1qItcncz7riWVturag0e3lpQ38Be/Ef6RgOsHR iAvND7SHyKOxFwRotNg3sUkUexojlV7DZejHg3cwu037rcijTVYn/CkMo4AC4QmO1S7m gl7LL3IRJW/ImBAyVAH+2hde+Vg70H0Bn7Xz8jAcAutQ4Rfd/OzdlXIdJD+EhjV3kZ9H Zm+bcV8qvTAbfQT1f1fNp2aRq7AvB5Zjj1e9OyC7oIqsBrLPBXCc4WekXSc9VryOMGtI Xhig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ijin9UCX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id p3si4259234ejd.639.2020.11.16.03.05.13; Mon, 16 Nov 2020 03:05:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ijin9UCX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729544AbgKPLBn (ORCPT + 99 others); Mon, 16 Nov 2020 06:01:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35502 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729071AbgKPLBm (ORCPT ); Mon, 16 Nov 2020 06:01:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605524501; 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=q4hQUNWeVvrMyJW5B2CVV/vzK8bShCZT5rYetr9JqRg=; b=Ijin9UCXOliaZT+MuOcrgRnr1E3/LHKxnMCNqs05+prk9v8jUxWOHtDRCpxs/S4VGu0NgQ PE6LU9r/Ee1o1Asu3faYdneeo5+v/ZqvprfRQLA2hMNfzKv3mBoSSmQj3RdieQto0Hz20f uMq6dkK+eBwxzugDw3tZOSctftw+eLI= 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-542-zA1I6xGtOB6oodjH1nO7yg-1; Mon, 16 Nov 2020 06:01:38 -0500 X-MC-Unique: zA1I6xGtOB6oodjH1nO7yg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43DC21007474; Mon, 16 Nov 2020 11:01:36 +0000 (UTC) Received: from laptop.redhat.com (ovpn-113-230.ams2.redhat.com [10.36.113.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 956B35C716; Mon, 16 Nov 2020 11:01:31 +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, will@kernel.org, joro@8bytes.org, maz@kernel.org, robin.murphy@arm.com, alex.williamson@redhat.com Cc: jean-philippe@linaro.org, zhangfei.gao@linaro.org, zhangfei.gao@gmail.com, vivek.gautam@arm.com, shameerali.kolothum.thodi@huawei.com, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, tn@semihalf.com, nicoleotsuka@gmail.com, yuzenghui@huawei.com Subject: [PATCH v11 07/13] vfio: Use capability chains to handle device specific irq Date: Mon, 16 Nov 2020 12:00:24 +0100 Message-Id: <20201116110030.32335-8-eric.auger@redhat.com> In-Reply-To: <20201116110030.32335-1-eric.auger@redhat.com> References: <20201116110030.32335-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 629dfb38d9e7..0e2bfbeccd08 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -701,11 +701,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) * @@ -807,7 +823,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.21.3