lkml.org 
[lkml]   [2020]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    SubjectRe: [PATCH 5/5] x86/kvm: Add KVM_FEATURE_MSI_EXT_DEST_ID
    Date
    On Mon, Oct 12 2020 at 21:20, David Woodhouse wrote:
    > On Mon, 2020-10-12 at 20:38 +0200, Thomas Gleixner wrote:
    >> Nasty, but way better than what we have now.
    >
    > Want me to send that out in email or is the git tree enough for now?
    >
    > I've cleaned it up a little and fixed a bug in the I/OAPIC error path.

    Mail would be nice once you are confident with the pile.

    > Still not entirely convinced about the apic->apic_id_valid(32768) thing
    > but it should work well enough, and doesn't require exporting any extra
    > state from apic.c that way.

    Yeah, that part is odd.

    I really dislike the way how irq_find_matching_fwspec() works. The 'rc'
    value is actually boolean despite being type 'int' and if 'rc' is not 0
    then it returns the domain even if 'rc' is an error code.

    But that does not allow to return error codes from a domain match() /
    select() callback which is what we really want to express that there is
    something fishy.

    Something like the below perhaps? Needs more thought obviously.

    Marc, any opinion ?

    Thanks,

    tglx

    8<-------------

    arch/x86/kernel/apic/vector.c | 18 ++++++++++++++++++
    include/linux/irqdomain.h | 1 +
    kernel/irq/irqdomain.c | 2 +-
    3 files changed, 20 insertions(+), 1 deletion(-)

    --- a/arch/x86/kernel/apic/vector.c
    +++ b/arch/x86/kernel/apic/vector.c
    @@ -593,6 +593,24 @@ static int x86_vector_alloc_irqs(struct
    return err;
    }

    +struct irq_domain *x86_select_parent_domain(struct irq_fwspec *fwspec)
    +{
    + struct irq_domain *dom;
    +
    + /*
    + * If Interrupt Remapping is enabled then the match function
    + * returns either the remapping domain or an error code if the
    + * device is not registered with the remapping unit.
    + *
    + * If remapping is not enabled, then the function returns NULL.
    + */
    + dom = irq_find_matching_fwspec(fwspec, DOMAIN_BUS_IR);
    + if (dom)
    + return IS_ERR(dom) ? NULL : dom;
    +
    + return x86_vector_domain;
    +}
    +
    #ifdef CONFIG_GENERIC_IRQ_DEBUGFS
    static void x86_vector_debug_show(struct seq_file *m, struct irq_domain *d,
    struct irq_data *irqd, int ind)
    --- a/include/linux/irqdomain.h
    +++ b/include/linux/irqdomain.h
    @@ -85,6 +85,7 @@ enum irq_domain_bus_token {
    DOMAIN_BUS_TI_SCI_INTA_MSI,
    DOMAIN_BUS_WAKEUP,
    DOMAIN_BUS_VMD_MSI,
    + DOMAIN_BUS_IR,
    };

    /**
    --- a/kernel/irq/irqdomain.c
    +++ b/kernel/irq/irqdomain.c
    @@ -395,7 +395,7 @@ struct irq_domain *irq_find_matching_fws
    (h->bus_token == bus_token)));

    if (rc) {
    - found = h;
    + found = rc < 0 ? ERR_PTR(rc) : h;
    break;
    }
    }


    \
     
     \ /
      Last update: 2020-10-13 00:15    [W:4.262 / U:0.716 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site