From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web08.414.1635863040144179755 for ; Tue, 02 Nov 2021 07:24:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MKLJPVob; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635863039; 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: in-reply-to:in-reply-to:references:references; bh=YN3MOcypCws0N2oXqlMs36MtLWQeZ1owTGmiBMPYDkY=; b=MKLJPVobHpAZ/f33R5SWceb0JjSxJbufkK0CrTtDicO2Y4XD+7J3Y5/M25wgHga/lT0TFM Ex+aRw4hKW1OcVcr5vvjssB5AMNV47r7CTUtMmML6dsUhc82BxC21qf0DUOOrhqDGcK7Na 0ap/AKbWCEgavpgzep3pG9PoaVp41RM= 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-24-Wj4VLq9oOseoZb9yYlXDyw-1; Tue, 02 Nov 2021 10:23:53 -0400 X-MC-Unique: Wj4VLq9oOseoZb9yYlXDyw-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 12305100B703; Tue, 2 Nov 2021 14:23:52 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AAAB16A58; Tue, 2 Nov 2021 14:23:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9AAC5180092D; Tue, 2 Nov 2021 15:23:48 +0100 (CET) Date: Tue, 2 Nov 2021 15:23:48 +0100 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Ard Biesheuvel , Jiewen Yao , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Tom Lendacky Subject: Re: [PATCH V3 04/29] OvmfPkg: Extend VmgExitLib to handle #VE exception Message-ID: <20211102142348.wi7it5h7zgz6j2pp@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, > +MmioExit ( > + IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, > + IN TDCALL_VEINFO_RETURN_DATA *Veinfo > + ) > +{ > + do { > + OpCode = *Rip++; > + if (OpCode == 0x66) { > + OpSize = 2; Oh, wow. So the VE exit data doesn't provide the information which io/mmio access actually triggered the exception, so you have to go decode the instruction which trapped? > + switch (ReturnData.VeInfo.ExitReason) { > + case EXIT_REASON_CPUID: > + Status = CpuIdExit (Regs, &ReturnData.VeInfo); Indention is strange (switch + case should be the same). Otherwise looks sane to me. take care, Gerd