mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <muli@il.ibm.com>
To: Jan Beulich <jbeulich@novell.com>
Cc: linux-kernel@vger.kernel.org, mark.langsdorf@amd.com
Subject: Re: [PATCH] fix amd64-agp aperture validation
Date: Thu, 29 Mar 2007 19:08:55 +0200	[thread overview]
Message-ID: <20070329170855.GA3984@rhun.haifa.ibm.com> (raw)
In-Reply-To: <460B8DA8.76E4.0078.0@novell.com>

On Thu, Mar 29, 2007 at 08:58:00AM +0100, Jan Beulich wrote:

> Under CONFIG_DISCONTIGMEM, assuming that a !pfn_valid() implies all
> subsequent pfn-s are also invalid is wrong. Thus replace this by
> explicitly checking against the E820 map.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Acked-by: Mark Langsdorf <mark.langsdorf@amd.com>
> 
> --- linux-2.6.21-rc5/drivers/char/agp/amd64-agp.c	2007-03-26 15:20:14.000000000 +0200
> +++ 2.6.21-rc5-amd64-agp/drivers/char/agp/amd64-agp.c	2007-03-28 15:20:49.000000000 +0200
> @@ -14,6 +14,7 @@
>  #include <linux/agp_backend.h>
>  #include <linux/mmzone.h>
>  #include <asm/page.h>		/* PAGE_SIZE */
> +#include <asm/e820.h>
>  #include <asm/k8.h>
>  #include "agp.h"
>  
> @@ -259,7 +260,6 @@ static const struct agp_bridge_driver am
>  /* Some basic sanity checks for the aperture. */
>  static int __devinit aperture_valid(u64 aper, u32 size)
>  {
> -	u32 pfn, c;
>  	if (aper == 0) {
>  		printk(KERN_ERR PFX "No aperture\n");
>  		return 0;
> @@ -272,14 +272,9 @@ static int __devinit aperture_valid(u64 
>  		printk(KERN_ERR PFX "Aperture out of bounds\n");
>  		return 0;
>  	}
> -	pfn = aper >> PAGE_SHIFT;
> -	for (c = 0; c < size/PAGE_SIZE; c++) {
> -		if (!pfn_valid(pfn + c))
> -			break;
> -		if (!PageReserved(pfn_to_page(pfn + c))) {
> -			printk(KERN_ERR PFX "Aperture pointing to RAM\n");
> -			return 0;
> -		}
> +	if (e820_any_mapped(aper, aper + size, E820_RAM)) {
> +		printk(KERN_ERR PFX "Aperture pointing to RAM\n");
> +		return 0;
>  	}

This pretty much duplicates the checking done in
arch/x86-64/kernel/aperture.c:aperture_valid(), with slight variations
(e.g., 32MB vs. 64MB aperture size). Should these two functions be
consolidated?

Cheers,
Muli

      parent reply	other threads:[~2007-03-29 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-29  7:58 Jan Beulich
2007-03-29 10:00 ` [patches] " Andi Kleen
2007-03-29 17:08 ` Muli Ben-Yehuda [this message]

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=20070329170855.GA3984@rhun.haifa.ibm.com \
    --to=muli@il.ibm.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®