[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 for-5.2 3/5] ppc/xive: Introduce dedicated kvm_irqchip_in_
From: |
Greg Kurz |
Subject: |
Re: [PATCH v2 for-5.2 3/5] ppc/xive: Introduce dedicated kvm_irqchip_in_kernel() wrappers |
Date: |
Fri, 7 Aug 2020 11:29:12 +0200 |
On Fri, 7 Aug 2020 09:15:54 +0200
Greg Kurz <groug@kaod.org> wrote:
> On Thu, 6 Aug 2020 19:55:29 +0200
> Cédric Le Goater <clg@kaod.org> wrote:
>
[...]
> > > diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
> > > index 705cf48176fc..aa46e3fcf512 100644
> > > --- a/include/hw/ppc/xive.h
> > > +++ b/include/hw/ppc/xive.h
> > > @@ -161,6 +161,7 @@ typedef struct XiveNotifier XiveNotifier;
> > > typedef struct XiveNotifierClass {
> > > InterfaceClass parent;
> > > void (*notify)(XiveNotifier *xn, uint32_t lisn);
> > > + bool (*in_kernel)(const XiveNotifier *xn);
> > > } XiveNotifierClass;
> > >
> > > /*
> > > @@ -396,6 +397,7 @@ typedef struct XivePresenterClass {
> > > uint8_t nvt_blk, uint32_t nvt_idx,
> > > bool cam_ignore, uint8_t priority,
> > > uint32_t logic_serv, XiveTCTXMatch *match);
> > > + bool (*in_kernel)(const XivePresenter *xptr);
> > > } XivePresenterClass;
> > >
> > > int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx,
> > >
> > >
> >
> > It seems redundant. Can we introduce a new XiveBackend QOM interface
> > which would implement an in_kernel() handler ? and XiveRouter would
> > inherit from it.
> >
>
> Not sure to see how it would help... the XiveRouter type isn't used
> at the locations where we call kvm_irqchip_in_kernel(). Only
> XivePresenter and XiveNotifier...
>
Looking again at xive_source_realize(), I now realize (forgive the pun ;) that
the negative check on kvm_irqchip_in_kernel() is a bit awkward. We usually
do more stuff when we have a KVM backend, not less. The intent seems to be
that the ESB MMIO should point to either I/O sub-region when XIVE is emulated
or to a mmapped subregion when XIVE is backed by a KVM device. This can be
achieved with a container and overlapping sub-regions (prio 0 for emulated,
prio 1 for KVM). And we no longer need to hijack XiveNotifier.
So in the end, we only need the method for XivePresenter.
I'll cook a v3.
> > C.
> >
> >
> >
> >
> >
>