From patchwork Mon Mar 6 11:34:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9605871 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 2C25F602B4 for ; Mon, 6 Mar 2017 11:48:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AF2728249 for ; Mon, 6 Mar 2017 11:48:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F35D728338; Mon, 6 Mar 2017 11:48:43 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B251328249 for ; Mon, 6 Mar 2017 11:48:43 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VQYToCoXhHFp8HJ600PolHYbe4wnuTEems1kbanLHKY=; b=oFPWUB6LAEwBweYrMNdqk+UXp7 MnHzkzyHNyiT5FcTeKXoY2O0oZ915/3ZIqnAKZkT0OXf/UK8kFQ1HjBw9tJx1qVYJTQQl3eITXzVd PihvDidIFflWqR6XI7nflZdG8PFbAOeCiph20jd3CVry8WXVQmnl/cOr68sZlamo4cLRrzmIM83lA 8kXYLsSLsHpcruRz0y2fcpQwIMig3GZh8UWmLmlWA5IdKaOjfeFWzmHIgVptrOEzc7MjxOIwg4a7J XQn+93xUecgEvUXUj78rlE5fA+RCQAUrd/nV8uJXMig3RXHpWM0IxM9CFbojPcY9+N8jatJZQ2n+V VU1Jp9bw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ckr83-0005Sk-WF; Mon, 06 Mar 2017 11:48:40 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ckr2j-00009b-4M for linux-arm-kernel@bombadil.infradead.org; Mon, 06 Mar 2017 11:43:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vDhdcKl5u0NhoeYNff29wqKwsxq8Gf85H9ovwft4CBY=; b=omCTHqv9Dni19cidj2XqetXpn MCpgbmkv+1ZxHbyHLOhcbZBA4rTgjzXDj+IhwzA1QaUE9Ss0H8aXeIduJUPGezyr2L+MZ0DXcVcqa CIpeToeyWYK9Z2ghfxJ7p18uoEoJc0ByqKwuFt1b1N9bMq/BUc3P73hnK4MKWIH8yCzb0Z9CytCAk 4hNw8YgNsq7qhuuyIwKoPC2j5mBFsPXhzMJZkFssAHXxXFramWaWAHDE2kDtktwRJTKhNuh0VoQZD HmZcGaKFajGavTCmJcMQf8l8MGcKt2o1ff2Gs4jUQCrGvw+IoHu056qooNJyA3eTk7SjERRKZYspy ZTUW1M9NQ==; Received: from mx1.redhat.com ([209.132.183.28]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ckqvH-0003IV-FH for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2017 11:35:29 +0000 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 25731C062D11; Mon, 6 Mar 2017 11:35:07 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-100.ams2.redhat.com [10.36.116.100]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v26BYbnV002618; Mon, 6 Mar 2017 06:35:03 -0500 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, marc.zyngier@arm.com, christoffer.dall@linaro.org, vijayak@caviumnetworks.com, Vijaya.Kumar@cavium.com, peter.maydell@linaro.org, linux-arm-kernel@lists.infradead.org, drjones@redhat.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v3 06/19] KVM: arm64: ITS: Implement vgic_mmio_uaccess_write_its_creadr Date: Mon, 6 Mar 2017 12:34:21 +0100 Message-Id: <1488800074-21991-7-git-send-email-eric.auger@redhat.com> In-Reply-To: <1488800074-21991-1-git-send-email-eric.auger@redhat.com> References: <1488800074-21991-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.32]); Mon, 06 Mar 2017 11:35:07 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170306_113527_638940_FA3C9311 X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, pbonzini@redhat.com, dgilbert@redhat.com, quintela@redhat.com, Prasun.Kapoor@cavium.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GITS_CREADR needs to be restored so let's implement the associated uaccess_write_its callback. Signed-off-by: Eric Auger --- --- virt/kvm/arm/vgic/vgic-its.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index e9c8f9f..6120c6e 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -1225,6 +1225,25 @@ static unsigned long vgic_mmio_read_its_creadr(struct kvm *kvm, return extract_bytes(its->creadr, addr & 0x7, len); } +static void vgic_mmio_uaccess_write_its_creadr(struct kvm *kvm, + struct vgic_its *its, + gpa_t addr, unsigned int len, + unsigned long val) +{ + u32 reg; + + mutex_lock(&its->cmd_lock); + reg = update_64bit_reg(its->creadr, addr & 7, len, val); + reg = ITS_CMD_OFFSET(reg); + if (reg >= ITS_CMD_BUFFER_SIZE(its->cbaser)) { + mutex_unlock(&its->cmd_lock); + return; + } + + its->creadr = reg; + mutex_unlock(&its->cmd_lock); +} + #define BASER_INDEX(addr) (((addr) / sizeof(u64)) & 0x7) static unsigned long vgic_mmio_read_its_baser(struct kvm *kvm, struct vgic_its *its, @@ -1320,7 +1339,8 @@ static struct vgic_register_region its_registers[] = { vgic_mmio_read_its_cwriter, vgic_mmio_write_its_cwriter, NULL, 8, VGIC_ACCESS_64bit | VGIC_ACCESS_32bit), REGISTER_ITS_DESC(GITS_CREADR, - vgic_mmio_read_its_creadr, its_mmio_write_wi, NULL, 8, + vgic_mmio_read_its_creadr, its_mmio_write_wi, + vgic_mmio_uaccess_write_its_creadr, 8, VGIC_ACCESS_64bit | VGIC_ACCESS_32bit), REGISTER_ITS_DESC(GITS_BASER, vgic_mmio_read_its_baser, vgic_mmio_write_its_baser, NULL, 0x40,