aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-04 14:42:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-04 14:42:58 -0700
commit3a143125ddc4e2e0ca1e67fb4bedd45c36e59cc7 (patch)
tree0e5bc6fcc66b4cbfef909646b8a6b8f7f9d08956 /drivers
parenta1aa758d0019f2ac4ea558b3987a07c12fa19f61 (diff)
parent5761d64b277c287a7520b868c32d656ef03374b4 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86: x86: revert assign IRQs to hpet timer x86: tsc prevent time going backwards xen: Clear PG_pinned in release_{pt,pd}() xen: Do not pin/unpin PMD pages xen: refactor xen_{alloc,release}_{pt,pd}() x86, agpgart: scary messages are fortunately obsolete xen: fix grant table bug x86: fix breakage of vSMP irq operations x86: print message if nmi_watchdog=2 cannot be enabled x86: fix nmi_watchdog=2 on Pentium-D CPUs
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/hpet.c51
-rw-r--r--drivers/xen/grant-table.c16
2 files changed, 17 insertions, 50 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 465ad35ed38..1399971be68 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -731,14 +731,14 @@ static unsigned long hpet_calibrate(struct hpets *hpetp)
int hpet_alloc(struct hpet_data *hdp)
{
- u64 cap, mcfg, hpet_config;
+ u64 cap, mcfg;
struct hpet_dev *devp;
- u32 i, ntimer, irq;
+ u32 i, ntimer;
struct hpets *hpetp;
size_t siz;
struct hpet __iomem *hpet;
static struct hpets *last = NULL;
- unsigned long period, irq_bitmap;
+ unsigned long period;
unsigned long long temp;
/*
@@ -765,47 +765,11 @@ int hpet_alloc(struct hpet_data *hdp)
hpetp->hp_hpet_phys = hdp->hd_phys_address;
hpetp->hp_ntimer = hdp->hd_nirqs;
- hpet = hpetp->hp_hpet;
-
- /* Assign IRQs statically for legacy devices */
- hpetp->hp_dev[0].hd_hdwirq = hdp->hd_irq[0];
- hpetp->hp_dev[1].hd_hdwirq = hdp->hd_irq[1];
-
- /* Assign IRQs dynamically for the others */
- for (i = 2, devp = &hpetp->hp_dev[2]; i < hdp->hd_nirqs; i++, devp++) {
- struct hpet_timer __iomem *timer;
- timer = &hpet->hpet_timers[devp - hpetp->hp_dev];
+ for (i = 0; i < hdp->hd_nirqs; i++)
+ hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];
- /* Check if there's already an IRQ assigned to the timer */
- if (hdp->hd_irq[i]) {
- hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];
- continue;
- }
-
- hpet_config = readq(&timer->hpet_config);
- irq_bitmap = (hpet_config & Tn_INT_ROUTE_CAP_MASK)
- >> Tn_INT_ROUTE_CAP_SHIFT;
- if (!irq_bitmap)
- irq = 0; /* No valid IRQ Assignable */
- else {
- irq = find_first_bit(&irq_bitmap, 32);
- do {
- hpet_config |= irq << Tn_INT_ROUTE_CNF_SHIFT;
- writeq(hpet_config, &timer->hpet_config);
-
- /*
- * Verify whether we have written a valid
- * IRQ number by reading it back again
- */
- hpet_config = readq(&timer->hpet_config);
- if (irq == (hpet_config & Tn_INT_ROUTE_CNF_MASK)
- >> Tn_INT_ROUTE_CNF_SHIFT)
- break; /* Success */
- } while ((irq = (find_next_bit(&irq_bitmap, 32, irq))));
- }
- hpetp->hp_dev[i].hd_hdwirq = irq;
- }
+ hpet = hpetp->hp_hpet;
cap = readq(&hpet->hpet_cap);
@@ -836,8 +800,7 @@ int hpet_alloc(struct hpet_data *hdp)
hpetp->hp_which, hdp->hd_phys_address,
hpetp->hp_ntimer > 1 ? "s" : "");
for (i = 0; i < hpetp->hp_ntimer; i++)
- printk("%s %d", i > 0 ? "," : "",
- hpetp->hp_dev[i].hd_hdwirq);
+ printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]);
printk("\n");
printk(KERN_INFO "hpet%u: %u %d-bit timers, %Lu Hz\n",
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index ea94dbabf9a..d85dc6d41c2 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -381,11 +381,15 @@ EXPORT_SYMBOL_GPL(gnttab_cancel_free_callback);
static int grow_gnttab_list(unsigned int more_frames)
{
unsigned int new_nr_grant_frames, extra_entries, i;
+ unsigned int nr_glist_frames, new_nr_glist_frames;
new_nr_grant_frames = nr_grant_frames + more_frames;
extra_entries = more_frames * GREFS_PER_GRANT_FRAME;
- for (i = nr_grant_frames; i < new_nr_grant_frames; i++) {
+ nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
+ new_nr_glist_frames =
+ (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
+ for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
if (!gnttab_list[i])
goto grow_nomem;
@@ -407,7 +411,7 @@ static int grow_gnttab_list(unsigned int more_frames)
return 0;
grow_nomem:
- for ( ; i >= nr_grant_frames; i--)
+ for ( ; i >= nr_glist_frames; i--)
free_page((unsigned long) gnttab_list[i]);
return -ENOMEM;
}
@@ -530,7 +534,7 @@ static int gnttab_expand(unsigned int req_entries)
static int __devinit gnttab_init(void)
{
int i;
- unsigned int max_nr_glist_frames;
+ unsigned int max_nr_glist_frames, nr_glist_frames;
unsigned int nr_init_grefs;
if (!is_running_on_xen())
@@ -543,15 +547,15 @@ static int __devinit gnttab_init(void)
* grant reference free list on the current hypervisor.
*/
max_nr_glist_frames = (boot_max_nr_grant_frames *
- GREFS_PER_GRANT_FRAME /
- (PAGE_SIZE / sizeof(grant_ref_t)));
+ GREFS_PER_GRANT_FRAME / RPP);
gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
GFP_KERNEL);
if (gnttab_list == NULL)
return -ENOMEM;
- for (i = 0; i < nr_grant_frames; i++) {
+ nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
+ for (i = 0; i < nr_glist_frames; i++) {
gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
if (gnttab_list[i] == NULL)
goto ini_nomem;