Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1004533rwl; Fri, 31 Mar 2023 05:38:32 -0700 (PDT) X-Google-Smtp-Source: AKy350aPtE3C0kuyxM7lWexCkiFQ/EUwESYGBx081Xj3MzCNgnVxRbP/HglVlhLNBJLxpnpziIh2 X-Received: by 2002:a17:903:41cb:b0:1a2:9940:1f75 with SMTP id u11-20020a17090341cb00b001a299401f75mr3330472ple.0.1680266312269; Fri, 31 Mar 2023 05:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680266312; cv=none; d=google.com; s=arc-20160816; b=keW/r/Z6D9Y7fETy61wJpY7/4y6lcCHmV5oWnfKMXX7I/25PcdE1SlYvtjCqAQivML K8f+v0xais07NahsBkXCwgIDrX8KjiP91AufOUjbZKv7zPy5F5FWIqQ3OkGsTRzUtxtI M0lD0xcDubHmQ68c3p2FMmL/9fGXYPnu01GKRy1xTiCcocE3c5n7XggjgiMk3cUKrpEY WdE3deWnm6MdVCo4gaaDRfFCnXAFIeoA6ziRVI4qZ97Yc/YSqxCE/UFwX4dv3niAYRR+ frsy1jaKBNPzuVEHYSPXO9y/2NP2Pte15tW2Q11y672qa3yOxhFcL07GaETTZOkqmkD5 Qn3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4KTJSn8H2uB3vfjjc3uadlsM15f3kbQVGyII0+t/LEI=; b=RejJfY8XacIqhS6bAhAim/fig64Mjtp3xHIibGsTTFT9A6S0OIyfPsz9deoz5b8PcZ 7vHRNGr1ZrOxLeN0h8WnwAAKKC++3UiO1TViotfGX/+BGr1nLBR9kPLjgnvoneF5Mj0k FSPZhmIrNbanyXex7EwAa/LiPUT28hNGd/AEqCkZ1PK4JOP80u/pUv45Zu6K9DLrvzEK PfSJjw1o74NbHy28/kIGABe3K64wtbv9x7O1YgE5S98kXcsEG0q66jez0S1w2NSYz96y HK284dMPGVxR8P2jMaw1ea4h5tC6Bq3SxnuXPUq+a7jg+Jf2aDORz40Zcc7hbooJxxEL ULCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QD7WZmmZ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020a17090300d200b001a198422033si1988911plc.21.2023.03.31.05.38.20; Fri, 31 Mar 2023 05:38:32 -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=@gmail.com header.s=20210112 header.b=QD7WZmmZ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232267AbjCaMcW (ORCPT + 99 others); Fri, 31 Mar 2023 08:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230023AbjCaMcV (ORCPT ); Fri, 31 Mar 2023 08:32:21 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64EC420322; Fri, 31 Mar 2023 05:32:13 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id y20so28701885lfj.2; Fri, 31 Mar 2023 05:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680265931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=4KTJSn8H2uB3vfjjc3uadlsM15f3kbQVGyII0+t/LEI=; b=QD7WZmmZFrod6yoS7XIZqmHoij1p+/FnZDtyTewCqJtKLBHpesNP2T6jCg+PR3I+8K +i/SQVdPyh5dkNoxURbgtJ+N217ohEJRtDop/unOriovtyK3Q1+NznEJmjKVLNye0RtP TVHB1veuODw/isGXnIejoTLai8xDaJ3CYaj2705V1qazaU8DCKIrFJWC73L8faON1tdm nacW2wR1LYEtFjcGH68Cncb70AUQSusZca2le0uTX0L/JstBPZSX87Z9KdCjKxrRyiOf hzwrcVmmQqBtth+Jrb3UvHS6uPATZsmPQeU1h7sAD52RU92bV9XyFWUpJLfxGcl1y9YZ lbpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680265931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4KTJSn8H2uB3vfjjc3uadlsM15f3kbQVGyII0+t/LEI=; b=pNrnUocn65j5hA6Cu3j94rBeXb5OK9kzm9DJ+slakQjQ6NWggJSBnlZs/HxDc4n9bX y/Fv1/Fl9kMxiMtx514l5xPSYWDaIAhtcWQoWs+KEX1ugd01uc7Pzhgvg/lcB569fh6A 54CvNlc8FwLN4ZeLiT2DUO47bEUnkFOX5oNHvuTHbjnmgqOwXQgbNn1hQsXHZbkr/SUy O2v5vYPhxKkYuoU3CCKmus+POAB5woUH5O8XOMHd4GbZUNAACSCf/gaFz/bNmDRpMADg hxJ0xmAKQeDpXjoyQELN/QZ1jHlxvixoniKvF3PH98iuK1srqSwbKBalCQhQgIMfUrLC /WPg== X-Gm-Message-State: AAQBX9dVkPC8itFPNyxaIf9Yu+vZxGvP8m0aw8dZKJA7pypCF7MynoIR 0DK9HbC+y3K5g9LTw1d6lEI= X-Received: by 2002:ac2:4946:0:b0:4dc:807a:d137 with SMTP id o6-20020ac24946000000b004dc807ad137mr1455128lfi.4.1680265931481; Fri, 31 Mar 2023 05:32:11 -0700 (PDT) Received: from localhost (88-115-161-74.elisa-laajakaista.fi. [88.115.161.74]) by smtp.gmail.com with ESMTPSA id b4-20020ac25e84000000b004b4b600c093sm361849lfq.92.2023.03.31.05.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 05:32:11 -0700 (PDT) Date: Fri, 31 Mar 2023 15:31:07 +0300 From: Zhi Wang To: Xiaoyao Li Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Sean Christopherson Subject: Re: [PATCH v13 016/113] KVM: TDX: x86: Add ioctl to get TDX systemwide parameters Message-ID: <20230331153107.0000029d@gmail.com> In-Reply-To: References: <20230325104306.00004585@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,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, 31 Mar 2023 14:59:18 +0800 Xiaoyao Li wrote: > On 3/25/2023 4:43 PM, Zhi Wang wrote: > > On Sun, 12 Mar 2023 10:55:40 -0700 > > isaku.yamahata@intel.com wrote: > > > > Does this have to be a new generic ioctl with a dedicated new x86_ops? SNP > > does not use it at all and all the system-scoped ioctl of SNP going through > > the CCP driver. So getting system-scope information of TDX/SNP will end up > > differently. > > > > Any thought, Sean? Moving getting SNP system-wide information to > > KVM dev ioctl seems not ideal and TDX does not have a dedicated driver like > > CCP. Maybe make this ioctl TDX-specific? KVM_TDX_DEV_OP? > > What's the real different of it? For me, it's just renaming > KVM_MEMORY_ENCRYPT_OP to KVM_TDX_DEV_OP and maybe add some error message > if the IOCTL is issued for AMD plaform. > Hi: The ioctl is the API for the userspace. The purpose is to be orthogonal, avoid confusion and reflect its nature. A "generic" name with only one implementation is fine in the early design. But if the other implementation at the same level is pretty sure not going to use it, then the abstraction, which is only abstracted for one implementation, is just confusing. The possible strategies are: 1) Re-factor the other implementation to fit the current abstraction. 2) Give up the abstraction. Go "specific". For 1), it seems not realistic due to the efforts of re-factoring the SEV driver. For 2), there can be several ways: a. renaming it, let the name reflect its nature. IMO, KVM_TDX_DEV_OP is not ideal as well, but I don't have a better one. b. moving it to a proper layer of the implementation. But it is also not realistic to have a "TDX" driver because of it. That's why I am torn here.