Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1955617pxk; Mon, 14 Sep 2020 00:08:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb3HaKaVxQJU6FigjeSheIHHbgftbg15WxTU0KnfhOjPa6CMfG3HILToenoIrM1yk/53QU X-Received: by 2002:a17:906:a4e:: with SMTP id x14mr13099266ejf.112.1600067323675; Mon, 14 Sep 2020 00:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600067323; cv=none; d=google.com; s=arc-20160816; b=OMgULdWForBfprdig6slIYTwUNhF37X1kV0iSWW/Q2VqZ7QAjldNoDRPfSXC3K7YBh WJzGzR53EHSIxWiVyve8BsOW/iG5YCLnY0OTyJ7FpMZ54w0wXOhLgxcjoAkmMi3XLzT1 lyTWcm5wljuJjjhSgd744kFKfZoo94N6JXBcanjRhhvHlzSM0ED7ilZS/EUCZyZsnDWz q1Ax8f0XG30sxhAe2hb5+BngKLlnoQkrUM6tlYmdX1BpmcT13GtPcuTqsvCywKm+DNnp LFDsdhVNy99rQ85KcWrE2818jW6dPCp9T6K32GEi3oBwgrt0AgteBH8U/tFM5nsKuBJs zT9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YzjHK93gF6TNt+MS+qTD/b9Ejjchu3tiLLiAmnKOigs=; b=Nz3pO4Ye55jaolUw29dYO6KwbsjtdIS1KprPq5E+2PDAKobXcdbI10/XfcGafb/lup 9uQrGVz/NBZdFib5S9flWQu4j7qfxRizTc2rwQuuv4WonlQkycGdB7MOSrkxvoOoCXji tHXCWnj4itDgHIWWeDQenYhajfSlRHgOO+WAS+qpOByHRnzp5efNUInRjfsskVx7aj4V LUof74OcipsbAT1lJCrUmmnfaO2mrHM/ATfuS6+Sj9quEy3fYHs36NME++6I5L/RhZet C2za1X/aRXfGLAKQtP71HfHD/HjcY5wx2sHAX3OF/gUfyPN8IzECN+9QqMIUzX/jEjAt xG2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=GVuyGNCH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si6201713eju.153.2020.09.14.00.08.21; Mon, 14 Sep 2020 00:08:43 -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=@broadcom.com header.s=google header.b=GVuyGNCH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726124AbgINHGT (ORCPT + 99 others); Mon, 14 Sep 2020 03:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbgINHGO (ORCPT ); Mon, 14 Sep 2020 03:06:14 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 863A5C06174A for ; Mon, 14 Sep 2020 00:06:13 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id lo4so21608915ejb.8 for ; Mon, 14 Sep 2020 00:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YzjHK93gF6TNt+MS+qTD/b9Ejjchu3tiLLiAmnKOigs=; b=GVuyGNCHt3OvQ6eF2rUvSOr0rU/reUiaOsL5AQskvAlBtwEICewg7AIjbQWATNAvsg 0QOTbsPNg1FuPEykHQ4PIO2slHHDdVbY+esAt0zfaIcpyCYpi0nAc8lvByqsT/Pw5WFq yI/HcgRHr3XCgFrnJdqsQQNUQzaPLg3qEx9Zw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YzjHK93gF6TNt+MS+qTD/b9Ejjchu3tiLLiAmnKOigs=; b=UmPdoVJWwavDDOQvjXAnyP18r/5oQzfMZD63AF1yg2FEHucx31Y5K2tU+0PUU7FaA7 ZBqaIiJTTq0eS7+S9ngK+tOFF9ERQdWRdFM9S1lvxkwjHf8OAicPu4AM+ErbJ/i0KRZJ tAGFdP4NMAct93pN0q1Oa30bPF2YjPhMoomEeZMvCkGhEZNzpW3lCOwN84DhrQdy3KJY EZdUzxFhM6DyQ14sqXeOzDknHjCAVITKQVPRzwWrL4YmEfGc5TaLplA/cSPUkyxaQYcL l7tNKP77A2Sbs81IHkFrLeR6OIrEYRkHzfgL/+Zk5CB7vAvbaTi1TJY0U1SFrTXPoTwO OlRw== X-Gm-Message-State: AOAM531tMhGTi5ckoQRWcOI2adoK8Yy9U6QpWsoTgNGc7qAjrXQBNu6J HULswPfCvpBh0ojBih4Y8j5p0i5tBnoX18I+97cyaA== X-Received: by 2002:a17:906:4c51:: with SMTP id d17mr13102661ejw.28.1600067172080; Mon, 14 Sep 2020 00:06:12 -0700 (PDT) MIME-Version: 1.0 References: <20200910105735.1e060b95@w520.home> In-Reply-To: From: Vikas Gupta Date: Mon, 14 Sep 2020 12:36:01 +0530 Message-ID: Subject: Re: MSI/MSIX for VFIO platform To: Auger Eric Cc: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vikram Prakash , Srinath Mannam Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric/Alex, Thanks for your valuable suggestions and get back to you if anything is required. Thanks, Vikas On Fri, Sep 11, 2020 at 7:23 PM Auger Eric wrote: > > 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 > > >