From nobody Fri Apr 19 19:34:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=hygon.cn ARC-Seal: i=1; a=rsa-sha256; t=1560344187; cv=none; d=zoho.com; s=zohoarc; b=YL/NorckVWVf+Qu72VlsLdmUWGnz6cVrQHDvVGtNagHxHFMWpacJ6G6MsR9TF0NVxI0scHKfZfUJWE08R9uxTGRC0RDrVRilImPDihre7znUEsxnuS9dAAgps8I81+8B+PIqhBV70TVIN8+B2KZBJSwb/VdTxe63JCSEj10OWVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560344187; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=ZZw1SxBOZ9+jBYqdjy8kcT213nf+p8Q1Re+5PaIEebk=; b=bOCaKJwhppeHvtjFEFct1wHK8O3bJoLyxjB6m3GCyjWy7ze3sgrDCFV/63tIFklKSAgbaY9yHNujNUSgGGSjWXAO4bNTavO8fenb0rbD3Y4EXxldkjdUjzBmM71x2ybgWnRKIa8rKSYoxpKlPtp8RSs3WQrthTPxlfe1jph1uGc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1560344187245219.01425035344118; Wed, 12 Jun 2019 05:56:27 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hb2mf-0008K5-1T; Wed, 12 Jun 2019 12:55:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hb2md-0008Jo-FP for xen-devel@lists.xenproject.org; Wed, 12 Jun 2019 12:55:19 +0000 Received: from spam2.hygon.cn (unknown [110.188.70.11]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 51d77a8c-8d11-11e9-b073-37f1934053dc; Wed, 12 Jun 2019 12:55:16 +0000 (UTC) Received: from MK-DB.hygon.cn ([172.23.18.60]) by spam2.hygon.cn with ESMTP id x5CCshb6055005; Wed, 12 Jun 2019 20:54:43 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from cncheex01.Hygon.cn ([172.23.18.10]) by MK-DB.hygon.cn with ESMTP id x5CCsCUk066856; Wed, 12 Jun 2019 20:54:13 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from pw-vbox.hygon.cn (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; Wed, 12 Jun 2019 20:54:38 +0800 X-Inumbo-ID: 51d77a8c-8d11-11e9-b073-37f1934053dc From: Pu Wen To: Date: Wed, 12 Jun 2019 20:54:25 +0800 Message-ID: <86038466e1e7a77449230f97e19e9c3f436fd029.1560342915.git.puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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 x5CCshb6055005 X-DNSRBL: Subject: [Xen-devel] [PATCH v6] x86/pv: Add Hygon Dhyana support to emulate MSRs access X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Pu Wen , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The Hygon Dhyana CPU supports lots of MSRs(such as perf event select and counter MSRs, hardware configuration MSR, MMIO configuration base address MSR, MPERF/APERF MSRs) as AMD CPU does, so add Hygon Dhyana support to the PV emulation infrastructure by using the code path of AMD. [Rebase over 0cd07414 "x86/cpu: Renumber X86_VENDOR_* to form a bitmap"] Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/pv/emul-priv-op.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index b20d79c..2d5c82d 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -913,7 +913,8 @@ static int read_msr(unsigned int reg, uint64_t *val, /* fall through */ case MSR_AMD_FAM15H_EVNTSEL0 ... MSR_AMD_FAM15H_PERFCTR5: case MSR_K7_EVNTSEL0 ... MSR_K7_PERFCTR3: - if ( vpmu_msr || (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_A= MD) ) + if ( vpmu_msr || (boot_cpu_data.x86_vendor & + (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) { if ( vpmu_do_rdmsr(reg, val) ) break; @@ -995,7 +996,8 @@ static int write_msr(unsigned int reg, uint64_t val, case MSR_K8_PSTATE6: case MSR_K8_PSTATE7: case MSR_K8_HWCR: - if ( boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD ) + if ( !(boot_cpu_data.x86_vendor & + (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) break; if ( likely(!is_cpufreq_controller(currd)) || wrmsr_safe(reg, val) =3D=3D 0 ) @@ -1044,7 +1046,8 @@ static int write_msr(unsigned int reg, uint64_t val, =20 case MSR_IA32_MPERF: case MSR_IA32_APERF: - if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_A= MD)) ) + if ( !(boot_cpu_data.x86_vendor & + (X86_VENDOR_INTEL | X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) break; if ( likely(!is_cpufreq_controller(currd)) || wrmsr_safe(reg, val) =3D=3D 0 ) @@ -1076,7 +1079,8 @@ static int write_msr(unsigned int reg, uint64_t val, vpmu_msr =3D true; case MSR_AMD_FAM15H_EVNTSEL0 ... MSR_AMD_FAM15H_PERFCTR5: case MSR_K7_EVNTSEL0 ... MSR_K7_PERFCTR3: - if ( vpmu_msr || (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_A= MD) ) + if ( vpmu_msr || (boot_cpu_data.x86_vendor & + (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) { if ( (vpmu_mode & XENPMU_MODE_ALL) && !is_hardware_domain(currd) ) --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel