From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6068CFA372C for ; Fri, 8 Nov 2019 14:45:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05E1D214DB for ; Fri, 8 Nov 2019 14:45:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I5G10KTD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05E1D214DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=baDIUh0yP+bNcZCn8SAgHmZdUHqho+wzckbFeEGhBQ4=; b=I5G10KTDcd3USMTIqcrH0l2mLa EeD7i+G+yvAHMMpo3BW+UdPI0JgUO/KPfpQUSi6Hpva4Djblz/F3DMhJM24xIWGrRaFBpMzkS0tnF 9MvZVDKhrSX413y6YvFkUVyL7snO6mJ0jEh/E1rbU4s2Si+w8J+5qsqciSxK725tBJL8VF1QNeMNi PtyxEpsLkQak86K0RyN5UyXlZtORZiU43UVXM3hB/xmCCKmj5vMyXC2LXwzIaKd+wfGY7l3bFctrR MuPgUoUqhwhDyYmV8zwK5m7Gzug+ms5mc3MjtWLNd5V+zuD0Bf429O8BSUO661lJHT9/4Fd05XXqs X5TeLK6Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iT5Ve-0001hc-Gj; Fri, 08 Nov 2019 14:45:10 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iT5Ta-0007dG-4b for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 14:43:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 35E5446A; Fri, 8 Nov 2019 06:43:01 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 18ADD3F719; Fri, 8 Nov 2019 06:42:59 -0800 (PST) From: Andre Przywara To: Andrew Jones , Paolo Bonzini Subject: [kvm-unit-tests PATCH 08/17] arm: gic: Add simple SPI MP test Date: Fri, 8 Nov 2019 14:42:31 +0000 Message-Id: <20191108144240.204202-9-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191108144240.204202-1-andre.przywara@arm.com> References: <20191108144240.204202-1-andre.przywara@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191108_064302_258617_1BC0C437 X-CRM114-Status: GOOD ( 11.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Alexandru Elisei , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Shared Peripheral Interrupts (SPI) can target a specific CPU. Test this feature by routing the test SPI to each of the vCPUs, then triggering it and confirm its reception on that requested core. Signed-off-by: Andre Przywara --- arm/gic.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arm/gic.c b/arm/gic.c index 63aa9f4..304b7b9 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -620,16 +620,45 @@ static void spi_test_single(void) check_acked("now enabled SPI fires", &cpumask); } +static void spi_test_smp(void) +{ + int cpu; + int cores = 1; + + wait_on_ready(); + for_each_present_cpu(cpu) { + if (cpu == smp_processor_id()) + continue; + spi_configure_irq(SPI_IRQ, cpu); + if (trigger_and_check_spi(NULL, IRQ_STAT_IRQ, cpu)) + cores++; + else + report_info("SPI delivery failed on core %d", cpu); + } + report("SPI delievered on all cores", cores == nr_cpus); +} + static void spi_send(void) { irqs_enable(); spi_test_single(); + if (nr_cpus > 1) + spi_test_smp(); + check_spurious(); exit(report_summary()); } +static void spi_test(void *data __unused) +{ + if (smp_processor_id() == 0) + spi_send(); + else + irq_recv(); +} + int main(int argc, char **argv) { if (!gic_init()) { @@ -663,7 +692,7 @@ int main(int argc, char **argv) report_prefix_pop(); } else if (strcmp(argv[1], "irq") == 0) { report_prefix_push(argv[1]); - spi_send(); + on_cpus(spi_test, NULL); report_prefix_pop(); } else { report_abort("Unknown subtest '%s'", argv[1]); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel