Thanks, I have a copy now. And this one is relative to it:
---
Factor-out common aperture_valid code.
Signed-off-by: Pavel Machek <pavel@suse.cz>
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 02f4dba..5373f78 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -109,27 +109,6 @@ static u32 __init allocate_aperture(void
return (u32)__pa(p);
}
-static int __init aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
-{
- if (!aper_base)
- return 0;
-
- if (aper_base + aper_size > 0x100000000UL) {
- 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;
-}
/* Find a PCI capability */
static __u32 __init find_cap(int bus, int slot, int func, int cap)
@@ -344,7 +323,7 @@ out:
if (gart_fix_e820 && !fix && aper_enabled) {
if (!e820_all_mapped(aper_base, aper_base + aper_size,
E820_RESERVED)) {
- /* reserved it, so we can resuse it in second kernel */
+ /* reserve it, so we can reuse it in second kernel */
printk(KERN_INFO "update e820 for GART\n");
add_memory_region(aper_base, aper_size, E820_RESERVED);
update_e820();
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index fea1313..3b53ea0 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -228,24 +228,10 @@ static const struct agp_bridge_driver am
};
/* Some basic sanity checks for the aperture. */
-static int __devinit aperture_valid(u64 aper, u32 size)
+static int __devinit agp_aperture_valid(u64 aper, u32 size)
{
- if (aper == 0) {
- printk(KERN_ERR PFX "No aperture\n");
+ if (!aperture_valid(aper, size, ...On Tue, May 20, 2008 at 04:27:17PM +0200, Pavel Machek wrote:
> +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.
Dave
--
http://www.codemonkey.org.uk
--
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 --
On Tue, May 20, 2008 at 05:32:15PM +0200, Pavel Machek wrote: > > 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...? If you enable IOMMU, you _have_ to enable AGP. (well, you don't have to, it does a 'select AGP' for you when you enable it :-) It does this because the agpgart driver needs to know how much of the aperture has been stolen for IOMMU use, and I think it already uses some functions from that driver already. Dave -- http://www.codemonkey.org.uk --
That's actually not needed. The IOMMU code was carefully written to not require AGP. The only requirement it has is that if AGP is enabled it has to be built in. -Andi --
| Jesse Barnes | Re: [stable] [BUG][PATCH] cpqphp: fix kernel NULL pointer dereference |
| Greg KH | [003/136] p54usb: add Zcomax XG-705A usbid |
| Magnus Damm | [PATCH 03/07] ARM: Use shared GIC entry macros on Realview |
| Oliver Neukum | Re: [Bug #13682] The webcam stopped working when upgrading from 2.6.29 to 2.6.30 |
| Martin Schwidefsky | Re: [PATCH] optimized ktime_get[_ts] for GENERIC_TIME=y |
git: | |
| Junio C Hamano | Re: Some advanced index playing |
| Jeff King | Re: confusion over the new branch and merge config |
| Robin Rosenberg | Re: cvs2svn conversion directly to git ready for experimentation |
| Linus Torvalds | git binary size... |
| Ævar Arnfjörð Bjarmason | Re: Challenge with Git-Bash |
| Linux Kernel Mailing List | md: move allocation of ->queue from mddev_find to md_probe |
| Linux Kernel Mailing List | md: raid0: Represent zone->zone_offset in sectors. |
| Linux Kernel Mailing List | [ARM] S3C24XX: Add gpio_to_irq() facility |
| Linux Kernel Mailing List | md: rai |
