Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2890653pxb; Tue, 24 Aug 2021 09:58:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZWKulpewtq6CHYzCqtV6tL8orrEQ0Mj0bKUPpymGPu0cXh8MKJsNBIdq7RYgfkX792TbD X-Received: by 2002:a50:fd86:: with SMTP id o6mr3255808edt.312.1629824327618; Tue, 24 Aug 2021 09:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824327; cv=none; d=google.com; s=arc-20160816; b=vDWkwK5KRpXY2T3yZGdDqBCwf4alvmuNIhj1dfZbRjonWULoqpNt4V7cz2guaWPENk Rh7x8mtAxtVkcdomml3lDUP5TSNpoIODMrqS6sdfYROPqom+oXevA5FDEU1mL9dhk3bD pQIhLWoBhJTw3Csw01GQzUywAxK4SWVqNDyII82sfXiWnYUPXoAENAZp7vdc9unjY8iZ E9AhclbhnklhX1uFi3TT9vfyELwzYniCOMnEuaIVNh5+9BUXt74ubLyb+XN+/0UJSZcU uGissd43xxOgjaK0PMvj0Rq5jpFrpCSfjcXw/ahshZ+EWbeyl+GJ9ejhVkrx0EHXoU1x 8vUQ== 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=oucuOJ/6VvgUop2x1OI+HAFbSiUqa9pO9eiBxTDjqDU=; b=QKtav/SpvS0jHQY7qev1mXbRsS5ueSLGzMrRlUKcA0GeIBrnlIP6u+PI0ZjomA4rVE ul7DabPmGAecNP6U4iwcD8FEw4nmZUP2frTTZ08LEvaq/ULOEZrvgHORYSgOkkTVh5am 2+WcA7eV6YeKsfqQ5xRJFLoN96luewimuSE/UqN4dGO+kl7uNB6xczx2xwAT3B0DznaX FnsctUWqGYQb7IlxukqHSZ03Ob4fnegwUSqggqZp/1to7rZEtEQ1Qom90/fM4Wt38bIK NdTktlURM3nxRw5tJHWE8/pHrufUl2rUbT/BpTdF4yHwJTwoPURLc3eMNw309LQHwhTM hljQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=PNEDFxEL; 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=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy15si17561574ejb.95.2021.08.24.09.58.23; Tue, 24 Aug 2021 09:58:47 -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=@alien8.de header.s=dkim header.b=PNEDFxEL; 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=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232748AbhHXQzg (ORCPT + 99 others); Tue, 24 Aug 2021 12:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbhHXQzZ (ORCPT ); Tue, 24 Aug 2021 12:55:25 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B302C061757 for ; Tue, 24 Aug 2021 09:54:33 -0700 (PDT) Received: from zn.tnic (p200300ec2f11440049ee8a07127e6a59.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:4400:49ee:8a07:127e:6a59]) (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 104521EC04D1; Tue, 24 Aug 2021 18:54:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1629824068; 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=oucuOJ/6VvgUop2x1OI+HAFbSiUqa9pO9eiBxTDjqDU=; b=PNEDFxELl/eP785dgUGCkCL/yDSv4Uo0/Rl1JC8Eu0NqLPFsnSOJ+Q+m1oGl+c29okCpDn EXyBrlRojKbgqSvZGqwfTpkMep3+tae08RF6aIF6VwerwELWPpa/7uYP8qPa8pS04UnRqh enUQNP6+Cp7riAoIVAghu8QXIfRDQmI= Date: Tue, 24 Aug 2021 18:55:05 +0200 From: Borislav Petkov To: Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 10/12] x86/tdx: Add MSR support for TDX guest Message-ID: References: <20210804181329.2899708-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210804181329.2899708-11-sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210804181329.2899708-11-sathyanarayanan.kuppuswamy@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 04, 2021 at 11:13:27AM -0700, Kuppuswamy Sathyanarayanan wrote: > int tdg_handle_virtualization_exception(struct pt_regs *regs, > struct ve_info *ve) > { > + unsigned long val; > + int ret = 0; > + > switch (ve->exit_reason) { > case EXIT_REASON_HLT: > tdg_halt(); > break; > + case EXIT_REASON_MSR_READ: > + val = tdg_read_msr_safe(regs->cx, (unsigned int *)&ret); > + if (!ret) { > + regs->ax = val & UINT_MAX; regs->ax = (u32)val; > + regs->dx = val >> 32; > + } > + break; > + case EXIT_REASON_MSR_WRITE: > + ret = tdg_write_msr_safe(regs->cx, regs->ax, regs->dx); > + break; > default: > pr_warn("Unexpected #VE: %lld\n", ve->exit_reason); > return -EFAULT; > } > > /* After successful #VE handling, move the IP */ > - regs->ip += ve->instr_len; > + if (!ret) > + regs->ip += ve->instr_len; > > - return 0; > + return ret; > } > > void __init tdx_early_init(void) > -- -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette