KVM/riscv fixes for 6.1, take #1
- Fix compilation without RISCV_ISA_ZICBOM - Fix kvm_riscv_vcpu_timer_pending() for Sstc -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEZdn75s5e6LHDQ+f/rUjsVaLHLAcFAmNSTeoACgkQrUjsVaLH LAcSLhAAkiyDspNr5mT7SQALkixO6bVRSnDi+0Lt1+8/x4pCLoo5hGh8ugUu/vp+ /cIeeJMlBOb7FWBUiwU6of8WcZG8Ivl4BBe+tA6Ah00oFuDac9j1tht2MyvEmxrq 0hPqM6/5Ij3OaOYmApLLRU3zR2EM+AF1DxrBZ7PiTzdwRzTclAb2NAoWRDZVrw85 /e/k79heOqg3vlv/N3+8+0hgPoG+ttcs9vVvEyF//EvpwcZI4jtuxC+AXzGUZ2lh ztfrNgLR8EcQQVHvj+Q279iRlYGYFJe7ieOOEbiUdoUDTl9BvPeqkOklb3zfYrOH KL8WBnIPOMhGn5IOmGx6nucnElnpB4sR9wEZWp5hPXG5zJ9FG/AKnEqELgUbCfqk yORjVrDFCFuEnDr0cTneW1c3vKBBoX4Vtt/YL50SsOn6BC6xMhNzn9cOC/2k+knp BwP/NyHSsQxuQBKvYNkAzJPd1mNb186KHKmnP9siwCgaSSvTowToFU8EFXAm5JXY EjQ1CSpjyqoYaOVHmXlFrD3ez+N0AMSo0ZqPjuLcvWeOQnzOuORaFO6jt0PEQAV+ o0s/V76JzHTrX9RQDKAQ6B7F99GTuNvP3ejz16QrtJzHiwAAQEN3EYYkt7AeRqWA H1zg4KViTG6zH6cyWel/Zv4db8EKmAaA/IiJbUTskN/UiJFgYqg= =fm0r -----END PGP SIGNATURE----- Merge tag 'kvm-riscv-fixes-6.1-1' of https://github.com/kvm-riscv/linux into HEAD KVM/riscv fixes for 6.1, take #1 - Fix compilation without RISCV_ISA_ZICBOM - Fix kvm_riscv_vcpu_timer_pending() for Sstc
This commit is contained in:
Коммит
21e6075974
|
@ -42,16 +42,8 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
|
|
||||||
/*
|
|
||||||
* The T-Head CMO errata internally probe the CBOM block size, but otherwise
|
|
||||||
* don't depend on Zicbom.
|
|
||||||
*/
|
|
||||||
extern unsigned int riscv_cbom_block_size;
|
extern unsigned int riscv_cbom_block_size;
|
||||||
#ifdef CONFIG_RISCV_ISA_ZICBOM
|
|
||||||
void riscv_init_cbom_blocksize(void);
|
void riscv_init_cbom_blocksize(void);
|
||||||
#else
|
|
||||||
static inline void riscv_init_cbom_blocksize(void) { }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_RISCV_DMA_NONCOHERENT
|
#ifdef CONFIG_RISCV_DMA_NONCOHERENT
|
||||||
void riscv_noncoherent_supported(void);
|
void riscv_noncoherent_supported(void);
|
||||||
|
|
|
@ -45,6 +45,7 @@ int kvm_riscv_vcpu_timer_deinit(struct kvm_vcpu *vcpu);
|
||||||
int kvm_riscv_vcpu_timer_reset(struct kvm_vcpu *vcpu);
|
int kvm_riscv_vcpu_timer_reset(struct kvm_vcpu *vcpu);
|
||||||
void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu);
|
void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu);
|
||||||
void kvm_riscv_guest_timer_init(struct kvm *kvm);
|
void kvm_riscv_guest_timer_init(struct kvm *kvm);
|
||||||
|
void kvm_riscv_vcpu_timer_sync(struct kvm_vcpu *vcpu);
|
||||||
void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu);
|
void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu);
|
||||||
bool kvm_riscv_vcpu_timer_pending(struct kvm_vcpu *vcpu);
|
bool kvm_riscv_vcpu_timer_pending(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
|
|
|
@ -708,6 +708,9 @@ void kvm_riscv_vcpu_sync_interrupts(struct kvm_vcpu *vcpu)
|
||||||
clear_bit(IRQ_VS_SOFT, &v->irqs_pending);
|
clear_bit(IRQ_VS_SOFT, &v->irqs_pending);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sync-up timer CSRs */
|
||||||
|
kvm_riscv_vcpu_timer_sync(vcpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_riscv_vcpu_set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq)
|
int kvm_riscv_vcpu_set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq)
|
||||||
|
|
|
@ -320,6 +320,21 @@ void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu)
|
||||||
kvm_riscv_vcpu_timer_unblocking(vcpu);
|
kvm_riscv_vcpu_timer_unblocking(vcpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kvm_riscv_vcpu_timer_sync(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
struct kvm_vcpu_timer *t = &vcpu->arch.timer;
|
||||||
|
|
||||||
|
if (!t->sstc_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if defined(CONFIG_32BIT)
|
||||||
|
t->next_cycles = csr_read(CSR_VSTIMECMP);
|
||||||
|
t->next_cycles |= (u64)csr_read(CSR_VSTIMECMPH) << 32;
|
||||||
|
#else
|
||||||
|
t->next_cycles = csr_read(CSR_VSTIMECMP);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu)
|
void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
struct kvm_vcpu_timer *t = &vcpu->arch.timer;
|
struct kvm_vcpu_timer *t = &vcpu->arch.timer;
|
||||||
|
@ -327,13 +342,11 @@ void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu)
|
||||||
if (!t->sstc_enabled)
|
if (!t->sstc_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t = &vcpu->arch.timer;
|
/*
|
||||||
#if defined(CONFIG_32BIT)
|
* The vstimecmp CSRs are saved by kvm_riscv_vcpu_timer_sync()
|
||||||
t->next_cycles = csr_read(CSR_VSTIMECMP);
|
* upon every VM exit so no need to save here.
|
||||||
t->next_cycles |= (u64)csr_read(CSR_VSTIMECMPH) << 32;
|
*/
|
||||||
#else
|
|
||||||
t->next_cycles = csr_read(CSR_VSTIMECMP);
|
|
||||||
#endif
|
|
||||||
/* timer should be enabled for the remaining operations */
|
/* timer should be enabled for the remaining operations */
|
||||||
if (unlikely(!t->init_done))
|
if (unlikely(!t->init_done))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* Copyright (C) 2017 SiFive
|
* Copyright (C) 2017 SiFive
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/of.h>
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
@ -86,3 +87,40 @@ void flush_icache_pte(pte_t pte)
|
||||||
flush_icache_all();
|
flush_icache_all();
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MMU */
|
#endif /* CONFIG_MMU */
|
||||||
|
|
||||||
|
unsigned int riscv_cbom_block_size;
|
||||||
|
EXPORT_SYMBOL_GPL(riscv_cbom_block_size);
|
||||||
|
|
||||||
|
void riscv_init_cbom_blocksize(void)
|
||||||
|
{
|
||||||
|
struct device_node *node;
|
||||||
|
unsigned long cbom_hartid;
|
||||||
|
u32 val, probed_block_size;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
probed_block_size = 0;
|
||||||
|
for_each_of_cpu_node(node) {
|
||||||
|
unsigned long hartid;
|
||||||
|
|
||||||
|
ret = riscv_of_processor_hartid(node, &hartid);
|
||||||
|
if (ret)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* set block-size for cbom extension if available */
|
||||||
|
ret = of_property_read_u32(node, "riscv,cbom-block-size", &val);
|
||||||
|
if (ret)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!probed_block_size) {
|
||||||
|
probed_block_size = val;
|
||||||
|
cbom_hartid = hartid;
|
||||||
|
} else {
|
||||||
|
if (probed_block_size != val)
|
||||||
|
pr_warn("cbom-block-size mismatched between harts %lu and %lu\n",
|
||||||
|
cbom_hartid, hartid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (probed_block_size)
|
||||||
|
riscv_cbom_block_size = probed_block_size;
|
||||||
|
}
|
||||||
|
|
|
@ -8,13 +8,8 @@
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-map-ops.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/of.h>
|
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
|
|
||||||
unsigned int riscv_cbom_block_size;
|
|
||||||
EXPORT_SYMBOL_GPL(riscv_cbom_block_size);
|
|
||||||
|
|
||||||
static bool noncoherent_supported;
|
static bool noncoherent_supported;
|
||||||
|
|
||||||
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
|
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
|
||||||
|
@ -77,42 +72,6 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
|
||||||
dev->dma_coherent = coherent;
|
dev->dma_coherent = coherent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_RISCV_ISA_ZICBOM
|
|
||||||
void riscv_init_cbom_blocksize(void)
|
|
||||||
{
|
|
||||||
struct device_node *node;
|
|
||||||
unsigned long cbom_hartid;
|
|
||||||
u32 val, probed_block_size;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
probed_block_size = 0;
|
|
||||||
for_each_of_cpu_node(node) {
|
|
||||||
unsigned long hartid;
|
|
||||||
|
|
||||||
ret = riscv_of_processor_hartid(node, &hartid);
|
|
||||||
if (ret)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* set block-size for cbom extension if available */
|
|
||||||
ret = of_property_read_u32(node, "riscv,cbom-block-size", &val);
|
|
||||||
if (ret)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!probed_block_size) {
|
|
||||||
probed_block_size = val;
|
|
||||||
cbom_hartid = hartid;
|
|
||||||
} else {
|
|
||||||
if (probed_block_size != val)
|
|
||||||
pr_warn("cbom-block-size mismatched between harts %lu and %lu\n",
|
|
||||||
cbom_hartid, hartid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (probed_block_size)
|
|
||||||
riscv_cbom_block_size = probed_block_size;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void riscv_noncoherent_supported(void)
|
void riscv_noncoherent_supported(void)
|
||||||
{
|
{
|
||||||
WARN(!riscv_cbom_block_size,
|
WARN(!riscv_cbom_block_size,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче