Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1475426img; Sat, 23 Mar 2019 04:01:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdnS3mZ7B/z3TR94pVLwEr2fTKjUU8LAIh+PjwuSLuHesEw556qnp+gCC5AM6996OGSD6S X-Received: by 2002:a63:1cd:: with SMTP id 196mr13555281pgb.58.1553338873188; Sat, 23 Mar 2019 04:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553338873; cv=none; d=google.com; s=arc-20160816; b=BZ4dVOQ1gnae6BUKKZ1NiFvfbo9Z8Q6prrCgTJ9BdtIxpTUseyBTN6ph/bQEga2Z1n Fcq1Z2Me/bCNJvWGKjRlNG/mslbaK/6/ZAmrHZi2UlAqtV3ne2/9Rk3guc8NDCMtd74l C/zvH1FOkw5c7J1dYdyg+uReLkMlpY4U9f+6NLa126Fgqr8MZPZfFkVbZo/NMgGj1h6a nvUSk5WMzJIrfu6b78D7ku3Psd948YMXnzCmevgvJ2k2Ovy97CbSMxLDd2EzFEaRDvii MynP9vq0iRNs9Sx7tJPS9RZW3IOUTu0RE7D4nad9Q1IW9BvT187uLIATX5mwokKcIzjZ hGIg== 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:from:references:cc:to:subject; bh=HSxooK6zR/qzcDVy6DhOGagiOMkuHsy2W6Qm5ivl3g0=; b=kuEZWGiUYKXeU0oxj7yj31Nef/qH5qo+Ckpjd03huD5E69el8kJGVItJlSK942V1Iw u74DA/7x2ikQwHQ8UGFEpwHjQXywKDZXPEbrc8+AobB8lyv8G0eashlQVwbj7lgwaW/O vdaur8zop0kYRctAt4KWhT2cHu1IB+ULxozATdqbB9tlFOS5XKHYRGhXyuR4P4zLEPzV qTOoR+1KJE5RktCNhkfRKwWhEY2fnEb9+bD2oscEy5nFeUtP+HfBUt1n2uP2EDG9Yap3 ct5GsLPp3ji3hpIlTAvhvN25WigPxy0M/t/xtl2IZngEfHA8R0DJgPzV+NE6vkNdsMPn ouMA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hygon.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s78si8806027pfa.161.2019.03.23.04.00.45; Sat, 23 Mar 2019 04:01:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hygon.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbfCWK7q (ORCPT + 99 others); Sat, 23 Mar 2019 06:59:46 -0400 Received: from [110.188.70.11] ([110.188.70.11]:38719 "EHLO spam2.hygon.cn" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726667AbfCWK7q (ORCPT ); Sat, 23 Mar 2019 06:59:46 -0400 Received: from MK-FE.hygon.cn ([172.23.18.61]) by spam2.hygon.cn with ESMTP id x2NAuq2x064531; Sat, 23 Mar 2019 18:56:52 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from cncheex01.Hygon.cn ([172.23.18.10]) by MK-FE.hygon.cn with ESMTP id x2NAumNl061105; Sat, 23 Mar 2019 18:56:48 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from [192.168.1.193] (172.23.18.44) by cncheex01.Hygon.cn (172.23.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Sat, 23 Mar 2019 18:56:49 +0800 Subject: Re: [RFC PATCH] x86/cpu/hygon: Fix phys_proc_id calculation logic for multi-die processor To: Borislav Petkov CC: "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" References: <1553251380-7015-1-git-send-email-puwen@hygon.cn> <20190322155449.GE12472@zn.tnic> <639a5bc6-f821-ee9d-1594-d02701321192@hygon.cn> <20190322171632.GI12472@zn.tnic> <18e15073-81c2-73a3-abf1-e785d6a5649b@hygon.cn> <20190323085934.GB23698@zn.tnic> From: Pu Wen Message-ID: Date: Sat, 23 Mar 2019 18:56:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <20190323085934.GB23698@zn.tnic> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.23.18.44] X-ClientProxiedBy: cncheex02.Hygon.cn (172.23.18.12) To cncheex01.Hygon.cn (172.23.18.10) X-MAIL: spam2.hygon.cn x2NAuq2x064531 X-DNSRBL: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/3/23 16:59, Borislav Petkov wrote: > On Sat, Mar 23, 2019 at 10:13:39AM +0800, Pu Wen wrote: >> Current physical id is computed via "phys_proc_id = initial_apicid >> >> bits". >> >> For 4-Die 2 socket system, the physical id of socket 2 is: >> initial_apicid >> bits = 0b1xxxxxx >> 6 = 1. >> The result is true. >> >> But for 2-Die 2 socket system, the physical id of socket 2 is: >> initial_apicid >> bits = 0b10xxxxx >> 5 = 2, >> and for 1-Die 2 socket system, the physical id of socket 2 is: >> initial_apicid >> bits = 0b100xxxx >> 4 = 4. >> The results are not correct any more. >> >> So the adjustment for the 1-Die/2-Die 2 socket system is needed. >> And just use ApicId[6], which already defined the right thing, as the >> socket ID. > > I understand all that. But let me repeat my question: > > So why do you need to do something different than what AMD does? > > You said you're programming the initial APIC ID the same as AMD. So why > doesn't this need to be changed in AMD code too but only for hygon? Because AMD doesn't have 2-Socket system with 1-Die/2-Die processors(see reference [2]). So it will return the right result when getting physical ID in AMD system. [2] https://www.amd.com/en/products/specifications/processors -- Regards, Pu Wen