On 13.11.23 18:35, Oleksandr Tyshchenko wrote:
On 16.10.23 09:28, Juergen Gross wrote: Hello Juergen.The helper functions type_from_irq() and cpu_from_irq() are just one line functions used only internally. Open code them where needed. At the same time modify and rename get_evtchn_to_irq() to return a struct irq_info instead of the IRQ number. Signed-off-by: Juergen Gross <[email protected]>[snip]@@ -1181,15 +1172,16 @@ static int bind_evtchn_to_irq_chip(evtchn_port_t evtchn, struct irq_chip *chip, { int irq; int ret; + struct irq_info *info;if (evtchn >= xen_evtchn_max_channels())return -ENOMEM;I assume this check is called here (*before* holding a lock) by intention, as evtchn_to_info() below contains the same check.
Yes.
mutex_lock(&irq_mapping_update_lock); - irq = get_evtchn_to_irq(evtchn);+ info = evtchn_to_info(evtchn) > - if (irq == -1) { + if (!info) { irq = xen_allocate_irq_dynamic(); if (irq < 0) goto out; @@ -1212,8 +1204,8 @@ static int bind_evtchn_to_irq_chip(evtchn_port_t evtchn, struct irq_chip *chip, */ bind_evtchn_to_cpu(evtchn, 0, false); } else { - struct irq_info *info = info_for_irq(irq); - WARN_ON(info == NULL || info->type != IRQT_EVTCHN); + WARN_ON(info->type != IRQT_EVTCHN); + irq = info->irq; }This hunk doesn't apply clearly to the latest state, because of "9e90e58c11b7 xen: evtchn: Allow shared registration of IRQ handers" went in. Please rebase. With that: Reviewed-by: Oleksandr Tyshchenko <[email protected]>
Thanks, Juergen
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature
