[PATCH] Add iSCSI IBFT support (v0.4.3)
This patch (v0.4.3) adds /sysfs/firmware/ibft/[initiator|targetX|ethernetX| extensionX] directories along with text properties which export the the iSCSI Boot Firmware Table (iBFT) structure. What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI tools to extract from the machine NICs the iSCSI connection information so that they can automagically mount the iSCSI share/target. Currently the iSCSI information is hard-coded in the initrd. For full details of the IBFT structure please take a look at: ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf Please note that this patch depends on the Greg KH patches tree kobject changes. Signed-off-by: Konrad Rzeszutek <[EMAIL PROTECTED]> diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft new file mode 100644 index 000..4898740 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-ibft @@ -0,0 +1,31 @@ +What: /sys/firmware/ibft/initiator +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/initiator directory will contain + files that expose the iSCSI Boot Firmware Table initiator data. + Usually this contains the Initiator name. + +What: /sys/firmware/ibft/targetX +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/targetX directory will contain + files that expose the iSCSI Boot Firmware Table target data. + Usually this contains the target's IP address, boot LUN, + target name, and what NIC it is associated with. It can also + contain the CHAP name (and password), the reverse CHAP + name (and password) + +What: /sys/firmware/ibft/ethernetX +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/ethernetX directory will contain + files that expose the iSCSI Boot Firmware Table NIC data. + This can this can the IP address, MAC, and gateway of the NIC. + +What: /sys/firmware/ibft/extensionX +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/extensionX directory will contain + files that expose the iSCSI Boot Firmware Table extension data. + The extended data structure is not supported so there would be + no files in this directory. diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index e1e18c3..32900df 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c @@ -39,6 +39,7 @@ #include #include #include #include +#include #include #include #include @@ -148,6 +149,20 @@ static inline void copy_edd(void) } #endif +#if defined(CONFIG_ISCSI_IBFT_FIND) +static void __init reserve_ibft_region(void) +{ + unsigned int ibft_len; + + ibft_len = find_ibft(); + if (ibft_len) + reserve_bootmem((unsigned int)ibft_phys, + PAGE_ALIGN(ibft_len)); +} +#else +static void __init reserve_ibft_region(void) { } +#endif + int __initdata user_defined_memmap = 0; /* @@ -496,6 +511,8 @@ #ifdef CONFIG_BLK_DEV_INITRD } #endif reserve_crashkernel(); + + reserve_ibft_region(); } /* diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 30d94d1..307fb99 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c @@ -33,6 +33,7 @@ #include #include #include #include +#include #include #include #include @@ -198,6 +199,20 @@ static inline void copy_edd(void) } #endif +#if defined(CONFIG_ISCSI_IBFT_FIND) +static void __init reserve_ibft_region(void) +{ + unsigned int ibft_len; + + ibft_len = find_ibft(); + if (ibft_len) + reserve_bootmem_generic((unsigned long)ibft_phys, + PAGE_ALIGN(ibft_len)); +} +#else +static void __init reserve_ibft_region(void) { } +#endif + #ifdef CONFIG_KEXEC static void __init reserve_crashkernel(void) { @@ -403,6 +418,9 @@ #ifdef CONFIG_BLK_DEV_INITRD } #endif reserve_crashkernel(); + + reserve_ibft_region(); + paging_init(); #ifdef CONFIG_PCI diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 05f02a3..e2f7208 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -93,4 +93,23 @@ config DMIID information from userspace through /sys/class/dmi/id/ or if you want DMI-based module auto-loading. +config ISCSI_IBFT_FIND + bool "iSCSI Boot Firmware Table Attributes" + default n + help + This option enables the kernel to find the region of memory + in which the ISCSI Boot Firmware Table (iBFT) resides. This + is
[PATCH] Add iSCSI IBFT support (v0.4.3)
This patch (v0.4.3) adds /sysfs/firmware/ibft/[initiator|targetX|ethernetX| extensionX] directories along with text properties which export the the iSCSI Boot Firmware Table (iBFT) structure. What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI tools to extract from the machine NICs the iSCSI connection information so that they can automagically mount the iSCSI share/target. Currently the iSCSI information is hard-coded in the initrd. For full details of the IBFT structure please take a look at: ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf Please note that this patch depends on the Greg KH patches tree kobject changes. Signed-off-by: Konrad Rzeszutek [EMAIL PROTECTED] diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft new file mode 100644 index 000..4898740 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-ibft @@ -0,0 +1,31 @@ +What: /sys/firmware/ibft/initiator +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/initiator directory will contain + files that expose the iSCSI Boot Firmware Table initiator data. + Usually this contains the Initiator name. + +What: /sys/firmware/ibft/targetX +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/targetX directory will contain + files that expose the iSCSI Boot Firmware Table target data. + Usually this contains the target's IP address, boot LUN, + target name, and what NIC it is associated with. It can also + contain the CHAP name (and password), the reverse CHAP + name (and password) + +What: /sys/firmware/ibft/ethernetX +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/ethernetX directory will contain + files that expose the iSCSI Boot Firmware Table NIC data. + This can this can the IP address, MAC, and gateway of the NIC. + +What: /sys/firmware/ibft/extensionX +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/extensionX directory will contain + files that expose the iSCSI Boot Firmware Table extension data. + The extended data structure is not supported so there would be + no files in this directory. diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index e1e18c3..32900df 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c @@ -39,6 +39,7 @@ #include linux/module.h #include linux/efi.h #include linux/init.h #include linux/edd.h +#include linux/iscsi_ibft.h #include linux/nodemask.h #include linux/kexec.h #include linux/crash_dump.h @@ -148,6 +149,20 @@ static inline void copy_edd(void) } #endif +#if defined(CONFIG_ISCSI_IBFT_FIND) +static void __init reserve_ibft_region(void) +{ + unsigned int ibft_len; + + ibft_len = find_ibft(); + if (ibft_len) + reserve_bootmem((unsigned int)ibft_phys, + PAGE_ALIGN(ibft_len)); +} +#else +static void __init reserve_ibft_region(void) { } +#endif + int __initdata user_defined_memmap = 0; /* @@ -496,6 +511,8 @@ #ifdef CONFIG_BLK_DEV_INITRD } #endif reserve_crashkernel(); + + reserve_ibft_region(); } /* diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 30d94d1..307fb99 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c @@ -33,6 +33,7 @@ #include linux/pci.h #include linux/acpi.h #include linux/kallsyms.h #include linux/edd.h +#include linux/iscsi_ibft.h #include linux/mmzone.h #include linux/kexec.h #include linux/cpufreq.h @@ -198,6 +199,20 @@ static inline void copy_edd(void) } #endif +#if defined(CONFIG_ISCSI_IBFT_FIND) +static void __init reserve_ibft_region(void) +{ + unsigned int ibft_len; + + ibft_len = find_ibft(); + if (ibft_len) + reserve_bootmem_generic((unsigned long)ibft_phys, + PAGE_ALIGN(ibft_len)); +} +#else +static void __init reserve_ibft_region(void) { } +#endif + #ifdef CONFIG_KEXEC static void __init reserve_crashkernel(void) { @@ -403,6 +418,9 @@ #ifdef CONFIG_BLK_DEV_INITRD } #endif reserve_crashkernel(); + + reserve_ibft_region(); + paging_init(); #ifdef CONFIG_PCI diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 05f02a3..e2f7208 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -93,4 +93,23 @@ config DMIID information from userspace through /sys/class/dmi/id/ or if you want DMI-based module auto-loading. +config ISCSI_IBFT_FIND + bool iSCSI Boot
Re: [PATCH] Add iSCSI IBFT support (v0.4.3)
> > > > > This patch adds /sysfs/firmware/ibft/[initiator|targetX|ethernetX] > > > > > directories along with text properties which export the the iSCSI Boot > > > > > Firmware Table (iBFT) structure. > > > > > > > > > > What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI > > > > > tools to extract from the machine NICs the iSCSI connection > > > > > information > > > > > so that they can automagically mount the iSCSI share/target. Currently > > > > > the iSCSI information is hard-coded in the initrd. > > > > > > > > > > For full details of the IBFT structure please take a look at: > > > > > ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf > > > > > > > > Here is an updated version which provides an attribute symlink (in the > > > > ethernetX directory) called 'device' to the NIC device, instead of > > > > exporting a 'pci_bdf' file which had the "bus:slot:func" values. > > > > > > > > Review would be much appreciated. > > > > This next version (0.4.2) includes: much better error unrolling > > when kobject registration fails, fixes from Doug's review, and uses the > > 'kset_create_and_add' API that Greg KH posted. It has been tested on > > todays 2.6.24-rc4-gkh tree. > > Looks much nicer, good job. Thank you. > > However I changed the kobject api again, so some minor changes will need > to happen (kobject_init() and kobject_add() parameters have changed), > and you don't need to call kobject_del() right before kobject_put(). > Hm, that last one was always true, so that wasn't needed before... > > Do you want me to add this to my driver/ tree and fix up the kobject > issues there so it all builds properly, and it gets sent to Linus for > 2.6.25? Yes please. Albeit I've made changes to it to accommodate your newest set of patches. It is using kobject_init_and_add and making the error unrolling match the other changed drivers. I've tested it with your tree (yesterday) and had no trouble. Here it is: Signed-off-by: Konrad Rzeszutek <[EMAIL PROTECTED]> diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft new file mode 100644 index 000..4898740 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-ibft @@ -0,0 +1,31 @@ +What: /sys/firmware/ibft/initiator +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/initiator directory will contain + files that expose the iSCSI Boot Firmware Table initiator data. + Usually this contains the Initiator name. + +What: /sys/firmware/ibft/targetX +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/targetX directory will contain + files that expose the iSCSI Boot Firmware Table target data. + Usually this contains the target's IP address, boot LUN, + target name, and what NIC it is associated with. It can also + contain the CHAP name (and password), the reverse CHAP + name (and password) + +What: /sys/firmware/ibft/ethernetX +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/ethernetX directory will contain + files that expose the iSCSI Boot Firmware Table NIC data. + This can this can the IP address, MAC, and gateway of the NIC. + +What: /sys/firmware/ibft/extensionX +Date: November 2007 +Contact: Konrad Rzeszutek <[EMAIL PROTECTED]> +Description: The /sys/firmware/ibft/extensionX directory will contain + files that expose the iSCSI Boot Firmware Table extension data. + The extended data structure is not supported so there would be + no files in this directory. diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index e1e18c3..32900df 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c @@ -39,6 +39,7 @@ #include #include #include #include +#include #include #include #include @@ -148,6 +149,20 @@ static inline void copy_edd(void) } #endif +#if defined(CONFIG_ISCSI_IBFT_FIND) +static void __init reserve_ibft_region(void) +{ + unsigned int ibft_len; + + ibft_len = find_ibft(); + if (ibft_len) + reserve_bootmem((unsigned int)ibft_phys, + PAGE_ALIGN(ibft_len)); +} +#else +static void __init reserve_ibft_region(void) { } +#endif + int __initdata user_defined_memmap = 0; /* @@ -496,6 +511,8 @@ #ifdef CONFIG_BLK_DEV_INITRD } #endif reserve_crashkernel(); + + reserve_ibft_region(); } /* diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 30d94d1..307fb99 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c @@ -33,6 +33,7 @@ #include #include #include
Re: [PATCH] Add iSCSI IBFT support (v0.4.3)
This patch adds /sysfs/firmware/ibft/[initiator|targetX|ethernetX] directories along with text properties which export the the iSCSI Boot Firmware Table (iBFT) structure. What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI tools to extract from the machine NICs the iSCSI connection information so that they can automagically mount the iSCSI share/target. Currently the iSCSI information is hard-coded in the initrd. For full details of the IBFT structure please take a look at: ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf Here is an updated version which provides an attribute symlink (in the ethernetX directory) called 'device' to the NIC device, instead of exporting a 'pci_bdf' file which had the bus:slot:func values. Review would be much appreciated. This next version (0.4.2) includes: much better error unrolling when kobject registration fails, fixes from Doug's review, and uses the 'kset_create_and_add' API that Greg KH posted. It has been tested on todays 2.6.24-rc4-gkh tree. Looks much nicer, good job. Thank you. However I changed the kobject api again, so some minor changes will need to happen (kobject_init() and kobject_add() parameters have changed), and you don't need to call kobject_del() right before kobject_put(). Hm, that last one was always true, so that wasn't needed before... Do you want me to add this to my driver/ tree and fix up the kobject issues there so it all builds properly, and it gets sent to Linus for 2.6.25? Yes please. Albeit I've made changes to it to accommodate your newest set of patches. It is using kobject_init_and_add and making the error unrolling match the other changed drivers. I've tested it with your tree (yesterday) and had no trouble. Here it is: Signed-off-by: Konrad Rzeszutek [EMAIL PROTECTED] diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft new file mode 100644 index 000..4898740 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-ibft @@ -0,0 +1,31 @@ +What: /sys/firmware/ibft/initiator +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/initiator directory will contain + files that expose the iSCSI Boot Firmware Table initiator data. + Usually this contains the Initiator name. + +What: /sys/firmware/ibft/targetX +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/targetX directory will contain + files that expose the iSCSI Boot Firmware Table target data. + Usually this contains the target's IP address, boot LUN, + target name, and what NIC it is associated with. It can also + contain the CHAP name (and password), the reverse CHAP + name (and password) + +What: /sys/firmware/ibft/ethernetX +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/ethernetX directory will contain + files that expose the iSCSI Boot Firmware Table NIC data. + This can this can the IP address, MAC, and gateway of the NIC. + +What: /sys/firmware/ibft/extensionX +Date: November 2007 +Contact: Konrad Rzeszutek [EMAIL PROTECTED] +Description: The /sys/firmware/ibft/extensionX directory will contain + files that expose the iSCSI Boot Firmware Table extension data. + The extended data structure is not supported so there would be + no files in this directory. diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index e1e18c3..32900df 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c @@ -39,6 +39,7 @@ #include linux/module.h #include linux/efi.h #include linux/init.h #include linux/edd.h +#include linux/iscsi_ibft.h #include linux/nodemask.h #include linux/kexec.h #include linux/crash_dump.h @@ -148,6 +149,20 @@ static inline void copy_edd(void) } #endif +#if defined(CONFIG_ISCSI_IBFT_FIND) +static void __init reserve_ibft_region(void) +{ + unsigned int ibft_len; + + ibft_len = find_ibft(); + if (ibft_len) + reserve_bootmem((unsigned int)ibft_phys, + PAGE_ALIGN(ibft_len)); +} +#else +static void __init reserve_ibft_region(void) { } +#endif + int __initdata user_defined_memmap = 0; /* @@ -496,6 +511,8 @@ #ifdef CONFIG_BLK_DEV_INITRD } #endif reserve_crashkernel(); + + reserve_ibft_region(); } /* diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 30d94d1..307fb99 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c @@ -33,6 +33,7 @@ #include linux/pci.h #include linux/acpi.h