]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: add IMSM_OROM_CAPABILITIES_TPV to nvme orom
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Thu, 22 Aug 2024 10:18:06 +0000 (12:18 +0200)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Fri, 30 Aug 2024 12:32:53 +0000 (14:32 +0200)
Add it to avoid excluding. It has some value for users even if it is
always true for nvme virtual orom.

Rework detail-platform printing code, move printing 3rd party nvmes
to print_imsm_capability (as it should be), but keep it meaningful
only for nvme controllers (NVME and VMD hba types). Pass whole
orom_entry instead of orom there.

Squash code responsible for printing NVME and VMD hbas.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
platform-intel.c
super-intel.c

index 3a86f785f756b2cb32e86eb6817315f511cf964c..215913175eed8a9561248b72531cce9a4932d07f 100644 (file)
@@ -1089,7 +1089,8 @@ const struct imsm_orom *find_imsm_nvme(struct sys_dev *hba)
                        .vpa = IMSM_OROM_VOLUMES_PER_ARRAY,
                        .vphba = IMSM_OROM_TOTAL_DISKS_NVME / 2 * IMSM_OROM_VOLUMES_PER_ARRAY,
                        .attr = IMSM_OROM_ATTR_2TB | IMSM_OROM_ATTR_2TB_DISK,
-                       .driver_features = IMSM_OROM_CAPABILITIES_EnterpriseSystem
+                       .driver_features = IMSM_OROM_CAPABILITIES_EnterpriseSystem |
+                                          IMSM_OROM_CAPABILITIES_TPV
                };
                nvme_orom = add_orom(&nvme_orom_compat);
        }
index 50fd56d03a12ba72830729b4ad8539fd26c2fc55..744715d5ac16df9f8dd5ec4d94f51114498c18c3 100644 (file)
@@ -2663,9 +2663,12 @@ static void print_imsm_chunk_size_capability(const struct imsm_orom *orom)
 }
 
 
