Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1695131imm; Thu, 20 Sep 2018 01:06:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZK9sH0VCelpatbz8lVc+XD4ANy85yC7jiLrp5wXMGcxIlIMtON0ERB+Ejud6bMJYd5cEOn X-Received: by 2002:a62:b604:: with SMTP id j4-v6mr39867218pff.199.1537430776763; Thu, 20 Sep 2018 01:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537430776; cv=none; d=google.com; s=arc-20160816; b=o6vDKmviKyeFowXses/Mblx0QgRXG7Q2vxQc3xrUnOVYKmiKxI4f51CZfMAbH8lZ6y 3A/50d0k2m5gDZ1rcKFFFjDRqN/SmswcT7QlJNlTiKWn8wAWFbUHx25CHJb5Gtk69AC0 9t488p+e/1ts0DGfgypbdurtVVxzDbcpVBQpecfsBkdtDswtdwZveUZqLjatSXR7uC/P 3/Zwa8D566olaIqSW2dMkaGFrHTUm9tpKX55uB7gvkCtUZR6LDyZnH5+d7/0cj/2ULqp IgvLSdhRREqSLZW2rlhQlnid+rUqz+deAdqfySxyuYlj++PZZCrU+RyLw5qnz/9+CBN4 mpBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=mvag+PF2nFhNFjexs66sUFu130yH3y6xl33KygKpTQo=; b=T7J3r2XogtPk9th7aT5kcZ27lWSVGPyzlCuAjNrSLvY/BBjW39CYrm+7unhGx8Nj1T K2uvZ4UApZiSNomiEM+lpC+d+gkf1N8XQFqBAkzD0u6xuACBtfQyfRGSlM/tfJt8WVBI 95ZHDYvRxu7WY6EdyiX8EpFQ4EfbQgIXWxx7GEXEqmo89kq53GHaL+UFshuAiLYBQ42r 1R2RrWxiTbpxV0yem5FhzYSBpAoMKrPtXud6uuyGQxomXG6V72P0ed7mIUlXSPUvKe/s tD6ulWT42avyJf07/MVa8pIVjQWZvSMWkJDr0xYmWRZKcOCxoAGQdtfvUHxB2hHg8dzo 2Lyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si25155402pln.5.2018.09.20.01.06.01; Thu, 20 Sep 2018 01:06:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731526AbeITNrs (ORCPT + 99 others); Thu, 20 Sep 2018 09:47:48 -0400 Received: from smtp17.cstnet.cn ([159.226.251.17]:37088 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726177AbeITNrs (ORCPT ); Thu, 20 Sep 2018 09:47:48 -0400 Received: from [172.20.20.131] (unknown [182.150.46.145]) by APP-09 (Coremail) with SMTP id swCowAB3XR23VKNb2wB3Cw--.29767S2; Thu, 20 Sep 2018 16:05:12 +0800 (CST) From: Pu Wen Subject: Re: [PATCH v6 07/16] x86/pci: Add Hygon Dhyana support to PCI and north bridge To: "Lendacky, Thomas" , "tglx@linutronix.de" Cc: "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "bp@alien8.de" , "pbonzini@redhat.com" , "helgaas@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-pci@vger.kernel.org" References: <035e5d0a4f2a0edf68ca0f1019e47b878eaa5da6.1536550550.git.puwen@hygon.cn> Message-ID: Date: Thu, 20 Sep 2018 16:05:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID: swCowAB3XR23VKNb2wB3Cw--.29767S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Ar1xGF15GrWfAFW8tF13Arb_yoW8uF1Upr W5Xws5urn5Wr1Yqayjqr4UXr40vrWDWay7WrW3Gwn5GF1Duw18Zr429w1Sy3ZxJr4kua17 J3WkXF15Ar4ktFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvKb7Iv0xC_tr1lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWUJVW8JwA2z4x0Y4vEx4 A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AKxVWxJVW8Jr 1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7 Mxk0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr 0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY 17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcV C0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF 0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxh VjvjDU0xZFpf9x07UE-erUUUUU= X-Originating-IP: [182.150.46.145] X-CM-SenderInfo: psxzv046klw03qof0z/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/20 1:20, Lendacky, Thomas wrote: >> @@ -197,12 +212,25 @@ int amd_cache_northbridges(void) >> u16 i = 0; >> struct amd_northbridge *nb; >> struct pci_dev *root, *misc, *link; >> + const struct pci_device_id *root_ids = NULL; >> + const struct pci_device_id *misc_ids = NULL; >> + const struct pci_device_id *link_ids = NULL; >> + >> + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { >> + root_ids = amd_root_ids; >> + misc_ids = amd_nb_misc_ids; >> + link_ids = amd_nb_link_ids; >> + } else if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { >> + root_ids = hygon_root_ids; >> + misc_ids = hygon_nb_misc_ids; >> + link_ids = hygon_nb_link_ids; >> + } > > To be compatible with "before this patch" you should probably do: > > if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { > root_ids = hygon_root_ids; > misc_ids = hygon_nb_misc_ids; > link_ids = hygon_nb_link_ids; > } else { > root_ids = amd_root_ids; > misc_ids = amd_nb_misc_ids; > link_ids = amd_nb_link_ids; > } > > That way they are always the AMD values if not your chip. > ... >> @@ -263,9 +291,15 @@ bool __init early_is_amd_nb(u32 device) >> { >> const struct pci_device_id *id; >> u32 vendor = device & 0xffff; >> + const struct pci_device_id *misc_ids = NULL; >> + >> + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) >> + misc_ids = amd_nb_misc_ids; >> + else if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) >> + misc_ids = hygon_nb_misc_ids; > > Same comment as above. This will probably eliminate the PANIC that > that was reported by LKP. Yes, it's this modification that caused the PANIC reported by LKP. Because the misc_ids will be NULL if running on Intel chip. If change the vendor checking like this: + if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) + misc_ids = hygon_nb_misc_ids; + else + misc_ids = amd_nb_misc_ids; The PANIC will be eliminated. The PANIC will also be eliminated by adding AMD vendor checking in amd_gart_present: + if(boot_cpu_data.x86_vendor != X86_VENDOR_AMD) + return false; To prevent the function return true on non AMD platform. Thanks, Pu Wen