Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2058261pxm; Thu, 24 Feb 2022 15:26:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRF6j4eyN1RdXMhiQkiryY34rPRu2g27YtH0OfarFRHUO8JECYTYgkSzaQ6Mk8FTeU9QMf X-Received: by 2002:aa7:d8d8:0:b0:3f5:9041:2450 with SMTP id k24-20020aa7d8d8000000b003f590412450mr4643577eds.322.1645745165705; Thu, 24 Feb 2022 15:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645745165; cv=none; d=google.com; s=arc-20160816; b=W7B7T3VH+83bNfP7ZJfKi90MqUaKvWxtlGO6A2zqMWdM5aWWNampvGNAdsWQWY0qaZ A+vZAku/xzOvNw5kJlqeqefVjfCrV3reNqUfU5OoeBu7xJYqGMQda05S+bUFlwE9cyLR g/oT97TDwD1T9eMLeF8AtiBKa4CgdXVRkFBa16js55BAV6hJ+TFo/45rr2tVx67zqFZS U1NqbG7PO4daq1k6aM2TxwdeGcUhbvtsvGuSk1KwbirkPojxVX2PM8GzoABrOTCIeZV7 Y5NDIF1zh6ioPNmYegykDQWOvDOEg/yhzj9Ugy9wj0ER2z7KXv7Tm6LMplDfTDbciHy6 Fm1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=+vK1xB7UShJfAJZGgsC+y4YYAOeyIedk2kuQsNSaeeY=; b=KNi7ppYj6NyoYAtLW5+cFgC6c524WK5mMP6ZpTk3/H9sOlFvhkVWUebLNry32IUs/p jpjc26WE5jeuhJNDM/H21LWFLPIfQoDiLaXwiWx2CE2TBfbQI6xcAcMXzDhREkHkvB73 PM1Q9RxMWQj2bNGaWnTsy8kGcTjRpaVfTNO7kmUCpGL3lutPLhcOIN9yR8bA2amzjp+3 RVqAk0B9+dXC5+F5peSvMNAIcz2fvar8/Isb8IztbvlsQXdu/NLN1ot3/jX5T38uBfkq 1x/M7W/GjaVxjllQECbjA7/jGl8svRRDLPpGpZWcLtfoc14YKhFWSBskb0pRbtfj8fk2 KXoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KoTxr0dM; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a15-20020a056402236f00b004128f9e7cc5si620669eda.307.2022.02.24.15.25.42; Thu, 24 Feb 2022 15:26:05 -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=@intel.com header.s=Intel header.b=KoTxr0dM; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235430AbiBXWXP (ORCPT + 99 others); Thu, 24 Feb 2022 17:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235427AbiBXWXN (ORCPT ); Thu, 24 Feb 2022 17:23:13 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7011F6BE5 for ; Thu, 24 Feb 2022 14:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645741362; x=1677277362; h=message-id:date:mime-version:to:cc:references:from: subject:in-reply-to:content-transfer-encoding; bh=5RiZZ9aPukW4GiysnDDSrpGKUCcJUHrJhiwKvfkbbek=; b=KoTxr0dMmW17nB3tsSmkzgNSGXGmzAELExP4t79AGCWzf9bXwtkAP2iI mOfbPBuMhTJIn4JLKGBsF4gpU1en/4HfaCFN/ERWZls45laC6gPKzQ9Gq HIGlWa8WsxODMd7z/AM/fFkHMS/Qh++wqx/o7/C+94Trc4/fvdgQDOxLx 1icxvP2WvoGLhqkorn3/+RLh9PnsBXvklcFxQGVdUOxSoyFLcAPfAd1lk 38V9qulwnugGQVDxiHMYg1oNxuDoQq1R645iepX1KICHK1VvY3Np0L1QE ZFgjoF90B9XKevCRFzJdIBJmqDKZu7/ote58U73RwSdBpXl+vwClFWuRd g==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="235873948" X-IronPort-AV: E=Sophos;i="5.90,134,1643702400"; d="scan'208";a="235873948" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 14:22:42 -0800 X-IronPort-AV: E=Sophos;i="5.90,134,1643702400"; d="scan'208";a="639902503" Received: from hthen-mobl2.amr.corp.intel.com (HELO [10.209.48.194]) ([10.209.48.194]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 14:22:41 -0800 Message-ID: <10b4cfef-49f8-12db-0ad7-2a6acad00234@intel.com> Date: Thu, 24 Feb 2022 14:22:36 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: "Kirill A. Shutemov" , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, luto@kernel.org, peterz@infradead.org Cc: 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, thomas.lendacky@amd.com, brijesh.singh@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org References: <20220224155630.52734-1-kirill.shutemov@linux.intel.com> <20220224155630.52734-17-kirill.shutemov@linux.intel.com> From: Dave Hansen Subject: Re: [PATCHv4 16/30] x86/boot/compressed: Support TDX guest port I/O at decompression time In-Reply-To: <20220224155630.52734-17-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/24/22 07:56, Kirill A. Shutemov wrote: > @@ -24,4 +88,11 @@ void early_tdx_detect(void) > > /* Cache TDX guest feature status */ > tdx_guest_detected = true; > + > + pio_ops.inb = tdx_inb; > + pio_ops.inw = tdx_inw; > + pio_ops.inl = tdx_inl; > + pio_ops.outb = tdx_outb; > + pio_ops.outw = tdx_outw; > + pio_ops.outl = tdx_outl; > } I guess the kernel isn't going to get far if any of this goes wrong. But, I do kinda wish that code ^^ was connected to the below code somehow: > +static inline void init_io_ops(void) > +{ > + pio_ops.inb = inb; > + pio_ops.inw = inw; > + pio_ops.inl = inl; > + pio_ops.outb = outb; > + pio_ops.outw = outw; > + pio_ops.outl = outl; > +} Maybe just a comment would do it. Or, maybe init_io_ops() should just be called init_default_io_ops(). I think this would do: /* * Use the normal I/O instructions by default. * TDX guests override these to use hypercalls. */ if it went in init_io_ops() from the last patch. > > +static inline unsigned int tdx_io_in(int size, u16 port) > +{ > + struct tdx_hypercall_args args = { > + .r10 = TDX_HYPERCALL_STANDARD, > + .r11 = EXIT_REASON_IO_INSTRUCTION, > + .r12 = size, > + .r13 = 0, ^ munged whitespace? > + .r14 = port, > + }; > + > + if (__tdx_hypercall(&args, TDX_HCALL_HAS_OUTPUT)) > + return UINT_MAX; > + > + return args.r11; > +} With that fixed: Acked-by: Dave Hansen