Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1702502rdb; Tue, 20 Feb 2024 04:43:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUIJRdYRqZB8wP+LGEFlaTHEkXCaat4btZSVstxo7A/pCP6zyCHF5/7DLEnnembOlXf583OH/8PkMwFXWtiLsaKhyJJgHBnICJXFfsB9g== X-Google-Smtp-Source: AGHT+IG1djSt2XQmUd+MCvbeQp21US8IAHS7lZhMYQrz6iWNy21TVHJ/+KaMYN3shJcuK4pnVp6s X-Received: by 2002:a05:6808:1a06:b0:3c1:5bfe:e096 with SMTP id bk6-20020a0568081a0600b003c15bfee096mr5692577oib.47.1708433014637; Tue, 20 Feb 2024 04:43:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708433014; cv=pass; d=google.com; s=arc-20160816; b=TZ6QlLHScCZE4hg3kgmnDW7pBUZ2xYCIsxC0b7Zq+pBMPRlfRzcTzahABZZQIPezkJ ZA/LtFvW7YaShtzVGb8cxn0ceNRGecnMAevujDHT6tWEJRjlDYfbcLkgsC3jVzLj+gaL u2ycgwF/IEkN6ZleTMXyWVIJ34WYegSx5xVutunifm1K8ymKV/gnbpHY5sK9EbpY4mGT MyMUcwVH/Q2YYxNiL7EnGuozOQwYrDqRybKUTSiQSn3cgz6GAbHE5Pv/K1c12qVb7on1 GLF5rPZdS8q6gubevBKGvQpHnkJhxD0nDnWBT3q/ciMHd9+Dfxs6ILD/4CWwdh5atqu7 duLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=A5Qg9AD9QaJGHrmowQ3/i732QXFnUk1aude2RyMjZIo=; fh=ehmdxMaNn1e64k03FAUDGH5ufF0BMazsqKtQWl0yC7M=; b=pDhgY9GmrWTOPd6BqrKLFKlvZPgKZXltLKlROeJSt8ZxgbykCdDlbN7AtRNH9fdttF B9qJYeGIbmbmQptElBQtY+j0Fo1HojYkfNnOVmzNtEdtlUoSQtcmqY0oNpYWO8Cihu4C apocbuUihIFTIRezNIPMoUY9PuLQPDqmv8Ae08xeMsVnUl8GOd1nUHKJmx+4lhcjq0vZ 3OtqPHprulSs+0qeuJYa7J0oBGN1QyQ8hbM87gIJARbGNPEtJ7XAd93l/ihKvIYmjCA/ dVz7uNlAav0LMzGSyHBd3k+wTJPvsmAkUwL13RfQB4TeJq1cvco7Yg676STs7mCXXq3v NFmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-73035-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73035-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jk10-20020ad45d4a000000b0068f3be89f52si8323323qvb.322.2024.02.20.04.43.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 04:43:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73035-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-73035-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73035-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 6307E1C221EE for ; Tue, 20 Feb 2024 12:43:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A661D69974; Tue, 20 Feb 2024 12:43:26 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 6BD6067E63; Tue, 20 Feb 2024 12:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708433006; cv=none; b=DYKoz/eP6W78VQJ8VpNOqnrCiFvsR3xaGgRjIdzRXe6y/ecR1mfJ5PWNnuEZfp5zY2GsXOOdJGxsuSU7eKOLhu6XV/VwuyPiPX6H7yVUstx0Hgh5yKI/qxtOHl027XRe0fp6k63WEIoKUZAHfNDaeonG8/ftMZNf/pkRLOBHj0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708433006; c=relaxed/simple; bh=2FEiZFwWmcbhWJlWx8Ag758ea764HjGaW8MolDwpGGU=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gSgJAJmqYQmlcJFwlaastr9u4WGrhTItIC33/RlsEalNlKqEnTILMKdmtsLoZuw7sMpACC5YkxqImEQgk04sgukXZ/ALYrM8fpMu/Su7TmcAH2Up9bnHsPYTdvIUAg7q0lBmJ6Q1qi16QIhxLRYeOaH9tk6j1SDKkpRUnRgKUYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4TfJqr1qWVz6D94n; Tue, 20 Feb 2024 20:39:04 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 26DA0140C98; Tue, 20 Feb 2024 20:43:21 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 12:43:20 +0000 Date: Tue, 20 Feb 2024 12:43:19 +0000 From: Jonathan Cameron To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH v6 07/12] cxl/memscrub: Register CXL device patrol scrub with scrub configure driver Message-ID: <20240220124319.00005be0@Huawei.com> In-Reply-To: <20240215111455.1462-8-shiju.jose@huawei.com> References: <20240215111455.1462-1-shiju.jose@huawei.com> <20240215111455.1462-8-shiju.jose@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) On Thu, 15 Feb 2024 19:14:49 +0800 wrote: > From: Shiju Jose > > Register with the scrub configure driver to expose the sysfs attributes > to the user for configuring the CXL device memory patrol scrub. Add the > callback functions to support configuring the CXL memory device patrol > scrub. > > Signed-off-by: Shiju Jose Trivial comment inline. > diff --git a/drivers/cxl/core/memscrub.c b/drivers/cxl/core/memscrub.c > index a3a371c5aa7b..a1fb40f8307f 100644 > --- a/drivers/cxl/core/memscrub.c > +++ b/drivers/cxl/core/memscrub.c > @@ -6,14 +6,19 @@ > + > +/** > + * cxl_mem_patrol_scrub_is_visible() - Callback to return attribute visibility > + * @dev: Pointer to scrub device > + * @attr: Scrub attribute > + * @region_id: ID of the memory region > + * > + * Returns: 0 on success, an error otherwise > + */ > +static umode_t cxl_mem_patrol_scrub_is_visible(struct device *dev, > + u32 attr_id, int region_id) > +{ > + const struct cxl_patrol_scrub_context *cxl_ps_ctx = dev_get_drvdata(dev); > + > + if (attr_id == scrub_rate_available || > + attr_id == scrub_rate) { > + if (!cxl_ps_ctx->scrub_cycle_changeable) > + return 0; > + } > + > + switch (attr_id) { > + case scrub_rate_available: > + return 0444; Usual trick on these is to write back their default values if we support them. If we can make this function take that as well then this bcomes return mode; for all those supported. > + case scrub_enable: > + case scrub_rate: > + return 0644; > + default: > + return 0; > + } > +} > +