From patchwork Mon Dec 5 21:46:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9461587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89C2E6022E for ; Mon, 5 Dec 2016 21:47:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FFB728135 for ; Mon, 5 Dec 2016 21:47:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74DD62816B; Mon, 5 Dec 2016 21:47:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19DD928135 for ; Mon, 5 Dec 2016 21:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752464AbcLEVrh (ORCPT ); Mon, 5 Dec 2016 16:47:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33972 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126AbcLEVrd (ORCPT ); Mon, 5 Dec 2016 16:47:33 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 359B58F231; Mon, 5 Dec 2016 21:47:33 +0000 (UTC) Received: from localhost.localdomain.com (vpn1-4-120.ams2.redhat.com [10.36.4.120]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB5LksKc019596; Mon, 5 Dec 2016 16:47:29 -0500 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org, qemu-arm@nongnu.org, drjones@redhat.com, marc.zyngier@arm.com, christoffer.dall@linaro.org Cc: andre.przywara@arm.com, peter.maydell@linaro.org, alex.bennee@linaro.org, pbonzini@redhat.com Subject: [kvm-unit-tests RFC 08/15] arm/arm64: ITS: enable LPIs at re-distributor level Date: Mon, 5 Dec 2016 22:46:39 +0100 Message-Id: <1480974406-29345-9-git-send-email-eric.auger@redhat.com> In-Reply-To: <1480974406-29345-1-git-send-email-eric.auger@redhat.com> References: <1480974406-29345-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Dec 2016 21:47:33 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This helper function enables the signaling of LPIs by the redistributor to the connected PE. Signed-off-by: Eric Auger --- lib/arm/asm/gic-v3-its.h | 1 + lib/arm/gic-v3-its.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/arm/asm/gic-v3-its.h b/lib/arm/asm/gic-v3-its.h index 21054cb..3e36a2a 100644 --- a/lib/arm/asm/gic-v3-its.h +++ b/lib/arm/asm/gic-v3-its.h @@ -145,6 +145,7 @@ extern struct its_data its_data; extern int its_parse_baser(int i, struct its_baser *baser); extern void its_setup_baser(int i, struct its_baser *baser); +extern void enable_lpi(u32 redist); #endif /* !__ASSEMBLY__ */ diff --git a/lib/arm/gic-v3-its.c b/lib/arm/gic-v3-its.c index f577d5f..7c768a5 100644 --- a/lib/arm/gic-v3-its.c +++ b/lib/arm/gic-v3-its.c @@ -171,3 +171,18 @@ void init_cmd_queue(void) writeq(0, its_data.base + GITS_CWRITER); writeq(0, its_data.base + GITS_CREADR); } + +void enable_lpi(u32 redist) +{ + void *ptr; + u64 val; + + if (redist >= gicv3_data.cpu_count) + report_abort("%s redist=%d >= cpu_count=%d\n", + __func__, redist, gicv3_data.cpu_count); + + ptr = gicv3_data.redist_base[redist]; + val = readl(ptr + GICR_CTLR); + val |= GICR_CTLR_ENABLE_LPIS; + writel(val, ptr + GICR_CTLR); +}