All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Yanko Kaneti <yaneti@declera.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Renninger <trenn@suse.de>,
	maciej.rutecki@gmail.com
Subject: Re: [PATCH v1 2/3] x86/PCI: trim _CRS windows when they conflict with	previous reservations
Date: Wed, 17 Mar 2010 12:25:45 +0900	[thread overview]
Message-ID: <4BA04BB9.2090501@jp.fujitsu.com> (raw)
In-Reply-To: <20100312000114.4355.58189.stgit@bob.kio>

Bjorn Helgaas wrote:
> Yanko's GA-MA78GM-S2H (BIOS F11) reports a host bridge window that overlaps
> system memory:
> 
>     PCI window: [mem 0xcff00000-0x10ed0ffff]
>     System RAM: [mem 0x100000000-0x22fffffff]
> 
> We can be pretty confident that the System RAM region is correct (if it
> were wrong, we'd crash as soon as we tried to use any memory in that area),
> so this patch tries to correct the PCI window by trimming it so it doesn't
> conflict with any previous reservations.
> 

Though I might misunderstand something, it looks Yanko's machine specific
workaround. I'm wondering if trimming _CRS is a generic workaround for
broken _CRS machine.

How about doing this when GA-MA78GM-S2H (BIOS F11) (and known machines
that have the same problem) is detected? Or how about switching nocrs
mode if the problem (resource conflict) is detected?

Thanks,
Kenji Kaneshige



> http://bugzilla.kernel.org/show_bug.cgi?id=15480
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> Reported-by: Yanko Kaneti <yaneti@declera.com>
> ---
> 
>  arch/x86/pci/acpi.c |   48 +++++++++++++++++++++++++++++++++++-------------
>  1 files changed, 35 insertions(+), 13 deletions(-)
> 
> 
> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> index 6e22454..d255ce8 100644
> --- a/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -114,11 +114,19 @@ align_resource(struct acpi_device *bridge, struct resource *res)
>  	}
>  }
>  
> +static bool
> +resource_contains(struct resource *res, resource_size_t n)
> +{
> +	if (n < res->start || n > res->end)
> +		return false;
> +	return true;
> +}
> +
>  static acpi_status
>  setup_resource(struct acpi_resource *acpi_res, void *data)
>  {
>  	struct pci_root_info *info = data;
> -	struct resource *res;
> +	struct resource *res, *conflict;
>  	struct acpi_resource_address64 addr;
>  	acpi_status status;
>  	unsigned long flags;
> @@ -157,21 +165,35 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
>  		return AE_OK;
>  	}
>  
> -	if (insert_resource(root, res)) {
> +	conflict = insert_resource_conflict(root, res);
> +	while (conflict) {
>  		dev_err(&info->bridge->dev,
> -			"can't allocate host bridge window %pR\n", res);
> -	} else {
> -		pci_bus_add_resource(info->bus, res, 0);
> -		info->res_num++;
> -		if (addr.translation_offset)
> -			dev_info(&info->bridge->dev, "host bridge window %pR "
> -				 "(PCI address [%#llx-%#llx])\n",
> -				 res, res->start - addr.translation_offset,
> -				 res->end - addr.translation_offset);
> +		        "host bridge window %pR conflicts with %s %pR\n",
> +			res, conflict->name, conflict);
> +
> +		if (resource_contains(res, conflict->end))
> +			res->start = conflict->end + 1;
> +		else if (resource_contains(res, conflict->start))
> +			res->end = conflict->start - 1;
>  		else
> -			dev_info(&info->bridge->dev,
> -				 "host bridge window %pR\n", res);
> +			return AE_OK;
> +
> +		if (res->start >= res->end)
> +			return AE_OK;
> +
> +		conflict = insert_resource_conflict(root, res);
>  	}
> +
> +	pci_bus_add_resource(info->bus, res, 0);
> +	info->res_num++;
> +	if (addr.translation_offset)
> +		dev_info(&info->bridge->dev, "host bridge window %pR "
> +			 "(PCI address [%#llx-%#llx])\n",
> +			 res, res->start - addr.translation_offset,
> +			 res->end - addr.translation_offset);
> +	else
> +		dev_info(&info->bridge->dev,
> +			 "host bridge window %pR\n", res);
>  	return AE_OK;
>  }
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 



  reply	other threads:[~2010-03-17  3:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12  0:01 [PATCH v1 0/3] [RFC] resource, PCI: work around pci=use_crs conflicts Bjorn Helgaas
2010-03-12  0:01 ` [PATCH v1 1/3] resources: add interfaces that return conflict information Bjorn Helgaas
2010-03-19 20:46   ` Jesse Barnes
2010-03-12  0:01 ` [PATCH v1 2/3] x86/PCI: trim _CRS windows when they conflict with previous reservations Bjorn Helgaas
2010-03-17  3:25   ` Kenji Kaneshige [this message]
2010-03-17  4:22     ` Bjorn Helgaas
2010-03-17  8:47       ` Kenji Kaneshige
2010-03-17 13:15         ` Bjorn Helgaas
2010-03-12  0:01 ` [PATCH v1 3/3] PCI: for address space collisions, show conflicting resource Bjorn Helgaas
2010-03-12 14:49 ` [PATCH v1 0/3] [RFC] resource, PCI: work around pci=use_crs conflicts Yanko Kaneti
2010-03-16 19:59 ` Bjorn Helgaas

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=4BA04BB9.2090501@jp.fujitsu.com \
    --to=kaneshige.kenji@jp.fujitsu.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=maciej.rutecki@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    --cc=trenn@suse.de \
    --cc=yaneti@declera.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.