From patchwork Fri Apr 14 10:15:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9681119 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 955D960326 for ; Fri, 14 Apr 2017 10:44:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8733A28664 for ; Fri, 14 Apr 2017 10:44:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BA5528676; Fri, 14 Apr 2017 10:44:46 +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 2450928664 for ; Fri, 14 Apr 2017 10:44:46 +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=fNWtdbxck/42q3bFqM3dS/jniJf2nkll009RDq3WHeA=; b=erzEgTCqxx6ZQ52ycArwFN/z1J NTkoUG0qspaAZaLkHHeAudI0u6BxqlCJQcNaSPcybtMjQ3xUcFjKbr2xLkRYGXbXF7/3faaS85iqW +0cG4m0ZNAnKtqPZTwCe2w9wKOjvhnSU45IGBH3rMJcQujhJE6yOFlrPitru3gUJpB2lhzqjhj6kH XZQOvmchJOAD/dspZMeH+F6ASc83paCBR6eq4VkRxJVUVl8A9D6B313p4a61AxEw64O9eB8XzkSVe U29GOuBQz4JVaKd2AitN6URu8gUh1XMQ9nZgn/7lDr6erGKRDU0REoQlg9++DcPFPwvXPWI1SK2n1 pyP6EyLw==; 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 1cyyib-0006ia-Q3; Fri, 14 Apr 2017 10:44:45 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cyyiE-000634-Sg for linux-arm-kernel@bombadil.infradead.org; Fri, 14 Apr 2017 10:44:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=OJ5R51Rxcs1YxsGbX1x5drVApyjix/Sk0FDDlfYw8R4=; b=IphlOMjCmJlua1RKJ4ii9s1w5 PjJneFEzLPQDXC6UvRiuCJf2q9r4OBswO5tRwSqMIm6sznta2pyqpPBfitGwI3J1MYd+1Pz/DsE61 xl+v1X0snxuN/6T+UvtQCQEYQmjCWTtyxkrZLBNdNXPCB8jo7M72V4jteiTmvFDJ+1p2l1N0vhQGN V6g4KhBN4zpJuUGsUQEYNK18eK78gUTbeq0hWndIhHi6YEtpBGz24a2RyWMay9cmfRAMjSQC9awZ0 S6mJ4pDzkDRXY5L/81cSzYweeSdjlusLUMlbgwXsq7OpT7GhrKLqj+Z3aeBhBAkTABnuU6aKxYYxB rMXcuzLvw==; Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cyyIV-0005a1-Ng for linux-arm-kernel@lists.infradead.org; Fri, 14 Apr 2017 10:17:48 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01EA531F3F4; Fri, 14 Apr 2017 10:17:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 01EA531F3F4 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eric.auger@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 01EA531F3F4 Received: from localhost.localdomain.com (ovpn-117-27.ams2.redhat.com [10.36.117.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8941B18214; Fri, 14 Apr 2017 10:16:55 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, marc.zyngier@arm.com, christoffer.dall@linaro.org, andre.przywara@arm.com, vijayak@caviumnetworks.com, Vijaya.Kumar@cavium.com, peter.maydell@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v5 12/22] KVM: arm64: vgic-its: Interpret MAPD ITT_addr field Date: Fri, 14 Apr 2017 12:15:24 +0200 Message-Id: <1492164934-988-13-git-send-email-eric.auger@redhat.com> In-Reply-To: <1492164934-988-1-git-send-email-eric.auger@redhat.com> References: <1492164934-988-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 14 Apr 2017 10:17:01 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170414_061747_900793_711F62C1 X-CRM114-Status: GOOD ( 12.22 ) 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: Prasun.Kapoor@cavium.com, drjones@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.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 Up to now the MAPD ITT_addr had been ignored. We will need it for save/restore. Let's record it in the its_device struct. Signed-off-by: Eric Auger Tested-by: Prakash, Brahmajyosyula --- v4 -> v5: - its_cmd_get_ittaddr macro now returns the actual ITT GPA v3 -> v4: - in vgic_its_cmd_handle_mapd, itt_addr directly is shifted - correct ittaddr bitmask to support 48bit GPA --- virt/kvm/arm/vgic/vgic-its.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 0f3c8f3..757598d 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -106,6 +106,7 @@ struct its_device { /* the head for the list of ITTEs */ struct list_head itt_head; u32 nb_eventid_bits; + gpa_t itt_addr; u32 device_id; }; @@ -569,6 +570,7 @@ static u64 its_cmd_mask_field(u64 *its_cmd, int word, int shift, int size) #define its_cmd_get_id(cmd) its_cmd_mask_field(cmd, 1, 0, 32) #define its_cmd_get_physical_id(cmd) its_cmd_mask_field(cmd, 1, 32, 32) #define its_cmd_get_collection(cmd) its_cmd_mask_field(cmd, 2, 0, 16) +#define its_cmd_get_ittaddr(cmd) (its_cmd_mask_field(cmd, 2, 8, 47) << 8) #define its_cmd_get_target_addr(cmd) its_cmd_mask_field(cmd, 2, 16, 32) #define its_cmd_get_validbit(cmd) its_cmd_mask_field(cmd, 2, 63, 1) @@ -840,6 +842,7 @@ static int vgic_its_cmd_handle_mapd(struct kvm *kvm, struct vgic_its *its, u32 device_id = its_cmd_get_deviceid(its_cmd); bool valid = its_cmd_get_validbit(its_cmd); u8 nb_eventid_bits = its_cmd_get_size(its_cmd); + gpa_t itt_addr = its_cmd_get_ittaddr(its_cmd); struct its_device *device; if (!vgic_its_check_id(its, its->baser_device_table, device_id)) @@ -871,6 +874,7 @@ static int vgic_its_cmd_handle_mapd(struct kvm *kvm, struct vgic_its *its, device->device_id = device_id; device->nb_eventid_bits = nb_eventid_bits; + device->itt_addr = itt_addr; INIT_LIST_HEAD(&device->itt_head);