Skip to contentSkip to conversation

MCA: garbage collect sys_desc_table

PATCH In review Paolo Pisati 3 participants 6 messages Jul 8, 2015 – Jul 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MCA: garbage collect sys_desc_table

Is sys_desc_table still used anywhere? It seems not:

arch/x86/boot/mca.c::query_mca()
...

    copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len);

...

arch/x86/kernel/setup.c::setup_arch()
...

    if (boot_params.sys_desc_table.length != 0) {
        machine_id = boot_params.sys_desc_table.table[0];
        machine_submodel_id = boot_params.sys_desc_table.table[1];
        BIOS_revision = boot_params.sys_desc_table.table[2];
    }

...

$ git grep machine_id
...
arch/x86/include/asm/processor.h:extern unsigned int            machine_id;
arch/x86/kernel/setup.c:unsigned int machine_id;
arch/x86/kernel/setup.c:                machine_id = boot_params.sys_desc_table.table[0];
...
$ git grep machine_submodel_id
arch/x86/include/asm/processor.h:extern unsigned int machine_submodel_id;
arch/x86/kernel/setup.c:unsigned int machine_submodel_id;
arch/x86/kernel/setup.c:                machine_submodel_id = boot_params.sys_desc_table.table[1];
$ git grep BIOS_revision
arch/x86/include/asm/processor.h:extern unsigned int            BIOS_revision;
arch/x86/kernel/setup.c:unsigned int BIOS_revision;
arch/x86/kernel/setup.c:                BIOS_revision = boot_params.sys_desc_table.table[2];

Compile tested with i386_defconfig, x86_64_defconfig and allyesconfig.

Paolo Pisati (1):
MCA: garbage collect sys_desc_table

 Documentation/x86/zero-page.txt       |  1 -
 arch/x86/boot/Makefile                |  2 +-
 arch/x86/boot/boot.h                  |  3 ---
 arch/x86/boot/compressed/eboot.c      |  4 ----
 arch/x86/boot/main.c                  |  3 ---
 arch/x86/boot/mca.c                   | 38 -----------------------------------
 arch/x86/include/asm/processor.h      |  8 --------
 arch/x86/include/uapi/asm/bootparam.h | 19 +++++++-----------
 arch/x86/kernel/kexec-bzimage64.c     |  3 ---
 arch/x86/kernel/setup.c               |  5 -----
 10 files changed, 8 insertions(+), 78 deletions(-)
 delete mode 100644 arch/x86/boot/mca.c
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 MCA: garbage collect sys_desc_table

---
 Documentation/x86/zero-page.txt       |  1 -
 arch/x86/boot/Makefile                |  2 +-
 arch/x86/boot/boot.h                  |  3 ---
 arch/x86/boot/compressed/eboot.c      |  4 ----
 arch/x86/boot/main.c                  |  3 ---
 arch/x86/boot/mca.c                   | 38 -----------------------------------
 arch/x86/include/asm/processor.h      |  8 --------
 arch/x86/include/uapi/asm/bootparam.h | 19 +++++++-----------
 arch/x86/kernel/kexec-bzimage64.c     |  3 ---
 arch/x86/kernel/setup.c               |  5 -----
 10 files changed, 8 insertions(+), 78 deletions(-)
 delete mode 100644 arch/x86/boot/mca.c
Documentation/x86/zero-page.txt +0 -1
index 82fbdbc..0761737 100644
@@ -17,7 +17,6 @@ Offset	Proto	Name		Meaning
 				(struct ist_info)
 080/010	ALL	hd0_info	hd0 disk parameter, OBSOLETE!!
 090/010	ALL	hd1_info	hd1 disk parameter, OBSOLETE!!
-0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table)
 0B0/010	ALL	olpc_ofw_header	OLPC's OpenFirmware CIF and friends
 0C0/004	ALL	ext_ramdisk_image ramdisk_image high 32bits
 0C4/004	ALL	ext_ramdisk_size  ramdisk_size high 32bits
arch/x86/boot/Makefile +1 -1
index 57bbf2f..0d553e5 100644
@@ -23,7 +23,7 @@ targets		+= fdimage fdimage144 fdimage288 image.iso mtools.conf
 subdir-		:= compressed
 
 setup-y		+= a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o
