Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp46396lqd; Tue, 23 Apr 2024 14:09:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqqitJVgjWUWY5BBq/teVqjl8RaNFzw8cKcy1b1ERDcyVzSSQOuGQyE/PIudQQjLBdlh3jB40Z3EdEy/SYzzEcvL2DIL33vVdFG+kqkg== X-Google-Smtp-Source: AGHT+IH3pTNGWWVC+1tbYdm9nFAmyAqueWmGkheHHcfDPpYjZB+w7wGfnzG6QOqEsGP+LBDnwzKs X-Received: by 2002:a05:6870:5389:b0:22e:7390:da7 with SMTP id h9-20020a056870538900b0022e73900da7mr524480oan.21.1713906574785; Tue, 23 Apr 2024 14:09:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713906574; cv=pass; d=google.com; s=arc-20160816; b=BNp1+0dvs2oIOa77Ww7GK3tlFi8HMMgX49PA4z/wuxJG3b4Tol3V9Nlr6X8ck1xQDv 4uZL9w1pE5V4Wyr5wLYbcgsC0xwYHl7Resk2MvwQIn8SbZEB7qs6Hvyeh2+vt1434bV8 4QF//ThZfGfzXzksq0TWZzjaOf/ivFtR3rylwiezEfah2sHy7UrzIZslEHjch7LX2qau b5lFoKByHLb1wAVvZtr+G4ulUr2+FEQ/FaBMox9sUEkH6ySyN5er1B+eSBdE1+6Mp2V7 +UDUf2YzwzsrGOmsO9pZb7YnTCfDqONtrnWWwFqB/qAmb6Tp3sv2T6wF0mqsCInUKBls j7aQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=iMgVwJPIk+SrJO1aUq+M0EnJvfj+z9S9X/zT3E0x9q4=; fh=kcKjAbYkyTw3eUKm0iQI7lF2UHIvydAGw4pmdudqqjg=; b=xcIlqj4uPdjmPm5ZE6BYwKB5OP3zAb51BPed1x7dZ8mnB5uVIbmhQ572jX42z/u8c6 5/CYxevwV/9L110XpPvNCZuDHEdYFFR5fyGAHPQiPgyJyPh38B+2GCwNSSwSRz7dSX2i PvDCfcp0j4xCokQ2xoz0s3fuhAPsX5WHWzlir5YvchOPB1d003YizAbOExUmeHxVS4A1 i7eE0O7SnrMIj8FyxgJkCUDJoRmVN85Qdd28Xwk5wTpWOWhGUUugo6z3p7CoJC5uKL+h 8tFBFjAM0ZtJFSFm633K7hYjOOSAaSrsGu/E4Ih2UEaQrpB3xwnVwnzUO+ckQE8fL6R8 aTgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C3Wxw7Nd; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-155905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fj25-20020a05622a551900b00439e7c3c6b0si3526193qtb.802.2024.04.23.14.09.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 14:09:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C3Wxw7Nd; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-155905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6CB831C23809 for ; Tue, 23 Apr 2024 21:09:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 888BC143864; Tue, 23 Apr 2024 21:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C3Wxw7Nd" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E983B142E79 for ; Tue, 23 Apr 2024 21:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713906567; cv=none; b=C8EUq2J2S9nX3YyJhC/1fDk7Q7Xfk+XefWfoGrVJkQlDVHePTFfJWzMIanGCU6a0LcxLrt8dBbqx49cJ6621FYD17ttGl0oKSL+o2kWTwYPKb6gPNThxgHGVX2bgCnU/ljaslggaS1LpvAnVuiaOE/DooRS463XrfYFa0PpF83Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713906567; c=relaxed/simple; bh=kgbIHXr2bi9p5muvD86p6UwpsFB1QKcNggyDv0it32c=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MAKp0amUP4xNINOIB+9pHAKNZZRSRWU42iQe3IAb6yuBPvzG61lfhQoWb90reCtHPR2z7y/5YbkliThVwPLLyoAUTCyerUl/IoPj/b0aJrQ4czG3ejYBSHH83psdFPyi6bEpsaQ9Aq2nMJyCc3OChzJHk6E6TuEdIPj9ddehNR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=C3Wxw7Nd; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713906564; 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=iMgVwJPIk+SrJO1aUq+M0EnJvfj+z9S9X/zT3E0x9q4=; b=C3Wxw7NdygxxWwPaaLV55eD7OSxUw+xiTa48BnmWQYf5/Raf2s+QPvOFWc9sm1Tz+ajgdo FBSHha7xdutIL7i6HckBCizDLYYGfGxmEEZJ3CzbyreluGAz2DjslkERkhUu4688whzq2s NzKLA0PnI3HpfKNr+2v8aYBFpvbqnww= Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-nfA-adxzOg-MAlaM0JRGrg-1; Tue, 23 Apr 2024 17:09:23 -0400 X-MC-Unique: nfA-adxzOg-MAlaM0JRGrg-1 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-7dd8cd201aaso208254339f.0 for ; Tue, 23 Apr 2024 14:09:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713906562; x=1714511362; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iMgVwJPIk+SrJO1aUq+M0EnJvfj+z9S9X/zT3E0x9q4=; b=S252DfY6Nd97lwuzSR4nqF/ksD4swBcpwikCWr5JqhzLO4R6tks5n6FwLuKALuTDgs qmx6KRHpBb4PsO/3RCLSETk4rddxlT4KmxfChTx7kYyGLq3hTfTserLMl3drFoRcIdkC FKdEH1Qpck8O6tHbq/V8SA5NRetVbCqfEHUx7iTXsyJUQyIZZqJi+tyht9Dw/JsdC0zq 0axS1Hrm+Gr7IZLK/WbaMdZGI16Cdvhdpn49jjJLSlAx96YKmy4/gPmm3CCXMc9cg9gU iua88kp7sG5X88JzoYGcJKfT7W5K23aJbTyYuMwEvSDgNmfhuHE6O+iJDaX7fP+bdmZm Bo7A== X-Forwarded-Encrypted: i=1; AJvYcCV+Bn2b4u9Xz4Xda6htR+F4Thfp9Nx27cvTvfuOoNUDyOOEUp41WDBxUpM/Tl5DJlFzb7JxC9u8q+8DYvSYgONCgSSu2sYLOAmsIFxk X-Gm-Message-State: AOJu0Yx1oL2z4ce2hTvti5wEL+v+1ABNUZRLIXx4hwgC3Eh1U4CsKtR0 HeJ+4q9/KseB3bX0qguGNThpv7vr96oPrZX1k0CnYV7SgRfzjR7y1CC2mm9y7CcVn1wZ+VAkjc6 BjH5dQSECenORSbYJ0eUm+jMWhCf6NuwwGOrn1CO/SLlEWEHMMlyIvT87v3DY2Q== X-Received: by 2002:a6b:f305:0:b0:7d0:8cff:cff3 with SMTP id m5-20020a6bf305000000b007d08cffcff3mr796381ioh.8.1713906562664; Tue, 23 Apr 2024 14:09:22 -0700 (PDT) X-Received: by 2002:a6b:f305:0:b0:7d0:8cff:cff3 with SMTP id m5-20020a6bf305000000b007d08cffcff3mr796364ioh.8.1713906562382; Tue, 23 Apr 2024 14:09:22 -0700 (PDT) Received: from redhat.com ([38.15.36.11]) by smtp.gmail.com with ESMTPSA id x5-20020a056638160500b00484f72550ccsm2560741jas.174.2024.04.23.14.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 14:09:21 -0700 (PDT) Date: Tue, 23 Apr 2024 15:09:20 -0600 From: Alex Williamson To: Nipun Gupta Cc: , , , , , , , , , , , Subject: Re: [PATCH v6 1/2] genirq/msi: add wrapper msi allocation API and export msi functions Message-ID: <20240423150920.12fe4a3e.alex.williamson@redhat.com> In-Reply-To: <20240423111021.1686144-1-nipun.gupta@amd.com> References: <20240423111021.1686144-1-nipun.gupta@amd.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 23 Apr 2024 16:40:20 +0530 Nipun Gupta wrote: > SI functions for allocation and free can be directly used by We lost the ^M in this version. > the device drivers without any wrapper provided by bus drivers. > So export these MSI functions. > > Also, add a wrapper API to allocate MSIs providing only the > number of interrupts rather than range for simpler driver usage. > > Signed-off-by: Nipun Gupta > Reviewed-by: Thomas Gleixner > --- > > No change in v5->v6 > > Changes in v4->v5: > - updated commit description as per the comments. I see in https://lore.kernel.org/all/87edbyfj0d.ffs@tglx/ that Thomas also suggested a new subject: genirq/msi: Add MSI allocation helper and export MSI functions I'll address both of these on commit if there are no objections or further comments. Patch 2/ looks ok to me now as well. Thanks, Alex > - Rebased on 6.9-rc1 > > Changes in v3->v4: > - No change > > Changes in v3: > - New in this patch series. VFIO-CDX uses the new wrapper API > msi_domain_alloc_irqs and exported APIs. (This patch is moved > from CDX interrupt support to vfio-cdx patch, where these APIs > are used). > > include/linux/msi.h | 6 ++++++ > kernel/irq/msi.c | 2 ++ > 2 files changed, 8 insertions(+) > > diff --git a/include/linux/msi.h b/include/linux/msi.h > index 84859a9aa091..dc27cf3903d5 100644 > --- a/include/linux/msi.h > +++ b/include/linux/msi.h > @@ -674,6 +674,12 @@ int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nve > void platform_device_msi_free_irqs_all(struct device *dev); > > bool msi_device_has_isolated_msi(struct device *dev); > + > +static inline int msi_domain_alloc_irqs(struct device *dev, unsigned int domid, int nirqs) > +{ > + return msi_domain_alloc_irqs_range(dev, domid, 0, nirqs - 1); > +} > + > #else /* CONFIG_GENERIC_MSI_IRQ */ > static inline bool msi_device_has_isolated_msi(struct device *dev) > { > diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c > index f90952ebc494..2024f89baea4 100644 > --- a/kernel/irq/msi.c > +++ b/kernel/irq/msi.c > @@ -1434,6 +1434,7 @@ int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid, > msi_unlock_descs(dev); > return ret; > } > +EXPORT_SYMBOL_GPL(msi_domain_alloc_irqs_range); > > /** > * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain > @@ -1680,6 +1681,7 @@ void msi_domain_free_irqs_range(struct device *dev, unsigned int domid, > msi_domain_free_irqs_range_locked(dev, domid, first, last); > msi_unlock_descs(dev); > } > +EXPORT_SYMBOL_GPL(msi_domain_free_irqs_all); > > /** > * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain