From patchwork Tue Aug 2 07:47:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 12934329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C307BC00140 for ; Tue, 2 Aug 2022 07:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236307AbiHBHvC (ORCPT ); Tue, 2 Aug 2022 03:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236354AbiHBHun (ORCPT ); Tue, 2 Aug 2022 03:50:43 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40D04627B for ; Tue, 2 Aug 2022 00:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659426622; x=1690962622; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nif8XEu6oh3Y03xfeEYZor1S8juxaW3ds9s4VuVJAbg=; b=gZ8EGKqlV3HNpYHkExaaeVijnMAKZEnbjaJ/Agj1x0piqYCRD2/IhX6u OgHJw0ztDOy5sULj3WTRwmfGUQ40dIHqsQOOOgnz1xa89f/jcHJIsG/FJ KzYZsowdr5SCR81l0Gf2DJdvr6W0KyeuGgRk1FMLIBZexmxzrXvtLNUVu ZJKs6CJcewVFM8LTouam0j7jMNbOyCO7akgdoeXZoRSx0ZiRDqyOHHRVR XrJ1yF7vE8fZILMLsSbMXHPJul/cBFrPr4CL3mXR9WqP6wQwXHpR60pGd ex3Hd43/TR9fk4j9k9Jlm66BhvbW8mL+6mV2tTozmdAscQCaRVK6+6VZs g==; X-IronPort-AV: E=McAfee;i="6400,9594,10426"; a="272393200" X-IronPort-AV: E=Sophos;i="5.93,210,1654585200"; d="scan'208";a="272393200" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2022 00:50:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,210,1654585200"; d="scan'208";a="630604413" Received: from lxy-dell.sh.intel.com ([10.239.48.38]) by orsmga008.jf.intel.com with ESMTP; 02 Aug 2022 00:50:17 -0700 From: Xiaoyao Li To: Paolo Bonzini , Isaku Yamahata , Gerd Hoffmann , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Richard Henderson , "Michael S . Tsirkin" , Marcel Apfelbaum , Cornelia Huck , Marcelo Tosatti , Laszlo Ersek , Eric Blake Cc: Connor Kuehl , erdemaktas@google.com, kvm@vger.kernel.org, qemu-devel@nongnu.org, seanjc@google.com, xiaoyao.li@intel.com Subject: [PATCH v1 34/40] hw/i386: add eoi_intercept_unsupported member to X86MachineState Date: Tue, 2 Aug 2022 15:47:44 +0800 Message-Id: <20220802074750.2581308-35-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220802074750.2581308-1-xiaoyao.li@intel.com> References: <20220802074750.2581308-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add a new bool member, eoi_intercept_unsupported, to X86MachineState with default value false. Set true for TDX VM. Inability to intercept eoi causes impossibility to emulate level triggered interrupt to be re-injected when level is still kept active. which affects interrupt controller emulation. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- hw/i386/x86.c | 1 + include/hw/i386/x86.h | 1 + target/i386/kvm/tdx.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index a389ee26265a..6ab023713bf1 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -1401,6 +1401,7 @@ static void x86_machine_initfn(Object *obj) x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); x86ms->bus_lock_ratelimit = 0; x86ms->above_4g_mem_start = 4 * GiB; + x86ms->eoi_intercept_unsupported = false; } static void x86_machine_class_init(ObjectClass *oc, void *data) diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 62fa5774f849..0a294f9c3176 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -61,6 +61,7 @@ struct X86MachineState { /* CPU and apic information: */ bool apic_xrupt_override; + bool eoi_intercept_unsupported; unsigned pci_irq_mask; unsigned apic_id_limit; uint16_t boot_cpus; diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 2f317a6bb55b..c734772200d0 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -675,6 +675,8 @@ int tdx_kvm_init(MachineState *ms, Error **errp) return -EINVAL; } + x86ms->eoi_intercept_unsupported = true; + if (!tdx_caps) { get_tdx_capabilities(); }