-setup-y		+= early_serial_console.o edd.o header.o main.o mca.o memory.o
+setup-y		+= early_serial_console.o edd.o header.o main.o memory.o
 setup-y		+= pm.o pmjump.o printf.o regs.o string.o tty.o video.o
 setup-y		+= video-mode.o version.o
 setup-$(CONFIG_X86_APM_BOOT) += apm.o
arch/x86/boot/boot.h +0 -3
index bd49ec6..0033e96 100644
@@ -307,9 +307,6 @@ void query_edd(void);
 /* header.S */
 void __attribute__((noreturn)) die(void);
 
-/* mca.c */
-int query_mca(void);
-
 /* memory.c */
 int detect_memory(void);
 
arch/x86/boot/compressed/eboot.c +0 -4
index 48304b8..2ec7f03 100644
@@ -1041,7 +1041,6 @@ void setup_graphics(struct boot_params *boot_params)
 struct boot_params *make_boot_params(struct efi_config *c)
 {
 	struct boot_params *boot_params;
-	struct sys_desc_table *sdt;
 	struct apm_bios_info *bi;
 	struct setup_header *hdr;
 	struct efi_info *efi;
@@ -1089,7 +1088,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
 	hdr = &boot_params->hdr;
 	efi = &boot_params->efi_info;
 	bi = &boot_params->apm_bios_info;
-	sdt = &boot_params->sys_desc_table;
 
 	/* Copy the second sector to boot_params */
 	memcpy(&hdr->jump, image->image_base + 512, 512);
@@ -1118,8 +1116,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
 	/* Clear APM BIOS info */
 	memset(bi, 0, sizeof(*bi));
 
-	memset(sdt, 0, sizeof(*sdt));
-
 	status = efi_parse_options(cmdline_ptr);
 	if (status != EFI_SUCCESS)
 		goto fail2;
arch/x86/boot/main.c +0 -3
index fd6c9f2..9bcea38 100644
@@ -161,9 +161,6 @@ void main(void)
 	/* Set keyboard repeat rate (why?) and query the lock flags */
 	keyboard_init();
 
-	/* Query MCA information */
-	query_mca();
-
 	/* Query Intel SpeedStep (IST) information */
 	query_ist();
 
arch/x86/boot/mca.c deleted +0 -38
deleted file mode 100644
index a95a531..0000000
@@ -1,38 +0,0 @@
-/* -*- linux-c -*- ------------------------------------------------------- *
- *
- *   Copyright (C) 1991, 1992 Linus Torvalds
- *   Copyright 2007 rPath, Inc. - All Rights Reserved
- *   Copyright 2009 Intel Corporation; author H. Peter Anvin
- *
- *   This file is part of the Linux kernel, and is made available under
- *   the terms of the GNU General Public License version 2.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * Get the MCA system description table
- */
-
-#include "boot.h"
-
-int query_mca(void)
-{
-	struct biosregs ireg, oreg;
-	u16 len;
-
-	initregs(&ireg);
-	ireg.ah = 0xc0;
-	intcall(0x15, &ireg, &oreg);
-
-	if (oreg.eflags & X86_EFLAGS_CF)
-		return -1;	/* No MCA present */
-
-	set_fs(oreg.es);
-	len = rdfs16(oreg.bx);
-
-	if (len > sizeof(boot_params.sys_desc_table))
-		len = sizeof(boot_params.sys_desc_table);
-
-	copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len);
-	return 0;
-}
arch/x86/include/asm/processor.h +0 -8
index 23ba676..81c05b3 100644
@@ -773,14 +773,6 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr)
 
 extern void set_task_blockstep(struct task_struct *task, bool on);
 
-/*
- * from system description table in BIOS. Mostly for MCA use, but
- * others may find it useful:
- */
-extern unsigned int		machine_id;
-extern unsigned int		machine_submodel_id;
-extern unsigned int		BIOS_revision;
-
 /* Boot loader type from the setup header: */
 extern int			bootloader_type;
 extern int			bootloader_version;
arch/x86/include/uapi/asm/bootparam.h +7 -12
index ab456dc..ad00cf4 100644
@@ -86,11 +86,6 @@ struct setup_header {
 	__u32	handover_offset;
 } __attribute__((packed));
 
