Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp717551pxb; Tue, 2 Feb 2021 16:33:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGvsp1i48miZiSa2NH7yYGyGLht8Q0eH5JaPnRyzKVh5kKrQGzHosr9OrDOToJ/0hs0pmb X-Received: by 2002:a17:906:8684:: with SMTP id g4mr590219ejx.186.1612312403605; Tue, 02 Feb 2021 16:33:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312403; cv=none; d=google.com; s=arc-20160816; b=spDKqCAOphuE1F1qFpNqVunP2BhfVfUkCCHVZOz/YxwLMOxwmWtkkCgEp2KOCnmd56 G1An8oOXNgUEsU1CLUTEw4+y5MHaF1mEzaLMZBF9dWxmdKF+l9RgNtw4d5ojft9a8dbA bc9vL64yproOgVWoOpu8BFVD4wU5kRxtHsaRt0Su5/jUAxHrWVrRoH6CxM7GvnHKMfkX 4WblvsETypPT16isBqlvmD1vpJoiQwjLLdx7jp2pUq5cB8Cd2BiHTkKR3XndzcdtrkiC qT3laLbEZiiwhyAgXiu4M8RSVPEvhZG5/1aqPwioe9SrC7BauRwR2J8XpsyvKTyDGNOa fW4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=34JzfiaD98noVdYI8wGijdt5CbMl5vmcMb4nVnbQldQ=; b=TF9sCOlqpZaAoxczGxJ/bUg8WC+1TH7ql8aizE9OfGqwIO5iMLKlmwGahc3PsV+Qt9 2IjzwtPXEdzG43IiHGZbHt40EEESk86rhU40JNowKZLOh6XNhVjK5f2pysdQ0DR6cuoH I/arQ6VykxzVZvMLCX50NCs1YhN1akSGaCAwTA22Mn/+TWeqJoOePf3BuupekO7hT9+U 98gNBsUo2SWO75H/H33rEqPwuilidVV+NyyRVuOeauiuHKADIXd+7LctUDLKe39dL7Lv GpCgT6X4zoU22eeJGvjAni/cjzUow1YmABb4/Bje8L9YgNC1IvgLzg1WdaPR2z6yPAVy 5jXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vO5z5tvj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si249103edr.533.2021.02.02.16.32.59; Tue, 02 Feb 2021 16:33:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vO5z5tvj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238198AbhBBSD5 (ORCPT + 99 others); Tue, 2 Feb 2021 13:03:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237961AbhBBSBM (ORCPT ); Tue, 2 Feb 2021 13:01:12 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA07DC0613ED; Tue, 2 Feb 2021 10:00:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=34JzfiaD98noVdYI8wGijdt5CbMl5vmcMb4nVnbQldQ=; b=vO5z5tvjc31myEUZzGdE71R7Br Y/Nzfs8zJY3uV6y00Mu/zEVEuwDCnaWBP6eQDvXu9TgZYzNa27lpaKOBRtu9RgwBdeWVMcavrCjjV toAyiyWm0vxFwXBjDYsOgWNyGOG6Xbs5JEA6G7YGX6TCA2TWe1ShBYZVhTZYhKgV7rULNHXjAHAOd ki+AU+lsEHlKowzeBwXTkqImxPd90/51+ccfIDW0dVXiCeZmURqv5kO913twHNJCIT6QnmEhq8Ppo iWdmd1PWCPDoACyTXy2Hoz+wGH9jdKYph4lEObpw24XkEk+eQUJQYJBEr6SVxYnqmPZoh2a8zxgcF my47UCuQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l6zyW-00FYwW-Ne; Tue, 02 Feb 2021 18:00:28 +0000 Date: Tue, 2 Feb 2021 18:00:28 +0000 From: Christoph Hellwig To: Ben Widawsky Cc: linux-cxl@vger.kernel.org, Dan Williams , Jonathan Corbet , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Chris Browy , Christoph Hellwig , Ira Weiny , Jon Masters , Jonathan Cameron , Rafael Wysocki , Randy Dunlap , Vishal Verma , daniel.lll@alibaba-inc.com, "John Groves (jgroves)" , "Kelley, Sean V" Subject: Re: [PATCH 01/14] cxl/mem: Introduce a driver for CXL-2.0-Type-3 endpoints Message-ID: <20210202180028.GB3708021@infradead.org> References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-2-ben.widawsky@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210130002438.1872527-2-ben.widawsky@intel.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int cxl_mem_dvsec(struct pci_dev *pdev, int dvsec) > +{ > + int pos; > + > + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_DVSEC); > + if (!pos) > + return 0; > + > + while (pos) { > + u16 vendor, id; > + > + pci_read_config_word(pdev, pos + PCI_DVSEC_VENDOR_ID_OFFSET, > + &vendor); > + pci_read_config_word(pdev, pos + PCI_DVSEC_ID_OFFSET, &id); > + if (vendor == PCI_DVSEC_VENDOR_ID_CXL && dvsec == id) > + return pos; > + > + pos = pci_find_next_ext_capability(pdev, pos, > + PCI_EXT_CAP_ID_DVSEC); > + } > + > + return 0; > +} There should be a patch with a generic version of this find a vendor specific capability helper on linux-pci. > +#define PCI_CLASS_MEMORY_CXL 0x050210 I think this should go into linux/pci_ids.h.