linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: "Yan, Zheng" <zheng.z.yan@intel.com>
Cc: "Zhang, Rui" <rui.zhang@intel.com>,
	"Lu, Aaron" <aaron.lu@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Borislav Petkov <bp@alien8.de>,
	lkml <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Linux PCI <linux-pci@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: Info: mapping multiple BARs. Your kernel is fine.
Date: Thu, 20 Mar 2014 17:03:34 +0100	[thread overview]
Message-ID: <CABPqkBT4xmF-0Z_zk++KEtDzV7Z4zbisdG4uH7WKqw+kNF_nCA@mail.gmail.com> (raw)
In-Reply-To: <532AA3F6.9090402@intel.com>

On Thu, Mar 20, 2014 at 9:16 AM, Yan, Zheng <zheng.z.yan@intel.com> wrote:
> On 03/20/2014 03:53 PM, Zhang, Rui wrote:
>> The resource length is also hardcoded to 0x6000, right?
>> This is probably a problem, because
>> only if the resource length read from PCI config space is larger than 0x4000,
>> drivers/pnp/quirks.c will detect the conflict and disable the PNP0C02
>> resource 0xfed10000 - 0xfed13fff, and the PCI device can request this
>> resource successfully.
>> In order to check this, can you please attach the dmesg output after boot?
>
> maybe the issue can be fixed by below untested patch
>
> ---
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index fd5e883..2b3d834 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -1701,7 +1701,7 @@ static struct uncore_event_desc snb_uncore_imc_events[] = {
>  #define SNB_UNCORE_PCI_IMC_BAR_OFFSET          0x48
>
>  /* page size multiple covering all config regs */
> -#define SNB_UNCORE_PCI_IMC_MAP_SIZE            0x6000
> +#define SNB_UNCORE_PCI_IMC_MAP_SIZE            0x8
>
I assume ioremap() works on page boundaries.
Eventually want to expose the other counters too, not just read and
writes ( 8 bytes total).

The size of 0x6000 comes from the counter offsets: BAR + 0x5040 to BAR + 0x5054.
May be a better way of doing this would be to remap just the one page
holding them
instead of the 6 covering the entire BAR + counters. That would need
changes in the
read_counter() but that is okay.

So that would something along the line of:

    addr = (addr + 0x5040) & (PAGE_SIZE - 1);
    ioremap(addr, 0x1000);


>  #define SNB_UNCORE_PCI_IMC_DATA_READS          0x1
>  #define SNB_UNCORE_PCI_IMC_DATA_READS_BASE     0x5050
> @@ -1736,7 +1736,8 @@ static void snb_uncore_imc_init_box(struct intel_uncore_box *box)
>
>         addr &= ~(PAGE_SIZE - 1);
>
> -       box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE);
> +       box->io_addr = ioremap(addr + SNB_UNCORE_PCI_IMC_CTR_BASE,
> +                              SNB_UNCORE_PCI_IMC_MAP_SIZE);
>         box->hrtimer_duration = UNCORE_SNB_IMC_HRTIMER_INTERVAL;
>  }
>
> @@ -1832,7 +1833,7 @@ static int snb_uncore_imc_event_init(struct perf_event *event)
>         }
>
>         /* must be done before validate_group */
> -       event->hw.event_base = base;
> +       event->hw.event_base = base - SNB_UNCORE_PCI_IMC_CTR_BASE;
>         event->hw.config = cfg;
>         event->hw.idx = idx;
>

  parent reply	other threads:[~2014-03-20 16:03 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 16:24 Info: mapping multiple BARs. Your kernel is fine Borislav Petkov
2014-02-24 20:19 ` Borislav Petkov
2014-02-25 15:48   ` H. Peter Anvin
2014-02-25 16:14     ` Stephane Eranian
2014-02-25 16:30       ` Borislav Petkov
2014-02-25 16:33         ` Stephane Eranian
2014-02-25 17:39           ` Borislav Petkov
2014-02-25 18:54             ` Stephane Eranian
2014-02-25 22:10               ` Borislav Petkov
2014-02-26  6:56                 ` Stephane Eranian
2014-02-26  9:29                   ` Borislav Petkov
2014-02-26  9:47                     ` Stephane Eranian
2014-02-26  9:59                       ` Borislav Petkov
2014-02-27 10:12                         ` Stephane Eranian
2014-02-27 10:27                           ` Borislav Petkov
2014-02-27 22:12                             ` Rafael J. Wysocki
2014-02-27 22:21                               ` Borislav Petkov
2014-03-05 21:03                                 ` Stephane Eranian
2014-02-27 10:30                           ` Peter Zijlstra
2014-02-27 10:32                             ` Stephane Eranian
2014-02-27 11:08                               ` Peter Zijlstra
2014-02-27 12:20                                 ` Stephane Eranian
2014-02-26 13:57 ` Rafael J. Wysocki
2014-02-26 13:50   ` Peter Zijlstra
2014-02-26 13:52   ` Borislav Petkov
2014-03-15 14:15 ` Rafael J. Wysocki
2014-03-16 11:55   ` Borislav Petkov
2014-03-16 13:08     ` Stephane Eranian
2014-03-17  0:09       ` Rafael J. Wysocki
2014-03-17  0:23         ` Rafael J. Wysocki
2014-03-20  2:24   ` Aaron Lu
2014-03-20  2:29     ` Stephane Eranian
2014-03-20  3:03     ` Zhang, Rui
2014-03-20  3:34       ` Stephane Eranian
2014-03-20  7:53         ` Zhang, Rui
2014-03-20  8:16           ` Yan, Zheng
2014-03-20 13:43             ` Zhang Rui
2014-03-20 16:03             ` Stephane Eranian [this message]
2014-03-20 13:35           ` Zhang Rui
2014-03-20 12:29       ` Rafael J. Wysocki
2014-03-20 16:45       ` Bjorn Helgaas
2014-03-20 20:55         ` Rafael J. Wysocki
2014-03-20 20:48           ` Bjorn Helgaas
2014-04-16 19:04             ` Borislav Petkov
2014-04-16 20:24               ` Zhang, Rui
2014-04-16 20:31               ` Bjorn Helgaas
2014-04-16 22:31                 ` Dave Jones
2014-04-16 22:56                   ` Bjorn Helgaas
2014-04-17  0:18                     ` Dave Jones
2014-04-17 10:45                     ` Borislav Petkov
2014-04-17 18:26                       ` Bjorn Helgaas
2014-04-17 19:48                         ` Borislav Petkov
2014-04-17 20:10                           ` Bjorn Helgaas
2014-04-17 19:52                         ` Dave Jones
2014-04-17 20:01                           ` Borislav Petkov
2014-04-17 20:03                             ` Dave Jones
2014-04-17 20:53                               ` Dave Jones
2014-04-17 21:01                                 ` Borislav Petkov
     [not found]                                   ` <20140417213027.GA22412@redhat.com>
2014-04-18 10:38                                     ` Borislav Petkov
2014-04-16 23:08                 ` Stephane Eranian
2014-04-16 23:11                   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABPqkBT4xmF-0Z_zk++KEtDzV7Z4zbisdG4uH7WKqw+kNF_nCA@mail.gmail.com \
    --to=eranian@google.com \
    --cc=aaron.lu@intel.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    --cc=zheng.z.yan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).