Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2029626imm; Sat, 9 Jun 2018 06:33:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKusqD2PCcLncWafhcw1aeSIncb96vIFFVkj9HHaR0JO7mieFlMn/6XisIkvwRd3+MiA8Wc X-Received: by 2002:a65:51cb:: with SMTP id i11-v6mr8885500pgq.320.1528551214416; Sat, 09 Jun 2018 06:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528551214; cv=none; d=google.com; s=arc-20160816; b=PwIqelIhL9IUSiLQxH30lvpKhl2XHN6IMttVa/DKu23ZEj2kTRjNK2+b3xbyaIh0be Be0I8qLB2h+rNAnckjI+WFvxrJ945pjktl+KWg4ddPkpVqOjuPE5q9XdoPIPhxofj5cV StKFhP+vILPIGoRjoeZND805KGLY4DuziS/u90OSwBzCcDa+9VheIExVA4bK3auFFVMs lWXFDwtc1vUi9El/0XswTONmjDDrWy0SOjBnqQ+xdt0nfLEmiUdbIHF5g0OJpXmJW5Pw 6lAwwRFKno6pKl8jWHX56/W8BEeddVcqoxCyNh/h/EjpGF8d7KYUjcjV+t2wQFnIUp0d bw6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FB9marfoqw5QxLDXnAvwV2U3iEY581yi7C2lh/rRvhE=; b=TJ9/ShZ+3LHUOUQoy2HNI6zHZBO6bspA0NaYhf3LUThC8BOMHGjMhWEmh3QvyUPsiQ XiEjl9hVkvoUK06oFuE7BpAcOJgQ1/JkVnu+SPL9rzIpGp0o6MIi+DF0cMZ3w31yV6Nv ivXCG8g0Gnv7W9ItySfpTt/Nyni2PCMLR1QRLTHk3pvDEA50G9f+VBkXj0HrlHnmRj2I hM8y4iGFyE3WGaTVUOWGE2mx541hqpW+6NbCygKB0nOcd3yP6EXe5pst7J/TWmsbSl4w eAx97fIauEjRBkKe4uo+rqP2nC4xGBZqLKh15J54calqSTjv+dNv90KBY9T3fPsadWxE zC6Q== 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 s4-v6si32386623pgc.634.2018.06.09.06.33.20; Sat, 09 Jun 2018 06:33:34 -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 S1753389AbeFINa1 (ORCPT + 99 others); Sat, 9 Jun 2018 09:30:27 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:44129 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753232AbeFINaV (ORCPT ); Sat, 9 Jun 2018 09:30:21 -0400 Received: from pw-vbox.higon.com (unknown [182.150.46.145]) by APP-01 (Coremail) with SMTP id qwCowAB3fS3c1BtbE1BEBA--.1072S2; Sat, 09 Jun 2018 21:23:45 +0800 (CST) From: Pu Wen To: boris.ostrovsky@oracle.com, jgross@suse.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, zhangpanyong@hygon.cn Cc: thomas.lendacky@amd.com, peterz@infradead.org, tony.luck@intel.com, bp@alien8.de, pbonzini@redhat.com, rkrcmar@redhat.com, rjw@rjwysocki.net, lenb@kernel.org, viresh.kumar@linaro.org, mchehab@kernel.org, trenn@suse.com, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-x86_64@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-edac@vger.kernel.org, linux-pm@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Pu Wen Subject: [PATCH 07/11] x86/xen: Add support for Hygon's Dhyana Family 18h processor Date: Sat, 9 Jun 2018 21:23:37 +0800 Message-Id: <1528550617-28395-1-git-send-email-puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: qwCowAB3fS3c1BtbE1BEBA--.1072S2 X-Coremail-Antispam: 1UD129KBjvJXoW7tFyfXw45Zr47ury5Ar47Jwb_yoW8urWDpa y3AF48JrsYqan7X3s5Xrs7XrW8Zr1vqa1rKrZxJa4ftF4kZ3W3XrZFy3Wrtr4j9348CF40 qa18Jw4qga95ZFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUva14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1I6r4UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr 1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280aVAFwI0_Cr0_Gr1UMcvjeVCFs4IE7xkEbV WUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7Cj xVA2Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxV Aqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a 6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6x kF7I0E14v26r4UJVWxJr1lIxAIcVCF04k26cxKx2IYs7xG6r4j6FyUMIIF0xvEx4A2jsIE 14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyT uYvjfUFa0PUUUUU 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 This patch enables the Xen Hypervisor support to Hygon Family 18h CPU: - Add Hygon support in Xen PMU arch init codes. - Add Hygon support in PMU MSR read/write codes. - Add Hygon support in read PMC codes. Signed-off-by: Pu Wen --- arch/x86/xen/pmu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c index 7d00d4a..e2bee70 100644 --- a/arch/x86/xen/pmu.c +++ b/arch/x86/xen/pmu.c @@ -68,7 +68,8 @@ static __read_mostly int intel_num_arch_counters, intel_num_fixed_counters; static void xen_pmu_arch_init(void) { - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { switch (boot_cpu_data.x86) { case 0x15: @@ -285,7 +286,8 @@ static bool xen_amd_pmu_emulate(unsigned int msr, u64 *val, bool is_read) bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err) { - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { if (is_amd_pmu_msr(msr)) { if (!xen_amd_pmu_emulate(msr, val, 1)) *val = native_read_msr_safe(msr, err); @@ -308,7 +310,8 @@ bool pmu_msr_write(unsigned int msr, uint32_t low, uint32_t high, int *err) { uint64_t val = ((uint64_t)high << 32) | low; - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { if (is_amd_pmu_msr(msr)) { if (!xen_amd_pmu_emulate(msr, &val, 0)) *err = native_write_msr_safe(msr, low, high); @@ -379,7 +382,8 @@ static unsigned long long xen_intel_read_pmc(int counter) unsigned long long xen_read_pmc(int counter) { - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) return xen_amd_read_pmc(counter); else return xen_intel_read_pmc(counter); -- 2.7.4