[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f1c8c1c1c091be87dfbc27b9178fc3e6@kernel.org>
Date: Fri, 28 Apr 2023 19:59:18 +0100
From: Marc Zyngier <maz@...nel.org>
To: Yi-De Wu <yi-de.wu@...iatek.com>
Cc: Yingshiuan Pan <yingshiuan.pan@...iatek.com>,
Ze-Yu Wang <ze-yu.wang@...iatek.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jonathan Corbet <corbet@....net>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-arch@...r.kernel.org, linux-mediatek@...ts.infradead.org,
David Bradil <dbrazdil@...gle.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Jade Shih <jades.shih@...iatek.com>,
Miles Chen <miles.chen@...iatek.com>,
Ivan Tseng <ivan.tseng@...iatek.com>,
My Chuang <my.chuang@...iatek.com>,
Shawn Hsiao <shawn.hsiao@...iatek.com>,
PeiLun Suei <peilun.suei@...iatek.com>,
Liju Chen <liju-clr.chen@...iatek.com>
Subject: Re: [PATCH v2 5/7] virt: geniezone: Add irqchip support for virtual
interrupt injection
On 2023-04-28 11:36, Yi-De Wu wrote:
> From: "Yingshiuan Pan" <yingshiuan.pan@...iatek.com>
>
> Enable GenieZone to handle virtual interrupt injection request.
>
> Signed-off-by: Yingshiuan Pan <yingshiuan.pan@...iatek.com>
> Signed-off-by: Yi-De Wu <yi-de.wu@...iatek.com>
> ---
> arch/arm64/geniezone/Makefile | 2 +-
> arch/arm64/geniezone/gzvm_arch.c | 24 ++++++--
> arch/arm64/geniezone/gzvm_arch.h | 11 ++++
> arch/arm64/geniezone/gzvm_irqchip.c | 88 +++++++++++++++++++++++++++++
> drivers/virt/geniezone/gzvm_vm.c | 75 ++++++++++++++++++++++++
> include/linux/gzvm_drv.h | 4 ++
> include/uapi/linux/gzvm.h | 38 ++++++++++++-
> 7 files changed, 235 insertions(+), 7 deletions(-)
> create mode 100644 arch/arm64/geniezone/gzvm_irqchip.c
[...]
> +++ b/arch/arm64/geniezone/gzvm_irqchip.c
> @@ -0,0 +1,88 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2023 MediaTek Inc.
> + */
> +
> +#include <linux/irqchip/arm-gic-v3.h>
> +#include <kvm/arm_vgic.h>
NAK.
There is no way you can rely on anything from KVM in
your own hypervisor code.
> +
> +#include <linux/gzvm.h>
> +#include <linux/gzvm_drv.h>
> +#include "gzvm_arch.h"
> +
> +/**
> + * gzvm_sync_vgic_state() - Check all LRs synced from gz hypervisor
> + *
> + * Traverse all LRs, see if any EOIed vint, notify_acked_irq if any.
> + * GZ does not fold/unfold everytime KVM_RUN, so we have to traverse
> all saved
> + * LRs. It will not takes much more time comparing to fold/unfold
> everytime
> + * GZVM_RUN, because there are only few LRs.
> + */
> +void gzvm_sync_vgic_state(struct gzvm_vcpu *vcpu)
> +{
> +}
> +
> +/* is_irq_valid() - Check the irq number and irq_type are matched */
> +static bool is_irq_valid(u32 irq, u32 irq_type)
> +{
> + switch (irq_type) {
> + case GZVM_IRQ_TYPE_CPU:
> + /* 0 ~ 15: SGI */
> + if (likely(irq <= GZVM_IRQ_CPU_FIQ))
> + return true;
> + break;
> + case GZVM_IRQ_TYPE_PPI:
> + /* 16 ~ 31: PPI */
> + if (likely(irq >= VGIC_NR_SGIS && irq < VGIC_NR_PRIVATE_IRQS))
What happens if I redefine all these macros tomorrow? None of
this code should rely on anything that is *INTERNAL* to KVM.
M.
--
Jazz is not dead. It just smells funny...
Powered by blists - more mailing lists