Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5909462rwb; Wed, 21 Sep 2022 14:25:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72Bl+SIWeDJn+ONi0LHt7PnhZUwEGUMlMPH9ZTVz6SNgwtdGqVVGQjtpVmKlpHJUTUo0dd X-Received: by 2002:a17:907:a0c6:b0:77d:7ad3:d05f with SMTP id hw6-20020a170907a0c600b0077d7ad3d05fmr189392ejc.734.1663795511742; Wed, 21 Sep 2022 14:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663795511; cv=none; d=google.com; s=arc-20160816; b=NVDHsVWX0OqKmQl4fQTOB3qAdzimZmbZ/jSuHY0fIgC+6o1HuKcdgxsHNB7PajTcmt jhf/4yU3VGSXyAJA2pj5G71TcmpqbHM3lu8b1uaXr4FNYKpn106OD4GVs8fXE8knLdZV dSmzeUWozh9IaOIzaFC0A/CW+15OTJsTcLUlEDWri/wM0GLOreYmoMbCzt9SDscVEGMB x4ys+ghGBoriEfx9tcUrVHX82Fc6O8hzw/M3bA4MCTQgCUbTsLYwXRz8OkymtQ+oi9wP 48ubXmp8kXmWf47qRBtBv5CkH69/M0N8c4pxuEzAuzq/szrwQPrzWx1qCcq6OO2Pcpfu G2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eYat1uCJDkfVTxQVLAjdR9+O2hpBg5EfLC0oZyPm3Jk=; b=gv9TU+hwgcPPv3d3mXpfSpfWrh76XyqpeSxNd6oKvun0G+lV7ovBge4rOq8VepYpdH fK+zx8KpJs1GfcXLt8YFOYLPuYWZLhSempGWbAQsTzGmSxn5RM/hewjosXJzY/dao8LH l4T53vK4w27pk79XWLJMbzmHIhQavfgXBplzQI5W55zNAufyuMTKjv8UTcd8ZOiu/iWy 5L2URkBn8sRJMROeYjSa2n+v38wTjguiObuuOGWPwZ8HH7BvMkqUktCCVDDPmjnu26Cb rAGcIFPKhtWHIjsvqX8oui7+5Kq9s4VDhu602SPy/9naNPKhmXbNzTccMYvM5fVumraV l7Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=yLd5kz5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wp.pl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090658c500b007821d14f2a8si2168184ejs.398.2022.09.21.14.24.44; Wed, 21 Sep 2022 14:25:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=yLd5kz5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wp.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbiIUU73 (ORCPT + 99 others); Wed, 21 Sep 2022 16:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbiIUU71 (ORCPT ); Wed, 21 Sep 2022 16:59:27 -0400 Received: from mx4.wp.pl (mx4.wp.pl [212.77.101.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3809A5705 for ; Wed, 21 Sep 2022 13:59:25 -0700 (PDT) Received: (wp-smtpd smtp.wp.pl 10811 invoked from network); 21 Sep 2022 22:59:22 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1663793962; bh=eYat1uCJDkfVTxQVLAjdR9+O2hpBg5EfLC0oZyPm3Jk=; h=From:To:Cc:Subject; b=yLd5kz5pQn06UdirC14XJMq7fqgHNUN8RpOCQjtmRkP+a/skd7WljLTiW0tKQve5Q DNz2067ulc1jVn0IKC2e4Z4Wphk/tnndw+WR5K1blQ/AQfYgmx1L9OrPrGHetQ+ANi zzSqlx+42FkBlPc7aYCSCDkg/T0v+nvbqq3sUNWA= Received: from ip-137-21.ds.pw.edu.pl (HELO LAPTOP-OLEK.lan) (olek2@wp.pl@[194.29.137.21]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 21 Sep 2022 22:59:22 +0200 From: Aleksander Jan Bajkowski To: john@phrozen.org, martin.blumenstingl@googlemail.com, hauke@hauke-m.de, tsbogend@alpha.franken.de, maz@kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Aleksander Jan Bajkowski Subject: [PATCH v2 1/1] MIPS: lantiq: enable all hardware interrupts on second VPE Date: Wed, 21 Sep 2022 22:59:44 +0200 Message-Id: <20220921205944.466745-2-olek2@wp.pl> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220921205944.466745-1-olek2@wp.pl> References: <20220921205944.466745-1-olek2@wp.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-WP-DKIM-Status: good (id: wp.pl) X-WP-MailID: 1fd3897e21a0bb49c1f0119ef35da854 X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 0000000 [sVP0] X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is needed to handle interrupts by the second VPE on the Lantiq ARX100, xRX200, xRX300 and xRX330 SoCs. Switching some ICU interrupts to the second VPE results in a hang. Currently, the vsmp_init_secondary() function is responsible for enabling these interrupts. It only enables Malta-specific interrupts (SW0, SW1, HW4 and HW5). The MIPS core has 8 interrupts defined. On Lantiq SoCs, hardware interrupts are wired to an ICU instance. Each VPE has an independent instance of the ICU. The mapping of the ICU interrupts is shown below: SW0(IP0) - IPI call, SW1(IP1) - IPI resched, HW0(IP2) - ICU 0-31, HW1(IP3) - ICU 32-63, HW2(IP4) - ICU 64-95, HW3(IP5) - ICU 96-127, HW4(IP6) - ICU 128-159, HW5(IP7) - timer. This patch enables all interrupt lines on the second VPE. This problem affects multithreaded SoCs with a custom interrupt controller. SOCs with 1004Kc core and newer use the MIPS GIC. At this point, I am aware that the Realtek RTL839x and RTL930x SoCs may need a similar fix. In the future, this may be replaced with some generic solution. Tested on Lantiq xRX200. Suggested-by: Thomas Bogendoerfer Signed-off-by: Aleksander Jan Bajkowski --- arch/mips/lantiq/prom.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c index c731082a0c42..be4829cc7a3a 100644 --- a/arch/mips/lantiq/prom.c +++ b/arch/mips/lantiq/prom.c @@ -34,6 +34,14 @@ unsigned long physical_memsize = 0L; */ static struct ltq_soc_info soc_info; +/* + * These structs are used to override vsmp_init_secondary() + */ +#if defined(CONFIG_MIPS_MT_SMP) +extern const struct plat_smp_ops vsmp_smp_ops; +static struct plat_smp_ops lantiq_smp_ops; +#endif + const char *get_system_type(void) { return soc_info.sys_type; @@ -84,6 +92,17 @@ void __init plat_mem_setup(void) __dt_setup_arch(dtb); } +#if defined(CONFIG_MIPS_MT_SMP) +static void lantiq_init_secondary(void) +{ + /* + * MIPS CPU startup function vsmp_init_secondary() will only + * enable some of the interrupts for the second CPU/VPE. + */ + set_c0_status(ST0_IM); +} +#endif + void __init prom_init(void) { /* call the soc specific detetcion code and get it to fill soc_info */ @@ -95,7 +114,10 @@ void __init prom_init(void) prom_init_cmdline(); #if defined(CONFIG_MIPS_MT_SMP) - if (register_vsmp_smp_ops()) - panic("failed to register_vsmp_smp_ops()"); + if (cpu_has_mipsmt) { + lantiq_smp_ops = vsmp_smp_ops; + lantiq_smp_ops.init_secondary = lantiq_init_secondary; + register_smp_ops(&lantiq_smp_ops); + } #endif } -- 2.30.2