Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5134261pxj; Wed, 9 Jun 2021 09:55:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTlmylYBo6eAXXJmLsPtHHM7tOv6ejtMhwaaG/lat2suMykolAzD84KNrBEvuI90NVrLNN X-Received: by 2002:a05:6402:655:: with SMTP id u21mr371927edx.211.1623257709452; Wed, 09 Jun 2021 09:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623257709; cv=none; d=google.com; s=arc-20160816; b=YZglIEfGOH0GL5jJvY3TtfQW/hO+1RkqxrD1W0jUe5ewTEABDZs5iQm3GW0bfgTZ32 ESjdE+WPAre/RNPdN3WYxx326ESNC401LuLbv+Q3J3SFQDzxi+RBEvMfJQuLmjAD1F0h XyZM1QcX+R38ZfBXqPap/r7q2W20Tee5oxy6r0XQuES0Xbet9QVkwGJVAPcY/uwcMkRb ansK8MPGroiQ8akxjHTcDY1WAEP0I3XRHL2FIscelgbW1OxqrTOR2F/TWTrycYtOnzBs +gFAbKkbpLnrH+ln8ivz5YdsTwleOoCrZ8Ry9lEd1O59uuHfwqfn57V4NkvQdELhemPV WO2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VVHHsZmgnQE4FoIRlh0tnAp+GCRu+pvT2NaDwu+6pyA=; b=JtEOGCTi3G0IYlcfaoRw4krTW66dZ7V5X4XPhBl54N/re+ma6jl0ZM5C1LbNLck+ON gvFynyOplMfLmE9wjQNpm2NbwNrCTv8mk73Y6HKh0vShj7Ijg0d8/+BelYlXBh4YKbKp B1w8oyjSxLOQC7OI1rCEp57joD6XrdYzrX0SNR0/xCwGBe8o0qn0RvEyQuYg9IvbsMF8 vNsywDjtLucpift6TWhNSQVI7yidpw2bEOZVS8yjWWn4ilYZqUnP+Ayxrfs5uTtqywxK sbmcyTqiOH1s/zky8JIljeR3Gx4SeQfyH/fFjzbVOKwloOYYc+Z7bazrFj0TEmW/ACCe uk0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=A2+gkPmE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh25si276363ejb.170.2021.06.09.09.54.46; Wed, 09 Jun 2021 09:55:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=A2+gkPmE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234915AbhFHXPX (ORCPT + 99 others); Tue, 8 Jun 2021 19:15:23 -0400 Received: from mail-pg1-f177.google.com ([209.85.215.177]:45860 "EHLO mail-pg1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234060AbhFHXPX (ORCPT ); Tue, 8 Jun 2021 19:15:23 -0400 Received: by mail-pg1-f177.google.com with SMTP id q15so17801978pgg.12 for ; Tue, 08 Jun 2021 16:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VVHHsZmgnQE4FoIRlh0tnAp+GCRu+pvT2NaDwu+6pyA=; b=A2+gkPmEOqrQW2pFugLSrb30IoeUDdcGr8dIbngT/4xp0aEmVg/PghppWc56VS68aR dpaUosF0QuVyrTuJ5+14RRCkabMvwxSuORRfTWvN1LoJM8RXxjsCV8JLvp47hONUCbNv 4rHmF7XWPwmi9/P9KtpR55iOVnKg2y2WIb8XxQKrefIsTl219SZ5pzHG+hDFqBRSEv9C xXzx02CHBW40cIRcYsK79amKtk61L2xpSVlPILWH5iF683I7emfT9by2MxbYonlnZGMc OPI+sWnz+MnRpT8BEwXJh6p64YWOR4fypV2WwQVc5GmcmhAVgtNEGY8vwBtbqbJl1pcl Gx9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VVHHsZmgnQE4FoIRlh0tnAp+GCRu+pvT2NaDwu+6pyA=; b=XLtIcDKCm6Sdfyr1zS8Yeou0tAsAxGrFx3STP//rAvwXS7dpZpGzyytwhQ4L2kts0A 9BiLdeWVxhnNc8QHE7FYzWPmLcKNi76VMnKYBguntJZVc8yKPDrL2q7+1ATrmAViNjRj 8tWb4J6H5BSVvawqgt0nxOsoI3b3ZYUPqc3msh8T+w4Jf2whlAXD4ehqzhpOSZw6lrSb 8YUcTVaarCXxWvG/uEmOPMeqIXDD3V8T4XPj4fk0vdIewjId3AGHSQbY9vrofqaOxxFf /i+VEhgnP0lFmiuOwlJt0KKqDdpmzCCD1VkFiXENnqGqGrGO4EO7Aj8CTvwlCHGqRVqn 9pEA== X-Gm-Message-State: AOAM532rj5FpHeoga110l86zSj2SDs7GgEwni81jIXaLjORFMpb08WTh Z59Loi9AExdS5GUSOtAWAfz3V1Tc7YphpqDroqjGgA== X-Received: by 2002:aa7:952b:0:b029:2e9:eef1:8e17 with SMTP id c11-20020aa7952b0000b02902e9eef18e17mr2290787pfp.70.1623193949671; Tue, 08 Jun 2021 16:12:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dan Williams Date: Tue, 8 Jun 2021 16:12:18 -0700 Message-ID: Subject: Re: [RFC v2-fix-v2 1/3] x86/tdx: Handle port I/O in decompression code To: Kuppuswamy Sathyanarayanan Cc: Peter Zijlstra , Andy Lutomirski , Dave Hansen , Tony Luck , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 8, 2021 at 8:40 AM Kuppuswamy Sathyanarayanan wrote: > > Add support to replace in/out instructions in > decompression code with TDX IO hypercalls. > > TDX cannot do port IO directly. The TDX module triggers > a #VE exception to let the guest kernel to emulate port > I/O, by converting them into TDX hypercalls to call the > host. > > But for the really early code in the decompressor, #VE > cannot be used because the IDT needed for handling the > exception is not set-up, and some other infrastructure > needed by the handler is missing. So to support port IO > in decompressor code, directly replace in/out instructions > with TDX IO hypercalls. This can beeasily achieved by > modifying __in/__out macros. > > Also, since TDX IO hypercall requires an IO size parameter, > modify __in/__out macros to accept size as input parameter. Looks good to me: Reviewed-by: Dan Williams