Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp722462pxf; Thu, 1 Apr 2021 11:48:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAD4HMQp+CyYhpP19ehaYdrERocesIU8zFFVK6JA9iorLTwBUAuCKWJbySnjFUYXqROWYV X-Received: by 2002:a02:94a9:: with SMTP id x38mr9204197jah.50.1617302903790; Thu, 01 Apr 2021 11:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617302903; cv=none; d=google.com; s=arc-20160816; b=qOJlrOFq086bfFtFCPCBNHp4d1/o7za2WPoC1NacvadSqtzruBwMNiQZpqSWFaaVoJ gLsqKRQYodcB77c+Rp4gcYMGCdmKLYnVUEy19IxNJl33hh5xDE57/629AjdC9tz/cPZt t6K9rJylRx3lrTDOaOiuNPF6saAkUcHUavRe/gUe04XRmnYyRVCLGsZzck+EMR9uNJLC 5TWoEBNTLLe/ZpOfPMldvFPO49ZUYpVZ/DAbLVxT0v2dWe0wUpiswsbUy+gGX198IOU6 vw/OWXeVDqfExq71owT2J4r2CGfzP7NhwQfWuAKlcUaCVDiJ+eMJJ6t+VUIDFHXdoY2c lsdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=HDQSi4i9puKJIB9MwfUsatbffZoOScXlisAbK8Eh9dU=; b=A4uP3B52LMBYCbYgYvrrqiKBkZOfbZDYHdYtkRyIUbgkcPr8Yq1P7US6RbK+ibHWPP Ay0FMWWUq9S8tk9AFAuZ2An4MyFVbXUqJy4KnirhNIw8bqzTB21p86zR425l9228iMX3 5U9ONb2uBayeZqfmbE6ByVX27ccj3rt6139zmIa3K2Cn04GF92EaOzcMavye4FQqanOr k5P9bATL9fs06sKdsXO//rKdptf7dCqNzR/sfUPu9W6w0GZkTRXfnCTvv+fuwv8UQM6y JKvTG9tWoVnKY6NzsKGuUkx8x4gWgeadX5STND+D9y5zOy3Q5UMhZ9fD+jlDuVJF+4E1 g8Cw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 9si5673044ilx.110.2021.04.01.11.48.10; Thu, 01 Apr 2021 11:48:23 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237167AbhDASrv (ORCPT + 99 others); Thu, 1 Apr 2021 14:47:51 -0400 Received: from mga06.intel.com ([134.134.136.31]:62929 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240029AbhDAS04 (ORCPT ); Thu, 1 Apr 2021 14:26:56 -0400 IronPort-SDR: t1q/F+j3zutU6A7MxiVXsB58ObzyuL3tl5oYGhAfIxz9LsTywAos0AgtTYtUu+YinLV65Gc3Uh 9semmPeNQUrQ== X-IronPort-AV: E=McAfee;i="6000,8403,9941"; a="253643745" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="253643745" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 11:23:12 -0700 IronPort-SDR: BpQApRmhMC2VG0Roa0vW6dfKW9oSoqXCJXE4cVlaFcC63pvFcWaxK4Fo6kw27W/6Y0aDiHCzb1 P3yD5hmyveTA== X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="377802024" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 11:23:08 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lS1yC-000KGK-P8; Thu, 01 Apr 2021 21:23:04 +0300 Date: Thu, 1 Apr 2021 21:23:04 +0300 From: Andy Shevchenko To: Bjorn Helgaas Cc: Henning Schild , Wolfram Sang , Jean Delvare , Lee Jones , Tan Jui Nee , Jim Quinlan , Jonathan Yong , Bjorn Helgaas , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org, Jean Delvare , Peter Tyser , hdegoede@redhat.com Subject: Re: [PATCH v1 3/7] PCI: New Primary to Sideband (P2SB) bridge support library Message-ID: References: <20210401164256.GA1516177@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210401164256.GA1516177@bjorn-Precision-5520> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 01, 2021 at 11:42:56AM -0500, Bjorn Helgaas wrote: > On Thu, Apr 01, 2021 at 06:45:02PM +0300, Andy Shevchenko wrote: > > On Tue, Mar 09, 2021 at 09:42:52AM +0100, Henning Schild wrote: > > > Am Mon, 8 Mar 2021 19:42:21 -0600 > > > schrieb Bjorn Helgaas : > > > > On Mon, Mar 08, 2021 at 09:16:50PM +0200, Andy Shevchenko wrote: > > > > > On Mon, Mar 08, 2021 at 12:52:12PM -0600, Bjorn Helgaas wrote: > > > > > > On Mon, Mar 08, 2021 at 02:20:16PM +0200, Andy Shevchenko wrote: > > > > ... > > > > > > > > > + /* Read the first BAR of the device in question */ > > > > > > > + __pci_bus_read_base(bus, devfn, pci_bar_unknown, mem, > > > > > > > PCI_BASE_ADDRESS_0, true); > > > > > > > > > > > > I don't get this. Apparently this normally hidden device is > > > > > > consuming PCI address space. The PCI core needs to know > > > > > > about this. If it doesn't, the PCI core may assign this > > > > > > space to another device. > > > > > > > > > > Right, it returns all 1:s to any request so PCI core *thinks* > > > > > it's plugged off (like D3cold or so). > > > > > > > > I'm asking about the MMIO address space. The BAR is a register > > > > in config space. AFAICT, clearing P2SBC_HIDE_BYTE makes that > > > > BAR visible. The BAR describes a region of PCI address space. > > > > It looks like setting P2SBC_HIDE_BIT makes the BAR disappear > > > > from config space, but it sounds like the PCI address space > > > > *described* by the BAR is still claimed by the device. If the > > > > device didn't respond to that MMIO space, you would have no > > > > reason to read the BAR at all. > > > > > > > > So what keeps the PCI core from assigning that MMIO space to > > > > another device? > > > > > > The device will respond to MMIO while being hidden. I am afraid > > > nothing stops a collision, except for the assumption that the BIOS > > > is always right and PCI devices never get remapped. But just > > > guessing here. > > > > > > I have seen devices with coreboot having the P2SB visible, and > > > most likely relocatable. Making it visible in Linux and not hiding > > > it again might work, but probably only as long as Linux will not > > > relocate it. Which i am afraid might seriously upset the BIOS, > > > depending on what a device does with those GPIOs and which parts > > > are implemented in the BIOS. > > > > So the question is, do we have knobs in PCI core to mark device > > fixes in terms of BARs, no relocation must be applied, no other > > devices must have the region? > > I think the closest thing is the IORESOURCE_PCI_FIXED bit that we use > for things that must not be moved. Generally PCI resources are > associated with a pci_dev, and we set IORESOURCE_PCI_FIXED for BARs, > e.g., dev->resource[n]. We do that for IDE legacy regions (see > LEGACY_IO_RESOURCE), Langwell devices (pci_fixed_bar_fixup()), > "enhanced allocation" (pci_ea_flags()), and some quirks (quirk_io()). > > In your case, the device is hidden so it doesn't respond to config > accesses, so there is no pci_dev for it. Yes, and the idea is to unhide it on the early stage. Would it be possible to quirk it to fix the IO resources? > Maybe you could do some sort of quirk that allocates its own struct > resource, fills it in, sets IORESOURCE_PCI_FIXED, and does something > similar to pci_claim_resource()? -- With Best Regards, Andy Shevchenko