Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4585321rwb; Tue, 8 Aug 2023 10:30:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJ5EBaVcVxIrIs8L29r8ygb/4nhJalQR2ky6TIMbzEfhIGE2xx6oGwe04F8u8NkTbhelv2 X-Received: by 2002:aa7:da54:0:b0:522:7d21:9ed3 with SMTP id w20-20020aa7da54000000b005227d219ed3mr429437eds.19.1691515849163; Tue, 08 Aug 2023 10:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691515849; cv=none; d=google.com; s=arc-20160816; b=WE4L8y7lSluHCDDa3tZGYfcFBdp+9Wz9DwB8pjS/0VStsbxRU/Mcvnj7j7TIbHkOCk liNStYF3Ec8HctSbZjRprXIYw9muBtKA8byH2YjxlDOw4P+KaDbp+MXEQE3X3gHFL2ao wNhJLLAyaEf69q/RBK2x7cZ/LplXGRfU/vjiR9SSQeBwVN+Wx2vYPD826pZNaxq3mb6v hsYVAmwer0Ofa4I8HZsPa9XCzMZLBHJQi1UvCZ7EJdWvgMaZe/N/EOw+zfNGTcfwbxrm FAJ5SjKM93GCrGkkjCob91iTeB0rWQ55VOQZpWVlggSZlDFBkqcGouqhj3c5pm/bdK9I rlmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=d1EipVqqNWhe4rs1axo24BAZMlXCdm9ghw2At6Z8v2k=; fh=6sOVRK6sXiZeriQp1YnxMeCoRyktZO+TrfWDw5x3qvY=; b=nWTzDw5BEwJuZCxa42n4KOgd+TDVVKiE6H6zlh6d38YuEvCuS+nVlUYTqeKWTqH0wD T+3o8IKlWxiHpIXRJPCF1skeGvUB6EZ/jTRJWcXO/Z7glp2MYHRF0A6lkEmyqskUvA5f z4GBNBAT64VenKRkorQMBhcwS1krJNtqfusLQgugQGGg6pQgHo72YGt387xFTiZ5aVYh bCHxNA2IwsbwBV79AZkPKGLOia6COufKRRwzFOsZpwTm2w0cdIrGxiZ6st9N5AZWD68J XQe4Ji88RuEiOg15enVj2QxOoYdSAuTe0fHGdfvIf4/fI4O85U3Z/pvMaaBhPoXlKrXX 86Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ePBIfcRi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020aa7d5c4000000b00522de11e513si7493859eds.500.2023.08.08.10.30.23; Tue, 08 Aug 2023 10:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ePBIfcRi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232850AbjHHQ3j (ORCPT + 99 others); Tue, 8 Aug 2023 12:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232530AbjHHQ2b (ORCPT ); Tue, 8 Aug 2023 12:28:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9D0311F66 for ; Tue, 8 Aug 2023 08:51:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 171ED62513 for ; Tue, 8 Aug 2023 13:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A2F9C433C7; Tue, 8 Aug 2023 13:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691500923; bh=NF5G/R0NqeQHYbKyCLsFwN904Kw6X0MLSj8fCMzbh/4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ePBIfcRi49VfeipofeouYVyEl0jnR3i6+3DlVYQJBGrzqdfkftJoXoUQEYx60e+KC xtvQE3P8fS8ZDhvRL3+IIlA56I4P2pKWBKY209TFAUFwLKFsgjU5edqPOg4tI92/hj tojQ5/H3sKxUYEbkxiVzCchvcaDgBInIozEC1FWVajBOQwQXstV99UYKbQcZDoYwdo HstWS30mqU60qO8QhDxrrMC6CI72+99JOC/YPnstBNw3oX+XcG+X+HHovX8Fupyx2G VsgaNYbR+3OeRCP010Oxn1wdDXrHv1slKnMXXQLOUL2P9DCf7GCIzPLFm2sGVL4ssw r9SqbgCDGIdPA== Date: Tue, 8 Aug 2023 14:21:57 +0100 From: Will Deacon To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com, Sami Mujawar , Catalin Marinas , Mark Rutland , Mike Leach , Alexander Shishkin , coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3 1/4] arm_pmu: acpi: Refactor arm_spe_acpi_register_device() Message-ID: <20230808132157.GB2369@willie-the-truck> References: <20230803055652.1322801-1-anshuman.khandual@arm.com> <20230803055652.1322801-2-anshuman.khandual@arm.com> <89058c7c-1fed-60ea-7233-04187772a931@arm.com> <20230804163921.GE30679@willie-the-truck> <9b630f76-2f9e-fc42-012e-403f4b8c1dee@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9b630f76-2f9e-fc42-012e-403f4b8c1dee@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 07, 2023 at 11:03:40AM +0530, Anshuman Khandual wrote: > On 8/4/23 22:09, Will Deacon wrote: > > On Thu, Aug 03, 2023 at 11:43:27AM +0530, Anshuman Khandual wrote: > >> On 8/3/23 11:26, Anshuman Khandual wrote: > >>> + /* > >>> + * Sanity check all the GICC tables for the same interrupt > >>> + * number. For now, only support homogeneous ACPI machines. > >>> + */ > >>> + for_each_possible_cpu(cpu) { > >>> + struct acpi_madt_generic_interrupt *gicc; > >>> + > >>> + gicc = acpi_cpu_get_madt_gicc(cpu); > >>> + if (gicc->header.length < len) > >>> + return gsi ? -ENXIO : 0; > >>> + > >>> + this_gsi = parse_gsi(gicc); > >>> + if (!this_gsi) > >>> + return gsi ? -ENXIO : 0; > >> > >> Moved parse_gsi() return code checking to its original place just to > >> make it similar in semantics to existing 'gicc->header.length check'. > >> If 'gsi' is valid i.e atleast a single cpu has been probed, return > >> -ENXIO indicating mismatch, otherwise just return 0. > > > > Wouldn't that still be the case without the check in this hunk? We'd run > > into the homogeneous check and return -ENXIO from there, no? > Although the return code will be the same i.e -ENXIO, but not for the same reason. > > this_gsi = parse_gsi(gicc); > if (!this_gsi) > return gsi ? -ENXIO : 0; > > This returns 0 when IRQ could not be parsed for the first cpu, but returns -ENXIO > for subsequent cpus. Although return code -ENXIO here still indicates IRQ parsing > to have failed. > > } else if (hetid != this_hetid || gsi != this_gsi) { > pr_warn("ACPI: %s: must be homogeneous\n", pdev->name); > return -ENXIO; > } > > This returns -ENXIO when there is a IRQ mismatch. But if the above check is not > there, -ENXIO return code here could not be classified into IRQ parse problem or > mismatch without looking into the IRQ value. Sorry, but I don't understand your point here. If any of this fails, there's going to be some debugging needed to look at the ACPI tables; the only difference with my suggestion is that you'll get a message indicating that the devices aren't homogeneous, which I think is helpful. Will