Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2515227lqb; Tue, 28 May 2024 02:11:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUs7qAX+1+ZZYyCcCJCZvsuwNr6ydSY1nU7MjbzYOdq7X+Kp0rUMLdsGltF4NvD4Qtnwfs6S85NGdL21F3WMeO+1Jj80KjOeurxVKeaqA== X-Google-Smtp-Source: AGHT+IGdzql0RzTytPSqujzZhYRk/I5VQ4l3ZMeLvOX6YCNxdm9A4SwuXD6Jl2kik1vS8xrIlnR4 X-Received: by 2002:a19:4314:0:b0:51c:b8ec:c46f with SMTP id 2adb3069b0e04-529645e3535mr6688900e87.22.1716887470967; Tue, 28 May 2024 02:11:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716887470; cv=pass; d=google.com; s=arc-20160816; b=zviKG3z/3ykDrU4+7eAgi7uLVGvoGL8kQ12wnMv3J4SFqhSqIOwXC9A6GDoe4LXJyj W+GlyQu7lSZyrz858AYGXzfvT7o9JGR9q1s03HsarcxUxNdKHxo2A3aniLjZHT1BrgUs 1tA5wjICG22zTdxmA6NnytjcQwE5SQQgaqO3CXbfpj6u+fUXZYJeS0INawL3k6D3CDBI OtwbbaauiOruAOoiAStYSWctREW/CP8S7F+w+uEFvboJqwvt8DxJEf/T5pjCNEkPi4Vn Owdyk6chU0xo8oEgWmQNgPb+FoNNcRbC6GmWiyNXtjPai7qd62vrFOIgxyAirpoG25Py NeuQ== 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:message-id:date:subject:cc:to :from; bh=aTaMz6YFu72bICue2bhYjmI4n1Ev6tsGaz7af6jWo/o=; fh=iQIEIpegfxGHAXzmCmQbfua7u3pb28YTuJpmY/Z0V14=; b=h4eeXqVru1gRtm+iUjJVwKPjAQgWFwEQzE1C+t/IvJwm1wle0uqiIiJAGbUgMmD5e1 YE1Lh9WX99XhEd0cm3SyOcPAnB2YxgE3Qa50V90xnEXJeNcn99rY5VlRHYWi/jLb61ke MMAhSkdC4Va9LXIMMsaLgfIFOhDbrBorPWdISV9x5XgQH0NTHYQDL773J+MUGL3dH6+d e0nALu47Cctj+brhfX+XKRF6SWZNfYC6gHxjoMHPLhpXFCAcdWXy6aOIT9ZN6iyT6Szz kuCWyasxsad1HNg8v6Yq1ldBnIa+AH5Z1vhOdxk6bAb8Pot4hxqU4YePqoiSx6fzWAZR rtmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-191991-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191991-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578524bc504si4702864a12.567.2024.05.28.02.11.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 02:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191991-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-191991-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191991-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 am.mirrors.kernel.org (Postfix) with ESMTPS id AF7761F24103 for ; Tue, 28 May 2024 09:11:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6AF013D29B; Tue, 28 May 2024 09:11:04 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 672994594A for ; Tue, 28 May 2024 09:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716887464; cv=none; b=QvFUv3RrNQV54UjNOB6X6bR+UKr9gsR7TrJy07JPmIn4kmDRdEuFZdai/XBQGx585WwYZ5DhoU2zulhegRLfLP/9cStPr/lEyS7nay7WvOgcFlrIBveK4DX/bivynsrpIY1L8PPYVPZYMXWnCvauFZYVmr4SfKVbjEevzGKpAbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716887464; c=relaxed/simple; bh=1RwQvCe3Yc/wpvVhbqyoP9WETRw6+GsL8em9Rc0ezjM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=HeTwuqyonuZW48V8sd7RHfDtha6hVcqd3QxumwCi50Zw6a4ujauO/8TzjTjrsEZmzH/bW9OcmldofnbWDnw+ow95RBDj9dBnHoD5z2+fuA6iaFiWfNz+c2FFecIYe1ldUHOok4Z3X8bCqKWlj+OtOEoj+1Lq8Lr5xw3YtaNRJtw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VpRV85DVszwQ7Y for ; Tue, 28 May 2024 17:07:12 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id B9E7A18006E for ; Tue, 28 May 2024 17:10:58 +0800 (CST) Received: from huawei.com (10.67.174.55) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 28 May 2024 17:10:58 +0800 From: Jinjie Ruan To: , CC: Subject: [PATCH] genirq/debugfs: Print irqdomain flags as human-readable strings Date: Tue, 28 May 2024 09:09:17 +0000 Message-ID: <20240528090917.3624463-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500008.china.huawei.com (7.221.188.139) This patch improves the readability of irqdomain debugging information in debugfs by printing the flags field of domain files as human-readable strings instead of a raw bitmask, which aligned with the existing style used for irqchip flags in the irq debug files. Before: #cat :cpus:cpu@0:interrupt-controller name: :cpus:cpu@0:interrupt-controller size: 0 mapped: 2 flags: 0x00000003 After: #cat :cpus:cpu@0:interrupt-controller name: :cpus:cpu@0:interrupt-controller size: 0 mapped: 3 flags: 0x00000003 IRQ_DOMAIN_FLAG_HIERARCHY IRQ_DOMAIN_NAME_ALLOCATED Signed-off-by: Jinjie Ruan --- kernel/irq/debugfs.c | 17 ----------------- kernel/irq/internals.h | 19 +++++++++++++++++++ kernel/irq/irqdomain.c | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c index aae0402507ed..61a21a4c43ac 100644 --- a/kernel/irq/debugfs.c +++ b/kernel/irq/debugfs.c @@ -9,23 +9,6 @@ static struct dentry *irq_dir; -struct irq_bit_descr { - unsigned int mask; - char *name; -}; -#define BIT_MASK_DESCR(m) { .mask = m, .name = #m } - -static void irq_debug_show_bits(struct seq_file *m, int ind, unsigned int state, - const struct irq_bit_descr *sd, int size) -{ - int i; - - for (i = 0; i < size; i++, sd++) { - if (state & sd->mask) - seq_printf(m, "%*s%s\n", ind + 12, "", sd->name); - } -} - #ifdef CONFIG_SMP static void irq_debug_show_masks(struct seq_file *m, struct irq_desc *desc) { diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index ed28059e9849..e2ea3f6917ac 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -501,6 +501,25 @@ static inline struct irq_data *irqd_get_parent_data(struct irq_data *irqd) #ifdef CONFIG_GENERIC_IRQ_DEBUGFS #include +struct irq_bit_descr { + unsigned int mask; + char *name; +}; + +#define BIT_MASK_DESCR(m) { .mask = m, .name = #m } + +static inline void irq_debug_show_bits(struct seq_file *m, int ind, + unsigned int state, + const struct irq_bit_descr *sd, int size) +{ + int i; + + for (i = 0; i < size; i++, sd++) { + if (state & sd->mask) + seq_printf(m, "%*s%s\n", ind + 12, "", sd->name); + } +} + void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *desc); static inline void irq_remove_debugfs_entry(struct irq_desc *desc) { diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index c5832caf24cd..ba5c5cc90c3d 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -1927,6 +1927,19 @@ static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq static struct dentry *domain_dir; +static const struct irq_bit_descr irqdomain_flags[] = { + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_HIERARCHY), + BIT_MASK_DESCR(IRQ_DOMAIN_NAME_ALLOCATED), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_IPI_PER_CPU), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_IPI_SINGLE), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_MSI), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_ISOLATED_MSI), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_NO_MAP), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_MSI_PARENT), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_MSI_DEVICE), + BIT_MASK_DESCR(IRQ_DOMAIN_FLAG_NONCORE), +}; + static void irq_domain_debug_show_one(struct seq_file *m, struct irq_domain *d, int ind) { @@ -1934,6 +1947,8 @@ irq_domain_debug_show_one(struct seq_file *m, struct irq_domain *d, int ind) seq_printf(m, "%*ssize: %u\n", ind + 1, "", d->revmap_size); seq_printf(m, "%*smapped: %u\n", ind + 1, "", d->mapcount); seq_printf(m, "%*sflags: 0x%08x\n", ind +1 , "", d->flags); + irq_debug_show_bits(m, ind, d->flags, irqdomain_flags, + ARRAY_SIZE(irqdomain_flags)); if (d->ops && d->ops->debug_show) d->ops->debug_show(m, d, NULL, ind + 1); #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY -- 2.34.1