mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Tom Lendacky <thomas.lendacky@amd.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
	'Wu Zongyong' <wuzongyong@linux.alibaba.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tony.luck@intel.com" <tony.luck@intel.com>,
	"wutu.xq2@linux.alibaba.com" <wutu.xq2@linux.alibaba.com>
Subject: Re: [RFC PATCH] x86/insn: support decode MOVSXD instruction for MMIO
Date: Fri, 31 Mar 2023 18:25:08 +0300	[thread overview]
Message-ID: <20230331152508.s7phgif3iozbbpqn@box> (raw)
In-Reply-To: <e9c3019f-936f-8bcc-d20f-16220993ff1c@amd.com>

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

  reply	other threads:[~2023-03-31 15:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  2:59 Wu Zongyong
2023-03-29 13:49 ` Tom Lendacky
2023-03-30  2:55   ` Wu Zongyong
2023-03-30 12:39 ` kirill.shutemov
2023-03-31  2:24   ` Wu Zongyong
2023-03-31  8:49     ` David Laight
2023-03-31 10:06       ` Kirill A. Shutemov
2023-03-31 13:40         ` Tom Lendacky
2023-03-31 14:09           ` Kirill A. Shutemov
2023-03-31 14:33             ` Tom Lendacky
2023-03-31 15:25               ` Kirill A. Shutemov [this message]
2023-03-31 15:50                 ` Tom Lendacky
2023-03-31 15:59                 ` David Laight
2023-03-31 15:30 ` Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230331152508.s7phgif3iozbbpqn@box \
    --to=kirill@shutemov.name \
    --cc=David.Laight@ACULAB.COM \
    --cc=dave.hansen@linux.intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=tony.luck@intel.com \
    --cc=wutu.xq2@linux.alibaba.com \
    --cc=wuzongyong@linux.alibaba.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®