Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1258017rwl; Fri, 31 Mar 2023 08:40:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bi/u+Je4mMT/ONOY4Y0SJQ8dMaIblOsfmNqvk6bJRt+/Ga7Wj30sOoOaKJ1EvYXS0Nm7DQ X-Received: by 2002:a05:6402:2811:b0:4bb:c3ce:63fc with SMTP id h17-20020a056402281100b004bbc3ce63fcmr31339713ede.3.1680277223358; Fri, 31 Mar 2023 08:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680277223; cv=none; d=google.com; s=arc-20160816; b=mVjBjmS1YN3jDr6ijvQK1B/Zn8nzZKJekuwZYlw1hz38HfND1AQwU/zg0wY9K1GasG 2MRVsANi3mkL68llz5tv407U7lU8a5cg7njb4c6o75znidySrRG+CShA+Z/odpXhX78W jGV32IPx9nS4lCuTVzcOvk09kr4AWaYMKudYWCO0NTR55XDpf8xJQbFXWwAUsdmrEiZ8 WjmhAnRIe18eD1+XU7Z4jEd6McviS62bbWrbPv4WNvvCpV0MyaMSgFezBAlyJgU81I2I bITCqjj8aagYbaEQIBoSMyVXVvF6IVKEXzkzLw2qPqJ24AliK9dEeWHcYVyNlxTOqpEn Cx/w== 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:feedback-id :dkim-signature:dkim-signature; bh=Ipz+M2Kmii1aq11vOWdBUVAGILuh07AcP4+oS2U+sCg=; b=iJ43KZu+SRfs77BGRemHpF7BZXn5ZFqeBxOH2HQvtHA9PBoS+1uWgXwYJ0egQQgnNY kYxz13Qf/7SCbyUJXLQWy3r5gX6iXGjanV8Z7NU31SRV9Uc4UjkPx+RlaoZ+R0qKLnUe p/k5JEL4TrKFphIjrkVHtbXHTCJncDQdSJ4aX0P0Vm7AyTrCIJfnEBJ4HBYVDzpSubsa yDTOBwMHTNnBpikaGMY+z6c1TV/pCPmxJx77+YtreDvk0AjeefdKvf/bNloSzfl095ve lcBX52vyptNfL0C0sqdu1Abb66WdujCgBwsY/+i1txctXrowXQid7llPqnqYq9kjWR4r Eaog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=IvxjrOl0; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Yy7gHDMJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a05640202cc00b00501db82b63csi2144444edx.172.2023.03.31.08.39.53; Fri, 31 Mar 2023 08:40:23 -0700 (PDT) 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=@shutemov.name header.s=fm1 header.b=IvxjrOl0; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Yy7gHDMJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233054AbjCaPZS (ORCPT + 99 others); Fri, 31 Mar 2023 11:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231654AbjCaPZR (ORCPT ); Fri, 31 Mar 2023 11:25:17 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B8E1CBBB for ; Fri, 31 Mar 2023 08:25:16 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EAF185C00FB; Fri, 31 Mar 2023 11:25:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 31 Mar 2023 11:25:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1680276312; x= 1680362712; bh=Ipz+M2Kmii1aq11vOWdBUVAGILuh07AcP4+oS2U+sCg=; b=I vxjrOl0Zn3hLpOF5K381+ACFnjhOAa3HBXf+M2Z56QIAxcocyryznTNpgnmui6vx OOSbGMfDG8XWMDUTf47hF2fcymwqHjndrsp4DUxd9yi9KuvBzDYOhDanNHo2cEDN CHFiUcvOq06MR4C7oF1A5x0S0dZyriqufm5arlR/ry+5bIES/7cxFnerd6H23tzI nY/U/mLAc7r0dh1y+bIdwyzeyTiZXfuQqWmugFs5RYddbsimNxjGgRsnw2KC0Qv6 egvHt1nQZCMlc5mzUc+xyaAacPIEhH5tFn4Sv+78BzLa8ifkbx7d1e/4H8fUrAL7 Ajhv4w7NJDqTsFr3ORMEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680276312; x=1680362712; bh=Ipz+M2Kmii1aq 11vOWdBUVAGILuh07AcP4+oS2U+sCg=; b=Yy7gHDMJYXES2yz9A0QrW53IXmHRe OkQXA1uL87EIHlEbqY6s0u9XSlm+hkgp7GQW1XMQ1sfJF0d/7cIXTlmFMKLNaPbX 6ByPO2SqdpOlga7HAWOafhZ8xlbhHYaC2vTdu5eDve9WnMlq+FnnF2FXu6p/kiFQ IIRFswHOoTvbUPCo5n+g1v4H4oRrUpLRySzehFwffv5mFXNRZg3Cu4Xz8iSRF1kH 3TbjEg0fUMSrnNow+S0YC+X2x7SJTFGS9V2R+5HBgWbMv1C24qYOQp9M6jeMuk64 xCO43j1c5kKp0OS6YJM72sgVZltkMmpMpmfvElvCo0hA370PkbevGjQfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeiuddgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpeegjeeuuddvheeuffeuuddvueetheejuddtfeei lefhhfffvddviefhkeefvdegudenucffohhmrghinhepmhhmihhordhhmhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkihhrihhllhesshhh uhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 31 Mar 2023 11:25:10 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 4E0B010A05E; Fri, 31 Mar 2023 18:25:08 +0300 (+03) Date: Fri, 31 Mar 2023 18:25:08 +0300 From: "Kirill A. Shutemov" To: Tom Lendacky Cc: David Laight , 'Wu Zongyong' , "kirill.shutemov@linux.intel.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "tony.luck@intel.com" , "wutu.xq2@linux.alibaba.com" Subject: Re: [RFC PATCH] x86/insn: support decode MOVSXD instruction for MMIO Message-ID: <20230331152508.s7phgif3iozbbpqn@box> References: <1655f5dc49ab77f94e350ecbdc93e8d9b31acf61.1680058548.git.wuzongyong@linux.alibaba.com> <20230330123951.b5vujv67c7q3dhay@box.shutemov.name> <20230331022414.GB435@L-PF27918B-1352.localdomain> <94c3f7ba1caa45f7ba503cde6e0c79d2@AcuMS.aculab.com> <20230331100620.mkqg72vwhmlliunn@box.shutemov.name> <2220e2f1-2c91-e054-c107-a761fdfe7ffb@amd.com> <20230331140916.ofb7ecrjpg7shaav@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 Fri, Mar 31, 2023 at 09:33:31AM -0500, Tom Lendacky wrote: > > > On 3/31/23 09:09, Kirill A. Shutemov wrote: > > On Fri, Mar 31, 2023 at 08:40:30AM -0500, Tom Lendacky wrote: > > > On 3/31/23 05:06, Kirill A. Shutemov wrote: > > > > On Fri, Mar 31, 2023 at 08:49:48AM +0000, David Laight wrote: > > > > > From: Wu Zongyong > > > > > > Sent: 31 March 2023 03:24 > > > > > > > > > > > > On Thu, Mar 30, 2023 at 03:39:51PM +0300, kirill.shutemov@linux.intel.com wrote: > > > > > > > On Wed, Mar 29, 2023 at 10:59:37AM +0800, Wu Zongyong wrote: > > > > > > > > It seems MOVSXD which opcode is 0x63 is not handled, support > > > > > > > > to decode it in insn_decode_mmio(). > > > > > > > > > > > > > > Do you have a particular user in mind? > > > > > > To be honest, I don't find a specific user which uses the MOVSXD. > > > > > > > > > > > > But both Intel and AMD's instructions reference contains MOVSXD and lots > > > > > > of MOVSXD instructions occur when I "objdump -S vmlinux", so I think it > > > > > > may be useful to support it in insn_decode_mmio(). > > > > > > > > > > > > Are there some special consideration about this instruction? > > > > > > > > > > It is a sign-extending memory read (32bit to 64bit). > > > > > You pretty much never want to do that to a device register. > > > > > Also kernel code should be using readl() (etc) which do > > > > > unsigned reads. > > > > > So they should never happen for mmio. > > > > > > > > > > Of course, if you mmap() PCIe space directly into a program's > > > > > address space anything might happen ... > > > > > > > > There are two users of the interface: TDX and SEV. TDX doesn't allow > > > > userspace MMIO. SEV *seems* allows it, but I am not sure how it is safe. > > > > > > > > Tom? > > > > > > The insn_decode_mmio() function is only called by the SEV/TDX related code > > > and is specifically MMIO oriented. As David said, this instruction is likely > > > not being used for that in the kernel. If we come across a case where this > > > is used, we can look at how it is being used in that situation and it can be > > > addressed then. > > > > I was asking if SEV supports userspace MMIO. And if yes, how do you make > > it safe? > > > > No, SEV doesn't support userspace MMIO. But where do you filter out userspace MMIO? AFAICS, it goes straight from from #VC to insn_decode_mmio(). Hm? -- Kiryl Shutsemau / Kirill A. Shutemov