Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2106641pxb; Wed, 2 Feb 2022 22:16:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlVeJTXh0+Z7hGswctN9SM38VLz1IO1zTU3OG82AyDLBijnXDB29HYWVgLfNAMhgEwNRaF X-Received: by 2002:a17:90b:1009:: with SMTP id gm9mr11939788pjb.223.1643869005481; Wed, 02 Feb 2022 22:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643869005; cv=none; d=google.com; s=arc-20160816; b=F2hL3y/OmdK/anNouC9yr5dzSftstRGubzxb2sFsTKnvLqnAnU5yv6RKcWkpH0U6FC XwrEMS0MMAkHA4rwknbeS7wrKzOeq/ECtR9sv9Nh7l11/CI38VwjefMHNDpN6W2wPfbC Q0ZZl8/ca1tmvorA0Da8VAQP39+XVmMBRbUtJBcf4ETDIZ7n3VdW/Rm0Cq9zgYO0TOGx tdRxatxatkIdSidzRQ37u472hWUL30BmBELehG2loYGMruyB2o+uamddZR0OK9uq2gAW RbLA9YSUQCGKrE5AeUnOqrC7jIpSi20yFNoPvKc+3hUPG/z1NQU74C4ECUTVjaSk6SYZ /kqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M4VktWFFIKUJAt6FYwzKVXHa8pwQPqrvJ0IYPtJZfc8=; b=XFcNMzyE5lIh3VA6Rl0GSb4WhkBCwhz4hL3BwOUTtfJs8ziKZytdLXCaALwDtmsDdY jRZmJ1kl1SwDN97EIGBFr/ejsvxMvwbNXBndokKc8th5Lno29E+LIh6M7qjvD1E8g914 QTFdim/+HzgtxxqvX8p+IHFe5TyOk9gCDup+6myx7hcU2FTzS2568h1tJ3uymmn+fga2 mPp2Fln86k8tYe6Jq7qyuFCa04rN/5O5cTu9GwZucC5WzQ/nJYux+pC6Z6ebRVV+uiFt GvyOgfXtaqnSsUcC9v2+Ux9lYfrRu3ZmKsmLopkmQnZI7sAHMLMMaB9YQs6W5GexhSPH TKcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=AbVsopQo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186si1916134pgd.740.2022.02.02.22.16.31; Wed, 02 Feb 2022 22:16:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=AbVsopQo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245713AbiBBKJu (ORCPT + 99 others); Wed, 2 Feb 2022 05:09:50 -0500 Received: from mail.skyhub.de ([5.9.137.197]:47678 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235899AbiBBKJr (ORCPT ); Wed, 2 Feb 2022 05:09:47 -0500 Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 26F631EC0518; Wed, 2 Feb 2022 11:09:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1643796582; 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:in-reply-to:in-reply-to: references:references; bh=M4VktWFFIKUJAt6FYwzKVXHa8pwQPqrvJ0IYPtJZfc8=; b=AbVsopQoa+KuH7xDGyom3d9zV7bGF11SEBS8qs907+enlvk/uGaq3Y+US1sexL4p3DcFb1 d39UkYf/vGxkv5L7ruZFA4U2uGlHfezt/7FHeOUjfLHaIshcNz1vBYTs7I17THmnxhIFIa 861Dh+YUCq5+9JY37CQKYOWPi/4j80c= Date: Wed, 2 Feb 2022 11:09:37 +0100 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: tglx@linutronix.de, mingo@redhat.com, dave.hansen@intel.com, luto@kernel.org, peterz@infradead.org, sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, jgross@suse.com, jmattson@google.com, joro@8bytes.org, jpoimboe@redhat.com, knsathya@kernel.org, pbonzini@redhat.com, sdeep@vmware.com, seanjc@google.com, tony.luck@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 14/29] x86/tdx: Early boot handling of port I/O Message-ID: References: <20220124150215.36893-1-kirill.shutemov@linux.intel.com> <20220124150215.36893-15-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220124150215.36893-15-kirill.shutemov@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 06:02:00PM +0300, Kirill A. Shutemov wrote: > Subject: Re: [PATCHv2 14/29] x86/tdx: Early boot handling of port I/O The condensed patch description in the subject line should start with a uppercase letter and should be written in imperative tone: ... Handle early boot port I/O or so. > From: Andi Kleen > > TDX guests cannot do port I/O directly. The TDX module triggers a #VE > exception to let the guest kernel emulate port I/O, by converting them s/,// > into TDCALLs to call the host. > > But before IDT handlers are set up, port I/O cannot be emulated using > normal kernel #VE handlers. To support the #VE-based emulation during > this boot window, add a minimal early #VE handler support in early > exception handlers. This is similar to what AMD SEV does. This is > mainly to support earlyprintk's serial driver, as well as potentially > the VGA driver (although it is expected not to be used). expectations, shmexpectations... ... > diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c > index 1cb6346ec3d1..76d298ddfe75 100644 > --- a/arch/x86/kernel/head64.c > +++ b/arch/x86/kernel/head64.c > @@ -417,6 +417,9 @@ void __init do_early_exception(struct pt_regs *regs, int trapnr) > trapnr == X86_TRAP_VC && handle_vc_boot_ghcb(regs)) > return; > if (IS_ENABLED(CONFIG_INTEL_TDX_GUEST)) && > + if (trapnr == X86_TRAP_VE && tdx_early_handle_ve(regs)) > + return; > + > early_fixup_exception(regs, trapnr); -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette