Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/platform/uv: Add sysfs hubless leaves

Add uv_sysfs hubless leaves for UV hubless systems.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-4-mike.travis@hpe.com

authored by

Mike Travis and committed by
Borislav Petkov
433e817a 612a0063

+50 -2
+50 -2
drivers/platform/x86/uv_sysfs.c
··· 44 44 return "5.0"; 45 45 else if (is_uv2_hub()) 46 46 return "3.0"; 47 + else if (uv_get_hubless_system()) 48 + return "0.1"; 47 49 else 48 50 return "unknown"; 49 51 } ··· 750 748 return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type()); 751 749 } 752 750 751 + static ssize_t uv_hubless_show(struct kobject *kobj, 752 + struct kobj_attribute *attr, char *buf) 753 + { 754 + return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_get_hubless_system()); 755 + } 756 + 753 757 static struct kobj_attribute partition_id_attr = 754 758 __ATTR(partition_id, 0444, partition_id_show, NULL); 755 759 static struct kobj_attribute coherence_id_attr = ··· 766 758 __ATTR(archtype, 0444, uv_archtype_show, NULL); 767 759 static struct kobj_attribute uv_hub_type_attr = 768 760 __ATTR(hub_type, 0444, uv_hub_type_show, NULL); 761 + static struct kobj_attribute uv_hubless_attr = 762 + __ATTR(hubless, 0444, uv_hubless_show, NULL); 769 763 770 764 static struct attribute *base_attrs[] = { 771 765 &partition_id_attr.attr, ··· 815 805 return 0; 816 806 } 817 807 808 + static struct attribute *hubless_base_attrs[] = { 809 + &partition_id_attr.attr, 810 + &uv_type_attr.attr, 811 + &uv_archtype_attr.attr, 812 + &uv_hubless_attr.attr, 813 + NULL, 814 + }; 815 + 816 + static struct attribute_group hubless_base_attr_group = { 817 + .attrs = hubless_base_attrs 818 + }; 819 + 820 + 821 + static int __init uv_sysfs_hubless_init(void) 822 + { 823 + int ret; 824 + 825 + ret = sysfs_create_group(sgi_uv_kobj, &hubless_base_attr_group); 826 + if (ret) { 827 + pr_warn("sysfs_create_group hubless_base_attr_group failed\n"); 828 + kobject_put(sgi_uv_kobj); 829 + } 830 + return ret; 831 + } 832 + 818 833 static int __init uv_sysfs_init(void) 819 834 { 820 835 int ret = 0; 821 836 822 - if (!is_uv_system()) 837 + if (!is_uv_system() && !uv_get_hubless_system()) 823 838 return -ENODEV; 824 839 825 840 num_cnodes = uv_num_possible_blades(); ··· 855 820 pr_warn("kobject_create_and_add sgi_uv failed\n"); 856 821 return -EINVAL; 857 822 } 823 + 824 + if (uv_get_hubless_system()) 825 + return uv_sysfs_hubless_init(); 826 + 858 827 ret = sysfs_create_group(sgi_uv_kobj, &base_attr_group); 859 828 if (ret) { 860 829 pr_warn("sysfs_create_group base_attr_group failed\n"); ··· 896 857 return ret; 897 858 } 898 859 860 + static void __exit uv_sysfs_hubless_exit(void) 861 + { 862 + sysfs_remove_group(sgi_uv_kobj, &hubless_base_attr_group); 863 + kobject_put(sgi_uv_kobj); 864 + } 865 + 899 866 static void __exit uv_sysfs_exit(void) 900 867 { 901 - if (!is_uv_system()) 868 + if (!is_uv_system()) { 869 + if (uv_get_hubless_system()) 870 + uv_sysfs_hubless_exit(); 902 871 return; 872 + } 903 873 904 874 pci_topology_exit(); 905 875 uv_ports_exit();