Return-Path: Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5CDFBC0032 for ; Tue, 1 Aug 2023 21:59:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 27BB680B0E for ; Tue, 1 Aug 2023 21:59:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 27BB680B0E Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=b15WuJUq X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -4.399 X-Spam-Level: X-Spam-Status: No, score=-4.399 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tWbhwpC09_JE for ; Tue, 1 Aug 2023 21:59:29 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by smtp1.osuosl.org (Postfix) with ESMTPS id B5E6D81FB1 for ; Tue, 1 Aug 2023 21:59:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B5E6D81FB1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690927169; x=1722463169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xod0brLje1kdlQreVfdXcpuAiLxaeAMIqy3XgmSedxw=; b=b15WuJUqjbeeqcC4mg/ulOBxZYcZKO+wrRYVxEQ6F6ZVuE0pHtVGdW92 5QBDWPHo4Iwui8c88W2rqLowJXQsCFZoP6uRA6hFQRJsO9KMQ3BN09jd9 ckMHoWTdFI1zUPewNPB8GCoiLQuSphYxQnGuOkb29Wg6wQ7KKLEWixoEY 8/zH9E1qI6IzpN8suA6HLumMNuCGJZ/phkYo240cHUXLO/KjBfgb+Z4yw ZogQV27tz2nO3/27lKAdEsekpQEdtDEZrpiptnhGt9fcRVgQc/+L4Nwp4 hNM8iWcr6L0IARnZVPA7NK2srfrVIQdnzM2l6slEmx/cymYlp34WlDS6R A==; X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="400365399" X-IronPort-AV: E=Sophos;i="6.01,248,1684825200"; d="scan'208";a="400365399" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2023 14:52:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="763974430" X-IronPort-AV: E=Sophos;i="6.01,248,1684825200"; d="scan'208";a="763974430" Received: from fyu1.sc.intel.com ([172.25.103.126]) by orsmga001.jf.intel.com with ESMTP; 01 Aug 2023 14:52:20 -0700 From: Fenghua Yu To: accel-config@lists.linuxfoundation.org, "Ramesh Thomas" , "Tony Luck" Date: Tue, 1 Aug 2023 14:52:26 -0700 Message-Id: <20230801215232.4001749-2-fenghua.yu@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230801215232.4001749-1-fenghua.yu@intel.com> References: <20230801215232.4001749-1-fenghua.yu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Accel-config] [PATCH 1/7] accel-config: Skip configuring ats_disable if the attribute is not present X-BeenThere: accel-config@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: accel-config List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2023 21:59:36 -0000 Not every IDXD device supports Address Translation Service (ATS) disable feature. Add the check so the ATS disable attribute can only be written on the IDXD devices that support the feature. Signed-off-by: Fenghua Yu Reviewed-by: Ramesh Thomas --- accfg/config.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/accfg/config.c b/accfg/config.c index 08952f8..2631fd9 100644 --- a/accfg/config.c +++ b/accfg/config.c @@ -117,6 +117,7 @@ static const struct group_set_table group_table[] = { static bool is_wq_threshold_writable(struct accfg_wq *wq, int val); static bool is_wq_prs_disable_writable(struct accfg_wq *wq, int val); +static bool is_wq_ats_disable_writable(struct accfg_wq *wq, int val); static const struct wq_set_table wq_table[] = { { "size", accfg_wq_set_size, NULL, NULL, NULL }, @@ -132,7 +133,8 @@ static const struct wq_set_table wq_table[] = { { "max_transfer_size", NULL, accfg_wq_set_max_transfer_size, NULL, NULL }, { "threshold", accfg_wq_set_threshold, NULL, NULL, is_wq_threshold_writable }, - { "ats_disable", accfg_wq_set_ats_disable, NULL, NULL, NULL }, + { "ats_disable", accfg_wq_set_ats_disable, NULL, NULL, + is_wq_ats_disable_writable }, { "prs_disable", accfg_wq_set_prs_disable, NULL, NULL, is_wq_prs_disable_writable }, }; @@ -231,6 +233,17 @@ static bool is_wq_prs_disable_writable(struct accfg_wq *wq, int val) return true; } +static bool is_wq_ats_disable_writable(struct accfg_wq *wq, int val) +{ + if (val < 0 || val > 1) + return false; + + if (accfg_wq_get_ats_disable(wq) < 0) + return false; + + return true; +} + static int device_attribute_filter(char *key) { for (int i = 0; i < (int)ARRAY_SIZE(device_table); i++) { -- 2.31.1