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=-8.3 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,URIBL_BLOCKED,USER_AGENT_SANE_1 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 4BB02C43331 for ; Tue, 12 Nov 2019 11:11:49 +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 1D9C62084E for ; Tue, 12 Nov 2019 11:11:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SOYgkUrk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D9C62084E 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O4gwHNhdAoiDpABr0OiiCyRhMIr1Ug5hVBydNL71788=; b=SOYgkUrktaWZtM Dw+5lKjxthbw8STcJjt8eNQTR9T79iLmdsU1Rd48q1aQH069HCl6JaySLZGSerM4WxTOxHpYywESC IwddfL7Eni4JhNW7X7FUYhRFaSBc9NSfbtGwLRTZflyMcmCWJwE78rrNNwv6QGIgwT2xOPYECKRVb YqQlKz/Q6bu6dqJ1UteiPktvSai9FI5t87j6UawneJyEFEJNBuFsvstDycEU0eGKSFILAXPrScRJr nhQdTcnu1QT61CweRiboYqX1COTDdWdgtgoeiFJFxvqIrJPMyj5Maw6zSWw12yRHo19ssZqE7cZN+ jalj1/sS9x2tBbOL4PZA==; 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 1iUU5L-0002MN-Sf; Tue, 12 Nov 2019 11:11:47 +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 1iUU5I-0002Le-IU for linux-arm-kernel@lists.infradead.org; Tue, 12 Nov 2019 11:11:46 +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 F390A31B; Tue, 12 Nov 2019 03:11:41 -0800 (PST) Received: from [10.1.196.63] (e123195-lin.cambridge.arm.com [10.1.196.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E5A23F6C4; Tue, 12 Nov 2019 03:11:40 -0800 (PST) Subject: Re: [kvm-unit-tests PATCH 02/17] arm: gic: Generalise function names To: Andre Przywara , Andrew Jones , Paolo Bonzini References: <20191108144240.204202-1-andre.przywara@arm.com> <20191108144240.204202-3-andre.przywara@arm.com> From: Alexandru Elisei Message-ID: Date: Tue, 12 Nov 2019 11:11:35 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191108144240.204202-3-andre.przywara@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191112_031144_700100_5C90ED52 X-CRM114-Status: GOOD ( 16.41 ) 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 , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org 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 Hi, On 11/8/19 2:42 PM, Andre Przywara wrote: > In preparation for adding functions to test SPI interrupts, generalise > some existing functions dealing with IPIs so far, since most of them > are actually generic for all kind of interrupts. > This also reformats the irq_handler() function, to later expand it > more easily. > > Signed-off-by: Andre Przywara > --- > arm/gic.c | 40 +++++++++++++++++++++------------------- > 1 file changed, 21 insertions(+), 19 deletions(-) > > diff --git a/arm/gic.c b/arm/gic.c > index 04b3337..a114009 100644 > --- a/arm/gic.c > +++ b/arm/gic.c > @@ -135,28 +135,30 @@ static void check_ipi_sender(u32 irqstat) > } > } > > -static void check_irqnr(u32 irqnr) > +static void check_irqnr(u32 irqnr, int expected) > { > - if (irqnr != IPI_IRQ) > + if (irqnr != expected) > bad_irq[smp_processor_id()] = irqnr; > } > > -static void ipi_handler(struct pt_regs *regs __unused) > +static void irq_handler(struct pt_regs *regs __unused) > { > u32 irqstat = gic_read_iar(); > u32 irqnr = gic_iar_irqnr(irqstat); > > - if (irqnr != GICC_INT_SPURIOUS) { > - gic_write_eoir(irqstat); > - smp_rmb(); /* pairs with wmb in stats_reset */ > - ++acked[smp_processor_id()]; > - check_ipi_sender(irqstat); > - check_irqnr(irqnr); > - smp_wmb(); /* pairs with rmb in check_acked */ > - } else { > + if (irqnr == GICC_INT_SPURIOUS) { > ++spurious[smp_processor_id()]; > smp_wmb(); > + return; > } > + > + gic_write_eoir(irqstat); > + > + smp_rmb(); /* pairs with wmb in stats_reset */ > + ++acked[smp_processor_id()]; > + check_ipi_sender(irqstat); > + check_irqnr(irqnr, IPI_IRQ); > + smp_wmb(); /* pairs with rmb in check_acked */ > } I'm not sure this change is necessary. In its current form, it is consistent with the other irq handler, ipi_clear_active_handler, and your patches add only two lines: an if statement to check for SPIs and call check_irqnr if true. That is trivial to integrate in the current handler. Would you care to elaborate why you think this change is needed? Thanks, Alex > > static void gicv2_ipi_send_self(void) > @@ -216,20 +218,20 @@ static void ipi_test_smp(void) > report_prefix_pop(); > } > > -static void ipi_enable(void) > +static void irqs_enable(void) > { > gic_enable_defaults(); > #ifdef __arm__ > - install_exception_handler(EXCPTN_IRQ, ipi_handler); > + install_exception_handler(EXCPTN_IRQ, irq_handler); > #else > - install_irq_handler(EL1H_IRQ, ipi_handler); > + install_irq_handler(EL1H_IRQ, irq_handler); > #endif > local_irq_enable(); > } > > static void ipi_send(void) > { > - ipi_enable(); > + irqs_enable(); > wait_on_ready(); > ipi_test_self(); > ipi_test_smp(); > @@ -237,9 +239,9 @@ static void ipi_send(void) > exit(report_summary()); > } > > -static void ipi_recv(void) > +static void irq_recv(void) > { > - ipi_enable(); > + irqs_enable(); > cpumask_set_cpu(smp_processor_id(), &ready); > while (1) > wfi(); > @@ -250,7 +252,7 @@ static void ipi_test(void *data __unused) > if (smp_processor_id() == IPI_SENDER) > ipi_send(); > else > - ipi_recv(); > + irq_recv(); > } > > static struct gic gicv2 = { > @@ -285,7 +287,7 @@ static void ipi_clear_active_handler(struct pt_regs *regs __unused) > > smp_rmb(); /* pairs with wmb in stats_reset */ > ++acked[smp_processor_id()]; > - check_irqnr(irqnr); > + check_irqnr(irqnr, IPI_IRQ); > smp_wmb(); /* pairs with rmb in check_acked */ > } else { > ++spurious[smp_processor_id()]; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel