From mboxrd@z Thu Jan 1 00:00:00 1970 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 C458B28F527; Tue, 22 Apr 2025 16:22:15 +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=1745338941; cv=none; b=C+tKkRfEMrnhcv+SSRsIETli8TvVYqNMegYeg1e5F4AWCBdwAP7o4wUygRqqe1CVGsqKFxq/HH+caUzXv8SDdhy1KH6aQJ0tRmthDyytQbyms8gE+SJ7uPFCQQrnX3s9Zc5DWVOp2Q3d3nJdUVoJx+vWavRsLlo0nreT2YhkU+c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745338941; c=relaxed/simple; bh=6sSFpjU1Fyw2Y31zbfsq+JMfKLoYSLZv/cDvBMBaAEU=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S2eEZ7KabilVZbFTPwBw1rCRNznsZVGZlK4jKv+6j6VWwwiDHnOCWe6YTzV98aNqsk7ASq4AE/wVOP/TOHtH4maBapY5GBYUgNpIUo0BjBpQw1ZoaOIQ069NMWyNZ1Hoooxk1UCKr3yM51YHqoOouPanyW+KlpX0FAuqIV0gHT4= 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.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4ZhnT14KHFz6K9X0; Wed, 23 Apr 2025 00:17:41 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 496321401F3; Wed, 23 Apr 2025 00:22:13 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 22 Apr 2025 18:22:12 +0200 Date: Tue, 22 Apr 2025 17:22:11 +0100 From: Jonathan Cameron To: CC: , , , , , , , , , Alejandro Lucero Subject: Re: [PATCH v14 11/22] cxl: define a driver interface for HPA free space enumeration Message-ID: <20250422172211.00004d10@huawei.com> In-Reply-To: <20250417212926.1343268-12-alejandro.lucero-palau@amd.com> References: <20250417212926.1343268-1-alejandro.lucero-palau@amd.com> <20250417212926.1343268-12-alejandro.lucero-palau@amd.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: netdev@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: lhrpeml500006.china.huawei.com (7.191.161.198) To frapeml500008.china.huawei.com (7.182.85.71) On Thu, 17 Apr 2025 22:29:14 +0100 wrote: > From: Alejandro Lucero > > CXL region creation involves allocating capacity from device DPA > (device-physical-address space) and assigning it to decode a given HPA > (host-physical-address space). Before determining how much DPA to > allocate the amount of available HPA must be determined. Also, not all > HPA is created equal, some specifically targets RAM, some target PMEM, > some is prepared for device-memory flows like HDM-D and HDM-DB, and some > is host-only (HDM-H). > > Wrap all of those concerns into an API that retrieves a root decoder > (platform CXL window) that fits the specified constraints and the > capacity available for a new region. > > Add a complementary function for releasing the reference to such root > decoder. > > Based on https://lore.kernel.org/linux-cxl/168592159290.1948938.13522227102445462976.stgit@dwillia2-xfh.jf.intel.com/ > > Signed-off-by: Alejandro Lucero > Reviewed-by: Jonathan Cameron > + /* > + * None flags are declared as bitmaps but for the sake of better code > + * used here as such, restricting the bitmap size to those bits used by > + * any Type2 device driver requester. I'd just drop the comment as it's more confusing than helpful. If you really want something then perhaps. * Flags are single unsigned longs. As CXL_DECODER_F_MAX is less than * 32 bits the bitmap functions may be used. > + */ > + if (!bitmap_subset(&ctx->flags, &cxld->flags, CXL_DECODER_F_MAX)) { > + dev_dbg(dev, "flags not matching: %08lx vs %08lx\n", > + cxld->flags, ctx->flags); > + return 0; > + }