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: <CAE9FiQVAqZRtMLKTtySaCiCbDicN0h=6dPXEGP1M2eAq9AiYXQ@mail.gmail.com>
Date:   Thu, 29 Jun 2017 16:26:44 -0700
From:   Yinghai Lu <yinghai@...nel.org>
To:     Stephane Eranian <eranian@...gle.com>,
        "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Borislav Petkov <bp@...en8.de>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Bjorn Helgaas <helgaas@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Matthew Wilcox <willy@...ux.intel.com>,
        Ivan Kokshaysky <ink@...assic.park.msu.ru>
Cc:     "linux-tip-commits@...r.kernel.org" 
        <linux-tip-commits@...r.kernel.org>
Subject: Re: [tip:x86/platform] x86/PCI/mmcfg: Switch to ECAM config mode if possible

On Wed, Jun 28, 2017 at 11:45 PM, tip-bot for Thomas Gleixner
<tipbot@...or.com> wrote:
> Commit-ID:  b5b0f00c760b6e9673ab79b88ede2f3c7a039f74
> Gitweb:     http://git.kernel.org/tip/b5b0f00c760b6e9673ab79b88ede2f3c7a039f74
> Author:     Thomas Gleixner <tglx@...utronix.de>
> AuthorDate: Thu, 16 Mar 2017 22:50:09 +0100
> Committer:  Thomas Gleixner <tglx@...utronix.de>
> CommitDate: Thu, 29 Jun 2017 08:41:54 +0200
>
> x86/PCI/mmcfg: Switch to ECAM config mode if possible
>
> To allow lockless access to the whole PCI configuration space the mmconfig
> based accessor functions need to be propagated to the pci_root_ops.
>
> Unfortunatly this cannot be done before the PCI subsystem initialization
> happens even if mmconfig access is already available. The reason is that
> some of the special platform PCI implementations must be able to overrule
> that setting before further accesses happen.
>
> The earliest possible point is after x86_init.pci.init() has been run. This
> is at a point in the boot process where nothing actually uses the PCI
> devices so the accessor function pointers can be updated lockless w/o risk.
>
> The switch to full ECAM mode depends on the availability of mmconfig and
> unchanged default accessors.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Acked-by: Bjorn Helgaas <helgaas@...nel.org>
> Cc: Andi Kleen <ak@...ux.intel.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Stephane Eranian <eranian@...gle.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: linux-pci@...r.kernel.org
> Link: http://lkml.kernel.org/r/20170316215057.452220163@linutronix.de
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
>  arch/x86/include/asm/pci_x86.h | 20 ++++++++++++--------
>  arch/x86/pci/common.c          | 16 ++++++++++++++++
>  arch/x86/pci/legacy.c          |  1 +
>  arch/x86/pci/mmconfig-shared.c | 30 ++++++++++++++++++++++++++++++
>  arch/x86/pci/mmconfig_32.c     |  8 ++++----
>  arch/x86/pci/mmconfig_64.c     |  8 ++++----
>  6 files changed, 67 insertions(+), 16 deletions(-)
>
>  /*
> + * Called after the last possible modification to raw_pci_[ext_]ops.
> + *
> + * Verify that root_pci_ops have not been overwritten by any implementation
> + * of x86_init.pci.arch_init() and x86_init.pci.init().
> + *
> + * If not, let the mmconfig code decide whether the ops can be switched
> + * over to the ECAM accessor functions.
> + */
> +void __init pcibios_select_ops(void)
> +{
> +       if (pci_root_ops.read != pci_read || pci_root_ops.write != pci_write)
> +               return;
> +       pci_mmcfg_select_ops();
> +}
> +
> +/*
>   *  Called after each bus is probed, but before its children
>   *  are examined.
>   */
> diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
> index 1cb01ab..80ea40e 100644
> --- a/arch/x86/pci/legacy.c
> +++ b/arch/x86/pci/legacy.c
> @@ -65,6 +65,7 @@ static int __init pci_subsys_init(void)
>                 }
>         }
>
> +       pcibios_select_ops();
>         pcibios_fixup_peer_bridges();
>         x86_init.pci.init_irq();
>         pcibios_init();
> diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
> index d1b47d5..6af6351 100644
> --- a/arch/x86/pci/mmconfig-shared.c
> +++ b/arch/x86/pci/mmconfig-shared.c
> @@ -816,3 +816,33 @@ int pci_mmconfig_delete(u16 seg, u8 start, u8 end)
>
>         return -ENOENT;
>  }
> +
> +static int pci_ecam_read(struct pci_bus *bus, unsigned int devfn, int reg,
> +                        int size, u32 *value)
> +{
> +       return pci_mmcfg_read(pci_domain_nr(bus), bus->number, devfn, reg,
> +                             size, value);
> +}
> +
> +static int pci_ecam_write(struct pci_bus *bus, unsigned int devfn, int reg,
> +                         int size, u32 value)
> +{
> +       return pci_mmcfg_write(pci_domain_nr(bus), bus->number, devfn, reg,
> +                              size, value);
> +}
> +
> +void __init pci_mmcfg_select_ops(void)
> +{
> +       if (raw_pci_ext_ops != &pci_mmcfg)
> +               return;
> +
> +       /*
> +        * The pointer to root_pci_ops has been handed in to ACPI already
> +        * and is already set in the busses.
> +        *
> +        * Switch the functions over to ECAM for all config space accesses.
> +        */
> +       pci_root_ops.read = pci_ecam_read;
> +       pci_root_ops.write = pci_ecam_write;
> +       pr_info("PCI: Switch to ECAM configuration mode\n");
> +}

Hi Thomas,

Would this patch actually void the commit:

commit a0ca9909609470ad779b9b9cc68ce96e975afff7
Author: Ivan Kokshaysky <ink@...assic.park.msu.ru>
Date:   Mon Jan 14 17:31:09 2008 -0500

    PCI x86: always use conf1 to access config space below 256 bytes

    Thanks to Loic Prylli <loic@...i.com>, who originally proposed
    this idea.

    Always using legacy configuration mechanism for the legacy config space
    and extended mechanism (mmconf) for the extended config space is
    a simple and very logical approach. It's supposed to resolve all
    known mmconf problems. It still allows per-device quirks (tweaking
    dev->cfg_size). It also allows to get rid of mmconf fallback code.

    Signed-off-by: Ivan Kokshaysky <ink@...assic.park.msu.ru>
    Signed-off-by: Matthew Wilcox <willy@...ux.intel.com>
    Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