From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752365AbdJNIxM (ORCPT ); Sat, 14 Oct 2017 04:53:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41806 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbdJNIxE (ORCPT ); Sat, 14 Oct 2017 04:53:04 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9951AC04AC46 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eric.auger@redhat.com Subject: Re: [PATCH v2 02/10] KVM: arm/arm64: vgic-its: Always allow clearing GITS_CREADR/CWRITER To: Christoffer Dall References: <1506518920-18571-1-git-send-email-eric.auger@redhat.com> <1506518920-18571-3-git-send-email-eric.auger@redhat.com> <4315e223-a843-50d9-506d-a3902ee8d18d@arm.com> <20171013114412.GG8927@cbox> <065e1e4c-e16d-5df6-ceff-3415a2d91e8d@redhat.com> <20171013175446.GC17578@cbox> Cc: Andre Przywara , eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, marc.zyngier@arm.com, peter.maydell@linaro.org, wanghaibin.wang@huawei.com, wu.wubin@huawei.com From: Auger Eric Message-ID: Date: Sat, 14 Oct 2017 10:53:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171013175446.GC17578@cbox> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 14 Oct 2017 08:53:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christoffer, On 13/10/2017 19:54, Christoffer Dall wrote: > On Fri, Oct 13, 2017 at 01:54:34PM +0200, Auger Eric wrote: >> Hi Christoffer, >> On 13/10/2017 13:44, Christoffer Dall wrote: >>> On Fri, Oct 06, 2017 at 05:29:02PM +0200, Auger Eric wrote: >>>> Hi, >>>> >>>> On 06/10/2017 16:37, Andre Przywara wrote: >>>>> Hi, >>>>> >>>>> On 27/09/17 14:28, Eric Auger wrote: >>>>>> If the GITS_CBASER Size field is 0, which can correspond to a >>>>>> reset value, the userspace fails to set the GITS_CREADR/CWRITER >>>>>> offsets to 0. This failure is not justified. >>>>>> >>>>>> Let's allow this setting which can also correspond to a reset value. >>>>> >>>>> But the GITS_CBASER size field has a +1 encoding, so can never be 0, if >>>>> I understand the manual (and ITS_CMD_BUFFER_SIZE) correctly. >>>> Oh OK, you're. I missed that. I would have sworn I've seen that failure >>>> but I must have misinterpreted it. >>>> >>> >>> What is CWRITER is written to a brand new ITS before the CBASER is >>> written? >>> >>> I don't see us initializing the cbaser field anywhere? >> in vgic_its_create() its is allocated with kzalloc so its->cbaser is >> initialized at this moment. >> > > Right, so it can be 0, and we still need your patch, contrary to Andre's > comment. Am I missing something? No Andre is right, cbaser = 0 but ITS_CMD_BUFFER_SIZE(its->cbaser) returns 4kB. #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) So the check doesn't fail. Thanks Eric > > Thanks, > -Christoffer >