Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2623132pxb; Sun, 17 Oct 2021 20:48:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5hMKhPQ1YIa76dc1aZAqBXFQTvzv+OWNV+0YPkRTeJWir28F8EcEE9iWZ6PKQqGVg+042 X-Received: by 2002:a05:6a00:23d6:b0:44d:8426:e2bb with SMTP id g22-20020a056a0023d600b0044d8426e2bbmr22452702pfc.30.1634528888902; Sun, 17 Oct 2021 20:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528888; cv=none; d=google.com; s=arc-20160816; b=MmZmcdmzRGFBUzmeY0Jv38pA7/VRxopXSEgVwppWoU7E7Aqk0OuK8ySihWT/ktMbrc h+xSLMCZBAzk7rzh1pkoaamdXZD0UBNqSYY8HaVqt4v5zsZFxjK26n4juELsXCTuzhu3 eaw599bkUnC6uKNwWVZvAiKtKyT7NpYHaEihhVbrJtVZHOet3dDydlzveYEkbMlhwY5X NJ62niNKtGrE4b0aF7dgLuFGouCZJusYiGJ0D3gozJFO5ktm7g8x4sLhBj4poCN7jmMd +lnb3KTiol6RQBmJkzZeEu0jyLT0KvgcwEa9aiVQYvB1FDD/hG7n6gw7rpGc8Nukig1B yj3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=nayAYxRaMWLhlwjlwBCKqCn9Mc1r6wv7O0VDxjFDwbo=; b=KCNsdASBdrjYZ9Eb9qYR2YQeKWG6C7zWAWcHk4T4VgGF18ivo6neVVWYAMPdaSskRx BqmK10/X/OUmLXSmAPr6q55v3MvX0cc4WRjCN4pR8rlwWGJ41f21bjB7oX9eTkO/6H88 71u8Lwrj0qB4B2hALEfl++qt+eDsuvS6dC6MeR5jE9ZzF5oMyX2z7pNfB/SU7vLjA7zd yJgHBXyFEJIcAdoXsXcZCftXyW8mWX4xFlu1z52qICJnVV+GIOhyr8FoN3DrGbiQISfu ki3clAsHOt6EQov4y9HI8CYzpGkTVFoUoLApySNK8/zbH4JOwQV+dwzG+0C9xsOBuNTg 1tGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xxPqPbXk; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si27853402pjn.155.2021.10.17.20.47.56; Sun, 17 Oct 2021 20:48:08 -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=@linutronix.de header.s=2020 header.b=xxPqPbXk; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242787AbhJQUAr (ORCPT + 98 others); Sun, 17 Oct 2021 16:00:47 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:34028 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242719AbhJQUAr (ORCPT ); Sun, 17 Oct 2021 16:00:47 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634500716; 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: in-reply-to:in-reply-to:references:references; bh=nayAYxRaMWLhlwjlwBCKqCn9Mc1r6wv7O0VDxjFDwbo=; b=xxPqPbXkwStGcwGk97vgo3gQwK+9SIIutD1PFI5W+Yy8wKFtrrQBNqjfqsDN3Gthen7BuW 6Ya+P1wrpX0rbnqtwwpZfhFMo+qH88PRJCiubRU0FaajvrSNZUqgBPaVaGAvUZsJLDsDYV 7zbDOeO0Vs4SXEGbIYDKM69DX4NmBwHPtQTdqWCf7gWxYHOgaLTC2dR68Rvmjs8RxJzs/y 93jg3gJkRWyLNtYM+D5guYl+jRqRe7Y8rib/tJSvUjFR5I04COZbDyQdE8cKUw8yHbvx+P BRqHmKZeqnIrV6BqqzHH7W+cq2PWntMwGwOJcWQIHTzXGI3TC6iRDT+9sUQE3Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634500716; 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: in-reply-to:in-reply-to:references:references; bh=nayAYxRaMWLhlwjlwBCKqCn9Mc1r6wv7O0VDxjFDwbo=; b=nOgIU5sdnBldu0pc04Vbom9ze/HDO6e12owG/8UTIPsUD5EAIDfgvZ8JjdPzFwxCzuNQIF itNuBVc3UhQ+ojCg== To: Kuppuswamy Sathyanarayanan , Ingo Molnar , Borislav Petkov , x86@kernel.org, Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Josh Poimboeuf , "H . Peter Anvin" Cc: Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 05/10] x86/tdx: Handle port I/O In-Reply-To: <20211005204136.1812078-6-sathyanarayanan.kuppuswamy@linux.intel.com> References: <20211005204136.1812078-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005204136.1812078-6-sathyanarayanan.kuppuswamy@linux.intel.com> Date: Sun, 17 Oct 2021 21:58:35 +0200 Message-ID: <87v91v2zkk.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 05 2021 at 13:41, Kuppuswamy Sathyanarayanan wrote: > \ > static inline void outs##bwl(int port, const void *addr, unsigned long count) \ > { \ > - if (sev_key_active()) { \ > + if (sev_key_active() || \ > + cc_platform_has(CC_ATTR_GUEST_UNROLL_STRING_IO)) { \ Instead of adding an extra check, can you please replace that sev_key_active() with cc_platform_has() completely? > +/* > + * tdx_handle_early_io() cannot be re-used in #VE handler for handling > + * I/O because the way of handling string I/O is different between > + * normal and early I/O case. Also, once trace support is enabled, > + * tdx_handle_io() will be extended to use trace calls which is also > + * not valid for early I/O cases. > + */ > +static void tdx_handle_io(struct pt_regs *regs, u32 exit_qual) > +{ > + struct tdx_hypercall_output outh; > + int out, size, port, ret; > + bool string; > + u64 mask; > + > + string = VE_IS_IO_STRING(exit_qual); > + > + /* I/O strings ops are unrolled at build time. */ Fancy. The compiler can evaluate sev_key_active() and cc_platform_has() at build time? Thanks, tglx