Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp446469pxu; Thu, 26 Nov 2020 02:53:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKcJDOziBvgVqIWnJQ/Jedcf7wZ5re5MjbG/xC9JrIoEXoSTDnSbKkeiir9yxKs/YfXgUr X-Received: by 2002:a17:906:5182:: with SMTP id y2mr2112436ejk.471.1606387995114; Thu, 26 Nov 2020 02:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606387995; cv=none; d=google.com; s=arc-20160816; b=ad3obY/SufFKZVB+zMPOwwJXCeG9cX15XBHIFYk/p7sdhJWhuk27rh/j0xUDoAHLpB uujahyX9W8pXqliHs+Rwi5J9P2kyaDwgAyko+pUqPDQ0+vhtgeNPF8pnz3GiAY3qYMn6 5FS2l1asRM0dzH3nSIyahTSJ4iS1hgD8dKLp98fO5T3Rbx0i8nm/twKCLeoi0ykADkg2 j14DG9EbGHYXxz5eG/6wYj4l8baApmJ8OpHjAJlAoxW+gdFrfav1gVQ799Q49P9p2fRY AX2vK40tafxWwlSWlOSVhvwjxcDB/Cle7BVzlZpj/nzuvqSEzFKpeMyr9Ofstxgx5avm GWaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nYWk5jzHxLGFoIevTIg8NOOjqLX1QGlqnK2/2OZh2eA=; b=rlFsmqhtbySEhgyem2M3V2946F2folzoccZudndee0DHAc9DVcXlNDMxUTdxgsGEQH 8/ptf26BwzBFDW3W1PPd2pF7wtJZuk2E5u0aVwjXCaqLGupeynNOzfRiNC/FoCS7lolJ pitfyEJLcmvwG/29L3lmoZUl5NXc2lhkoGcwxnT/5fVqc4VldsydubJOBI7ZJP3WocGh P3dAY4kJpYKJKGB73SDXd8MyuJpDR3eTjxOtYVm86iF9tv/jYUu1Wu+3iYEbHrrQnd1Q 1JUTggH5QV30tZZT+PIYZvdKJ49Nz1+HqeTejhD+g5o9iLtYbGvCJ1AD5pa476KYyS9X QY0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GnCB8gya; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be20si2927660edb.423.2020.11.26.02.52.52; Thu, 26 Nov 2020 02:53:15 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=GnCB8gya; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388814AbgKZI3Q (ORCPT + 99 others); Thu, 26 Nov 2020 03:29:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33745 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731952AbgKZI3P (ORCPT ); Thu, 26 Nov 2020 03:29:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606379353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nYWk5jzHxLGFoIevTIg8NOOjqLX1QGlqnK2/2OZh2eA=; b=GnCB8gyaC8kn/hYuQUuwLkQxl0nj3K/tkdEJ3vA6JnKL1UMm2YhIvLFy7jeunmqS4Y5Ali 8t5j+DdGrvjJGIqUeIJ/9vrqUU3CK/wpAJCK9iwDC8ZsIc+L8WkK2IkT+uRbwV1eKFiB/E fFdn7LO7mmIxOgEzpWm51+8YypWulxc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-KAfUyjO2N3G93yzHuKlhfQ-1; Thu, 26 Nov 2020 03:29:09 -0500 X-MC-Unique: KAfUyjO2N3G93yzHuKlhfQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A651881CBDB; Thu, 26 Nov 2020 08:29:07 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-113-83.ams2.redhat.com [10.36.113.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABF5E5C1B4; Thu, 26 Nov 2020 08:29:01 +0000 (UTC) From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: Paul Mackerras , linux-pci@vger.kernel.org, Thomas Gleixner , linux-block@vger.kernel.org, "Michael S . Tsirkin" , Marc Zyngier , Christoph Hellwig , Greg Kurz , linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Benjamin Herrenschmidt , Laurent Vivier Subject: [PATCH v4 1/2] genirq/irqdomain: Add an irq_create_mapping_affinity() function Date: Thu, 26 Nov 2020 09:28:51 +0100 Message-Id: <20201126082852.1178497-2-lvivier@redhat.com> In-Reply-To: <20201126082852.1178497-1-lvivier@redhat.com> References: <20201126082852.1178497-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is currently no way to convey the affinity of an interrupt via irq_create_mapping(), which creates issues for devices that expect that affinity to be managed by the kernel. In order to sort this out, rename irq_create_mapping() to irq_create_mapping_affinity() with an additional affinity parameter that can conveniently passed down to irq_domain_alloc_descs(). irq_create_mapping() is then re-implemented as a wrapper around irq_create_mapping_affinity(). Signed-off-by: Laurent Vivier Reviewed-by: Greg Kurz --- include/linux/irqdomain.h | 12 ++++++++++-- kernel/irq/irqdomain.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 71535e87109f..ea5a337e0f8b 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -384,11 +384,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain, extern void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq); -extern unsigned int irq_create_mapping(struct irq_domain *host, - irq_hw_number_t hwirq); +extern unsigned int irq_create_mapping_affinity(struct irq_domain *host, + irq_hw_number_t hwirq, + const struct irq_affinity_desc *affinity); extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec); extern void irq_dispose_mapping(unsigned int virq); +static inline unsigned int irq_create_mapping(struct irq_domain *host, + irq_hw_number_t hwirq) +{ + return irq_create_mapping_affinity(host, hwirq, NULL); +} + + /** * irq_linear_revmap() - Find a linux irq from a hw irq number. * @domain: domain owning this hardware interrupt diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index cf8b374b892d..e4ca69608f3b 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -624,17 +624,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) EXPORT_SYMBOL_GPL(irq_create_direct_mapping); /** - * irq_create_mapping() - Map a hardware interrupt into linux irq space + * irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space * @domain: domain owning this hardware interrupt or NULL for default domain * @hwirq: hardware irq number in that domain space + * @affinity: irq affinity * * Only one mapping per hardware interrupt is permitted. Returns a linux * irq number. * If the sense/trigger is to be specified, set_irq_type() should be called * on the number returned from that call. */ -unsigned int irq_create_mapping(struct irq_domain *domain, - irq_hw_number_t hwirq) +unsigned int irq_create_mapping_affinity(struct irq_domain *domain, + irq_hw_number_t hwirq, + const struct irq_affinity_desc *affinity) { struct device_node *of_node; int virq; @@ -660,7 +662,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain, } /* Allocate a virtual interrupt number */ - virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL); + virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), + affinity); if (virq <= 0) { pr_debug("-> virq allocation failed\n"); return 0; @@ -676,7 +679,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain, return virq; } -EXPORT_SYMBOL_GPL(irq_create_mapping); +EXPORT_SYMBOL_GPL(irq_create_mapping_affinity); /** * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs -- 2.28.0