From patchwork Fri Dec 20 14:30:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Murray X-Patchwork-Id: 182284 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp608888ilf; Fri, 20 Dec 2019 06:33:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyZcSf92Eznu5cW7Tiq88c0PL1xtsXwDivIxYq5/GEOaWNJ91ZST58g0H/BpKXIaqYToorY X-Received: by 2002:aca:f484:: with SMTP id s126mr3676618oih.48.1576852388663; Fri, 20 Dec 2019 06:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576852388; cv=none; d=google.com; s=arc-20160816; b=jm0TK5glOgfBxwr/TX//nUrymhD5GAr1sTMU6FZplVjAn5UdIzXlBMfVZ1oDyGpInV Ie+DyRggG3SKf2HhqAiHo87zAHrJDr+Ahp/1iE7p+mI5aE2Y+Nan8AwXGwJbF6RwLPOH t9vYIvAFsJA7r2EuqIwO0ONJHKP3fdwLltqDbRtNlEqwhg/HvTS9FPku2dGFbabeph2N ScCNdZ9YYLqIOoCLRUpEzdpTQ6xugbarooqEAH/psmBGVSh6A1nANathGfrfuOdoUEdT PXZHstRrRHaTZ8cA1o9h3nPNyepFQqpe/mfG8D4qohVNqsYt2rKZxVmUOhBvvRFbQs7l 4GOg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ioeCicH+JZf02sBp5Wz7enjBNxJXm9k1A+Cvi42eW9E=; b=eqW5Kglt9B7h5r9XreMWXYCivF6DXRTdr1g5jAHZdvzRowusAjTa/exYL8g7AQPsFl StRiDI5idczfWXrEuCu2yzhEVbItp1RDR/Wlm13Geuw3ElIKLIEQFVnMD8+XaoBYZTJq DVwSknd1dwMQn2KTZmjplEHR4MOQNahpsrA0B77Kp4+ayfwLkHswwj/5CUBcRiMAUYUL 1j0etxi/oIteXR9eTd1DkM+DqE3sNbvgJ3OZMDTnV/Y5lPpvtaF8XrvPC5Xyc8jI83eK d8WgS4ByxsIETl4vS5LdAlwGobIWtO/fR4ElJ4ChI7evVHHcfh7cjcw6py55jWrVGz+v 1keQ== 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 w64si4972237oib.185.2019.12.20.06.33.02; Fri, 20 Dec 2019 06:33:08 -0800 (PST) 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 S1727953AbfLTOaz (ORCPT + 27 others); Fri, 20 Dec 2019 09:30:55 -0500 Received: from foss.arm.com ([217.140.110.172]:51218 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727790AbfLTOan (ORCPT ); Fri, 20 Dec 2019 09:30:43 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C03411B3; Fri, 20 Dec 2019 06:30:43 -0800 (PST) Received: from e119886-lin.cambridge.arm.com (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6302E3F718; Fri, 20 Dec 2019 06:30:41 -0800 (PST) From: Andrew Murray To: Marc Zyngier , Catalin Marinas , Will Deacon Cc: Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland Subject: [PATCH v2 05/18] arm64: KVM/VHE: enable the use PMSCR_EL12 on VHE systems Date: Fri, 20 Dec 2019 14:30:12 +0000 Message-Id: <20191220143025.33853-6-andrew.murray@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191220143025.33853-1-andrew.murray@arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla Currently, we are just using PMSCR_EL1 in the host for non VHE systems. We already have the {read,write}_sysreg_el*() accessors for accessing particular ELs' sysregs in the presence of VHE. Lets just define PMSCR_EL12 and start making use of it here which will access the right register on both VHE and non VHE systems. This change is required to add SPE guest support on VHE systems. Signed-off-by: Sudeep Holla Signed-off-by: Andrew Murray --- arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/kvm/hyp/debug-sr.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 6e919fafb43d..6c0b0ad97688 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -468,6 +468,7 @@ #define SYS_AFSR1_EL12 sys_reg(3, 5, 5, 1, 1) #define SYS_ESR_EL12 sys_reg(3, 5, 5, 2, 0) #define SYS_FAR_EL12 sys_reg(3, 5, 6, 0, 0) +#define SYS_PMSCR_EL12 sys_reg(3, 5, 9, 9, 0) #define SYS_MAIR_EL12 sys_reg(3, 5, 10, 2, 0) #define SYS_AMAIR_EL12 sys_reg(3, 5, 10, 3, 0) #define SYS_VBAR_EL12 sys_reg(3, 5, 12, 0, 0) diff --git a/arch/arm64/kvm/hyp/debug-sr.c b/arch/arm64/kvm/hyp/debug-sr.c index 0fc9872a1467..98be2f11c16c 100644 --- a/arch/arm64/kvm/hyp/debug-sr.c +++ b/arch/arm64/kvm/hyp/debug-sr.c @@ -108,8 +108,8 @@ static void __hyp_text __debug_save_spe_nvhe(u64 *pmscr_el1) return; /* Yes; save the control register and disable data generation */ - *pmscr_el1 = read_sysreg_s(SYS_PMSCR_EL1); - write_sysreg_s(0, SYS_PMSCR_EL1); + *pmscr_el1 = read_sysreg_el1(SYS_PMSCR); + write_sysreg_el1(0, SYS_PMSCR); isb(); /* Now drain all buffered data to memory */ @@ -126,7 +126,7 @@ static void __hyp_text __debug_restore_spe_nvhe(u64 pmscr_el1) isb(); /* Re-enable data generation */ - write_sysreg_s(pmscr_el1, SYS_PMSCR_EL1); + write_sysreg_el1(pmscr_el1, SYS_PMSCR); } static void __hyp_text __debug_save_state(struct kvm_vcpu *vcpu,