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 33EDFC7112B for ; Fri, 18 Aug 2023 10:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359635AbjHRKBO (ORCPT ); Fri, 18 Aug 2023 06:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359646AbjHRKAu (ORCPT ); Fri, 18 Aug 2023 06:00:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59BE468A for ; Fri, 18 Aug 2023 03:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692352823; x=1723888823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XHGyPmr32gfRp1gabnygMwh7rV9WOuw4y1xl3pv0pPw=; b=hbuqP5umDn7TsUtaP/uqH/Vq9VA9TpCXmpzW17SZ9Sr+3GHbbD4VTWVo fzJBMvZ0DSW1h03VtmSZCUsO0pWl9gxwxFm6CMIiwaHhsFS4ex8JxwvhS 9D4L6AXNzYxRB2YwFFRmvfWFYyNWo3jLsl202jygBKpM6TLo+URpO5Xtj 7tGJ+/DUKxEwCZpZTaKkfToOzQaY81TJSmp3fjr7bss1lRPhOBY/lDSpz Myh7B4eQQFM+gDPUyodLd/ZodEwS2knp60cmKdf/c0GEfxj8zsrIAPNtf s4YjaknHXjHj/Ry+JlgMHswvD9+eRROKJpGGTepAlONWwXnz8h9eFIdG+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10805"; a="371966846" X-IronPort-AV: E=Sophos;i="6.01,182,1684825200"; d="scan'208";a="371966846" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2023 02:58:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10805"; a="849235639" X-IronPort-AV: E=Sophos;i="6.01,182,1684825200"; d="scan'208";a="849235639" Received: from lxy-clx-4s.sh.intel.com ([10.239.48.46]) by fmsmga002.fm.intel.com with ESMTP; 18 Aug 2023 02:58:37 -0700 From: Xiaoyao Li To: Paolo Bonzini , Richard Henderson , "Michael S. Tsirkin" , Marcel Apfelbaum , Igor Mammedov , Ani Sinha , Peter Xu , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Cornelia Huck , Eric Blake , Markus Armbruster , Marcelo Tosatti , Gerd Hoffmann Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Eduardo Habkost , Laszlo Ersek , xiaoyao.li@intel.com, Isaku Yamahata , erdemaktas@google.com, Chenyi Qiang Subject: [PATCH v2 49/58] i386/tdx: Disable PIC for TDX VMs Date: Fri, 18 Aug 2023 05:50:32 -0400 Message-Id: <20230818095041.1973309-50-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818095041.1973309-1-xiaoyao.li@intel.com> References: <20230818095041.1973309-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Legacy PIC (8259) cannot be supported for TDX VMs since TDX module doesn't allow directly interrupt injection. Using posted interrupts for the PIC is not a viable option as the guest BIOS/kernel will not do EOI for PIC IRQs, i.e. will leave the vIRR bit set. Hence disable PIC for TDX VMs and error out if user wants PIC. Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann --- target/i386/kvm/tdx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index f9d03ab0f461..23ecd84a9e21 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -689,6 +689,13 @@ int tdx_kvm_init(MachineState *ms, Error **errp) return -EINVAL; } + if (x86ms->pic == ON_OFF_AUTO_AUTO) { + x86ms->pic = ON_OFF_AUTO_OFF; + } else if (x86ms->pic == ON_OFF_AUTO_ON) { + error_setg(errp, "TDX VM doesn't support PIC"); + return -EINVAL; + } + if (!tdx_caps) { get_tdx_capabilities(); } -- 2.34.1