From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (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 8B3B12D2391 for ; Mon, 20 Oct 2025 13:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965949; cv=none; b=rvzWJczkCW4M5qRgmszZxq+BKuQ5roQsxXPDQOJD/kD0Q5SV75nIMw3wMSno3rmPvPetVUbi3KrnqMg/smmj0iLHcuk+qix3OpIQrFr4GpbQFUmmt/BvVQX1PoFgDU2WlQM2rx1RFEbEwMG+upcL5H+ecNmsVYN6z+2ArcdcQiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965949; c=relaxed/simple; bh=DrL2WwRNEFOK1bJtIv9ky7I7c7G4ou42pOsCGy3RwiM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Wh+bttM7zlGu9qlaJYMl21tp7vTL1H7igTBh59QKNZM0f6cg7yexQ3fhsHPTzTzpeDjwuUNyO0nI++eV0YUC6MR5AJqL27Xeo6P9ZjTD/NVhMDpOOnuAoQhWTHGqAdfn/jpWtLw7l/VYgPZzTJazYbM6Ikn+Uk1XeXmKvFpr8B4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=IN+80p57; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="IN+80p57" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1760965943; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=OBImoBy0givvKDy/jG9fhQjUBUsrZdSED+mmJaxLZFs=; b=IN+80p57Qt2KkZIu09mGlJqerP5W5Ql8Zqtbf2eEIv8P7tJv7G7c539ed2ArukC/ibLLtQcArFDtOwnZPiU2/55mUH4dYHG8I1YpzC07AfJ574qcMB22Wy4gevXBPvpVH4Qh/hzzWBudNa3P7fpUXJUc4LFHgPF4LngbyfVTmHo= Received: from localhost.localdomain(mailfrom:fangyu.yu@linux.alibaba.com fp:SMTPD_---0WqcnIPA_1760965938 cluster:ay36) by smtp.aliyun-inc.com; Mon, 20 Oct 2025 21:12:20 +0800 From: fangyu.yu@linux.alibaba.com To: ajones@ventanamicro.com Cc: alex.williamson@redhat.com, alex@ghiti.fr, anup@brainfault.org, atish.patra@linux.dev, iommu@lists.linux.dev, jgg@nvidia.com, joro@8bytes.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com, robin.murphy@arm.com, tglx@linutronix.de, tjeznach@rivosinc.com, will@kernel.org, zong.li@sifive.com Subject: Re: [RFC PATCH v2 18/18] DO NOT UPSTREAM: RISC-V: KVM: Workaround kvm_riscv_gstage_ioremap() bug Date: Mon, 20 Oct 2025 21:12:18 +0800 Message-Id: <20251020131218.68932-1-fangyu.yu@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20250920203851.2205115-38-ajones@ventanamicro.com> References: <20250920203851.2205115-38-ajones@ventanamicro.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit >Workaround a bug that breaks guest booting with device assignment that >was introduced with commit 9bca8be646e0 ("RISC-V: KVM: Fix pte settings >within kvm_riscv_gstage_ioremap()") The root cause of the guest booting failure is that an HPA is obtained in the kvm_arch_prepare_memory_region. Here [1] might be the correct fixes for this issue. [1] https://lore.kernel.org/linux-riscv/20251020130801.68356-1-fangyu.yu@linux.alibaba.com/T/#u >--- > arch/riscv/kvm/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c >index 525fb5a330c0..994f18b92143 100644 >--- a/arch/riscv/kvm/mmu.c >+++ b/arch/riscv/kvm/mmu.c >@@ -56,7 +56,7 @@ int kvm_riscv_mmu_ioremap(struct kvm *kvm, gpa_t gpa, phys_addr_t hpa, > > end = (gpa + size + PAGE_SIZE - 1) & PAGE_MASK; > pfn = __phys_to_pfn(hpa); >- prot = pgprot_noncached(PAGE_WRITE); >+ prot = pgprot_noncached(__pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_READ | _PAGE_WRITE)); > > for (addr = gpa; addr < end; addr += PAGE_SIZE) { > map.addr = addr; >-- >2.49.0 Thanks, Fangyu