Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp717334lqp; Thu, 21 Mar 2024 13:22:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWM9hNEGONzJrxI2EenG/3xr+D3SJp9p6U7xbCcc6pAjpqZInWEDTfl9owlTsx/iLH5WmO1Jj16GwPlB2cuLGB7de2fBlqWekwbYYTHOQ== X-Google-Smtp-Source: AGHT+IE4eIdrOvv0B5SawmWRAw/FLWgKOJpuTV9p5eanNL/xF0M4BsNoqUv+P99Np+5wifawh1wd X-Received: by 2002:ac2:58f5:0:b0:513:ec32:aa7b with SMTP id v21-20020ac258f5000000b00513ec32aa7bmr222548lfo.63.1711052521938; Thu, 21 Mar 2024 13:22:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711052521; cv=pass; d=google.com; s=arc-20160816; b=EWMzOVOP7YE13o6RqqEeIwIlFuz82wUBVcmd6M1Ymx4SzGtTeD4TMaYc3ZtQcaRgLt txXdLT0XSHPPVJ7/rAJ9Mt8+DuAiw4bUMN/mZFVjHMrbcndkZk4VxXhQG2p96xrcopFh w7rqBlXIjXRuNR4xvkMRQ/3g5vVFaJpXSnozCRTfuU7bd3YAgSkKaTWePzkuTjM2MeHm j0gouZ1JpcW7XcWCRr5wwBWzBhYmLKHMGZOlmecy2s4NQb6kS7c3NlSXfkavgOb09vKR QjCM7R4GZf/uugFJNwArb5BbBOYCIBoLmsFIlarDSZTLQrVcjD+gXZVg1pBttv8xHNOt J1Mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WWF3lW4QsVZK3xcCY1Poz41fomNqCvzEVN14tgabovk=; fh=tt0CEY5xhom/IlvDKU6vi+rzDvhB3cKAIKF4sAkibAI=; b=A9htdAWcRS9ZAwXDXS3868xzcqGZVFh9agyiFZLiVLumjwqFpto2pEJuQR7FzQ0kdv j7VszGOvnu5ZjWWKogl+dN8vSVbrLlT4MjxvZoL+yy+B2LXl4qfTMzQTFjjvbsZPFZfT Ncjr6HZcpuox4V+TcBJiqny3T7HPrJdYl2ZCSNlwzv0VPyjP5lXBSBDP3mU7lU4ScMGQ RnZD7r4ygr2R06qrBGxr6LkLU/bmS0UsLmM4eIYA/qzAg6SVIKeZeCId0sfnlB/GRvgv 2PnPkGBLMboMIW81YsugLdnFGK78yvLIIz3+cJWLK3hYcXfEOZZ/EffovQIUqiR/kyKn 5RYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PAOtddWz; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v27-20020a50a45b000000b0056827075d5bsi220039edb.199.2024.03.21.13.22.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 13:22:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PAOtddWz; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110636-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 721A31F22DD2 for ; Thu, 21 Mar 2024 20:22:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0260B134CDB; Thu, 21 Mar 2024 20:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PAOtddWz" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F5B71332B8; Thu, 21 Mar 2024 20:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711052513; cv=none; b=KQhtEnmMj+rlfN8Y1KKeyGQVHcE4fp+2tbT7ZUXkqTodu/Y15DRFIeuOzqRKawvKoyJEWh1jfDBwnGl2Tk+U/PtAMg7wnJhdb17FUaOZNSGeZo+GmeQBRC0sp78nFrNCEkwoU3oQYIV7J5gyBaEr622eap+QG5bMPdOoUO0kC2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711052513; c=relaxed/simple; bh=YNdCec0+EXbFaWJzFkVG+4FcFLin1OKD7Jn+VdAoNPw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JL65fi8FuHz1PcpUj3oPgnTeCq2EiOnx1bicr4YBl5CVmXZGP+YRGhXcPNpsF2yxjhBpMqZ6NaL6lHZs7T0rf0d8PxnnIrMijdPNJ5a24YONHkXafZb9BY40F2kS0KbMKVi9IFEIXS0lfVFvgqbGW1CgR72r+QI/LBX3T+tO7Xo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PAOtddWz; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711052511; x=1742588511; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=YNdCec0+EXbFaWJzFkVG+4FcFLin1OKD7Jn+VdAoNPw=; b=PAOtddWzEvRLH1NzoPRinogWbUv+RLBYfh47Ixk/DsMYocTMlnIl4JQF hjOfC9uC1arKAhf3vwF0MYtiQyyPW+qoUrSDiET7c+z0++NNo6b0wchuS vrj7aQKcXpv/D/BA/OkM/7S1rH1BzbfyLlOL9rBUia7L94n+ygaZ3WRrh GMcw2qRU5BoD6OWWy65TqbTYq84Uukg5uA9HwIPVlA5B7EopWPHNUWAT2 VXWoHnHXQIVApg00Sp8dpZ0XP/BtNzzstz88DDsGTi4tUVeLedNmmGMxa 9xGW49Q0FdpjwJoquokiHztvtLQyqHb33nGxOkSzq6jHuG+XZ/Ipmp7nr w==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="6686108" X-IronPort-AV: E=Sophos;i="6.07,143,1708416000"; d="scan'208";a="6686108" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 13:21:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,143,1708416000"; d="scan'208";a="37768692" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 13:21:50 -0700 Date: Thu, 21 Mar 2024 13:21:50 -0700 From: Isaku Yamahata To: Chao Gao Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, isaku.yamahata@linux.intel.com Subject: Re: [PATCH v19 043/130] KVM: TDX: create/free TDX vcpu structure Message-ID: <20240321202150.GP1994522@ls.amr.corp.intel.com> References: <51c4203e844159451f5a78fb18cc5bebcc38a76e.1708933498.git.isaku.yamahata@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Mar 21, 2024 at 09:30:12AM +0800, Chao Gao wrote: > >+int tdx_vcpu_create(struct kvm_vcpu *vcpu) > >+{ > >+ struct kvm_tdx *kvm_tdx = to_kvm_tdx(vcpu->kvm); > >+ > >+ WARN_ON_ONCE(vcpu->arch.cpuid_entries); > >+ WARN_ON_ONCE(vcpu->arch.cpuid_nent); > >+ > >+ /* TDX only supports x2APIC, which requires an in-kernel local APIC. */ > > Cannot QEMU emulate x2APIC? In my understanding, the reason is TDX module always > enables APICv for TDs. So, KVM cannot intercept every access to APIC and forward > them to QEMU for emulation. You're right. Let me update it as follows. /* * TDX module always enables APICv for TDs. So, KVM cannot intercept every * access to APIC and forward them to user space VMM. */ > >+ if (!vcpu->arch.apic) > > will "if (!irqchip_in_kernel(vcpu->kvm))" work? looks this is the custome for such > a check. It should work because kvm_arch_vcpu_create(). Will update it. -- Isaku Yamahata