Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1707773lqp; Mon, 15 Apr 2024 14:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpWNZvx3V13iforVIfkip1rrVrvtBwgTrNDU8Y7Z0rw/el/5o01dO5TsENoSIWb2qTllcIV1HMD94SVk/ZEWiGKN28KDFUkZ0M+7uKnw== X-Google-Smtp-Source: AGHT+IEaK/GlK9VILKKV3XXdXDxd2OycqXbF9bm+Z1mog3W57KPDaKSqNB3r5tOxs9Kq534ISp5Z X-Received: by 2002:ad4:43ec:0:b0:69b:5c27:488 with SMTP id f12-20020ad443ec000000b0069b5c270488mr10229798qvu.38.1713217885851; Mon, 15 Apr 2024 14:51:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713217885; cv=pass; d=google.com; s=arc-20160816; b=Plt6Wo/xl68XcDVC5q6L396P4QHJ4mX88R+moCm7k2ffwc3AniypbJfZVqAaCu8K3J xwUE12GODCQ6LmU/0NrHhXsHgBd2pbBziRIbLq6Cd169DFhSZ1F0K0t8cD6EgyncXdks Cn8BAZQlPsRD9cZETkVlpNxg143Ij0mzQQQZ8mBThzmcfOaFjLXlkP9/Yd8UcdpXwmsM wX8b3bBDw3eLDQM7f8MIFTmnAmsY0UIS6uWY+O3PemrIHCPlxCpPrqcUY4nW5ggzC2Ei ujnFW24WF9vr4dX8V3GurSTJSlYjm16FnGa4pAi7LNW5wpzssntqCXqCvf7KxBwHiil6 HNvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=W75B8HxMGNP8+16CidR8Q5gbDKs8IlBrIfQhtQWz1PY=; fh=q4cYIN7fTyFU9kU0bgjXRn2Y/8eO+EDL5gIfeEDPaGM=; b=oMGulV9BIqTFG4cXK8bzQUskZhNP3hqUlIU+ows4ezdNed4XbfhYPrqxYPpxoAMLt4 nxKwj/G2NX21k+tD0gshzHHoAjCTlwnU32j6Y8vgF2FNefMei+94a6ZeYYaiUZeu3Dpu WAJ0Ncr073UilfPZW9wgWizN4h8C25eu15woVF3dUU2IPwHDBKIbRBIfHEw7eebLxZB8 Gl/k/8TP8fjXDlalrFuZwberdY0rVbyxtM/jJn0nlBGWobDgezOTqcEnWGXre8+/bcO3 sigGvcgfXlRJlm8hVKfFwdDijkanzTUdIjl01mJ/X8J0wHmQr0eFw9Ujrzb888BDry8J X1Ig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gKqSmNoR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-145954-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u17-20020a0cea51000000b006993bbcb63dsi10775519qvp.549.2024.04.15.14.51.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 14:51:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145954-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gKqSmNoR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-145954-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 647B31C21C6E for ; Mon, 15 Apr 2024 21:51:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BB7915A4AA; Mon, 15 Apr 2024 21:50:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gKqSmNoR" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93FDB15A49C for ; Mon, 15 Apr 2024 21:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713217821; cv=none; b=GRkKFQD54INi0bQ/01LtlmY9VI1IeJs/gfJJbnmraatAbbyZQKsMNSeihCGwRn1Zs1Tm3WZ4CiKyQ390920yguveSWW366vgLsl8Id9PegHdXptTjWQPEtrirje1acVHWtL6BLgBOqxSgxC3opNSN8S2c9nF+fjcDpngRAIIigo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713217821; c=relaxed/simple; bh=Z0FynSgBzopwyO8X0ElsM9/n+YXv1XIMpnCuN7gKjYg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Nuy0qALidK0FXFzNcnP3cXqfdCt6S4SWrpcf6fFohPEVEJxRxrn7lcape+7a1hCH6q/Z8t7eGhVNuJzM+aVMKduQDT1uceKEN2HZ1NuzqSghKKUYIlmFCIwnQCMtDoTN4SnCDVjmW1OKI/3rK+V4Sj54HrHeULvwp3dHvM3nl9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gKqSmNoR; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713217820; x=1744753820; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Z0FynSgBzopwyO8X0ElsM9/n+YXv1XIMpnCuN7gKjYg=; b=gKqSmNoRg6tLlmAtltz9EbmAqbPG0p903jkSq8CaI9oYHDKcXelqJgQE katqGqZ+FvBoFHdHGxxYuMR2zJYh8Eca5ytkWdZhtAthT9aqwkkZmTwd1 ZWrghhoXsFt3yHVR6+on5dP25Qb9fsoQ0GrLrSI40rSO70TkEexVjMW8b aIxt/j4sw49SO5RUNDgcf8vuXCiukTYaaPke2AXIkGbB3x8nEVFq4OLMg 3rZAk9ZMEMQCAVAU1ucud0yyDJcVnTti5tI9tXXmMvl5soT/ZIf8V0UxP bh+vht2MGgeSKtDocZwt/Cl73GyoCU4OnaBoMXAYPmODp3UQYAJq5wXvc g==; X-CSE-ConnectionGUID: Wv14UPDZQc+s309tU4cjBA== X-CSE-MsgGUID: nPGlVcAfQ8ynz9ZdZ2mtUg== X-IronPort-AV: E=McAfee;i="6600,9927,11045"; a="8491832" X-IronPort-AV: E=Sophos;i="6.07,204,1708416000"; d="scan'208";a="8491832" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 14:50:19 -0700 X-CSE-ConnectionGUID: ZnuBGbWJRmurMVTsPmFBbA== X-CSE-MsgGUID: Ah6dHlfBRTSJ6L2YSp6mdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,204,1708416000"; d="scan'208";a="26710469" Received: from garumuga-mobl1.amr.corp.intel.com (HELO [10.209.93.175]) ([10.209.93.175]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 14:50:18 -0700 Message-ID: <7e138229-24bf-447b-b8dd-5340eaa939fe@linux.intel.com> Date: Mon, 15 Apr 2024 14:50:17 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 13/14] x86/sev: Hide SVSM attestation entries if not running under an SVSM To: Tom Lendacky , linux-kernel@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, svsm-devel@coconut-svsm.dev Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Dan Williams , Michael Roth , Ashish Kalra , Joel Becker , Christoph Hellwig References: <67893f352bc54de61160bfe251cba0bdf0431f37.1711405593.git.thomas.lendacky@amd.com> <1f6f4477-0f2a-434a-8c89-3b5d51d61581@linux.intel.com> <19d69960-e548-a2e6-87d9-c463f2851613@amd.com> <81d05bd9-ef8f-4a3a-a5df-384a82be49f5@linux.intel.com> <490a6a10-47d0-0689-432a-cbf22de11ad6@amd.com> Content-Language: en-US From: Kuppuswamy Sathyanarayanan In-Reply-To: <490a6a10-47d0-0689-432a-cbf22de11ad6@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 4/15/24 1:13 PM, Tom Lendacky wrote: > On 4/15/24 14:48, Kuppuswamy Sathyanarayanan wrote: >> Hi, >> >> On 4/15/24 12:16 PM, Tom Lendacky wrote: >>> On 4/12/24 10:52, Tom Lendacky wrote: >>>> On 4/9/24 13:12, Kuppuswamy Sathyanarayanan wrote: >>>>> On 3/25/24 3:26 PM, Tom Lendacky wrote: >>>>>> Config-fs provides support to hide individual attribute entries. Using >>>>>> this support, base the display of the SVSM related entries on the presence >>>>>> of an SVSM. >>>>>> >>>>>> Cc: Joel Becker >>>>>> Cc: Christoph Hellwig >>>>>> Signed-off-by: Tom Lendacky >>>>>> --- >>>>>>    arch/x86/coco/core.c        |  4 ++++ >>>>>>    drivers/virt/coco/tsm.c     | 14 ++++++++++---- >>>>>>    include/linux/cc_platform.h |  8 ++++++++ >>>>>>    3 files changed, 22 insertions(+), 4 deletions(-) >>>>>> >>> >>>>> >>>>> Any comment about the following query? I think introducing a CC flag for this use >>>>> case is over kill. >>>>> >>>>> https://lore.kernel.org/lkml/6b90b223-46e0-4e6d-a17c-5caf72e3c949@linux.intel.com/ >>>> >>>> If you don't think TDX will be able to make use of the SVSM attribute I can look at adding a callback. But I was waiting to see if anyone else had comments, for or against, before re-doing it all. >>>> >>> >>> What about something like this (applied on top of patch 13): >>> > >>> diff --git a/include/linux/tsm.h b/include/linux/tsm.h >>> index 27cc97fe8dcd..5aaf626d178d 100644 >>> --- a/include/linux/tsm.h >>> +++ b/include/linux/tsm.h >>> @@ -74,7 +74,20 @@ extern const struct config_item_type tsm_report_default_type; >>>   /* publish @privlevel, @privlevel_floor, and @auxblob attributes */ >>>   extern const struct config_item_type tsm_report_extra_type; >>>   +/* >>> + * Used to indicate the attribute group type to the visibility callback to >>> + * avoid the callback having to examine the attribute name. >> >> Checking the attribute name will give more flexibility, right? Since it is one time >> check, it should not be costly, right? > > I thought about checking the name(s), but what if in the future another attribute is added, then you have to remember to update multiple places. This way you have an enum that represents the related attributes. Is there a I think it depends on how you implement the visibility function. If the vendor driver allows all attributes by default and denies few selected ones, you don't have to update the vendor driver for all new attributes. Letting the vendor driver decide whether to support any new attributes makes sense to me. > scenario where you would want to not hide all attributes that are related? String comparisons just seem awkward to me. > > I suppose the config_item and configfs_attr could also be supplied on the callback if that's a requirement. I am ok with enum based checks. But lets see what others think. Personally I think checking config attr name is more flexible. > >> >>> +enum tsm_type { >>> +    TSM_TYPE_SERVICE_PROVIDER, >>> + >>> +    TSM_TYPE_MAX >>> +}; >>> + >>> +typedef bool (*tsm_visibility_t)(enum tsm_type type); >>> + >>>   int tsm_register(const struct tsm_ops *ops, void *priv, >>> -         const struct config_item_type *type); >>> +         const struct config_item_type *type, >>> +         tsm_visibility_t visibility); >>>   int tsm_unregister(const struct tsm_ops *ops); >>>   #endif /* __TSM_H */ >>> >> >> Why not add a callback in tsm_ops? > > That's an option, too. Either way works for me. > > Thanks, > Tom > >> >>>> Thanks, >>>> Tom >>>> > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer