Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8016594rwb; Wed, 23 Nov 2022 14:12:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf63AKUbWXuwLSk0IH2heXjEi/bwpGgZmT6SoCYmbbaQA+8kFnjD5ePD13q57THsFdGRLuBF X-Received: by 2002:a17:90b:793:b0:218:9c4f:e97 with SMTP id l19-20020a17090b079300b002189c4f0e97mr22455759pjz.2.1669241531587; Wed, 23 Nov 2022 14:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669241531; cv=none; d=google.com; s=arc-20160816; b=w2gOEE0oX/YZTLT2c1EaUKcHJSG2DE+JRowIMZmGiXgRLl0VQ3eYYTu7KoTsVHlCFd 8NFLFmkScYRTvvkYl3NiWGh4XyN/Fm2vItFQShLkooWtlYTPNvPzWwW9sRBm+7E73mQ5 yiIBwDBuX83OEwIFUzrsnN0MV4DKfNIFjaVrFI+jkOn0JnsKWq6A+9cZgkPYLd6Aa3fg rxzvNMNBkLazQ020IJUoFz8PpeKDy6Vi9fG8ytCd8Yioe9ULCxJYRl+I6RFiR9mlj9iq Sm89UP1ZzPHmW06HPFRghTNDNLqVoKh2+xDRpkple05lnh/U59Df9dB34vbWXJXNFRsi wKgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=OYGZ+OQ5qxelo1vLefYAbKPSOBIaPb9bSn17c3dzbNo=; b=pkSq8eaLkj5AlAcclT0agJbLQCh+zEURlCQsqfZ8Rbi1DM0SsCSdwbdFTzboiOV7gy qeyBQhXA/R7IMx0N3SAupwtj5uXsnc+6P0DlFfckas1vI0Rert9zAA7msqsgSzkoeGQ7 4Qh/P7u5G4/08bZOFs05xL5iGy/2baIhpcL50JBMm6OqV/b88Jk/ILG2QG4E8qAkVRne HFtn3yaESZBAwW7iJE/xmalnaqQcxPOMMkKkkNzvO9gihtQJFPRqjV7h4zi1rWTuLYi3 MWrRu30rgcJTtqI6thM7f0JJViiky0YZxXZwVQVCHJoPhMLVgZhcGs8FsfkivUvQP590 anig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SV035AWE; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a656555000000b00476f2b11c08si19527pgw.813.2022.11.23.14.11.59; Wed, 23 Nov 2022 14:12:11 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=SV035AWE; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238783AbiKWVuR (ORCPT + 89 others); Wed, 23 Nov 2022 16:50:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238466AbiKWVuP (ORCPT ); Wed, 23 Nov 2022 16:50:15 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E867E391DC; Wed, 23 Nov 2022 13:50:13 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669240211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OYGZ+OQ5qxelo1vLefYAbKPSOBIaPb9bSn17c3dzbNo=; b=SV035AWEgb1QckLYvmuG9aGLSJp+M6x5TJFdtTm7HhLaLkbr08vOdIu+DPT3rPZzYZnXjK uc4LxuPUjoR9tlEa/jbRrGyiaci5sX/SjSbb9w6SILoe90HhvOwnle8dXgpt94MtSQkQHv 74ar/HW+1iH8ByymXFJwRIvslRG3/dOUYXDC3MXSG8q0F3M9AcVPd3sNAAch5j0CJkmvPS YUTHrwTzPzNo9WK0D5NSvMHURicMpgXpDuPoTV0+S6mx+exuWoH1VoKDgtQZkk9bwkBoX/ dHA/r1fZF51YbbhQyQPnDQU3Z/nczSKu7B+dzvhCO0LRFNNbw7qMMJTYYlQsfw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669240211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OYGZ+OQ5qxelo1vLefYAbKPSOBIaPb9bSn17c3dzbNo=; b=J0IXugY9QKlxaIwsaZKJcdEZEB0+z095g/yyzRyf0nF5lMr73k+q6IHCuIZn0mCGlb2Mx5 eHRp80j/DHuDe+Dw== To: "Tian, Kevin" , LKML Cc: "x86@kernel.org" , Joerg Roedel , Will Deacon , "linux-pci@vger.kernel.org" , Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , "Jiang, Dave" , Alex Williamson , "Williams, Dan J" , Logan Gunthorpe , "Raj, Ashok" , Jon Mason , Allen Hubbe , "Ahmed S. Darwish" Subject: RE: [patch V2 12/33] PCI/MSI: Add support for per device MSI[X] domains In-Reply-To: <87zgchew4u.ffs@tglx> References: <20221121083657.157152924@linutronix.de> <20221121091327.163146917@linutronix.de> <87zgchew4u.ffs@tglx> Date: Wed, 23 Nov 2022 22:50:11 +0100 Message-ID: <8735a9e3xo.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Wed, Nov 23 2022 at 12:41, Thomas Gleixner wrote: > On Wed, Nov 23 2022 at 08:08, Kevin Tian wrote: >>> +bool pci_setup_msi_device_domain(struct pci_dev *pdev) >>> +{ >>> + if (WARN_ON_ONCE(pdev->msix_enabled)) >>> + return false; >> >> the check already exists in __pci_enable_msi_range() >> >>> +bool pci_setup_msix_device_domain(struct pci_dev *pdev, unsigned int >>> hwsize) >>> +{ >>> + if (WARN_ON_ONCE(pdev->msix_enabled)) >>> + return false; >> >> ditto. >> >> btw according to the comment this should check pdev->msi_enabled. > > Yeah, those are probably redundant. I fixed the MSIX check and kept them for paranoia reasons, so changes in the calling code get caught. >> This is general PCI MSI logic. So an open related to my rely to patch02, >> is it correct for PCI core to assume that the real parent imposes all the >> restrictions and there is no need to further go down the hierarchy? > > That was my working assumption and it turned out to be correct with both > x86 and ARM. As a follow up, I went through some of the other architectures, especially the places which have extra limitations and it turns out that the restriction comes always from the direct parent. If that ever changes then we need a callback which lets us evaluate the resulting capabilities through the hierarchy. That's nothing which can be evaluated directly. Just look at the x86 hierarchy with IR. IR allows multi PCI-MSI, but the vector domain does not. Who is right? That's a decision which is made in the particular hierarchy. For now it's valid that the direct MSI parent has the proper set available. Thanks, tglx