-static void print_imsm_capability(const struct imsm_orom *orom)
+static void print_imsm_capability(const struct orom_entry *entry)
 {
+       const struct imsm_orom *orom = &entry->orom;
+
        printf("       Platform : Intel(R) ");
+
        if (orom->capabilities == 0 && orom->driver_features == 0)
                printf("Matrix Storage Manager\n");
        else if (imsm_orom_is_enterprise(orom) && orom->major_ver >= 6)
@@ -2673,6 +2676,7 @@ static void print_imsm_capability(const struct imsm_orom *orom)
        else
                printf("Rapid Storage Technology%s\n",
                        imsm_orom_is_enterprise(orom) ? " enterprise" : "");
+
        if (orom->major_ver || orom->minor_ver || orom->hotfix_ver || orom->build) {
                if (imsm_orom_is_vmd_without_efi(orom))
                        printf("        Version : %d.%d\n", orom->major_ver, orom->minor_ver);
@@ -2690,11 +2694,19 @@ static void print_imsm_capability(const struct imsm_orom *orom)
        printf("\n");
 
        printf("    2TB volumes :%s supported\n", (orom->attr & IMSM_OROM_ATTR_2TB) ? "" : " not");
+
        printf("      2TB disks :%s supported\n",
               (orom->attr & IMSM_OROM_ATTR_2TB_DISK) ? "" : " not");
+
        printf("      Max Disks : %d\n", orom->tds);
+
        printf("    Max Volumes : %d per array, %d per %s\n", orom->vpa, orom->vphba,
               imsm_orom_is_nvme(orom) ? "platform" : "controller");
+
+       if (entry->type == SYS_DEV_VMD || entry->type == SYS_DEV_NVME)
+               /* This is only meaningful for controllers with nvme support */
+               printf(" 3rd party NVMe :%s supported\n",
+                      imsm_orom_has_tpv_support(&entry->orom) ? "" : " not");
        return;
 }
 
@@ -2733,26 +2745,25 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
         * platform capabilities.  If raid support is disabled in the BIOS the
         * option-rom capability structure will not be available.
         */
+       const struct orom_entry *entry;
        struct sys_dev *list, *hba;
-       int host_base = 0;
+       struct devid_list *devid;
        int port_count = 0;
-       int result=1;
+       int host_base = 0;
+       int result = 1;
 
        if (enumerate_only) {
                if (check_no_platform())
                        return 0;
+
                list = find_intel_devices();
                if (!list)
                        return 2;
-               for (hba = list; hba; hba = hba->next) {
-                       if (find_imsm_capability(hba)) {
-                               result = 0;
-                               break;
-                       }
-                       else
-                               result = 2;
-               }
-               return result;
+
+               for (hba = list; hba; hba = hba->next)
+                       if (find_imsm_capability(hba))
+                               return 0;
+               return 2;
        }
 
        list = find_intel_devices();
@@ -2768,6 +2779,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
                        continue;
                if (!find_imsm_capability(hba)) {
                        char buf[PATH_MAX];
+
                        pr_err("imsm capabilities not found for controller: %s (type %s)\n",
                                  hba->type == SYS_DEV_VMD || hba->type == SYS_DEV_SATA_VMD ?
                                  vmd_domain_to_controller(hba, buf) :
@@ -2783,40 +2795,27 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
                return result;
        }
 
-       const struct orom_entry *entry;
-
        for (entry = orom_entries; entry; entry = entry->next) {
-               if (entry->type == SYS_DEV_VMD) {
-                       print_imsm_capability(&entry->orom);
-                       printf(" 3rd party NVMe :%s supported\n",
-                           imsm_orom_has_tpv_support(&entry->orom)?"":" not");
+               print_imsm_capability(entry);
+
+               if (entry->type == SYS_DEV_VMD || entry->type == SYS_DEV_NVME) {
                        for (hba = list; hba; hba = hba->next) {
-                               if (hba->type == SYS_DEV_VMD) {
-                                       char buf[PATH_MAX];
+                               char buf[PATH_MAX];
+
+                               if (hba->type != entry->type)
+                                       continue;
+
+                               if (hba->type == SYS_DEV_VMD)
                                        printf(" I/O Controller : %s (%s)\n",
-                                               vmd_domain_to_controller(hba, buf), get_sys_dev_type(hba->type));
-                                       if (print_nvme_info(hba)) {
-                                               if (verbose > 0)
-                                                       pr_err("failed to get devices attached to VMD domain.\n");
-                                               result |= 2;
-                                       }
-                               }
-                       }
-                       printf("\n");
-                       continue;
-               }
+                                              vmd_domain_to_controller(hba, buf),
+                                              get_sys_dev_type(hba->type));
 
-               print_imsm_capability(&entry->orom);
-               if (entry->type == SYS_DEV_NVME) {
-                       for (hba = list; hba; hba = hba->next) {
-                               if (hba->type == SYS_DEV_NVME)
-                                       print_nvme_info(hba);
+                               print_nvme_info(hba);
                        }
                        printf("\n");
                        continue;
                }
 
-               struct devid_list *devid;
                for (devid = entry->devid_list; devid; devid = devid->next) {
                        hba = device_by_id(devid->devid);
                        if (!hba)
@@ -6035,8 +6034,7 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
                        pr_err("%s controller supports Multi-Path I/O, Intel (R) VROC does not support multipathing\n",
                               basename(cntrl_path));
 
-               if (super->hba->type == SYS_DEV_VMD && super->orom &&
-                   !imsm_orom_has_tpv_support(super->orom)) {
+               if (super->orom && !imsm_orom_has_tpv_support(super->orom)) {
                        pr_err("\tPlatform configuration does not support non-Intel NVMe drives.\n"
                               "\tPlease refer to Intel(R) RSTe/VROC user guide.\n");
                        goto error;