Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp668283ybl; Fri, 13 Dec 2019 02:44:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzYHklQE7aC/gu5nkw+jGqToEvtG1Ed31QCEEL1Jw1UdV4zPDtTgkJ135EPFWHOcV8ckhfP X-Received: by 2002:a9d:7d8e:: with SMTP id j14mr13250031otn.227.1576233880286; Fri, 13 Dec 2019 02:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576233880; cv=none; d=google.com; s=arc-20160816; b=q2fYtxpBZ7tlXuNZkLZpTVwMVBNFvaZbWWF8tP6eTk7egiSPsRxKOclFiwucLQPGBN EVAsf4kxWLFPsFE9YiISb3O1G7aiWOvgM4jDzX71uI2G/5UFcoNlNZVlDBrAFkfgByb0 Co2VNWLh8Q4AXEhrWeXzk0Jm4YYd/0Flx6nBMsjB9iy67NFqrz7rCHJK6vzGXv80c3eL TMAATUrl8MiICdK95wihIn6Ba9UoQb0gDZ0dxk+78lMiyIRFpFYzsHDoNrqg0lg3jAbL jglekwxHJLWqLCyI9zCjgj5ixlyexFpXABDhw7SiDCspD3w8c9I58unK57FIDlzcyUqT YeXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=5N2xRZeSV0wFBYlp9Kmg0m1OZIdFZmbJ1qhZKhLa/Ak=; b=ld9IaMMjsAFpfi9Z9TroHTPGT2TIm7dy2OG48kuxTbo2/wkB0Zjw72ggFhXo1HQSi4 cZYkEVJoT5j9FTS3k3fyIRtliMIm08O0XlaLJTxRvka+x8o8UZW2e0U/bTCY2Spb8zKA 5XfKRsIGzMSQn8kvd7MPqBsI4vE6SEq+0065ad86pfzoEuiLcpL5YylhMWshiNXd/Lh2 nfNniBeWYAbKJmTJJFr8DCnLVoHB8aHYW3mX74XGWZ7ITeqMqPxjwTepurkE4OgsW8n8 dvjPckPpE3515ipDoOwEIOpIOGDja62ghH1BKDU8NYFomITUJ1XaiP9FCG+rXEFvQ/F6 CU9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b133si4727910oif.244.2019.12.13.02.44.27; Fri, 13 Dec 2019 02:44:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726494AbfLMKnY (ORCPT + 99 others); Fri, 13 Dec 2019 05:43:24 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:54434 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfLMKnY (ORCPT ); Fri, 13 Dec 2019 05:43:24 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ifiPq-0003kl-75; Fri, 13 Dec 2019 11:43:22 +0100 To: Eric Auger Subject: Re: [PATCH] KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 13 Dec 2019 10:43:22 +0000 From: Marc Zyngier Cc: , , In-Reply-To: <20191213094237.19627-1-eric.auger@redhat.com> References: <20191213094237.19627-1-eric.auger@redhat.com> Message-ID: <2634d1361ac3d5518b3bea62dc40ab06@www.loen.fr> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: eric.auger@redhat.com, eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On 2019-12-13 09:42, Eric Auger wrote: > Saving/restoring an unmapped collection is a valid scenario. For > example this happens if a MAPTI command was sent, featuring an > unmapped collection. At the moment the CTE fails to be restored. > Only compare against the number of online vcpus if the rdist > base is set. > > Cc: stable@vger.kernel.org # v4.11+ > Fixes: ea1ad53e1e31a ("KVM: arm64: vgic-its: Collection table > save/restore") > Signed-off-by: Eric Auger > --- > virt/kvm/arm/vgic/vgic-its.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/vgic/vgic-its.c > b/virt/kvm/arm/vgic/vgic-its.c > index 98c7360d9fb7..17920d1b350a 100644 > --- a/virt/kvm/arm/vgic/vgic-its.c > +++ b/virt/kvm/arm/vgic/vgic-its.c > @@ -2475,7 +2475,8 @@ static int vgic_its_restore_cte(struct vgic_its > *its, gpa_t gpa, int esz) > target_addr = (u32)(val >> KVM_ITS_CTE_RDBASE_SHIFT); > coll_id = val & KVM_ITS_CTE_ICID_MASK; > > - if (target_addr >= atomic_read(&kvm->online_vcpus)) > + if (target_addr != COLLECTION_NOT_MAPPED && > + target_addr >= atomic_read(&kvm->online_vcpus)) > return -EINVAL; > > collection = find_collection(its, coll_id); Looks good to me. Out of curiosity, how was this spotted? Thanks, M. -- Jazz is not dead. It just smells funny...