From nobody Tue Nov 4 23:55:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531588977465927.564269716584; Sat, 14 Jul 2018 10:22:57 -0700 (PDT) Received: from localhost ([::1]:42091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1feOG0-0001pv-5h for importer@patchew.org; Sat, 14 Jul 2018 13:22:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1feO9u-0005nI-CR for qemu-devel@nongnu.org; Sat, 14 Jul 2018 13:16:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1feO9q-0004bW-QO for qemu-devel@nongnu.org; Sat, 14 Jul 2018 13:16:36 -0400 Received: from greensocs.com ([193.104.36.180]:57319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1feO9j-0004Qn-LA; Sat, 14 Jul 2018 13:16:27 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 2B5EBC7AFB; Sat, 14 Jul 2018 19:16:27 +0200 (CEST) Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mp5SvqOQmpak; Sat, 14 Jul 2018 19:16:26 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id 60AD3C7ADD; Sat, 14 Jul 2018 19:16:26 +0200 (CEST) Received: from localhost.localdomain (unknown [105.98.38.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luc.michel@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id A58F542898C; Sat, 14 Jul 2018 19:16:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1531588587; bh=EG46i0a1O3AX/avIOovDkdx0T7SdNQIq/Xhp8wq4+FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZXlX+LGu/APcDBprLvbzoYlYPCYZ1jQknkDHEnc7jGBAOH39ZAWNbBJ4lghhP6Wki UTM5Hxw0Wxlmvsk/5b7Sb/fPukQ4BW0EnMH7xc54lJtejqhFfmCbMwg+YQEFLJ4WCD jJSAivbdESeDTd+dMZfH4Ibe8tPKU7dXIPwNdFPA= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=nxER826N; dkim=pass (1024-bit key) header.d=greensocs.com header.b=nxER826N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1531588586; bh=EG46i0a1O3AX/avIOovDkdx0T7SdNQIq/Xhp8wq4+FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nxER826N7SyHQ62zQaHKQGOegbxxWDYjyxL9UMk4TNlnePZjhH8ySbpOklliXEZqm B8ftCxrf59DIKmoEn+T/bu/L7Kjg6LccPcKnDsFI1CFJkLCdzPTuD0sXoilI6W2EPF TvkOXmXUH2VmgDt8rT0i15QEK6Hx26gPwkgwVPM8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1531588586; bh=EG46i0a1O3AX/avIOovDkdx0T7SdNQIq/Xhp8wq4+FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nxER826N7SyHQ62zQaHKQGOegbxxWDYjyxL9UMk4TNlnePZjhH8ySbpOklliXEZqm B8ftCxrf59DIKmoEn+T/bu/L7Kjg6LccPcKnDsFI1CFJkLCdzPTuD0sXoilI6W2EPF TvkOXmXUH2VmgDt8rT0i15QEK6Hx26gPwkgwVPM8= From: Luc Michel To: qemu-devel@nongnu.org Date: Sat, 14 Jul 2018 19:15:53 +0200 Message-Id: <20180714171601.5734-13-luc.michel@greensocs.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180714171601.5734-1-luc.michel@greensocs.com> References: <20180714171601.5734-1-luc.michel@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v4 12/20] intc/arm_gic: Implement virtualization extensions in gic_(deactivate|complete_irq) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , mark.burton@greensocs.com, saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Jan Kiszka , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Implement virtualization extensions in the gic_deactivate_irq() and gic_complete_irq() functions. When a guest tries to deactivat or end an IRQ that does not exist in the LRs, the EOICount field of the virtual interface HCR register is incremented by one, and the request is ignored. Signed-off-by: Luc Michel --- hw/intc/arm_gic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index be9e2594d9..50cbbfbe24 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -590,6 +590,15 @@ static void gic_deactivate_irq(GICState *s, int cpu, i= nt irq, MemTxAttrs attrs) return; } =20 + if (gic_is_vcpu(cpu) && !gic_virq_is_valid(s, irq, cpu)) { + /* This vIRQ does not have an LR entry which is either active or + * pending and active. Increment EOICount and ignore the write. + */ + int rcpu =3D gic_get_vcpu_real_id(cpu); + s->h_hcr[rcpu] +=3D 1 << R_GICH_HCR_EOICount_SHIFT; + return; + } + if (gic_cpu_ns_access(s, cpu, attrs) && !group) { DPRINTF("Non-secure DI for Group0 interrupt %d ignored\n", irq); return; @@ -604,6 +613,15 @@ static void gic_complete_irq(GICState *s, int cpu, int= irq, MemTxAttrs attrs) int group; =20 DPRINTF("EOI %d\n", irq); + if (gic_is_vcpu(cpu) && !gic_virq_is_valid(s, irq, cpu)) { + /* This vIRQ does not have an LR entry which is either active or + * pending and active. Increment EOICount and ignore the write. + */ + int rcpu =3D gic_get_vcpu_real_id(cpu); + s->h_hcr[rcpu] +=3D 1 << R_GICH_HCR_EOICount_SHIFT; + return; + } + if (irq >=3D s->num_irq) { /* This handles two cases: * 1. If software writes the ID of a spurious interrupt [ie 1023] --=20 2.18.0