From: Wei Liu Subject: Re: [PATCH 2/3] xen/arm: vgic-v3: Correctly retrieve the vCPU associated to a re-distributor Date: Tue, 29 Sep 2015 10:46:48 +0100 Message-ID: <20150929094648.GW13821@zion.uk.xensource.com> References: <1443472296-6671-1-git-send-email-julien.grall@citrix.com> <1443472296-6671-3-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZgrUq-0002M5-Hw for xen-devel@lists.xenproject.org; Tue, 29 Sep 2015 09:46:52 +0000 Content-Disposition: inline In-Reply-To: <1443472296-6671-3-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, Wei Liu , ian.campbell@citrix.com, shameerali.kolothum.thodi@huawei.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, Sep 28, 2015 at 09:31:35PM +0100, Julien Grall wrote: > When the guest is accessing the re-distributor, Xen retrieves the base > of the re-distributor using a mask based on the stride. > > Although, when the stride contains multiple set, the corresponding mask > will be computed incorrectly [1] and therefore giving invalid vCPU and > offset: > > (XEN) d0v0: vGICR: unknown gpa read address 000000008d130008 > (XEN) traps.c:2447:d0v1 HSR=0x93c08006 pc=0xffffffc00032362c > gva=0xffffff80000b0008 gpa=0x0000008d130008 > > For instance if the region of re-distributor is starting at 0x8d100000 > and the stride is 0x30000, an access to the address 0x8d130008 should > be valid and use the re-distributor of vCPU1 with an offset of 0x8. > Although, Xen is returning the vCPU0 and an offset of 0x20008. > > I didn't find a way to replace the current computation of the mask with > a valid. The only solution I have found is to pass the region in private > data of the handler. So we can directly get the offset from the > beginning of the region and find the corresponding vCPU/offset in the > re-distributor. > > This is also make the code simpler and avoid fast/slow path. > > [1] http://lists.xen.org/archives/html/xen-devel/2015-09/msg03372.html > > Signed-off-by: Julien Grall > > --- > Cc: shameerali.kolothum.thodi@huawei.com > Cc: Wei Liu > > This is technically a good candidate for Xen 4.6. Without it DOM0 > may not be able to bring secondary CPU on platform using a stride > with multiple bit set [1]. Although, we don't support such platform > right now. So I would rather defer this change to Xen 4.6.1 and > avoid possible downside/bug in this patch. > This sounds reasonable to me.