* [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed
@ 2007-07-05 22:27 Aaron Durbin
2007-07-06 10:59 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Aaron Durbin @ 2007-07-05 22:27 UTC (permalink / raw)
To: linux-kernel; +Cc: ak, akpm, matthias.lenk
Insert HPET resources after pci probing has been completed in order to avoid
resource conflicts with PCI resource reservation. With this change the
HPET firmware resources will be identified, but it should also not cause
issues when the HPET address falls on a BAR in a PCI device, and the PCI
enumeration cannot reserve the resources.
Signed-off-by: Aaron Durbin <adurbin@google.com>
---
arch/i386/kernel/acpi/boot.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index a574cd2..ca12b84 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -618,6 +618,8 @@ static int __init acpi_parse_sbf(struct
#ifdef CONFIG_HPET_TIMER
#include <asm/hpet.h>
+static struct __initdata resource *hpet_res;
+
static int __init acpi_parse_hpet(struct acpi_table_header *table)
{
struct acpi_table_hpet *hpet_tbl;
@@ -638,8 +640,42 @@ static int __init acpi_parse_hpet(struct
printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
hpet_tbl->id, hpet_address);
+ /*
+ * Allocate and initialize the HPET firmware resource for adding into
+ * the resource tree during the lateinit timeframe.
+ */
+#define HPET_RESOURCE_NAME_SIZE 9
+ hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
+
+ if (!hpet_res)
+ return 0;
+
+ memset(hpet_res, 0, sizeof(*hpet_res));
+ hpet_res->name = (void *)&hpet_res[1];
+ hpet_res->flags = IORESOURCE_MEM;
+ snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, "HPET %u",
+ hpet_tbl->sequence);
+
+ hpet_res->start = hpet_address;
+ hpet_res->end = hpet_address + (1 * 1024) - 1;
+
return 0;
}
+
+/*
+ * hpet_insert_resource inserts the HPET resources used into the resource
+ * tree.
+ */
+static __init int hpet_insert_resource(void)
+{
+ if (!hpet_res)
+ return 1;
+
+ return insert_resource(&iomem_resource, hpet_res);
+}
+
+late_initcall(hpet_insert_resource);
+
#else
#define acpi_parse_hpet NULL
#endif
--
1.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed
2007-07-05 22:27 [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed Aaron Durbin
@ 2007-07-06 10:59 ` Andi Kleen
2007-07-06 11:09 ` Matthias Lenk
2007-07-06 12:45 ` Aaron Durbin
0 siblings, 2 replies; 5+ messages in thread
From: Andi Kleen @ 2007-07-06 10:59 UTC (permalink / raw)
To: Aaron Durbin; +Cc: linux-kernel, akpm, matthias.lenk
On Friday 06 July 2007 00:27:24 Aaron Durbin wrote:
>
> Insert HPET resources after pci probing has been completed in order to avoid
> resource conflicts with PCI resource reservation. With this change the
> HPET firmware resources will be identified, but it should also not cause
> issues when the HPET address falls on a BAR in a PCI device, and the PCI
> enumeration cannot reserve the resources.
But what advantage does it have when it's already reserved by PCI?
That's only a cosmetic change, isn't it? A lot of code for cosmetics.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed
2007-07-06 10:59 ` Andi Kleen
@ 2007-07-06 11:09 ` Matthias Lenk
2007-07-09 14:07 ` Matthias Lenk
2007-07-06 12:45 ` Aaron Durbin
1 sibling, 1 reply; 5+ messages in thread
From: Matthias Lenk @ 2007-07-06 11:09 UTC (permalink / raw)
To: Andi Kleen; +Cc: Aaron Durbin, linux-kernel, akpm
Aaron, I tested the patch on my affected system and unfortunately it did
not work. The BAR1 resource still gets overridden and hence the same
effects as before.
Thanks,
Matthias
Andi Kleen wrote:
> On Friday 06 July 2007 00:27:24 Aaron Durbin wrote:
>
>> Insert HPET resources after pci probing has been completed in order to avoid
>> resource conflicts with PCI resource reservation. With this change the
>> HPET firmware resources will be identified, but it should also not cause
>> issues when the HPET address falls on a BAR in a PCI device, and the PCI
>> enumeration cannot reserve the resources.
>>
>
> But what advantage does it have when it's already reserved by PCI?
>
> That's only a cosmetic change, isn't it? A lot of code for cosmetics.
>
> -Andi
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed
2007-07-06 10:59 ` Andi Kleen
2007-07-06 11:09 ` Matthias Lenk
@ 2007-07-06 12:45 ` Aaron Durbin
1 sibling, 0 replies; 5+ messages in thread
From: Aaron Durbin @ 2007-07-06 12:45 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, akpm, matthias.lenk
On 7/6/07, Andi Kleen <ak@suse.de> wrote:
> On Friday 06 July 2007 00:27:24 Aaron Durbin wrote:
> >
> > Insert HPET resources after pci probing has been completed in order to avoid
> > resource conflicts with PCI resource reservation. With this change the
> > HPET firmware resources will be identified, but it should also not cause
> > issues when the HPET address falls on a BAR in a PCI device, and the PCI
> > enumeration cannot reserve the resources.
>
> But what advantage does it have when it's already reserved by PCI?
>
> That's only a cosmetic change, isn't it? A lot of code for cosmetics.
>
To my knowledge, not every machine has the HPET live on a BAR in PCI space. It
is cosmetic, but it shows what devices are using what memory address space in
/proc/iomem so one doesn't need to dig through dmesg to piece things together.
I am going to work w/ Matthias to see if we can get a patch working with his
system. I think that it is beneficial to easily view where resources are being
used, but I do understand the prudence.
-Aaron
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed
2007-07-06 11:09 ` Matthias Lenk
@ 2007-07-09 14:07 ` Matthias Lenk
0 siblings, 0 replies; 5+ messages in thread
From: Matthias Lenk @ 2007-07-09 14:07 UTC (permalink / raw)
To: Andi Kleen; +Cc: Aaron Durbin, linux-kernel, akpm
Andi, Aaron,
I retested the patch with Andi's patch not reverted (that's the way it's
meant to be I guess) and then it works! I can now boot with HPET enabled.
Thanks,
Matthias
Matthias Lenk wrote:
> Aaron, I tested the patch on my affected system and unfortunately it
> did not work. The BAR1 resource still gets overridden and hence the
> same effects as before.
>
> Thanks,
>
> Matthias
>
> Andi Kleen wrote:
>> On Friday 06 July 2007 00:27:24 Aaron Durbin wrote:
>>
>>> Insert HPET resources after pci probing has been completed in order
>>> to avoid
>>> resource conflicts with PCI resource reservation. With this change the
>>> HPET firmware resources will be identified, but it should also not
>>> cause
>>> issues when the HPET address falls on a BAR in a PCI device, and the
>>> PCI
>>> enumeration cannot reserve the resources.
>>>
>>
>> But what advantage does it have when it's already reserved by PCI?
>>
>> That's only a cosmetic change, isn't it? A lot of code for cosmetics.
>>
>> -Andi
>>
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-09 14:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-05 22:27 [PATCH] i386/x86_64: Insert HPET firmware resource after PCI enumeration has completed Aaron Durbin
2007-07-06 10:59 ` Andi Kleen
2007-07-06 11:09 ` Matthias Lenk
2007-07-09 14:07 ` Matthias Lenk
2007-07-06 12:45 ` Aaron Durbin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox