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] [day] [month] [year] [list]
Date:	Fri, 7 Jan 2011 18:02:59 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Jan Beulich <JBeulich@...ell.com>
Cc:	tglx@...utronix.de, hpa@...or.com,
	Andreas Herrmann3 <Andreas.Herrmann3@....com>,
	Joerg Roedel <joerg.roedel@....com>,
	Robert Richter <robert.richter@....com>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH, tip] x86: use PCI method for enabling AMD extended
 config space before MSR method


* Jan Beulich <JBeulich@...ell.com> wrote:

> --- tip/arch/x86/pci/amd_bus.c
> +++ tip-x86-amd-ecs/arch/x86/pci/amd_bus.c
> @@ -4,6 +4,7 @@
>  #include <linux/cpu.h>
>  #include <linux/range.h>
>  
> +#include <asm/amd_nb.h>
>  #include <asm/pci_x86.h>
>  
>  #include <asm/pci-direct.h>
> @@ -386,6 +387,35 @@ static int __init pci_io_ecs_init(void)
>          if (boot_cpu_data.x86 < 0x10)
>  		return 0;
>  
> +#ifdef CONFIG_AMD_NB
> +	/* Try the PCI method first. */
> +	if (early_pci_allowed()) {
> +		unsigned int i, n;
> +
> +		for (n = i = 0; !n && amd_nb_bus_dev_ranges[i].dev_limit; ++i) {
> +			u8 bus = amd_nb_bus_dev_ranges[i].bus;
> +			u8 slot = amd_nb_bus_dev_ranges[i].dev_base;
> +			u8 limit = amd_nb_bus_dev_ranges[i].dev_limit;
> +
> +			for (; slot < limit; ++slot) {
> +				u32 val = read_pci_config(bus, slot, 3, 0);
> +
> +				if (!early_is_amd_nb(val))
> +					continue;
> +
> +				val = read_pci_config(bus, slot, 3, 0x8c);
> +				if (!(val & (ENABLE_CF8_EXT_CFG >> 32))) {
> +					val |= ENABLE_CF8_EXT_CFG >> 32;
> +					write_pci_config(bus, slot, 3, 0x8c,
> +							 val);
> +				}
> +				++n;
> +			}
> +		}
> +		pr_info("Extended Config Space enabled on %u nodes\n", n);
> +	}
> +#endif

Please, instead of plopping such a big #ifdef-ed block of code into an existing 
function create a new helper function instead. That will make it less ugly and more 
readable.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