Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp667501ybh; Wed, 22 Jul 2020 10:05:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfnYi25KKGC7mIFlrwkqxCi7X+swWiP9w8RGhPw6iHOvSG0Z81bLC0+pabhHJMu2QSJxet X-Received: by 2002:a17:906:2b12:: with SMTP id a18mr525111ejg.186.1595437518334; Wed, 22 Jul 2020 10:05:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595437518; cv=none; d=google.com; s=arc-20160816; b=pAXBAo4DA/x2x8u/TFtCtHuPs0fnMd0X7S2u+ndwxN9ihJtBXe/IM+OWdiUzO3QdTY MK1t0VdIguRoZHYsj30BFDqxULnCt5mTMiGSx9t8WRZXwaTQCw4QhDqkcNNP7dyDBW7P KOvXsHDAcRBdd1UdUMbA+vVLdjRz69TkBG6Dg2+Jf8+jDZnWqQpgX4FcIz7fv4Z6bQak kHlgXxTVWyhJLjX4trMVrqTcKP0OSuYBY5GEAn+K2ZDbSAsVNjyXQU6qV7PeYsd9zJo4 Tad60BqcqSA5+xmSTnc2/pxoTeIxsTYvuPc+wn534+YC3MQ5MbxLt7jUzKkm4V87j3e+ TTNg== 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:ironport-sdr:ironport-sdr; bh=HChZYydMpOfagveeueHgrF/VPMEWoq0Or3XUjlOo4QQ=; b=dcdYsU4nBzRpmRtOOfnh+Ay9NL9iX21o8CPPvcC/SiicA28e5Lkc+PqXghYMACk4+Z Cmd/g9tVAdbe3hccwaUZvQVk+uoKafSA40fknoTWpXNjWJXJe7zWe9ETkrkWHf+uqCHM E6ri2xZHZYSQWaEhMrnhe7a+IEOwhZC73DrpSgDP0gMgHwLuD/PSszQptn1XMTQRGRkL pwV7fZHwVW7Ctmk83l5HM4Q4UyYlDhU1LvOcz7rafg7LM2JF001itKB9hvU/sGOz2kGD KeU0BaWOPLYR9475qSN6cavhbVjrhu/Ld7QAwGa4QZvFcu4ddYJ6/7aquuC82qb4jDDq XgWg== 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 ef10si352644ejb.519.2020.07.22.10.04.54; Wed, 22 Jul 2020 10:05:18 -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 S1731423AbgGVRDt (ORCPT + 99 others); Wed, 22 Jul 2020 13:03:49 -0400 Received: from mga07.intel.com ([134.134.136.100]:13584 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726717AbgGVRDt (ORCPT ); Wed, 22 Jul 2020 13:03:49 -0400 IronPort-SDR: WncTuVHB6W+2q2Dku1w0kCI1soF6shXjWgHmIwAdhIj3Q62ob4p49w+dH2m3rXas8o6Bwj5EFo 2k6EqhezeyNQ== X-IronPort-AV: E=McAfee;i="6000,8403,9690"; a="215007242" X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="215007242" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 10:03:48 -0700 IronPort-SDR: kZ7E+EWBoHhQmGLIn6X8M9EMk6wAI4cZKfcD9O1Bld2YtAg/0tt7cAw/BySjHNbl5PjqTD9eQJ zNMN1KUY8iRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="328275881" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by orsmga007.jf.intel.com with ESMTP; 22 Jul 2020 10:03:48 -0700 Received: from [10.254.181.38] (10.254.181.38) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 Jul 2020 10:03:48 -0700 Subject: Re: [PATCH RFC v2 03/18] irq/dev-msi: Create IR-DEV-MSI irq domain To: Jason Gunthorpe , Dave Jiang CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <159534667974.28840.2045034360240786644.stgit@djiang5-desk3.ch.intel.com> <159534735519.28840.10435935598386192252.stgit@djiang5-desk3.ch.intel.com> <20200721162104.GB2021248@mellanox.com> From: "Dey, Megha" Message-ID: <84fd4ae2-e7ee-4f9d-7686-6a034f3e2614@intel.com> Date: Wed, 22 Jul 2020 10:03:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200721162104.GB2021248@mellanox.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.254.181.38] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, On 7/21/2020 9:21 AM, Jason Gunthorpe wrote: > On Tue, Jul 21, 2020 at 09:02:35AM -0700, Dave Jiang wrote: >> From: Megha Dey >> >> When DEV_MSI is enabled, the dev_msi_default_domain is updated to the >> base DEV-MSI irq domain. If interrupt remapping is enabled, we create >> a new IR-DEV-MSI irq domain and update the dev_msi_default domain to >> the same. >> >> For X86, introduce a new irq_alloc_type which will be used by the >> interrupt remapping driver. > > Why? Shouldn't this by symmetrical with normal MSI? Does MSI do this? Since I am introducing the new dev msi domain for the case when IR_REMAP is turned on, I have introduced the new type in this patch. MSI/MSIX have their own irq alloc types which are also only used by the intel remapping driver.. > > I would have thought you'd want to switch to this remapping mode as > part of vfio or something like current cases. Can you let me know what current case you are referring to? > >> +struct irq_domain *create_remap_dev_msi_irq_domain(struct irq_domain *parent, >> + const char *name) >> +{ >> + struct fwnode_handle *fn; >> + struct irq_domain *domain; >> + >> + fn = irq_domain_alloc_named_fwnode(name); >> + if (!fn) >> + return NULL; >> + >> + domain = msi_create_irq_domain(fn, &dev_msi_ir_domain_info, parent); >> + if (!domain) { >> + pr_warn("failed to initialize irqdomain for IR-DEV-MSI.\n"); >> + return ERR_PTR(-ENXIO); >> + } >> + >> + irq_domain_update_bus_token(domain, DOMAIN_BUS_PLATFORM_MSI); >> + >> + if (!dev_msi_default_domain) >> + dev_msi_default_domain = domain; >> + >> + return domain; >> +} > > What about this code creates a "remap" ? ie why is the function called > "create_remap" ? Well, this function creates a new domain for the case when IR_REMAP is enabled, hence I called it create_remap... > >> diff --git a/include/linux/msi.h b/include/linux/msi.h >> index 1da97f905720..7098ba566bcd 100644 >> +++ b/include/linux/msi.h >> @@ -378,6 +378,9 @@ void *platform_msi_get_host_data(struct irq_domain *domain); >> void platform_msi_write_msg(struct irq_data *data, struct msi_msg *msg); >> void platform_msi_unmask_irq(struct irq_data *data); >> void platform_msi_mask_irq(struct irq_data *data); >> + >> +int dev_msi_prepare(struct irq_domain *domain, struct device *dev, >> + int nvec, msi_alloc_info_t *arg); > > I wonder if this should use the popular #ifdef dev_msi_prepare scheme > instead of a weak symbol? Ok, I will look into the #ifdef option. > > Jason >