All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: "Zheng, Lv" <lv.zheng@intel.com>
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"Brown, Len" <len.brown@intel.com>, Lv Zheng <zetalog@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Len Brown <lenb@kernel.org>, "Tang, Feng" <feng.tang@intel.com>,
	"sfi-devel@simplefirmware.org" <sfi-devel@simplefirmware.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v3 5/6] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - acpi_disabled linkage.
Date: Mon, 9 Dec 2013 16:15:15 -0700	[thread overview]
Message-ID: <20131209231515.GA4699@google.com> (raw)
In-Reply-To: <1AE640813FDE7649BE1B193DEA596E88024950DB@SHSMSX101.ccr.corp.intel.com>

On Fri, Dec 06, 2013 at 02:53:00PM +0000, Zheng, Lv wrote:
> Hi,
> 
> > From: Zheng, Lv
> > Sent: Friday, December 06, 2013 4:52 PM
> > To: Wysocki, Rafael J; Brown, Len
> > 
> > In Linux kernel, ACPICA is wrapped and safely exported by CONFIG_ACPI.  So
> > all external modules should depend on CONFIG_ACPI rather than using ACPICA
> > header directly for stubbing.  But if we moves <acpi/acpi.h> inclusions
> > into "#ifdef CONFIG_ACPI", build breakge can help to detect wrong ACPICA
> > dependent modules.
> > 
> > One of the build breakage is:
> > arch/x86/pci/mmconfig-shared.c:389:1: error: unknown type name 'acpi_status'
> > arch/x86/pci/mmconfig-shared.c:389:47: warning: 'struct acpi_resource' declared inside parameter list [enabled by default]
> > arch/x86/pci/mmconfig-shared.c:389:47: warning: its scope is only this definition or declaration, which is probably not what you want
> > [enabled by default]
> > arch/x86/pci/mmconfig-shared.c: In function 'check_mcfg_resource':
> > arch/x86/pci/mmconfig-shared.c:392:33: error: storage size of 'address' isn't known
> > arch/x86/pci/mmconfig-shared.c:393:2: error: unknown type name 'acpi_status'
> > arch/x86/pci/mmconfig-shared.c:395:9: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:395:19: error: 'ACPI_RESOURCE_TYPE_FIXED_MEMORY32' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c:395:19: note: each undeclared identifier is reported only once for each function it appears in
> > arch/x86/pci/mmconfig-shared.c:397:8: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:399:11: error: 'AE_OK' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c:400:35: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:401:33: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:402:19: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:404:11: error: 'AE_CTRL_TERMINATE' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c:407:10: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:407:20: error: 'ACPI_RESOURCE_TYPE_ADDRESS32' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c:408:10: error: dereferencing pointer to incomplete type
> > arch/x86/pci/mmconfig-shared.c:408:20: error: 'ACPI_RESOURCE_TYPE_ADDRESS64' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c:411:2: error: implicit declaration of function 'acpi_resource_to_address64' [-Werror=implicit-
> > function-declaration]
> > arch/x86/pci/mmconfig-shared.c:412:2: error: implicit declaration of function 'ACPI_FAILURE' [-Werror=implicit-function-declaration]
> > arch/x86/pci/mmconfig-shared.c:414:31: error: 'ACPI_MEMORY_RANGE' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c:392:33: warning: unused variable 'address' [-Wunused-variable]
> > arch/x86/pci/mmconfig-shared.c: At top level:
> > arch/x86/pci/mmconfig-shared.c:425:1: error: unknown type name 'acpi_status'
> > arch/x86/pci/mmconfig-shared.c:425:41: error: unknown type name 'acpi_handle'
> > arch/x86/pci/mmconfig-shared.c: In function 'is_acpi_reserved':
> > arch/x86/pci/mmconfig-shared.c:447:2: error: implicit declaration of function 'acpi_get_devices' [-Werror=implicit-function-
> > declaration]
> > arch/x86/pci/mmconfig-shared.c:447:30: error: 'find_mboard_resource' undeclared (first use in this function)
> > arch/x86/pci/mmconfig-shared.c: At top level:
> > arch/x86/pci/mmconfig-shared.c:389:20: warning: 'check_mcfg_resource' defined but not used [-Wunused-function]
> 
> Let me say something about this error messages.  Someone may face difficulties to reproduce it.
> Currently, this message cannot be seen in any kernel build.
> This is because this patch series doesn't include a fix to remove <acpi/acpi.h> inclusion from linux/sfi_acpi.h.
> To achieve this, I have offered 2 options:
> 1. Redefining ACPICA table stuff for CONFIG_ACPI=n environment, or
> 2. Implementing stubs for all ACPICA functions/globals/macros and introducing <linux/acpica.h> (where acpi/acpi.h is included) as a top level header.
> 3. Other solutions...
> 
> If we choose solution 1, then this issue is exposed by a build test where CONFIG_ACPI=n and CONFIG_SFI=y.
> Since we haven't decided what to do for the table structures and it is really not a good approach to achieve the build safety for mmconfig-share.c by relying on link-stage optimization rather than compile-stage referencing.  IMO, we need to sort it out, thus I make it a part of this patchset.
> 
> Well, if we choose solution 2, this patch can only help to reduce the size of the kernel image.

