Skip to content

Commit a61436d

Browse files
mike-travisSomasundaram Krishnasamy
authored andcommitted
x86/platform/uv: Add UV Hubbed/Hubless Proc FS Files
Upstream commit 8785968 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]> Orabug: 30518602 Signed-off-by: Somasundaram Krishnasamy <[email protected]> Reviewed-by: John Donnelly <[email protected]>
1 parent 0703ed7 commit a61436d

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
@@ -11,6 +11,8 @@ struct mm_struct;
1111

1212
#ifdef CONFIG_X86_UV
1313

14+
#define UV_PROC_NODE "sgi_uv"
15+
1416
static inline int uv(int uvtype)
1517
{
1618
/* uv(0) is "any" */
@@ -21,6 +23,7 @@ static inline int uv(int uvtype)
2123

2224
extern enum uv_system_type get_uv_system_type(void);
2325
extern int is_uv_system(void);
26+
extern int is_uv_hubbed(int uvtype);
2427
extern int is_uv_hubless(int uvtype);
2528
extern void uv_cpu_init(void);
2629
extern void uv_nmi_init(void);
@@ -32,6 +35,7 @@ extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
3235

3336
static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
3437
static inline int is_uv_system(void) { return 0; }
38+
static inline int is_uv_hubbed(int uv) { return 0; }
3539
static inline int is_uv_hubless(int uv) { return 0; }
3640
static inline void uv_cpu_init(void) { }
3741
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
@@ -45,6 +45,7 @@
4545
DEFINE_PER_CPU(int, x2apic_extra_bits);
4646

4747
static enum uv_system_type uv_system_type;
48+
static int uv_hubbed_system;
4849
static int uv_hubless_system;
4950
static u64 gru_start_paddr, gru_end_paddr;
5051
static u64 gru_dist_base, gru_first_node_paddr = -1LL, gru_last_node_paddr;
@@ -328,6 +329,24 @@ static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id)
328329
if (uv_hub_info->hub_revision == 0)
329330
goto badbios;
330331

332+
switch (uv_hub_info->hub_revision) {
333+
case UV4_HUB_REVISION_BASE:
334+
uv_hubbed_system = 0x11;
335+
break;
336+
337+
case UV3_HUB_REVISION_BASE:
338+
uv_hubbed_system = 0x9;
339+
break;
340+
341+
case UV2_HUB_REVISION_BASE:
342+
uv_hubbed_system = 0x5;
343+
break;
344+
345+
case UV1_HUB_REVISION_BASE:
346+
uv_hubbed_system = 0x3;
347+
break;
348+
}
349+
331350
pnodeid = early_get_pnodeid();
332351
early_get_apic_socketid_shift();
333352

@@ -377,6 +396,12 @@ int is_uv_system(void)
377396
}
378397
EXPORT_SYMBOL_GPL(is_uv_system);
379398

399+
int is_uv_hubbed(int uvtype)
400+
{
401+
return (uv_hubbed_system & uvtype);
402+
}
403+
EXPORT_SYMBOL_GPL(is_uv_hubbed);
404+
380405
int is_uv_hubless(int uvtype)
381406
{
382407
return (uv_hubless_system & uvtype);
@@ -1484,6 +1509,68 @@ static void __init build_socket_tables(void)
14841509
}
14851510
}
14861511

1512+
/* Setup user proc fs files */
1513+
static int proc_hubbed_show(struct seq_file *file, void *data)
1514+
{
1515+
seq_printf(file, "0x%x\n", uv_hubbed_system);
1516+
return 0;
1517+
}
1518+
1519+
static int proc_hubless_show(struct seq_file *file, void *data)
1520+
{
1521+
seq_printf(file, "0x%x\n", uv_hubless_system);
1522+
return 0;
1523+
}
1524+
1525+
static int proc_oemid_show(struct seq_file *file, void *data)
1526+
{
1527+
seq_printf(file, "%s/%s\n", oem_id, oem_table_id);
1528+
return 0;
1529+
}
1530+
1531+
static int proc_hubbed_open(struct inode *inode, struct file *file)
1532+
{
1533+
return single_open(file, proc_hubbed_show, (void *)NULL);
1534+
}
1535+
1536+
static int proc_hubless_open(struct inode *inode, struct file *file)
1537+
{
1538+
return single_open(file, proc_hubless_show, (void *)NULL);
1539+
}
1540+
1541+
static int proc_oemid_open(struct inode *inode, struct file *file)
1542+
{
1543+
return single_open(file, proc_oemid_show, (void *)NULL);
1544+
}
1545+
1546+
/* (struct is "non-const" as open function is set at runtime) */
1547+
static struct file_operations proc_version_fops = {
1548+
.read = seq_read,
1549+
.llseek = seq_lseek,
1550+
.release = single_release,
1551+
};
1552+
1553+
static const struct file_operations proc_oemid_fops = {
1554+
.open = proc_oemid_open,
1555+
.read = seq_read,
1556+
.llseek = seq_lseek,
1557+
.release = single_release,
1558+
};
1559+
1560+
static __init void uv_setup_proc_files(int hubless)
1561+
{
1562+
struct proc_dir_entry *pde;
1563+
char *name = hubless ? "hubless" : "hubbed";
1564+
1565+
pde = proc_mkdir(UV_PROC_NODE, NULL);
1566+
proc_create("oemid", 0, pde, &proc_oemid_fops);
1567+
proc_create(name, 0, pde, &proc_version_fops);
1568+
if (hubless)
1569+
proc_version_fops.open = proc_hubless_open;
1570+
else
1571+
proc_version_fops.open = proc_hubbed_open;
1572+
}
1573+
14871574
/* Initialize UV hubless systems */
14881575
static __init int uv_system_init_hubless(void)
14891576
{
@@ -1495,6 +1582,10 @@ static __init int uv_system_init_hubless(void)
14951582
/* Init kernel/BIOS interface */
14961583
rc = uv_bios_init();
14971584

1585+
/* Create user access node if UVsystab available */
1586+
if (rc >= 0)
1587+
uv_setup_proc_files(1);
1588+
14981589
return rc;
14991590
}
15001591

@@ -1623,7 +1714,7 @@ static void __init uv_system_init_hub(void)
16231714
uv_nmi_setup();
16241715
uv_cpu_init();
16251716
uv_scir_register_cpu_notifier();
1626-
proc_mkdir("sgi_uv", NULL);
1717+
uv_setup_proc_files(0);
16271718

16281719
/* Register Legacy VGA I/O redirection handler: */
16291720
pci_register_set_vga_state(uv_set_vga_state);

0 commit comments

Comments
 (0)