Skip to content

Commit 8785968

Browse files
mike-travisIngo Molnar
authored andcommitted
x86/platform/uv: Add UV Hubbed/Hubless Proc FS Files
Indicate to UV user utilities that UV hubless support is available on this system via the existing /proc infterface. The current interface is maintained with the addition of new /proc leaves ("hubbed", "hubless", and "oemid") that contain the specific type of UV arch this one is. Signed-off-by: Mike Travis <[email protected]> Reviewed-by: Steve Wahl <[email protected]> Reviewed-by: Dimitri Sivanich <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Hedi Berriche <[email protected]> Cc: Justin Ernst <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Russ Anderson <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 2bcf265 commit 8785968

File tree

2 files changed

+96
-1
lines changed

2 files changed

+96
-1
lines changed

arch/x86/include/asm/uv/uv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ struct mm_struct;
1212
#ifdef CONFIG_X86_UV
1313
#include <linux/efi.h>
1414

15+
#define UV_PROC_NODE "sgi_uv"
16+
1517
static inline int uv(int uvtype)
1618
{
1719
/* uv(0) is "any" */
@@ -28,6 +30,7 @@ static inline bool is_early_uv_system(void)
2830
return uv_systab_phys && uv_systab_phys != EFI_INVALID_TABLE_ADDR;
2931
}
3032
extern int is_uv_system(void);
33+
extern int is_uv_hubbed(int uvtype);
3134
extern int is_uv_hubless(int uvtype);
3235
extern void uv_cpu_init(void);
3336
extern void uv_nmi_init(void);
@@ -40,6 +43,7 @@ extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
4043
static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
4144
static inline bool is_early_uv_system(void) { return 0; }
4245
static inline int is_uv_system(void) { return 0; }
46+
static inline int is_uv_hubbed(int uv) { return 0; }
4347
static inline int is_uv_hubless(int uv) { return 0; }
4448
static inline void uv_cpu_init(void) { }
4549
static inline void uv_system_init(void) { }

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
static DEFINE_PER_CPU(int, x2apic_extra_bits);
2727

2828
static enum uv_system_type uv_system_type;
29+
static int uv_hubbed_system;
2930
static int uv_hubless_system;
3031
static u64 gru_start_paddr, gru_end_paddr;
3132
static u64 gru_dist_base, gru_first_node_paddr = -1LL, gru_last_node_paddr;
@@ -309,6 +310,24 @@ static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id)
309310
if (uv_hub_info->hub_revision == 0)
310311
goto badbios;
311312

313+
switch (uv_hub_info->hub_revision) {
314+
case UV4_HUB_REVISION_BASE:
315+
uv_hubbed_system = 0x11;
316+
break;
317+
318+
case UV3_HUB_REVISION_BASE:
319+
uv_hubbed_system = 0x9;
320+
break;
321+
322+
case UV2_HUB_REVISION_BASE:
323+
uv_hubbed_system = 0x5;
324+
break;
325+
326+
case UV1_HUB_REVISION_BASE:
327+
uv_hubbed_system = 0x3;
328+
break;
329+
}
330+
312331
pnodeid = early_get_pnodeid();
313332
early_get_apic_socketid_shift();
314333

@@ -359,6 +378,12 @@ int is_uv_system(void)
359378
}
360379
EXPORT_SYMBOL_GPL(is_uv_system);
361380

381+
int is_uv_hubbed(int uvtype)
382+
{
383+
return (uv_hubbed_system & uvtype);
384+
}
385+
EXPORT_SYMBOL_GPL(is_uv_hubbed);
386+
362387
int is_uv_hubless(int uvtype)
363388
{
364389
return (uv_hubless_system & uvtype);
@@ -1457,6 +1482,68 @@ static void __init build_socket_tables(void)
14571482
}
14581483
}
14591484

1485+
/* Setup user proc fs files */
1486+
static int proc_hubbed_show(struct seq_file *file, void *data)
1487+
{
1488+
seq_printf(file, "0x%x\n", uv_hubbed_system);
1489+
return 0;
1490+
}
1491+
1492+
static int proc_hubless_show(struct seq_file *file, void *data)
1493+
{
1494+
seq_printf(file, "0x%x\n", uv_hubless_system);
1495+
return 0;
1496+
}
1497+
1498+
static int proc_oemid_show(struct seq_file *file, void *data)
1499+
{
1500+
seq_printf(file, "%s/%s\n", oem_id, oem_table_id);
1501+
return 0;
1502+
}
1503+
1504+
static int proc_hubbed_open(struct inode *inode, struct file *file)
1505+
{
1506+
return single_open(file, proc_hubbed_show, (void *)NULL);
1507+
}
1508+
1509+
static int proc_hubless_open(struct inode *inode, struct file *file)
1510+
{
1511+
return single_open(file, proc_hubless_show, (void *)NULL);
1512+
}
1513+
1514+
static int proc_oemid_open(struct inode *inode, struct file *file)
1515+
{
1516+
return single_open(file, proc_oemid_show, (void *)NULL);
1517+
}
1518+
1519+
/* (struct is "non-const" as open function is set at runtime) */
1520+
static struct file_operations proc_version_fops = {
1521+
.read = seq_read,
1522+
.llseek = seq_lseek,
1523+
.release = single_release,
1524+
};
1525+
1526+
static const struct file_operations proc_oemid_fops = {
1527+
.open = proc_oemid_open,
1528+
.read = seq_read,
1529+
.llseek = seq_lseek,
1530+
.release = single_release,
1531+
};
1532+
1533+
static __init void uv_setup_proc_files(int hubless)
1534+
{
1535+
struct proc_dir_entry *pde;
1536+
char *name = hubless ? "hubless" : "hubbed";
1537+
1538+
pde = proc_mkdir(UV_PROC_NODE, NULL);
1539+
proc_create("oemid", 0, pde, &proc_oemid_fops);
1540+
proc_create(name, 0, pde, &proc_version_fops);
1541+
if (hubless)
1542+
proc_version_fops.open = proc_hubless_open;
1543+
else
1544+
proc_version_fops.open = proc_hubbed_open;
1545+
}
1546+
14601547
/* Initialize UV hubless systems */
14611548
static __init int uv_system_init_hubless(void)
14621549
{
@@ -1468,6 +1555,10 @@ static __init int uv_system_init_hubless(void)
14681555
/* Init kernel/BIOS interface */
14691556
rc = uv_bios_init();
14701557

1558+
/* Create user access node if UVsystab available */
1559+
if (rc >= 0)
1560+
uv_setup_proc_files(1);
1561+
14711562
return rc;
14721563
}
14731564

@@ -1596,7 +1687,7 @@ static void __init uv_system_init_hub(void)
15961687
uv_nmi_setup();
15971688
uv_cpu_init();
15981689
uv_scir_register_cpu_notifier();
1599-
proc_mkdir("sgi_uv", NULL);
1690+
uv_setup_proc_files(0);
16001691

16011692
/* Register Legacy VGA I/O redirection handler: */
16021693
pci_register_set_vga_state(uv_set_vga_state);

0 commit comments

Comments
 (0)