OK, I assume you will make sure one of these fixes gets merged before the
change that causes the breakage, so bisection continues to work.
Therefore, I think it's best if both changes are merged through the same
tree, and I won't apply this via the PCI tree.  Let me know if you need me
to do something.

Bjorn

> > 
> > The root cause of this breakage is:
> > 1. The following commit doesn't protect ACPICA functions like
> >    acpi_get_devices()/acpi_walk_resources()/acpi_resource_to_address64() in
> >    CONFIG_SFI=y and CONFIG_ACPI=n environment:
> >     Commit: 5f0db7a2fb78895a197f64e548333b3bbd433996
> >     Author: Feng Tang <feng.tang@intel.com>
> >     Subject: SFI: Hook PCI MMCONFIG
> >     First check ACPI, and if that fails, ask SFI to find the MCFG.
> >    So it actually depends on the logic that in !CONFIG_ACPI builds, code
> >    blocks under "if (!acpi_disabled)" will not be linked in.
> > 
> > This patch fixes this issue by introducing a stub for MCFG entry checker
> > is_acpi_reserved() in !CONFIG_ACPI builds.
> > 
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: Feng Tang <feng.tang@intel.com>
> > Cc: sfi-devel@simplefirmware.org
> > Cc: linux-pci@vger.kernel.org
> > ---
> >  arch/x86/pci/mmconfig-shared.c |    7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
> > index 248642f..2c04b22 100644
> > --- a/arch/x86/pci/mmconfig-shared.c
> > +++ b/arch/x86/pci/mmconfig-shared.c
> > @@ -369,6 +369,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
> >  	return !list_empty(&pci_mmcfg_list);
> >  }
> > 
> > +#ifdef CONFIG_ACPI
> >  static acpi_status check_mcfg_resource(struct acpi_resource *res, void *data)
> >  {
> >  	struct resource *mcfg_res = data;
> > @@ -435,6 +436,12 @@ static int is_acpi_reserved(u64 start, u64 end, unsigned not_used)
> > 
> >  	return mcfg_res.flags;
> >  }
> > +#else
> > +static inline int is_acpi_reserved(u64 start, u64 end, unsigned not_used)
> > +{
> > +	return 0;
> > +}
> > +#endif
> > 
> >  typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type);
> > 
> > --
> > 1.7.10
> 

  reply	other threads:[~2013-12-09 23:15 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 23:26 [PATCH 0/4] ACPI: Cleanup header inclusions Lv Zheng
2013-11-22 23:26 ` Lv Zheng
2013-11-22 23:27 ` [PATCH 1/4] ACPICA: Linux: Cleanup wrong ACPICA inclusions Lv Zheng
2013-11-22 23:27   ` Lv Zheng
2013-11-25 23:54   ` Rafael J. Wysocki
2013-11-22 23:29 ` [PATCH 2/4] ACPI: Cleanup <acpi/acpi_bus.h> and <acpi/acpi_drivers.h> inclusions Lv Zheng
2013-11-22 23:29   ` Lv Zheng
2013-11-26  0:06   ` Rafael J. Wysocki
2013-11-26  0:29     ` Zheng, Lv
2013-11-26  0:29       ` Zheng, Lv
2013-11-22 23:32 ` [PATCH 3/4] ACPICA: Cleanup <acpi/acpi.h> inclusions Lv Zheng
2013-11-22 23:32   ` Lv Zheng
2013-11-22 23:37 ` [PATCH 4/4] ACPI: Add support to force header inclusion rules for <linux/acpi.h> Lv Zheng
2013-11-22 23:37   ` Lv Zheng
2013-11-26  0:09   ` [UPDATE PATCH " Rafael J. Wysocki
2013-11-26  0:32     ` Zheng, Lv
2013-11-26  0:32       ` Zheng, Lv
2013-11-26  5:21 ` [PATCH v2] ACPI: Cleanup <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h> inclusions Lv Zheng
2013-11-26 20:29   ` Rafael J. Wysocki
2013-11-26 20:27     ` Matthew Garrett
2013-11-26 20:29     ` Konrad Rzeszutek Wilk
2013-11-27  0:29       ` Rafael J. Wysocki
2013-11-28  1:12         ` Zheng, Lv
2013-11-28  1:12           ` Zheng, Lv
2013-11-28  2:34       ` Zheng, Lv
2013-11-26 20:54     ` Greg Kroah-Hartman
2013-11-28  0:54     ` Zheng, Lv
2013-11-28  0:54       ` Zheng, Lv
2013-11-28 14:18     ` Rafael J. Wysocki
2013-12-03 23:57       ` Rafael J. Wysocki
2013-12-04  3:31         ` Zheng, Lv
2013-12-04  3:31           ` Zheng, Lv
2013-11-26 21:07   ` Bjorn Helgaas
2013-12-04  0:41 ` [UPDTE PATCH 0/3] ACPI: Cleanup direct ACPICA inclusions Lv Zheng
2013-12-04  0:41   ` Lv Zheng
2013-12-04  0:38   ` [PATCH 1/3] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module Lv Zheng
2013-12-04  0:38     ` Lv Zheng
2013-12-04  8:16     ` [Intel-gfx] " Daniel Vetter
2013-12-05 13:04     ` Jani Nikula
2013-12-05 13:04       ` [Intel-gfx] " Jani Nikula
2013-12-04  0:38   ` [PATCH 2/3] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - acpi_disabled linkage Lv Zheng
2013-12-04  0:38     ` Lv Zheng
2013-12-04  0:38   ` [RFC PATCH 3/3] ACPI/IBFT: Fix wrong <acpi/acpi.h> inclusion in iSCSI boot firmware module Lv Zheng
2013-12-04  0:38     ` Lv Zheng
2013-12-05 14:25 ` [PATCH v2] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module Lv Zheng
2013-12-05 14:25   ` Lv Zheng
2013-12-06  8:51 ` [PATCH v3 0/6] ACPI: Cleanup header inclusions Lv Zheng
2013-12-06  8:51   ` Lv Zheng
2013-12-06  8:51   ` [PATCH v3 1/6] ACPI: Clean up incorrect inclusions of ACPICA headers Lv Zheng
2013-12-06  8:51     ` Lv Zheng
2013-12-06  8:51   ` [PATCH v3 2/6] ACPI: Clean up inclusions of ACPI header files Lv Zheng
2013-12-06  8:51     ` Lv Zheng
2013-12-06 14:31     ` Konrad Rzeszutek Wilk
2013-12-06  8:51   ` [PATCH v3 3/6] SFI: Fix warnings reported by W=1 builds Lv Zheng
2013-12-06  8:51     ` Lv Zheng
2013-12-06  8:52   ` [PATCH v3 4/6] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module Lv Zheng
2013-12-06  8:52     ` Lv Zheng
2013-12-06  8:52   ` [PATCH v3 5/6] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - acpi_disabled linkage Lv Zheng
2013-12-06  8:52     ` Lv Zheng
2013-12-06 14:53     ` Zheng, Lv
2013-12-09 23:15       ` Bjorn Helgaas [this message]
2013-12-12  1:38         ` Rafael J. Wysocki
2013-12-06  8:52   ` [PATCH v3 6/6] ACPI/IBFT: Fix wrong <acpi/acpi.h> inclusion in iSCSI boot firmware module Lv Zheng
2013-12-06  8:52     ` Lv Zheng
2013-12-06 15:01     ` Zheng, Lv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131209231515.GA4699@google.com \
    --to=bhelgaas@google.com \
    --cc=feng.tang@intel.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=sfi-devel@simplefirmware.org \
    --cc=zetalog@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.