lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRnDQdKN8bfHdwMS@sunset>
Date:   Sun, 15 Aug 2021 21:45:37 -0400
From:   Alyssa Rosenzweig <alyssa@...enzweig.io>
To:     Marc Zyngier <maz@...nel.org>
Cc:     linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
        Rob Herring <robh+dt@...nel.org>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Krzysztof WilczyƄski <kw@...ux.com>,
        Stan Skowronek <stan@...ellium.com>,
        Mark Kettenis <kettenis@...nbsd.org>,
        Sven Peter <sven@...npeter.dev>,
        Hector Martin <marcan@...can.st>, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 2/2] PCI: apple: Add driver for the Apple M1

> > > +static int apple_pcie_setup_refclk(void __iomem *rc,
> > > +				   void __iomem *port,
> > > +				   unsigned int idx)
> > > +{
> > > +	u32 stat;
> > > +	int res;
> > > +
> > > +	res = readl_poll_timeout(rc + CORE_RC_PHYIF_STAT, stat,
> > > +				 stat & CORE_RC_PHYIF_STAT_REFCLK, 100, 50000);
> > > +	if (res < 0)
> > > +		return res;
> > > +
> > > +	rmwl(0, CORE_LANE_CTL_CFGACC, rc + CORE_LANE_CTL(idx));
> > > +	rmwl(0, CORE_LANE_CFG_REFCLK0REQ, rc + CORE_LANE_CFG(idx));
> > > +
> > > +	res = readl_poll_timeout(rc + CORE_LANE_CFG(idx), stat,
> > > +				 stat & CORE_LANE_CFG_REFCLK0ACK, 100, 50000);
> > > +	if (res < 0)
> > > +		return res;
> > > +
> > > +	rmwl(0, CORE_LANE_CFG_REFCLK1, rc + CORE_LANE_CFG(idx));
> > > +	res = readl_poll_timeout(rc + CORE_LANE_CFG(idx), stat,
> > > +				 stat & CORE_LANE_CFG_REFCLK1, 100, 50000);
> > > +
> > > +	if (res < 0)
> > > +		return res;
> > > +
> > > +	rmwl(CORE_LANE_CTL_CFGACC, 0, rc + CORE_LANE_CTL(idx));
> > > +	udelay(1);
> > > +	rmwl(0, CORE_LANE_CFG_REFCLKEN, rc + CORE_LANE_CFG(idx));
> > > +
> > > +	rmwl(0, PORT_REFCLK_EN, port + PORT_REFCLK);
> > > +
> > > +	return 0;
> > > +}
> 
> This really wants to be moved to its own clock driver, unless there is
> a strong guarantee that the clock tree isn't shared with anything
> else. I expect that parts of that clock tree will need to be
> refcounted, and that's where having a real clock driver will help.
> 
> I also have the strong feeling that the clock hierarchy will need to
> be described in DT one way or another, if only to be able to cope with
> future revisions of this block.

Could be, but this is the most magical part of the driver (no docs...)
and that means it's prohibitively difficult to design useful DT
bindings...

For whatever it's worth the Corellium code doesn't expose any DT
bindings here, so maybe this hasn't changed since older Apple SoCs.

Orthogonal to this magic code, we /do/ need DT bindings for the
clock/power gates. At the moment, m1n1 enables the PCIe clock and leaves
it on, so it's not urgent for this series. But in the future when we
want fine grained power management, we'll need it modeled. Sven has a
WIP clock gate driver and proposed bindings, which can be added to the
PCIe DT later nonintrusively. That shouldn't block this series, however.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