From: "H. Peter Anvin" <hpa@linux.intel.com>
To: Matthew Wilcox <matthew@wil.cx>,
Jesse Barnes <jbarnes@virtuousgeek.org>, Martin Mares <mj@ucw.cz>,
LKML <linux-kernel@vger.kernel.org>,
linux-pci@vger.kernel.orgthe
Subject: RFC: x86: cap iomem_resource to addressable physical memory
Date: Tue, 09 Jun 2009 18:32:53 -0700 [thread overview]
Message-ID: <4A2F0D45.2040602@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
x86 cannot generate full 64-bit addresses; this patch clamps iomem
addresses to the accessible range.
I wanted to post it for review before committing it, however; comments
would be appreciated, especially of the kind "this is done too early/too
late/in the wrong place/incorrectly".
-hpa
[-- Attachment #2: 0001-x86-cap-iomem_resource-to-addressable-physical-memo.patch --]
[-- Type: text/x-patch, Size: 1415 bytes --]
From 8dd8d59d1d1586b350401d6a5f8c7a9e30f142d4 Mon Sep 17 00:00:00 2001
From: H. Peter Anvin <hpa@zytor.com>
Date: Tue, 9 Jun 2009 18:20:39 -0700
Subject: [PATCH] x86: cap iomem_resource to addressable physical memory
iomem_resource is by default initialized to -1, which means 64 bits of
physical address space if 64-bit resources are enabled. However, x86
CPUs cannot address 64 bits of physical address space. Thus, we want
to cap the physical address space to what the union of all CPU can
actually address.
Without this patch, we may end up assigning inaccessible values to
uninitialized 64-bit PCI memory resources.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Martin Mares <mj@ucw.cz>
Cc: stable@kernel.org
---
arch/x86/kernel/cpu/common.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 77848d9..de8a49c 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -839,6 +839,9 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
numa_add_cpu(smp_processor_id());
#endif
+
+ /* Cap the iomem address space to what is addressable on all CPUs */
+ iomem_resource.end &= (1ULL << c->x86_phys_bits) - 1;
}
#ifdef CONFIG_X86_64
--
1.6.0.6
WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@linux.intel.com>
To: Matthew Wilcox <matthew@wil.cx>,
Jesse Barnes <jbarnes@virtuousgeek.org>, Martin Mares <mj@ucw.cz>,
LKML <linux-kernel@vger.kernel.org>,
linux-pci@vger.kernel.org,
the arch/x86 maintainers <x86@kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
linux-arch@vger.kernel.org
Subject: RFC: x86: cap iomem_resource to addressable physical memory
Date: Tue, 09 Jun 2009 18:32:53 -0700 [thread overview]
Message-ID: <4A2F0D45.2040602@linux.intel.com> (raw)
Message-ID: <20090610013253.Wwibm_5VVthfKwv65GQfYtI1ZImr1QvwEagPZNIlfB4@z> (raw)
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
x86 cannot generate full 64-bit addresses; this patch clamps iomem
addresses to the accessible range.
I wanted to post it for review before committing it, however; comments
would be appreciated, especially of the kind "this is done too early/too
late/in the wrong place/incorrectly".
-hpa
[-- Attachment #2: 0001-x86-cap-iomem_resource-to-addressable-physical-memo.patch --]
[-- Type: text/x-patch, Size: 1415 bytes --]
From 8dd8d59d1d1586b350401d6a5f8c7a9e30f142d4 Mon Sep 17 00:00:00 2001
From: H. Peter Anvin <hpa@zytor.com>
Date: Tue, 9 Jun 2009 18:20:39 -0700
Subject: [PATCH] x86: cap iomem_resource to addressable physical memory
iomem_resource is by default initialized to -1, which means 64 bits of
physical address space if 64-bit resources are enabled. However, x86
CPUs cannot address 64 bits of physical address space. Thus, we want
to cap the physical address space to what the union of all CPU can
actually address.
Without this patch, we may end up assigning inaccessible values to
uninitialized 64-bit PCI memory resources.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Martin Mares <mj@ucw.cz>
Cc: stable@kernel.org
---
arch/x86/kernel/cpu/common.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 77848d9..de8a49c 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -839,6 +839,9 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
numa_add_cpu(smp_processor_id());
#endif
+
+ /* Cap the iomem address space to what is addressable on all CPUs */
+ iomem_resource.end &= (1ULL << c->x86_phys_bits) - 1;
}
#ifdef CONFIG_X86_64
--
1.6.0.6
next reply other threads:[~2009-06-10 1:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 1:32 H. Peter Anvin [this message]
2009-06-10 1:32 ` RFC: x86: cap iomem_resource to addressable physical memory H. Peter Anvin
2009-06-11 19:17 ` Jesse Barnes
2009-06-11 19:17 ` Jesse Barnes
2009-06-11 20:43 ` Yinghai Lu
2009-06-11 20:46 ` H. Peter Anvin
2009-06-11 20:46 ` H. Peter Anvin
2009-06-21 6:42 ` Pavel Machek
2009-06-21 6:42 ` Pavel Machek
2009-06-21 7:40 ` H. Peter Anvin
2009-06-21 20:55 ` Pavel Machek
2009-06-21 20:55 ` Pavel Machek
2009-06-22 7:54 ` H. Peter Anvin
2009-06-22 7:54 ` H. Peter Anvin
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=4A2F0D45.2040602@linux.intel.com \
--to=hpa@linux.intel.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.orgthe \
--cc=matthew@wil.cx \
--cc=mj@ucw.cz \
/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