Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2496034pxj; Mon, 31 May 2021 03:46:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuE87cbs82qptE1lAOx008zJuPVzFuAj7T2JUIJbRvskApwmrRkK2iu11eHOInNpNvKrOw X-Received: by 2002:a17:907:1117:: with SMTP id qu23mr14021569ejb.71.1622457990274; Mon, 31 May 2021 03:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622457990; cv=none; d=google.com; s=arc-20160816; b=1B1Cy7ysOR64ABjA1j3KJFlivwHOGkLrIQP7e7FopIh4z5HIBzQZjro+UZ6Zq6Yo8H nM740PyMFHM/M1qqWWwqFIysUwVs/xiQzSBwGnDoXq+Dz2V4Idm1UXXp1tyQ+7x/GyZC rv7B2DoA4XT/VGdWAfSh29g8ilhoZEdEUDdh9P9Q25A0/3/RC5MfM9KERK7MDx2S7B1T IR6litnPjod0Dh8tjI4rANirF3juiZ6c27EwhgISu9jtdk3HYovJajFVSlayPxqGGdqu cFjM+Bc7al9QWm8CpV6f0AN0P4AqlIHyu4gNwaNrVd6ww2i5I+QptUEVm3vxv0G1c+4f Bjzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:dkim-signature:dkim-signature:from; bh=DkYWBZqlHfDLHs3VHHFUBhkPLWH2ujbiiCtKaGt9OtQ=; b=MudcuFa/43dbtbDzPIRB4w1klVKz4EGqROwcJpXYo/TPp3IJgH+UXnkCQWQmIoFqb8 v14b9AUsFOh/ihCMVAzlFcfHwa3rMM18LHtW5/JadLtTbSFONllqYk8w/ZhdjrpDy18R ikqgSYpEd/v94UwTGe5LjFu7o0DO77QBjlTlHUytTaLH1Ko2V8YfcIrWA79J9M1Q7FP9 nRDlzM23+obYSeg+Xf0MVwvzmJMA/hcf2n0rt31yqF4tc/2kLV9l22yMT1XQ3PZ5MnYR Pb09K7O4x3MPScDRlkQFj1A4Vx0GH9aQsmglyU1xNmFnFgwaMl8ADWqaUaJ47uoxS01b mLHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kbzeZ8Hz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=HE9eE0UX; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z71si14604421ede.151.2021.05.31.03.46.08; Mon, 31 May 2021 03:46:30 -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=@linutronix.de header.s=2020 header.b=kbzeZ8Hz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=HE9eE0UX; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbhEaKne (ORCPT + 99 others); Mon, 31 May 2021 06:43:34 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:53646 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231409AbhEaKnH (ORCPT ); Mon, 31 May 2021 06:43:07 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1622457686; 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: in-reply-to:in-reply-to; bh=DkYWBZqlHfDLHs3VHHFUBhkPLWH2ujbiiCtKaGt9OtQ=; b=kbzeZ8HzzmHvgOCTjbZY5uO8IB+f2P1hWy09rAQnAK9BajcqlRlz7Vb2pVN93vxRC0jakC 1VYEFmZkuqoj1WBL5rduadQ607w9N2MN84Od15JjMpz8STZhdbO4EtRO8tQ0t2kydC3zET GWRqm1j/Xl85y8DNsY/7qjRDTGTpfy56MezIh9zA6VPyepkG1hNOjD+TOkUL3yOoB1aDmb aGWlqbm5pootOphYg6oX3F3QASAopGDpEMU5sF1P0UK72Vo9hrkeufTy1J8lG0jFiFBko8 ScdXGt6I4IPnd8n6XjgWVxWJpSpKQVPOu/CBArbMGCl1Owwn79wLc7fdirj8ZQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1622457686; 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: in-reply-to:in-reply-to; bh=DkYWBZqlHfDLHs3VHHFUBhkPLWH2ujbiiCtKaGt9OtQ=; b=HE9eE0UX5y+lRuLEaHmipJm7gxrOIieS0Yq85ci2o6WS45RWZl/WDd3g9+lTuhWiSfXtR+ g8kAEvB2DD/J5WAQ== To: Jason Gunthorpe , Dave Jiang Cc: alex.williamson@redhat.com, kwankhede@nvidia.com, vkoul@kernel.org, megha.dey@intel.com, jacob.jun.pan@intel.com, ashok.raj@intel.com, yi.l.liu@intel.com, baolu.lu@intel.com, kevin.tian@intel.com, sanjay.k.kumar@intel.com, tony.luck@intel.com, dan.j.williams@intel.com, eric.auger@redhat.com, pbonzini@redhat.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v6 05/20] vfio: mdev: common lib code for setting up Interrupt Message Store In-Reply-To: <20210528163906.GN1002214@nvidia.com> Date: Mon, 31 May 2021 12:41:25 +0200 Message-ID: <87tumj423u.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 28 2021 at 13:39, Jason Gunthorpe wrote: > On Fri, May 28, 2021 at 09:37:56AM -0700, Dave Jiang wrote: >> On 5/28/2021 5:21 AM, Jason Gunthorpe wrote: >> > On Thu, May 27, 2021 at 06:49:59PM -0700, Dave Jiang wrote: >> > > > > +static int mdev_msix_enable(struct mdev_irq *mdev_irq, int nvec) >> > > > > +{ >> > > > > + struct mdev_device *mdev = irq_to_mdev(mdev_irq); >> > > > > + struct device *dev; >> > > > > + int rc; >> > > > > + >> > > > > + if (nvec != mdev_irq->num) >> > > > > + return -EINVAL; >> > > > > + >> > > > > + if (mdev_irq->ims_num) { >> > > > > + dev = &mdev->dev; >> > > > > + rc = msi_domain_alloc_irqs(dev_get_msi_domain(dev), dev, mdev_irq->ims_num); >> > > > >> > > > Huh? The PCI device should be the only device touching IRQ stuff. I'm >> > > > nervous to see you mix in the mdev struct device into this function. >> > > >> > > As we talked about in the other thread. We have a single IMS domain per >> > > device. The domain is set to the mdev 'struct device' and we allocate the >> > > vectors to each mdev 'struct device' so we can manage those IMS vectors >> > > specifically for that mdev. >> > >> > That is not the point, I'm asking if you should be calling >> > dev_set_msi_domain(mdev) at all >> >> I'm not familiar with the standard way of doing this. Should I not set the >> domain to the mdev 'struct device' because I can have multiple mdev using >> the same domain? With the domain set, I am able to retrieve it and call the >> msi_domain_alloc_irqs() in common code. Alternatively we can pass in the >> domain during init and not rely on dev->msi_ > > Honestly, I don't know. I would prefer Thomas confirm what is the > correct way to use the msi_domain as IDXD is going to be the reference > everyone copies. The general expectation is that the MSI irqdomain is retrievable from struct device for any device which supports MSI. Thanks, tglx