Received: by 2002:ab2:644:0:b0:1ec:cbc4:63fb with SMTP id 4csp1159081lqn; Mon, 26 Feb 2024 09:15:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXkQSMljXQRpSnWbpJZa0lkWXq0KLgawoONrQy3dA2QkblnPJa0t5J7OryXr8u3Pu3ssSQCQB5ZnkqfjViNWL0iJhyXA9971lvTz0vnCA== X-Google-Smtp-Source: AGHT+IFdJmSd/wmBHahrKVNbYv8uqDoeBV7Rycv8wa9RvJLHCyN/bGmtlFQpK+PGTuE0X8IEWFTR X-Received: by 2002:a17:90a:6c44:b0:29a:83da:efd1 with SMTP id x62-20020a17090a6c4400b0029a83daefd1mr4893331pjj.6.1708967723108; Mon, 26 Feb 2024 09:15:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708967723; cv=pass; d=google.com; s=arc-20160816; b=g6vDDvsEtqbiYOEjRpaLtNI1RCc6PH8/UA1W6Pgdluv/buJ98VWfFn50symqQcWWjY E31tDlaaBW9DLTYi6YO73WmBB0xViiyyGJMzNFW+53NX4oVnT97HKaNxyeUDwQRjdu9J AZRCoVme2C2K52ZRApaEHSWBcQ5lKqu+rIhW4ATsLZwCq6KILFu1NewouQe1fqSBextD 0YPI5Mmvnu3ixSBmN9yYgt5rU2uQcj7njKcxg83RLAR1SxC30UUgpEeRo0w0c6++juJo T/Y+qrJBZGL6C/1dBMhB0KsZ17CDN5Fw5iAq4EDbvjotqAbJ1Du3oyHYPexkFL4Xh2hG WNxA== 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=KAIIO7EKE3wy/0VUwvCO5uVZHh34aA/bLqoAKlXg4/Y=; fh=8Ab5tpfziye9snclotTlYLc5J1wxaUKOiwCNg8jZb/E=; b=L/yZQMD/esDzVBCxf+uQGAWjgl+DleqGjtv1M9UzbHO39hPnNwAu7ByDIln+r1mC/R 6Fj9/UG3/B6Op10LRZthMzlRV3CR7xi5vlq6dOr+IdSZECMRwKgSaQgSwNaXwWJBHE63 cYyBYHA8GqepP2KwlKWxQIX4RZ3ZG0sbnY7oH3GG10ALr9VxfDIjydOrmc3Zukpe7Nbp 7PHYnS0t4OvYO58BgQhaAy/Y0DB7fXR/uB5uy06m1EtvePgG1uCe89WgubC+wXl6rmMM 1ZohjBTFDAMeeBCa2n19tRIFXDlSQ3rexwHxU2cKMsA8OAMhYMtPJKzl4bQwFxWJf9Od go3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DyIxUsKG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-82012-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx6-20020a17090af48600b002993b6846d5si4083467pjb.85.2024.02.26.09.15.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:15:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82012-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DyIxUsKG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-82012-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82012-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D204D295483 for ; Mon, 26 Feb 2024 17:13:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BA6313399D; Mon, 26 Feb 2024 17:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DyIxUsKG" 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 BD6E612CD8E; Mon, 26 Feb 2024 17:00:34 +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=1708966834; cv=none; b=fwK/DLwab+p0vi2JMwpnY9wOomaRbmkRqlPt8+Nu7mSEW4MtVpAAmeVZnwFda56Wyragg8Nuf3KR6yssNac1v+AUMdqXJ4I6joJ3hcmr63zgo36k7BIH6ufz/qN1IY/5mTJ56rvYJk8E9Q43Qxj9RCYlShYFHcZFR62oQOaKgto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966834; c=relaxed/simple; bh=o7v0UCT9OJMGkA8U7iwQfdvtLg8GUAcNkvD+ZlnbU24=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=DeNNRBhSLVIRS4hJ7tlr2y4AfO4qGdsS9hHIMUmIEUmD0atQiYDQGk5bhCJzV7z+enxc4afYBeR1zQdOaEpsz171T8aKpXi9LxSjOlZxFgnRJa6FPUD4QZMED2tV6KS3r+b6Cka/QzInzOcxHeAWNsWF6aknjoTiWCA5eW329Sc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DyIxUsKG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4EADC433C7; Mon, 26 Feb 2024 17:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708966834; bh=o7v0UCT9OJMGkA8U7iwQfdvtLg8GUAcNkvD+ZlnbU24=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=DyIxUsKGGPDAmjVcDmEACK0+SYqCLsCEN5Pvrv/hVkCVhiqVmMWpjrDX5QNXfk9dw PlKm10ffgHy6JyuJpdZGm5o/ETxm+cQD+aMgYDXJMEQ4jE0IR+TwJATYJ82t1scM6b mfySgmNWSO1it0+Pf8NbovTGCnx3GWcah+jCTYA06f5hLjRcEgos20ExHSyMJEU9mf itmqNwDXg3F75jbwx9K3G24zgczNPR6H/JDKfXX4OSgNOTJ7gRNpqaffOrauaVFrsc SIjvJTC2qxrWOCA9swBjLmVWazr7fHuYWrI10K+c5aCNkoz5RxfWI/RUDb8NNkbj6Z agj0RVgmeUpiw== Date: Mon, 26 Feb 2024 11:00:32 -0600 From: Bjorn Helgaas To: Sai Krishna Gajula Cc: "bhelgaas@google.com" , "linux-pci@vger.kernel.org" , "richardcochran@gmail.com" , "horms@kernel.org" , "vinicius.gomes@intel.com" , "vadim.fedorenko@linux.dev" , "davem@davemloft.net" , "kuba@kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Sunil Kovvuri Goutham , Geethasowjanya Akula , Linu Cherian , Hariprasad Kelam , Subbaraya Sundeep Bhatta , Naveen Mamindlapalli Subject: Re: [net-next PATCH v2] octeontx2: Add PTP clock driver for Octeon PTM clock. Message-ID: <20240226170032.GA202638@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: On Mon, Feb 26, 2024 at 03:40:25PM +0000, Sai Krishna Gajula wrote: > > -----Original Message----- > > From: Bjorn Helgaas > > Sent: Wednesday, February 14, 2024 10:59 PM > > ... > > On Wed, Feb 14, 2024 at 06:38:53PM +0530, Sai Krishna wrote: > > > The PCIe PTM(Precision time measurement) protocol provides precise > > > coordination of events across multiple components like PCIe host > > > clock, PCIe EP PHC local clocks of PCIe devices. This patch adds > > > support for ptp clock based PTM clock. We can use this PTP device to > > > sync the PTM time with CLOCK_REALTIME or other PTP PHC devices using > > > phc2sys. > > > +#define PCI_VENDOR_ID_CAVIUM 0x177d Already defined in pci_ids.h. > > > +static int __init ptp_oct_ptm_init(void) { > > > + struct pci_dev *pdev = NULL; > > > + > > > + pdev = pci_get_device(PCI_VENDOR_ID_CAVIUM, > > > + PCI_DEVID_OCTEONTX2_PTP, pdev); > > > > pci_get_device() is a sub-optimal method for a driver to claim a device. > > pci_register_driver() is the preferred method. If you can't use that, a > > comment here explaining why not would be helpful. > > We just want to check the PTP device availability in the system as > one of the use case is to sync PTM time to PTP. This doesn't explain why you can't use pci_register_driver(). Can you clarify that? > > > + ptm_ctl_addr = ioremap(PEMX_PTM_CTL, 8); > > > > Hard-coded register addresses? That can't be right. Shouldn't > > this be discoverable either as a PCI BAR or via DT or similar > > firmware interface? > > Ack, will explore the DT implementation for register addresses > access and submit patch V3. Thanks for the review. I assume the PCI_DEVID_OCTEONTX2_PTP device is a PCIe Endpoint, and this driver runs on the host? I.e., this driver does not run as firmware on the Endpoint itself? So if you run lspci on the host, you would see this device as one of the PCI devices? If that's the case, a driver would normally operate the device via MMIO accesses to regions described by PCI BARs. "lspci -v" would show those addresses. Bjorn