diff --git a/0121-imsm-support-for-third-Sata-controller.patch b/0121-imsm-support-for-third-Sata-controller.patch new file mode 100644 index 0000000..316548b --- /dev/null +++ b/0121-imsm-support-for-third-Sata-controller.patch @@ -0,0 +1,125 @@ +From f94df5cf83917df50a3436dd067c751504bfc665 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Wed, 17 Mar 2021 13:01:54 +0100 +Subject: [PATCH] imsm: support for third Sata controller +Git-commit: f94df5cf83917df50a3436dd067c751504bfc665 +Patch-mainline: mdadm-4.2-rc1~4 +References: bsc#1201297 + +Add new UEFI TSata variable. Remove CSata variable. +This variable has been never exposed by UEFI. +Remove vulnerability to match different hbas with SATA variable. + +Signed-off-by: Mariusz Tkaczyk +Signed-off-by: Jes Sorensen +Acked-by: Coly Li +--- + platform-intel.c | 58 ++++++++++++++++++++++++++---------------------- + 1 file changed, 31 insertions(+), 27 deletions(-) + +diff --git a/platform-intel.c b/platform-intel.c +index 0e1ec3d..2da152f 100644 +--- a/platform-intel.c ++++ b/platform-intel.c +@@ -488,7 +488,7 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) + #define SCU_PROP "RstScuV" + #define AHCI_PROP "RstSataV" + #define AHCI_SSATA_PROP "RstsSatV" +-#define AHCI_CSATA_PROP "RstCSatV" ++#define AHCI_TSATA_PROP "RsttSatV" + #define VMD_PROP "RstUefiV" + + #define VENDOR_GUID \ +@@ -496,7 +496,8 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) + + #define PCI_CLASS_RAID_CNTRL 0x010400 + +-static int read_efi_var(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) ++static int read_efi_var(void *buffer, ssize_t buf_size, ++ const char *variable_name, struct efi_guid guid) + { + char path[PATH_MAX]; + char buf[GUID_STR_MAX]; +@@ -525,7 +526,8 @@ static int read_efi_var(void *buffer, ssize_t buf_size, char *variable_name, str + return 0; + } + +-static int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) ++static int read_efi_variable(void *buffer, ssize_t buf_size, ++ const char *variable_name, struct efi_guid guid) + { + char path[PATH_MAX]; + char buf[GUID_STR_MAX]; +@@ -578,7 +580,9 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) + { + struct imsm_orom orom; + struct orom_entry *ret; +- int err; ++ static const char * const sata_efivars[] = {AHCI_PROP, AHCI_SSATA_PROP, ++ AHCI_TSATA_PROP}; ++ unsigned long i; + + if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) + return imsm_platform_test(hba); +@@ -587,35 +591,35 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) + if (check_env("IMSM_TEST_OROM")) + return NULL; + +- if (hba->type == SYS_DEV_SATA && hba->class != PCI_CLASS_RAID_CNTRL) +- return NULL; +- +- err = read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID); ++ switch (hba->type) { ++ case SYS_DEV_SAS: ++ if (!read_efi_variable(&orom, sizeof(orom), SCU_PROP, ++ VENDOR_GUID)) ++ break; + +- /* try to read variable for second AHCI controller */ +- if (err && hba->type == SYS_DEV_SATA) +- err = read_efi_variable(&orom, sizeof(orom), AHCI_SSATA_PROP, VENDOR_GUID); ++ return NULL; ++ case SYS_DEV_SATA: ++ if (hba->class != PCI_CLASS_RAID_CNTRL) ++ return NULL; + +- /* try to read variable for combined AHCI controllers */ +- if (err && hba->type == SYS_DEV_SATA) { +- static struct orom_entry *csata; ++ for (i = 0; i < ARRAY_SIZE(sata_efivars); i++) { ++ if (!read_efi_variable(&orom, sizeof(orom), ++ sata_efivars[i], VENDOR_GUID)) ++ break; + +- err = read_efi_variable(&orom, sizeof(orom), AHCI_CSATA_PROP, VENDOR_GUID); +- if (!err) { +- if (!csata) +- csata = add_orom(&orom); +- add_orom_device_id(csata, hba->dev_id); +- csata->type = hba->type; +- return &csata->orom; + } +- } ++ if (i == ARRAY_SIZE(sata_efivars)) ++ return NULL; + +- if (hba->type == SYS_DEV_VMD) { +- err = read_efi_variable(&orom, sizeof(orom), VMD_PROP, VENDOR_GUID); +- } +- +- if (err) ++ break; ++ case SYS_DEV_VMD: ++ if (!read_efi_variable(&orom, sizeof(orom), VMD_PROP, ++ VENDOR_GUID)) ++ break; + return NULL; ++ default: ++ return NULL; ++ } + + ret = add_orom(&orom); + add_orom_device_id(ret, hba->dev_id); +-- +2.35.3 + diff --git a/1005-mdadm-enable-Intel-Alderlake-RSTe-configuration.patch b/1005-mdadm-enable-Intel-Alderlake-RSTe-configuration.patch new file mode 100644 index 0000000..c6ace72 --- /dev/null +++ b/1005-mdadm-enable-Intel-Alderlake-RSTe-configuration.patch @@ -0,0 +1,60 @@ +From 449c8b62164880ab132ad6eec86a8d53f793af69 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Tue, 19 Jul 2022 13:18:23 +0800 +Subject: [PATCH 19/23] mdadm: enable Intel Alderlake RSTe configuration +Patch-mainline: N/A, SUSE only patch +References: bsc#1201297 + +Alderlake has a slightly different RST configuration; the UEFI +variable is name 'RstVmdV', and the AHCI controller shows up as +a child device of the VMD bridge, but continues to use the 'AHCI HBA' +PCI class (and not the RAID class as RSTe would normally do). + +Signed-off-by: Hannes Reinecke +Acked-by: Coly Li +--- + platform-intel.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/platform-intel.c b/platform-intel.c +index 5a8729e7..a4d55a38 100644 +--- a/platform-intel.c ++++ b/platform-intel.c +@@ -512,12 +512,14 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) + #define AHCI_PROP "RstSataV" + #define AHCI_SSATA_PROP "RstsSatV" + #define AHCI_TSATA_PROP "RsttSatV" ++#define AHCI_RST_PROP "RstVmdV" + #define VMD_PROP "RstUefiV" + + #define VENDOR_GUID \ + EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6) + + #define PCI_CLASS_RAID_CNTRL 0x010400 ++#define PCI_CLASS_SATA_HBA 0x010601 + + static int read_efi_var(void *buffer, ssize_t buf_size, + const char *variable_name, struct efi_guid guid) +@@ -604,7 +606,8 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) + struct imsm_orom orom; + struct orom_entry *ret; + static const char * const sata_efivars[] = {AHCI_PROP, AHCI_SSATA_PROP, +- AHCI_TSATA_PROP}; ++ AHCI_TSATA_PROP, ++ AHCI_RST_PROP}; + unsigned long i; + + if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) +@@ -622,7 +625,8 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) + + return NULL; + case SYS_DEV_SATA: +- if (hba->class != PCI_CLASS_RAID_CNTRL) ++ if (hba->class != PCI_CLASS_RAID_CNTRL && ++ hba->class != PCI_CLASS_SATA_HBA) + return NULL; + + for (i = 0; i < ARRAY_SIZE(sata_efivars); i++) { +-- +2.35.3 + diff --git a/mdadm.changes b/mdadm.changes index d1862e2..74700c7 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Aug 11 11:41:37 UTC 2022 - Coly Li + +- imsm: support for third Sata controller (bsc#1201297) + 0121-imsm-support-for-third-Sata-controller.patch +- mdadm: enable Intel Alderlake RSTe configuration (bsc#1201297) + 1005-mdadm-enable-Intel-Alderlake-RSTe-configuration.patch + ------------------------------------------------------------------- Mon May 30 08:25:00 UTC 2022 - Heming Zhao diff --git a/mdadm.spec b/mdadm.spec index ec6ffcf..a38dda3 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -159,10 +159,12 @@ Patch117: 0117-Grow-be-careful-of-corrupt-dev_roles-list.patch Patch118: 0118-Remove-Spare-drives-line-from-details-for-external-m.patch Patch119: 0119-Don-t-associate-spares-with-other-arrays-during-RAID.patch Patch120: 0120-udev-md-raid-assembly.rules-skip-if-DM_UDEV_DISABLE_.patch +Patch121: 0121-imsm-support-for-third-Sata-controller.patch Patch1001: 1001-display-timeout-status.patch Patch1002: 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch Patch1003: 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch Patch1004: 1004-mdadm-super1-restore-commit-45a87c2f31335-to-fix-clu.patch +Patch1005: 1005-mdadm-enable-Intel-Alderlake-RSTe-configuration.patch %define _udevdir %(pkg-config --variable=udevdir udev) %define _systemdshutdowndir %{_unitdir}/../system-shutdown @@ -287,10 +289,12 @@ mdadm is a program that can be used to control Linux md devices. %patch118 -p1 %patch119 -p1 %patch120 -p1 +%patch121 -p1 %patch1001 -p1 %patch1002 -p1 %patch1003 -p1 %patch1004 -p1 +%patch1005 -p1 %build make %{?_smp_mflags} CC="%__cc" CXFLAGS="%{optflags} -Wno-error" SUSE=yes BINDIR=%{_sbindir}