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 7EFB3C67861 for ; Fri, 5 Apr 2024 13:05:05 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3YBN9BuX948gZTG36ckdYn3jsnpJNDHWoVmOAvIYvGg=; b=cWpT5QN0/rCRTB tRgQtx+L2wv+ouSWpuWaYiri0eVKtjcHLAOVJ+s8Jz4QTl+UE1zbq2FSLOytZbKpBMqwTD3H16Vow TsD/VwQWzaQ8rI8misER6b7kklbeimHY+ZHxeDW3UqqurR0ZNdABcSpTawygAKSk47cu52bNCZMio t3I4x8qrmXZm1juiYLKaaf7VsGw+fw+UUarTxnHF79uvq11OmQ2whcJFWyemuU5ETDd9ZtQMLa3u+ fH80QrHST1INe6YB233AQpMn+DzIgTNvpgrlrVO3AlBLYJ/l6Bm86LEDxJ1sScpkQtnZFJf6GPXM4 7emG3Xj5F59qgWphRyBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsjFY-000000077gI-0c62; Fri, 05 Apr 2024 13:04:56 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsiGB-00000006nX1-33fq for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 12:01:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712318479; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yv0f7+ZooceAuz8ErMSH+4jWIomyiUMNQo0xCMMDiy0=; b=D0dexOdKBC6jWCiRy8El20lKC0hvUVEPKHGa3YlskKLyFLm394fi0LVay/1Cl+TxOlJy6Q NiHPvXg8d8/VLoGLt2B3osg2lT+4+fP0Xb4ISMjCRmUx12AzsktpgPuV4mIL9KJFn0vNOv sFuzrQbj+kiwq343fVA0eG68+ren2pY= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-456-2RIkpDKoOtOnw_FRWnGzfg-1; Fri, 05 Apr 2024 08:01:18 -0400 X-MC-Unique: 2RIkpDKoOtOnw_FRWnGzfg-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-432f160f5d9so18838121cf.0 for ; Fri, 05 Apr 2024 05:01:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712318477; x=1712923277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yv0f7+ZooceAuz8ErMSH+4jWIomyiUMNQo0xCMMDiy0=; b=aWD+U1AuiOs6Ztfizg1WONbDQ1CdLJsNG7dknmz0RQHGCnHvhRIWRsByES8yvR8Z5U N58lHF3NW+c1BrismYucGDgHN5m8zHk3FgZPTsB5LgljkuDk1vTntfmdLcbaZ+bcqi61 MygP1sE40CEVpYUAwZtsqpk7wkMJHIqtkZg7HdTwRXWxdqLFqiKth4NxSYT4XBtGZ072 kxYJjL6XPznHPdGWU+9UBJ950JRIZ7TMzdaoKequJsZGtxjMv/zrojs0taNnJfUylTca dlTUN3sc7d0kXpVqKGGmGNz2KWRHrmPH3d3TdEC2khJ3I1XEShz27QJUJ3vSvz+wbTIY BkvQ== X-Gm-Message-State: AOJu0YzishUW7eJIsRdkGcejMtXcdrWNnpAaVsp2Xkp72/jEjiHxxEp1 sfnOigBKMcs432JQvxjri7FupJCLu/hb8Ymyft8mAhm0i+yRdytDsCGQ26DnxPUkO5ELFbh9D7o 6s4jOeGdIgix5iPRLwK7sSvWsZ5MPgoXJik/ALCs5jAf7jGLakXQKH0K1hZNxnTjpXGbQhBNGcM f+40Zy+x7Bs+q19KBczQv5Znc37WDuL6/35QE4gR28tHtUZ0NEXIxsfw== X-Received: by 2002:ac8:5886:0:b0:434:516a:5486 with SMTP id t6-20020ac85886000000b00434516a5486mr976115qta.21.1712318477287; Fri, 05 Apr 2024 05:01:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhQuEwy17Cph2Q2g7cvwJ6s/aiHUU0/VZ7nyNR44guIaL32ndi6+BiWQVeBBtgC3cEN4G/SQ== X-Received: by 2002:ac8:5886:0:b0:434:516a:5486 with SMTP id t6-20020ac85886000000b00434516a5486mr976080qta.21.1712318476646; Fri, 05 Apr 2024 05:01:16 -0700 (PDT) Received: from rh.redhat.com (p200300c93f4c24001316a1e598258370.dip0.t-ipconnect.de. [2003:c9:3f4c:2400:1316:a1e5:9825:8370]) by smtp.gmail.com with ESMTPSA id fb17-20020a05622a481100b00434383f2518sm679808qtb.87.2024.04.05.05.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:01:16 -0700 (PDT) From: Sebastian Ott To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon Subject: [PATCH 1/4] KVM: arm64: change return value in arm64_check_features() Date: Fri, 5 Apr 2024 14:01:05 +0200 Message-ID: <20240405120108.11844-2-sebott@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405120108.11844-1-sebott@redhat.com> References: <20240405120108.11844-1-sebott@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_050132_370189_029D6DE3 X-CRM114-Status: GOOD ( 16.44 ) 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 arm64_check_features() returns -E2BIG to indicate the register's feature set is a superset of the maximally-allowed register value. The only caller of that function changes this to -EINVAL since that's what userspace expects for invalid register writes. In preparation of adding another caller for arm64_check_features() that would need to do the same conversion just return -EINVAL directly. Signed-off-by: Sebastian Ott --- arch/arm64/kvm/sys_regs.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index c9f4f387155f..131f5b0ca2b9 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1445,7 +1445,7 @@ static s64 kvm_arm64_ftr_safe_value(u32 id, const struct arm64_ftr_bits *ftrp, * considered the safe value regardless For register fields that are not in * writable, only the value in limit is considered the safe value. * - * Return: 0 if all the fields are safe. Otherwise, return negative errno. + * Return: 0 if all the fields are safe. Otherwise, return -EINVAL. */ static int arm64_check_features(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, @@ -1464,7 +1464,7 @@ static int arm64_check_features(struct kvm_vcpu *vcpu, * only safe value is 0. */ if (sysreg_visible_as_raz(vcpu, rd)) - return val ? -E2BIG : 0; + return val ? -EINVAL : 0; ftr_reg = get_arm64_ftr_reg(id); if (!ftr_reg) @@ -1490,12 +1490,12 @@ static int arm64_check_features(struct kvm_vcpu *vcpu, safe_val = kvm_arm64_ftr_safe_value(id, ftrp, f_val, f_lim); if (safe_val != f_val) - return -E2BIG; + return -EINVAL; } /* For fields that are not writable, values in limit are the safe values. */ if ((val & ~mask) != (limit & ~mask)) - return -E2BIG; + return -EINVAL; return 0; } @@ -1840,16 +1840,6 @@ static int set_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, IDREG(vcpu->kvm, id) = val; mutex_unlock(&vcpu->kvm->arch.config_lock); - - /* - * arm64_check_features() returns -E2BIG to indicate the register's - * feature set is a superset of the maximally-allowed register value. - * While it would be nice to precisely describe this to userspace, the - * existing UAPI for KVM_SET_ONE_REG has it that invalid register - * writes return -EINVAL. - */ - if (ret == -E2BIG) - ret = -EINVAL; return ret; } -- 2.42.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel