Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp373223lqt; Mon, 18 Mar 2024 10:09:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGTCDB70cbAkA7SqiCpU6KEm4g6qvTExzambg4zydmcKEAEoat2iMaD8b6AfnfjYdnXnL9zFUR6V243uUFJ8oPAiDSM0yw4sYdO14RDA== X-Google-Smtp-Source: AGHT+IE+Hf4nmbebnalhtPyU9+9+GgVmiu+KJOkaCUNm0PazdAFOonoZbxPksQG8CqaeRvZiF0ra X-Received: by 2002:a05:6214:c88:b0:696:14e6:9cd with SMTP id r8-20020a0562140c8800b0069614e609cdmr411756qvr.23.1710781748541; Mon, 18 Mar 2024 10:09:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710781748; cv=pass; d=google.com; s=arc-20160816; b=iXsSz7EV1X3WIny/pqWHkrKvS6KrZhnlv+/Up15lycjDEPwjI8uT6hZ3wCBBFd/y9W 1pP+6UUSbu5eBtUWe11TSt3Fdk/1/pguvpR/hkKqk3wC3BRehkFAC4anN6i+TZjNpX+t 4kVU6v3n7MaNGGqcm3VIx2uz8ZC6EcCmucqWPYAgwLRQfvdlH8DZUyO/Soms/1Nq740z RT6ZPKGs6LJtcNe9g07yz0kpjgD6u08Kavf+9q2XqL/ghEHLfZ31SmS9HmBH60Cps16c xUWUOKio2BTJHfJ82W9EJadeG6SGfuBeUVBo4KYvwJvGi7oGTUygSN5WIuGzs8cX+nUY PZHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=YglLOR/cTer1np5opoTbXvkOu4iZWe1OT9nKXpVRbSA=; fh=k7z6AmpGT0u+xUVPv2mqUuxjt55v/ji9mLLvYJDBiXk=; b=muEIxaBBtJqORKbBXX+QipIiigOBalKWyzrPdg7+n2FTk505gRXIBZHXzFP5sCtpvr y5cmrpNXpg4PRHLFj/dQKN3FqbBXa5BG4ctLDXr+B1+GQvOQyXJKJ1EvXSx0fhdol3Av OHRa4pDrzeXi1B0KnN4QPi8yrAcG2dsFHvkB88FHkts+5g5tfj0r1Nt772DRrb2XeFtj y2XlwRsEnGNuCgrqBLuvdvKl425EVbeHrmKWWI6u1qmJWfDiHH03OXW5uMWdd9bfd6So O1lJTj70aTeAzYSxN6lZoGuxY2PjVjbXqswyvS2ivyDNaSCHokZas8DQZaVpel2jifu4 2RsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RDpVQYHC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106422-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106422-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f7-20020a0562141d2700b0068f2b1d42d6si8932625qvd.92.2024.03.18.10.09.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 10:09:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106422-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RDpVQYHC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106422-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106422-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 E2EB71C20DFF for ; Mon, 18 Mar 2024 17:09:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C73CB55C01; Mon, 18 Mar 2024 17:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RDpVQYHC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EAAD254BE3; Mon, 18 Mar 2024 17:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710781726; cv=none; b=emnbO6d0ku7O8wBHPLXe6TvzvizhhHHbMLbWTqXGhSel6qJ1oGHKZ6SH0JS7c9n7aKWVRXIeAHXlk09zxitYe+SvVkY7LpxTvw+lef6hLoBO3cVtwemQ3aOUwbTDs5UU8wsJQch9tCW9Gt/K0NLsjEY5BwgXuXYuyMk4+LWHt0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710781726; c=relaxed/simple; bh=ZmPRdsYdvMk1O/gZ3oDc5Rz15l5IIb9Dtfx18VBfImc=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=rcFzkd9jb/bUIyrVUsEacQ7GOA00ArRcAGp1x+Q4uPmcx5UkdvpTLTYiN25skJrGRGW85g8tHR0GxGJd0PnKYAHQAtumLAs5KbjKyDCnz70fWsDYf5vsNDRsmhJS8Pzhn6yxMv7hTQt708NCSq1sZrccghM0FRhoqraIvVFmEig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RDpVQYHC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 285D8C433F1; Mon, 18 Mar 2024 17:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710781725; bh=ZmPRdsYdvMk1O/gZ3oDc5Rz15l5IIb9Dtfx18VBfImc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=RDpVQYHC6k54NrE+3ukgLb7d+rvBUnUc/YcBo9tqpDO6oqsqnA47xfxyXnrm4Ae8x h/10876VNVpxJoDlMS1S+MeTAZ8w4KIf77AYMjQc9LhV84rHk++ie2o3T8PQn5DQYL wcaBeSpX5VLLU2PBS9gns/IlRQT1W94MhxtEn0XSkMbs+zVRpz2LrgkRsH5xojJ1j2 vdH6oASz+BNvWuyI5Bz7L9rzuY7vgKc9vpegxxJYmC+fA7fCmzuMRyZka2S5V050Ak ZgZmNSn+LMOp3nMSjlqZE0iimYvBnN5V+khEEX+M7cauoSck4X1jr5xgWK8WXiesuL H/IzuwlkdSWIQ== Date: Mon, 18 Mar 2024 12:08:43 -0500 From: Bjorn Helgaas To: Manivannan Sadhasivam Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Kishon Vijay Abraham I , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: endpoint: Migrate to Genalloc framework for outbound window memory allocation Message-ID: <20240318170843.GA1187538@bhelgaas> 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-Disposition: inline In-Reply-To: <20240317-pci-ep-genalloc-v1-1-70fe52a3b9be@linaro.org> On Sun, Mar 17, 2024 at 11:39:17AM +0530, Manivannan Sadhasivam wrote: > As proposed during the last year 'PCI Endpoint Subsystem Open Items > Discussion' of Linux Plumbers conference [1], let's migrate to Genalloc > framework for managing the endpoint outbound window memory allocation. > > PCI Endpoint subsystem is using a custom memory allocator in pci-epc-mem > driver from the start for managing the memory required to map the host > address space (outbound) in endpoint. Even though it works well, it > completely defeats the purpose of the 'Genalloc framework', a general > purpose memory allocator framework created to avoid various custom memory > allocators in the kernel. Nice idea. I wonder if something like this could be done for PCI BAR assignment, i.e., the stuff in setup-bus.c. There are a lot of constraints there, so maybe it wouldn't be practical. > The migration to Genalloc framework is done is such a way that the existing > API semantics are preserved. So that the callers of the EPC mem APIs do not > need any modification (apart from the pcie-designware-epc driver that > queries page size). > > Internally, the EPC mem driver now uses Genalloc framework's > 'gen_pool_first_fit_order_align' algorithm that aligns the allocated memory > based on the requested size as like the previous allocator. And the > page size passed during pci_epc_mem_init() API is used as the minimum order > for the memory allocations. /as like the previous allocator/as the previous allocator did/ > During the migration, 'struct pci_epc_mem' is removed as it is seems > redundant and the existing 'struct pci_epc_mem_window' in 'struct pci_epc' > is now used to hold the address windows of the endpoint controller. s/as it is seems/as it seems/ If this is not a logically required part of the conversion, could the pci_epc_mem removal be a separate patch? The docs refer to it as "genalloc", i.e., not capitalized: https://docs.kernel.org/core-api/genalloc.html Thanks for working on this. Bjorn