Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp513351pxv; Thu, 8 Jul 2021 07:39:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5lzomKBH516cawk42kvSmEbCqWKpDypnbOlEwZOgE+198laStuzkWxQgmNVWZq73CRUa8 X-Received: by 2002:a92:8707:: with SMTP id m7mr8680154ild.177.1625755177906; Thu, 08 Jul 2021 07:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625755177; cv=none; d=google.com; s=arc-20160816; b=k9u72TSU8hBKVNvHTdlsD6qEt3oEYDKbZr8QMrIKjWLIaeitUfhs7mxlf+6df3Y4l1 xiP6yTX+217s2KSNx74nHz1bSXOSvjSGtYXg/ahI6vHmBK87cm74LkNkqDXj43pp9vH3 rGf5Xz0cQHgRgKE+0LgtKyIrgkZ73tfQ5upWb5/iRVEPza7Z7GndwafxBHvin38CCXmk M9KiNqc9hZBky0G8iKzZ4JbsEMZB6xN1avR7fbEgJvGK8SE6zwOMRcO6kXO8XRXR77u7 9Ok/1AmgO/RPHgdYnZIeOAOMrVv9PupFIUMk3iDEMzeszGdOVMf6C9u0D4fSQdpovZTj MVDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=kmrNj0OGC7ywKCcRHLLXRwPf/N2WPZytFfJKN1VD1tg=; b=oyHXAl57OmFl6ld9WnhvfmurHaV6ZpHaU8Mx63OWxmgNLptoM1wfJZIwOMRFl5fNjy S4gkD36lpuhOWPx2gTQqAApf1fSfVBOYhZTXwAj1FjzKiV1G64KfFns9MHwy8GlRX9xR sclet/0qR1fV1KR+ZcFhLTYz0Eq0Bb3DE3e0EoAlmr57XX7q/LaeDSA8hNgbJYZTLe// NgnyMAXVDtpW+oSxq6Pa3sjnLM2rCLD55fF2I7SUoqNekzf411dUEz2cyYLMYIqDN9M+ glOM+AyYXffW1ebF1Ic6ZIyp9hK7Ft1uCDAJs+Wq7TjzeB1eTUc/s20lAejO3LyZcTSw PTaQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si3127596ill.63.2021.07.08.07.39.25; Thu, 08 Jul 2021 07:39:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231910AbhGHOkY (ORCPT + 99 others); Thu, 8 Jul 2021 10:40:24 -0400 Received: from mga12.intel.com ([192.55.52.136]:19419 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231858AbhGHOkX (ORCPT ); Thu, 8 Jul 2021 10:40:23 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10038"; a="189195795" X-IronPort-AV: E=Sophos;i="5.84,224,1620716400"; d="scan'208";a="189195795" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2021 07:37:23 -0700 X-IronPort-AV: E=Sophos;i="5.84,224,1620716400"; d="scan'208";a="487629085" Received: from otc-nc-03.jf.intel.com (HELO otc-nc-03) ([10.54.39.36]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2021 07:37:23 -0700 Date: Thu, 8 Jul 2021 07:36:57 -0700 From: "Raj, Ashok" To: Jason Gunthorpe Cc: Thomas Gleixner , "Dey, Megha" , linux-kernel@vger.kernel.org, "Jiang, Dave" , "Tian, Kevin" , "Pan, Jacob jun" , "Liu, Yi L" , "Kumar, Sanjay K" , "Van De Ven, Arjan" , "Williams, Dan J" , "Shankar, Ravi V" , Ashok Raj Subject: Re: Programming PASID in IMS entries Message-ID: <20210708143657.GA70042@otc-nc-03> References: <87k0m2qzgz.ffs@nanos.tec.linutronix.de> <20210707221216.GA56594@otc-nc-03> <20210707235822.GB4459@nvidia.com> <20210708003335.GC56594@otc-nc-03> <20210708120846.GD4459@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210708120846.GD4459@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason On Thu, Jul 08, 2021 at 09:08:46AM -0300, Jason Gunthorpe wrote: > On Wed, Jul 07, 2021 at 05:33:35PM -0700, Raj, Ashok wrote: > > On Wed, Jul 07, 2021 at 08:58:22PM -0300, Jason Gunthorpe wrote: > > > On Wed, Jul 07, 2021 at 03:12:16PM -0700, Raj, Ashok wrote: > > > > Hi Thomas > > > > > > > > On Wed, Jul 07, 2021 at 10:50:52AM +0200, Thomas Gleixner wrote: > > > > > Megha, > > > > > > > > > > On Wed, Jul 07 2021 at 09:49, Megha Dey wrote: > > > > > > Per your suggestions during the last meeting, we wanted to confirm the > > > > > > sequence to program the PASID into the IMS entries: > > > > > > > > > > > > 1. Add a PASID member to struct msi_desc (Add as part of a union. Other > > > > > > source-id's such as Jason's vm-id can be added to it) > > > > > > > > > > Yes. Though we also discussed storing the default PASID in struct device > > > > > to begin with which is then copied to the msi_desc entries during > > > > > allocation. > > > > > > > > Using default PASID in struct device will work for sub-devices until the > > > > guest needs to enable ENQCMD support. Since the guest kernel can ask for an > > > > interrupt by specifying something in the descriptor submitted via ENQCMD. > > > > Using the PASID in struct device won't be sufficient. > > > > > > Could you could store a pasid table in the struct device and index it > > > by vector? > > > > Possibly... what ever Thomas things is clean. The device specific driver > > would have this already. So providing some call to get this filled in vs > > storing that in struct device. Someone close at heart to the driver model > > is best to comment :-) > > > > IMS core owns the format of the entries right now vs device specific driver. > > I suppose your use case requiring a vm_id might have a different format. > > So this is yet another one the core needs to learn and adapt? > > All entry format stuff is device specific, it shouldn't be in "core" > code. Well, this is how it started way back last year. https://lore.kernel.org/lkml/158751209583.36773.15917761221672315662.stgit@djiang5-desk3.ch.intel.com/ Where the driver functions for mask/unmask/write_msg etc. So the core needs So the format or layout is device specific, but core can dictate the exact message that needs to be written. > > It is is the same reason that the IRQ chip driver for IDXD should have > IDXD in the name, it is not a generic "IMS core" thing. > > The question mark is probably the locking model, but if IDXD > guarentees the pasid table doesn't change while the irq is active then > maybe it works out well enough. I think this must be gauranteed at a min? changing things underneath when the interrupts are unmasked would be bad usage. > > Associating a void * with the irq is also possibly reasonable, I'm not > sure which path makes the most sense. > Seems like it.. Cheers, Ashok