From patchwork Wed Apr 28 10:18:41 2021 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: 12228487 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 D7964C433B4 for ; Wed, 28 Apr 2021 10:21:47 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 4667961107 for ; Wed, 28 Apr 2021 10:21:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4667961107 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OeGhtVPkMRB8vRTjSYE/B2rVR414iN0B052Mrt3NLPk=; b=GURlO77KbNz373dbD/tDIaYlC fG9zPRqzE42mGcQqbcOyGkLTSA9qhxa896aqY6to3MUqYz+L8u3SttQtkF35XfgC4StYShjkbWXOX ThRsucc7n8mUDFgwriKT/ff/hPvymxeVSPcvNntObq2ER9IICL9QM7jkSA5me0r45k6fSrS7pFwAi Lx5oiYNrFu/cbPMo+qFrZEO2BEmza4N0D19s1O/WWVMBxInxussnrNTunXYD0+iuuUzfw/8Lb/lrk faBuIzTfD7Xgt+r8a38K8z+8sAPUZiAp3ARUQBxl7HzUvTS8cnApbTz8Q2GwQBBDlh1Iukp+jDIt9 /mIP8aYmg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbhIG-003H3g-Nh; Wed, 28 Apr 2021 10:19:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbhHT-003H0d-1V for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 10:18:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=W/65gl/q8IPHxxfmkIEqzGwlIffS1aBvU9xDbEnZyHM=; b=vxwSDx5A00xoupB1W6WRICilDJ XJQv0es7yZpZpAH9svw65StWPeo+rEiFgO99F9kEReMXTmQBYvG8pOS+nJwRjt8CHsSwPI0dbcj8P FZgpvcBROTN7eBFLdU7OfXqWtZdD6Tw+nkQg9rB5eIIjEB1EIgwtW8ym5LB3Ims20cxNiCV/NuBqL SAFtEV/4Zdpx4C+COHabZZtSCc/8mFu3NsV/0zEFjdkUyDnoTDKmysrkTkhgKofBOj5Jn9tsCmRJ7 sHwmLygyuRoFxp32bNzPLaRdvuaeFmPQA7pAtmn7X4otzAFplYk6AU+AYrd0doKg0O0tKclV9MaWi l8ynE/Pg==; Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbhHQ-00HLzN-Dm for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 10:18:53 +0000 Received: by mail-wm1-x332.google.com with SMTP id g65so4306727wmg.2 for ; Wed, 28 Apr 2021 03:18:50 -0700 (PDT) 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=W/65gl/q8IPHxxfmkIEqzGwlIffS1aBvU9xDbEnZyHM=; b=SSrrTtwZJ02Zr0JA6NRj0GmP0uyFPOUSFabhokoV6Sy5GNCyllTC4VWQMLE81igmUe Wh0Vi6utYveAA/fpekiI7G8ty768Nqo3K2LOp81FzggyzgrXoRp1v5KCSAMdAMjCuyuX r9IM1GiXmva9cV/s22qi9+5GmGGbvx5LX8EDykKoW42J+NlR2k9rKWnZXSzadxTkzeUd 8J/bswhnJIBlc10SW99J5bPaBrR8JUigyAKh1GY1S03X1swxtLM4p+pB0ZXIwfxYh19v CSzoeIhOjW5U/V0rLWA1tjAH0VlGLBK6V5mrPM0R1DcsKn2suEmABcoaH6S5DiU8qNgM REDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W/65gl/q8IPHxxfmkIEqzGwlIffS1aBvU9xDbEnZyHM=; b=lxKXglgUqWiAOBw5McVaymMMy7/L5wJ5wA3HkYaRlmV9FQOBwZU275dvAlTSnFSuH8 JK4zO93niDP6v/PcDiIZ4VDYPAoMGdZl+BkU/gVqXc6uVGJ5YeipKoqC5Yipiggbv30J 4OOhA7FDdSZ09fpt5B5upQ53JWqsn/J5YCyEFrY+9CnQuCxSJcnK9K/Brxs6GCLRP6Q/ 5M8tIP9g84PySdXNHLufKOIrOVHFiUhHJCPRZQNmbhllXdlEzVbEPC6EV/VvRGOtDYSx nsBD1VvwIeS+M9/qJJYWgrhb5HBHHR/3wG5AnjYi4gEVjLd0swpMA0U6Kp6T9UG/Cabp WWRw== X-Gm-Message-State: AOAM530QNydP28OzRrdI56KspOVP7M0pgcvoq6UkvVGCx1DZ9Gt2GVVU +jhDG+UAkDbgDb1Ud17aiMiZXsvqawN28A== X-Google-Smtp-Source: ABdhPJxRO3MjPBAuuf7/5yeRHIOMTjCLbzPgeFWy3MG9Ge5F6gbUkBS3K7ic1Vpc5z70bIjpSShKyA== X-Received: by 2002:a7b:cd85:: with SMTP id y5mr3586309wmj.93.1619605129193; Wed, 28 Apr 2021 03:18:49 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b14sm7950544wrf.75.2021.04.28.03.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 03:18:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 27D401FF87; Wed, 28 Apr 2021 11:18:44 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: kvm@vger.kernel.org Cc: shashi.mallela@linaro.org, alexandru.elisei@arm.com, eric.auger@redhat.com, qemu-arm@nongnu.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@arm.com, maz@kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [kvm-unit-tests PATCH v1 1/4] arm64: split its-trigger test into KVM and TCG variants Date: Wed, 28 Apr 2021 11:18:41 +0100 Message-Id: <20210428101844.22656-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210428101844.22656-1-alex.bennee@linaro.org> References: <20210428101844.22656-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_031852_487880_45F290FE X-CRM114-Status: GOOD ( 17.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A few of the its-trigger tests rely on IMPDEF behaviour where caches aren't flushed before invall events. However TCG emulation doesn't model any invall behaviour and as we can't probe for it we need to be told. Split the test into a KVM and TCG variant and skip the invall tests when under TCG. Signed-off-by: Alex Bennée Cc: Shashi Mallela --- arm/gic.c | 60 +++++++++++++++++++++++++++-------------------- arm/unittests.cfg | 11 ++++++++- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index 98135ef..96a329d 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -36,6 +36,7 @@ static struct gic *gic; static int acked[NR_CPUS], spurious[NR_CPUS]; static int irq_sender[NR_CPUS], irq_number[NR_CPUS]; static cpumask_t ready; +static bool under_tcg; static void nr_cpu_check(int nr) { @@ -734,32 +735,38 @@ static void test_its_trigger(void) /* * re-enable the LPI but willingly do not call invall * so the change in config is not taken into account. - * The LPI should not hit + * The LPI should not hit. This does however depend on + * implementation defined behaviour - under QEMU TCG emulation + * it can quite correctly process the event directly. */ - gicv3_lpi_set_config(8195, LPI_PROP_DEFAULT); - stats_reset(); - cpumask_clear(&mask); - its_send_int(dev2, 20); - wait_for_interrupts(&mask); - report(check_acked(&mask, -1, -1), - "dev2/eventid=20 still does not trigger any LPI"); - - /* Now call the invall and check the LPI hits */ - stats_reset(); - cpumask_clear(&mask); - cpumask_set_cpu(3, &mask); - its_send_invall(col3); - wait_for_interrupts(&mask); - report(check_acked(&mask, 0, 8195), - "dev2/eventid=20 pending LPI is received"); - - stats_reset(); - cpumask_clear(&mask); - cpumask_set_cpu(3, &mask); - its_send_int(dev2, 20); - wait_for_interrupts(&mask); - report(check_acked(&mask, 0, 8195), - "dev2/eventid=20 now triggers an LPI"); + if (under_tcg) { + report_skip("checking LPI triggers without invall"); + } else { + gicv3_lpi_set_config(8195, LPI_PROP_DEFAULT); + stats_reset(); + cpumask_clear(&mask); + its_send_int(dev2, 20); + wait_for_interrupts(&mask); + report(check_acked(&mask, -1, -1), + "dev2/eventid=20 still does not trigger any LPI"); + + /* Now call the invall and check the LPI hits */ + stats_reset(); + cpumask_clear(&mask); + cpumask_set_cpu(3, &mask); + its_send_invall(col3); + wait_for_interrupts(&mask); + report(check_acked(&mask, 0, 8195), + "dev2/eventid=20 pending LPI is received"); + + stats_reset(); + cpumask_clear(&mask); + cpumask_set_cpu(3, &mask); + its_send_int(dev2, 20); + wait_for_interrupts(&mask); + report(check_acked(&mask, 0, 8195), + "dev2/eventid=20 now triggers an LPI"); + } report_prefix_pop(); @@ -981,6 +988,9 @@ int main(int argc, char **argv) if (argc < 2) report_abort("no test specified"); + if (argc == 3 && strcmp(argv[2], "tcg") == 0) + under_tcg = true; + if (strcmp(argv[1], "ipi") == 0) { report_prefix_push(argv[1]); nr_cpu_check(2); diff --git a/arm/unittests.cfg b/arm/unittests.cfg index f776b66..c72dc34 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -184,13 +184,22 @@ extra_params = -machine gic-version=3 -append 'its-introspection' groups = its arch = arm64 -[its-trigger] +[its-trigger-kvm] file = gic.flat smp = $MAX_SMP +accel = kvm extra_params = -machine gic-version=3 -append 'its-trigger' groups = its arch = arm64 +[its-trigger-tcg] +file = gic.flat +smp = $MAX_SMP +accel = tcg +extra_params = -machine gic-version=3 -append 'its-trigger tcg' +groups = its +arch = arm64 + [its-migration] file = gic.flat smp = $MAX_SMP