Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3697936pxf; Mon, 5 Apr 2021 20:30:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiQTdTzOG12tKMKfkstlVhHWPEzMg6tanoIX3mKDGtR3IB56Ag3/lEuQM3KNONJRYHwz1h X-Received: by 2002:a05:6402:14cc:: with SMTP id f12mr36608092edx.19.1617679834658; Mon, 05 Apr 2021 20:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617679834; cv=none; d=google.com; s=arc-20160816; b=yEkzeYS9UHmZBj7x5SKcp6Gd2LXbzdfseKaHXvfMxoIDf7XpF0pDGVLeeuO9VO0zpk 8ViPpebuRuWow/AHmajBKLny21tCJ/hDBDg2a3HTQFJraD5Z5OfI65mRuNqo/RZPcobp j4fvTNXKHAjerX1aXZjlSJzsY4fE2DkZgIN2ztBgcZMsD7NlGfSwolZHBzKG1nBC+HxS sOBuBs3nIHupYJE4g4OArkW64nQDMacbpq+abNEjHq75Su2F8gwDdh3soUdK1BQ2IVxA 5CH8Jgx9Dwk7jQcbWIpCUrL4OxQI8uaL73a6dJGlJ3GuFGog/qDI1HItaGSgMd0K/1yn XFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=WlZlrre6xzixEo2giGUl6pFbTjNx7pniG1L/BRwxIwU=; b=dcjlKa7K3kaiXd6lGxfq0L/AqCJELoTGPKq15DJsM7oS70U3Q+xbNWNkmHTl02KW3F U/9VbLyVacceTjFfoBPat91fniw3WrwIxfoJMYE46tIoIBAjb3oROSzalwgQub3b9jMM 2uGIf9ej+0oY4qMP21E6Ki2MUF8Lv7/gtvHFXzIzG1O0TRQvw4Nx7XmFqmdQZdYi/7Sv v+4X8OtY4gqvgxnlMZDbEle5vBLNJx5pqR3JIp/zcBDol7Xk+r5KK4YMEubJ2LFwnHXc uagD8fb39jY53gATP2S2Lx+Eg3HklvqC5pvovzH+0KRj+qlj5bVGmaMRVyErrXuMX+/U bVAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tDA3jodw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si15427507ejk.685.2021.04.05.20.30.10; Mon, 05 Apr 2021 20:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tDA3jodw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242387AbhDEQc0 (ORCPT + 99 others); Mon, 5 Apr 2021 12:32:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238474AbhDEQc0 (ORCPT ); Mon, 5 Apr 2021 12:32:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA2C8C061756 for ; Mon, 5 Apr 2021 09:32:19 -0700 (PDT) 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 Cc: linuxppc-dev@lists.ozlabs.org, kernel test robot , Anton Blanchard 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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