Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp224415pxb; Wed, 3 Feb 2021 04:06:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxXwhw5bgL9kzbBX+fhwQW7HyemMbrqb57QdKiqqxZKnq1a7BYXjt4afquYLKoNZHcKB7i X-Received: by 2002:a05:6402:1152:: with SMTP id g18mr2640089edw.18.1612354003097; Wed, 03 Feb 2021 04:06:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612354003; cv=none; d=google.com; s=arc-20160816; b=NIj6O5Pz407Qw0P7p+QnDM1ZlDuSFL4IX6lOQGHtNxvvUNFfNiG8QU6RxGMjnHoGA+ mSzQMVEc33Q9lL9i4rCtSODeUzaBiQtnONdUD14tpjTSED4uyGyGKlSb29JHKXK/gf7K KJZ8PtTLm0gBhVCkZcgIVHvoy7Toz8cl1V1z8aFfjbIJzu3xSdQlu/JfGxtjFRrO/yRC p2fwCm2xMBGIDhUjHwdZ/8jnqgmOUT1VdtahRvDiSh5ToCNAvuYWKXmkktXuMgkQ04HV PNXl6yH8TQLd1fhbfXkb1Gkm3DrZMAFaXwxNBrN3I2aJLN0AHvgxYC0OM+eRJlpYZMln z8LA== 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=iNR8QlX4YDC7YWVJjV9rWOyT5zUrM1pP8pRraf7704c=; b=mC4K7c705lRxHSZO84JT8D6CXJc9LeZ9I58BYs8o6+Dsjc8V4XeO/TM1Lau+iPG+U/ vcmIMie+3V4aBtr/RErY/Rp0EdjsjS5mnGQhCuYFKeQEr6m3UrZHc/CrDKXpOI3OVapn RdrAz8HEGe+bwgzfzAzjaDX9hAUMF0zpXV/umImjmgGWukNlr2s9nnNcnDT7mBKXJ26G kpyhUKp1csEjOKeDynTAfdXnojPeAkXl3PwMhzfJNKDLeJwjt3IZJojo+hFJIdPqweQz 4LMd646aZ71axwHfKnb5QcJOiEkLxzzYxh3fv1WAnoD382QlZVkxdbaarjUG87YpSv0S wS7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="pjo0NJt/"; 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 f11si1242624ejw.77.2021.02.03.04.06.18; Wed, 03 Feb 2021 04:06:43 -0800 (PST) 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="pjo0NJt/"; 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 S234132AbhBCMCP (ORCPT + 99 others); Wed, 3 Feb 2021 07:02:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234341AbhBCMBV (ORCPT ); Wed, 3 Feb 2021 07:01:21 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2516CC061573 for ; Wed, 3 Feb 2021 04:00:41 -0800 (PST) Received: from zn.tnic (p200300ec2f0c84005017455b058bf408.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:8400:5017:455b:58b:f408]) (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 894E71EC0324; Wed, 3 Feb 2021 13:00:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1612353639; 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=iNR8QlX4YDC7YWVJjV9rWOyT5zUrM1pP8pRraf7704c=; b=pjo0NJt/YkDWZ9jQFICp9DrZYnm9uzcPyt+kCGI8kOX3skF9da/I82o5V54GyUss1DfVQg jxkX8LXCUxY295A9TBZVdHpZ3uf3MmRnoMaWwclsh6O2yvyF6VPBx+ejlacVNsZPYIqB7m e6yeQlCl0nfmcr+ucknWNhnhiR79T9U= Date: Wed, 3 Feb 2021 13:00:37 +0100 From: Borislav Petkov To: Tom Lendacky Cc: Andy Lutomirski , Masami Hiramatsu , X86 ML , LKML Subject: Re: [PATCH v1 00/19] x86/insn: Add an insn_decode() API Message-ID: <20210203120037.GA13819@zn.tnic> References: <20201223174233.28638-1-bp@alien8.de> <9e5d1122-d5ad-93f2-143d-d0386d054e4a@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9e5d1122-d5ad-93f2-143d-d0386d054e4a@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 27, 2020 at 09:26:04AM -0600, Tom Lendacky wrote: > > We could also say that probably there should be a way to say "decode > > only the first insn in the buffer and ignore the rest". That is all up > > to the use cases so I'm looking for suggestions here. > > That's the way it works today, right? One instruction, no matter the length > of the buffer (assuming the length is long enough to include a full > instruction)? > > Because the callers of the decode may rely on parsing only the current > instruction (like SEV-ES), it should probably default to that (although most > of the call points are being updated so you could supply a boolean to > indicate one vs many instructions). The caller doesn't necessarily know the > length of the instruction, so it may provide a buffer of max instruction > length. > > Also, if you want to parse more than one instruction at a time, wouldn't you > need to maintain register context within the parsing, I don't think that is > done today. Or you could chain together some instruction contexts to > identify each instruction that was parsed? Yah, let's leave it all to the one who actually needs multiple insn parsing. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette