Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp841246rwl; Fri, 31 Mar 2023 03:14:29 -0700 (PDT) X-Google-Smtp-Source: AKy350avLouN5x90qbu0vnxc4uIDM7Oj9leb0TVq6Qql6jrK8xQSQv4cXBRD7qi/eBDzF6j+t21C X-Received: by 2002:a17:906:15c:b0:8f5:14ab:94bc with SMTP id 28-20020a170906015c00b008f514ab94bcmr22789464ejh.6.1680257669701; Fri, 31 Mar 2023 03:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680257669; cv=none; d=google.com; s=arc-20160816; b=TWIxd0nV6daF7VH48aTI9t9vvzjrUxmxgWOHzMAoRAy05jlhBAdY7QiX8yqH1GaGCN yF7qMnqw/Js3BIYgV81BoQOQfe5YsDduvufmlcMRNGkNU8UA8J+8hvlwAJBkzUUnNjt5 CDu+RX1iPcUDXlTY/GDuVzLG0OsY6ysr8gSryXnu627shbT11HdUHfAPvGcV3R+jd3X/ JJ8eatXvpYI1XRp+HtNvhUqu3RDvuzUYuQSub9t/JZBP+uNHVLZMySdc7h738YFuh1wD iiIZhZ8GJjzNM0w+Ju/zpWETLU0bamgSju7pRPw+dIu5rHwMuZDD8ZvSXE5R7eJSajpY ZAMQ== 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=FVZsS7Q8CRL80mz+OBGzUgzxi1hLCre7tpFSwGVLW6c=; b=iIbu0+vkrYDH8FDlI7gVGmYvxgRbwySvs/mntxJXCSEa9X7M1vHetHrUvOpNI5c/lX mFfmqir7hHOTpkTBMP4vnDdFMdLXMLffkcrV+Ofd+DWoufF2L0xJczFxEOSiFly/udrK beahLDkqXs8adPLYjHJRe4gRzuUKER6fvOuEqP2X+msl5ocRspSe67W6MjaIvnhLASPR MuLt/ZsOZ1A+9w7zn6U7zOleced1mFreLXgE6BaSvQMDn70xv60CyrIfrnAQDtWpDhQb e74nTPXa47s4+DZ0PygU+PKIcXzv+xlCpdSfzyCcj2T+vI2SjyO3glMIExJGlmTaNNBu paYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=g74BrP38; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jkzseWqP; 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 s26-20020a170906169a00b0093117deb464si1376002ejd.88.2023.03.31.03.14.04; Fri, 31 Mar 2023 03:14:29 -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=g74BrP38; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jkzseWqP; 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 S230440AbjCaKNF (ORCPT + 99 others); Fri, 31 Mar 2023 06:13:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjCaKLw (ORCPT ); Fri, 31 Mar 2023 06:11:52 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 794D522EA8 for ; Fri, 31 Mar 2023 03:06:28 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id AE0F13200033; Fri, 31 Mar 2023 06:06:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 31 Mar 2023 06:06:25 -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=1680257184; x= 1680343584; bh=FVZsS7Q8CRL80mz+OBGzUgzxi1hLCre7tpFSwGVLW6c=; b=g 74BrP38adlV3AUiyQeWoYGLAcME2rL0+pv7IBNgRy6IN357gg7OYoa8v7XXKHCAf sDJN9llWppir27pU7VawuVGewVQya18qdWb9m3BzXn9xIf9Jf5ORbIW4TGD1D+jq 1aP7VSzB1jekwAqWdBof+0ntl6Q+0vaHvEL5UZKkJpaWg0NiOMKmcZE9g85WQXiS RlI/6IZHfNmuABWdMHt79cJp9rHkCX7H1TVPT3gQr126WGLsS12PS3AWxbRlIqZU SVsC8NBX9ahtIP75+R77Exa3xm9KTnx43AHvq8JskEi+WX9jMrNk525Z0BWdsE+h jfsMjnOvVBhc/a88cSytw== 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=1680257184; x=1680343584; bh=FVZsS7Q8CRL80 mz+OBGzUgzxi1hLCre7tpFSwGVLW6c=; b=jkzseWqPQU0PHhQ0L9uvlmc4Qs037 yn69fNiTAsUORI1iOpm8Ydn5n/KrudKX3PPmsFv7WPQVt20+T+DDYfnu7uJqXj6J S4G7fcJkCCH1hpmEaAa+HS7aGcqrURVL3J4hbQoO3KaBno6hRcG/g2XvtmQD6FnG zvbepOzmB1o6Q5di+HHRGsLANgi27Us03rza7HjzCpOttk5Mfdu6rE22knuprcj2 DGESYlEMcOeC/eV6FMKk0KYvBD0JIQ+yyzlYl2oKsS4Uafh9/eUKtc4MF6me9jaC rH8gmJ2MNYptvBesPLd4e27ZSVHFFQj6QX7eAzDT9ITb1ZQbDTGRJthWA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeiuddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpefhieeghfdtfeehtdeftdehgfehuddtvdeuheet tddtheejueekjeegueeivdektdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 31 Mar 2023 06:06:23 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 2468F104994; Fri, 31 Mar 2023 13:06:20 +0300 (+03) Date: Fri, 31 Mar 2023 13:06:20 +0300 From: "Kirill A. Shutemov" To: David Laight , Tom Lendacky Cc: '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: <20230331100620.mkqg72vwhmlliunn@box.shutemov.name> References: <1655f5dc49ab77f94e350ecbdc93e8d9b31acf61.1680058548.git.wuzongyong@linux.alibaba.com> <20230330123951.b5vujv67c7q3dhay@box.shutemov.name> <20230331022414.GB435@L-PF27918B-1352.localdomain> <94c3f7ba1caa45f7ba503cde6e0c79d2@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94c3f7ba1caa45f7ba503cde6e0c79d2@AcuMS.aculab.com> 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 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? -- Kiryl Shutsemau / Kirill A. Shutemov