From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web12.13477.1634043757736863921 for ; Tue, 12 Oct 2021 06:02:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PERPZujc; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634043756; 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=nPyz+qpPuomADi57nB7ycQtXO1StuWQsZrJHrqDlU3w=; b=PERPZujcwwDOPL34kIhsDNqRyB39yYSdH7thKbxl7LeB0xT9mgOsf9iXhMNrRcX4keG9Av HGcvlHL82bbJdFwFqdVZqNa7ROEITdrjZFyb5OmtaeyPx5h14ZU755bZKnsql+glr+QGLF xIdyYXItgxFfZeLiaglRJ0jliSoJAiA= 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-365-I02Xb-PnNjuea3xVVj6Ktg-1; Tue, 12 Oct 2021 09:02:33 -0400 X-MC-Unique: I02Xb-PnNjuea3xVVj6Ktg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 943F2192377F; Tue, 12 Oct 2021 13:02:10 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81C83A3AA0; Tue, 12 Oct 2021 13:02:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EDD271800929; Tue, 12 Oct 2021 15:02:07 +0200 (CEST) Date: Tue, 12 Oct 2021 15:02:07 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io, min.m.xu@intel.com Cc: Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V2 28/28] OvmfPkg: Add LocalApicTimerDxe Message-ID: <20211012130207.zmx2yf5inpkoalqf@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Oct 05, 2021 at 11:39:39AM +0800, Min Xu wrote: > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 > > TDX guest supports LocalApicTimer. But in current OvmfPkg the supported > timer is 8254TimerDxe. So gUefiOvmfPkgTokenSpaceGuid.PcdTimerSelector > is introduced to select the running Timer. The Timer driver will check > the TimerSelector in its entry point. The default Timer is 8254. Hmm. We already have a local apic timer implementation (XenTimerDxe). Works fine with kvm, microvm already uses that. See commit 76602f45dcd9 ("OvmfPkg/Microvm: use XenTimerDxe (lapic timer)"). So, first I'd suggest to just use that (maybe rename the thing to avoid confusion as it isn't really Xen specific). Next question is whenever there is a need for a runtime switch. I doubt it is possible to create a virtual machine without lapic, so switching ovmf from 8254 (aka pit) to lapic unconditionally should work fine. Quick smoke test (patch below) shows no obvious problems. take care, Gerd >>From 948aaf555a864da1d6f2ccc8dddc7e22cefb76e1 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 12 Oct 2021 14:58:18 +0200 Subject: [PATCH 1/1] OvmfPkgX64: use lapic timer --- OvmfPkg/OvmfPkgX64.dsc | 4 ++-- OvmfPkg/OvmfPkgX64.fdf | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 52f7598cf1c7..687aae6e3e68 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -620,6 +620,7 @@ [PcdsDynamicDefault] gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x800000000 !endif + gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000 gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0 # Set video resolution for text setup. @@ -765,10 +766,9 @@ [Components] } MdeModulePkg/Universal/EbcDxe/EbcDxe.inf - OvmfPkg/8259InterruptControllerDxe/8259.inf UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf UefiCpuPkg/CpuDxe/CpuDxe.inf - OvmfPkg/8254TimerDxe/8254Timer.inf + OvmfPkg/XenTimerDxe/XenTimerDxe.inf OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf { diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index b6cc3cabdd69..9ca723dc8604 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -232,10 +232,9 @@ [FV.DXEFV] INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf -INF OvmfPkg/8259InterruptControllerDxe/8259.inf INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf INF UefiCpuPkg/CpuDxe/CpuDxe.inf -INF OvmfPkg/8254TimerDxe/8254Timer.inf +INF OvmfPkg/XenTimerDxe/XenTimerDxe.inf INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf -- 2.31.1