From nobody Sun Dec 14 11:34:18 2025 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E5731A314E for ; Mon, 17 Feb 2025 08:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739782743; cv=none; b=UuyTJ4C4TSFm+d0nYq8ZPl3vCRvjtPl3HlyIK2iq50kIwxO/VXjSM1RZQZWuQh8bzNqnnOdXpNTzzT+lITwjDkPQLuGnjLqWIiOrbwN6di9RTiZxOykjRhTXv/48OoGTEw6fUPBhVrWwDv59lEJzhrLstaST0a70tUx1pN8MnIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739782743; c=relaxed/simple; bh=a6c0Uq7JBdxZXw7kUxhrWKbabcgA5MuMPGG3EqfXL64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWaXJWgeE3LsIwEs+KjKhJsaAnqNq+5Q+3NyEzTE2a+2OtUi90DKdpXC/NT8Mgdm2licB4rpAS5DK1T9j6A86J6Ll0zOREQISxe5TkgdPkme0J1vNIuq/CNK8+pqAOkElLdLqvi0DZfag809a98Z5Kp3yxmujYTSOhDlSPLDYjo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=pRDEdXXx; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="pRDEdXXx" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21f61b01630so79537135ad.1 for ; Mon, 17 Feb 2025 00:59:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1739782742; x=1740387542; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=koCL3sGSNowxnA2uthh7D1mm9ult5obqPLO5TypzPmY=; b=pRDEdXXxokO+M2WhFucDV+HQ9HUS7av7a7PRHS1ulbIvholmc5VAXboqho1+wY5BUi cSt8GbQlkA8ZmP1y4+MtCflLKAux1cckRs0PVQ+XhC2Ld1dMCRxBDgVlb/kVv6WedwPI UlLzS4qdOKlY4tgSd54pWpNdZB4XmvSW+c5OzkqAeFxoiG0t8W9T/xDW6I9buh+njwbm 5lvSHLclm8fsvf7wjt1FpUmId4+GJB67rCAE0KzgvI1BMxDFAdrhgu4nqw7rwKZejMz6 MEeQv0dlPB7mTmeU7D29sg4WLh34ElzRjpSn9mZP8i0+36flOtlF9Of+W9Jc0S0lGhUL sPLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739782742; x=1740387542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=koCL3sGSNowxnA2uthh7D1mm9ult5obqPLO5TypzPmY=; b=JeWbNlx6p7T7UVh3RIHm60Ifj/nGbuxE84+RgRDt7t5EDCPtxAsWux9JxR8UyXMl3G Lmi/RXZVwJydOVgmRujMeEKGOol9ZIiDrc9mn66D2CPQKe1fT8kL6oQeQ1Aq2yL8u/11 vUi66wEHu9vg5WIgEXkslydNMOFqry2hjBjy9fpFnMpElzfh7J5wCPGM6yDG1cnYAfJJ tNbrstxh5a5QkC/h+P375KRDq9nkk5RrHAg6IBS6imPoI37BW0jyQOv6ikcOMc9xIG7n JpkpyZJIwR165dlK4HNPNbL6oWi+hyf5Sy6UrUt9QpceT0peQvubSawn5Sj2LXrMpavZ RRBg== X-Forwarded-Encrypted: i=1; AJvYcCXdDe1L238wwD9PHO906cr/KPBn7YDQ8Fz4X2d62TTzfIOMlp+TVDVjYMxlB2ORKoyya3OqVfG/F3KOiXQ=@vger.kernel.org X-Gm-Message-State: AOJu0YydIzsDn/thXHc4/oguKFwSWtRKQE9MPUyJ+sbSJsWslnZSc7L5 JtTH+FtXQBJGfpSuWBVYUWzvLgROR6ovX0SH3yDBPXkfl0JX/adUyG7uxLtv0oc= X-Gm-Gg: ASbGnctdn9I5lW4BTQKmOxAgb0DlJI4efWw+kHvV+xUrwVAYAUCdFkZ2fRIKlR+W3xe 7ZkZhNjsd/GifvxM5AtkaJB4b+DeMhv3TJp2XzgsknkJdJGpQNyxAXvAY3r/K7JhUnmT9hmb4Ns orx/zF9ai70QWDDoC0zL3Zundn4lryyg+Bom6KG2qW+rkh+X11GVbe3CBEb4HSELsZCmlmAFItW 6KuuTbCKwi34XOB9c+EplsqmwDS0GKfVx8xE/KP4ZtPN57WW3tbg56T5HQuABCnr6ttHLhXItjY Yn4RYHp6SCMwLlK53U5871gAh1gNWZVuK5bM5pDv51StZhObjPNxuq8= X-Google-Smtp-Source: AGHT+IHbBvzPw0Wn7/Eyf5Y7dSkIAJVrU71JRxh4insgq9Beex3YYjwNlgnCYaOLqfIHDCH+B/xxjA== X-Received: by 2002:a05:6a00:4fd2:b0:730:949d:2d52 with SMTP id d2e1a72fcca58-73262158ademr14543775b3a.3.1739782741534; Mon, 17 Feb 2025 00:59:01 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([122.171.22.227]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73242546867sm7632018b3a.24.2025.02.17.00.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 00:59:00 -0800 (PST) From: Anup Patel To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: hpa@zytor.com, Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v6 09/10] irqchip/riscv-imsic: Replace hwirq with irq in the IMSIC vector Date: Mon, 17 Feb 2025 14:26:55 +0530 Message-ID: <20250217085657.789309-10-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250217085657.789309-1-apatel@ventanamicro.com> References: <20250217085657.789309-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, the imsic_handle_irq() uses generic_handle_domain_irq() to handle the irq which internally has an extra step of resolving hwirq using domain. This extra step can be avoided by replacing hwirq with irq in the IMSIC vector and directly calling generic_handle_irq(). Signed-off-by: Anup Patel --- drivers/irqchip/irq-riscv-imsic-early.c | 6 ++---- drivers/irqchip/irq-riscv-imsic-platform.c | 2 +- drivers/irqchip/irq-riscv-imsic-state.c | 8 ++++---- drivers/irqchip/irq-riscv-imsic-state.h | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-= riscv-imsic-early.c index 553650932c75..d9ae87808651 100644 --- a/drivers/irqchip/irq-riscv-imsic-early.c +++ b/drivers/irqchip/irq-riscv-imsic-early.c @@ -73,7 +73,7 @@ static int __init imsic_ipi_domain_init(void) { return 0;= } static void imsic_handle_irq(struct irq_desc *desc) { struct irq_chip *chip =3D irq_desc_get_chip(desc); - int err, cpu =3D smp_processor_id(); + int cpu =3D smp_processor_id(); struct imsic_vector *vec; unsigned long local_id; =20 @@ -103,9 +103,7 @@ static void imsic_handle_irq(struct irq_desc *desc) continue; } =20 - err =3D generic_handle_domain_irq(imsic->base_domain, vec->hwirq); - if (unlikely(err)) - pr_warn_ratelimited("hwirq 0x%x mapping not found\n", vec->hwirq); + generic_handle_irq(vec->irq); } =20 chained_irq_exit(chip, desc); diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/i= rq-riscv-imsic-platform.c index b9e3f9030bdf..6bf5d63f614e 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -111,7 +111,7 @@ static int imsic_irq_set_affinity(struct irq_data *d, c= onst struct cpumask *mask return -EBUSY; =20 /* Get a new vector on the desired set of CPUs */ - new_vec =3D imsic_vector_alloc(old_vec->hwirq, mask_val); + new_vec =3D imsic_vector_alloc(old_vec->irq, mask_val); if (!new_vec) return -ENOSPC; =20 diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-= riscv-imsic-state.c index 5ec2b6bdffb2..d0148e48ab05 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.c +++ b/drivers/irqchip/irq-riscv-imsic-state.c @@ -422,7 +422,7 @@ struct imsic_vector *imsic_vector_from_local_id(unsigne= d int cpu, unsigned int l return &lpriv->vectors[local_id]; } =20 -struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct c= pumask *mask) +struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpu= mask *mask) { struct imsic_vector *vec =3D NULL; struct imsic_local_priv *lpriv; @@ -438,7 +438,7 @@ struct imsic_vector *imsic_vector_alloc(unsigned int hw= irq, const struct cpumask =20 lpriv =3D per_cpu_ptr(imsic->lpriv, cpu); vec =3D &lpriv->vectors[local_id]; - vec->hwirq =3D hwirq; + vec->irq =3D irq; vec->enable =3D false; vec->move_next =3D NULL; vec->move_prev =3D NULL; @@ -451,7 +451,7 @@ void imsic_vector_free(struct imsic_vector *vec) unsigned long flags; =20 raw_spin_lock_irqsave(&imsic->matrix_lock, flags); - vec->hwirq =3D UINT_MAX; + vec->irq =3D 0; irq_matrix_free(imsic->matrix, vec->cpu, vec->local_id, false); raw_spin_unlock_irqrestore(&imsic->matrix_lock, flags); } @@ -510,7 +510,7 @@ static int __init imsic_local_init(void) vec =3D &lpriv->vectors[i]; vec->cpu =3D cpu; vec->local_id =3D i; - vec->hwirq =3D UINT_MAX; + vec->irq =3D 0; } } =20 diff --git a/drivers/irqchip/irq-riscv-imsic-state.h b/drivers/irqchip/irq-= riscv-imsic-state.h index 19dea0c77738..3202ffa4e849 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.h +++ b/drivers/irqchip/irq-riscv-imsic-state.h @@ -20,7 +20,7 @@ struct imsic_vector { unsigned int cpu; unsigned int local_id; /* Details saved by driver in the vector */ - unsigned int hwirq; + unsigned int irq; /* Details accessed using local lock held */ bool enable; struct imsic_vector *move_next; @@ -96,7 +96,7 @@ void imsic_vector_move(struct imsic_vector *old_vec, stru= ct imsic_vector *new_ve =20 struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned= int local_id); =20 -struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct c= pumask *mask); +struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpu= mask *mask); void imsic_vector_free(struct imsic_vector *vector); =20 void imsic_vector_debug_show(struct seq_file *m, struct imsic_vector *vec,= int ind); --=20 2.43.0