Patch "RISC-V: KVM: No need to use mask when hart-index-bit is 0" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RISC-V: KVM: No need to use mask when hart-index-bit is 0

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     risc-v-kvm-no-need-to-use-mask-when-hart-index-bit-i.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6f977ad4508099b59eb9bc41bc9cb56204ed6dad
Author: Yong-Xuan Wang <yongxuan.wang@xxxxxxxxxx>
Date:   Mon Apr 15 14:49:04 2024 +0800

    RISC-V: KVM: No need to use mask when hart-index-bit is 0
    
    [ Upstream commit 2d707b4e37f9b0c37b8b2392f91b04c5b63ea538 ]
    
    When the maximum hart number within groups is 1, hart-index-bit is set to
    0. Consequently, there is no need to restore the hart ID from IMSIC
    addresses and hart-index-bit settings. Currently, QEMU and kvmtool do not
    pass correct hart-index-bit values when the maximum hart number is a
    power of 2, thereby avoiding this issue. Corresponding patches for QEMU
    and kvmtool will also be dispatched.
    
    Fixes: 89d01306e34d ("RISC-V: KVM: Implement device interface for AIA irqchip")
    Signed-off-by: Yong-Xuan Wang <yongxuan.wang@xxxxxxxxxx>
    Reviewed-by: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240415064905.25184-1-yongxuan.wang@xxxxxxxxxx
    Signed-off-by: Anup Patel <anup@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/kvm/aia_device.c b/arch/riscv/kvm/aia_device.c
index 0eb689351b7d0..5cd407c6a8e4f 100644
--- a/arch/riscv/kvm/aia_device.c
+++ b/arch/riscv/kvm/aia_device.c
@@ -237,10 +237,11 @@ static gpa_t aia_imsic_ppn(struct kvm_aia *aia, gpa_t addr)
 
 static u32 aia_imsic_hart_index(struct kvm_aia *aia, gpa_t addr)
 {
-	u32 hart, group = 0;
+	u32 hart = 0, group = 0;
 
-	hart = (addr >> (aia->nr_guest_bits + IMSIC_MMIO_PAGE_SHIFT)) &
-		GENMASK_ULL(aia->nr_hart_bits - 1, 0);
+	if (aia->nr_hart_bits)
+		hart = (addr >> (aia->nr_guest_bits + IMSIC_MMIO_PAGE_SHIFT)) &
+		       GENMASK_ULL(aia->nr_hart_bits - 1, 0);
 	if (aia->nr_group_bits)
 		group = (addr >> aia->nr_group_shift) &
 			GENMASK_ULL(aia->nr_group_bits - 1, 0);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux