From patchwork Wed Oct 28 12:33:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 319323 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp35773ilc; Wed, 28 Oct 2020 18:05:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDPgnLmh7wHF3pRL0n0Ln9H5H6qwMjnOkXDS+KLh1qY1feYriEgv21vYCA7pxWxpcqnqC8 X-Received: by 2002:aa7:d843:: with SMTP id f3mr1682561eds.354.1603933523639; Wed, 28 Oct 2020 18:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603933523; cv=none; d=google.com; s=arc-20160816; b=zsv/7GYIxNQNGr7rcwrONY/S7kfHTiC5YQJArRv01UhcAGwOCQwf7hhAsgivHWa3tP U1n1i/Pst0w1Xw/IjpBQ5W8efuFXOK/1VRyXk5EC30G1T3DqQAZh+UMOVqS8clhfRabt ZgjRmhz0B58nh220rx/piutFRtdDWxykqF3kI3KtOP5H7nhOLTX6kBp/A0mglcO6DqLN p3iqcofg24LXN6wb56LWXNNihyn5emXmaIg6OEtpxGEiTAJxtXBJAWx8AqbnB0fuWzd5 ruHcETDDVYwaJ1tS1w+efbpCLqnthVyyQSLXVS+WRVCVNEC086X3XGLpLAOO9QbjWcq+ uL3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7KJCSHdCx0eOjsnKEiQeTaBPZJRcHmBtR/m/GYHM5D8=; b=tBp55zhg98ODewaMM1NuESSPbt4GqLdEuwIw60r72YjkTyjPYq2RwnxWH6FkH2v0/4 fTJ1vrTTjLxOJZTNgQT5AHGqjWPq9Ngjq7++ATCbjD4/EVjmzXbV8/YhkNcgkKA5h8gN 2XorVRHsTRsnQLJwqBzA6rgkLd9cc4KhyU6CTmA1nVcnNCQFvBJfbEAHf7m0YnLih7QO r+P8E9rJszIHl6Ly35UUWzz4z1wmeMfJvsQZ4W4bO8Q6Svuhp7TvIz/p8b3pm/rbhoER XMCB0fWYmcz5a5klb/SvKxeg5/p8/z5RNpT9cktsxSaodKMPjYiCplhrvH0h4vERelgz 1G1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si949045edf.60.2020.10.28.18.05.23 for ; Wed, 28 Oct 2020 18:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730865AbgJ2BFM (ORCPT ); Wed, 28 Oct 2020 21:05:12 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:6982 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730036AbgJ1WFo (ORCPT ); Wed, 28 Oct 2020 18:05:44 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CLp3x39q2zhbW6; Wed, 28 Oct 2020 20:37:01 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Wed, 28 Oct 2020 20:36:47 +0800 From: John Garry To: , , , , CC: , , , , John Garry Subject: [PATCH v2 1/3] genirq/affinity: Add irq_update_affinity_desc() Date: Wed, 28 Oct 2020 20:33:05 +0800 Message-ID: <1603888387-52499-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1603888387-52499-1-git-send-email-john.garry@huawei.com> References: <1603888387-52499-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add a function to allow the affinity of an interrupt be switched to managed, such that interrupts allocated for platform devices may be managed. Suggested-by: Thomas Gleixner Signed-off-by: John Garry --- include/linux/interrupt.h | 8 ++++++++ kernel/irq/manage.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) -- 2.26.2 diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index ee8299eb1f52..870b3251e174 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -352,6 +352,8 @@ extern int irq_can_set_affinity(unsigned int irq); extern int irq_select_affinity(unsigned int irq); extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); +extern int irq_update_affinity_desc(unsigned int irq, + struct irq_affinity_desc *affinity); extern int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); @@ -387,6 +389,12 @@ static inline int irq_set_affinity_hint(unsigned int irq, return -EINVAL; } +static inline int irq_update_affinity_desc(unsigned int irq, + struct irq_affinity_desc *affinity) +{ + return -EINVAL; +} + static inline int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) { diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index c460e0496006..b96af4cde4bc 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -371,6 +371,25 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, return ret; } +int irq_update_affinity_desc(unsigned int irq, + struct irq_affinity_desc *affinity) +{ + unsigned long flags; + struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); + + if (!desc) + return -EINVAL; + + if (affinity->is_managed) { + irqd_set(&desc->irq_data, IRQD_AFFINITY_MANAGED); + irqd_set(&desc->irq_data, IRQD_MANAGED_SHUTDOWN); + } + + cpumask_copy(desc->irq_common_data.affinity, &affinity->mask); + irq_put_desc_unlock(desc, flags); + return 0; +} + int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) { struct irq_desc *desc = irq_to_desc(irq);