From owner-svn-src-head@freebsd.org Fri Aug 21 15:22:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5466D9BF74F; Fri, 21 Aug 2015 15:22:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21615AA0; Fri, 21 Aug 2015 15:22:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iodt126 with SMTP id t126so85398750iod.2; Fri, 21 Aug 2015 08:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/HcHZ2ReXUgMkmksSzj3OqK29ahM6w3KwXI7XvYZFUI=; b=xqnXG7BIPReH8Gv9bgSRiY1SzI8BzFQJViVYWxY+RTC81HUZD5Z2wl3i1EzLO5Vm+S 9aVpcYqwTXaInGkCMbSEJOIZ+zgzMV2Qo7ZQJisTG1d+kQ1s7I010r7mKXJ8cu2CWfJM 7RinBUepIrvETD7U5kv6hsdNbS/v25ri9xdYCGjbvtmd3xfivRP8jkAmEZMVvvPacEw+ dTucdJ3URBQk4hKER1x8ovfRwgqIdtvw9FLzGbu7y/msG13PRKzDh7yYQUIB2fVcz0OE yM/yPdipBfU7DFRbhKuy1jU9jfJYToom+QpEPLhujWu1vANQ+uxu+oVxZ8khyxbSdJBx goOw== MIME-Version: 1.0 X-Received: by 10.107.131.196 with SMTP id n65mr7117580ioi.75.1440170571430; Fri, 21 Aug 2015 08:22:51 -0700 (PDT) Received: by 10.36.38.133 with HTTP; Fri, 21 Aug 2015 08:22:51 -0700 (PDT) In-Reply-To: <201508211513.t7LFDQri028106@repo.freebsd.org> References: <201508211513.t7LFDQri028106@repo.freebsd.org> Date: Fri, 21 Aug 2015 08:22:51 -0700 Message-ID: Subject: Re: svn commit: r286994 - head/sys/x86/acpica From: Adrian Chadd To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 15:22:52 -0000 Think we could do the same for the Asus zenbooks? -a On 21 August 2015 at 08:13, Konstantin Belousov wrote: > Author: kib > Date: Fri Aug 21 15:13:25 2015 > New Revision: 286994 > URL: https://svnweb.freebsd.org/changeset/base/286994 > > Log: > Automatically disable x2APIC mode on SandyBridge Lenovo machines. I > believe that the bug only affects mobile CPUs, at least I did not see > other reports, but it is impossible to detect it in madt_setup_local(). > > While there, reduce duplication in the information strings printed > when x2APIC is auto-disabled, and do not print the line when user > manually override the setting. > > Tested and reviewed by: royger (previous version) > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/x86/acpica/madt.c > > Modified: head/sys/x86/acpica/madt.c > ============================================================================== > --- head/sys/x86/acpica/madt.c Fri Aug 21 14:28:14 2015 (r286993) > +++ head/sys/x86/acpica/madt.c Fri Aug 21 15:13:25 2015 (r286994) > @@ -132,20 +132,27 @@ madt_setup_local(void) > { > ACPI_TABLE_DMAR *dmartbl; > vm_paddr_t dmartbl_physaddr; > + const char *reason; > + char *hw_vendor; > u_int p[4]; > > madt = pmap_mapbios(madt_physaddr, madt_length); > if ((cpu_feature2 & CPUID2_X2APIC) != 0) { > x2apic_mode = 1; > + reason = NULL; > + > + /* > + * Automatically detect several configurations where > + * x2APIC mode is known to cause troubles. User can > + * override the setting with hw.x2apic_enable tunable. > + */ > dmartbl_physaddr = acpi_find_table(ACPI_SIG_DMAR); > if (dmartbl_physaddr != 0) { > dmartbl = acpi_map_table(dmartbl_physaddr, > ACPI_SIG_DMAR); > if ((dmartbl->Flags & ACPI_DMAR_X2APIC_OPT_OUT) != 0) { > x2apic_mode = 0; > - if (bootverbose) > - printf( > - "x2APIC available but disabled by DMAR table\n"); > + reason = "by DMAR table"; > } > acpi_unmap_table(dmartbl); > } > @@ -154,14 +161,34 @@ madt_setup_local(void) > if ((p[0] & VMW_VCPUINFO_VCPU_RESERVED) != 0 || > (p[0] & VMW_VCPUINFO_LEGACY_X2APIC) == 0) { > x2apic_mode = 0; > - if (bootverbose) > - printf( > - "x2APIC available but disabled inside VMWare without intr redirection\n"); > + reason = "inside VMWare without intr redirection"; > } > } else if (vm_guest == VM_GUEST_XEN) { > x2apic_mode = 0; > + reason = "due to running under XEN"; > + } else if (vm_guest == VM_GUEST_NO) { > + hw_vendor = kern_getenv("smbios.planar.maker"); > + /* > + * It seems that some Lenovo SandyBridge-based > + * notebook BIOSes have a bug which prevents > + * booting AP in x2APIC mode. Since the only > + * way to detect mobile CPU is to check > + * northbridge pci id, which cannot be done > + * that early, disable x2APIC for all Lenovo > + * SandyBridge machines. > + */ > + if (hw_vendor != NULL && > + !strcmp(hw_vendor, "LENOVO") && > + CPUID_TO_FAMILY(cpu_id) == 0x6 && > + CPUID_TO_MODEL(cpu_id) == 0x2a) { > + x2apic_mode = 0; > + reason = "for a suspected Lenovo SandyBridge BIOS bug"; > + } > + freeenv(hw_vendor); > } > TUNABLE_INT_FETCH("hw.x2apic_enable", &x2apic_mode); > + if (!x2apic_mode && reason != NULL && bootverbose) > + printf("x2APIC available but disabled %s\n", reason); > } > > lapic_init(madt->Address); >