From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB4D21429A for ; Wed, 7 Feb 2024 10:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707302415; cv=none; b=TbOwYjYPvI3FrNn7OaQpZ5eKPgFHWXI97SlRbuYpGze7eP/AiatjQUWrcerthVAyweqQPg4B1pWtw7sqWeDnq0wEMqZ4VxFsdFQZInT1PAb3kRP8BLtG1C7LMpH6LxR6H01CrdcCpXltDqofsLfzExghD5RhSHKHeYokdbiOGYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707302415; c=relaxed/simple; bh=cAxhH+SONjD42Gw3gF+CFGXzaUkX8lnopUdQqjcQd0I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g27fCgLzXu7BNM1e0McG4IQlvMQ4MQWvU56fOAEPWoDyxVtcTtgzQQQNVBW/qDUswQw4Pt4dtk98xMKeABwyA5GezEytMv7ilJEbK7NtqV+pZWg5lMGiMLqNCMhSJdcBeGiUjRektLkIvOjKBiV7FP/Nu2eLryiVd15aEgC2hWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=OVnT1IBv; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="OVnT1IBv" Date: Wed, 7 Feb 2024 10:40:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707302410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EOXmtPnFnBC290lPG3I2msiOcq62QDPQe0I4UIkLUi4=; b=OVnT1IBvZqREiqu4C7ANpqTXrYLU+JqRJoIk2KmilaUJC+391mgYdDXoi02OI/bkY+iCAR c2TPlSjx32vCnNkp1rkIcZ9MqSW4B9q6cCY5+8+0I7ug9cJ85RSbDJd75GiQdm8Kqo0Ru4 eQhqdIsHYP/Vr7j6Ut6UntGp4/QGcjw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Joey Gouly , Mark Brown Subject: Re: [PATCH v3 04/26] KVM: arm64: nv: Add sanitising to EL2 configuration registers Message-ID: References: <20240205103431.1104133-1-maz@kernel.org> <20240205103431.1104133-5-maz@kernel.org> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240205103431.1104133-5-maz@kernel.org> X-Migadu-Flow: FLOW_OUT On Mon, Feb 05, 2024 at 10:34:09AM +0000, Marc Zyngier wrote: > + if (!(__vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS) && > + __vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS))) > + res0 |= (HCR_API | HCR_APK); I think what you probably meant here is _ADDRESS and _GENERIC, right? Of course, this has no actual effect on the code, since we don't allow one without the other. Maybe we can just change KVM's representation to a single flag to avoid this pointless exercise. > + if (!kvm_has_feat(kvm, ID_AA64ISAR0_EL1, TME, IMP)) > + res0 |= BIT(39); > + if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, RAS, IMP)) > + res0 |= (HCR_TEA | HCR_TERR); > + if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, LO, IMP)) > + res0 |= HCR_TLOR; > + if (!kvm_has_feat(kvm, ID_AA64MMFR4_EL1, E2H0, IMP)) > + res1 |= HCR_E2H; > + set_sysreg_masks(kvm, HCR_EL2, res0, res1); > + > out: > mutex_unlock(&kvm->arch.config_lock); > > -- > 2.39.2 -- Thanks, Oliver From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2B03C4828D for ; Wed, 7 Feb 2024 10:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WDlCkbJIcrYYhwXyflOraHPOv+6YpsfoOgPI20HtCiw=; b=gGTeS07hTWEu9R FW2DM5Dt3+d5ZOsDZhxAQMkZUc5nVVRJ3tI1ru2d7elQGdCwIbcJcphSRErVsWKFGAdMQ5qARIyxz BN/nqqGM30Cx6PdAaasIZiS+VbeGcAvbj0TtNkgDmW1IPXN4qC3YLinKOaCcnDpwVPG0waIBjAjCA KcHoUQp9YylZ5KGIYICg+WdRvfRTdbTKHuin9EQ6csSd1QdPtEewudVdOaR1h3UrXHfptrHMBemC0 xDIChU1jZMibSSXOOikfimgAFAaknHvtgTjRx0KqRngiLsHDJBHkwZZt5jbFKxlDQbgaG3H3Y2nyq RE0Vtw9lNDO8/pq37qYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXfLn-0000000ANiU-35Jx; Wed, 07 Feb 2024 10:40:19 +0000 Received: from out-181.mta1.migadu.com ([95.215.58.181]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXfLk-0000000ANhH-2gXf for linux-arm-kernel@lists.infradead.org; Wed, 07 Feb 2024 10:40:18 +0000 Date: Wed, 7 Feb 2024 10:40:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707302410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EOXmtPnFnBC290lPG3I2msiOcq62QDPQe0I4UIkLUi4=; b=OVnT1IBvZqREiqu4C7ANpqTXrYLU+JqRJoIk2KmilaUJC+391mgYdDXoi02OI/bkY+iCAR c2TPlSjx32vCnNkp1rkIcZ9MqSW4B9q6cCY5+8+0I7ug9cJ85RSbDJd75GiQdm8Kqo0Ru4 eQhqdIsHYP/Vr7j6Ut6UntGp4/QGcjw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Joey Gouly , Mark Brown Subject: Re: [PATCH v3 04/26] KVM: arm64: nv: Add sanitising to EL2 configuration registers Message-ID: References: <20240205103431.1104133-1-maz@kernel.org> <20240205103431.1104133-5-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240205103431.1104133-5-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_024016_905278_88F4CA43 X-CRM114-Status: UNSURE ( 9.74 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 05, 2024 at 10:34:09AM +0000, Marc Zyngier wrote: > + if (!(__vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS) && > + __vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS))) > + res0 |= (HCR_API | HCR_APK); I think what you probably meant here is _ADDRESS and _GENERIC, right? Of course, this has no actual effect on the code, since we don't allow one without the other. Maybe we can just change KVM's representation to a single flag to avoid this pointless exercise. > + if (!kvm_has_feat(kvm, ID_AA64ISAR0_EL1, TME, IMP)) > + res0 |= BIT(39); > + if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, RAS, IMP)) > + res0 |= (HCR_TEA | HCR_TERR); > + if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, LO, IMP)) > + res0 |= HCR_TLOR; > + if (!kvm_has_feat(kvm, ID_AA64MMFR4_EL1, E2H0, IMP)) > + res1 |= HCR_E2H; > + set_sysreg_masks(kvm, HCR_EL2, res0, res1); > + > out: > mutex_unlock(&kvm->arch.config_lock); > > -- > 2.39.2 -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel