Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp391742pxk; Fri, 11 Sep 2020 09:39:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyx/KSdYLqRPCcdiilGqw+Cu/plcVtPEV0TSQFRVYr0IPbzlQpPM8He14y8Q/NvmBSUSY3 X-Received: by 2002:a05:6402:1d05:: with SMTP id dg5mr2973392edb.67.1599842382274; Fri, 11 Sep 2020 09:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599842382; cv=none; d=google.com; s=arc-20160816; b=DgV+LKIy08y1v0f1QGw2C0Ri6k3Wuh4EBoZuVQrMacwNzCyp2qm7S+3pvilTcOWGPO b4dBip/3lkfQrGX0UlD1VKCelb/kj8FS/xer++WGXw70wjrCFz2VFXxEmRPpwqb+4FBH JFAV/2Ca+9eCBGSiMPu/iF7OSzdubewiLRAzsg9P1ZPGaGJOHnEEZn4pz1C0D9e3648r mt8d2+6Tof9zrnDFOxRYVmMVK4n1+Xp/EwrPEIe77BlZCrmUfI0HSN8vWnl61K9bvIYa eAZWTWRQ09kqiaQnCQuFFI9/muSJ6AF1dkTk4W6+iaaYJIx08D9BYm6XDldnKsqYCica pL7w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=aiWmHLDD0Ad0LUM9I3Re3J2jS/emquPxE/7QtuwNOPg=; b=aqEioRahRy9j5q3hmjMOIDu6k4waOJEZHHbu2GFKpL9wU2f9PRV2r9V8QPpkU/64ky a53LVEmkM1kjd09adTD2P0P2eJi/Py3Y8pvlbhDjeVBBJjPPViH0G1gcWtuyTZIj1IrM xtwEQybKWA2gCwnr1msRbLbA+kXfvXPmzdW+fpJumotUOmHEzfGYLexvQ6O6ABvNQV3a TB6KBWx3gEu05wDWXVYQx5k3gLJ+MW8SGG2V14ZueRcHF51hqIvpOGf7ERQBUBU4zTE1 xTIaWcMexPrmh1ZKLE1NFkx98GtoDFlCHbRtLuJhAuKXrooNMf+r7XCQrnbwKOiNaOiz VYBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gxXCtIup; 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 a13si1785079edh.74.2020.09.11.09.39.17; Fri, 11 Sep 2020 09:39:42 -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=gxXCtIup; 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 S1726364AbgIKQip (ORCPT + 99 others); Fri, 11 Sep 2020 12:38:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28926 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726274AbgIKPMQ (ORCPT ); Fri, 11 Sep 2020 11:12:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599837121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aiWmHLDD0Ad0LUM9I3Re3J2jS/emquPxE/7QtuwNOPg=; b=gxXCtIupESgbz961KIg5tC4lEmLWzKToPJBqqrL5WIchgdrsdUGifvttRW07oWQtkxCInS rLNv/SsI/azVsJHj2mLVsZ+cGXkEW22ym9M2v4+SkyUAF6rFPdvA9mj758sYLqEx90AtZp Jm+d0g8OSvLNiLA0hOM2YRmH5+4zdE8= 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-200-4NT_19gWN0K2miAueSjn9w-1; Fri, 11 Sep 2020 09:53:13 -0400 X-MC-Unique: 4NT_19gWN0K2miAueSjn9w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62D58CD046; Fri, 11 Sep 2020 13:53:12 +0000 (UTC) Received: from [10.36.112.212] (ovpn-112-212.ams2.redhat.com [10.36.112.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B1135DA2A; Fri, 11 Sep 2020 13:53:00 +0000 (UTC) Subject: Re: MSI/MSIX for VFIO platform To: Alex Williamson , Vikas Gupta Cc: Cornelia Huck , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vikram Prakash , Srinath Mannam References: <20200910105735.1e060b95@w520.home> From: Auger Eric Message-ID: Date: Fri, 11 Sep 2020 15:52:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200910105735.1e060b95@w520.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vikas, On 9/10/20 6:57 PM, Alex Williamson wrote: > On Thu, 10 Sep 2020 16:15:27 +0530 > Vikas Gupta wrote: > >> Hi Alex/Cornelia, >> >> We are looking for MSI interrupts for platform devices in user-space >> applications via event/poll mechanism using VFIO. >> >> Since there is no support for MSI/MSIX handling in VFIO-platform in kernel, >> it may not possible to get this feature in user-space. >> >> Is there any other way we can get this feature in user-space OR can you >> please suggest if any patch or feature is in progress for same in VFIO >> platform? >> >> Any suggestions would be helpful. > > Eric (Cc'd) is the maintainer of vfio-platform. > > vfio-platform devices don't have IRQ indexes dedicated to MSI and MSI-X > like vfio-pci devices do (technically these are PCI concepts, but I > assume we're referring generically to message signaled interrupts), but > that's simply due to the lack of standardization in platform devices. > Logically these are simply collections of edge triggered interrupts, > which the vfio device API supports generically, it's simply a matter > that the vfio bus driver exposing a vfio-platform device create an IRQ > index exposing these vectors. Thanks, I have not worked on MSI support and I am not aware of any work happening in this area. First I would recommend to look at IRQ related uapis exposed by VFIO: VFIO_DEVICE_GET_IRQ_INFO VFIO_DEVICE_SET_IRQS and try to understand if they can be implemented for MSIs in a generic way in the vfio_platform driver using platform-msi helpers. For instance VFIO_DEVICE_GET_IRQ_INFO would need to return the number of requested vectors. On init I guess we should allocate vectors using platform_msi_domain_alloc_irqs/ devm_request_irq and in the handler trigger the eventfd provided through VFIO_DEVICE_SET_IRQS. On userspace where you have to trap the MSI setup to call the above functions and setup irqfd injection. This would be device specific as opposed to PCI. That's just rough ideas at the moment. Thanks Eric > > Alex >