Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp121982lqb; Tue, 28 May 2024 10:26:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULhp6LIKOR3nBRnT7cunLQ5hE50nyrlzhUD72bpiI00XcolIQrTdftZ9UmDXiYCbE+u8iZQ81B+uj1nVUv1nmLDcp0wUm+qiUQiu28iw== X-Google-Smtp-Source: AGHT+IEoWk7c24fd1GPbOkb+zHpMe4Dt+shfrP0iXh8TS2cmphqpmdRg5Eqoed/shJcuAWU6djty X-Received: by 2002:a17:902:f688:b0:1f3:354a:c862 with SMTP id d9443c01a7336-1f4486cf88amr143583115ad.1.1716917207273; Tue, 28 May 2024 10:26:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716917207; cv=pass; d=google.com; s=arc-20160816; b=tlpcszOATTXLt4ShM1jyikWrtLN0ATiU7zUq9PVHgzbnmTRmkk/h3dt2EByIvcD1ue zwEvoh76FYw6qnpcqyEWM3ix1IBa2QmhSEVsOcsLqqACqgpBx7SFy4efvZkT1+ESmrZs UgyVddsrcB71zQvtkvrJT4yyfcvMqbZhOi3w/Sb6ZnccdzkV4yTCYbSypfpa4Dj7t5CI zwNIU2vYqRp7XdB9LyhdInvUKYk915Ob2vcSQKZYfi78IaGMj+0FhFCQyT0Pi/0Z6jZ/ 3HQMq2zcFxpVYp4qiN82NiamsSjH8a0yzgzfxzHpfunePgcatkvxQfxUlq8IQI6FMS9J b5ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=s/zJPbXyQmRdniGVZf4TSPPBc/ZwEN1OkaaD+bjWerY=; fh=XWiZ0b7POUsKBcdVWzBjJq2fWGDADJOEjRzKYXmuv1g=; b=I+yyPzxASu1qpjmDxB/7hWtZnkslPCULQiXIcX1p2xSdeYfNwjLtB/fR30ASvSKuBT j1OaDyZPVHvoNYvEu9BMdwKICH0qkTq1JisiwdeqvNQbItWMtz+jkHVTfrUcxuhsi8fk kD/NXvLy4xrH9NLRikeMZijUoMxavRA6Xovo33bPe+fj+dbKcQZjT0TGMGM0lveyZbnF 3QTw1x1rzCDj1eqmVip7NdXmoVvSLNNOEO9/BJw4jx2vturU7gGfRUw7YcRappoqwXN5 +xmgZrKQ8Z4f/hJq4iaqcdJ5U8yiPv0Wj39/AenoxGPfBC086QYdLx82njrkSr7yuI8M 0Cmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HGUOH8TK; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-192806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192806-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c9bb747si63261865ad.473.2024.05.28.10.26.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 10:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HGUOH8TK; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-192806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192806-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EEA02B24630 for ; Tue, 28 May 2024 17:25:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10D71174ECA; Tue, 28 May 2024 17:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HGUOH8TK" Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 C42DD17332F for ; Tue, 28 May 2024 17:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716917087; cv=none; b=pKW75GFO7GJAxNFn6FUcUpp0/wuN7icyPOKvBQ/QuaCJb/ooFtQ1A284GMpBfzSUsjucOMm34VxNQm1dULLPUO3MKgDv6T7aJAKJAlpGywQs+IZF5NCwxdo+TQIx3dfeC8652O9X7Ew66IutYto6VX6FnIr/99vp8ybEfSvNeTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716917087; c=relaxed/simple; bh=BYOBM/Qgb1pPbXOKQyDM68LLkkFSrrz6a8nkyDmMy/U=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=IZDDmMQYEEMrKfVMYs35LpMBKOxZEpdtKTl+G8u0m4F3AbqXWG9lnKd0pRZ3qeE7pzBnlm9xtNe3ohkwl9FR9gvla3ML5JID6FN8QXZCg5mrq7vyTKcQfN65gNUePBwfQPLuTCE1+jzbQm/BFNfuw/8D+hco3HRTTyJ1Pmfux3s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HGUOH8TK; arc=none smtp.client-ip=209.85.160.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-43dfe020675so33121cf.0 for ; Tue, 28 May 2024 10:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716917085; x=1717521885; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=s/zJPbXyQmRdniGVZf4TSPPBc/ZwEN1OkaaD+bjWerY=; b=HGUOH8TKgMETbqRvcrd8gq1AjAgS0TLYGukfllplzgE7Yy9RJyucWjruOvAgSmy4UB UnfheKuEpRUs8dourh7NaHkCVqF/b5UdLVlEpGdjPjOY5NtNvK7krDmwpqKrx92qTcQp Mprfmy9JVpQPfs/lkdaTPJokWxYD6d634KvzRi0ffL2mYus7+KOzX78LRyn76B62ea09 MSScK8CU8o8NU0Vppb2jAWQAZnKVHf3zEU3vXgknWudvvPvU2enkf48Amy2bHbjg6/oA 0XiRSszGUAY0rH7twI/PcqI4uKfmyZxToAF+MoxsHVBycOH84ktWUop+2di0ajQ6u52C 1wlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716917085; x=1717521885; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s/zJPbXyQmRdniGVZf4TSPPBc/ZwEN1OkaaD+bjWerY=; b=E63qcsV9ld7Ly2qIwS2RRUSX23iP04a2yVMyCHFjtHfAkMxjqUorviYvHqBeVXrT/w CpKEe19pn2vnbFFw7zUHAB7y5ghrVYUelzRjafSpXf+V4vWQjgVWgUP4Wf6wT9BYnsJd Q6MHNWG0SN04l2fQRj2a6+SK2PzIX/IVUFvvNEHCLtjVN7X1BKZ7QtPhoQuj+a9fw51d CITvTHi4O8Mevwt7Tt8UFcIJp2T7Yz+AOb5zYZsifG9pfmkjoowaLukVoLippZxIp2Uw hKuNbRoZo0DYRqBuEIAR8JmB+uVpwqbzUrBc60CXSRQl/p0gWbYyPMHHp2sBx1ty48ln xCXA== X-Forwarded-Encrypted: i=1; AJvYcCVdAa9RO9hoT4lb+mKimAytdrtakC27RzwHS3tt9Ksp7/b2bt4UQyyXy3yMjlLhRthSZdizoY4+IRJSm7jiQI1kfXhh7GnTuKRY+y56 X-Gm-Message-State: AOJu0Yzv2NNmHInQZoZOaPBRXOVu/dNnQfsHYugZ+Io0z6BZTfMT2sSy lqVxRNJAC/misnt15+qC6mfAbPAEB4zdBviht0A12ZHU9ZQ4za12r/rH4iTdOsNjU5gj8SdZOSo hvnoDbuJd7I0K8l+qoaFgtKttyVivCpl/a7ya X-Received: by 2002:a05:622a:400d:b0:43f:b1dd:11fc with SMTP id d75a77b69052e-43fb9f9ac98mr7220561cf.18.1716917084620; Tue, 28 May 2024 10:24:44 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240528164132.2451685-1-maz@kernel.org> In-Reply-To: <20240528164132.2451685-1-maz@kernel.org> From: Saravana Kannan Date: Tue, 28 May 2024 19:23:39 +0200 Message-ID: Subject: Re: [PATCH] of: property: Fix fw_devlink handling of interrupt-map To: Marc Zyngier Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Anup Patel , Rob Herring Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 28, 2024 at 6:41=E2=80=AFPM Marc Zyngier wrote= : > > Commit d976c6f4b32c ("of: property: Add fw_devlink support for > interrupt-map property") tried to do what it says on the tin, > but failed on a couple of points: > > - it confuses bytes and cells. Not a huge deal, except when it > comes to pointer arithmetic > > - it doesn't really handle anything but interrupt-maps that have > their parent #address-cells set to 0 > > The combinations of the two leads to some serious fun on my M1 > box, with plenty of WARN-ON() firing all over the shop, and > amusing values being generated for interrupt specifiers. > > Address both issues so that I can boot my machines again. > > Fixes: d976c6f4b32c ("of: property: Add fw_devlink support for interrupt-= map property") > Signed-off-by: Marc Zyngier > Cc: Anup Patel > Cc: Saravana Kannan > Cc: Rob Herring (Arm) > --- > drivers/of/property.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index 1c83e68f805b..9adebc63bea9 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -1322,7 +1322,13 @@ static struct device_node *parse_interrupt_map(str= uct device_node *np, > addrcells =3D of_bus_n_addr_cells(np); > > imap =3D of_get_property(np, "interrupt-map", &imaplen); > - if (!imap || imaplen <=3D (addrcells + intcells)) > + imaplen /=3D sizeof(*imap); > + > + /* > + * Check that we have enough runway for the child unit interrupt > + * specifier and a phandle. That's the bare minimum we can expect= . > + */ > + if (!imap || imaplen <=3D (addrcells + intcells + 1)) > return NULL; > imap_end =3D imap + imaplen; > > @@ -1346,8 +1352,14 @@ static struct device_node *parse_interrupt_map(str= uct device_node *np, > if (!index) > return sup_args.np; > > - of_node_put(sup_args.np); > + /* > + * Account for the full parent unit interrupt specifier > + * (address cells, interrupt cells, and phandle). > + */ > + imap +=3D of_bus_n_addr_cells(sup_args.np); > imap +=3D sup_args.args_count + 1; > + > + of_node_put(sup_args.np); > index--; > } > Thanks Marc! And sorry for not catching this in my earlier review! Acked-by: Saravana Kannan -Saravana