From patchwork Wed Feb 14 10:15:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 200888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1111775dyb; Wed, 14 Feb 2024 02:16:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVf+knMqt8lfIB6zRIvl2wR/4eXPAi4OIeqkyP6MEJH8gPVZx6XCJg+ugr7WY8cvQrJqi88k+dyeUFFe9yiC1aEzmreKg== X-Google-Smtp-Source: AGHT+IEjeIudy/5Kfhi9/nnDGfJCqJwAfmgi7Yf352moMGOkAkWjTrEsHIpYS0lYRA1hEx2sNKrl X-Received: by 2002:a25:84d2:0:b0:dcc:f6e2:44d0 with SMTP id x18-20020a2584d2000000b00dccf6e244d0mr2002543ybm.37.1707905813209; Wed, 14 Feb 2024 02:16:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707905813; cv=pass; d=google.com; s=arc-20160816; b=zY7LOwL9N7hXMFbHNGIjqEyvDpceeaq0ka1REItunNQ/6W5ruzw1JGR4i++YYyYZAe uYmTufv6ZzD0NbrIPlz2ppWCYvTfAiwO/eTMl8mjdbeZklgpqtgtYHqA9XVmoyFMpC9s tIJqMDoy/DOMv03l23Z4r3RknXOzEivQDx0VKbZdLp4TEZE2EVVA1PhAmHlyhMzN0MUb CcNaSYkes7hYJe4U8skfJ1JtK3vzMTjcIqucrFrs3WwjU6aiYVw+mUdOmRjdMkG0ukv/ zuA2Robq4TgwiDd0eI6ib6Jdm1BTda4YMsKpVbouf/jseKCBSZzlY/eesWBxce/l0DYL zbCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bGRgT0divJ/KD2WyBItPZAmrgw48yLvLyea+cSkDaXs=; fh=kYV5blxIlzhvxacf6MeoneQCnFpBQu8lHV2sHdvDEP4=; b=NR6rRm9+jW3N/LvvO0JHosL9elSlIWJXBuHCs2z1tfFOi8A2CdokJIvdEKFER+eYOF sN0xFTr5eXr7tFn1msoe1OweZsrMjx0c2wsCHVx5x4qI5dgRwe/ihQ7wVEIufkLGBbD/ QhxVK2sAATLNlqmg4wsC2iqx8i4cGMqGhqwcAjYIl8xfuXmwDOTuSA/FyPUgWMAn/T2G 6gIdUdpnRjl9Ec15TXhflsWOp9UFoCTSVZAeVKUcBZ1bYC81oK6ASUr87S0ELsjT7mc7 Hp/CjfpRIiXSjq/4zNqLz/QseN3bYtYWGIpzI6lxnlEoYhwAxNWJqoKkOr1gPfgJwk/d Vl3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=GlwHXq5K; arc=pass (i=1 spf=pass spfdomain=xen0n.name dkim=pass dkdomain=xen0n.name); spf=pass (google.com: domain of linux-kernel+bounces-65032-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65032-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCW1Ma1zWMXN5Shikv79elleW5wXeGvbDzIeWW60ckc/VZfisoFmIVU2YpIm4dTD450liAuh4vY+mET6OoeadHExMh42FQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y9-20020a05620a09c900b00785d9bbb481si5808084qky.627.2024.02.14.02.16.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 02:16:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65032-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=GlwHXq5K; arc=pass (i=1 spf=pass spfdomain=xen0n.name dkim=pass dkdomain=xen0n.name); spf=pass (google.com: domain of linux-kernel+bounces-65032-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65032-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 00D011C24CF3 for ; Wed, 14 Feb 2024 10:16:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB0FB18057; Wed, 14 Feb 2024 10:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xen0n.name header.i=@xen0n.name header.b="GlwHXq5K" Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) (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 EC7B6171AC; Wed, 14 Feb 2024 10:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.28.160.31 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707905776; cv=none; b=FIODYYogxAa11CEkW/fGtmx/kKMzXlz0nmGQ8wqsgrc04OO0eAjNW8TR3DwRdcbMj9u245URdGWhzCYHnJ6uE3gwgM/AmA3R2jjdni6RG2MzLgZVDEA1GtI35FqUVL3l6F/Ll1MmoZizonbGOAJ94gn1bET+Ml/YuQe7nIpppIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707905776; c=relaxed/simple; bh=eTiNyXEgBPCIo0Ta8sYgjRV8p1Xz0hDcVMygIqs3U3E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B5mwd8xgekWIEmHy+vF+v+ucle1Ufa2ZiCOtLm86cDh0gNHTttCFWe9V6N8fd82yIsaJo9lcyFREDdIqaio30wMzkjTrm9xQhirtYjEwxr5sJRAEUBCqP8s55BKeWuMj3q9yBH3mO5cBTfkDewuYUkki7LAIPGZsCeDGPm2PXYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xen0n.name; spf=pass smtp.mailfrom=xen0n.name; dkim=pass (1024-bit key) header.d=xen0n.name header.i=@xen0n.name header.b=GlwHXq5K; arc=none smtp.client-ip=115.28.160.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xen0n.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xen0n.name DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1707905769; bh=eTiNyXEgBPCIo0Ta8sYgjRV8p1Xz0hDcVMygIqs3U3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GlwHXq5KtlJN3WjzDugZTkyJEy5LHE+ExYx073zzj48EYrqsL7zgxjG0jH/CXdUWu lHC5BxTxuznnRWa29bxkSyDY9QBTn3MlyULKk31DvSXmHgOaImFsYVGo+Dmwyixr+h HhHqPrIQO+kYbav4MpoP9qcNYRLyGihzdZ4frvdI= Received: from ld50.lan (unknown [IPv6:240e:388:8d00:6500:5531:eef6:1274:cebe]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 9843160562; Wed, 14 Feb 2024 18:16:09 +0800 (CST) From: WANG Xuerui To: Paolo Bonzini , Huacai Chen Cc: Tianrui Zhao , Bibo Mao , kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, WANG Xuerui Subject: [PATCH for-6.8 5/5] KVM: LoongArch: Clean up comments of _kvm_get_cpucfg_mask and kvm_check_cpucfg Date: Wed, 14 Feb 2024 18:15:57 +0800 Message-ID: <20240214101557.2900512-6-kernel@xen0n.name> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214101557.2900512-1-kernel@xen0n.name> References: <20240214101557.2900512-1-kernel@xen0n.name> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790869045971437671 X-GMAIL-MSGID: 1790869045971437671 From: WANG Xuerui Remove comments that are merely restatement of the code nearby, and paraphrase the rest so they read more natural for English speakers (that lack understanding of Chinese grammar). No functional changes. Signed-off-by: WANG Xuerui --- arch/loongarch/kvm/vcpu.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index 9e108ffaba30..ff51d6ba59aa 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -302,20 +302,14 @@ static int _kvm_get_cpucfg_mask(int id, u64 *v) { switch (id) { case 2: - /* Return CPUCFG2 features which have been supported by KVM */ + /* CPUCFG2 features unconditionally supported by KVM */ *v = CPUCFG2_FP | CPUCFG2_FPSP | CPUCFG2_FPDP | CPUCFG2_FPVERS | CPUCFG2_LLFTP | CPUCFG2_LLFTPREV | CPUCFG2_LAM; - /* - * If LSX is supported by CPU, it is also supported by KVM, - * as we implement it. - */ + /* If LSX is supported by the host, then it is also supported by KVM */ if (cpu_has_lsx) *v |= CPUCFG2_LSX; - /* - * if LASX is supported by CPU, it is also supported by KVM, - * as we implement it. - */ + /* Same with LASX */ if (cpu_has_lasx) *v |= CPUCFG2_LASX; @@ -336,21 +330,23 @@ static int kvm_check_cpucfg(int id, u64 val) switch (id) { case 2: - /* CPUCFG2 features checking */ if (val & ~mask) - /* The unsupported features should not be set */ + /* Unsupported features should not be set */ return -EINVAL; if (!(val & CPUCFG2_LLFTP)) - /* The LLFTP must be set, as guest must has a constant timer */ + /* Guests must have a constant timer */ return -EINVAL; if ((val & CPUCFG2_FP) && (!(val & CPUCFG2_FPSP) || !(val & CPUCFG2_FPDP))) - /* Single and double float point must both be set when enable FP */ + /* Single and double float point must both be set when FP is enabled */ return -EINVAL; if ((val & CPUCFG2_LSX) && !(val & CPUCFG2_FP)) - /* FP should be set when enable LSX */ + /* LSX is architecturally defined to imply FP */ return -EINVAL; if ((val & CPUCFG2_LASX) && !(val & CPUCFG2_LSX)) - /* LSX, FP should be set when enable LASX, and FP has been checked before. */ + /* + * LASX is architecturally defined to imply LSX and FP + * FP is checked just above + */ return -EINVAL; return 0; default: