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.129.124]) by mx.groups.io with SMTP id smtpd.web10.68663.1661765541982297553 for ; Mon, 29 Aug 2022 02:32:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gMoZ43Mk; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661765540; 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=eDtGJ4KgPvoSCph2A230k4uVpI0dYtrIk2aE/V6xaGQ=; b=gMoZ43MkDB02OiL7jfKuc9Pb6TKCO+xswHfxAN5nLM6TDMxJIx7UXmBelsp2DNHSfRAUz9 t2S+IPF65o/cyPgRQqji8trx0dO/ACayag9mXTotFdPmos/StCap9Iksi57ybX1QmRoMjk 62Y9bIbS6ck/fLAE+NmFCespzE0/dfQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-o6-1a78PMTuGiT9gMjvuvQ-1; Mon, 29 Aug 2022 05:32:19 -0400 X-MC-Unique: o6-1a78PMTuGiT9gMjvuvQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9323D1C16B40; Mon, 29 Aug 2022 09:32:18 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B0B3C15BB3; Mon, 29 Aug 2022 09:32:18 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 96C6918000B3; Mon, 29 Aug 2022 11:32:16 +0200 (CEST) Date: Mon, 29 Aug 2022 11:32:16 +0200 From: "Gerd Hoffmann" To: "Lee, Chun-Yi" Cc: devel@edk2.groups.io, Ard Biesheuvel , Jiewen Yao , Jordan Justen , Min Xu , Brijesh Singh , Erdem Aktas , James Bottomley , "Lee, Chun-Yi" Subject: Re: [PATCH v2] OvmfPkg/IncompatiblePciDeviceSupportDxe: Ignore OptionRom in Sev guest Message-ID: <20220829093216.aztojumlhrj2x7am@sirius.home.kraxel.org> References: <20220826151520.25850-1-jlee@suse.com> MIME-Version: 1.0 In-Reply-To: <20220826151520.25850-1-jlee@suse.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 26, 2022 at 11:15:20PM +0800, Lee, Chun-Yi wrote: > Reference: https://bugzilla.tianocore.org/show_bug.cgi?id=4031 > > This patch is similar to the c477b2783f patch for Td guest. > > Host VMM may inject OptionRom which is untrusted in Sev guest. So PCI > OptionRom needs to be ignored if it is Sev guest. According to > "Table 20. ACPI 2.0 & 3.0 QWORD Address Space Descriptor Usage" > PI spec 1.7, type-specific flags can be set to 0 when Address > Translation Offset == 6 to skip device option ROM. > > Without this patch, Sev guest may shows invalid MMIO opcode error > as following: > > Invalid MMIO opcode (F6) > ASSERT /home/abuild/rpmbuild/BUILD/edk2-edk2-stable202202/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c(1041): ((BOOLEAN)(0==1)) > > The OptionRom must be disabled both on Td and Sev guests, so we direct > use CcProbe(). > > v2: Use CcProbe() instead of TdIsEnabled() and MemEncryptSevIsEnabled(). Reviewed-by: Gerd Hoffmann