Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp881700pxj; Wed, 2 Jun 2021 14:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgtfD+44ck4GzPvrr4HWBsSiNjIAydcD75ZhO7y1OTacssbcVSl5sjNCzsQb/7JxvptUZk X-Received: by 2002:a05:6402:35cc:: with SMTP id z12mr40048408edc.154.1622667850946; Wed, 02 Jun 2021 14:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622667850; cv=none; d=google.com; s=arc-20160816; b=RyQDEre044j3BMFV9R03BXEKgJnrvd7PmjAKEfJ2x624w426RdOca3z3leUogKjF6h Dlhl6lo6MwLW7Yx6j8DXfJIs3WgdBiFQLg8ncLbjMWa9UKkLsal4T5EcB663k7CaZrhC eo40Gm4S+Kw6lWrp8tnP4RUJwewnRIGit5uVY4Ic8rX4y6RcbVMt+o7ojf8H4btsDzzB 1T4fK/TFzsOBpScJqq4gR61qgHsJGHvVh2J3Z+Vh3ooFuhuhYRUD3TzL6+rywqMuIJVi XMT9I/WsJBdelyNaS0r6y0Tb6qNoLD7nepF+PYCoJavcSKrPbyhdZ1qCYItPn28QYnwv uexQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=XQnwN8oUxOYxmM7f+zdDNDwk+sUY/dycXI3rH7MtcP0=; b=ynq4Nn3hLf/mv0M1KDUD/8YxXHtgzTs4+u9LIPqegDOvBWB4rATIIi1zqL1bataNrD lxRdPHp7GqraFjKQ1PXC1xN38n0IsgA5a0+zPPsFtrlwKZiMhRoxzsZm0JTj/D71iDEo 99vwG2ibnhBNhVLTCQwtuxAuCg4b1JPatP/TV+35tOVS9JMFjx+neb9tvKzszwQxBzeb 2ZKtHe5a433I6vXAW+lOTw3aKLh0xXinVoHzHMXA38xhV+pLkD4AY3uJcUGPAjjbPtxR Xn+St2ecO1HO7J6ss3G1IoiDQxFrGugborOoGyrPOTDBii/JzkKmy0p9kFir+0XuinzI hMvw== ARC-Authentication-Results: i=1; mx.google.com; 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 df14si726412edb.108.2021.06.02.14.03.40; Wed, 02 Jun 2021 14:04:10 -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; 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 S229619AbhFBVDs (ORCPT + 99 others); Wed, 2 Jun 2021 17:03:48 -0400 Received: from mga01.intel.com ([192.55.52.88]:44909 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbhFBVDs (ORCPT ); Wed, 2 Jun 2021 17:03:48 -0400 IronPort-SDR: vu1nzEQCRwtGrmv/puk5JPep95Hn+0KktcbWosg1H/s3zWvjoH9dggb9anDP2geNlEFJaWw1Lx MJ1NR4/3p9iw== X-IronPort-AV: E=McAfee;i="6200,9189,10003"; a="225189230" X-IronPort-AV: E=Sophos;i="5.83,242,1616482800"; d="scan'208";a="225189230" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 14:01:28 -0700 IronPort-SDR: J2wKdPazg82ORk0RGAZtvxrW6bZfilHAJDJ3Z2cv1VC3xjRHF8j0sev2eNp+5JM8uSkjojzilB XOCGnoqCS2hw== X-IronPort-AV: E=Sophos;i="5.83,242,1616482800"; d="scan'208";a="550322215" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.209.87.193]) ([10.209.87.193]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 14:01:27 -0700 Subject: Re: [RFC v2-fix-v2 2/2] x86/tdx: Handle in-kernel MMIO To: Kuppuswamy Sathyanarayanan , Peter Zijlstra , Andy Lutomirski , Dave Hansen , Tony Luck Cc: Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , Sean Christopherson , linux-kernel@vger.kernel.org References: <3e9a26c3-8eee-88f5-f8e2-8a2dd2c028ea@intel.com> <20210602194220.2227863-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210602194220.2227863-3-sathyanarayanan.kuppuswamy@linux.intel.com> From: Andi Kleen Message-ID: Date: Wed, 2 Jun 2021 14:01:26 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210602194220.2227863-3-sathyanarayanan.kuppuswamy@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org User-space > access triggers SIGBUS. Actually it looks like it's implemented below now, so that sentence could be dropped. > + > + if (user_mode(regs)) { > + ret = insn_fetch_from_user(regs, buffer); > + if (!ret) > + return -EFAULT; > + if (!insn_decode_from_regs(&insn, regs, buffer, ret)) > + return -EFAULT; > + } else { > + ret = copy_from_kernel_nofault(buffer, (void *)regs->ip, > + MAX_INSN_SIZE); > + if (ret) > + return -EFAULT; > + insn_init(&insn, buffer, MAX_INSN_SIZE, 1); > + insn_get_length(&insn); > + } > +