From patchwork Fri Feb 26 13:15:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 63046 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp712284lbc; Fri, 26 Feb 2016 05:16:58 -0800 (PST) X-Received: by 10.140.129.79 with SMTP id 76mr1895839qhb.28.1456492618644; Fri, 26 Feb 2016 05:16:58 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f80si13087096qkh.107.2016.02.26.05.16.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 26 Feb 2016 05:16:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dkim=fail header.i=@linaro.org Received: from localhost ([::1]:49688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIGP-00011Z-WD for patch@linaro.org; Fri, 26 Feb 2016 08:16:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIFK-0008IL-1g for qemu-devel@nongnu.org; Fri, 26 Feb 2016 08:15:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZIFH-0004EJ-Gw for qemu-devel@nongnu.org; Fri, 26 Feb 2016 08:15:49 -0500 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:38487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIFH-0004EC-Ab for qemu-devel@nongnu.org; Fri, 26 Feb 2016 08:15:47 -0500 Received: by mail-wm0-x22f.google.com with SMTP id a4so69525333wme.1 for ; Fri, 26 Feb 2016 05:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dds8zRny+PJpQFMM2ucRYvszTd6/bmDFghCy5iXg7Fk=; b=eJ3g4lNb4BBqiSl7S3XBYgnddHG/93c938qDLprkWgNmR9KdymBfuOD6faTd2UnVzi 7u9WVA/gXtdFK39SlNffFNcWhUuNYZlYDP1HnUfxjnF1vLfviqcqISTsV7WLOtLbi7WD 5dBMdU4fyJ3a5I0S0HVurX47qVxNmyOSvVkOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dds8zRny+PJpQFMM2ucRYvszTd6/bmDFghCy5iXg7Fk=; b=As2LH0C7DN0VQ9MEdzrSwwAlEQx61aKmguwfrGPy1Xk4aCxuXQLTOOnvuT9tMm3kjK Q9ljQs4lP9fH2j7z/B9Egoyj0pwbfEnxlff2iZPSsMgxe2nkTXY5b6QRylsCbHp2jSAL 11xD94Lf8H/3AoaT1BWWWbvAVW2WmqLfcLNSHvvRiPUZtgaYPoEwQE/2Ijmix0ZoU3Hq AqSCcWkJ10jKBFIR8sqn8ZIGKgzMNA0fhgYLJC1CZYdd9qHmltv5wDF5UP1lNc2P60NI F70L30PCVuqWqfbcc6X8CgKvdUUnvlLxKsud1EReoB5rAv/MQDPuuaFdMjw0HeX1Huo4 yRGQ== X-Gm-Message-State: AD7BkJIQvg8bDoEjzJef1e3A1mvMy/EwVwE+YsRSIdVLhTbfVUHVdItGe5C52lJKpMNNCVS4 X-Received: by 10.28.228.214 with SMTP id b205mr3364072wmh.94.1456492546833; Fri, 26 Feb 2016 05:15:46 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g3sm12442397wjw.31.2016.02.26.05.15.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2016 05:15:44 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 50D6F3E027C; Fri, 26 Feb 2016 13:15:41 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com Date: Fri, 26 Feb 2016 13:15:26 +0000 Message-Id: <1456492533-17171-5-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456492533-17171-1-git-send-email-alex.bennee@linaro.org> References: <1456492533-17171-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22f Cc: peter.maydell@linaro.org, drjones@redhat.com, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, will.deacon@arm.com, crosthwaitepeter@gmail.com, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [RFC 04/11] arm/arm64: Add IPI test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Andrew Jones Signed-off-by: Andrew Jones [ajb: slight tweak to .mak file] Signed-off-by: Alex Bennée --- arm/ipi-test.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ config/config-arm-common.mak | 2 ++ 2 files changed, 60 insertions(+) create mode 100644 arm/ipi-test.c -- 2.7.1 diff --git a/arm/ipi-test.c b/arm/ipi-test.c new file mode 100644 index 0000000..705295f --- /dev/null +++ b/arm/ipi-test.c @@ -0,0 +1,58 @@ +/* + * Test sending an IPI and handling IRQ exceptions. + * + * Copyright (C) 2015, Red Hat Inc, Andrew Jones + * + * This work is licensed under the terms of the GNU LGPL, version 2. + */ +#include +#include +#include +#include +#include +#include + +static volatile bool ready, acked, done; + +static void irq_handler(struct pt_regs *regs __unused) +{ + gic_irq_ack(); + acked = true; +} + +static void ipi_test(void) +{ + gic_enable(); +#ifdef __arm__ + install_exception_handler(EXCPTN_IRQ, irq_handler); +#else + install_irq_handler(EL1H_IRQ, irq_handler); +#endif + local_irq_enable(); + ready = true; + wfi(); + report("IPI", acked); + done = true; + halt(); +} + +int main(void) +{ + if (nr_cpus < 2) { + printf("ipi-test requires '-smp 2'\n"); + abort(); + } + + gic_enable(); + smp_boot_secondary(1, ipi_test); + + while (!ready) + cpu_relax(); + + gic_send_sgi(1, 1); + + while (!done) + cpu_relax(); + + return report_summary(); +} diff --git a/config/config-arm-common.mak b/config/config-arm-common.mak index e037507..d90eccc 100644 --- a/config/config-arm-common.mak +++ b/config/config-arm-common.mak @@ -11,6 +11,7 @@ endif tests-common = $(TEST_DIR)/selftest.flat tests-common += $(TEST_DIR)/spinlock-test.flat +tests-common += $(TEST_DIR)/ipi-test.flat all: test_cases @@ -69,3 +70,4 @@ test_cases: $(generated_files) $(tests-common) $(tests) $(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o $(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o +$(TEST_DIR)/ipi-test.elf: $(cstart.o) $(TEST_DIR)/ipi-test.o