From patchwork Tue Nov 18 07:31:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 5326071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7C5AFC11AD for ; Tue, 18 Nov 2014 07:36:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7F9A2017A for ; Tue, 18 Nov 2014 07:36:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A547B2010B for ; Tue, 18 Nov 2014 07:36:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XqdIL-0001HU-3N; Tue, 18 Nov 2014 07:33:49 +0000 Received: from mail-ig0-f177.google.com ([209.85.213.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XqdHw-0001BK-0S for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 07:33:24 +0000 Received: by mail-ig0-f177.google.com with SMTP id uq10so5347688igb.4 for ; Mon, 17 Nov 2014 23:33:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mFebKY4srQNWASG9Z2T8W6hGO7wFzCMVwXsoog/fmj4=; b=aHq+hEq/8I0TKoV/aRI6RGnAFPUfxpCrFYQONnrxCTJOXzdPXp1a/F+FOr6Cv1Wpvk JkEBVOB6bGtC43RQrmwNp3smVHal9qLyvRW5QpSiExRi/5dZr+HIgtIJVo4hxHJPP85M kbO3yVh6Z6+CWGG9rDHzF819i2mwJNeR3d6iu/U2fC+f2QQqy9A9yxKOSZrtZsDBErEu 1es2Jz4YFBgK8LitiISui5ci5vDc2lPKYnPAxTMXCYFA0qukbpWdpPwBJqgpm0VQZQkt nEE7+bnruUhMHkPbFYIBNauyMM5mK0RXSgpH+yEDUMbB0Wtjeac76L/+z6VILl5gHoIy W1Kg== X-Gm-Message-State: ALoCoQl8qddEfSOdIO2aUixVozoKrO92PAw49yYSGbJlUpF2xJ6Ybmlxc0gl7ulW9vGSNmpdyHyN X-Received: by 10.43.89.8 with SMTP id bc8mr32249217icc.35.1416295983009; Mon, 17 Nov 2014 23:33:03 -0800 (PST) Received: from localhost.localdomain (c-24-8-37-141.hsd1.co.comcast.net. [24.8.37.141]) by mx.google.com with ESMTPSA id w197sm20175215iod.24.2014.11.17.23.33.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Nov 2014 23:33:02 -0800 (PST) From: Lina Iyer To: khilman@linaro.org, ulf.hansson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, daniel.lezcano@linaro.org Subject: [PATCH v4/RFC 3/4] irq: Add irq_get_affinity() api Date: Tue, 18 Nov 2014 00:31:49 -0700 Message-Id: <1416295910-40433-4-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416295910-40433-1-git-send-email-lina.iyer@linaro.org> References: <1416295910-40433-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141117_233324_098133_DABB1559 X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: -0.7 (/) Cc: Lina Iyer X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Export irq_get_affinity API for drivers to read the smp affinity of an IRQ safely. Signed-off-by: Lina Iyer --- include/linux/interrupt.h | 8 ++++++++ kernel/irq/manage.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 69517a2..fff619c 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -260,6 +260,8 @@ extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); extern int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); +extern int irq_get_affinity(unsigned int irq, struct cpumask *mask); + #else /* CONFIG_SMP */ static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) @@ -290,6 +292,12 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) { return 0; } + +static inline int irq_get_affinity(unsigned int irq, struct cpumask *mask) +{ + return -EINVAL; +} + #endif /* CONFIG_SMP */ /* diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 0a9104b..2d17098 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -246,6 +246,24 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) } EXPORT_SYMBOL_GPL(irq_set_affinity_hint); +int irq_get_affinity(unsigned int irq, struct cpumask *mask) +{ + struct irq_desc *desc = irq_to_desc(irq); + unsigned long flags; + + if (!mask) + return -EINVAL; + + raw_spin_lock_irqsave(&desc->lock, flags); + if (!irqd_irq_disabled(&desc->irq_data)) + cpumask_copy(mask, desc->irq_data.affinity); + else + cpumask_clear(mask); + raw_spin_unlock_irqrestore(&desc->lock, flags); + + return 0; +} + static void irq_affinity_notify(struct work_struct *work) { struct irq_affinity_notify *notify =