public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Dave Jones <davej@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: aperture_64: use symbolic constants
Date: Tue, 20 May 2008 17:32:15 +0200	[thread overview]
Message-ID: <20080520153215.GA5368@elf.ucw.cz> (raw)
In-Reply-To: <20080520150604.GD4843@redhat.com>

Hi!

>  > +static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
>  > +{
>  > +	if (!aper_base)
>  > +		return 0;
>  > +
>  > +	if (aper_base + aper_size > 0x100000000ULL) {
>  > +		printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n");
>  > +		return 0;
>  > +	}
>  > +	if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
>  > +		printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n");
>  > +		return 0;
>  > +	}
>  > +	if (aper_size < min_size) {
>  > +		printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n",
>  > +				 aper_size>>20, min_size>>20);
>  > +		return 0;
>  > +	}
>  > +
>  > +	return 1;
>  > +}
> 
> Instead of making this an inline, we could add it to the agpgart code
> and export it, and have the gart-iommu code call it.
> You can't build the IOMMU code without agpgart anyway, and having this inlined
> in both places seems a bit wasteful.
> Additionally, it would mean not having a function in a header file,
> which always strikes me as a wrong thing to do.

Can you elaborate? Yes, it would be nicer if this went to .c
somewhere, but aperture_64.c seems unsuitable (we need it on 32-bit,
too, right?)... plus it was __init in one place, and __devinit in the
other, so I figured out "inline it so that it works automagically".

Plus, I don't think it should go into drivers/agp, as iommu code in
arch/x86/kernel seems to be able to work without that...?

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2008-05-20 15:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-19 12:39 aperture_64: use symbolic constants Pavel Machek
2008-05-20 11:20 ` Andi Kleen
     [not found] ` <20080519125425.GD13546@elte.hu>
2008-05-20 14:27   ` Pavel Machek
2008-05-20 15:06     ` Dave Jones
2008-05-20 15:32       ` Pavel Machek [this message]
2008-05-20 15:42         ` Dave Jones
2008-05-21  1:23           ` Andi Kleen
2008-05-20 15:42     ` Ingo Molnar
2008-05-21  1:59       ` 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=20080520153215.GA5368@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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