[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RESEND] intel/pinctrl: check capability offset is between MMIO region


  • To: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 25 Mar 2021 09:46:46 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1pH94whoYKNlTpf6SIE/WeL/oLwmFP7iUQ7oN3PBZKI=; b=SNIgD8WZdxzuP4v8DoNDSgIOat9T7gq64VfeBlauPjDbRm2d/TJYs3/pJ/kXiOXq4EsXSmfGmMomxsolNUkHX9bob0HHfGKxXRYjowYxGGoqOap4ImPNjCBi2PWDupuL5EAhgo2mYTtv9gmoDsI5ywUENQzwyyXwQULCU5V1XBkr8soCn+36AitesX13wBzvQqU8hDKgPNvRX7iWGvxOvPnbhPkKfT30ak5gY1mWobqiQDfl7GN5XOyGvnsWq4WRnPFBQmzIhFtCYaKJHlH5v7MKPeDNUuNCj4G2f00VtQr4rxmTLagDNv4QjJeoIT7T6lL81INk8gatzyWSLn2U7A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bca2mcanGMyjtolbW8lqvr8hpakZjxlfxJ2qmNrXruNEsXkI/n5suJ5RNVfKLxpah9ewiezl9pKn0wLTvZXse9nu4ucqUfAn5H1Ie9qh/vc3AwFWXAUuJg20g3lk6GGVUx4lzvm2gFp9G5CPYOWYER57FVu+cA5po/JBilVXDXgk/SHwgs5K26BdiZhssluV4Jr8NGHzZ3zOKREwHg/aout/ZIKP4pyH5b5JIKzMLN5qWHOQPChi1YIBYOCgCR350Tl3U/Bx/5gjL+CIjZRLo9qQ0NSTAPKmjLznHkOCjNVDPodCHliCbFloD7ieVqiJd5vsjc0A4A4e398PXhDXVw==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <linux-kernel@xxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Mika Westerberg" <mika.westerberg@xxxxxxxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, <linux-gpio@xxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 25 Mar 2021 08:47:01 +0000
  • Ironport-hdrordr: A9a23:nTa9GK87CfnSfeyz1Rhuk+FGcL1zdoIgy1knxilNYDRvWIixi9 2ukPMH1RX9lTYWXzUalcqdPbSbKEmzybdc2qNUGbu5RgHptC+TLI9k5Zb/2DGIIULD38Zn/+ Nbf6B6YeedMXFTkdv67A6kE9wp3dmA9+SSif3Dymp2JDsLV4hLxW5Ce2CmO2dxQxRLAod8OZ qH/8xcpyehf3N/VLXHOlAuWe/fq9rX0K/8aRkdCBI9rCWIhzWk6Ln1eiLoois2eTVJ3Lsk7C z5gxX0j5/Tyc2T5z398yvo75pQkMb80dcrPq2xo+UcNzmEsHfMWK1PQLuH1QpFxN2HyFFvq9 XUpgdlAsIb0QKvQkiQgT/Anzbtyywv7XiK8y7qvVLGrdbiTDw3T+pt7LgpCifx0EYrsNFi3K 8j5Qvw3PA7fHCw/lWJ2/HyWx5njUayq3Y5+NRj9EB3aocCdKRX6bUW4UI9KuZxIAvB9IslHO NyZfusncp+TFXyVQG/gkBfhPaoXng1Ay6cRFkDtsG/w1Ft7QFE5npd68oFknga8pUhD7FC+u TfK6xt0IpDV8kMcMtGdas8aPryLlaIbQPHMWqUL1iiPKYbO0jVo5qyxLku/umldLEB0ZNaou WPbHpo8UoJP27+A8yH25NGtjrXRn+mYDjrwsZCo7Bkp7zVXtPQQG2+YWFrt/Hlj+QUA8XdVf r2EolRGeX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TsdXJEKIkeHSpbgMUt3MKzJm6woRUlBIWD0e3fAvISXrl6 iO/XKgHYv5VcqB0zlB6gUeXu3NXwgT30cmXvVBdTTYk56P/uB/eLOMVKueo2elSrolg+esut26 kG+x6EkNoeI0/gm49hveJt3WBTpS3XRh4m9DpIJPe0FkUre5caaZpJd5oca0sLeLbWvRuQRC8h sCg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Mar 24, 2021 at 06:57:12PM +0200, Andy Shevchenko wrote:
> On Wed, Mar 24, 2021 at 04:13:59PM +0100, Roger Pau Monné wrote:
> > On Wed, Mar 24, 2021 at 04:22:44PM +0200, Andy Shevchenko wrote:
> > > On Wed, Mar 24, 2021 at 02:55:15PM +0100, Roger Pau Monné wrote:
> > > > On Wed, Mar 24, 2021 at 02:58:07PM +0200, Andy Shevchenko wrote:
> > > > > On Wed, Mar 24, 2021 at 01:31:18PM +0100, Roger Pau Monne wrote:
> > > > > Moreover, it seems you are bailing out and basically denying driver 
> > > > > to load.
> > > > > This does look that capability is simply the first register that 
> > > > > blows the setup.
> > > > > I think you have to fix something into Xen to avoid loading these 
> > > > > drivers or
> > > > > check with something like pci_device_is_present() approach.
> > > > 
> > > > Is there a backing PCI device BAR for those MMIO regions that the
> > > > pinctrl driver is trying to access? AFAICT those regions are only
> > > > reported in the ACPI DSDT table on the _CRS method of the object (at
> > > > least on my system).
> > > 
> > > Unfortunately it does not expose PCI configuration space.
> > 
> > Are those regions supposed to be marked as reserved in the memory map,
> > or that's left to the discretion of the hardware vendor?
> 
> I didn't get. The OS doesn't see them and an internal backbone simply drops 
> any
> IO access to that region.

I'm not sure I understand the above reply. My question was whether the
MMIO regions used by the pinctrl device (as fetched from the ACPI DSDT
table) are supposed belong to regions marked as RESERVED in the
firmware memory map (ie: either the e820 or the EFI one).

> > > > Doing something like pci_device_is_present would require a register
> > > > that we know will never return ~0 unless the device is not present. As
> > > > said above, maybe we could use REVID to that end?
> > > 
> > > Yes, that's good, see above.
> > > 
> > > WRT capabilities, if we crash we will see the report immediately on the
> > > hardware which has such an issue. (It's quite unlikely we will ever have 
> > > one,
> > > that's why I consider it's not critical)
> > 
> > I would rather prefer to not crash, because I think the kernel should
> > only resort to crashing when there's no alternative, and here it's
> > perfectly fine to just print an error message and don't load the
> > driver.
> 
> Are we speaking about real hardware that has an issue? I eagerly want to know
> what is that beast.

OK, I'm not going to resend this anymore. I'm happy with just getting
the first patch in.

I think you trust the hardware more that I would do, and I also think
the check added here is very minimal an unintrusive and serves as a
way to sanitize the data fetched from the hardware in order to prevent
a kernel page fault if such data turns out to be wrong.

Taking a reactive approach of requiring a broken piece of hardware to
exist in order to sanitize a fetched value seems too risky. I could
add a WARN_ON or similar if you want some kind of splat that's very
noticeable when this goes wrong but that doesn't end up in a fatal
kernel page fault.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.