From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C562EC433ED for ; Mon, 5 Apr 2021 16:32:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACCCB61398 for ; Mon, 5 Apr 2021 16:32:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACCCB61398 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FDbmm1NSvz2yy8 for ; Tue, 6 Apr 2021 02:32:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=tDA3jodw; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1236::1; helo=casper.infradead.org; envelope-from=rdunlap@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=tDA3jodw; dkim-atps=neutral Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FDbmC6gxtz2yRG for ; Tue, 6 Apr 2021 02:32:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=WlZlrre6xzixEo2giGUl6pFbTjNx7pniG1L/BRwxIwU=; b=tDA3jodwCZQinL1j+mqzmDIbMI 5x9ANZXMUUVi7C+9PvXqBExh+5JA5lXzeFMV3qWB/f+e1Hr51A3Y4LJ7GR4c2ydyce3q2z8siPx7X 7ytVHJajPFoNofR1z7SAxarTPpdtMVxwA1xbH9ln5e953zaaalkGsPXW0lvBPe8dVLbbuz8NfsJ4L fOBu5fjjaLIn//r9LFSgMjg4PBUt3+KhLPUDij3prUeeFUS8Z7mm10RG4LpIwTof6d0cbaq6WOxrj weRUDDc3tx360RWB9BvDsjkbWc/EcQycrIqf9TKhspUCRtTEmKW/EP5xuWzsR63VcddqMXedVMj9X lyEvvBCA==; Received: from [2601:1c0:6280:3f0::e0e1] by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lTS8c-00Bc7S-Uq; Mon, 05 Apr 2021 16:31:50 +0000 Subject: Re: [PATCH v2] powerpc: iommu: fix build when neither PCI or IBMVIO is set To: Christophe Leroy , linux-kernel@vger.kernel.org References: <20210404192623.10697-1-rdunlap@infradead.org> <135d33bc-5520-d49b-dd1c-582c7d8e3bac@csgroup.eu> From: Randy Dunlap Message-ID: Date: Mon, 5 Apr 2021 09:31:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <135d33bc-5520-d49b-dd1c-582c7d8e3bac@csgroup.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, kernel test robot , Anton Blanchard Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 4/5/21 2:04 AM, Christophe Leroy wrote: > > > Le 04/04/2021 à 21:26, Randy Dunlap a écrit : >> When neither CONFIG_PCI nor CONFIG_IBMVIO is set/enabled, iommu.c has a >> build error. The fault injection code is not useful in that kernel config, >> so make the FAIL_IOMMU option depend on PCI || IBMVIO. >> >> Prevents this build error (warning escalated to error): >> ../arch/powerpc/kernel/iommu.c:178:30: error: 'fail_iommu_bus_notifier' defined but not used [-Werror=unused-variable] >>    178 | static struct notifier_block fail_iommu_bus_notifier = { >> >> Fixes: d6b9a81b2a45 ("powerpc: IOMMU fault injection") >> Signed-off-by: Randy Dunlap >> Reported-by: kernel test robot >> Suggested-by: Michael Ellerman >> Cc: Michael Ellerman >> Cc: linuxppc-dev@lists.ozlabs.org >> Cc: Anton Blanchard >> --- >> I was supposed to update this about one month ago, but then I lost >> some email and also took a break for a few weeks, then I remembered, >> so here it is. >> >>   arch/powerpc/Kconfig.debug |    1 + >>   1 file changed, 1 insertion(+) > > Wouldn't it be cleaner to get rid of those two horid #ifdefs ? > Of course we can do both. Sure, that works. Thanks. Acked-by: Randy Dunlap # build-tested > diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c > index 216871414434..d691afa8acf8 100644 > --- a/arch/powerpc/kernel/iommu.c > +++ b/arch/powerpc/kernel/iommu.c > @@ -180,12 +180,10 @@ static struct notifier_block fail_iommu_bus_notifier = { > >  static int __init fail_iommu_setup(void) >  { > -#ifdef CONFIG_PCI > -    bus_register_notifier(&pci_bus_type, &fail_iommu_bus_notifier); > -#endif > -#ifdef CONFIG_IBMVIO > -    bus_register_notifier(&vio_bus_type, &fail_iommu_bus_notifier); > -#endif > +    if (IS_ENABLED(CONFIG_PCI)) > +        bus_register_notifier(&pci_bus_type, &fail_iommu_bus_notifier); > +    if (IS_ENABLED(CONFIG_IBMVIO)) > +        bus_register_notifier(&vio_bus_type, &fail_iommu_bus_notifier); > >      return 0; >  } > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 86c799c97b77..361f4f255911 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -964,6 +964,8 @@ enum { >  #define PCI_IRQ_MSIX        (1 << 2) /* Allow MSI-X interrupts */ >  #define PCI_IRQ_AFFINITY    (1 << 3) /* Auto-assign affinity */ > > +extern struct bus_type pci_bus_type; > + >  /* These external functions are only available when PCI support is enabled */ >  #ifdef CONFIG_PCI > > @@ -986,8 +988,6 @@ enum pcie_bus_config_types { > >  extern enum pcie_bus_config_types pcie_bus_config; > > -extern struct bus_type pci_bus_type; > - >  /* Do NOT directly access these two variables, unless you are arch-specific PCI >   * code, or PCI core code. */ >  extern struct list_head pci_root_buses;    /* List of all known PCI buses */ -- ~Randy