From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 A0A4830BBB6 for ; Fri, 30 Jan 2026 15:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769788718; cv=none; b=L5e4rYdjZNCkmLzYmfX1FvWZ+lD6asw10HSv9nV64lMWDfv/+clyEJ6n9SqrEw743RKhbEKczRqwA7Sw0EsYvd0X5ywQnZhBAVdc9vIQWDLzrSFxgWj5lkt/H1fUMg4VTZduprC+vYbe/1laZTkHhPqnAEKMXpkzGpQSxgWKq4E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769788718; c=relaxed/simple; bh=JHNaQF/tDX4f6NrSy7kAELk8akXPiqvpv6QvjBz8r8I=; h=Mime-Version:Content-Type:Date:Message-Id:To:From:Subject:Cc: References:In-Reply-To; b=tMDrP5ubouaR29MQ3q4qlsLcHHoEUyBEwCgO0amVryxDBzuvD6c/Z2PmWJUOvKRRRWuVSfpQaXCwMYxDUUZS5SywqTIZYI7ENTW37f2xy6oA6Nq5LKjj5qBaCuJI3dCZsgbWgmERjcu15SMI1mtnm+JTbhjLljUiGxZFQevG4xw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=WrHHYB5I; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Q605g9Sl; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="WrHHYB5I"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Q605g9Sl" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60UAbnLS890982 for ; Fri, 30 Jan 2026 15:58:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lQNZhRVTVABmpgTnG4Zg3cj198URaNvQKUlnGCClzJk=; b=WrHHYB5IUzWk3xSd mLrptX3mVqYwutQLOSwiXhQDrtxyCqpRwXE7pmXSQIcVZbUQ3UZqG95BoFl1cLUD HTgyb5Rjht5SrPoMzWK9ewSHsHjSjBxrHAtRCurs3zg9qAZU4ykYiTOmXSM2BR9W dsFgwrbdg3Rs59TzFLEzQ4HcXl9cwwG7SVPQM3FfrHgGAHs5TRWJd5a49dFZpbhy giU/zPpIAMQKCggL8MRs/Y713kfc8P/ZMn28fVUqbY/RZkFS4IX8jyHaupnarTPP SYDvZec8LT6XzlVCY7kDchqY9m5f8rIndL3rQle4aDC3HcshG19AQr8Q2/cnUe+y jpyktA== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c0gs7tspa-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 30 Jan 2026 15:58:36 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8c71655aa11so679338685a.3 for ; Fri, 30 Jan 2026 07:58:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769788716; x=1770393516; darn=vger.kernel.org; h=in-reply-to:references:cc:subject:from:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lQNZhRVTVABmpgTnG4Zg3cj198URaNvQKUlnGCClzJk=; b=Q605g9Sli7o3GQC1T05Ku+k47c42bcuQhd9g8zqJqpevLD9hKhWW1fDSB11ZXpi26K 1NQes3V4DkTnhciHEguIpPUnU+heEx+N3JFoAAm3DJ+8T2VkDtCrm1uugsmNJs8aREnK 06PgJR0W+q57TV0CZEdnicxnrQZgnaBqbatbJxOIA2fMV9zJne0JxHmCW7FMiIetWvt4 OR55hk/QPrflZsJJM7ZXFFqVIcrRW/6deu085XCXFY/zZ9Yg3XzYiePhZFR+eWRYCXPa bzSCkq/kXXDZyTZGjk4ZKXouJ2QLLVoVM9KTRlhyMBZyrs1cNTmGzv/V7+oVrG93Pcuq ifWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769788716; x=1770393516; h=in-reply-to:references:cc:subject:from:to:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lQNZhRVTVABmpgTnG4Zg3cj198URaNvQKUlnGCClzJk=; b=JZknFUvUyxN+BOr9zsR9/u7Pr03Cyeu9Tt0b6R6jZdzWagihe+hxAic70Dj4beVNeP AlYTEZ8XOqBfuLnYx6iIVCevhMJX9AqK8XZrWyt//LzBUo9RaLhBJ0EKWZ4iPgdmqtiq 8hJSskXKhIAvnX3g+Y3NcrXhplnrDXMH4IW2GT2GBKGdmLQ/f3fdYRtqclrCkWIE7vD1 SGkxfTQUXH9/ZpDWFc6B0dUa4ZVdp7GyrhoSj1YExtpYojB1Crd5FBv59TGFMR+nr7Sc Ufy5x+hmkWlosmL2gIWaacWURH6e2ogqsqkyBeNeGEvgIq/GQSns1hn72za52cgxJ7xr E1Bg== X-Forwarded-Encrypted: i=1; AJvYcCWwf+teZIUy+wVctE6WktUn9uBQiy01ArS3zyDxhfDv+NXXUue8Ng6jRpULViXleDtSa83ZfjDwahohPKk=@vger.kernel.org X-Gm-Message-State: AOJu0Yyi/il2KVo8y8z6nJTU2teVayowAc38SJtye5uvPyVgCi6JTVHr tXCNDawKqC+32W6ofMyJzy+sOtwZDkmPBUAJs9BszGyIPr8846jCEbS8MyJcSw1yNv6n0RegeUW SZ55laqFrGTrYJceJWjr8u4Dkuez98eXzp6ju6tF5tp6+bmm9VDDzU7ANEMulIxBo+bo= X-Gm-Gg: AZuq6aLsdKYfB9aMFSjt1skuPgBdboE5ZcXcSyfwH31uyZdfC2aLtZ2TfjLVXnGp4GG BFQ5Cmr9nDboqEVf6vphG5Dm38W1ESAFVC0CdV5g+SFCR3A4+RyowZiL0ccHuruaWsP4IoG0wxC 8evmUPUCxYeJt5x9CJgPwixQMCOlMSd97Iou13MuY1WUuoOLecO1+12JmcA4L3iwCVLrESJrr9R ku8EvmIOqAkWgmWarDtTFM6ZAbHNeNBTJjBuWsMM8jF3sgKiD1C5x1Wkcg/g/YbNTI0eIBvt0V4 HbkaT/y6+c88LD/8LnTvZ7S727z5w0cRSdkwnIfAyQliQIUC5yJKbH7ax2Dy11UgFo8f9hBV+WT NnhHNI1V57vzqSGK7vzOAX1bWZ/pb241I1SHGqMPhfpgLSFdU X-Received: by 2002:a05:620a:29d2:b0:8c5:36be:41fe with SMTP id af79cd13be357-8c9eb32be89mr429758485a.60.1769788715923; Fri, 30 Jan 2026 07:58:35 -0800 (PST) X-Received: by 2002:a05:620a:29d2:b0:8c5:36be:41fe with SMTP id af79cd13be357-8c9eb32be89mr429754485a.60.1769788715467; Fri, 30 Jan 2026 07:58:35 -0800 (PST) Received: from localhost (ip-86-49-253-11.bb.vodafone.cz. [86.49.253.11]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-482dbd4a5b8sm27030845e9.5.2026.01.30.07.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 07:58:33 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 30 Jan 2026 15:58:32 +0000 Message-Id: To: From: =?utf-8?q?Radim_Kr=C4=8Dm=C3=A1=C5=99?= Subject: Re: [PATCH v3 1/2] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode Cc: , , , , , , , , , , , , , , , References: <20260130132458.16367-1-fangyu.yu@linux.alibaba.com> In-Reply-To: <20260130132458.16367-1-fangyu.yu@linux.alibaba.com> X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTMwMDEyOSBTYWx0ZWRfX0Mky89JOs4NH n4VdqDZS4A04PNOqXT9H4Ia9n/Jk8w+TzZYp9Rb5zUfpBK1h4hn7bTFXiIwsGqXxkleMNFDCGfV zvOVnEQR22ZYUdob5fNBq30NqeZDlXPWHXc0BD0nfZDERRwmYb4T6YZM9Wvbn5RuX57dku3t/iZ RRJU4wxTfGKjTEvSL+kCMUbMMG/urnO3f8rT7Z6V8yTaUpX6sfw9Z+YSG3j/3rfUs6hwFDjwFep 8r/sS9Yxi1z/wBbUFsk9bDECfTmunZYb7TvtLknCcJG9w7HHC9R21K5U3ZTl6OTta5TItNnTPtK j6HeV1szvcaRFhBHysEtbQDs0hPKOSicC/y7bll/BL2xrsQJUhAg76Ppjl0GZtriJhwNYOlqaZi GMARcagzYNpf/zo6qrf359au18sryF4IqNIfF7ym3XFJRHo+NZkhD7BzBUovHweS9d3ZxoQjY67 V2t0cmptpPW7nsVI1uw== X-Proofpoint-ORIG-GUID: SK4JIB5K6Cr1kfa12vLUPXO7X4FmxwF0 X-Proofpoint-GUID: SK4JIB5K6Cr1kfa12vLUPXO7X4FmxwF0 X-Authority-Analysis: v=2.4 cv=UPLQ3Sfy c=1 sm=1 tr=0 ts=697cd52c cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=HFCiZzTCIv7qJCpyeE1rag==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=NEAV23lmAAAA:8 a=SRrdq9N9AAAA:8 a=655hpoqrAi3NGJe9dLIA:9 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-30_02,2026-01-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601300129 2026-01-30T21:24:58+08:00, : >>> From: Fangyu Yu >>> - kvm_info("using %s G-stage page table format\n", str); >>> + kvm_info("Max G-stage page table format %s\n", str); >> >>Fun fact: the ISA doesn't define the same hierarchy for hgatp modes as >>it does for satp modes, so we could have just Sv57x4 and nothing below. >> >>We could do just with a code comment that we're assuming vendors will do >>better, but I'd rather not introduce more assumptions... >>I think the easiest would be to kvm_riscv_gstage_mode_detect() levels in >>reverse and stop on the first one that is not supported. >>(I'll reply with a patch later.) > > Please refer to the discussion here: > https://github.com/riscv/riscv-isa-manual/issues/2208 > If Sv57x4 is implemented, then Sv48x4 and Sv39x4 must also be implemented= . I don't think so, sadly, but we're mostly dealing with technicalities here. As Andrew pointed out: "The H extension itself does not impose this requirement, so technically Sv57x4 without Sv48x4 conforms to the H extension spec." This means it's completely valid to support {Bare, Sv39x4, Sv57x4}. The RVA23 profile imposes additional constraints via Shgatpa: "For each supported virtual memory scheme SvNN supported in satp, the corresponding hgatp SvNNx4 mode must be supported. The hgatp mode Bare must also be supported." The requirement only goes one way, so an RVA23 implementation with just {Bare, Sv39} in satp could support {Bare, Sv39x4, Sv57x4} in hgatp, because RVA23 nor ISA prevent Sv57x4 to be there. Not that I expect any sensible implementation to do this... Btw. do we target only RVA23 with KVM? Thanks.