Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1228907
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Daniel J Blueman <daniel@numascale.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/4] x86: Add Numachip2 APIC support |
| Date | Sun, 20 Sep 2015 19:20:01 +0200 |
| Message-ID | <qaQrn-6fo-5@gated-at.bofh.it> (permalink) |
| References | <qaQrn-6fo-3@gated-at.bofh.it> |
| X-Original-To | Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com> |
| Authentication-Results | spf=none (sender IP is ) smtp.mailfrom=daniel@numascale.com; |
| X-Mailer | git-send-email 2.5.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| X-Originating-IP | [175.156.157.249] |
| X-Clientproxiedby | DB5PR03CA0064.eurprd03.prod.outlook.com (25.164.34.32) To AM4PR07MB1298.eurprd07.prod.outlook.com (25.164.81.156) |
| X-Microsoft-Exchange-Diagnostics | 1;AM4PR07MB1298;2:MP4/YZDZ+66trvWIX7yJCnZar4DEthOCN1Ph2+xl+qNSnSQag/1/gSsdwnWVcJIZ9IqOCkbGzMQBzPaDrlmc7526z5q9ztQWmP7HW9u/2GAk17a/uf2WJrVsTlq1vgwfHUpYLVH3skzUjifAFaurhiYWHHUsKj8sABKdjU5+M5c=;3:rdwEcRzYIiwzDpGv45/ypYFghrz4Aps6yClQT0o2rhbxjpOGQKEY85v0LovFtCbb5juMeyjd5NuvJI9qiOU47M2Rmiink6crB3k4maY8DZhvlw7SqbXLmn8RkfC34IFzp+OwfI4ILA/ja2CDMc9zsg==;25:vQ7EpLeApj9BUdW0IybXKKqLEnTEB8lyuR6IQAMR///SIO2utu0+eLJ8cyaQxPA6qykbsfXN7/xICW4IS+HCm14DefSlw1btIXpoKZuJYu43GYh7I/0f/XRNoqGkxHVg368ghEGVzfxzev6kjSmHnpjFv/wYqlVx+3O3Z0+fee2hsovq2c4deopr+6QHJA2Fj9EiZOn+VNJ5N9GFJAKnljE59P5yA3BWn6kt5Nk1CWHlthsEBp7MbXA+0CrAT3oK;4:vuR8mFaye0QKzlmpLsmRM+flG9LNnc4WI/NBRi3CCY/8FeP8OBCe8wUtLdfTa1rdTHR77eWUsXmm1aL/VvITCRdqhet9gdykQeutTRAhboFluBy1M6zpqW10mXkJHnyLdtVB1Ryp5P+22xYasBu7XdpdN4Ix6Fn75vWqPBgDMvwPYm/v+KQKA4klqq1azRy8XBT1LFng5YlIe2zoHgPGEOxjZb7DI8lDFpX/BMGj604= |
| X-Microsoft-Antispam | UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR07MB1298; |
| X-Exchange-Antispam-Report-Cfa | BCL:0;PCL:0;RULEID:;SRVR:AM4PR07MB1298;BCL:0;PCL:0;RULEID:;SRVR:AM4PR07MB1298; |
| X-Forefront-Prvs | 0705EB1700 |
| X-Forefront-Antispam-Report | SFV:NSPM;SFS:(10019020)(6009001)(6069001)(189002)(199003)(33646002)(122386002)(46102003)(101416001)(92566002)(19580395003)(76176999)(62966003)(19580405001)(5001770100001)(77156002)(50986999)(87976001)(86362001)(36756003)(4001540100001)(40100003)(5001830100001)(81156007)(97736004)(50226001)(5001860100001)(189998001)(2950100001)(42186005)(106356001)(47776003)(77096005)(68736005)(105586002)(5004730100002)(229853001)(5003940100001)(64706001)(50466002)(48376002)(66066001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM4PR07MB1298;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; |
| Received-Spf | None (protection.outlook.com: numascale.com does not designate permitted sender hosts) |
| X-Microsoft-Exchange-Diagnostics | 1;AM4PR07MB1298;23:47qoYb6SA2hSRXT28oEstv6X/x+GHXRaRE7DTEy7YLy8GsmxB8ErH6Qg2gDVtYATeC+W/mYA+Bvfz2HiytPHoKdT/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MB1298;5:ouPgGl5TizUyLg7LkD0FK5YbcvAKRXOslzGkEvU1LGsu2+/mxib9I8qfGdINOOUXLT/MqRV+b5TvWe6DP6L4yCco1yoziOX/gf12+yoBXwe4wRvdQ3S/+zaOWL0IDGqROPRApXbrCGeecMA5jZiYMg==;24:VFNehto5kXzySB2A4EXu6HNRX6tuwwsKKg9BbapU3ew8fK+MpKL2He5L1oKmVELwSHMC9IXTVfOgmNDNc+9jFb2lhsVX6p+TEqnZKfaoaG8=;20:MoWc1UaSFUP5ndu5T3FZrxlmujzE8WosdBOam97oPamoYek7AXlCFKkTsJE3RqJRFFEjuoJnxCb9gTh4Zccd/A== |
| Spamdiagnosticoutput | 1:23 |
| Spamdiagnosticmetadata | NSPM |
| X-Originatororg | numascale.com |
| X-Ms-Exchange-Crosstenant-Originalarrivaltime | 20 Sep 2015 17:02:21.2931 (UTC) |
| X-Ms-Exchange-Crosstenant-Fromentityheader | Hosted |
| X-Ms-Exchange-Transport-Crosstenantheadersstamped | AM4PR07MB1298 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 227 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Daniel J Blueman <daniel@numascale.com>, <x86@kernel.org>, <linux-kernel@vger.kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Steffen Persvold <sp@numascale.com> |
| X-Original-Date | Mon, 21 Sep 2015 01:02:00 +0800 |
| X-Original-Message-ID | <1442768522-19217-2-git-send-email-daniel@numascale.com> |
| X-Original-References | <1442768522-19217-1-git-send-email-daniel@numascale.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1228907 |
Show key headers only | View raw
Introduce support for Numachip2 remote interrupts via detecting the right
ACPI SRAT signature.
Access is performed via a fixed mapping in the x86 physical address space.
Signed-off-by: Daniel J Blueman <daniel@numascale.com>
Acked-by: Steffen Persvold <sp@numascale.com>
---
arch/x86/include/asm/numachip/numachip.h | 1 +
arch/x86/include/asm/numachip/numachip_csr.h | 34 ++++++++++
arch/x86/kernel/apic/apic_numachip.c | 93 ++++++++++++++++++++++++++++
3 files changed, 128 insertions(+)
diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h
index 1c6f7f6..c64373a 100644
--- a/arch/x86/include/asm/numachip/numachip.h
+++ b/arch/x86/include/asm/numachip/numachip.h
@@ -14,6 +14,7 @@
#ifndef _ASM_X86_NUMACHIP_NUMACHIP_H
#define _ASM_X86_NUMACHIP_NUMACHIP_H
+extern u8 numachip_system;
extern int __init pci_numachip_init(void);
#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */
diff --git a/arch/x86/include/asm/numachip/numachip_csr.h b/arch/x86/include/asm/numachip/numachip_csr.h
index 7469b13..c7efc25 100644
--- a/arch/x86/include/asm/numachip/numachip_csr.h
+++ b/arch/x86/include/asm/numachip/numachip_csr.h
@@ -14,6 +14,7 @@
#ifndef _ASM_X86_NUMACHIP_NUMACHIP_CSR_H
#define _ASM_X86_NUMACHIP_NUMACHIP_CSR_H
+#include <linux/smp.h>
#include <linux/io.h>
#define CSR_NODE_SHIFT 16
@@ -50,4 +51,38 @@ static inline void write_lcsr(unsigned long offset, unsigned int val)
writel(swab32(val), lcsr_address(offset));
}
+/*
+ * On NumaChip2, local CSR space is 16MB and starts at fixed offset below 4G
+ */
+
+#define NUMACHIP2_LCSR_BASE 0xf0000000UL
+#define NUMACHIP2_LCSR_SIZE 0x1000000UL
+#define NUMACHIP2_APIC_ICR 0x100000
+
+static inline void __iomem *numachip2_lcsr_address(unsigned long offset)
+{
+ return (void __iomem *)__va(NUMACHIP2_LCSR_BASE |
+ (offset & (NUMACHIP2_LCSR_SIZE - 1)));
+}
+
+static inline u32 numachip2_read32_lcsr(unsigned long offset)
+{
+ return readl(numachip2_lcsr_address(offset));
+}
+
+static inline u64 numachip2_read64_lcsr(unsigned long offset)
+{
+ return readq(numachip2_lcsr_address(offset));
+}
+
+static inline void numachip2_write32_lcsr(unsigned long offset, u32 val)
+{
+ writel(val, numachip2_lcsr_address(offset));
+}
+
+static inline void numachip2_write64_lcsr(unsigned long offset, u64 val)
+{
+ writeq(val, numachip2_lcsr_address(offset));
+}
+
#endif /* _ASM_X86_NUMACHIP_NUMACHIP_CSR_H */
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 8729249..dfe2b1c 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -22,6 +22,7 @@
u8 numachip_system __read_mostly;
static const struct apic apic_numachip1;
+static const struct apic apic_numachip2;
static void (*numachip_apic_icr_write)(int apicid, unsigned int val) __read_mostly;
static unsigned int numachip1_get_apic_id(unsigned long x)
@@ -45,6 +46,19 @@ static unsigned long numachip1_set_apic_id(unsigned int id)
return x;
}
+static unsigned int numachip2_get_apic_id(unsigned long x)
+{
+ u64 mcfg;
+
+ rdmsrl(MSR_FAM10H_MMIO_CONF_BASE, mcfg);
+ return ((mcfg >> (28 - 8)) & 0xfff00) | (x >> 24);
+}
+
+static unsigned long numachip2_set_apic_id(unsigned int id)
+{
+ return id << 24;
+}
+
static int numachip_apic_id_valid(int apicid)
{
/* Trust what bootloader passes in MADT */
@@ -66,6 +80,11 @@ static void numachip1_apic_icr_write(int apicid, unsigned int val)
write_lcsr(CSR_G3_EXT_IRQ_GEN, (apicid << 16) | val);
}
+static void numachip2_apic_icr_write(int apicid, unsigned int val)
+{
+ numachip2_write32_lcsr(NUMACHIP2_APIC_ICR, (apicid << 12) | val);
+}
+
static int numachip_wakeup_secondary(int phys_apicid, unsigned long start_rip)
{
numachip_apic_icr_write(phys_apicid, APIC_DM_INIT);
@@ -129,6 +148,11 @@ static int __init numachip1_probe(void)
return apic == &apic_numachip1;
}
+static int __init numachip2_probe(void)
+{
+ return apic == &apic_numachip2;
+}
+
static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
{
u64 val;
@@ -154,6 +178,13 @@ static int __init numachip_system_init(void)
numachip_apic_icr_write = numachip1_apic_icr_write;
x86_init.pci.arch_init = pci_numachip_init;
break;
+ case 2:
+ init_extra_mapping_uc(NUMACHIP2_LCSR_BASE, NUMACHIP2_LCSR_SIZE);
+ numachip_apic_icr_write = numachip2_apic_icr_write;
+
+ /* Use MCFG config cycles rather than locked CF8 cycles */
+ raw_pci_ops = &pci_mmcfg;
+ break;
default:
return 0;
}
@@ -175,6 +206,17 @@ static int numachip1_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
return 1;
}
+static int numachip2_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+ if ((strncmp(oem_id, "NUMASC", 6) != 0) ||
+ (strncmp(oem_table_id, "NCONECT2", 8) != 0))
+ return 0;
+
+ numachip_system = 2;
+
+ return 1;
+}
+
static const struct apic apic_numachip1 __refconst = {
.name = "NumaConnect system",
.probe = numachip1_probe,
@@ -225,3 +267,54 @@ static const struct apic apic_numachip1 __refconst = {
};
apic_driver(apic_numachip1);
+
+static const struct apic apic_numachip2 __refconst = {
+ .name = "NumaConnect2 system",
+ .probe = numachip2_probe,
+ .acpi_madt_oem_check = numachip2_acpi_madt_oem_check,
+ .apic_id_valid = numachip_apic_id_valid,
+ .apic_id_registered = numachip_apic_id_registered,
+
+ .irq_delivery_mode = dest_Fixed,
+ .irq_dest_mode = 0, /* physical */
+
+ .target_cpus = online_target_cpus,
+ .disable_esr = 0,
+ .dest_logical = 0,
+ .check_apicid_used = NULL,
+
+ .vector_allocation_domain = default_vector_allocation_domain,
+ .init_apic_ldr = flat_init_apic_ldr,
+
+ .ioapic_phys_id_map = NULL,
+ .setup_apic_routing = NULL,
+ .cpu_present_to_apicid = default_cpu_present_to_apicid,
+ .apicid_to_cpu_present = NULL,
+ .check_phys_apicid_present = default_check_phys_apicid_present,
+ .phys_pkg_id = numachip_phys_pkg_id,
+
+ .get_apic_id = numachip2_get_apic_id,
+ .set_apic_id = numachip2_set_apic_id,
+ .apic_id_mask = 0xffU << 24,
+
+ .cpu_mask_to_apicid_and = default_cpu_mask_to_apicid_and,
+
+ .send_IPI_mask = numachip_send_IPI_mask,
+ .send_IPI_mask_allbutself = numachip_send_IPI_mask_allbutself,
+ .send_IPI_allbutself = numachip_send_IPI_allbutself,
+ .send_IPI_all = numachip_send_IPI_all,
+ .send_IPI_self = numachip_send_IPI_self,
+
+ .wakeup_secondary_cpu = numachip_wakeup_secondary,
+ .inquire_remote_apic = NULL, /* REMRD not supported */
+
+ .read = native_apic_mem_read,
+ .write = native_apic_mem_write,
+ .eoi_write = native_apic_mem_write,
+ .icr_read = native_apic_icr_read,
+ .icr_write = native_apic_icr_write,
+ .wait_icr_idle = native_apic_wait_icr_idle,
+ .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
+};
+
+apic_driver(apic_numachip2);
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 2/4] x86: Add Numachip2 APIC support Daniel J Blueman <daniel@numascale.com> - 2015-09-20 19:20 +0200
csiph-web