Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3018072rdb; Mon, 4 Dec 2023 14:18:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaSJiuj6s2CIIqEhnAOr31vlJdDQPrbsyw78GXj0R/5cfMh3NQeKlI1oYwbCcdc/OIFVDE X-Received: by 2002:a05:6358:98a8:b0:16d:e1d8:22c7 with SMTP id q40-20020a05635898a800b0016de1d822c7mr5677801rwa.29.1701728285339; Mon, 04 Dec 2023 14:18:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701728285; cv=none; d=google.com; s=arc-20160816; b=Ztl+rBM5wuEjYtUnLcXcf8CvJn5pHiKDNtomaXMMLlvUUc1HuUAPBwXpXXgbJLFwhn v95MVxJzKfM+F115dy5Seo2oRx6zh2M27hn9D4hO/aWAv0yREL9JvTjVhEs4A07KyMMy LJEUfLNGHMeJF5ck6h185R5xyyfULL7KTGEzY0r21sIvfn+zxhEIy4ZIJvRkT4BvgGgK dZWkT2Ip8LrpSdgUcdkVc1n3TAys1egTxBT8Ft9RrgKmRyPVeBEViYFqXUxr/EuRhZxX YiaOuKY+O7Sqv03S5G3xeM8PK457qVLuV+zydIeZiDvq63uNrxfmbdM9ewcrHfb3wtwM F8iQ== 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:date:subject:cc:to:from :dkim-signature; bh=v02hD3R8jEMwVKzcum5kRAvgAtTP2BuZ+eebivmoZM8=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=iS2NPcbrfz2zwHdLxzVqEbnfaPEkwbIPW9X2Rpv4Oqd2YPVVR5ZgoqbGCMgTJjhhfl 4HrGjhhP5NUtOd58eiLBIIyWCe4e2nOwme4Q+Bnwg/ChgEWzaYtKtomPW1KaYKg9SVlW VlvEQ+j7HjIvvejkz4pCAgvLeu7MTN8kZ/bk6IB1AJLoLwLEC6gHfoPsHbHIw70yqoVH T4h3cMk9Jq1J5035YQIg4Kioamui/gOD6DZyu/5WKldz8AN6shRp8AorDtnj2DCmuG+v MC2n8aGZozfemYVhCVvEYvUvwLq/avKBIpap2pD4Lzxag62jo8Plv0WE2XL6r2dU+YUE gMwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ltWg0URi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u13-20020a6540cd000000b005be0050a443si8100817pgp.430.2023.12.04.14.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:18:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ltWg0URi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 013068043D02; Mon, 4 Dec 2023 14:18:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234534AbjLDWRq (ORCPT + 99 others); Mon, 4 Dec 2023 17:17:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234141AbjLDWRl (ORCPT ); Mon, 4 Dec 2023 17:17:41 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E903CD5; Mon, 4 Dec 2023 14:17:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701728267; x=1733264267; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BQqr6Qiq+LU7qEGRJzXDgEFA8nx6ZpzNwnQjzicG5Lw=; b=ltWg0URif3DXDlQ92tAF/zWwMXe3ggj1U/JWJ80yloCcIgB5UsLIFy/q 7eCTYgU5AnEb/iW/33uz+kKO3uy4vDvdC2Y4pOEjdzFIjDG4Ey8OEEOUt qyDfrFVftx4z55/TYVXjdZw9STpxhV8ixE3j+CwSlmDph7fEPl1TMBd9V QIDsOh2zo+KJTZbrehifibouWx6AZRJard0FKO97sHp65zK3oHzC4aq2O Ys0r6ng9/xq2qhjFTYnuxgudNdEDXD9p8JNlwLeWIuBoVnyr6DdH+jkqb UnYHibrIiyFvTzzKURDFKURRyWighVmy/MDJBTH1wHNGMxMq2sc9KkGHy A==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="480000875" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="480000875" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 14:17:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="764111953" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="764111953" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga007.jf.intel.com with ESMTP; 04 Dec 2023 14:17:46 -0800 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v3 2/5] platform/x86/intel/tpmi: Modify external interface to get read/write state Date: Mon, 4 Dec 2023 14:17:37 -0800 Message-Id: <20231204221740.3645130-3-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231204221740.3645130-1-srinivas.pandruvada@linux.intel.com> References: <20231204221740.3645130-1-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:18:02 -0800 (PST) Modify the external interface tpmi_get_feature_status() to get read and write blocked instead of locked and disabled. Since auxiliary device is not created when disabled, no use of returning disabled state. Also locked state is not useful as feature driver can't use locked state in a meaningful way. Using read and write state, feature driver can decide which operations to restrict for that feature. Signed-off-by: Srinivas Pandruvada Reviewed-by: Ilpo Järvinen --- v3 - Rebased on top of /pdx86/platform-drivers-x86 review-hans v2: - Change read_blocked/write_blocked to bool * drivers/platform/x86/intel/tpmi.c | 8 ++++---- include/linux/intel_tpmi.h | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/intel/tpmi.c b/drivers/platform/x86/intel/tpmi.c index 09972e2b8a06..92c5c3a90d53 100644 --- a/drivers/platform/x86/intel/tpmi.c +++ b/drivers/platform/x86/intel/tpmi.c @@ -345,8 +345,8 @@ static int tpmi_read_feature_status(struct intel_tpmi_info *tpmi_info, int featu return ret; } -int tpmi_get_feature_status(struct auxiliary_device *auxdev, int feature_id, - int *locked, int *disabled) +int tpmi_get_feature_status(struct auxiliary_device *auxdev, + int feature_id, bool *read_blocked, bool *write_blocked) { struct intel_vsec_device *intel_vsec_dev = dev_to_ivdev(auxdev->dev.parent); struct intel_tpmi_info *tpmi_info = auxiliary_get_drvdata(&intel_vsec_dev->auxdev); @@ -357,8 +357,8 @@ int tpmi_get_feature_status(struct auxiliary_device *auxdev, int feature_id, if (ret) return ret; - *locked = feature_state.locked; - *disabled = !feature_state.enabled; + *read_blocked = feature_state.read_blocked; + *write_blocked = feature_state.write_blocked; return 0; } diff --git a/include/linux/intel_tpmi.h b/include/linux/intel_tpmi.h index ee07393445f9..4f89c5bd8663 100644 --- a/include/linux/intel_tpmi.h +++ b/include/linux/intel_tpmi.h @@ -32,7 +32,6 @@ struct intel_tpmi_plat_info { struct intel_tpmi_plat_info *tpmi_get_platform_data(struct auxiliary_device *auxdev); struct resource *tpmi_get_resource_at_index(struct auxiliary_device *auxdev, int index); int tpmi_get_resource_count(struct auxiliary_device *auxdev); - -int tpmi_get_feature_status(struct auxiliary_device *auxdev, int feature_id, int *locked, - int *disabled); +int tpmi_get_feature_status(struct auxiliary_device *auxdev, int feature_id, bool *read_blocked, + bool *write_blocked); #endif -- 2.40.1