x86: replacing mp_config_X with mpc_X
Hello Ingo,
Please pull these cleanup patches.
The following changes since commit 5b47b0188e1da604f9efad2bac96213877e3ddca:
Ingo Molnar (1):
Merge branch 'sched/urgent'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (2):
x86: replacing mp_config_ioapic with mpc_ioapic
x86: replacing mp_config_intsrc with mpc_intsrc
arch/x86/include/asm/io_apic.h | 26 +-------- arch/x86/kernel/acpi/boot.c | 96 ++++++++++++++++----------------- arch/x86/kernel/io_apic.c | 118 ++++++++++++++++++++-------------------- arch/x86/kernel/mpparse.c | 80 ++++++++++++++-------------- 4 files changed, 147 insertions(+), 173 deletions(-)
arch/x86/include/asm/io_apic.h +2 -24
@@ -114,38 +114,16 @@ struct IR_IO_APIC_route_entry {extern int nr_ioapics;extern int nr_ioapic_registers[MAX_IO_APICS ]; -/* -* MP-BIOS irq configuration table structures: -*/ -#define MP_MAX_IOAPIC_PIN 127 -struct mp_config_ioapic { -unsigned long mp_apicaddr; -unsigned int mp_apicid; -unsigned char mp_type; -unsigned char mp_apicver; -unsigned char mp_flags; -}; - -struct mp_config_intsrc { -unsigned int mp_dstapic; -unsigned char mp_type; -unsigned char mp_irqtype; -unsigned short mp_irqflag; -unsigned char mp_srcbus; -unsigned char mp_srcbusirq; -unsigned char mp_dstirq; -}; -/* I/O APIC entries */ -extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS ]; +extern struct mpc_ioapic mp_ioapics[MAX_IO_APICS ];/* # of MP IRQ source entries */ extern int mp_irq_entries;/* MP IRQ source entries */ -extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES ]; +extern struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES ];/* non-0 if default (table-less) MP configuration */ extern int mpc_default_type;
arch/x86/kernel/acpi/boot.c +47 -49
187 lines not on this page · raw message
arch/x86/kernel/io_apic.c +58 -60
314 lines not on this page · raw message
arch/x86/kernel/mpparse.c +40 -40
138 lines not on this page · raw message
Quoted 7 lines · Jaswinder Singh Rajput
arch/x86/include/asm/io_apic.h +0
-7-struct mp_config_ioapic { -unsigned long mp_apicaddr; -unsigned int mp_apicid; -unsigned char mp_type; -unsigned char mp_apicver; -unsigned char mp_flags; -};
arch/x86/include/asm/io_apic.h struct IR_IO_APIC_route_entry { · line 139
Quoted 10 lines
arch/x86/include/asm/io_apic.h +0
-10- -struct mp_config_intsrc { -unsigned int mp_dstapic; -unsigned char mp_type; -unsigned char mp_irqtype; -unsigned short mp_irqflag; -unsigned char mp_srcbus; -unsigned char mp_srcbusirq; -unsigned char mp_dstirq; -};
So you replaced that with mpc_ioapic and mpc_intsrc uses:
struct mpc_ioapic {
unsigned char type;
unsigned char apicid;
unsigned char apicver;
unsigned char flags;
unsigned int apicaddr;};
struct mpc_intsrc {
unsigned char type;
unsigned char irqtype;
unsigned short irqflag;
unsigned char srcbus;
unsigned char srcbusirq;
unsigned char dstapic;
unsigned char dstirq;};
And removed the mp_config_ioapic and mp_config_intsrc types.
The mp_config_ioapic and mp_config_intsrc types are kernel-internal, while mpc_ioapic and mpc_intsrc is an MP Specification type - the lowlevel structure of these tables as provided in RAM or ROM by the BIOS.
Here's the potential problems that need to be thought through:
- the biggest potential problem is that apicaddr is 32-bit wide while mp_apicaddr is 64-bit wide, on the 64-bit kernel. Can an apic address be above 4 GB, in an mptable? I dont think it can be.
- another problem could be that dstapic are all 1-byte entities - while in the in-kernel version (mp_apicid and mp_dstapic) they are 32 bit. The ACPI code fills in the tables too so maybe there it can be wider than 8 bits?
I've Cc:-ed a few more folks.
The cleanup potential is significant: we can get rid of all the type mixing that we do (assign_to_mp_irq(), assign_to_mpc_intsrc() can go away, etc.) and can standardize the code.
Ingo
Quoted 47 lines · Ingo Molnar
Quoted 7 lines · Jaswinder Singh Rajput
arch/x86/include/asm/io_apic.h +0
-7-struct mp_config_ioapic { -unsigned long mp_apicaddr; -unsigned int mp_apicid; -unsigned char mp_type; -unsigned char mp_apicver; -unsigned char mp_flags; -};arch/x86/include/asm/io_apic.h struct IR_IO_APIC_route_entry { · line 139
Quoted 10 lines
arch/x86/include/asm/io_apic.h +0
-10- -struct mp_config_intsrc { -unsigned int mp_dstapic; -unsigned char mp_type; -unsigned char mp_irqtype; -unsigned short mp_irqflag; -unsigned char mp_srcbus; -unsigned char mp_srcbusirq; -unsigned char mp_dstirq; -};So you replaced that with
mpc_ioapicandmpc_intsrcuses:struct mpc_ioapic { unsigned char type; unsigned char apicid; unsigned char apicver; unsigned char flags; unsigned int apicaddr;};
struct mpc_intsrc { unsigned char type; unsigned char irqtype; unsigned short irqflag; unsigned char srcbus; unsigned char srcbusirq; unsigned char dstapic; unsigned char dstirq;};
And removed the
mp_config_ioapicandmp_config_intsrctypes.The
mp_config_ioapicandmp_config_intsrctypes are kernel-internal, whilempc_ioapicandmpc_intsrcis an MP Specification type - the lowlevel structure of these tables as provided in RAM or ROM by the BIOS.
Quoted 6 lines
Here's the potential problems that need to be thought through:
- the biggest potential problem is that apicaddr is 32-bit wide while
mp_apicaddris 64-bit wide, on the 64-bit kernel. Can an apic address be above 4 GB, in an mptable? I dont think it can be.
mp_apicaddr is getting its value from apicaddr which is u32 (arch/x86/kernel/acpi/boot.c)
ORmp_apicaddr is getting its value from apicaddr which is u32 (arch/x86/kernel/mpparse.c)
Quoted 5 lines
- another problem could be that dstapic are all 1-byte entities - while in the in-kernel version (
mp_apicidandmp_dstapic) they are 32 bit. The ACPI code fills in the tables too so maybe there it can be wider than 8 bits?
mp_apicid is getting its value from uniq_ioapic_id(id) which returns u8 (arch/x86/kernel/acpi/boot.c)
ORmp_apicid is getting its value from reg_00.bits.ID which also 8 bits (arch/x86/kernel/io_apic.c)
ORmp_apicid is getting its value from apicid which also 8 bits (arch/x86/kernel/mpparse.c)
and
mp_dstapic is getting its value from mp_apicid which is already 8 bits (arch/x86/kernel/acpi/boot.c)
ORmp_dstapic is getting its value from mpc_intsrc->dstapic which is already 8 bits (arch/x86/kernel/mpparse.c)
By using current structure we are wasting space as well as creating confusion for checking u8 <-> u32 and u32 <-> u64.
Thanks,
--
JSR
Quoted 78 lines · Jaswinder Singh Rajput
Quoted 47 lines · Ingo Molnar
Quoted 7 lines · Jaswinder Singh Rajput
arch/x86/include/asm/io_apic.h +0
-7-struct mp_config_ioapic { -unsigned long mp_apicaddr; -unsigned int mp_apicid; -unsigned char mp_type; -unsigned char mp_apicver; -unsigned char mp_flags; -};arch/x86/include/asm/io_apic.h struct IR_IO_APIC_route_entry { · line 139
Quoted 10 lines
arch/x86/include/asm/io_apic.h +0
-10- -struct mp_config_intsrc { -unsigned int mp_dstapic; -unsigned char mp_type; -unsigned char mp_irqtype; -unsigned short mp_irqflag; -unsigned char mp_srcbus; -unsigned char mp_srcbusirq; -unsigned char mp_dstirq; -};So you replaced that with
mpc_ioapicandmpc_intsrcuses:struct mpc_ioapic { unsigned char type; unsigned char apicid; unsigned char apicver; unsigned char flags; unsigned int apicaddr;};
struct mpc_intsrc { unsigned char type; unsigned char irqtype; unsigned short irqflag; unsigned char srcbus; unsigned char srcbusirq; unsigned char dstapic; unsigned char dstirq;};
And removed the
mp_config_ioapicandmp_config_intsrctypes.The
mp_config_ioapicandmp_config_intsrctypes are kernel-internal, whilempc_ioapicandmpc_intsrcis an MP Specification type - the lowlevel structure of these tables as provided in RAM or ROM by the BIOS.Quoted 6 lines
Here's the potential problems that need to be thought through:
- the biggest potential problem is that apicaddr is 32-bit wide while
mp_apicaddris 64-bit wide, on the 64-bit kernel. Can an apic address be above 4 GB, in an mptable? I dont think it can be.
mp_apicaddris getting its value from apicaddr which is u32 (arch/x86/kernel/acpi/boot.c)
ORmp_apicaddris getting its value from apicaddr which is u32 (arch/x86/kernel/mpparse.c)Quoted 5 lines
- another problem could be that dstapic are all 1-byte entities - while in the in-kernel version (
mp_apicidandmp_dstapic) they are 32 bit. The ACPI code fills in the tables too so maybe there it can be wider than 8 bits?
mp_apicidis getting its value fromuniq_ioapic_id(id)which returns u8 (arch/x86/kernel/acpi/boot.c)
ORmp_apicidis getting its value from reg_00.bits.ID which also 8 bits (arch/x86/kernel/io_apic.c)
ORmp_apicidis getting its value from apicid which also 8 bits (arch/x86/kernel/mpparse.c)and
Quoted 8 lines
mp_dstapicis getting its value frommp_apicidwhich is already 8 bits (arch/x86/kernel/acpi/boot.c)
ORmp_dstapicis getting its value frommpc_intsrc->dstapicwhich is already 8 bits (arch/x86/kernel/mpparse.c)By using current structure we are wasting space as well as creating confusion for checking u8 <-> u32 and u32 <-> u64.
ok, that sounds fair enough - double-checking that we are not introducing some stupid limit somewhere was important.
I've pulled your two cleanup commits, thanks,
Ingo