From: tip-bot for Jan Kiszka <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, jan.kiszka@siemens.com,
linux-kernel@vger.kernel.org, mingo@kernel.org,
tglx@linutronix.de
Subject: [tip:x86/platform] x86/jailhouse: Enable APIC and SMP support
Date: Sun, 14 Jan 2018 12:36:05 -0800 [thread overview]
Message-ID: <tip-11c8dc419bbc7b5acef812043feefc53c45ef558@git.kernel.org> (raw)
In-Reply-To: <8b2255da0a9856c530293a67aa9d6addfe102a2b.1511770314.git.jan.kiszka@siemens.com>
Commit-ID: 11c8dc419bbc7b5acef812043feefc53c45ef558
Gitweb: https://git.kernel.org/tip/11c8dc419bbc7b5acef812043feefc53c45ef558
Author: Jan Kiszka <jan.kiszka@siemens.com>
AuthorDate: Mon, 27 Nov 2017 09:11:47 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 14 Jan 2018 21:11:55 +0100
x86/jailhouse: Enable APIC and SMP support
Register the APIC which Jailhouse always exposes at 0xfee00000 if in
xAPIC mode or via MSRs as x2APIC. The latter is only available if it was
already activated because there is no support for switching its mode
during runtime.
Jailhouse requires the APIC to be operated in phys-flat mode. Ensure
that this mode is selected by Linux.
The available CPUs are taken from the setup data structure that the
loader filled and registered with the kernel.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: jailhouse-dev@googlegroups.com
Link: https://lkml.kernel.org/r/8b2255da0a9856c530293a67aa9d6addfe102a2b.1511770314.git.jan.kiszka@siemens.com
---
arch/x86/kernel/apic/apic_flat_64.c | 4 +++-
arch/x86/kernel/jailhouse.c | 42 +++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 4b55477..fcce5a7 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -19,6 +19,7 @@
#include <asm/smp.h>
#include <asm/apic.h>
#include <asm/ipi.h>
+#include <asm/jailhouse_para.h>
#include <linux/acpi.h>
@@ -239,7 +240,8 @@ static void physflat_send_IPI_all(int vector)
static int physflat_probe(void)
{
- if (apic == &apic_physflat || num_possible_cpus() > 8)
+ if (apic == &apic_physflat || num_possible_cpus() > 8 ||
+ jailhouse_paravirt())
return 1;
return 0;
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index 1186b89..57f4996 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -9,6 +9,7 @@
*/
#include <linux/kernel.h>
+#include <asm/apic.h>
#include <asm/cpu.h>
#include <asm/hypervisor.h>
#include <asm/setup.h>
@@ -29,12 +30,43 @@ static uint32_t __init jailhouse_detect(void)
return jailhouse_cpuid_base();
}
+static void __init jailhouse_get_smp_config(unsigned int early)
+{
+ unsigned int cpu;
+
+ if (x2apic_enabled()) {
+ /*
+ * We do not have access to IR inside Jailhouse non-root cells.
+ * So we have to run in physical mode.
+ */
+ x2apic_phys = 1;
+
+ /*
+ * This will trigger the switch to apic_x2apic_phys.
+ * Empty OEM IDs ensure that only this APIC driver picks up
+ * the call.
+ */
+ default_acpi_madt_oem_check("", "");
+ }
+
+ register_lapic_address(0xfee00000);
+
+ for (cpu = 0; cpu < setup_data.num_cpus; cpu++) {
+ generic_processor_info(setup_data.cpu_ids[cpu],
+ boot_cpu_apic_version);
+ }
+
+ smp_found_config = 1;
+}
+
static void __init jailhouse_init_platform(void)
{
u64 pa_data = boot_params.hdr.setup_data;
struct setup_data header;
void *mapping;
+ x86_init.mpparse.get_smp_config = jailhouse_get_smp_config;
+
while (pa_data) {
mapping = early_memremap(pa_data, sizeof(header));
memcpy(&header, mapping, sizeof(header));
@@ -66,8 +98,18 @@ bool jailhouse_paravirt(void)
return jailhouse_cpuid_base() != 0;
}
+static bool jailhouse_x2apic_available(void)
+{
+ /*
+ * The x2APIC is only available if the root cell enabled it. Jailhouse
+ * does not support switching between xAPIC and x2APIC.
+ */
+ return x2apic_enabled();
+}
+
const struct hypervisor_x86 x86_hyper_jailhouse __refconst = {
.name = "Jailhouse",
.detect = jailhouse_detect,
.init.init_platform = jailhouse_init_platform,
+ .init.x2apic_available = jailhouse_x2apic_available,
};
next prev parent reply other threads:[~2018-01-14 20:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 8:11 [PATCH v2 00/12] x86: Add support for running as secondary Jailhouse guest Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 01/12] x86/apic: Install an empty physflat_init_apic_ldr Jan Kiszka
2018-01-14 20:34 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 02/12] x86: Control warm reset setup via legacy feature flag Jan Kiszka
2018-01-14 20:34 ` [tip:x86/platform] x86/platform: " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 03/12] x86: Introduce and use MP IRQ trigger and polarity defines Jan Kiszka
2018-01-14 20:34 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 04/12] x86/jailhouse: Add infrastructure for running in non-root cell Jan Kiszka
2018-01-14 20:35 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 05/12] x86/jailhouse: Enable APIC and SMP support Jan Kiszka
2018-01-14 20:36 ` tip-bot for Jan Kiszka [this message]
2017-11-27 8:11 ` [PATCH v2 06/12] x86/jailhouse: Enable PMTIMER Jan Kiszka
2018-01-14 20:36 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 07/12] x86/jailhouse: Set up timekeeping Jan Kiszka
2018-01-14 20:37 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 08/12] x86/jailhouse: Avoid access of unsupported platform resources Jan Kiszka
2018-01-14 20:37 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 09/12] x86/jailhouse: Silence ACPI warning Jan Kiszka
2018-01-14 20:37 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 10/12] x86/jailhouse: Halt instead of failing to restart Jan Kiszka
2018-01-14 20:38 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 11/12] x86/jailhouse: Wire up IOAPIC for legacy UART ports Jan Kiszka
2018-01-14 20:38 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2017-11-27 8:11 ` [PATCH v2 12/12] x86/jailhouse: Initialize PCI support Jan Kiszka
2018-01-14 20:39 ` [tip:x86/platform] " tip-bot for Jan Kiszka
2018-01-22 22:26 ` [PATCH v2 12/12] " Bjorn Helgaas
2018-01-23 7:49 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-11c8dc419bbc7b5acef812043feefc53c45ef558@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox