Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1543487ybp; Wed, 9 Oct 2019 16:11:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6Ff2gRuOqxdJnYxlgW7U+lgWgM22xBhi5X2AxEzED7FkTwPj2agKx57NamrIkh1/sWKCh X-Received: by 2002:a17:906:8286:: with SMTP id h6mr5227493ejx.258.1570662672999; Wed, 09 Oct 2019 16:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570662672; cv=none; d=google.com; s=arc-20160816; b=WftWA3x59WvalFfhUOelfEzkzWPAS8Ze0Z+91qiiClplajc3D8nzZx30HNUSySeEZM 7qi4JU6Rj7HmYnl3nkBdJCwkNVKqHJNds+DUn/NkHYVONb2ONliWaCNDMpoBk4pvVDtt IYK1FUndYgrI5w889xW9yVZXWhatC5lrpRZwDZp1tHuTTFw8snYk3VwPQLDxPVlKBoCA aLHaj/ggc+ysiIKTq+qw5lBN1LSooQVkUz6hRNMFRxB6SZ9zf9p5lYtFxbFUam9Kr5HC X+k3qZRNH0HfDehaARA/pPzHEAyuPCqKRILx8imumlw0eJD9EyBq0BrnM4DxDYyA87E3 pZQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eMDmjSJAJFJlqbtJsteRO0zPPnOAeBhiXg67K5xvgtY=; b=VGV3Uxr2GsRC0J3WhPhwTpNv4+pgGnJmMFj7iuWmS7Ar+V9Gc0C1Zgmxbr1Un5XWQG pnOUqn2wgE/LFx1BjisRVzYRLa/2+SEjm5hAK0JK7H93hzyWqXoYl9KavH1umWDExz9e WbncupGowhwgYWKkZy+4vh2Kf47IXDHdWml0RqQvQiTlFUD8mheKdsVsZa0tWVApO99P haeAqQf+mdUpOWHBQMT8gkapX+Kur9fStLB7OHVANHQtvUyFHRwVfgL2FJFpKSX9joWU 8rn0S4X2DPqQXthUMM9rD9sVIJeURI66aBf5t68/bKEFyeI0FyxMRgYB3Xz3ZsSI/gN/ M6jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q2iLNgUO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si1940291edr.429.2019.10.09.16.10.49; Wed, 09 Oct 2019 16:11:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q2iLNgUO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732516AbfJIXJb (ORCPT + 99 others); Wed, 9 Oct 2019 19:09:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732501AbfJIXJb (ORCPT ); Wed, 9 Oct 2019 19:09:31 -0400 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9407D21A4A; Wed, 9 Oct 2019 23:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570662569; bh=ohHhwFLHLpyDn+DVqk1XdMRpeBxYlKbvgLKaFM+Thic=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Q2iLNgUOqojrOM61BLBav7VkGbGgdRBJd+Uz00O8OQMEB7O/pT3j8MiTx1XVPFm1r EM4gkBtkY/JuI/3lu5BXSZyNplbKxaaPI9Rm9UdL8CrBy7Vwo0TmCh5l+Y13sD0UCY +saSwHvqYFfNrFT7YkxGVyPJGqnXkX1qvwHyIB7Y= Received: by mail-qk1-f170.google.com with SMTP id x134so3874606qkb.0; Wed, 09 Oct 2019 16:09:29 -0700 (PDT) X-Gm-Message-State: APjAAAUpziyGSc//TPmLO8MJFmvuqu3NJDMhfrgItx5huVqaHyI0zZaW 9gXZx5hRT/LpbB64bSPu/cjWr4PXeqcCjRjK2Q== X-Received: by 2002:a05:620a:136e:: with SMTP id d14mr6214231qkl.393.1570662568596; Wed, 09 Oct 2019 16:09:28 -0700 (PDT) MIME-Version: 1.0 References: <20191007151730.7705-1-hhhawa@amazon.com> <20191007151730.7705-4-hhhawa@amazon.com> In-Reply-To: <20191007151730.7705-4-hhhawa@amazon.com> From: Rob Herring Date: Wed, 9 Oct 2019 18:09:17 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 3/3] edac: Add support for Amazon's Annapurna Labs L2 EDAC To: Hanna Hawa Cc: Borislav Petkov , Mauro Carvalho Chehab , Mark Rutland , James Morse , Frank Rowand , David Miller , Greg Kroah-Hartman , Linus Walleij , daniel@iogearbox.net, "Paul E. McKenney" , "linux-kernel@vger.kernel.org" , linux-edac , devicetree@vger.kernel.org, "Woodhouse, David" , benh@amazon.com, "Krupnik, Ronen" , Talel Shenhar , Jonathan Chocron , "Hanoch, Uri" , Sudeep Holla Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Sudeep On Mon, Oct 7, 2019 at 10:18 AM Hanna Hawa wrote: > > Adds support for Amazon's Annapurna Labs L2 EDAC driver to detect and > report L2 errors. I was curious why you needed a DT cache parsing function... [...] > +static int al_l2_edac_probe(struct platform_device *pdev) > +{ > + struct edac_device_ctl_info *edac_dev; > + struct al_l2_edac *al_l2; > + struct device *dev = &pdev->dev; > + int ret, i; > + > + edac_dev = edac_device_alloc_ctl_info(sizeof(*al_l2), DRV_NAME, 1, "L", > + 1, 2, NULL, 0, > + edac_device_alloc_index()); > + if (!edac_dev) > + return -ENOMEM; > + > + al_l2 = edac_dev->pvt_info; > + edac_dev->edac_check = al_l2_edac_check; > + edac_dev->dev = dev; > + edac_dev->mod_name = DRV_NAME; > + edac_dev->dev_name = dev_name(dev); > + edac_dev->ctl_name = "L2_cache"; > + platform_set_drvdata(pdev, edac_dev); > + > + INIT_LIST_HEAD(&al_l2->l2_caches); > + > + for_each_possible_cpu(i) { > + struct device_node *cpu; > + struct device_node *cpu_cache; > + struct al_l2_cache *l2_cache; > + bool found = false; > + > + cpu = of_get_cpu_node(i, NULL); > + if (!cpu) > + continue; > + > + cpu_cache = of_find_next_cache_node(cpu); > + list_for_each_entry(l2_cache, &al_l2->l2_caches, list_node) { > + if (l2_cache->of_node == cpu_cache) { > + found = true; > + break; > + } > + } > + > + if (found) { > + cpumask_set_cpu(i, &l2_cache->cluster_cpus); > + } else { > + l2_cache = devm_kzalloc(dev, sizeof(*l2_cache), > + GFP_KERNEL); > + l2_cache->of_node = cpu_cache; > + list_add(&l2_cache->list_node, &al_l2->l2_caches); > + cpumask_set_cpu(i, &l2_cache->cluster_cpus); > + } > + > + of_node_put(cpu); > + } We already have what's probably similar code to parse DT and populate cacheinfo data. Does that not work for you? If not, why not and can we extend it? Then your driver might work if the data comes from ACPI instead (or maybe that's all different, I don't know). Rob