parisc: Reduce kernel size by packing alternative tables
Subsystems (3)
Helge Deller
maintainerPATCH 1/2 parisc: Reduce kernel size by packing alternative tables
The values stored in the length and condition fields of the alternative table fit in 16 bits, and thus reduce the struct.
bloat-o-meter shows a reduction of -0.01% by this change:
Total: Before=10196505, After=10195529, chg -0.01%
$ ls -la vmlinux vmlinux.before -rwxr-xr-x 14437324 vmlinux -rwxr-xr-x 14449512 vmlinux.before
Signed-off-by Helge Deller <[email protected]>
--- arch/parisc/include/asm/alternative.h | 21 ++++++++++++--------- arch/parisc/kernel/alternative.c | 7 ++++--- 2 files changed, 16 insertions(+), 12 deletions(-)
arch/parisc/include/asm/alternative.h +12 -9
@@ -22,10 +22,10 @@struct alt_instr {s32 orig_offset;/* offset to original instructions */ -s32 len;/* end of original instructions */ -u32 cond;/* see ALT_COND_XXX */ +s16 len;/* end of original instructions */ +u16 cond;/* see ALT_COND_XXX */ u32 replacement;/* replacement instruction or code */ -}; +} __packed;void set_kernel_text_rw (int enable_read_write);void apply_alternatives_all (void );
@@ -35,8 +35,9 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,/* Alternative SMP implementation. */ #define ALTERNATIVE (cond, replacement) "!0:" \ ".section .altinstructions, \"aw\" !" \ - ".word (0b-4-.), 1, " __stringify(cond) "," \ - __stringify(replacement) " !" \ + ".word (0b-4-.) !" \ + ".hword 1, " __stringify(cond) " !" \ + ".word " __stringify(replacement) " !" \ ".previous"#else
@@ -44,15 +45,17 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,/* to replace one single instructions by a new instruction */ #define ALTERNATIVE (from, to, cond, replacement)\ .section .altinstructions, "aw" ! \ - .word (from - .), (to - from)/4 ! \ - .word cond, replacement ! \ + .word (from - .) ! \ + .hword (to - from)/4, cond ! \ + .word replacement ! \ .previous/* to replace multiple instructions by new code */ #define ALTERNATIVE_CODE (from, num_instructions, cond, new_instr_ptr)\ .section .altinstructions, "aw" ! \ - .word (from - .), -num_instructions ! \ - .word cond, (new_instr_ptr - .) ! \ + .word (from - .) ! \ + .hword -num_instructions, cond ! \ + .word (new_instr_ptr - .) ! \ .previous#endif /* __ASSEMBLY__ */
arch/parisc/kernel/alternative.c +4 -3
@@ -26,7 +26,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,struct alt_instr *entry;int index =0 , applied =0 ;int num_cpus =num_online_cpus (); -u32 cond_check; +u16 cond_check; cond_check =ALT_COND_ALWAYS | ((num_cpus == 1) ? ALT_COND_NO_SMP : 0) |
@@ -45,8 +45,9 @@ void __init_or_module apply_alternatives(struct alt_instr *start,for (entry = start; entry < end; entry++, index++) { -u32 *from, cond, replacement; -s32 len; +u32 *from, replacement; +u16 cond; +s16 len; from = (u32 *)((ulong )&entry->orig_offset + entry->orig_offset); len = entry->len;
--
2.37.3
Helge Deller
maintainerPATCH 2/2 parisc: Convert PDC console to an early console
Rewrite the PDC console to become an early console.
Beside the fact that now boot information is visible until another (text- or graphics) console takes over, this benefits as well machines with a yet-unsupported STI console and kgdb.
Signed-off-by Helge Deller <[email protected]>
--- arch/parisc/include/asm/pdc.h | 3 - arch/parisc/kernel/pdc_cons.c | 240 ++++------------------------------ arch/parisc/kernel/setup.c | 6 +- arch/parisc/kernel/traps.c | 15 +-- drivers/tty/serial/Kconfig | 15 --- lib/Kconfig.kgdb | 2 +- 6 files changed, 32 insertions(+), 249 deletions(-)
arch/parisc/include/asm/pdc.h +0 -3
@@ -19,9 +19,6 @@ extern unsigned long parisc_pat_pdc_cap; /* PDC capabilities (PAT) */#define PDC_TYPE_SYSTEM_MAP 1/* 32-bit, but supports PDC_SYSTEM_MAP */ #define PDC_TYPE_SNAKE 2/* Doesn't support SYSTEM_MAP */ -void pdc_console_init (void );/* in pdc_console.c */ -void pdc_console_restart (void ); -void setup_pdc (void );/* in inventory.c */ /* wrapper-functions from pdc.c */
arch/parisc/kernel/pdc_cons.c +26 -214
280 lines not on this page · raw message
arch/parisc/kernel/setup.c +4 -2
@@ -70,6 +70,10 @@ void __init setup_cmdline(char **cmdline_p)strlcat (p,"tty0" ,COMMAND_LINE_SIZE ); } +/* default to use early console */ +if (!strstr (p,"earlycon" )) +strlcat (p," earlycon=pdc" ,COMMAND_LINE_SIZE ); +#ifdef CONFIG_BLK_DEV_INITRD if (boot_args[2 ] !=0 )/* did palo pass us a ramdisk? */ {
@@ -139,8 +143,6 @@ void __init setup_arch(char **cmdline_p)if (__pa ((unsigned long ) &_end) >=KERNEL_INITIAL_SIZE )panic ("KERNEL_INITIAL_ORDER too small!" ); -pdc_console_init (); -#ifdef CONFIG_64BIT if (parisc_narrow_firmware) {printk (KERN_INFO "Kernel is using PDC in 32-bit mode.\n" );
arch/parisc/kernel/traps.c +1 -14
@@ -239,13 +239,6 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)/* unlock the pdc lock if necessary */ pdc_emergency_unlock (); -/* maybe the kernel hasn't booted very far yet and hasn't been able -* to initialize the serial or STI console. In that case we should -* re-enable the pdc console, so that the user will be able to -* identify the problem. */ -if (!console_drivers) -pdc_console_restart (); -if (err)printk (KERN_CRIT "%s (pid %d): %s (code %ld)\n" , current->comm,task_pid_nr (current), str, err);
@@ -429,10 +422,6 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o/* unlock the pdc lock if necessary */ pdc_emergency_unlock (); -/* restart pdc console if necessary */ -if (!console_drivers) -pdc_console_restart (); -/* Not all paths will gutter the processor... */ switch (code){
@@ -482,9 +471,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)unsigned long fault_space =0 ;int si_code; -if (code ==1 ) -pdc_console_restart ();/* switch back to pdc if HPMC */ -else if (!irqs_disabled_flags (regs->gr[0 ])) +if (!irqs_disabled_flags (regs->gr[0 ]))local_irq_enable ();/* Security check:
drivers/tty/serial/Kconfig +0 -15
@@ -602,21 +602,6 @@ config SERIAL_MUX_CONSOLE select SERIAL_CORE_CONSOLE default y -config PDC_CONSOLE - bool "PDC software console support" - depends on PARISC && !SERIAL_MUX && VT - help - Saying Y here will enable the software based PDC console to be - used as the system console. This is useful for machines in - which the hardware based console has not been written yet. The - following steps must be completed to use the PDC console: - - 1. create the device entry (mknod /dev/ttyB0 c 11 0) - 2. Edit the /etc/inittab to start a getty listening on /dev/ttyB0 - 3. Add device ttyB0 to /etc/securetty (if you want to log on as - root on this console.) - 4. Change the kernel command console parameter to: console=ttyB0 - config SERIAL_SUNSAB tristate "Sun Siemens SAB82532 serial support" depends on SPARC && PCI
lib/Kconfig.kgdb +1 -1
@@ -121,7 +121,7 @@ config KDB_DEFAULT_ENABLE config KDB_KEYBOARD bool "KGDB_KDB: keyboard as input device" - depends on VT && KGDB_KDB + depends on VT && KGDB_KDB && !PARISC default n help KDB can use a PS/2 type keyboard for an input device
--
2.37.3