[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d1e8b55-e404-466b-a2d6-b189de910637@ventanamicro.com>
Date: Mon, 20 Oct 2025 16:47:07 -0300
From: Daniel Henrique Barboza <dbarboza@...tanamicro.com>
To: fangyu.yu@...ux.alibaba.com, ajones@...tanamicro.com
Cc: alex.williamson@...hat.com, alex@...ti.fr, anup@...infault.org,
atish.patra@...ux.dev, iommu@...ts.linux.dev, jgg@...dia.com,
joro@...tes.org, kvm-riscv@...ts.infradead.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
palmer@...belt.com, paul.walmsley@...ive.com, robin.murphy@....com,
tglx@...utronix.de, tjeznach@...osinc.com, will@...nel.org,
zong.li@...ive.com
Subject: Re: [RFC PATCH v2 18/18] DO NOT UPSTREAM: RISC-V: KVM: Workaround
kvm_riscv_gstage_ioremap() bug
Drew,
On 10/20/25 10:12 AM, fangyu.yu@...ux.alibaba.com wrote:
>> 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
This patch fixes the issue we've been seeing with device assignment inside a
kvm guest. I suggest folding it into this series and dropping this workaround
patch in the next version.
Thanks,
Daniel
>
>> ---
>> 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
>
Powered by blists - more mailing lists