From patchwork Wed Aug 21 05:55:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 171917 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp521212ily; Tue, 20 Aug 2019 22:56:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwPhA9hNardahzFeigdegE70dZLDgBxqtUFUrdMtrNw9O9V5jH0+nK1pX31dmo8md5rkmL X-Received: by 2002:a62:e515:: with SMTP id n21mr34372041pff.186.1566366971418; Tue, 20 Aug 2019 22:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566366971; cv=none; d=google.com; s=arc-20160816; b=ilEYDwcTJmcN2zIYj+hXA4DoB4y330wt3i4f8Uu1JLHj/DlP15rZ7Rw1JY23daw1cD pfHhuky+Iu2H3iIFC3CaR4IS5KklqU+fi5litS2R2TKnqPXfbUt8Lft98BcOfbCGrvM+ Ur1dYdlPbxIBSzcgnCmd4sdB35e3y0kQzs2qIdYkpavKNQcpN+HlUDIXEao6yIUH7GYO cSplCqSyX3lDuV+Tfms0YlaRVcHdNzBbw5mozJfEa+JGp4I6+QMEKk2FkGJitVPQ2zkB 8aXAUyHuDixy3jG5z4V2saHwGR6W+JXxAROqOayqxUdrR62dE4hYEDoIbxXiiZhJBDSI w4MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lLwP3mTOJnfDSrV2MSql/pLg1RylIFBDj+4cxU85JLA=; b=YzrZl/6mD572Af2ETvUd7MSBRpigo62lK1kGmZFwejZaiugzSC2IbR+J62RNKYcfCb wg6w9x9R4gT+N+J53tGJnL04ZfY7RkV7c9vUIBZ90o6mb+OgHd9iOUm+ZqjTftib42Lv v80l2LuZyJU++9JHtjxJUdCN3XKHAEvBPRbLF7U44x8e/3v3JL/ek7fnjOb++gB1zFAS X+DHgJlcS9e58ZC82VVerOGZ2+7/ggsoWe6AfKcSh44fdb3kl/MEEf1qkrK3beJKjiLM 2fySKj/g7UNm7e9CJsW3jypaJWlAtD4qFp7vTQDNX7xs7IO4svNT8uAmr9ygacYM821o r7LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pgfPMqAY; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v63si13408321pgd.111.2019.08.20.22.56.11; Tue, 20 Aug 2019 22:56:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pgfPMqAY; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727674AbfHUF4K (ORCPT + 8 others); Wed, 21 Aug 2019 01:56:10 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38119 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbfHUF4K (ORCPT ); Wed, 21 Aug 2019 01:56:10 -0400 Received: by mail-pl1-f196.google.com with SMTP id w11so240010plp.5 for ; Tue, 20 Aug 2019 22:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lLwP3mTOJnfDSrV2MSql/pLg1RylIFBDj+4cxU85JLA=; b=pgfPMqAYF1GB9XdOwifBr9+txHI4Bvok60GT3VptbvsIKyyrpsDxznr48oNqWFPy0Z obk2AWdFDOJO0+HbeoUQsDLJlQ+6on9XrOFpnBktqGSAIDyZhQ0jBxBenpFZhF1PWadB B4kmu3+tV2X7lHFWqrBnCKQt/5dFxdRN7K1pn7xw7EzubDJKQkPsfeH0tAc5rxJJrw6Z LVK31Gulp/iQI6J2K/jicOEpE0ozIdVTu0dE1S6nXFUfy6EC/27Y1474FiMtF8fxNxka thf7+ZFwgxhFGCkkR8yG0CtCoZqcqUhcZxE8QGa9TVHf1/c/Aj0lT6oLDgbItlauMYlx EhoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lLwP3mTOJnfDSrV2MSql/pLg1RylIFBDj+4cxU85JLA=; b=oC4KP3dUlFqkzaAhT28gymUsvbQz6oqmB8RO8Y0XANlpMIV1ylhCwyeyXCKfRq+jbk jquqYQow0vQmzzc6QnT3lHjNTt47uyva55bsgLLD2R9ZNXFZlNoCziou2H8A548KrDUk H9bsuuY1dprWJ7DC0H9ODVsuIdxXps6DWNJxSiNdJaWzyGrBN27QWhZDEa9rjaaD5WJa r5waxB00a6Xd52GQLkDvYDU57knI1ww6HEMlWSje4Y/OZfSK3Gfb6yQNivGEqHmHjUhY eEsonG2yvPe/lo2wrzA4Phh4c6Ac2HJySEUxLrzsYjD9z5Zc5JZtVnb5i5RnTDWyLDFb 5qBg== X-Gm-Message-State: APjAAAX0UpJYTKCpHJs0iUw1NIBxuHWZFw6H4ozRN3r2Hyx8wDg6CO48 8Q1LGr7GgK1EhVriL+K4VzY= X-Received: by 2002:a17:902:e9:: with SMTP id a96mr16619138pla.169.1566366969567; Tue, 20 Aug 2019 22:56:09 -0700 (PDT) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id m9sm26568254pfh.84.2019.08.20.22.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 22:56:08 -0700 (PDT) From: Joel Stanley To: Rob Herring , Arnd Bergmann , Olof Johansson Cc: Ryan Chen , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Rutland , Andrew Jeffery , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH 4/7] ARM: aspeed: Enable SMP boot Date: Wed, 21 Aug 2019 15:25:27 +0930 Message-Id: <20190821055530.8720-5-joel@jms.id.au> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190821055530.8720-1-joel@jms.id.au> References: <20190821055530.8720-1-joel@jms.id.au> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This brings the secondary CPU into Linux. It depends on the setup performed by ASPEED's u-boot. Signed-off-by: Joel Stanley --- arch/arm/Makefile | 1 + arch/arm/mach-aspeed/Makefile | 5 +++ arch/arm/mach-aspeed/platsmp.c | 61 ++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 arch/arm/mach-aspeed/Makefile create mode 100644 arch/arm/mach-aspeed/platsmp.c -- 2.23.0.rc1 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index f96419135d35..be2fc3e79434 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -155,6 +155,7 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 machine-$(CONFIG_ARCH_ACTIONS) += actions machine-$(CONFIG_ARCH_ALPINE) += alpine machine-$(CONFIG_ARCH_ARTPEC) += artpec +machine-$(CONFIG_ARCH_ASPEED) += aspeed machine-$(CONFIG_ARCH_AT91) += at91 machine-$(CONFIG_ARCH_AXXIA) += axxia machine-$(CONFIG_ARCH_BCM) += bcm diff --git a/arch/arm/mach-aspeed/Makefile b/arch/arm/mach-aspeed/Makefile new file mode 100644 index 000000000000..1951b3317a76 --- /dev/null +++ b/arch/arm/mach-aspeed/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) ASPEED Technology Inc. +# Copyright IBM Corp. + +obj-$(CONFIG_SMP) += platsmp.o diff --git a/arch/arm/mach-aspeed/platsmp.c b/arch/arm/mach-aspeed/platsmp.c new file mode 100644 index 000000000000..2324becf7991 --- /dev/null +++ b/arch/arm/mach-aspeed/platsmp.c @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (C) ASPEED Technology Inc. +// Copyright IBM Corp. + +#include +#include +#include +#include + +#define BOOT_ADDR 0x00 +#define BOOT_SIG 0x04 + +static struct device_node *secboot_node; + +static int aspeed_g6_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + void __iomem *base; + + base = of_iomap(secboot_node, 0); + if (!base) { + pr_err("could not map the secondary boot base!"); + return -ENODEV; + } + + writel_relaxed(0, base + BOOT_ADDR); + writel_relaxed(__pa_symbol(secondary_startup_arm), base + BOOT_ADDR); + writel_relaxed((0xABBAAB00 | (cpu & 0xff)), base + BOOT_SIG); + + dsb_sev(); + + iounmap(base); + + return 0; +} + +static void __init aspeed_g6_smp_prepare_cpus(unsigned int max_cpus) +{ + void __iomem *base; + + secboot_node = of_find_compatible_node(NULL, NULL, "aspeed,ast2600-smpmem"); + if (!secboot_node) { + pr_err("secboot device node found!!\n"); + return; + } + + base = of_iomap(secboot_node, 0); + if (!base) { + pr_err("could not map the secondary boot base!"); + return; + } + __raw_writel(0xBADABABA, base + BOOT_SIG); + + iounmap(base); +} + +static const struct smp_operations aspeed_smp_ops __initconst = { + .smp_prepare_cpus = aspeed_g6_smp_prepare_cpus, + .smp_boot_secondary = aspeed_g6_boot_secondary, +}; + +CPU_METHOD_OF_DECLARE(aspeed_smp, "aspeed,ast2600-smp", &aspeed_smp_ops);