|
@@ -101,7 +101,7 @@ int mp_irq_entries;
|
|
static int nr_irqs_gsi = NR_IRQS_LEGACY;
|
|
static int nr_irqs_gsi = NR_IRQS_LEGACY;
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Saved I/O APIC state during suspend/resume.
|
|
|
|
|
|
+ * Saved I/O APIC state during suspend/resume, or while enabling intr-remap.
|
|
*/
|
|
*/
|
|
static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS];
|
|
static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS];
|
|
|
|
|
|
@@ -628,74 +628,43 @@ static int __init ioapic_pirq_setup(char *str)
|
|
__setup("pirq=", ioapic_pirq_setup);
|
|
__setup("pirq=", ioapic_pirq_setup);
|
|
#endif /* CONFIG_X86_32 */
|
|
#endif /* CONFIG_X86_32 */
|
|
|
|
|
|
-struct IO_APIC_route_entry **alloc_ioapic_entries(void)
|
|
|
|
-{
|
|
|
|
- int apic;
|
|
|
|
- struct IO_APIC_route_entry **ioapic_entries;
|
|
|
|
-
|
|
|
|
- ioapic_entries = kzalloc(sizeof(*ioapic_entries) * nr_ioapics,
|
|
|
|
- GFP_ATOMIC);
|
|
|
|
- if (!ioapic_entries)
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
- for (apic = 0; apic < nr_ioapics; apic++) {
|
|
|
|
- ioapic_entries[apic] =
|
|
|
|
- kzalloc(sizeof(struct IO_APIC_route_entry) *
|
|
|
|
- nr_ioapic_registers[apic], GFP_ATOMIC);
|
|
|
|
- if (!ioapic_entries[apic])
|
|
|
|
- goto nomem;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return ioapic_entries;
|
|
|
|
-
|
|
|
|
-nomem:
|
|
|
|
- while (--apic >= 0)
|
|
|
|
- kfree(ioapic_entries[apic]);
|
|
|
|
- kfree(ioapic_entries);
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Saves all the IO-APIC RTE's
|
|
* Saves all the IO-APIC RTE's
|
|
*/
|
|
*/
|
|
-int save_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries)
|
|
|
|
|
|
+int save_ioapic_entries(void)
|
|
{
|
|
{
|
|
int apic, pin;
|
|
int apic, pin;
|
|
-
|
|
|
|
- if (!ioapic_entries)
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ int err = 0;
|
|
|
|
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
- if (!ioapic_entries[apic])
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ if (!ioapic_saved_data[apic]) {
|
|
|
|
+ err = -ENOMEM;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
|
|
- ioapic_entries[apic][pin] =
|
|
|
|
|
|
+ ioapic_saved_data[apic][pin] =
|
|
ioapic_read_entry(apic, pin);
|
|
ioapic_read_entry(apic, pin);
|
|
}
|
|
}
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
* Mask all IO APIC entries.
|
|
* Mask all IO APIC entries.
|
|
*/
|
|
*/
|
|
-void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries)
|
|
|
|
|
|
+void mask_ioapic_entries(void)
|
|
{
|
|
{
|
|
int apic, pin;
|
|
int apic, pin;
|
|
|
|
|
|
- if (!ioapic_entries)
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
- if (!ioapic_entries[apic])
|
|
|
|
- break;
|
|
|
|
|
|
+ if (!ioapic_saved_data[apic])
|
|
|
|
+ continue;
|
|
|
|
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
|
|
struct IO_APIC_route_entry entry;
|
|
struct IO_APIC_route_entry entry;
|
|
|
|
|
|
- entry = ioapic_entries[apic][pin];
|
|
|
|
|
|
+ entry = ioapic_saved_data[apic][pin];
|
|
if (!entry.mask) {
|
|
if (!entry.mask) {
|
|
entry.mask = 1;
|
|
entry.mask = 1;
|
|
ioapic_write_entry(apic, pin, entry);
|
|
ioapic_write_entry(apic, pin, entry);
|
|
@@ -705,36 +674,23 @@ void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Restore IO APIC entries which was saved in ioapic_entries.
|
|
|
|
|
|
+ * Restore IO APIC entries which was saved in ioapic_saved_data
|
|
*/
|
|
*/
|
|
-int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries)
|
|
|
|
|
|
+int restore_ioapic_entries(void)
|
|
{
|
|
{
|
|
int apic, pin;
|
|
int apic, pin;
|
|
|
|
|
|
- if (!ioapic_entries)
|
|
|
|
- return -ENOMEM;
|
|
|
|
-
|
|
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
- if (!ioapic_entries[apic])
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ if (!ioapic_saved_data[apic])
|
|
|
|
+ continue;
|
|
|
|
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
|
|
ioapic_write_entry(apic, pin,
|
|
ioapic_write_entry(apic, pin,
|
|
- ioapic_entries[apic][pin]);
|
|
|
|
|
|
+ ioapic_saved_data[apic][pin]);
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries)
|
|
|
|
-{
|
|
|
|
- int apic;
|
|
|
|
-
|
|
|
|
- for (apic = 0; apic < nr_ioapics; apic++)
|
|
|
|
- kfree(ioapic_entries[apic]);
|
|
|
|
-
|
|
|
|
- kfree(ioapic_entries);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Find the IRQ entry number of a certain pin.
|
|
* Find the IRQ entry number of a certain pin.
|
|
*/
|
|
*/
|