Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp890438rwi; Fri, 14 Oct 2022 09:52:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47yiboym6UIU4et4O5YSJBWQYMYXaGOywcZ+al8ONOND+AoYdoUDvjdOvt2JsLLdDjhD0D X-Received: by 2002:a05:6402:278c:b0:45c:da8e:837d with SMTP id b12-20020a056402278c00b0045cda8e837dmr1401114ede.18.1665766340296; Fri, 14 Oct 2022 09:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665766340; cv=none; d=google.com; s=arc-20160816; b=rM/pgYAO7BrAFLXufr4IOQayWoo42tDfg0hP9EzV4AVlzJp/d7vWNId4Wj06wQ/gtq uKY0UM9JiAMaUxDR+xD1UhF84uPIxt007ebHpLnBLYrGrdmFED2YCFOZY+5G9EjMHkCG sQNHvsqgu01X2HH5aw/orAI4+Vr6bp8v5JoDE1FUZ2FLC8QkHYOq8mANLjgQ+dU/29q5 Uf4jabsQLwKkXEI/g1/O6YAPbtDyr0FPPe1b9gOYFkctw969cc+lSPthABCGAv9IiHG5 a9hnP38MlaSan+eVIO+aZcXsspyqXR9ILDX4lfLwoBdFoWQkdzHvqrW1LJGZ0S9Dvw3s ZpvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=K/ZlgY+cXSoM1N6Y9bpSC2nRVsmCPhsYw6bswZ9SOWQ=; b=uHm6JU5y4Ikp9NeEmm6JEJ78IsKz+TdC5WzQTu30FrMF3lTAcnH91WNTFfOm5RuQyx 9ucsaGeTG9m/dNVRhHQ3yr5DWGqHWPyUYhENfjNDNX5FVcxic1SIeaS33V+taLRngr11 Oh9/7ZXCjn69XblhlDn9bvxTvcwmPh0ATTDIfDAak7XUaS+wGSsM3nyuWOjuHVEIdBSF AZgudO1ldaqWJAK4gd08eMIPF1A581ViDDfRYaSA8enHHclyRXV9mF5HmKkOVkiRb3gQ EEJSySkXGaMVEnvM9KkV+l4DnTeHeUwzJNMPErbkQ+Y9sPhKnmm8THMOxFfsx+6E5PQJ hXMg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a056402348a00b0045901aa2468si3276121edc.333.2022.10.14.09.51.53; Fri, 14 Oct 2022 09:52:20 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiJNP5C (ORCPT + 99 others); Fri, 14 Oct 2022 11:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiJNP5A (ORCPT ); Fri, 14 Oct 2022 11:57:00 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1342DD95; Fri, 14 Oct 2022 08:56:57 -0700 (PDT) Received: from fraeml711-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MprXk2v91z67Vhk; Fri, 14 Oct 2022 23:53:58 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml711-chm.china.huawei.com (10.206.15.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 14 Oct 2022 17:56:54 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 14 Oct 2022 16:56:54 +0100 Date: Fri, 14 Oct 2022 16:56:53 +0100 From: Jonathan Cameron To: Davidlohr Bueso CC: , , , , , , , Subject: Re: [PATCH] cxl: Add generic MSI/MSI-X interrupt support Message-ID: <20221014165653.0000140e@huawei.com> In-Reply-To: <20221013173703.th54drzlafvj74oo@offworld> References: <20221012180432.473373-1-dave@stgolabs.net> <20221013131913.0000038b@huawei.com> <20221013173703.th54drzlafvj74oo@offworld> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,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 Thu, 13 Oct 2022 10:37:03 -0700 Davidlohr Bueso wrote: > Thanks for having a look. > > On Thu, 13 Oct 2022, Jonathan Cameron wrote: > > >> +struct cxl_irq_cap { > >> + const char *name; > >> + int (*get_max_msgnum)(struct cxl_dev_state *cxlds); > > > >For the CPMU case I need to walk the register locator dvsec block so need > >the callback to take the pci_dev not the cxl_dev_state. > > Hmm ok, however maybe I'm missing something, but given a pdev, do we have a > way to get back to the cxlds? I'd failed to register we can easily get from cxlds to pci dev. Had wrong mental model of what embedded what. > > ... > > >> static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) > >> { > >> struct cxl_register_map map; > >> @@ -498,6 +558,9 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) > >> if (IS_ERR(cxlmd)) > >> return PTR_ERR(cxlmd); > >> > >> + /* TODO: When there are users, this return value must be checked */ > >> + cxl_pci_alloc_irq_vectors(cxlds); > >> + > > > >Gut feeling is this will end up moving ahead of any of the sub device creation > >because many of them end up needing interrupts. > > > >Also check response from the start - can't see a reason to not do so as we > >won't be registering any at all if no callbacks provided. > > > >So I'd move it above the devm_cxl_add_memdev() call. > > Will do. In addition, are you ok with grouping the irq setup for each cxl > feature/component, ie: > > if (cxl_pci_alloc_irq_vectors(cxlds) > 0) { > cxl_setup_mbox_irq(); > cxl_setup_events_irq(); > cxl_setup_pmu_irq(); > } > > I ask mostly from the mailbox perspective, in that we already have > a mbox setup call and can certainly understand if people would prefer > it there, but I tend to prefer the above (logically wrt irqs). I'd rather see it in each of the setup calls. Out in pci.c we should just be doing minimum to find that max irq number. e.g. the CPMU driver will rewalk and find it's vector number directly from it's own register space. Jonathan > > Thanks, > Davidlohr