-struct sys_desc_table {
-	__u16 length;
-	__u8  table[14];
-};
-
 /* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
 struct olpc_ofw_header {
 	__u32 ofw_magic;	/* OFW signature */
@@ -120,12 +115,12 @@ struct boot_params {
 	__u8  _pad3[16];				/* 0x070 */
 	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
 	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
-	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
+	__u8  _pad4[16];					/* 0x0a0 */
 	struct olpc_ofw_header olpc_ofw_header;		/* 0x0b0 */
 	__u32 ext_ramdisk_image;			/* 0x0c0 */
 	__u32 ext_ramdisk_size;				/* 0x0c4 */
 	__u32 ext_cmd_line_ptr;				/* 0x0c8 */
-	__u8  _pad4[116];				/* 0x0cc */
+	__u8  _pad5[116];				/* 0x0cc */
 	struct edid_info edid_info;			/* 0x140 */
 	struct efi_info efi_info;			/* 0x1c0 */
 	__u32 alt_mem_k;				/* 0x1e0 */
@@ -134,7 +129,7 @@ struct boot_params {
 	__u8  eddbuf_entries;				/* 0x1e9 */
 	__u8  edd_mbr_sig_buf_entries;			/* 0x1ea */
 	__u8  kbd_status;				/* 0x1eb */
-	__u8  _pad5[3];					/* 0x1ec */
+	__u8  _pad6[3];					/* 0x1ec */
 	/*
 	 * The sentinel is set to a nonzero value (0xff) in header.S.
 	 *
@@ -147,14 +142,14 @@ struct boot_params {
 	 * kernel should zero out certain portions of boot_params.
 	 */
 	__u8  sentinel;					/* 0x1ef */
-	__u8  _pad6[1];					/* 0x1f0 */
+	__u8  _pad7[1];					/* 0x1f0 */
 	struct setup_header hdr;    /* setup header */	/* 0x1f1 */
-	__u8  _pad7[0x290-0x1f1-sizeof(struct setup_header)];
+	__u8  _pad8[0x290-0x1f1-sizeof(struct setup_header)];
 	__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX];	/* 0x290 */
 	struct e820entry e820_map[E820MAX];		/* 0x2d0 */
-	__u8  _pad8[48];				/* 0xcd0 */
+	__u8  _pad9[48];				/* 0xcd0 */
 	struct edd_info eddbuf[EDDMAXNR];		/* 0xd00 */
-	__u8  _pad9[276];				/* 0xeec */
+	__u8  _pad10[276];				/* 0xeec */
 } __attribute__((packed));
 
 enum {
arch/x86/kernel/kexec-bzimage64.c +0 -3
index ca05f86..3666a84 100644
@@ -222,9 +222,6 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
 	memset(&params->hd0_info, 0, sizeof(params->hd0_info));
 	memset(&params->hd1_info, 0, sizeof(params->hd1_info));
 
-	/* Default sysdesc table */
-	params->sys_desc_table.length = 0;
-
 	if (image->type == KEXEC_TYPE_CRASH) {
 		ret = crash_setup_memmap_entries(image, params);
 		if (ret)
arch/x86/kernel/setup.c +0 -5
index d74ac33..e42cf00 100644
@@ -915,11 +915,6 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_X86_32
 	apm_info.bios = boot_params.apm_bios_info;
 	ist_info = boot_params.ist_info;
-	if (boot_params.sys_desc_table.length != 0) {
-		machine_id = boot_params.sys_desc_table.table[0];
-		machine_submodel_id = boot_params.sys_desc_table.table[1];
-		BIOS_revision = boot_params.sys_desc_table.table[2];
-	}
 #endif
 	saved_video_mode = boot_params.hdr.vid_mode;
 	bootloader_type = boot_params.hdr.type_of_loader;
Signature · 1 line
2.1.4
#2 lore raw

On Wed, 8 Jul 2015, Paolo Pisati wrote:

This lacks a proper changelog.

Documentation/x86/zero-page.txt Offset Proto Name Meaning · line 20

Quoted 10 lines
Documentation/x86/zero-page.txt +0 -1
index 82fbdbc..0761737 100644
@@ -17,7 +17,6 @@ Offset	Proto	Name		Meaning
 				(struct ist_info)
 080/010	ALL	hd0_info	hd0 disk parameter, OBSOLETE!!
 090/010	ALL	hd1_info	hd1 disk parameter, OBSOLETE!!
-0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table)

Removing this is wrong. The space stays reserved for sys_desc_table. It's just unused and should be marked OBSOLETE.

Quoted 30 lines
Documentation/x86/zero-page.txt +0 -8
 extern void set_task_blockstep(struct task_struct *task, bool on);
 
-/*
- * from system description table in BIOS. Mostly for MCA use, but
- * others may find it useful:
- */
-extern unsigned int		machine_id;
-extern unsigned int		machine_submodel_id;
-extern unsigned int		BIOS_revision;
-
 /* Boot loader type from the setup header: */
 extern int			bootloader_type;
 extern int			bootloader_version;
arch/x86/include/uapi/asm/bootparam.h +0 -5
index ab456dc..ad00cf4 100644
@@ -86,11 +86,6 @@ struct setup_header {
 	__u32	handover_offset;
 } __attribute__((packed));
 
-struct sys_desc_table {
-	__u16 length;
-	__u8  table[14];
-};
-
 /* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
 struct olpc_ofw_header {
 	__u32 ofw_magic;	/* OFW signature */

arch/x86/include/uapi/asm/bootparam.h struct boot_params { · line 118

Quoted 5 lines
arch/x86/include/uapi/asm/bootparam.h +1 -1
@@ -120,12 +115,12 @@ struct boot_params {
 	__u8  _pad3[16];				/* 0x070 */
 	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
 	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
-	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
+	__u8  _pad4[16];					/* 0x0a0 */

This is a UAPI header and we dont know what might reference that field. Leave it as is and mark it obsolete.

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params, · line 223

Quoted 5 lines
arch/x86/kernel/kexec-bzimage64.c +0 -0
@@ -222,9 +222,6 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
 	memset(&params->hd0_info, 0, sizeof(params->hd0_info));
 	memset(&params->hd1_info, 0, sizeof(params->hd1_info));

These two lines are useless as well, but that should be a separate patch

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params, · line 227

Quoted 3 lines
arch/x86/kernel/kexec-bzimage64.c +0 -3
-	/* Default sysdesc table */
-	params->sys_desc_table.length = 0;
-

Thanks,

tglx

#3 lore raw

PATCH v2 1/1 x86: MCA: obsolete sys_desc_table

Mark sys_desc_table as obsolete: remove any reference from the code together with the remaining of MCA.

bloat-o-meter output:
add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-55 (-55)

function                                     old     new   delta
i386_start_kernel                            128     119      -9

setup_arch 1421 1375 -46

---
Changes since v1:
-added a changelog
-kept sys_desc_table around but marked obsolete

 Documentation/x86/zero-page.txt       |  3 ++-
 arch/x86/boot/Makefile                |  2 +-
 arch/x86/boot/boot.h                  |  3 ---
 arch/x86/boot/compressed/eboot.c      |  4 ----
 arch/x86/boot/main.c                  |  3 ---
 arch/x86/boot/mca.c                   | 38 -----------------------------------
 arch/x86/include/asm/processor.h      |  8 --------
 arch/x86/include/uapi/asm/bootparam.h |  2 +-
 arch/x86/kernel/kexec-bzimage64.c     |  3 ---
 arch/x86/kernel/setup.c               |  5 -----
 10 files changed, 4 insertions(+), 67 deletions(-)
 delete mode 100644 arch/x86/boot/mca.c
Documentation/x86/zero-page.txt +2 -1
index 82fbdbc..95a4d34 100644
@@ -17,7 +17,8 @@ Offset	Proto	Name		Meaning
 				(struct ist_info)
 080/010	ALL	hd0_info	hd0 disk parameter, OBSOLETE!!
 090/010	ALL	hd1_info	hd1 disk parameter, OBSOLETE!!
-0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table)
+0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table),
+				OBSOLETE!!
 0B0/010	ALL	olpc_ofw_header	OLPC's OpenFirmware CIF and friends
 0C0/004	ALL	ext_ramdisk_image ramdisk_image high 32bits
 0C4/004	ALL	ext_ramdisk_size  ramdisk_size high 32bits
arch/x86/boot/Makefile +1 -1
index 57bbf2f..0d553e5 100644
@@ -23,7 +23,7 @@ targets		+= fdimage fdimage144 fdimage288 image.iso mtools.conf
 subdir-		:= compressed
 
 setup-y		+= a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o
-setup-y		+= early_serial_console.o edd.o header.o main.o mca.o memory.o
+setup-y		+= early_serial_console.o edd.o header.o main.o memory.o
 setup-y		+= pm.o pmjump.o printf.o regs.o string.o tty.o video.o
 setup-y		+= video-mode.o version.o
 setup-$(CONFIG_X86_APM_BOOT) += apm.o
arch/x86/boot/boot.h +0 -3
index bd49ec6..0033e96 100644
@@ -307,9 +307,6 @@ void query_edd(void);
 /* header.S */
 void __attribute__((noreturn)) die(void);
 
-/* mca.c */
-int query_mca(void);
-
 /* memory.c */
 int detect_memory(void);
 
arch/x86/boot/compressed/eboot.c +0 -4
index 48304b8..2ec7f03 100644
@@ -1041,7 +1041,6 @@ void setup_graphics(struct boot_params *boot_params)
 struct boot_params *make_boot_params(struct efi_config *c)
 {
 	struct boot_params *boot_params;
-	struct sys_desc_table *sdt;
 	struct apm_bios_info *bi;
 	struct setup_header *hdr;
 	struct efi_info *efi;
@@ -1089,7 +1088,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
 	hdr = &boot_params->hdr;
 	efi = &boot_params->efi_info;
 	bi = &boot_params->apm_bios_info;
-	sdt = &boot_params->sys_desc_table;
 
 	/* Copy the second sector to boot_params */
 	memcpy(&hdr->jump, image->image_base + 512, 512);
@@ -1118,8 +1116,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
 	/* Clear APM BIOS info */
 	memset(bi, 0, sizeof(*bi));
 
-	memset(sdt, 0, sizeof(*sdt));
-
 	status = efi_parse_options(cmdline_ptr);
 	if (status != EFI_SUCCESS)
 		goto fail2;
arch/x86/boot/main.c +0 -3
index fd6c9f2..9bcea38 100644
@@ -161,9 +161,6 @@ void main(void)
 	/* Set keyboard repeat rate (why?) and query the lock flags */
 	keyboard_init();
 
-	/* Query MCA information */
-	query_mca();
-
 	/* Query Intel SpeedStep (IST) information */
 	query_ist();
 
arch/x86/boot/mca.c deleted +0 -38
deleted file mode 100644
index a95a531..0000000
@@ -1,38 +0,0 @@
-/* -*- linux-c -*- ------------------------------------------------------- *
- *
- *   Copyright (C) 1991, 1992 Linus Torvalds
- *   Copyright 2007 rPath, Inc. - All Rights Reserved
- *   Copyright 2009 Intel Corporation; author H. Peter Anvin
- *
- *   This file is part of the Linux kernel, and is made available under
- *   the terms of the GNU General Public License version 2.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * Get the MCA system description table
- */
-
-#include "boot.h"
-
-int query_mca(void)
-{
-	struct biosregs ireg, oreg;
-	u16 len;
-
-	initregs(&ireg);
-	ireg.ah = 0xc0;
-	intcall(0x15, &ireg, &oreg);
-
-	if (oreg.eflags & X86_EFLAGS_CF)
-		return -1;	/* No MCA present */
-
-	set_fs(oreg.es);
-	len = rdfs16(oreg.bx);
-
-	if (len > sizeof(boot_params.sys_desc_table))
-		len = sizeof(boot_params.sys_desc_table);
-
-	copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len);
-	return 0;
-}
arch/x86/include/asm/processor.h +0 -8
index 23ba676..81c05b3 100644
@@ -773,14 +773,6 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr)
 
 extern void set_task_blockstep(struct task_struct *task, bool on);
 
