From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web11.10579.1583941194724835269 for ; Wed, 11 Mar 2020 08:39:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGoiUgtW; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583941193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IdgwJV8pTvVmBlkx7lnDA05fxVYxbBx0V3rhSsQCR5Q=; b=iGoiUgtW85YMGGeiffGSV8c21zrMJimdCjnR2A0iiEOCRr7D6lOpwSTDCA4qYGs2BbkKJB A6dUCwEJ4e3ooozO/DAn8gpIZvfkR0AMdYBaq/ueivQbd9LqKtkgE6CSY9nHNXSCycxDxr /KQ9Q6tWYpAeDrNGjMzmTQ1D4m01iDk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-124-DH4JJyM3MRevc3fX7cBujg-1; Wed, 11 Mar 2020 11:39:44 -0400 X-MC-Unique: DH4JJyM3MRevc3fX7cBujg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 424A3189F763; Wed, 11 Mar 2020 15:39:43 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.36.119.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65AF0393; Wed, 11 Mar 2020 15:39:42 +0000 (UTC) Subject: Re: [PATCH 1/1] ArmVirtPkg: fix ASSERT in ArmVirtGicArchLib with virtualization=on To: Leif Lindholm , devel@edk2.groups.io Cc: Ard Biesheuvel References: <20200311153217.18253-1-leif@nuviainc.com> From: "Laszlo Ersek" Message-ID: <5787d2ae-3e0a-2443-64bd-049743f8891b@redhat.com> Date: Wed, 11 Mar 2020 16:39:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200311153217.18253-1-leif@nuviainc.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 03/11/20 16:32, Leif Lindholm wrote: > ArmVirtGicArchLib was originally implemented before virtualization > emulation was implemented in QEMU, and the GICv2 model implemented only > the physical copy of control registers. > > Enabling virtualization emulation to QEMU adds also the virtual copy, > doubling the RegSize returned by FindCompatibleNodeReg () in > ArmVirtGicArchLibConstructor (). This triggered an ASSERT when running > QEMU with -M virt,virtualization=on. Address this by testing for both > possible valid values of RegSize. > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2588 > > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Signed-off-by: Leif Lindholm > --- > ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c > index af6b3af60edf..5448865ad8e8 100644 > --- a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c > +++ b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c > @@ -110,7 +110,12 @@ ArmVirtGicArchLibConstructor ( > break; > > case 2: > - ASSERT (RegSize == 32); > + // > + // When the GICv2 is emulated with virtualization=on, it adds a virtual > + // set of control registers. This means the register property can be > + // either 32 or 64 bytes in size. > + // > + ASSERT ((RegSize == 32) || (RegSize == 64)); > > DistBase = SwapBytes64 (Reg[0]); > CpuBase = SwapBytes64 (Reg[2]); > Reviewed-by: Laszlo Ersek