On Mon, 2018-05-07 at 18:02 +0200, christophe lombard wrote: > > To answer to your questions, here is the timeline in the cxl driver > > 1. call disable_irq() > > 2. call plpar_hcall9() to attach a process element > During this phase, phyp (as described in CAPI PAPR document) > disables the virtual interrupts provided in the process-element- > struct. > Then the partition must use ibm,set-xive to enable the virtual > interrupt source after H_ATTACH_CA_PROCESS completes > successfully.
Ok, this is the breakage. This PAPR API is badly defined, nothing other than the existing interrupt management PAPR calls should affect the enable/disable state of the interrupt The fact that attaching a process element does is a broken design. > 3. call enable_irq() > Before the following patch (genirq: Avoid unnecessary low level > irq function calls) be pushed in mainline, the unmask api > (= ics_rtas_unmask_irq()) was called by default and everything > was ok. > > With this patch, the unmask api is now called only if > IRQD_IRQ_MASKED is set and in our case, it's never done and the > irqs remain masked. > > > So, there is a disconnect between the 'HW' (phyp) state of the > interrupt and the IRQD_IRQ_MASKED flag. > > In the timeline of the cxl driver, the IRQD_IRQ_MASKED flag is never > set. > This flag was not used in enable_irq(), before that the patch "genirq: > Avoid ..." was pushed. So ics_rtas_unmask_irq() was called and > everything was ok. > > Thanks > > > > > > > > > > > > > > > Signed-off-by: Christophe Lombard <clomb...@linux.vnet.ibm.com> > > > > > --- > > > > > drivers/misc/cxl/guest.c | 1 + > > > > > 1 file changed, 1 insertion(+) > > > > > > > > > > diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c > > > > > index f58b4b6c..dc476e1 100644 > > > > > --- a/drivers/misc/cxl/guest.c > > > > > +++ b/drivers/misc/cxl/guest.c > > > > > @@ -389,6 +389,7 @@ static void disable_afu_irqs(struct cxl_context > > > > > *ctx) > > > > > hwirq = ctx->irqs.offset[r]; > > > > > for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) { > > > > > virq = irq_find_mapping(NULL, hwirq); > > > > > + irq_set_status_flags(virq, IRQ_DISABLE_UNLAZY); > > > > > disable_irq(virq); > > > > > } > > > > > }