-/*
- * from system description table in BIOS. Mostly for MCA use, but
- * others may find it useful:
- */
-extern unsigned int		machine_id;
-extern unsigned int		machine_submodel_id;
-extern unsigned int		BIOS_revision;
-
 /* Boot loader type from the setup header: */
 extern int			bootloader_type;
 extern int			bootloader_version;
arch/x86/include/uapi/asm/bootparam.h +1 -1
index ab456dc..3292543 100644
@@ -120,7 +120,7 @@ struct boot_params {
 	__u8  _pad3[16];				/* 0x070 */
 	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
 	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
-	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
+	struct sys_desc_table sys_desc_table; /* obsolete! */	/* 0x0a0 */
 	struct olpc_ofw_header olpc_ofw_header;		/* 0x0b0 */
 	__u32 ext_ramdisk_image;			/* 0x0c0 */
 	__u32 ext_ramdisk_size;				/* 0x0c4 */
arch/x86/kernel/kexec-bzimage64.c +0 -3
index ca05f86..3666a84 100644
@@ -222,9 +222,6 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
 	memset(&params->hd0_info, 0, sizeof(params->hd0_info));
 	memset(&params->hd1_info, 0, sizeof(params->hd1_info));
 
-	/* Default sysdesc table */
-	params->sys_desc_table.length = 0;
-
 	if (image->type == KEXEC_TYPE_CRASH) {
 		ret = crash_setup_memmap_entries(image, params);
 		if (ret)
arch/x86/kernel/setup.c +0 -5
index d74ac33..e42cf00 100644
@@ -915,11 +915,6 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_X86_32
 	apm_info.bios = boot_params.apm_bios_info;
 	ist_info = boot_params.ist_info;
-	if (boot_params.sys_desc_table.length != 0) {
-		machine_id = boot_params.sys_desc_table.table[0];
-		machine_submodel_id = boot_params.sys_desc_table.table[1];
-		BIOS_revision = boot_params.sys_desc_table.table[2];
-	}
 #endif
 	saved_video_mode = boot_params.hdr.vid_mode;
 	bootloader_type = boot_params.hdr.type_of_loader;
Signature · 1 line
2.1.4
#4 lore raw

[tip:x86/boot] x86/boot: Obsolete the MCA sys_desc_table

x86/boot: Obsolete the MCA sys_desc_table
Commit-ID:  949163015ce6fdb76a5e846a3582d3c40c23c001
Gitweb:     http://git.kernel.org/tip/949163015ce6fdb76a5e846a3582d3c40c23c001
Author:     Paolo Pisati <[email protected]>
AuthorDate: Mon, 20 Jul 2015 18:23:50 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 21 Jul 2015 10:55:11 +0200

x86/boot: Obsolete the MCA sys_desc_table

The kernel does not support the MCA bus anymroe, so mark sys_desc_table as obsolete: remove any reference from the code together with the remaining of MCA logic.

bloat-o-meter output:

add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-55 (-55)

  function                                     old     new   delta
  i386_start_kernel                            128     119      -9

setup_arch 1421 1375 -46

---
 Documentation/x86/zero-page.txt       |  3 ++-
 arch/x86/boot/Makefile                |  2 +-
 arch/x86/boot/boot.h                  |  3 ---
 arch/x86/boot/compressed/eboot.c      |  4 ----
 arch/x86/boot/main.c                  |  3 ---
 arch/x86/boot/mca.c                   | 38 -----------------------------------
 arch/x86/include/asm/processor.h      |  8 --------
 arch/x86/include/uapi/asm/bootparam.h |  2 +-
 arch/x86/kernel/kexec-bzimage64.c     |  3 ---
 arch/x86/kernel/setup.c               |  5 -----
 10 files changed, 4 insertions(+), 67 deletions(-)
Documentation/x86/zero-page.txt +2 -1
index 82fbdbc..95a4d34 100644
@@ -17,7 +17,8 @@ Offset	Proto	Name		Meaning
 				(struct ist_info)
 080/010	ALL	hd0_info	hd0 disk parameter, OBSOLETE!!
 090/010	ALL	hd1_info	hd1 disk parameter, OBSOLETE!!
-0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table)
+0A0/010	ALL	sys_desc_table	System description table (struct sys_desc_table),
+				OBSOLETE!!
 0B0/010	ALL	olpc_ofw_header	OLPC's OpenFirmware CIF and friends
 0C0/004	ALL	ext_ramdisk_image ramdisk_image high 32bits
 0C4/004	ALL	ext_ramdisk_size  ramdisk_size high 32bits
arch/x86/boot/Makefile +1 -1
index 57bbf2f..0d553e5 100644
@@ -23,7 +23,7 @@ targets		+= fdimage fdimage144 fdimage288 image.iso mtools.conf
 subdir-		:= compressed
 
 setup-y		+= a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o
-setup-y		+= early_serial_console.o edd.o header.o main.o mca.o memory.o
+setup-y		+= early_serial_console.o edd.o header.o main.o memory.o
 setup-y		+= pm.o pmjump.o printf.o regs.o string.o tty.o video.o
 setup-y		+= video-mode.o version.o
 setup-$(CONFIG_X86_APM_BOOT) += apm.o
arch/x86/boot/boot.h +0 -3
index bd49ec6..0033e96 100644
@@ -307,9 +307,6 @@ void query_edd(void);
 /* header.S */
 void __attribute__((noreturn)) die(void);
 
-/* mca.c */
-int query_mca(void);
-
 /* memory.c */
 int detect_memory(void);
 
arch/x86/boot/compressed/eboot.c +0 -4
index 2c82bd1..e140bcc 100644
@@ -1041,7 +1041,6 @@ void setup_graphics(struct boot_params *boot_params)
 struct boot_params *make_boot_params(struct efi_config *c)
 {
 	struct boot_params *boot_params;
-	struct sys_desc_table *sdt;
 	struct apm_bios_info *bi;
 	struct setup_header *hdr;
 	struct efi_info *efi;
@@ -1089,7 +1088,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
 	hdr = &boot_params->hdr;
 	efi = &boot_params->efi_info;
 	bi = &boot_params->apm_bios_info;
-	sdt = &boot_params->sys_desc_table;
 
 	/* Copy the second sector to boot_params */
 	memcpy(&hdr->jump, image->image_base + 512, 512);
@@ -1118,8 +1116,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
 	/* Clear APM BIOS info */
 	memset(bi, 0, sizeof(*bi));
 
-	memset(sdt, 0, sizeof(*sdt));
-
 	status = efi_parse_options(cmdline_ptr);
 	if (status != EFI_SUCCESS)
 		goto fail2;
arch/x86/boot/main.c +0 -3
index fd6c9f2..9bcea38 100644
@@ -161,9 +161,6 @@ void main(void)
 	/* Set keyboard repeat rate (why?) and query the lock flags */
 	keyboard_init();
 
-	/* Query MCA information */
-	query_mca();
-
 	/* Query Intel SpeedStep (IST) information */
 	query_ist();
 
arch/x86/boot/mca.c deleted +0 -38
deleted file mode 100644
index a95a531..0000000
@@ -1,38 +0,0 @@
-/* -*- linux-c -*- ------------------------------------------------------- *
- *
- *   Copyright (C) 1991, 1992 Linus Torvalds
- *   Copyright 2007 rPath, Inc. - All Rights Reserved
- *   Copyright 2009 Intel Corporation; author H. Peter Anvin
- *
- *   This file is part of the Linux kernel, and is made available under
- *   the terms of the GNU General Public License version 2.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * Get the MCA system description table
- */
-
-#include "boot.h"
-
-int query_mca(void)
-{
-	struct biosregs ireg, oreg;
-	u16 len;
-
-	initregs(&ireg);
-	ireg.ah = 0xc0;
-	intcall(0x15, &ireg, &oreg);
-
-	if (oreg.eflags & X86_EFLAGS_CF)
-		return -1;	/* No MCA present */
-
-	set_fs(oreg.es);
-	len = rdfs16(oreg.bx);
-
-	if (len > sizeof(boot_params.sys_desc_table))
-		len = sizeof(boot_params.sys_desc_table);
-
-	copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len);
-	return 0;
-}
arch/x86/include/asm/processor.h +0 -8
index 43e6519..3e15e13 100644
@@ -647,14 +647,6 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr)
 
 extern void set_task_blockstep(struct task_struct *task, bool on);
 
