All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Yinghai Lu <yinghai.lu@oracle.com>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Peter Jones <pjones@redhat.com>,
	Konrad Rzeszutek Wilk <konrad@kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH -v3] ibft: Fix finding IBFT ACPI table on UEFI
Date: Mon, 12 Dec 2011 12:17:40 -0500	[thread overview]
Message-ID: <20111212171740.GA26407@phenom.dumpdata.com> (raw)
In-Reply-To: <4EE12975.5090506@oracle.com>

On Thu, Dec 08, 2011 at 01:17:41PM -0800, Yinghai Lu wrote:
> 
> Found one system with UEFI/iBFT, kernel does not detect the iBFT during
> iscsi_ibft module loading.
> 
> Root cause: on x86 (UEFI), we are calling of find_ibft_region() much earlier
> 	- specifically in setup_arch() before ACPI is enabled.


I get this when compiling with make allmodconfig:

 BUILD   arch/x86/boot/bzImage
Setup is 16636 bytes (padded to 16896 bytes).
System is 4680 kB
CRC 88f70464
Kernel: arch/x86/boot/bzImage is ready  (#2)
ERROR: "acpi_table_parse" [drivers/firmware/iscsi_ibft.ko] undefined!
make[3]: *** [__modpost] Error 1
make[2]: *** [modules] Error 2


on 64-bit Fedora Core 16.

> 
> Try to split acpi checking code out and call that later
> 
> At that time ACPI iBFT already get permanent mapped with ioremap.
> So isa_virt_to_bus() will get wrong phys from right virt address.
> We could just skip that phys address printing.
> 
> For legacy one, print the found address early.
> 
> -v2: update comments and description according to Konrad.
> -v3: fix problem about module use case that is found by Konrad.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> ---
>  drivers/firmware/iscsi_ibft.c      |   43 +++++++++++++++++++++++++++++++++++--
>  drivers/firmware/iscsi_ibft_find.c |   26 +---------------------
>  2 files changed, 43 insertions(+), 26 deletions(-)
> 
> Index: linux-2.6/drivers/firmware/iscsi_ibft.c
> ===================================================================
> --- linux-2.6.orig/drivers/firmware/iscsi_ibft.c
> +++ linux-2.6/drivers/firmware/iscsi_ibft.c
> @@ -746,6 +746,38 @@ static void __exit ibft_exit(void)
>  	ibft_cleanup();
>  }
>  
> +#ifdef CONFIG_ACPI
> +static const struct {
> +	char *sign;
> +} ibft_signs[] = {
> +	/*
> +	 * One spec says "IBFT", the other says "iBFT". We have to check
> +	 * for both.
> +	 */
> +	{ ACPI_SIG_IBFT },
> +	{ "iBFT" },
> +};
> +
> +static int __init acpi_find_ibft(struct acpi_table_header *header)
> +{
> +	ibft_addr = (struct acpi_table_ibft *)header;
> +
> +	return 0;
> +}
> +
> +static void __init acpi_find_ibft_region(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++)
> +		acpi_table_parse(ibft_signs[i].sign, acpi_find_ibft);
> +}
> +#else
> +static void __init acpi_find_ibft_region(void)
> +{
> +}
> +#endif
> +
>  /*
>   * ibft_init() - creates sysfs tree entries for the iBFT data.
>   */
> @@ -753,9 +785,16 @@ static int __init ibft_init(void)
>  {
>  	int rc = 0;
>  
> +	/*
> +	   As on UEFI systems the setup_arch()/find_ibft_region()
> +	   is called before ACPI tables are parsed and it only does
> +	   legacy finding.
> +	*/
> +	if (!ibft_addr)
> +		acpi_find_ibft_region();
> +
>  	if (ibft_addr) {
> -		printk(KERN_INFO "iBFT detected at 0x%llx.\n",
> -		       (u64)isa_virt_to_bus(ibft_addr));
> +		pr_info("iBFT detected.\n");
>  
>  		rc = ibft_check_device();
>  		if (rc)
> Index: linux-2.6/drivers/firmware/iscsi_ibft_find.c
> ===================================================================
> --- linux-2.6.orig/drivers/firmware/iscsi_ibft_find.c
> +++ linux-2.6/drivers/firmware/iscsi_ibft_find.c
> @@ -45,13 +45,6 @@ EXPORT_SYMBOL_GPL(ibft_addr);
>  static const struct {
>  	char *sign;
>  } ibft_signs[] = {
> -#ifdef CONFIG_ACPI
> -	/*
> -	 * One spec says "IBFT", the other says "iBFT". We have to check
> -	 * for both.
> -	 */
> -	{ ACPI_SIG_IBFT },
> -#endif
>  	{ "iBFT" },
>  	{ "BIFT" },	/* Broadcom iSCSI Offload */
>  };
> @@ -62,14 +55,6 @@ static const struct {
>  #define VGA_MEM 0xA0000 /* VGA buffer */
>  #define VGA_SIZE 0x20000 /* 128kB */
>  
> -#ifdef CONFIG_ACPI
> -static int __init acpi_find_ibft(struct acpi_table_header *header)
> -{
> -	ibft_addr = (struct acpi_table_ibft *)header;
> -	return 0;
> -}
> -#endif /* CONFIG_ACPI */
> -
>  static int __init find_ibft_in_mem(void)
>  {
>  	unsigned long pos;
> @@ -94,6 +79,7 @@ static int __init find_ibft_in_mem(void)
>  				 * the table cannot be valid. */
>  				if (pos + len <= (IBFT_END-1)) {
>  					ibft_addr = (struct acpi_table_ibft *)virt;
> +					pr_info("iBFT found at 0x%lx.\n", pos);
>  					goto done;
>  				}
>  			}
> @@ -108,20 +94,12 @@ done:
>   */
>  unsigned long __init find_ibft_region(unsigned long *sizep)
>  {
> -#ifdef CONFIG_ACPI
> -	int i;
> -#endif
>  	ibft_addr = NULL;
>  
> -#ifdef CONFIG_ACPI
> -	for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++)
> -		acpi_table_parse(ibft_signs[i].sign, acpi_find_ibft);
> -#endif /* CONFIG_ACPI */
> -
>  	/* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will
>  	 * only use ACPI for this */
>  
> -	if (!ibft_addr && !efi_enabled)
> +	if (!efi_enabled)
>  		find_ibft_in_mem();
>  
>  	if (ibft_addr) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2011-12-12 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08  8:22 [PATCH] ibft: Fix finding ibft with ACPI tables Yinghai Lu
2011-12-08 14:29 ` Konrad Rzeszutek Wilk
2011-12-08 15:01   ` Peter Jones
2011-12-08 16:51   ` Yinghai Lu
2011-12-08 16:52   ` [PATCH -v2] ibft: Fix finding IBFT ACPI table on UEFI Yinghai Lu
2011-12-08 19:08     ` Konrad Rzeszutek Wilk
2011-12-08 21:16       ` Yinghai Lu
2011-12-08 21:17       ` [PATCH -v3] " Yinghai Lu
2011-12-12 17:17         ` Konrad Rzeszutek Wilk [this message]
2011-12-12 20:39           ` Yinghai Lu

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=20111212171740.GA26407@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=konrad@darnok.org \
    --cc=konrad@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pjones@redhat.com \
    --cc=yinghai.lu@oracle.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.