Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1012232pxb; Sun, 11 Apr 2021 04:51:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTZRatEYGfZ1VYF+WN5W2w5SX+/2HJC2JbIvL+4sSIcm8mTz/GQq6sC7iXXXt6QgWS/aDl X-Received: by 2002:a17:90a:5311:: with SMTP id x17mr20111353pjh.25.1618141877205; Sun, 11 Apr 2021 04:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618141877; cv=none; d=google.com; s=arc-20160816; b=AfVbRLNZExQ4zyxvL1P5DIR3PwOUw0GbVOanQPXWQ6dRdl8c2Bt1vG6zfVDuu6zbod 7jl46idonCU6IWYOAD99eNVy0m0w2xCVil9wXqAt1B0oRWEVq8bAwn+yqolQTzC0zvUJ /pkQm9Hsq4FYu1zQOLAbrEEzfHs7rgm3sjDy8Bg/CJ5BimjMHOo8xbBdGyU0YweA9Ycy cI8yEv1/5RwhWC0NQu1llE4rVWtJJPa4kLn/UNs4Rs2W4JOROZsbhMcpx/dW8EPRUNyr lseUO/Mm7juDhNEB+mmUvoHWHordEpRTdM85Tq2xZqTNJ1HZCbDkckZjUy1w5MkOAHdf QjKQ== 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=xucYuCl5K1mWx3617CZ/wFEan4m2BNoR8BpLKGBpX28=; b=vjxjEphloe5uh1wDq4UWbCyhwmG20JFqKWVCe6AhOhCB/9AAWr8xO5vfN7MzOWWFLH QBfHH1M3vfwQMwmc53FFi3jAHn+EfwZOOOkvmy4H22k8DGohfyoPVOcMl5ljUEfgUTY2 XsQHhBC770rgKGsXAnef2YufH/mOT3mO0SXA5s/txhE9K9p9yhD+Rl3hwoSZ4RmpHOQV 8FV0q3+y8g6Y4i4X0Gr44Py1BYxL8WFZZs01Ajc3i53cD65hpOftHf1bVaAJioB7QtZK C5QnP6qihHpZBh7YbSisSSnKj1dOjS/phP0E04AYex1lFXSgSzflLvcy126fq9iSefYm oP0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EP12p62L; 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 h13si9642400pjt.98.2021.04.11.04.51.05; Sun, 11 Apr 2021 04:51:17 -0700 (PDT) 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=EP12p62L; 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 S235649AbhDKLtO (ORCPT + 99 others); Sun, 11 Apr 2021 07:49:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38459 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235611AbhDKLtA (ORCPT ); Sun, 11 Apr 2021 07:49:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618141723; 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=xucYuCl5K1mWx3617CZ/wFEan4m2BNoR8BpLKGBpX28=; b=EP12p62L4GiqbmhoSerbzgTTgYdyZOyQ4Q7s+pirtBC37hezhF6knf3EF+bL9eBlOIWKzu bjvQ6tvooEPamox+sItUd+myK6r4hIg4OBCiFQgKfvcBnxmjbfnE/jPv8Xi7m5cbUJEzdy C1eJdxXzwlSAPyl8uvJ/3MUNaE+nghs= 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-527-BTEAAPHvND-Uc-Ts57am1g-1; Sun, 11 Apr 2021 07:48:39 -0400 X-MC-Unique: BTEAAPHvND-Uc-Ts57am1g-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 07A7218397A6; Sun, 11 Apr 2021 11:48:36 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id B010C5C266; Sun, 11 Apr 2021 11:48:27 +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, maz@kernel.org, robin.murphy@arm.com, joro@8bytes.org, alex.williamson@redhat.com, tn@semihalf.com, zhukeqian1@huawei.com Cc: jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, wangxingang5@huawei.com, jean-philippe@linaro.org, zhangfei.gao@linaro.org, zhangfei.gao@gmail.com, vivek.gautam@arm.com, shameerali.kolothum.thodi@huawei.com, yuzenghui@huawei.com, nicoleotsuka@gmail.com, lushenming@huawei.com, vsethi@nvidia.com, chenxiang66@hisilicon.com, vdumpa@nvidia.com, jiangkunkun@huawei.com Subject: [PATCH v13 07/13] vfio: Use capability chains to handle device specific irq Date: Sun, 11 Apr 2021 13:46:53 +0200 Message-Id: <20210411114659.15051-8-eric.auger@redhat.com> In-Reply-To: <20210411114659.15051-1-eric.auger@redhat.com> References: <20210411114659.15051-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 ca8cc796e254..0728b6f3f348 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -708,11 +708,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) * @@ -814,7 +830,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.26.3