-/*
- * from system description table in BIOS. Mostly for MCA use, but
- * others may find it useful:
- */
-extern unsigned int		machine_id;
-extern unsigned int		machine_submodel_id;
-extern unsigned int		BIOS_revision;
-
 /* Boot loader type from the setup header: */
 extern int			bootloader_type;
 extern int			bootloader_version;
arch/x86/include/uapi/asm/bootparam.h +1 -1
index ab456dc..3292543 100644
@@ -120,7 +120,7 @@ struct boot_params {
 	__u8  _pad3[16];				/* 0x070 */
 	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
 	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
-	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
+	struct sys_desc_table sys_desc_table; /* obsolete! */	/* 0x0a0 */
 	struct olpc_ofw_header olpc_ofw_header;		/* 0x0b0 */
 	__u32 ext_ramdisk_image;			/* 0x0c0 */
 	__u32 ext_ramdisk_size;				/* 0x0c4 */
arch/x86/kernel/kexec-bzimage64.c +0 -3
index ca83f7ac..961e51e 100644
@@ -223,9 +223,6 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
 	memset(&params->hd0_info, 0, sizeof(params->hd0_info));
 	memset(&params->hd1_info, 0, sizeof(params->hd1_info));
 
-	/* Default sysdesc table */
-	params->sys_desc_table.length = 0;
-
 	if (image->type == KEXEC_TYPE_CRASH) {
 		ret = crash_setup_memmap_entries(image, params);
 		if (ret)
arch/x86/kernel/setup.c +0 -5
index 80f874b..b143c2d 100644
@@ -916,11 +916,6 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_X86_32
 	apm_info.bios = boot_params.apm_bios_info;
 	ist_info = boot_params.ist_info;
-	if (boot_params.sys_desc_table.length != 0) {
-		machine_id = boot_params.sys_desc_table.table[0];
-		machine_submodel_id = boot_params.sys_desc_table.table[1];
-		BIOS_revision = boot_params.sys_desc_table.table[2];
-	}
 #endif
 	saved_video_mode = boot_params.hdr.vid_mode;
 	bootloader_type = boot_params.hdr.type_of_loader;
#5 lore raw

Resend: Re: [PATCH] x86: MCA: garbage collect sys_desc_table

In reply to Paolo Pisati

On Wed, Jul 08, 2015 at 07:14:36PM +0200, Paolo Pisati wrote:

Adding Josh Triplett since he was interested in MCA removal for the kernel tinification project, and slightly change the subject line.

Quoted 54 lines

Is sys_desc_table still used anywhere? It seems not:

arch/x86/boot/mca.c::query_mca()
...

    copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len);

...

arch/x86/kernel/setup.c::setup_arch()
...

    if (boot_params.sys_desc_table.length != 0) {
        machine_id = boot_params.sys_desc_table.table[0];
        machine_submodel_id = boot_params.sys_desc_table.table[1];
        BIOS_revision = boot_params.sys_desc_table.table[2];
    }

...

$ git grep machine_id
...
arch/x86/include/asm/processor.h:extern unsigned int            machine_id;
arch/x86/kernel/setup.c:unsigned int machine_id;
arch/x86/kernel/setup.c:                machine_id = boot_params.sys_desc_table.table[0];
...
$ git grep machine_submodel_id
arch/x86/include/asm/processor.h:extern unsigned int machine_submodel_id;
arch/x86/kernel/setup.c:unsigned int machine_submodel_id;
arch/x86/kernel/setup.c:                machine_submodel_id = boot_params.sys_desc_table.table[1];
$ git grep BIOS_revision
arch/x86/include/asm/processor.h:extern unsigned int            BIOS_revision;
arch/x86/kernel/setup.c:unsigned int BIOS_revision;
arch/x86/kernel/setup.c:                BIOS_revision = boot_params.sys_desc_table.table[2];

Compile tested with i386_defconfig, x86_64_defconfig and allyesconfig.

Paolo Pisati (1):
MCA: garbage collect sys_desc_table

 Documentation/x86/zero-page.txt       |  1 -
 arch/x86/boot/Makefile                |  2 +-
 arch/x86/boot/boot.h                  |  3 ---
 arch/x86/boot/compressed/eboot.c      |  4 ----
 arch/x86/boot/main.c                  |  3 ---
 arch/x86/boot/mca.c                   | 38 -----------------------------------
 arch/x86/include/asm/processor.h      |  8 --------
 arch/x86/include/uapi/asm/bootparam.h | 19 +++++++-----------
 arch/x86/kernel/kexec-bzimage64.c     |  3 ---
 arch/x86/kernel/setup.c               |  5 -----
 10 files changed, 8 insertions(+), 78 deletions(-)
 delete mode 100644 arch/x86/boot/mca.c
Signature · 1 line
2.1.4
Signature · 2 lines
bye,
p.